News:

Wondering if this will always be free?  See why free is better.

Main Menu

Site Integration Mod

Started by live627, April 29, 2008, 07:45:20 PM

Previous topic - Next topic

Nathaniel

Not sure about that error, its possible that you tried to add a file/action include with the same name as one that is already in the system (although that shouldn't have caused any errors). I will have a look into it. You shouldn't have to overwrite any source files. ;)

Just a few questions: ;)
Which version of SMF do you have?
Where are you receiving that error?
SMF Friend (Former Support Specialist) | SimplePortal Developer
My SMF Mods | SimplePortal

"Quis custodiet ipsos custodes?" - Who will Guard the Guards?

Please don't send me ANY support related PMs. I will just delete them.

dwd2000

#201
Quote from: dwd2000 on August 15, 2008, 02:40:37 AM
Quote from: LHVWB on August 15, 2008, 02:13:38 AM
@dwd2000,
It really depends on how huge the scripts are, if you are talking about integrating a script that normally requires its own folder on your website, and has 40 or more parts to it, such as a forum, CMS, or etc. then it probably wouldn't work. It also depends, if you are using your own member system with the scripts, or if you want to use the SMF member system. However, if you are merely trying to integrate a few relatively small scripts then it should be possible.

If you are trying to integrate huge scripts then you should ask about them in this forum:
http://www.simplemachines.org/community/index.php?board=33.0

Yes, each script has its own folder.
No, it's not like a CMS.
I would use the forums that are included with SMF.
If it's possible, I would use the SMF membership system.
Script examples:
Banner exchange, link exchange, web ring, etc.

Each script has it's own CSS, etc., so I could see that as a problem. (unless I want to go through every script and make the changes)

I have also posted this as a mod request, hoping someone might develop website promotion mods for SMF.

Thanks for your reply.

Tried integrating the scripts, but was very complicated. The main page for the script would work great, but the internal links for the script wouldn't. I think I would have to change all the internal links to "action=whatever" and incorporate each section into the integration. I read an earlier post where you suggested using iframes. Tried it and works great. The only downfall is that people need to sign into each section separately. I can live with that.

If anyone wants to look: http://www.ultimatewebring.com
I've added a web ring, link exchange, and a plug board to the site. (so far)

OOOOPS - Forgot to set permissions for guests, etc. It's done now.
30 years ago I was young and foolish.
Now I'm just young.

DAMMIT JIM...I'M A TWEAKER...NOT A CODER!!!

Dave's Games

Dret

Hi to all...

I saw the new version of this fantastic Mod (settings for permissions in easy way!!)....

But... don't seems actually working on new 1.1.6...!!!  :( :-[

Is planned an upgrade... in short time??

Thanks a lot...!!
Bye!

Dret.

Nathaniel

@dwd2000,
It looks good. :)

@Dret,
I have now updated it for SMF 2 Beta 4.0 and SMF 1.1.6, it should now install properly.
SMF Friend (Former Support Specialist) | SimplePortal Developer
My SMF Mods | SimplePortal

"Quis custodiet ipsos custodes?" - Who will Guard the Guards?

Please don't send me ANY support related PMs. I will just delete them.

steph1987

#204
If anyone could help me with this it would be greatly appreciated

The mod works fine, absolutely fantastic mod and gives me the chance to create everything i want.....but

as soon as i log off admin and i go to guest status, i cant access those pages, im running the musiconica theme

I want to make it so all pages can be accessed by guests/mods/admin/whoever

I know u have to insert or modify some sort of code but i dont understand it well, is there a simple code i can paste somewhere, or search for something and change it?

thanks again, and congrats to the author for making the best smf mod around

Nathaniel

@steph1987,
Have you set-up the 'Permissions' setting for your Included Files/Actions in the admin area? If you click on the 'manage' link next to each file/action then you can change the permissions, by default only admin can view included files/actions.
I am glad that you like the mod. :)

SMF Friend (Former Support Specialist) | SimplePortal Developer
My SMF Mods | SimplePortal

"Quis custodiet ipsos custodes?" - Who will Guard the Guards?

Please don't send me ANY support related PMs. I will just delete them.

