includes/pageprocess.php
changeset 345 4ccdfeee9a11
parent 343 eefe9ab7fe7c
child 368 ed4f3ee072be
equal deleted inserted replaced
344:be6c5fdd9203 345:4ccdfeee9a11
   425     $text = $db->escape($text_undb);
   425     $text = $db->escape($text_undb);
   426     $author = $db->escape($session->username);
   426     $author = $db->escape($session->username);
   427     $time = time();
   427     $time = time();
   428     $edit_summary = ( strval($edit_summary) === $edit_summary ) ? $db->escape($edit_summary) : '';
   428     $edit_summary = ( strval($edit_summary) === $edit_summary ) ? $db->escape($edit_summary) : '';
   429     $minor_edit = ( $minor_edit ) ? '1' : '0';
   429     $minor_edit = ( $minor_edit ) ? '1' : '0';
   430     $date_string = date('d M Y h:i a');
   430     $date_string = enano_date('d M Y h:i a');
   431     
   431     
   432     // Insert log entry
   432     // Insert log entry
   433     $sql = 'INSERT INTO ' . table_prefix . "logs ( time_id, date_string, log_type, action, page_id, namespace, author, page_text, edit_summary, minor_edit )\n"
   433     $sql = 'INSERT INTO ' . table_prefix . "logs ( time_id, date_string, log_type, action, page_id, namespace, author, page_text, edit_summary, minor_edit )\n"
   434          . "  VALUES ( $time, '$date_string', 'page', 'edit', '{$this->page_id}', '{$this->namespace}', '$author', '$text', '$edit_summary', $minor_edit );";
   434          . "  VALUES ( $time, '$date_string', 'page', 'edit', '{$this->page_id}', '{$this->namespace}', '$author', '$text', '$edit_summary', $minor_edit );";
   435     if ( !$db->sql_query($sql) )
   435     if ( !$db->sql_query($sql) )
   679       display_page_headers();
   679       display_page_headers();
   680     }
   680     }
   681     
   681     
   682     if ( $this->revision_id )
   682     if ( $this->revision_id )
   683     {
   683     {
   684       echo '<div class="info-box" style="margin-left: 0; margin-top: 5px;"><b>Notice:</b><br />The page you are viewing was archived on '.date('F d, Y \a\t h:i a', $this->revision_id).'.<br /><a href="'.makeUrlNS($this->namespace, $this->page_id).'" onclick="ajaxReset(); return false;">View current version</a>  |  <a href="'.makeUrlNS($this->namespace, $this->page_id, 'do=rollback&amp;id='.$this->revision_id).'" onclick="ajaxRollback(\''.$this->revision_id.'\')">Restore this version</a></div><br />';
   684       echo '<div class="info-box" style="margin-left: 0; margin-top: 5px;"><b>Notice:</b><br />The page you are viewing was archived on '.enano_date('F d, Y \a\t h:i a', $this->revision_id).'.<br /><a href="'.makeUrlNS($this->namespace, $this->page_id).'" onclick="ajaxReset(); return false;">View current version</a>  |  <a href="'.makeUrlNS($this->namespace, $this->page_id, 'do=rollback&amp;id='.$this->revision_id).'" onclick="ajaxRollback(\''.$this->revision_id.'\')">Restore this version</a></div><br />';
   685     }
   685     }
   686     
   686     
   687     if ( $redir_enabled )
   687     if ( $redir_enabled )
   688     {
   688     {
   689       echo $redir_html;
   689       echo $redir_html;
       
   690     }
       
   691     
       
   692     $code = $plugins->setHook('pageprocess_render_head');
       
   693     foreach ( $code as $cmd )
       
   694     {
       
   695       eval($cmd);
   690     }
   696     }
   691     
   697     
   692     if ( $incl_inner_headers )
   698     if ( $incl_inner_headers )
   693     {
   699     {
   694       $text = '?>' . RenderMan::render($text);
   700       $text = '?>' . RenderMan::render($text);
   698       $text = '?>' . $text;
   704       $text = '?>' . $text;
   699       $text = preg_replace('/<nowiki>(.*?)<\/nowiki>/s', '\\1', $text);
   705       $text = preg_replace('/<nowiki>(.*?)<\/nowiki>/s', '\\1', $text);
   700     }
   706     }
   701     // echo('<pre>'.htmlspecialchars($text).'</pre>');
   707     // echo('<pre>'.htmlspecialchars($text).'</pre>');
   702     eval ( $text );
   708     eval ( $text );
       
   709     
       
   710     $code = $plugins->setHook('pageprocess_render_tail');
       
   711     foreach ( $code as $cmd )
       
   712     {
       
   713       eval($cmd);
       
   714     }
   703     
   715     
   704     if ( $incl_inner_headers )
   716     if ( $incl_inner_headers )
   705     {
   717     {
   706       display_page_footers();
   718       display_page_footers();
   707     }
   719     }
   939     echo '<tr><th class="subhead">All about ' . htmlspecialchars($target_username) . '</th></tr>';
   951     echo '<tr><th class="subhead">All about ' . htmlspecialchars($target_username) . '</th></tr>';
   940     if ( $userdata['user_has_avatar'] == '1' )
   952     if ( $userdata['user_has_avatar'] == '1' )
   941     {
   953     {
   942       echo '<tr><td class="row1" style="text-align: center;"><img alt="' . $lang->get('usercp_avatar_image_alt', array('username' => $userdata['username'])) . '" src="' . make_avatar_url(intval($userdata['authoritative_uid']), $userdata['avatar_type']) . '" /></td></tr>';
   954       echo '<tr><td class="row1" style="text-align: center;"><img alt="' . $lang->get('usercp_avatar_image_alt', array('username' => $userdata['username'])) . '" src="' . make_avatar_url(intval($userdata['authoritative_uid']), $userdata['avatar_type']) . '" /></td></tr>';
   943     }
   955     }
   944     echo '<tr><td class="row3">Joined: ' . date('F d, Y h:i a', $userdata['reg_time']) . '</td></tr>';
   956     echo '<tr><td class="row3">Joined: ' . enano_date('F d, Y h:i a', $userdata['reg_time']) . '</td></tr>';
   945     echo '<tr><td class="row1">Total comments: ' . $userdata['n_comments'] . '</td></tr>';
   957     echo '<tr><td class="row1">Total comments: ' . $userdata['n_comments'] . '</td></tr>';
   946     
   958     
   947     if ( !empty($userdata['real_name']) )
   959     if ( !empty($userdata['real_name']) )
   948     {
   960     {
   949       echo '<tr><td class="row3">Real name: ' . $userdata['real_name'] . '</td></tr>';
   961       echo '<tr><td class="row3">Real name: ' . $userdata['real_name'] . '</td></tr>';
   968     
   980     
   969     if ( $row = $db->fetchrow() )
   981     if ( $row = $db->fetchrow() )
   970     {
   982     {
   971       do 
   983       do 
   972       {
   984       {
   973         $row['time'] = date('F d, Y', $row['time']);
   985         $row['time'] = enano_date('F d, Y', $row['time']);
   974         $comments[] = $row;
   986         $comments[] = $row;
   975       }
   987       }
   976       while ( $row = $db->fetchrow() );
   988       while ( $row = $db->fetchrow() );
   977     }
   989     }
   978     else
   990     else
  1239     global $db, $session, $paths, $template, $plugins; // Common objects
  1251     global $db, $session, $paths, $template, $plugins; // Common objects
  1240     global $lang;
  1252     global $lang;
  1241     global $email;
  1253     global $email;
  1242     
  1254     
  1243     // Log it for crying out loud
  1255     // Log it for crying out loud
  1244     $q = $db->sql_query('INSERT INTO '.table_prefix.'logs(log_type,action,time_id,date_string,author,edit_summary,page_text) VALUES(\'security\', \'illegal_page\', '.time().', \''.date('d M Y h:i a').'\', \''.$db->escape($session->username).'\', \''.$db->escape($_SERVER['REMOTE_ADDR']).'\', \'' . $db->escape(serialize(array($this->page_id, $this->namespace))) . '\')');
  1256     $q = $db->sql_query('INSERT INTO '.table_prefix.'logs(log_type,action,time_id,date_string,author,edit_summary,page_text) VALUES(\'security\', \'illegal_page\', '.time().', \''.enano_date('d M Y h:i a').'\', \''.$db->escape($session->username).'\', \''.$db->escape($_SERVER['REMOTE_ADDR']).'\', \'' . $db->escape(serialize(array($this->page_id, $this->namespace))) . '\')');
  1245     
  1257     
  1246     $ob = '';
  1258     $ob = '';
  1247     //$template->tpl_strings['PAGE_NAME'] = 'Access denied';
  1259     //$template->tpl_strings['PAGE_NAME'] = 'Access denied';
  1248     $template->tpl_strings['PAGE_NAME'] = htmlspecialchars( $this->title );
  1260     $template->tpl_strings['PAGE_NAME'] = htmlspecialchars( $this->title );
  1249       
  1261       
  1456             ';
  1468             ';
  1457     }
  1469     }
  1458   }
  1470   }
  1459   
  1471   
  1460   /**
  1472   /**
  1461    * PHP 4 constructor.
       
  1462    * @see PageProcessor::__construct()
       
  1463    */
       
  1464   
       
  1465   function PageProcessor( $page_id, $namespace, $revision_id = 0 )
       
  1466   {
       
  1467     $this->__construct($page_id, $namespace, $revision_id);
       
  1468   }
       
  1469   
       
  1470   /**
       
  1471    * Send an error message and die. For debugging or critical technical errors only - nothing that would under normal circumstances be shown to the user.
  1473    * Send an error message and die. For debugging or critical technical errors only - nothing that would under normal circumstances be shown to the user.
  1472    * @var string Error message
  1474    * @var string Error message
  1473    * @var bool If true, send DBAL's debugging information as well
  1475    * @var bool If true, send DBAL's debugging information as well
  1474    */
  1476    */
  1475    
  1477