The core will be the core
authorFlorent Bruneau <florent.bruneau@polytechnique.org>
Sun, 22 Jun 2008 14:13:50 +0000 (16:13 +0200)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Sun, 22 Jun 2008 14:13:50 +0000 (16:13 +0200)
Signed-off-by: Florent Bruneau <florent.bruneau@polytechnique.org>
39 files changed:
core/classes/csvimporter.php [deleted file]
core/classes/env.php [deleted file]
core/classes/miniwiki.php [deleted file]
core/classes/mmlist.php [deleted file]
core/classes/platal.php [deleted file]
core/classes/plbacktrace.php [deleted file]
core/classes/plflagset.php [deleted file]
core/classes/plglobals.php [deleted file]
core/classes/pliterator.php [deleted file]
core/classes/pllogger.php [deleted file]
core/classes/plmailer.php [deleted file]
core/classes/plmodule.php [deleted file]
core/classes/plpage.php [deleted file]
core/classes/plprofiler.php [deleted file]
core/classes/plsession.php [deleted file]
core/classes/plset.php [deleted file]
core/classes/pltableeditor.php [deleted file]
core/classes/plupload.php [deleted file]
core/classes/plwizard.php [deleted file]
core/classes/s.php [deleted file]
core/classes/varstream.php [deleted file]
core/classes/xdb.php [deleted file]
core/classes/xmlrpcclient.php [deleted file]
core/include/misc.inc.php [deleted file]
core/include/platal.inc.php [deleted file]
core/modules/core.php [deleted file]
core/plugins/block.tidy.php [deleted file]
core/plugins/compiler.checkpasswd.php [deleted file]
core/plugins/compiler.iterate.php [deleted file]
core/plugins/compiler.javascript.php [deleted file]
core/plugins/function.select_db_table.php [deleted file]
core/plugins/function.valid_date.php [deleted file]
core/plugins/function.xsrf_token.php [deleted file]
core/plugins/function.xsrf_token_field.php [deleted file]
core/plugins/modifier.date_format.php [deleted file]
core/plugins/modifier.htmlentities.php [deleted file]
core/plugins/modifier.miniwiki.php [deleted file]
core/plugins/modifier.number_format.php [deleted file]
core/plugins/modifier.uint_to_ip.php [deleted file]