steph1987

found the problem, it doesnt like my spaces, ive got thousands of pages all with links with spaces in it. Theres no possible way to change permissions on names with spaces is there?? or make every file default to guests being able to view it instead of just admin?
'

Nathaniel

No, not easily. The reason that it doesn't allow spaces in included file/action names, is because the $_POST method doesn't support them.

This edit should work:
Find this code ('sources/LoadFile.php'):
   //   Check permissions before we even load anything.
   if(!allowedTo("SiteIntegration:".$context['current_action']))
   {
      //   If they are a guest then show a login screen.
      if($user_info['is_guest']
      //   Also make sure that the correct setting has been check to enable redirecting of guests to a login screen.
      && isset($modSettings['SiteIntegrationMod_badpermissions_guestlogin'])
      && $modSettings['SiteIntegrationMod_badpermissions_guestlogin'])
      {
         //   Show the login page.
         require_once($sourcedir."/LogInOut.php");
         Login();
         //   Set the url so that when the user logs in, they will be redirected back to the correct action.
         $_SESSION['login_url'] = $boardurl . "/index.php?action=".$context['current_action'];
      }
      //   Other wise they are a member and we will send them to the setable permissions error page.
      elseif(isset($modSettings['SiteIntegrationMod_failed_permissions_action']))
         redirectexit("action=".$modSettings['SiteIntegrationMod_failed_permissions_action']);
         
      //   Can't be bothered mucking around with this scumbag, send them straight to the board home.
      else
         redirectexit();
     
      //   Break this function to avoid any annouying errors.
      return false;
   }


Replace with this code:
/*   //   Check permissions before we even load anything.
   if(!allowedTo("SiteIntegration:".$context['current_action']))
   {
      //   If they are a guest then show a login screen.
      if($user_info['is_guest']
      //   Also make sure that the correct setting has been check to enable redirecting of guests to a login screen.
      && isset($modSettings['SiteIntegrationMod_badpermissions_guestlogin'])
      && $modSettings['SiteIntegrationMod_badpermissions_guestlogin'])
      {
         //   Show the login page.
         require_once($sourcedir."/LogInOut.php");
         Login();
         //   Set the url so that when the user logs in, they will be redirected back to the correct action.
         $_SESSION['login_url'] = $boardurl . "/index.php?action=".$context['current_action'];
      }
      //   Other wise they are a member and we will send them to the setable permissions error page.
      elseif(isset($modSettings['SiteIntegrationMod_failed_permissions_action']))
         redirectexit("action=".$modSettings['SiteIntegrationMod_failed_permissions_action']);
         
      //   Can't be bothered mucking around with this scumbag, send them straight to the board home.
      else
         redirectexit();
     
      //   Break this function to avoid any annouying errors.
      return false;
   }
*/


Please note, that by commenting out that code (you could remove it as well), you are allowing anyone to see any of your included pages, no matter their permissions.
SMF Friend (Former Support Specialist) | SimplePortal Developer
My SMF Mods | SimplePortal

"Quis custodiet ipsos custodes?" - Who will Guard the Guards?

Please don't send me ANY support related PMs. I will just delete them.

steph1987

Wow it worked, im jumping up and down. Wooohooooooooooo

Thank you soooo much, i mean u really went out of ur way to help me, im very thankful :)

Dret

Quote from: LHVWB on September 10, 2008, 01:24:26 AM
@dwd2000,
It looks good. :)

@Dret,
I have now updated it for SMF 2 Beta 4.0 and SMF 1.1.6, it should now install properly.

Thanks a lot....!!
Bye.

Dret!

omsharma

i am using ur mod. it worked well upto integrating the external webpages. but my problem starts here.
i want to integrate a web form that allows uploading files to server either by normal client upload or via http fetch and also it should be only accessible to global moderators. i hav integrated the script files. but when im trying to upload the files, it fails to upload. plz tell me whether its possible to use this form using this mod or not. i hav also chmod the upload folders with full permission.

Nathaniel

@omsharma,
I am not sure about that issue. I can't think of any reasons why a script like that wouldn't work within SMF, because I don't now anything about the script that you are trying to use.

