includes/pageprocess.php
changeset 369 d0825e599853
parent 368 ed4f3ee072be
child 372 5bd429428101
equal deleted inserted replaced
368:ed4f3ee072be 369:d0825e599853
  1292         $page_id_key = $paths->nslist[ $this->namespace ] . $this->page_id;
  1292         $page_id_key = $paths->nslist[ $this->namespace ] . $this->page_id;
  1293         $page_data = $paths->pages[$page_id_key];
  1293         $page_data = $paths->pages[$page_id_key];
  1294         $title = ( isset($page_data['name']) ) ? $page_data['name'] : $paths->nslist[$this->namespace] . htmlspecialchars( str_replace('_', ' ', dirtify_page_id( $this->page_id ) ) );
  1294         $title = ( isset($page_data['name']) ) ? $page_data['name'] : $paths->nslist[$this->namespace] . htmlspecialchars( str_replace('_', ' ', dirtify_page_id( $this->page_id ) ) );
  1295         $b = '<a href="' . $url . '">' . $title . '</a>';
  1295         $b = '<a href="' . $url . '">' . $title . '</a>';
  1296         
  1296         
  1297         $ob .= '<small>(Redirected to ' . $b . ' from ' . $a . ')<br /></small>';
  1297         $ob .= '<small>' . $lang->get('page_msg_redirected_from_to', array('from' => $a, 'to' => $b)) . '<br /></small>';
  1298       }
  1298       }
  1299     }
  1299     }
  1300     
  1300     
  1301     $email_link = $email->encryptEmail(getConfig('contact_email'), '', '', $lang->get('page_err_access_denied_siteadmin'));
  1301     $email_link = $email->encryptEmail(getConfig('contact_email'), '', '', $lang->get('page_err_access_denied_siteadmin'));
  1302     
  1302     
  1316    */
  1316    */
  1317    
  1317    
  1318   function err_wrong_password()
  1318   function err_wrong_password()
  1319   {
  1319   {
  1320     global $db, $session, $paths, $template, $plugins; // Common objects
  1320     global $db, $session, $paths, $template, $plugins; // Common objects
       
  1321     global $lang;
  1321     
  1322     
  1322     $title = 'Password required';
  1323     $title = 'Password required';
  1323     $message = ( empty($this->password) ) ? '<p>Access to this page requires a password. Please enter the password for this page below:</p>' : '<p>The password you entered for this page was incorrect. Please enter the password for this page below:</p>';
  1324     $message = ( empty($this->password) ) ?
       
  1325                  '<p>' . $lang->get('page_msg_passrequired') . '</p>' :
       
  1326                  '<p>' . $lang->get('page_msg_pass_wrong') . '</p>';
  1324     $message .= '<form action="' . makeUrlNS($this->namespace, $this->page_id) . '" method="post">
  1327     $message .= '<form action="' . makeUrlNS($this->namespace, $this->page_id) . '" method="post">
  1325                    <p>
  1328                    <p>
  1326                      <label>Password: <input name="pagepass" type="password" /></label>&nbsp;&nbsp;<input type="submit" value="Submit" />
  1329                      <label>' . $lang->get('page_lbl_password') . ' <input name="pagepass" type="password" /></label>&nbsp;&nbsp;<input type="submit" value="Submit" />
  1327                    </p>
  1330                    </p>
  1328                  </form>';
  1331                  </form>';
  1329     if ( $this->send_headers )
  1332     if ( $this->send_headers )
  1330     {
  1333     {
  1331       $template->tpl_strings['PAGE_NAME'] = $title;
  1334       $template->tpl_strings['PAGE_NAME'] = $title;
  1371    */
  1374    */
  1372    
  1375    
  1373   function err_page_not_existent($userpage = false)
  1376   function err_page_not_existent($userpage = false)
  1374   {
  1377   {
  1375     global $db, $session, $paths, $template, $plugins; // Common objects
  1378     global $db, $session, $paths, $template, $plugins; // Common objects
       
  1379     global $lang;
  1376     
  1380     
  1377     header('HTTP/1.1 404 Not Found');
  1381     header('HTTP/1.1 404 Not Found');
  1378     
  1382     
  1379     $this->header();
  1383     $this->header();
  1380     $this->do_breadcrumbs();
  1384     $this->do_breadcrumbs();
  1387     }
  1391     }
  1388     else
  1392     else
  1389     {
  1393     {
  1390       if ( $userpage )
  1394       if ( $userpage )
  1391       {
  1395       {
  1392         echo '<h3>There is no page with this title yet.</h3>
  1396         echo '<h3>' . $lang->get('page_msg_404_title') . '</h3>
  1393                <p>This user has not created his or her user page yet.';
  1397                <p>' . $lang->get('page_msg_404_body_userpage');
  1394       }
  1398       }
  1395       else
  1399       else
  1396       {
  1400       {
  1397         echo '<h3>There is no page with this title yet.</h3>
  1401         echo '<h3>' . $lang->get('page_msg_404_title') . '</h3>
  1398                <p>You have requested a page that doesn\'t exist yet.';
  1402                <p>' . $lang->get('page_msg_404_body');
  1399       }
  1403       }
  1400       if ( $session->get_permissions('create_page') )
  1404       if ( $session->get_permissions('create_page') )
  1401       {
  1405       {
  1402         echo ' You can <a href="'.makeUrlNS($this->namespace, $this->page_id, 'do=edit', true).'" onclick="ajaxEditor(); return false;">create this page</a>, or return to the <a href="'.makeUrl(getConfig('main_page')).'">homepage</a>.';
  1406         echo ' ' . $lang->get('page_msg_404_create', array(
       
  1407             'create_flags' => 'href="'.makeUrlNS($this->namespace, $this->page_id, 'do=edit', true).'" onclick="ajaxEditor(); return false;"',
       
  1408             'mainpage_link' => makeUrl(getConfig('main_page'), false, true)
       
  1409           ));
  1403       }
  1410       }
  1404       else
  1411       else
  1405       {
  1412       {
  1406         echo ' Return to the <a href="'.makeUrl(getConfig('main_page')).'">homepage</a>.</p>';
  1413         echo ' ' . $lang->get('page_msg_404_gohome', array(
  1407       }
  1414             'mainpage_link' => makeUrl(getConfig('main_page'), false, true)
       
  1415           ));
       
  1416       }
       
  1417       echo '</p>';
  1408       if ( $session->get_permissions('history_rollback') )
  1418       if ( $session->get_permissions('history_rollback') )
  1409       {
  1419       {
  1410         $e = $db->sql_query('SELECT * FROM ' . table_prefix . 'logs WHERE action=\'delete\' AND page_id=\'' . $this->page_id . '\' AND namespace=\'' . $this->namespace . '\' ORDER BY time_id DESC;');
  1420         $e = $db->sql_query('SELECT * FROM ' . table_prefix . 'logs WHERE action=\'delete\' AND page_id=\'' . $this->page_id . '\' AND namespace=\'' . $this->namespace . '\' ORDER BY time_id DESC;');
  1411         if ( !$e )
  1421         if ( !$e )
  1412         {
  1422         {
  1413           $db->_die('The deletion log could not be selected.');
  1423           $db->_die('The deletion log could not be selected.');
  1414         }
  1424         }
  1415         if ( $db->numrows() > 0 )
  1425         if ( $db->numrows() > 0 )
  1416         {
  1426         {
  1417           $r = $db->fetchrow();
  1427           $r = $db->fetchrow();
  1418           echo '<p><b>This page was deleted on ' . $r['date_string'] . '.</b> The stated reason was:</p><blockquote>' . $r['edit_summary'] . '</blockquote><p>You can probably <a href="'.makeUrl($paths->page, 'do=rollback&amp;id='.$r['time_id']).'" onclick="ajaxRollback(\''.$r['time_id'].'\'); return false;">roll back</a> the deletion.</p>';
  1428           echo '<p>' . $lang->get('page_msg_404_was_deleted', array(
       
  1429                     'delete_time' => enano_date('d M Y h:i a', $r['time_id']),
       
  1430                     'delete_reason' => htmlspecialchars($r['edit_summary']),
       
  1431                     'rollback_flags' => 'href="'.makeUrl($paths->page, 'do=rollback&amp;id='.$r['time_id']).'" onclick="ajaxRollback(\''.$r['time_id'].'\'); return false;"'
       
  1432                   ))
       
  1433                 . '</p>';
  1419           if ( $session->user_level >= USER_LEVEL_ADMIN )
  1434           if ( $session->user_level >= USER_LEVEL_ADMIN )
  1420           {
  1435           {
  1421             echo '<p>Additional admin options: <a href="' . makeUrl($paths->page, 'do=detag', true) . '" title="Remove any tags on this page">detag page</a></p>';
  1436             echo '<p>' . $lang->get('page_msg_404_admin_opts', array(
       
  1437                       'detag_link' => makeUrl($paths->page, 'do=detag', true)
       
  1438                     ))
       
  1439                   . '</p>';
  1422           }
  1440           }
  1423         }
  1441         }
  1424         $db->free_result();
  1442         $db->free_result();
  1425       }
  1443       }
  1426       echo '<p>
  1444       echo '<p>
  1427               HTTP Error: 404 Not Found
  1445               ' . $lang->get('page_msg_404_http_response') . '
  1428             </p>';
  1446             </p>';
  1429     }
  1447     }
  1430     $this->footer();
  1448     $this->footer();
  1431   }
  1449   }
  1432   
  1450   
  1489    */
  1507    */
  1490    
  1508    
  1491   function send_error($message, $sql = false)
  1509   function send_error($message, $sql = false)
  1492   {
  1510   {
  1493     global $db, $session, $paths, $template, $plugins; // Common objects
  1511     global $db, $session, $paths, $template, $plugins; // Common objects
       
  1512     global $lang;
  1494     
  1513     
  1495     $content = "<p>$message</p>";
  1514     $content = "<p>$message</p>";
  1496     $template->tpl_strings['PAGE_NAME'] = 'General error in page fetcher';
  1515     $template->tpl_strings['PAGE_NAME'] = $lang->get('page_msg_general_error');
  1497     
  1516     
  1498     if ( $this->debug['works'] )
  1517     if ( $this->debug['works'] )
  1499     {
  1518     {
  1500       $content .= $this->debug['backtrace'];
  1519       $content .= $this->debug['backtrace'];
  1501     }
  1520     }