includes/pageutils.php
changeset 266 917dcc6c4ceb
parent 240 f0149a27df5f
parent 260 661beb9b0fa3
child 271 f088805540ae
equal deleted inserted replaced
265:7e0cdf71b1bb 266:917dcc6c4ceb
   342       if ( $create != 'good' )
   342       if ( $create != 'good' )
   343         return 'The page did not exist, and I was not able to create it. The reported error was: ' . $create;
   343         return 'The page did not exist, and I was not able to create it. The reported error was: ' . $create;
   344       $paths->page_exists = true;
   344       $paths->page_exists = true;
   345     }
   345     }
   346     
   346     
   347     $prot = ( ( $paths->pages[$pname]['protected'] == 2 && $session->user_logged_in && $session->reg_time + 60*60*24*4 < time() ) || $paths->pages[$pname]['protected'] == 1) ? true : false;
   347     // Check page protection
   348     $wiki = ( ( $paths->pages[$pname]['wiki_mode'] == 2 && getConfig('wiki_mode') == '1') || $paths->pages[$pname]['wiki_mode'] == 1) ? true : false;
   348     
   349     if(($prot || !$wiki) && $session->user_level < USER_LEVEL_ADMIN ) return('You are not authorized to edit this page.');
   349     $is_protected = false;
       
   350     $page_data =& $paths->pages[$pname];
       
   351     // Is the protection semi?
       
   352     if ( $page_data['protected'] == 2 )
       
   353     {
       
   354       $is_protected = true;
       
   355       // Page is semi-protected. Has the user been here for at least 4 days?
       
   356       // 345600 seconds = 4 days
       
   357       if ( $session->user_logged_in && ( $session->reg_time + 345600 ) <= time() )
       
   358         $is_protected = false;
       
   359     }
       
   360     // Is the protection full?
       
   361     else if ( $page_data['protected'] == 1 )
       
   362     {
       
   363       $is_protected = true;
       
   364     }
       
   365     
       
   366     // If it's protected and we DON'T have even_when_protected rights, bail out
       
   367     if ( $is_protected && !$session->get_permissions('even_when_protected') )
       
   368     {
       
   369       return 'You don\'t have the necessary permissions to edit this page.';
       
   370     }
       
   371     
       
   372     // We're skipping the wiki mode check here because by default edit_page pemissions are AUTH_WIKIMODE.
       
   373     // The exception here is the user's own userpage, which is overridden at the time of account creation.
       
   374     // At that point it's set to AUTH_ALLOW, but obviously only for the user's own userpage.
   350     
   375     
   351     // Strip potentially harmful tags and PHP from the message, dependent upon permissions settings
   376     // Strip potentially harmful tags and PHP from the message, dependent upon permissions settings
   352     $message = RenderMan::preprocess_text($message, false, false);
   377     $message = RenderMan::preprocess_text($message, false, false);
   353     
   378     
   354     $msg = $db->escape($message);
   379     $msg = $db->escape($message);