I can only recommend that you make sure that any urls are correct for your forum and that your script works fine outside of SMF. I may be able to help fix the issue if you can post your code.

About the permissions, make sure that you have set them up in the admin area. You should be able to do it for each membergroup when you manage the included file/action.
SMF Friend (Former Support Specialist) | SimplePortal Developer
My SMF Mods | SimplePortal

"Quis custodiet ipsos custodes?" - Who will Guard the Guards?

Please don't send me ANY support related PMs. I will just delete them.

omsharma

one more problem i hav. when i open that integrated page it shows the full directory structure. how can i avoid my script from showing the full directory structure.... i hav kept my index.php and httpup.php files inside a folder named "rapid" inside smf root directory.

Nathaniel

You can put in place a 'dummy', 'index.php' or 'index.html' file so that they can't view the directory structure of the folder. If you want, you can copy the 'index.php' file from your 'sources' directory, which should try to redirect them back to your forum.

You can also put this code at the start of those files, to stop them from being accessed from outside of SMF:
<?php
if (!defined('SMF'))
   die(
'Hacking attempt...');
?>


Your issue may be that this mod won't add any files called 'index.php' to its list of included action/files so they won't be added. Try renaming them, if this is the issue.
SMF Friend (Former Support Specialist) | SimplePortal Developer
My SMF Mods | SimplePortal

"Quis custodiet ipsos custodes?" - Who will Guard the Guards?

Please don't send me ANY support related PMs. I will just delete them.

GamersGoop

I must be dumb... But I can't find the code anywhere...

What code would I put into one of my php files to display "online users, online today, online now" on one of them? Kind of like TinyPortal has.

Thanks, and keep up the good work.

Nathaniel

The code below should work, although it has more fields than you want. If you want to edit the appearance then you can edit the outputed html code near the bottom. I can help you if you can give me a more detail explanation of what you want.

<?php
   
