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

Documentation generated on Mon, 13 Jan 2020 04:25:09 +0100 by phpDocumentor 1.4.3