Page MenuHomePhorge

No OneTemporary

Size
55 KB
Referenced Files
None
Subscribers
None
diff --git a/bin/cleandb.sh b/bin/cleandb.sh
index f54ad98f9..a2349dd72 100755
--- a/bin/cleandb.sh
+++ b/bin/cleandb.sh
@@ -1,31 +1,29 @@
#!/usr/bin/env php
<?php
/*
+-----------------------------------------------------------------------+
| This file is part of the Roundcube Webmail client |
| |
| Copyright (C) The Roundcube Dev Team |
| |
| Licensed under the GNU General Public License version 3 or |
| any later version with exceptions for skins & plugins. |
| See the README file for a full license statement. |
| |
| PURPOSE: |
| Finally remove all db records marked as deleted some time ago |
+-----------------------------------------------------------------------+
| Author: Thomas Bruederli <roundcube@gmail.com> |
+-----------------------------------------------------------------------+
*/
define('INSTALL_PATH', realpath(__DIR__ . '/..') . '/' );
require INSTALL_PATH.'program/include/clisetup.php';
if (!empty($_SERVER['argv'][1]))
$days = intval($_SERVER['argv'][1]);
else
$days = 7;
rcmail_utils::db_clean($days);
-
-?>
diff --git a/bin/cssshrink.sh b/bin/cssshrink.sh
index 55cb180d8..86e744f02 100755
--- a/bin/cssshrink.sh
+++ b/bin/cssshrink.sh
@@ -1,62 +1,62 @@
#!/bin/sh
PWD=`dirname "$0"`
JAR_DIR='/tmp'
VERSION='2.4.8'
COMPILER_URL="https://github.com/yui/yuicompressor/releases/download/v${VERSION}/yuicompressor-${VERSION}.zip"
do_shrink() {
- rm -f "$2"
- java -jar $JAR_DIR/yuicompressor.jar -v -o "$2" "$1"
+ rm -f "$2"
+ java -jar $JAR_DIR/yuicompressor.jar -v -o "$2" "$1"
}
if [ ! -w "$JAR_DIR" ]; then
- JAR_DIR=$PWD
+ JAR_DIR=$PWD
fi
if java -version >/dev/null 2>&1; then
- :
+ :
else
- echo "Java not found. Please ensure that the 'java' program is in your PATH."
- exit 1
+ echo "Java not found. Please ensure that the 'java' program is in your PATH."
+ exit 1
fi
if [ ! -r "$JAR_DIR/yuicompressor.jar" ]; then
- if which wget >/dev/null 2>&1 && which unzip >/dev/null 2>&1; then
- wget "$COMPILER_URL" -O "/tmp/$$.zip"
- elif which curl >/dev/null 2>&1 && which unzip >/dev/null 2>&1; then
- curl -L "$COMPILER_URL" -o "/tmp/$$.zip"
- else
- echo "Please download $COMPILER_URL and extract compiler.jar to $JAR_DIR/."
- exit 1
- fi
- (cd $JAR_DIR && unzip "/tmp/$$.zip" && mv "yuicompressor-${VERSION}.jar" "yuicompressor.jar")
- rm -f "/tmp/$$.zip"
+ if which wget >/dev/null 2>&1 && which unzip >/dev/null 2>&1; then
+ wget "$COMPILER_URL" -O "/tmp/$$.zip"
+ elif which curl >/dev/null 2>&1 && which unzip >/dev/null 2>&1; then
+ curl -L "$COMPILER_URL" -o "/tmp/$$.zip"
+ else
+ echo "Please download $COMPILER_URL and extract compiler.jar to $JAR_DIR/."
+ exit 1
+ fi
+ (cd $JAR_DIR && unzip "/tmp/$$.zip" && mv "yuicompressor-${VERSION}.jar" "yuicompressor.jar")
+ rm -f "/tmp/$$.zip"
fi
# compress single file from argument
if [ $# -gt 0 ]; then
- CSS_FILE="$1"
+ CSS_FILE="$1"
- echo "Shrinking $CSS_FILE"
+ echo "Shrinking $CSS_FILE"
minfile=`echo $CSS_FILE | sed -e 's/\.css$/\.min\.css/'`
- do_shrink "$CSS_FILE" "$minfile"
- exit
+ do_shrink "$CSS_FILE" "$minfile"
+ exit
fi
DIRS="$PWD/../skins/* $PWD/../plugins/* $PWD/../plugins/*/skins/*"
# default: compress application scripts
for dir in $DIRS; do
for file in $dir/*.css; do
echo "$file" | grep -e '.min.css$' >/dev/null
if [ $? -eq 0 ]; then
continue
fi
if [ ! -f "$file" ]; then
continue
fi
echo "Shrinking $file"
minfile=`echo $file | sed -e 's/\.css$/\.min\.css/'`
do_shrink "$file" "$minfile"
done
done
diff --git a/bin/decrypt.sh b/bin/decrypt.sh
index b3a9d4673..a269d6222 100755
--- a/bin/decrypt.sh
+++ b/bin/decrypt.sh
@@ -1,65 +1,65 @@
#!/usr/bin/env php
<?php
/*
+-----------------------------------------------------------------------+
| This file is part of the Roundcube Webmail client |
| |
| Copyright (C) The Roundcube Dev Team |
| |
| Licensed under the GNU General Public License version 3 or |
| any later version with exceptions for skins & plugins. |
| See the README file for a full license statement. |
| |
| PURPOSE: |
| Decrypt the encrypted parts of the HTTP Received: headers |
+-----------------------------------------------------------------------+
| Author: Tomas Tevesz <ice@extreme.hu> |
+-----------------------------------------------------------------------+
*/
/**
* If http_received_header_encrypt is configured, the IP address and the
* host name of the added Received: header is encrypted with 3DES, to
* protect information that some could consider sensitve, yet their
* availability is a must in some circumstances.
*
* Such an encrypted Received: header might look like:
*
* Received: from DzgkvJBO5+bw+oje5JACeNIa/uSI4mRw2cy5YoPBba73eyBmjtyHnQ==
* [my0nUbjZXKtl7KVBZcsvWOxxtyVFxza4]
* with HTTP/1.1 (POST); Thu, 14 May 2009 19:17:28 +0200
*
* In this example, the two encrypted components are the sender host name
* (DzgkvJBO5+bw+oje5JACeNIa/uSI4mRw2cy5YoPBba73eyBmjtyHnQ==) and the IP
* address (my0nUbjZXKtl7KVBZcsvWOxxtyVFxza4).
*
* Using this tool, they can be decrypted into plain text:
*
* $ bin/decrypt.sh 'my0nUbjZXKtl7KVBZcsvWOxxtyVFxza4' \
* > 'DzgkvJBO5+bw+oje5JACeNIa/uSI4mRw2cy5YoPBba73eyBmjtyHnQ=='
* 84.3.187.208
* 5403BBD0.catv.pool.telekom.hu
* $
*
* Thus it is known that this particular message was sent by 84.3.187.208,
* having, at the time of sending, the name of 5403BBD0.catv.pool.telekom.hu.
*
* If (most likely binary) junk is shown, then
* - either the encryption password has, between the time the mail was sent
* and 'now', changed, or
* - you are dealing with counterfeit header data.
*/
define('INSTALL_PATH', realpath(__DIR__ .'/..') . '/');
require INSTALL_PATH . 'program/include/clisetup.php';
if ($argc < 2) {
- die("Usage: " . basename($argv[0]) . " encrypted-hdr-part [encrypted-hdr-part ...]\n");
+ die("Usage: " . basename($argv[0]) . " encrypted-hdr-part [encrypted-hdr-part ...]\n");
}
$RCMAIL = rcube::get_instance();
for ($i = 1; $i < $argc; $i++) {
- printf("%s\n", $RCMAIL->decrypt($argv[$i]));
+ printf("%s\n", $RCMAIL->decrypt($argv[$i]));
};
diff --git a/bin/indexcontacts.sh b/bin/indexcontacts.sh
index fefe18e6e..3fcff8039 100755
--- a/bin/indexcontacts.sh
+++ b/bin/indexcontacts.sh
@@ -1,28 +1,26 @@
#!/usr/bin/env php
<?php
/*
+-----------------------------------------------------------------------+
| This file is part of the Roundcube Webmail client |
| |
| Copyright (C) The Roundcube Dev Team |
| |
| Licensed under the GNU General Public License version 3 or |
| any later version with exceptions for skins & plugins. |
| See the README file for a full license statement. |
| |
| PURPOSE: |
| Update the fulltext index for all contacts of the internal |
| address book. |
+-----------------------------------------------------------------------+
| Author: Thomas Bruederli <roundcube@gmail.com> |
+-----------------------------------------------------------------------+
*/
define('INSTALL_PATH', realpath(__DIR__ . '/..') . '/' );
require_once INSTALL_PATH.'program/include/clisetup.php';
ini_set('memory_limit', -1);
rcmail_utils::indexcontacts();
-
-?>
diff --git a/bin/initdb.sh b/bin/initdb.sh
index cbfb9def9..31c5078e6 100755
--- a/bin/initdb.sh
+++ b/bin/initdb.sh
@@ -1,41 +1,39 @@
#!/usr/bin/env php
<?php
/*
+-----------------------------------------------------------------------+
| This file is part of the Roundcube Webmail client |
| |
| Copyright (C) The Roundcube Dev Team |
| Copyright (C) Kolab Systems AG |
| |
| Licensed under the GNU General Public License version 3 or |
| any later version with exceptions for skins & plugins. |
| See the README file for a full license statement. |
| |
| PURPOSE: |
| Create database schema |
+-----------------------------------------------------------------------+
| Author: Aleksander Machniak <alec@alec.pl> |
+-----------------------------------------------------------------------+
*/
define('INSTALL_PATH', realpath(__DIR__ . '/..') . '/' );
require_once INSTALL_PATH . 'program/include/clisetup.php';
// get arguments
$opts = rcube_utils::get_opt(array(
'd' => 'dir',
));
if (empty($opts['dir'])) {
rcube::raise_error("Database schema directory not specified (--dir).", false, true);
}
// Check if directory exists
if (!file_exists($opts['dir'])) {
rcube::raise_error("Specified database schema directory doesn't exist.", false, true);
}
rcmail_utils::db_init($opts['dir']);
-
-?>
diff --git a/bin/installto.sh b/bin/installto.sh
index e206dfd79..0450e1878 100755
--- a/bin/installto.sh
+++ b/bin/installto.sh
@@ -1,140 +1,138 @@
#!/usr/bin/env php
<?php
/*
+-----------------------------------------------------------------------+
| This file is part of the Roundcube Webmail client |
| |
| Copyright (C) The Roundcube Dev Team |
| |
| Licensed under the GNU General Public License version 3 or |
| any later version with exceptions for skins & plugins. |
| See the README file for a full license statement. |
| |
| PURPOSE: |
| Update an existing Roundcube installation with files from |
| this version |
+-----------------------------------------------------------------------+
| Author: Thomas Bruederli <roundcube@gmail.com> |
+-----------------------------------------------------------------------+
*/
define('INSTALL_PATH', realpath(__DIR__ . '/..') . '/' );
require_once INSTALL_PATH . 'program/include/clisetup.php';
if (!function_exists('system')) {
rcube::raise_error("PHP system() function is required. Check disable_functions in php.ini.", false, true);
}
$target_dir = unslashify($_SERVER['argv'][1]);
if (empty($target_dir) || !is_dir(realpath($target_dir)))
rcube::raise_error("Invalid target: not a directory\nUsage: installto.sh <TARGET>", false, true);
// read version from iniset.php
$iniset = @file_get_contents($target_dir . '/program/include/iniset.php');
if (!preg_match('/define\(.RCMAIL_VERSION.,\s*.([0-9.]+[a-z-]*)/', $iniset, $m))
rcube::raise_error("No valid Roundcube installation found at $target_dir", false, true);
$oldversion = $m[1];
if (version_compare(version_parse($oldversion), version_parse(RCMAIL_VERSION), '>'))
rcube::raise_error("Target installation already in version $oldversion.", false, true);
if (version_compare(version_parse($oldversion), version_parse(RCMAIL_VERSION), '==')) {
echo "Target installation already in version $oldversion. Do you want to update again? (y/N)\n";
}
else {
echo "Upgrading from $oldversion. Do you want to continue? (y/N)\n";
}
$input = trim(fgets(STDIN));
if (strtolower($input) == 'y') {
echo "Copying files to target location...";
$adds = array();
$dirs = array('bin','SQL','plugins','skins','program');
if (is_dir(INSTALL_PATH . 'vendor') && !is_file("$target_dir/composer.json")) {
$dirs[] = 'vendor';
}
if (file_exists("$target_dir/installer")) {
$dirs[] = 'installer';
}
foreach ($dirs as $dir) {
// @FIXME: should we use --delete for all directories?
$delete = in_array($dir, array('program', 'vendor', 'installer')) ? '--delete ' : '';
$command = "rsync -aC --out-format=%n " . $delete . INSTALL_PATH . "$dir/ $target_dir/$dir/";
if (system($command, $ret) === false || $ret > 0) {
rcube::raise_error("Failed to execute command: $command", false, true);
}
}
foreach (array('index.php','config/defaults.inc.php','composer.json-dist','jsdeps.json','CHANGELOG','README.md','UPGRADING','LICENSE','INSTALL') as $file) {
$command = "rsync -a --out-format=%n " . INSTALL_PATH . "$file $target_dir/$file";
if (file_exists(INSTALL_PATH . $file) && (system($command, $ret) === false || $ret > 0)) {
rcube::raise_error("Failed to execute command: $command", false, true);
}
}
// Copy .htaccess or .user.ini if needed
foreach (array('.htaccess','.user.ini') as $file) {
if (file_exists(INSTALL_PATH . $file)) {
if (!file_exists("$target_dir/$file") || file_get_contents(INSTALL_PATH . $file) != file_get_contents("$target_dir/$file")) {
if (copy(INSTALL_PATH . $file, "$target_dir/$file.new")) {
echo "$file.new\n";
$adds[] = "NOTICE: New $file file saved as $file.new.";
}
}
}
}
// remove old (<1.0) .htaccess file
@unlink("$target_dir/program/.htaccess");
echo "done.\n\n";
if (is_dir("$target_dir/skins/default")) {
echo "Removing old default skin...";
system("rm -rf $target_dir/skins/default $target_dir/plugins/jqueryui/themes/default");
foreach (glob(INSTALL_PATH . "plugins/*/skins") as $plugin_skin_dir) {
$plugin_skin_dir = preg_replace('!^.*' . INSTALL_PATH . '!', '', $plugin_skin_dir);
if (is_dir("$target_dir/$plugin_skin_dir/classic"))
system("rm -rf $target_dir/$plugin_skin_dir/default");
}
echo "done.\n\n";
}
// check if js-deps are up-to-date
if (file_exists("$target_dir/jsdeps.json") && file_exists("$target_dir/bin/install-jsdeps.sh")) {
$jsdeps = json_decode(file_get_contents("$target_dir/jsdeps.json"));
$package = $jsdeps->dependencies[0];
$dest_file = $target_dir . '/' . $package->dest;
if (!file_exists($dest_file) || sha1_file($dest_file) !== $package->sha1) {
echo "Installing JavaScript dependencies...";
system("cd $target_dir && bin/install-jsdeps.sh");
echo "done.\n\n";
}
}
else {
$adds[] = "NOTICE: JavaScript dependencies installation skipped...";
}
if (file_exists("$target_dir/installer")) {
$adds[] = "NOTICE: The 'installer' directory still exists. You should remove it after the upgrade.";
}
if (!empty($adds)) {
echo implode($adds, "\n") . "\n\n";
}
echo "Running update script at target...\n";
system("cd $target_dir && php bin/update.sh --version=$oldversion");
echo "All done.\n";
}
else {
echo "Update cancelled. See ya!\n";
}
-
-?>
diff --git a/bin/jsshrink.sh b/bin/jsshrink.sh
index d8f0fa528..23d65a32c 100755
--- a/bin/jsshrink.sh
+++ b/bin/jsshrink.sh
@@ -1,75 +1,75 @@
#!/bin/sh
PWD=`dirname "$0"`
JS_DIR="$PWD/../program/js"
JAR_DIR='/tmp'
LANG_IN='ECMASCRIPT5'
CLOSURE_COMPILER_URL='http://dl.google.com/closure-compiler/compiler-latest.zip'
do_shrink() {
- rm -f "$2"
- # copy the first comment block with license information for LibreJS
- grep -q '@lic' $1 && sed -n '/\/\*/,/\*\// { p; /\*\//q; }' $1 > $2
- java -jar $JAR_DIR/compiler.jar --compilation_level=SIMPLE_OPTIMIZATIONS --js="$1" --language_in="$3" >> $2
+ rm -f "$2"
+ # copy the first comment block with license information for LibreJS
+ grep -q '@lic' $1 && sed -n '/\/\*/,/\*\// { p; /\*\//q; }' $1 > $2
+ java -jar $JAR_DIR/compiler.jar --compilation_level=SIMPLE_OPTIMIZATIONS --js="$1" --language_in="$3" >> $2
}
if [ ! -d "$JS_DIR" ]; then
- echo "Directory $JS_DIR not found."
- exit 1
+ echo "Directory $JS_DIR not found."
+ exit 1
fi
if [ ! -w "$JAR_DIR" ]; then
- JAR_DIR=$PWD
+ JAR_DIR=$PWD
fi
if java -version >/dev/null 2>&1; then
- :
+ :
else
- echo "Java not found. Please ensure that the 'java' program is in your PATH."
- exit 1
+ echo "Java not found. Please ensure that the 'java' program is in your PATH."
+ exit 1
fi
if [ ! -r "$JAR_DIR/compiler.jar" ]; then
- if which wget >/dev/null 2>&1 && which unzip >/dev/null 2>&1; then
- wget "$CLOSURE_COMPILER_URL" -O "/tmp/$$.zip"
- elif which curl >/dev/null 2>&1 && which unzip >/dev/null 2>&1; then
- curl "$CLOSURE_COMPILER_URL" -o "/tmp/$$.zip"
- else
- echo "Please download $CLOSURE_COMPILER_URL and extract compiler.jar to $JAR_DIR/."
- exit 1
- fi
- unzip -p "/tmp/$$.zip" "*.jar" > "$JAR_DIR/compiler.jar"
- rm -f "/tmp/$$.zip"
+ if which wget >/dev/null 2>&1 && which unzip >/dev/null 2>&1; then
+ wget "$CLOSURE_COMPILER_URL" -O "/tmp/$$.zip"
+ elif which curl >/dev/null 2>&1 && which unzip >/dev/null 2>&1; then
+ curl "$CLOSURE_COMPILER_URL" -o "/tmp/$$.zip"
+ else
+ echo "Please download $CLOSURE_COMPILER_URL and extract compiler.jar to $JAR_DIR/."
+ exit 1
+ fi
+ unzip -p "/tmp/$$.zip" "*.jar" > "$JAR_DIR/compiler.jar"
+ rm -f "/tmp/$$.zip"
fi
# compress single file from argument
if [ $# -gt 0 ]; then
- JS_DIR=`dirname "$1"`
- JS_FILE="$1"
+ JS_DIR=`dirname "$1"`
+ JS_FILE="$1"
- if [ $# -gt 1 ]; then
- LANG_IN="$2"
- fi
+ if [ $# -gt 1 ]; then
+ LANG_IN="$2"
+ fi
- echo "Shrinking $JS_FILE"
+ echo "Shrinking $JS_FILE"
minfile=`echo $JS_FILE | sed -e 's/\.js$/\.min\.js/'`
- do_shrink "$JS_FILE" "$minfile" "$LANG_IN"
- exit
+ do_shrink "$JS_FILE" "$minfile" "$LANG_IN"
+ exit
fi
DIRS="$PWD/../program/js $PWD/../skins/* $PWD/../plugins/* $PWD/../plugins/*/skins/* $PWD/../plugins/managesieve/codemirror/lib"
# default: compress application scripts
for dir in $DIRS; do
for file in $dir/*.js; do
echo "$file" | grep -e '.min.js$' >/dev/null
if [ $? -eq 0 ]; then
continue
fi
if [ ! -f "$file" ]; then
continue
fi
echo "Shrinking $file"
minfile=`echo $file | sed -e 's/\.js$/\.min\.js/'`
do_shrink "$file" "$minfile" "$LANG_IN"
done
done
diff --git a/bin/makedoc.sh b/bin/makedoc.sh
index 3602c3a65..896040aeb 100755
--- a/bin/makedoc.sh
+++ b/bin/makedoc.sh
@@ -1,24 +1,23 @@
#!/bin/sh
TITLE="Roundcube Webmail"
PACKAGES="Webmail"
INSTALL_PATH="`dirname $0`/.."
PATH_PROJECT=$INSTALL_PATH/program/include
PATH_FRAMEWORK=$INSTALL_PATH/program/lib/Roundcube
PATH_DOCS=$INSTALL_PATH/doc/phpdoc
BIN_PHPDOC="`/usr/bin/which phpdoc`"
if [ ! -x "$BIN_PHPDOC" ]
then
echo "phpdoc not found: $BIN_PHPDOC"
exit 1
fi
OUTPUTFORMAT=HTML
TEMPLATE=responsive-twig
# make documentation
-$BIN_PHPDOC -d $PATH_PROJECT,$PATH_FRAMEWORK -t $PATH_DOCS --title "$TITLE" --defaultpackagename $PACKAGES \
- --template=$TEMPLATE
-
+$BIN_PHPDOC -d $PATH_PROJECT,$PATH_FRAMEWORK -t $PATH_DOCS --title "$TITLE" \
+ --defaultpackagename $PACKAGES --template=$TEMPLATE
diff --git a/bin/moduserprefs.sh b/bin/moduserprefs.sh
index c7dada01f..4de60a83d 100755
--- a/bin/moduserprefs.sh
+++ b/bin/moduserprefs.sh
@@ -1,67 +1,65 @@
#!/usr/bin/env php
<?php
/*
+-----------------------------------------------------------------------+
| This file is part of the Roundcube Webmail client |
| |
| Copyright (C) The Roundcube Dev Team |
| |
| Licensed under the GNU General Public License version 3 or |
| any later version with exceptions for skins & plugins. |
| See the README file for a full license statement. |
| |
| PURPOSE: |
| Bulk-change settings stored in user preferences |
+-----------------------------------------------------------------------+
| Author: Thomas Bruederli <roundcube@gmail.com> |
+-----------------------------------------------------------------------+
*/
define('INSTALL_PATH', realpath(__DIR__ . '/..') . '/' );
require_once INSTALL_PATH.'program/include/clisetup.php';
function print_usage()
{
print "Usage: moduserprefs.sh [options] pref-name [pref-value]\n";
print "Options:\n";
print " --user=user-id User ID in local database\n";
print " --config=path Location of additional configuration file\n";
print " --delete Unset the given preference\n";
print " --type=type Pref-value type: int, bool, string\n";
}
// get arguments
$args = rcube_utils::get_opt(array(
'u' => 'user',
'd' => 'delete:bool',
't' => 'type',
'c' => 'config',
));
if ($_SERVER['argv'][1] == 'help') {
print_usage();
exit;
}
else if (empty($args[0]) || (empty($args[1]) && empty($args['delete']))) {
print "Missing required parameters.\n";
print_usage();
exit;
}
$pref_name = trim($args[0]);
$pref_value = $args['delete'] ? null : trim($args[1]);
if ($pref_value === null) {
$args['type'] = null;
}
if ($args['config']) {
$rcube = rcube::get_instance();
$rcube->config->load_from_file($args['config']);
}
rcmail_utils::mod_pref($pref_name, $pref_value, $args['user'], $args['type']);
-
-?>
diff --git a/bin/msgexport.sh b/bin/msgexport.sh
index 86ba935f5..358ed1cc2 100755
--- a/bin/msgexport.sh
+++ b/bin/msgexport.sh
@@ -1,156 +1,145 @@
#!/usr/bin/env php
<?php
/*
+-----------------------------------------------------------------------+
| This file is part of the Roundcube Webmail client |
| |
| Copyright (C) The Roundcube Dev Team |
| |
| Licensed under the GNU General Public License version 3 or |
| any later version with exceptions for skins & plugins. |
| See the README file for a full license statement. |
+-----------------------------------------------------------------------+
| Author: Thomas Bruederli <thomas@roundcube.net> |
+-----------------------------------------------------------------------+
*/
define('INSTALL_PATH', realpath(__DIR__ . '/..') . '/' );
ini_set('memory_limit', -1);
require_once INSTALL_PATH.'program/include/clisetup.php';
function print_usage()
{
- print "Usage: msgexport -h imap-host -u user-name -m mailbox name\n";
- print "--host IMAP host\n";
- print "--user IMAP user name\n";
- print "--mbox Folder name, set to '*' for all\n";
- print "--file Output file\n";
+ print "Usage: msgexport -h imap-host -u user-name -m mailbox name\n";
+ print "--host IMAP host\n";
+ print "--user IMAP user name\n";
+ print "--mbox Folder name, set to '*' for all\n";
+ print "--file Output file\n";
}
function vputs($str)
{
- $out = $GLOBALS['args']['file'] ? STDOUT : STDERR;
- fwrite($out, $str);
+ $out = $GLOBALS['args']['file'] ? STDOUT : STDERR;
+ fwrite($out, $str);
}
function progress_update($pos, $max)
{
- $percent = round(100 * $pos / $max);
- vputs(sprintf("%3d%% [%-51s] %d/%d\033[K\r", $percent, @str_repeat('=', $percent / 2) . '>', $pos, $max));
+ $percent = round(100 * $pos / $max);
+ vputs(sprintf("%3d%% [%-51s] %d/%d\033[K\r", $percent, @str_repeat('=', $percent / 2) . '>', $pos, $max));
}
function export_mailbox($mbox, $filename)
{
- global $IMAP;
+ global $IMAP;
- $IMAP->set_folder($mbox);
+ $IMAP->set_folder($mbox);
$index = $IMAP->index($mbox, null, 'ASC');
$count = $index->count();
$index = $index->get();
- vputs("Getting message list of {$mbox}...");
- vputs("$count messages\n");
-
- if ($filename)
- {
- if (!($out = fopen($filename, 'w')))
- {
- vputs("Cannot write to output file\n");
- return;
- }
- vputs("Writing to $filename\n");
- }
- else
- $out = STDOUT;
-
- for ($i = 0; $i < $count; $i++)
- {
- $headers = $IMAP->get_message_headers($index[$i]);
- $from = current(rcube_mime::decode_address_list($headers->from, 1, false));
-
- fwrite($out, sprintf("From %s %s UID %d\n", $from['mailto'], $headers->date, $headers->uid));
- $IMAP->get_raw_body($headers->uid, $out);
- fwrite($out, "\n\n\n");
-
- progress_update($i+1, $count);
- }
- vputs("\ncomplete.\n");
-
- if ($filename)
- fclose($out);
+ vputs("Getting message list of {$mbox}...");
+ vputs("$count messages\n");
+
+ if ($filename) {
+ if (!($out = fopen($filename, 'w'))) {
+ vputs("Cannot write to output file\n");
+ return;
+ }
+ vputs("Writing to $filename\n");
+ }
+ else {
+ $out = STDOUT;
+ }
+
+ for ($i = 0; $i < $count; $i++) {
+ $headers = $IMAP->get_message_headers($index[$i]);
+ $from = current(rcube_mime::decode_address_list($headers->from, 1, false));
+
+ fwrite($out, sprintf("From %s %s UID %d\n", $from['mailto'], $headers->date, $headers->uid));
+ $IMAP->get_raw_body($headers->uid, $out);
+ fwrite($out, "\n\n\n");
+
+ progress_update($i+1, $count);
+ }
+ vputs("\ncomplete.\n");
+
+ if ($filename) {
+ fclose($out);
+ }
}
-
// get arguments
$opts = array('h' => 'host', 'u' => 'user', 'p' => 'pass', 'm' => 'mbox', 'f' => 'file');
$args = rcube_utils::get_opt($opts) + array('host' => 'localhost', 'mbox' => 'INBOX');
-if ($_SERVER['argv'][1] == 'help')
-{
- print_usage();
- exit;
+if ($_SERVER['argv'][1] == 'help') {
+ print_usage();
+ exit;
}
-else if (!$args['host'])
-{
- vputs("Missing required parameters.\n");
- print_usage();
- exit;
+else if (!$args['host']) {
+ vputs("Missing required parameters.\n");
+ print_usage();
+ exit;
}
// prompt for username if not set
-if (empty($args['user']))
-{
- vputs("IMAP user: ");
- $args['user'] = trim(fgets(STDIN));
+if (empty($args['user'])) {
+ vputs("IMAP user: ");
+ $args['user'] = trim(fgets(STDIN));
}
// prompt for password
$args['pass'] = rcube_utils::prompt_silent("Password: ");
// parse $host URL
$a_host = parse_url($args['host']);
-if ($a_host['host'])
-{
- $host = $a_host['host'];
- $imap_ssl = (isset($a_host['scheme']) && in_array($a_host['scheme'], array('ssl','imaps','tls'))) ? TRUE : FALSE;
- $imap_port = isset($a_host['port']) ? $a_host['port'] : ($imap_ssl ? 993 : 143);
+if ($a_host['host']) {
+ $host = $a_host['host'];
+ $imap_ssl = (isset($a_host['scheme']) && in_array($a_host['scheme'], array('ssl','imaps','tls'))) ? TRUE : FALSE;
+ $imap_port = isset($a_host['port']) ? $a_host['port'] : ($imap_ssl ? 993 : 143);
}
-else
-{
- $host = $args['host'];
- $imap_port = 143;
+else {
+ $host = $args['host'];
+ $imap_port = 143;
}
// instantiate IMAP class
$IMAP = new rcube_imap(null);
// try to connect to IMAP server
-if ($IMAP->connect($host, $args['user'], $args['pass'], $imap_port, $imap_ssl))
-{
- vputs("IMAP login successful.\n");
+if ($IMAP->connect($host, $args['user'], $args['pass'], $imap_port, $imap_ssl)) {
+ vputs("IMAP login successful.\n");
- $filename = null;
- $mailboxes = $args['mbox'] == '*' ? $IMAP->list_folders(null) : array($args['mbox']);
+ $filename = null;
+ $mailboxes = $args['mbox'] == '*' ? $IMAP->list_folders(null) : array($args['mbox']);
- foreach ($mailboxes as $mbox)
- {
- if ($args['file'])
- $filename = preg_replace('/\.[a-z0-9]{3,4}$/i', '', $args['file']) . asciiwords($mbox) . '.mbox';
- else if ($args['mbox'] == '*')
- $filename = asciiwords($mbox) . '.mbox';
+ foreach ($mailboxes as $mbox) {
+ if ($args['file'])
+ $filename = preg_replace('/\.[a-z0-9]{3,4}$/i', '', $args['file']) . asciiwords($mbox) . '.mbox';
+ else if ($args['mbox'] == '*')
+ $filename = asciiwords($mbox) . '.mbox';
- if ($args['mbox'] == '*' && in_array(strtolower($mbox), array('junk','spam','trash')))
- continue;
+ if ($args['mbox'] == '*' && in_array(strtolower($mbox), array('junk','spam','trash'))) {
+ continue;
+ }
- export_mailbox($mbox, $filename);
- }
+ export_mailbox($mbox, $filename);
+ }
}
-else
-{
- vputs("IMAP login failed.\n");
+else {
+ vputs("IMAP login failed.\n");
}
-
-?>
diff --git a/bin/msgimport.sh b/bin/msgimport.sh
index 42077c23a..bd9aab4d4 100755
--- a/bin/msgimport.sh
+++ b/bin/msgimport.sh
@@ -1,126 +1,112 @@
#!/usr/bin/env php
<?php
/*
+-----------------------------------------------------------------------+
| This file is part of the Roundcube Webmail client |
| |
| Copyright (C) The Roundcube Dev Team |
| |
| Licensed under the GNU General Public License version 3 or |
| any later version with exceptions for skins & plugins. |
| See the README file for a full license statement. |
+-----------------------------------------------------------------------+
| Author: Thomas Bruederli <thomas@roundcube.net> |
+-----------------------------------------------------------------------+
*/
define('INSTALL_PATH', realpath(__DIR__ . '/..') . '/' );
ini_set('memory_limit', -1);
require_once INSTALL_PATH.'program/include/clisetup.php';
function print_usage()
{
- print "Usage: msgimport -h imap-host -u user-name -m mailbox -f message-file\n";
- print "--host IMAP host\n";
- print "--user IMAP user name\n";
- print "--mbox Target mailbox\n";
- print "--file Message file to upload\n";
+ print "Usage: msgimport -h imap-host -u user-name -m mailbox -f message-file\n";
+ print "--host IMAP host\n";
+ print "--user IMAP user name\n";
+ print "--mbox Target mailbox\n";
+ print "--file Message file to upload\n";
}
// get arguments
$opts = array('h' => 'host', 'u' => 'user', 'p' => 'pass', 'm' => 'mbox', 'f' => 'file');
$args = rcube_utils::get_opt($opts) + array('host' => 'localhost', 'mbox' => 'INBOX');
-if ($_SERVER['argv'][1] == 'help')
-{
- print_usage();
- exit;
+if ($_SERVER['argv'][1] == 'help') {
+ print_usage();
+ exit;
}
-else if (!($args['host'] && $args['file']))
-{
- print "Missing required parameters.\n";
- print_usage();
- exit;
+else if (!($args['host'] && $args['file'])) {
+ print "Missing required parameters.\n";
+ print_usage();
+ exit;
}
-else if (!is_file($args['file']))
-{
- rcube::raise_error("Cannot read message file.", false, true);
+else if (!is_file($args['file'])) {
+ rcube::raise_error("Cannot read message file.", false, true);
}
// prompt for username if not set
-if (empty($args['user']))
-{
- //fwrite(STDOUT, "Please enter your name\n");
- echo "IMAP user: ";
- $args['user'] = trim(fgets(STDIN));
+if (empty($args['user'])) {
+ //fwrite(STDOUT, "Please enter your name\n");
+ echo "IMAP user: ";
+ $args['user'] = trim(fgets(STDIN));
}
// prompt for password
-if (empty($args['pass']))
-{
- $args['pass'] = rcube_utils::prompt_silent("Password: ");
+if (empty($args['pass'])) {
+ $args['pass'] = rcube_utils::prompt_silent("Password: ");
}
// parse $host URL
$a_host = parse_url($args['host']);
-if ($a_host['host'])
-{
- $host = $a_host['host'];
- $imap_ssl = (isset($a_host['scheme']) && in_array($a_host['scheme'], array('ssl','imaps','tls'))) ? TRUE : FALSE;
- $imap_port = isset($a_host['port']) ? $a_host['port'] : ($imap_ssl ? 993 : 143);
+if ($a_host['host']) {
+ $host = $a_host['host'];
+ $imap_ssl = (isset($a_host['scheme']) && in_array($a_host['scheme'], array('ssl','imaps','tls'))) ? TRUE : FALSE;
+ $imap_port = isset($a_host['port']) ? $a_host['port'] : ($imap_ssl ? 993 : 143);
}
-else
-{
- $host = $args['host'];
- $imap_port = 143;
+else {
+ $host = $args['host'];
+ $imap_port = 143;
}
// instantiate IMAP class
$IMAP = new rcube_imap(null);
// try to connect to IMAP server
-if ($IMAP->connect($host, $args['user'], $args['pass'], $imap_port, $imap_ssl))
-{
- print "IMAP login successful.\n";
- print "Uploading messages...\n";
-
- $count = 0;
- $message = $lastline = '';
-
- $fp = fopen($args['file'], 'r');
- while (($line = fgets($fp)) !== false)
- {
- if (preg_match('/^From\s+-/', $line) && $lastline == '')
- {
- if (!empty($message))
- {
- if ($IMAP->save_message($args['mbox'], rtrim($message)))
- $count++;
- else
- rcube::raise_error("Failed to save message to {$args['mbox']}", false, true);
- $message = '';
- }
- continue;
- }
-
- $message .= $line;
- $lastline = rtrim($line);
- }
-
- if (!empty($message) && $IMAP->save_message($args['mbox'], rtrim($message)))
- $count++;
-
- // upload message from file
- if ($count)
- print "$count messages successfully added to {$args['mbox']}.\n";
- else
- print "Adding messages failed!\n";
+if ($IMAP->connect($host, $args['user'], $args['pass'], $imap_port, $imap_ssl)) {
+ print "IMAP login successful.\n";
+ print "Uploading messages...\n";
+
+ $count = 0;
+ $message = $lastline = '';
+
+ $fp = fopen($args['file'], 'r');
+ while (($line = fgets($fp)) !== false) {
+ if (preg_match('/^From\s+-/', $line) && $lastline == '') {
+ if (!empty($message)) {
+ if ($IMAP->save_message($args['mbox'], rtrim($message)))
+ $count++;
+ else
+ rcube::raise_error("Failed to save message to {$args['mbox']}", false, true);
+ $message = '';
+ }
+ continue;
+ }
+
+ $message .= $line;
+ $lastline = rtrim($line);
+ }
+
+ if (!empty($message) && $IMAP->save_message($args['mbox'], rtrim($message)))
+ $count++;
+
+ // upload message from file
+ if ($count)
+ print "$count messages successfully added to {$args['mbox']}.\n";
+ else
+ print "Adding messages failed!\n";
}
-else
-{
- rcube::raise_error("IMAP login failed.", false, true);
+else {
+ rcube::raise_error("IMAP login failed.", false, true);
}
-
-?>
diff --git a/bin/package2composer.sh b/bin/package2composer.sh
index 3f9b15025..dc3bfea8b 100755
--- a/bin/package2composer.sh
+++ b/bin/package2composer.sh
@@ -1,107 +1,106 @@
#!/usr/bin/env php
<?php
/*
+-----------------------------------------------------------------------+
| This file is part of the Roundcube Webmail client |
| |
| Copyright (C) The Roundcube Dev Team |
| |
| Licensed under the GNU General Public License version 3 or |
| any later version with exceptions for skins & plugins. |
| See the README file for a full license statement. |
| |
| PURPOSE: |
| Convert a plugin's package.xml file into a composer.json description |
+-----------------------------------------------------------------------+
| Author: Thomas Bruederli <thomas@roundcube.net> |
+-----------------------------------------------------------------------+
*/
ini_set('error_reporting', E_ALL & ~E_NOTICE);
list(, $filename, $vendor) = $_SERVER['argv'];
if (!$filename || !is_readable($filename)) {
die("Invalid input file name!\nUsage: " . $_SERVER['argv'][0] . " XMLFILE VENDOR\n");
}
if (!$vendor) {
$vendor = 'anonymous';
}
$package = new SimpleXMLElement(file_get_contents($filename));
$data = array(
'name' => $vendor . '/' . strval($package->name),
'type' => 'roundcube-plugin',
'description' => trim(strval($package->description), '- ') ? trim(strval($package->description)) : trim(strval($package->summary)),
'homepage' => strval($package->uri),
'license' => 'GPLv3+',
'version' => strval($package->version->release),
'authors' => array(),
'repositories' => array(
array('type' => 'composer', 'url' => 'https://plugins.roundcube.net'),
),
'require' => array(
'php' => '>=5.3.0',
'roundcube/plugin-installer' => '>=0.1.3',
),
);
if ($package->license) {
$data['license'] = strval($package->license);
}
if ($package->lead) {
foreach ($package->lead as $lead) {
if (strval($lead->active) == 'no') {
continue;
}
$data['authors'][] = array(
'name' => strval($lead->name),
'email' => strval($lead->email),
'role' => 'Lead',
);
}
}
if ($devs = $package->developer) {
foreach ($package->developer as $dev) {
$data['authors'][] = array(
'name' => strval($dev->name),
'email' => strval($dev->email),
'role' => 'Developer',
);
}
}
if ($package->dependencies->required->extension) {
foreach ($package->dependencies->required->extension as $ext) {
$data['require']['ext-' . strval($ext->name)] = '*';
}
}
// remove empty values
$data = array_filter($data);
// use the JSON encoder from the Composer package
if (is_file('composer.phar')) {
include 'phar://composer.phar/src/Composer/Json/JsonFile.php';
echo \Composer\Json\JsonFile::encode($data);
}
// PHP 5.4's json_encode() does the job, too
else if (defined('JSON_PRETTY_PRINT')) {
$flags = defined('JSON_PRETTY_PRINT') ? JSON_PRETTY_PRINT & JSON_UNESCAPED_SLASHES : 0;
echo json_encode($data, $flags);
}
else {
fwrite(STDERR,
"FAILED! composer.phar not found in current directory.
Please download it from http://getcomposer.org/download/ or with
curl -s http://getcomposer.org/installer | php
");
}
echo "\n";
-
diff --git a/bin/update.sh b/bin/update.sh
index 5134dceb9..b1315e823 100755
--- a/bin/update.sh
+++ b/bin/update.sh
@@ -1,275 +1,273 @@
#!/usr/bin/env php
<?php
/*
+-----------------------------------------------------------------------+
| This file is part of the Roundcube Webmail client |
| |
| Copyright (C) The Roundcube Dev Team |
| |
| Licensed under the GNU General Public License version 3 or |
| any later version with exceptions for skins & plugins. |
| See the README file for a full license statement. |
| |
| PURPOSE: |
| Check local configuration and database schema after upgrading |
| to a new version |
+-----------------------------------------------------------------------+
| Author: Thomas Bruederli <roundcube@gmail.com> |
+-----------------------------------------------------------------------+
*/
define('INSTALL_PATH', realpath(__DIR__ . '/..') . '/' );
require_once INSTALL_PATH . 'program/include/clisetup.php';
// get arguments
$opts = rcube_utils::get_opt(array('v' => 'version', 'y' => 'accept:bool'));
// ask user if no version is specified
if (!$opts['version']) {
echo "What version are you upgrading from? Type '?' if you don't know.\n";
if (($input = trim(fgets(STDIN))) && preg_match('/^[0-9.]+[a-z-]*$/', $input))
$opts['version'] = $input;
else
$opts['version'] = RCMAIL_VERSION;
}
$RCI = rcmail_install::get_instance();
$RCI->load_config();
if ($RCI->configured) {
$success = true;
if (($messages = $RCI->check_config()) || $RCI->legacy_config) {
$success = false;
$err = 0;
// list old/replaced config options
if (is_array($messages['replaced'])) {
echo "WARNING: Replaced config options:\n";
echo "(These config options have been replaced or renamed)\n";
foreach ($messages['replaced'] as $msg) {
echo "- '" . $msg['prop'] . "' was replaced by '" . $msg['replacement'] . "'\n";
$err++;
}
echo "\n";
}
// list obsolete config options (just a notice)
if (is_array($messages['obsolete'])) {
echo "NOTICE: Obsolete config options:\n";
echo "(You still have some obsolete or inexistent properties set. This isn't a problem but should be noticed)\n";
foreach ($messages['obsolete'] as $msg) {
echo "- '" . $msg['prop'] . ($msg['name'] ? "': " . $msg['name'] : "'") . "\n";
$err++;
}
echo "\n";
}
if (!$err && $RCI->legacy_config) {
echo "WARNING: Your configuration needs to be migrated!\n";
echo "We changed the configuration files structure and your two config files main.inc.php and db.inc.php have to be merged into one single file.\n";
$err++;
}
// ask user to update config files
if ($err) {
if (!$opts['accept']) {
echo "Do you want me to fix your local configuration? (y/N)\n";
$input = trim(fgets(STDIN));
}
// positive: let's merge the local config with the defaults
if ($opts['accept'] || strtolower($input) == 'y') {
$error = $written = false;
// backup current config
echo ". backing up the current config file(s)...\n";
foreach (array('config', 'main', 'db') as $file) {
if (file_exists(RCMAIL_CONFIG_DIR . '/' . $file . '.inc.php')) {
if (!copy(RCMAIL_CONFIG_DIR . '/' . $file . '.inc.php', RCMAIL_CONFIG_DIR . '/' . $file . '.old.php')) {
$error = true;
}
}
}
if (!$error) {
$RCI->merge_config();
echo ". writing " . RCMAIL_CONFIG_DIR . "/config.inc.php...\n";
$written = $RCI->save_configfile($RCI->create_config());
}
// Success!
if ($written) {
echo "Done.\n";
echo "Your configuration files are now up-to-date!\n";
if ($messages['missing']) {
echo "But you still need to add the following missing options:\n";
foreach ($messages['missing'] as $msg)
echo "- '" . $msg['prop'] . ($msg['name'] ? "': " . $msg['name'] : "'") . "\n";
}
if ($RCI->legacy_config) {
foreach (array('main', 'db') as $file) {
@unlink(RCMAIL_CONFIG_DIR . '/' . $file . '.inc.php');
}
}
}
else {
echo "Failed to write config file(s)!\n";
echo "Grant write privileges to the current user or update the files manually according to the above messages.\n";
}
}
else {
echo "Please update your config files manually according to the above messages.\n";
}
}
// check dependencies based on the current configuration
if (is_array($messages['dependencies'])) {
echo "WARNING: Dependency check failed!\n";
echo "(Some of your configuration settings require other options to be configured or additional PHP modules to be installed)\n";
foreach ($messages['dependencies'] as $msg) {
echo "- " . $msg['prop'] . ': ' . $msg['explain'] . "\n";
}
echo "Please fix your config files and run this script again!\n";
echo "See ya.\n";
}
}
// check file type detection
if ($RCI->check_mime_detection()) {
echo "WARNING: File type detection doesn't work properly!\n";
echo "Please check the 'mime_magic' config option or the finfo functions of PHP and run this script again.\n";
}
if ($RCI->check_mime_extensions()) {
echo "WARNING: Mimetype to file extension mapping doesn't work properly!\n";
echo "Please check the 'mime_types' config option and run this script again.\n";
}
// check database schema
if ($RCI->config['db_dsnw']) {
echo "Executing database schema update.\n";
$success = rcmail_utils::db_update(INSTALL_PATH . 'SQL', 'roundcube', $opts['version'],
array('errors' => true));
}
// update composer dependencies
if (is_file(INSTALL_PATH . 'composer.json') && is_readable(INSTALL_PATH . 'composer.json-dist')) {
$composer_data = json_decode(file_get_contents(INSTALL_PATH . 'composer.json'), true);
$composer_template = json_decode(file_get_contents(INSTALL_PATH . 'composer.json-dist'), true);
$comsposer_json = null;
// update the require section with the new dependencies
if (is_array($composer_data['require']) && is_array($composer_template['require'])) {
$composer_data['require'] = array_merge($composer_data['require'], $composer_template['require']);
// remove obsolete packages
$old_packages = array(
'pear-pear.php.net/net_socket',
'pear-pear.php.net/auth_sasl',
'pear-pear.php.net/net_idna2',
'pear-pear.php.net/mail_mime',
'pear-pear.php.net/net_smtp',
'pear-pear.php.net/crypt_gpg',
'pear-pear.php.net/net_sieve',
'pear/mail_mime-decode',
'roundcube/net_sieve',
'endroid/qrcode',
);
foreach ($old_packages as $pkg) {
if (array_key_exists($pkg, $composer_data['require'])) {
unset($composer_data['require'][$pkg]);
}
}
}
// update the repositories section with the new dependencies
if (is_array($composer_template['repositories'])) {
if (!is_array($composer_data['repositories'])) {
$composer_data['repositories'] = array();
}
foreach ($composer_template['repositories'] as $repo) {
$rkey = $repo['type'] . preg_replace('/^https?:/', '', $repo['url']) . $repo['package']['name'];
$existing = false;
foreach ($composer_data['repositories'] as $k => $_repo) {
if ($rkey == $_repo['type'] . preg_replace('/^https?:/', '', $_repo['url']) . $_repo['package']['name']) {
// switch to https://
if (isset($_repo['url']) && strpos($_repo['url'], 'http://') === 0)
$composer_data['repositories'][$k]['url'] = 'https:' . substr($_repo['url'], 5);
$existing = true;
break;
}
// remove old repos
else if (strpos($_repo['url'], 'git://git.kolab.org') === 0) {
unset($composer_data['repositories'][$k]);
}
else if ($_repo['type'] == 'package' && $_repo['package']['name'] == 'Net_SMTP') {
unset($composer_data['repositories'][$k]);
}
}
if (!$existing) {
$composer_data['repositories'][] = $repo;
}
}
$composer_data['repositories'] = array_values($composer_data['repositories']);
}
// use the JSON encoder from the Composer package
if (is_file('composer.phar')) {
include 'phar://composer.phar/src/Composer/Json/JsonFile.php';
$comsposer_json = \Composer\Json\JsonFile::encode($composer_data);
}
// PHP 5.4's json_encode() does the job, too
else if (defined('JSON_PRETTY_PRINT')) {
$comsposer_json = json_encode($composer_data, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);
}
else {
$success = false;
$comsposer_json = null;
}
// write updated composer.json back to disk
if ($comsposer_json && is_writeable(INSTALL_PATH . 'composer.json')) {
$success &= (bool)file_put_contents(INSTALL_PATH . 'composer.json', $comsposer_json);
}
else {
echo "WARNING: unable to update composer.json!\n";
echo "Please replace the 'require' section in your composer.json with the following:\n";
$require_json = '';
foreach ($composer_data['require'] as $pkg => $ver) {
$require_json .= sprintf(' "%s": "%s",'."\n", $pkg, $ver);
}
echo ' "require": {'."\n";
echo rtrim($require_json, ",\n");
echo "\n }\n\n";
}
echo "NOTE: Update dependencies by running `php composer.phar update --no-dev`\n";
}
// index contacts for fulltext searching
if ($opts['version'] && version_compare(version_parse($opts['version']), '0.6.0', '<')) {
rcmail_utils::indexcontacts();
}
if ($success) {
echo "This instance of Roundcube is up-to-date.\n";
echo "Have fun!\n";
}
}
else {
echo "This instance of Roundcube is not yet configured!\n";
echo "Open http://url-to-roundcube/installer/ in your browser and follow the instuctions.\n";
}
-
-?>
diff --git a/bin/updatecss.sh b/bin/updatecss.sh
index 6ff6f4efa..772ad8393 100755
--- a/bin/updatecss.sh
+++ b/bin/updatecss.sh
@@ -1,121 +1,119 @@
#!/usr/bin/env php
<?php
/*
+-----------------------------------------------------------------------+
| This file is part of the Roundcube Webmail client |
| |
| Copyright (C) The Roundcube Dev Team |
| |
| Licensed under the GNU General Public License version 3 or |
| any later version with exceptions for skins & plugins. |
| See the README file for a full license statement. |
| |
| PURPOSE: |
| Update cache-baster marks for css background images |
+-----------------------------------------------------------------------+
| Author: Aleksander Machniak <alec@alec.pl> |
+-----------------------------------------------------------------------+
*/
define('INSTALL_PATH', realpath(__DIR__ . '/..') . '/' );
require_once INSTALL_PATH . 'program/include/clisetup.php';
// get arguments
$opts = rcube_utils::get_opt(array(
'd' => 'dir',
));
if (empty($opts['dir'])) {
print "Skin directory not specified (--dir). Using skins/ and plugins/*/skins/.\n";
$dir = INSTALL_PATH . 'skins';
$dir_p = INSTALL_PATH . 'plugins';
$skins = glob("$dir/*", GLOB_ONLYDIR);
$skins_p = glob("$dir_p/*/skins/*", GLOB_ONLYDIR);
$dirs = array_merge($skins, $skins_p);
}
// Check if directory exists
else if (!file_exists($opts['dir'])) {
rcube::raise_error("Specified directory doesn't exist.", false, true);
}
else {
$dirs = array($opts['dir']);
}
foreach ($dirs as $dir) {
$img_dir = $dir . '/images';
if (!file_exists($img_dir)) {
continue;
}
$files = get_files($dir);
$images = get_images($img_dir);
$find = array();
$replace = array();
// build regexps array
foreach ($images as $path => $sum) {
$path_ex = str_replace('.', '\\.', $path);
$find[] = "#url\(['\"]?images/$path_ex(\?v=[a-f0-9-\.]+)?['\"]?\)#";
$replace[] = "url(images/$path?v=$sum)";
}
foreach ($files as $file) {
$file = $dir . '/' . $file;
print "File: $file\n";
$content = file_get_contents($file);
$content = preg_replace($find, $replace, $content, -1, $count);
if ($count) {
file_put_contents($file, $content);
}
}
}
function get_images($dir)
{
$images = array();
$dh = opendir($dir);
while ($file = readdir($dh)) {
if (preg_match('/^(.+)\.(gif|ico|png|jpg|jpeg)$/', $file, $m)) {
$filepath = "$dir/$file";
$images[$file] = substr(md5_file($filepath), 0, 4) . '.' . filesize($filepath);
print "Image: $filepath ({$images[$file]})\n";
}
else if ($file != '.' && $file != '..' && is_dir($dir . '/' . $file)) {
foreach (get_images($dir . '/' . $file) as $img => $sum) {
$images[$file . '/' . $img] = $sum;
}
}
}
closedir($dh);
return $images;
}
function get_files($dir)
{
$files = array();
$dh = opendir($dir);
while ($file = readdir($dh)) {
if (preg_match('/^(.+)\.(css|html)$/', $file, $m)) {
$files[] = $file;
}
else if ($file != '.' && $file != '..' && is_dir($dir . '/' . $file)) {
foreach (get_files($dir . '/' . $file) as $f) {
$files[] = $file . '/' . $f;
}
}
}
closedir($dh);
return $files;
}
-
-?>
diff --git a/bin/updatedb.sh b/bin/updatedb.sh
index 211f2415e..338b07f7c 100755
--- a/bin/updatedb.sh
+++ b/bin/updatedb.sh
@@ -1,41 +1,39 @@
#!/usr/bin/env php
<?php
/*
+-----------------------------------------------------------------------+
| This file is part of the Roundcube Webmail client |
| |
| Copyright (C) The Roundcube Dev Team |
| Copyright (C) Kolab Systems AG |
| |
| Licensed under the GNU General Public License version 3 or |
| any later version with exceptions for skins & plugins. |
| See the README file for a full license statement. |
| |
| PURPOSE: |
| Update database schema |
+-----------------------------------------------------------------------+
| Author: Aleksander Machniak <alec@alec.pl> |
+-----------------------------------------------------------------------+
*/
define('INSTALL_PATH', realpath(__DIR__ . '/..') . '/' );
require_once INSTALL_PATH . 'program/include/clisetup.php';
// get arguments
$opts = rcube_utils::get_opt(array(
'v' => 'version',
'd' => 'dir',
'p' => 'package',
));
if (empty($opts['dir'])) {
rcube::raise_error("Database schema directory not specified (--dir).", false, true);
}
if (empty($opts['package'])) {
rcube::raise_error("Database schema package name not specified (--package).", false, true);
}
rcmail_utils::db_update($opts['dir'], $opts['package'], $opts['version'], array('errors' => true));
-
-?>

File Metadata

Mime Type
text/x-diff
Expires
Thu, Mar 19, 8:46 AM (21 h, 47 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
457588
Default Alt Text
(55 KB)

Event Timeline