zCommunity 0.8.1 Beta Now available! (supports SMF 2.0 RC1 and 1.1.8)

Started by Charles Hill, June 16, 2008, 03:33:34 PM

Previous topic - Next topic

jayman2

QuoteYou've got the old code for zCommunity in your forum's index.php... you have to uninstall all the edits from that file and then install the correct edits.   The edits for that file are located in other_1_1_x.xml (if using smf 1.1.x) or other_2.xml (if using smf2).
Charles, I did what you instructed and removed all of the zc edits from my index.php.  Then I add the first part of the code that initializes the zc community.

When I added the 2nd part to load the blog, I keep getting a require error.  I'm using smf 2b4 and I'm trying to get zC v0.7.9 running.  This is the code that I'm trying to use in my index.php:

// entering the blogging community...
   elseif (isset($modSettings['zc_mode']) && isset($zc['main_dir']) && empty($_REQUEST['action']) && (isset($_REQUEST['zc']) || !empty($_REQUEST['blog']) || !empty($_REQUEST['article'])))
   {
      return 'zC_START';
   }

This give me the error, referring to this code.   Is this what I should be using?  I don't know anything about php programming, but I was playing around with the code and I was able to get the blog to load up, but then I had other problems, like I couldn't log off of the forum.  Any suggestions?

Charles Hill

There should be one other bit of code in the index.php above that.

jayman2

Quote from: Charles Hill on February 16, 2009, 06:56:54 PM
There should be one other bit of code in the index.php above that.
Yes, I added that part first.  It's when I add this last part that I start having problems.

Charles Hill


jayman2

