Source for file options_order.php

Documentation is available at options_order.php

  1. <?php
  2.  
  3. /**
  4.  * options_order.php
  5.  *
  6.  * Displays messagelist column order options
  7.  *
  8.  * @copyright &copy; 1999-2006 The SquirrelMail Project Team
  9.  * @license http://opensource.org/licenses/gpl-license.php GNU Public License
  10.  * @version $Id: options_order.php,v 1.28.2.8 2006/04/14 22:27:08 jervfors Exp $
  11.  * @package squirrelmail
  12.  * @subpackage prefs
  13.  */
  14.  
  15. /**
  16.  * Path for SquirrelMail required files.
  17.  * @ignore
  18.  */
  19. define('SM_PATH','../');
  20.  
  21. /* SquirrelMail required files. */
  22. require_once(SM_PATH 'include/validate.php');
  23. require_once(SM_PATH 'functions/global.php');
  24. require_once(SM_PATH 'functions/display_messages.php');
  25. require_once(SM_PATH 'functions/imap.php');
  26. require_once(SM_PATH 'functions/plugin.php');
  27. require_once(SM_PATH 'functions/html.php');
  28.  
  29. /* get globals */
  30. sqgetGlobalVar('num',       $num,       SQ_GET);  
  31. sqgetGlobalVar('add',       $add,       SQ_POST);
  32.  
  33. sqgetGlobalVar('submit',    $submit);
  34. sqgetGlobalVar('method',    $method);
  35. /* end of get globals */
  36.  
  37. displayPageHeader($color'None');
  38.  
  39.    echo
  40.    html_tag'table''''center''''width="95%" border="0" cellpadding="1" cellspacing="0"' 
  41.    html_tag'tr' 
  42.    html_tag'td''''center'$color[0.
  43.    '<b>' _("Options"' - ' _("Index Order"'</b>' .
  44.    html_tag'table''''''''width="100%" border="0" cellpadding="8" cellspacing="0"' 
  45.    html_tag'tr' 
  46.    html_tag'td''''center'$color[4);
  47.  
  48.     $available[1_("Checkbox");
  49.     $available[2_("From");
  50.     $available[3_("Date");
  51.     $available[4_("Subject");
  52.     $available[5_("Flags");
  53.     $available[6_("Size");
  54.     
  55.     if (isset($method)) $method ''}
  56.  
  57.     if ($method == 'up' && $num 1{
  58.         $prev $num-1;
  59.         $tmp $index_order[$prev];
  60.         $index_order[$prev$index_order[$num];
  61.         $index_order[$num$tmp;
  62.     else if ($method == 'down' && $num count($index_order)) {
  63.         $next $num++;
  64.         $tmp $index_order[$next];
  65.         $index_order[$next$index_order[$num];
  66.         $index_order[$num$tmp;
  67.     else if ($method == 'remove' && $num{
  68.         for ($i=1$i 8$i++{
  69.             removePref($data_dir$username"order$i")
  70.         }
  71.         for ($j=1,$i=1$i <= count($index_order)$i++{
  72.            if ($i != $num{
  73.                $new_ary[$j$index_order[$i];
  74.                $j++;
  75.            }
  76.         }
  77.         $index_order array();
  78.         $index_order $new_ary;
  79.         if (count($index_order1{
  80.            include_once(SM_PATH 'include/load_prefs.php');
  81.         }
  82.     else if ($method == 'add' && $add{
  83.         /* User should not be able to insert PHP-code here */
  84.         $add str_replace ('<?''..'$add);
  85.         $add ereg_replace ('<.*script.*language.*php.*>''..'$add);
  86.         $add str_replace ('<%''..'$add);
  87.         $index_order[count($index_order)+1$add;
  88.     }
  89.  
  90.     if ($method{
  91.         for ($i=1$i <= count($index_order)$i++{
  92.            setPref($data_dir$username"order$i"$index_order[$i]);
  93.         }
  94.     }
  95.     echo html_tag'table',
  96.                 html_tag'tr',
  97.                     html_tag'td',
  98.                         _("The index order is the order that the columns are arranged in the message index. You can add, remove, and move columns around to customize them to fit your needs.")
  99.                     )
  100.                 ,
  101.             '''''''width="65%" border="0" cellpadding="0" cellspacing="0"' "<br />\n";
  102.  
  103.     if (count($index_order))
  104.     {
  105.         echo html_tag'table'''''''' cellspacing="0" cellpadding="0" border="0"' "\n";
  106.         for ($i=1$i <= count($index_order)$i++{
  107.             $tmp $index_order[$i];
  108.             echo html_tag'tr' );
  109.             echo html_tag'td''<small><a href="options_order.php?method=up&amp;num=' $i '">'_("up".'</a></small>' );
  110.             echo html_tag'td''<small>&nbsp;|&nbsp;</small>' );
  111.             echo html_tag'td''<small><a href="options_order.php?method=down&amp;num=' $i '">'_("down".'</a></small>' );
  112.             echo html_tag'td''<small>&nbsp;|&nbsp;</small>' );
  113.             echo html_tag'td' );
  114.             /* Always show the subject */
  115.             if ($tmp != 4)
  116.                echo '<small><a href="options_order.php?method=remove&amp;num=' $i '">' _("remove"'</a></small>';
  117.             else
  118.                echo '&nbsp;'
  119.             echo '</td>';
  120.             echo html_tag'td''<small>&nbsp;-&nbsp;</small>' );
  121.             echo html_tag'td'$available[$tmp);
  122.             echo '</tr>' "\n";
  123.         }
  124.         echo '</table>' "\n";
  125.     }
  126.     
  127.     if (count($index_order!= count($available)) {
  128.         echo '<form name="f" method="post" action="options_order.php">';
  129.         echo '<select name="add">';
  130.         for ($i=1$i <= count($available)$i++{
  131.             $found false;
  132.             for ($j=1$j <= count($index_order)$j++{
  133.                 if ($index_order[$j== $i{
  134.                     $found true;
  135.                 }
  136.             }
  137.             if (!$found{
  138.                 echo "<option value=\"$i\">$available[$i]</option>";
  139.             }
  140.         }
  141.         echo '</select>';
  142.         echo '<input type="hidden" value="add" name="method" />';
  143.         echo '<input type="submit" value="'._("Add").'" name="submit" />';
  144.         echo '</form>';
  145.     }
  146.  
  147.     echo html_tag'p''<a href="../src/options.php">' _("Return to options page"'</a></p><br />' );
  148.  
  149. ?>
  150.     </td></tr>
  151.     </table>
  152.  
  153. </td></tr>
  154. </table>
  155. </body></html>

Documentation generated on Sat, 07 Oct 2006 16:32:58 +0300 by phpDocumentor 1.3.0RC6