From 0fc2aca076a604fae5aa24b231288b4054a26fa2 Mon Sep 17 00:00:00 2001 From: philippe_mingo Date: Wed, 26 Sep 2001 10:43:39 +0000 Subject: [PATCH] Operation "foo_once". functions Folder Step 1: Check file including and change it to the _once system. git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@1526 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- functions/addressbook.php | 10 +++++----- functions/i18n.php | 4 ++-- functions/imap.php | 10 +++++----- functions/imap_mailbox.php | 11 +++++------ functions/imap_search.php | 12 ++++++------ functions/mime.php | 2 +- functions/plugin.php | 4 ++-- functions/smtp.php | 12 ++++++------ functions/strings.php | 4 ++-- functions/tree.php | 4 ++-- 10 files changed, 36 insertions(+), 37 deletions(-) diff --git a/functions/addressbook.php b/functions/addressbook.php index 11cb7d09..ecb8cd66 100644 --- a/functions/addressbook.php +++ b/functions/addressbook.php @@ -30,17 +30,17 @@ // Include backends here. - include('../functions/abook_local_file.php'); - include('../functions/abook_ldap_server.php'); + require_once('../functions/abook_local_file.php'); + require_once('../functions/abook_ldap_server.php'); // Use this if you wanna have a global address book if (isset($address_book_global_filename)) - include('../functions/abook_global_file.php'); + include_once('../functions/abook_global_file.php'); // Only load database backend if database is configured global $addrbook_dsn; if(isset($addrbook_dsn)) - include('../functions/abook_database.php'); + include_once('../functions/abook_database.php'); // Create and initialize an addressbook object. @@ -478,4 +478,4 @@ } -?> +?> \ No newline at end of file diff --git a/functions/i18n.php b/functions/i18n.php index 28bb04e4..ca477c37 100644 --- a/functions/i18n.php +++ b/functions/i18n.php @@ -785,7 +785,7 @@ // If we can fake gettext, try that elseif ($gettext_flags == 0) { $use_gettext = true; - include('../functions/gettext.php'); + include_once('../functions/gettext.php'); } else { // Uh-ho. A weird install if (! $gettext_flags & 1) { @@ -858,4 +858,4 @@ if ($my_charset) $default_charset=$my_charset; } -?> +?> \ No newline at end of file diff --git a/functions/imap.php b/functions/imap.php index 824501ce..fc65a681 100644 --- a/functions/imap.php +++ b/functions/imap.php @@ -11,8 +11,8 @@ $imap_backend = 'imap'; - include ('../functions/' . $imap_backend . '_mailbox.php'); - include ('../functions/' . $imap_backend . '_messages.php'); - include ('../functions/' . $imap_backend . '_general.php'); - include ('../functions/' . $imap_backend . '_search.php'); -?> + require_once('../functions/' . $imap_backend . '_mailbox.php'); + require_once('../functions/' . $imap_backend . '_messages.php'); + require_once('../functions/' . $imap_backend . '_general.php'); + require_once('../functions/' . $imap_backend . '_search.php'); +?> \ No newline at end of file diff --git a/functions/imap_mailbox.php b/functions/imap_mailbox.php index ebad86d2..f244876e 100755 --- a/functions/imap_mailbox.php +++ b/functions/imap_mailbox.php @@ -11,6 +11,9 @@ return; define ('imap_mailbox_php', true); + require_once('../src/load_prefs.php'); + require_once('../functions/array.php'); + /****************************************************************************** ** Expunges a mailbox ******************************************************************************/ @@ -210,8 +213,7 @@ $inbox_in_list = false; $inbox_subscribed = false; - include "../src/load_prefs.php"; - include "../functions/array.php"; + $dm = sqimap_get_delimiter ($imap_stream); @@ -358,9 +360,6 @@ function sqimap_mailbox_list_all ($imap_stream) { global $list_special_folders_first, $folder_prefix; - if (!function_exists ("ary_sort")) - include ("../functions/array.php"); - $dm = sqimap_get_delimiter ($imap_stream); fputs ($imap_stream, "a001 LIST \"$folder_prefix\" *\r\n"); @@ -445,4 +444,4 @@ return $boxes; } -?> +?> \ No newline at end of file diff --git a/functions/imap_search.php b/functions/imap_search.php index a92e8970..7efff2d8 100644 --- a/functions/imap_search.php +++ b/functions/imap_search.php @@ -8,11 +8,11 @@ return; define ('imap_search_php', true); - include("../functions/imap.php"); - include("../functions/date.php"); - include("../functions/array.php"); - include("../functions/mailbox_display.php"); - include("../functions/mime.php"); + 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'); function sqimap_search($imapConnection,$search_where,$search_what,$mailbox,$color) { @@ -152,4 +152,4 @@ function sqimap_search($imapConnection,$search_where,$search_what,$mailbox,$colo } } -?> +?> \ No newline at end of file diff --git a/functions/mime.php b/functions/mime.php index 044a486c..6271141a 100644 --- a/functions/mime.php +++ b/functions/mime.php @@ -14,7 +14,7 @@ global $debug_mime; $debug_mime = false; - include "../functions/imap.php"; + require_once('../functions/imap.php'); /** Setting up the objects that have the structure for the message **/ diff --git a/functions/plugin.php b/functions/plugin.php index a6371dfa..de8d4687 100644 --- a/functions/plugin.php +++ b/functions/plugin.php @@ -32,7 +32,7 @@ if (file_exists('../plugins/'.$name.'/setup.php')) { if ($plugin_general_debug) echo "plugin: -- Loading $name/setup.php
\n"; - include ('../plugins/'.$name.'/setup.php'); + include_once('../plugins/'.$name.'/setup.php'); $function = 'squirrelmail_plugin_init_'.$name; if (function_exists($function)) { @@ -87,4 +87,4 @@ } } -?> +?> \ No newline at end of file diff --git a/functions/smtp.php b/functions/smtp.php index 0d0edd14..fd179db6 100644 --- a/functions/smtp.php +++ b/functions/smtp.php @@ -11,8 +11,8 @@ return; define('smtp_php', true); - include('../functions/addressbook.php'); - include('../functions/plugin.php'); + require_once('../functions/addressbook.php'); + require_once('../functions/plugin.php'); global $username, $popuser, $domain; @@ -448,7 +448,7 @@ if ($num != 250) { $tmp = nl2br(htmlspecialchars($tmp)); displayPageHeader($color, 'None'); - include ("../functions/display_messages.php"); + include_once('../functions/display_messages.php'); $msg = "Message not sent!
\nReason given: $tmp"; plain_error_message($msg, $color); return(0); @@ -554,9 +554,9 @@ } if ($status == 0) { - include '../functions/page_header.php'; + include_once('../functions/page_header.php'); displayPageHeader($color, 'None'); - include ("../functions/display_messages.php"); + include_once('../functions/display_messages.php'); $lines = nl2br(htmlspecialchars($lines)); $msg = $message . "
\nServer replied: $lines"; plain_error_message($msg, $color); @@ -622,4 +622,4 @@ return $length; } -?> +?> \ No newline at end of file diff --git a/functions/strings.php b/functions/strings.php index dcef5bd0..ac71e9da 100644 --- a/functions/strings.php +++ b/functions/strings.php @@ -172,7 +172,7 @@ global $where, $what; // from searching global $color; // color theme - include '../functions/url_parser.php'; + require_once('../functions/url_parser.php'); $body_ary = explode("\n", $body); $PriorQuotes = 0; @@ -515,4 +515,4 @@ return ereg_replace('(["\\])', '\\\\1', $str); } -?> +?> \ No newline at end of file diff --git a/functions/tree.php b/functions/tree.php index cda8c8e3..f37c8422 100644 --- a/functions/tree.php +++ b/functions/tree.php @@ -6,7 +6,7 @@ return; define('tree_php', true); - include('../functions/imap.php'); + require_once('../functions/imap.php'); // Recursive function to find the correct parent for a new node function findParentForChild($value, $treeIndexToStart, $tree) { @@ -126,4 +126,4 @@ echo $tree[$index]['value'] . '
'; } } -?> +?> \ No newline at end of file -- 2.25.1