diff --git a/core/classes/csvimporter.php b/core/classes/csvimporter.php
deleted file mode 100644 (file)
index 0f576a0..0000000
+++ /dev/null
@@ -1,355 +0,0 @@
-<?php
-/***************************************************************************
- *  Copyright (C) 2003-2008 Polytechnique.org                              *
- *  http://opensource.polytechnique.org/                                   *
- *                                                                         *
- *  This program is free software; you can redistribute it and/or modify   *
- *  it under the terms of the GNU General Public License as published by   *
- *  the Free Software Foundation; either version 2 of the License, or      *
- *  (at your option) any later version.                                    *
- *                                                                         *
- *  This program is distributed in the hope that it will be useful,        *
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of         *
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
- *  GNU General Public License for more details.                           *
- *                                                                         *
- *  You should have received a copy of the GNU General Public License      *
- *  along with this program; if not, write to the Free Software            *
- *  Foundation, Inc.,                                                      *
- *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
- ***************************************************************************/
-
-define('CSV_INSERT',     'insert'); // INSERT IGNORE
-define('CSV_REPLACE',    'replace'); // REPLACE
-define('CSV_UPDATE',     'update'); // INSERT and UPDATE on error
-define('CSV_UPDATEONLY', 'updateonly'); // UPDATE
-
-class CSVImporter
-{
-    private $table;
-    private $key;
-    private $do_sql;
-
-    private $index;
-    private $data = array();
-
-    private $user_functions = array();
-    private $field_desc = array();
-    private $field_value = array();
-
-    public function __construct($table, $key = 'id', $do_sql = true)
-    {
-        $this->table     = $table;
-        $this->key       = explode(',', $key);
-        $this->do_sql    = $do_sql;
-    }
-
-    private function processLine(array $array)
-    {
-        if (is_null($this->index)) {
-            $this->index = array_map('strtolower', $array);
-            return true;
-        }
-
-        if (count($array) != count($this->index)) {
-            return false;
-        }
-        $assoc = array();
-        $i     = 0;
-        foreach ($this->index as $key) {
-            $assoc[$key] = $array[$i];
-            $i++;
-        }
-        $this->data[] = $assoc;
-        return true;
-    }
-
-    private function getValue($line, $key, $action)
-    {
-        if (@array_key_exists($action, $line)) {
-            $value = $line[$action];
-        } elseif (is_callable($action, false)) {
-            $value = call_user_func($action, $line, $key);
-        } else {
-            $value = $action;
-        }
-        if (is_null($value) || $value == 'NULL') {
-            $value = 'NULL';
-        }
-        return $value;
-    }
-
-    private function makeAssoc($line, $relation)
-    {
-        $ops = array();
-        foreach ($relation as $key=>$ref) {
-            $ops[$key] = $this->getValue($line, $key, $ref);
-        }
-        return $ops;
-    }
-
-    private function makeRequestArgs($line, $relation)
-    {
-        $ops = array();
-        foreach ($relation as $key=>$ref) {
-            $value = $this->getValue($line, $key, $ref);
-            if (!is_null($value) && $value != 'NULL') {
-                $value = "'" . addslashes($value) . "'";
-            }
-            $ops[$key] = "$key = $value";
-        }
-        return $ops;
-    }
-
-    private function makeRelation()
-    {
-        $relation = array();
-        foreach ($this->index as $title) {
-            $relation[$title] = $title;
-        }
-        return $relation;
-    }
-
-    private function execute($query)
-    {
-        if (!$this->do_sql) {
-            echo "$query;\n";
-            return false;
-        }
-        return XDB::execute($query);
-    }
-
-    private function getFieldList()
-    {
-        $res = XDB::query("SHOW COLUMNS FROM {$this->table}");
-        if ($res->numRows()) {
-            return $res->fetchColumn();
-        }
-        return null;
-    }
-
-    public function setCSV($csv, $index = null, $separator = ';')
-    {
-        require_once dirname(__FILE__) . '/varstream.php';
-        VarStream::init();
-        global $csv_source;
-        $this->index     = null;
-
-        $csv_source = $csv;
-        $res        = fopen('var://csv_source', 'r');
-
-        while (!feof($res)) {
-            $this->processLine(fgetcsv($res, 0, $separator));
-        }
-    }
-
-    public function run($action = CSV_UPDATE, $insert_relation = null, $update_relation = null)
-    {
-        if (is_null($insert_relation)) {
-            $insert_relation = $this->makeRelation();
-        }
-        if (is_null($update_relation)) {
-            $update_relation = $insert_relation;
-        }
-        foreach ($this->data as $line) {
-            $set = join(', ', $this->makeRequestArgs($line, $insert_relation));
-            switch ($action) {
-              case CSV_INSERT:
-                $this->execute("INSERT IGNORE INTO {$this->table} SET $set");
-                break;
-              case CSV_REPLACE:
-                $this->execute("REPLACE INTO {$this->table} SET $set");
-                break;
-              case CSV_UPDATE: case CSV_UPDATEONLY:
-                if ($action == CSV_UPDATEONLY || !$this->execute("INSERT INTO {$this->table} SET $set")) {
-                    $ops = $this->makeRequestArgs($line, $update_relation);
-                    $set = join(', ', $ops);
-                    $where = array();
-                    foreach ($this->key as $key) {
-                        $where[] = $ops[$key];
-                    }
-                    $where = join(' AND ', $where);
-                    $this->execute("UPDATE {$this->table} SET $set WHERE $where");
-                }
-                break;
-            }
-        }
-    }
-
-    static public function dynamicCond($line, $key)
-    {
-        static $fields, $conds, $values, $thens, $elses;
-
-        if (!isset($fields)) {
-            $fields = $_SESSION['csv_cond_field'];
-            $conds  = $_SESSION['csv_cond'];
-            $values = $_SESSION['csv_cond_value'];
-            $thens  = $_SESSION['csv_cond_then'];
-            $elses  = $_SESSION['csv_cond_else'];
-        }
-        $field = $line[$fields[$key]];
-        $cond  = $conds[$key];
-        $value = $values[$key];
-        if (is_numeric($field) && is_numeric($value)) {
-            $field = floatval($field);
-            $value = floatval($value);
-        }
-        switch ($cond) {
-            case 'defined':          $ok = (!empty($field)); break;
-            case 'equals':           $ok = ($field == $value); break;
-            case 'contains':         $ok = (strpos($field, $value) !== false); break;
-            case 'contained':        $ok = (strpos($value, $field) !== false); break;
-            case 'greater':          $ok = ($field > $value); break;
-            case 'greater_or_equal': $ok ($field >= $value); break;
-            case 'lower':            $ok = ($field < $value); break;
-            case 'lower_or_equal':   $ok = ($field <= $value); break;
-            default:                 $ok = false;
-        }
-        if ($ok) {
-            return $thens[$key];
-        } else {
-            return $elses[$key];
-        }
-    }
-
-    public function registerFunction($name, $desc, $callback)
-    {
-        if (is_callable($callback, false, $ref)) {
-            $this->user_functions['func_' . $name] = array('desc' => $desc, 'callback' => $callback);
-            return true;
-        }
-        return false;
-    }
-
-    public function describe($name, $desc)
-    {
-        $this->field_desc[$name] = $desc;
-    }
-
-    public function forceValue($name, $value)
-    {
-        $this->field_value[$name] = $value;
-    }
-
-    private function cleanSession($fields)
-    {
-        foreach ($fields as $field) {
-            unset($_SESSION[$field]);
-        }
-    }
-
-    /** Handle insertion form
-     * @param $page  PlPage to process
-     * @param $url   URI of the page
-     * @param $field Editable fields
-     */
-    public function apply(&$page, $url, $fields = null)
-    {
-        $sesfields = array('csv_value', 'csv_user_value', 'csv_cond_field',
-                           'csv_update', 'csv_action', 'csv_cond_field',
-                           'csv_cond', 'csv_cond_value', 'csv_cond_then',
-                           'csv_cond_else', 'csv', 'csv_separator', 'csv_url');
-        if ($url != @$_SESSION['csv_url']) {
-            $this->cleanSession($sesfields);
-            $_SESSION['csv_url'] = $url;
-        }
-
-        if (is_null($fields) || empty($fields)) {
-            $fields = $this->getFieldList();
-        }
-        if (is_null($fields)) {
-            return false;
-        }
-        foreach ($this->field_value as $key=>$value) {
-            $search = array_search($key, $fields);
-            unset($fields[$search]);
-        }
-
-        $current = Env::v('csv_page');
-        if (empty($current)) {
-            $current = 'source';
-        }
-        $next = Env::v('csv_next_page');
-        if (empty($next)) {
-            $next = $current;
-        }
-        $csv  = @$_SESSION['csv'];
-        if ($current == 'source' && Env::has('csv_valid')) {
-            $csv = Env::v('csv_source');
-            $_SESSION['csv'] = $csv;
-            $next = 'values';
-        }
-        if ($csv) {
-            if (Env::has('csv_separator')) {
-                $sep = Env::v('csv_separator');
-                if (empty($sep)) {
-                    $sep = ';';
-                }
-                $_SESSION['csv_separator'] = $sep;
-            }
-            $this->setCSV($csv, null, $_SESSION['csv_separator']);
-        }
-        if ($current == 'values' && Env::has('csv_valid')) {
-            $next = 'valid';
-        }
-        if (empty($csv)) {
-            $next = 'source';
-        }
-        if (Env::has('csv_action')) {
-            $_SESSION['csv_action'] = Env::v('csv_action');
-        }
-        if ($next == 'valid') {
-            if ($current != 'valid') {
-                $cpyfields = array('csv_value', 'csv_user_value', 'csv_cond_field',
-                                   'csv_update', 'csv_action', 'csv_cond_field',
-                                   'csv_cond', 'csv_cond_value', 'csv_cond_then',
-                                   'csv_cond_else');
-                foreach ($cpyfields as $field) {
-                    $_SESSION[$field] = Env::v($field);
-                }
-            }
-            $insert   = $_SESSION['csv_value'];
-            $values   = $_SESSION['csv_user_value'];
-            $update   = $_SESSION['csv_update'];
-            foreach ($insert as $key=>$value) {
-                if (empty($value)) {
-                    $insert[$key] = null;
-                } elseif ($value == 'user_value') {
-                    $insert[$key] = $values[$key];
-                } elseif ($value == 'cond_value') {
-                    $insert[$key] = array($this, 'dynamicCond');
-                } elseif (array_key_exists($value, $this->user_functions)) {
-                    $insert[$key] = $this->user_functions[$value]['callback'];
-                }
-                if (isset($update[$key])) {
-                    $update[$key] = $insert[$key];
-                }
-            }
-            foreach ($this->field_value as $key=>$value) {
-                $insert[$key] = $value;
-                $fields[]     = $key;
-            }
-            if ($current == 'valid' && Env::has('csv_valid')) {
-                S::assert_xsrf_token();
-                $this->run($_SESSION['csv_action'], $insert, $update);
-                $page->assign('csv_done', true);
-                $this->cleanSession($sesfields);
-            } else {
-                $preview = array();
-                foreach ($this->data as $line) {
-                    $preview[] = $this->makeAssoc($line, $insert);
-                }
-                $page->assign('csv_preview', $preview);
-            }
-        }
-        $page->assign('csv_index', $this->index);
-        $page->assign('csv_functions', $this->user_functions);
-        $page->assign('csv_field_desc', $this->field_desc);
-        $page->assign('csv_page', $next);
-        $page->assign('csv_path', $url);
-        $page->assign('csv_fields', $fields);
-    }
-}
-
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
-?>
diff --git a/core/classes/env.php b/core/classes/env.php
deleted file mode 100644 (file)
index e3bbd88..0000000
+++ /dev/null
@@ -1,214 +0,0 @@
-<?php
-/***************************************************************************
- *  Copyright (C) 2003-2008 Polytechnique.org                              *
- *  http://opensource.polytechnique.org/                                   *
- *                                                                         *
- *  This program is free software; you can redistribute it and/or modify   *
- *  it under the terms of the GNU General Public License as published by   *
- *  the Free Software Foundation; either version 2 of the License, or      *
- *  (at your option) any later version.                                    *
- *                                                                         *
- *  This program is distributed in the hope that it will be useful,        *
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of         *
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
- *  GNU General Public License for more details.                           *
- *                                                                         *
- *  You should have received a copy of the GNU General Public License      *
- *  along with this program; if not, write to the Free Software            *
- *  Foundation, Inc.,                                                      *
- *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
- ***************************************************************************/
-
-class Env
-{
-    public static function _get($key, $default)
-    {
-        return isset($_REQUEST[$key]) ? $_REQUEST[$key] : $default;
-    }
-
-    public static function has($key)
-    {
-        return isset($_REQUEST[$key]);
-    }
-
-    public static function kill($key)
-    {
-        unset($_REQUEST[$key]);
-    }
-
-    public static function v($key, $default = null)
-    {
-        return Env::_get($key, $default);
-    }
-
-    public static function s($key, $default = '')
-    {
-        return (string)Env::_get($key, $default);
-    }
-
-    public static function b($key, $default = false)
-    {
-        return (bool)Env::_get($key, $default);
-    }
-
-    public static function i($key, $default = 0)
-    {
-        $i = Env::_get($key, $default);
-        return is_numeric($i) ? intval($i) : $default;
-    }
-
-    public static function l(array $keys)
-    {
-        return array_map(array('Env', 'v'), $keys);
-    }
-}
-
-class Post
-{
-    public static function _get($key, $default)
-    {
-        return isset($_POST[$key]) ? $_POST[$key] : $default;
-    }
-
-    public static function has($key)
-    {
-        return isset($_POST[$key]);
-    }
-
-    public static function kill($key)
-    {
-        unset($_POST[$key]);
-    }
-
-    public static function v($key, $default = null)
-    {
-        return Post::_get($key, $default);
-    }
-
-    public static function b($key, $default = false)
-    {
-        return (bool)Post::_get($key, $default);
-    }
-
-    public static function s($key, $default = '')
-    {
-        return (string)Post::_get($key, $default);
-    }
-
-    public static function i($key, $default = 0)
-    {
-        $i = Post::_get($key, $default);
-        return is_numeric($i) ? intval($i) : $default;
-    }
-
-     public static function l(array $keys)
-    {
-        return array_map(array('Post', 'v'), $keys);
-    }
-}
-
-class Get
-{
-    public static function _get($key, $default)
-    {
-        return isset($_GET[$key]) ? $_GET[$key] : $default;
-    }
-
-    public static function has($key)
-    {
-        return isset($_GET[$key]);
-    }
-
-    public static function kill($key)
-    {
-        unset($_GET[$key]);
-    }
-
-    public static function v($key, $default = null)
-    {
-        return Get::_get($key, $default);
-    }
-
-    public static function b($key, $default = false)
-    {
-        return (bool)Get::_get($key, $default);
-    }
-
-    public static function s($key, $default = '')
-    {
-        return (string)Get::_get($key, $default);
-    }
-
-    public static function i($key, $default = 0)
-    {
-        $i = Get::_get($key, $default);
-        return is_numeric($i) ? intval($i) : $default;
-    }
-
-    public static function l(array $keys)
-    {
-        return array_map(array('Get', 'v'), $keys);
-    }
-}
-
-class Cookie
-{
-    public static function _get($key, $default)
-    {
-        return isset($_COOKIE[$key]) ? $_COOKIE[$key] : $default;
-    }
-
-    public static function has($key)
-    {
-        return isset($_COOKIE[$key]);
-    }
-
-    public static function kill($key)
-    {
-        unset($_COOKIE[$key]);
-    }
-
-    public static function v($key, $default = null)
-    {
-        return Cookie::_get($key, $default);
-    }
-
-    public static function s($key, $default = '')
-    {
-        return (string)Cookie::_get($key, $default);
-    }
-
-    public static function b($key, $default = false)
-    {
-        return (bool)Cookie::_get($key, $default);
-    }
-
-    public static function i($key, $default = 0)
-    {
-        $i = Cookie::_get($key, $default);
-        return is_numeric($i) ? intval($i) : $default;
-    }
-
-    public static function l(array $keys)
-    {
-        return array_map(array('Cookie', 'v'), $keys);
-    }
-}
-
-function fix_gpc_magic(&$item, $key) {
-    if (is_array($item)) {
-        array_walk($item, 'fix_gpc_magic');
-    } else {
-        $item = stripslashes($item);
-    }
-}
-
-if (ini_get('magic_quotes_gpc') && empty($DONT_FIX_GPC)) {
-    array_walk($_GET, 'fix_gpc_magic');
-    array_walk($_POST, 'fix_gpc_magic');
-    array_walk($_COOKIE, 'fix_gpc_magic');
-    array_walk($_REQUEST, 'fix_gpc_magic');
-}
-
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
-?>
diff --git a/core/classes/miniwiki.php b/core/classes/miniwiki.php
deleted file mode 100644 (file)
index ab547e0..0000000
+++ /dev/null
@@ -1,198 +0,0 @@
-<?php
-
-class MiniWiki
-{
-
-    private static $patternsWiki = array();
-    private static $replacementHTML = array();
-    private static $replacementText = array();
-
-    private static $title_index = -1;
-    private static $info     = array();
-
-    public static function Markup($pattern, $replacement, $replacementTxt, $info = null)
-    {
-        $id = count(MiniWiki::$patternsWiki);
-        MiniWiki::$patternsWiki[$id] = $pattern;
-        MiniWiki::$replacementHTML[$id] = $replacement;
-        MiniWiki::$replacementText[$id] = $replacementTxt;
-        if ($info) {
-            MiniWiki::$info[$id] = $info;
-        }
-        return $id;
-    }
-
-    public static function init()
-    {
-        if (isset(MiniWiki::$patternsWiki[0])) {
-            return;
-        }
-        MiniWiki::Markup("/(\r\n|\r([^\n]))/", "\n$2", "\n$2");
-
-        // retours à la ligne avec \\
-        MiniWiki::Markup("/\\\\(?".">(\\\\*))\n/e", "str_repeat('<br />\n',mb_strlen('$1'))", "str_repeat('\n',mb_strlen('$1'))", "ligne1\\\\\nligne2");
-
-        // * unordered list
-        MiniWiki::Markup("/(^|\n)\*(([^\n]*(\n|$))(\*[^\n]*(\n|$))*)/se",
-                         "'</p><ul><li>'.str_replace(\"\\n*\",'</li><li>','$2').'</li></ul><p>'",
-                         "'$1 -' . str_replace(\"\\n*\", \"\\n -\", '$2')",
-                         "* element1\n* element2\n* element3");
-        // # unordered list
-        MiniWiki::Markup("/(^|\n)#(([^\n]*(\n|$))(#[^\n]*(\n|$))*)/se", "'<ol><li>'.str_replace(\"\\n#\",'</li><li>','$2').'</li></ol>'", "'$0'", "# element1\n# element2\n# element3");
-
-        // bold, italic and others
-        // ''' bold '''
-        MiniWiki::Markup("/'''(.*?)'''/",'<strong>$1</strong>','*$1*', "'''gras'''");
-        // '' italic ''
-        MiniWiki::Markup("/''(.*?)''/",'<em>$1</em>','/$1/', "''italique''");
-        // '+ big +'
-        MiniWiki::Markup("/'\\+(.*?)\\+'/",'<big>$1</big>','*$1*', "'+grand+'");
-        // '- small -'
-        MiniWiki::Markup("/'\\-(.*?)\\-'/",'<small>$1</small>','$1', "'-petit-'");
-        // '^superscript^'
-        MiniWiki::Markup("/'\\^(.*?)\\^'/",'<sup>$1</sup>','$1', "'^exposant^'");
-        // '_subscript_'
-        MiniWiki::Markup("/'_(.*?)_'/",'<sub>$1</sub>','$1', "'_indice_'");
-        // {+ underline +}
-        MiniWiki::Markup("/\\{\\+(.*?)\\+\\}/",'<ins>$1</ins>','_$1_', "{+insertion+}");
-        // {- strikeout -}
-        MiniWiki::Markup("/\\{-(.*?)-\\}/",'<del>$1</del>','-$1-', "{-suppression-}");
-        // {color| colored text |}
-        MiniWiki::Markup("/%([a-z]+|\#[0-9a-f]{3,6})%(.*?)%%/i", "<span style='color: $1;'>$2</span>", "$2",
-                         "%red% texte en rouge %%\\\\\n%#ff0% texte en jaune %%\\\\\n%#0000ff% texte en bleu %%");
-        // [+ big +] [++ bigger ++] [+++ even bigger +++] ...
-        MiniWiki::Markup("/\\[(([-+])+)(.*?)\\1\\]/e","'<span style=\'font-size:'.(round(pow(6/5,$2mb_strlen('$1'))*100,0)).'%\'>$3</span>'", "'$3'", "[+ grand +]\n\n[++ plus grand ++]\n\n[+++ encore plus grand +++]");
-
-        // ----- <hr/>
-        MiniWiki::Markup("/(\n|^)--(--+| \n)/s", '$1<hr/>', '$1-- '."\n", "----\n");
-        // titles
-        MiniWiki::$title_index = MiniWiki::Markup('/(\n|^)(!+)([^\n]*)/se',
-                                                  "'$1<h'.mb_strlen('$2').'>$3</h'.mb_strlen('$2').'>'",
-                                                  "'$1$3'", "!titre1\n\n!!titre2\n\n!!!titre3");
-
-        // links
-        MiniWiki::Markup('/((?:https?|ftp):\/\/(?:[\.\,\;\!\:]*[\w@~%$£µ&i#\-+=_\/\?])*)/ui',
-                         '<a href="\\0">\\0</a>', '<\\0>');
-        MiniWiki::Markup('/(\s|^|\[\[)www\.((?:[\.\,\;\!\:]*[\w@~%$£µ&i#\-+=_\/\?])*)/iu',
-                         '\\1<a href="http://www.\\2">www.\\2</a>', '\\1<http://www.\\2>');
-        MiniWiki::Markup('/(?:mailto:)?([a-z0-9.\-+_]+@([\-.+_]?[a-z0-9])+)/i', '<a href="mailto:\\0">\\0</a>', '<\\0>');
-        MiniWiki::Markup('/\[\[\s*<(?:a href=")?([^">]*?)(?:">.*?<\/a)?>\s*\|([^\]]+)\]\]/i',
-                         '<a href="\\1">\\2</a>', '\\2 <\\1>',
-                         "[[http://www.example.com|Mon site web]]\n\nhttp://www.example.com\n\ntest@example.com");
-
-        // paragraphs and empty lines
-        MiniWiki::Markup("/\n\n/", '</p><p>', "\n\n", "paragraphe1\n\nparagraphe2");
-        MiniWiki::Markup("/\n/", ' ', "\n");
-        MiniWiki::Markup("/^.*<\/p>.*<p>.*$/s", "<p>$0</p>", "$0");
-
-        // french typo rules, unbreakable spaces
-        MiniWiki::Markup("/ +([!?:;])/", "&nbsp;$1", "$0");
-    }
-
-    public static function WikiToHTML($wiki, $title = false)
-    {
-        if (!$title) {
-            $oldrule12 = MiniWiki::$replacementHTML[MiniWiki::$title_index];
-            MiniWiki::$replacementHTML[MiniWiki::$title_index] = "'$0'";
-        }
-        $html = preg_replace(MiniWiki::$patternsWiki,
-                             MiniWiki::$replacementHTML,
-                             htmlentities(trim($wiki), ENT_COMPAT, 'UTF-8'));
-        if (!$title) {
-            MiniWiki::$replacementHTML[MiniWiki::$title_index] = $oldrule12;
-        }
-        return $html;
-    }
-
-    private static function justify($text, $n)
-    {
-        $arr = explode("\n", wordwrap($text, $n));
-        $arr = array_map('trim', $arr);
-        $res = '';
-        foreach ($arr as $key => $line) {
-            $nxl       = isset($arr[$key+1]) ? trim($arr[$key+1]) : '';
-            $nxl_split = preg_split('! +!u', $nxl);
-            $nxw_len   = count($nxl_split) ? mb_strlen($nxl_split[0]) : 0;
-            $line      = trim($line);
-
-            if (mb_strlen($line)+1+$nxw_len < $n) {
-                $res .= "$line\n";
-                continue;
-            }
-
-            if (preg_match('![.:;]$!u',$line)) {
-                $res .= "$line\n";
-                continue;
-            }
-
-            $tmp   = preg_split('! +!u', trim($line));
-            $words = count($tmp);
-            if ($words <= 1) {
-                $res .= "$line\n";
-                continue;
-            }
-
-            $len   = array_sum(array_map('mb_strlen', $tmp));
-            $empty = $n - $len;
-            $sw    = floatval($empty) / floatval($words-1);
-
-            $cur = 0;
-            $l   = '';
-            foreach ($tmp as $word) {
-                $l   .= $word;
-                $cur += $sw + strlen($word); // Use strlen here instead of mb_strlen because it is used by str_pad
-                                             // which is not multibyte compatible
-                $l   = str_pad($l, intval($cur + 0.5));
-            }
-            $res .= trim($l)."\n";
-        }
-        return trim($res);
-    }
-
-
-    public static function WikiToText($wiki, $just=false, $indent=0, $width=68, $title=false)
-    {
-        if (!$title) {
-            $oldrule12 = MiniWiki::$replacementHTML[MiniWiki::$title_index];
-            MiniWiki::$replacementHTML[MiniWiki::$title_index] = "'$0'";
-        }
-        //$text = trim($wiki);
-        //foreach (MiniWiki::$patternsWiki as $key=>$pattern) {
-        //    echo $key . " -  " . $pattern . "\n";
-        //    $text = preg_replace($pattern, MiniWiki::$replacementText[$key], $text);
-        //}
-        $text = preg_replace(MiniWiki::$patternsWiki, MiniWiki::$replacementText, trim($wiki));
-        if (!$title) {
-            MiniWiki::$replacementHTML[MiniWiki::$title_index] = $oldrule12;
-        }
-        $text = $just ? MiniWiki::justify($text, $width - $indent) :  wordwrap($text, $width - $indent);
-        if($indent) {
-            $ind = str_pad('',$indent);
-            $text = $ind.str_replace("\n","\n$ind",$text);
-        }
-        return $text;
-    }
-
-    static public function help($with_title = false)
-    {
-        if (!$with_title) {
-            $info12 = MiniWiki::$info[MiniWiki::$title_index];
-            unset(MiniWiki::$info[MiniWiki::$title_index]);
-        }
-
-        $res = array();
-        foreach (MiniWiki::$info as $value) {
-            $res[$value] = MiniWiki::wikiToHtml($value, true);
-        }
-
-        if (!$with_title) {
-            MiniWiki::$info[MiniWiki::$title_index] = $info12;
-        }
-        return $res;
-    }
-}
-
-MiniWiki::init();
-
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
-?>
diff --git a/core/classes/mmlist.php b/core/classes/mmlist.php
deleted file mode 100644 (file)
index a16b1c6..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-<?php
-/***************************************************************************
- *  Copyright (C) 2003-2008 Polytechnique.org                              *
- *  http://opensource.polytechnique.org/                                   *
- *                                                                         *
- *  This program is free software; you can redistribute it and/or modify   *
- *  it under the terms of the GNU General Public License as published by   *
- *  the Free Software Foundation; either version 2 of the License, or      *
- *  (at your option) any later version.                                    *
- *                                                                         *
- *  This program is distributed in the hope that it will be useful,        *
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of         *
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
- *  GNU General Public License for more details.                           *
- *                                                                         *
- *  You should have received a copy of the GNU General Public License      *
- *  along with this program; if not, write to the Free Software            *
- *  Foundation, Inc.,                                                      *
- *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
- ***************************************************************************/
-
-class MMList extends XmlrpcClient
-{
-    public function __construct($uid, $pass, $fqdn = null)
-    {
-        global $globals;
-
-        $dom = is_null($fqdn) ? $globals->mail->domain : $fqdn;
-        $url = "http://$uid:$pass@{$globals->lists->rpchost}:{$globals->lists->rpcport}/$dom";
-        parent::__construct($url);
-        if ($globals->debug & DEBUG_BT) {
-            $this->bt = new PlBacktrace('MMList');
-        }
-    }
-}
-
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
-?>
diff --git a/core/classes/platal.php b/core/classes/platal.php
deleted file mode 100644 (file)
index 2a69b72..0000000
+++ /dev/null
@@ -1,354 +0,0 @@
-<?php
-/***************************************************************************
- *  Copyright (C) 2003-2008 Polytechnique.org                              *
- *  http://opensource.polytechnique.org/                                   *
- *                                                                         *
- *  This program is free software; you can redistribute it and/or modify   *
- *  it under the terms of the GNU General Public License as published by   *
- *  the Free Software Foundation; either version 2 of the License, or      *
- *  (at your option) any later version.                                    *
- *                                                                         *
- *  This program is distributed in the hope that it will be useful,        *
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of         *
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
- *  GNU General Public License for more details.                           *
- *                                                                         *
- *  You should have received a copy of the GNU General Public License      *
- *  along with this program; if not, write to the Free Software            *
- *  Foundation, Inc.,                                                      *
- *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
- ***************************************************************************/
-
-define('PL_DO_AUTH',   300);
-define('PL_FORBIDDEN', 403);
-define('PL_NOT_FOUND', 404);
-
-class Platal
-{
-    private $__mods;
-    private $__hooks;
-
-    protected $https;
-
-    public $ns;
-    public $path;
-    public $argv;
-
-    static private $_page = null;
-
-    public function __construct()
-    {
-        global $platal, $session, $globals;
-        $platal  =& $this;
-        $globalclass = PL_GLOBALS_CLASS;
-        $globals = new $globalclass();
-        $sessionclass = PL_SESSION_CLASS;
-        $session = new $sessionclass();
-        if (!$session->startAvailableAuth()) {
-            Platal::page()->trigError('Données d\'authentification invalide.');
-        }
-
-        $modules    = func_get_args();
-        if (is_array($modules[0])) {
-            $modules = $modules[0];
-        }
-        $this->path = trim(Get::_get('n', null), '/');
-
-        $this->__mods  = array();
-        $this->__hooks = array();
-
-        array_unshift($modules, 'core');
-        foreach ($modules as $module) {
-            $module = strtolower($module);
-            $this->__mods[$module] = $m = PLModule::factory($module);
-            $this->__hooks += $m->handlers();
-        }
-
-        if ($globals->mode == '') {
-            pl_redirect('index.html');
-        }
-    }
-
-    public function pl_self($n = null)
-    {
-        if (is_null($n))
-            return $this->path;
-
-        if ($n >= 0)
-            return join('/', array_slice($this->argv, 0, $n + 1));
-
-        if ($n <= -count($this->argv))
-            return $this->argv[0];
-
-        return join('/', array_slice($this->argv, 0, $n));
-    }
-
-    protected function find_hook()
-    {
-        $p = $this->path;
-
-        while ($p) {
-            if (array_key_exists($p, $this->__hooks))
-                break;
-
-            $p = substr($p, 0, strrpos($p, '/'));
-        }
-
-        if (empty($this->__hooks[$p])) {
-            return null;
-        }
-
-        $hook = $this->__hooks[$p];
-
-        if (!is_callable($hook['hook'])) {
-            return null;
-        }
-
-        $this->https = ($hook['type'] & NO_HTTPS) ? false : true;
-        $this->argv    = explode('/', substr($this->path, strlen($p)));
-        $this->argv[0] = $p;
-
-        return $hook;
-    }
-
-    protected function find_nearest_key($key, array &$array)
-    {
-        $keys    = array_keys($array);
-        if (in_array($key, $keys)) {
-            return $key;
-        }
-
-        if (($pos = strpos($key, '.php')) !== false) {
-            $key = substr($key, 0, $pos);
-        }
-
-        $has_end = in_array("#final#", $keys);
-        if (strlen($key) > 24 && $has_end) {
-            return "#final#";
-        }
-
-        foreach ($keys as $k) {
-            if ($k == "#final#") {
-                continue;
-            }
-            $lev = levenshtein($key, $k);
-
-            if ((!isset($val) || $lev < $val)
-                && ($lev <= strlen($k)/2 || strpos($k, $key) !== false || strpos($key, $k) !== false)) {
-                $val  = $lev;
-                $best = $k;
-            }
-        }
-        if (!isset($best) && $has_end) {
-            return "#final#";
-        } else if (isset($best)) {
-            return $best;
-        }
-        return null;
-    }
-
-    public function near_hook()
-    {
-        $hooks = array();
-        $leafs = array();
-        foreach ($this->__hooks as $hook=>$handler) {
-            if (!$this->check_perms($handler['perms'])) {
-                continue;
-            }
-            $parts = split('/', $hook);
-            $place =& $hooks;
-            foreach ($parts as $part) {
-                if (!isset($place[$part])) {
-                    $place[$part] = array();
-                }
-                $place =& $place[$part];
-            }
-            $leaf = $parts[count($parts)-1];
-            if (!isset($leafs[$leaf])) {
-                $leafs[$leaf] = $hook;
-            } else if (is_array($leafs[$leaf])) {
-                $leafs[$leaf][] = $hook;
-            } else {
-                $leafs[$leaf] = array($hook, $leafs[$leaf]);
-            }
-            $place["#final#"] = array();
-        }
-
-        // search for the nearest full path
-        $p = split('/', $this->path);
-        $place =& $hooks;
-        $link  = '';
-        foreach ($p as $k) {
-            if (!isset($ended)) {
-                $key = $this->find_nearest_key($k, $place);
-            } else {
-                $key = $k;
-            }
-            if ($key == "#final#") {
-                if (!array_key_exists($link, $this->__hooks)) {
-                    $link = '';
-                    break;
-                }
-                $key = $k;
-                $ended = true;
-            }
-            if (!is_null($key)) {
-                if (!empty($link)) {
-                    $link .= '/';
-                }
-                $link .= $key;
-                $place =& $place[$key];
-            } else {
-                $link = '';
-                break;
-            }
-        }
-        if ($link == $this->path) {
-            $link = '';
-        }
-        if ($link && levenshtein($link, $this->path) < strlen($link)/3) {
-            return $link;
-        }
-
-        // search for missing namespace (the given name is a leaf)
-        $leaf = array_shift($p);
-        $args = count($p) ? '/' . implode('/', $p) : '';
-        if (isset($leafs[$leaf]) && !is_array($leafs[$leaf]) && $leafs[$leaf] != $this->path) {
-            return $leafs[$leaf] . $args;
-        }
-        unset($val);
-        $best = null;
-        foreach ($leafs as $k=>&$path) {
-            if (is_array($path)) {
-                continue;
-            }
-            $lev = levenshtein($leaf, $k);
-
-            if ((!isset($val) || $lev < $val)
-                && ($lev <= strlen($k)/2 || strpos($k, $leaf) !== false || strpos($leaf, $k) !== false)) {
-                $val  = $lev;
-                $best = $path;
-            }
-        }
-        return $best == null ? ( $link ? $link : null ) : $best . $args;
-    }
-
-    protected function check_perms($perms)
-    {
-        if (!$perms) { // No perms, no check
-            return true;
-        }
-        $s_perms = S::v('perms');
-        return $s_perms->hasFlagCombination($perms);
-    }
-
-    private function call_hook(PlPage &$page)
-    {
-        $hook = $this->find_hook();
-        if (empty($hook)) {
-            return PL_NOT_FOUND;
-        }
-        global $globals, $session;
-        if ($this->https && !$_SERVER['HTTPS'] && $globals->core->secure_domain) {
-            http_redirect('https://' . $globals->core->secure_domain . $_SERVER['REQUEST_URI']);
-        }
-
-        $args    =  $this->argv;
-        $args[0] =& $page;
-
-        if ($hook['auth'] > S::v('auth', AUTH_PUBLIC)) {
-            if ($hook['type'] & DO_AUTH) {
-                if (!$session->start($hook['auth'])) {
-                    $this->force_login($page);
-                }
-            } else {
-                return PL_FORBIDDEN;
-            }
-        }
-        if ($hook['auth'] != AUTH_PUBLIC && !$this->check_perms($hook['perms'])) {
-            return PL_FORBIDDEN;
-        }
-
-        $val = call_user_func_array($hook['hook'], $args);
-        if ($val == PL_DO_AUTH) {
-            // The handler need a better auth with the current args
-            if (!$session->start($hook['auth'])) {
-                $this->force_login($page);
-            }
-            $val = call_user_func_array($hook['hook'], $args);
-        }
-        return $val;
-    }
-
-    public function force_login(PlPage &$page)
-    {
-        header($_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden');
-        if (S::logged()) {
-            $page->changeTpl('core/password_prompt_logged.tpl');
-            $page->addJsLink('do_challenge_response_logged.js');
-        } else {
-            $page->changeTpl('core/password_prompt.tpl');
-            $page->addJsLink('do_challenge_response.js');
-        }
-        $page->assign('platal', $this);
-        $page->run();
-    }
-
-    public function run()
-    {
-        $page =& self::page();
-
-        if (empty($this->path)) {
-            $this->path = 'index';
-        }
-
-        $page->assign('platal', $this);
-        switch ($this->call_hook($page)) {
-          case PL_FORBIDDEN:
-            $this->__mods['core']->handler_403($page);
-            break;
-
-          case PL_NOT_FOUND:
-            $this->__mods['core']->handler_404($page);
-            break;
-        }
-
-        $page->assign('platal', $this);
-        $page->run();
-    }
-
-    public function on_subscribe($forlife, $uid, $promo, $pass)
-    {
-        $args = func_get_args();
-        foreach ($this->__mods as $mod) {
-            if (!is_callable($mod, 'on_subscribe'))
-                continue;
-            call_user_func_array(array($mod, 'on_subscribe'), $args);
-        }
-    }
-
-    static public function &page()
-    {
-        global $platal;
-        if (is_null(self::$_page)) {
-            $pageclass = PL_PAGE_CLASS;
-            self::$_page = new $pageclass();
-        }
-        return self::$_page;
-    }
-
-    static public function &session()
-    {
-        global $session;
-        return $session;
-    }
-
-    static public function &globals()
-    {
-        global $globals;
-        return $globals;
-    }
-}
-
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
-?>
diff --git a/core/classes/plbacktrace.php b/core/classes/plbacktrace.php
deleted file mode 100644 (file)
index 9fb80ec..0000000
+++ /dev/null
@@ -1,116 +0,0 @@
-<?php
-/***************************************************************************
- *  Copyright (C) 2003-2008 Polytechnique.org                              *
- *  http://opensource.polytechnique.org/                                   *
- *                                                                         *
- *  This program is free software; you can redistribute it and/or modify   *
- *  it under the terms of the GNU General Public License as published by   *
- *  the Free Software Foundation; either version 2 of the License, or      *
- *  (at your option) any later version.                                    *
- *                                                                         *
- *  This program is distributed in the hope that it will be useful,        *
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of         *
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
- *  GNU General Public License for more details.                           *
- *                                                                         *
- *  You should have received a copy of the GNU General Public License      *
- *  along with this program; if not, write to the Free Software            *
- *  Foundation, Inc.,                                                      *
- *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
- ***************************************************************************/
-
-/** Ligth debugging tool to generate execution backtrace
- */
-class PlBacktrace
-{
-    static public $bt = array();
-
-    public $traces    = array();
-    public $totaltime = 0.0;
-    public $error     = false;
-
-    function __construct($name, array $init = array(), $sizef = 'rows', $timef = 'exectime', $errorf = 'error')
-    {
-        PlBacktrace::$bt[$name] = $this;
-        foreach ($init as &$entry) {
-            $this->add($entry, $sizef, $timef, $errorf);
-        }
-    }
-
-    private function fixCharset($action)
-    {
-        if (!is_string($action)) {
-            return $action;
-        } else {
-            return is_utf8($action) ? $action : utf8_encode($action);
-        }
-    }
-
-    private function add(array &$entry, $sizef = 'rows', $timef = 'exectime', $errorf = 'error')
-    {
-        $trace = array();
-        $trace['action'] = $this->fixCharset($entry['action']);
-        unset($entry['action']);
-        $trace['exectime'] = @$entry[$timef];
-        $this->totaltime += $trace['exectime'];
-        unset($entry[$timef]);
-        $trace['rows'] = @$entry[$sizef];
-        unset($entry[$sizef]);
-        $trace['error'] = $this->fixCharset(@$entry[$errorf]);
-        unset($entry[$errorf]);
-        if ($trace['error']) {
-            $this->error = true;
-        }
-        $trace['data'] = array($this->fixCharset($entry));
-        $this->traces[] =& $trace;
-    }
-
-    public function newEvent($action, $rows = 0, $error = null, array $userdata = array())
-    {
-        $trace = array('action' => $this->fixCharset($action), 'time' => 0);
-        $this->traces[] =& $trace;
-        $this->update($rows, $error, $userdata);
-    }
-
-    public function start($action)
-    {
-        $this->traces[] =  array('action' => $this->fixCharset($action), 'starttime' => microtime(true));;
-    }
-
-    public function stop($rows = 0, $error = null, array $userdata = array())
-    {
-        $time = microtime(true);
-        if (!$this->traces) {
-            return;
-        }
-        $trace =& $this->traces[count($this->traces) - 1];
-        $trace['exectime'] = $time - $trace['starttime'];
-        unset($trace['starttime']);
-        $this->totaltime += $trace['exectime'];
-        $this->update($rows, $error, $userdata);
-    }
-
-    public function update($rows = 0, $error = null, array $userdata = array())
-    {
-        $trace =& $this->traces[count($this->traces) - 1];
-        $trace['rows']  = $rows;
-        $trace['error'] = $this->fixCharset($error);
-        array_walk_recursive($userdata, array($this, 'fixCharset'));
-        $trace['data']  = $userdata;
-        if ($trace['error']) {
-            $this->error = true;
-        }
-    }
-
-    public static function clean()
-    {
-        foreach (PlBacktrace::$bt as $name=>&$entry) {
-            if (!$entry->traces) {
-                unset(PlBacktrace::$bt[$name]);
-            }
-        }
-    }
-}
-
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
-?>
diff --git a/core/classes/plflagset.php b/core/classes/plflagset.php
deleted file mode 100644 (file)
index 1971751..0000000
+++ /dev/null
@@ -1,123 +0,0 @@
-<?php
-/*
- * Copyright (C) 2003-2008 Polytechnique.org
- * http://opensource.polytechnique.org/
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-
-/** class for describing flags
- */
-class PlFlagSet
-{
-    /** string that holds the PlFlagSet */
-    private $values = array();
-
-    /** the boundary between flags */
-    private $sep;
-
-
-    /** set flag
-     * @param $flags services FROM coupures
-     * @return VOID
-     */
-    public function __construct($flags = '', $sep = ',')
-    {
-        $this->sep = $sep;
-        $splitted = explode($sep, $flags);
-        foreach ($splitted as $part) {
-            $this->values[$part] = true;
-        }
-    }
-
-
-    /** add flag
-     * @param $flag XXX
-     * @return VOID
-     */
-    public function addFlag($flag)
-    {
-        if (empty($flag)) {
-            return;
-        }
-        $this->values[$flag] = true;
-    }
-
-
-    /** test si flag ou pas
-     * @param $flag XXX
-     * @return 1 || 0
-     */
-    public function hasFlag($flag)
-    {
-        return !empty($flag) && isset($this->values[$flag]) && $this->values[$flag];
-    }
-
-    /** test flag combination
-     */
-    public function hasFlagCombination($flag)
-    {
-        $perms = explode(',', $flag);
-        foreach ($perms as $perm)
-        {
-            $ok = true;
-            $rights = explode(':', $perm);
-            foreach ($rights as $right) {
-                if (($right{0} == '!' && $this->hasFlag(substr($right, 1))) || !$this->hasFlag($right)) {
-                    $ok = false;
-                }
-            }
-            if ($ok) {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    /** remove flag
-     * @param $flag XXX
-     * @return VOID
-     */
-    public function rmFlag($flag)
-    {
-        if (empty($flag)) {
-            return;
-        }
-        if (isset($this->values[$flag])) {
-            unset($this->values[$flag]);
-        }
-    }
-
-
-    /** return the PlFlagSet
-     */
-    public function flags()
-    {
-        $flags = '';
-        foreach ($this->values as $key=>$value) {
-            if (!empty($flags)) {
-                $flags .= $this->sep;
-            }
-            if ($value) {
-                $flags .= $key;
-            }
-        }
-        return $flags;
-    }
-}
-
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
-?>
diff --git a/core/classes/plglobals.php b/core/classes/plglobals.php
deleted file mode 100644 (file)
index 2636890..0000000
+++ /dev/null
@@ -1,243 +0,0 @@
-<?php
-/***************************************************************************
- *  Copyright (C) 2003-2008 Polytechnique.org                              *
- *  http://opensource.polytechnique.org/                                   *
- *                                                                         *
- *  This program is free software; you can redistribute it and/or modify   *
- *  it under the terms of the GNU General Public License as published by   *
- *  the Free Software Foundation; either version 2 of the License, or      *
- *  (at your option) any later version.                                    *
- *                                                                         *
- *  This program is distributed in the hope that it will be useful,        *
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of         *
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
- *  GNU General Public License for more details.                           *
- *                                                                         *
- *  You should have received a copy of the GNU General Public License      *
- *  along with this program; if not, write to the Free Software            *
- *  Foundation, Inc.,                                                      *
- *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
- ***************************************************************************/
-/** Debug levels:
- * DEBUG_BT     = show the backtraces (SQL/XMLRPC/...)
- * DEBUG_VALID  = run html validation
- * DEBUG_SMARTY = don't hide smarty errors/warnings/notices
- */
-define('DEBUG_BT', 1);
-define('DEBUG_VALID', 2);
-define('DEBUG_SMARTY', 4);
-
-/** PlGlobals provides functions to read a set of configuration files and gives
- * access to this configurations.
- *
- * The configuration files ares ini files with sections:
- * <pre>
- * [SectionName]
- * fieldname = value
- * </pre>
- *
- * With this configuration file, you'll be able to access 'value' via
- * $globals->sectionname->fieldname. Let say 'sectionname' is a namespace
- *
- *
- * You should derivate this class into a local Globals class. In this class
- * you can specify configuration variables that belongs to the 'global' namespace
- * (accessible via $global->fieldname). To do so, just define the fieldname
- * in your class and set its value in the [Core] section of you ini file.
- */
-class PlGlobals
-{
-    public $coreVersion = '0.9.17';
-
-    /** Debug level.
-     * This is a combination of the DEBUG_ flags. As soon as at least
-     * one flag is set, the debug mode is activated, this means:
-     *   - debug panel on the top of the pages
-     *   - don't hide php notices
-     *   - recompile templates when they have been changed
-     */
-    public $debug   = 0;
-
-    /** Access mode.
-     */
-    public $mode    = 'rw';    // 'rw' => read/write,
-                               // 'r'  => read/only
-                               // ''   => site down
-
-    /** BaseURL of the site.
-     * This is read from the HTTP headers if available but you MUST give a
-     * default value for this field in you configuration file (because, this
-     * can be used in CLI scripts that has no access no HTTP headers...)
-     *
-     * [Core]
-     * baseurl = "https//www.mysite.org/"
-     */
-    public $baseurl;
-
-    /** In case your base url is https-based, this provied an HTTP-based value
-     * for the URL.
-     */
-    public $baseurl_http;
-
-    /** paths */
-    public $spoolroot;
-
-    /** Localization configuration.
-     */
-    public $locale;
-    public $timezone;
-
-    /** You must give a list of file to load.
-     * The filenames given are relatives to the config path of your plat/al installation.
-     */
-    public function __construct(array $files)
-    {
-        $this->spoolroot = dirname(dirname(dirname(__FILE__)));
-
-        $this->readConfig($files);
-        if (isset($_SERVER) && isset($_SERVER['SERVER_NAME'])) {
-            $base = empty($_SERVER['HTTPS']) ? 'http://' : 'https://';
-            $this->baseurl      = @trim($base    .$_SERVER['SERVER_NAME'].dirname($_SERVER['PHP_SELF']), '/');
-            $this->baseurl_http = @trim('http://'.$_SERVER['SERVER_NAME'].dirname($_SERVER['PHP_SELF']), '/');
-        }
-
-        $this->setLocale();
-    }
-
-    private function readIniFile($filename)
-    {
-        $array = parse_ini_file($filename, true);
-        if (!is_array($array)) {
-            return;
-        }
-        foreach ($array as $cat => $conf) {
-            $c = strtolower($cat);
-            foreach ($conf as $k => $v) {
-                if ($c == 'core' && property_exists($this, $k)) {
-                    $this->$k=$v;
-                } else {
-                    if (!isset($this->$c)) {
-                        $this->$c = new stdClass;
-                    }
-                    $this->$c->$k = $v;
-                }
-            }
-        }
-    }
-
-    private function readConfig(array $files)
-    {
-        foreach ($files as $file) {
-            $this->readIniFile($this->spoolroot . '/configs/' . $file);
-        }
-        if (file_exists($this->spoolroot.'/spool/conf/platal.dynamic.conf')) {
-            $this->readIniFile($this->spoolroot.'/spool/conf/platal.dynamic.conf');
-        }
-    }
-
-    /** Writes an ini file separated in categories
-     * @param filename the name of the file to write (overwrite existing)
-     * @param categories an array of categories (array of keys and values)
-     */
-    private function writeIniFile($filename, &$categories)
-    {
-        // [category]
-        // key = value
-        $f = fopen($filename, 'w');
-        foreach ($categories as $cat => $conf) {
-            fwrite($f, '; {{{ '.$cat."\n\n");
-            fwrite($f, '['.$cat.']'."\n\n");
-            foreach ($conf as $k => $v) {
-                fwrite($f, $k.' = "'.str_replace('"','\\"',$v).'"'."\n");
-            }
-            fwrite($f, "\n".'; }}}'."\n");
-        }
-        fwrite($f, '; vim:set syntax=dosini foldmethod=marker:'."\n");
-        fclose($f);
-    }
-
-    /** Change dynamic config file
-     * @param conf array of keys and values to add or replace
-     * @param category name of category to change
-     * 
-     * Opens the dynamic conf file and set values from conf in specified
-     * category. Updates config vars too.
-     */ 
-    public function changeDynamicConfig($conf, $category = 'Core')
-    {
-        $dynamicfile = $this->spoolroot.'/spool/conf/platal.dynamic.conf';
-        if (file_exists($dynamicfile)) {
-            $array = parse_ini_file($dynamicfile, true);
-        } else {
-            $array = null;
-        }
-        if (!is_array($array)) {
-            // dynamic conf is empty
-            $array = array($category => $conf);
-        } else {
-            // looks for a category that looks the same (case insensitive)
-            $same = false;
-            foreach ($array as $m => &$c) {
-                if (strtolower($m) == strtolower($category)) {
-                    $same = $m;
-                    break;
-                }
-            }
-            if (!$same) {
-                // this category doesn't exist yet
-                $array[$category] = $conf;
-            } else {
-                // this category already exists
-                $conflower = array();
-                foreach ($conf as $k => $v) {
-                    $conflower[strtolower($k)] = $v;
-                }
-                // $conflower is now same as $conf but with lower case keys
-                // replaces values of keys that already exists
-                foreach ($array[$same] as $k => $v) {
-                    if (isset($conflower[strtolower($k)])) {
-                        $array[$same][$k] = $conflower[strtolower($k)];
-                        unset($conflower[strtolower($k)]);
-                    }
-                }
-                // add new keys
-                foreach ($conf as $k => $v) {
-                    if (isset($conflower[strtolower($k)])) {
-                        $array[$same][$k] = $v;
-                    }
-                } 
-            }
-        }
-        // writes the file over
-        $this->writeIniFile($dynamicfile, $array);
-        // rereads the new config to correctly set vars
-        $this->readIniFile($dynamicfile);
-    }
-
-    public function bootstrap($conf, $callback, $category = 'Core')
-    {
-        $bootstrap = false;
-        $category = strtolower($category);
-        foreach ($conf as $key) {
-            if (!isset($this->$category->$key)) {
-                $bootstrap = true;
-                break;
-            }
-        }
-        if ($bootstrap) {
-            call_user_func($callback);
-        }
-    }
-
-    private function setLocale()
-    {
-        setlocale(LC_MESSAGES, $this->locale);
-        setlocale(LC_TIME,     $this->locale);
-        setlocale(LC_CTYPE,    $this->locale);
-        date_default_timezone_set($this->timezone);
-        mb_internal_encoding("UTF-8");
-    }
-}
-
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
-?>
diff --git a/core/classes/pliterator.php b/core/classes/pliterator.php
deleted file mode 100644 (file)
index 0b5f254..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-<?php
-/***************************************************************************
- *  Copyright (C) 2003-2008 Polytechnique.org                              *
- *  http://opensource.polytechnique.org/                                   *
- *                                                                         *
- *  This program is free software; you can redistribute it and/or modify   *
- *  it under the terms of the GNU General Public License as published by   *
- *  the Free Software Foundation; either version 2 of the License, or      *
- *  (at your option) any later version.                                    *
- *                                                                         *
- *  This program is distributed in the hope that it will be useful,        *
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of         *
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
- *  GNU General Public License for more details.                           *
- *                                                                         *
- *  You should have received a copy of the GNU General Public License      *
- *  along with this program; if not, write to the Free Software            *
- *  Foundation, Inc.,                                                      *
- *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
- ***************************************************************************/
-
-interface PlIterator
-{
-    public function next();
-    public function total();
-    public function first();
-    public function last();
-}
-
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
-?>
diff --git a/core/classes/pllogger.php b/core/classes/pllogger.php
deleted file mode 100644 (file)
index 0381926..0000000
+++ /dev/null
@@ -1,114 +0,0 @@
-<?php
-/*
- * Copyright (C) 2003-2004 Polytechnique.org
- * http://opensource.polytechnique.org/
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-
-class PlLogger
-{
-    /** user id */
-    public $uid;
-    /** id of the session */
-    private $session;
-    /** list of available actions */
-    private $actions;
-
-    public $ip;
-    public $host;
-    public $proxy_ip;
-    public $proxy_host;
-
-    /** The constructor, creates a new entry in the sessions table
-     *
-     * @param $uid the id of the logged user
-     * @param $suid the id of the administrator who has just su'd to the user
-     * @return VOID
-     */
-    public function __construct($uid, $suid = 0)
-    {
-        // write the session entry
-        $this->uid     = $uid;
-        $this->session = $this->writeSession($uid, $suid);
-
-        // retrieve available actions
-        $res = XDB::iterRow("SELECT id, text FROM logger.actions");
-
-        while (list($action_id, $action_text) = $res->next()) {
-            $this->actions[$action_text] = $action_id;
-        }
-    }
-
-    /** Creates a new session entry in database and return its ID.
-     *
-     * @param $uid the id of the logged user
-     * @param $suid the id of the administrator who has just su'd to the user
-     * @return session the session id
-     */
-    private function writeSession($uid, $suid = 0)
-    {
-        $ip      = $_SERVER['REMOTE_ADDR'];
-        $host    = strtolower(gethostbyaddr($_SERVER['REMOTE_ADDR']));
-        $browser = (isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '');
-
-        @list($forward_ip,) = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']);
-        $forward_host = $forward_ip;
-        if ($forward_host) {
-            $forward_host = strtolower(gethostbyaddr($forward_host));
-        }
-        $proxy = '';
-        if ($forward_ip || @$_SERVER['HTTP_VIA']) {
-            $proxy = 'proxy';
-        }
-
-        XDB::execute("INSERT INTO logger.sessions
-                         SET uid={?}, host={?}, ip={?}, forward_ip={?}, forward_host={?}, browser={?}, suid={?}, flags={?}",
-                     $uid, $host, ip_to_uint($ip), ip_to_uint($forward_ip), $forward_host, $browser, $suid, $proxy);
-        if ($forward_ip) {
-            $this->proxy_ip = $ip;
-            $this->proxy_host = $host;
-            $this->ip = $forward_ip;
-            $this->host = $forward_host;
-        } else {
-            $this->ip = $ip;
-            $this->host = $host;
-        }
-
-        return XDB::insertId();
-    }
-
-
-    /** Logs an action and its related data.
-     *
-     * @param $action le type d'action
-     * @param $data les données (id de liste, etc.)
-     * @return VOID
-     */
-    public function log($action, $data = null)
-    {
-        if (isset($this->actions[$action])) {
-            XDB::execute("INSERT INTO logger.events
-                             SET session={?}, action={?}, data={?}",
-                         $this->session, $this->actions[$action], $data);
-        } else {
-            trigger_error("PlLogger: unknown action, $action", E_USER_WARNING);
-        }
-    }
-}
-
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
-?>
diff --git a/core/classes/plmailer.php b/core/classes/plmailer.php
deleted file mode 100644 (file)
index 2106d50..0000000
+++ /dev/null
@@ -1,336 +0,0 @@
-<?php
-/***************************************************************************
- *  Copyright (C) 2003-2008 Polytechnique.org                              *
- *  http://opensource.polytechnique.org/                                   *
- *                                                                         *
- *  This program is free software; you can redistribute it and/or modify   *
- *  it under the terms of the GNU General Public License as published by   *
- *  the Free Software Foundation; either version 2 of the License, or      *
- *  (at your option) any later version.                                    *
- *                                                                         *
- *  This program is distributed in the hope that it will be useful,        *
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of         *
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
- *  GNU General Public License for more details.                           *
- *                                                                         *
- *  You should have received a copy of the GNU General Public License      *
- *  along with this program; if not, write to the Free Software            *
- *  Foundation, Inc.,                                                      *
- *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
- ***************************************************************************/
-
-require_once('smarty/libs/Smarty.class.php');
-
-/** Classe de mail avec corps en templates.
- */
-class PlMail extends Smarty
-{
-    private $tpl;
-    private $mailer = null;
-
-    function __construct($tpl)
-    {
-        global $globals;
-        $this->tpl           = $tpl;
-        $this->caching       = false;
-        $this->compile_check = true;
-
-        $this->template_dir  = $globals->spoolroot . "/templates/";
-        $this->compile_dir   = $globals->spoolroot . "/spool/mails_c/";
-        $this->config_dir    = $globals->spoolroot . "/configs/";
-        array_unshift($this->plugins_dir, $globals->spoolroot."/plugins/");
-
-        $this->register_outputfilter(Array($this, 'mail_format'));
-        $this->register_function('from',    Array($this, 'setFrom'));
-        $this->register_function('to',      Array($this, 'addTo'));
-        $this->register_function('cc',      Array($this, 'addCc'));
-        $this->register_function('bcc',     Array($this, 'addBcc'));
-        $this->register_function('subject', Array($this, 'setSubject'));
-        $this->register_function('add_header', Array($this, 'addHeader'));
-        $this->assign_by_ref('globals', $globals);
-    }
-
-    public static function &get(&$mailer, $tpl)
-    {
-        static $plmail;
-        if (!isset($plmail) || $plmail->tpl != $tpl) {
-            $plmail = new PlMail($tpl);
-        }
-        $plmail->mailer =& $mailer;
-        return $plmail;
-    }
-
-    public function run($version)
-    {
-        $this->assign('mail_part', $version);
-        $text = $this->fetch($this->tpl);
-        if ($version == 'text') {
-            return wordwrap($text, 78);
-        }
-        return $text;
-    }
-
-    /** used to remove the empty lines due to {from ...}, {to ...} ... functions */
-    static public function mail_format($output, &$smarty)
-    {
-        return "\n".trim($output)."\n";
-    }
-
-    static protected function format_addr(&$params)
-    {
-        if (isset($params['full'])) {
-            return $params['full'];
-        } elseif (empty($params['text'])) {
-            return $params['addr'];
-        } else {
-            return $params['text'].' <'.$params['addr'].'>';
-        }
-    }
-
-    /** template function : from.
-     * {from full=...} for an already formatted address
-     * {from addr=... [text=...]} else
-     */
-    public function setFrom($params, &$smarty)
-    {
-        $smarty->mailer->setFrom(PlMail::format_addr($params));
-    }
-
-    /** template function : to.
-     * {to full=...} for an already formatted address
-     * {to addr=... [text=...]} else
-     */
-    public function addTo($params, &$smarty)
-    {
-        $smarty->mailer->addTo(PlMail::format_addr($params));
-    }
-
-    /** template function : cc.
-     * {cc full=...} for an already formatted address
-     * {cc addr=... [text=...]} else
-     */
-    public function addCc($params, &$smarty)
-    {
-        $smarty->mailer->addCc(PlMail::format_addr($params));
-    }
-
-    /** template function : bcc.
-     * {bcc full=...} for an already formatted address
-     * {bcc addr=... [text=...]} else
-     */
-    public function addBcc($params, &$smarty)
-    {
-        $smarty->mailer->addBcc(PlMail::format_addr($params));
-    }
-
-    /** template function : subject.
-     * {subject text=...}
-     */
-    public function setSubject($params, &$smarty)
-    {
-        $smarty->mailer->setSubject($params['text']);
-    }
-
-    /** template function : add_header.
-     * {add_header name=... value=...}
-     */
-    public function addHeader($params, &$smarty)
-    {
-        $smarty->mailer->addHeader($params['name'], $params['value']);
-    }
-}
-
-require_once('Mail.php');
-require_once('Mail/mime.php');
-
-/** Class for sending inline or multipart-emails.
- * Based on Diogenes' HermesMailer
- */
-class PlMailer extends Mail_Mime {
-
-    private $mail;
-    private $page    = null;
-    private $charset;
-    private $wiki    = null;
-
-    function __construct($tpl = null, $charset = "UTF-8")
-    {
-        $this->charset = $charset;
-        $this->Mail_Mime("\n");
-        $this->mail = Mail::factory('sendmail', Array('sendmail_args' => '-oi'));
-        if (!is_null($tpl)) {
-            $this->page =& PlMail::get($this, $tpl);
-        }
-    }
-
-    /**
-     * converts all : Foo Bar Baz <quux@foobar.org> into "Foo Bar Baz" <quux@foobar.org> which is RFC compliant
-     */
-    private function correct_emails($email)
-    {
-        return preg_replace('!(^|, *)([^<"]+?) *(<[^>]*>)!u', '\1"\2" \3', $email);
-    }
-
-    public function addTo($email)
-    {
-        $email = $this->correct_emails($email);
-        if (isset($this->_headers['To'])) {
-            $this->_headers['To'] .= ", $email";
-        } else {
-            $this->_headers['To'] = $email;
-        }
-    }
-
-    public function addCc($email)
-    {
-        return parent::addCc($this->correct_emails($email));
-    }
-
-    public function addBcc($email)
-    {
-        return parent::addBcc($this->correct_emails($email));
-    }
-
-    public function setFrom($email)
-    {
-        return parent::setFrom($this->correct_emails($email));
-    }
-
-    public function addHeader($hdr,$val)
-    {
-        switch($hdr) {
-            case 'From':
-                $this->setFrom($val);
-                break;
-
-            case 'To':
-                unset($this->_headers[$hdr]);
-                $this->addTo($val);
-                break;
-
-            case 'Cc':
-                unset($this->_headers[$hdr]);
-                $this->addCc($val);
-                break;
-
-            case 'Bcc':
-                unset($this->_headers[$hdr]);
-                $this->addBcc($val);
-                break;
-
-            default:
-                $this->headers(Array($hdr=>$val));
-        }
-    }
-
-    public function addUploadAttachment(PlUpload &$upload, $name)
-    {
-        $encoding = $upload->isType('text') ? 'quoted-printable' : 'base64';
-        $this->addAttachment($upload->getContents(), $upload->contentType(), $name, false, $encoding);
-    }
-
-    public function assign($var, $value)
-    {
-        if (!is_null($this->page)) {
-            $this->page->assign($var, $value);
-        }
-    }
-
-    public function assign_by_ref($var, &$value)
-    {
-        if (!is_null($this->page)) {
-            $this->page->assign_by_ref($var, $value);
-        }
-    }
-
-    public function register_modifier($var, $callback)
-    {
-        if (!is_null($this->page)) {
-            $this->page->register_modifier($var, $callback);
-        }
-    }
-
-    public function register_function($var, $callback)
-    {
-        if (!is_null($this->page)) {
-            $this->page->register_function($var, $callback);
-        }
-    }
-
-    public function setWikiBody($wiki)
-    {
-        $this->wiki = $wiki;
-    }
-
-    private function processPage($with_html = true)
-    {
-        if (!is_null($this->page)) {
-            global $globals;
-            if (!($globals->debug & DEBUG_SMARTY)) {
-                $level = error_reporting(0);
-            }
-            $this->page->run('head'); // process page headers
-            $this->wiki = trim($this->page->run('wiki')); // get wiki
-            if (!$this->wiki) {
-                $this->setTxtBody($this->page->run('text'));
-                if ($with_html) {
-                    $html = trim($this->page->run('html'));
-                    if (!empty($html)) {
-                        $this->setHtmlBody($html);
-                    }
-                }
-            }
-            if (!($globals->debug & DEBUG_SMARTY)) {
-                error_reporting($level);
-            }
-        }
-        if ($this->wiki) {
-            $this->setTxtBody(MiniWiki::WikiToText($this->wiki, false, 0, 78));
-            if ($with_html) {
-                $this->setHtmlBody('<html><body>' . MiniWiki::WikiToHtml($this->wiki, true) . '</body></html>');
-            }
-        }
-    }
-
-    public function send($with_html = true)
-    {
-        $this->processPage($with_html);
-        if (S::v('forlife')) {
-            global $globals;
-            $this->addHeader('X-Org-Mail', S::v('forlife') . '@' . $globals->mail->domain);
-        }
-        $addrs = Array();
-        foreach(Array('To', 'Cc', 'Bcc') as $hdr) {
-            if(isset($this->_headers[$hdr])) {
-                require_once 'Mail/RFC822.php';
-                $parsed = @Mail_RFC822::parseAddressList($this->_headers[$hdr]);
-                if (is_array($parsed)) {
-                    $addrs = array_merge($addrs, $parsed);
-                }
-            }
-        }
-        if(empty($addrs)) {
-            return false;
-        }
-
-        $dests = Array();
-        foreach($addrs as $a) {
-            $dests[] = "{$a->mailbox}@{$a->host}";
-        }
-
-        // very important to do it in THIS order very precisely.
-        $body = $this->get(array('text_charset' => $this->charset,
-                                 'text_encoding' => '8bit',
-                                 'html_charset' => $this->charset,
-                                 'head_charset' => $this->charset));
-        $hdrs = $this->headers();
-        if (empty($hdrs['From'])) {
-            trigger_error('Empty "From", mail not sent', E_USER_WARNING);
-            return false;
-        }
-        return $this->mail->send($dests, $hdrs, $body);
-    }
-}
-
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
-?>
diff --git a/core/classes/plmodule.php b/core/classes/plmodule.php
deleted file mode 100644 (file)
index 9d5dc9b..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-<?php
-/***************************************************************************
- *  Copyright (C) 2003-2008 Polytechnique.org                              *
- *  http://opensource.polytechnique.org/                                   *
- *                                                                         *
- *  This program is free software; you can redistribute it and/or modify   *
- *  it under the terms of the GNU General Public License as published by   *
- *  the Free Software Foundation; either version 2 of the License, or      *
- *  (at your option) any later version.                                    *
- *                                                                         *
- *  This program is distributed in the hope that it will be useful,        *
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of         *
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
- *  GNU General Public License for more details.                           *
- *                                                                         *
- *  You should have received a copy of the GNU General Public License      *
- *  along with this program; if not, write to the Free Software            *
- *  Foundation, Inc.,                                                      *
- *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
- ***************************************************************************/
-
-abstract class PLModule
-{
-    abstract function handlers();
-
-    /** Register a hook
-     * @param fun name of the handler (the exact name will be handler_$fun)
-     * @param auth authentification level of needed to run this handler
-     * @param perms permission required to run this handler
-     * @param type additionnal flags
-     *
-     * Perms syntax is the following:
-     * perms = rights(,rights)*
-     * rights = right(:right)*
-     * right is an atomic right permission (like 'admin', 'user', 'groupadmin', 'groupmember'...)
-     *
-     * If type is set to NO_AUTH, the system will return 403 instead of asking auth data
-     * this is useful for Ajax handler
-     * If type is not set to NO_SKIN, the system will consider redirecting the user to https
-     */
-    public function make_hook($fun, $auth, $perms = 'user', $type = DO_AUTH)
-    {
-        return array('hook'  => array($this, 'handler_'.$fun),
-                     'auth'  => $auth,
-                     'perms' => $perms,
-                     'type'  => $type);
-    }
-
-    /* static functions */
-
-    public static function factory($modname)
-    {
-        global $globals;
-        if ($modname == 'core') {
-            $mod_path = $globals->spoolroot  . '/core/modules/' . $modname . '.php';
-        } else {
-            $mod_path = $globals->spoolroot . '/modules/' . $modname . '.php';
-        }
-        $class    = ucfirst($modname) . 'Module';
-
-        require_once $mod_path;
-        return new $class();
-    }
-}
-
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
-?>
diff --git a/core/classes/plpage.php b/core/classes/plpage.php
deleted file mode 100644 (file)
index 5230036..0000000
+++ /dev/null
@@ -1,446 +0,0 @@
-<?php
-/***************************************************************************
- *  Copyright (C) 2003-2008 Polytechnique.org                              *
- *  http://opensource.polytechnique.org/                                   *
- *                                                                         *
- *  This program is free software; you can redistribute it and/or modify   *
- *  it under the terms of the GNU General Public License as published by   *
- *  the Free Software Foundation; either version 2 of the License, or      *
- *  (at your option) any later version.                                    *
- *                                                                         *
- *  This program is distributed in the hope that it will be useful,        *
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of         *
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
- *  GNU General Public License for more details.                           *
- *                                                                         *
- *  You should have received a copy of the GNU General Public License      *
- *  along with this program; if not, write to the Free Software            *
- *  Foundation, Inc.,                                                      *
- *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
- ***************************************************************************/
-
-require_once 'smarty/libs/Smarty.class.php';
-
-abstract class PlPage extends Smarty
-{
-    private $_page_type;
-    private $_tpl;
-    private $_errors;
-    private $_failure;
-    private $_jsonVars;
-
-    // {{{ function PlPage()
-
-    public function __construct()
-    {
-        parent::Smarty();
-
-        global $globals;
-
-        $this->caching       = false;
-        $this->config_overwrite = false;
-        $this->use_sub_dirs  = false;
-        $this->template_dir  = $globals->spoolroot . '/templates/';
-        $this->compile_dir   = $globals->spoolroot . '/spool/templates_c/';
-        array_unshift($this->plugins_dir,
-                      $globals->spoolroot . '/core/plugins/',
-                      $globals->spoolroot . '/plugins/');
-        $this->config_dir    = $globals->spoolroot . '/configs/';
-
-        $this->compile_check = !empty($globals->debug);
-
-        $this->_errors    = array('errors' => array());
-        $this->_jsonVars  = array();
-        $this->_failure   = false;
-
-        if ($globals->mode != 'rw') {
-            $this->trigError("En raison d'une maintenance, une partie des fonctionnalités du site sont"
-                             . " actuellement désactivée, en particuliers aucune donnée ne sera sauvegardée");
-        }
-        $this->register_prefilter('at_to_globals');
-        $this->addJsLink('xorg.js');
-        $this->addJsLink('jquery.js');
-    }
-
-    // }}}
-    // {{{ function changeTpl()
-
-    public function changeTpl($tpl, $type = SKINNED)
-    {
-        $this->_tpl       = $tpl;
-        $this->_page_type = $type;
-        $this->assign('pl_tpl', $tpl);
-    }
-
-    // }}}
-    // {{{ function raw()
-
-    public function raw()
-    {
-        global $globals;
-        $this->assign('globals', $globals);
-        return $this->fetch($this->_tpl);
-    }
-
-    // }}}
-    // {{{ function _run()
-
-    protected function _run($skin)
-    {
-        global $globals, $TIME_BEGIN;
-
-        Platal::session()->close();
-
-        $this->register_prefilter('trimwhitespace');
-        $this->register_prefilter('form_force_encodings');
-        $this->register_prefilter('wiki_include');
-        $this->register_prefilter('if_has_perms');
-        $this->assign('pl_triggers', $this->_errors);
-        $this->assign('pl_errors', $this->nb_errs());
-        $this->assign('pl_failure', $this->_failure);
-        $this->assign_by_ref('globals', $globals);
-
-        if (Env::has('json') && count($this->_jsonVars)) {
-            return $this->jsonDisplay();
-        }
-
-        if (Env::v('display') == 'light') {
-            $this->_page_type = SIMPLE;
-        } elseif (Env::v('display') == 'raw') {
-            $this->_page_type = NO_SKIN;
-        } elseif (Env::v('display') == 'full') {
-            $this->_page_typ = SKINNED;
-        }
-
-        switch ($this->_page_type) {
-          case NO_SKIN:
-            if (!($globals->debug & DEBUG_SMARTY)) {
-                error_reporting(0);
-            }
-            $this->display($this->_tpl);
-            exit;
-
-          case SIMPLE:
-            $this->assign('simple', true);
-
-          case SKINNED:
-            $this->register_modifier('escape_html', 'escape_html');
-            $this->default_modifiers = Array('@escape_html');
-        }
-        if (S::i('auth') <= AUTH_PUBLIC) {
-            $this->register_outputfilter('hide_emails');
-        }
-        $this->addJsLink('wiki.js');
-        header("Accept-Charset: utf-8");
-        if (Env::v('forceXml')) {
-            header("Content-Type: text/xml; charset=utf-8");
-        }
-
-        if (!$globals->debug) {
-            error_reporting(0);
-            $this->display($skin);
-            exit;
-        }
-
-        $this->assign('validate', true);
-        if (!($globals->debug & DEBUG_SMARTY)) {
-            error_reporting(0);
-        }
-        $START_SMARTY = microtime(true);
-        $result = $this->fetch($skin);
-        $ttime  = sprintf('Temps total: %.02fs (Smarty %.02fs) - Mémoire totale : %dKo<br />',
-                          microtime(true) - $TIME_BEGIN, microtime(true) - $START_SMARTY,
-                          memory_get_peak_usage(true) / 1024);
-        if ($globals->debug & DEBUG_BT) {
-            PlBacktrace::clean();
-            $this->assign_by_ref('backtraces', PlBacktrace::$bt);
-            $result = str_replace('@@BACKTRACE@@', $this->fetch('skin/common.backtrace.tpl'), $result);
-        } else {
-            $result = str_replace('@@BACKTRACE@@', '', $result);
-        }
-
-        $replc  = "<span class='erreur'>VALIDATION HTML INACTIVE</span><br />";
-        if ($globals->debug & DEBUG_VALID) {
-            $fd = fopen($this->compile_dir."/valid.html","w");
-            fwrite($fd, $result);
-            fclose($fd);
-
-            exec($globals->spoolroot."/bin/devel/xhtml.validate.pl ".$this->compile_dir."/valid.html", $val);
-            foreach ($val as $h) {
-                if (preg_match("/^X-W3C-Validator-Errors: (\d+)$/", $h, $m)) {
-                    $replc = '<span style="color: #080;">HTML OK</span><br />';
-                    if ($m[1]) {
-                        $replc = "<span class='erreur'><a href='http://validator.w3.org/check?uri={$globals->baseurl}"
-                            ."/valid.html&amp;ss=1#result'>{$m[1]} ERREUR(S) !!!</a></span><br />";
-                    }
-                    break;
-                }
-            }
-        }
-
-        echo str_replace("@HOOK@", $ttime.$replc, $result);
-        exit;
-    }
-
-    abstract public function run();
-
-    // }}}
-    // {{{ function nb_errs()
-
-    public function nb_errs()
-    {
-        return count($this->_errors['errors']);
-    }
-
-    // }}}
-    // {{{ function trig()
-
-    private function trig($msg, $type = 'errors')
-    {
-        if (!isset($this->_errors[$type])) {
-            $this->_errors[$type] = array();
-        }
-        $this->_errors[$type][] = $msg;
-    }
-
-    public function trigError($msg)
-    {
-        $this->trig($msg, 'errors');
-    }
-
-    public function trigWarning($msg)
-    {
-        $this->trig($msg, 'warnings');
-    }
-
-    public function trigSuccess($msg)
-    {
-        $this->trig($msg, 'success');
-    }
-
-    // }}}
-    // {{{ function kill()
-
-    public function kill($msg)
-    {
-        global $platal;
-
-        $this->assign('platal', $platal);
-        $this->trigError($msg);
-        $this->_failure = true;
-        $this->run();
-    }
-
-    // }}}
-    // {{{ function addJsLink
-
-    public function addJsLink($path)
-    {
-        $this->append('pl_js', $path);
-    }
-
-    // }}}
-    // {{{ function addCssLink
-
-    public function addCssLink($path)
-    {
-        $this->append('pl_css', $path);
-    }
-
-    // }}}
-    // {{{ function addCssInline
-
-    public function addCssInline($css)
-    {
-        if (!empty($css)) {
-            $this->append('pl_inline_css', $css);
-        }
-    }
-
-    // }}}
-    // {{{ function setRssLink
-
-    public function setRssLink($title, $path)
-    {
-        $this->assign('pl_rss', array('title' => $title, 'href' => $path));
-    }
-
-    // }}}
-    // {{{ function jsonDisplay
-    protected function jsonDisplay()
-    {
-        header("Content-type: text/javascript; charset=utf-8");
-        array_walk_recursive($this->_jsonVars, "escape_xorgDB");
-        $jsonbegin = Env::v('jsonBegin');
-        $jsonend = Env::v('jsonEnd');
-        if (Env::has('jsonVar')) {
-            $jsonbegin = Env::v('jsonVar').' = ';
-            $jsonend = ';';
-        } elseif (Env::has('jsonFunc')) {
-            $jsonbegin = Env::v('jsonFunc').'(';
-            $jsonend = ');';
-        }
-        echo $jsonbegin, json_encode($this->_jsonVars), $jsonend;
-        exit;
-    }
-    // }}}
-    // {{{ function jsonAssign
-    public function jsonAssign($var, $value)
-    {
-        $this->_jsonVars[$var] = $value;
-    }
-
-    // }}}
-}
-
-function escape_xorgDB(&$item, $key)
-{
-    if (is_a($item, 'XOrgDBIterator')) {
-        $expanded = array();
-        while ($a = $item->next()) {
-            $expanded[] = $a;
-        }
-        $item = $expanded;
-    }
-}
-
-// {{{ function escape_html ()
-
-/**
- * default smarty plugin, used to auto-escape dangerous html.
- *
- * < --> &lt;
- * > --> &gt;
- * " --> &quot;
- * & not followed by some entity --> &amp;
- */
-function escape_html($string)
-{
-    if (is_string($string)) {
-        return htmlspecialchars($string, ENT_QUOTES, 'UTF-8');
-    } else {
-        return $string;
-    }
-}
-
-// }}}
-// {{{ function at_to_globals()
-
-/**
- * helper
- */
-
-function _to_globals($s) {
-    global $globals;
-    $t = explode('.',$s);
-    if (count($t) == 1) {
-        return var_export($globals->$t[0],true);
-    } else {
-        return var_export($globals->$t[0]->$t[1],true);
-    }
-}
-
-/**
- * compilation plugin used to import $globals confing through #globals.foo.bar# directives
- */
-
-function at_to_globals($tpl_source, &$smarty)
-{
-    return preg_replace('/#globals\.([a-zA-Z0-9_.]+?)#/e', '_to_globals(\'\\1\')', $tpl_source);
-                        }
-
-                        // }}}
-                        // {{{  function trimwhitespace
-
-                        function trimwhitespace($source, &$smarty)
-                        {
-                        $tags = '(script|pre|textarea)';
-                        preg_match_all("!<$tags.*?>.*?</(\\1)>!ius", $source, $tagsmatches);
-                        $source = preg_replace("!<$tags.*?>.*?</(\\1)>!ius", "&&&tags&&&", $source);
-
-                        // remove all leading spaces, tabs and carriage returns NOT
-                        // preceeded by a php close tag.
-                        $source = preg_replace('/((?<!\?>)\n)[\s]+/m', '\1', $source);
-                        $source = preg_replace("!&&&tags&&&!e",  'array_shift($tagsmatches[0])', $source);
-
-                        return $source;
-                        }
-
-                        // }}}
-                        // {{{ function wiki_include
-
-function wiki_include($source, &$smarty)
-{
-    return preg_replace('/\{include( [^}]*)? wiki=([^} ]+)(.*?)\}/ui',
-                        '{include\1 file="../spool/wiki.d/cache_\2.tpl"\3 included=1}',
-                        $source);
-}
-
-// }}}
-//{{{ function hasPerm
-
-function if_has_perms($source, &$smarty)
-{
-    $source = preg_replace('/\{if([^}]*) (\!?)hasPerms\(([^)]+)\)([^}]*)\}/',
-    '{if\1 \2$smarty.session.perms->hasFlagCombination(\3)\4}',
-    $source);
-return preg_replace('/\{if([^}]*) (\!?)hasPerm\(([^)]+)\)([^}]*)\}/',
-       '{if\1 \2($smarty.session.perms && $smarty.session.perms->hasFlag(\3))\4}',
-       $source);
-}
-
-// }}}
-// {{{
-
-function form_force_encodings($source, &$smarty)
-{
-    return preg_replace('/<form[^\w]/',
-                        '\0 accept-charset="utf-8" ',
-                        $source);
-}
-
-// }}}
-// {{{ function hide_emails
-
-function _hide_email($source)
-{
-    $source = str_replace("\n", '', $source);
-    return '<script type="text/javascript">//<![CDATA[' . "\n" .
-        'Nix.decode("' . addslashes(str_rot13($source)) . '");' . "\n" .
-        '//]]></script>';
-}
-
-function hide_emails($source, &$smarty)
-{
-    if (!strpos($source, '@')) {
-        return $source;
-    }
-
-    //prevent email replacement in <script> and <textarea>
-    $tags = '(script|textarea|select)';
-    preg_match_all("!<$tags.*?>.*?</(\\1)>!ius", $source, $tagsmatches);
-    $source = preg_replace("!<$tags.*?>.*?</(\\1)>!ius", "&&&tags&&&", $source);
-
-    //catch all emails in <a href="mailto:...">
-    preg_match_all("!<a[^>]+href=[\"'][^\"']*[-a-z0-9+_.]+@[-a-z0-9_.]+[^\"']*[\"'].*?>.*?</a>!ius", $source, $ahref);
-    $source = preg_replace("!<a[^>]+href=[\"'][^\"']*[-a-z0-9+_.]+@[-a-z0-9_.]+[^\"']*[\"'].*?>.*?</a>!ius", '&&&ahref&&&', $source);
-
-    //prevant replacement in tag attributes
-    preg_match_all("!<[^>]+[-a-z0-9_+.]+@[-a-z0-9_.]+.+?>!ius", $source, $misc);
-    $source = preg_replace("!<[^>]+[-a-z0-9_+.]+@[-a-z0-9_.]+.+?>!ius", '&&&misc&&&', $source);
-
-    //catch !
-    $source = preg_replace('!([-a-z0-9_+.]+@[-a-z0-9_.]+)!iue', '_hide_email("\1")', $source);
-    $source = preg_replace('!&&&ahref&&&!e', '_hide_email(array_shift($ahref[0]))', $source);
-
-    // restore data
-    $source = preg_replace('!&&&misc&&&!e', 'array_shift($misc[0])', $source);
-    $source = preg_replace("!&&&tags&&&!e",  'array_shift($tagsmatches[0])', $source);
-
-    return $source;
-}
-
-// }}}
-
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
-?>
diff --git a/core/classes/plprofiler.php b/core/classes/plprofiler.php
deleted file mode 100644 (file)
index 1734ff5..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-<?php
-/***************************************************************************
- *  Copyright (C) 2003-2008 Polytechnique.org                              *
- *  http://opensource.polytechnique.org/                                   *
- *                                                                         *
- *  This program is free software; you can redistribute it and/or modify   *
- *  it under the terms of the GNU General Public License as published by   *
- *  the Free Software Foundation; either version 2 of the License, or      *
- *  (at your option) any later version.                                    *
- *                                                                         *
- *  This program is distributed in the hope that it will be useful,        *
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of         *
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
- *  GNU General Public License for more details.                           *
- *                                                                         *
- *  You should have received a copy of the GNU General Public License      *
- *  along with this program; if not, write to the Free Software            *
- *  Foundation, Inc.,                                                      *
- *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
- ***************************************************************************/
-
-class PlProfiler
-{
-    static public function start($name, $info = "action")
-    {
-        global $globals;
-        if (!($globals->debug & DEBUG_BT)) {
-            return false;
-        }
-        if (!isset(PlBacktrace::$bt[$name])) {
-            new PlBacktrace($name);
-        }
-        PlBacktrace::$bt[$name]->start($info);
-        return true;
-    }
-
-    static public function step($name, $info = "action")
-    {
-        PlProfiler::stop($name);
-        PlProfiler::start($name, $info);
-    }
-
-    static public function stop($name)
-    {
-        global $globals;
-        if (!($globals->debug & DEBUG_BT)) {
-            return false;
-        }
-        PlBacktrace::$bt[$name]->stop();
-        return true;
-    }
-}
-
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
-?>
diff --git a/core/classes/plsession.php b/core/classes/plsession.php
deleted file mode 100644 (file)
index b1ddcd8..0000000
+++ /dev/null
@@ -1,204 +0,0 @@
-<?php
-/***************************************************************************
- *  Copyright (C) 2003-2008 Polytechnique.org                              *
- *  http://opensource.polytechnique.org/                                   *
- *                                                                         *
- *  This program is free software; you can redistribute it and/or modify   *
- *  it under the terms of the GNU General Public License as published by   *
- *  the Free Software Foundation; either version 2 of the License, or      *
- *  (at your option) any later version.                                    *
- *                                                                         *
- *  This program is distributed in the hope that it will be useful,        *
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of         *
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
- *  GNU General Public License for more details.                           *
- *                                                                         *
- *  You should have received a copy of the GNU General Public License      *
- *  along with this program; if not, write to the Free Software            *
- *  Foundation, Inc.,                                                      *
- *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
- ***************************************************************************/
-
-/** Authentication level.
- * Only AUTH_PUBLIC is mandatory. The others are defined as useful values,
- * but can be overwritten by others auth levels definitions.
- */
-define('AUTH_PUBLIC', 0);
-define('AUTH_COOKIE', 1);
-define('AUTH_MDP',    2);
-
-
-/** The PlSession is a wrapper around the user session management.
- */
-abstract class PlSession
-{
-    /** Build a new session object.
-     * If a session is already started, this just wraps the session... if no
-     * session is currently started, this set the base session variables.
-     *  * auth        contains the current authentication level. The level is
-     *                an integer that grows with the security of the authentication
-     *                method.
-     *  * perms       contains the current permission flags of the user. This flags
-     *                depends on the category of the user.
-     *  * challenge   contains a random uniq id for authentication.
-     *  * xsrf_token  contains a random uniq id for xsrf prevention.
-     *  * user        contains a reference to the current user.
-     */
-    public function __construct()
-    {
-        $this->create();
-    }
-
-    /** Build the session structure with system fields.
-     */
-    private function fillSession()
-    {
-        S::bootstrap('user', null);
-        S::bootstrap('auth', AUTH_PUBLIC);
-        S::bootstrap('challenge', sha1(uniqid(rand(), true)));
-        S::bootstrap('xsrf_token', rand_url_id());
-        S::bootstrap('perms', new PlFlagSet());
-    }
-
-    /** Write current session and close it.
-     */
-    public function close()
-    {
-        session_write_close();
-    }
-
-    /** Create a new session
-     */
-    private function create()
-    {
-        session_start();
-        $this->fillSession();
-    }
-
-    /** Kill the current session.
-     */
-    public function destroy()
-    {
-        session_destroy();
-        unset($_SESSION);
-        $this->create();
-    }
-
-    /** Check if the user has at least the given authentication level.
-     */
-    public function checkAuth($level)
-    {
-        return S::i('auth') >= $level;
-    }
-
-    /** Check if the user has the given permissions.
-     */
-    public function checkPerms($perms)
-    {
-        return S::v('perms')->hasFlagCombination($perms);
-    }
-
-    /** Run authentication procedure to reach at least the given level.
-     */
-    public function start($level)
-    {
-        $backup = S::i($level);
-        if ($this->checkAuth($level)) {
-            return true;
-        }
-        $user = $this->doAuth($level);
-        if (is_null($user)) {
-            return false;
-        }
-        if (!$this->checkAuth($level)) {
-            $this->destroy();
-            return false;
-        }
-        if ($this->startSessionAs($user, $level)) {
-            if (is_null(S::v('user'))) {
-                S::set('user', $user);
-            }
-            return true;
-        } else {
-            $this->destroy();
-        }
-        return false;
-    }
-
-
-    /*** Abstract methods ***/
-
-    /** Function that check authentication at build time of the session object.
-     * This is useful to perform authentication from a cookie or when coming
-     * back from a authentication service.
-     *
-     * This function must NOT try to launch a new authenticatioin procedure. It
-     * just tests if the environment contains sufficient information to start
-     * a user session.
-     *
-     * This function return false if informations are available but lead to an
-     * authentication failure (invalid cookie, invalid service return data...)
-     */
-    abstract public function startAvailableAuth();
-
-    /** Run the effectively authentication procedure to reach the given user.
-     * This method must return a user object (that will be used to fill the
-     * $_SESSION['user'] field).
-     *
-     * If auth failed, the function MUST return null. If auth succeed, the
-     * field $_SESSION['auth'] MUST be filled to the current effective level.
-     */
-    abstract protected function doAuth($level);
-
-    /** Set the session environment to the given user and authentication level.
-     * This function MUST return false if a session is already started and the
-     * user mismatch.
-     *
-     * On succes, this function MUST return true.
-     * If $level is set to -1, this means you are building a new SUID session.
-     */
-    abstract protected function startSessionAs($user, $level);
-
-
-    /*** SUID management ***/
-
-    /** Start a new SUID session.
-     */
-    public function startSUID($user)
-    {
-        if (S::has('suid')) {
-            return false;
-        }
-        $backup   = $_SESSION;
-        $_SESSION = array();
-        $this->fillSession();
-        S::set('suid', $backup);
-        if (!$this->startSessionAs($user, -1)) {
-            $this->stopSUID();
-            return false;
-        }
-        S::set('user', $user);
-        return true;
-    }
-
-    /** Stop a SUID session
-     */
-    public function stopSUID()
-    {
-        if (!S::has('suid')) {
-            return false;
-        }
-        $_SESSION = $_SESSION['suid'];
-        return true;
-    }
-
-
-    /*** Thresholds ***/
-
-    /** Minimum level of authentication that is considered as sure.
-     */
-    abstract public function sureLevel();
-}
-
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
-?>
diff --git a/core/classes/plset.php b/core/classes/plset.php
deleted file mode 100644 (file)
index 7c6168b..0000000
+++ /dev/null
@@ -1,284 +0,0 @@
-<?php
-/***************************************************************************
- *  Copyright (C) 2003-2008 Polytechnique.org                              *
- *  http://opensource.polytechnique.org/                                   *
- *                                                                         *
- *  This program is free software; you can redistribute it and/or modify   *
- *  it under the terms of the GNU General Public License as published by   *
- *  the Free Software Foundation; either version 2 of the License, or      *
- *  (at your option) any later version.                                    *
- *                                                                         *
- *  This program is distributed in the hope that it will be useful,        *
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of         *
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
- *  GNU General Public License for more details.                           *
- *                                                                         *
- *  You should have received a copy of the GNU General Public License      *
- *  along with this program; if not, write to the Free Software            *
- *  Foundation, Inc.,                                                      *
- *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
- ***************************************************************************/
-
-/** UserSet is a light-weight Model/View tool for displaying a set of items
- */
-class PlSet
-{
-    private $from    = null;
-    private $groupby = null;
-    private $joins   = null;
-    private $where   = null;
-
-    private $count   = null;
-
-    private $mods      = array();
-    private $modParams = array();
-    private $mod       = null;
-    private $default   = null;
-
-    public function __construct($from, $joins = '', $where = '', $groupby = '')
-    {
-        $this->from    = $from;
-        $this->joins   = $joins;
-        $this->where   = $where;
-        $this->groupby = $groupby;
-    }
-
-    public function addMod($name, $description, $default = false, array $params = array())
-    {
-        $name = strtolower($name);
-        $this->mods[$name]      = $description;
-        $this->modParams[$name] = $params;
-        if ($default) {
-            $this->default = $name;
-        }
-    }
-
-    public function rmMod($name)
-    {
-        $name = strtolower($name);
-        unset($this->mods[$name]);
-    }
-
-    private function &query($fields, $from, $joins, $where, $groupby, $order, $limit)
-    {
-        if (trim($order)) {
-            $order = "ORDER BY $order";
-        }
-        if (trim($where)) {
-            $where = "WHERE $where";
-        }
-        if (trim($groupby)) {
-            $groupby = "GROUP BY $groupby";
-        }
-        $query = "SELECT  SQL_CALC_FOUND_ROWS
-                          $fields
-                    FROM  $from
-                          $joins
-                          $where
-                          $groupby
-                          $order
-                          $limit";
-//        echo $query;
-//        print_r($this);
-        $it    = XDB::iterator($query);
-        $count = XDB::query('SELECT FOUND_ROWS()');
-        $this->count = intval($count->fetchOneCell());
-        return $it;
-    }
-
-    public function args()
-    {
-        $get = $_GET;
-        unset($get['n']);
-        return $get;
-    }
-
-    protected function encodeArgs(array $args, $encode = false)
-    {
-        $qs = '?';
-        $sep = '&';
-        foreach ($args as $k=>$v) {
-            if (!$encode) {
-                $k = urlencode($k);
-                $v = urlencode($v);
-            }
-            $qs .= "$k=$v$sep";
-        }
-        return $encode ? urlencode($qs) : $qs;
-    }
-
-    public function &get($fields, $joins, $where, $groupby, $order, $limitcount = null, $limitfrom = null)
-    {
-        if (!is_null($limitcount)) {
-            if (!is_null($limitfrom)) {
-                $limitcount = "$limitfrom,$limitcount";
-            }
-            $limitcount = "LIMIT $limitcount";
-        }
-        $joins  = $this->joins . ' ' . $joins;
-        if (trim($this->where)) {
-            if (trim($where)) {
-                $where .= ' AND ';
-            }
-            $where .= $this->where;
-        }
-        if (!$groupby) {
-            $groupby = $this->groupby;
-        }
-        return $this->query($fields, $this->from, $joins, $where, $groupby, $order, $limitcount);
-    }
-
-    public function count()
-    {
-        return $this->count;
-    }
-
-    private function &buildView($view, $data)
-    {
-        $view = strtolower($view);
-        if (!$view || !class_exists($view . 'View') || !isset($this->mods[$view])) {
-            reset($this->mods);
-            $view = $this->default ? $this->default : key($this->mods);
-        }
-        $this->mod = $view;
-        $class = $view . 'View';
-        if (!class_exists($class)) {
-            $view = null;
-        } else {
-            $view = new $class($this, $data, $this->modParams[$this->mod]);
-            if (!$view instanceof PlView) {
-                $view = null;
-            }
-        }
-        return $view;
-    }
-
-    public function apply($baseurl, PlPage &$page, $view = null, $data = null)
-    {
-        $view =& $this->buildView($view, $data);
-        if (is_null($view)) {
-            return false;
-        }
-        $args = $view->args();
-        if (!isset($args['rechercher'])) {
-            $args['rechercher'] = 'Chercher';
-        }
-        $page->changeTpl('core/plset.tpl');
-        $page->assign('plset_base', $baseurl);
-        $page->assign('plset_mods', $this->mods);
-        $page->assign('plset_mod', $this->mod);
-        $page->assign('plset_search', $this->encodeArgs($args));
-        $page->assign('plset_search_enc', $this->encodeArgs($args, true));
-        foreach ($this->modParams[$this->mod] as $param=>$value) {
-            $page->assign($this->mod . '_' . $param, $value);
-        }
-        $page->assign('plset_content', $view->apply($page));
-        $page->assign('plset_count', $this->count);
-        return true;
-    }
-}
-
-interface PlView
-{
-    public function __construct(PlSet &$set, $data, array $params);
-    public function apply(PlPage &$page);
-    public function args();
-}
-
-abstract class MultipageView implements PlView
-{
-    protected $set;
-
-    public $pages  = 1;
-    public $page   = 1;
-    public $offset = 0;
-
-    protected $entriesPerPage = 20;
-    protected $params = array();
-
-    protected $sortkeys = array();
-    protected $defaultkey = null;
-
-    public function __construct(PlSet &$set, $data, array $params)
-    {
-        $this->set   =& $set;
-        $this->page   = Env::i('page', 1);
-        $this->offset = $this->entriesPerPage * ($this->page - 1);
-        $this->params = $params;
-    }
-
-    public function joins()
-    {
-        return null;
-    }
-
-    public function where()
-    {
-        return null;
-    }
-
-    public function groupBy()
-    {
-        return null;
-    }
-
-    protected function addSortKey($name, array $keys, $desc, $default = false)
-    {
-        $this->sortkeys[$name] = array('keys' => $keys, 'desc' => $desc);
-        if (!$this->defaultkey || $default) {
-            $this->defaultkey = $name;
-        }
-    }
-
-    public function order()
-    {
-        $order = Env::v('order', $this->defaultkey);
-        $invert = ($order{0} == '-');
-        if ($invert) {
-            $order = substr($order, 1);
-        }
-        $list = array();
-        foreach ($this->sortkeys[$order]['keys'] as $item) {
-            $desc = ($item{0} == '-');
-            if ($desc) {
-                $item = substr($item, 1);
-            }
-            if ($desc xor $invert) {
-                $item .= ' DESC';
-            }
-            $list[] = $item;
-        }
-        return implode(', ', $list);
-    }
-
-    abstract public function templateName();
-
-    public function apply(PlPage &$page)
-    {
-        $page->assign('order', Env::v('order', $this->defaultkey));
-        $page->assign('orders', $this->sortkeys);
-        $page->assign_by_ref('plview', $this);
-        $page->assign_by_ref('set',
-                             $this->set->get($this->fields(),
-                                             $this->joins(),
-                                             $this->where(),
-                                             $this->groupBy(),
-                                             $this->order(),
-                                             $this->entriesPerPage,
-                                             $this->offset));
-        $count = $this->set->count();
-        $this->pages = intval(ceil($count / $this->entriesPerPage));
-        return 'include/plview.multipage.tpl';
-    }
-
-    public function args()
-    {
-        $list = $this->set->args();
-        unset($list['page']);
-        unset($list['order']);
-        return $list;
-    }
-}
-
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
-?>
diff --git a/core/classes/pltableeditor.php b/core/classes/pltableeditor.php
deleted file mode 100644 (file)
index d364d0e..0000000
+++ /dev/null
@@ -1,324 +0,0 @@
-<?php
-/***************************************************************************
- *  Copyright (C) 2003-2008 Polytechnique.org                              *
- *  http://opensource.polytechnique.org/                                   *
- *                                                                         *
- *  This program is free software; you can redistribute it and/or modify   *
- *  it under the terms of the GNU General Public License as published by   *
- *  the Free Software Foundation; either version 2 of the License, or      *
- *  (at your option) any later version.                                    *
- *                                                                         *
- *  This program is distributed in the hope that it will be useful,        *
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of         *
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
- *  GNU General Public License for more details.                           *
- *                                                                         *
- *  You should have received a copy of the GNU General Public License      *
- *  along with this program; if not, write to the Free Software            *
- *  Foundation, Inc.,                                                      *
- *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
- ***************************************************************************/
-
-class PLTableEditor
-{
-    // the plat/al name of the page
-    public $pl;
-    // the table name
-    public $table;
-    // joint tables to delete when deleting an entry
-    public $jtables = array();
-    // sorting field
-    public $sort = array();
-    // the id field
-    public $idfield;
-    // possibility to edit the field
-    public $idfield_editable;
-    // vars
-    public $vars;
-    // number of displayed fields
-    public $nbfields;
-    // a where clause to restrict table
-    public $whereclause;
-    // the field for sorting entries
-    public $sortfield;
-    public $sortdesc = false;
-    // action to do to delete row:
-    // null => delete effectively, false => no deletion, SQL
-    public $delete_action;
-    public $delete_message;
-    // Should "Save" button return to the list view
-    public $auto_return = true;
-
-    /* table editor for platal
-     * $plname : the PLname of the page, ex: admin/payments
-     * $table : the table to edit, ex: profile_medals
-     * $idfield : the field of the table which is the id, ex: id
-     * $editid : is the id editable or not (if not, it is considered as an int)
-     */
-    public function __construct($plname, $table, $idfield, $editid=false)
-    {
-        $this->pl = $plname;
-        $this->table = $table;
-        $this->idfield = $idfield;
-        $this->sortfield = $idfield;
-        $this->idfield_editable = $editid;
-        $this->whereclause = '1';
-        $r = XDB::iterator("SHOW FULL COLUMNS FROM $table");
-        $this->vars = array();
-        while ($a = $r->next()) {
-            // desc will be the title of the column
-            $a['desc'] = $a['Field'];
-            $a['display'] = true;
-
-            if (substr($a['Type'],0,8) == 'varchar(') {
-                // limit editing box size
-                $a['Size'] = $a['Maxlength'] = substr($a['Type'], 8, strlen($a['Type']) - 9);
-                if ($a['Size'] > 40) $a['Size'] = 40;
-                // if too big, put a textarea
-                $a['Type'] = ($a['Maxlength']<200)?'varchar':'varchar200';
-            }
-            elseif ($a['Type'] == 'text' || $a['Type'] == 'mediumtext')
-                $a['Type'] = 'textarea';
-            elseif (substr($a['Type'],0,4) == 'set(') {
-                // get the list of options
-                $a['List'] = explode('§',str_replace("','","§",substr($a['Type'], 5, strlen($a['Type']) - 7)));
-                if (count($a['List']) == 1) {
-                    $a['Type'] = 'checkbox';
-                    $a['Value'] = $a['List'][0];
-                } else {
-                    $a['Type'] = 'set';
-                }
-            }
-            elseif (substr($a['Type'],0,5) == 'enum(') {
-                // get the list of options
-                $a['List'] = explode('§',str_replace("','","§",substr($a['Type'], 6, strlen($a['Type']) - 8)));
-                $a['Type'] = 'enum';
-            }
-            elseif (substr($a['Type'],0,10) == 'timestamp(' || $a['Type'] == 'datetime') {
-                $a['Type'] = 'timestamp';
-            }
-            elseif ($a['Comment'] == 'ip_address') {
-                $a['Type']='ip_address';
-            }
-
-            $this->vars[$a['Field']] = $a;
-        }
-        $this->vars[$idfield]['desc'] = 'id';
-    }
-
-    // called before creating a new entry
-    private function prepare_new()
-    {
-        $entry = array();
-        foreach ($this->vars as $field => $descr) {
-            $entry[$field] = $descr['Default'];
-        }
-        return $this->prepare_edit($entry);
-    }
-
-    // called before editing $entry
-    private function prepare_edit(&$entry)
-    {
-        foreach ($this->vars as $field => $descr) {
-            if ($descr['Type'] == 'set') {
-                // get the list of options selected
-                $selected = explode(',', $entry[$field]);
-                $entry[$field] = array();
-                foreach ($selected as $option)
-                    $entry[$field][$option] = 1;
-            }
-            if ($descr['Type'] == 'timestamp') {
-                // set readable timestamp
-                $date =& $entry[$field];
-                $date = preg_replace('/([0-9]{4})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})/', '\3/\2/\1 \4:\5:\6', $date);
-            }
-            if ($descr['Type'] == 'date') {
-                $date =& $entry[$field];
-                $date = preg_replace('/([0-9]{4})-?([0-9]{2})-?([0-9]{2})/', '\3/\2/\1', $date);
-            }
-            if ($descr['Type'] == 'ip_address') {
-                $ip = & $entry[$field];
-                $ip = long2ip($ip);
-            }
-        }
-        return $entry;
-    }
-
-    // set whether the save button show redirect to list view or edit view
-    public function list_on_edit($var)
-    {
-        $this->auto_return = $var;
-    }
-
-    // change display of a field
-    public function describe($name, $desc, $display)
-    {
-        $this->vars[$name]['desc'] = $desc;
-        $this->vars[$name]['display'] = $display;
-    }
-
-    // add a join table, when deleting a row corresponding entries will be deleted in these tables
-    public function add_join_table($name,$joinid,$joindel,$joinextra="")
-    {
-        if ($joindel)
-            $this->jtables[$name] = array("joinid" => $joinid,"joinextra" => $joinextra?(" AND ".$joinextra):"");
-    }
-
-    // add a sort key
-    public function add_sort_field($key, $desc = false, $default = false)
-    {
-        if ($default) {
-            $this->sortfield = $key . ($desc ? ' DESC' : '');
-        } else {
-            $this->sort[] = $key . ($desc ? ' DESC' : '');
-        }
-    }
-
-    // add a where clause to limit table listing
-    public function set_where_clause($whereclause="1")
-    {
-        $this->whereclause = $whereclause;
-    }
-    
-    // set an action when trying to delete row
-    public function on_delete($action = NULL, $message = NULL)
-    {
-        $this->delete_action = $action;
-        $this->delete_message = $message;
-    }
-
-    // call when done
-    public function apply(PlPage &$page, $action, $id = false)
-    {
-        $page->changeTpl('core/table-editor.tpl');
-        $list = true;
-        if ($action == 'delete') {
-            S::assert_xsrf_token();
-
-            if (!isset($this->delete_action)) {
-                foreach ($this->jtables as $table => $j)
-                    XDB::execute("DELETE FROM {$table} WHERE {$j['joinid']} = {?}{$j['joinextra']}", $id);
-                XDB::execute("DELETE FROM {$this->table} WHERE {$this->idfield} = {?}",$id);
-                $page->trigSuccess("L'entrée ".$id." a été supprimée.");
-            } else if ($this->delete_action) {
-                XDB::execute($this->delete_action, $id);
-                if (isset($this->delete_message)) {
-                    $page->trigSuccess($this->delete_message);
-                } else {
-                    $page->trigSuccess("L'entrée ".$id." a été supprimée.");
-                }
-            } else {
-                $page->trigError("Impossible de supprimer l'entrée.");
-            }
-        }
-        if ($action == 'edit') {
-            $r = XDB::query("SELECT * FROM {$this->table} WHERE {$this->idfield} = {?} AND {$this->whereclause}",$id);
-            $entry = $r->fetchOneAssoc();
-            $page->assign('entry', $this->prepare_edit($entry));
-            $page->assign('id', $id);
-            $list = false;
-        }
-        if ($action == 'massadd') {
-            $importer = new CSVImporter($this->table, $this->idfield_editable ? $this->idfield : null);
-            $fields   = array();
-            foreach ($this->vars as $field=>$descr) {
-                if ($this->idfield_editable || $field != $this->idfield) {
-                    $fields[] = $field;
-                    $importer->describe($field, @$descr['desc']);
-                }
-            }
-            $page->assign('massadd', true);
-            $importer->apply($page, $this->pl . '/massadd', $fields);
-            $list = false;
-        }
-        if ($action == 'new') {
-            if (!$this->idfield_editable) {
-                $r = XDB::query("SELECT MAX({$this->idfield})+1 FROM {$this->table}");
-                $page->assign('id', $r->fetchOneCell());
-                $page->assign('entry', $this->prepare_new());
-            }
-            $list = false;
-        }
-        if ($action == 'update') {
-            S::assert_xsrf_token();
-
-            $values = "";
-            $cancel = false;
-            foreach ($this->vars as $field => $descr) {
-                if ($values) $values .= ',';
-                if (($field == $this->idfield) && !$this->idfield_editable)
-                    $val = "'".addslashes($id)."'";
-                elseif ($descr['Type'] == 'set') {
-                    $val = "";
-                    if (Post::has($field)) foreach (Post::v($field) as $option) {
-                        if ($val) $val .= ',';
-                        $val .= $option;
-                    }
-                    $val = "'".addslashes($val)."'";
-                } elseif ($descr['Type'] == 'checkbox') {
-                    $val = Post::has($field)?"'".addslashes($descr['Value'])."'":"''";
-                } elseif (Post::has($field)) {
-                    $val = Post::v($field);
-                    if ($descr['Type'] == 'timestamp') {
-                        $val = preg_replace('/([0-9]{1,2})\/([0-9]{1,2})\/([0-9]{4}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})/', '\3\2\1\4\5\6', $val);
-                    }
-                    elseif ($descr['Type'] == 'date') {
-                        $val = preg_replace('/([0-9]{1,2})\/([0-9]{1,2})\/([0-9]{4})/', '\3-\2-\1', $val);
-                    }
-                    elseif ($descr['Type'] == 'ip_address') {
-                        $val = ip2long($val);
-                    }
-                    $val = "'".addslashes($val)."'";
-                } else {
-                    $cancel = true;
-                    $page->trigError("Il manque le champ ".$field);
-                }
-                $values .= $val;
-            }
-            if (!$cancel) {
-                if ($this->idfield_editable && ($id != Post::v($this->idfield)) && $action != 'new')
-                    XDB::execute("UPDATE {$this->table} SET {$this->idfield} = {?} WHERE {$this->idfield} = {?} AND {$this->whereclause}", Post::v($this->idfield), $id);
-                XDB::execute("REPLACE INTO {$this->table} VALUES ($values)");
-                if ($id !== false)
-                    $page->trigSuccess("L'entrée ".$id." a été mise à jour.");
-                else {
-                    $page->trigSuccess("Une nouvelle entrée a été créée.");
-                    $id = XDB::insertId();
-                }
-            } else
-                $page->trigError("Impossible de mettre à jour.");
-            if (!$this->auto_return) {
-                return $this->apply($page, 'edit', $id);
-            }
-        }
-        if ($action == 'sort') {
-            $this->sortfield = $id;
-        }
-        if ($action == 'sortdesc') {
-            $this->sortfield = $id.' DESC';
-        }
-        if ($list) {
-            // user can sort by field by clicking the title of the column
-            if (isset($this->sortfield)) {
-                // add this sort order after the others (chosen by dev)
-                $this->add_sort_field($this->sortfield);
-                if (substr($this->sortfield,-5) == ' DESC') {
-                    $this->sortfield = substr($this->sortfield,0,-5);
-                    $this->sortdesc = true;
-                }
-            }
-            if (count($this->sort) > 0) {
-                $sort = 'ORDER BY ' . join($this->sort, ',');
-            }
-            $it = XDB::iterator("SELECT * FROM {$this->table} WHERE {$this->whereclause} $sort");
-            $this->nbfields = 0;
-            foreach ($this->vars as $field => $descr)
-                if ($descr['display']) $this->nbfields++;
-            $page->assign('list', $it);
-        }
-        $page->assign('t', $this);
-    }
-}
-
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
-?>
diff --git a/core/classes/plupload.php b/core/classes/plupload.php
deleted file mode 100644 (file)
index ea192f0..0000000
+++ /dev/null
@@ -1,316 +0,0 @@
-<?php
-/***************************************************************************
- *  Copyright (C) 2003-2008 Polytechnique.org                              *
- *  http://opensource.polytechnique.org/                                   *
- *                                                                         *
- *  This program is free software; you can redistribute it and/or modify   *
- *  it under the terms of the GNU General Public License as published by   *
- *  the Free Software Foundation; either version 2 of the License, or      *
- *  (at your option) any later version.                                    *
- *                                                                         *
- *  This program is distributed in the hope that it will be useful,        *
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of         *
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
- *  GNU General Public License for more details.                           *
- *                                                                         *
- *  You should have received a copy of the GNU General Public License      *
- *  along with this program; if not, write to the Free Software            *
- *  Foundation, Inc.,                                                      *
- *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
- ***************************************************************************/
-
-/** Class to store per user and per category files
- */
-class PlUpload
-{
-    private $forlife;
-    private $category;
-    private $file_id;
-
-    private $filename;
-    private $type;
-
-    static public $lastError;
-
-    /** For images
-     */
-    private $x;
-    private $y;
-
-    public function __construct($forlife, $category, $filename = null)
-    {
-        $this->file_id  = $filename;
-        $this->category = $category;
-        $this->forlife  = $forlife;
-        $this->filename = $this->makeFilename($this->file_id);
-        $this->checkContentType();
-    }
-
-    private function makeFilename($file_id)
-    {
-        global $globals;
-        $filename = $globals->spoolroot . '/spool/tmp/';
-        if (!file_exists($filename)) {
-            if (!mkdir($filename)) {
-                trigger_error('can\'t create upload directory: ' . $filename, E_USER_ERROR);
-            }
-        }
-        $filename .= $this->forlife . '--' . $this->category;
-        if ($file_id) {
-            $filename .= '--' . $file_id;
-        }
-        return $filename;
-    }
-
-    private function checkContentType()
-    {
-        if ($this->exists()) {
-            $this->type = trim(mime_content_type($this->filename));
-            if ($this->type == 'text/plain') { // Workaround a bug of php 5.2.0+etch10 (mime_content_type fallback is 'text/plain')
-                $this->type = preg_replace('/;.*/', '', trim(shell_exec('file -bi ' . escapeshellarg($this->filename))));
-            }
-        }
-    }
-
-    public function upload(array &$file)
-    {
-        if (@$file['error']) {
-            PlUpload::$lastError = 'Erreur de téléchargement de ' . $file['name'] . ' : ';
-            switch ($file['error']) {
-              case UPLOAD_ERR_INI_SIZE: case UPLOAD_ERR_FORM_SIZE:
-                PlUpload::$lastError .= 'le fichier est trop gros (limite : ' . ini_get('upload_max_filesize') . ')';
-                break;
-              case UPLOAD_ERR_PARTIAL: case UPLOAD_ERR_NO_FILE:
-                PlUpload::$lastError .= 'le fichier n\'a pas été transmis intégralement';
-                break;
-              default:
-                PlUpload::$lastError .= 'erreur interne';
-                break;
-            }
-            return false;
-        }
-        if (!is_uploaded_file($file['tmp_name'])) {
-            return false;
-        } else if (!move_uploaded_file($file['tmp_name'], $this->filename)) {
-            return false;
-        }
-        $this->checkContentType();
-        return true;
-    }
-
-    public function copyFrom($filename)
-    {
-        if (!copy($filename, $this->filename)) {
-            return false;
-        }
-        $this->checkContentType();
-        return true;
-    }
-
-    public function download($url)
-    {
-        if (!$url || @parse_url($url) === false) {
-            trigger_error('malformed URL given', E_USER_NOTICE);
-            return false;
-        }
-        $data = file_get_contents($url);
-        if (!$data) {
-            return false;
-        }
-        if (!file_put_contents($this->filename, $data)) {
-            return false;
-        }
-        $this->checkContentType();
-        return true;
-    }
-
-    static public function &get(array &$file, $forlife, $category, $uniq = false)
-    {
-        $upload = new PlUpload($forlife, $category, $uniq ? null : $file['name']);
-        if (!$upload->upload($file)) {
-            $upload = null;
-        }
-        return $upload;
-    }
-
-    public function rm()
-    {
-        @unlink($this->filename);
-        @clearstatcache();
-    }
-
-    public function rename($fn)
-    {
-        if (!$this->file_id) {
-            return false;
-        }
-        $filename = $this->makeFilename($fn);
-        if (rename($this->filename)) {
-            $this->filename = $filename;
-            $this->file_id  = $fn;
-            clearstatcache();
-            return true;
-        }
-        return false;
-    }
-
-    public function exists()
-    {
-        return file_exists($this->filename);
-    }
-
-    static public function listRawFiles($forlife = '*', $category = '*', $uniq = false, $basename = false)
-    {
-        global $globals;
-        $filename = $globals->spoolroot . '/spool/tmp/';
-        $filename .= $forlife . '--' . $category;
-        if (!$uniq) {
-            $filename .= '--*';
-        }
-        $files = glob($filename);
-        if ($basename) {
-            $files = array_map('basename', $files);
-        }
-        return $files;
-    }
-
-    static public function listFilenames($forlife = '*', $category = '*')
-    {
-        $files = PlUpload::listRawFiles($forlife, $category, false, true);
-        foreach ($files as &$name) {
-            list($forlife, $cat, $fn) = explode('--', $name, 3);
-            $name = $fn;
-        }
-        return $files;
-    }
-
-    static public function &listFiles($forlife = '*', $category = '*', $uniq = false)
-    {
-        $res   = array();
-        $files = PlUpload::listRawFiles($forlife, $category, $uniq, true);
-        foreach ($files as $name) {
-            list($forlife, $cat, $fn) = explode('--', $name, 3);
-            $res[$fn] = new PlUpload($forlife, $cat, $fn);
-        }
-        return $res;
-    }
-
-    static public function clear($user = '*', $category = '*', $uniq = false)
-    {
-        $files = PlUpload::listRawFiles($user, $category, $uniq, false);
-        array_map('unlink', $files);
-    }
-
-    public function contentType()
-    {
-        return $this->type;
-    }
-
-    public function isType($type, $subtype = null)
-    {
-        list($mytype, $mysubtype) = explode('/', $this->type);
-        if ($mytype != $type || ($subtype && $mysubtype != $subtype)) {
-            return false;
-        }
-        return true;
-    }
-
-    public function imageInfo()
-    {
-        static $map;
-        if (!isset($map)) {
-            $tmpmap = array (IMG_GIF => 'gif', IMG_JPG => 'jpeg', IMG_PNG => 'png', IMG_WBMP => 'bmp', IMG_XPM => 'xpm');
-            $map = array();
-            $supported = imagetypes();
-            foreach ($tmpmap as $type=>$mime) {
-                if ($supported & $type) {
-                    $map[$type] = $mime;
-                }
-            }
-        }
-        $array = getimagesize($this->filename);
-        $array[2] = @$map[$array[2]];
-        if (!$array[2]) {
-            list($image, $type) = explode('/', $array['mime']);
-            $array[2] = $type;
-        }
-        if (!$array[2]) {
-            trigger_error('unknown image type', E_USER_NOTICE);
-            return null;
-        }
-        return $array;
-    }
-
-    public function resizeImage($max_x = -1, $max_y = -1, $min_x = 0, $min_y = 0, $maxsize = -1)
-    {
-        if (!$this->exists() || strpos($this->type, 'image/') !== 0) {
-            trigger_error('not an image', E_USER_NOTICE);
-            return false;
-        }
-        $image_infos = $this->imageInfo();
-        if (!$image_infos) {
-            trigger_error('invalid image', E_USER_NOTICE);
-            return false;
-        }
-        list($this->x, $this->y, $mimetype) = $image_infos;
-        if ($max_x == -1) {
-            $max_x = $this->x;
-        }
-        if ($max_y == -1) {
-            $max_y = $this->y;
-        }
-        if ($maxsize == -1) {
-            $maxsize = filesize($this->filename);
-        }
-        if (filesize($this->filename) > $maxsize || $this->x > $max_x || $this->y > $max_y
-                                                 || $this->x < $min_x || $this->y < $min_y) {
-            $img = imagecreatefromstring(file_get_contents($this->filename));
-            if (!$img) {
-                trigger_error('too large image, can\'t be resized', E_USER_NOTICE);
-                return false;
-            }
-
-            $nx = $this->x;
-            $ny = $this->y;
-            if ($nx > $max_x) {
-                $ny = intval($ny*$max_x/$nx);
-                $nx = $max_x;
-            }
-            if ($ny > $max_y) {
-                $nx = intval($nx*$max_y/$ny);
-                $ny = $max_y;
-            }
-            if ($nx < $min_x) {
-                $ny = intval($ny*$min_x/$nx);
-                $nx = $min_x;
-            }
-            if ($ny < $min_y) {
-                $nx = intval($nx * $min_y/$ny);
-                $ny = $min_y;
-            }
-
-            $comp = 90;
-            do {
-                $img2 = imagecreatetruecolor($nx, $ny);
-                imagecopyresampled($img2, $img, 0, 0, 0, 0, $nx, $ny, $this->x, $this->y);
-                imagejpeg($img2, $this->filename, $comp);
-                $comp --;
-                clearstatcache();
-            } while (filesize($this->filename) > $maxsize && $comp > 0);
-            $this->type = 'image/jpeg';
-            $this->x    = $nx;
-            $this->y    = $ny;
-        }
-        return true;
-    }
-
-    public function getContents()
-    {
-        if ($this->exists()) {
-            return file_get_contents($this->filename);
-        }
-        return null;
-    }
-}
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
-?>
diff --git a/core/classes/plwizard.php b/core/classes/plwizard.php
deleted file mode 100644 (file)
index e12eec7..0000000
+++ /dev/null
@@ -1,219 +0,0 @@
-<?php
-/***************************************************************************
- *  Copyright (C) 2003-2008 Polytechnique.org                              *
- *  http://opensource.polytechnique.org/                                   *
- *                                                                         *
- *  This program is free software; you can redistribute it and/or modify   *
- *  it under the terms of the GNU General Public License as published by   *
- *  the Free Software Foundation; either version 2 of the License, or      *
- *  (at your option) any later version.                                    *
- *                                                                         *
- *  This program is distributed in the hope that it will be useful,        *
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of         *
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
- *  GNU General Public License for more details.                           *
- *                                                                         *
- *  You should have received a copy of the GNU General Public License      *
- *  along with this program; if not, write to the Free Software            *
- *  Foundation, Inc.,                                                      *
- *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
- **************************************************************************/
-
-/** A Wizard Page is a page of a wizard. It is a self-contained step which
- * handles both the creation and initialisation of the step (by using the
- * Wizard global state, if needed) and the processing of the action the
- * user made on it.
- */
-interface PlWizardPage
-{
-    /** Build a new instance of the class
-     * associated with the given wizard master.
-     */
-    public function __construct(PlWizard &$wiz);
-
-    /** Return the name of the templace describing the page.
-     */
-    public function template();
-
-    /** Prepare the page by assigning to it any useful value.
-     */
-    public function prepare(PlPage &$page, $id);
-
-    /** Process information resulting of the application of the page.
-     * This function must return a clue indicating the next page to show.
-     * This clue can be either a page id, a page number or a navigation
-     * id (PlWizard::FIRST_PAGE, PlWizard::NEXT_PAGE, PlWizard::CURRENT_PAGE
-     *  PlWizard::PREVIOUS_PAGE, PlWizard::LAST_PAGE).
-     */
-    public function process();
-}
-
-/** A PlWizard is a set of pages through which the user can navigate,
- * his action on a page determining which the next one will be.
- *
- * A Wizard can either a stateless wizard (which is only a set of
- * independent pages through which the user can easily navigate) or
- * stateful (a suite of steps where each step gives clue for the next
- * one).
- */
-class PlWizard
-{
-    const FIRST_PAGE    = 'bt_first';
-    const NEXT_PAGE     = 'bt_next';
-    const CURRENT_PAGE  = 'bt_current';
-    const PREVIOUS_PAGE = 'bt_previous';
-    const LAST_PAGE     = 'bt_last';
-
-    protected $name;
-    protected $layout;
-    protected $stateless;
-    protected $ajax;
-
-    protected $pages;
-    protected $titles;
-    protected $lookup;
-    protected $inv_lookup;
-
-    public function __construct($name, $layout, $stateless = false, $ajax = true)
-    {
-        $this->name      = 'wiz_' . $name;
-        $this->layout    = $layout;
-        $this->stateless = $stateless;
-        $this->pages  = array();
-        $this->lookup = array();
-        $this->titles = array();
-        $this->ajax   = $ajax;
-        if (!isset($_SESSION[$this->name])) {
-            $_SESSION[$this->name] = array();
-            $_SESSION[$this->name . '_page']  = null;
-            $_SESSION[$this->name . '_stack'] = array();
-        }
-    }
-
-    public function addPage($class, $title, $id = null)
-    {
-        if ($id == null) {
-            $id = count($this->pages);
-        }
-        $this->lookup[$id]  = count($this->pages);
-        $this->inv_lookup[] = $id;
-        $this->pages[]      = $class;
-        $this->titles[]     = $title;
-    }
-
-    public function set($varname, $value)
-    {
-        $_SESSION[$this->name][$varname] = $value;
-    }
-
-    public function get($varname, $default = null)
-    {
-        return isset($_SESSION[$this->name][$varname]) ?
-                    $_SESSION[$this->name][$varname] : $default;
-    }
-
-    public function v($varname, $default = "")
-    {
-        return $this->get($varname, $default);
-    }
-
-    public function i($varname, $default = 0)
-    {
-        return (int)$this->get($varname, $default);
-    }
-
-    public function clear($varname = null)
-    {
-        if (is_null($varname)) {
-            $_SESSION[$this->name] = array();
-        } else {
-            unset($_SESSION[$this->name][$varname]);
-        }
-        $_SESSION[$this->name . '_page'] = null;
-    }
-
-    private function getPage($id)
-    {
-        $page = $this->pages[$id];
-        return new $page($this);
-    }
-
-    public function apply(PlPage &$smarty, $baseurl, $pgid = null, $mode = 'normal')
-    {
-        if ($this->stateless && (isset($this->lookup[$pgid]) || isset($this->pages[$pgid]))) { 
-            $curpage = is_numeric($pgid) ? $pgid : $this->lookup[$pgid]; 
-        } else if ($this->stateless && is_null($pgid)) {
-            $curpage = 0;
-        } else {
-            $curpage = $_SESSION[$this->name . '_page'];
-        }
-        $oldpage = $curpage;
-
-        // Process the previous page
-        if (Post::has('valid_page')) {
-            $page = $this->getPage(Post::i('valid_page'));
-            $curpage = Post::i('valid_page');
-            $next = $page->process();
-            $last = $curpage;
-            switch ($next) {
-              case PlWizard::FIRST_PAGE:
-                $curpage = 0;
-                break;
-              case PlWizard::PREVIOUS_PAGE:
-                if (!$this->stateless && count($_SESSION[$this->name . '_stack'])) {
-                    $curpage = array_pop($_SESSION[$this->name . '_stack']);
-                } elseif ($curpage && $this->stateless) {
-                    $curpage--;
-                } else {
-                    $curpage = 0;
-                }
-                break;
-              case PlWizard::NEXT_PAGE:
-                if ($curpage < count($this->pages) - 1) {
-                    $curpage++;
-                }
-                break;
-              case PlWizard::LAST_PAGE:
-                $curpage = count($this->pages) - 1;
-                break;
-              case PlWizard::CURRENT_PAGE: break; // don't change the page
-              default:
-                $curpage = is_numeric($next) ? $next : $this->lookup[$next];
-                break;
-            }
-            if (!$this->stateless) {
-                array_push($_SESSION[$this->name . '_stack'], $last);
-            }
-        }
-        if (is_null($curpage)) {
-            $curpage = 0;
-        }
-
-        // Prepare the page
-        $_SESSION[$this->name . '_page'] = $curpage;
-        if ($curpage != $oldpage) {
-            pl_redirect($baseurl . '/' . $this->inv_lookup[$curpage]);
-        } else if (!isset($page)) {
-            $page = $this->getPage($curpage);
-        }
-        if ($mode == 'ajax') {
-            header('Content-Type: text/html; charset=utf-8');
-            $smarty->changeTpl($page->template(), NO_SKIN);
-        } else {
-            $smarty->changeTpl($this->layout);
-        }
-        $smarty->assign('pages', $this->titles);
-        $smarty->assign('current', $curpage);
-        $smarty->assign('lookup', $this->inv_lookup);
-        $smarty->assign('stateless', $this->stateless);
-        $smarty->assign('wiz_baseurl', $baseurl);
-        $smarty->assign('wiz_ajax', $this->ajax);
-        $smarty->assign('tab_width', (int)(99 / count($this->pages)));
-        $smarty->assign('wiz_page', $page->template());
-        $smarty->assign('pl_no_errors', true);
-        $page->prepare($smarty, isset($this->inv_lookup[$curpage]) ? $this->inv_lookup[$curpage] : $curpage);
-    }
-}
-
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
-?>
diff --git a/core/classes/s.php b/core/classes/s.php
deleted file mode 100644 (file)
index 7ba3b24..0000000
+++ /dev/null
@@ -1,123 +0,0 @@
-<?php
-/***************************************************************************
- *  Copyright (C) 2003-2008 Polytechnique.org                              *
- *  http://opensource.polytechnique.org/                                   *
- *                                                                         *
- *  This program is free software; you can redistribute it and/or modify   *
- *  it under the terms of the GNU General Public License as published by   *
- *  the Free Software Foundation; either version 2 of the License, or      *
- *  (at your option) any later version.                                    *
- *                                                                         *
- *  This program is distributed in the hope that it will be useful,        *
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of         *
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
- *  GNU General Public License for more details.                           *
- *                                                                         *
- *  You should have received a copy of the GNU General Public License      *
- *  along with this program; if not, write to the Free Software            *
- *  Foundation, Inc.,                                                      *
- *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
- ***************************************************************************/
-
-class S
-{
-    /** Set a constructor because this is called prior to S::s(), so we can
-     * define S::s() for other usages.
-     */
-    private function __construct()
-    {
-        assert(false);
-    }
-
-    public static function has($key)
-    {
-        return isset($_SESSION[$key]);
-    }
-
-    public static function kill($key)
-    {
-        unset($_SESSION[$key]);
-    }
-
-    public static function v($key, $default = null)
-    {
-        return isset($_SESSION[$key]) ? $_SESSION[$key] : $default;
-    }
-
-    public static function s($key, $default = '')
-    {
-        return (string)S::v($key, $default);
-    }
-
-    public static function i($key, $default = 0)
-    {
-        $i = S::v($key, $default);
-        return is_numeric($i) ? intval($i) : $default;
-    }
-
-    public static function l(array $keys)
-    {
-        return array_map(array('S', 'v'), $keys);
-    }
-
-    public static function set($key, $value)
-    {
-        $_SESSION[$key] =& $value;
-    }
-
-    public static function bootstrap($key, $value)
-    {
-        if (!S::has($key)) {
-            S::set($key, $value);
-        }
-    }
-
-    public static function logger($uid = null)
-    {
-        if (!S::has('log')) {
-            if (S::has('suid')) {
-                $suid = S::v('suid');
-                S::set('log', new PlLogger(S::v('uid'), $suid['uid']));
-            } else if (S::has('uid') || $uid) {
-                S::set('log', new PlLogger(S::v('uid', $uid)));
-            }
-        }
-        return S::v('log');
-    }
-
-    public static function has_perms()
-    {
-        return Platal::session()->checkPerms(PERMS_ADMIN);
-    }
-
-    public static function logged()
-    {
-        return S::v('auth', AUTH_PUBLIC) > AUTH_PUBLIC;
-    }
-
-    public static function identified()
-    {
-        return S::v('auth', AUTH_PUBLIC) >= Platal::session()->sureLevel();
-    }
-
-    // Anti-XSRF protections.
-    public static function has_xsrf_token()
-    {
-        return S::has('xsrf_token') && S::v('xsrf_token') == Env::v('token');
-    }
-
-    public static function assert_xsrf_token()
-    {
-        if (!S::has_xsrf_token()) {
-            Platal::page()->kill('L\'opération n\'a pas pu aboutir, merci de réessayer.');
-        }
-    }
-
-    public static function rssActivated()
-    {
-        return S::has('core_rss_hash') && S::v('core_rss_hash');
-    }
-}
-
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
-?>
diff --git a/core/classes/varstream.php b/core/classes/varstream.php
deleted file mode 100644 (file)
index e57b60f..0000000
+++ /dev/null
@@ -1,107 +0,0 @@
-<?php
-/***************************************************************************
- *  Copyright (C) 2003-2008 Polytechnique.org                              *
- *  http://opensource.polytechnique.org/                                   *
- *                                                                         *
- *  This program is free software; you can redistribute it and/or modify   *
- *  it under the terms of the GNU General Public License as published by   *
- *  the Free Software Foundation; either version 2 of the License, or      *
- *  (at your option) any later version.                                    *
- *                                                                         *
- *  This program is distributed in the hope that it will be useful,        *
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of         *
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
- *  GNU General Public License for more details.                           *
- *                                                                         *
- *  You should have received a copy of the GNU General Public License      *
- *  along with this program; if not, write to the Free Software            *
- *  Foundation, Inc.,                                                      *
- *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
- ***************************************************************************/
-
-class VarStream
-{
-    // Stream handler to read from global variables
-    private $varname;
-    private $position;
-
-    public function stream_open($path, $mode, $options, &$opened_path)
-    {
-        $url            = parse_url($path);
-        $this->varname  = $url['host'];
-        $this->position = 0;
-        if (!isset($GLOBALS[$this->varname]))
-        {
-            trigger_error('Global variable '.$this->varname.' does not exist', E_USER_WARNING);
-            return false;
-        }
-        return true;
-    }
-
-    public function stream_close()
-    {
-    }
-
-    public function stream_read($count)
-    {
-        $ret = substr($GLOBALS[$this->varname], $this->position, $count);
-        $this->position += strlen($ret);
-        return $ret;
-    }
-
-    public function stream_write($data)
-    {
-        $len = strlen($data);
-        if ($len > $this->position + strlen($GLOBALS[$this->varname])) {
-            str_pad($GLOBALS[$this->varname], $len);
-        }
-
-        $GLOBALS[$this->varname] = substr_replace($GLOBALS[$this->varname], $data, $this->position, $len);
-        $this->position += $len;
-    }
-
-    public function stream_eof()
-    {
-        return $this->position >= strlen($GLOBALS[$this->varname]);
-    }
-
-    public function stream_tell()
-    {
-        return $this->position;
-    }
-
-    public function stream_seek($offs, $whence)
-    {
-        switch ($whence) {
-            case SEEK_SET:
-                $final = $offs;
-                break;
-
-            case SEEK_CUR:
-                $final += $offs;
-                break;
-
-            case SEEK_END:
-                $final = strlen($GLOBALS[$this->varname]) + $offs;
-                break;
-        }
-
-        if ($final < 0) {
-            return -1;
-        }
-        $this->position = $final;
-        return 0;
-    }
-
-    public function stream_flush()
-    {
-    }
-
-    static public function init()
-    {
-        stream_wrapper_register('var','VarStream');
-    }
-}
-
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
-?>
diff --git a/core/classes/xdb.php b/core/classes/xdb.php
deleted file mode 100644 (file)
index a9cb068..0000000
+++ /dev/null
@@ -1,366 +0,0 @@
-<?php
-/***************************************************************************
- *  Copyright (C) 2003-2008 Polytechnique.org                              *
- *  http://opensource.polytechnique.org/                                   *
- *                                                                         *
- *  This program is free software; you can redistribute it and/or modify   *
- *  it under the terms of the GNU General Public License as published by   *
- *  the Free Software Foundation; either version 2 of the License, or      *
- *  (at your option) any later version.                                    *
- *                                                                         *
- *  This program is distributed in the hope that it will be useful,        *
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of         *
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
- *  GNU General Public License for more details.                           *
- *                                                                         *
- *  You should have received a copy of the GNU General Public License      *
- *  along with this program; if not, write to the Free Software            *
- *  Foundation, Inc.,                                                      *
- *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
- **************************************************************************/
-
-class XDB
-{
-    private static $mysqli = null;
-
-    public static function connect()
-    {
-        global $globals;
-        XDB::$mysqli = new mysqli($globals->dbhost, $globals->dbuser, $globals->dbpwd, $globals->dbdb);
-        if ($globals->debug & DEBUG_BT) {
-            $bt = new PlBacktrace('MySQL');
-            if (mysqli_connect_errno()) {
-                $bt->newEvent("MySQLI connection", 0, mysqli_connect_error());
-                return false;
-            }
-        }
-        XDB::$mysqli->autocommit(true);
-        XDB::$mysqli->set_charset($globals->dbcharset);
-        return true;
-    }
-
-    public static function _prepare($args)
-    {
-        $query    = array_map(Array('XDB', 'escape'), $args);
-        $query[0] = str_replace('{?}', '%s', str_replace('%',   '%%', $args[0]));
-        return call_user_func_array('sprintf', $query);
-    }
-
-    public static function _reformatQuery($query)
-    {
-        $query  = preg_split("/\n\\s*/", trim($query));
-        $length = 0;
-        foreach ($query as $key=>$line) {
-            $local = -2;
-            if (preg_match('/^([A-Z]+(?:\s+(?:JOIN|BY|FROM|INTO))?)\s+(.*)/u', $line, $matches)
-            && $matches[1] != 'AND' && $matches[1] != 'OR')
-            {
-                $local  = strlen($matches[1]);
-                $line   = $matches[1] . '  ' . $matches[2];
-                $length = max($length, $local);
-            }
-            $query[$key] = array($line, $local);
-        }
-        $res = '';
-        foreach ($query as $array) {
-            list($line, $local) = $array;
-            $local   = max(0, $length - $local);
-            $res    .= str_repeat(' ', $local) . $line . "\n";
-            $length += 2 * (substr_count($line, '(') - substr_count($line, ')'));
-        }
-        return $res;
-    }
-
-    public static function _query($query)
-    {
-        global $globals;
-
-        if (!XDB::$mysqli && !XDB::connect()) {
-            return false;
-        }
-
-        if ($globals->debug & DEBUG_BT) {
-            $explain = array();
-            if (strpos($query, 'FOUND_ROWS()') === false) {
-                $res = XDB::$mysqli->query("EXPLAIN $query");
-                if ($res) {
-                    while ($row = $res->fetch_assoc()) {
-                        $explain[] = $row;
-                    }
-                    $res->free();
-                }
-            }
-            PlBacktrace::$bt['MySQL']->start(XDB::_reformatQuery($query));
-        }
-
-        $res = XDB::$mysqli->query($query);
-
-        if ($globals->debug & DEBUG_BT) {
-            PlBacktrace::$bt['MySQL']->stop(@$res->num_rows ? $res->num_rows : XDB::$mysqli->affected_rows,
-                                            XDB::$mysqli->error,
-                                            $explain);
-        }
-        return $res;
-    }
-
-    public static function query()
-    {
-        return new XOrgDBResult(XDB::_prepare(func_get_args()));
-    }
-
-    public static function execute()
-    {
-        global $globals;
-        $args = func_get_args();
-        if ($globals->mode != 'rw' && !strpos($args[0], 'logger')) {
-            return;
-        }
-        return XDB::_query(XDB::_prepare($args));
-    }
-
-    public static function iterator()
-    {
-        return new XOrgDBIterator(XDB::_prepare(func_get_args()));
-    }
-
-    public static function iterRow()
-    {
-        return new XOrgDBIterator(XDB::_prepare(func_get_args()), MYSQL_NUM);
-    }
-
-    public static function insertId()
-    {
-        return XDB::$mysqli->insert_id;
-    }
-
-    public static function errno()
-    {
-        return XDB::$mysqli->errno;
-    }
-
-    public static function error()
-    {
-        return XDB::$mysqli->error;
-    }
-
-    public static function affectedRows()
-    {
-        return XDB::$mysqli->affected_rows;
-    }
-
-    public static function escape($var)
-    {
-        switch (gettype($var)) {
-          case 'boolean':
-            return $var ? 1 : 0;
-
-          case 'integer':
-          case 'double':
-          case 'float':
-            return $var;
-
-          case 'string':
-            return "'".addslashes($var)."'";
-
-          case 'NULL':
-            return 'NULL';
-
-          case 'object':
-            if ($var instanceof PlFlagSet) {
-                return "'" . addslashes($var->flags()) . "'";
-            }
-          case 'array':
-            return "'".addslashes(serialize($var))."'";
-
-          default:
-            die(var_export($var, true).' is not a valid for a database entry');
-        }
-    }
-}
-
-class XOrgDBResult
-{
-
-    private $_res;
-
-    public function __construct($query)
-    {
-        $this->_res = XDB::_query($query);
-    }
-
-    public function free()
-    {
-        if ($this->_res) {
-            $this->_res->free();
-        }
-        unset($this);
-    }
-
-    protected function _fetchRow()
-    {
-        return $this->_res ? $this->_res->fetch_row() : null;
-    }
-
-    protected function _fetchAssoc()
-    {
-        return $this->_res ? $this->_res->fetch_assoc() : null;
-    }
-
-    public function fetchAllRow()
-    {
-        $result = Array();
-        if (!$this->_res) {
-            return $result;
-        }
-        while ($result[] = $this->_res->fetch_row());
-        array_pop($result);
-        $this->free();
-        return $result;
-    }
-
-    public function fetchAllAssoc()
-    {
-        $result = Array();
-        if (!$this->_res) {
-            return $result;
-        }
-        while ($result[] = $this->_res->fetch_assoc());
-        array_pop($result);
-        $this->free();
-        return $result;
-    }
-
-    public function fetchOneAssoc()
-    {
-        $tmp = $this->_fetchAssoc();
-        $this->free();
-        return $tmp;
-    }
-
-    public function fetchOneRow()
-    {
-        $tmp = $this->_fetchRow();
-        $this->free();
-        return $tmp;
-    }
-
-    public function fetchOneCell()
-    {
-        $tmp = $this->_fetchRow();
-        $this->free();
-        return $tmp[0];
-    }
-
-    public function fetchColumn($key = 0)
-    {
-        $res = Array();
-        if (is_numeric($key)) {
-            while($tmp = $this->_fetchRow()) {
-                $res[] = $tmp[$key];
-            }
-        } else {
-            while($tmp = $this->_fetchAssoc()) {
-                $res[] = $tmp[$key];
-            }
-        }
-        $this->free();
-        return $res;
-    }
-
-    public function fetchOneField()
-    {
-        return $this->_res ? $this->_res->fetch_field() : null;
-    }
-
-    public function fetchFields()
-    {
-        $res = array();
-        while ($res[] = $this->fetchOneField());
-        return $res;
-    }
-
-    public function numRows()
-    {
-        return $this->_res ? $this->_res->num_rows : 0;
-    }
-
-    public function fieldCount()
-    {
-        return $this->_res ? $this->_res->field_count : 0;
-    }
-}
-
-require_once dirname(__FILE__) . '/pliterator.php';
-
-class XOrgDBIterator extends XOrgDBResult implements PlIterator
-{
-    private $_result;
-    private $_pos;
-    private $_total;
-    private $_fpos;
-    private $_fields;
-    private $_mode = MYSQL_ASSOC;
-
-    public function __construct($query, $mode = MYSQL_ASSOC)
-    {
-        parent::__construct($query);
-        $this->_pos    = 0;
-        $this->_total  = $this->numRows();
-        $this->_fpost  = 0;
-        $this->_fields = $this->fieldCount();
-        $this->_mode   = $mode;
-    }
-
-    public function next()
-    {
-        $this->_pos ++;
-        if ($this->_pos > $this->_total) {
-            $this->free();
-            unset($this);
-            return null;
-        }
-        return $this->_mode != MYSQL_ASSOC ? $this->_fetchRow() : $this->_fetchAssoc();
-    }
-
-    public function first()
-    {
-        return $this->_pos == 1;
-    }
-
-    public function last()
-    {
-        return $this->_pos == $this->_total;
-    }
-
-    public function total()
-    {
-        return $this->_total;
-    }
-
-    public function nextField()
-    {
-        $this->_fpos++;
-        if ($this->_fpos > $this->_fields) {
-            return null;
-        }
-        return $this->fetchOneField();
-    }
-
-    public function firstField()
-    {
-        return $this->_fpos == 1;
-    }
-
-    public function lastField()
-    {
-        return $this->_fpos == $this->_fields;
-    }
-
-    public function totalFields()
-    {
-        return $this->_fields;
-    }
-}
-
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
-?>
diff --git a/core/classes/xmlrpcclient.php b/core/classes/xmlrpcclient.php
deleted file mode 100644 (file)
index be47a70..0000000
+++ /dev/null
@@ -1,130 +0,0 @@
-<?php
-/***************************************************************************
- *  Copyright (C) 2003-2008 Polytechnique.org                              *
- *  http://opensource.polytechnique.org/                                   *
- *                                                                         *
- *  This program is free software; you can redistribute it and/or modify   *
- *  it under the terms of the GNU General Public License as published by   *
- *  the Free Software Foundation; either version 2 of the License, or      *
- *  (at your option) any later version.                                    *
- *                                                                         *
- *  This program is distributed in the hope that it will be useful,        *
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of         *
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
- *  GNU General Public License for more details.                           *
- *                                                                         *
- *  You should have received a copy of the GNU General Public License      *
- *  along with this program; if not, write to the Free Software            *
- *  Foundation, Inc.,                                                      *
- *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
- ***************************************************************************/
-
-/* taken from : http://fr2.php.net/xml-rpc
- * Author mboeren@php.net
- *
- * Usage:
- * $client = new xmlrpc_client("http://localhost:7080");
- * print $client->echo('x')."\n";
- * print $client->add(1, 3)."\n";
- */
-
-class XmlrpcClient
-{
-    private $url;
-    private $urlparts;
-    public $bt = null;
-
-    public function __construct($url)
-    {
-        $this->url = $url;
-        $this->urlparts = parse_url($this->url);
-
-        if (empty($this->urlparts['port'])) {
-            $this->urlparts['port'] = 80;
-        }
-
-        if (empty($this->urlparts['path'])) {
-            $this->urlparts['path'] = '/';
-        }
-    }
-
-    private function http_post($request)
-    {
-        $host = $path = $port = $user = $pass = null;
-        extract($this->urlparts);
-
-        if ($scheme == 'https') {
-            $host = 'ssl://'.$host;
-        }
-
-        $query_fd    = fsockopen($host, $port, $errno, $errstr, 10);
-        if (!$query_fd)
-            return null;
-
-        $auth = '';
-        if ($user) {
-            $auth = 'Authorization: Basic ' . base64_encode("$user:$pass") . "\r\n";
-        }
-
-        $content_len = strlen($request);
-        $http_request =
-            "POST $path HTTP/1.0\r\n" .
-            $auth .
-            "Content-Type: text/xml\r\n" .
-            "Content-Length: $content_len\r\n" .
-            "Connection: Close\r\n" .
-            "Host: $host:$port\r\n" .
-            "\r\n" .
-            $request;
-
-        fputs($query_fd, $http_request, strlen($http_request));
-
-        $buf = '';
-        while (!feof($query_fd)) {
-            $buf .= fread($query_fd, 8192);
-        }
-
-        fclose($query_fd);
-        return $buf;
-    }
-
-    private function find_and_decode_xml($buf)
-    {
-        $pos = strpos($buf, '<?xml');
-        if ($pos !== false) {
-            return xmlrpc_decode(substr($buf, $pos));
-        }
-        trigger_error("Cannot parse XML\n".$buf);
-    }
-
-    public function __call($method, $args)
-    {
-        $query  = xmlrpc_encode_request($method, $args);
-        if ($this->bt) {
-            $this->bt->start($method . "\n" . var_export($args, true));
-        }
-        $answer = $this->http_post($query, $this->urlparts);
-        if ($this->bt) {
-            $this->bt->stop();
-        }
-        $result = $this->find_and_decode_xml($answer);
-        if ($this->bt) {
-            if (is_array($result) && isset($result['faultCode'])) {
-                $this->bt->update(0, $result['faultString']);
-            } else {
-                $this->bt->update(count($result));
-            }
-        }
-
-        if (is_array($result) && isset($result['faultCode'])) {
-            trigger_error("Error in xmlrpc call $function\n".
-                          "  code   : {$result['faultCode']}\n".
-                          "  message: {$result['faultString']}\n");
-            return null;
-        }
-        return $result;
-    }
-}
-
-// vim:set et sw=4 sts=4 sws=4 enc=utf-8:
-?>
diff --git a/core/include/misc.inc.php b/core/include/misc.inc.php
deleted file mode 100644 (file)
index 3cd88c8..0000000
+++ /dev/null
@@ -1,258 +0,0 @@
-<?php
-/***************************************************************************
- *  Copyright (C) 2003-2008 Polytechnique.org                              *
- *  http://opensource.polytechnique.org/                                   *
- *                                                                         *
- *  This program is free software; you can redistribute it and/or modify   *
- *  it under the terms of the GNU General Public License as published by   *
- *  the Free Software Foundation; either version 2 of the License, or      *
- *  (at your option) any later version.                                    *
- *                                                                         *
- *  This program is distributed in the hope that it will be useful,        *
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of         *
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
- *  GNU General Public License for more details.                           *
- *                                                                         *
- *  You should have received a copy of the GNU General Public License      *
- *  along with this program; if not, write to the Free Software            *
- *  Foundation, Inc.,                                                      *
- *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
- ***************************************************************************/
-
-function quoted_printable_encode($input, $line_max = 76)
-{
-    $lines = preg_split("/(?:\r\n|\r|\n)/", $input);
-    $eol = "\n";
-    $linebreak = "=0D=0A=\n    ";
-    $escape = "=";
-    $output = "";
-
-    foreach ($lines as $j => $line) {
-        $linlen = strlen($line);
-        $newline = "";
-        for($i = 0; $i < $linlen; $i++) {
-            $c = $line{$i};
-            $dec = ord($c);
-            if ( ($dec == 32) && ($i == ($linlen - 1)) ) {
-                // convert space at eol only
-                $c = "=20";
-            } elseif ( ($dec == 61) || ($dec < 32 ) || ($dec > 126) ) {
-                // always encode "\t", which is *not* required
-                $c = $escape.strtoupper(sprintf("%02x",$dec));
-            }
-            if ( (strlen($newline) + strlen($c)) >= $line_max ) { // CRLF is not counted
-                $output .= $newline.$escape.$eol;
-                $newline = "    ";
-            }
-            $newline .= $c;
-        } // end of for
-        $output .= $newline;
-        if ($j<count($lines)-1) $output .= $linebreak;
-    }
-    return trim($output);
-}
-
-/** vérifie si une adresse email convient comme adresse de redirection
- * @param $email l'adresse email a verifier
- * @return BOOL
- */
-function isvalid_email_redirection($email)
-{
-    return isvalid_email($email) &&
-        !preg_match("/@(polytechnique\.(org|edu)|melix\.(org|net)|m4x\.org)$/", $email);
-}
-
-/** genere une chaine aleatoire de 22 caracteres ou moins
- * @param $len longueur souhaitée, 22 par défaut
- * @return la chaine aleatoire qui contient les caractères [A-Za-z0-9+/]
- */
-function rand_token($len = 22)
-{
-    $len = max(2, $len);
-    $len = min(50, $len);
-    $fp = fopen('/dev/urandom', 'r');
-    // $len * 2 is certainly an overkill,
-    // but HEY, reading 40 bytes from /dev/urandom is not that slow !
-    $token = fread($fp, $len * 2);
-    fclose($fp);
-    $token = base64_encode($token);
-    $token = preg_replace("![Il10O+/]!", "", $token);
-    $token = substr($token,0,$len);
-    return $token;
-}
-
-/** genere une chaine aleatoire convenable pour une url
- * @param $len longueur souhaitée, 22 par défaut
- * @return la chaine aleatoire
- */
-function rand_url_id($len = 22)
-{
-    return rand_token($len);
-}
-
-
-/** genere une chaine aleatoire convenable pour un mot de passe
- * @return la chaine aleatoire
- */
-function rand_pass()
-{
-    return rand_token(8);
-}
-
-/** Remove accent from a string and replace them by the nearest letter
- */
-global $lc_convert, $uc_convert;
-$lc_convert = array('é' => 'e', 'è' => 'e', 'ë' => 'e', 'ê' => 'e',
-    'á' => 'a', 'à' => 'a', 'ä' => 'a', 'â' => 'a', 'å' => 'a', 'ã' => 'a',
-    'ï' => 'i', 'î' => 'i', 'ì' => 'i', 'í' => 'i',
-    'ô' => 'o', 'ö' => 'o', 'ò' => 'o', 'ó' => 'o', 'õ' => 'o', 'ø' => 'o',
-    'ú' => 'u', 'ù' => 'u', 'û' => 'u', 'ü' => 'u',
-    'ç' => 'c', 'ñ' => 'n');
-$uc_convert = array('É' => 'E', 'È' => 'E', 'Ë' => 'E', 'Ê' => 'E',
-    'Á' => 'A', 'À' => 'A', 'Ä' => 'A', 'Â' => 'A', 'Å' => 'A', 'Ã' => 'A',
-    'Ï' => 'I', 'Î' => 'I', 'Ì' => 'I', 'Í' => 'I',
-    'Ô' => 'O', 'Ö' => 'O', 'Ò' => 'O', 'Ó' => 'O', 'Õ' => 'O', 'Ø' => 'O',
-    'Ú' => 'U', 'Ù' => 'U', 'Û' => 'U', 'Ü' => 'U',
-    'Ç' => 'C', 'Ñ' => 'N');
-
-function replace_accent($string)
-{
-    global $lc_convert, $uc_convert;
-    $string = strtr($string, $lc_convert);
-    return strtr($string, $uc_convert);
-}
-
-/** creates a username from a first and last name
- *
- * @param $prenom the firstname
- * @param $nom the last name
- *
- * return STRING the corresponding username
- */
-function make_username($prenom,$nom)
-{
-    /* on traite le prenom */
-    $prenomUS=replace_accent(trim($prenom));
-    $prenomUS=stripslashes($prenomUS);
-
-    /* on traite le nom */
-    $nomUS=replace_accent(trim($nom));
-    $nomUS=stripslashes($nomUS);
-
-    // calcul du login
-    $username = strtolower($prenomUS.".".$nomUS);
-    $username = str_replace(" ","-",$username);
-    $username = str_replace("'","",$username);
-    return $username;
-}
-
-/* Un soundex en français posté par Frédéric Bouchery
-   Voici une adaptation en PHP de la fonction soundex2 francisée de Frédéric BROUARD (http://sqlpro.developpez.com/Soundex/).
-   C'est une bonne démonstration de la force des expressions régulières compatible Perl.
-trouvé sur http://expreg.com/voirsource.php?id=40&type=Chaines%20de%20caract%E8res */
-function soundex_fr($sIn)
-{
-    static $convVIn, $convVOut, $convGuIn, $convGuOut, $accents;
-    if (!isset($convGuIn)) {
-        global $uc_convert, $lc_convert;
-        $convGuIn  = array( 'GUI', 'GUE', 'GA', 'GO', 'GU', 'SCI', 'SCE', 'SC', 'CA', 'CO',
-                            'CU', 'QU', 'Q', 'CC', 'CK', 'G', 'ST', 'PH');
-        $convGuOut = array( 'KI', 'KE', 'KA', 'KO', 'K', 'SI', 'SE', 'SK', 'KA', 'KO',
-                            'KU', 'K', 'K', 'K', 'K', 'J', 'T', 'F');
-        $convVIn   = array( '/E?(AU)/', '/([EA])?[UI]([NM])([^EAIOUY]|$)/', '/[AE]O?[NM]([^AEIOUY]|$)/',
-            '/[EA][IY]([NM]?[^NM]|$)/', '/(^|[^OEUIA])(OEU|OE|EU)([^OEUIA]|$)/', '/OI/',
-            '/(ILLE?|I)/', '/O(U|W)/', '/O[NM]($|[^EAOUIY])/', '/(SC|S|C)H/',
-            '/([^AEIOUY1])[^AEIOUYLKTPNR]([UAO])([^AEIOUY])/', '/([^AEIOUY]|^)([AUO])[^AEIOUYLKTP]([^AEIOUY1])/', '/^KN/',
-            '/^PF/', '/C([^AEIOUY]|$)/',
-            '/C/', '/Z$/', '/(?<!^)Z+/', '/ER$/', '/H/', '/W/');
-        $convVOut  = array( 'O', '1\3', 'A\1',
-            'E\1', '\1E\3', 'O',
-            'Y', 'U', 'O\1', '9',
-            '\1\2\3', '\1\2\3', 'N',
-            'F', 'K\1',
-            'S', 'SE', 'S', 'E', '', 'V');
-        $accents = $uc_convert + $lc_convert;
-        $accents['Ç'] = 'S';
-        $accents['¿'] = 'E';
-    }
-    // Si il n'y a pas de mot, on sort immédiatement
-    if ( $sIn === '' ) return '    ';
-    // On supprime les accents
-    $sIn = strtr( $sIn, $accents);
-    // On met tout en minuscule
-    $sIn = strtoupper( $sIn );
-    // On supprime tout ce qui n'est pas une lettre
-    $sIn = preg_replace( '`[^A-Z]`', '', $sIn );
-    // Si la chaîne ne fait qu'un seul caractère, on sort avec.
-    if ( strlen( $sIn ) === 1 ) return $sIn . '   ';
-    // on remplace les consonnances primaires
-    $sIn = str_replace( $convGuIn, $convGuOut, $sIn );
-    // on supprime les lettres répétitives
-    $sIn = preg_replace( '`(.)\1`', '$1', $sIn );
-    // on réinterprète les voyelles
-    $sIn = preg_replace( $convVIn, $convVOut, $sIn);
-    // on supprime les terminaisons T, D, S, X (et le L qui précède si existe)
-    $sIn = preg_replace( '`L?[TDX]S?$`', '', $sIn );
-    // on supprime les E, A et Y qui ne sont pas en première position
-    $sIn = preg_replace( '`(?!^)Y([^AEOU]|$)`', '\1', $sIn);
-    $sIn = preg_replace( '`(?!^)[EA]`', '', $sIn);
-    return substr( $sIn . '    ', 0, 4);
-}
-
-/** met les majuscules au debut de chaque atome du prénom
- * @param $prenom le prénom à formater
- * return STRING le prénom avec les majuscules
- */
-function make_firstname_case($prenom)
-{
-    $prenom = strtolower($prenom);
-    $pieces = explode('-',$prenom);
-
-    foreach ($pieces as $piece) {
-        $subpieces = explode("'",$piece);
-        $usubpieces="";
-        foreach ($subpieces as $subpiece)
-            $usubpieces[] = ucwords($subpiece);
-        $upieces[] = implode("'",$usubpieces);
-    }
-    return implode('-',$upieces);
-}
-
-
-function make_forlife($prenom, $nom, $promo)
-{
-    $prenomUS = replace_accent(trim($prenom));
-    $nomUS    = replace_accent(trim($nom));
-
-    $forlife = strtolower($prenomUS.".".$nomUS.".".$promo);
-    $forlife = str_replace(" ","-",$forlife);
-    $forlife = str_replace("'","",$forlife);
-    return $forlife;
-}
-
-/** Convert ip to uint (to store it in a database)
- */
-function ip_to_uint($ip)
-{
-    $part = explode('.', $ip);
-    if (count($part) != 4) {
-        return null;
-    }
-    $v = 0;
-    $fact = 0x1000000;
-    for ($i = 0 ; $i < 4 ; ++$i) {
-        $v += $fact * $part[$i];
-        $fact >>= 8;
-    }
-    return $v;
-}
-
-/** Convert uint to ip (to build a human understandable ip)
- */
-function uint_to_ip($uint)
-{
-    return long2ip($uint);
-}
-
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
-?>
diff --git a/core/include/platal.inc.php b/core/include/platal.inc.php
deleted file mode 100644 (file)
index 81f4068..0000000
+++ /dev/null
@@ -1,174 +0,0 @@
-<?php
-/***************************************************************************
- *  Copyright (C) 2003-2008 Polytechnique.org                              *
- *  http://opensource.polytechnique.org/                                   *
- *                                                                         *
- *  This program is free software; you can redistribute it and/or modify   *
- *  it under the terms of the GNU General Public License as published by   *
- *  the Free Software Foundation; either version 2 of the License, or      *
- *  (at your option) any later version.                                    *
- *                                                                         *
- *  This program is distributed in the hope that it will be useful,        *
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of         *
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
- *  GNU General Public License for more details.                           *
- *                                                                         *
- *  You should have received a copy of the GNU General Public License      *
- *  along with this program; if not, write to the Free Software            *
- *  Foundation, Inc.,                                                      *
- *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
- ***************************************************************************/
-
-$TIME_BEGIN = microtime(true);
-
-require_once dirname(__FILE__) . '/misc.inc.php';
-
-define('PERMS_EXT',   'ext');
-define('PERMS_USER',  'user');
-define('PERMS_ADMIN', 'admin');
-
-define('SKINNED', 0);
-define('SIMPLE',  1);
-define('NO_SKIN', 2);
-
-define('NO_AUTH', 0);
-define('DO_AUTH', 1);
-define('NO_HTTPS', 2);
-
-function pl_autoload($cls, array $pathes = array())
-{
-    $cls  = strtolower($cls);
-    $basepath = dirname(dirname(dirname(__FILE__)));
-
-    array_unshift($pathes, 'core/classes', 'classes');
-    foreach ($pathes as $path) {
-        if (@include_once "$basepath/$path/$cls.php") {
-            return true;
-        }
-    }
-    return false;
-}
-pl_autoload('Env');
-
-function pl_error_handler($errno, $errstr, $errfile, $errline)
-{
-    static $errortype;
-    if (!error_reporting())
-        return;
-
-    if (!isset($errortype)) {
-        $errortype = array (
-            E_ERROR           => "Error",
-            E_WARNING         => "Warning",
-            E_PARSE           => "Parsing Error",
-            E_NOTICE          => "Notice",
-            E_CORE_ERROR      => "Core Error",
-            E_CORE_WARNING    => "Core Warning",
-            E_COMPILE_ERROR   => "Compile Error",
-            E_COMPILE_WARNING => "Compile Warning",
-            E_USER_ERROR      => "User Error",
-            E_USER_WARNING    => "User Warning",
-            E_USER_NOTICE     => "User Notice",
-            E_STRICT          => "Runtime Notice",
-            E_RECOVERABLE_ERROR => "Recoverable Error"
-        );
-    }
-
-    global $globals;
-    if (isset($globals) && !$globals->debug) {
-        if ($errno == E_NOTICE || $errno == E_USER_NOTICE || $errno == E_STRICT) {
-            return;
-        }
-    }
-
-    $type = isset($errortype[$errno]) ? $errortype[$errno] : $errno;
-    $errstr = utf8_encode(htmlentities($errstr));
-    $GLOBALS['pl_errors'][] =
-        "<div class='phperror'>".
-        "<strong>{$type}</strong> <em>$errstr</em><br />".
-        "<tt>$errfile : $errline</tt>".
-        "</div>";
-}
-
-function pl_clear_errors()
-{
-    unset($GLOBALS['pl_errors']);
-}
-
-function pl_dump_env()
-{
-    echo "<div class='phperror'><pre>";
-    echo "\nSESSION: " . session_id(); var_dump($_SESSION);
-    echo "\nPOST:    "; var_dump($_POST);
-    echo "\nGET:     "; var_dump($_GET);
-    echo "\nCOOKIE:  "; var_dump($_COOKIE);
-    echo "</pre></div>";
-}
-
-function pl_print_errors()
-{
-    if (!empty($GLOBALS['pl_errors'])) {
-        print join("\n", $GLOBALS['pl_errors']);
-    }
-}
-
-set_error_handler('pl_error_handler', E_ALL | E_STRICT);
-register_shutdown_function('pl_print_errors');
-//register_shutdown_function('pl_dump_env');
-
-/** Check if the string is utf8
- */
-function is_utf8($s)
-{
-    return @iconv('utf-8', 'utf-8', $s) == $s;
-}
-
-/** vérifie si une adresse email est bien formatée  * ATTENTION, cette fonction ne doit pas être appelée sur une chaîne ayant subit un addslashes (car elle accepte le "'" qui it alors un "\'"
- * @param $email l'adresse email a verifier
- * @return BOOL  */
-function isvalid_email($email)
-{
-    // la rfc2822 authorise les caractères "a-z", "0-9", "!", "#", "$", "%", "&", "'", "*", "+", "-", "/", "=", "?", "^",  `", "{", "|", "}", "~" aussi bien dans la partie locale que dans le domaine.
-    // Pour la partie locale, on réduit cet ensemble car il n'est pas utilisé.
-    // Pour le domaine, le système DNS limite à [a-z0-9.-], on y ajoute le "_" car il est parfois utilisé.
-    return preg_match("/^[a-z0-9_.'+-]+@[a-z0-9._-]+\.[a-z]{2,6}$/i", $email);
-}
-
-function pl_url($path, $query = null, $fragment = null)
-{
-    global $platal;
-
-    $base = $platal->ns . $path . ($query ? '?'.$query : '');
-    return $fragment ? $base.'#'.$fragment : $base;
-}
-
-function pl_self($n = null) {
-    global $platal;
-    return $platal->pl_self($n);
-}
-
-function http_redirect($fullurl)
-{
-    Platal::session()->close();
-    header('Location: '. $fullurl);
-    exit;
-}
-
-function pl_redirect($path, $query = null, $fragment = null)
-{
-    global $globals;
-    http_redirect($globals->baseurl . '/' . pl_url($path, $query, $fragment));
-}
-
-function pl_entities($text, $mode = ENT_COMPAT)
-{
-    return htmlentities($text, $mode, 'UTF-8');
-}
-
-function pl_entity_decode($text, $mode = ENT_COMPAT)
-{
-    return html_entity_decode($text, $mode, 'UTF-8');
-}
-
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
-?>
diff --git a/core/modules/core.php b/core/modules/core.php
deleted file mode 100644 (file)
index dad9b02..0000000
+++ /dev/null
@@ -1,169 +0,0 @@
-<?php
-/***************************************************************************
- *  Copyright (C) 2003-2008 Polytechnique.org                              *
- *  http://opensource.polytechnique.org/                                   *
- *                                                                         *
- *  This program is free software; you can redistribute it and/or modify   *
- *  it under the terms of the GNU General Public License as published by   *
- *  the Free Software Foundation; either version 2 of the License, or      *
- *  (at your option) any later version.                                    *
- *                                                                         *
- *  This program is distributed in the hope that it will be useful,        *
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of         *
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
- *  GNU General Public License for more details.                           *
- *                                                                         *
- *  You should have received a copy of the GNU General Public License      *
- *  along with this program; if not, write to the Free Software            *
- *  Foundation, Inc.,                                                      *
- *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
- ***************************************************************************/
-
-class CoreModule extends PLModule
-{
-    function handlers()
-    {
-        return array(
-            '403'         => $this->make_hook('403', AUTH_PUBLIC),
-            '404'         => $this->make_hook('404', AUTH_PUBLIC),
-            'login'       => $this->make_hook('login',      AUTH_COOKIE),
-            'send_bug'    => $this->make_hook('bug', AUTH_COOKIE),
-            'purge_cache' => $this->make_hook('purge_cache', AUTH_COOKIE, 'admin'),
-            'kill_sessions' => $this->make_hook('kill_sessions', AUTH_COOKIE, 'admin'),
-            'get_rights'  => $this->make_hook('get_rights', AUTH_MDP, 'admin'),
-
-            'wiki_help'    => $this->make_hook('wiki_help', AUTH_PUBLIC),
-            'wiki_preview' => $this->make_hook('wiki_preview', AUTH_COOKIE, 'user', NO_AUTH),
-
-            'valid.html'  => $this->make_hook('valid', AUTH_PUBLIC),
-            'favicon.ico' => $this->make_hook('favicon', AUTH_PUBLIC),
-            'robots.txt'  => $this->make_hook('robotstxt', AUTH_PUBLIC, 'user', NO_HTTPS),
-        );
-    }
-
-    function handler_valid(&$page)
-    {
-        readfile($page->compile_dir.'/valid.html');
-        exit;
-    }
-
-    function handler_403(&$page)
-    {
-        global $globals;
-        header($_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden');
-        $page->changeTpl('core/403.tpl');
-    }
-
-    function handler_404(&$page)
-    {
-        global $globals, $platal;
-        header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found');
-        $page->changeTpl('core/404.tpl');
-        $page->assign('near', $platal->near_hook());
-    }
-
-    function handler_login(&$page)
-    {
-        $allkeys = func_get_args();
-        unset($allkeys[0]);
-        $url = join('/',$allkeys);
-        pl_redirect($url);
-    }
-
-    function handler_favicon(&$page)
-    {
-        $data = file_get_contents(dirname(__FILE__).'/../htdocs/images/favicon.ico');
-        header('Content-Type: image/x-icon');
-        echo $data;
-        exit;
-    }
-
-    function handler_robotstxt(&$page)
-    {
-        global $globals;
-        if (!$globals->core->restricted_platal) {
-            return PL_NOT_FOUND;
-        }
-
-        header('Content-Type: text/plain');
-        echo "User-agent: *\n";
-        echo "Disallow: /\n";
-        exit;
-    }
-
-    function handler_purge_cache(&$page)
-    {
-        require_once 'wiki.inc.php';
-        S::assert_xsrf_token();
-
-        $page->clear_compiled_tpl();
-        wiki_clear_all_cache();
-
-        http_redirect(empty($_SERVER['HTTP_REFERER']) ? './' : $_SERVER['HTTP_REFERER']);
-    }
-
-    function handler_kill_sessions(&$page)
-    {
-        kill_sessions();
-    }
-
-    function handler_get_rights(&$page, $level)
-    {
-        if (S::has('suid')) {
-            $page->kill('Déjà en SUID');
-        }
-
-        if (isset($_SESSION['log'])) {
-            S::logger()->log("suid_start", "login by ".S::v('forlife'));
-        }
-        Platal::session()->startSUID(S::i('uid'));
-        Platal::session()->makePerms($level);
-
-        pl_redirect('/');
-    }
-
-    function handler_bug(&$page)
-    {
-        global $globals;
-        $page->changeTpl('core/bug.tpl', SIMPLE);
-        $page->addJsLink('close_on_esc.js');
-        if (Env::has('send') && trim(Env::v('detailed_desc'))) {
-            S::assert_xsrf_token();
-
-            $body = wordwrap(Env::v('detailed_desc'), 78) . "\n\n"
-                  . "----------------------------\n"
-                  . "Page        : " . Env::v('page') . "\n\n"
-                  . "Utilisateur : " . S::v('forlife') . "\n"
-                  . "Navigateur  : " . $_SERVER['HTTP_USER_AGENT'] . "\n"
-                  . "Skin        : " . S::v('skin') . "\n";
-            $page->assign('bug_sent',1);
-            $mymail = new PlMailer();
-            $mymail->setFrom('"'.S::v('prenom').' '.S::v('nom').'" <'.S::v('bestalias').'@' . $globals->mail->domain . '>');
-            $mymail->addTo('support+platal@' . $globals->mail->domain);
-            $mymail->addCc('"'.S::v('prenom').' '.S::v('nom').'" <'.S::v('bestalias').'@' . $globals->mail->domain . '>');
-            $mymail->setSubject('Plat/al '.Env::v('task_type').' : '.Env::v('item_summary'));
-            $mymail->setTxtBody($body);
-            $mymail->send();
-        } elseif (Env::has('send')) {
-            $page->trigError("Merci de remplir une explication du problème rencontré");
-        }
-    }
-
-    function handler_wiki_help(&$page, $action = 'title')
-    {
-        $page->changeTpl('core/wiki.help.tpl', SIMPLE);
-        $page->assign('wiki_help', MiniWiki::help($action == 'title'));
-    }
-
-    /// Shared handler for wiki syntax result preview
-    function handler_wiki_preview(&$page, $action = 'title')
-    {
-        header('Content-Type: text/html; charset=utf-8');
-        $text = Get::v('text');
-        echo MiniWiki::wikiToHtml($text, $action == 'title');
-        exit;
-    }
-}
-
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
-?>
diff --git a/core/plugins/block.tidy.php b/core/plugins/block.tidy.php
deleted file mode 100644 (file)
index d74de2f..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-<?php
-/***************************************************************************
- *  Copyright (C) 2003-2008 Polytechnique.org                              *
- *  http://opensource.polytechnique.org/                                   *
- *                                                                         *
- *  This program is free software; you can redistribute it and/or modify   *
- *  it under the terms of the GNU General Public License as published by   *
- *  the Free Software Foundation; either version 2 of the License, or      *
- *  (at your option) any later version.                                    *
- *                                                                         *
- *  This program is distributed in the hope that it will be useful,        *
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of         *
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
- *  GNU General Public License for more details.                           *
- *                                                                         *
- *  You should have received a copy of the GNU General Public License      *
- *  along with this program; if not, write to the Free Software            *
- *  Foundation, Inc.,                                                      *
- *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
- ***************************************************************************/
-
-global $tidy_config;
-$tidy_config = array(
-    'drop-empty-paras' => true,
-    'drop-font-tags' => true,
-    'drop-proprietary-attributes' => true,
-    'hide-comments' => true,
-    'logical-emphasis' => true,
-    'output-xhtml' => true,
-    'replace-color' => true,
-    'show-body-only' => true,
-    'clean' => false,
-    'join-styles' => false,
-    'join-classes' => false,
-    'alt-text' => '[ inserted by TIDY ]',
-    'wrap' => '120');
-
-/*
- * Smarty plugin
- * -------------------------------------------------------------
- * File:     block.min_perms.php
- * Type:     block
- * Name:     min_perms
- * Purpose:
- * -------------------------------------------------------------
- */
-function smarty_block_tidy($params, $content, &$smarty)
-{
-    global $tidy_config;
-    return tidy_repair_string($content, $tidy_config, 'utf8');
-}
-
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
-?>
diff --git a/core/plugins/compiler.checkpasswd.php b/core/plugins/compiler.checkpasswd.php
deleted file mode 100644 (file)
index 2ad19ff..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-<?php
-/***************************************************************************
- *  Copyright (C) 2003-2008 Polytechnique.org                              *
- *  http://opensource.polytechnique.org/                                   *
- *                                                                         *
- *  This program is free software; you can redistribute it and/or modify   *
- *  it under the terms of the GNU General Public License as published by   *
- *  the Free Software Foundation; either version 2 of the License, or      *
- *  (at your option) any later version.                                    *
- *                                                                         *
- *  This program is distributed in the hope that it will be useful,        *
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of         *
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
- *  GNU General Public License for more details.                           *
- *                                                                         *
- *  You should have received a copy of the GNU General Public License      *
- *  along with this program; if not, write to the Free Software            *
- *  Foundation, Inc.,                                                      *
- *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
- ***************************************************************************/
-
-function smarty_compiler_checkpasswd($tag_attrs, &$compiler)
-{
-    extract($compiler->_parse_attrs($tag_attrs));
-    if (!isset($width)) {
-      $width = '230px';
-    }
-    if (!isset($prompt)) {
-      $prompt = "'nouveau'";
-    }
-    if (!isset($submit)) {
-      $submit = "'submitn'";
-    }
-
-    return '?><script type="text/javascript" src="javascript/jquery.js" ></script>
-              <script type="text/javascript" src="javascript/jquery.color.js" ></script>
-              <script type="text/javascript">//<![CDATA[
-                var passwordprompt_name = '.  $prompt . ';
-                var passwordprompt_submit = ' . $submit . ';
-                $(":input[@name=' . $prompt . ']").keyup(function(event) { checkPassword(event.target); });
-                $(document).ready(function() {
-                  checkPassword($(":input[@name=' . $prompt . ']").get(0));
-                });
-              //]]></script>
-              <div>
-                <div style="border: 1px solid white; width: ' . $width . '; height: 7px; background-color: #444; margin-top: 4px; float: left">
-                  <div id="passwords_measure" style="height: 100%; background-color: red; width: 0px"></div>
-                </div>
-                <a href="Xorg/MDP?display=light" style="display: block; float: left; margin-left: 4px;" class="popup_600x800">
-                  <img src="images/icons/information.gif" alt="Aide" title="Comment construire un mot de passe fort..." />
-                </a>
-              </div><?php';
-}
-
-/* vim: set expandtab enc=utf-8: */
-
-?>
diff --git a/core/plugins/compiler.iterate.php b/core/plugins/compiler.iterate.php
deleted file mode 100644 (file)
index 1ab1a01..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-<?php
-/***************************************************************************
- *  Copyright (C) 2003-2008 Polytechnique.org                              *
- *  http://opensource.polytechnique.org/                                   *
- *                                                                         *
- *  This program is free software; you can redistribute it and/or modify   *
- *  it under the terms of the GNU General Public License as published by   *
- *  the Free Software Foundation; either version 2 of the License, or      *
- *  (at your option) any later version.                                    *
- *                                                                         *
- *  This program is distributed in the hope that it will be useful,        *
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of         *
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
- *  GNU General Public License for more details.                           *
- *                                                                         *
- *  You should have received a copy of the GNU General Public License      *
- *  along with this program; if not, write to the Free Software            *
- *  Foundation, Inc.,                                                      *
- *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
- ***************************************************************************/
-
-function iterate_end($tag_attrs, &$compiler) {
-    return 'endwhile;';
-}
-
-function smarty_compiler_iterate($tag_attrs, &$compiler)
-{
-    static $reg = false;
-    if (!$reg) {
-        $reg = true;
-        $compiler->register_compiler_function("/iterate", 'iterate_end');
-    }
-
-    $_params = $compiler->_parse_attrs($tag_attrs);
-
-    if (!isset($_params['from'])) {
-        $compiler->_syntax_error("iterate: missing 'from' parameter", E_USER_ERROR, __FILE__, __LINE__);
-        return;
-    }
-
-    if (empty($_params['item'])) {
-        $compiler->_syntax_error("iterate: missing 'item' attribute", E_USER_ERROR, __FILE__, __LINE__);
-        return;
-    }
-
-    $_from = $compiler->_dequote($_params['from']);
-    $_item = $compiler->_dequote($_params['item']);
-
-    return "\$_iterate_$_item = $_from;\n"
-        .  "while ((\$this->_tpl_vars['$_item'] = \$_iterate_{$_item}->next()) !== null):";
-}
-
-/* vim: set expandtab enc=utf-8: */
-
-?>
diff --git a/core/plugins/compiler.javascript.php b/core/plugins/compiler.javascript.php
deleted file mode 100644 (file)
index e2d3e0f..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-<?php
-/***************************************************************************
- *  Copyright (C) 2003-2008 Polytechnique.org                              *
- *  http://opensource.polytechnique.org/                                   *
- *                                                                         *
- *  This program is free software; you can redistribute it and/or modify   *
- *  it under the terms of the GNU General Public License as published by   *
- *  the Free Software Foundation; either version 2 of the License, or      *
- *  (at your option) any later version.                                    *
- *                                                                         *
- *  This program is distributed in the hope that it will be useful,        *
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of         *
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
- *  GNU General Public License for more details.                           *
- *                                                                         *
- *  You should have received a copy of the GNU General Public License      *
- *  along with this program; if not, write to the Free Software            *
- *  Foundation, Inc.,                                                      *
- *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
- ***************************************************************************/
-
-function smarty_compiler_javascript($tag_attrs, &$compiler)
-{
-    extract($compiler->_parse_attrs($tag_attrs));
-
-    if (!isset($name)) {
-        return null;
-    }
-    $name = pl_entities(trim($name, '\'"'), ENT_QUOTES);
-    $name = "javascript/$name.js";
-    if ($full) {
-        global $globals;
-        $name = $globals->baseurl . '/' . $name;
-    }
-
-    return "?><script type='text/javascript' src='$name'></script><?php";
-}
-
-/* vim: set expandtab enc=utf-8: */
-
-?>
diff --git a/core/plugins/function.select_db_table.php b/core/plugins/function.select_db_table.php
deleted file mode 100644 (file)
index 2bb73f7..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-<?php
-/***************************************************************************
- *  Copyright (C) 2003-2008 Polytechnique.org                              *
- *  http://opensource.polytechnique.org/                                   *
- *                                                                         *
- *  This program is free software; you can redistribute it and/or modify   *
- *  it under the terms of the GNU General Public License as published by   *
- *  the Free Software Foundation; either version 2 of the License, or      *
- *  (at your option) any later version.                                    *
- *                                                                         *
- *  This program is distributed in the hope that it will be useful,        *
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of         *
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
- *  GNU General Public License for more details.                           *
- *                                                                         *
- *  You should have received a copy of the GNU General Public License      *
- *  along with this program; if not, write to the Free Software            *
- *  Foundation, Inc.,                                                      *
- *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
- ***************************************************************************/
-
-function select_options($table,$valeur,$champ="text",$pad=false,
-                        $where="",$join="",$group="")
-{
-    $fields = 't.id,' . $champ;
-    $order = $champ;
-    if ($group) {
-        $fields .= ',' . $group;
-        $order = $group . ',' . $order;
-    }
-    $sql = "SELECT $fields FROM $table AS t $join $where ORDER BY $order";
-    $res = XDB::iterRow($sql);
-    $sel = ' selected="selected"';
-
-    // on ajoute une entree vide si $pad est vrai
-    $html = "";
-    if ($pad) {
-        $html.= '<option value="0"'.($valeur==0?$sel:"")."></option>\n";
-    }
-    $optgrp = null;
-    while (list($my_id,$my_text,$my_grp) = $res->next()) {
-        if ($my_grp != $optgrp) {
-            if (!is_null($optgrp)) {
-                $html .= '</optgroup>';
-            }
-            $html .= '<optgroup label="' . pl_entities($my_grp, ENT_QUOTES) . '">';
-            $optgrp = $my_grp;
-        }
-        $html .= sprintf("<option value=\"%s\" %s>%s</option>\n",
-                         $my_id, $valeur==$my_id ? $sel : "", pl_entities($my_text));
-    }
-    if (!is_null($optgrp)) {
-        $html .= '</optgroup>';
-    }
-    return $html;
-}
-
-function smarty_function_select_db_table($params, &$smarty) {
-    if(empty($params['table']))
-        return;
-    if(empty($params['champ']))
-        $params['champ'] = 'text';
-    if(empty($params['pad']) || !($params['pad']))
-        $pad = false;
-    else
-        $pad = true;
-    if(empty($params['where']))
-        $params['where'] = '';
-    return select_options($params['table'], $params['valeur'], $params['champ'], $pad,
-                          $params['where'], $params['join'], $params['group']);
-}
-
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
-?>
diff --git a/core/plugins/function.valid_date.php b/core/plugins/function.valid_date.php
deleted file mode 100644 (file)
index fbda218..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-<?php
-/***************************************************************************
- *  Copyright (C) 2003-2008 Polytechnique.org                              *
- *  http://opensource.polytechnique.org/                                   *
- *                                                                         *
- *  This program is free software; you can redistribute it and/or modify   *
- *  it under the terms of the GNU General Public License as published by   *
- *  the Free Software Foundation; either version 2 of the License, or      *
- *  (at your option) any later version.                                    *
- *                                                                         *
- *  This program is distributed in the hope that it will be useful,        *
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of         *
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
- *  GNU General Public License for more details.                           *
- *                                                                         *
- *  You should have received a copy of the GNU General Public License      *
- *  along with this program; if not, write to the Free Software            *
- *  Foundation, Inc.,                                                      *
- *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
- ***************************************************************************/
-
-function smarty_function_valid_date($params, &$smarty)
-{
-    extract($params);
-
-    if (!isset($name)) {
-        $name = 'valid_date';
-    }
-    $text = "<select name=\"$name\">";
-    if (!isset($from)) {
-        $from = 1;
-    }
-    if (!isset($to)) {
-        $to = 30;
-    }
-    $value = strtr($value, array('-' => ''));
-    $time = time() + 3600 * 24 * $from;
-    $mth  = '';
-    for ($i = $from ; $i <= $to ; $i++) {
-        $p_stamp = date('Ymd', $time);
-        $date    = date('d / m / Y', $time);
-        $select  = ($p_stamp == $value) ? 'selected="selected"' : '';
-        $month   = pl_entities(strftime('%B', $time), ENT_QUOTES);
-        if ($mth != $month) {
-            if ($i != $from) {
-                $text .= '</optgroup>';
-            }
-            $text .= "<optgroup label=\"$month\">";
-            $mth = $month;
-        }
-        $time += 3600 * 24;
-        $text .= "<option value=\"$p_stamp\" $select>$date</option>";
-    }
-    return $text . "</optgroup></select>";
-}
-
-/* vim: set expandtab enc=utf-8: */
-?>
diff --git a/core/plugins/function.xsrf_token.php b/core/plugins/function.xsrf_token.php
deleted file mode 100644 (file)
index caa0a10..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-<?php
-/***************************************************************************
- *  Copyright (C) 2003-2008 Polytechnique.org                              *
- *  http://opensource.polytechnique.org/                                   *
- *                                                                         *
- *  This program is free software; you can redistribute it and/or modify   *
- *  it under the terms of the GNU General Public License as published by   *
- *  the Free Software Foundation; either version 2 of the License, or      *
- *  (at your option) any later version.                                    *
- *                                                                         *
- *  This program is distributed in the hope that it will be useful,        *
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of         *
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
- *  GNU General Public License for more details.                           *
- *                                                                         *
- *  You should have received a copy of the GNU General Public License      *
- *  along with this program; if not, write to the Free Software            *
- *  Foundation, Inc.,                                                      *
- *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
- ***************************************************************************/
-
-function smarty_function_xsrf_token($params, &$smarty) {
-    return S::v('xsrf_token', '');
-}
-
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
-?>
diff --git a/core/plugins/function.xsrf_token_field.php b/core/plugins/function.xsrf_token_field.php
deleted file mode 100644 (file)
index 8eb2430..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-<?php
-/***************************************************************************
- *  Copyright (C) 2003-2008 Polytechnique.org                              *
- *  http://opensource.polytechnique.org/                                   *
- *                                                                         *
- *  This program is free software; you can redistribute it and/or modify   *
- *  it under the terms of the GNU General Public License as published by   *
- *  the Free Software Foundation; either version 2 of the License, or      *
- *  (at your option) any later version.                                    *
- *                                                                         *
- *  This program is distributed in the hope that it will be useful,        *
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of         *
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
- *  GNU General Public License for more details.                           *
- *                                                                         *
- *  You should have received a copy of the GNU General Public License      *
- *  along with this program; if not, write to the Free Software            *
- *  Foundation, Inc.,                                                      *
- *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
- ***************************************************************************/
-
-function smarty_function_xsrf_token_field($params, &$smarty) {
-    if (S::has('xsrf_token')) {
-        return '<input type="hidden" name="token" value="' . S::v('xsrf_token') . '" />';
-    }
-    return '';
-}
-
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
-?>
diff --git a/core/plugins/modifier.date_format.php b/core/plugins/modifier.date_format.php
deleted file mode 100644 (file)
index 7714f16..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-<?php
-/***************************************************************************
- *  Copyright (C) 2003-2008 Polytechnique.org                              *
- *  http://opensource.polytechnique.org/                                   *
- *                                                                         *
- *  This program is free software; you can redistribute it and/or modify   *
- *  it under the terms of the GNU General Public License as published by   *
- *  the Free Software Foundation; either version 2 of the License, or      *
- *  (at your option) any later version.                                    *
- *                                                                         *
- *  This program is distributed in the hope that it will be useful,        *
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of         *
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
- *  GNU General Public License for more details.                           *
- *                                                                         *
- *  You should have received a copy of the GNU General Public License      *
- *  along with this program; if not, write to the Free Software            *
- *  Foundation, Inc.,                                                      *
- *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
- ***************************************************************************/
-
-function smarty_modifier_date_format($string, $format = '%x', $default_date=null)
-{
-    $d = empty($string) ? $default_date : $string;
-    if (empty($format) || preg_match('/^[ 0\-]*$/', $d)) return;
-    $f = str_replace('%X', '%T', str_replace('%x', '%e %B %Y', $format));
-
-    if (preg_match('/^\d{14}$/', $d)) {
-        $t = mktime(substr($d,8,2), substr($d,10,2), substr($d,12,2), substr($d,4,2), substr($d,6,2), substr($d,0,4));
-    } elseif (preg_match('/^\d{8}$/', $d)) {
-        $t = mktime(0, 0, 0, substr($d,4,2), substr($d,6,2), substr($d,0,4));
-    } elseif (is_numeric($d)) {
-        $t = intval($d);
-    } else {
-        $t = strtotime($d);
-    }
-
-    if ( $t != -1 ) {
-        return strftime($f , $t);
-    } else {
-        require_once('Date.php');
-        $date = new Date($d);
-        return $date->format($f);
-    }
-}
-
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
-?>
diff --git a/core/plugins/modifier.htmlentities.php b/core/plugins/modifier.htmlentities.php
deleted file mode 100644 (file)
index a81af32..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-<?php
-/***************************************************************************
- *  Copyright (C) 2003-2008 Polytechnique.org                              *
- *  http://opensource.polytechnique.org/                                   *
- *                                                                         *
- *  This program is free software; you can redistribute it and/or modify   *
- *  it under the terms of the GNU General Public License as published by   *
- *  the Free Software Foundation; either version 2 of the License, or      *
- *  (at your option) any later version.                                    *
- *                                                                         *
- *  This program is distributed in the hope that it will be useful,        *
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of         *
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
- *  GNU General Public License for more details.                           *
- *                                                                         *
- *  You should have received a copy of the GNU General Public License      *
- *  along with this program; if not, write to the Free Software            *
- *  Foundation, Inc.,                                                      *
- *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
- ***************************************************************************/
-
-function smarty_modifier_htmlentities($string, $format = ENT_COMPAT)
-{
-    return pl_entities($string, $format);
-}
-
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
-?>
diff --git a/core/plugins/modifier.miniwiki.php b/core/plugins/modifier.miniwiki.php
deleted file mode 100644 (file)
index 9b7418e..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-<?php
-/***************************************************************************
- *  Copyright (C) 2003-2008 Polytechnique.org                              *
- *  http://opensource.polytechnique.org/                                   *
- *                                                                         *
- *  This program is free software; you can redistribute it and/or modify   *
- *  it under the terms of the GNU General Public License as published by   *
- *  the Free Software Foundation; either version 2 of the License, or      *
- *  (at your option) any later version.                                    *
- *                                                                         *
- *  This program is distributed in the hope that it will be useful,        *
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of         *
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
- *  GNU General Public License for more details.                           *
- *                                                                         *
- *  You should have received a copy of the GNU General Public License      *
- *  along with this program; if not, write to the Free Software            *
- *  Foundation, Inc.,                                                      *
- *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
- ***************************************************************************/
-
-function smarty_modifier_miniwiki($string, $format = 'no_title')
-{
-    return MiniWiki::wikiToHTML($string, $format == 'title');
-}
-
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
-?>
diff --git a/core/plugins/modifier.number_format.php b/core/plugins/modifier.number_format.php
deleted file mode 100644 (file)
index 4b09833..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-<?php
-/***************************************************************************
- *  Copyright (C) 2003-2008 Polytechnique.org                              *
- *  http://opensource.polytechnique.org/                                   *
- *                                                                         *
- *  This program is free software; you can redistribute it and/or modify   *
- *  it under the terms of the GNU General Public License as published by   *
- *  the Free Software Foundation; either version 2 of the License, or      *
- *  (at your option) any later version.                                    *
- *                                                                         *
- *  This program is distributed in the hope that it will be useful,        *
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of         *
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
- *  GNU General Public License for more details.                           *
- *                                                                         *
- *  You should have received a copy of the GNU General Public License      *
- *  along with this program; if not, write to the Free Software            *
- *  Foundation, Inc.,                                                      *
- *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
- ***************************************************************************/
-
-function smarty_modifier_number_format($string, $decimal = 0)
-{
-    return number_format($string, $decimal, ',', '.');
-}
-
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
-?>
diff --git a/core/plugins/modifier.uint_to_ip.php b/core/plugins/modifier.uint_to_ip.php
deleted file mode 100644 (file)
index a7076fa..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-<?php
-/***************************************************************************
- *  Copyright (C) 2003-2008 Polytechnique.org                              *
- *  http://opensource.polytechnique.org/                                   *
- *                                                                         *
- *  This program is free software; you can redistribute it and/or modify   *
- *  it under the terms of the GNU General Public License as published by   *
- *  the Free Software Foundation; either version 2 of the License, or      *
- *  (at your option) any later version.                                    *
- *                                                                         *
- *  This program is distributed in the hope that it will be useful,        *
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of         *
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
- *  GNU General Public License for more details.                           *
- *                                                                         *
- *  You should have received a copy of the GNU General Public License      *
- *  along with this program; if not, write to the Free Software            *
- *  Foundation, Inc.,                                                      *
- *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
- ***************************************************************************/
-
-function smarty_modifier_uint_to_ip($string)
-{
-    return uint_to_ip($string);
-}
-
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
-?>