global $scripturl$db_prefix$user_info$txt$settings$online$modSettings;

   
$result db_query("
      SELECT
         lo.ID_MEMBER, lo.logTime, lo.url, mem.realName, mem.memberName, mem.showOnline,
         mg.onlineColor, mg.ID_GROUP
      FROM 
{$db_prefix}log_online AS lo
         LEFT JOIN 
{$db_prefix}members AS mem ON (mem.ID_MEMBER = lo.ID_MEMBER)
         LEFT JOIN 
{$db_prefix}membergroups AS mg ON (mg.ID_GROUP = IF(mem.ID_GROUP = 0, mem.ID_POST_GROUP, mem.ID_GROUP))"__FILE____LINE__);

   
$online['users'] = array();
   
$online['guests'] = 0;
   
$online['hidden'] = 0;
   
$online['buddies'] = 0;
    
$online['spiders'] = array();
   
$online['num_spiders'] = 0;   
   
$show_buddies = !empty($user_info['buddies']);

   while (
$row mysql_fetch_assoc($result))
   {
      if (empty(
$row['realName']))
      {
         
// Get the request parameters..
         
$actions = @unserialize($row['url']);
         
         
// Is a spider?
         
$is_spider ob_googlebot_getAgent($actions['USER_AGENT'], $spider_name$agent);
         
         if (!
$is_spider)
            
$context['num_guests']++;
         else
         {
            
$context['num_spiders']++;
            
            if (
$modSettings['ob_googlebot_display_agent'])
               
$spider_name $agent;
            
            if (
$modSettings['ob_googlebot_count_all_instances'] && $modSettings['ob_googlebot_display_all_instances'])
               
$context['spiders'][] = $spider_name;
            else
               
$context['spiders'][$agent] = $spider_name;
         }
         
         continue;
      }
      elseif (!empty(
$row['showOnline']) || allowedTo('moderate_forum'))
      {
         
// Some basic color coding...
         
if (!empty($row['onlineColor']))
            
$link '<a href="' $scripturl '?action=profile;u=' $row['ID_MEMBER'] . '" style="color: ' $row['onlineColor'] . ';">' $row['realName'] . '</a>';
         else
            
$link '<a href="' $scripturl '?action=profile;u=' $row['ID_MEMBER'] . '">' $row['realName'] . '</a>';

         
// Bold any buddies.
         
if ($show_buddies && in_array($row['ID_MEMBER'], $user_info['buddies']))
         {
            
$online['buddies']++;
            
$link '<b>' $link '</b>';
         }

         
$online['users'][$row['logTime'] . $row['memberName']] = array(
            
'id' => $row['ID_MEMBER'],
            
'username' => $row['memberName'],
            
'name' => $row['realName'],
            
'group' => $row['ID_GROUP'],
            
'href' => $scripturl '?action=profile;u=' $row['ID_MEMBER'],
            
'link' => $link,
            
'hidden' => empty($row['showOnline']),
            
'is_last' => false,
         );
      }
      else
         
$online['hidden']++;
   }
   
mysql_free_result($result);

   if (!empty(
$online['users']))
   {
      
krsort($online['users']);
      
$userlist array_keys($online['users']);
      
$online['users'][$userlist[count($userlist) - 1]]['is_last'] = true;
   }
   
$online['num_users'] = count($online['users']) + $online['hidden'];
   
$online['total_users'] = $online['num_users'] + $online['guests'];
   
ksort($online['spiders']);

   
// Allowed user to see spiders online?
   
if (!allowedTo('googlebot_view'))
      
$online['spiders'] = array();
   
   
// Don't count all instances of a spider, only 1 for each different spider
   
if (!empty($context['spiders']) && !$modSettings['ob_googlebot_count_all_instances'])
      
$online['num_spiders'] = count($context['spiders']);
      
   
// Diplay how many instances of each spider
   
if (!empty($online['spiders']) && $modSettings['ob_googlebot_count_all_instances'] && $modSettings['ob_googlebot_display_all_instances'])
   {
      
$spider_grouped array_count_values($context['spiders']);
      
      
$online['spiders'] = array();
      foreach (
$spider_grouped as $k => $v)
         
$online['spiders'][$k] = $k . ($v == '' ' (' $v ')');
   }

      echo 
'<table>
      <tr>
         <td><img src="' 
$settings['images_url'] . '/dot.gif" alt="Dot" /></td>
         <td>'
$txt['sp-onlineguest'], '</td>
         <td>:</td>
         <td>'
$online['num_spiders'],'</td>
      </tr>
      <tr>
         <td><img src="' 
$settings['images_url'] . '/dot.gif" alt="Dot" /></td>
         <td>'
$txt['sp-onlineuser'], '</td>
         <td>:</td>
         <td>'
$online['num_users'],'</td>
      </tr>
      <tr>
         <td><img src="' 
$settings['images_url'] . '/dot.gif" alt="Dot" /></td>
         <td>'
$txt['sp-onlinehuser'], '</td>
         <td>:</td>
         <td>'
$online['hidden'],'</td>
      </tr>
      <tr>
         <td><img src="' 
$settings['images_url'] . '/dot.gif" alt="Dot" /></td>
         <td>'
$txt['sp-onlinetuser'], '</td>
         <td>:</td>
         <td>'
$online['total_users'],'</td>
      </tr>'
;
            if(!empty(
$online['users']))
            echo 
'   <tr>
         <td><img src="' 
$settings['images_url'] . '/dot.gif" alt="Dot" />
         </td><td>'
$txt['sp-onlineouser'], '</td>
         <td>:</td>
         <td>&nbsp;</td>
      </tr>'
;

      foreach (
$online['users'] as $user)
         echo 
'<tr>
               <td colspan="4" style="padding-left: 15px;"><img src="' 
$settings['images_url'] . '/useron.gif" alt="user" /> ',$user['hidden'] ? '<i>' $user['link'] . '</i>' $user['link'],'</td>
            </tr>'
;
      echo 
'</table>';
?>


That code is taken from the whos_online block from Simple Portal.[/code]
SMF Friend (Former Support Specialist) | SimplePortal Developer
My SMF Mods | SimplePortal

"Quis custodiet ipsos custodes?" - Who will Guard the Guards?

Please don't send me ANY support related PMs. I will just delete them.

GamersGoop

I love you! I knew I saw that code before somewhere... I was looking in the default index.template file! Lol.

But yess! That was perfect. Thank you a ton. Keep up the good work. I love your mods.

GamersGoop

There is one small problem with that code. It doesn't want to show the real guests number online. It stays at 0.

Nathaniel

I apologise, it appears that I posted a heavily edited version which was meant to show some spiders as well. Try the code below, it should show the correct numbers and the correct titles as well. ;)

