plugins/SpecialUserFuncs.php
changeset 909 94c1ff984286
parent 908 44302dd20d62
child 912 95d0d8596c87
equal deleted inserted replaced
908:44302dd20d62 909:94c1ff984286
  1253     echo '</div>';
  1253     echo '</div>';
  1254   }
  1254   }
  1255   $template->footer();
  1255   $template->footer();
  1256 }
  1256 }
  1257 
  1257 
  1258 function page_Special_Contributions() {
  1258 function page_Special_Contributions()
       
  1259 {
  1259   global $db, $session, $paths, $template, $plugins; // Common objects
  1260   global $db, $session, $paths, $template, $plugins; // Common objects
  1260   global $lang;
  1261   global $lang;
  1261   
  1262   
  1262   // This is a vast improvement over the old Special:Contributions in 1.0.x.
  1263   // This is a vast improvement over the old Special:Contributions in 1.0.x.
  1263   
  1264   
  1272     echo '<p>' . $lang->get('userfuncs_contribs_err_no_user') . '</p>';
  1273     echo '<p>' . $lang->get('userfuncs_contribs_err_no_user') . '</p>';
  1273     $template->footer();
  1274     $template->footer();
  1274     return;
  1275     return;
  1275   }
  1276   }
  1276   
  1277   
  1277   $user = $db->escape($user);
  1278   $url = makeUrlNS("Special", "Log/user={$user}");
  1278   $q = 'SELECT log_type, time_id, action, date_string, page_id, namespace, author, edit_summary, minor_edit, page_id, namespace, ( action = \'edit\' ) AS is_edit FROM '.table_prefix.'logs WHERE author=\''.$user.'\' AND log_type=\'page\' AND is_draft != 1 ORDER BY is_edit DESC, time_id DESC;';
  1279   redirect($url, '', '', 0);
  1279   $q = $db->sql_query($q);
       
  1280   if ( !$q )
       
  1281     $db->_die('SpecialUserFuncs selecting contribution data');
       
  1282   
       
  1283   echo '<h3>' . $lang->get('userfuncs_contribs_heading_edits') . '</h3>';
       
  1284   
       
  1285   $cnt_edits = 0;
       
  1286   $cnt_other = 0;
       
  1287   $current = 'cnt_edits';
       
  1288   $cls = 'row2';
       
  1289   
       
  1290   while ( $row = $db->fetchrow($q) )
       
  1291   {
       
  1292     if ( $current == 'cnt_edits' && $row['is_edit'] != 1 )
       
  1293     {
       
  1294       // No longer processing page edits - split the table
       
  1295       if ( $cnt_edits == 0 )
       
  1296       {
       
  1297         echo '<p>' . $lang->get('userfuncs_contribs_msg_no_edits') . '</p>';
       
  1298       }
       
  1299       else
       
  1300       {
       
  1301         echo '</table></div>';
       
  1302         echo '<h3>' . $lang->get('userfuncs_contribs_heading_other') . '</h3>';
       
  1303       }
       
  1304       $current = 'cnt_other';
       
  1305       $cls = 'row2';
       
  1306     }
       
  1307     if ( $$current == 0 )
       
  1308     {
       
  1309       echo '<div class="tblholder">
       
  1310               <table border="0" cellspacing="1" cellpadding="4">';
       
  1311       echo '  <tr>
       
  1312                 <th>' . $lang->get('history_col_datetime') . '</th>';
       
  1313       echo '    <th>' . $lang->get('history_col_page') . '</th>';
       
  1314       if ( $current == 'cnt_edits' )
       
  1315       {
       
  1316         echo '  <th>' . $lang->get('history_col_summary') . '</th>';
       
  1317       }
       
  1318       echo '    <th>' . $lang->get('history_col_minor') . '</th>';
       
  1319       if ( $current == 'cnt_other' )
       
  1320       {
       
  1321         echo '  <th>' . $lang->get('history_col_action_taken') . '</th>
       
  1322                 <th>' . $lang->get('history_col_extra') . '</th>
       
  1323              ';
       
  1324       }
       
  1325       echo '    <th>' . $lang->get('history_col_actions') . '</th>
       
  1326               </tr>';
       
  1327     }
       
  1328     $$current++;
       
  1329     $cls = ( $cls == 'row1' ) ? 'row2' : 'row1';
       
  1330     
       
  1331     echo '<tr>';
       
  1332     
       
  1333     // date & time
       
  1334     echo '  <td class="' . $cls . '">' . enano_date('d M Y h:i a', $row['time_id']) . '</td>';
       
  1335     
       
  1336     // page & link to said page
       
  1337     echo '  <td class="' . $cls . '"><a href="' . makeUrlNS($row['namespace'], $row['page_id']) . '">' . get_page_title_ns($row['page_id'], $row['namespace']) . '</a></td>';
       
  1338     
       
  1339     switch ( $row['action'] )
       
  1340     {
       
  1341       case 'edit':
       
  1342         if ( $row['edit_summary'] == 'Automatic backup created when logs were purged' )
       
  1343         {
       
  1344           $row['edit_summary'] = $lang->get('history_summary_clearlogs');
       
  1345         }
       
  1346         else if ( empty($row['edit_summary']) )
       
  1347         {
       
  1348           $row['edit_summary'] = '<span style="color: #808080">' . $lang->get('history_summary_none_given') . '</span>';
       
  1349         }
       
  1350         echo '  <td class="' . $cls . '">' . $row['edit_summary'] . '</td>';
       
  1351         if ( $row['minor_edit'] == 1 )
       
  1352         {
       
  1353           echo '<td class="' . $cls . '"><b>M</b></td>';
       
  1354         }
       
  1355         else
       
  1356         {
       
  1357           echo '<td class="' . $cls . '"></td>';
       
  1358         }
       
  1359         break;
       
  1360       case 'prot':
       
  1361         echo '  <td class="' . $cls . '"></td>';
       
  1362         echo '  <td class="' . $cls . '">' . $lang->get('history_log_protect') . '</td>';
       
  1363         echo '  <td class="' . $cls . '">' . $lang->get('history_extra_reason') . ' ' . $row['edit_summary'] . '</td>';
       
  1364         break;
       
  1365       case 'unprot':
       
  1366         echo '  <td class="' . $cls . '"></td>';
       
  1367         echo '  <td class="' . $cls . '">' . $lang->get('history_log_unprotect') . '</td>';
       
  1368         echo '  <td class="' . $cls . '">' . $lang->get('history_extra_reason') . ' ' . $row['edit_summary'] . '</td>';
       
  1369         break;
       
  1370       case 'semiprot':
       
  1371         echo '  <td class="' . $cls . '"></td>';
       
  1372         echo '  <td class="' . $cls . '">' . $lang->get('history_log_semiprotect') . '</td>';
       
  1373         echo '  <td class="' . $cls . '">' . $lang->get('history_extra_reason') . ' ' . $row['edit_summary'] . '</td>';
       
  1374         break;
       
  1375       case 'rename':
       
  1376         echo '  <td class="' . $cls . '"></td>';
       
  1377         echo '  <td class="' . $cls . '">' . $lang->get('history_log_rename') . '</td>';
       
  1378         echo '  <td class="' . $cls . '">' . $lang->get('history_extra_oldtitle') . ' ' . htmlspecialchars($row['edit_summary']) . '</td>';
       
  1379         break;
       
  1380       case 'create':
       
  1381         echo '  <td class="' . $cls . '"></td>';
       
  1382         echo '  <td class="' . $cls . '">' . $lang->get('history_log_create') . '</td>';
       
  1383         echo '  <td class="' . $cls . '"></td>';
       
  1384         break;
       
  1385       case 'delete':
       
  1386         echo '  <td class="' . $cls . '"></td>';
       
  1387         echo '  <td class="' . $cls . '">' . $lang->get('history_log_delete') . '</td>';
       
  1388         echo '  <td class="' . $cls . '">' . $lang->get('history_extra_reason') . ' ' . $row['edit_summary'] . '</td>';
       
  1389         break;
       
  1390       case 'reupload':
       
  1391         echo '  <td class="' . $cls . '"></td>';
       
  1392         echo '  <td class="' . $cls . '">' . $lang->get('history_log_uploadnew') . '</td>';
       
  1393         echo '  <td class="' . $cls . '">' . $lang->get('history_extra_reason') . ' ' . $row['edit_summary'] . '</td>';
       
  1394         break;
       
  1395     }
       
  1396     
       
  1397     // actions column
       
  1398     echo '    <td class="' . $cls . '" style="text-align: center;">';
       
  1399     if ( $row['is_edit'] == 1 )
       
  1400     {
       
  1401       echo '    <a href="' . makeUrlNS($row['namespace'], $row['page_id'], "oldid={$row['time_id']}", true) . '">' . $lang->get('history_action_view') . '</a> | ';
       
  1402       echo '      <a href="' . makeUrlNS($row['namespace'], $row['page_id'], "do=rollback&id={$row['time_id']}", true) . '">' . $lang->get('history_action_restore') . '</a>';
       
  1403     }
       
  1404     else
       
  1405     {
       
  1406       echo '      <a href="' . makeUrlNS($row['namespace'], $row['page_id'], "do=rollback&id={$row['time_id']}", true) . '">' . $lang->get('history_action_revert') . '</a>';
       
  1407     }
       
  1408     echo '    </td>';
       
  1409     
       
  1410     if ( $current == 'cnt_other' && $cnt_edits + $cnt_other >= $db->numrows($q) )
       
  1411     {
       
  1412       echo '</table></div>';
       
  1413     }
       
  1414   }
       
  1415   
       
  1416   if ( $current == 'cnt_edits' )
       
  1417   {
       
  1418     // no "other" edits, close the table
       
  1419     if ( $cnt_edits > 0 )
       
  1420       echo '</table></div>';
       
  1421     else
       
  1422       echo '<p>' . $lang->get('userfuncs_contribs_msg_no_edits') . '</p>';
       
  1423     echo '<h3>' . $lang->get('userfuncs_contribs_heading_other') . '</h3>';
       
  1424     echo '<p>' . $lang->get('userfuncs_contribs_msg_no_other') . '</p>';
       
  1425   }
       
  1426   
       
  1427   $db->free_result();
       
  1428   $template->footer();
       
  1429 }
  1280 }
  1430 
  1281 
  1431 function page_Special_ChangeStyle()
  1282 function page_Special_ChangeStyle()
  1432 {
  1283 {
  1433   global $db, $session, $paths, $template, $plugins; // Common objects
  1284   global $db, $session, $paths, $template, $plugins; // Common objects