plugins/SpecialPageFuncs.php
changeset 953 323c4cd1aa37
parent 871 4e45f191dc33
child 960 e74741b8360b
equal deleted inserted replaced
952:d52dfa1f08da 953:323c4cd1aa37
   311   // This should be an easy one
   311   // This should be an easy one
   312   global $db, $session, $paths, $template, $plugins; // Common objects
   312   global $db, $session, $paths, $template, $plugins; // Common objects
   313   global $lang;
   313   global $lang;
   314   
   314   
   315   $template->header();
   315   $template->header();
   316   $sz = sizeof( $paths->pages ) / 2;
       
   317   echo '<p>' . $lang->get('pagetools_allpages_blurb') . '</p>';
   316   echo '<p>' . $lang->get('pagetools_allpages_blurb') . '</p>';
   318   
   317   
   319   $q = $db->sql_query('SELECT COUNT(urlname) FROM '.table_prefix.'pages WHERE visible!=0;');
   318   $q = $db->sql_query('SELECT COUNT(urlname) FROM '.table_prefix.'pages WHERE visible!=0;');
   320   if ( !$q )
   319   if ( !$q )
   321     $db->_die();
   320     $db->_die();
   322   $row = $db->fetchrow_num();
   321   $row = $db->fetchrow_num();
   323   $count = $row[0];
   322   $count = $row[0];
       
   323   $sz =& $count;
   324   
   324   
   325   switch($count % 4)
   325   switch($count % 4)
   326   {
   326   {
   327     case 0:
   327     case 0:
   328     case 2:
   328     case 2:
   376   // This should be an easy one
   376   // This should be an easy one
   377   global $db, $session, $paths, $template, $plugins; // Common objects
   377   global $db, $session, $paths, $template, $plugins; // Common objects
   378   global $lang;
   378   global $lang;
   379   
   379   
   380   $template->header();
   380   $template->header();
   381   $sz = sizeof($paths->pages) / 2;
   381   echo '<p>' . $lang->get('pagetools_specialpages_blurb') . '</p><div class="tblholder"><table border="0" width="100%" cellspacing="1" cellpadding="4"><tr>';
   382   echo '<p>' . $lang->get('pagetools_specialpages_blurb') . '</p><div class="tblholder"><table border="0" width="100%" cellspacing="1" cellpadding="4">';
   382   $cclass = 'row1';
   383   $cclass='row1';
   383   $i = -1;
   384   for ( $i = 0; $i < $sz; $i = $i)
   384   foreach ( $paths->pages as $cdata )
   385   {
   385   {
   386     if ( $cclass == 'row1' )
   386     if ( $cdata['namespace'] != 'Special' )
   387     {
   387       continue;
   388       $cclass = 'row3';
   388     
   389     }
   389     $i++;
   390     else if ( $cclass == 'row3')
   390     if ( $i % 2 == 0 && $i > 0 )
   391     {
   391     {
   392       $cclass='row1';
   392       echo '</tr><tr>';
   393     }
   393       $cclass = ( $cclass == 'row1' ) ? 'row3' : 'row1';
   394     echo '<tr>';
   394     }
   395     for ( $j = 0; $j < 2; $j = $j )
   395     echo '<td style="width: 50%;" class="' . $cclass . '">';
   396     {
   396     echo '<a href="' . makeUrl($cdata['urlname']) . '">';
   397       if ( $i < $sz && $paths->pages[$i]['namespace'] == 'Special' && $paths->pages[$i]['visible'] == 1)
   397     echo htmlspecialchars($cdata['name']);
   398       {
   398     echo '</a>';
   399         echo '<td style="width: 50%" class="'.$cclass.'"><a href="'.makeUrl($paths->pages[$i]['urlname']).'">';
   399     echo '</td>';
   400         echo $paths->pages[$i]['name'].'</a></td>';
   400   }
   401         $j++;
   401   // close up the table if necessary
   402       }
   402   if ( $i % 2 > 0 )
   403       else if ( $i >= $sz )
   403   {
   404       {  
   404     echo "<td class=\"$cclass\"></td>";
   405         echo '<td style="width: 50%" class="row2"></td>';
       
   406         $j++;
       
   407       }
       
   408       $i++;
       
   409     }
       
   410     echo '</tr>';
       
   411   }
   405   }
   412   echo '</table></div>';
   406   echo '</table></div>';
   413   $template->footer();
   407   $template->footer();
   414 }
   408 }
   415 
   409