<?php
global 
$scripturl$db_prefix$user_info$txt$settings$online;

$result db_query("
SELECT
lo.ID_MEMBER, lo.logTime, mem.realName, mem.memberName, mem.showOnline,
mg.onlineColor, mg.ID_GROUP
FROM 
{$db_prefix}log_online AS lo
LEFT JOIN 
{$db_prefix}members AS mem ON (mem.ID_MEMBER = lo.ID_MEMBER)
LEFT JOIN 
{$db_prefix}membergroups AS mg ON (mg.ID_GROUP = IF(mem.ID_GROUP = 0, mem.ID_POST_GROUP, mem.ID_GROUP))"__FILE____LINE__);

$online['users'] = array();
$online['guests'] = 0;
$online['hidden'] = 0;
$online['buddies'] = 0;
$show_buddies = !empty($user_info['buddies']);

while ($row mysql_fetch_assoc($result))
{
if (!isset($row['realName']))
$online['guests']++;
elseif (!empty($row['showOnline']) || allowedTo('moderate_forum'))
{
// Some basic color coding...
if (!empty($row['onlineColor']))
$link '<a href="' $scripturl '?action=profile;u=' $row['ID_MEMBER'] . '" style="color: ' $row['onlineColor'] . ';">' $row['realName'] . '</a>';
else
$link '<a href="' $scripturl '?action=profile;u=' $row['ID_MEMBER'] . '">' $row['realName'] . '</a>';

// Bold any buddies.
if ($show_buddies && in_array($row['ID_MEMBER'], $user_info['buddies']))
{
$online['buddies']++;
$link '<b>' $link '</b>';
}

$online['users'][$row['logTime'] . $row['memberName']] = array(
'id' => $row['ID_MEMBER'],
'username' => $row['memberName'],
'name' => $row['realName'],
'group' => $row['ID_GROUP'],
'href' => $scripturl '?action=profile;u=' $row['ID_MEMBER'],
'link' => $link,
'hidden' => empty($row['showOnline']),
'is_last' => false,
);
}
else
$online['hidden']++;
}
mysql_free_result($result);

if (!empty($online['users']))
{
krsort($online['users']);
$userlist array_keys($online['users']);
$online['users'][$userlist[count($userlist) - 1]]['is_last'] = true;
}
$online['num_users'] = count($online['users']) + $online['hidden'];
$online['total_users'] = $online['num_users'] + $online['guests'];

echo '<table>
<tr>
<td>Guests Online</td>
<td>:</td>
<td>'
$online['guests'],'</td>
</tr>
<tr>
<td>User Online</td>
<td>:</td>
<td>'
$online['num_users'],'</td>
</tr>
<tr>
<td>Hidden Users Online:</td>
<td>:</td>
<td>'
$online['hidden'],'</td>
</tr>
<tr>
<td>Total Users Online:</td>
<td>:</td>
<td>'
$online['total_users'],'</td>
</tr>'
;
if(!empty($online['users']))
echo ' <tr>
<td>Online users:</td>
<td>:</td>
<td>&nbsp;</td>
</tr>'
;

foreach ($online['users'] as $user)
echo '<tr>
<td colspan="3" style="padding-left: 15px;"><img src="' 
$settings['images_url'] . '/useron.gif" alt="user" /> ',$user['hidden'] ? '<i>' $user['link'] . '</i>' $user['link'],'</td>
</tr>'
;
echo '</table>';

?>
SMF Friend (Former Support Specialist) | SimplePortal Developer
My SMF Mods | SimplePortal

"Quis custodiet ipsos custodes?" - Who will Guard the Guards?

Please don't send me ANY support related PMs. I will just delete them.

GamersGoop

That is perfectly fine. It works perfectly now. Thank you so much!

Advertisement: