Преглед изворни кода

Converted all files in functions/ to use SM_PATH. This will break all
plugins. Each callable script needs a:

define('SM_PATH', '../../');

Or something like that put at the top.

thomppj пре 23 година
родитељ
комит
9001d31cf8

+ 2 - 2
functions/addressbook.php

@@ -30,8 +30,8 @@
   Include backends here.
 */
 
-require_once('../functions/abook_local_file.php');
-require_once('../functions/abook_ldap_server.php');
+require_once(SM_PATH . 'functions/abook_local_file.php');
+require_once(SM_PATH . 'functions/abook_ldap_server.php');
 
 global $addrbook_dsn;
 

+ 1 - 1
functions/constants.php

@@ -13,7 +13,7 @@
  * $Id$
  */
 
-require_once('../functions/plugin.php');      // Required for the hook
+require_once(SM_PATH . 'functions/plugin.php');  /* Required for the hook */
 
 /**************************************************************/
 /* Set values for constants used by Squirrelmail preferences. */

+ 1 - 1
functions/date.php

@@ -14,7 +14,7 @@
  * $Id$
  */
 
-require_once( '../functions/constants.php' );
+require_once(SM_PATH . 'functions/constants.php');
 
 /* corrects a time stamp to be the local time */
 function getGMTSeconds($stamp, $gmt) {

+ 1 - 1
functions/db_prefs.php

@@ -33,7 +33,7 @@ define('SMDB_MYSQL', 1);
 define('SMDB_PGSQL', 2);
 
 require_once('DB.php');
-require_once('../config/config.php');
+require_once(SM_PATH . 'config/config.php');
 
 global $prefs_are_cached, $prefs_cache;
 

+ 6 - 5
functions/imap.php

@@ -12,9 +12,10 @@
  * $Id$
  */
 
-require_once('../functions/imap_mailbox.php');
-require_once('../functions/imap_messages.php');
-require_once('../functions/imap_general.php');
-require_once('../functions/imap_search.php');
-require_once('../functions/imap_parse.php');
+require_once(SM_PATH . 'functions/imap_mailbox.php');
+require_once(SM_PATH . 'functions/imap_messages.php');
+require_once(SM_PATH . 'functions/imap_general.php');
+require_once(SM_PATH . 'functions/imap_search.php');
+require_once(SM_PATH . 'functions/imap_parse.php');
+
 ?>

+ 1 - 1
functions/imap_general.php

@@ -11,7 +11,7 @@
  * $Id$
  */
 
-require_once('../functions/page_header.php');
+require_once(SM_PATH . 'functions/page_header.php');
 
 global $sqimap_session_id;
 $sqimap_session_id = 1;

+ 7 - 7
functions/imap_mailbox.php

@@ -10,8 +10,8 @@
  *
  * $Id$
  */
-require_once('../functions/imap_utf7_encode_local.php');
-require_once('../functions/imap_utf7_decode_local.php');
+require_once(SM_PATH . 'functions/imap_utf7_encode_local.php');
+require_once(SM_PATH . 'functions/imap_utf7_decode_local.php');
 global $boxesnew;
 
 class mailboxes {
@@ -461,8 +461,8 @@ function sqimap_mailbox_list($imap_stream) {
         $inbox_in_list = false;
         $inbox_subscribed = false;
 
-        require_once('../src/load_prefs.php');
-        require_once('../functions/array.php');
+        require_once(SM_PATH . 'src/load_prefs.php');
+        require_once(SM_PATH . 'functions/array.php');
 
     if ($noselect_fix_enable) {
         $lsub_args = "LSUB \"$folder_prefix\" \"*%\"";
@@ -615,7 +615,7 @@ function sqimap_mailbox_list($imap_stream) {
 function sqimap_mailbox_list_all($imap_stream) {
     global $list_special_folders_first, $folder_prefix, $delimiter;
 
-    require_once('../functions/array.php');
+    require_once(SM_PATH . 'functions/array.php');
 
     $ssid = sqimap_session_id();
     $lsid = strlen( $ssid );
@@ -711,8 +711,8 @@ function sqimap_mailbox_tree($imap_stream) {
         $inbox_in_list = false;
         $inbox_subscribed = false;
 
-        require_once('../src/load_prefs.php');
-        require_once('../functions/array.php');
+        require_once(SM_PATH . 'src/load_prefs.php');
+        require_once(SM_PATH . 'functions/array.php');
 
         /* LSUB array */
         $lsub_ary = sqimap_run_command ($imap_stream, "LSUB \"$folder_prefix\" \"*\"",

+ 5 - 5
functions/imap_search.php

@@ -11,11 +11,11 @@
  * $Id$
  */
 
-require_once('../functions/imap.php');
-require_once('../functions/date.php');
-require_once('../functions/array.php');
-require_once('../functions/mailbox_display.php');
-require_once('../functions/mime.php');
+require_once(SM_PATH . 'functions/imap.php');
+require_once(SM_PATH . 'functions/date.php');
+require_once(SM_PATH . 'functions/array.php');
+require_once(SM_PATH . 'functions/mailbox_display.php');
+require_once(SM_PATH . 'functions/mime.php');
 
 function sqimap_search($imapConnection, $search_where, $search_what, $mailbox,
                        $color, $search_position = '', $search_all, $count_all) {

+ 4 - 4
functions/mailbox_display.php

@@ -12,10 +12,10 @@
  * $Id$
  */
 
-require_once('../functions/strings.php');
-require_once('../functions/html.php');
-require_once('../class/html.class.php');
-require_once('../functions/imap_mailbox.php');
+require_once(SM_PATH . 'functions/strings.php');
+require_once(SM_PATH . 'functions/html.php');
+require_once(SM_PATH . 'class/html.class.php');
+require_once(SM_PATH . 'functions/imap_mailbox.php');
 
 /* Default value for page_selector_max. */
 define('PG_SEL_MAX', 10);

+ 3 - 3
functions/mime.php

@@ -12,8 +12,8 @@
  * $Id$
  */
 
-require_once('../functions/imap.php');
-require_once('../functions/attachment_common.php');
+require_once(SM_PATH . 'functions/imap.php');
+require_once(SM_PATH . 'functions/attachment_common.php');
 
 /* --------------------------------------------------------------------------------- */
 /* MIME DECODING                                                                     */
@@ -268,7 +268,7 @@ function translateText(&$body, $wrap_at, $charset) {
     global $where, $what;   /* from searching */
     global $color;          /* color theme */
 
-    require_once('../functions/url_parser.php');
+    require_once(SM_PATH . 'functions/url_parser.php');
 
     $body_ary = explode("\n", $body);
     for ($i=0; $i < count($body_ary); $i++) {

+ 4 - 4
functions/page_header.php

@@ -11,10 +11,10 @@
  * $Id$
  */
 
-require_once('../functions/strings.php');
-//require_once('../functions/imap_utf7_decode_local.php');
-require_once('../functions/html.php');
-require_once('../functions/imap_mailbox.php');
+require_once(SM_PATH . 'functions/strings.php');
+require_once(SM_PATH . 'functions/html.php');
+require_once(SM_PATH . 'functions/imap_mailbox.php');
+
 /* Always set up the language before calling these functions */
 function displayHtmlHeader( $title = 'SquirrelMail', $xtra = '', $do_hook = TRUE ) {
 

+ 2 - 2
functions/plugin.php

@@ -89,10 +89,10 @@ if (isset($plugins) && is_array($plugins)) {
 
         global $HTTP_USER_AGENT, $SQSPELL_SOUP_NAZI;
         
-        require_once('../plugins/squirrelspell/sqspell_config.php');
+        require_once(SM_PATH . 'plugins/squirrelspell/sqspell_config.php');
 
         $soup_menu = explode( ',', $SQSPELL_SOUP_NAZI );
         return( in_array( trim( $HTTP_USER_AGENT ), $soup_menu ) );
     }
 
-?>
+?>

+ 2 - 2
functions/prefs.php

@@ -23,9 +23,9 @@ if ( !session_is_registered('prefs_are_cached') ||
 }
 
 if (isset($prefs_dsn) && !empty($prefs_dsn)) {
-    require_once('../functions/db_prefs.php');
+    require_once(SM_PATH . 'functions/db_prefs.php');
 } else {
-    require_once('../functions/file_prefs.php');
+    require_once(SM_PATH . 'functions/file_prefs.php');
 }
 
 /* Hashing functions */

+ 3 - 3
functions/smtp.php

@@ -12,9 +12,9 @@
  * $Id$
  */
 
-require_once('../functions/addressbook.php');
-require_once('../functions/plugin.php');
-require_once('../functions/prefs.php');
+require_once(SM_PATH . 'functions/addressbook.php');
+require_once(SM_PATH . 'functions/plugin.php');
+require_once(SM_PATH . 'functions/prefs.php');
 
 global $username, $popuser, $domain;
 

+ 1 - 1
functions/tree.php

@@ -12,7 +12,7 @@
  * $Id$
  */
 
-require_once('../functions/imap.php');
+require_once(SM_PATH . 'functions/imap.php');
 
 /**
  * findParentForChild