From: dj3c1t
Date: Fri, 30 Nov 2012 22:29:28 +0000 (+0100)
Subject: import mtweb.0.4.1
X-Git-Tag: mtweb.0.4.1
X-Git-Url: http://git.dj3c1t.com/index.cgi?a=commitdiff_plain;h=19b8f3b9263210d9154e7556446e903f84175519;p=mtweb
import mtweb.0.4.1
---
19b8f3b9263210d9154e7556446e903f84175519
diff --git a/readme.txt b/readme.txt
new file mode 100644
index 0000000..87d4bf6
--- /dev/null
+++ b/readme.txt
@@ -0,0 +1,107 @@
+
+ mtweb 0.4.1
+
+copyright dj3c1t 2011
+programme en GNU/GPLv3
+
+
+mtweb est une base de programmation pour application web.
+
+
+ce programme utilise, dans le dossier libs :
+
+ - TinyMCE
+ http://tinymce.moxiecode.com/
+
+ - une classe Php sxml, tres utile, et trouvee ici :
+ http://www.shop24-7.info/32-0-simplexml-alternative-php4.html
+
+ - Ptitcaptcha, une classe Php pour un captcha (anti-spam)
+ http://www.jpfox.fr/?post/2007/10/24/190-un-petit-captcha-en-php
+
+ - InputFilter, une class Php pour filtrer les balises et les attributs
+ HTML dangereux dans les description des sources
+ http://www.phpclasses.org/inputfilter
+
+installation :
+--------------
+
+installation rapide :
+
+ - l'archive mtweb.tar.gz contient un dossier "web"
+ - uploadez le contenu de ce dossier a la racine de votre site
+ - assurez-vous que Php a le droit d'ecrire dans le dossier "content"
+ (et dans ses fichiers et sous-dossiers)
+
+Par defaut, mtweb stocke ses donnees dans des fichiers XML.
+
+pour utilisez le stockage des donnees avec MySql :
+
+ - importez les tables fournies dans le fichier "content/data/sql/mysql/mtweb.sql"
+ - puis dans le fichier "config.php" :
+ - commentez la partie relative aux donnees XML
+ - decommentez la partie relative aux donnees MySql
+ - adaptez les informations pour MySql avec vos parametres de connexion
+
+pour une premiere utilisation, vous pouvez vous identifier avec :
+
+login: admin
+pass: adminpass
+
+pensez a changer le mot de passe
+
+
+documentation :
+---------------
+
+Plus d'infos en ligne :
+http://mtweb.dj3c1t.com
+
+
+historique des modifications :
+------------------------------
+
+0.4.1 :
+-------
+
+3 Janv 2012
+
+la version 0.4, qui introduit les plugins, en contient trois
+dans son repertoire "plugins".
+
+dans cette version, seule l'application principale est fournie.
+
+les plugins restent disponibles, mais via leur propre archive.
+
+
+0.4 :
+-----
+
+30 Dec 2011
+
+version extraite de sourceML.0.13
+
+ajout d'un systeme de plugins
+l'appli gere aussi maintenant une arborescence de liens
+
+changement de methode pour les surcharges. le dossier "app/local"
+disparait et le contenu du dossier "app/core" descent dans "app/"
+les surcharges se font maintenant avec les plugins.
+
+
+0.3.2 :
+-------
+
+Utilisation d'un cache en RAM pour les donnees gerees en XML.
+
+0.3.1 :
+-------
+
+Ajout d'un exemple d'application, pour un agenda en ligne.
+
+0.3 :
+-----
+
+Cette version a ete extraite de la dernier version de sourceML (sourceML.0.10)
+
+marche avec Mysql ou XML
diff --git a/web/.htaccess b/web/.htaccess
new file mode 100644
index 0000000..7efd22b
--- /dev/null
+++ b/web/.htaccess
@@ -0,0 +1,7 @@
+# ------------------------------------------------------------------------------------
+# le template par defaut de mtweb utilise les "short tags" php pour l'affichage, dans
+# les fichiers php du dossier "out". Si ces "short tags" ne sont pas disponibles par
+# defaut sur votre hebergement, essayez en decommentant la ligne suivante.
+# ------------------------------------------------------------------------------------
+
+# php_value short_open_tag On
diff --git a/web/app/config.xml b/web/app/config.xml
new file mode 100644
index 0000000..b862223
--- /dev/null
+++ b/web/app/config.xml
@@ -0,0 +1,23 @@
+
+
+
+
+ #--
+
+
+
+ 1
+
+
+
+ e
+ id
+ user
+ status
+ from
+ start
+ alpha
+
+
+
+
\ No newline at end of file
diff --git a/web/app/data/impl/mw_mysql.php b/web/app/data/impl/mw_mysql.php
new file mode 100644
index 0000000..22bd3ce
--- /dev/null
+++ b/web/app/data/impl/mw_mysql.php
@@ -0,0 +1,87 @@
+EXTENTION_OK; }
+
+ function mw_mysql($host, $base, $user, $password)
+ { $this->host = $host;
+ $this->base = $base;
+ $this->user = $user;
+ $this->password = $password;
+ $this->EXTENTION_OK = function_exists("mysql_connect");
+ }
+
+ function connect($host, $base, $user, $password)
+ { $this->link = @mysql_connect($host, $user, $password);
+ if(!$this->link) return null;
+ @mysql_query("SET NAMES 'utf8'");
+ if($base)
+ { $connected = @mysql_select_db($base, $this->link);
+ if(!$connected) return null;
+ }
+ return true;
+ }
+
+ function select_db($db_name)
+ { $this->base = $db_name;
+ if(!$this->link)
+ { if(!$this->connect($this->host, $this->base, $this->user, $this->password)) return null;
+ }
+ return $this->query("USE ".$db_name);
+ }
+
+ function table_exists($table_name)
+ { $sql = "SHOW TABLES LIKE '".$table_name."'";
+ $rst = $this->query($sql);
+ if(isset($rst))
+ { $exists = false;
+ $v_rst = $this->fetch_assoc($rst);
+ if($v_rst) $exists = true;
+ $this->free_result($rst);
+ return $exists;
+ }
+ return null;
+ }
+
+ function query($query_string)
+ { if(!$this->link)
+ { if(!$this->connect($this->host, $this->base, $this->user, $this->password)) return null;
+ }
+ $result = @mysql_query($query_string, $this->link);
+ if(!$result) return null;
+ return $result;
+ }
+
+ function fetch_assoc($rst)
+ { if($rst && $this->link) return mysql_fetch_assoc($rst);
+ return null;
+ }
+
+ function insert_id()
+ { if($this->link) return mysql_insert_id($this->link);
+ return null;
+ }
+
+ function free_result($rst)
+ { if($rst && $this->link) return mysql_free_result($rst);
+ return null;
+ }
+
+ function close()
+ { if($this->link) return mysql_close($this->link);
+ return null;
+ }
+
+ }
+
+?>
\ No newline at end of file
diff --git a/web/app/data/impl/mw_xml.php b/web/app/data/impl/mw_xml.php
new file mode 100644
index 0000000..b454cdd
--- /dev/null
+++ b/web/app/data/impl/mw_xml.php
@@ -0,0 +1,180 @@
+init_xml_env($host, $base, $user, $password);
+ $this->EXTENTION_OK = true;
+ }
+
+ function extention_ok(&$env)
+ { if($this->EXTENTION_OK)
+ { if
+ ( file_exists($env->app_file("data/impl/xml/mw_xml_data.php"))
+ && file_exists($env->app_file("data/impl/xml/mw_xml_data_handler.php"))
+ )
+ { require $env->app_file("data/impl/xml/mw_xml_data.php");
+ require $env->app_file("data/impl/xml/mw_xml_data_handler.php");
+ if
+ ( class_exists("mw_xml_data")
+ && class_exists("mw_xml_data_handler")
+ )
+ { $this->xml_data = new mw_xml_data($this->host, $this->base);
+ }
+ else $this->EXTENTION_OK = false;
+ }
+ else $this->EXTENTION_OK = false;
+ }
+ return $this->EXTENTION_OK;
+ }
+
+ function init_xml_env($host, $base, $user, $password)
+ { $this->host = $host.($host && substr($host, -1) != "/" ? "/" : "");
+ $this->base = $base.($base && substr($base, -1) != "/" ? "/" : "");
+ $this->user = $user;
+ $this->password = $password;
+ $this->data_handlers = array();
+ $this->last_data_handler = 0;
+ }
+
+ function connect($host, $base, $user, $password)
+ { if($host.$base && is_dir($host.$base) && is_writable($host.$base))
+ { $this->init_xml_env($host, $base, $user, $password);
+ $this->xml_data = new mw_xml_data($this->host, $this->base);
+ return true;
+ }
+ return null;
+ }
+
+ function select_db($base)
+ { $this->base = $base.($base && substr($base, -1) != "/" ? "/" : "");
+ return $this->connect($this->host, $this->base, $this->user, $this->password);
+ }
+
+ function data_exists($data_path)
+ { return is_dir($this->host.$this->base.$data_path);
+ }
+
+ function create_data($data_path)
+ { if(!is_dir($this->host.$this->base.$data_path)) @mkdir($this->host.$this->base.$data_path);
+ if(is_dir($this->host.$this->base.$data_path))
+ { if($dh = $this->open_data($data_path, false))
+ { $this->close_data($dh);
+ return true;
+ }
+ }
+ return null;
+ }
+
+ function get_data($data_path, $data_id)
+ { $dh = ++$this->last_data_handler;
+ $this->data_handlers[$dh] = new mw_xml_data_handler($this->xml_data, $data_path);
+ if($this->data_handlers[$dh]->open_data(false))
+ { $res = $this->data_handlers[$dh]->get_data($data_id);
+ $this->close_data($dh);
+ return $res;
+ }
+ return null;
+ }
+
+ function open_data($data_path, $FETCH = true)
+ { $dh = ++$this->last_data_handler;
+ $this->data_handlers[$dh] = new mw_xml_data_handler($this->xml_data, $data_path);
+ if($this->data_handlers[$dh]->open_data($FETCH))
+ { return $dh;
+ }
+ $this->close_data($dh);
+ return null;
+ }
+
+ function fetch_data($dh)
+ { if(isset($this->data_handlers[$dh]))
+ { return $this->data_handlers[$dh]->fetch_assoc();
+ }
+ return false;
+ }
+
+ function add_data($data_path, $data)
+ { $dh = ++$this->last_data_handler;
+ $this->data_handlers[$dh] = new mw_xml_data_handler($this->xml_data, $data_path);
+ if($this->data_handlers[$dh]->open_data(false))
+ { $res = $this->data_handlers[$dh]->add_data($data);
+ if($res) $res = $this->last_index($dh);
+ $this->close_data($dh);
+ return $res;
+ }
+ return null;
+ }
+
+ function last_index($dh)
+ { if(isset($this->data_handlers[$dh]))
+ { return $this->data_handlers[$dh]->last_index;
+ }
+ return null;
+ }
+
+ function set_data($data_path, $data_id, $data)
+ { $dh = ++$this->last_data_handler;
+ $this->data_handlers[$dh] = new mw_xml_data_handler($this->xml_data, $data_path);
+ if($this->data_handlers[$dh]->open_data(false))
+ { $res = $this->data_handlers[$dh]->set_data($data_id.".xml", $data);
+ $this->close_data($dh);
+ return $res;
+ }
+ return null;
+ }
+
+ function del_data($data_path, $data_id)
+ { $dh = ++$this->last_data_handler;
+ $this->data_handlers[$dh] = new mw_xml_data_handler($this->xml_data, $data_path);
+ if($this->data_handlers[$dh]->open_data(false))
+ { $res = $this->data_handlers[$dh]->del_data($data_id.".xml");
+ $this->close_data($dh);
+ return $res;
+ }
+ return null;
+ }
+
+ function close_data($dh)
+ { if(isset($this->data_handlers[$dh]))
+ { $this->data_handlers[$dh]->close_data();
+ unset($this->data_handlers[$dh]);
+ }
+ }
+
+ function remove_data($data_path)
+ { $OK = strlen($data_path) > 0;
+ if($OK && is_dir($this->host.$this->base.$data_path) && is_writable($this->host.$this->base.$data_path))
+ { $data_path .= substr($data_path, -1) == "/" ? "" : "/";
+ if($dh = opendir($this->host.$this->base.$data_path))
+ { while($OK && ($file = readdir($dh)) !== false)
+ { if(is_dir($this->host.$this->base.$data_path.$file))
+ { if($file != "." && $file != "..") $OK = $this->remove_data($data_path.$file);
+ }
+ else $OK = @unlink($this->host.$this->base.$data_path.$file);
+ }
+ closedir($dh);
+ }
+ else $OK = null;
+ }
+ else $OK = null;
+ if($OK) @rmdir($this->host.$this->base.$data_path);
+ return $OK;
+ }
+
+ }
+
+?>
\ No newline at end of file
diff --git a/web/app/data/impl/xml/mw_xml_data.php b/web/app/data/impl/xml/mw_xml_data.php
new file mode 100644
index 0000000..628c0d2
--- /dev/null
+++ b/web/app/data/impl/xml/mw_xml_data.php
@@ -0,0 +1,105 @@
+host = $host.(substr($host, -1) != "/" ? "/" : "");
+ $this->base = $base.(substr($base, -1) != "/" ? "/" : "");
+ $this->cache = array();
+ }
+
+ function host() { return $this->host; }
+ function base() { return $this->base; }
+
+ function use_cache() { return true; }
+
+ function set_cache($data_name, $data, $data_id)
+ { if($this->use_cache())
+ { $this->cache[$data_name] = $data;
+ $this->cache[$data_name]["id"] = $data_id;
+ }
+ }
+
+ function get_data($data_path, $data_id)
+ { $data_name = $this->data_name($data_path, $data_id);
+ if(isset($this->cache[$data_name])) return $this->cache[$data_name];
+ if($this->buffer = @file_get_contents($data_name))
+ { if(($data = $this->parse_data()) !== false)
+ { $this->set_cache($data_name, $data, $data_id);
+ $data["id"] = $data_id;
+ return $data;
+ }
+ }
+ return false;
+ }
+
+ function add_data($data_path, $data_id, $data)
+ { return $this->_set_data($data_path, $data_id, $data);
+ }
+
+ function set_data($data_path, $data_id, $data)
+ { return $this->_set_data($data_path, $data_id, $data);
+ }
+
+ function _set_data($data_path, $data_id, $data)
+ { if($fh = @fopen($this->data_name($data_path, $data_id), "w"))
+ { $this->buffer = $this->serialize_data($data);
+ if(@fwrite($fh, $this->buffer) !== false)
+ { @fclose($fh);
+ $this->buffer = null;
+ $data_name = $this->data_name($data_path, $data_id);
+ $this->set_cache($data_name, $data, $data_id);
+ return $data_id;
+ }
+ else
+ { @fclose($fh);
+ $this->buffer = null;
+ }
+ }
+ return null;
+ }
+
+ function del_data($data_path, $data_id)
+ { $data_name = $this->data_name($data_path, $data_id);
+ if(isset($this->cache[$data_name])) unset($this->cache[$data_name]);
+ return @unlink($this->data_name($data_path, $data_id));
+ }
+
+ function data_name($data_path, $data_id)
+ { return $this->host.$this->base.$data_path.$data_id.".xml";
+ }
+
+ function parse_data()
+ { if(!isset($this->sxml)) $this->sxml = new sxml();
+ $this->sxml->parse($this->buffer);
+ if(isset($this->sxml->data["tuple"][0]))
+ { $this->buffer = $this->sxml->data["tuple"][0];
+ $v_rst = array();
+ foreach($this->buffer["subs"] as $key => $value)
+ { $v_rst[$key] = $value[0]["data"];
+ }
+ return $v_rst;
+ }
+ return false;
+ }
+
+ function serialize_data($data)
+ { $this->buffer = "\n";
+ foreach($data as $key => $value)
+ { if(isset($value)) $this->buffer .= " <".$key.">".$key.">\n";
+ }
+ $this->buffer .= "\n";
+ return $this->buffer;
+ }
+
+ }
+
+?>
\ No newline at end of file
diff --git a/web/app/data/impl/xml/mw_xml_data_handler.php b/web/app/data/impl/xml/mw_xml_data_handler.php
new file mode 100644
index 0000000..fb9e267
--- /dev/null
+++ b/web/app/data/impl/xml/mw_xml_data_handler.php
@@ -0,0 +1,128 @@
+xml_data = $xml_data;
+ $this->data_path = $data_path.(substr($data_path, -1) != "/" ? "/" : "");
+ }
+
+ function get_data($data_id)
+ { if(file_exists($this->xml_data->host().$this->xml_data->base().$this->data_path.$data_id.".xml"))
+ { return $this->xml_data->get_data($this->data_path, $data_id);
+ }
+ return false;
+ }
+
+ function open_data($FETCH = true)
+ { clearstatcache();
+ $INDEX_OK = false;
+ if($this->xml_data->host() && $this->xml_data->base() && $this->data_path)
+ { if(is_dir($this->xml_data->host().$this->xml_data->base().$this->data_path) && is_writable($this->xml_data->host().$this->xml_data->base().$this->data_path))
+ { if(!file_exists($this->xml_data->host().$this->xml_data->base().$this->data_path.".index"))
+ { if($fh = @fopen($this->xml_data->host().$this->xml_data->base().$this->data_path.".index", "w+"))
+ { if(@fwrite($fh, "0"))
+ { $this->last_index = 0;
+ @fclose($fh);
+ $INDEX_OK = true;
+ }
+ else @fclose($fh);
+ }
+ }
+ else
+ { if(($this->buffer = @file_get_contents($this->xml_data->host().$this->xml_data->base().$this->data_path.".index")) !== false)
+ { if(preg_match("/^[0-9]+$/", $this->buffer))
+ { $this->last_index = (int)$this->buffer;
+ $INDEX_OK = true;
+ }
+ }
+ }
+ }
+ }
+ if($INDEX_OK)
+ { if($FETCH)
+ { if($this->data_path_handler = @opendir($this->xml_data->host().$this->xml_data->base().$this->data_path))
+ { return true;
+ }
+ else
+ { $this->close_data();
+ return null;
+ }
+ }
+ else return true;
+ }
+ else
+ { $this->close_data();
+ return null;
+ }
+ }
+
+ function fetch_assoc()
+ { if($this->data_path_handler)
+ { $FORMAT_OK = false;
+ while(!$FORMAT_OK && ($data_file = @readdir($this->data_path_handler)) !== false)
+ { if(substr($data_file, 0, 1) != "." && substr($data_file, -4) == ".xml") $FORMAT_OK = true;
+ }
+ if($FORMAT_OK) return $this->xml_data->get_data($this->data_path, substr($data_file, 0, -4));
+ }
+ return false;
+ }
+
+ function add_data($data)
+ { $index = $this->inc_index();
+ if(isset($index))
+ { if(is_array($data)) return $this->xml_data->add_data($this->data_path, $index, $data);
+ }
+ return null;
+ }
+
+ function inc_index()
+ { clearstatcache();
+ if(isset($this->last_index))
+ { $index = $this->last_index + 1;
+ if($fh = @fopen($this->xml_data->host().$this->xml_data->base().$this->data_path.".index", "w+"))
+ { if(@fwrite($fh, (string)$index))
+ { $this->last_index = $index;
+ @fclose($fh);
+ return $index;
+ }
+ else @fclose($fh);
+ }
+ }
+ return null;
+ }
+
+ function set_data($data_file, $data)
+ { if(preg_match("/^[0-9]+\.xml$/", $data_file))
+ { if(is_writable($this->xml_data->host().$this->xml_data->base().$this->data_path.$data_file))
+ { if(is_array($data))
+ { return $this->xml_data->set_data($this->data_path, substr($data_file, 0, -4), $data);
+ }
+ }
+ }
+ return null;
+ }
+
+ function del_data($data_file)
+ { if(preg_match("/^[0-9]+\.xml$/", $data_file))
+ { if(is_file($this->xml_data->host().$this->xml_data->base().$this->data_path.$data_file))
+ { return $this->xml_data->del_data($this->data_path, substr($data_file, 0, -4));
+ }
+ }
+ return null;
+ }
+
+ function close_data()
+ { $this->data_path= null;
+ if($this->data_path_handler) @closedir($this->data_path_handler);
+ $this->last_index = null;
+ }
+
+ }
+
+?>
\ No newline at end of file
diff --git a/web/app/data/modules/share/mw_data_check_instance.php b/web/app/data/modules/share/mw_data_check_instance.php
new file mode 100644
index 0000000..772a093
--- /dev/null
+++ b/web/app/data/modules/share/mw_data_check_instance.php
@@ -0,0 +1,12 @@
+
\ No newline at end of file
diff --git a/web/app/data/modules/share/mw_data_images.php b/web/app/data/modules/share/mw_data_images.php
new file mode 100644
index 0000000..01c1d71
--- /dev/null
+++ b/web/app/data/modules/share/mw_data_images.php
@@ -0,0 +1,28 @@
+ $max_width || $img_infos[1] > $max_height)
+ { $r = $max_width / $img_infos[0];
+ if($r * $img_infos[1] > $max_height) $r = $max_height / $img_infos[1];
+ return array
+ ( "width" => floor($r * $img_infos[0]),
+ "height" => floor($r * $img_infos[1])
+ );
+ }
+ return array
+ ( "width" => $img_infos[0],
+ "height" => $img_infos[1]
+ );
+ }
+ return false;
+ }
+
+ }
+
+?>
\ No newline at end of file
diff --git a/web/app/data/modules/share/mw_data_init.php b/web/app/data/modules/share/mw_data_init.php
new file mode 100644
index 0000000..ae4df81
--- /dev/null
+++ b/web/app/data/modules/share/mw_data_init.php
@@ -0,0 +1,18 @@
+env; }
+ function sgbd() { return $this->sgbd; }
+
+ function set_env(&$env) { $this->env = &$env; }
+ function set_sgbd(&$sgbd) { $this->sgbd = &$sgbd; }
+
+ function table_prefix() { return false; }
+
+ }
+
+?>
\ No newline at end of file
diff --git a/web/app/data/modules/share/mw_data_links.php b/web/app/data/modules/share/mw_data_links.php
new file mode 100644
index 0000000..7af65db
--- /dev/null
+++ b/web/app/data/modules/share/mw_data_links.php
@@ -0,0 +1,99 @@
+links = array();
+ return true;
+ }
+
+ function load_link(&$links, $v_path, $url, $intitule = "", $position = 0)
+ { if($path_item = array_shift($v_path))
+ { if(!isset($links[$path_item])) $links[$path_item] = array
+ ( "nom" => $path_item,
+ "url" => $v_path ? null : $url,
+ "intitule" => $v_path ? null : $intitule,
+ "subs" => array(),
+ "position" => 0
+ );
+ if($v_path) $this->load_link($links[$path_item]["subs"], $v_path, $url, $intitule, $position);
+ else
+ { $links[$path_item]["nom"] = $path_item;
+ $links[$path_item]["url"] = $url;
+ $links[$path_item]["intitule"] = $intitule;
+ $links[$path_item]["position"] = $position;
+ }
+ }
+ }
+
+ function valid_link_path($path)
+ { $v_path = explode("/", $path);
+ $SYNTAX_OK = true;
+ foreach($v_path as $i => $path_item)
+ { if($path_item)
+ { if(!preg_match("/^[a-zA-Z]+[a-zA-Z0-9\-_\.]*$/", $path_item))
+ { $SYNTAX_OK = false;
+ break;
+ }
+ }
+ else unset($v_path[$i]);
+ }
+ return $v_path && $SYNTAX_OK ? $v_path : false;
+ }
+
+ function get_link($path = null)
+ { if(!isset($this->links)) $this->init_links();
+ if($this->links !== false)
+ { if(!isset($path)) return $this->links;
+ if($v_path = $this->valid_link_path($path))
+ { return $this->_get_link($this->links, $v_path);
+ }
+ }
+ return false;
+ }
+
+ function _get_link($links, $v_path)
+ { if($path_item = array_shift($v_path))
+ { if(isset($links[$path_item]))
+ { if($v_path) return $this->_get_link($links[$path_item]["subs"], $v_path);
+ else return $links[$path_item];
+ }
+ else return false;
+ }
+ }
+
+ function set_link($path, $url, $intitule = "", $position = 0)
+ { if(!isset($this->links)) $this->init_links();
+ if($v_path = $this->valid_link_path($path))
+ { $this->load_link($this->links, $v_path, $url, $intitule, $position);
+ $this->links = $this->ordonne_links($this->links);
+ }
+ }
+
+ function ordonne_links($links)
+ { if(!is_array($links)) return false;
+ $values = array_values($links);
+ $maximum = count($values);
+ while($maximum > 0)
+ { $maximumTemporaire = 0;
+ for($i = 0; $i < $maximum - 1; $i++)
+ { if($values[$i]["position"] > $values[$i + 1]["position"])
+ { $tmp = $values[$i];
+ $values[$i] = $values[$i + 1];
+ $values[$i + 1] = $tmp;
+ $maximumTemporaire = $i + 1;
+ }
+ }
+ $maximum = $maximumTemporaire;
+ }
+ $res = array();
+ foreach($values as $value) { if($value["nom"]) $res[$value["nom"]] = $value; }
+ foreach($res as $nom => $sub) { if($sub["subs"]) $res[$nom]["subs"] = $this->ordonne_links($res[$nom]["subs"]); }
+ return $res;
+ }
+
+ }
+
+?>
\ No newline at end of file
diff --git a/web/app/data/modules/share/mw_data_out_config.php b/web/app/data/modules/share/mw_data_out_config.php
new file mode 100644
index 0000000..bdd8ead
--- /dev/null
+++ b/web/app/data/modules/share/mw_data_out_config.php
@@ -0,0 +1,29 @@
+env();
+ $config = array();
+ if($env->out_file_exists("config.xml"))
+ { if($this->buffer = file_get_contents($env->out_file("config.xml")))
+ { if(!isset($this->sxml)) $this->sxml = new sxml();
+ $this->sxml->parse($this->buffer);
+ $this->buffer = $this->sxml->data["config"][0];
+ if($this->buffer["subs"]) foreach($this->buffer["subs"] as $key => $value)
+ { $config[$key] = array
+ ( "type" => $value[0]["attrs"]["type"],
+ "default" => $value[0]["attrs"]["default"],
+ "text" => $value[0]["data"]
+ );
+ }
+ }
+ else $config = false;
+ }
+ return $config;
+ }
+
+ }
+
+?>
\ No newline at end of file
diff --git a/web/app/data/modules/share/mw_data_utils.php b/web/app/data/modules/share/mw_data_utils.php
new file mode 100644
index 0000000..17ba22b
--- /dev/null
+++ b/web/app/data/modules/share/mw_data_utils.php
@@ -0,0 +1,77 @@
+ 0)
+ { $maximumTemporaire = 0;
+ for($i = 0; $i < $maximum; $i++)
+ { if($values[$i][$key] > $values[$i + 1][$key])
+ { $tmp = $values[$i];
+ $values[$i] = $values[$i + 1];
+ $values[$i + 1] = $tmp;
+ $maximumTemporaire = $i + 1;
+ }
+ }
+ $maximum = $maximumTemporaire;
+ }
+ $res = array();
+ foreach($values as $value) if($value["id"]) $res[$value["id"]] = $value;
+ return $res;
+ }
+ */
+
+ function ordonne($list, $key, $order = "ASC")
+ { $values = array_values($list);
+ $maximum = count($values);
+ while($maximum > 0)
+ { $maximumTemporaire = 0;
+ for($i = 0; $i < $maximum; $i++)
+ { if
+ ( ($order == "ASC" && $values[$i][$key] > $values[$i + 1][$key])
+ || ($order == "DESC" && $values[$i][$key] < $values[$i + 1][$key])
+ )
+ { $tmp = $values[$i];
+ $values[$i] = $values[$i + 1];
+ $values[$i + 1] = $tmp;
+ $maximumTemporaire = $i + 1;
+ }
+ }
+ $maximum = $maximumTemporaire;
+ }
+ $res = array();
+ foreach($values as $value) if($value["id"]) $res[$value["id"]] = $value;
+ return $res;
+ }
+
+ function upload($image, $upload_dir)
+ { $file = "";
+ $upload_dir .= $upload_dir && (substr($upload_dir, -1) != "/") ? "/" : "";
+ if($_FILES)
+ { if(isset($_FILES[$image]))
+ { if($_FILES[$image]["error"] == UPLOAD_ERR_OK)
+ { if(move_uploaded_file($_FILES[$image]["tmp_name"], $upload_dir.$_FILES[$image]["name"]))
+ { $file = $_FILES[$image]["name"];
+ }
+ else $file = false;
+ }
+ else if($_FILES[$image]["error"] != UPLOAD_ERR_NO_FILE) $file = false;
+ }
+ else $file = false;
+ }
+ return $file;
+ }
+
+ }
+
+?>
\ No newline at end of file
diff --git a/web/app/data/modules/sql/mw_data_config.php b/web/app/data/modules/sql/mw_data_config.php
new file mode 100644
index 0000000..280f5c1
--- /dev/null
+++ b/web/app/data/modules/sql/mw_data_config.php
@@ -0,0 +1,64 @@
+sgbd();
+ $value = false;
+ if(isset($key))
+ { $sql =
+ "SELECT `value` FROM #--config"
+ ." WHERE `key`=".$this->eq($key);
+ $rst = $sgbd->query($sql);
+ if(!isset($rst)) return false;
+ if($v_rst = $sgbd->fetch_assoc($rst)) $value = $v_rst["value"];
+ else $value = "";
+ $sgbd->free_result($rst);
+ }
+ else
+ { $value = array();
+ $sql =
+ "SELECT * FROM #--config";
+ $rst = $sgbd->query($sql);
+ if(!isset($rst)) return false;
+ while($v_rst = $sgbd->fetch_assoc($rst)) $value[$v_rst["key"]] = $v_rst["value"];
+ $sgbd->free_result($rst);
+ }
+ return $value;
+ }
+
+ function config_exists($key)
+ { $sgbd = $this->sgbd();
+ $exists = false;
+ $sql = "SELECT count(*) as n FROM #--config"
+ ." WHERE `key`=".$this->eq($key);
+ $rst = $sgbd->query($sql);
+ if(!isset($rst)) return false;
+ if($v_rst = $sgbd->fetch_assoc($rst)) $exists = $v_rst["n"];
+ $sgbd->free_result($rst);
+ return $exists;
+ }
+
+ function set_config($key, $value)
+ { $sgbd = $this->sgbd();
+ if($this->config_exists($key)) $sql =
+ "UPDATE #--config"
+ ." SET `value`=".$this->eq($value)
+ ." WHERE `key`=".$this->eq($key);
+ else $sql =
+ "INSERT INTO #--config"
+ ." VALUES(NULL, ".$this->eq($key).", ".$this->eq($value).")";
+ $rst = $sgbd->query($sql);
+ if(!isset($rst)) return false;
+ return true;
+ }
+
+ function del_config($key)
+ { $sgbd = $this->sgbd();
+ return $sgbd->query("DELETE FROM #--config WHERE `key`=".$this->eq($key)) ? true : false;
+ }
+
+ }
+
+?>
\ No newline at end of file
diff --git a/web/app/data/modules/sql/mw_data_users.php b/web/app/data/modules/sql/mw_data_users.php
new file mode 100644
index 0000000..b144ad6
--- /dev/null
+++ b/web/app/data/modules/sql/mw_data_users.php
@@ -0,0 +1,259 @@
+sgbd();
+ $env = $this->env();
+ $users = array("list" => array(), "total" => 0);
+ $SELECT = "SELECT *";
+ $FROM = " FROM #--users";
+ $WHERE = "";
+ $WHERE .= (isset($alpha) ? ($WHERE ? " AND" : " WHERE")." LEFT(login, 1)=".$this->eq($alpha) : "");
+ $WHERE .= (isset($status) ? ($WHERE ? " AND" : " WHERE")." status=".$this->eq($status) : "");
+ $LIMIT = ($env->config("max_list") ? " LIMIT ".$env->config("max_list")." OFFSET ".$start : "");
+ $sql = "SELECT count(*) as n FROM(".$SELECT.$FROM.$WHERE.") res";
+ $rst = $sgbd->query($sql);
+ if(!isset($rst)) return false;
+ if($v_rst = $sgbd->fetch_assoc($rst)) $users["total"] = $v_rst["n"];
+ $sgbd->free_result($rst);
+ if($users["total"] > 0)
+ { $sql = "SELECT * FROM(".$SELECT.$FROM.$WHERE.$LIMIT.") res";
+ $rst = $sgbd->query($sql);
+ if(!isset($rst)) return false;
+ while($v_rst = $sgbd->fetch_assoc($rst)) $users["list"][$v_rst["id"]] = $v_rst;
+ $sgbd->free_result($rst);
+ }
+ return $users;
+ }
+
+ function user_by_id($id)
+ { $sgbd = $this->sgbd();
+ $user = array();
+ $sql = "SELECT * from #--users WHERE id=".$this->eq($id);
+ $rst = $sgbd->query($sql);
+ if(!isset($rst)) return false;
+ if($v_rst = $sgbd->fetch_assoc($rst)) $user = $v_rst;
+ $sgbd->free_result($rst);
+ return $user;
+ }
+
+ function user($login)
+ { $sgbd = $this->sgbd();
+ $user = array();
+ $sql = "SELECT * from #--users WHERE login=".$this->eq($login);
+ $rst = $sgbd->query($sql);
+ if(!isset($rst)) return false;
+ if($v_rst = $sgbd->fetch_assoc($rst)) $user = $v_rst;
+ $sgbd->free_result($rst);
+ return $user;
+ }
+
+ function user_exists($login)
+ { $sgbd = $this->sgbd();
+ $EXISTS = 0;
+ $sql = "SELECT count(*) as n from #--users WHERE login=".$this->eq($login);
+ $rst = $sgbd->query($sql);
+ if(!isset($rst)) return false;
+ if($v_rst = $sgbd->fetch_assoc($rst)) $EXISTS = $v_rst["n"];
+ $sgbd->free_result($rst);
+ return $EXISTS;
+ }
+
+ function add_user($login, $password, $email, $status)
+ { $sgbd = $this->sgbd();
+ $sql =
+ "INSERT INTO #--users(login, password, email, status) VALUES"
+ ."( ".$this->eq($login)
+ .", ".$this->eq($password)
+ .", ".$this->eq($email)
+ .", ".$status
+ .")";
+ return $sgbd->query($sql);
+ }
+
+ function set_user($id, $login, $password, $email, $status)
+ { $sgbd = $this->sgbd();
+ $sql =
+ "UPDATE #--users SET"
+ ." login=".$this->eq($login)
+ .", password=".$this->eq($password)
+ .", email=".$this->eq($email)
+ .", status=".$status
+ ." WHERE id=".$id;
+ return $sgbd->query($sql);
+ }
+
+ function del_user($login)
+ { $sgbd = $this->sgbd();
+ $sql = "DELETE FROM #--users WHERE login=".$this->eq($login);
+ return $sgbd->query($sql);
+ }
+
+ # ----------------------------------------------------------------------------------------
+ # status
+ #
+
+ function status()
+ { if(!isset($this->user_status)) return false;
+ return $this->user_status;
+ }
+
+ function init_user_status($status = array())
+ { $sgbd = $this->sgbd();
+ $this->user_status = array();
+ $sql = "SELECT * FROM #--user_status";
+ $rst = $sgbd->query($sql);
+ if(!isset($rst)) return false;
+ while($v_rst = $sgbd->fetch_assoc($rst)) $this->user_status[$v_rst["id"]] = $v_rst;
+ $sgbd->free_result($rst);
+ return $this->user_status;
+ }
+
+ function init_action_status($status = array())
+ { if(!isset($this->user_status)) return false;
+ $sgbd = $this->sgbd();
+ $this->action_status = array();
+ $sql = "SELECT * FROM #--action_status";
+ $rst = $sgbd->query($sql);
+ if(!isset($rst)) return false;
+ while($v_rst = $sgbd->fetch_assoc($rst)) $this->action_status[$v_rst["id"]] = $v_rst;
+ $sgbd->free_result($rst);
+ return $this->action_status;
+ }
+
+ function get_user_status()
+ { $user = $this->get_session_user();
+ if($user && isset($user["status"])) return $user["status"];
+ return 0;
+ }
+
+ function get_action_status($mod, $controller = "index", $action = "index", $set_status = array())
+ { $sgbd = $this->sgbd();
+ $status = array();
+ $sql =
+ "SELECT action, id_status"
+ ." FROM #--action_status"
+ ." WHERE action=".$this->eq($mod)
+ ." OR action=".$this->eq($mod."/".$controller)
+ ." OR action=".$this->eq($mod."/".$controller."/".$action);
+ $rst = $sgbd->query($sql);
+ if(!isset($rst)) return false;
+ while($v_rst = $sgbd->fetch_assoc($rst))
+ { if(!isset($status[$v_rst["action"]])) $status[$v_rst["action"]] = array();
+ $status[$v_rst["action"]][$v_rst["id_status"]] = true;
+ }
+ $sgbd->free_result($rst);
+ return $status;
+ }
+
+ function creation_default_status()
+ { $sgbd = $this->sgbd();
+ $default_status = 0;
+ $sql = "SELECT id FROM #--user_status WHERE creation_default=1 LIMIT 0,1";
+ $rst = $sgbd->query($sql);
+ if(!isset($rst)) return false;
+ if($v_rst = $sgbd->fetch_assoc($rst)) $default_status = $v_rst["id"];
+ $sgbd->free_result($rst);
+ return $default_status;
+ }
+
+ # ----------------------------------------------------------------------------------------
+ # log in / out
+ #
+
+ function login($login, $password)
+ { if(($user = $this->user($login)) !== false)
+ { if($this->password_ok($user, $password))
+ { if(!$this->set_session($user)) $user = false;
+ }
+ else
+ { $this->clear_session();
+ $user = array();
+ }
+ }
+ return $user;
+ }
+
+ function logout()
+ { return $this->clear_session();
+ }
+
+ function user_ok($user)
+ { return
+ strcmp(md5($user["password"].$_SESSION["id"]), $_SESSION["pass"]) == 0
+ && $_SESSION["ip"] == $_SERVER["REMOTE_ADDR"];
+ }
+
+ function password_ok($user, $password)
+ { return
+ strcmp(md5($user["password"].$_SESSION["id"]), $password) == 0
+ && $_SESSION["ip"] == $_SERVER["REMOTE_ADDR"];
+ }
+
+ # ----------------------------------------------------------------------------------------
+ # session
+ #
+
+ function load_session()
+ { session_start();
+ if(!isset($_SESSION["id"])) $this->clear_session();
+ if
+ ( $user =
+ ( isset($_COOKIE["user"]) || isset($_SESSION["user"]) ?
+ $this->user(isset($_COOKIE["user"]) ? $_COOKIE["user"] : $_SESSION["user"])
+ : array()
+ )
+ )
+ { if(isset($_COOKIE["user"])) $this->set_session($user);
+ if(!$this->user_ok($user))
+ { $this->clear_session();
+ $user = array();
+ }
+ }
+ $this->_user = $user;
+ return $user;
+ }
+
+ function set_session($user)
+ { $_SESSION["user"] = $user["login"];
+ $_SESSION["pass"] = md5($user["password"].$_SESSION["id"]);
+ $env = $this->env();
+ return setcookie("user", $user["login"], time() + (60 * 60 * 24 * 7), $env->path("web"));
+ }
+
+ function clear_session()
+ { unset($_SESSION["user"]);
+ unset($_SESSION["pass"]);
+ $_SESSION["ip"] = $_SERVER["REMOTE_ADDR"];
+ $_SESSION["id"] = md5(rand());
+ $env = $this->env();
+ return setcookie("user", "", 0, $env->path("web"));
+ }
+
+ function get_session_user() { return $this->_user; }
+
+ # ----------------------------------------------------------------------------------------
+ # uploads
+ #
+
+ function check_user_uploads_dir($user = null)
+ { $env = $this->env();
+ $user_dir = $env->path("content")."uploads/".(isset($user) ? $user : $this->_user["id"]);
+ if(!file_exists($user_dir)) @mkdir($user_dir);
+ return file_exists($user_dir);
+ }
+
+ }
+
+?>
\ No newline at end of file
diff --git a/web/app/data/modules/xml/mw_data_config.php b/web/app/data/modules/xml/mw_data_config.php
new file mode 100644
index 0000000..98d4607
--- /dev/null
+++ b/web/app/data/modules/xml/mw_data_config.php
@@ -0,0 +1,106 @@
+sgbd();
+ $value = false;
+ if($rst = $sgbd->open_data("config"))
+ { if(isset($key))
+ { while($v_rst = $sgbd->fetch_data($rst))
+ { if(isset($v_rst))
+ { if($v_rst["key"] == $key)
+ { $value = $v_rst["value"];
+ }
+ }
+ else $value = null;
+ }
+ }
+ else
+ { $value = array();
+ while($v_rst = $sgbd->fetch_data($rst))
+ { if(isset($v_rst))
+ { if(is_array($v_rst)) foreach($v_rst as $key => $_value)
+ { $value[$key] = $_value;
+ break;
+ }
+ }
+ else $value = null;
+ }
+ }
+ $sgbd->close_data($rst);
+ }
+ if(!isset($value)) return false;
+ return $value;
+ }
+
+ function config_exists($key)
+ { $sgbd = $this->sgbd();
+ $exists = 0;
+ if($rst = $sgbd->open_data("config"))
+ { while($v_rst = $sgbd->fetch_data($rst))
+ { if(isset($v_rst))
+ { if(isset($v_rst[$key])) $exists++;
+ }
+ else
+ { $exists = false;
+ break;
+ }
+ }
+ $sgbd->close_data($rst);
+ }
+ else $exists = false;
+ return $exists;
+ }
+
+ function set_config($key, $value)
+ { $sgbd = $this->sgbd();
+ $FOUND = false;
+ if($rst = $sgbd->open_data("config"))
+ { while($v_rst = $sgbd->fetch_data($rst))
+ { if(isset($v_rst))
+ { if(array_key_exists($key, $v_rst))
+ { $FOUND = $sgbd->set_data("config", $v_rst["id"], array($key => $value));
+ break;
+ }
+ }
+ else
+ { $FOUND = null;
+ break;
+ }
+ }
+ $sgbd->close_data($rst);
+ }
+ else $FOUND = null;
+ if(isset($FOUND))
+ { if($FOUND) return true;
+ else
+ { if($sgbd->add_data("config", array($key => $value))) return true;
+ }
+ }
+ return false;
+ }
+
+ function del_config($key)
+ { $ids = array();
+ $sgbd = $this->sgbd();
+ if($rst = $sgbd->open_data("config"))
+ { while($v_rst = $sgbd->fetch_data($rst))
+ { if(isset($v_rst))
+ { if(isset($v_rst[$key]) && isset($v_rst["id"]))
+ { $ids[] = $v_rst["id"];
+ }
+ }
+ else $ids = false;
+ }
+ $sgbd->close_data($rst);
+ }
+ if($ids === false) return false;
+ foreach($ids as $id) if(!$sgbd->del_data("config", $id)) return false;
+ return true;
+ }
+
+ }
+
+?>
\ No newline at end of file
diff --git a/web/app/data/modules/xml/mw_data_users.php b/web/app/data/modules/xml/mw_data_users.php
new file mode 100644
index 0000000..cc84872
--- /dev/null
+++ b/web/app/data/modules/xml/mw_data_users.php
@@ -0,0 +1,427 @@
+sgbd();
+ $env = $this->env();
+ $users = array("list" => array(), "total" => 0);
+ $res = array();
+ if($rst = $sgbd->open_data("users"))
+ { while($v_rst = $sgbd->fetch_data($rst))
+ { if(isset($v_rst))
+ { if(!isset($alpha) || (isset($v_rst["login"]) && strtolower(substr($v_rst["login"], 0, 1)) == strtolower($alpha)))
+ { if(!isset($status) || (isset($v_rst["status"]) && $v_rst["status"] == $status))
+ { $res[$v_rst["id"]] = $v_rst;
+ $users["total"]++;
+ }
+ }
+ }
+ else
+ { $res = false;
+ break;
+ }
+ }
+ $sgbd->close_data($rst);
+ if($res !== false)
+ { $n = 0;
+ foreach($res as $id_user => $user)
+ { $n++;
+ if(!$env->config("max_list") || ($n > $start && $n <= ($start + $env->config("max_list"))))
+ { $users["list"][$user["id"]] = $user;
+ if(!isset($this->users)) $this->users = array();
+ $this->users[$user["id"]] = $user;
+ }
+ }
+ }
+ else $users = false;
+ }
+ else $users = false;
+ return $users;
+ }
+
+ function user_by_id($id)
+ { if(!isset($this->users)) $this->users = array();
+ if(isset($this->users[$id])) return $this->users[$id];
+ $sgbd = $this->sgbd();
+ if(($user = $sgbd->get_data("users", $id)) !== false)
+ { $this->users[$id] = $user;
+ }
+ return $user;
+ }
+
+ function user($login)
+ { $sgbd = $this->sgbd();
+ $user = array();
+ if($rst = $sgbd->open_data("users"))
+ { while($v_rst = $sgbd->fetch_data($rst))
+ { if(isset($v_rst))
+ { if(isset($v_rst["login"]) && $v_rst["login"] == $login)
+ { $user = $v_rst;
+ break;
+ }
+ }
+ else $user = false;
+ }
+ $sgbd->close_data($rst);
+ }
+ else $user = false;
+ if($user !== false)
+ { if(!isset($this->users)) $this->users = array();
+ $this->users[$user["id"]] = $user;
+ }
+ return $user;
+ }
+
+ function user_exists($login)
+ { $sgbd = $this->sgbd();
+ $EXISTS = 0;
+ if($rst = $sgbd->open_data("users"))
+ { while($v_rst = $sgbd->fetch_data($rst))
+ { if(isset($v_rst))
+ { if(isset($v_rst["login"]) && $v_rst["login"] == $login)
+ { $EXISTS++;
+ }
+ }
+ else
+ { $EXISTS = false;
+ break;
+ }
+ }
+ $sgbd->close_data($rst);
+ }
+ else $EXISTS = false;
+ return $EXISTS;
+ }
+
+ function add_user($login, $password, $email, $status)
+ { $sgbd = $this->sgbd();
+ return $sgbd->add_data
+ ( "users",
+ array
+ ( "login" => $login,
+ "password" => $password,
+ "email" => $email,
+ "status" => $status
+ )
+ );
+ }
+
+ function set_user($id, $login, $password, $email, $status)
+ { $sgbd = $this->sgbd();
+ return $sgbd->set_data
+ ( "users",
+ $id,
+ array
+ ( "login" => $login,
+ "password" => $password,
+ "email" => $email,
+ "status" => $status
+ )
+ );
+ }
+
+ function del_user($login)
+ { if(($user = $this->user($login)) !== false)
+ { $sgbd = $this->sgbd();
+ return $sgbd->del_data("users", $user["id"]);
+ }
+ return false;
+ }
+
+ # ----------------------------------------------------------------------------------------
+ # status
+ #
+
+ function status()
+ { if(!isset($this->user_status)) return false;
+ return $this->user_status;
+ }
+
+ function init_user_status($status = array())
+ { $sgbd = $this->sgbd();
+ $this->user_status = array();
+ if($rst = $sgbd->open_data("user_status"))
+ { while($v_rst = $sgbd->fetch_data($rst))
+ { if(isset($v_rst))
+ { $this->user_status[$v_rst["id"]] = $v_rst;
+ }
+ else
+ { $this->user_status = false;
+ break;
+ }
+ }
+ $sgbd->close_data($rst);
+ }
+ else $this->user_status = false;
+ if($status && $this->user_status !== false)
+ { foreach($status as $new_user_status)
+ { $id_status = false;
+ foreach($this->user_status as $user_status) if($new_user_status["nom"] == $user_status["nom"])
+ { $id_status = $user_status["id"];
+ break;
+ }
+ if($id_status)
+ { $SAME = true;
+ foreach($new_user_status as $status_key => $status_value)
+ { if(!isset($this->user_status[$id_status][$status_key]) || $this->user_status[$id_status][$status_key] != $status_value)
+ { $SAME = false; break;
+ }
+ }
+ if(!$SAME)
+ { if($sgbd->set_data("user_status", $id_status, $new_user_status)) $this->user_status[$id_status] = $new_user_status;
+ else { $this->user_status = false; break; }
+ }
+ }
+ else
+ { if($id_status = $sgbd->add_data("user_status", $new_user_status)) $this->user_status[$id_status] = $new_user_status;
+ else { $this->user_status = false; break; }
+ }
+ }
+ }
+ return $this->user_status;
+ }
+
+ function init_action_status($status = array())
+ { if(!isset($this->user_status)) return false;
+ $sgbd = $this->sgbd();
+ $this->action_status = array();
+ if($rst = $sgbd->open_data("action_status"))
+ { while($v_rst = $sgbd->fetch_data($rst))
+ { if(isset($v_rst))
+ { $this->action_status[$v_rst["id"]] = $v_rst;
+ }
+ else
+ { $this->action_status = false;
+ break;
+ }
+ }
+ $sgbd->close_data($rst);
+ }
+ else $this->action_status = false;
+ if($status && $this->action_status !== false)
+ { $STATUS_OK = true;
+ foreach($status as $id_new_action_status => $new_action_status)
+ { $FOUND = $new_action_status["id_status"] == "0";
+ if(!$FOUND) foreach($this->user_status as $user_status)
+ { if($new_action_status["id_status"] == $user_status["nom"])
+ { $FOUND = true;
+ $status[$id_new_action_status]["id_status"] = $user_status["id"];
+ }
+ }
+ if(!$FOUND)
+ { $STATUS_OK = false;
+ break;
+ }
+ }
+ if($STATUS_OK)
+ { foreach($status as $new_action_status)
+ { $id_status = false;
+ foreach($this->action_status as $action_status)
+ { if
+ ( $new_action_status["action"] == $action_status["action"]
+ && $new_action_status["id_status"] == $action_status["id_status"]
+ )
+ { $id_status = $action_status["id"];
+ break;
+ }
+ }
+ if($id_status)
+ { $SAME = true;
+ foreach($new_action_status as $status_key => $status_value)
+ { if(!isset($this->action_status[$id_status][$status_key]) || $this->action_status[$id_status][$status_key] != $status_value)
+ { $SAME = false; break;
+ }
+ }
+ if(!$SAME)
+ { if($id_status = $sgbd->add_data("action_status", $new_action_status)) $this->action_status[$id_status] = $new_action_status;
+ else { $this->action_status = false; break; }
+ }
+ }
+ else
+ { if($id_status = $sgbd->add_data("action_status", $new_action_status)) $this->action_status[$id_status] = $new_action_status;
+ else { $this->action_status = false; break; }
+ }
+ }
+ }
+ else $this->action_status = false;
+ }
+ return $this->action_status;
+ }
+
+ function get_user_status()
+ { $user = $this->get_session_user();
+ if($user && isset($user["status"])) return $user["status"];
+ return 0;
+ }
+
+ function get_action_status($mod, $controller = "index", $action = "index", $set_status = array())
+ { $sgbd = $this->sgbd();
+ if($rst = $sgbd->open_data("action_status"))
+ { while($status !==false && $v_rst = $sgbd->fetch_data($rst))
+ { if(isset($v_rst) && isset($v_rst["action"]) && isset($v_rst["id_status"]))
+ { if
+ ( $v_rst["action"] == $mod
+ || $v_rst["action"] == $mod."/".$controller
+ || $v_rst["action"] == $mod."/".$controller."/".$action
+ )
+ { if(!isset($status[$v_rst["action"]])) $status[$v_rst["action"]] = array();
+ $status[$v_rst["action"]][$v_rst["id_status"]] = true;
+ }
+ }
+ else $status = false;
+ }
+ $sgbd->close_data($rst);
+ }
+ else $status = false;
+ if($status !== false)
+ { if($set_status)
+ { foreach($set_status as $new_action_status)
+ { $id_status = false;
+ foreach($status as $user_status) if($new_user_status["nom"] == $user_status["nom"])
+ { $id_status = $user_status["id"];
+ break;
+ }
+ if($id_status)
+ { $SAME = true;
+ foreach($new_user_status as $status_key => $status_value)
+ { if(!isset($status[$id_status][$status_key]) || $status[$id_status][$status_key] != $status_value)
+ { $SAME = false; break;
+ }
+ }
+ if(!$SAME)
+ { if($sgbd->set_data("user_status", $id_status, $new_user_status)) $status[$id_status] = $new_user_status;
+ else { $status = false; break; }
+ }
+ }
+ else
+ { if($id_status = $sgbd->add_data("user_status", $new_user_status)) $status[$id_status] = $new_user_status;
+ else { $status = false; break; }
+ }
+ }
+ }
+ }
+ return $status;
+ }
+
+ function creation_default_status()
+ { $sgbd = $this->sgbd();
+ $default_status = 0;
+ if($rst = $sgbd->open_data("user_status"))
+ { while($v_rst = $sgbd->fetch_data($rst))
+ { if(isset($v_rst))
+ { if(isset($v_rst["creation_default"]) && $v_rst["creation_default"] == 1)
+ { $default_status = $v_rst["id"];
+ break;
+ }
+ }
+ else
+ { $default_status = false;
+ break;
+ }
+ }
+ $sgbd->close_data($rst);
+ }
+ else $default_status = false;
+ return $default_status;
+ }
+
+ # ----------------------------------------------------------------------------------------
+ # log in / out
+ #
+
+ function login($login, $password)
+ { if(($user = $this->user($login)) !== false)
+ { if($this->password_ok($user, $password))
+ { if(!$this->set_session($user)) $user = false;
+ }
+ else
+ { $this->clear_session();
+ $user = array();
+ }
+ }
+ return $user;
+ }
+
+ function logout()
+ { return $this->clear_session();
+ }
+
+ function user_ok($user)
+ { return
+ strcmp(md5($user["password"].$_SESSION["id"]), $_SESSION["pass"]) == 0
+ && $_SESSION["ip"] == $_SERVER["REMOTE_ADDR"];
+ }
+
+ function password_ok($user, $password)
+ { return
+ strcmp(md5($user["password"].$_SESSION["id"]), $password) == 0
+ && $_SESSION["ip"] == $_SERVER["REMOTE_ADDR"];
+ }
+
+ # ----------------------------------------------------------------------------------------
+ # session
+ #
+
+ function load_session()
+ { session_start();
+ if(!isset($_SESSION["id"])) $this->clear_session();
+ if
+ ( $user =
+ ( isset($_COOKIE["user"]) || isset($_SESSION["user"]) ?
+ $this->user(isset($_COOKIE["user"]) ? $_COOKIE["user"] : $_SESSION["user"])
+ : array()
+ )
+ )
+ { if(isset($_COOKIE["user"])) $this->set_session($user);
+ if(!$this->user_ok($user))
+ { $this->clear_session();
+ $user = array();
+ }
+ }
+ $this->_user = $user;
+ return $user;
+ }
+
+ function set_session($user)
+ { $_SESSION["user"] = $user["login"];
+ $_SESSION["pass"] = md5($user["password"].$_SESSION["id"]);
+ $env = $this->env();
+ return setcookie("user", $user["login"], time() + (60 * 60 * 24 * 7), $env->path("web"));
+ }
+
+ function clear_session()
+ { unset($_SESSION["user"]);
+ unset($_SESSION["pass"]);
+ $_SESSION["ip"] = $_SERVER["REMOTE_ADDR"];
+ $_SESSION["id"] = md5(rand());
+ $env = $this->env();
+ return setcookie("user", "", 0, $env->path("web"));
+ }
+
+ function get_session_user() { return $this->_user; }
+
+ # ----------------------------------------------------------------------------------------
+ # uploads
+ #
+
+ function check_user_uploads_dir($user = null)
+ { $env = $this->env();
+ $user_dir = $env->path("content")."uploads/".(isset($user) ? $user : $this->_user["id"]);
+ if(!file_exists($user_dir)) @mkdir($user_dir);
+ return file_exists($user_dir);
+ }
+
+ }
+
+?>
\ No newline at end of file
diff --git a/web/app/data/mw_data.php b/web/app/data/mw_data.php
new file mode 100644
index 0000000..c08fbb1
--- /dev/null
+++ b/web/app/data/mw_data.php
@@ -0,0 +1,8 @@
+
\ No newline at end of file
diff --git a/web/app/data/mw_sgbd.php b/web/app/data/mw_sgbd.php
new file mode 100644
index 0000000..432ff33
--- /dev/null
+++ b/web/app/data/mw_sgbd.php
@@ -0,0 +1,109 @@
+sgbd_impl = $sgbd_impl;
+ $this->env = $env;
+ }
+
+ function extention_ok() { return $this->sgbd_impl->extention_ok($this->env); }
+
+ function connect($host, $base, $user, $password)
+ { return $this->sgbd_impl->connect($host, $base, $user, $password);
+ }
+
+ function select_db($db_name)
+ { return $this->sgbd_impl->select_db($db_name);
+ }
+
+ # ---------------------------------------------------------------------------------
+ # SQL
+ #
+
+ function table_exists($table_name)
+ { return $this->sgbd_impl->table_exists
+ ( ($prefix_codes = array_keys($this->env->bdd("table_prefix"))) ?
+ str_replace($prefix_codes, array_values($this->env->bdd("table_prefix")), $table_name)
+ : $table_name
+ );
+ }
+
+ function query($sql)
+ { return $this->sgbd_impl->query
+ ( ($prefix_codes = array_keys($this->env->bdd("table_prefix"))) ?
+ str_replace($prefix_codes, array_values($this->env->bdd("table_prefix")), $sql)
+ : $sql
+ );
+ }
+
+ function insert_id()
+ { return $this->sgbd_impl->insert_id();
+ }
+
+ function fetch_assoc($rst)
+ { return $this->sgbd_impl->fetch_assoc($rst);
+ }
+
+ function free_result($rst)
+ { return $this->sgbd_impl->free_result($rst);
+ }
+
+ function close()
+ { return $this->sgbd_impl->close();
+ }
+
+ # ---------------------------------------------------------------------------------
+ # XML
+ #
+
+ function data_exists($data_path)
+ { return $this->sgbd_impl->data_exists($data_path);
+ }
+
+ function create_data($data_path)
+ { return $this->sgbd_impl->create_data($data_path);
+ }
+
+ function get_data($data_path, $data_id)
+ { return $this->sgbd_impl->get_data($data_path, $data_id);
+ }
+
+ function open_data($data_path, $FETCH = true)
+ { return $this->sgbd_impl->open_data($data_path, $FETCH);
+ }
+
+ function fetch_data($dh)
+ { return $this->sgbd_impl->fetch_data($dh);
+ }
+
+ function add_data($data_path, $data)
+ { return $this->sgbd_impl->add_data($data_path, $data);
+ }
+
+ function last_index($dh)
+ { return $this->sgbd_impl->last_index($dh);
+ }
+
+ function set_data($data_path, $data_id, $data)
+ { return $this->sgbd_impl->set_data($data_path, $data_id, $data);
+ }
+
+ function del_data($data_path, $data_id)
+ { return $this->sgbd_impl->del_data($data_path, $data_id);
+ }
+
+ function close_data($dh)
+ { return $this->sgbd_impl->close_data($dh);
+ }
+
+ function remove_data($data_path)
+ { return $this->sgbd_impl->remove_data($data_path);
+ }
+
+ }
+
+?>
\ No newline at end of file
diff --git a/web/app/env/modules/mw_env_config.php b/web/app/env/modules/mw_env_config.php
new file mode 100644
index 0000000..4357b06
--- /dev/null
+++ b/web/app/env/modules/mw_env_config.php
@@ -0,0 +1,114 @@
+bdd = $bdd;
+ $this->bdd["table_prefix"] = array();
+ $this->CONFIG = isset($CONFIG) ? $CONFIG : array();
+ $this->PARAMS = array();
+ $xml_parser = new sxml();
+ $app_config_file = $this->path("app")."config.xml";
+ if(file_exists($app_config_file))
+ { $xml_parser->parse(file_get_contents($app_config_file));
+ $app_config = $xml_parser->data["config"][0];
+ if(isset($app_config["subs"]["params"]))
+ { foreach($app_config["subs"]["params"][0]["subs"] as $param_key => $param_elt)
+ { $this->PARAMS[$param_key] = $param_elt[0]["data"];
+ }
+ }
+ if(isset($app_config["subs"]["config"]))
+ { foreach($app_config["subs"]["config"][0]["subs"] as $config_key => $config_elt)
+ { $this->CONFIG[$config_key] = $config_elt[0]["data"];
+ }
+ }
+ if(isset($app_config["subs"]["bdd"][0]["subs"]["table_prefix_code"]))
+ { $this->add_table_prefix
+ ( array
+ ( $app_config["subs"]["bdd"][0]["subs"]["table_prefix_code"][0]["data"] => $bdd["table_prefix"]
+ )
+ );
+ }
+ }
+ if(($plugins = $this->plugins("ASC")) !== false)
+ { foreach($plugins as $plugin_name => $plugin)
+ { $app_config_file = $this->path("plugins").$plugin_name."/app/config.xml";
+ if(file_exists($app_config_file) && $plugin["installed"] && $plugin["enabled"])
+ { $xml_parser->parse(file_get_contents($app_config_file));
+ $app_config = $xml_parser->data["config"][0];
+ if(isset($app_config["subs"]["params"]))
+ { foreach($app_config["subs"]["params"][0]["subs"] as $param_key => $param_elt)
+ { $this->PARAMS[$param_key] = $param_elt[0]["data"];
+ }
+ }
+ if(isset($app_config["subs"]["config"]))
+ { foreach($app_config["subs"]["config"][0]["subs"] as $config_key => $config_elt)
+ { $this->CONFIG[$config_key] = $config_elt[0]["data"];
+ }
+ }
+ if(isset($app_config["subs"]["bdd"][0]["subs"]["table_prefix_code"]))
+ { $this->add_table_prefix
+ ( array
+ ( $app_config["subs"]["bdd"][0]["subs"]["table_prefix_code"][0]["data"] => $bdd["table_prefix"]
+ )
+ );
+ }
+ }
+ }
+ $this->init_additional_get_params();
+ }
+ else $this->erreur("impossible de lire les fichiers de configuration pour les plugins", true);
+ }
+ else $this->erreur("impossible de trouver le fichier de configuration pour l'installation", true);
+ }
+
+ function get_config_file() { return $this->config_file; }
+ function set_config_file($config_file) { $this->config_file = $config_file; }
+
+ function get_PATHES() { return $this->PATHES; }
+ function path($name)
+ { if(isset($this->PATHES[$name])) return $this->PATHES[$name];
+ return "";
+ }
+ function set_PATHES($PATHES)
+ { foreach($PATHES as $path_name => $path_value)
+ { if($path_value && substr($path_value, -1) != "/") $PATHES[$path_name] .= "/";
+ }
+ $this->PATHES = $PATHES;
+ }
+
+ function get_PARAMS() { return $this->PARAMS; }
+ function param($name) { return $this->PARAMS[$name]; }
+
+ function get_CONFIG() { return $this->CONFIG; }
+ function config($name) { return $this->CONFIG[$name]; }
+ function set_config($config)
+ { if(is_array($config))
+ { foreach($config as $key => $value) $this->CONFIG[$key] = $value;
+ return true;
+ }
+ return false;
+ }
+
+ function get_bdd() { return $this->bdd; }
+ function bdd($name) { return $this->bdd[$name]; }
+ function set_bdd($key, $value) { $this->bdd[$key] = $value; }
+ function add_table_prefix($table_prefix)
+ { if(is_array($table_prefix))
+ { foreach($table_prefix as $prefix_code => $prefix) $this->bdd["table_prefix"][$prefix_code] = $prefix;
+ return true;
+ }
+ return false;
+ }
+
+ }
+
+?>
\ No newline at end of file
diff --git a/web/app/env/modules/mw_env_data.php b/web/app/env/modules/mw_env_data.php
new file mode 100644
index 0000000..cc0e711
--- /dev/null
+++ b/web/app/env/modules/mw_env_data.php
@@ -0,0 +1,15 @@
+data = &$data; }
+
+ function data()
+ { return $this->data;
+ }
+
+ }
+
+?>
\ No newline at end of file
diff --git a/web/app/env/modules/mw_env_init.php b/web/app/env/modules/mw_env_init.php
new file mode 100644
index 0000000..8987f71
--- /dev/null
+++ b/web/app/env/modules/mw_env_init.php
@@ -0,0 +1,65 @@
+plugins()) !== false)
+ { foreach($plugins as $plugin_name => $plugin)
+ { $init_path = $this->path("plugins").$plugin_name."/app/init/";
+ if
+ ( $plugin["installed"]
+ && $plugin["enabled"]
+ && file_exists($init_path)
+ && is_dir($init_path)
+ )
+ { if($dh = opendir($init_path))
+ { $files = array();
+ while(($file = readdir($dh)) !== false)
+ { if
+ ( substr($file, 0, 1) != "."
+ && !is_dir($init_path.$file)
+ && strcmp(substr($file, -4), ".php") == 0
+ && !isset($init_files[$file])
+ ) $init_files[$file] = $init_path;
+ }
+ closedir($dh);
+
+ }
+ else $this->erreur("impossible d'ouvrir le dossier init du plugin ".$plugin_name, true);
+ }
+ if($this->check_stop()) return;
+ }
+ $init_path = $this->path("app")."init/";
+ if
+ ( file_exists($init_path)
+ && is_dir($init_path)
+ )
+ { if($dh = opendir($init_path))
+ { $files = array();
+ while(($file = readdir($dh)) !== false)
+ { if
+ ( substr($file, 0, 1) != "."
+ && !is_dir($init_path.$file)
+ && strcmp(substr($file, -4), ".php") == 0
+ ) $init_files[$file] = $init_path;
+ }
+ closedir($dh);
+ }
+ else $this->erreur("impossible d'ouvrir le dossier init du plugin ".$plugin_name, true);
+ }
+ }
+ if($this->check_stop()) return;
+ if($init_files)
+ { ksort($init_files);
+ foreach($init_files as $file => $init_path)
+ { require $init_path.$file;
+ if($this->check_stop()) return;
+ }
+ }
+ }
+
+ }
+
+?>
\ No newline at end of file
diff --git a/web/app/env/modules/mw_env_inputs.php b/web/app/env/modules/mw_env_inputs.php
new file mode 100644
index 0000000..526285a
--- /dev/null
+++ b/web/app/env/modules/mw_env_inputs.php
@@ -0,0 +1,42 @@
+path("libs")."inputfilter.php";
+ $allowed_tags = array
+ ( "p", "span", "pre", "blockquote", "address", "hr", "br",
+ "img",
+ "strong", "em", "u", "i", "b", "s",
+ "a",
+ "ul", "ol", "li",
+ "h1", "h2", "h3", "h4", "h5", "h6"
+ );
+ $allowed_attrs = array
+ ( "style",
+ "src", "alt", "width", "height",
+ "href", "title"
+ );
+ $input_filter = new InputFilter($allowed_tags, $allowed_attrs);
+ $_POST = $input_filter->process($_POST);
+ }
+ if($_FILES)
+ { foreach($_FILES as $file_key => $file_infos)
+ { $v_name = explode(".", $file_infos["name"]);
+ $ext = strtolower($v_name[count($v_name) - 1]);
+ if
+ ( $ext != "png"
+ && $ext != "jpg"
+ && $ext != "jpeg"
+ && $ext != "gif"
+ ) unset($_FILES[$file_key]);
+ }
+ }
+ return true;
+ }
+
+ }
+
+?>
\ No newline at end of file
diff --git a/web/app/env/modules/mw_env_links.php b/web/app/env/modules/mw_env_links.php
new file mode 100644
index 0000000..818ce44
--- /dev/null
+++ b/web/app/env/modules/mw_env_links.php
@@ -0,0 +1,23 @@
+data();
+ return $data->init_links();
+ }
+
+ function get_link($path = null)
+ { $data = $this->data();
+ return $data->get_link($path);
+ }
+
+ function set_link($path, $url, $intitule = "", $position = 0)
+ { $data = $this->data();
+ return $data->set_link($path, $url, $intitule, $position);
+ }
+
+ }
+
+?>
\ No newline at end of file
diff --git a/web/app/env/modules/mw_env_messages.php b/web/app/env/modules/mw_env_messages.php
new file mode 100644
index 0000000..824b82f
--- /dev/null
+++ b/web/app/env/modules/mw_env_messages.php
@@ -0,0 +1,35 @@
+set_etat("reponses/html/erreur", false);
+ $erreur = $this->out("erreur");
+ if(!isset($erreur)) $erreur = array("messages" => array());
+ $erreur["messages"][] = $message;
+ $this->set_out("erreur", $erreur);
+ }
+ }
+
+ function message($message)
+ { $messages = $this->out("messages");
+ if(!isset($messages)) $messages = array();
+ $messages[] = $message;
+ $this->set_out("messages", $messages);
+ }
+
+ function messages()
+ { $messages = $this->out("messages");
+ if(isset($messages)) return $messages;
+ return array();
+ }
+
+ }
+
+?>
\ No newline at end of file
diff --git a/web/app/env/modules/mw_env_out.php b/web/app/env/modules/mw_env_out.php
new file mode 100644
index 0000000..17f1096
--- /dev/null
+++ b/web/app/env/modules/mw_env_out.php
@@ -0,0 +1,275 @@
+out[$key] = $value; return $value; }
+ function get_out() { return $this->out; }
+ function out($key) { return $this->out[$key]; }
+
+ function out_pathes()
+ { $pathes = array();
+ if($dh = opendir($this->path("out")))
+ { while(($file = readdir($dh)) !== false)
+ { if(is_dir($this->path("out").$file) && substr($file, 0 ,1) != ".") $pathes[] = $file;
+ }
+ closedir($dh);
+ }
+ else $pathes = false;
+ return $pathes;
+ }
+
+ function out_file_exists($file, $PRIORITE = "DESC")
+ { $out_file = $this->_out_file($file, $PRIORITE);
+ return $out_file ? true : false;
+ }
+
+ function out_file($file, $PRIORITE = "DESC")
+ { $out_file = $this->_out_file($file, $PRIORITE);
+ return $out_file ? $out_file : $file;
+ }
+
+ function _out_file($file, $PRIORITE = "DESC")
+ { $out_file = false;
+ if($PRIORITE == "ASC")
+ { $tmp_out_file = $this->path("out").$this->config("out").$file;
+ if($file && file_exists($tmp_out_file))
+ { $out_file = $tmp_out_file;
+ }
+ if(!$out_file)
+ { $tmp_out_file = $this->path("out").$this->path("dist_out").$file;
+ if($file && file_exists($tmp_out_file))
+ { $out_file = $tmp_out_file;
+ }
+ }
+ }
+ if($out_file) return $out_file;
+ if(($plugins = $this->plugins($PRIORITE)) !== false)
+ { foreach($plugins as $plugin_name => $plugin)
+ { $tmp_out_file = $this->path("plugins").$plugin_name."/out/".$this->config("out").$file;
+ if($file && $plugin["installed"] && $plugin["enabled"] && file_exists($tmp_out_file))
+ { $out_file = $tmp_out_file;
+ break;
+ }
+ if(!$out_file)
+ { $tmp_out_file = $this->path("plugins").$plugin_name."/out/".$this->path("dist_out").$file;
+ if($file && $plugin["installed"] && $plugin["enabled"] && file_exists($tmp_out_file))
+ { $out_file = $tmp_out_file;
+ break;
+ }
+ }
+ }
+ if($PRIORITE == "DESC" && !$out_file)
+ { $tmp_out_file = $this->path("out").$this->config("out").$file;
+ if($file && file_exists($tmp_out_file))
+ { $out_file = $tmp_out_file;
+ }
+ if(!$out_file)
+ { $tmp_out_file = $this->path("out").$this->path("dist_out").$file;
+ if($file && file_exists($tmp_out_file))
+ { $out_file = $tmp_out_file;
+ }
+ }
+ }
+ }
+ return $out_file;
+ }
+
+ # ---------------------------------------------------------------------------------
+ # out config
+ #
+
+ function set_out_config($out_config)
+ { $this->out_config = $out_config;
+ return $this->out_config;
+ }
+
+ function get_out_config() { return isset($this->out_config) ? $this->out_config : array(); }
+
+ function out_config($name)
+ { if(isset($this->out_config))
+ { $CONFIG = $this->get_CONFIG();
+ return isset($CONFIG["out_".$name]) ? $CONFIG["out_".$name] : $this->out_config[$name]["default"];
+ }
+ return null;
+ }
+
+ # ---------------------------------------------------------------------------------
+ # layouts
+ #
+
+ function layout() { return $this->layout; }
+
+ function render_layout($layout = null)
+ { if(!isset($layout)) $layout = $this->init_layout();
+ if(($plugins = $this->plugins("ASC")) !== false)
+ { foreach($plugins as $plugin_name => $plugin)
+ { if($plugin["installed"] && $plugin["enabled"])
+ { $FOUND = false;
+ $functions_file = $this->path("plugins").$plugin_name."/out/".$this->config("out")."functions.php";
+ if(file_exists($functions_file))
+ { $FOUND = true;
+ require $functions_file;
+ }
+ if(!$FOUND)
+ { $functions_file = $this->path("plugins").$plugin_name."/out/".$this->path("dist_out")."functions.php";
+ if($plugin["installed"] && $plugin["enabled"] && file_exists($functions_file))
+ { require $functions_file;
+ }
+ }
+ }
+ }
+ $FOUND = false;
+ $functions_file = $this->path("out").$this->config("out")."functions.php";
+ if(file_exists($functions_file))
+ { $FOUND = true;
+ require $functions_file;
+ }
+ if(!$FOUND)
+ { $functions_file = $this->path("out").$this->path("dist_out")."functions.php";
+ if(file_exists($functions_file))
+ { require $functions_file;
+ }
+ }
+ if($layout["page"])
+ { if($this->out_file_exists($layout["page"])) require $this->out_file($layout["page"]);
+ }
+ elseif($layout["content"])
+ { if($this->out_file_exists($layout["content"])) require $this->out_file($layout["content"]);
+ }
+ }
+ }
+
+ function init_layout()
+ { $this->layout = array();
+ $this->_init_layout("index");
+ if(($mod = $this->etat("mod")) != "index") $this->_init_layout($mod);
+ return $this->get_layout();
+ }
+
+ function _init_layout($mod)
+ { if(($plugins = $this->plugins("ASC")) !== false)
+ { $layout_file = false;
+ $tmp_layout_file = $this->path("out").$this->config("out")."layouts/".$mod.".xml";
+ if(file_exists($tmp_layout_file)) $layout_file = $tmp_layout_file;
+ if(!$layout_file)
+ { $tmp_layout_file = $this->path("out").$this->path("dist_out")."layouts/".$mod.".xml";
+ if(file_exists($tmp_layout_file)) $layout_file = $tmp_layout_file;
+ }
+ if($layout_file) $this->load_layout($layout_file);
+ foreach($plugins as $plugin_name => $plugin)
+ { if($plugin["installed"] && $plugin["enabled"])
+ { $layout_file = false;
+ $tmp_layout_file = $this->path("plugins").$plugin_name."/out/".$this->config("out")."layouts/".$mod.".xml";
+ if(file_exists($tmp_layout_file)) $layout_file = $tmp_layout_file;
+ if(!$layout_file)
+ { $tmp_layout_file = $this->path("plugins").$plugin_name."/out/".$this->path("dist_out")."layouts/".$mod.".xml";
+ if(file_exists($tmp_layout_file)) $layout_file = $tmp_layout_file;
+ }
+ if($layout_file) $this->load_layout($layout_file);
+ }
+ }
+ }
+ }
+
+ function load_layout($layout_file)
+ { if(file_exists($layout_file))
+ { $xml_parser = new sxml();
+ $xml_parser->parse(file_get_contents($layout_file));
+ $layout = $xml_parser->data;
+ if(isset($layout["layout"][0]["subs"]))
+ { foreach($layout["layout"][0]["subs"] as $mod => $mod_node)
+ { if(!isset($this->layout[$mod]))
+ { $this->layout[$mod] = array
+ ( "page" => null,
+ "content" => null,
+ "controllers" => array()
+ );
+ }
+ if(isset($mod_node[0]["attrs"]["page"])) $this->layout[$mod]["page"] = $mod_node[0]["attrs"]["page"];
+ if(isset($mod_node[0]["attrs"]["content"])) $this->layout[$mod]["content"] = $mod_node[0]["attrs"]["content"];
+ if(isset($mod_node[0]["subs"]))
+ { foreach($mod_node[0]["subs"] as $controller => $controller_node)
+ { if(!isset($this->layout[$mod]["controllers"][$controller]))
+ { $this->layout[$mod]["controllers"][$controller] = array
+ ( "page" => null,
+ "content" => null,
+ "actions" => array()
+ );
+ }
+ if(isset($controller_node[0]["attrs"]["page"])) $this->layout[$mod]["controllers"][$controller]["page"] = $controller_node[0]["attrs"]["page"];
+ if(isset($controller_node[0]["attrs"]["content"])) $this->layout[$mod]["controllers"][$controller]["content"] = $controller_node[0]["attrs"]["content"];
+ if(isset($controller_node[0]["subs"]))
+ { foreach($controller_node[0]["subs"] as $action => $action_node)
+ { if(!isset($this->layout[$mod]["controllers"][$controller]["actions"][$action]))
+ { $this->layout[$mod]["controllers"][$controller]["actions"][$action] = array
+ ( "page" => null,
+ "content" => null
+ );
+ }
+ if(isset($action_node[0]["attrs"]["page"])) $this->layout[$mod]["controllers"][$controller]["actions"][$action]["page"] = $action_node[0]["attrs"]["page"];
+ if(isset($action_node[0]["attrs"]["content"])) $this->layout[$mod]["controllers"][$controller]["actions"][$action]["content"] = $action_node[0]["attrs"]["content"];
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ function get_layout()
+ { $mod = $this->etat("mod");
+ $controller = $this->etat("controller");
+ $action = $this->etat("action");
+ $content = "";
+ if(isset($this->layout[$mod]["controllers"][$controller]["actions"][$action]["content"]))
+ { $content = $this->layout[$mod]["controllers"][$controller]["actions"][$action]["content"];
+ }
+ else
+ { if(isset($this->layout[$mod]["controllers"][$controller]["content"]))
+ { $content = $this->layout[$mod]["controllers"][$controller]["content"];
+ }
+ else
+ { if(isset($this->layout[$mod]["content"]))
+ { $content = $this->layout[$mod]["content"];
+ }
+ else
+ { if(isset($this->layout["index"]["content"]))
+ { $content = $this->layout["index"]["content"];
+ }
+ }
+ }
+ }
+ $page = "";
+ if(isset($this->layout[$mod]["controllers"][$controller]["actions"][$action]["page"]))
+ { $page = $this->layout[$mod]["controllers"][$controller]["actions"][$action]["page"];
+ }
+ else
+ { if(isset($this->layout[$mod]["controllers"][$controller]["page"]))
+ { $page = $this->layout[$mod]["controllers"][$controller]["page"];
+ }
+ else
+ { if(isset($this->layout[$mod]["page"]))
+ { $page = $this->layout[$mod]["page"];
+ }
+ else
+ { if(isset($this->layout["index"]["page"]))
+ { $content = $this->layout["index"]["page"];
+ }
+ }
+ }
+ }
+ return array
+ ( "page" => $page,
+ "content" => $content
+ );
+ }
+
+ }
+
+?>
\ No newline at end of file
diff --git a/web/app/env/modules/mw_env_plugins.php b/web/app/env/modules/mw_env_plugins.php
new file mode 100644
index 0000000..fc4925b
--- /dev/null
+++ b/web/app/env/modules/mw_env_plugins.php
@@ -0,0 +1,185 @@
+init_plugins($PRIORITE);
+ if($PRIORITE == "ASC") return $this->plugins_asc;
+ if($PRIORITE == "DESC") return $this->plugins_desc;
+ return false;
+ }
+
+ # ---------------------------------------------------------------------------------
+ # init
+ #
+
+ function init_plugins($PRIORITE = "ASC")
+ { if(isset($this->plugins_asc) || isset($this->plugins_desc))
+ { if($PRIORITE == "ASC")
+ { if(!isset($this->plugins_asc)) $this->plugins_asc = $this->ordonne_plugins($this->plugins_desc, $PRIORITE);
+ }
+ elseif($PRIORITE == "DESC")
+ { if(!isset($this->plugins_desc)) $this->plugins_desc = $this->ordonne_plugins($this->plugins_asc, $PRIORITE);
+ }
+ return;
+ }
+ $plugins = array();
+ if(!class_exists("mw_plugin"))
+ { require $this->path("app")."mw_plugin.php";
+ if(!class_exists("mw_plugin"))
+ { $plugins = false;
+ return;
+ }
+ }
+ if(file_exists($this->path("plugins")))
+ { if($dh = opendir($this->path("plugins")))
+ { $OK = true;
+ while($OK && ($plugin_name = readdir($dh)) !== false)
+ { if(substr($plugin_name, 0 ,1) !== "." && is_dir($this->path("plugins").$plugin_name))
+ { if(!isset($plugins[$plugin_name]))
+ { if(($plugin = $this->plugin_data($plugin_name)) !== false)
+ { $MAJ = false;
+ if(!isset($plugin["installed"]) || !isset($plugin["enabled"]))
+ { $plugin["installed"] = false;
+ $plugin["enabled"] = false;
+ $plugin["priorite"] = 0;
+ $MAJ = true;
+ }
+ if(!$plugin["installed"] && $plugin["enabled"]) { $plugin["enabled"] = false; $MAJ = true; }
+ if($MAJ) $OK = $this->set_plugin_data($plugin_name, $plugin);
+ if($OK)
+ { if(($plugin["impl"] = $this->plugin_impl($plugin_name)) !== false)
+ { $plugin["title"] = ($plugin_title = $this->plugin_call($plugin["impl"], "title")) ? $plugin_title : "";
+ $plugin["description"] = ($plugin_description = $this->plugin_call($plugin["impl"], "description")) ? $plugin_description : "";
+ $plugin["name"] = $plugin_name;
+ $plugins[$plugin_name] = $plugin;
+ }
+ }
+ }
+ else $OK = false;
+ }
+ }
+ if(!$OK) $plugins = false;
+ }
+ closedir($dh);
+ if($plugins !== false)
+ { if(file_exists($this->plugins_data_dir()) && is_dir($this->plugins_data_dir()))
+ { if($dh = opendir($this->plugins_data_dir()))
+ { $plugins_data_files = array();
+ $OK = true;
+ while($OK && ($plugin_name = readdir($dh)) !== false)
+ { if(substr($plugin_name, 0 ,1) != "." && !is_dir($this->plugin_data_file($plugin_name)))
+ { if(!$plugins[$plugin_name]) $this->del_plugin_data($plugin_name);
+ }
+ if(!$OK) $plugins = false;
+ }
+ closedir($dh);
+ }
+ }
+ }
+ }
+ else $plugins = false;
+ }
+ if($plugins !== false)
+ { if($PRIORITE == "ASC") $this->plugins_asc = $this->ordonne_plugins($plugins, $PRIORITE);
+ elseif($PRIORITE == "DESC") $this->plugins_desc = $this->ordonne_plugins($plugins, $PRIORITE);
+ }
+ else
+ { $this->plugins_asc = false;
+ $this->plugins_desc = false;
+ }
+ }
+
+ function ordonne_plugins($plugins, $PRIORITE = "ASC")
+ { $values = array_values($plugins);
+ $maximum = count($values);
+ while($maximum > 0)
+ { $maximumTemporaire = 0;
+ for($i = 0; $i < $maximum - 1; $i++)
+ { if
+ ( ($PRIORITE == "ASC" && $values[$i]["priorite"] > $values[$i + 1]["priorite"])
+ || ($PRIORITE == "DESC" && $values[$i]["priorite"] < $values[$i + 1]["priorite"])
+ )
+ { $tmp = $values[$i];
+ $values[$i] = $values[$i + 1];
+ $values[$i + 1] = $tmp;
+ $maximumTemporaire = $i + 1;
+ }
+ }
+ $maximum = $maximumTemporaire;
+ }
+ $res = array();
+ foreach($values as $value) if($value["name"]) $res[$value["name"]] = $value;
+ return $res;
+ }
+
+ function plugin_call($impl, $method) { if(method_exists($impl, $method)) return $impl->$method($this); }
+
+ # ---------------------------------------------------------------------------------
+ # impl
+ #
+
+ function plugin_impl($plugin_name)
+ { $plugin = false;
+ if(file_exists($this->path("plugins")))
+ { if(substr($plugin_name, 0 ,1) !== "." && is_dir($this->path("plugins").$plugin_name))
+ { if(file_exists($this->path("plugins").$plugin_name."/".$plugin_name.".php"))
+ { require $this->path("plugins").$plugin_name."/".$plugin_name.".php";
+ if(class_exists($plugin_name))
+ { $plugin = new $plugin_name();
+ }
+ }
+ }
+ }
+ return $plugin;
+ }
+
+ # ---------------------------------------------------------------------------------
+ # data
+ #
+
+ function plugins_data_dir()
+ { return $this->path("content")."data/plugins/";
+ }
+
+ function plugin_data_file($plugin_name)
+ { return $this->plugins_data_dir().$plugin_name;
+ }
+
+ function plugin_data($plugin_name)
+ { $data_file = $this->plugin_data_file($plugin_name);
+ $data = array();
+ if(file_exists($data_file))
+ { if($content = file_get_contents($data_file))
+ { $data = unserialize($content);
+ }
+ }
+ return $data;
+ }
+
+ function set_plugin_data($plugin_name, $data)
+ { $data_file = $this->plugin_data_file($plugin_name);
+ $content = serialize($data);
+ $OK = false;
+ if($fh = fopen($data_file, "w"))
+ { if(fwrite($fh, $content) !== false)
+ { $OK = true;
+ }
+ fclose($fh);
+ }
+ return $OK;
+ }
+
+ function del_plugin_data($plugin_name)
+ { $data_file = $this->plugin_data_file($plugin_name);
+ if(file_exists($data_file)) return @unlink($data_file);
+ return true;
+ }
+
+ }
+
+?>
\ No newline at end of file
diff --git a/web/app/env/modules/mw_env_run.php b/web/app/env/modules/mw_env_run.php
new file mode 100644
index 0000000..ba47626
--- /dev/null
+++ b/web/app/env/modules/mw_env_run.php
@@ -0,0 +1,174 @@
+data();
+ return $data->get_session_user();
+ }
+
+ function set_etat($etat, $valid_status = true)
+ { if(($this->etat = $this->valid_etat($etat)) !== false)
+ { if(!$valid_status || $this->status_ok($this->etat, false))
+ { return $this->etat;
+ }
+ else $this->erreur("Vous n'avez pas le statut requis pour effectuer cette action");
+ }
+ else $this->erreur("etat invalide");
+ return false;
+ }
+
+ function valid_etat($etat)
+ { $_etat = array();
+ $_etat["mod"] = "";
+ $_etat["controller"] = "";
+ $_etat["action"] = "";
+ if(is_array($etat))
+ { $_etat["mod"] = isset($etat["mod"]) ? $etat["mod"] : "";
+ $_etat["controller"] = isset($etat["controller"]) ? $etat["controller"] : "";
+ $_etat["action"] = isset($etat["action"]) ? $etat["action"] : "";
+ }
+ else
+ { $etat = explode("/", $etat);
+ foreach($etat as $etat_item)
+ { if($etat_item)
+ { if(!$_etat["mod"]) $_etat["mod"] = $etat_item;
+ else
+ { if(!$_etat["controller"]) $_etat["controller"] = $etat_item;
+ else
+ { if(!$_etat["action"]) $_etat["action"] = $etat_item;
+ break;
+ }
+ }
+ }
+ }
+ }
+ if(!$_etat["mod"])
+ { $_etat["mod"] = "index";
+ $_etat["controller"] = "index";
+ $_etat["action"] = "index";
+ }
+ else
+ { if(!$_etat["controller"])
+ { $_etat["controller"] = "index";
+ $_etat["action"] = "index";
+ }
+ else
+ { if(!$_etat["action"]) $_etat["action"] = "index";
+ }
+ }
+ if
+ ( is_array($_etat)
+ && count($_etat) == 3
+ && isset($_etat["mod"]) && preg_match("/^[a-zA-Z0-9_]+$/", $_etat["mod"])
+ && isset($_etat["controller"]) && preg_match("/^[a-zA-Z0-9_]+$/", $_etat["controller"])
+ && isset($_etat["action"]) && preg_match("/^[a-zA-Z0-9_]+$/", $_etat["action"])
+ ) return $_etat;
+ return false;
+ }
+
+ function etat_is_valid()
+ { return $this->valid_etat($this->etat);
+ }
+
+ function status_ok($etat, $CHECK_FORMAT = true)
+ { $OK = $this->config("default_allow");
+ $data = $this->data();
+ if($CHECK_FORMAT) $etat = $this->valid_etat($etat);
+ if($etat !== false)
+ { if(($user_status = $data->get_user_status()) !== false)
+ { if
+ ( ( $action_status = $data->get_action_status
+ ( $etat["mod"],
+ $etat["controller"],
+ $etat["action"]
+ )
+ ) !== false
+ )
+ { $action = $etat["mod"]."/".$etat["controller"]."/".$etat["action"];
+ if(isset($action_status[$action]))
+ { $OK = $action_status[$action][0] || (isset($action_status[$action][$user_status]) && $action_status[$action][$user_status]);
+ }
+ else
+ { $action = $etat["mod"]."/".$etat["controller"];
+ if(isset($action_status[$action]))
+ { $OK = $action_status[$action][0] || (isset($action_status[$action][$user_status]) && $action_status[$action][$user_status]);
+ }
+ else
+ { $action = $etat["mod"];
+ if(isset($action_status[$action]))
+ { $OK = $action_status[$action][0] || (isset($action_status[$action][$user_status]) && $action_status[$action][$user_status]);
+ }
+ }
+ }
+ }
+ else $this->erreur("Impossible de lire les status des actions en base");
+ }
+ else $this->erreur("Impossible de lire le statut de l'utilisateur courant");
+ }
+ else $this->erreur("etat invalide");
+ return $OK;
+ }
+
+ function run($etat, $valid_status = true, $params = array(), $method = "GET")
+ { if($this->set_etat($etat, $valid_status))
+ { $controller_file = "mods/".$this->etat("mod")."/".$this->etat("controller").".php";
+ if($this->app_file_exists($controller_file = "mods/".$this->etat("mod")."/".$this->etat("controller").".php", "DESC"))
+ { if(!class_exists("mw_mod")) require $this->app_file("mods/mw_mod.php");
+ if(!class_exists($controller_class = "mw_".$this->etat("mod")."_".$this->etat("controller")))
+ { require $this->app_file($controller_file, "DESC");
+ }
+ if(class_exists($controller_class))
+ { $controller = new $controller_class();
+ $action_method = $this->etat("action");
+ if(method_exists($controller, $action_method))
+ { foreach($params as $key => $value)
+ { switch(strtolower($method))
+ { case "get": $_GET[$this->param($key)] = $value; break;
+ case "post": $_POST[$key] = $value; break;
+ default: break;
+ }
+ }
+ if(($controller_validate = $controller->validate($this)) === true)
+ { if(($controller_prepare_inputs = $controller->prepare_inputs($this)) === true)
+ { $controller->$action_method($this);
+ }
+ else $this->erreur($controller_prepare_inputs);
+ }
+ else $this->erreur($controller_validate);
+ }
+ else $this->erreur("Impossible de trouver l'action ".$this->etat("action"));
+ }
+ else $this->erreur("Impossible d'instancier le controleur ".$this->etat("controller"));
+ }
+ else $this->erreur("Impossible de trouver le controleur ".$this->etat("controller")." pour le module ".$this->etat("mod"));
+ }
+ else $this->erreur("Impossible d'effectuer cette action");
+ }
+
+ function etat($name) { return $this->etat[$name]; }
+
+ function check_stop()
+ { return $this->etat("mod") == "reponses";
+ }
+
+ function get_mod($mod_name)
+ { if($etat = $this->valid_etat($mod_name))
+ { if($this->app_file_exists($controller_file = "mods/".$etat["mod"]."/".$etat["controller"].".php"))
+ { if(!class_exists("mw_mod")) require $this->app_file("mods/mw_mod.php");
+ if(!class_exists($controller_class = "mw_".$etat["mod"]."_".$etat["controller"]))
+ { require $this->app_file($controller_file);
+ }
+ if(class_exists($controller_class))
+ { return new $controller_class();
+ }
+ }
+ }
+ return false;
+ }
+
+ }
+
+?>
\ No newline at end of file
diff --git a/web/app/env/modules/mw_env_urls.php b/web/app/env/modules/mw_env_urls.php
new file mode 100644
index 0000000..4a8c08a
--- /dev/null
+++ b/web/app/env/modules/mw_env_urls.php
@@ -0,0 +1,47 @@
+additional_get_params = array();
+ $_params = $_SERVER["QUERY_STRING"];
+ $v_params = explode("&", $_params);
+ foreach($v_params as $param)
+ { if($param)
+ { $key = strpos($param, "=") === false ? $param : substr($param, 0, strpos($param, "="));
+ $value = strpos($param, "=") === false ? "" : substr($param, strpos($param, "=") + 1);
+ if(!$this->is_a_param($key)) $this->additional_get_params[$key] = $value;
+ }
+ }
+ }
+
+ function is_a_param($key)
+ { foreach($this->get_PARAMS() as $_key => $_value) if(strcmp($key, $_value) == 0) return true;
+ return false;
+ }
+
+ function url($action = "", $_params = array(), $script_name = "index.php")
+ { if($action) $_params["e"] = $action;
+ $get_params = "";
+ if(isset($this->additional_get_params)) foreach($this->additional_get_params as $key => $value) $get_params .= ($get_params ? "&" : "?").$key."=".$value;
+ foreach($_params as $key => $value) $get_params .= ($get_params ? "&" : "?").$this->param($key)."=".$value;
+ return $this->path("web").$script_name.$get_params;
+ }
+
+ function redirect($url, $message, $wait = 1)
+ { $this->set_etat("reponses/html/redirect_javascript", false);
+ $this->set_out
+ ( "redirect",
+ array
+ ( "url" => str_replace("&", "&", $url),
+ "message" => $message,
+ "wait" => $wait
+ )
+ );
+ }
+
+ }
+
+?>
\ No newline at end of file
diff --git a/web/app/env/mw_env.php b/web/app/env/mw_env.php
new file mode 100644
index 0000000..8350609
--- /dev/null
+++ b/web/app/env/mw_env.php
@@ -0,0 +1,35 @@
+_app_file($file, $PRIORITE);
+ return $app_file ? true : false;
+ }
+
+ function app_file($file, $PRIORITE = "ASC")
+ { $app_file = $this->_app_file($file, $PRIORITE);
+ return $app_file ? $app_file : $file;
+ }
+
+ function _app_file($file, $PRIORITE = "ASC")
+ { $app_file = false;
+ if($PRIORITE == "ASC" && file_exists($this->path("app").$file)) return $this->path("app").$file;
+ if(($plugins = $this->plugins($PRIORITE)) !== false)
+ { foreach($plugins as $plugin_name => $plugin)
+ { if($file && $plugin["installed"] && $plugin["enabled"] && file_exists($this->path("plugins").$plugin_name."/app/".$file))
+ { $app_file = $this->path("plugins").$plugin_name."/app/".$file;
+ break;
+ }
+ }
+ if($PRIORITE == "DESC" && !$app_file)
+ { if(file_exists($this->path("app").$file)) $app_file = $this->path("app").$file;
+ }
+ }
+ return $app_file;
+ }
+
+ }
+
+?>
\ No newline at end of file
diff --git a/web/app/init/0100_functions.php b/web/app/init/0100_functions.php
new file mode 100644
index 0000000..06f135d
--- /dev/null
+++ b/web/app/init/0100_functions.php
@@ -0,0 +1,7 @@
+\n".htmlentities(print_r($content, true))."\n\n";
+ }
+
+?>
\ No newline at end of file
diff --git a/web/app/init/0200_inputs.php b/web/app/init/0200_inputs.php
new file mode 100644
index 0000000..e8759d0
--- /dev/null
+++ b/web/app/init/0200_inputs.php
@@ -0,0 +1,60 @@
+ $v)
+ { unset($process[$key][$k]);
+ if(is_array($v))
+ { $process[$key][stripslashes($k)] = $v;
+ $process[] = &$process[$key][stripslashes($k)];
+ }
+ else $process[$key][stripslashes($k)] = stripslashes($v);
+ }
+ }
+ unset($process);
+ }
+
+
+
+ /*
+ *
+ * decommentez la fin du fichier pour activer le filtrage
+ * des inputs (ici POST et FILES)
+ *
+
+ if($_POST)
+ { require $this->path("libs")."inputfilter.php";
+ $allowed_tags = array
+ ( "p", "span", "pre", "blockquote", "address", "hr", "br",
+ "img",
+ "strong", "em", "u", "i", "b", "s",
+ "a",
+ "ul", "ol", "li",
+ "h1", "h2", "h3", "h4", "h5", "h6"
+ );
+ $allowed_attrs = array
+ ( "style",
+ "src", "alt", "width", "height",
+ "href", "title"
+ );
+ $input_filter = new InputFilter($allowed_tags, $allowed_attrs);
+ $_POST = $input_filter->process($_POST);
+ }
+
+ if($_FILES)
+ { foreach($_FILES as $file_key => $file_infos)
+ { $v_name = explode(".", $file_infos["name"]);
+ $ext = strtolower($v_name[count($v_name) - 1]);
+ if
+ ( $ext != "png"
+ && $ext != "jpg"
+ && $ext != "jpeg"
+ && $ext != "gif"
+ ) unset($_FILES[$file_key]);
+ }
+ }
+
+ */
+
+?>
\ No newline at end of file
diff --git a/web/app/init/0300_data.php b/web/app/init/0300_data.php
new file mode 100644
index 0000000..b4dc586
--- /dev/null
+++ b/web/app/init/0300_data.php
@@ -0,0 +1,40 @@
+app_file("data/mw_sgbd.php");
+ require $this->app_file("data/mw_data.php");
+ if($this->app_file_exists("data/impl/mw_".$this->bdd("sgbd").".php"))
+ { require $this->app_file("data/impl/mw_".$this->bdd("sgbd").".php");
+ if(class_exists($sgbd_impl = "mw_".$this->bdd("sgbd")))
+ { if(($plugins = $this->plugins("DESC")) !== false)
+ { $data = new mw_data(true);
+ foreach($plugins as $plugin_name => $plugin)
+ { if($plugin["installed"] && $plugin["enabled"])
+ { $data->load_modules($this->path("plugins").$plugin_name."/app/", "data/modules/share/");
+ $data->load_modules($this->path("plugins").$plugin_name."/app/", "data/modules/".($this->bdd("sgbd") == "xml" ? "xml" : "sql")."/");
+ }
+ }
+ $data->load_modules($this->path("app"), "data/modules/share/");
+ $data->load_modules($this->path("app"), "data/modules/".($this->bdd("sgbd") == "xml" ? "xml" : "sql")."/");
+ $sgbd = new mw_sgbd
+ ( new $sgbd_impl
+ ( $this->bdd("host"),
+ $this->bdd("base"),
+ $this->bdd("user"),
+ $this->bdd("password")
+ ),
+ $this
+ );
+ if($sgbd->extention_ok())
+ { $data->set_sgbd($sgbd);
+ $data->set_env($this);
+ $this->set_data($data);
+ }
+ else $this->erreur("L'extention php ".$this->bdd("sgbd")." n'est pas installée", true);
+ }
+ else $this->erreur("Impossible de lire les plugins pour charger les modules de donnees");
+ }
+ else $this->erreur("Impossible de trouver la classe d'implementation du sgbd ".$this->bdd("sgbd"), true);
+ }
+ else $this->erreur("Impossible de trouver le fichier d'implementation du sgbd ".$this->bdd("sgbd"), true);
+
+?>
\ No newline at end of file
diff --git a/web/app/init/0400_config.php b/web/app/init/0400_config.php
new file mode 100644
index 0000000..7affb17
--- /dev/null
+++ b/web/app/init/0400_config.php
@@ -0,0 +1,18 @@
+config()) !== false)
+ { $this->set_config($config);
+ $start_action_params_config = $this->config("start_action_params") ? @unserialize($this->config("start_action_params")) : array();
+ $out_config = $this->config("out");
+ $out_config .= $out_config && substr($out_config, -1) != "/" ? "/" : "";
+ $this->set_config
+ ( array
+ ( "out" => $out_config,
+ "start_action_params" => $start_action_params_config
+ )
+ );
+ if($this->set_out_config($data->out_config()) === false) $this->erreur("Impossible de lire la configuration du template");
+ }
+ else $this->erreur("Impossible de lire la configuration", true);
+
+?>
\ No newline at end of file
diff --git a/web/app/init/0500_users.php b/web/app/init/0500_users.php
new file mode 100644
index 0000000..409a7fb
--- /dev/null
+++ b/web/app/init/0500_users.php
@@ -0,0 +1,14 @@
+load_session() !== false)
+ { if($data->init_user_status($this->config("user_status")) !== false)
+ { if($data->init_action_status($this->config("action_status")) !== false)
+ {
+ }
+ else $this->erreur("Impossible de charger les statuts des actions", true);
+ }
+ else $this->erreur("Impossible de charger les statuts des utilisateurs", true);
+ }
+ else $this->erreur("Impossible de charger la session", true);
+
+?>
\ No newline at end of file
diff --git a/web/app/init/0600_check_instance.php b/web/app/init/0600_check_instance.php
new file mode 100644
index 0000000..82f60fa
--- /dev/null
+++ b/web/app/init/0600_check_instance.php
@@ -0,0 +1,11 @@
+check_instance()) !== false)
+ { if($check_instance_return === true)
+ {
+ }
+ else $this->erreur($check_instance_return, true);
+ }
+ else $this->erreur("Impossible de verifier l'integrité de la base de donné", true);
+
+?>
\ No newline at end of file
diff --git a/web/app/init/0700_links.php b/web/app/init/0700_links.php
new file mode 100644
index 0000000..36d5537
--- /dev/null
+++ b/web/app/init/0700_links.php
@@ -0,0 +1,10 @@
+init_links())
+ { $this->set_link("admin/config", $this->url("admin/config"), "Configuration", 10);
+ $this->set_link("admin/users", $this->url("admin/users"), "Utilisateurs", 20);
+ $this->set_link("admin/plugins", $this->url("admin/plugins"), "Plugins", 30);
+ }
+ else $this->erreur("impossible de charger les liens", true);
+
+?>
\ No newline at end of file
diff --git a/web/app/init/0800_init_plugins.php b/web/app/init/0800_init_plugins.php
new file mode 100644
index 0000000..afd3247
--- /dev/null
+++ b/web/app/init/0800_init_plugins.php
@@ -0,0 +1,12 @@
+plugins("DESC")) !== false)
+ { foreach($plugins as $plugin_name => $plugin)
+ { if($plugin["installed"] && $plugin["enabled"])
+ { if(!$plugin["impl"]->init($this)) $this->erreur("erreur lors de l'initialisation du plugin ".$plugin_name, true);
+ }
+ }
+ }
+ else $this->erreur("erreur lors de l'initialisation des plugins", true);
+
+?>
\ No newline at end of file
diff --git a/web/app/init/0900_pre_run.php b/web/app/init/0900_pre_run.php
new file mode 100644
index 0000000..dbcbaeb
--- /dev/null
+++ b/web/app/init/0900_pre_run.php
@@ -0,0 +1,5 @@
+
\ No newline at end of file
diff --git a/web/app/main.php b/web/app/main.php
new file mode 100644
index 0000000..e6bfabe
--- /dev/null
+++ b/web/app/main.php
@@ -0,0 +1,36 @@
+load_modules($PATHES["app"], "env/modules/");
+ $env->set_config_file($config_file);
+ $env->set_PATHES($PATHES);
+ $env->init_plugins();
+ $env->load_config($bdd, $CONFIG);
+ $env->init();
+ $etat = ($etat === false ? false : ($etat ? $etat : (isset($_GET[$env->param("e")]) ? $_GET[$env->param("e")] : "")));
+ if($etat !== false) $env->run($etat);
+ return $env;
+ }
+ else echo "impossible de trouver le fichier env/mw_env.php
";
+ }
+ else echo "impossible de trouver le fichier ".$libs_path."empty_class.php
";
+ }
+ else echo "impossible de trouver le fichier ".$libs_path."sxml.php
";
+ return false;
+ }
+
+ function __mw_display($env)
+ { if($env->etat_is_valid()) $env->render_layout($env->init_layout());
+ }
+
+?>
\ No newline at end of file
diff --git a/web/app/mods/admin/config.php b/web/app/mods/admin/config.php
new file mode 100644
index 0000000..953f982
--- /dev/null
+++ b/web/app/mods/admin/config.php
@@ -0,0 +1,66 @@
+data();
+ if(($CONFIG = $env->get_CONFIG()) !== false)
+ { if(!$CONFIG["out"]) $CONFIG["out"] = "dist";
+ $env->set_out("config", $CONFIG);
+ if(($out_config = $env->get_out_config()) !== false)
+ { $env->set_out("out_config", $out_config);
+ if($env->set_out("out_pathes", $env->out_pathes()) !== false)
+ { if($_POST)
+ { $env->set_out("config", $_POST);
+ if(preg_match("/^[0-9]+$/", $_POST["max_list"]))
+ { if(!$_POST["contact_form"] || trim($_POST["email"]))
+ { $CONTINUE = true;
+ if($CONTINUE && $data->set_config("site_name", $_POST["site_name"]));
+ else $CONTINUE = false;
+ if($CONTINUE && $data->set_config("description", $_POST["description"]));
+ else $CONTINUE = false;
+ if($CONTINUE && $data->set_config("max_list", $_POST["max_list"]));
+ else $CONTINUE = false;
+ if($CONTINUE && $data->set_config("contact_form", $_POST["contact_form"] ? "1" : "0"));
+ else $CONTINUE = false;
+ if($CONTINUE && $data->set_config("email", $_POST["email"]));
+ else $CONTINUE = false;
+ if($CONTINUE && $data->set_config("captcha", $_POST["captcha"] ? "1" : "0"));
+ else $CONTINUE = false;
+ if($CONTINUE && $data->set_config("out", $_POST["out"]));
+ else $CONTINUE = false;
+ if($CONTINUE)
+ { foreach($out_config as $key => $values)
+ { if($data->set_config("out_".$key, isset($_POST["out_".$key]) ? $_POST["out_".$key] : "") === false)
+ { $CONTINUE = false;
+ break;
+ }
+ }
+ }
+ if($CONTINUE) $env->redirect
+ ( $env->url("admin/config"),
+ "la configuration a été enregistrée"
+ );
+ else $env->erreur("Impossible d'enregistrer la configuration");
+ }
+ else $env->message("merci de préciser un email pour le formulaire de contact");
+ }
+ else $env->message("la taille maximum des listes doit être un nombre");
+ }
+ }
+ else $env->erreur("Impossible de lire la liste des templates");
+ }
+ else $env->erreur("Impossible de lire l configuration du templates");
+ }
+ else $env->erreur("Impossible de lire la configuration");
+ }
+
+ }
+
+?>
\ No newline at end of file
diff --git a/web/app/mods/admin/index.php b/web/app/mods/admin/index.php
new file mode 100644
index 0000000..5ef3ed7
--- /dev/null
+++ b/web/app/mods/admin/index.php
@@ -0,0 +1,11 @@
+run("admin/config");
+ }
+
+ }
+
+?>
\ No newline at end of file
diff --git a/web/app/mods/admin/plugins.php b/web/app/mods/admin/plugins.php
new file mode 100644
index 0000000..fe804da
--- /dev/null
+++ b/web/app/mods/admin/plugins.php
@@ -0,0 +1,163 @@
+plugins = $env->plugins("DESC")) === false) return "impossible de lire la liste des plugins";
+ return true;
+ }
+
+ function index(&$env)
+ { if($this->plugins !== false)
+ { if($_POST)
+ { $OK = true;
+ foreach($this->plugins as $plugin_name => $plugin)
+ { if(isset($_POST["priorite_".$plugin_name]))
+ { $this->plugins[$plugin_name]["priorite"] = $_POST["priorite_".$plugin_name];
+ if(!preg_match("/^[0-9]+(\.[0-9]+)?$/", $_POST["priorite_".$plugin_name]))
+ { $env->message("les priorités des plugins doivent être des nombres");
+ $OK = false;
+ break;
+ }
+ }
+ else $this->plugins[$plugin_name]["priorite"] = 0;
+ }
+ if($OK)
+ { foreach($this->plugins as $plugin_name => $plugin)
+ { $plugin_data = array
+ ( "installed" => $this->plugins[$plugin_name]["installed"],
+ "enabled" => $this->plugins[$plugin_name]["enabled"],
+ "priorite" => $this->plugins[$plugin_name]["priorite"]
+ );
+ if(!$env->set_plugin_data($plugin_name, $plugin_data))
+ { $env->erreur("impossible de mettre à jour la priorité du plugin ".$plugin_name);
+ $OK = false;
+ break;
+ }
+ }
+ if($OK)
+ { $env->redirect
+ ( $env->url("admin/plugins/index"),
+ "les priorités des plugins ont été enregistrées"
+ );
+ }
+ }
+ }
+ $env->set_out("plugins", $this->plugins);
+ }
+ else $env->erreur("impossible de lire la liste des plugins");
+ }
+
+ function install(&$env)
+ { $plugin_name = $_GET[$env->param("id")];
+ if(isset($this->plugins[$plugin_name]))
+ { $impl = $this->plugins[$plugin_name]["impl"];
+ $res = $impl->install($env);
+ if($res === true)
+ { $plugin_data = array
+ ( "installed" => true,
+ "enabled" => false,
+ "priorite" => isset($this->plugins[$plugin_name]["priorite"]) ? $this->plugins[$plugin_name]["priorite"] : 0
+ );
+ if($env->set_plugin_data($plugin_name, $plugin_data))
+ { $env->redirect
+ ( $env->url("admin/plugins/index"),
+ "le plugin a été installé"
+ );
+ }
+ else $env->erreur("impossible de mettre à jour le statut du plugin ".$plugin_name);
+ }
+ else $env->erreur("erreur lors de l'installation du plugin ".$plugin_name."
".$res);
+ }
+ else $env->erreur("impossible de trouver le plugin ".$plugin_name);
+ }
+
+ function uninstall(&$env)
+ { $plugin_name = $_GET[$env->param("id")];
+ if(isset($this->plugins[$plugin_name]))
+ { $impl = $this->plugins[$plugin_name]["impl"];
+ $res= $impl->uninstall($env);
+ if($res === true)
+ { $plugin_data = array
+ ( "installed" => false,
+ "enabled" => false,
+ "priorite" => isset($this->plugins[$plugin_name]["priorite"]) ? $this->plugins[$plugin_name]["priorite"] : 0
+ );
+ if($env->set_plugin_data($plugin_name, $plugin_data))
+ { $env->redirect
+ ( $env->url("admin/plugins/index"),
+ "le plugin a été désinstallé"
+ );
+ }
+ else $env->erreur("impossible de mettre à jour le statut du plugin ".$plugin_name);
+ }
+ else $env->erreur("erreur lors de la désinstallation du plugin ".$plugin_name."
".$res);
+ }
+ else $env->erreur("impossible de trouver le plugin ".$plugin_name);
+ }
+
+ function enable(&$env)
+ { $plugin_name = $_GET[$env->param("id")];
+ if(isset($this->plugins[$plugin_name]))
+ { if($this->plugins[$plugin_name]["installed"])
+ { if(!$this->plugins[$plugin_name]["enabled"])
+ { $impl = $this->plugins[$plugin_name]["impl"];
+ $res = $impl->enable($env);
+ if($res === true)
+ { $plugin_data = array
+ ( "installed" => true,
+ "enabled" => true,
+ "priorite" => isset($this->plugins[$plugin_name]["priorite"]) ? $this->plugins[$plugin_name]["priorite"] : 0
+ );
+ if($env->set_plugin_data($plugin_name, $plugin_data))
+ { $env->redirect
+ ( $env->url("admin/plugins/index"),
+ "le plugin a été activé"
+ );
+ }
+ else $env->erreur("impossible de mettre à jour le statut du plugin ".$plugin_name);
+ }
+ else $env->erreur("erreur lors de l'activation du plugin ".$plugin_name."
".$res);
+ }
+ else $env->erreur("le plugin ".$plugin_name." est déjà actif");
+ }
+ else $env->erreur("le plugin ".$plugin_name." n'est pas installé");
+ }
+ else $env->erreur("impossible de trouver le plugin ".$plugin_name);
+ }
+
+ function disable(&$env)
+ { $plugin_name = $_GET[$env->param("id")];
+ if(isset($this->plugins[$plugin_name]))
+ { if($this->plugins[$plugin_name]["installed"])
+ { if($this->plugins[$plugin_name]["enabled"])
+ { $impl = $this->plugins[$plugin_name]["impl"];
+ $res = $impl->disable($env);
+ if($res === true)
+ { $plugin_data = array
+ ( "installed" => true,
+ "enabled" => false,
+ "priorite" => isset($this->plugins[$plugin_name]["priorite"]) ? $this->plugins[$plugin_name]["priorite"] : 0
+ );
+ if($env->set_plugin_data($plugin_name, $plugin_data))
+ { $env->redirect
+ ( $env->url("admin/plugins/index"),
+ "le plugin a été désactivé"
+ );
+ }
+ else $env->erreur("impossible de mettre à jour le statut du plugin ".$plugin_name);
+ }
+ else $env->erreur("erreur lors de la désactivation du plugin ".$plugin_name."
".$res);
+ }
+ else $env->erreur("le plugin ".$plugin_name." est déjà inactif");
+ }
+ else $env->erreur("le plugin ".$plugin_name." n'est pas installé");
+ }
+ else $env->erreur("impossible de trouver le plugin ".$plugin_name);
+ }
+
+ }
+
+?>
\ No newline at end of file
diff --git a/web/app/mods/admin/users.php b/web/app/mods/admin/users.php
new file mode 100644
index 0000000..f175fdc
--- /dev/null
+++ b/web/app/mods/admin/users.php
@@ -0,0 +1,147 @@
+data();
+ if(($this->status = $data->status()) === false) return "impossible de lire la liste des statuts";
+ return true;
+ }
+
+ function index(&$env)
+ { $data = $env->data();
+ if
+ ( $env->set_out
+ ( "users",
+ $data->users
+ ( $_GET[$env->param("start")] ? $_GET[$env->param("start")] : 0,
+ $_GET[$env->param("alpha")],
+ $_GET[$env->param("status")]
+ )
+ ) !== false
+ )
+ { if($this->status)
+ { $env->set_out("status", $this->status);
+ }
+ else $env->erreur("impossible de lire la liste des status");
+ }
+ else $env->erreur("impossible de lire la liste des utilisateurs");
+ }
+
+ function add(&$env)
+ { $data = $env->data();
+ if($this->status)
+ { $env->set_out("status", $this->status);
+ $env->set_out("user", array("status" => $data->creation_default_status()));
+ if($_POST)
+ { $env->set_out("user", $_POST);
+ if($_POST["login"])
+ { if(($exists = $data->user($_POST["login"])) !== false)
+ { if(!$exists)
+ { $VALID = true;
+ if(!$_POST["email"])
+ { $env->message("merci de preciser un email");
+ $VALID = false;
+ }
+ if(!$_POST["password"])
+ { $env->message("merci de preciser un mot de passe");
+ $VALID = false;
+ }
+ if($_POST["password"] != $_POST["password_confirm"])
+ { $env->message("la confirmation du mot de passe est incorrecte");
+ $VALID = false;
+ }
+ if($VALID)
+ { if
+ ( $data->add_user
+ ( $_POST["login"],
+ md5($_POST["password"]),
+ $_POST["email"],
+ $_POST["status"]
+ )
+ )
+ $env->redirect
+ ( $env->url("admin/users"),
+ "l'utilisateur ".$_POST["login"]." a été ajouté"
+ );
+ else $env->erreur("Impossible d'ajouter l'utilisateur");
+ }
+ }
+ else $env->message("ce login existe déjà");
+ }
+ else $env->erreur("impossible de savoir si cet login existe déjà");
+ }
+ else $env->message("merci de préciser un login");
+ }
+ }
+ else $env->erreur("impossible de lire la liste des status");
+ }
+
+ function edit(&$env)
+ { $data = $env->data();
+ if($this->status)
+ { $env->set_out("status", $this->status);
+ if($env->set_out("user", $data->user($_GET[$env->param("id")])))
+ { if($_POST)
+ { $user = $env->out("user");
+ $id = $user["id"];
+ $login = $user["login"];
+ $password = $user["password"];
+ $_POST["login"] = $login;
+ $env->set_out("user", $_POST);
+ $VALID = true;
+ if(!$_POST["email"])
+ { $env->message("merci de preciser un email");
+ $VALID = false;
+ }
+ if(isset($_POST["change_password"]) && $_POST["change_password"])
+ { if(!$_POST["password"])
+ { $env->message("merci de preciser un mot de passe");
+ $VALID = false;
+ }
+ if($_POST["password"] != $_POST["password_confirm"])
+ { $env->message("la confirmation du mot de passe est incorrecte");
+ $VALID = false;
+ }
+ }
+ if($VALID)
+ { if
+ ( $data->set_user
+ ( $id,
+ $login,
+ isset($_POST["change_password"]) && $_POST["change_password"] ? md5($_POST["password"]) : $password,
+ $_POST["email"],
+ $_POST["status"]
+ )
+ )
+ $env->redirect
+ ( $env->url("admin/users"),
+ "l'utilisateur ".$login." a été modifié"
+ );
+ else $env->erreur("Impossible de mettre à jour l'utilisateur");
+ }
+ }
+ }
+ else $env->erreur("Impossible de lire les informations de cet utilisateur");
+ }
+ else $env->erreur("impossible de lire la liste des status");
+ }
+
+ function del(&$env)
+ { $data = $env->data();
+ if($env->set_out("user", $data->user($_GET[$env->param("id")])))
+ { $user = $env->out("user");
+ if($data->del_user($_GET[$env->param("id")])) $env->redirect
+ ( $env->url("admin/users"),
+ "l'utilisateur ".$user["login"]." a été supprimé"
+ );
+ else $env->erreur("Impossible de supprimer l'utilisateur");
+ }
+ else $env->erreur("Impossible de lire les informations de cet utilisateur");
+ }
+
+ }
+
+?>
\ No newline at end of file
diff --git a/web/app/mods/forms/contact.php b/web/app/mods/forms/contact.php
new file mode 100644
index 0000000..d0fcc50
--- /dev/null
+++ b/web/app/mods/forms/contact.php
@@ -0,0 +1,72 @@
+path("libs")."ptitcaptcha.php")) require $this->path("libs")."ptitcaptcha.php";
+
+ class mw_forms_contact extends mw_mod
+ {
+
+ function validate(&$env)
+ { if($pages_view_mod = $env->get_mod("pages/view"))
+ { return $pages_view_mod->validate(&$env);
+ }
+ return true;
+ }
+
+ function index(&$env)
+ { if($env->config("contact_form") && $env->config("email"))
+ { if($_POST)
+ { if
+ ( $this->send
+ ( $env,
+ $_POST["email"],
+ "[".$env->config("site_name")."] nouveau message",
+ $_POST["message"],
+ $env->config("email"),
+ $env->config("captcha")
+ )
+ )
+ { $env->redirect
+ ( $env->url("index"),
+ "Le message a été envoyé",
+ 2
+ );
+ }
+ }
+ }
+ else $env->run("index");
+ }
+
+ function send(&$env, $from, $titre, $message, $dest, $captcha)
+ { $env->set_out("ENVOYE", false);
+ if($captcha && !file_exists($env->path("libs")."ptitcaptcha.php"))
+ { $env->erreur("fichier du captcha introuvable");
+ return false;
+ }
+ if(!$captcha || PtitCaptchaHelper::checkCaptcha())
+ { if($from)
+ { if($dest)
+ { if
+ ( mail
+ ( $dest,
+ $titre,
+ $message,
+ "From: ".$from."\r\n"
+ ."Reply-To: ".$from."\r\n"
+ )
+ )
+ { $env->set_out("ENVOYE", true);
+ return true;
+ }
+ else $env->erreur("Erreur à l'envoi du mail");
+ }
+ else $env->erreur("Impossible de trouver l'email du destinataire");
+ }
+ else $env->message("merci de préciser un email");
+ }
+ else $env->message("anti-spam incorrect");
+ return false;
+ }
+
+ }
+
+?>
\ No newline at end of file
diff --git a/web/app/mods/index/index.php b/web/app/mods/index/index.php
new file mode 100644
index 0000000..9894853
--- /dev/null
+++ b/web/app/mods/index/index.php
@@ -0,0 +1,19 @@
+config("start_action");
+ if($start_action)
+ { $start_action_params = $env->config("start_action_params");
+ if($start_action_params && is_array($start_action_params))
+ { foreach($start_action_params as $key => $value) $_GET[$key] = $value;
+ }
+ $env->run($start_action);
+ }
+ }
+
+ }
+
+?>
\ No newline at end of file
diff --git a/web/app/mods/mw_mod.php b/web/app/mods/mw_mod.php
new file mode 100644
index 0000000..cfba689
--- /dev/null
+++ b/web/app/mods/mw_mod.php
@@ -0,0 +1,12 @@
+prepare_inputs(); }
+
+ }
+
+?>
\ No newline at end of file
diff --git a/web/app/mods/reponses/html.php b/web/app/mods/reponses/html.php
new file mode 100644
index 0000000..db13052
--- /dev/null
+++ b/web/app/mods/reponses/html.php
@@ -0,0 +1,19 @@
+
\ No newline at end of file
diff --git a/web/app/mods/users/compte.php b/web/app/mods/users/compte.php
new file mode 100644
index 0000000..7a6c022
--- /dev/null
+++ b/web/app/mods/users/compte.php
@@ -0,0 +1,37 @@
+validation_result = true;
+ $this->validate_status($env);
+ $this->validate_user($env);
+ return true;
+ }
+
+ function validate_status(&$env)
+ { $data = $env->data();
+ if(($this->status = $data->status()) !== false) $this->validation_result = true;
+ else $this->validation_result = "impossible de lire la liste des statuts";
+ }
+
+ function validate_user(&$env)
+ { if($this->user = $env->user()) $this->validation_result = true;
+ else $this->validation_result = "Vous devez être identifier pour accéder à cette page";
+ }
+
+ function index(&$env)
+ { if($this->validation_result === true)
+ { $env->run("users/infos");
+ }
+ }
+
+ }
+
+?>
\ No newline at end of file
diff --git a/web/app/mods/users/identification.php b/web/app/mods/users/identification.php
new file mode 100644
index 0000000..36b6d2b
--- /dev/null
+++ b/web/app/mods/users/identification.php
@@ -0,0 +1,36 @@
+user())
+ { $data = $env->data();
+ if($data->login(trim($_POST['login']), trim($_POST['pass'])))
+ { $env->redirect
+ ( isset($_POST["from"]) ? urldecode($_POST["from"]) : $this->env->url(),
+ "Vous êtes maintenant identifié en tant que ".$_POST['login']
+ );
+ }
+ else $env->message("Idantifiants incorrects");
+ }
+ else $env->message("Vous êtes déjà identifié");
+ }
+
+ function logout(&$env)
+ { $data = $env->data();
+ if($data->logout())
+ { $env->redirect
+ ( $env->url(),
+ "Vous n'êtes plus identifié sur le site"
+ );
+ }
+ else $env->message("Erreur lors de la deconnection. il se peut que vous soyez encore identifié");
+ }
+
+ }
+
+?>
\ No newline at end of file
diff --git a/web/app/mods/users/index.php b/web/app/mods/users/index.php
new file mode 100644
index 0000000..3cd2462
--- /dev/null
+++ b/web/app/mods/users/index.php
@@ -0,0 +1,11 @@
+run("users/infos");
+ }
+
+ }
+
+?>
\ No newline at end of file
diff --git a/web/app/mods/users/infos.php b/web/app/mods/users/infos.php
new file mode 100644
index 0000000..0b0e427
--- /dev/null
+++ b/web/app/mods/users/infos.php
@@ -0,0 +1,73 @@
+users_compte_mod = $env->get_mod("users/compte"))
+ { $this->users_compte_mod->validation_result = true;
+ $this->users_compte_mod->validate_status($env);
+ $this->users_compte_mod->validate_user($env);
+ return $this->users_compte_mod->validation_result;
+ }
+ return "impossible de trouver le module users/compte";
+ }
+
+ function index(&$env)
+ { $env->run("users/infos/edit");
+ }
+
+ function edit(&$env)
+ { if(isset($this->users_compte_mod->user) && $this->users_compte_mod->user !== false)
+ { $user = $this->users_compte_mod->user;
+ if($_POST)
+ { $data = $env->data();
+ $VALID = true;
+ if($_POST["email"]) $user["email"] = $_POST["email"];
+ else
+ { $env->message("merci de preciser un email");
+ $VALID = false;
+ }
+ if($VALID && isset($_POST["change_password"]) && $_POST["change_password"])
+ { if($_POST["password"])
+ { if($_POST["password"] == $_POST["password_confirm"])
+ { $user["password"] = md5($_POST["password"]);
+ }
+ else
+ { $env->message("la confirmation du mot de passe est incorrecte");
+ $VALID = false;
+ }
+ }
+ else
+ { $env->message("merci de preciser un mot de passe");
+ $VALID = false;
+ }
+ }
+ if($VALID)
+ { if
+ ( $data->set_user
+ ( $user["id"],
+ $user["login"],
+ $user["password"],
+ $user["email"],
+ $user["status"]
+ )
+ )
+ $env->redirect
+ ( $env->url("users/infos"),
+ "vos informations ont été modifiées"
+ );
+ else $env->erreur("Impossible de mettre à jour l'utilisateur");
+ }
+ }
+ $env->set_out("user", $user);
+ $env->set_out("status", $this->users_compte_mod->status);
+ }
+ else $env->erreur("Impossible de lire les informations de l'utilisateur");
+ }
+
+ }
+
+?>
\ No newline at end of file
diff --git a/web/app/mw_plugin.php b/web/app/mw_plugin.php
new file mode 100644
index 0000000..eb91f9d
--- /dev/null
+++ b/web/app/mw_plugin.php
@@ -0,0 +1,38 @@
+
\ No newline at end of file
diff --git a/web/config.php b/web/config.php
new file mode 100644
index 0000000..4ac10a1
--- /dev/null
+++ b/web/config.php
@@ -0,0 +1,65 @@
+mtweb";
+
+?>
\ No newline at end of file
diff --git a/web/content/data/.htaccess b/web/content/data/.htaccess
new file mode 100644
index 0000000..3a42882
--- /dev/null
+++ b/web/content/data/.htaccess
@@ -0,0 +1 @@
+Deny from all
diff --git a/web/content/data/mysql/mtweb.sql b/web/content/data/mysql/mtweb.sql
new file mode 100644
index 0000000..79d3c80
--- /dev/null
+++ b/web/content/data/mysql/mtweb.sql
@@ -0,0 +1,108 @@
+-- phpMyAdmin SQL Dump
+-- version 3.3.2deb1
+-- http://www.phpmyadmin.net
+--
+-- Serveur: localhost
+-- Généré le : Dim 25 Décembre 2011 à 15:01
+-- Version du serveur: 5.1.41
+-- Version de PHP: 5.3.2-1ubuntu4.11
+
+SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
+
+--
+-- Base de données: `mtweb`
+--
+
+-- --------------------------------------------------------
+
+--
+-- Structure de la table `mw_action_status`
+--
+
+CREATE TABLE IF NOT EXISTS `mw_action_status` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `action` varchar(255) NOT NULL,
+ `id_status` int(11) NOT NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=5 ;
+
+--
+-- Contenu de la table `mw_action_status`
+--
+
+INSERT INTO `mw_action_status` (`id`, `action`, `id_status`) VALUES
+(1, 'admin', 1),
+(2, 'users', 1),
+(3, 'users', 2),
+(4, 'users/identification', 0);
+
+-- --------------------------------------------------------
+
+--
+-- Structure de la table `mw_config`
+--
+
+CREATE TABLE IF NOT EXISTS `mw_config` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `key` varchar(255) NOT NULL,
+ `value` text NOT NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=20 ;
+
+--
+-- Contenu de la table `mw_config`
+--
+
+INSERT INTO `mw_config` (`id`, `key`, `value`) VALUES
+(1, 'site_name', 'mtweb'),
+(2, 'max_list', '10'),
+(3, 'description', ''),
+(4, 'out', 'dist'),
+(5, 'start_action', ''),
+(6, 'contact_form', '0'),
+(8, 'email', ''),
+(9, 'captcha', '0'),
+(16, 'start_action_params', '');
+
+-- --------------------------------------------------------
+
+--
+-- Structure de la table `mw_users`
+--
+
+CREATE TABLE IF NOT EXISTS `mw_users` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `login` varchar(255) NOT NULL,
+ `password` varchar(255) NOT NULL,
+ `email` varchar(255) NOT NULL,
+ `status` int(11) NOT NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=8 ;
+
+--
+-- Contenu de la table `mw_users`
+--
+
+INSERT INTO `mw_users` (`id`, `login`, `password`, `email`, `status`) VALUES
+(1, 'admin', '25e4ee4e9229397b6b17776bfceaf8e7', 'admin@domain.tld', 1);
+
+-- --------------------------------------------------------
+
+--
+-- Structure de la table `mw_user_status`
+--
+
+CREATE TABLE IF NOT EXISTS `mw_user_status` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `nom` varchar(255) NOT NULL,
+ `creation_default` tinyint(4) NOT NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=3 ;
+
+--
+-- Contenu de la table `mw_user_status`
+--
+
+INSERT INTO `mw_user_status` (`id`, `nom`, `creation_default`) VALUES
+(1, 'admin', 0),
+(2, 'membre', 1);
diff --git a/web/content/data/xml/mw/action_status/.index b/web/content/data/xml/mw/action_status/.index
new file mode 100644
index 0000000..a6b4ce8
--- /dev/null
+++ b/web/content/data/xml/mw/action_status/.index
@@ -0,0 +1 @@
+176
\ No newline at end of file
diff --git a/web/content/data/xml/mw/action_status/170.xml b/web/content/data/xml/mw/action_status/170.xml
new file mode 100644
index 0000000..8e3fd22
--- /dev/null
+++ b/web/content/data/xml/mw/action_status/170.xml
@@ -0,0 +1,4 @@
+
+
+
+
diff --git a/web/content/data/xml/mw/action_status/171.xml b/web/content/data/xml/mw/action_status/171.xml
new file mode 100644
index 0000000..c662bfd
--- /dev/null
+++ b/web/content/data/xml/mw/action_status/171.xml
@@ -0,0 +1,4 @@
+
+
+
+
diff --git a/web/content/data/xml/mw/action_status/172.xml b/web/content/data/xml/mw/action_status/172.xml
new file mode 100644
index 0000000..c8de13d
--- /dev/null
+++ b/web/content/data/xml/mw/action_status/172.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/web/content/data/xml/mw/action_status/173.xml b/web/content/data/xml/mw/action_status/173.xml
new file mode 100644
index 0000000..d037f86
--- /dev/null
+++ b/web/content/data/xml/mw/action_status/173.xml
@@ -0,0 +1,4 @@
+
+
+
+
diff --git a/web/content/data/xml/mw/config/.index b/web/content/data/xml/mw/config/.index
new file mode 100644
index 0000000..4800c7d
--- /dev/null
+++ b/web/content/data/xml/mw/config/.index
@@ -0,0 +1 @@
+58
\ No newline at end of file
diff --git a/web/content/data/xml/mw/config/1.xml b/web/content/data/xml/mw/config/1.xml
new file mode 100644
index 0000000..9a787f9
--- /dev/null
+++ b/web/content/data/xml/mw/config/1.xml
@@ -0,0 +1,3 @@
+
+
+
diff --git a/web/content/data/xml/mw/config/2.xml b/web/content/data/xml/mw/config/2.xml
new file mode 100644
index 0000000..a9b669e
--- /dev/null
+++ b/web/content/data/xml/mw/config/2.xml
@@ -0,0 +1,3 @@
+
+
+
diff --git a/web/content/data/xml/mw/config/21.xml b/web/content/data/xml/mw/config/21.xml
new file mode 100644
index 0000000..e12352f
--- /dev/null
+++ b/web/content/data/xml/mw/config/21.xml
@@ -0,0 +1,3 @@
+
+
+
diff --git a/web/content/data/xml/mw/config/22.xml b/web/content/data/xml/mw/config/22.xml
new file mode 100644
index 0000000..60f4932
--- /dev/null
+++ b/web/content/data/xml/mw/config/22.xml
@@ -0,0 +1,3 @@
+
+
+
diff --git a/web/content/data/xml/mw/config/34.xml b/web/content/data/xml/mw/config/34.xml
new file mode 100644
index 0000000..7b34699
--- /dev/null
+++ b/web/content/data/xml/mw/config/34.xml
@@ -0,0 +1,3 @@
+
+
+
diff --git a/web/content/data/xml/mw/config/39.xml b/web/content/data/xml/mw/config/39.xml
new file mode 100644
index 0000000..09ef208
--- /dev/null
+++ b/web/content/data/xml/mw/config/39.xml
@@ -0,0 +1,3 @@
+
+
+
diff --git a/web/content/data/xml/mw/config/40.xml b/web/content/data/xml/mw/config/40.xml
new file mode 100644
index 0000000..449c69f
--- /dev/null
+++ b/web/content/data/xml/mw/config/40.xml
@@ -0,0 +1,3 @@
+
+
+
diff --git a/web/content/data/xml/mw/config/41.xml b/web/content/data/xml/mw/config/41.xml
new file mode 100644
index 0000000..7ffdb60
--- /dev/null
+++ b/web/content/data/xml/mw/config/41.xml
@@ -0,0 +1,3 @@
+
+
+
diff --git a/web/content/data/xml/mw/config/55.xml b/web/content/data/xml/mw/config/55.xml
new file mode 100644
index 0000000..590e811
--- /dev/null
+++ b/web/content/data/xml/mw/config/55.xml
@@ -0,0 +1,3 @@
+
+
+
diff --git a/web/content/data/xml/mw/config/56.xml b/web/content/data/xml/mw/config/56.xml
new file mode 100644
index 0000000..4120eef
--- /dev/null
+++ b/web/content/data/xml/mw/config/56.xml
@@ -0,0 +1,3 @@
+
+
+
diff --git a/web/content/data/xml/mw/config/57.xml b/web/content/data/xml/mw/config/57.xml
new file mode 100644
index 0000000..15e20ee
--- /dev/null
+++ b/web/content/data/xml/mw/config/57.xml
@@ -0,0 +1,3 @@
+
+
+
diff --git a/web/content/data/xml/mw/user_status/.index b/web/content/data/xml/mw/user_status/.index
new file mode 100644
index 0000000..bf0d87a
--- /dev/null
+++ b/web/content/data/xml/mw/user_status/.index
@@ -0,0 +1 @@
+4
\ No newline at end of file
diff --git a/web/content/data/xml/mw/user_status/1.xml b/web/content/data/xml/mw/user_status/1.xml
new file mode 100644
index 0000000..fa722e0
--- /dev/null
+++ b/web/content/data/xml/mw/user_status/1.xml
@@ -0,0 +1,4 @@
+
+ admin
+ 0
+
\ No newline at end of file
diff --git a/web/content/data/xml/mw/user_status/2.xml b/web/content/data/xml/mw/user_status/2.xml
new file mode 100644
index 0000000..93bb41f
--- /dev/null
+++ b/web/content/data/xml/mw/user_status/2.xml
@@ -0,0 +1,4 @@
+
+
+
+
diff --git a/web/content/data/xml/mw/users/.index b/web/content/data/xml/mw/users/.index
new file mode 100644
index 0000000..da2d398
--- /dev/null
+++ b/web/content/data/xml/mw/users/.index
@@ -0,0 +1 @@
+14
\ No newline at end of file
diff --git a/web/content/data/xml/mw/users/14.xml b/web/content/data/xml/mw/users/14.xml
new file mode 100644
index 0000000..c69b833
--- /dev/null
+++ b/web/content/data/xml/mw/users/14.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
diff --git a/web/index.php b/web/index.php
new file mode 100644
index 0000000..1320ff3
--- /dev/null
+++ b/web/index.php
@@ -0,0 +1,8 @@
+
\ No newline at end of file
diff --git a/web/libs/empty_class.php b/web/libs/empty_class.php
new file mode 100644
index 0000000..72c5cd9
--- /dev/null
+++ b/web/libs/empty_class.php
@@ -0,0 +1,114 @@
+root_inst = $this;
+ else $this->root_inst = $root_inst;
+ }
+
+ function load_modules($modules_path, $current_modules, $core_modules = null)
+ { $this->_load_modules($modules_path, $current_modules, $this->root_inst, true);
+ if(isset($core_modules) && $current_modules != $core_modules)
+ { $this->_load_modules($modules_path, $core_modules, $this->root_inst, true);
+ }
+ }
+
+ function _load_modules($modules_path, $modules_path_suffixe, $root_inst, $recursif = false)
+ { if(file_exists($modules_path.$modules_path_suffixe) && $dh = opendir($modules_path.$modules_path_suffixe))
+ { while(($file = readdir($dh)) !== false)
+ { if(is_dir($modules_path.$modules_path_suffixe.$file))
+ { if($recursif && substr($file, 0, 1) != ".")
+ { $this->_load_modules($modules_path, $modules_path_suffixe.$file."/", $root_inst, $recursif);
+ }
+ }
+ elseif(strcasecmp(substr($file, -4), ".php") == 0)
+ { $this->load($modules_path.$modules_path_suffixe.$file, $root_inst);
+ }
+ }
+ closedir($dh);
+ }
+ }
+
+ function load($module_file, $root_inst)
+ { if($module_file && file_exists($module_file))
+ { $v_path = explode("/", $module_file);
+ $file = $v_path[count($v_path) - 1];
+ if(strcasecmp(substr($file, -4), ".php") == 0)
+ { $class_name = substr($file, 0, -4);
+ if(!class_exists($class_name))
+ { require_once $module_file;
+ if(version_compare(PHP_VERSION, '5.0.0', '>='))
+ { if(class_exists($class_name) && !isset($this->modules[$class_name]))
+ { $this->modules[$class_name] = new $class_name($root_inst);
+ }
+ }
+ else
+ { if(class_exists($class_name))
+ { aggregate($this, $class_name);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ function __call($method_name, $arguments)
+ { return $this->empty_class_call($this->root_inst, $method_name, $arguments);
+ }
+
+ function empty_class_call($inst, $method_name, $arguments)
+ { $r = false;
+ $args = "";
+ foreach($arguments as $i => $arg) $args .= ($args ? ", " : "")."\$arguments[".$i."]";
+ if(isset($inst->modules)) foreach($inst->modules as $module_name => $module)
+ { if(method_exists($module, $method_name))
+ { eval("\$r = \$module->".$method_name."(".$args.");");
+ break;
+ }
+ else
+ { $r = $this->empty_class_call($module, $method_name, $arguments);
+ if($r !== false) break;
+ }
+ }
+ return $r;
+ }
+
+ }
+
+?>
\ No newline at end of file
diff --git a/web/libs/inputfilter.php b/web/libs/inputfilter.php
new file mode 100644
index 0000000..b023bc0
--- /dev/null
+++ b/web/libs/inputfilter.php
@@ -0,0 +1,315 @@
+tagsArray = (array) $tagsArray;
+ $this->attrArray = (array) $attrArray;
+ $this->tagsMethod = $tagsMethod;
+ $this->attrMethod = $attrMethod;
+ $this->xssAuto = $xssAuto;
+ }
+
+ /**
+ * Method to be called by another php script. Processes for XSS and specified bad code.
+ * @access public
+ * @param Mixed $source - input string/array-of-string to be 'cleaned'
+ * @return String $source - 'cleaned' version of input parameter
+ */
+ function process($source) {
+ // clean all elements in this array
+ if (is_array($source)) {
+ foreach($source as $key => $value)
+ // filter element for XSS and other 'bad' code etc.
+ if (is_string($value)) $source[$key] = $this->remove($this->decode($value));
+ return $source;
+ // clean this string
+ } else if (is_string($source)) {
+ // filter source for XSS and other 'bad' code etc.
+ return $this->remove($this->decode($source));
+ // return parameter as given
+ } else return $source;
+ }
+
+ /**
+ * Internal method to iteratively remove all unwanted tags and attributes
+ * @access protected
+ * @param String $source - input string to be 'cleaned'
+ * @return String $source - 'cleaned' version of input parameter
+ */
+ function remove($source) {
+ $loopCounter=0;
+ // provides nested-tag protection
+ while($source != $this->filterTags($source)) {
+ $source = $this->filterTags($source);
+ $loopCounter++;
+ }
+ return $source;
+ }
+
+ /**
+ * Internal method to strip a string of certain tags
+ * @access protected
+ * @param String $source - input string to be 'cleaned'
+ * @return String $source - 'cleaned' version of input parameter
+ */
+ function filterTags($source) {
+ // filter pass setup
+ $preTag = NULL;
+ $postTag = $source;
+ // find initial tag's position
+ $tagOpen_start = strpos($source, '<');
+ // interate through string until no tags left
+ while($tagOpen_start !== FALSE) {
+ // process tag interatively
+ $preTag .= substr($postTag, 0, $tagOpen_start);
+ $postTag = substr($postTag, $tagOpen_start);
+ $fromTagOpen = substr($postTag, 1);
+ // end of tag
+ $tagOpen_end = strpos($fromTagOpen, '>');
+ if ($tagOpen_end === false) break;
+ // next start of tag (for nested tag assessment)
+ $tagOpen_nested = strpos($fromTagOpen, '<');
+ if (($tagOpen_nested !== false) && ($tagOpen_nested < $tagOpen_end)) {
+ $preTag .= substr($postTag, 0, ($tagOpen_nested+1));
+ $postTag = substr($postTag, ($tagOpen_nested+1));
+ $tagOpen_start = strpos($postTag, '<');
+ continue;
+ }
+ $tagOpen_nested = (strpos($fromTagOpen, '<') + $tagOpen_start + 1);
+ $currentTag = substr($fromTagOpen, 0, $tagOpen_end);
+ $tagLength = strlen($currentTag);
+ if (!$tagOpen_end) {
+ $preTag .= $postTag;
+ $tagOpen_start = strpos($postTag, '<');
+ }
+ // iterate through tag finding attribute pairs - setup
+ $tagLeft = $currentTag;
+ $attrSet = array();
+ $currentSpace = strpos($tagLeft, ' ');
+ // is end tag
+ if (substr($currentTag, 0, 1) == "/") {
+ $isCloseTag = TRUE;
+ list($tagName) = explode(' ', $currentTag);
+ $tagName = substr($tagName, 1);
+ // is start tag
+ } else {
+ $isCloseTag = FALSE;
+ list($tagName) = explode(' ', $currentTag);
+ }
+ // excludes all "non-regular" tagnames OR no tagname OR remove if xssauto is on and tag is blacklisted
+ if ((!preg_match("/^[a-z][a-z0-9]*$/i",$tagName)) || (!$tagName) || ((in_array(strtolower($tagName), $this->tagBlacklist)) && ($this->xssAuto))) {
+ $postTag = substr($postTag, ($tagLength + 2));
+ $tagOpen_start = strpos($postTag, '<');
+ // don't append this tag
+ continue;
+ }
+ // this while is needed to support attribute values with spaces in!
+ while ($currentSpace !== FALSE) {
+ $fromSpace = substr($tagLeft, ($currentSpace+1));
+ $nextSpace = strpos($fromSpace, ' ');
+ $openQuotes = strpos($fromSpace, '"');
+ $closeQuotes = strpos(substr($fromSpace, ($openQuotes+1)), '"') + $openQuotes + 1;
+ // another equals exists
+ if (strpos($fromSpace, '=') !== FALSE) {
+ // opening and closing quotes exists
+ if (($openQuotes !== FALSE) && (strpos(substr($fromSpace, ($openQuotes+1)), '"') !== FALSE))
+ $attr = substr($fromSpace, 0, ($closeQuotes+1));
+ // one or neither exist
+ else $attr = substr($fromSpace, 0, $nextSpace);
+ // no more equals exist
+ } else $attr = substr($fromSpace, 0, $nextSpace);
+ // last attr pair
+ if (!$attr) $attr = $fromSpace;
+ // add to attribute pairs array
+ $attrSet[] = $attr;
+ // next inc
+ $tagLeft = substr($fromSpace, strlen($attr));
+ $currentSpace = strpos($tagLeft, ' ');
+ }
+ // appears in array specified by user
+ $tagFound = in_array(strtolower($tagName), $this->tagsArray);
+ // remove this tag on condition
+ if ((!$tagFound && $this->tagsMethod) || ($tagFound && !$this->tagsMethod)) {
+ // reconstruct tag with allowed attributes
+ if (!$isCloseTag) {
+ $attrSet = $this->filterAttr($attrSet);
+ $preTag .= '<' . $tagName;
+ for ($i = 0; $i < count($attrSet); $i++)
+ $preTag .= ' ' . $attrSet[$i];
+ // reformat single tags to XHTML
+ if (strpos($fromTagOpen, "" . $tagName)) $preTag .= '>';
+ else $preTag .= ' />';
+ // just the tagname
+ } else $preTag .= '' . $tagName . '>';
+ }
+ // find next tag's start
+ $postTag = substr($postTag, ($tagLength + 2));
+ $tagOpen_start = strpos($postTag, '<');
+ }
+ // append any code after end of tags
+ $preTag .= $postTag;
+ return $preTag;
+ }
+
+ /**
+ * Internal method to strip a tag of certain attributes
+ * @access protected
+ * @param Array $attrSet
+ * @return Array $newSet
+ */
+ function filterAttr($attrSet) {
+ $newSet = array();
+ // process attributes
+ for ($i = 0; $i xssAuto) && ((in_array(strtolower($attrSubSet[0]), $this->attrBlacklist)) || (substr($attrSubSet[0], 0, 2) == 'on'))))
+ continue;
+ // xss attr value filtering
+ if ($attrSubSet[1]) {
+ // strips unicode, hex, etc
+ $attrSubSet[1] = str_replace('', '', $attrSubSet[1]);
+ // strip normal newline within attr value
+ $attrSubSet[1] = preg_replace('/\s+/', '', $attrSubSet[1]);
+ // strip double quotes
+ $attrSubSet[1] = str_replace('"', '', $attrSubSet[1]);
+ // [requested feature] convert single quotes from either side to doubles (Single quotes shouldn't be used to pad attr value)
+ if ((substr($attrSubSet[1], 0, 1) == "'") && (substr($attrSubSet[1], (strlen($attrSubSet[1]) - 1), 1) == "'"))
+ $attrSubSet[1] = substr($attrSubSet[1], 1, (strlen($attrSubSet[1]) - 2));
+ // strip slashes
+ $attrSubSet[1] = stripslashes($attrSubSet[1]);
+ }
+ // auto strip attr's with "javascript:
+ if ( ((strpos(strtolower($attrSubSet[1]), 'expression') !== false) && (strtolower($attrSubSet[0]) == 'style')) ||
+ (strpos(strtolower($attrSubSet[1]), 'javascript:') !== false) ||
+ (strpos(strtolower($attrSubSet[1]), 'behaviour:') !== false) ||
+ (strpos(strtolower($attrSubSet[1]), 'vbscript:') !== false) ||
+ (strpos(strtolower($attrSubSet[1]), 'mocha:') !== false) ||
+ (strpos(strtolower($attrSubSet[1]), 'livescript:') !== false)
+ ) continue;
+
+ // if matches user defined array
+ $attrFound = in_array(strtolower($attrSubSet[0]), $this->attrArray);
+ // keep this attr on condition
+ if ((!$attrFound && $this->attrMethod) || ($attrFound && !$this->attrMethod)) {
+ // attr has value
+ if ($attrSubSet[1]) $newSet[] = $attrSubSet[0] . '="' . $attrSubSet[1] . '"';
+ // attr has decimal zero as value
+ else if ($attrSubSet[1] == "0") $newSet[] = $attrSubSet[0] . '="0"';
+ // reformat single attributes to XHTML
+ else $newSet[] = $attrSubSet[0] . '="' . $attrSubSet[0] . '"';
+ }
+ }
+ return $newSet;
+ }
+
+ /**
+ * Try to convert to plaintext
+ * @access protected
+ * @param String $source
+ * @return String $source
+ */
+ function decode($source) {
+ // url decode
+// $source = html_entity_decode($source, ENT_QUOTES, "ISO-8859-1");
+ $source = html_entity_decode($source, ENT_QUOTES, "UTF-8");
+ // convert decimal
+ $source = preg_replace('/(\d+);/me',"chr(\\1)", $source); // decimal notation
+ // convert hex
+ $source = preg_replace('/([a-f0-9]+);/mei',"chr(0x\\1)", $source); // hex notation
+ return $source;
+ }
+
+ /**
+ * Method to be called by another php script. Processes for SQL injection
+ * @access public
+ * @param Mixed $source - input string/array-of-string to be 'cleaned'
+ * @param Buffer $connection - An open MySQL connection
+ * @return String $source - 'cleaned' version of input parameter
+ */
+ function safeSQL($source, &$connection) {
+ // clean all elements in this array
+ if (is_array($source)) {
+ foreach($source as $key => $value)
+ // filter element for SQL injection
+ if (is_string($value)) $source[$key] = $this->quoteSmart($this->decode($value), $connection);
+ return $source;
+ // clean this string
+ } else if (is_string($source)) {
+ // filter source for SQL injection
+ if (is_string($source)) return $this->quoteSmart($this->decode($source), $connection);
+ // return parameter as given
+ } else return $source;
+ }
+
+ /**
+ * @author Chris Tobin
+ * @author Daniel Morris
+ * @access protected
+ * @param String $source
+ * @param Resource $connection - An open MySQL connection
+ * @return String $source
+ */
+ function quoteSmart($source, &$connection) {
+ // strip slashes
+ if (get_magic_quotes_gpc()) $source = stripslashes($source);
+ // quote both numeric and text
+ $source = $this->escapeString($source, $connection);
+ return $source;
+ }
+
+ /**
+ * @author Chris Tobin
+ * @author Daniel Morris
+ * @access protected
+ * @param String $source
+ * @param Resource $connection - An open MySQL connection
+ * @return String $source
+ */
+ function escapeString($string, &$connection) {
+ // depreciated function
+ if (version_compare(phpversion(),"4.3.0", "<")) mysql_escape_string($string);
+ // current function
+ else mysql_real_escape_string($string);
+ return $string;
+ }
+}
+
+?>
\ No newline at end of file
diff --git a/web/libs/ptitcaptcha.php b/web/libs/ptitcaptcha.php
new file mode 100644
index 0000000..6e24126
--- /dev/null
+++ b/web/libs/ptitcaptcha.php
@@ -0,0 +1,127 @@
+\n";
+ }
+
+ /**
+ * Generate hidden tag (must be in a form)
+ *
+ * @return input hidden tag
+ */
+ function generateHiddenTags()
+ {
+ return "";
+ }
+
+ /**
+ * Generate input tag (must be in a form)
+ *
+ * @return input tag
+ */
+ function generateInputTags()
+ {
+ return "";
+ }
+
+ /**
+ * Check if user input is correct
+ *
+ * @return boolean (true=correct, false=incorrect)
+ */
+ function checkCaptcha()
+ {
+ if( isset($_POST['ptitcaptcha_entry']) &&
+ $_POST['ptitcaptcha_entry'] == PtitCaptchaHelper::_getDisplayText($_POST['ptitcaptcha_key']))
+ {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Internal function
+ *
+ * @param string $pck
+ * @return string
+ */
+ function _getDisplayText($pck) // internal function
+ {
+ $src=md5(PTITCAPTCHA_ENTROPY.$pck);
+ $txt="";
+ for($i=0;$i
\ No newline at end of file
diff --git a/web/libs/sxml.php b/web/libs/sxml.php
new file mode 100644
index 0000000..78533f3
--- /dev/null
+++ b/web/libs/sxml.php
@@ -0,0 +1,74 @@
+parser, XML_OPTION_CASE_FOLDING, 0);
+ dans la fonction parse($data) pour la prise en compte de la casse
+
+- if($attribs) $this->data['attrs'] = $attribs;
+ dans la fonction tag_open pour la prise en compte des attributs
+
+*/
+
+class sxml
+{
+ var $parser;
+ var $error_code;
+ var $error_string;
+ var $current_line;
+ var $current_column;
+ var $data;
+ var $datas;
+ function parse($data)
+ {
+// $this->parser = xml_parser_create('UTF-8');
+ $this->data = array();
+ $this->datas = array();
+ $this->parser = xml_parser_create();
+ xml_set_object($this->parser, $this);
+ xml_parser_set_option($this->parser, XML_OPTION_SKIP_WHITE, 1);
+ xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, 0);
+ xml_set_element_handler($this->parser, 'tag_open', 'tag_close');
+ xml_set_character_data_handler($this->parser, 'cdata');
+ if (!xml_parse($this->parser, $data))
+ {
+ $this->data = array();
+ $this->error_code = xml_get_error_code($this->parser);
+ $this->error_string = xml_error_string($this->error_code);
+ $this->current_line = xml_get_current_line_number($this->parser);
+ $this->current_column = xml_get_current_column_number($this->parser);
+ }
+ else
+ {
+ $this->data = $this->data['subs'];
+ }
+ xml_parser_free($this->parser);
+ }
+
+ function tag_open($parser, $tag, $attribs)
+ {
+ $this->datas[] = &$this->data;
+ $this->data = &$this->data['subs'][$tag][];
+ if($attribs) $this->data['attrs'] = $attribs;
+
+ }
+
+ function cdata($parser, $cdata)
+ {
+ @$this->data['data'] .= $cdata;
+ }
+
+ function tag_close($parser, $tag)
+ {
+ $this->data =& $this->datas[count($this->datas)-1];
+ array_pop($this->datas);
+ }
+}
+
+?>
\ No newline at end of file
diff --git a/web/libs/tiny_mce/langs/en.js b/web/libs/tiny_mce/langs/en.js
new file mode 100644
index 0000000..ea4a1b0
--- /dev/null
+++ b/web/libs/tiny_mce/langs/en.js
@@ -0,0 +1,170 @@
+tinyMCE.addI18n({en:{
+common:{
+edit_confirm:"Do you want to use the WYSIWYG mode for this textarea?",
+apply:"Apply",
+insert:"Insert",
+update:"Update",
+cancel:"Cancel",
+close:"Close",
+browse:"Browse",
+class_name:"Class",
+not_set:"-- Not set --",
+clipboard_msg:"Copy/Cut/Paste is not available in Mozilla and Firefox.\nDo you want more information about this issue?",
+clipboard_no_support:"Currently not supported by your browser, use keyboard shortcuts instead.",
+popup_blocked:"Sorry, but we have noticed that your popup-blocker has disabled a window that provides application functionality. You will need to disable popup blocking on this site in order to fully utilize this tool.",
+invalid_data:"Error: Invalid values entered, these are marked in red.",
+more_colors:"More colors"
+},
+contextmenu:{
+align:"Alignment",
+left:"Left",
+center:"Center",
+right:"Right",
+full:"Full"
+},
+insertdatetime:{
+date_fmt:"%Y-%m-%d",
+time_fmt:"%H:%M:%S",
+insertdate_desc:"Insert date",
+inserttime_desc:"Insert time",
+months_long:"January,February,March,April,May,June,July,August,September,October,November,December",
+months_short:"Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec",
+day_long:"Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday,Sunday",
+day_short:"Sun,Mon,Tue,Wed,Thu,Fri,Sat,Sun"
+},
+print:{
+print_desc:"Print"
+},
+preview:{
+preview_desc:"Preview"
+},
+directionality:{
+ltr_desc:"Direction left to right",
+rtl_desc:"Direction right to left"
+},
+layer:{
+insertlayer_desc:"Insert new layer",
+forward_desc:"Move forward",
+backward_desc:"Move backward",
+absolute_desc:"Toggle absolute positioning",
+content:"New layer..."
+},
+save:{
+save_desc:"Save",
+cancel_desc:"Cancel all changes"
+},
+nonbreaking:{
+nonbreaking_desc:"Insert non-breaking space character"
+},
+iespell:{
+iespell_desc:"Run spell checking",
+download:"ieSpell not detected. Do you want to install it now?"
+},
+advhr:{
+advhr_desc:"Horizontal rule"
+},
+emotions:{
+emotions_desc:"Emotions"
+},
+searchreplace:{
+search_desc:"Find",
+replace_desc:"Find/Replace"
+},
+advimage:{
+image_desc:"Insert/edit image"
+},
+advlink:{
+link_desc:"Insert/edit link"
+},
+xhtmlxtras:{
+cite_desc:"Citation",
+abbr_desc:"Abbreviation",
+acronym_desc:"Acronym",
+del_desc:"Deletion",
+ins_desc:"Insertion",
+attribs_desc:"Insert/Edit Attributes"
+},
+style:{
+desc:"Edit CSS Style"
+},
+paste:{
+paste_text_desc:"Paste as Plain Text",
+paste_word_desc:"Paste from Word",
+selectall_desc:"Select All",
+plaintext_mode_sticky:"Paste is now in plain text mode. Click again to toggle back to regular paste mode. After you paste something you will be returned to regular paste mode.",
+plaintext_mode:"Paste is now in plain text mode. Click again to toggle back to regular paste mode."
+},
+paste_dlg:{
+text_title:"Use CTRL+V on your keyboard to paste the text into the window.",
+text_linebreaks:"Keep linebreaks",
+word_title:"Use CTRL+V on your keyboard to paste the text into the window."
+},
+table:{
+desc:"Inserts a new table",
+row_before_desc:"Insert row before",
+row_after_desc:"Insert row after",
+delete_row_desc:"Delete row",
+col_before_desc:"Insert column before",
+col_after_desc:"Insert column after",
+delete_col_desc:"Remove column",
+split_cells_desc:"Split merged table cells",
+merge_cells_desc:"Merge table cells",
+row_desc:"Table row properties",
+cell_desc:"Table cell properties",
+props_desc:"Table properties",
+paste_row_before_desc:"Paste table row before",
+paste_row_after_desc:"Paste table row after",
+cut_row_desc:"Cut table row",
+copy_row_desc:"Copy table row",
+del:"Delete table",
+row:"Row",
+col:"Column",
+cell:"Cell"
+},
+autosave:{
+unload_msg:"The changes you made will be lost if you navigate away from this page.",
+restore_content:"Restore auto-saved content.",
+warning_message:"If you restore the saved content, you will lose all the content that is currently in the editor.\n\nAre you sure you want to restore the saved content?."
+},
+fullscreen:{
+desc:"Toggle fullscreen mode"
+},
+media:{
+desc:"Insert / edit embedded media",
+edit:"Edit embedded media"
+},
+fullpage:{
+desc:"Document properties"
+},
+template:{
+desc:"Insert predefined template content"
+},
+visualchars:{
+desc:"Visual control characters on/off."
+},
+spellchecker:{
+desc:"Toggle spellchecker",
+menu:"Spellchecker settings",
+ignore_word:"Ignore word",
+ignore_words:"Ignore all",
+langs:"Languages",
+wait:"Please wait...",
+sug:"Suggestions",
+no_sug:"No suggestions",
+no_mpell:"No misspellings found."
+},
+pagebreak:{
+desc:"Insert page break."
+},
+advlist:{
+types:"Types",
+def:"Default",
+lower_alpha:"Lower alpha",
+lower_greek:"Lower greek",
+lower_roman:"Lower roman",
+upper_alpha:"Upper alpha",
+upper_roman:"Upper roman",
+circle:"Circle",
+disc:"Disc",
+square:"Square"
+}}});
\ No newline at end of file
diff --git a/web/libs/tiny_mce/license.txt b/web/libs/tiny_mce/license.txt
new file mode 100644
index 0000000..60d6d4c
--- /dev/null
+++ b/web/libs/tiny_mce/license.txt
@@ -0,0 +1,504 @@
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 2.1, February 1999
+
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the Lesser GPL. It also counts
+ as the successor of the GNU Library Public License, version 2, hence
+ the version number 2.1.]
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+ This license, the Lesser General Public License, applies to some
+specially designated software packages--typically libraries--of the
+Free Software Foundation and other authors who decide to use it. You
+can use it too, but we suggest you first think carefully about whether
+this license or the ordinary General Public License is the better
+strategy to use in any particular case, based on the explanations below.
+
+ When we speak of free software, we are referring to freedom of use,
+not price. Our General Public Licenses are designed to make sure that
+you have the freedom to distribute copies of free software (and charge
+for this service if you wish); that you receive source code or can get
+it if you want it; that you can change the software and use pieces of
+it in new free programs; and that you are informed that you can do
+these things.
+
+ To protect your rights, we need to make restrictions that forbid
+distributors to deny you these rights or to ask you to surrender these
+rights. These restrictions translate to certain responsibilities for
+you if you distribute copies of the library or if you modify it.
+
+ For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you. You must make sure that they, too, receive or can get the source
+code. If you link other code with the library, you must provide
+complete object files to the recipients, so that they can relink them
+with the library after making changes to the library and recompiling
+it. And you must show them these terms so they know their rights.
+
+ We protect your rights with a two-step method: (1) we copyright the
+library, and (2) we offer you this license, which gives you legal
+permission to copy, distribute and/or modify the library.
+
+ To protect each distributor, we want to make it very clear that
+there is no warranty for the free library. Also, if the library is
+modified by someone else and passed on, the recipients should know
+that what they have is not the original version, so that the original
+author's reputation will not be affected by problems that might be
+introduced by others.
+
+ Finally, software patents pose a constant threat to the existence of
+any free program. We wish to make sure that a company cannot
+effectively restrict the users of a free program by obtaining a
+restrictive license from a patent holder. Therefore, we insist that
+any patent license obtained for a version of the library must be
+consistent with the full freedom of use specified in this license.
+
+ Most GNU software, including some libraries, is covered by the
+ordinary GNU General Public License. This license, the GNU Lesser
+General Public License, applies to certain designated libraries, and
+is quite different from the ordinary General Public License. We use
+this license for certain libraries in order to permit linking those
+libraries into non-free programs.
+
+ When a program is linked with a library, whether statically or using
+a shared library, the combination of the two is legally speaking a
+combined work, a derivative of the original library. The ordinary
+General Public License therefore permits such linking only if the
+entire combination fits its criteria of freedom. The Lesser General
+Public License permits more lax criteria for linking other code with
+the library.
+
+ We call this license the "Lesser" General Public License because it
+does Less to protect the user's freedom than the ordinary General
+Public License. It also provides other free software developers Less
+of an advantage over competing non-free programs. These disadvantages
+are the reason we use the ordinary General Public License for many
+libraries. However, the Lesser license provides advantages in certain
+special circumstances.
+
+ For example, on rare occasions, there may be a special need to
+encourage the widest possible use of a certain library, so that it becomes
+a de-facto standard. To achieve this, non-free programs must be
+allowed to use the library. A more frequent case is that a free
+library does the same job as widely used non-free libraries. In this
+case, there is little to gain by limiting the free library to free
+software only, so we use the Lesser General Public License.
+
+ In other cases, permission to use a particular library in non-free
+programs enables a greater number of people to use a large body of
+free software. For example, permission to use the GNU C Library in
+non-free programs enables many more people to use the whole GNU
+operating system, as well as its variant, the GNU/Linux operating
+system.
+
+ Although the Lesser General Public License is Less protective of the
+users' freedom, it does ensure that the user of a program that is
+linked with the Library has the freedom and the wherewithal to run
+that program using a modified version of the Library.
+
+ The precise terms and conditions for copying, distribution and
+modification follow. Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library". The
+former contains code derived from the library, whereas the latter must
+be combined with the library in order to run.
+
+ GNU LESSER GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License Agreement applies to any software library or other
+program which contains a notice placed by the copyright holder or
+other authorized party saying it may be distributed under the terms of
+this Lesser General Public License (also called "this License").
+Each licensee is addressed as "you".
+
+ A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+ The "Library", below, refers to any such software library or work
+which has been distributed under these terms. A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language. (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+ "Source code" for a work means the preferred form of the work for
+making modifications to it. For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control compilation
+and installation of the library.
+
+ Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it). Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+
+ 1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+ You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+
+ 2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) The modified work must itself be a software library.
+
+ b) You must cause the files modified to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ c) You must cause the whole of the work to be licensed at no
+ charge to all third parties under the terms of this License.
+
+ d) If a facility in the modified Library refers to a function or a
+ table of data to be supplied by an application program that uses
+ the facility, other than as an argument passed when the facility
+ is invoked, then you must make a good faith effort to ensure that,
+ in the event an application does not supply such function or
+ table, the facility still operates, and performs whatever part of
+ its purpose remains meaningful.
+
+ (For example, a function in a library to compute square roots has
+ a purpose that is entirely well-defined independent of the
+ application. Therefore, Subsection 2d requires that any
+ application-supplied function or table used by this function must
+ be optional: if the application does not supply it, the square
+ root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library. To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License. (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.) Do not make any other change in
+these notices.
+
+ Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+ This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+ 4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+ If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library". Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+ However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library". The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+ When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library. The
+threshold for this to be true is not precisely defined by law.
+
+ If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work. (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+ Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+
+ 6. As an exception to the Sections above, you may also combine or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+ You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License. You must supply a copy of this License. If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License. Also, you must do one
+of these things:
+
+ a) Accompany the work with the complete corresponding
+ machine-readable source code for the Library including whatever
+ changes were used in the work (which must be distributed under
+ Sections 1 and 2 above); and, if the work is an executable linked
+ with the Library, with the complete machine-readable "work that
+ uses the Library", as object code and/or source code, so that the
+ user can modify the Library and then relink to produce a modified
+ executable containing the modified Library. (It is understood
+ that the user who changes the contents of definitions files in the
+ Library will not necessarily be able to recompile the application
+ to use the modified definitions.)
+
+ b) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (1) uses at run time a
+ copy of the library already present on the user's computer system,
+ rather than copying library functions into the executable, and (2)
+ will operate properly with a modified version of the library, if
+ the user installs one, as long as the modified version is
+ interface-compatible with the version that the work was made with.
+
+ c) Accompany the work with a written offer, valid for at
+ least three years, to give the same user the materials
+ specified in Subsection 6a, above, for a charge no more
+ than the cost of performing this distribution.
+
+ d) If distribution of the work is made by offering access to copy
+ from a designated place, offer equivalent access to copy the above
+ specified materials from the same place.
+
+ e) Verify that the user has already received a copy of these
+ materials or that you have already sent this user a copy.
+
+ For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it. However, as a special exception,
+the materials to be distributed need not include anything that is
+normally distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+ It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system. Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+
+ 7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+ a) Accompany the combined library with a copy of the same work
+ based on the Library, uncombined with any other library
+ facilities. This must be distributed under the terms of the
+ Sections above.
+
+ b) Give prominent notice with the combined library of the fact
+ that part of it is a work based on the Library, and explaining
+ where to find the accompanying uncombined form of the same work.
+
+ 8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License. Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License. However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+ 9. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Library or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+ 10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties with
+this License.
+
+ 11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all. For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply,
+and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License may add
+an explicit geographical distribution limitation excluding those countries,
+so that distribution is permitted only in or among countries not thus
+excluded. In such case, this License incorporates the limitation as if
+written in the body of this License.
+
+ 13. The Free Software Foundation may publish revised and/or new
+versions of the Lesser General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation. If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+
+ 14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission. For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this. Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+ NO WARRANTY
+
+ 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Libraries
+
+ If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change. You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms of the
+ordinary General Public License).
+
+ To apply these terms, attach the following notices to the library. It is
+safest to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.
+
+
+ Copyright (C)
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the library, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the
+ library `Frob' (a library for tweaking knobs) written by James Random Hacker.
+
+ , 1 April 1990
+ Ty Coon, President of Vice
+
+That's all there is to it!
+
+
diff --git a/web/libs/tiny_mce/plugins/advhr/css/advhr.css b/web/libs/tiny_mce/plugins/advhr/css/advhr.css
new file mode 100644
index 0000000..0e22834
--- /dev/null
+++ b/web/libs/tiny_mce/plugins/advhr/css/advhr.css
@@ -0,0 +1,5 @@
+input.radio {border:1px none #000; background:transparent; vertical-align:middle;}
+.panel_wrapper div.current {height:80px;}
+#width {width:50px; vertical-align:middle;}
+#width2 {width:50px; vertical-align:middle;}
+#size {width:100px;}
diff --git a/web/libs/tiny_mce/plugins/advhr/editor_plugin.js b/web/libs/tiny_mce/plugins/advhr/editor_plugin.js
new file mode 100644
index 0000000..4d3b062
--- /dev/null
+++ b/web/libs/tiny_mce/plugins/advhr/editor_plugin.js
@@ -0,0 +1 @@
+(function(){tinymce.create("tinymce.plugins.AdvancedHRPlugin",{init:function(a,b){a.addCommand("mceAdvancedHr",function(){a.windowManager.open({file:b+"/rule.htm",width:250+parseInt(a.getLang("advhr.delta_width",0)),height:160+parseInt(a.getLang("advhr.delta_height",0)),inline:1},{plugin_url:b})});a.addButton("advhr",{title:"advhr.advhr_desc",cmd:"mceAdvancedHr"});a.onNodeChange.add(function(d,c,e){c.setActive("advhr",e.nodeName=="HR")});a.onClick.add(function(c,d){d=d.target;if(d.nodeName==="HR"){c.selection.select(d)}})},getInfo:function(){return{longname:"Advanced HR",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advhr",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("advhr",tinymce.plugins.AdvancedHRPlugin)})();
\ No newline at end of file
diff --git a/web/libs/tiny_mce/plugins/advhr/editor_plugin_src.js b/web/libs/tiny_mce/plugins/advhr/editor_plugin_src.js
new file mode 100644
index 0000000..0c652d3
--- /dev/null
+++ b/web/libs/tiny_mce/plugins/advhr/editor_plugin_src.js
@@ -0,0 +1,57 @@
+/**
+ * editor_plugin_src.js
+ *
+ * Copyright 2009, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://tinymce.moxiecode.com/license
+ * Contributing: http://tinymce.moxiecode.com/contributing
+ */
+
+(function() {
+ tinymce.create('tinymce.plugins.AdvancedHRPlugin', {
+ init : function(ed, url) {
+ // Register commands
+ ed.addCommand('mceAdvancedHr', function() {
+ ed.windowManager.open({
+ file : url + '/rule.htm',
+ width : 250 + parseInt(ed.getLang('advhr.delta_width', 0)),
+ height : 160 + parseInt(ed.getLang('advhr.delta_height', 0)),
+ inline : 1
+ }, {
+ plugin_url : url
+ });
+ });
+
+ // Register buttons
+ ed.addButton('advhr', {
+ title : 'advhr.advhr_desc',
+ cmd : 'mceAdvancedHr'
+ });
+
+ ed.onNodeChange.add(function(ed, cm, n) {
+ cm.setActive('advhr', n.nodeName == 'HR');
+ });
+
+ ed.onClick.add(function(ed, e) {
+ e = e.target;
+
+ if (e.nodeName === 'HR')
+ ed.selection.select(e);
+ });
+ },
+
+ getInfo : function() {
+ return {
+ longname : 'Advanced HR',
+ author : 'Moxiecode Systems AB',
+ authorurl : 'http://tinymce.moxiecode.com',
+ infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advhr',
+ version : tinymce.majorVersion + "." + tinymce.minorVersion
+ };
+ }
+ });
+
+ // Register plugin
+ tinymce.PluginManager.add('advhr', tinymce.plugins.AdvancedHRPlugin);
+})();
\ No newline at end of file
diff --git a/web/libs/tiny_mce/plugins/advhr/js/rule.js b/web/libs/tiny_mce/plugins/advhr/js/rule.js
new file mode 100644
index 0000000..b6cbd66
--- /dev/null
+++ b/web/libs/tiny_mce/plugins/advhr/js/rule.js
@@ -0,0 +1,43 @@
+var AdvHRDialog = {
+ init : function(ed) {
+ var dom = ed.dom, f = document.forms[0], n = ed.selection.getNode(), w;
+
+ w = dom.getAttrib(n, 'width');
+ f.width.value = w ? parseInt(w) : (dom.getStyle('width') || '');
+ f.size.value = dom.getAttrib(n, 'size') || parseInt(dom.getStyle('height')) || '';
+ f.noshade.checked = !!dom.getAttrib(n, 'noshade') || !!dom.getStyle('border-width');
+ selectByValue(f, 'width2', w.indexOf('%') != -1 ? '%' : 'px');
+ },
+
+ update : function() {
+ var ed = tinyMCEPopup.editor, h, f = document.forms[0], st = '';
+
+ h = '
';
+
+ ed.execCommand("mceInsertContent", false, h);
+ tinyMCEPopup.close();
+ }
+};
+
+tinyMCEPopup.requireLangPack();
+tinyMCEPopup.onInit.add(AdvHRDialog.init, AdvHRDialog);
diff --git a/web/libs/tiny_mce/plugins/advhr/langs/en_dlg.js b/web/libs/tiny_mce/plugins/advhr/langs/en_dlg.js
new file mode 100644
index 0000000..873bfd8
--- /dev/null
+++ b/web/libs/tiny_mce/plugins/advhr/langs/en_dlg.js
@@ -0,0 +1,5 @@
+tinyMCE.addI18n('en.advhr_dlg',{
+width:"Width",
+size:"Height",
+noshade:"No shadow"
+});
\ No newline at end of file
diff --git a/web/libs/tiny_mce/plugins/advhr/rule.htm b/web/libs/tiny_mce/plugins/advhr/rule.htm
new file mode 100644
index 0000000..fc37b2a
--- /dev/null
+++ b/web/libs/tiny_mce/plugins/advhr/rule.htm
@@ -0,0 +1,57 @@
+
+
+
+ {#advhr.advhr_desc}
+
+
+
+
+
+
+
+
+
+
diff --git a/web/libs/tiny_mce/plugins/advimage/css/advimage.css b/web/libs/tiny_mce/plugins/advimage/css/advimage.css
new file mode 100644
index 0000000..0a6251a
--- /dev/null
+++ b/web/libs/tiny_mce/plugins/advimage/css/advimage.css
@@ -0,0 +1,13 @@
+#src_list, #over_list, #out_list {width:280px;}
+.mceActionPanel {margin-top:7px;}
+.alignPreview {border:1px solid #000; width:140px; height:140px; overflow:hidden; padding:5px;}
+.checkbox {border:0;}
+.panel_wrapper div.current {height:305px;}
+#prev {margin:0; border:1px solid #000; width:428px; height:150px; overflow:auto;}
+#align, #classlist {width:150px;}
+#width, #height {vertical-align:middle; width:50px; text-align:center;}
+#vspace, #hspace, #border {vertical-align:middle; width:30px; text-align:center;}
+#class_list {width:180px;}
+input {width: 280px;}
+#constrain, #onmousemovecheck {width:auto;}
+#id, #dir, #lang, #usemap, #longdesc {width:200px;}
diff --git a/web/libs/tiny_mce/plugins/advimage/editor_plugin.js b/web/libs/tiny_mce/plugins/advimage/editor_plugin.js
new file mode 100644
index 0000000..4c7a9c3
--- /dev/null
+++ b/web/libs/tiny_mce/plugins/advimage/editor_plugin.js
@@ -0,0 +1 @@
+(function(){tinymce.create("tinymce.plugins.AdvancedImagePlugin",{init:function(a,b){a.addCommand("mceAdvImage",function(){if(a.dom.getAttrib(a.selection.getNode(),"class").indexOf("mceItem")!=-1){return}a.windowManager.open({file:b+"/image.htm",width:480+parseInt(a.getLang("advimage.delta_width",0)),height:385+parseInt(a.getLang("advimage.delta_height",0)),inline:1},{plugin_url:b})});a.addButton("image",{title:"advimage.image_desc",cmd:"mceAdvImage"})},getInfo:function(){return{longname:"Advanced image",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advimage",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("advimage",tinymce.plugins.AdvancedImagePlugin)})();
\ No newline at end of file
diff --git a/web/libs/tiny_mce/plugins/advimage/editor_plugin_src.js b/web/libs/tiny_mce/plugins/advimage/editor_plugin_src.js
new file mode 100644
index 0000000..2625dd2
--- /dev/null
+++ b/web/libs/tiny_mce/plugins/advimage/editor_plugin_src.js
@@ -0,0 +1,50 @@
+/**
+ * editor_plugin_src.js
+ *
+ * Copyright 2009, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://tinymce.moxiecode.com/license
+ * Contributing: http://tinymce.moxiecode.com/contributing
+ */
+
+(function() {
+ tinymce.create('tinymce.plugins.AdvancedImagePlugin', {
+ init : function(ed, url) {
+ // Register commands
+ ed.addCommand('mceAdvImage', function() {
+ // Internal image object like a flash placeholder
+ if (ed.dom.getAttrib(ed.selection.getNode(), 'class').indexOf('mceItem') != -1)
+ return;
+
+ ed.windowManager.open({
+ file : url + '/image.htm',
+ width : 480 + parseInt(ed.getLang('advimage.delta_width', 0)),
+ height : 385 + parseInt(ed.getLang('advimage.delta_height', 0)),
+ inline : 1
+ }, {
+ plugin_url : url
+ });
+ });
+
+ // Register buttons
+ ed.addButton('image', {
+ title : 'advimage.image_desc',
+ cmd : 'mceAdvImage'
+ });
+ },
+
+ getInfo : function() {
+ return {
+ longname : 'Advanced image',
+ author : 'Moxiecode Systems AB',
+ authorurl : 'http://tinymce.moxiecode.com',
+ infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advimage',
+ version : tinymce.majorVersion + "." + tinymce.minorVersion
+ };
+ }
+ });
+
+ // Register plugin
+ tinymce.PluginManager.add('advimage', tinymce.plugins.AdvancedImagePlugin);
+})();
\ No newline at end of file
diff --git a/web/libs/tiny_mce/plugins/advimage/image.htm b/web/libs/tiny_mce/plugins/advimage/image.htm
new file mode 100644
index 0000000..79cff3f
--- /dev/null
+++ b/web/libs/tiny_mce/plugins/advimage/image.htm
@@ -0,0 +1,232 @@
+
+
+
+ {#advimage_dlg.dialog_title}
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/web/libs/tiny_mce/plugins/advimage/img/sample.gif b/web/libs/tiny_mce/plugins/advimage/img/sample.gif
new file mode 100644
index 0000000..53bf689
Binary files /dev/null and b/web/libs/tiny_mce/plugins/advimage/img/sample.gif differ
diff --git a/web/libs/tiny_mce/plugins/advimage/js/image.js b/web/libs/tiny_mce/plugins/advimage/js/image.js
new file mode 100644
index 0000000..3bda86a
--- /dev/null
+++ b/web/libs/tiny_mce/plugins/advimage/js/image.js
@@ -0,0 +1,443 @@
+var ImageDialog = {
+ preInit : function() {
+ var url;
+
+ tinyMCEPopup.requireLangPack();
+
+ if (url = tinyMCEPopup.getParam("external_image_list_url"))
+ document.write('');
+ },
+
+ init : function(ed) {
+ var f = document.forms[0], nl = f.elements, ed = tinyMCEPopup.editor, dom = ed.dom, n = ed.selection.getNode();
+
+ tinyMCEPopup.resizeToInnerSize();
+ this.fillClassList('class_list');
+ this.fillFileList('src_list', 'tinyMCEImageList');
+ this.fillFileList('over_list', 'tinyMCEImageList');
+ this.fillFileList('out_list', 'tinyMCEImageList');
+ TinyMCE_EditableSelects.init();
+
+ if (n.nodeName == 'IMG') {
+ nl.src.value = dom.getAttrib(n, 'src');
+ nl.width.value = dom.getAttrib(n, 'width');
+ nl.height.value = dom.getAttrib(n, 'height');
+ nl.alt.value = dom.getAttrib(n, 'alt');
+ nl.title.value = dom.getAttrib(n, 'title');
+ nl.vspace.value = this.getAttrib(n, 'vspace');
+ nl.hspace.value = this.getAttrib(n, 'hspace');
+ nl.border.value = this.getAttrib(n, 'border');
+ selectByValue(f, 'align', this.getAttrib(n, 'align'));
+ selectByValue(f, 'class_list', dom.getAttrib(n, 'class'), true, true);
+ nl.style.value = dom.getAttrib(n, 'style');
+ nl.id.value = dom.getAttrib(n, 'id');
+ nl.dir.value = dom.getAttrib(n, 'dir');
+ nl.lang.value = dom.getAttrib(n, 'lang');
+ nl.usemap.value = dom.getAttrib(n, 'usemap');
+ nl.longdesc.value = dom.getAttrib(n, 'longdesc');
+ nl.insert.value = ed.getLang('update');
+
+ if (/^\s*this.src\s*=\s*\'([^\']+)\';?\s*$/.test(dom.getAttrib(n, 'onmouseover')))
+ nl.onmouseoversrc.value = dom.getAttrib(n, 'onmouseover').replace(/^\s*this.src\s*=\s*\'([^\']+)\';?\s*$/, '$1');
+
+ if (/^\s*this.src\s*=\s*\'([^\']+)\';?\s*$/.test(dom.getAttrib(n, 'onmouseout')))
+ nl.onmouseoutsrc.value = dom.getAttrib(n, 'onmouseout').replace(/^\s*this.src\s*=\s*\'([^\']+)\';?\s*$/, '$1');
+
+ if (ed.settings.inline_styles) {
+ // Move attribs to styles
+ if (dom.getAttrib(n, 'align'))
+ this.updateStyle('align');
+
+ if (dom.getAttrib(n, 'hspace'))
+ this.updateStyle('hspace');
+
+ if (dom.getAttrib(n, 'border'))
+ this.updateStyle('border');
+
+ if (dom.getAttrib(n, 'vspace'))
+ this.updateStyle('vspace');
+ }
+ }
+
+ // Setup browse button
+ document.getElementById('srcbrowsercontainer').innerHTML = getBrowserHTML('srcbrowser','src','image','theme_advanced_image');
+ if (isVisible('srcbrowser'))
+ document.getElementById('src').style.width = '260px';
+
+ // Setup browse button
+ document.getElementById('onmouseoversrccontainer').innerHTML = getBrowserHTML('overbrowser','onmouseoversrc','image','theme_advanced_image');
+ if (isVisible('overbrowser'))
+ document.getElementById('onmouseoversrc').style.width = '260px';
+
+ // Setup browse button
+ document.getElementById('onmouseoutsrccontainer').innerHTML = getBrowserHTML('outbrowser','onmouseoutsrc','image','theme_advanced_image');
+ if (isVisible('outbrowser'))
+ document.getElementById('onmouseoutsrc').style.width = '260px';
+
+ // If option enabled default contrain proportions to checked
+ if (ed.getParam("advimage_constrain_proportions", true))
+ f.constrain.checked = true;
+
+ // Check swap image if valid data
+ if (nl.onmouseoversrc.value || nl.onmouseoutsrc.value)
+ this.setSwapImage(true);
+ else
+ this.setSwapImage(false);
+
+ this.changeAppearance();
+ this.showPreviewImage(nl.src.value, 1);
+ },
+
+ insert : function(file, title) {
+ var ed = tinyMCEPopup.editor, t = this, f = document.forms[0];
+
+ if (f.src.value === '') {
+ if (ed.selection.getNode().nodeName == 'IMG') {
+ ed.dom.remove(ed.selection.getNode());
+ ed.execCommand('mceRepaint');
+ }
+
+ tinyMCEPopup.close();
+ return;
+ }
+
+ if (tinyMCEPopup.getParam("accessibility_warnings", 1)) {
+ if (!f.alt.value) {
+ tinyMCEPopup.confirm(tinyMCEPopup.getLang('advimage_dlg.missing_alt'), function(s) {
+ if (s)
+ t.insertAndClose();
+ });
+
+ return;
+ }
+ }
+
+ t.insertAndClose();
+ },
+
+ insertAndClose : function() {
+ var ed = tinyMCEPopup.editor, f = document.forms[0], nl = f.elements, v, args = {}, el;
+
+ tinyMCEPopup.restoreSelection();
+
+ // Fixes crash in Safari
+ if (tinymce.isWebKit)
+ ed.getWin().focus();
+
+ if (!ed.settings.inline_styles) {
+ args = {
+ vspace : nl.vspace.value,
+ hspace : nl.hspace.value,
+ border : nl.border.value,
+ align : getSelectValue(f, 'align')
+ };
+ } else {
+ // Remove deprecated values
+ args = {
+ vspace : '',
+ hspace : '',
+ border : '',
+ align : ''
+ };
+ }
+
+ tinymce.extend(args, {
+ src : nl.src.value,
+ width : nl.width.value,
+ height : nl.height.value,
+ alt : nl.alt.value,
+ title : nl.title.value,
+ 'class' : getSelectValue(f, 'class_list'),
+ style : nl.style.value,
+ id : nl.id.value,
+ dir : nl.dir.value,
+ lang : nl.lang.value,
+ usemap : nl.usemap.value,
+ longdesc : nl.longdesc.value
+ });
+
+ args.onmouseover = args.onmouseout = '';
+
+ if (f.onmousemovecheck.checked) {
+ if (nl.onmouseoversrc.value)
+ args.onmouseover = "this.src='" + nl.onmouseoversrc.value + "';";
+
+ if (nl.onmouseoutsrc.value)
+ args.onmouseout = "this.src='" + nl.onmouseoutsrc.value + "';";
+ }
+
+ el = ed.selection.getNode();
+
+ if (el && el.nodeName == 'IMG') {
+ ed.dom.setAttribs(el, args);
+ } else {
+ ed.execCommand('mceInsertContent', false, '', {skip_undo : 1});
+ ed.dom.setAttribs('__mce_tmp', args);
+ ed.dom.setAttrib('__mce_tmp', 'id', '');
+ ed.undoManager.add();
+ }
+
+ tinyMCEPopup.close();
+ },
+
+ getAttrib : function(e, at) {
+ var ed = tinyMCEPopup.editor, dom = ed.dom, v, v2;
+
+ if (ed.settings.inline_styles) {
+ switch (at) {
+ case 'align':
+ if (v = dom.getStyle(e, 'float'))
+ return v;
+
+ if (v = dom.getStyle(e, 'vertical-align'))
+ return v;
+
+ break;
+
+ case 'hspace':
+ v = dom.getStyle(e, 'margin-left')
+ v2 = dom.getStyle(e, 'margin-right');
+
+ if (v && v == v2)
+ return parseInt(v.replace(/[^0-9]/g, ''));
+
+ break;
+
+ case 'vspace':
+ v = dom.getStyle(e, 'margin-top')
+ v2 = dom.getStyle(e, 'margin-bottom');
+ if (v && v == v2)
+ return parseInt(v.replace(/[^0-9]/g, ''));
+
+ break;
+
+ case 'border':
+ v = 0;
+
+ tinymce.each(['top', 'right', 'bottom', 'left'], function(sv) {
+ sv = dom.getStyle(e, 'border-' + sv + '-width');
+
+ // False or not the same as prev
+ if (!sv || (sv != v && v !== 0)) {
+ v = 0;
+ return false;
+ }
+
+ if (sv)
+ v = sv;
+ });
+
+ if (v)
+ return parseInt(v.replace(/[^0-9]/g, ''));
+
+ break;
+ }
+ }
+
+ if (v = dom.getAttrib(e, at))
+ return v;
+
+ return '';
+ },
+
+ setSwapImage : function(st) {
+ var f = document.forms[0];
+
+ f.onmousemovecheck.checked = st;
+ setBrowserDisabled('overbrowser', !st);
+ setBrowserDisabled('outbrowser', !st);
+
+ if (f.over_list)
+ f.over_list.disabled = !st;
+
+ if (f.out_list)
+ f.out_list.disabled = !st;
+
+ f.onmouseoversrc.disabled = !st;
+ f.onmouseoutsrc.disabled = !st;
+ },
+
+ fillClassList : function(id) {
+ var dom = tinyMCEPopup.dom, lst = dom.get(id), v, cl;
+
+ if (v = tinyMCEPopup.getParam('theme_advanced_styles')) {
+ cl = [];
+
+ tinymce.each(v.split(';'), function(v) {
+ var p = v.split('=');
+
+ cl.push({'title' : p[0], 'class' : p[1]});
+ });
+ } else
+ cl = tinyMCEPopup.editor.dom.getClasses();
+
+ if (cl.length > 0) {
+ lst.options.length = 0;
+ lst.options[lst.options.length] = new Option(tinyMCEPopup.getLang('not_set'), '');
+
+ tinymce.each(cl, function(o) {
+ lst.options[lst.options.length] = new Option(o.title || o['class'], o['class']);
+ });
+ } else
+ dom.remove(dom.getParent(id, 'tr'));
+ },
+
+ fillFileList : function(id, l) {
+ var dom = tinyMCEPopup.dom, lst = dom.get(id), v, cl;
+
+ l = window[l];
+ lst.options.length = 0;
+
+ if (l && l.length > 0) {
+ lst.options[lst.options.length] = new Option('', '');
+
+ tinymce.each(l, function(o) {
+ lst.options[lst.options.length] = new Option(o[0], o[1]);
+ });
+ } else
+ dom.remove(dom.getParent(id, 'tr'));
+ },
+
+ resetImageData : function() {
+ var f = document.forms[0];
+
+ f.elements.width.value = f.elements.height.value = '';
+ },
+
+ updateImageData : function(img, st) {
+ var f = document.forms[0];
+
+ if (!st) {
+ f.elements.width.value = img.width;
+ f.elements.height.value = img.height;
+ }
+
+ this.preloadImg = img;
+ },
+
+ changeAppearance : function() {
+ var ed = tinyMCEPopup.editor, f = document.forms[0], img = document.getElementById('alignSampleImg');
+
+ if (img) {
+ if (ed.getParam('inline_styles')) {
+ ed.dom.setAttrib(img, 'style', f.style.value);
+ } else {
+ img.align = f.align.value;
+ img.border = f.border.value;
+ img.hspace = f.hspace.value;
+ img.vspace = f.vspace.value;
+ }
+ }
+ },
+
+ changeHeight : function() {
+ var f = document.forms[0], tp, t = this;
+
+ if (!f.constrain.checked || !t.preloadImg) {
+ return;
+ }
+
+ if (f.width.value == "" || f.height.value == "")
+ return;
+
+ tp = (parseInt(f.width.value) / parseInt(t.preloadImg.width)) * t.preloadImg.height;
+ f.height.value = tp.toFixed(0);
+ },
+
+ changeWidth : function() {
+ var f = document.forms[0], tp, t = this;
+
+ if (!f.constrain.checked || !t.preloadImg) {
+ return;
+ }
+
+ if (f.width.value == "" || f.height.value == "")
+ return;
+
+ tp = (parseInt(f.height.value) / parseInt(t.preloadImg.height)) * t.preloadImg.width;
+ f.width.value = tp.toFixed(0);
+ },
+
+ updateStyle : function(ty) {
+ var dom = tinyMCEPopup.dom, st, v, f = document.forms[0], img = dom.create('img', {style : dom.get('style').value});
+
+ if (tinyMCEPopup.editor.settings.inline_styles) {
+ // Handle align
+ if (ty == 'align') {
+ dom.setStyle(img, 'float', '');
+ dom.setStyle(img, 'vertical-align', '');
+
+ v = getSelectValue(f, 'align');
+ if (v) {
+ if (v == 'left' || v == 'right')
+ dom.setStyle(img, 'float', v);
+ else
+ img.style.verticalAlign = v;
+ }
+ }
+
+ // Handle border
+ if (ty == 'border') {
+ dom.setStyle(img, 'border', '');
+
+ v = f.border.value;
+ if (v || v == '0') {
+ if (v == '0')
+ img.style.border = '0';
+ else
+ img.style.border = v + 'px solid black';
+ }
+ }
+
+ // Handle hspace
+ if (ty == 'hspace') {
+ dom.setStyle(img, 'marginLeft', '');
+ dom.setStyle(img, 'marginRight', '');
+
+ v = f.hspace.value;
+ if (v) {
+ img.style.marginLeft = v + 'px';
+ img.style.marginRight = v + 'px';
+ }
+ }
+
+ // Handle vspace
+ if (ty == 'vspace') {
+ dom.setStyle(img, 'marginTop', '');
+ dom.setStyle(img, 'marginBottom', '');
+
+ v = f.vspace.value;
+ if (v) {
+ img.style.marginTop = v + 'px';
+ img.style.marginBottom = v + 'px';
+ }
+ }
+
+ // Merge
+ dom.get('style').value = dom.serializeStyle(dom.parseStyle(img.style.cssText), 'img');
+ }
+ },
+
+ changeMouseMove : function() {
+ },
+
+ showPreviewImage : function(u, st) {
+ if (!u) {
+ tinyMCEPopup.dom.setHTML('prev', '');
+ return;
+ }
+
+ if (!st && tinyMCEPopup.getParam("advimage_update_dimensions_onchange", true))
+ this.resetImageData();
+
+ u = tinyMCEPopup.editor.documentBaseURI.toAbsolute(u);
+
+ if (!st)
+ tinyMCEPopup.dom.setHTML('prev', '');
+ else
+ tinyMCEPopup.dom.setHTML('prev', '');
+ }
+};
+
+ImageDialog.preInit();
+tinyMCEPopup.onInit.add(ImageDialog.init, ImageDialog);
diff --git a/web/libs/tiny_mce/plugins/advimage/langs/en_dlg.js b/web/libs/tiny_mce/plugins/advimage/langs/en_dlg.js
new file mode 100644
index 0000000..f493d19
--- /dev/null
+++ b/web/libs/tiny_mce/plugins/advimage/langs/en_dlg.js
@@ -0,0 +1,43 @@
+tinyMCE.addI18n('en.advimage_dlg',{
+tab_general:"General",
+tab_appearance:"Appearance",
+tab_advanced:"Advanced",
+general:"General",
+title:"Title",
+preview:"Preview",
+constrain_proportions:"Constrain proportions",
+langdir:"Language direction",
+langcode:"Language code",
+long_desc:"Long description link",
+style:"Style",
+classes:"Classes",
+ltr:"Left to right",
+rtl:"Right to left",
+id:"Id",
+map:"Image map",
+swap_image:"Swap image",
+alt_image:"Alternative image",
+mouseover:"for mouse over",
+mouseout:"for mouse out",
+misc:"Miscellaneous",
+example_img:"Appearance preview image",
+missing_alt:"Are you sure you want to continue without including an Image Description? Without it the image may not be accessible to some users with disabilities, or to those using a text browser, or browsing the Web with images turned off.",
+dialog_title:"Insert/edit image",
+src:"Image URL",
+alt:"Image description",
+list:"Image list",
+border:"Border",
+dimensions:"Dimensions",
+vspace:"Vertical space",
+hspace:"Horizontal space",
+align:"Alignment",
+align_baseline:"Baseline",
+align_top:"Top",
+align_middle:"Middle",
+align_bottom:"Bottom",
+align_texttop:"Text top",
+align_textbottom:"Text bottom",
+align_left:"Left",
+align_right:"Right",
+image_list:"Image list"
+});
\ No newline at end of file
diff --git a/web/libs/tiny_mce/plugins/advlink/css/advlink.css b/web/libs/tiny_mce/plugins/advlink/css/advlink.css
new file mode 100644
index 0000000..1436431
--- /dev/null
+++ b/web/libs/tiny_mce/plugins/advlink/css/advlink.css
@@ -0,0 +1,8 @@
+.mceLinkList, .mceAnchorList, #targetlist {width:280px;}
+.mceActionPanel {margin-top:7px;}
+.panel_wrapper div.current {height:320px;}
+#classlist, #title, #href {width:280px;}
+#popupurl, #popupname {width:200px;}
+#popupwidth, #popupheight, #popupleft, #popuptop {width:30px;vertical-align:middle;text-align:center;}
+#id, #style, #classes, #target, #dir, #hreflang, #lang, #charset, #type, #rel, #rev, #tabindex, #accesskey {width:200px;}
+#events_panel input {width:200px;}
diff --git a/web/libs/tiny_mce/plugins/advlink/editor_plugin.js b/web/libs/tiny_mce/plugins/advlink/editor_plugin.js
new file mode 100644
index 0000000..983fe5a
--- /dev/null
+++ b/web/libs/tiny_mce/plugins/advlink/editor_plugin.js
@@ -0,0 +1 @@
+(function(){tinymce.create("tinymce.plugins.AdvancedLinkPlugin",{init:function(a,b){this.editor=a;a.addCommand("mceAdvLink",function(){var c=a.selection;if(c.isCollapsed()&&!a.dom.getParent(c.getNode(),"A")){return}a.windowManager.open({file:b+"/link.htm",width:480+parseInt(a.getLang("advlink.delta_width",0)),height:400+parseInt(a.getLang("advlink.delta_height",0)),inline:1},{plugin_url:b})});a.addButton("link",{title:"advlink.link_desc",cmd:"mceAdvLink"});a.addShortcut("ctrl+k","advlink.advlink_desc","mceAdvLink");a.onNodeChange.add(function(d,c,f,e){c.setDisabled("link",e&&f.nodeName!="A");c.setActive("link",f.nodeName=="A"&&!f.name)})},getInfo:function(){return{longname:"Advanced link",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advlink",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("advlink",tinymce.plugins.AdvancedLinkPlugin)})();
\ No newline at end of file
diff --git a/web/libs/tiny_mce/plugins/advlink/editor_plugin_src.js b/web/libs/tiny_mce/plugins/advlink/editor_plugin_src.js
new file mode 100644
index 0000000..14e46a7
--- /dev/null
+++ b/web/libs/tiny_mce/plugins/advlink/editor_plugin_src.js
@@ -0,0 +1,61 @@
+/**
+ * editor_plugin_src.js
+ *
+ * Copyright 2009, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://tinymce.moxiecode.com/license
+ * Contributing: http://tinymce.moxiecode.com/contributing
+ */
+
+(function() {
+ tinymce.create('tinymce.plugins.AdvancedLinkPlugin', {
+ init : function(ed, url) {
+ this.editor = ed;
+
+ // Register commands
+ ed.addCommand('mceAdvLink', function() {
+ var se = ed.selection;
+
+ // No selection and not in link
+ if (se.isCollapsed() && !ed.dom.getParent(se.getNode(), 'A'))
+ return;
+
+ ed.windowManager.open({
+ file : url + '/link.htm',
+ width : 480 + parseInt(ed.getLang('advlink.delta_width', 0)),
+ height : 400 + parseInt(ed.getLang('advlink.delta_height', 0)),
+ inline : 1
+ }, {
+ plugin_url : url
+ });
+ });
+
+ // Register buttons
+ ed.addButton('link', {
+ title : 'advlink.link_desc',
+ cmd : 'mceAdvLink'
+ });
+
+ ed.addShortcut('ctrl+k', 'advlink.advlink_desc', 'mceAdvLink');
+
+ ed.onNodeChange.add(function(ed, cm, n, co) {
+ cm.setDisabled('link', co && n.nodeName != 'A');
+ cm.setActive('link', n.nodeName == 'A' && !n.name);
+ });
+ },
+
+ getInfo : function() {
+ return {
+ longname : 'Advanced link',
+ author : 'Moxiecode Systems AB',
+ authorurl : 'http://tinymce.moxiecode.com',
+ infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advlink',
+ version : tinymce.majorVersion + "." + tinymce.minorVersion
+ };
+ }
+ });
+
+ // Register plugin
+ tinymce.PluginManager.add('advlink', tinymce.plugins.AdvancedLinkPlugin);
+})();
\ No newline at end of file
diff --git a/web/libs/tiny_mce/plugins/advlink/js/advlink.js b/web/libs/tiny_mce/plugins/advlink/js/advlink.js
new file mode 100644
index 0000000..b78e82f
--- /dev/null
+++ b/web/libs/tiny_mce/plugins/advlink/js/advlink.js
@@ -0,0 +1,528 @@
+/* Functions for the advlink plugin popup */
+
+tinyMCEPopup.requireLangPack();
+
+var templates = {
+ "window.open" : "window.open('${url}','${target}','${options}')"
+};
+
+function preinit() {
+ var url;
+
+ if (url = tinyMCEPopup.getParam("external_link_list_url"))
+ document.write('');
+}
+
+function changeClass() {
+ var f = document.forms[0];
+
+ f.classes.value = getSelectValue(f, 'classlist');
+}
+
+function init() {
+ tinyMCEPopup.resizeToInnerSize();
+
+ var formObj = document.forms[0];
+ var inst = tinyMCEPopup.editor;
+ var elm = inst.selection.getNode();
+ var action = "insert";
+ var html;
+
+ document.getElementById('hrefbrowsercontainer').innerHTML = getBrowserHTML('hrefbrowser','href','file','advlink');
+ document.getElementById('popupurlbrowsercontainer').innerHTML = getBrowserHTML('popupurlbrowser','popupurl','file','advlink');
+ document.getElementById('linklisthrefcontainer').innerHTML = getLinkListHTML('linklisthref','href');
+ document.getElementById('anchorlistcontainer').innerHTML = getAnchorListHTML('anchorlist','href');
+ document.getElementById('targetlistcontainer').innerHTML = getTargetListHTML('targetlist','target');
+
+ // Link list
+ html = getLinkListHTML('linklisthref','href');
+ if (html == "")
+ document.getElementById("linklisthrefrow").style.display = 'none';
+ else
+ document.getElementById("linklisthrefcontainer").innerHTML = html;
+
+ // Resize some elements
+ if (isVisible('hrefbrowser'))
+ document.getElementById('href').style.width = '260px';
+
+ if (isVisible('popupurlbrowser'))
+ document.getElementById('popupurl').style.width = '180px';
+
+ elm = inst.dom.getParent(elm, "A");
+ if (elm != null && elm.nodeName == "A")
+ action = "update";
+
+ formObj.insert.value = tinyMCEPopup.getLang(action, 'Insert', true);
+
+ setPopupControlsDisabled(true);
+
+ if (action == "update") {
+ var href = inst.dom.getAttrib(elm, 'href');
+ var onclick = inst.dom.getAttrib(elm, 'onclick');
+
+ // Setup form data
+ setFormValue('href', href);
+ setFormValue('title', inst.dom.getAttrib(elm, 'title'));
+ setFormValue('id', inst.dom.getAttrib(elm, 'id'));
+ setFormValue('style', inst.dom.getAttrib(elm, "style"));
+ setFormValue('rel', inst.dom.getAttrib(elm, 'rel'));
+ setFormValue('rev', inst.dom.getAttrib(elm, 'rev'));
+ setFormValue('charset', inst.dom.getAttrib(elm, 'charset'));
+ setFormValue('hreflang', inst.dom.getAttrib(elm, 'hreflang'));
+ setFormValue('dir', inst.dom.getAttrib(elm, 'dir'));
+ setFormValue('lang', inst.dom.getAttrib(elm, 'lang'));
+ setFormValue('tabindex', inst.dom.getAttrib(elm, 'tabindex', typeof(elm.tabindex) != "undefined" ? elm.tabindex : ""));
+ setFormValue('accesskey', inst.dom.getAttrib(elm, 'accesskey', typeof(elm.accesskey) != "undefined" ? elm.accesskey : ""));
+ setFormValue('type', inst.dom.getAttrib(elm, 'type'));
+ setFormValue('onfocus', inst.dom.getAttrib(elm, 'onfocus'));
+ setFormValue('onblur', inst.dom.getAttrib(elm, 'onblur'));
+ setFormValue('onclick', onclick);
+ setFormValue('ondblclick', inst.dom.getAttrib(elm, 'ondblclick'));
+ setFormValue('onmousedown', inst.dom.getAttrib(elm, 'onmousedown'));
+ setFormValue('onmouseup', inst.dom.getAttrib(elm, 'onmouseup'));
+ setFormValue('onmouseover', inst.dom.getAttrib(elm, 'onmouseover'));
+ setFormValue('onmousemove', inst.dom.getAttrib(elm, 'onmousemove'));
+ setFormValue('onmouseout', inst.dom.getAttrib(elm, 'onmouseout'));
+ setFormValue('onkeypress', inst.dom.getAttrib(elm, 'onkeypress'));
+ setFormValue('onkeydown', inst.dom.getAttrib(elm, 'onkeydown'));
+ setFormValue('onkeyup', inst.dom.getAttrib(elm, 'onkeyup'));
+ setFormValue('target', inst.dom.getAttrib(elm, 'target'));
+ setFormValue('classes', inst.dom.getAttrib(elm, 'class'));
+
+ // Parse onclick data
+ if (onclick != null && onclick.indexOf('window.open') != -1)
+ parseWindowOpen(onclick);
+ else
+ parseFunction(onclick);
+
+ // Select by the values
+ selectByValue(formObj, 'dir', inst.dom.getAttrib(elm, 'dir'));
+ selectByValue(formObj, 'rel', inst.dom.getAttrib(elm, 'rel'));
+ selectByValue(formObj, 'rev', inst.dom.getAttrib(elm, 'rev'));
+ selectByValue(formObj, 'linklisthref', href);
+
+ if (href.charAt(0) == '#')
+ selectByValue(formObj, 'anchorlist', href);
+
+ addClassesToList('classlist', 'advlink_styles');
+
+ selectByValue(formObj, 'classlist', inst.dom.getAttrib(elm, 'class'), true);
+ selectByValue(formObj, 'targetlist', inst.dom.getAttrib(elm, 'target'), true);
+ } else
+ addClassesToList('classlist', 'advlink_styles');
+}
+
+function checkPrefix(n) {
+ if (n.value && Validator.isEmail(n) && !/^\s*mailto:/i.test(n.value) && confirm(tinyMCEPopup.getLang('advlink_dlg.is_email')))
+ n.value = 'mailto:' + n.value;
+
+ if (/^\s*www\./i.test(n.value) && confirm(tinyMCEPopup.getLang('advlink_dlg.is_external')))
+ n.value = 'http://' + n.value;
+}
+
+function setFormValue(name, value) {
+ document.forms[0].elements[name].value = value;
+}
+
+function parseWindowOpen(onclick) {
+ var formObj = document.forms[0];
+
+ // Preprocess center code
+ if (onclick.indexOf('return false;') != -1) {
+ formObj.popupreturn.checked = true;
+ onclick = onclick.replace('return false;', '');
+ } else
+ formObj.popupreturn.checked = false;
+
+ var onClickData = parseLink(onclick);
+
+ if (onClickData != null) {
+ formObj.ispopup.checked = true;
+ setPopupControlsDisabled(false);
+
+ var onClickWindowOptions = parseOptions(onClickData['options']);
+ var url = onClickData['url'];
+
+ formObj.popupname.value = onClickData['target'];
+ formObj.popupurl.value = url;
+ formObj.popupwidth.value = getOption(onClickWindowOptions, 'width');
+ formObj.popupheight.value = getOption(onClickWindowOptions, 'height');
+
+ formObj.popupleft.value = getOption(onClickWindowOptions, 'left');
+ formObj.popuptop.value = getOption(onClickWindowOptions, 'top');
+
+ if (formObj.popupleft.value.indexOf('screen') != -1)
+ formObj.popupleft.value = "c";
+
+ if (formObj.popuptop.value.indexOf('screen') != -1)
+ formObj.popuptop.value = "c";
+
+ formObj.popuplocation.checked = getOption(onClickWindowOptions, 'location') == "yes";
+ formObj.popupscrollbars.checked = getOption(onClickWindowOptions, 'scrollbars') == "yes";
+ formObj.popupmenubar.checked = getOption(onClickWindowOptions, 'menubar') == "yes";
+ formObj.popupresizable.checked = getOption(onClickWindowOptions, 'resizable') == "yes";
+ formObj.popuptoolbar.checked = getOption(onClickWindowOptions, 'toolbar') == "yes";
+ formObj.popupstatus.checked = getOption(onClickWindowOptions, 'status') == "yes";
+ formObj.popupdependent.checked = getOption(onClickWindowOptions, 'dependent') == "yes";
+
+ buildOnClick();
+ }
+}
+
+function parseFunction(onclick) {
+ var formObj = document.forms[0];
+ var onClickData = parseLink(onclick);
+
+ // TODO: Add stuff here
+}
+
+function getOption(opts, name) {
+ return typeof(opts[name]) == "undefined" ? "" : opts[name];
+}
+
+function setPopupControlsDisabled(state) {
+ var formObj = document.forms[0];
+
+ formObj.popupname.disabled = state;
+ formObj.popupurl.disabled = state;
+ formObj.popupwidth.disabled = state;
+ formObj.popupheight.disabled = state;
+ formObj.popupleft.disabled = state;
+ formObj.popuptop.disabled = state;
+ formObj.popuplocation.disabled = state;
+ formObj.popupscrollbars.disabled = state;
+ formObj.popupmenubar.disabled = state;
+ formObj.popupresizable.disabled = state;
+ formObj.popuptoolbar.disabled = state;
+ formObj.popupstatus.disabled = state;
+ formObj.popupreturn.disabled = state;
+ formObj.popupdependent.disabled = state;
+
+ setBrowserDisabled('popupurlbrowser', state);
+}
+
+function parseLink(link) {
+ link = link.replace(new RegExp(''', 'g'), "'");
+
+ var fnName = link.replace(new RegExp("\\s*([A-Za-z0-9\.]*)\\s*\\(.*", "gi"), "$1");
+
+ // Is function name a template function
+ var template = templates[fnName];
+ if (template) {
+ // Build regexp
+ var variableNames = template.match(new RegExp("'?\\$\\{[A-Za-z0-9\.]*\\}'?", "gi"));
+ var regExp = "\\s*[A-Za-z0-9\.]*\\s*\\(";
+ var replaceStr = "";
+ for (var i=0; i";
+ } else
+ regExp += ".*";
+ }
+
+ regExp += "\\);?";
+
+ // Build variable array
+ var variables = [];
+ variables["_function"] = fnName;
+ var variableValues = link.replace(new RegExp(regExp, "gi"), replaceStr).split('');
+ for (var i=0; i';
+ html += '';
+
+ for (i=0; i' + name + '';
+ }
+
+ html += '';
+
+ return html;
+}
+
+function insertAction() {
+ var inst = tinyMCEPopup.editor;
+ var elm, elementArray, i;
+
+ elm = inst.selection.getNode();
+ checkPrefix(document.forms[0].href);
+
+ elm = inst.dom.getParent(elm, "A");
+
+ // Remove element if there is no href
+ if (!document.forms[0].href.value) {
+ tinyMCEPopup.execCommand("mceBeginUndoLevel");
+ i = inst.selection.getBookmark();
+ inst.dom.remove(elm, 1);
+ inst.selection.moveToBookmark(i);
+ tinyMCEPopup.execCommand("mceEndUndoLevel");
+ tinyMCEPopup.close();
+ return;
+ }
+
+ tinyMCEPopup.execCommand("mceBeginUndoLevel");
+
+ // Create new anchor elements
+ if (elm == null) {
+ inst.getDoc().execCommand("unlink", false, null);
+ tinyMCEPopup.execCommand("CreateLink", false, "#mce_temp_url#", {skip_undo : 1});
+
+ elementArray = tinymce.grep(inst.dom.select("a"), function(n) {return inst.dom.getAttrib(n, 'href') == '#mce_temp_url#';});
+ for (i=0; i';
+
+ for (var i=0; i' + tinyMCELinkList[i][0] + '';
+
+ html += '';
+
+ return html;
+
+ // tinyMCE.debug('-- image list start --', html, '-- image list end --');
+}
+
+function getTargetListHTML(elm_id, target_form_element) {
+ var targets = tinyMCEPopup.getParam('theme_advanced_link_targets', '').split(';');
+ var html = '';
+
+ html += '';
+
+ return html;
+}
+
+// While loading
+preinit();
+tinyMCEPopup.onInit.add(init);
diff --git a/web/libs/tiny_mce/plugins/advlink/langs/en_dlg.js b/web/libs/tiny_mce/plugins/advlink/langs/en_dlg.js
new file mode 100644
index 0000000..c71ffbd
--- /dev/null
+++ b/web/libs/tiny_mce/plugins/advlink/langs/en_dlg.js
@@ -0,0 +1,52 @@
+tinyMCE.addI18n('en.advlink_dlg',{
+title:"Insert/edit link",
+url:"Link URL",
+target:"Target",
+titlefield:"Title",
+is_email:"The URL you entered seems to be an email address, do you want to add the required mailto: prefix?",
+is_external:"The URL you entered seems to external link, do you want to add the required http:// prefix?",
+list:"Link list",
+general_tab:"General",
+popup_tab:"Popup",
+events_tab:"Events",
+advanced_tab:"Advanced",
+general_props:"General properties",
+popup_props:"Popup properties",
+event_props:"Events",
+advanced_props:"Advanced properties",
+popup_opts:"Options",
+anchor_names:"Anchors",
+target_same:"Open in this window / frame",
+target_parent:"Open in parent window / frame",
+target_top:"Open in top frame (replaces all frames)",
+target_blank:"Open in new window",
+popup:"Javascript popup",
+popup_url:"Popup URL",
+popup_name:"Window name",
+popup_return:"Insert 'return false'",
+popup_scrollbars:"Show scrollbars",
+popup_statusbar:"Show status bar",
+popup_toolbar:"Show toolbars",
+popup_menubar:"Show menu bar",
+popup_location:"Show location bar",
+popup_resizable:"Make window resizable",
+popup_dependent:"Dependent (Mozilla/Firefox only)",
+popup_size:"Size",
+popup_position:"Position (X/Y)",
+id:"Id",
+style:"Style",
+classes:"Classes",
+target_name:"Target name",
+langdir:"Language direction",
+target_langcode:"Target language",
+langcode:"Language code",
+encoding:"Target character encoding",
+mime:"Target MIME type",
+rel:"Relationship page to target",
+rev:"Relationship target to page",
+tabindex:"Tabindex",
+accesskey:"Accesskey",
+ltr:"Left to right",
+rtl:"Right to left",
+link_list:"Link list"
+});
\ No newline at end of file
diff --git a/web/libs/tiny_mce/plugins/advlink/link.htm b/web/libs/tiny_mce/plugins/advlink/link.htm
new file mode 100644
index 0000000..876669c
--- /dev/null
+++ b/web/libs/tiny_mce/plugins/advlink/link.htm
@@ -0,0 +1,333 @@
+
+
+
+ {#advlink_dlg.title}
+
+
+
+
+
+
+
+
+
+
+
diff --git a/web/libs/tiny_mce/plugins/advlist/editor_plugin.js b/web/libs/tiny_mce/plugins/advlist/editor_plugin.js
new file mode 100644
index 0000000..02d1697
--- /dev/null
+++ b/web/libs/tiny_mce/plugins/advlist/editor_plugin.js
@@ -0,0 +1 @@
+(function(){var a=tinymce.each;tinymce.create("tinymce.plugins.AdvListPlugin",{init:function(b,c){var d=this;d.editor=b;function e(g){var f=[];a(g.split(/,/),function(h){f.push({title:"advlist."+(h=="default"?"def":h.replace(/-/g,"_")),styles:{listStyleType:h=="default"?"":h}})});return f}d.numlist=b.getParam("advlist_number_styles")||e("default,lower-alpha,lower-greek,lower-roman,upper-alpha,upper-roman");d.bullist=b.getParam("advlist_bullet_styles")||e("default,circle,disc,square")},createControl:function(d,b){var f=this,e,h;if(d=="numlist"||d=="bullist"){if(f[d][0].title=="advlist.def"){h=f[d][0]}function c(i,k){var j=true;a(k.styles,function(m,l){if(f.editor.dom.getStyle(i,l)!=m){j=false;return false}});return j}function g(){var k,i=f.editor,l=i.dom,j=i.selection;k=l.getParent(j.getNode(),"ol,ul");if(!k||k.nodeName==(d=="bullist"?"OL":"UL")||c(k,h)){i.execCommand(d=="bullist"?"InsertUnorderedList":"InsertOrderedList")}if(h){k=l.getParent(j.getNode(),"ol,ul");if(k){l.setStyles(k,h.styles);k.removeAttribute("_mce_style")}}}e=b.createSplitButton(d,{title:"advanced."+d+"_desc","class":"mce_"+d,onclick:function(){g()}});e.onRenderMenu.add(function(i,j){j.onShowMenu.add(function(){var m=f.editor.dom,l=m.getParent(f.editor.selection.getNode(),"ol,ul"),k;if(l||h){k=f[d];a(j.items,function(n){var o=true;n.setSelected(0);if(l&&!n.isDisabled()){a(k,function(p){if(p.id==n.id){if(!c(l,p)){o=false;return false}}});if(o){n.setSelected(1)}}});if(!l){j.items[h.id].setSelected(1)}}});j.add({id:f.editor.dom.uniqueId(),title:"advlist.types","class":"mceMenuItemTitle"}).setDisabled(1);a(f[d],function(k){k.id=f.editor.dom.uniqueId();j.add({id:k.id,title:k.title,onclick:function(){h=k;g()}})})});return e}},getInfo:function(){return{longname:"Advanced lists",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advlist",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("advlist",tinymce.plugins.AdvListPlugin)})();
\ No newline at end of file
diff --git a/web/libs/tiny_mce/plugins/advlist/editor_plugin_src.js b/web/libs/tiny_mce/plugins/advlist/editor_plugin_src.js
new file mode 100644
index 0000000..a61887a
--- /dev/null
+++ b/web/libs/tiny_mce/plugins/advlist/editor_plugin_src.js
@@ -0,0 +1,154 @@
+/**
+ * editor_plugin_src.js
+ *
+ * Copyright 2009, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://tinymce.moxiecode.com/license
+ * Contributing: http://tinymce.moxiecode.com/contributing
+ */
+
+(function() {
+ var each = tinymce.each;
+
+ tinymce.create('tinymce.plugins.AdvListPlugin', {
+ init : function(ed, url) {
+ var t = this;
+
+ t.editor = ed;
+
+ function buildFormats(str) {
+ var formats = [];
+
+ each(str.split(/,/), function(type) {
+ formats.push({
+ title : 'advlist.' + (type == 'default' ? 'def' : type.replace(/-/g, '_')),
+ styles : {
+ listStyleType : type == 'default' ? '' : type
+ }
+ });
+ });
+
+ return formats;
+ };
+
+ // Setup number formats from config or default
+ t.numlist = ed.getParam("advlist_number_styles") || buildFormats("default,lower-alpha,lower-greek,lower-roman,upper-alpha,upper-roman");
+ t.bullist = ed.getParam("advlist_bullet_styles") || buildFormats("default,circle,disc,square");
+ },
+
+ createControl: function(name, cm) {
+ var t = this, btn, format;
+
+ if (name == 'numlist' || name == 'bullist') {
+ // Default to first item if it's a default item
+ if (t[name][0].title == 'advlist.def')
+ format = t[name][0];
+
+ function hasFormat(node, format) {
+ var state = true;
+
+ each(format.styles, function(value, name) {
+ // Format doesn't match
+ if (t.editor.dom.getStyle(node, name) != value) {
+ state = false;
+ return false;
+ }
+ });
+
+ return state;
+ };
+
+ function applyListFormat() {
+ var list, ed = t.editor, dom = ed.dom, sel = ed.selection;
+
+ // Check for existing list element
+ list = dom.getParent(sel.getNode(), 'ol,ul');
+
+ // Switch/add list type if needed
+ if (!list || list.nodeName == (name == 'bullist' ? 'OL' : 'UL') || hasFormat(list, format))
+ ed.execCommand(name == 'bullist' ? 'InsertUnorderedList' : 'InsertOrderedList');
+
+ // Append styles to new list element
+ if (format) {
+ list = dom.getParent(sel.getNode(), 'ol,ul');
+
+ if (list) {
+ dom.setStyles(list, format.styles);
+ list.removeAttribute('_mce_style');
+ }
+ }
+ };
+
+ btn = cm.createSplitButton(name, {
+ title : 'advanced.' + name + '_desc',
+ 'class' : 'mce_' + name,
+ onclick : function() {
+ applyListFormat();
+ }
+ });
+
+ btn.onRenderMenu.add(function(btn, menu) {
+ menu.onShowMenu.add(function() {
+ var dom = t.editor.dom, list = dom.getParent(t.editor.selection.getNode(), 'ol,ul'), fmtList;
+
+ if (list || format) {
+ fmtList = t[name];
+
+ // Unselect existing items
+ each(menu.items, function(item) {
+ var state = true;
+
+ item.setSelected(0);
+
+ if (list && !item.isDisabled()) {
+ each(fmtList, function(fmt) {
+ if (fmt.id == item.id) {
+ if (!hasFormat(list, fmt)) {
+ state = false;
+ return false;
+ }
+ }
+ });
+
+ if (state)
+ item.setSelected(1);
+ }
+ });
+
+ // Select the current format
+ if (!list)
+ menu.items[format.id].setSelected(1);
+ }
+ });
+
+ menu.add({id : t.editor.dom.uniqueId(), title : 'advlist.types', 'class' : 'mceMenuItemTitle'}).setDisabled(1);
+
+ each(t[name], function(item) {
+ item.id = t.editor.dom.uniqueId();
+
+ menu.add({id : item.id, title : item.title, onclick : function() {
+ format = item;
+ applyListFormat();
+ }});
+ });
+ });
+
+ return btn;
+ }
+ },
+
+ getInfo : function() {
+ return {
+ longname : 'Advanced lists',
+ author : 'Moxiecode Systems AB',
+ authorurl : 'http://tinymce.moxiecode.com',
+ infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advlist',
+ version : tinymce.majorVersion + "." + tinymce.minorVersion
+ };
+ }
+ });
+
+ // Register plugin
+ tinymce.PluginManager.add('advlist', tinymce.plugins.AdvListPlugin);
+})();
\ No newline at end of file
diff --git a/web/libs/tiny_mce/plugins/autoresize/editor_plugin.js b/web/libs/tiny_mce/plugins/autoresize/editor_plugin.js
new file mode 100644
index 0000000..1676b15
--- /dev/null
+++ b/web/libs/tiny_mce/plugins/autoresize/editor_plugin.js
@@ -0,0 +1 @@
+(function(){tinymce.create("tinymce.plugins.AutoResizePlugin",{init:function(a,c){var d=this;if(a.getParam("fullscreen_is_enabled")){return}function b(){var h=a.getDoc(),e=h.body,j=h.documentElement,g=tinymce.DOM,i=d.autoresize_min_height,f;f=tinymce.isIE?e.scrollHeight:j.offsetHeight;if(f>d.autoresize_min_height){i=f}g.setStyle(g.get(a.id+"_ifr"),"height",i+"px");if(d.throbbing){a.setProgressState(false);a.setProgressState(true)}}d.editor=a;d.autoresize_min_height=a.getElement().offsetHeight;a.onChange.add(b);a.onSetContent.add(b);a.onPaste.add(b);a.onKeyUp.add(b);a.onPostRender.add(b);if(a.getParam("autoresize_on_init",true)){a.onInit.add(function(f,e){f.setProgressState(true);d.throbbing=true;f.getBody().style.overflowY="hidden"});a.onLoadContent.add(function(f,e){b();setTimeout(function(){b();f.setProgressState(false);d.throbbing=false},1250)})}a.addCommand("mceAutoResize",b)},getInfo:function(){return{longname:"Auto Resize",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/autoresize",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("autoresize",tinymce.plugins.AutoResizePlugin)})();
\ No newline at end of file
diff --git a/web/libs/tiny_mce/plugins/autoresize/editor_plugin_src.js b/web/libs/tiny_mce/plugins/autoresize/editor_plugin_src.js
new file mode 100644
index 0000000..c260b7a
--- /dev/null
+++ b/web/libs/tiny_mce/plugins/autoresize/editor_plugin_src.js
@@ -0,0 +1,119 @@
+/**
+ * editor_plugin_src.js
+ *
+ * Copyright 2009, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://tinymce.moxiecode.com/license
+ * Contributing: http://tinymce.moxiecode.com/contributing
+ */
+
+(function() {
+ /**
+ * Auto Resize
+ *
+ * This plugin automatically resizes the content area to fit its content height.
+ * It will retain a minimum height, which is the height of the content area when
+ * it's initialized.
+ */
+ tinymce.create('tinymce.plugins.AutoResizePlugin', {
+ /**
+ * Initializes the plugin, this will be executed after the plugin has been created.
+ * This call is done before the editor instance has finished it's initialization so use the onInit event
+ * of the editor instance to intercept that event.
+ *
+ * @param {tinymce.Editor} ed Editor instance that the plugin is initialized in.
+ * @param {string} url Absolute URL to where the plugin is located.
+ */
+ init : function(ed, url) {
+ var t = this;
+
+ if (ed.getParam('fullscreen_is_enabled'))
+ return;
+
+ /**
+ * This method gets executed each time the editor needs to resize.
+ */
+ function resize() {
+ var d = ed.getDoc(), b = d.body, de = d.documentElement, DOM = tinymce.DOM, resizeHeight = t.autoresize_min_height, myHeight;
+
+ // Get height differently depending on the browser used
+ myHeight = tinymce.isIE ? b.scrollHeight : de.offsetHeight;
+
+ // Don't make it smaller than the minimum height
+ if (myHeight > t.autoresize_min_height)
+ resizeHeight = myHeight;
+
+ // Resize content element
+ DOM.setStyle(DOM.get(ed.id + '_ifr'), 'height', resizeHeight + 'px');
+
+ // if we're throbbing, we'll re-throb to match the new size
+ if (t.throbbing) {
+ ed.setProgressState(false);
+ ed.setProgressState(true);
+ }
+ };
+
+ t.editor = ed;
+
+ // Define minimum height
+ t.autoresize_min_height = ed.getElement().offsetHeight;
+
+ // Add appropriate listeners for resizing content area
+ ed.onChange.add(resize);
+ ed.onSetContent.add(resize);
+ ed.onPaste.add(resize);
+ ed.onKeyUp.add(resize);
+ ed.onPostRender.add(resize);
+
+ if (ed.getParam('autoresize_on_init', true)) {
+ // Things to do when the editor is ready
+ ed.onInit.add(function(ed, l) {
+ // Show throbber until content area is resized properly
+ ed.setProgressState(true);
+ t.throbbing = true;
+
+ // Hide scrollbars
+ ed.getBody().style.overflowY = "hidden";
+ });
+
+ ed.onLoadContent.add(function(ed, l) {
+ resize();
+
+ // Because the content area resizes when its content CSS loads,
+ // and we can't easily add a listener to its onload event,
+ // we'll just trigger a resize after a short loading period
+ setTimeout(function() {
+ resize();
+
+ // Disable throbber
+ ed.setProgressState(false);
+ t.throbbing = false;
+ }, 1250);
+ });
+ }
+
+ // Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('mceExample');
+ ed.addCommand('mceAutoResize', resize);
+ },
+
+ /**
+ * Returns information about the plugin as a name/value array.
+ * The current keys are longname, author, authorurl, infourl and version.
+ *
+ * @return {Object} Name/value array containing information about the plugin.
+ */
+ getInfo : function() {
+ return {
+ longname : 'Auto Resize',
+ author : 'Moxiecode Systems AB',
+ authorurl : 'http://tinymce.moxiecode.com',
+ infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/autoresize',
+ version : tinymce.majorVersion + "." + tinymce.minorVersion
+ };
+ }
+ });
+
+ // Register plugin
+ tinymce.PluginManager.add('autoresize', tinymce.plugins.AutoResizePlugin);
+})();
\ No newline at end of file
diff --git a/web/libs/tiny_mce/plugins/autosave/editor_plugin.js b/web/libs/tiny_mce/plugins/autosave/editor_plugin.js
new file mode 100644
index 0000000..6e48540
--- /dev/null
+++ b/web/libs/tiny_mce/plugins/autosave/editor_plugin.js
@@ -0,0 +1 @@
+(function(e){var c="autosave",g="restoredraft",b=true,f,d,a=e.util.Dispatcher;e.create("tinymce.plugins.AutoSave",{init:function(i,j){var h=this,l=i.settings;h.editor=i;function k(n){var m={s:1000,m:60000};n=/^(\d+)([ms]?)$/.exec(""+n);return(n[2]?m[n[2]]:1)*parseInt(n)}e.each({ask_before_unload:b,interval:"30s",retention:"20m",minlength:50},function(n,m){m=c+"_"+m;if(l[m]===f){l[m]=n}});l.autosave_interval=k(l.autosave_interval);l.autosave_retention=k(l.autosave_retention);i.addButton(g,{title:c+".restore_content",onclick:function(){if(i.getContent({draft:true}).replace(/\s| |<\/?p[^>]*>|
]*>/gi,"").length>0){i.windowManager.confirm(c+".warning_message",function(m){if(m){h.restoreDraft()}})}else{h.restoreDraft()}}});i.onNodeChange.add(function(){var m=i.controlManager;if(m.get(g)){m.setDisabled(g,!h.hasDraft())}});i.onInit.add(function(){if(i.controlManager.get(g)){h.setupStorage(i);setInterval(function(){h.storeDraft();i.nodeChanged()},l.autosave_interval)}});h.onStoreDraft=new a(h);h.onRestoreDraft=new a(h);h.onRemoveDraft=new a(h);if(!d){window.onbeforeunload=e.plugins.AutoSave._beforeUnloadHandler;d=b}},getInfo:function(){return{longname:"Auto save",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/autosave",version:e.majorVersion+"."+e.minorVersion}},getExpDate:function(){return new Date(new Date().getTime()+this.editor.settings.autosave_retention).toUTCString()},setupStorage:function(i){var h=this,k=c+"_test",j="OK";h.key=c+i.id;e.each([function(){if(localStorage){localStorage.setItem(k,j);if(localStorage.getItem(k)===j){localStorage.removeItem(k);return localStorage}}},function(){if(sessionStorage){sessionStorage.setItem(k,j);if(sessionStorage.getItem(k)===j){sessionStorage.removeItem(k);return sessionStorage}}},function(){if(e.isIE){i.getElement().style.behavior="url('#default#userData')";return{autoExpires:b,setItem:function(l,n){var m=i.getElement();m.setAttribute(l,n);m.expires=h.getExpDate();m.save("TinyMCE")},getItem:function(l){var m=i.getElement();m.load("TinyMCE");return m.getAttribute(l)},removeItem:function(l){i.getElement().removeAttribute(l)}}}},],function(l){try{h.storage=l();if(h.storage){return false}}catch(m){}})},storeDraft:function(){var i=this,l=i.storage,j=i.editor,h,k;if(l){if(!l.getItem(i.key)&&!j.isDirty()){return}k=j.getContent({draft:true});if(k.length>j.settings.autosave_minlength){h=i.getExpDate();if(!i.storage.autoExpires){i.storage.setItem(i.key+"_expires",h)}i.storage.setItem(i.key,k);i.onStoreDraft.dispatch(i,{expires:h,content:k})}}},restoreDraft:function(){var h=this,i=h.storage;if(i){content=i.getItem(h.key);if(content){h.editor.setContent(content);h.onRestoreDraft.dispatch(h,{content:content})}}},hasDraft:function(){var h=this,k=h.storage,i,j;if(k){j=!!k.getItem(h.key);if(j){if(!h.storage.autoExpires){i=new Date(k.getItem(h.key+"_expires"));if(new Date().getTime()]*>|
]*>/gi, "").length > 0) {
+ // Show confirm dialog if the editor isn't empty
+ ed.windowManager.confirm(
+ PLUGIN_NAME + ".warning_message",
+ function(ok) {
+ if (ok)
+ self.restoreDraft();
+ }
+ );
+ } else
+ self.restoreDraft();
+ }
+ });
+
+ // Enable/disable restoredraft button depending on if there is a draft stored or not
+ ed.onNodeChange.add(function() {
+ var controlManager = ed.controlManager;
+
+ if (controlManager.get(RESTORE_DRAFT))
+ controlManager.setDisabled(RESTORE_DRAFT, !self.hasDraft());
+ });
+
+ ed.onInit.add(function() {
+ // Check if the user added the restore button, then setup auto storage logic
+ if (ed.controlManager.get(RESTORE_DRAFT)) {
+ // Setup storage engine
+ self.setupStorage(ed);
+
+ // Auto save contents each interval time
+ setInterval(function() {
+ self.storeDraft();
+ ed.nodeChanged();
+ }, settings.autosave_interval);
+ }
+ });
+
+ /**
+ * This event gets fired when a draft is stored to local storage.
+ *
+ * @event onStoreDraft
+ * @param {tinymce.plugins.AutoSave} sender Plugin instance sending the event.
+ * @param {Object} draft Draft object containing the HTML contents of the editor.
+ */
+ self.onStoreDraft = new Dispatcher(self);
+
+ /**
+ * This event gets fired when a draft is restored from local storage.
+ *
+ * @event onStoreDraft
+ * @param {tinymce.plugins.AutoSave} sender Plugin instance sending the event.
+ * @param {Object} draft Draft object containing the HTML contents of the editor.
+ */
+ self.onRestoreDraft = new Dispatcher(self);
+
+ /**
+ * This event gets fired when a draft removed/expired.
+ *
+ * @event onRemoveDraft
+ * @param {tinymce.plugins.AutoSave} sender Plugin instance sending the event.
+ * @param {Object} draft Draft object containing the HTML contents of the editor.
+ */
+ self.onRemoveDraft = new Dispatcher(self);
+
+ // Add ask before unload dialog only add one unload handler
+ if (!unloadHandlerAdded) {
+ window.onbeforeunload = tinymce.plugins.AutoSave._beforeUnloadHandler;
+ unloadHandlerAdded = TRUE;
+ }
+ },
+
+ /**
+ * Returns information about the plugin as a name/value array.
+ * The current keys are longname, author, authorurl, infourl and version.
+ *
+ * @method getInfo
+ * @return {Object} Name/value array containing information about the plugin.
+ */
+ getInfo : function() {
+ return {
+ longname : 'Auto save',
+ author : 'Moxiecode Systems AB',
+ authorurl : 'http://tinymce.moxiecode.com',
+ infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/autosave',
+ version : tinymce.majorVersion + "." + tinymce.minorVersion
+ };
+ },
+
+ /**
+ * Returns an expiration date UTC string.
+ *
+ * @method getExpDate
+ * @return {String} Expiration date UTC string.
+ */
+ getExpDate : function() {
+ return new Date(
+ new Date().getTime() + this.editor.settings.autosave_retention
+ ).toUTCString();
+ },
+
+ /**
+ * This method will setup the storage engine. If the browser has support for it.
+ *
+ * @method setupStorage
+ */
+ setupStorage : function(ed) {
+ var self = this, testKey = PLUGIN_NAME + '_test', testVal = "OK";
+
+ self.key = PLUGIN_NAME + ed.id;
+
+ // Loop though each storage engine type until we find one that works
+ tinymce.each([
+ function() {
+ // Try HTML5 Local Storage
+ if (localStorage) {
+ localStorage.setItem(testKey, testVal);
+
+ if (localStorage.getItem(testKey) === testVal) {
+ localStorage.removeItem(testKey);
+
+ return localStorage;
+ }
+ }
+ },
+
+ function() {
+ // Try HTML5 Session Storage
+ if (sessionStorage) {
+ sessionStorage.setItem(testKey, testVal);
+
+ if (sessionStorage.getItem(testKey) === testVal) {
+ sessionStorage.removeItem(testKey);
+
+ return sessionStorage;
+ }
+ }
+ },
+
+ function() {
+ // Try IE userData
+ if (tinymce.isIE) {
+ ed.getElement().style.behavior = "url('#default#userData')";
+
+ // Fake localStorage on old IE
+ return {
+ autoExpires : TRUE,
+
+ setItem : function(key, value) {
+ var userDataElement = ed.getElement();
+
+ userDataElement.setAttribute(key, value);
+ userDataElement.expires = self.getExpDate();
+ userDataElement.save("TinyMCE");
+ },
+
+ getItem : function(key) {
+ var userDataElement = ed.getElement();
+
+ userDataElement.load("TinyMCE");
+
+ return userDataElement.getAttribute(key);
+ },
+
+ removeItem : function(key) {
+ ed.getElement().removeAttribute(key);
+ }
+ };
+ }
+ },
+ ], function(setup) {
+ // Try executing each function to find a suitable storage engine
+ try {
+ self.storage = setup();
+
+ if (self.storage)
+ return false;
+ } catch (e) {
+ // Ignore
+ }
+ });
+ },
+
+ /**
+ * This method will store the current contents in the the storage engine.
+ *
+ * @method storeDraft
+ */
+ storeDraft : function() {
+ var self = this, storage = self.storage, editor = self.editor, expires, content;
+
+ // Is the contents dirty
+ if (storage) {
+ // If there is no existing key and the contents hasn't been changed since
+ // it's original value then there is no point in saving a draft
+ if (!storage.getItem(self.key) && !editor.isDirty())
+ return;
+
+ // Store contents if the contents if longer than the minlength of characters
+ content = editor.getContent({draft: true});
+ if (content.length > editor.settings.autosave_minlength) {
+ expires = self.getExpDate();
+
+ // Store expiration date if needed IE userData has auto expire built in
+ if (!self.storage.autoExpires)
+ self.storage.setItem(self.key + "_expires", expires);
+
+ self.storage.setItem(self.key, content);
+ self.onStoreDraft.dispatch(self, {
+ expires : expires,
+ content : content
+ });
+ }
+ }
+ },
+
+ /**
+ * This method will restore the contents from the storage engine back to the editor.
+ *
+ * @method restoreDraft
+ */
+ restoreDraft : function() {
+ var self = this, storage = self.storage;
+
+ if (storage) {
+ content = storage.getItem(self.key);
+
+ if (content) {
+ self.editor.setContent(content);
+ self.onRestoreDraft.dispatch(self, {
+ content : content
+ });
+ }
+ }
+ },
+
+ /**
+ * This method will return true/false if there is a local storage draft available.
+ *
+ * @method hasDraft
+ * @return {boolean} true/false state if there is a local draft.
+ */
+ hasDraft : function() {
+ var self = this, storage = self.storage, expDate, exists;
+
+ if (storage) {
+ // Does the item exist at all
+ exists = !!storage.getItem(self.key);
+ if (exists) {
+ // Storage needs autoexpire
+ if (!self.storage.autoExpires) {
+ expDate = new Date(storage.getItem(self.key + "_expires"));
+
+ // Contents hasn't expired
+ if (new Date().getTime() < expDate.getTime())
+ return TRUE;
+
+ // Remove it if it has
+ self.removeDraft();
+ } else
+ return TRUE;
+ }
+ }
+
+ return false;
+ },
+
+ /**
+ * Removes the currently stored draft.
+ *
+ * @method removeDraft
+ */
+ removeDraft : function() {
+ var self = this, storage = self.storage, key = self.key, content;
+
+ if (storage) {
+ // Get current contents and remove the existing draft
+ content = storage.getItem(key);
+ storage.removeItem(key);
+ storage.removeItem(key + "_expires");
+
+ // Dispatch remove event if we had any contents
+ if (content) {
+ self.onRemoveDraft.dispatch(self, {
+ content : content
+ });
+ }
+ }
+ },
+
+ "static" : {
+ // Internal unload handler will be called before the page is unloaded
+ _beforeUnloadHandler : function(e) {
+ var msg;
+
+ tinymce.each(tinyMCE.editors, function(ed) {
+ // Store a draft for each editor instance
+ if (ed.plugins.autosave)
+ ed.plugins.autosave.storeDraft();
+
+ // Never ask in fullscreen mode
+ if (ed.getParam("fullscreen_is_enabled"))
+ return;
+
+ // Setup a return message if the editor is dirty
+ if (!msg && ed.isDirty() && ed.getParam("autosave_ask_before_unload"))
+ msg = ed.getLang("autosave.unload_msg");
+ });
+
+ return msg;
+ }
+ }
+ });
+
+ tinymce.PluginManager.add('autosave', tinymce.plugins.AutoSave);
+})(tinymce);
diff --git a/web/libs/tiny_mce/plugins/autosave/langs/en.js b/web/libs/tiny_mce/plugins/autosave/langs/en.js
new file mode 100644
index 0000000..fce6bd3
--- /dev/null
+++ b/web/libs/tiny_mce/plugins/autosave/langs/en.js
@@ -0,0 +1,4 @@
+tinyMCE.addI18n('en.autosave',{
+restore_content: "Restore auto-saved content",
+warning_message: "If you restore the saved content, you will lose all the content that is currently in the editor.\n\nAre you sure you want to restore the saved content?"
+});
\ No newline at end of file
diff --git a/web/libs/tiny_mce/plugins/bbcode/editor_plugin.js b/web/libs/tiny_mce/plugins/bbcode/editor_plugin.js
new file mode 100644
index 0000000..930fdff
--- /dev/null
+++ b/web/libs/tiny_mce/plugins/bbcode/editor_plugin.js
@@ -0,0 +1 @@
+(function(){tinymce.create("tinymce.plugins.BBCodePlugin",{init:function(a,b){var d=this,c=a.getParam("bbcode_dialect","punbb").toLowerCase();a.onBeforeSetContent.add(function(e,f){f.content=d["_"+c+"_bbcode2html"](f.content)});a.onPostProcess.add(function(e,f){if(f.set){f.content=d["_"+c+"_bbcode2html"](f.content)}if(f.get){f.content=d["_"+c+"_html2bbcode"](f.content)}})},getInfo:function(){return{longname:"BBCode Plugin",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/bbcode",version:tinymce.majorVersion+"."+tinymce.minorVersion}},_punbb_html2bbcode:function(a){a=tinymce.trim(a);function b(c,d){a=a.replace(c,d)}b(/(.*?)<\/a>/gi,"[url=$1]$2[/url]");b(/(.*?)<\/font>/gi,"[code][color=$1]$2[/color][/code]");b(/(.*?)<\/font>/gi,"[quote][color=$1]$2[/color][/quote]");b(/(.*?)<\/font>/gi,"[code][color=$1]$2[/color][/code]");b(/(.*?)<\/font>/gi,"[quote][color=$1]$2[/color][/quote]");b(/(.*?)<\/span>/gi,"[color=$1]$2[/color]");b(/(.*?)<\/font>/gi,"[color=$1]$2[/color]");b(/(.*?)<\/span>/gi,"[size=$1]$2[/size]");b(/(.*?)<\/font>/gi,"$1");b(//gi,"[img]$1[/img]");b(/(.*?)<\/span>/gi,"[code]$1[/code]");b(/(.*?)<\/span>/gi,"[quote]$1[/quote]");b(/(.*?)<\/strong>/gi,"[code][b]$1[/b][/code]");b(/(.*?)<\/strong>/gi,"[quote][b]$1[/b][/quote]");b(/(.*?)<\/em>/gi,"[code][i]$1[/i][/code]");b(/(.*?)<\/em>/gi,"[quote][i]$1[/i][/quote]");b(/(.*?)<\/u>/gi,"[code][u]$1[/u][/code]");b(/(.*?)<\/u>/gi,"[quote][u]$1[/u][/quote]");b(/<\/(strong|b)>/gi,"[/b]");b(/<(strong|b)>/gi,"[b]");b(/<\/(em|i)>/gi,"[/i]");b(/<(em|i)>/gi,"[i]");b(/<\/u>/gi,"[/u]");b(/(.*?)<\/span>/gi,"[u]$1[/u]");b(//gi,"[u]");b(/]*>/gi,"[quote]");b(/<\/blockquote>/gi,"[/quote]");b(/
/gi,"\n");b(/
/gi,"\n");b(/
/gi,"\n");b(//gi,"");b(/<\/p>/gi,"\n");b(/ /gi," ");b(/"/gi,'"');b(/</gi,"<");b(/>/gi,">");b(/&/gi,"&");return a},_punbb_bbcode2html:function(a){a=tinymce.trim(a);function b(c,d){a=a.replace(c,d)}b(/\n/gi,"
");b(/\[b\]/gi,"");b(/\[\/b\]/gi,"");b(/\[i\]/gi,"");b(/\[\/i\]/gi,"");b(/\[u\]/gi,"");b(/\[\/u\]/gi,"");b(/\[url=([^\]]+)\](.*?)\[\/url\]/gi,'$2');b(/\[url\](.*?)\[\/url\]/gi,'$1');b(/\[img\](.*?)\[\/img\]/gi,'');b(/\[color=(.*?)\](.*?)\[\/color\]/gi,'$2');b(/\[code\](.*?)\[\/code\]/gi,'$1 ');b(/\[quote.*?\](.*?)\[\/quote\]/gi,'$1 ');return a}});tinymce.PluginManager.add("bbcode",tinymce.plugins.BBCodePlugin)})();
\ No newline at end of file
diff --git a/web/libs/tiny_mce/plugins/bbcode/editor_plugin_src.js b/web/libs/tiny_mce/plugins/bbcode/editor_plugin_src.js
new file mode 100644
index 0000000..5586637
--- /dev/null
+++ b/web/libs/tiny_mce/plugins/bbcode/editor_plugin_src.js
@@ -0,0 +1,120 @@
+/**
+ * editor_plugin_src.js
+ *
+ * Copyright 2009, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://tinymce.moxiecode.com/license
+ * Contributing: http://tinymce.moxiecode.com/contributing
+ */
+
+(function() {
+ tinymce.create('tinymce.plugins.BBCodePlugin', {
+ init : function(ed, url) {
+ var t = this, dialect = ed.getParam('bbcode_dialect', 'punbb').toLowerCase();
+
+ ed.onBeforeSetContent.add(function(ed, o) {
+ o.content = t['_' + dialect + '_bbcode2html'](o.content);
+ });
+
+ ed.onPostProcess.add(function(ed, o) {
+ if (o.set)
+ o.content = t['_' + dialect + '_bbcode2html'](o.content);
+
+ if (o.get)
+ o.content = t['_' + dialect + '_html2bbcode'](o.content);
+ });
+ },
+
+ getInfo : function() {
+ return {
+ longname : 'BBCode Plugin',
+ author : 'Moxiecode Systems AB',
+ authorurl : 'http://tinymce.moxiecode.com',
+ infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/bbcode',
+ version : tinymce.majorVersion + "." + tinymce.minorVersion
+ };
+ },
+
+ // Private methods
+
+ // HTML -> BBCode in PunBB dialect
+ _punbb_html2bbcode : function(s) {
+ s = tinymce.trim(s);
+
+ function rep(re, str) {
+ s = s.replace(re, str);
+ };
+
+ // example: to [b]
+ rep(/(.*?)<\/a>/gi,"[url=$1]$2[/url]");
+ rep(/(.*?)<\/font>/gi,"[code][color=$1]$2[/color][/code]");
+ rep(/(.*?)<\/font>/gi,"[quote][color=$1]$2[/color][/quote]");
+ rep(/(.*?)<\/font>/gi,"[code][color=$1]$2[/color][/code]");
+ rep(/(.*?)<\/font>/gi,"[quote][color=$1]$2[/color][/quote]");
+ rep(/(.*?)<\/span>/gi,"[color=$1]$2[/color]");
+ rep(/(.*?)<\/font>/gi,"[color=$1]$2[/color]");
+ rep(/(.*?)<\/span>/gi,"[size=$1]$2[/size]");
+ rep(/(.*?)<\/font>/gi,"$1");
+ rep(//gi,"[img]$1[/img]");
+ rep(/(.*?)<\/span>/gi,"[code]$1[/code]");
+ rep(/(.*?)<\/span>/gi,"[quote]$1[/quote]");
+ rep(/(.*?)<\/strong>/gi,"[code][b]$1[/b][/code]");
+ rep(/(.*?)<\/strong>/gi,"[quote][b]$1[/b][/quote]");
+ rep(/(.*?)<\/em>/gi,"[code][i]$1[/i][/code]");
+ rep(/(.*?)<\/em>/gi,"[quote][i]$1[/i][/quote]");
+ rep(/(.*?)<\/u>/gi,"[code][u]$1[/u][/code]");
+ rep(/(.*?)<\/u>/gi,"[quote][u]$1[/u][/quote]");
+ rep(/<\/(strong|b)>/gi,"[/b]");
+ rep(/<(strong|b)>/gi,"[b]");
+ rep(/<\/(em|i)>/gi,"[/i]");
+ rep(/<(em|i)>/gi,"[i]");
+ rep(/<\/u>/gi,"[/u]");
+ rep(/(.*?)<\/span>/gi,"[u]$1[/u]");
+ rep(//gi,"[u]");
+ rep(/]*>/gi,"[quote]");
+ rep(/<\/blockquote>/gi,"[/quote]");
+ rep(/
/gi,"\n");
+ rep(/
/gi,"\n");
+ rep(/
/gi,"\n");
+ rep(//gi,"");
+ rep(/<\/p>/gi,"\n");
+ rep(/ /gi," ");
+ rep(/"/gi,"\"");
+ rep(/</gi,"<");
+ rep(/>/gi,">");
+ rep(/&/gi,"&");
+
+ return s;
+ },
+
+ // BBCode -> HTML from PunBB dialect
+ _punbb_bbcode2html : function(s) {
+ s = tinymce.trim(s);
+
+ function rep(re, str) {
+ s = s.replace(re, str);
+ };
+
+ // example: [b] to
+ rep(/\n/gi,"
");
+ rep(/\[b\]/gi,"");
+ rep(/\[\/b\]/gi,"");
+ rep(/\[i\]/gi,"");
+ rep(/\[\/i\]/gi,"");
+ rep(/\[u\]/gi,"");
+ rep(/\[\/u\]/gi,"");
+ rep(/\[url=([^\]]+)\](.*?)\[\/url\]/gi,"$2");
+ rep(/\[url\](.*?)\[\/url\]/gi,"$1");
+ rep(/\[img\](.*?)\[\/img\]/gi,"");
+ rep(/\[color=(.*?)\](.*?)\[\/color\]/gi,"$2");
+ rep(/\[code\](.*?)\[\/code\]/gi,"$1 ");
+ rep(/\[quote.*?\](.*?)\[\/quote\]/gi,"$1 ");
+
+ return s;
+ }
+ });
+
+ // Register plugin
+ tinymce.PluginManager.add('bbcode', tinymce.plugins.BBCodePlugin);
+})();
\ No newline at end of file
diff --git a/web/libs/tiny_mce/plugins/contextmenu/editor_plugin.js b/web/libs/tiny_mce/plugins/contextmenu/editor_plugin.js
new file mode 100644
index 0000000..9749e51
--- /dev/null
+++ b/web/libs/tiny_mce/plugins/contextmenu/editor_plugin.js
@@ -0,0 +1 @@
+(function(){var a=tinymce.dom.Event,c=tinymce.each,b=tinymce.DOM;tinymce.create("tinymce.plugins.ContextMenu",{init:function(d){var f=this,g;f.editor=d;f.onContextMenu=new tinymce.util.Dispatcher(this);d.onContextMenu.add(function(h,i){if(!i.ctrlKey){if(g){h.selection.setRng(g)}f._getMenu(h).showMenu(i.clientX,i.clientY);a.add(h.getDoc(),"click",function(j){e(h,j)});a.cancel(i)}});d.onRemove.add(function(){if(f._menu){f._menu.removeAll()}});function e(h,i){g=null;if(i&&i.button==2){g=h.selection.getRng();return}if(f._menu){f._menu.removeAll();f._menu.destroy();a.remove(h.getDoc(),"click",e)}}d.onMouseDown.add(e);d.onKeyDown.add(e)},getInfo:function(){return{longname:"Contextmenu",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/contextmenu",version:tinymce.majorVersion+"."+tinymce.minorVersion}},_getMenu:function(h){var l=this,f=l._menu,i=h.selection,e=i.isCollapsed(),d=i.getNode()||h.getBody(),g,k,j;if(f){f.removeAll();f.destroy()}k=b.getPos(h.getContentAreaContainer());j=b.getPos(h.getContainer());f=h.controlManager.createDropMenu("contextmenu",{offset_x:k.x+h.getParam("contextmenu_offset_x",0),offset_y:k.y+h.getParam("contextmenu_offset_y",0),constrain:1});l._menu=f;f.add({title:"advanced.cut_desc",icon:"cut",cmd:"Cut"}).setDisabled(e);f.add({title:"advanced.copy_desc",icon:"copy",cmd:"Copy"}).setDisabled(e);f.add({title:"advanced.paste_desc",icon:"paste",cmd:"Paste"});if((d.nodeName=="A"&&!h.dom.getAttrib(d,"name"))||!e){f.addSeparator();f.add({title:"advanced.link_desc",icon:"link",cmd:h.plugins.advlink?"mceAdvLink":"mceLink",ui:true});f.add({title:"advanced.unlink_desc",icon:"unlink",cmd:"UnLink"})}f.addSeparator();f.add({title:"advanced.image_desc",icon:"image",cmd:h.plugins.advimage?"mceAdvImage":"mceImage",ui:true});f.addSeparator();g=f.addMenu({title:"contextmenu.align"});g.add({title:"contextmenu.left",icon:"justifyleft",cmd:"JustifyLeft"});g.add({title:"contextmenu.center",icon:"justifycenter",cmd:"JustifyCenter"});g.add({title:"contextmenu.right",icon:"justifyright",cmd:"JustifyRight"});g.add({title:"contextmenu.full",icon:"justifyfull",cmd:"JustifyFull"});l.onContextMenu.dispatch(l,f,d,e);return f}});tinymce.PluginManager.add("contextmenu",tinymce.plugins.ContextMenu)})();
\ No newline at end of file
diff --git a/web/libs/tiny_mce/plugins/contextmenu/editor_plugin_src.js b/web/libs/tiny_mce/plugins/contextmenu/editor_plugin_src.js
new file mode 100644
index 0000000..13813a6
--- /dev/null
+++ b/web/libs/tiny_mce/plugins/contextmenu/editor_plugin_src.js
@@ -0,0 +1,147 @@
+/**
+ * editor_plugin_src.js
+ *
+ * Copyright 2009, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://tinymce.moxiecode.com/license
+ * Contributing: http://tinymce.moxiecode.com/contributing
+ */
+
+(function() {
+ var Event = tinymce.dom.Event, each = tinymce.each, DOM = tinymce.DOM;
+
+ /**
+ * This plugin a context menu to TinyMCE editor instances.
+ *
+ * @class tinymce.plugins.ContextMenu
+ */
+ tinymce.create('tinymce.plugins.ContextMenu', {
+ /**
+ * Initializes the plugin, this will be executed after the plugin has been created.
+ * This call is done before the editor instance has finished it's initialization so use the onInit event
+ * of the editor instance to intercept that event.
+ *
+ * @method init
+ * @param {tinymce.Editor} ed Editor instance that the plugin is initialized in.
+ * @param {string} url Absolute URL to where the plugin is located.
+ */
+ init : function(ed) {
+ var t = this, lastRng;
+
+ t.editor = ed;
+
+ /**
+ * This event gets fired when the context menu is shown.
+ *
+ * @event onContextMenu
+ * @param {tinymce.plugins.ContextMenu} sender Plugin instance sending the event.
+ * @param {tinymce.ui.DropMenu} menu Drop down menu to fill with more items if needed.
+ */
+ t.onContextMenu = new tinymce.util.Dispatcher(this);
+
+ ed.onContextMenu.add(function(ed, e) {
+ if (!e.ctrlKey) {
+ // Restore the last selection since it was removed
+ if (lastRng)
+ ed.selection.setRng(lastRng);
+
+ t._getMenu(ed).showMenu(e.clientX, e.clientY);
+ Event.add(ed.getDoc(), 'click', function(e) {
+ hide(ed, e);
+ });
+ Event.cancel(e);
+ }
+ });
+
+ ed.onRemove.add(function() {
+ if (t._menu)
+ t._menu.removeAll();
+ });
+
+ function hide(ed, e) {
+ lastRng = null;
+
+ // Since the contextmenu event moves
+ // the selection we need to store it away
+ if (e && e.button == 2) {
+ lastRng = ed.selection.getRng();
+ return;
+ }
+
+ if (t._menu) {
+ t._menu.removeAll();
+ t._menu.destroy();
+ Event.remove(ed.getDoc(), 'click', hide);
+ }
+ };
+
+ ed.onMouseDown.add(hide);
+ ed.onKeyDown.add(hide);
+ },
+
+ /**
+ * Returns information about the plugin as a name/value array.
+ * The current keys are longname, author, authorurl, infourl and version.
+ *
+ * @method getInfo
+ * @return {Object} Name/value array containing information about the plugin.
+ */
+ getInfo : function() {
+ return {
+ longname : 'Contextmenu',
+ author : 'Moxiecode Systems AB',
+ authorurl : 'http://tinymce.moxiecode.com',
+ infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/contextmenu',
+ version : tinymce.majorVersion + "." + tinymce.minorVersion
+ };
+ },
+
+ _getMenu : function(ed) {
+ var t = this, m = t._menu, se = ed.selection, col = se.isCollapsed(), el = se.getNode() || ed.getBody(), am, p1, p2;
+
+ if (m) {
+ m.removeAll();
+ m.destroy();
+ }
+
+ p1 = DOM.getPos(ed.getContentAreaContainer());
+ p2 = DOM.getPos(ed.getContainer());
+
+ m = ed.controlManager.createDropMenu('contextmenu', {
+ offset_x : p1.x + ed.getParam('contextmenu_offset_x', 0),
+ offset_y : p1.y + ed.getParam('contextmenu_offset_y', 0),
+ constrain : 1
+ });
+
+ t._menu = m;
+
+ m.add({title : 'advanced.cut_desc', icon : 'cut', cmd : 'Cut'}).setDisabled(col);
+ m.add({title : 'advanced.copy_desc', icon : 'copy', cmd : 'Copy'}).setDisabled(col);
+ m.add({title : 'advanced.paste_desc', icon : 'paste', cmd : 'Paste'});
+
+ if ((el.nodeName == 'A' && !ed.dom.getAttrib(el, 'name')) || !col) {
+ m.addSeparator();
+ m.add({title : 'advanced.link_desc', icon : 'link', cmd : ed.plugins.advlink ? 'mceAdvLink' : 'mceLink', ui : true});
+ m.add({title : 'advanced.unlink_desc', icon : 'unlink', cmd : 'UnLink'});
+ }
+
+ m.addSeparator();
+ m.add({title : 'advanced.image_desc', icon : 'image', cmd : ed.plugins.advimage ? 'mceAdvImage' : 'mceImage', ui : true});
+
+ m.addSeparator();
+ am = m.addMenu({title : 'contextmenu.align'});
+ am.add({title : 'contextmenu.left', icon : 'justifyleft', cmd : 'JustifyLeft'});
+ am.add({title : 'contextmenu.center', icon : 'justifycenter', cmd : 'JustifyCenter'});
+ am.add({title : 'contextmenu.right', icon : 'justifyright', cmd : 'JustifyRight'});
+ am.add({title : 'contextmenu.full', icon : 'justifyfull', cmd : 'JustifyFull'});
+
+ t.onContextMenu.dispatch(t, m, el, col);
+
+ return m;
+ }
+ });
+
+ // Register plugin
+ tinymce.PluginManager.add('contextmenu', tinymce.plugins.ContextMenu);
+})();
\ No newline at end of file
diff --git a/web/libs/tiny_mce/plugins/directionality/editor_plugin.js b/web/libs/tiny_mce/plugins/directionality/editor_plugin.js
new file mode 100644
index 0000000..bce8e73
--- /dev/null
+++ b/web/libs/tiny_mce/plugins/directionality/editor_plugin.js
@@ -0,0 +1 @@
+(function(){tinymce.create("tinymce.plugins.Directionality",{init:function(a,b){var c=this;c.editor=a;a.addCommand("mceDirectionLTR",function(){var d=a.dom.getParent(a.selection.getNode(),a.dom.isBlock);if(d){if(a.dom.getAttrib(d,"dir")!="ltr"){a.dom.setAttrib(d,"dir","ltr")}else{a.dom.setAttrib(d,"dir","")}}a.nodeChanged()});a.addCommand("mceDirectionRTL",function(){var d=a.dom.getParent(a.selection.getNode(),a.dom.isBlock);if(d){if(a.dom.getAttrib(d,"dir")!="rtl"){a.dom.setAttrib(d,"dir","rtl")}else{a.dom.setAttrib(d,"dir","")}}a.nodeChanged()});a.addButton("ltr",{title:"directionality.ltr_desc",cmd:"mceDirectionLTR"});a.addButton("rtl",{title:"directionality.rtl_desc",cmd:"mceDirectionRTL"});a.onNodeChange.add(c._nodeChange,c)},getInfo:function(){return{longname:"Directionality",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/directionality",version:tinymce.majorVersion+"."+tinymce.minorVersion}},_nodeChange:function(b,a,e){var d=b.dom,c;e=d.getParent(e,d.isBlock);if(!e){a.setDisabled("ltr",1);a.setDisabled("rtl",1);return}c=d.getAttrib(e,"dir");a.setActive("ltr",c=="ltr");a.setDisabled("ltr",0);a.setActive("rtl",c=="rtl");a.setDisabled("rtl",0)}});tinymce.PluginManager.add("directionality",tinymce.plugins.Directionality)})();
\ No newline at end of file
diff --git a/web/libs/tiny_mce/plugins/directionality/editor_plugin_src.js b/web/libs/tiny_mce/plugins/directionality/editor_plugin_src.js
new file mode 100644
index 0000000..4444959
--- /dev/null
+++ b/web/libs/tiny_mce/plugins/directionality/editor_plugin_src.js
@@ -0,0 +1,82 @@
+/**
+ * editor_plugin_src.js
+ *
+ * Copyright 2009, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://tinymce.moxiecode.com/license
+ * Contributing: http://tinymce.moxiecode.com/contributing
+ */
+
+(function() {
+ tinymce.create('tinymce.plugins.Directionality', {
+ init : function(ed, url) {
+ var t = this;
+
+ t.editor = ed;
+
+ ed.addCommand('mceDirectionLTR', function() {
+ var e = ed.dom.getParent(ed.selection.getNode(), ed.dom.isBlock);
+
+ if (e) {
+ if (ed.dom.getAttrib(e, "dir") != "ltr")
+ ed.dom.setAttrib(e, "dir", "ltr");
+ else
+ ed.dom.setAttrib(e, "dir", "");
+ }
+
+ ed.nodeChanged();
+ });
+
+ ed.addCommand('mceDirectionRTL', function() {
+ var e = ed.dom.getParent(ed.selection.getNode(), ed.dom.isBlock);
+
+ if (e) {
+ if (ed.dom.getAttrib(e, "dir") != "rtl")
+ ed.dom.setAttrib(e, "dir", "rtl");
+ else
+ ed.dom.setAttrib(e, "dir", "");
+ }
+
+ ed.nodeChanged();
+ });
+
+ ed.addButton('ltr', {title : 'directionality.ltr_desc', cmd : 'mceDirectionLTR'});
+ ed.addButton('rtl', {title : 'directionality.rtl_desc', cmd : 'mceDirectionRTL'});
+
+ ed.onNodeChange.add(t._nodeChange, t);
+ },
+
+ getInfo : function() {
+ return {
+ longname : 'Directionality',
+ author : 'Moxiecode Systems AB',
+ authorurl : 'http://tinymce.moxiecode.com',
+ infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/directionality',
+ version : tinymce.majorVersion + "." + tinymce.minorVersion
+ };
+ },
+
+ // Private methods
+
+ _nodeChange : function(ed, cm, n) {
+ var dom = ed.dom, dir;
+
+ n = dom.getParent(n, dom.isBlock);
+ if (!n) {
+ cm.setDisabled('ltr', 1);
+ cm.setDisabled('rtl', 1);
+ return;
+ }
+
+ dir = dom.getAttrib(n, 'dir');
+ cm.setActive('ltr', dir == "ltr");
+ cm.setDisabled('ltr', 0);
+ cm.setActive('rtl', dir == "rtl");
+ cm.setDisabled('rtl', 0);
+ }
+ });
+
+ // Register plugin
+ tinymce.PluginManager.add('directionality', tinymce.plugins.Directionality);
+})();
\ No newline at end of file
diff --git a/web/libs/tiny_mce/plugins/emotions/editor_plugin.js b/web/libs/tiny_mce/plugins/emotions/editor_plugin.js
new file mode 100644
index 0000000..dbdd8ff
--- /dev/null
+++ b/web/libs/tiny_mce/plugins/emotions/editor_plugin.js
@@ -0,0 +1 @@
+(function(a){a.create("tinymce.plugins.EmotionsPlugin",{init:function(b,c){b.addCommand("mceEmotion",function(){b.windowManager.open({file:c+"/emotions.htm",width:250+parseInt(b.getLang("emotions.delta_width",0)),height:160+parseInt(b.getLang("emotions.delta_height",0)),inline:1},{plugin_url:c})});b.addButton("emotions",{title:"emotions.emotions_desc",cmd:"mceEmotion"})},getInfo:function(){return{longname:"Emotions",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/emotions",version:a.majorVersion+"."+a.minorVersion}}});a.PluginManager.add("emotions",a.plugins.EmotionsPlugin)})(tinymce);
\ No newline at end of file
diff --git a/web/libs/tiny_mce/plugins/emotions/editor_plugin_src.js b/web/libs/tiny_mce/plugins/emotions/editor_plugin_src.js
new file mode 100644
index 0000000..71d5416
--- /dev/null
+++ b/web/libs/tiny_mce/plugins/emotions/editor_plugin_src.js
@@ -0,0 +1,43 @@
+/**
+ * editor_plugin_src.js
+ *
+ * Copyright 2009, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://tinymce.moxiecode.com/license
+ * Contributing: http://tinymce.moxiecode.com/contributing
+ */
+
+(function(tinymce) {
+ tinymce.create('tinymce.plugins.EmotionsPlugin', {
+ init : function(ed, url) {
+ // Register commands
+ ed.addCommand('mceEmotion', function() {
+ ed.windowManager.open({
+ file : url + '/emotions.htm',
+ width : 250 + parseInt(ed.getLang('emotions.delta_width', 0)),
+ height : 160 + parseInt(ed.getLang('emotions.delta_height', 0)),
+ inline : 1
+ }, {
+ plugin_url : url
+ });
+ });
+
+ // Register buttons
+ ed.addButton('emotions', {title : 'emotions.emotions_desc', cmd : 'mceEmotion'});
+ },
+
+ getInfo : function() {
+ return {
+ longname : 'Emotions',
+ author : 'Moxiecode Systems AB',
+ authorurl : 'http://tinymce.moxiecode.com',
+ infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/emotions',
+ version : tinymce.majorVersion + "." + tinymce.minorVersion
+ };
+ }
+ });
+
+ // Register plugin
+ tinymce.PluginManager.add('emotions', tinymce.plugins.EmotionsPlugin);
+})(tinymce);
\ No newline at end of file
diff --git a/web/libs/tiny_mce/plugins/emotions/emotions.htm b/web/libs/tiny_mce/plugins/emotions/emotions.htm
new file mode 100644
index 0000000..55a1d72
--- /dev/null
+++ b/web/libs/tiny_mce/plugins/emotions/emotions.htm
@@ -0,0 +1,40 @@
+
+
+
+ {#emotions_dlg.title}
+
+
+
+
+
+
+
diff --git a/web/libs/tiny_mce/plugins/emotions/img/smiley-cool.gif b/web/libs/tiny_mce/plugins/emotions/img/smiley-cool.gif
new file mode 100644
index 0000000..ba90cc3
Binary files /dev/null and b/web/libs/tiny_mce/plugins/emotions/img/smiley-cool.gif differ
diff --git a/web/libs/tiny_mce/plugins/emotions/img/smiley-cry.gif b/web/libs/tiny_mce/plugins/emotions/img/smiley-cry.gif
new file mode 100644
index 0000000..74d897a
Binary files /dev/null and b/web/libs/tiny_mce/plugins/emotions/img/smiley-cry.gif differ
diff --git a/web/libs/tiny_mce/plugins/emotions/img/smiley-embarassed.gif b/web/libs/tiny_mce/plugins/emotions/img/smiley-embarassed.gif
new file mode 100644
index 0000000..963a96b
Binary files /dev/null and b/web/libs/tiny_mce/plugins/emotions/img/smiley-embarassed.gif differ
diff --git a/web/libs/tiny_mce/plugins/emotions/img/smiley-foot-in-mouth.gif b/web/libs/tiny_mce/plugins/emotions/img/smiley-foot-in-mouth.gif
new file mode 100644
index 0000000..16f68cc
Binary files /dev/null and b/web/libs/tiny_mce/plugins/emotions/img/smiley-foot-in-mouth.gif differ
diff --git a/web/libs/tiny_mce/plugins/emotions/img/smiley-frown.gif b/web/libs/tiny_mce/plugins/emotions/img/smiley-frown.gif
new file mode 100644
index 0000000..716f55e
Binary files /dev/null and b/web/libs/tiny_mce/plugins/emotions/img/smiley-frown.gif differ
diff --git a/web/libs/tiny_mce/plugins/emotions/img/smiley-innocent.gif b/web/libs/tiny_mce/plugins/emotions/img/smiley-innocent.gif
new file mode 100644
index 0000000..334d49e
Binary files /dev/null and b/web/libs/tiny_mce/plugins/emotions/img/smiley-innocent.gif differ
diff --git a/web/libs/tiny_mce/plugins/emotions/img/smiley-kiss.gif b/web/libs/tiny_mce/plugins/emotions/img/smiley-kiss.gif
new file mode 100644
index 0000000..4efd549
Binary files /dev/null and b/web/libs/tiny_mce/plugins/emotions/img/smiley-kiss.gif differ
diff --git a/web/libs/tiny_mce/plugins/emotions/img/smiley-laughing.gif b/web/libs/tiny_mce/plugins/emotions/img/smiley-laughing.gif
new file mode 100644
index 0000000..1606c11
Binary files /dev/null and b/web/libs/tiny_mce/plugins/emotions/img/smiley-laughing.gif differ
diff --git a/web/libs/tiny_mce/plugins/emotions/img/smiley-money-mouth.gif b/web/libs/tiny_mce/plugins/emotions/img/smiley-money-mouth.gif
new file mode 100644
index 0000000..ca2451e
Binary files /dev/null and b/web/libs/tiny_mce/plugins/emotions/img/smiley-money-mouth.gif differ
diff --git a/web/libs/tiny_mce/plugins/emotions/img/smiley-sealed.gif b/web/libs/tiny_mce/plugins/emotions/img/smiley-sealed.gif
new file mode 100644
index 0000000..b33d3cc
Binary files /dev/null and b/web/libs/tiny_mce/plugins/emotions/img/smiley-sealed.gif differ
diff --git a/web/libs/tiny_mce/plugins/emotions/img/smiley-smile.gif b/web/libs/tiny_mce/plugins/emotions/img/smiley-smile.gif
new file mode 100644
index 0000000..e6a9e60
Binary files /dev/null and b/web/libs/tiny_mce/plugins/emotions/img/smiley-smile.gif differ
diff --git a/web/libs/tiny_mce/plugins/emotions/img/smiley-surprised.gif b/web/libs/tiny_mce/plugins/emotions/img/smiley-surprised.gif
new file mode 100644
index 0000000..cb99cdd
Binary files /dev/null and b/web/libs/tiny_mce/plugins/emotions/img/smiley-surprised.gif differ
diff --git a/web/libs/tiny_mce/plugins/emotions/img/smiley-tongue-out.gif b/web/libs/tiny_mce/plugins/emotions/img/smiley-tongue-out.gif
new file mode 100644
index 0000000..2075dc1
Binary files /dev/null and b/web/libs/tiny_mce/plugins/emotions/img/smiley-tongue-out.gif differ
diff --git a/web/libs/tiny_mce/plugins/emotions/img/smiley-undecided.gif b/web/libs/tiny_mce/plugins/emotions/img/smiley-undecided.gif
new file mode 100644
index 0000000..bef7e25
Binary files /dev/null and b/web/libs/tiny_mce/plugins/emotions/img/smiley-undecided.gif differ
diff --git a/web/libs/tiny_mce/plugins/emotions/img/smiley-wink.gif b/web/libs/tiny_mce/plugins/emotions/img/smiley-wink.gif
new file mode 100644
index 0000000..9faf1af
Binary files /dev/null and b/web/libs/tiny_mce/plugins/emotions/img/smiley-wink.gif differ
diff --git a/web/libs/tiny_mce/plugins/emotions/img/smiley-yell.gif b/web/libs/tiny_mce/plugins/emotions/img/smiley-yell.gif
new file mode 100644
index 0000000..648e6e8
Binary files /dev/null and b/web/libs/tiny_mce/plugins/emotions/img/smiley-yell.gif differ
diff --git a/web/libs/tiny_mce/plugins/emotions/js/emotions.js b/web/libs/tiny_mce/plugins/emotions/js/emotions.js
new file mode 100644
index 0000000..c549367
--- /dev/null
+++ b/web/libs/tiny_mce/plugins/emotions/js/emotions.js
@@ -0,0 +1,22 @@
+tinyMCEPopup.requireLangPack();
+
+var EmotionsDialog = {
+ init : function(ed) {
+ tinyMCEPopup.resizeToInnerSize();
+ },
+
+ insert : function(file, title) {
+ var ed = tinyMCEPopup.editor, dom = ed.dom;
+
+ tinyMCEPopup.execCommand('mceInsertContent', false, dom.createHTML('img', {
+ src : tinyMCEPopup.getWindowArg('plugin_url') + '/img/' + file,
+ alt : ed.getLang(title),
+ title : ed.getLang(title),
+ border : 0
+ }));
+
+ tinyMCEPopup.close();
+ }
+};
+
+tinyMCEPopup.onInit.add(EmotionsDialog.init, EmotionsDialog);
diff --git a/web/libs/tiny_mce/plugins/emotions/langs/en_dlg.js b/web/libs/tiny_mce/plugins/emotions/langs/en_dlg.js
new file mode 100644
index 0000000..3b57ad9
--- /dev/null
+++ b/web/libs/tiny_mce/plugins/emotions/langs/en_dlg.js
@@ -0,0 +1,20 @@
+tinyMCE.addI18n('en.emotions_dlg',{
+title:"Insert emotion",
+desc:"Emotions",
+cool:"Cool",
+cry:"Cry",
+embarassed:"Embarassed",
+foot_in_mouth:"Foot in mouth",
+frown:"Frown",
+innocent:"Innocent",
+kiss:"Kiss",
+laughing:"Laughing",
+money_mouth:"Money mouth",
+sealed:"Sealed",
+smile:"Smile",
+surprised:"Surprised",
+tongue_out:"Tongue out",
+undecided:"Undecided",
+wink:"Wink",
+yell:"Yell"
+});
\ No newline at end of file
diff --git a/web/libs/tiny_mce/plugins/example/dialog.htm b/web/libs/tiny_mce/plugins/example/dialog.htm
new file mode 100644
index 0000000..50b2b34
--- /dev/null
+++ b/web/libs/tiny_mce/plugins/example/dialog.htm
@@ -0,0 +1,22 @@
+
+
+
+ {#example_dlg.title}
+
+
+
+
+
+
+
+
+
diff --git a/web/libs/tiny_mce/plugins/example/editor_plugin.js b/web/libs/tiny_mce/plugins/example/editor_plugin.js
new file mode 100644
index 0000000..ec1f81e
--- /dev/null
+++ b/web/libs/tiny_mce/plugins/example/editor_plugin.js
@@ -0,0 +1 @@
+(function(){tinymce.PluginManager.requireLangPack("example");tinymce.create("tinymce.plugins.ExamplePlugin",{init:function(a,b){a.addCommand("mceExample",function(){a.windowManager.open({file:b+"/dialog.htm",width:320+parseInt(a.getLang("example.delta_width",0)),height:120+parseInt(a.getLang("example.delta_height",0)),inline:1},{plugin_url:b,some_custom_arg:"custom arg"})});a.addButton("example",{title:"example.desc",cmd:"mceExample",image:b+"/img/example.gif"});a.onNodeChange.add(function(d,c,e){c.setActive("example",e.nodeName=="IMG")})},createControl:function(b,a){return null},getInfo:function(){return{longname:"Example plugin",author:"Some author",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/example",version:"1.0"}}});tinymce.PluginManager.add("example",tinymce.plugins.ExamplePlugin)})();
\ No newline at end of file
diff --git a/web/libs/tiny_mce/plugins/example/editor_plugin_src.js b/web/libs/tiny_mce/plugins/example/editor_plugin_src.js
new file mode 100644
index 0000000..9a0e7da
--- /dev/null
+++ b/web/libs/tiny_mce/plugins/example/editor_plugin_src.js
@@ -0,0 +1,84 @@
+/**
+ * editor_plugin_src.js
+ *
+ * Copyright 2009, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://tinymce.moxiecode.com/license
+ * Contributing: http://tinymce.moxiecode.com/contributing
+ */
+
+(function() {
+ // Load plugin specific language pack
+ tinymce.PluginManager.requireLangPack('example');
+
+ tinymce.create('tinymce.plugins.ExamplePlugin', {
+ /**
+ * Initializes the plugin, this will be executed after the plugin has been created.
+ * This call is done before the editor instance has finished it's initialization so use the onInit event
+ * of the editor instance to intercept that event.
+ *
+ * @param {tinymce.Editor} ed Editor instance that the plugin is initialized in.
+ * @param {string} url Absolute URL to where the plugin is located.
+ */
+ init : function(ed, url) {
+ // Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('mceExample');
+ ed.addCommand('mceExample', function() {
+ ed.windowManager.open({
+ file : url + '/dialog.htm',
+ width : 320 + parseInt(ed.getLang('example.delta_width', 0)),
+ height : 120 + parseInt(ed.getLang('example.delta_height', 0)),
+ inline : 1
+ }, {
+ plugin_url : url, // Plugin absolute URL
+ some_custom_arg : 'custom arg' // Custom argument
+ });
+ });
+
+ // Register example button
+ ed.addButton('example', {
+ title : 'example.desc',
+ cmd : 'mceExample',
+ image : url + '/img/example.gif'
+ });
+
+ // Add a node change handler, selects the button in the UI when a image is selected
+ ed.onNodeChange.add(function(ed, cm, n) {
+ cm.setActive('example', n.nodeName == 'IMG');
+ });
+ },
+
+ /**
+ * Creates control instances based in the incomming name. This method is normally not
+ * needed since the addButton method of the tinymce.Editor class is a more easy way of adding buttons
+ * but you sometimes need to create more complex controls like listboxes, split buttons etc then this
+ * method can be used to create those.
+ *
+ * @param {String} n Name of the control to create.
+ * @param {tinymce.ControlManager} cm Control manager to use inorder to create new control.
+ * @return {tinymce.ui.Control} New control instance or null if no control was created.
+ */
+ createControl : function(n, cm) {
+ return null;
+ },
+
+ /**
+ * Returns information about the plugin as a name/value array.
+ * The current keys are longname, author, authorurl, infourl and version.
+ *
+ * @return {Object} Name/value array containing information about the plugin.
+ */
+ getInfo : function() {
+ return {
+ longname : 'Example plugin',
+ author : 'Some author',
+ authorurl : 'http://tinymce.moxiecode.com',
+ infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/example',
+ version : "1.0"
+ };
+ }
+ });
+
+ // Register plugin
+ tinymce.PluginManager.add('example', tinymce.plugins.ExamplePlugin);
+})();
\ No newline at end of file
diff --git a/web/libs/tiny_mce/plugins/example/img/example.gif b/web/libs/tiny_mce/plugins/example/img/example.gif
new file mode 100644
index 0000000..1ab5da4
Binary files /dev/null and b/web/libs/tiny_mce/plugins/example/img/example.gif differ
diff --git a/web/libs/tiny_mce/plugins/example/js/dialog.js b/web/libs/tiny_mce/plugins/example/js/dialog.js
new file mode 100644
index 0000000..fa83411
--- /dev/null
+++ b/web/libs/tiny_mce/plugins/example/js/dialog.js
@@ -0,0 +1,19 @@
+tinyMCEPopup.requireLangPack();
+
+var ExampleDialog = {
+ init : function() {
+ var f = document.forms[0];
+
+ // Get the selected contents as text and place it in the input
+ f.someval.value = tinyMCEPopup.editor.selection.getContent({format : 'text'});
+ f.somearg.value = tinyMCEPopup.getWindowArg('some_custom_arg');
+ },
+
+ insert : function() {
+ // Insert the contents from the input into the document
+ tinyMCEPopup.editor.execCommand('mceInsertContent', false, document.forms[0].someval.value);
+ tinyMCEPopup.close();
+ }
+};
+
+tinyMCEPopup.onInit.add(ExampleDialog.init, ExampleDialog);
diff --git a/web/libs/tiny_mce/plugins/example/langs/en.js b/web/libs/tiny_mce/plugins/example/langs/en.js
new file mode 100644
index 0000000..e0784f8
--- /dev/null
+++ b/web/libs/tiny_mce/plugins/example/langs/en.js
@@ -0,0 +1,3 @@
+tinyMCE.addI18n('en.example',{
+ desc : 'This is just a template button'
+});
diff --git a/web/libs/tiny_mce/plugins/example/langs/en_dlg.js b/web/libs/tiny_mce/plugins/example/langs/en_dlg.js
new file mode 100644
index 0000000..ebcf948
--- /dev/null
+++ b/web/libs/tiny_mce/plugins/example/langs/en_dlg.js
@@ -0,0 +1,3 @@
+tinyMCE.addI18n('en.example_dlg',{
+ title : 'This is just a example title'
+});
diff --git a/web/libs/tiny_mce/plugins/fullpage/css/fullpage.css b/web/libs/tiny_mce/plugins/fullpage/css/fullpage.css
new file mode 100644
index 0000000..7a3334f
--- /dev/null
+++ b/web/libs/tiny_mce/plugins/fullpage/css/fullpage.css
@@ -0,0 +1,182 @@
+/* Hide the advanced tab */
+#advanced_tab {
+ display: none;
+}
+
+#metatitle, #metakeywords, #metadescription, #metaauthor, #metacopyright {
+ width: 280px;
+}
+
+#doctype, #docencoding {
+ width: 200px;
+}
+
+#langcode {
+ width: 30px;
+}
+
+#bgimage {
+ width: 220px;
+}
+
+#fontface {
+ width: 240px;
+}
+
+#leftmargin, #rightmargin, #topmargin, #bottommargin {
+ width: 50px;
+}
+
+.panel_wrapper div.current {
+ height: 400px;
+}
+
+#stylesheet, #style {
+ width: 240px;
+}
+
+/* Head list classes */
+
+.headlistwrapper {
+ width: 100%;
+}
+
+.addbutton, .removebutton, .moveupbutton, .movedownbutton {
+ border-top: 1px solid;
+ border-left: 1px solid;
+ border-bottom: 1px solid;
+ border-right: 1px solid;
+ border-color: #F0F0EE;
+ cursor: default;
+ display: block;
+ width: 20px;
+ height: 20px;
+}
+
+#doctypes {
+ width: 200px;
+}
+
+.addbutton:hover, .removebutton:hover, .moveupbutton:hover, .movedownbutton:hover {
+ border: 1px solid #0A246A;
+ background-color: #B6BDD2;
+}
+
+.addbutton {
+ background-image: url('../images/add.gif');
+ float: left;
+ margin-right: 3px;
+}
+
+.removebutton {
+ background-image: url('../images/remove.gif');
+ float: left;
+}
+
+.moveupbutton {
+ background-image: url('../images/move_up.gif');
+ float: left;
+ margin-right: 3px;
+}
+
+.movedownbutton {
+ background-image: url('../images/move_down.gif');
+ float: left;
+}
+
+.selected {
+ border: 1px solid #0A246A;
+ background-color: #B6BDD2;
+}
+
+.toolbar {
+ width: 100%;
+}
+
+#headlist {
+ width: 100%;
+ margin-top: 3px;
+ font-size: 11px;
+}
+
+#info, #title_element, #meta_element, #script_element, #style_element, #base_element, #link_element, #comment_element, #unknown_element {
+ display: none;
+}
+
+#addmenu {
+ position: absolute;
+ border: 1px solid gray;
+ display: none;
+ z-index: 100;
+ background-color: white;
+}
+
+#addmenu a {
+ display: block;
+ width: 100%;
+ line-height: 20px;
+ text-decoration: none;
+ background-color: white;
+}
+
+#addmenu a:hover {
+ background-color: #B6BDD2;
+ color: black;
+}
+
+#addmenu span {
+ padding-left: 10px;
+ padding-right: 10px;
+}
+
+#updateElementPanel {
+ display: none;
+}
+
+#script_element .panel_wrapper div.current {
+ height: 108px;
+}
+
+#style_element .panel_wrapper div.current {
+ height: 108px;
+}
+
+#link_element .panel_wrapper div.current {
+ height: 140px;
+}
+
+#element_script_value {
+ width: 100%;
+ height: 100px;
+}
+
+#element_comment_value {
+ width: 100%;
+ height: 120px;
+}
+
+#element_style_value {
+ width: 100%;
+ height: 100px;
+}
+
+#element_title, #element_script_src, #element_meta_name, #element_meta_content, #element_base_href, #element_link_href, #element_link_title {
+ width: 250px;
+}
+
+.updateElementButton {
+ margin-top: 3px;
+}
+
+/* MSIE specific styles */
+
+* html .addbutton, * html .removebutton, * html .moveupbutton, * html .movedownbutton {
+ width: 22px;
+ height: 22px;
+}
+
+textarea {
+ height: 55px;
+}
+
+.panel_wrapper div.current {height:420px;}
\ No newline at end of file
diff --git a/web/libs/tiny_mce/plugins/fullpage/editor_plugin.js b/web/libs/tiny_mce/plugins/fullpage/editor_plugin.js
new file mode 100644
index 0000000..aeaa669
--- /dev/null
+++ b/web/libs/tiny_mce/plugins/fullpage/editor_plugin.js
@@ -0,0 +1 @@
+(function(){tinymce.create("tinymce.plugins.FullPagePlugin",{init:function(a,b){var c=this;c.editor=a;a.addCommand("mceFullPageProperties",function(){a.windowManager.open({file:b+"/fullpage.htm",width:430+parseInt(a.getLang("fullpage.delta_width",0)),height:495+parseInt(a.getLang("fullpage.delta_height",0)),inline:1},{plugin_url:b,head_html:c.head})});a.addButton("fullpage",{title:"fullpage.desc",cmd:"mceFullPageProperties"});a.onBeforeSetContent.add(c._setContent,c);a.onSetContent.add(c._setBodyAttribs,c);a.onGetContent.add(c._getContent,c)},getInfo:function(){return{longname:"Fullpage",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/fullpage",version:tinymce.majorVersion+"."+tinymce.minorVersion}},_setBodyAttribs:function(d,a){var l,c,e,g,b,h,j,f=this.head.match(/body(.*?)>/i);if(f&&f[1]){l=f[1].match(/\s*(\w+\s*=\s*".*?"|\w+\s*=\s*'.*?'|\w+\s*=\s*\w+|\w+)\s*/g);if(l){for(c=0,e=l.length;c",a);h.head=f.substring(0,a+1);j=f.indexOf("
\n";h.foot="\n