From: lkehresman Date: Tue, 25 Jul 2000 13:16:15 +0000 (+0000) Subject: - added a hook at beginning of left_main X-Git-Url: https://vcs.fsf.org/?p=squirrelmail.git;a=commitdiff_plain;h=9d0c7bee6b1efb09fc667f8f3763a49748628a4b;hp=5155cfcbc15139e9f1cbd6e6bf8450c30e294bc3 - added a hook at beginning of left_main - added plugin options in conf.pl git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@637 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- diff --git a/config/conf.pl b/config/conf.pl index 357bea32..10c673c3 100755 --- a/config/conf.pl +++ b/config/conf.pl @@ -35,7 +35,7 @@ while ($line = ) { if ($var =~ /^([a-z]|[A-Z])/) { @options = split(/\s*EQUALS\s*/, $var); $options[1] =~ s/[\n|\r]//g; - $options[1] =~ s/\";$//; + $options[1] =~ s/\";\s*$//; $options[1] =~ s/;$//; $options[1] =~ s/^"//; @@ -49,6 +49,11 @@ while ($line = ) { $sub =~ s/\]\["NAME"\]//; $sub =~ s/.*\[//; $theme_name[$sub] = $options[1]; + } elsif ($options[0] =~ /^plugins\[[0-9]+\]/) { + $sub = $options[0]; + $sub =~ s/\]//; + $sub =~ s/^plugins\[//; + $plugins[$sub] = $options[1]; } elsif ($options[0] =~ /^ldap_server\[[0-9]+\]/) { $sub = $options[0]; $sub =~ s/\]//; @@ -134,6 +139,7 @@ while (($command ne "q") && ($command ne "Q")) { print "5. Themes\n"; print "6. Address Books (LDAP)\n"; print "7. Message of the Day (MOTD)\n"; + print "8. Plugins\n"; print "\n"; print "D. Set pre-defined settings for specific IMAP servers\n"; print "\n"; @@ -208,6 +214,14 @@ while (($command ne "q") && ($command ne "Q")) { print "1 Edit the MOTD\n"; print "\n"; print "R Return to Main Menu\n"; + } elsif ($menu == 8) { + print $WHT."Plugins\n".$NRM; + print "1 Change Plugins\n"; + for ($count = 0; $count <= $#plugins; $count++) { + print " > $plugins[$count]\n"; + } + print "\n"; + print "R Return to Main Menu\n"; } print "S Save data\n"; print "Q Quit\n"; @@ -239,7 +253,7 @@ while (($command ne "q") && ($command ne "Q")) { } else { $saved = 0; if ($menu == 0) { - if (($command > 0) && ($command < 8)) { + if (($command > 0) && ($command < 9)) { $menu = $command; } } elsif ($menu == 1) { @@ -283,6 +297,8 @@ while (($command ne "q") && ($command ne "Q")) { elsif ($command == 2) { command62(); } } elsif ($menu == 7) { if ($command == 1) { $motd = command71(); } + } elsif ($menu == 8) { + if ($command == 1) { $motd = command81(); } } } } @@ -490,6 +506,77 @@ sub command71 { return $new_motd; } +################# PLUGINS ################### + +sub command81 { + print "\nThis is where you can define plugins. The plugin must already exist in the\n"; + print "plugins/ directory in order to add them here. A plugin name is the name of the\n"; + print "directory that it resides in. For example, if you have a plugin in the directory\n"; + print "plugins/myplug, the name is \"myplug\".\n\n"; + print "[plugins] command (?=help) > "; + $input = ; + $input =~ s/[\r|\n]//g; + while ($input ne "d") { + if ($input =~ /^\s*l\s*/i) { + $count = 0; + while ($count <= $#plugins) { + print " $count. $plugins[$count]\n"; + $count++; + } + print "\n"; + } elsif ($input =~ /^\s*\+/) { + print "What is the name of this plugin: "; + $name = ; + $name =~ s/[\r|\n]//g; + + if (-e "../plugins/$name") { + $exists = 0; + for ($m=0; $m <= $#plugins; $m++) { + if ($plugins[$m] eq $name) { + $exists = 1; + } + } + if ($exists == 1) { + print "\nThat plugin already exists in the list!\n"; + } else { + $plugins[$#plugins+1] = $name; + } + print "\n"; + } else { + print "\nThat plugin does not exist in the plugins/ directory!\n\n"; + } + } elsif ($input =~ /^\s*-\s*[0-9]?/) { + if ($input =~ /[0-9]+\s*$/) { + $rem_num = $input; + $rem_num =~ s/^\s*-\s*//g; + $rem_num =~ s/\s*$//; + } else { + $rem_num = $#plugins; + } + + $count = 0; + @new_plugins = (); + while ($count <= $#plugins) { + if ($count != $rem_num) { + @new_plugins = (@new_plugins, $plugins[$count]); + } + $count++; + } + @plugins = @new_plugins; + } elsif ($input =~ /^\s*\?\s*/) { + print ".-------------------------.\n"; + print "| + (add plugin) |\n"; + print "| - N (remove plugin) |\n"; + print "| l (list plugins) |\n"; + print "| d (done) |\n"; + print "`-------------------------'\n"; + } + print "[plugins] command (?=help) > "; + $input = ; + $input =~ s/[\r|\n]//g; + } +} + ################# FOLDERS ################### # default_folder_prefix @@ -1188,6 +1275,12 @@ sub save_data { print FILE "\n"; + for ($count=0; $count <= $#plugins; $count++) { + print FILE "\t\$plugins[$count] = \"$plugins[$count]\";\n"; + } + + print FILE "\n"; + for ($count=0; $count <= $#theme_name; $count++) { print FILE "\t\$theme[$count][\"PATH\"] = \"$theme_path[$count]\";\n"; print FILE "\t\$theme[$count][\"NAME\"] = \"$theme_name[$count]\";\n"; diff --git a/src/left_main.php b/src/left_main.php index 0e6ef6c7..91d2bcc0 100644 --- a/src/left_main.php +++ b/src/left_main.php @@ -29,7 +29,8 @@ include("../functions/page_header.php"); if (!isset($i18n_php)) include("../functions/i18n.php"); - + if (!isset($plugin_php)) + include("../functions/plugin.php"); displayHtmlHeader(); @@ -113,6 +114,8 @@ echo "\n\n\n"; + do_hook("left_main_before"); + $boxes = sqimap_mailbox_list($imapConnection); echo "
";