Source for file folders_create.php

Documentation is available at folders_create.php

  1. <?php
  2.  
  3. /**
  4.  * folders_create.php
  5.  *
  6.  * Creates folders on the IMAP server.
  7.  * Called from folders.php
  8.  *
  9.  * @copyright 1999-2014 The SquirrelMail Project Team
  10.  * @license http://opensource.org/licenses/gpl-license.php GNU Public License
  11.  * @version $Id: folders_create.php 14436 2014-01-21 21:30:59Z pdontthink $
  12.  * @package squirrelmail
  13.  */
  14.  
  15. /** This is the folders_create page */
  16. define('PAGE_NAME''folders_create');
  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/imap.php');
  28. require_once(SM_PATH 'functions/display_messages.php');
  29.  
  30. /* get globals we may need */
  31. sqgetGlobalVar('key',          $key,           SQ_COOKIE);
  32. sqgetGlobalVar('username',     $username,      SQ_SESSION);
  33. sqgetGlobalVar('onetimepad',   $onetimepad,    SQ_SESSION);
  34. sqgetGlobalVar('delimiter',    $delimiter,     SQ_SESSION);
  35. sqgetGlobalVar('folder_name',  $folder_name,   SQ_POST);
  36. sqgetGlobalVar('subfolder',    $subfolder,     SQ_POST);
  37. if (sqgetGlobalVar('contain_subs'$contain_subs,  SQ_POST)) {
  38.     unset($contain_subs);
  39. }
  40. if (!sqgetGlobalVar('smtoken',$submitted_tokenSQ_POST)) {
  41.     $submitted_token '';
  42. }
  43. /* end of get globals */
  44.  
  45. // first, validate security token
  46. sm_validate_security_token($submitted_token-1TRUE);
  47.  
  48. $folder_name trim($folder_name);
  49.  
  50. if (substr_count($folder_name'"'|| substr_count($folder_name"\\"||
  51.     substr_count($folder_name$delimiter|| ($folder_name == '')) {
  52.     displayPageHeader($color'None');
  53.  
  54.     plain_error_message(_("Illegal folder name. Please select a different name.").
  55.         '<br /><a href="../src/folders.php">'._("Click here to go back").'</a>.'$color);
  56.  
  57.     exit;
  58. }
  59.  
  60. $folder_name imap_utf7_encode_local($folder_name);
  61.  
  62. if (isset($contain_subs&& $contain_subs {
  63.     $folder_type 'noselect';
  64. else {
  65.     $folder_type '';
  66. }
  67.  
  68. if ($folder_prefix && (substr($folder_prefix-1!= $delimiter)) {
  69.     $folder_prefix $folder_prefix $delimiter;
  70. }
  71. if ($folder_prefix && (substr($subfolder0strlen($folder_prefix)) != $folder_prefix)){
  72.     $subfolder_orig $subfolder;
  73.     $subfolder $folder_prefix $subfolder;
  74. else {
  75.     $subfolder_orig $subfolder;
  76. }
  77.  
  78. global $imap_stream_options// in case not defined in config
  79. $imapConnection sqimap_login($username$key$imapServerAddress$imapPort0$imap_stream_options);
  80.  
  81. if (trim($subfolder_orig== ''{
  82.     sqimap_mailbox_create ($imapConnection$folder_prefix.$folder_name$folder_type);
  83. else {
  84.     sqimap_mailbox_create ($imapConnection$subfolder.$delimiter.$folder_name$folder_type);
  85. }
  86.  
  87. sqimap_logout($imapConnection);
  88.  
  89. $location get_location();
  90. header ("Location: $location/folders.php?success=create");

Documentation generated on Fri, 22 Aug 2014 04:20:54 +0200 by phpDocumentor 1.4.3