changeset 1175 | 1e2c9819ede3 |
parent 1153 | 124ebcbb6a31 |
child 1216 | 4125e19d3b27 |
1174:def792dd9b1b | 1175:1e2c9819ede3 |
---|---|
202 |
202 |
203 $paths->add_page($page_data); |
203 $paths->add_page($page_data); |
204 |
204 |
205 $qa = $db->sql_query('INSERT INTO ' . table_prefix.'pages(name,urlname,namespace,visible,protected,delvote_ips) VALUES(\'' . $db->escape($name) . '\', \'' . $db->escape($page_id) . '\', \'' . $namespace . '\', '. ( $visible ? '1' : '0' ) .', ' . $prot . ', \'' . $db->escape(serialize($ips)) . '\');'); |
205 $qa = $db->sql_query('INSERT INTO ' . table_prefix.'pages(name,urlname,namespace,visible,protected,delvote_ips) VALUES(\'' . $db->escape($name) . '\', \'' . $db->escape($page_id) . '\', \'' . $namespace . '\', '. ( $visible ? '1' : '0' ) .', ' . $prot . ', \'' . $db->escape(serialize($ips)) . '\');'); |
206 $qb = $db->sql_query('INSERT INTO ' . table_prefix.'page_text(page_id,namespace) VALUES(\'' . $db->escape($page_id) . '\', \'' . $namespace . '\');'); |
206 $qb = $db->sql_query('INSERT INTO ' . table_prefix.'page_text(page_id,namespace) VALUES(\'' . $db->escape($page_id) . '\', \'' . $namespace . '\');'); |
207 $qc = $db->sql_query('INSERT INTO ' . table_prefix.'logs(time_id,date_string,log_type,action,author,page_id,namespace) VALUES('.time().', \'DEPRECATED\', \'page\', \'create\', \'' . $session->username . '\', \'' . $db->escape($page_id) . '\', \'' . $namespace . '\');'); |
207 $qc = $db->sql_query('INSERT INTO ' . table_prefix.'logs(time_id,date_string,log_type,action,author,author_uid,page_id,namespace) VALUES('.time().', \'DEPRECATED\', \'page\', \'create\', \'' . $session->username . '\', ' . $session->user_id . ', \'' . $db->escape($page_id) . '\', \'' . $namespace . '\');'); |
208 |
208 |
209 if($qa && $qb && $qc) |
209 if($qa && $qb && $qc) |
210 return 'good'; |
210 return 'good'; |
211 else |
211 else |
212 { |
212 { |
267 } |
267 } |
268 |
268 |
269 $wiki = ( ( $cdata['wiki_mode'] == 2 && getConfig('wiki_mode') == '1') || $cdata['wiki_mode'] == 1) ? true : false; |
269 $wiki = ( ( $cdata['wiki_mode'] == 2 && getConfig('wiki_mode') == '1') || $cdata['wiki_mode'] == 1) ? true : false; |
270 $prot = ( ( $cdata['protected'] == 2 && $session->user_logged_in && $session->reg_time + 60*60*24*4 < time() ) || $cdata['protected'] == 1) ? true : false; |
270 $prot = ( ( $cdata['protected'] == 2 && $session->user_logged_in && $session->reg_time + 60*60*24*4 < time() ) || $cdata['protected'] == 1) ? true : false; |
271 |
271 |
272 $q = 'SELECT log_id,time_id,date_string,page_id,namespace,author,edit_summary,minor_edit FROM ' . table_prefix.'logs WHERE log_type=\'page\' AND action=\'edit\' AND page_id=\'' . $page_id . '\' AND namespace=\'' . $namespace . '\' AND is_draft != 1 ORDER BY time_id DESC;'; |
272 $q = 'SELECT log_id,time_id,date_string,page_id,namespace,author,author_uid,u.username,edit_summary,minor_edit FROM ' . table_prefix . "logs AS l\n" |
273 . " LEFT JOIN " . table_prefix . "users AS u\n" |
|
274 . " ON ( u.user_id = l.author_uid OR u.user_id IS NULL )\n" |
|
275 . " WHERE log_type='page' AND action='edit' AND page_id='$page_id' AND namespace='$namespace' AND is_draft != 1 ORDER BY time_id DESC;"; |
|
276 |
|
273 if ( !($q = $db->sql_query($q)) ) |
277 if ( !($q = $db->sql_query($q)) ) |
274 $db->_die('The history data for the page "' . $paths->cpage['name'] . '" could not be selected.'); |
278 $db->_die('The history data for the page "' . $paths->cpage['name'] . '" could not be selected.'); |
275 |
279 |
276 echo $lang->get('history_page_subtitle') . ' |
280 echo $lang->get('history_page_subtitle') . ' |
277 <h3>' . $lang->get('history_heading_edits') . '</h3>'; |
281 <h3>' . $lang->get('history_heading_edits') . '</h3>'; |
332 |
336 |
333 // Date and time |
337 // Date and time |
334 echo '<td class="' . $cls . '" style="white-space: nowrap;">' . enano_date(ED_DATE | ED_TIME, intval($r['time_id'])) . '</td class="' . $cls . '">'."\n"; |
338 echo '<td class="' . $cls . '" style="white-space: nowrap;">' . enano_date(ED_DATE | ED_TIME, intval($r['time_id'])) . '</td class="' . $cls . '">'."\n"; |
335 |
339 |
336 // User |
340 // User |
337 if ( $session->get_permissions('mod_misc') && is_valid_ip($r['author']) ) |
341 $real_username = $r['author_uid'] > 1 && !empty($r['username']) ? $r['username'] : $r['author']; |
342 $rank_info = $session->get_user_rank($r['author_uid']); |
|
343 if ( $session->get_permissions('mod_misc') && is_valid_ip($r['author']) && $r['author_uid'] == 1 ) |
|
338 { |
344 { |
339 $rc = ' style="cursor: pointer;" title="' . $lang->get('history_tip_rdns') . '" onclick="ajaxReverseDNS(this, \'' . $r['author'] . '\');"'; |
345 $rc = ' style="cursor: pointer;" title="' . $lang->get('history_tip_rdns') . '" onclick="ajaxReverseDNS(this, \'' . $r['author'] . '\');"'; |
340 } |
346 } |
341 else |
347 else |
342 { |
348 { |
343 $rc = ''; |
349 $rc = ''; |
344 } |
350 } |
345 echo '<td class="' . $cls . '"' . $rc . '><a href="'.makeUrlNS('User', sanitize_page_id($r['author'])).'" '; |
351 echo '<td class="' . $cls . '"' . $rc . '><a href="'.makeUrlNS('User', sanitize_page_id($real_username)).'" '; |
346 if ( !isPage($paths->nslist['User'] . sanitize_page_id($r['author'])) ) |
352 if ( !isPage($paths->nslist['User'] . sanitize_page_id($real_username)) ) |
347 { |
353 { |
348 echo 'class="wikilink-nonexistent"'; |
354 echo 'class="wikilink-nonexistent"'; |
349 } |
355 } |
350 echo '>' . $r['author'] . '</a></td class="' . $cls . '">'."\n"; |
356 echo 'style="' . $rank_info['rank_style'] . '">' . htmlspecialchars($real_username) . '</a></td class="' . $cls . '">'."\n"; |
351 |
357 |
352 // Edit summary |
358 // Edit summary |
353 if ( $r['edit_summary'] == 'Automatic backup created when logs were purged' ) |
359 if ( $r['edit_summary'] == 'Automatic backup created when logs were purged' ) |
354 { |
360 { |
355 $r['edit_summary'] = $lang->get('history_summary_clearlogs'); |
361 $r['edit_summary'] = $lang->get('history_summary_clearlogs'); |
375 </form> |
381 </form> |
376 <script type="text/javascript">if ( !KILL_SWITCH ) { buildDiffList(); }</script>'; |
382 <script type="text/javascript">if ( !KILL_SWITCH ) { buildDiffList(); }</script>'; |
377 } |
383 } |
378 $db->free_result(); |
384 $db->free_result(); |
379 echo '<h3>' . $lang->get('history_heading_other') . '</h3>'; |
385 echo '<h3>' . $lang->get('history_heading_other') . '</h3>'; |
380 $sql = 'SELECT log_id,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;'; |
386 |
387 $sql = 'SELECT log_id,action,time_id,date_string,page_id,namespace,author,author_uid,u.username,edit_summary,minor_edit FROM ' . table_prefix . "logs AS l\n" |
|
388 . " LEFT JOIN " . table_prefix . "users AS u\n" |
|
389 . " ON ( u.user_id = l.author_uid OR u.user_id IS NULL )\n" |
|
390 . " WHERE log_type='page' AND action!='edit' AND page_id='$page_id' AND namespace='$namespace' AND is_draft != 1 ORDER BY time_id DESC;"; |
|
391 |
|
381 if ( !( $q = $db->sql_query($sql)) ) |
392 if ( !( $q = $db->sql_query($sql)) ) |
382 { |
393 { |
383 $db->_die('The history data for the page "' . htmlspecialchars($paths->cpage['name']) . '" could not be selected.'); |
394 $db->_die('The history data for the page "' . htmlspecialchars($paths->cpage['name']) . '" could not be selected.'); |
384 } |
395 } |
385 if ( $db->numrows() < 1 ) |
396 if ( $db->numrows() < 1 ) |
408 |
419 |
409 // Date and time |
420 // Date and time |
410 echo '<td class="' . $cls . '">' . enano_date(ED_DATE | ED_TIME, intval($r['time_id'])) . '</td class="' . $cls . '">'; |
421 echo '<td class="' . $cls . '">' . enano_date(ED_DATE | ED_TIME, intval($r['time_id'])) . '</td class="' . $cls . '">'; |
411 |
422 |
412 // User |
423 // User |
413 echo '<td class="' . $cls . '"><a href="'.makeUrlNS('User', sanitize_page_id($r['author'])).'" '; |
424 $real_username = $r['author_uid'] > 1 && !empty($r['username']) ? $r['username'] : $r['author']; |
414 if(!isPage($paths->nslist['User'] . sanitize_page_id($r['author']))) echo 'class="wikilink-nonexistent"'; |
425 $rank_info = $session->get_user_rank($r['author_uid']); |
415 echo '>' . $r['author'] . '</a></td class="' . $cls . '">'; |
426 if ( $session->get_permissions('mod_misc') && is_valid_ip($r['author']) && $r['author_uid'] == 1 ) |
427 { |
|
428 $rc = ' style="cursor: pointer;" title="' . $lang->get('history_tip_rdns') . '" onclick="ajaxReverseDNS(this, \'' . $r['author'] . '\');"'; |
|
429 } |
|
430 else |
|
431 { |
|
432 $rc = ''; |
|
433 } |
|
434 echo '<td class="' . $cls . '"' . $rc . '><a href="'.makeUrlNS('User', sanitize_page_id($real_username)).'" '; |
|
435 if ( !isPage($paths->nslist['User'] . sanitize_page_id($real_username)) ) |
|
436 { |
|
437 echo 'class="wikilink-nonexistent"'; |
|
438 } |
|
439 echo 'style="' . $rank_info['rank_style'] . '">' . htmlspecialchars($real_username) . '</a></td class="' . $cls . '">'."\n"; |
|
416 |
440 |
417 |
441 |
418 // Minor edit |
442 // Minor edit |
419 echo '<td class="' . $cls . '" style="text-align: center;">'. (( $r['minor_edit'] ) ? 'M' : '' ) .'</td>'; |
443 echo '<td class="' . $cls . '" style="text-align: center;">'. (( $r['minor_edit'] ) ? 'M' : '' ) .'</td>'; |
420 |
444 |
1069 if ( !$session->sid_super ) |
1093 if ( !$session->sid_super ) |
1070 { |
1094 { |
1071 return $lang->get('etc_access_denied_need_reauth'); |
1095 return $lang->get('etc_access_denied_need_reauth'); |
1072 } |
1096 } |
1073 |
1097 |
1074 $e = $db->sql_query('INSERT INTO ' . table_prefix.'logs(time_id,date_string,log_type,action,page_id,namespace,author,edit_summary) VALUES('.time().', \''.enano_date(ED_DATE | ED_TIME).'\', \'page\', \'delete\', \'' . $page_id . '\', \'' . $namespace . '\', \'' . $session->username . '\', \'' . $db->escape(htmlspecialchars($reason)) . '\')'); |
1098 $e = $db->sql_query('INSERT INTO ' . table_prefix.'logs(time_id,date_string,log_type,action,page_id,namespace,author,author_uid,edit_summary) VALUES('.time().', \''.enano_date(ED_DATE | ED_TIME).'\', \'page\', \'delete\', \'' . $page_id . '\', \'' . $namespace . '\', \'' . $session->username . '\', ' . $session->user_id . ', \'' . $db->escape(htmlspecialchars($reason)) . '\')'); |
1075 if(!$e) $db->_die('The page log entry could not be inserted.'); |
1099 if(!$e) $db->_die('The page log entry could not be inserted.'); |
1076 $e = $db->sql_query('DELETE FROM ' . table_prefix.'categories WHERE page_id=\'' . $page_id . '\' AND namespace=\'' . $namespace . '\''); |
1100 $e = $db->sql_query('DELETE FROM ' . table_prefix.'categories WHERE page_id=\'' . $page_id . '\' AND namespace=\'' . $namespace . '\''); |
1077 if(!$e) $db->_die('The page categorization entries could not be deleted.'); |
1101 if(!$e) $db->_die('The page categorization entries could not be deleted.'); |
1078 $e = $db->sql_query('DELETE FROM ' . table_prefix.'comments WHERE page_id=\'' . $page_id . '\' AND namespace=\'' . $namespace . '\''); |
1102 $e = $db->sql_query('DELETE FROM ' . table_prefix.'comments WHERE page_id=\'' . $page_id . '\' AND namespace=\'' . $namespace . '\''); |
1079 if(!$e) $db->_die('The page comments could not be deleted.'); |
1103 if(!$e) $db->_die('The page comments could not be deleted.'); |