513 elseif($r['action']=='semiprot') echo $lang->get('history_log_semiprotect') . '</td><td class="' . $cls . '">' . $lang->get('history_extra_reason') . ' ' . ( $r['edit_summary'] === '__REVERSION__' ? $lang->get('history_extra_protection_reversion') : htmlspecialchars($r['edit_summary']) ); |
513 elseif($r['action']=='semiprot') echo $lang->get('history_log_semiprotect') . '</td><td class="' . $cls . '">' . $lang->get('history_extra_reason') . ' ' . ( $r['edit_summary'] === '__REVERSION__' ? $lang->get('history_extra_protection_reversion') : htmlspecialchars($r['edit_summary']) ); |
514 elseif($r['action']=='rename') echo $lang->get('history_log_rename') . '</td><td class="' . $cls . '">' . $lang->get('history_extra_oldtitle') . ' '.htmlspecialchars($r['edit_summary']); |
514 elseif($r['action']=='rename') echo $lang->get('history_log_rename') . '</td><td class="' . $cls . '">' . $lang->get('history_extra_oldtitle') . ' '.htmlspecialchars($r['edit_summary']); |
515 elseif($r['action']=='create') echo $lang->get('history_log_create') . '</td><td class="' . $cls . '">'; |
515 elseif($r['action']=='create') echo $lang->get('history_log_create') . '</td><td class="' . $cls . '">'; |
516 elseif($r['action']=='delete') echo $lang->get('history_log_delete') . '</td><td class="' . $cls . '">' . $lang->get('history_extra_reason') . ' ' . $r['edit_summary']; |
516 elseif($r['action']=='delete') echo $lang->get('history_log_delete') . '</td><td class="' . $cls . '">' . $lang->get('history_extra_reason') . ' ' . $r['edit_summary']; |
517 elseif($r['action']=='reupload') echo $lang->get('history_log_uploadnew') . '</td><td class="' . $cls . '">' . $lang->get('history_extra_reason') . ' ' . ( $r['edit_summary'] === '__ROLLBACK__' ? $lang->get('history_extra_upload_reversion') : htmlspecialchars($r['edit_summary']) ); |
517 elseif($r['action']=='reupload') echo $lang->get('history_log_uploadnew') . '</td><td class="' . $cls . '">' . $lang->get('history_extra_reason') . ' ' . ( $r['edit_summary'] === '__ROLLBACK__' ? $lang->get('history_extra_upload_reversion') : htmlspecialchars($r['edit_summary']) ); |
|
518 elseif($r['action']=='votereset')echo $lang->get('history_log_votereset') . '</td><td class="' . $cls . '">' . $lang->get('history_extra_numvotes') . ' ' . $r['edit_summary']; |
518 echo '</td>'; |
519 echo '</td>'; |
519 |
520 |
520 // Actions! |
521 // Actions! |
521 echo '<td class="' . $cls . '" style="text-align: center;"><a rel="nofollow" href="'.makeUrl($paths->nslist['Special'].'Contributions/' . $r['author']) . '">' . $lang->get('history_action_contrib') . '</a></td>'; |
522 echo '<td class="' . $cls . '" style="text-align: center;"><a rel="nofollow" href="'.makeUrl($paths->nslist['Special'].'Contributions/' . $r['author']) . '">' . $lang->get('history_action_contrib') . '</a></td>'; |
522 echo '<td class="' . $cls . '" style="text-align: center;"><a rel="nofollow" href="'.makeUrlNS($namespace, $page_id, 'do=rollback&id=' . $r['log_id']) . '" onclick="ajaxRollback(\'' . $r['log_id'] . '\'); return false;">' . $lang->get('history_action_revert') . '</a></td>'; |
523 echo '<td class="' . $cls . '" style="text-align: center;"><a rel="nofollow" href="'.makeUrlNS($namespace, $page_id, 'do=rollback&id=' . $r['log_id']) . '" onclick="ajaxRollback(\'' . $r['log_id'] . '\'); return false;">' . $lang->get('history_action_revert') . '</a></td>'; |
1310 { |
1311 { |
1311 global $db, $session, $paths, $template, $plugins; // Common objects |
1312 global $db, $session, $paths, $template, $plugins; // Common objects |
1312 global $lang; |
1313 global $lang; |
1313 global $cache; |
1314 global $cache; |
1314 |
1315 |
1315 if(!$session->get_permissions('vote_reset')) |
1316 if ( !$session->get_permissions('vote_reset') ) |
1316 { |
1317 { |
1317 return $lang->get('etc_access_denied'); |
1318 return $lang->get('etc_access_denied'); |
1318 } |
1319 } |
1319 $q = 'UPDATE ' . table_prefix.'pages SET delvotes=0,delvote_ips=\'' . $db->escape(serialize(array('ip'=>array(),'u'=>array()))) . '\' WHERE urlname=\'' . $page_id . '\' AND namespace=\'' . $namespace . '\''; |
1320 |
|
1321 $page_id = $db->escape($page_id); |
|
1322 $namespace = $db->escape($namespace); |
|
1323 |
|
1324 // pull existing info |
|
1325 $q = $db->sql_query('SELECT delvotes, delvote_ips FROM ' . table_prefix . "pages WHERE urlname = '$page_id' AND namespace = '$namespace'"); |
|
1326 if ( !$q ) |
|
1327 $db->_die(); |
|
1328 if ( $db->numrows() < 1 ) |
|
1329 return $lang->get('page_err_page_not_exist'); |
|
1330 |
|
1331 list($delvotes, $delvote_ips) = $db->fetchrow_num(); |
|
1332 $db->free_result(); |
|
1333 $delvote_ips = $db->escape($delvote_ips); |
|
1334 $username = $db->escape($session->username); |
|
1335 |
|
1336 // log action |
|
1337 $time = time(); |
|
1338 $q = $db->sql_query('INSERT INTO ' . table_prefix . "logs (time_id, log_type, action, edit_summary, page_text, author, page_id, namespace) VALUES\n" |
|
1339 . " ( $time, 'page', 'votereset', '$delvotes', '$delvote_ips', '$username', '$page_id', '$namespace' )"); |
|
1340 if ( !$q ) |
|
1341 $db->_die(); |
|
1342 |
|
1343 // reset votes |
|
1344 $empty_vote_record = $db->escape(serialize(array('ip'=>array(),'u'=>array()))); |
|
1345 $q = 'UPDATE ' . table_prefix.'pages SET delvotes=0,delvote_ips=\'' . $empty_vote_record . '\' WHERE urlname=\'' . $page_id . '\' AND namespace=\'' . $namespace . '\''; |
1320 $e = $db->sql_query($q); |
1346 $e = $db->sql_query($q); |
1321 if ( !$e ) |
1347 if ( !$e ) |
1322 { |
1348 { |
1323 $db->_die('The number of delete votes was not reset.'); |
1349 $db->_die('The number of delete votes was not reset.'); |
1324 } |
1350 } |
1539 */ |
1565 */ |
1540 |
1566 |
1541 public static function setwikimode($page_id, $namespace, $level) |
1567 public static function setwikimode($page_id, $namespace, $level) |
1542 { |
1568 { |
1543 global $db, $session, $paths, $template, $plugins; // Common objects |
1569 global $db, $session, $paths, $template, $plugins; // Common objects |
|
1570 global $cache; |
|
1571 |
1544 if(!$session->get_permissions('set_wiki_mode')) return('Insufficient access rights'); |
1572 if(!$session->get_permissions('set_wiki_mode')) return('Insufficient access rights'); |
1545 if ( !isset($level) || ( isset($level) && !preg_match('#^([0-2]){1}$#', (string)$level) ) ) |
1573 if ( !isset($level) || ( isset($level) && !preg_match('#^([0-2]){1}$#', (string)$level) ) ) |
1546 { |
1574 { |
1547 return('Invalid mode string'); |
1575 return('Invalid mode string'); |
1548 } |
1576 } |
1549 $q = $db->sql_query('UPDATE ' . table_prefix.'pages SET wiki_mode=' . $level . ' WHERE urlname=\'' . $page_id . '\' AND namespace=\'' . $namespace . '\';'); |
1577 $q = $db->sql_query('UPDATE ' . table_prefix.'pages SET wiki_mode=' . $level . ' WHERE urlname=\'' . $page_id . '\' AND namespace=\'' . $namespace . '\';'); |
1550 if ( !$q ) |
1578 if ( !$q ) |
1551 { |
1579 { |
1552 return('Error during update query: '.$db->get_error()."\n\nSQL Backtrace:\n".$db->sql_backtrace()); |
1580 return('Error during update query: '.$db->get_error()."\n\nSQL Backtrace:\n".$db->sql_backtrace()); |
1553 } |
1581 } |
|
1582 |
|
1583 $cache->purge('page_meta'); |
1554 return('GOOD'); |
1584 return('GOOD'); |
1555 } |
1585 } |
1556 |
1586 |
1557 /** |
1587 /** |
1558 * Sets the access password for a page. |
1588 * Sets the access password for a page. |