summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorThomas Bruederli <thomas@roundcube.net>2013-01-07 21:50:37 +0100
committerThomas Bruederli <thomas@roundcube.net>2013-01-07 21:50:37 +0100
commit6fdc35e13eff20c82e314a620158e56aa8366648 (patch)
tree4eead030843bacac815010eae3f25b28a576e915 /bin
parent2c6aea9b8e3431a22399a55d2b47e974e24cb4c8 (diff)
Remove development stuff and prepare for releasev0.9-beta
Diffstat (limited to 'bin')
-rwxr-xr-xbin/dumpschema.sh97
-rwxr-xr-xbin/exportgettext.sh233
-rwxr-xr-xbin/importgettext.sh196
-rwxr-xr-xbin/makedoc.sh26
4 files changed, 0 insertions, 552 deletions
diff --git a/bin/dumpschema.sh b/bin/dumpschema.sh
deleted file mode 100755
index 6d5cde723..000000000
--- a/bin/dumpschema.sh
+++ /dev/null
@@ -1,97 +0,0 @@
-#!/usr/bin/env php
-<?php
-/*
- +-----------------------------------------------------------------------+
- | bin/dumpschema.sh |
- | |
- | This file is part of the Roundcube Webmail client |
- | Copyright (C) 2005-2009, 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: |
- | Dumps database schema in XML format using MDB2_Schema |
- | |
- +-----------------------------------------------------------------------+
- | Author: Thomas Bruederli <roundcube@gmail.com> |
- +-----------------------------------------------------------------------+
-*/
-
-define('INSTALL_PATH', realpath(dirname(__FILE__) . '/..') . '/' );
-
-require INSTALL_PATH.'program/include/clisetup.php';
-
-/** callback function for schema dump **/
-function print_schema($dump)
-{
- foreach ((array)$dump as $part)
- echo $dump . "\n";
-}
-
-$config = new rcube_config();
-
-// don't allow public access if not in devel_mode
-if (!$config->get('devel_mode') && $_SERVER['REMOTE_ADDR']) {
- header("HTTP/1.0 401 Access denied");
- die("Access denied!");
-}
-
-$options = array(
- 'use_transactions' => false,
- 'log_line_break' => "\n",
- 'idxname_format' => '%s',
- 'debug' => false,
- 'quote_identifier' => true,
- 'force_defaults' => false,
- 'portability' => false,
-);
-
-$dsnw = $config->get('db_dsnw');
-$dsn_array = MDB2::parseDSN($dsnw);
-
-// set options for postgres databases
-if ($dsn_array['phptype'] == 'pgsql') {
- $options['disable_smart_seqname'] = true;
- $options['seqname_format'] = '%s';
-}
-
-$schema =& MDB2_Schema::factory($dsnw, $options);
-$schema->db->supported['transactions'] = false;
-
-
-// send as text/xml when opened in browser
-if ($_SERVER['REMOTE_ADDR'])
- header('Content-Type: text/xml');
-
-
-if (PEAR::isError($schema)) {
- $error = $schema->getMessage() . ' ' . $schema->getUserInfo();
-}
-else {
- $dump_config = array(
- // 'output_mode' => 'file',
- 'output' => 'print_schema',
- );
-
- $definition = $schema->getDefinitionFromDatabase();
- $definition['charset'] = 'utf8';
-
- if (PEAR::isError($definition)) {
- $error = $definition->getMessage() . ' ' . $definition->getUserInfo();
- }
- else {
- $operation = $schema->dumpDatabase($definition, $dump_config, MDB2_SCHEMA_DUMP_STRUCTURE);
- if (PEAR::isError($operation)) {
- $error = $operation->getMessage() . ' ' . $operation->getUserInfo();
- }
- }
-}
-
-$schema->disconnect();
-
-if ($error && !$_SERVER['REMOTE_ADDR'])
- fputs(STDERR, $error);
-
-?>
diff --git a/bin/exportgettext.sh b/bin/exportgettext.sh
deleted file mode 100755
index b220b2242..000000000
--- a/bin/exportgettext.sh
+++ /dev/null
@@ -1,233 +0,0 @@
-#!/usr/bin/env php
-<?php
-/*
- +-----------------------------------------------------------------------+
- | bin/exportgettext.sh |
- | |
- | This file is part of the Roundcube Webmail client |
- | Copyright (C) 2011, The Roundcube Dev Team |
- | Licensed under the GNU General Public License |
- | |
- | PURPOSE: |
- | Export PHP-based localization files to PO files for gettext |
- +-----------------------------------------------------------------------+
- | Author: Thomas Bruederli <roundcube@gmail.com> |
- +-----------------------------------------------------------------------+
-*/
-
-define('INSTALL_PATH', realpath(dirname(__FILE__) . '/..') . '/' );
-require INSTALL_PATH.'program/include/clisetup.php';
-
-if ($argc < 2) {
- die("Usage: " . basename($argv[0]) . " SRCDIR DESTDIR\n");
-}
-
-$srcdir = unslashify(realpath($argv[1]));
-$destdir = unslashify($argv[2]);
-$layout = 'launchpad'; # or 'narro';
-$langcode_map = array(
- 'hy_AM' => 'hy',
- 'ar_SA' => 'ar',
- 'az_AZ' => 'az',
- 'bg_BG' => 'bg',
- 'bs_BA' => 'bs',
- 'ca_ES' => 'ca',
- 'cs_CZ' => 'cs',
- 'cy_GB' => 'cy',
- 'da_DK' => 'da',
- 'et_EE' => 'et',
- 'el_GR' => 'el',
- 'eu_ES' => 'eu',
- 'fa_IR' => 'fa',
- 'ga_IE' => 'ga',
- 'ka_GE' => 'ka',
- 'gl_ES' => 'gl',
- 'he_IL' => 'he',
- 'hi_IN' => 'hi',
- 'hr_HR' => 'hr',
- 'ja_JP' => 'ja',
- 'ko_KR' => 'ko',
- 'km_KH' => 'km',
- 'ms_MY' => 'ms',
- 'mr_IN' => 'mr',
- 'ml_IN' => 'ml',
- 'pl_PL' => 'pl',
- 'si_LK' => 'si',
- 'sl_SI' => 'sl',
- 'sq_AL' => 'sq',
- 'sr_CS' => 'sr',
- 'sv_SE' => 'sv',
- 'uk_UA' => 'uk',
- 'vi_VN' => 'vi',
-);
-
-
-// converting roundcube localization dir
-if (is_dir($srcdir.'/en_US')) {
- load_en_US($srcdir.'/en_US');
-
- foreach (glob($srcdir.'/*') as $locdir) {
- if (is_dir($locdir)) {
- $lang = basename($locdir);
- //echo "$locdir => $destdir$lang\n";
- convert_dir($locdir, $destdir . ($layout != 'launchpad' ? $lang : ''));
- }
- }
-}
-// converting single localization directory
-else if (is_dir($srcdir)) {
- if (is_file($srcdir.'/en_US.inc')) // plugin localization
- load_en_US($srcdir.'/en_US.inc');
- else
- load_en_US(realpath($srcdir.'/../en_US')); // single language
- convert_dir($srcdir, $destdir);
-}
-// converting a single file
-else if (is_file($srcdir)) {
- //load_en_US();
- convert_file($srcdir, $destdir);
-}
-
-
-/**
- * Load en_US localization which is used to build msgids
- */
-function load_en_US($fn)
-{
- $texts = array();
-
- if (is_dir($fn)) {
- foreach (glob($fn.'/*.inc') as $ifn) {
- include($ifn);
- $texts = array_merge($texts, (array)$labels, (array)$messages);
- }
- }
- else if (is_file($fn)) {
- include($fn);
- $texts = array_merge($texts, (array)$labels, (array)$messages);
- }
-
- $GLOBALS['en_US'] = $texts;
-}
-
-/**
- * Convert all .inc files in the given src directory
- */
-function convert_dir($indir, $outdir)
-{
- global $layout;
-
- if (!is_dir($outdir)) // attempt to create destination dir
- mkdir($outdir, 0777, true);
-
- foreach (glob($indir.'/*.inc') as $fn) {
- $filename = basename($fn);
-
- // create subdir for each template (launchpad rules)
- if ($layout == 'launchpad' && preg_match('/^(labels|messages)/', $filename, $m)) {
- $lang = end(explode('/', $indir));
- $destdir = $outdir . '/' . $m[1];
- if (!is_dir($destdir))
- mkdir($destdir, 0777, true);
- $outfn = $destdir . '/' . $lang . '.po';
- }
- else {
- $outfn = $outdir . '/' . preg_replace('/\.[a-z0-9]+$/i', '', basename($fn)) . '.po';
- }
-
- convert_file($fn, $outfn);
- }
-}
-
-/**
- * Convert the given Roundcube localization file into a gettext .po file
- */
-function convert_file($fn, $outfn)
-{
- global $layout, $langcode_map;
-
- $basename = basename($fn);
- $srcname = str_replace(INSTALL_PATH, '', $fn);
- $product = preg_match('!plugins/(\w+)!', $srcname, $m) ? 'roundcube-plugin-' . $m[1] : 'roundcubemail';
- $lang = preg_match('!/([a-z]{2}(_[A-Z]{2})?)[./]!', $outfn, $m) ? $m[1] : '';
- $labels = $messages = $seen = array();
-
- if (is_dir($outfn))
- $outfn .= '/' . $basename . '.po';
-
- // launchpad requires the template file to have the same name as the directory
- if (strstr($outfn, '/en_US') && $layout == 'launchpad') {
- $a = explode('/', $outfn);
- array_pop($a);
- $templ = end($a);
- $a[] = $templ . '.pot';
- $outfn = join('/', $a);
- $is_pot = true;
- }
- // launchpad is very picky about file names
- else if ($layout == 'launchpad' && preg_match($regex = '!/([a-z]{2})_([A-Z]{2})!', $outfn, $m)) {
- if ($shortlang = $langcode_map[$lang])
- $outfn = preg_replace($regex, '/'.$shortlang, $outfn);
- else if ($m[1] == strtolower($m[2]))
- $outfn = preg_replace($regex, '/\1', $outfn);
- }
-
- include($fn);
- $texts = array_merge($labels, $messages);
-
- // write header
- $header = <<<EOF
-# Converted from Roundcube PHP localization files
-# Copyright (C) 2011 The Roundcube Dev Team
-# This file is distributed under the same license as the Roundcube package.
-#
-#: %s
-msgid ""
-msgstr ""
-"Project-Id-Version: %s\\n"
-"Report-Msgid-Bugs-To: \\n"
-"%s: %s\\n"
-"Last-Translator: \\n"
-"Language-Team: Translations <hello@roundcube.net>\\n"
-"Language: %s\\n"
-"Content-Type: text/plain; charset=UTF-8\\n"
-"Content-Transfer-Encoding: 8bit\\n"
-EOF;
-
- $out = sprintf($header, $srcname, $product, $is_pot ? "POT-Creation-Date" : "PO-Revision-Date", date('c'), $shortlang ? $shortlang : $lang);
- $out .= "\n";
-
- $messages = array();
- foreach ((array)$texts as $label => $msgstr) {
- $msgid = $is_pot ? $msgstr : ($GLOBALS['en_US'][$label] ?: $label);
- $messages[$msgid][] = $label;
- }
-
- foreach ($messages as $msgid => $labels) {
- $out .= "\n";
- foreach ($labels as $label)
- $out .= "#: $srcname:$label\n";
- $msgstr = $texts[$label];
- $out .= 'msgid ' . gettext_quote($msgid) . "\n";
- $out .= 'msgstr ' . gettext_quote(!$is_pot ? $msgstr : '') . "\n";
- }
-
- if ($outfn == '-')
- echo $out;
- else {
- echo "$fn\t=>\t$outfn\n";
- file_put_contents($outfn, $out);
- }
-}
-
-function gettext_quote($str)
-{
- $out = "";
- $lines = explode("\n", wordwrap(stripslashes($str)));
- $last = count($lines) - 1;
- foreach ($lines as $i => $line)
- $out .= '"' . addcslashes($line, '"') . ($i < $last ? ' ' : '') . "\"\n";
- return rtrim($out);
-}
-
-?>
diff --git a/bin/importgettext.sh b/bin/importgettext.sh
deleted file mode 100755
index 285f5680f..000000000
--- a/bin/importgettext.sh
+++ /dev/null
@@ -1,196 +0,0 @@
-#!/usr/bin/env php
-<?php
-/*
- +-----------------------------------------------------------------------+
- | bin/importgettext.sh |
- | |
- | This file is part of the Roundcube Webmail client |
- | Copyright (C) 2011, The Roundcube Dev Team |
- | Licensed under the GNU General Public License |
- | |
- | PURPOSE: |
- | Import localizations from gettext PO format |
- +-----------------------------------------------------------------------+
- | Author: Thomas Bruederli <roundcube@gmail.com> |
- +-----------------------------------------------------------------------+
-*/
-
-define('INSTALL_PATH', realpath(dirname(__FILE__) . '/..') . '/' );
-require INSTALL_PATH.'program/include/clisetup.php';
-
-if ($argc < 2) {
- die("Usage: " . basename($argv[0]) . " SRCDIR\n");
-}
-
-$srcdir = unslashify(realpath($argv[1]));
-
-if (is_dir($srcdir)) {
- $out = import_dir($srcdir);
-}
-else if (is_file($srcdir)) {
- $out = import_file($srcdir);
-}
-
-// write output files
-foreach ($out as $outfn => $texts) {
- $lang = preg_match('!/([a-z]{2}(_[A-Z]{2})?)[./]!', $outfn, $m) ? $m[1] : '';
- $varname = strpos($outfn, 'messages.inc') !== false ? 'messages' : 'labels';
-
- $header = <<<EOF
-<?php
-
-/*
- +-----------------------------------------------------------------------+
- | localization/%s/%-51s|
- | |
- | Language file of the Roundcube Webmail client |
- | Copyright (C) %s, The Roundcube Dev Team |
- | Licensed under the GNU General Public License |
- | |
- +-----------------------------------------------------------------------+
- | Author: %-62s|
- +-----------------------------------------------------------------------+
-*/
-
-$%s = array();
-
-EOF;
-
- $author = preg_replace('/\s*<Unknown>/i', '', $texts['_translator']);
- $output = sprintf($header, $lang, $varname.'.inc', date('Y'), $author, $varname);
-
- foreach ($texts as $label => $value) {
- if (is_array($value)) { var_dump($outfn, $label, $value); exit; }
- if ($label[0] != '_' && strlen($value))
- $output .= sprintf("\$%s['%s'] = '%s';\n", $varname, $label, strtr(addcslashes($value, "'"), array("\r" => '', "\n" => '\n')));
- }
-
- $output .= "\n";
- $dir = dirname($outfn);
- @mkdir($dir, 0755, true);
- if (file_put_contents($outfn, $output))
- echo "-> $outfn\n";
-}
-
-
-/**
- * Convert all .po files in the given src directory
- */
-function import_dir($indir)
-{
- $out = array();
- foreach (glob($indir.'/*.po') as $fn) {
- $out = array_merge_recursive($out, import_file($fn));
- }
- return $out;
-}
-
-/**
- * Convert the given .po file into a Roundcube localization array
- */
-function import_file($fn)
-{
- $out = array();
- $lines = file($fn);
- $language = '';
- $translator = '';
-
- // get language code from file name
- if (preg_match('/-([a-z_]+).po$/i', $fn, $m))
- $language = expand_langcode($m[1]);
-
- $is_header = true;
- $msgid = null;
- $msgstr = '';
- $dests = array();
- foreach ($lines as $i => $line) {
- $line = trim($line);
-
- // parse header
- if ($is_header && $line[0] == '"') {
- list($key, $val) = explode(": ", preg_replace('/\\\n$/', '', trim($line, '"')), 2);
- switch (strtolower($key)) {
- case 'language':
- $language = expand_langcode($val);
- break;
- case 'last-translator':
- $translator = $val;
- break;
- }
- }
-
- // empty line
- if ($line == '') {
- if ($msgid && $dests) {
- foreach ($dests as $dest) {
- list($file, $label) = explode(':', $dest);
- $out[$file][$label] = $msgstr;
- $out[$file]['_translator'] = $translator;
- }
- }
-
- $msgid = null;
- $msgstr = '';
- $dests = array();
- }
-
- // meta line
- if ($line[0] == '#') {
- $value = trim(substr($line, 2));
- if ($line[1] == ':')
- $dests[] = str_replace('en_US', $language, $value);
- }
- else if (strpos($line, 'msgid') === 0) {
- $msgid = gettext_decode(substr($line, 6));
-
- if (!empty($msgid))
- $is_header = false;
- }
- else if (strpos($line, 'msgstr') === 0) {
- $msgstr = gettext_decode(substr($line, 7));
- }
- else if ($msgid && $line[0] == '"') {
- $msgstr .= gettext_decode($line);
- }
- else if ($msgid !== null && $line[0] == '"') {
- $msgid .= gettext_decode($line);
- }
- }
-
- if ($msgid && $dests) {
- foreach ($dests as $dest) {
- list($file, $label) = explode(':', $dest);
- $out[$file][$label] = $msgstr;
- $out[$file]['_translator'] = $translator;
- }
- }
-
- return $language ? $out : array();
-}
-
-
-function gettext_decode($str)
-{
- return stripslashes(trim($str, '"'));
-}
-
-/**
- * Translate two-chars language codes to our internally used language identifiers
- */
-function expand_langcode($lang)
-{
- static $rcube_language_aliases, $rcube_languages;
-
- if (!$rcube_language_aliases)
- include(INSTALL_PATH . 'program/localization/index.inc');
-
- if ($rcube_language_aliases[$lang])
- return $rcube_language_aliases[$lang];
- else if (strlen($lang) == 2 && !isset($rcube_languages[$lang]))
- return strtolower($lang) . '_' . strtoupper($lang);
- else
- return $lang;
-}
-
-
-?>
diff --git a/bin/makedoc.sh b/bin/makedoc.sh
deleted file mode 100755
index 2a34254cb..000000000
--- a/bin/makedoc.sh
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/bin/sh
-
-TITLE="Roundcube Webmail"
-PACKAGES="Core"
-
-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
-CONVERTER=frames
-TEMPLATE=earthli
-PRIVATE=off
-
-# make documentation
-$BIN_PHPDOC -d $PATH_PROJECT,$PATH_FRAMEWORK -t $PATH_DOCS -ti "$TITLE" -dn $PACKAGES \
--o $OUTPUTFORMAT:$CONVERTER:$TEMPLATE -pp $PRIVATE
-