Source for file folders_create.php

Documentation is available at folders_create.php

  1. <?php
  2.  
  3. /**
  4.  * folders_create.php
  5.  *
  6.  * Copyright (c) 1999-2006 The SquirrelMail Project Team
  7.  * Licensed under the GNU GPL. For full terms see the file COPYING.
  8.  *
  9.  * Creates folders on the IMAP server.
  10.  * Called from folders.php
  11.  *
  12.  * @version $Id: folders_create.php,v 1.64.2.7 2006/08/24 20:00:09 kink Exp $
  13.  * @package squirrelmail
  14.  */
  15.  
  16. /**
  17.  * Path for SquirrelMail required files.
  18.  * @ignore
  19.  */
  20. define('SM_PATH','../');
  21.  
  22. /* SquirrelMail required files. */
  23. require_once(SM_PATH 'include/validate.php');
  24. require_once(SM_PATH 'functions/global.php');
  25. require_once(SM_PATH 'functions/imap.php');
  26. require_once(SM_PATH 'functions/display_messages.php');
  27.  
  28. /* get globals we may need */
  29. sqgetGlobalVar('key',          $key,           SQ_COOKIE);
  30. sqgetGlobalVar('username',     $username,      SQ_SESSION);
  31. sqgetGlobalVar('onetimepad',   $onetimepad,    SQ_SESSION);
  32. sqgetGlobalVar('delimiter',    $delimiter,     SQ_SESSION);
  33. sqgetGlobalVar('folder_name',  $folder_name,   SQ_POST);
  34. sqgetGlobalVar('subfolder',    $subfolder,     SQ_POST);
  35. if (sqgetGlobalVar('contain_subs'$contain_subs,  SQ_POST)) {
  36.     unset($contain_subs);
  37. }
  38. /* end of get globals */
  39.  
  40. $folder_name trim($folder_name);
  41.  
  42. if (substr_count($folder_name'"'|| substr_count($folder_name"\\"||
  43.     substr_count($folder_name$delimiter|| ($folder_name == '')) {
  44.     displayPageHeader($color'None');
  45.  
  46.     plain_error_message(_("Illegal folder name. Please select a different name.").
  47.         '<br /><a href="../src/folders.php">'._("Click here to go back").'</a>.'$color);
  48.  
  49.     exit;
  50. }
  51.  
  52. $folder_name imap_utf7_encode_local($folder_name);
  53.  
  54. if (isset($contain_subs&& $contain_subs {
  55.     $folder_type 'noselect';
  56. else {
  57.     $folder_type '';
  58. }
  59.  
  60. if ($folder_prefix && (substr($folder_prefix-1!= $delimiter)) {
  61.     $folder_prefix $folder_prefix $delimiter;
  62. }
  63. if ($folder_prefix && (substr($subfolder0strlen($folder_prefix)) != $folder_prefix)){
  64.     $subfolder_orig $subfolder;
  65.     $subfolder $folder_prefix $subfolder;
  66. else {
  67.     $subfolder_orig $subfolder;
  68. }
  69.  
  70. $imapConnection sqimap_login($username$key$imapServerAddress$imapPort0);
  71.  
  72. if (trim($subfolder_orig== ''{
  73.     sqimap_mailbox_create ($imapConnection$folder_prefix.$folder_name$folder_type);
  74. else {
  75.     sqimap_mailbox_create ($imapConnection$subfolder.$delimiter.$folder_name$folder_type);
  76. }
  77.  
  78. sqimap_logout($imapConnection);
  79.  
  80. $location get_location();
  81. header ("Location$location/folders.php?success=create");
  82.  
  83. ?>

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