includes/pageutils.php
changeset 261 5f1cd51bf1be
parent 259 112debff64bd
child 283 e133d321fce4
equal deleted inserted replaced
259:112debff64bd 261:5f1cd51bf1be
   200                <p>You have requested a page that doesn\'t exist yet.';
   200                <p>You have requested a page that doesn\'t exist yet.';
   201         if($session->get_permissions('create_page')) echo ' You can <a href="'.makeUrl($paths->page, 'do=edit', true).'" onclick="ajaxEditor(); return false;">create this page</a>, or return to the <a href="'.makeUrl(getConfig('main_page')).'">homepage</a>.';
   201         if($session->get_permissions('create_page')) echo ' You can <a href="'.makeUrl($paths->page, 'do=edit', true).'" onclick="ajaxEditor(); return false;">create this page</a>, or return to the <a href="'.makeUrl(getConfig('main_page')).'">homepage</a>.';
   202         else echo ' Return to the <a href="'.makeUrl(getConfig('main_page')).'">homepage</a>.</p>';
   202         else echo ' Return to the <a href="'.makeUrl(getConfig('main_page')).'">homepage</a>.</p>';
   203         if ( $session->get_permissions('history_rollback') )
   203         if ( $session->get_permissions('history_rollback') )
   204         {
   204         {
   205           $e = $db->sql_query('SELECT * FROM ' . table_prefix.'logs WHERE action=\'delete\' AND page_id=\'' . $paths->cpage['urlname_nons'] . '\' AND namespace=\'' . $pid[1] . '\' ORDER BY time_id DESC;');
   205           $e = $db->sql_query('SELECT * FROM ' . table_prefix.'logs WHERE action=\'delete\' AND page_id=\'' . $paths->page_id . '\' AND namespace=\'' . $pid[1] . '\' ORDER BY time_id DESC;');
   206           if ( !$e )
   206           if ( !$e )
   207           {
   207           {
   208             $db->_die('The deletion log could not be selected.');
   208             $db->_die('The deletion log could not be selected.');
   209           }
   209           }
   210           if ($db->numrows() > 0 )
   210           if ($db->numrows() > 0 )
   377     $message = RenderMan::preprocess_text($message, false, false);
   377     $message = RenderMan::preprocess_text($message, false, false);
   378     
   378     
   379     $msg = $db->escape($message);
   379     $msg = $db->escape($message);
   380     
   380     
   381     $minor = $minor ? ENANO_SQL_BOOLEAN_TRUE : ENANO_SQL_BOOLEAN_FALSE;
   381     $minor = $minor ? ENANO_SQL_BOOLEAN_TRUE : ENANO_SQL_BOOLEAN_FALSE;
   382     $q='INSERT INTO ' . table_prefix.'logs(log_type,action,time_id,date_string,page_id,namespace,page_text,char_tag,author,edit_summary,minor_edit) VALUES(\'page\', \'edit\', '.time().', \''.date('d M Y h:i a').'\', \'' . $paths->cpage['urlname_nons'] . '\', \'' . $paths->namespace . '\', ' . ENANO_SQL_MULTISTRING_PRFIX . '\'' . $msg . '\', \'' . $uid . '\', \'' . $session->username . '\', \'' . $db->escape(htmlspecialchars($summary)) . '\', ' . $minor . ');';
   382     $q='INSERT INTO ' . table_prefix.'logs(log_type,action,time_id,date_string,page_id,namespace,page_text,char_tag,author,edit_summary,minor_edit) VALUES(\'page\', \'edit\', '.time().', \''.date('d M Y h:i a').'\', \'' . $paths->page_id . '\', \'' . $paths->namespace . '\', ' . ENANO_SQL_MULTISTRING_PRFIX . '\'' . $msg . '\', \'' . $uid . '\', \'' . $session->username . '\', \'' . $db->escape(htmlspecialchars($summary)) . '\', ' . $minor . ');';
   383     if(!$db->sql_query($q)) $db->_die('The history (log) entry could not be inserted into the logs table.');
   383     if(!$db->sql_query($q)) $db->_die('The history (log) entry could not be inserted into the logs table.');
   384     
   384     
   385     $q = 'UPDATE ' . table_prefix.'page_text SET page_text=' . ENANO_SQL_MULTISTRING_PRFIX . '\'' . $msg . '\',char_tag=\'' . $uid . '\' WHERE page_id=\'' . $page_id . '\' AND namespace=\'' . $namespace . '\';';
   385     $q = 'UPDATE ' . table_prefix.'page_text SET page_text=' . ENANO_SQL_MULTISTRING_PRFIX . '\'' . $msg . '\',char_tag=\'' . $uid . '\' WHERE page_id=\'' . $page_id . '\' AND namespace=\'' . $namespace . '\';';
   386     $e = $db->sql_query($q);
   386     $e = $db->sql_query($q);
   387     if(!$e) $db->_die('Enano was unable to save the page contents. Your changes have been lost <tt>:\'(</tt>.');
   387     if(!$e) $db->_die('Enano was unable to save the page contents. Your changes have been lost <tt>:\'(</tt>.');
   652             </form>
   652             </form>
   653             <script type="text/javascript">if ( !KILL_SWITCH ) { buildDiffList(); }</script>';
   653             <script type="text/javascript">if ( !KILL_SWITCH ) { buildDiffList(); }</script>';
   654     }
   654     }
   655     $db->free_result();
   655     $db->free_result();
   656     echo '<h3>Other changes:</h3>';
   656     echo '<h3>Other changes:</h3>';
   657     $q = 'SELECT time_id,action,date_string,page_id,namespace,author,edit_summary,minor_edit FROM ' . table_prefix.'logs WHERE log_type=\'page\' AND action!=\'edit\' AND page_id=\'' . $paths->cpage['urlname_nons'] . '\' AND namespace=\'' . $paths->namespace . '\' ORDER BY time_id DESC;';
   657     $q = 'SELECT time_id,action,date_string,page_id,namespace,author,edit_summary,minor_edit FROM ' . table_prefix.'logs WHERE log_type=\'page\' AND action!=\'edit\' AND page_id=\'' . $paths->page_id . '\' AND namespace=\'' . $paths->namespace . '\' ORDER BY time_id DESC;';
   658     if(!$db->sql_query($q)) $db->_die('The history data for the page "' . $paths->cpage['name'] . '" could not be selected.');
   658     if(!$db->sql_query($q)) $db->_die('The history data for the page "' . $paths->cpage['name'] . '" could not be selected.');
   659     if($db->numrows() < 1) echo 'No history entries in this category.';
   659     if($db->numrows() < 1) echo 'No history entries in this category.';
   660     else {
   660     else {
   661       
   661       
   662       echo '<div class="tblholder"><table border="0" width="100%" cellspacing="1" cellpadding="4"><tr><th>Date/time</th><th>User</th><th>Minor</th><th>Action taken</th><th>Extra info</th><th colspan="2"></th></tr>';
   662       echo '<div class="tblholder"><table border="0" width="100%" cellspacing="1" cellpadding="4"><tr><th>Date/time</th><th>User</th><th>Minor</th><th>Action taken</th><th>Extra info</th><th colspan="2"></th></tr>';
  1369     {
  1369     {
  1370       die('Name is too short');
  1370       die('Name is too short');
  1371     }
  1371     }
  1372     if( ( $session->get_permissions('rename') && ( ( $prot && $session->get_permissions('even_when_protected') ) || !$prot ) ) && ( $paths->namespace != 'Special' && $paths->namespace != 'Admin' ))
  1372     if( ( $session->get_permissions('rename') && ( ( $prot && $session->get_permissions('even_when_protected') ) || !$prot ) ) && ( $paths->namespace != 'Special' && $paths->namespace != 'Admin' ))
  1373     {
  1373     {
  1374       $e = $db->sql_query('INSERT INTO ' . table_prefix.'logs(time_id,date_string,log_type,action,page_id,namespace,author,edit_summary) VALUES('.time().', \''.date('d M Y h:i a').'\', \'page\', \'rename\', \'' . $db->escape($paths->cpage['urlname_nons']) . '\', \'' . $paths->namespace . '\', \'' . $db->escape($session->username) . '\', \'' . $db->escape($paths->cpage['name']) . '\')');
  1374       $e = $db->sql_query('INSERT INTO ' . table_prefix.'logs(time_id,date_string,log_type,action,page_id,namespace,author,edit_summary) VALUES('.time().', \''.date('d M Y h:i a').'\', \'page\', \'rename\', \'' . $db->escape($paths->page_id) . '\', \'' . $paths->namespace . '\', \'' . $db->escape($session->username) . '\', \'' . $db->escape($paths->cpage['name']) . '\')');
  1375       if ( !$e )
  1375       if ( !$e )
  1376       {
  1376       {
  1377         $db->_die('The page title could not be updated.');
  1377         $db->_die('The page title could not be updated.');
  1378       }
  1378       }
  1379       $e = $db->sql_query('UPDATE ' . table_prefix.'pages SET name=\'' . $db->escape($name) . '\' WHERE urlname=\'' . $db->escape($page_id) . '\' AND namespace=\'' . $db->escape($namespace) . '\';');
  1379       $e = $db->sql_query('UPDATE ' . table_prefix.'pages SET name=\'' . $db->escape($name) . '\' WHERE urlname=\'' . $db->escape($page_id) . '\' AND namespace=\'' . $db->escape($namespace) . '\';');
  1595   function catedit_raw($page_id, $namespace)
  1595   function catedit_raw($page_id, $namespace)
  1596   {
  1596   {
  1597     global $db, $session, $paths, $template, $plugins; // Common objects
  1597     global $db, $session, $paths, $template, $plugins; // Common objects
  1598     ob_start();
  1598     ob_start();
  1599     $_ob = '';
  1599     $_ob = '';
  1600     $e = $db->sql_query('SELECT category_id FROM ' . table_prefix.'categories WHERE page_id=\'' . $paths->cpage['urlname_nons'] . '\' AND namespace=\'' . $paths->namespace . '\'');
  1600     $e = $db->sql_query('SELECT category_id FROM ' . table_prefix.'categories WHERE page_id=\'' . $paths->page_id . '\' AND namespace=\'' . $paths->namespace . '\'');
  1601     if(!$e) jsdie('Error selecting category information for current page: '.mysql_error());
  1601     if(!$e) jsdie('Error selecting category information for current page: '.mysql_error());
  1602     $cat_current = Array();
  1602     $cat_current = Array();
  1603     while($r = $db->fetchrow())
  1603     while($r = $db->fetchrow())
  1604     {
  1604     {
  1605       $cat_current[] = $r;
  1605       $cat_current[] = $r;
  2181               <p><label><input name="data[scope]" value="only_this" type="radio" checked="checked" /> Only this page</p>
  2181               <p><label><input name="data[scope]" value="only_this" type="radio" checked="checked" /> Only this page</p>
  2182               ' . $groupsel . '
  2182               ' . $groupsel . '
  2183               <p><label><input name="data[scope]" value="entire_site" type="radio" /> The entire site</p>
  2183               <p><label><input name="data[scope]" value="entire_site" type="radio" /> The entire site</p>
  2184               <div style="margin: 0 auto 0 0; text-align: right;">
  2184               <div style="margin: 0 auto 0 0; text-align: right;">
  2185                 <input name="data[mode]" value="seltarget" type="hidden" />
  2185                 <input name="data[mode]" value="seltarget" type="hidden" />
  2186                 <input type="hidden" name="data[page_id]" value="' . $paths->cpage['urlname_nons'] . '" />
  2186                 <input type="hidden" name="data[page_id]" value="' . $paths->page_id . '" />
  2187                 <input type="hidden" name="data[namespace]" value="' . $paths->namespace . '" />
  2187                 <input type="hidden" name="data[namespace]" value="' . $paths->namespace . '" />
  2188                 <input type="submit" value="Next &gt;" />
  2188                 <input type="submit" value="Next &gt;" />
  2189               </div>';
  2189               </div>';
  2190         echo $formend;
  2190         echo $formend;
  2191         break;
  2191         break;