Quote from: Charles Hill on February 16, 2009, 07:06:06 PM
Could you copy/paste that part of your index.php also?
Here's that section:

   // Load the current theme.  (note that ?theme=1 will also work, may be used for guest theming.)
   loadTheme();

   // Check if the user should be disallowed access.
   is_not_banned();

   if (isset($modSettings['zc_mode']))
   {
      global $context, $boarddir;
      global $zc, $zcFunc, $blog_info, $blog, $article, $comment, $poll, $draft;

      // initialize zCommunity...
      if (file_exists($boarddir . '/zCommunity/zc.php'))
      {
         require_once($boarddir . '/zCommunity/zc.php');
         zc_init();
      }
      else
         unset($modSettings['zc_mode']);
   }

   if (isset($modSettings['blogMode']))
   {
      global $context, $boarddir, $boardurl;
      global $zc_dir, $zc_sources_dir, $zc_includes_url, $zc_themes_url, $zc_themes_dir;
      global $zc_settings, $blog_info, $blog, $article, $comment, $poll, $draft;

         // detect SMF version....
      if (substr($modSettings['smfVersion'], 0, 3) == '2.0')
         $context['zc']['smf_version'] = '2.0';
      elseif (substr($modSettings['smfVersion'], 0, 3) == '1.1')
         $context['zc']['smf_version'] = '1.1.x';
      else
         $context['zc']['smf_version'] = false;
   }

   // If we are in a topic and don't have permission to approve it then duck out now.
   if (!empty($topic) && empty($board_info['cur_topic_approved']) && !allowedTo('approve_posts') && ($user_info['id'] != $board_info['cur_topic_starter'] || $user_info['is_guest']))
      fatal_lang_error('not_a_topic', false);

   // Do some logging, unless this is an attachment, avatar, theme option or XML feed.
   if (empty($_REQUEST['action']) || !in_array($_REQUEST['action'], array('dlattach', 'jsoption', '.xml', 'xmlhttp', 'verificationcode')))
   {
      // Log this user as online.
      writeLog();

      // Track forum statistics and hits...?
      if (!empty($modSettings['hitStats']))
         trackStats(array('hits' => '+'));
   }

   //SPortal
   sportal_init();

   // Is the forum in maintenance mode? (doesn't apply to administrators.)
   if (!empty($maintenance) && !allowedTo('admin_forum'))
   {
      // You can only login.... otherwise, you're getting the "maintenance mode" display.
      if (isset($_REQUEST['action']) && ($_REQUEST['action'] == 'login2' || $_REQUEST['action'] == 'logout'))
      {
         require_once($sourcedir . '/LogInOut.php');
         return $_REQUEST['action'] == 'login2' ? 'Login2' : 'Logout';
      }
      // Don't even try it, sonny.
      else
      {
         require_once($sourcedir . '/Subs-Auth.php');
         return 'InMaintenance';
      }
   }
   // If guest access is off, a guest can only do one of the very few following actions.
   elseif (empty($modSettings['allow_guestAccess']) && $user_info['is_guest'] && (!isset($_REQUEST['action']) || !in_array($_REQUEST['action'], array('coppa', 'login', 'login2', 'register', 'register2', 'reminder', 'activate', 'help', 'smstats', '.xml', 'mailq', 'verificationcode', 'openidreturn',))))
   {
      require_once($sourcedir . '/Subs-Auth.php');
      return 'KickGuest';
   }
   // Check for arcade actions
   // IBPArcade v2.x.x Games support
   elseif (isset($_REQUEST['act']) && strtolower($_REQUEST['act']) == 'arcade')
   {
      $_REQUEST['action'] = 'arcade';

      if (isset($_REQUEST['do']) && $_REQUEST['do'] == 'newscore')
         $_REQUEST['sa'] = 'ibpsubmit2';

      require_once($sourcedir . '/Arcade.php');
      return 'Arcade';
   }
   // IBPArcade v3.x.x Games support
   elseif (isset($_REQUEST['autocom']) && $_REQUEST['autocom'] == 'arcade')
   {
      $_REQUEST['action'] = 'arcade';

      if (isset($_REQUEST['do']) && $_REQUEST['do'] == 'savescore')
         $_REQUEST['sa'] = 'ibpsubmit3';

      elseif (isset($_REQUEST['do']) && $_REQUEST['do'] = 'verifyscore')
         $_REQUEST['sa'] = 'ibpverify';

      require_once($sourcedir . '/Arcade.php');
      return 'Arcade';
   }
   elseif (isset($_REQUEST['play']))
   {
      $_REQUEST['game'] = $_REQUEST['play'];
      unset($_REQUEST['play']);
      $_REQUEST['sa'] = 'play';

      require_once($sourcedir . '/Arcade.php');
      return 'Arcade';
   }
   elseif (isset($_REQUEST['highscore']))
   {
      $_REQUEST['game'] = $_REQUEST['highscore'];
      unset($_REQUEST['highscore']);
      $_REQUEST['sa'] = 'highscore';

      require_once($sourcedir . '/Arcade.php');
      return 'Arcade';
   }
   elseif ((isset($_REQUEST['game']) || isset($_REQUEST['match'])) && !isset($_REQUEST['action']))
   {
      require_once($sourcedir . '/Arcade.php');
      return 'Arcade';
   }
   elseif (empty($_REQUEST['action']))
   // entering the blogging community...
      elseif (isset($modSettings['zc_mode']) && isset($zc['main_dir']) && empty($_REQUEST['action']) && (isset($_REQUEST['zc']) || !empty($_REQUEST['blog']) || !empty($_REQUEST['article'])))
      {
         return 'zC_START';
      }

   {

   // Action and board are both empty... SPortal!
      if (empty($board) && empty($topic) && !empty($modSettings['portalactive']))
      {
         require_once($sourcedir . '/SPortal2.php');
         return 'SPortal';
      }

Charles Hill

Try this modified version of that code snippet you pasted above:

// Load the current theme.  (note that ?theme=1 will also work, may be used for guest theming.)
   loadTheme();

   // Check if the user should be disallowed access.
   is_not_banned();

   if (isset($modSettings['zc_mode']))
   {
      global $context, $boarddir;
      global $zc, $zcFunc, $blog_info, $blog, $article, $comment, $poll, $draft;

      // initialize zCommunity...
      if (file_exists($boarddir . '/zCommunity/zc.php'))
      {
         require_once($boarddir . '/zCommunity/zc.php');
         zc_init();
      }
      else
         unset($modSettings['zc_mode']);
   }

   // If we are in a topic and don't have permission to approve it then duck out now.
   if (!empty($topic) && empty($board_info['cur_topic_approved']) && !allowedTo('approve_posts') && ($user_info['id'] != $board_info['cur_topic_starter'] || $user_info['is_guest']))
      fatal_lang_error('not_a_topic', false);

   // Do some logging, unless this is an attachment, avatar, theme option or XML feed.
   if (empty($_REQUEST['action']) || !in_array($_REQUEST['action'], array('dlattach', 'jsoption', '.xml', 'xmlhttp', 'verificationcode')))
   {
      // Log this user as online.
      writeLog();

      // Track forum statistics and hits...?
      if (!empty($modSettings['hitStats']))
         trackStats(array('hits' => '+'));
   }

   //SPortal
   sportal_init();

   // Is the forum in maintenance mode? (doesn't apply to administrators.)
   if (!empty($maintenance) && !allowedTo('admin_forum'))
   {
      // You can only login.... otherwise, you're getting the "maintenance mode" display.
      if (isset($_REQUEST['action']) && ($_REQUEST['action'] == 'login2' || $_REQUEST['action'] == 'logout'))
      {
         require_once($sourcedir . '/LogInOut.php');
         return $_REQUEST['action'] == 'login2' ? 'Login2' : 'Logout';
      }
      // Don't even try it, sonny.
      else
      {
         require_once($sourcedir . '/Subs-Auth.php');
         return 'InMaintenance';
      }
   }
   // If guest access is off, a guest can only do one of the very few following actions.
   elseif (empty($modSettings['allow_guestAccess']) && $user_info['is_guest'] && (!isset($_REQUEST['action']) || !in_array($_REQUEST['action'], array('coppa', 'login', 'login2', 'register', 'register2', 'reminder', 'activate', 'help', 'smstats', '.xml', 'mailq', 'verificationcode', 'openidreturn',))))
   {
      require_once($sourcedir . '/Subs-Auth.php');
      return 'KickGuest';
   }
   // Check for arcade actions
   // IBPArcade v2.x.x Games support
   elseif (isset($_REQUEST['act']) && strtolower($_REQUEST['act']) == 'arcade')
   {
      $_REQUEST['action'] = 'arcade';

      if (isset($_REQUEST['do']) && $_REQUEST['do'] == 'newscore')
         $_REQUEST['sa'] = 'ibpsubmit2';

      require_once($sourcedir . '/Arcade.php');
      return 'Arcade';
   }
   // IBPArcade v3.x.x Games support
   elseif (isset($_REQUEST['autocom']) && $_REQUEST['autocom'] == 'arcade')
   {
      $_REQUEST['action'] = 'arcade';

      if (isset($_REQUEST['do']) && $_REQUEST['do'] == 'savescore')
         $_REQUEST['sa'] = 'ibpsubmit3';

      elseif (isset($_REQUEST['do']) && $_REQUEST['do'] = 'verifyscore')
         $_REQUEST['sa'] = 'ibpverify';

      require_once($sourcedir . '/Arcade.php');
      return 'Arcade';
   }
   elseif (isset($_REQUEST['play']))
   {
      $_REQUEST['game'] = $_REQUEST['play'];
      unset($_REQUEST['play']);
$_REQUEST['sa'] = 'play';

require_once($sourcedir . '/Arcade.php');
return 'Arcade';
}
elseif (isset($_REQUEST['highscore']))
{
$_REQUEST['game'] = $_REQUEST['highscore'];
unset($_REQUEST['highscore']);
$_REQUEST['sa'] = 'highscore';

require_once($sourcedir . '/Arcade.php');
return 'Arcade';
}
elseif ((isset($_REQUEST['game']) || isset($_REQUEST['match'])) && !isset($_REQUEST['action']))
{
require_once($sourcedir . '/Arcade.php');
return 'Arcade';
}
// entering the blogging community...
elseif (isset($modSettings['zc_mode']) && isset($zc['main_dir']) && empty($_REQUEST['action']) && (isset($_REQUEST['zc']) || !empty($_REQUEST['blog']) || !empty($_REQUEST['article'])))
{
return 'zC_START';
}
elseif (empty($_REQUEST['action']))
{
// Action and board are both empty... SPortal!
if (empty($board) && empty($topic) && !empty($modSettings['portalactive']))
{
require_once($sourcedir . '/SPortal2.php');
return 'SPortal';
}

jayman2

That fixed it, Charles.  I can't thank you enough for the great mod and the great support.

Charles Hill


~Killer~

Well regarding my previous experience, that no-one helped me out with, zCommunity didn't work well with PortaMX, maybe you could fix that, PortaMX just overridden zCommunity.

Although now, I have enabled the Blogs, yet members still cannot access it... :'(

Charles Hill

Quote from: ~Killer~ on February 17, 2009, 04:51:03 AM
Well regarding my previous experience, that no-one helped me out with, zCommunity didn't work well with PortaMX, maybe you could fix that, PortaMX just overridden zCommunity.

Although now, I have enabled the Blogs, yet members still cannot access it... :'(

Have you assigned permissions to member groups via the Permissions page in your Blog Control Panel?   About PortaMX... I will look at that to see what might be causing the incompatibility.  Could just be that you've edited some files manually and now the package manager cannot find where to make the edits.



On a side note... it looks like there aren't any major bugs left... and relatively few minor bugs.  Next version will be 0.8.0 Beta.  Been cleaning up the code here and there, as well as adding some extra touches.  Crusader, you will be pleased to know that I added the ability to set the content of custom windows as Normal text, Raw HTML, or PHP (provided the user has the necessary permissions).  I added two permissions to go with this added feature (can use raw HTML in custom windows ... can use php in custom windows).  :)

If anyone else has any things they would like added to the core of zCommunity, now would be a good time to mention your ideas :D

~Killer~

Can't wait for BETA now :D
And I tried it on a clean install of SMF, PortaMX and zCommunity, same issue...

Yes I have set the permissions, and they still can't access it :'(

PfalzNacht

Today i wanted to install the zCommunity 0.7.9, but now i will wait until 0.8beta is released.  ;)

Lamarck

Wow,that will be a nice addition.Well,a thing that was mentioned before: put blocks/windows on left and/or right (and even things on footer or header...I'm thinking for example in the possibility to put custom windows with html on header to add a custom banner and stuff like that).
Also,It would be nice more options for user to customize the template.

Charles Hill

Quote from: Lamarck on February 18, 2009, 12:22:11 PM
Wow,that will be a nice addition.Well,a thing that was mentioned before: put blocks/windows on left and/or right (and even things on footer or header...I'm thinking for example in the possibility to put custom windows with html on header to add a custom banner and stuff like that).
Also,It would be nice more options for user to customize the template.


Well remember that in allowing a user to use raw HTML you are opening up possible security issues.  I will definitely be adding an option for "allowed HTML tags" in custom windows (and auto clean out risky html tags).  Allowing just any user to use PHP in a custom window is definitely a bad idea... I could write up a sanitize-php function, but that would be quite complex to say the least.

jayman2

Quote from: linkgamer3 on February 13, 2009, 02:19:19 PM
Quote from: linkgamer3 on February 11, 2009, 09:11:33 PM
Ummm...I'm really stumped on what I'm doing wrong. I reinstalled the entire forum on my site to try to fix this error, but my efforts were in vain. I'm getting this error when I try to click the "Blogs" tab.
Page request Error
The page you have requested does not exist.

What am I doing wrong? Or is this a bug?
Ok, I found a fix...of sorts...If I specify something else along with the URL, the main blog page will come up. For example, http://whatninja.com/index.php?zc will not work, however, http://whatninja.com/index.php?zc;theme=2 will work. Any suggestions on a real fix though? Please?
I just did a fresh install of smf 2.0 rc1 on another test site and the first mod I installed was zc 07.9.  It installed without any errors, but when I clicked on the blogs menu option, I got the same message.

What I did was edit my subs.php file like this:

         'zcommunity' => array(
            'title' => !empty($txt['b1a']) ? $txt['b1a'] : 'Blogs',
            'href' => $scripturl . '?zc;theme=1',
            'show' => !empty($context['zc']['show_zc_nav']),
            'sub_buttons' => array(
            ),
         ),

This is on the default theme.  I would imagine as long as you don't allow your users to change themes, this should work just fine.  If you want to use another theme for your board, you would just change the number following "theme=.  I hope this helps someone.

Charles Hill

Interesting solution.  I'll have to take the time one day to completely follow the logic of SMF 2 RC1's code...

cubetgio

I: Impossible to change the default setting In global blog setting,

"New blogs will be visible to the following member groups by default"

II: general users can't have acces in article edit/write   mode. Only 1 link appear, it's the "subscribe" link ???

Can you help me

PfalzNacht

Hey Charles, when will 0.8 be released?  :D

I wait for it.  ;)

Charles Hill

Quote from: cubetgio on February 23, 2009, 02:54:14 AM
I: Impossible to change the default setting In global blog setting,

"New blogs will be visible to the following member groups by default"

II: general users can't have acces in article edit/write   mode. Only 1 link appear, it's the "subscribe" link ???

Can you help me

I am fairly certain that these issues do not exist in 0.8.0 Beta... but I am only testing this on one configuration of PHP, so we'll just have to see.


Quote from: The Crusader on February 23, 2009, 06:45:11 AM
Hey Charles, when will 0.8 be released?  :D

I wait for it.  ;)

I've been really sick for the past few days, so I haven't been able to get done as much as I would have liked.  I have been making significant optimizations and improvements to the templates and the sources files.  I can't give a release time on 0.8.0 Beta, but it shouldn't be much longer...

Nibogo

Hi charles , I have some little questions:

1. You can integrate the SMF 2.0 WYSIWYG with the zCommunity?? Is really simple and really I think of will be a nice feature

2. Maybe you should add something like the rate that topic feature or create a plug-in for rate articles

3. Will be pretty a search feature for blogs , I think of the SMF Search can`t find results in blogs

Advertisement: