diff --git a/.gitignore b/.gitignore new file mode 100755 index 0000000..bf84970 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +.DS_store +cache/ diff --git a/README b/README old mode 100644 new mode 100755 diff --git a/Rain/library/DB.php b/Rain/library/DB.php deleted file mode 100644 index f073c17..0000000 --- a/Rain/library/DB.php +++ /dev/null @@ -1,317 +0,0 @@ -_connect($link_name); - } - self::$obj_instance_list[$link_name]->fetch_mode = self::$default_fetch_mode; - return self::$obj_instance_list[$link_name]; - } - - - /** - * Execute a query - * - * @param string $query - * @param array $field if you use PDO prepared query here you going to write the field - */ - function query( $query=null,$field=array() ){ - try{ - $this->statement = $this->link->prepare($query); - $this->statement->execute($field); - self::$nquery++; - return $this->statement; - } catch ( PDOException $e ){ - error_reporting( "Error!: " . $e->getMessage() . "
", E_USER_ERROR ); - } - } - - - - /** - * Get the number of rows involved in the last query - * - * @param string $query - * @param array $field - * @return string - */ - function row_count($query=null,$field=array()){ - return $query ? $this->query($query,$field)->rowCount() : $this->statement->rowCount(); - } - - - - /** - * Get one field - * - * @param string $query - * @param array $field - * @return string - */ - function get_field($query=null,$field=array()){ - return $this->query($query,$field)->fetchColumn(0); - } - - - /** - * Get one row - * - * @param string $query - * @param array $field - * @return array - */ - function get_row($query=null,$field=array() ){ - return $this->query($query,$field)->fetch($this->fetch_mode ); - } - - - - /** - * Get a list of rows. Example: - * - * $db->get_list("SELECT * FROM user") => array(array('id'=>23,'name'=>'tim'),array('id'=>43,'name'=>'max') ... ) - * $db->get_list("SELECT * FROM user","id") => array(23=>array('id'=>23,'name'=>'tim'),42=>array('id'=>43,'name'=>'max') ... ) - * $db->get_list("SELECT * FROM user","id","name") => array(23=>'tim'),42=>'max' ...) - * - * @param string $query - * @param string $key - * @param string $value - * @param array $field - * @return array of array - */ - function get_list( $query = null, $field=array(), $key = null, $value = null ){ - if( $result = $this->query($query,$field)->fetchALL($this->fetch_mode) ){ - if( !$key ) - return $result; - elseif( !$value ) - foreach( $result as $row ) - $rows[ $row[$key] ] = $row; - else - foreach( $result as $row ) - $rows[ $row[$key] ] = $row[$value]; - - return isset($rows)?$rows:null; - } - } - - - - /** - * Get the last inserted id of an insert query - */ - function get_insert_id( ){ - return $this->link->lastInsertId(); - } - - - - /** - * Set the fetch mode - * PDO::FETCH_ASSOC for arrays, PDO::FETCH_OBJ for objects - */ - function set_fetch_mode( $fetch_mode = PDO::FETCH_ASSOC ){ - $this->fetch_mode = $fetch_mode; - } - - - - /** - * Insert Into - * @param array data The parameter must be an associative array (name=>value) - */ - function insert( $table, $data ){ - if( count( $data ) ){ - $fields = $values = ""; - foreach( $data as $name => $value ){ - $fields .= $fields ? ",`$name`" : "`$name`"; - $values .= $values ? ",`$value`" : "`$value`"; - } - return $this->link->query( "INSERT INTO $table ($fields) VALUES ($values)" ); - } - } - - - - /** - * Update - * @param string $table the selected table - * @param array $data the parameter must be an associative array (name=>value) - */ - function update( $table, $data, $where, $field = null ){ - if( count( $data ) ){ - $fields = ""; - foreach( $data as $name => $value ) - $fields .= $fields ? ",`$name`='$value'" : "`$name`='$value'"; - $where = is_string( $where ) ? " WHERE $where" : null; - $query = "UPDATE $table SET $fields $where"; - return $this->query( $query, $field ); - } - } - - - - /** - * Delete - * - * @param array data The parameter must be an associative array (name=>value) - * @param string $where the condition of the row to be deleted - */ - function delete( $table, $where ){ - return $this->link->query("DELETE FROM $table WHERE $where"); - } - - - - /** - * Begin a transaction - */ - function begin_transaction(){ - return $this->link->beginTransaction(); - } - - - - /** - * Commit a transaction - */ - function commit_transaction(){ - return $this->link->commit(); - } - - - - /** - * Rollback a transaction - */ - function rollback_transaction(){ - return $this->link->rollBack(); - } - - - - /** - * Return the number of executed query - */ - static function get_executed_query( ){ - return self::$nquery; - } - - - - /** - * Return > 0 if connected - */ - static function is_connected( ){ - return count(self::$obj_instance_list); - } - - - - /** - * Connect to the database - */ - private function _connect($link_name){ - - if( !$this->db ){ - require_once self::$config_dir . self::$config_file; - $this->db = $db; - } - - extract( $this->db[$link_name] ); // get $dbserver, $hostname, $database, $username, $password, $database_path - - try{ - - switch( $dbserver ){ - case 'mysql': - case 'pgsql': - $this->link = new PDO( "$dbserver:host=$hostname;dbname=$database", $username, $password ); - $this->link->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING); - break; - case 'sqlite': - $this->link = new PDO( "sqlite:$database_path" ); - $this->link->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING); - break; - case 'oracle': - $this->link = new PDO( "OCI:", $username, $password ); - $this->link->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING); - break; - case 'odbc': - $this->link = new PDO( "odbc:Driver={Microsoft Access Driver (*.mdb)};Dbq={$database_path};Uid={$username}"); - $this->link->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING); - break; - default: - die( "DBMS $dbserver not found" ); - } - } catch (PDOException $e) { - die( "Error!: " . $e->getMessage() . "
" ); - } - - } - - - /** - * Configure the settings - * - */ - static function configure( $setting, $value ){ - if( is_array( $setting ) ) - foreach( $setting as $key => $value ) - $this->configure( $key, $value ); - else if( property_exists( __CLASS__, $setting ) ) - self::$$setting = $value; - } - - - /** - * Close mysql connection - */ - function disconnect( ){ - unset( $this->link ); - } - - - private function __construct(){} - -} - -// -- end \ No newline at end of file diff --git a/Rain/library/Model.php b/Rain/library/Model.php deleted file mode 100644 index 768f9c6..0000000 --- a/Rain/library/Model.php +++ /dev/null @@ -1,20 +0,0 @@ - \ No newline at end of file diff --git a/Rain/library/User/Rain_Group.php b/Rain/library/User/Rain_Group.php deleted file mode 100644 index 5ecd7a9..0000000 --- a/Rain/library/User/Rain_Group.php +++ /dev/null @@ -1,37 +0,0 @@ -get_list( "SELECT * FROM ".DB_PREFIX."usergroup ORDER BY name", null, "group_id" ); - } - - function get_group( $group_id ){ - $db = DB::get_instance(); - return $db->get_row( "SELECT * FROM ".DB_PREFIX."usergroup WHERE group_id=?", array($group_id) ); - } - - function get_user_in_group( $group_id, $order_by = "name", $order = "asc", $limit = 0 ){ - $db = DB::get_instance(); - return $db->get_list( "SELECT * FROM ".DB_PREFIX."usergroup_user INNER JOIN ".DB_PREFIX."user ON ".DB_PREFIX."usergroup_user.user_id = ".DB_PREFIX."user.user_id WHERE ".DB_PREFIX."usergroup_user.group_id = $group_id ORDER BY $order_by $order" . ($limit>0? " LIMIT $limit" : null ) ); - } - -} - - - -?> \ No newline at end of file diff --git a/Rain/library/User/Rain_User_Localization.php b/Rain/library/User/Rain_User_Localization.php deleted file mode 100755 index e6c30e6..0000000 --- a/Rain/library/User/Rain_User_Localization.php +++ /dev/null @@ -1,147 +0,0 @@ -query( "DELETE FROM ".DB_PREFIX."user_localization WHERE time < " . HOUR ); - } - - $user_localization_id = $user_localization ? $_SESSION['user_localization']['user_localization_id'] : $db->get_field( "SELECT user_localization_id FROM ".DB_PREFIX."user_localization WHERE sid='$sid'" ); - - if( $user_id = User::get_user_id() ){ - $guest_id = 0; - $name = User::get_user_field( "name" ); - } - else{ - $guest_id = isset( $user_localization['guest_id'] ) ? $user_localization['guest_id'] : ( 1 + $db->get_field( "SELECT guest_id FROM ".DB_PREFIX."user_localization ORDER BY guest_id DESC LIMIT 1;" ) ); - $name = get_msg('guest') . " " . $guest_id; - } - - if( $user_localization_id ) - $db->query( "UPDATE ".DB_PREFIX."user_localization SET ip='$ip', user_id='$user_id', name='$name', url='$url', id='$id', file='$file', time='".TIME."', sid='$sid' WHERE user_localization_id='$user_localization_id'" ); - else{ - - if( !($location = ip_to_location( $ip, $type = 'array' )) ) - $location = array( 'CountryCode'=>null, 'CountryName'=>null, 'RegionCode'=>null, 'RegionName'=>null, 'City'=>null, 'ZipPostalCode'=>null, 'Latitude'=>null, 'Longitude'=>null, 'TimezoneName'=>null, 'Gmtoffset'=>null ); - - //replace_sql_injection( $location ); - - $db->query( "INSERT INTO ".DB_PREFIX."user_localization - (ip,sid,user_id,guest_id,name,url,id,file,os,browser,time,time_first_click,country_code,country_name,region_code,region_name,city_name,zip,latitude,longitude,timezone_name,gmt_offset) - VALUES - ('$ip','$sid','$user_id','$guest_id','$name','$url','$id','$file','$os','$browser', ".TIME.", ".TIME.", '{$location['CountryCode']}', '{$location['CountryName']}', '{$location['RegionCode']}', '{$location['RegionName']}','{$location['City']}', '{$location['ZipPostalCode']}', '{$location['Latitude']}', '{$location['Longitude']}', '{$location['TimezoneName']}', '{$location['Gmtoffset']}')" ); - $user_localization_id = $db->get_insert_id(); - } - - $_SESSION['user_localization'] = array( 'user_localization_id' => $user_localization_id, 'id' => $id, 'guest_id'=>$guest_id, 'name'=>$name, 'time' => TIME, 'file' => $file, 'user_id' => $user_id, 'os' => $os, 'browser' => $browser ); - } - - - - /** - * Refresh all the user info - */ - function refresh(){ - $db = DB::get_instance(); - if( isset( $_SESSION['user_localization'] ) ){ - $db->query( "UPDATE ".DB_PREFIX."user_localization SET time='".TIME."' WHERE user_localization_id='{$_SESSION['user_localization']['user_localization_id']}'" ); - $_SESSION['user_localization']['time'] = TIME; - } - } - - - - /** - * Refresh all the user info - */ - function get_user_localization_id(){ - if( isset( $_SESSION['user_localization'] ) ) - return $_SESSION['user_localization']['user_localization_id']; - } - - - - /** - * Get the userWhereIs info - */ - function get_user_localization( $user_localization_id = null, $online_time = USER_ONLINE_TIME ){ - - if( !$user_localization_id ) - $user_localization_id = $this->get_user_localization_id(); - - $db = DB::get_instance(); - return $db->get_row( "SELECT ".DB_PREFIX."user.*, ".DB_PREFIX."user_localization.* - FROM ".DB_PREFIX."user_localization - LEFT JOIN ".DB_PREFIX."user ON ".DB_PREFIX."user_localization.user_id = ".DB_PREFIX."user.user_id - WHERE ( ".TIME." - time ) < $online_time - AND user_localization_id = $user_localization_id"); - } - - - - /** - * Get the list of all user online - */ - function get_user_localization_list( $id = null, $yourself = true, $online_time = USER_ONLINE_TIME ){ - $db = DB::get_instance(); - return $db->get_list( "SELECT ".DB_PREFIX."user.*, ".DB_PREFIX."user_localization.*, IF (".DB_PREFIX."user.user_id > 0, ".DB_PREFIX."user.name, ".DB_PREFIX."user_localization.name ) AS name - FROM ".DB_PREFIX."user_localization - LEFT JOIN ".DB_PREFIX."user ON ".DB_PREFIX."user_localization.user_id = ".DB_PREFIX."user.user_id - WHERE ( ".TIME." - time ) < $online_time - " . ( $id!=null ? "AND ".DB_PREFIX."user_localization.id = $id" : null ) - . ( !$yourself ? " AND ".DB_PREFIX."user_localization.sid != '".session_id()."'" : null ) - ); - } - - - - /** - * Delete the user where is info - */ - function logout( $user_localization_id = null ){ - - if( !$user_localization_id ) - $user_localization_id = $this->get_user_localization_id(); - - $db = DB::get_instance(); - $db->query( "DELETE FROM ".DB_PREFIX."user_localization WHERE user_localization_id='$user_localization_id'" ); - unset( $_SESSION['user_localization'] ); - } - - -} - - - -?> \ No newline at end of file diff --git a/ajax.php b/ajax.php old mode 100644 new mode 100755 index 3963420..a0cf274 --- a/ajax.php +++ b/ajax.php @@ -5,20 +5,21 @@ #-------------------------------- # Base application directory #-------------------------------- - $application = "application"; - $website = "website"; + $app = "app"; - #-------------------------------- + #-------------------------------- # Load the class #-------------------------------- - require_once "$website/config/directory.php"; - + require_once "config/directory.php"; #-------------------------------- # Load the bootstrap #-------------------------------- - require_once "$application/ajax.bootstrap.php"; \ No newline at end of file + require_once "$app/ajax.bootstrap.php"; + + +// -- end \ No newline at end of file diff --git a/application/ajax.bootstrap.php b/app/ajax.bootstrap.php old mode 100644 new mode 100755 similarity index 92% rename from application/ajax.bootstrap.php rename to app/ajax.bootstrap.php index e7940dd..49ab8d1 --- a/application/ajax.bootstrap.php +++ b/app/ajax.bootstrap.php @@ -1,23 +1,24 @@ -ajax_mode(); - - $loader->init_settings(); - $loader->init_language('en'); +ajax_mode(); + + $loader->init_settings(); + $loader->init_language('en'); $loader->init_db(); $loader->auth_user(); - $loader->init_session(); - $loader->auto_load_controller(); - + //$loader->auth_user(); + $loader->init_session(); + $loader->auto_load_controller(); + // -- end \ No newline at end of file diff --git a/app/bootstrap.php b/app/bootstrap.php new file mode 100755 index 0000000..fbfdd99 --- /dev/null +++ b/app/bootstrap.php @@ -0,0 +1,35 @@ +init_settings();//load the settings +$loader->init_db(); +$loader->init_session(); +$loader->init_language();//set the language +//$loader->auth_user(); +$loader->init_theme();//set theme +$loader->init_js(); + +#-------------------------------- +# Auto Load the Controller +# init_route set the controller/action/params +# to load the controller +#-------------------------------- +$loader->auto_load_controller(); + +#-------------------------------- +# Load model +# load the model and assign the result +# @params model, action, params, assign_to +#-------------------------------- +$loader->load_menu(); + +#-------------------------------- +# Assign Layout variables +#-------------------------------- +$loader->assign( 'title', 'RainFramework' ); + +#-------------------------------- +# Print the layout +#-------------------------------- +$loader->draw(); diff --git a/app/controllers/charts/charts.php b/app/controllers/charts/charts.php new file mode 100755 index 0000000..898823b --- /dev/null +++ b/app/controllers/charts/charts.php @@ -0,0 +1,27 @@ +load_library("Charts"); + $data = array( array('OSX', 10), array('Win', 3 ), array('Unix', 7 ) ); + $this->Charts->set_data($data) ; + //$chart_pie = $this->Charts->draw_pie(); + + $this->Charts->load_csv( WEBSITE_DIR . "assign_execution_time.csv" ) ; + $chart_line = $this->Charts->draw_line(); + + $tpl = new View; + $tpl->assign( "chart_pie", $chart_pie ); + $tpl->assign( "chart_line", $chart_line ); + $tpl->draw( "charts/charts" ); + + } + + } + +?> \ No newline at end of file diff --git a/application/controllers/content/Content.php b/app/controllers/content/content.php old mode 100644 new mode 100755 similarity index 98% rename from application/controllers/content/Content.php rename to app/controllers/content/content.php index 0e696c5..db13020 --- a/application/controllers/content/Content.php +++ b/app/controllers/content/content.php @@ -3,7 +3,7 @@ class Content_Controller extends Controller{ function index(){ - + //love easy $this->load_model("content","content_obj"); diff --git a/app/controllers/form/form.Ajax.php b/app/controllers/form/form.Ajax.php new file mode 100755 index 0000000..81ddd1e --- /dev/null +++ b/app/controllers/form/form.Ajax.php @@ -0,0 +1,15 @@ +ajax_mode( true, true ); + echo $name = get_post('name'); + + } + +} + +?> \ No newline at end of file diff --git a/application/controllers/form/Form.php b/app/controllers/form/form.php old mode 100644 new mode 100755 similarity index 100% rename from application/controllers/form/Form.php rename to app/controllers/form/form.php diff --git a/app/controllers/install/install.ajax.php b/app/controllers/install/install.ajax.php new file mode 100644 index 0000000..f35b062 --- /dev/null +++ b/app/controllers/install/install.ajax.php @@ -0,0 +1,119 @@ + post("adminname"), + "salt" => "$salt", + "password" => "$md5_password", + "email" => post("adminemail", FILTER_SANITIZE_EMAIL), + "status" => 3 + )); + + DB::query("DROP TABLE IF EXISTS ".DB_PREFIX."user_where_is"); + DB::query("CREATE TABLE ".DB_PREFIX."user_where_is ( + user_where_is_id int(11) NOT NULL AUTO_INCREMENT, + user_id int(11) NOT NULL, + guest_id int(11) NOT NULL, + ip varchar(20) NOT NULL default '127.0.0.1', + name varchar(90) NOT NULL, + sid varchar(32) NOT NULL, + url varchar(255) NOT NULL, + id int(11) NOT NULL, + file varchar(255) NOT NULL, + os varchar(255) NOT NULL, + browser varchar(255) NOT NULL, + time int(15) NOT NULL , + time_first_click int(15) NOT NULL, + country_code varchar(2) NOT NULL, + country_name varchar(90) NOT NULL, + region_code varchar(15) NOT NULL, + region_name varchar(255) NOT NULL, + city_name varchar(255) NOT NULL, + zip varchar(20) NOT NULL, + latitude varchar(55) NOT NULL, + longitude varchar(55) NOT NULL, + timezone_name varchar(255) NOT NULL, + gmt_offset varchar(255) NOT NULL, + PRIMARY KEY (user_where_is_id) + ) ENGINE=MyISAM"); + + DB::query("DROP TABLE IF EXISTS ".DB_PREFIX."usergroup"); + DB::query("CREATE TABLE ".DB_PREFIX."usergroup( + group_id int(11) NOT NULL AUTO_INCREMENT, + parent_id int(11) NOT NULL, + name varchar(255) NOT NULL, + position int(11) NOT NULL, + nuser int(11) NOT NULL, + PRIMARY KEY (group_id) + ) ENGINE=MyISAM"); + + DB::query("DROP TABLE IF EXISTS ".DB_PREFIX."usergroup_user"); + DB::query("CREATE TABLE ".DB_PREFIX."usergroup_user( + group_id int(11) NOT NULL, + user_id int(11) NOT NULL, + PRIMARY KEY (group_id , user_id) + ) ENGINE=MyISAM"); + + DB::query("DROP TABLE IF EXISTS ".DB_PREFIX."user_localization"); + DB::query("CREATE TABLE ".DB_PREFIX."user_localization( + user_localization_id int(11) NOT NULL AUTO_INCREMENT, + ip varchar(20) NOT NULL DEFAULT '127.0.0.1', + sid varchar(32) NOT NULL, + user_id int(11) NOT NULL, + guest_id int(11) NOT NULL, + name varchar(90) NOT NULL, + url varchar(255) NOT NULL, + id int(11) NOT NULL, + file varchar(255) NOT NULL, + os varchar(255) NOT NULL, + browser varchar(255) NOT NULL, + time int(15) NOT NULL, + time_first_click int(15) NOT NULL, + country_code varchar(2) NOT NULL, + country_name varchar(90) NOT NULL, + region_code varchar(15) NOT NULL, + region_name varchar(255) NOT NULL, + city_name varchar(255) NOT NULL, + zip varchar(20) NOT NULL, + latitude varchar(55) NOT NULL, + longitude varchar(55) NOT NULL, + timezone_name varchar(255) NOT NULL, + gmt_offset varchar(255) NOT NULL, + PRIMARY KEY (user_localization_id) + )"); + + $querys = DB::get_executed_query(); + $html_message = '
Install Complete!!!
Please Delete:
'.CONTROLLERS_DIR.'install +
Please read next steps in the "Install-notes"
'; + + if($querys == 11) + echo draw_msg($html_message , INFO , true); else echo draw_msg ("ERROR", ERROR, true); + } + +} diff --git a/app/controllers/install/install.php b/app/controllers/install/install.php new file mode 100644 index 0000000..e5e9d97 --- /dev/null +++ b/app/controllers/install/install.php @@ -0,0 +1,35 @@ +'; + echo '

Thanks for using Rainframework!

'; + echo 'To Install and Use some Classes you will add some informations about you'; + + //load form class + $this->load_library("Form", "form"); + $this->form->init_form(URL . "ajax.php/install/install" , "post"); + $this->form->open_table("Userdata"); + $this->form->add_item("text" , "adminname" , "Admin-Name" , "Enter here your Adminname maybe needed later!!" , null , "required"); + $this->form->add_item("text" , "adminemail" , "Admin-Email" , "for Login" , null , "required,email"); + $this->form->add_item("password" , "adminpassword1" , "Admin-Password" , "for Login" , null , "required" , array("id"=>"adminpass1")); + $this->form->add_item("password" , "adminpassword2" , "Admin-Password2" , "Repeat your Password" , null , "required"); + $this->form->add_button(); + $this->form->add_validation("adminpassword2" , 'equalTo="#adminpass1"' , "not equalTo Admin-Password"); + $this->form->close_table(); + $this->form->draw($ajax = true , $return_string = false); + + echo '
'; + echo 'installerversion BETA.1.0'; + echo '
'; + } + +} \ No newline at end of file diff --git a/application/controllers/test/Test.php b/app/controllers/test/test.php old mode 100644 new mode 100755 similarity index 100% rename from application/controllers/test/Test.php rename to app/controllers/test/test.php diff --git a/Rain/language/index.html b/app/index.html old mode 100644 new mode 100755 similarity index 100% rename from Rain/language/index.html rename to app/index.html diff --git a/Rain/library/index.html b/app/log/index.html old mode 100644 new mode 100755 similarity index 100% rename from Rain/library/index.html rename to app/log/index.html diff --git a/application/models/Content.php b/app/models/Content.php old mode 100644 new mode 100755 similarity index 100% rename from application/models/Content.php rename to app/models/Content.php diff --git a/application/models/Menu.php b/app/models/Menu.php old mode 100644 new mode 100755 similarity index 100% rename from application/models/Menu.php rename to app/models/Menu.php diff --git a/app/views/charts/charts.html b/app/views/charts/charts.html new file mode 100755 index 0000000..3255236 --- /dev/null +++ b/app/views/charts/charts.html @@ -0,0 +1,7 @@ +
+

Charts

+
+ {$chart_line} + {$chart_pie} +
+
diff --git a/application/views/content/content.html b/app/views/content/content.html old mode 100644 new mode 100755 similarity index 100% rename from application/views/content/content.html rename to app/views/content/content.html diff --git a/application/views/content/content.php b/app/views/content/content.php old mode 100644 new mode 100755 similarity index 100% rename from application/views/content/content.php rename to app/views/content/content.php diff --git a/application/views/css/style.css b/app/views/css/style.css old mode 100644 new mode 100755 similarity index 100% rename from application/views/css/style.css rename to app/views/css/style.css diff --git a/application/views/img/bg.gif b/app/views/img/bg.gif old mode 100644 new mode 100755 similarity index 100% rename from application/views/img/bg.gif rename to app/views/img/bg.gif diff --git a/application/views/img/logo_mini.gif b/app/views/img/logo_mini.gif old mode 100644 new mode 100755 similarity index 100% rename from application/views/img/logo_mini.gif rename to app/views/img/logo_mini.gif diff --git a/application/views/index.html b/app/views/index.html similarity index 100% rename from application/views/index.html rename to app/views/index.html diff --git a/application/views/not_found.html b/app/views/not_found.html similarity index 100% rename from application/views/not_found.html rename to app/views/not_found.html diff --git a/application/bootstrap.php b/application/bootstrap.php deleted file mode 100644 index 8b26cdc..0000000 --- a/application/bootstrap.php +++ /dev/null @@ -1,50 +0,0 @@ -init_settings(); // load the settings - $loader->init_db(); - $loader->init_session(); - $loader->init_language(); // set the language - $loader->auth_user(); - $loader->init_theme(); // set theme - $loader->init_js(); - - - - - #-------------------------------- - # Auto Load the Controller - # init_route set the controller/action/params - # to load the controller - #-------------------------------- - $loader->auto_load_controller(); - - - - - #-------------------------------- - # Load model - # load the model and assign the result - # @params model, action, params, assign_to - #-------------------------------- - $loader->load_menu(); - - - - - #-------------------------------- - # Assign Layout variables - #-------------------------------- - $loader->assign( 'title', 'RainFramework' ); - - - - #-------------------------------- - # Print the layout - #-------------------------------- - $loader->draw(); - - -?> diff --git a/application/controllers/form/Form.Ajax.php b/application/controllers/form/Form.Ajax.php deleted file mode 100644 index 56ca34b..0000000 --- a/application/controllers/form/Form.Ajax.php +++ /dev/null @@ -1,15 +0,0 @@ -ajax_mode( true, true ); - echo $name = get_post('name'); - - } - - } - -?> \ No newline at end of file diff --git a/changes b/changes old mode 100644 new mode 100755 diff --git a/config/db.php b/config/db.php new file mode 100755 index 0000000..be6aa9b --- /dev/null +++ b/config/db.php @@ -0,0 +1,23 @@ +array( + 'driver'=>'mysql', + 'hostname'=>'localhost', + 'username'=>'root', + 'password'=>'root', + 'database'=>'rainframework2' + ), + //production database (live website) + 'prod'=>array( + 'driver'=>'', + 'hostname'=>'', + 'username'=>'', + 'password'=>'', + 'database'=>'' + ) +); + +if( !defined("DB_PREFIX" ) ) + define( "DB_PREFIX", "RAIN_" ); +// -- end diff --git a/config/directory.php b/config/directory.php new file mode 100755 index 0000000..6997bc5 --- /dev/null +++ b/config/directory.php @@ -0,0 +1,43 @@ + \ No newline at end of file +#-------------------------------- +# Base application directory +#-------------------------------- +$app = "app"; + +#-------------------------------- +# Load the class +#-------------------------------- +require_once "config/directory.php"; + +#-------------------------------- +# Load the bootstrap +#-------------------------------- +require_once "$app/bootstrap.php"; diff --git a/install-notes.txt b/install-notes.txt new file mode 100644 index 0000000..02e1ce8 --- /dev/null +++ b/install-notes.txt @@ -0,0 +1,12 @@ +if you find bugs or i forgot anything write post in www.rainframework.com forum. + +after Installation you need to delete "//" in + +#app/bootstrap.php +#app/ajax.bootstrap.php + +befor $loader->$loader->auth_user() + +and enjoy this framework + +Check www.raincms.org Please to. \ No newline at end of file diff --git a/Rain/const/constants.php b/system/const/constants.php similarity index 82% rename from Rain/const/constants.php rename to system/const/constants.php index 059a1f4..72d2705 100755 --- a/Rain/const/constants.php +++ b/system/const/constants.php @@ -2,7 +2,7 @@ // check that we are using rain framework define( "RAIN", true ); - define( "RAINFRAMEWORK_VERSION", "Rain Framework 2.2" ); + define( "RAINFRAMEWORK_VERSION", "Rain Framework 2.4.5" ); @@ -15,7 +15,7 @@ define( "CONTROLLER_EXTENSION", "php" ); define( "CONTROLLER_CLASS_NAME", "_Controller" ); - define( "AJAX_CONTROLLER_EXTENSION", "Ajax.php" ); + define( "AJAX_CONTROLLER_EXTENSION", "ajax.php" ); define( "AJAX_CONTROLLER_CLASS_NAME", "_Ajax_Controller" ); @@ -28,15 +28,23 @@ // get user IP $IP = getenv( "HTTP_X_FORWARDED_FOR" ) ? getenv( "HTTP_X_FORWARDED_FOR" ) : getenv( "REMOTE_ADDR" ); if( !preg_match("^([1-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(\.([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])){3}^", $IP ) ) $IP = null; - // browser calculation - $known = array('msie', 'firefox', 'safari', 'webkit', 'opera', 'netscape', 'konqueror', 'gecko'); preg_match( '#(' . join('|', $known) . ')[/ ]+([0-9]+(?:\.[0-9]+)?)#', strtolower($_SERVER['HTTP_USER_AGENT']), $br ); preg_match_all( '#\((.*?);#', $_SERVER['HTTP_USER_AGENT'], $os ); if( isset( $br[1][1] ) ) $browser = $br[1][1]; else $browser = null; if( isset( $br[2][1] ) ) $version = $br[2][1]; else $version = null; define( "IP", $IP ); + define( "USER_ONLINE_TIME", 150 ); // user is considered online before 3 minutes of inactivity + + + // Browser Info define( "BROWSER_LANG_ID", substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2) ); + + $known = array('msie', 'firefox', 'safari', 'webkit', 'opera', 'netscape', 'konqueror', 'gecko'); + preg_match( '#(' . join('|', $known) . ')[/ ]+([0-9]+(?:\.[0-9]+)?)#', strtolower($_SERVER['HTTP_USER_AGENT']), $br ); + preg_match_all( '#\((.*?);#', $_SERVER['HTTP_USER_AGENT'], $os ); + if( isset( $br[1][1] ) ) $browser = $br[1][1]; else $browser = null; + if( isset( $br[2][1] ) ) $version = $br[2][1]; else $version = null; + if( isset( $os[1][0] ) ) $browser_os = $os[1][0]; else $browser_os = null; define( "BROWSER", $browser ); define( "BROWSER_VERSION", $version ); - define( "BROWSER_OS", $os[1][0] ); - define( "USER_ONLINE_TIME", 150 ); // user is considered online before 3 minutes of inactivity + define( "BROWSER_OS", $browser_os ); @@ -123,4 +131,4 @@ ); -?> \ No newline at end of file +?> diff --git a/system/language/de/de.gif b/system/language/de/de.gif new file mode 100644 index 0000000..6667ec3 Binary files /dev/null and b/system/language/de/de.gif differ diff --git a/system/language/de/form.php b/system/language/de/form.php new file mode 100644 index 0000000..f720ff2 --- /dev/null +++ b/system/language/de/form.php @@ -0,0 +1,24 @@ + \ No newline at end of file diff --git a/system/language/de/generic.php b/system/language/de/generic.php new file mode 100644 index 0000000..d2f4f32 --- /dev/null +++ b/system/language/de/generic.php @@ -0,0 +1,43 @@ + left , 1 => right + + //Generic + define("_YES_" , "Ja"); + define("_NO_" , "Nein"); + define("_ENABLED_" ,"möglich"); + define("_DISABLED_" ,"nicht möglich"); + define("_TRUE_" ,"Wahr"); + define("_FALSE_" ,"nicht Wahr"); + +?> \ No newline at end of file diff --git a/system/language/de/user.php b/system/language/de/user.php new file mode 100644 index 0000000..d457bdf --- /dev/null +++ b/system/language/de/user.php @@ -0,0 +1,12 @@ + \ No newline at end of file diff --git a/Rain/language/en/en.gif b/system/language/en/en.gif old mode 100644 new mode 100755 similarity index 100% rename from Rain/language/en/en.gif rename to system/language/en/en.gif diff --git a/Rain/language/en/form.php b/system/language/en/form.php similarity index 100% rename from Rain/language/en/form.php rename to system/language/en/form.php diff --git a/Rain/language/en/generic.php b/system/language/en/generic.php similarity index 100% rename from Rain/language/en/generic.php rename to system/language/en/generic.php diff --git a/Rain/language/en/user.php b/system/language/en/user.php old mode 100644 new mode 100755 similarity index 100% rename from Rain/language/en/user.php rename to system/language/en/user.php diff --git a/system/language/es/es.gif b/system/language/es/es.gif new file mode 100755 index 0000000..08b9071 Binary files /dev/null and b/system/language/es/es.gif differ diff --git a/system/language/es/form.php b/system/language/es/form.php new file mode 100755 index 0000000..2163178 --- /dev/null +++ b/system/language/es/form.php @@ -0,0 +1,24 @@ + diff --git a/system/language/es/generic.php b/system/language/es/generic.php new file mode 100755 index 0000000..db39d29 --- /dev/null +++ b/system/language/es/generic.php @@ -0,0 +1,45 @@ + left , 1 => right + + //Generic + define("_YES_" , "Si"); + define("_NO_" , "No"); + define("_ENABLED_" ,"Habilitado"); + define("_DISABLED_" ,"Inhabilitado"); + define("_TRUE_" ,"Verdadero"); + define("_FALSE_" ,"Falso"); + +?> diff --git a/system/language/es/user.php b/system/language/es/user.php new file mode 100755 index 0000000..3ec2167 --- /dev/null +++ b/system/language/es/user.php @@ -0,0 +1,12 @@ + diff --git a/application/log/index.html b/system/language/index.html old mode 100644 new mode 100755 similarity index 100% rename from application/log/index.html rename to system/language/index.html diff --git a/system/library/Charts.php b/system/library/Charts.php new file mode 100755 index 0000000..c8207d4 --- /dev/null +++ b/system/library/Charts.php @@ -0,0 +1,178 @@ +data[$i] = explode( ",", $rows[$i] ); + } + + /** + * Load data from array + */ + function set_data($array){ + $this->data = $array; + } + + + + /** + * Draw line + */ + function draw_line(){ + return $this->_draw('line'); + } + + + + /** + * Draw pie + */ + function draw_pie(){ + return $this->_draw('pie'); + } + + + + private function _draw( $chart = 'line'){ + + $id = 'name' . self::$charts_count; + $js = ""; + if( !self::$charts_count ) + $js .= $this->_init_script(); + + self::$charts_count++; + + $js .= '' . "\n"; + + $html = '
'; + + return $js . $html; + + } + + + function get_colors(){ + return self::$colors; + } + + function set_colors($array){ + self::$colors = $array; + } + + function _init_script(){ + return '' . "\n"; + } + + } + + +?> + + + diff --git a/Rain/library/Controller.php b/system/library/Controller.php old mode 100644 new mode 100755 similarity index 59% rename from Rain/library/Controller.php rename to system/library/Controller.php index c5ad95f..05ba7e7 --- a/Rain/library/Controller.php +++ b/system/library/Controller.php @@ -15,8 +15,8 @@ class Controller{ static protected $models_dir = MODELS_DIR, $library_dir = LIBRARY_DIR; - static protected $controllers_dir = CONTROLLERS_DIR; - static protected $controller_loaded = array(); + static protected $controllers_dir = CONTROLLERS_DIR; + static protected $controller_loaded = array(); /** * load a controller and return the html @@ -24,11 +24,11 @@ class Controller{ */ function load_controller( $controller, $action = null, $params = null, $load_area = null ){ - // get the loader - $loader = Loader::get_instance(); - $loader->load_controller( $controller, $action, $params, $load_area ); + // get the loader + $loader = Loader::get_instance(); + $loader->load_controller( $controller, $action, $params, $load_area ); - } + } @@ -41,13 +41,14 @@ function load_controller( $controller, $action = null, $params = null, $load_are */ function load_model($model,$object_name=null){ - if( !$object_name ) - $object_name = $model; + if( !$object_name ) + $object_name = $model; - // get the loader - $loader = Loader::get_instance(); - // assign the model to the object name, so now it's accessible from the controller - $this->$object_name = $loader->load_model( $model ); + // get the loader + $loader = Loader::get_instance(); + + // assign the model to the object name, so now it's accessible from the controller + $this->$object_name = $loader->load_model( $model ); } @@ -58,13 +59,8 @@ function load_model($model,$object_name=null){ */ function load_library( $library, $object_name = null ){ - if( !$object_name ) - $object_name = $library; - - // transform the library string to capitalized. e.g. user => User, news_list => News_List - $library = implode( "_", array_map( "ucfirst", array_map( "strtolower", explode( "_", $library ) ) ) ); - + $object_name = $library; if( file_exists($file = self::$library_dir . $library . ".php") ) require_once $file; @@ -92,8 +88,8 @@ function load_library( $library, $object_name = null ){ * */ function ajax_mode( $load_javascript = false, $load_style = false, $load_layout = false){ - $loader = Loader::get_instance(); - $loader->ajax_mode( $load_javascript, $load_style, $load_layout ); + $loader = Loader::get_instance(); + $loader->ajax_mode( $load_javascript, $load_style, $load_layout ); } @@ -112,17 +108,17 @@ static function configure( $setting, $value ){ - /** - * Called before init the controller - */ - public function filter_before(){} + /** + * Called before init the controller + */ + public function filter_before(){} - /** - * Called before init the controller - */ - public function filter_after(){} + /** + * Called before init the controller + */ + public function filter_after(){} } diff --git a/system/library/DB.php b/system/library/DB.php new file mode 100755 index 0000000..350e538 --- /dev/null +++ b/system/library/DB.php @@ -0,0 +1,341 @@ +" . $driver . " driver
"); + } + + switch( $driver ){ + case 'mysql': + $string = "mysql:host=$hostname;dbname=$database"; + $pdo_options = array( PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8" ); + break; + case 'pgsql': + $string = "pqsql:host=$hostname;dbname=$database"; + break; + case 'sqlite': + $string = "sqlite:$database_path"; + break; + case 'oracle': + $string = "OCI:"; + break; + case 'odbc': + // $database path + $string = "odbc:Driver={Microsoft Access Driver (*.mdb)};Dbq=$database;Uid=$username"; + break; + default: + die( "Error!: Driver $driver not recognized in DB class" ); + } + + // connect + self::setup( $string, $username, $password, $name, $pdo_options ); + } + + + /** + * Select another database + * @param type $name + */ + public function select_database( $name ) { + + if( empty( self::$db[$name] ) ) + self::init( $name ); + + self::$link = &self::$db[$name]['link']; + } + + + /** + * Execute a query + * + * @param string $query + * @param array $field if you use PDO prepared query here you going to write the field + */ + static function query( $query=null,$field=array() ){ + try{ + self::$statement = self::$link->prepare($query); + self::$statement->execute($field); + self::$nquery++; + return self::$statement; + } catch ( PDOException $e ){ + error_reporting( "Error!: " . $e->getMessage() . "
", E_USER_ERROR ); + } + } + + + + /** + * Get the number of rows involved in the last query + * + * @param string $query + * @param array $field + * @return string + */ + static function count($query=null,$field=array()){ + return $query ? self::query($query,$field)->rowCount() : self::$statement->rowCount(); + } + + + + /** + * Get one field + * + * @param string $query + * @param array $field + * @return string + */ + static function get_field($query=null,$field=array()){ + return self::query($query,$field)->fetchColumn(0); + } + + + /** + * Get one row + * + * @param string $query + * @param array $field + * @return array + */ + static function get_row($query=null,$field=array() ){ + return self::query($query,$field)->fetch(self::$fetch_mode ); + } + + + + /** + * Get a list of rows. Example: + * + * db::get_all("SELECT * FROM user") => array(array('id'=>23,'name'=>'tim'),array('id'=>43,'name'=>'max') ... ) + * db::get_all("SELECT * FROM user","id") => array(23=>array('id'=>23,'name'=>'tim'),42=>array('id'=>43,'name'=>'max') ... ) + * db::get_all("SELECT * FROM user","id","name") => array(23=>'tim'),42=>'max' ...) + * + * @param string $query + * @param string $key + * @param string $value + * @param array $field + * @return array of array + */ + static function get_all( $query = null, $field=array(), $key = null, $value = null ){ + $rows = array(); + if( $result = self::query($query,$field)->fetchALL(self::$fetch_mode) ){ + if( !$key ) + return $result; + elseif( !$value ) + foreach( $result as $row ) + $rows[ $row[$key] ] = $row; + else + foreach( $result as $row ) + $rows[ $row[$key] ] = $row[$value]; + } + return $rows; + } + + + + /** + * Get the last inserted id of an insert query + */ + static function get_last_id( ){ + return self::$link->lastInsertId(); + } + + + + /** + * Set the fetch mode + * PDO::FETCH_ASSOC for arrays, PDO::FETCH_OBJ for objects + */ + static function set_fetch_mode( $fetch_mode = PDO::FETCH_ASSOC ){ + self::$fetch_mode = $fetch_mode; + } + + + + /** + * Insert Into + * @param array data The parameter must be an associative array (name=>value) + */ + static function insert( $table, $data ){ + if( $n = count( $data ) ){ + $fields = implode( ',', array_keys( $data ) ); + $values = implode( ',', array_fill( 0, $n, '?' ) ); + $prepared = array_values( $data ); + + return self::query( "INSERT INTO $table ($fields) VALUES ($values)", $prepared ); + } + } + + + + + /** + * Update + * @param string $table the selected table + * @param array $data the parameter must be an associative array (name=>value) + */ + static function update( $table, $data, $where, $field = null ){ + if( !$where ){ + die( 'You have to set the parameter $where in order to use db::update()' ); + } + + if( count( $data ) ){ + foreach( $data as $field => $value ){ // create the fields + $fields[] = $field . '=?'; + } + $prepared = array_values( $data ); + $fields_query = implode( ',', $fields ); + $where = " WHERE $where"; + + return self::query( "UPDATE $table SET $fields_query $where", $prepared ); + } + } + + + + /** + * Delete + * @param array data The parameter must be an associative array (name=>value) + * @param string $where the condition of the row to be deleted + */ + static function delete( $table, $where ){ + if( !$where ){ + die( 'You have to set the parameter $where in order to use db::delete()' ); + } + $where = $where; + return self::$link->query("DELETE FROM $table WHERE $where"); + } + + + + /** + * Begin a transaction + */ + static function begin(){ + return self::$link->beginTransaction(); + } + + + + /** + * Commit a transaction + */ + static function commit(){ + return self::$link->commit(); + } + + + + /** + * Rollback a transaction + */ + static function rollback(){ + return self::$link->rollBack(); + } + + + + /** + * Return the number of executed query + */ + static function get_executed_query( ){ + return self::$nquery; + } + + + + /** + * Return > 0 if connected + */ + static function is_connected( ){ + return count(self::$link); + } + + + + /** + * Connect to the database + */ + static function setup( $string, $username, $password, $name = self::DEFAULT_CONNECTION_NAME, $pdo_options = array() ){ + + try{ + self::$link = new PDO( $string, $username, $password, $pdo_options ); + self::$link->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING); + self::$db[$name]['link'] = self::$link; + } catch (PDOException $e) { + die( "Error!: " . $e->getMessage() . "
" ); + } + + } + + + /** + * Close mysql connection + */ + static function disconnect( ){ + unset( self::$link ); + } + + + /** + * Configure the settings + * + */ + static function configure( $setting, $value ){ + if( is_array( $setting ) ) + foreach( $setting as $key => $value ) + $this->configure( $key, $value ); + else if( property_exists( __CLASS__, $setting ) ) + self::$$setting = $value; + } + +} + +// -- end \ No newline at end of file diff --git a/Rain/library/Email.php b/system/library/Email.php old mode 100644 new mode 100755 similarity index 100% rename from Rain/library/Email.php rename to system/library/Email.php diff --git a/Rain/library/Email/Phpmailer_email.class.php b/system/library/Email/Phpmailer_email.class.php old mode 100644 new mode 100755 similarity index 100% rename from Rain/library/Email/Phpmailer_email.class.php rename to system/library/Email/Phpmailer_email.class.php diff --git a/Rain/library/Email/phpmailer/LICENSE b/system/library/Email/phpmailer/LICENSE similarity index 100% rename from Rain/library/Email/phpmailer/LICENSE rename to system/library/Email/phpmailer/LICENSE diff --git a/Rain/library/Email/phpmailer/class.phpmailer.php b/system/library/Email/phpmailer/class.phpmailer.php similarity index 100% rename from Rain/library/Email/phpmailer/class.phpmailer.php rename to system/library/Email/phpmailer/class.phpmailer.php diff --git a/Rain/library/Email/phpmailer/class.pop3.php b/system/library/Email/phpmailer/class.pop3.php similarity index 100% rename from Rain/library/Email/phpmailer/class.pop3.php rename to system/library/Email/phpmailer/class.pop3.php diff --git a/Rain/library/Email/phpmailer/class.smtp.php b/system/library/Email/phpmailer/class.smtp.php similarity index 100% rename from Rain/library/Email/phpmailer/class.smtp.php rename to system/library/Email/phpmailer/class.smtp.php diff --git a/Rain/library/Email/phpmailer/language/phpmailer.lang-en.php b/system/library/Email/phpmailer/language/phpmailer.lang-en.php similarity index 100% rename from Rain/library/Email/phpmailer/language/phpmailer.lang-en.php rename to system/library/Email/phpmailer/language/phpmailer.lang-en.php diff --git a/Rain/library/Form.php b/system/library/Form.php similarity index 71% rename from Rain/library/Form.php rename to system/library/Form.php index 1c8a89a..9d4dabd 100755 --- a/Rain/library/Form.php +++ b/system/library/Form.php @@ -50,22 +50,22 @@ function add_validation( $name, $validation, $message = null ){ $this->form_obj->add_validation( $name, $validation, $message ); } - function draw( $ajax = false, $return_string = false ){ - return $this->form_obj->draw( $ajax, $return_string ); + function draw( $ajax = false, $return_string = false , $triggers = null){ + return $this->form_obj->draw( $ajax, $return_string , $triggers); + } + + /** + * Configure the settings + * + */ + static function configure( $setting, $value ){ + if( is_array( $setting ) ) + foreach( $setting as $key => $value ) + $this->configure( $key, $value ); + else if( property_exists( "Form", $setting ) ) + self::$$setting = $value; } - /** - * Configure the settings - * - */ - static function configure( $setting, $value ){ - if( is_array( $setting ) ) - foreach( $setting as $key => $value ) - $this->configure( $key, $value ); - else if( property_exists( "Form", $setting ) ) - self::$$setting = $value; - } - } diff --git a/Rain/library/Form/Rain_Form.php b/system/library/Form/Rain_Form.php similarity index 81% rename from Rain/library/Form/Rain_Form.php rename to system/library/Form/Rain_Form.php index 1586a86..62ade86 100755 --- a/Rain/library/Form/Rain_Form.php +++ b/system/library/Form/Rain_Form.php @@ -1,401 +1,426 @@ -action = $action; - $this->name = $name ? $name : "form__" . self::$form_counter; - $this->method = $method; - $this->target = $target; - $this->layout = $GLOBALS['form_layout'][ $layout ]; - $this->counter = 0; - - self::$form_counter++; - - } - - - function open_table( $name, $subtitle = null, $class = "table" ){ - $this->html .= str_replace( array('{$title}','{$subtitle}','{$class}'), array($name,$subtitle,$class), $this->layout['openTable'] ); - } - - function close_table( ){ - $this->html .= $this->layout['closeTable']; - } - - function add_item( $item, $name, $title = null, $description = null, $value = null, $validation = null, $param = null, $layout = null ){ - - $this->counter++; - - $this->add_validation( $name, $validation ); - - if( !$layout ) - $layout = in_array( $item, array('textarea', 'word') ) ? "row" : "layout"; - - if( method_exists( $this, "_".$item ) ){ - $method = "_".$item; - return $this->html .= $this->_layout_replace( $title, $description, $this->$method( $name, $value, $param ), $layout ); - } - else{ - - $function = "form_" . $item; - - if( function_exists( $function ) ); - elseif( !file_exists( $plugin = "plugins/$item.php" ) ) - return $this->html .= $this->layoutReplace( $title, $description, "plugins not found", $layout ); - else - include_once $plugin; - return $this->html .= $this->layoutReplace( $title, $description, $function( $name, $value, $param, $validation, $this ), $layout ); - - } - } - - - - function add_hidden( $name, $value ){ - $this->hidden .= ""; - } - - - - // wife comment :) nov.12.09 - // hello php...i found youuu. now i work..see? it works now...im sure it does...working...working...working. working hard. im done. - function add_html( $html ){ - $this->counter++; - $this->html .= str_replace( array('{$html}','{$counter}'), array($html,$this->counter), $this->layout['html'] ); - } - - - - //button can be a list or a string - function add_button( $button = null ){ - $this->counter++; - if( null === $button ) - $button = get_msg( "submit" ); - - if( is_array($button) ){ - for($i=0,$html="";$i'.$button[$i]['button'].' '; - } - $this->html .= str_replace( array('{$button}','{$counter}'), array( $html,$this->counter%2), $this->layout['buttons'] ); - } - else - $this->html .= str_replace( array('{$button}','{$counter}'), array('',$this->counter%2), $this->layout['buttons'] ); - } - - - // accepted validation method - //required,remote,minlenght,maxlength,rangelength,min,max,range,email,url,date,dateISO,dateDE,number,numberDE,digits, creditcard,accept,equalTo - function add_validation( $name, $validation, $message = null ){ - - if( $validation ){ - - $val = explode( ",", $validation ); - - foreach( $val as $validation ){ - - $array = explode( "=", $validation ); - $validation = $array[0]; - $value = isset( $array[1] ) ? $array[1] : true; - - if( !in_array( $validation, explode( ',', 'required,remote,minlenght,maxlength,rangelength,min,max,range,email,url,date,dateISO,dateDE,number,numberDE,digits,creditcard,accept,equalTo') ) ) - echo "Validation method not found: $validation
"; - - $message = $message ? $message : str_replace( '{$value}', $value, get_msg( $validation ) ); - $message = "$validation: '$message'"; - $rule = "$validation: $value"; - - if( !isset($this->validation[$name]) ) - $this->validation[$name] = array('rules'=>'','messages'=>''); - - $this->validation[$name]['rules'][] = $rule; - $this->validation[$name]['messages'][] = $message; - $message = null; - } - } - } - - - function draw( $ajax = false, $return_string = false ){ - - if( $ajax ){ - // add ajax jquery script - add_script( "jquery/jquery.form.js" ); - $ajax = " debug:true," . "\n" . - " submitHandler: function(form){" . "\n" . - " $('#{$this->name}_loading').fadeIn('slow')" . "\n" . - " $('#{$this->name}').hide()" . "\n" . - " $('#{$this->name}_result').html('').hide()" . "\n" . - " $(form).ajaxSubmit({" . "\n" . - " target: '#{$this->name}_result'," . "\n" . - " complete:function( data ){" . "\n" . - " $('#{$this->name}_loading').slideUp('slow', function(){" . "\n" . - " $('#{$this->name}').fadeIn('slow');" . "\n" . - " $('#{$this->name}_result').fadeIn('slow');" . "\n" . - " });" . "\n" . - " }" . "\n" . - " });" . "\n" . - " }"; - } - - $validation = null; - - // create the validation html - if( $this->validation ){ - if( $ajax ) $ajax .= ","; - $rules = $messages = ""; - $j = 0; - foreach( $this->validation as $name => $array){ - - $rules .= " $name : { "; - $messages .= " $name : { "; - - for( $i = 0; $i < count( $array['rules'] ); $i++ ){ - $rules .= $array['rules'][$i] . ( $i+1 < count( $array['rules'] ) ? "," : "" ); - $messages .= $array['messages'][$i] . ( $i+1 < count( $array['messages'] ) ? "," : "" ); - } - - $rules .= " }" . ( $j+1 < count( $this->validation ) ? "," : "" ) . "\n"; - $messages .= " }" . ( $j+1 < count( $this->validation ) ? "," : "" ) . "\n"; - $j++; - } - - $validation = " rules: { " . "\n" . - $rules . "\n" . - " }, " . "\n" . - " messages: { " . "\n" . - $messages . "\n" . - " } " . "\n"; - } - - // add javascript - $script = '$("#'.$this->name.'").validate({' . "\n" . ( $this->tiny_mce ?'submit: function(){ tinyMCE.triggerSave() },':null) . "\n" . $ajax . "\n" . $validation . "\n" . ' });'; - - // add the javascript - add_javascript( $script, $onLoad = true ); - - $html = '' . "\n" . - '' . "\n" . - '
target ? 'target="'.$this->target.'"' : null ) . ( $this->upload_file ? ' enctype="multipart/form-data"' : '' ) . ">" . "\n" . $this->hidden . "\n" . $this->html . "\n" . "
" . "\n"; - - if( $return_string ) return $html; else echo $html; - } - - - - private function _text( $name, $value, $param, $type='text' ){ - $attributes = ''; - if( is_array( $param ) ) - foreach( $param as $attr => $val ) - $attributes .= $attr == 'disabled' ? ' disabled' : " $attr=\"$val\""; - return ""; - } - - - - private function _password( $name, $value, $param ){ - return $this->_text( $name, $value, $param, "password" ); - } - - - - private function _file( $name, $value, $param ){ - $attributes = ""; - if( is_array( $param ) ) - foreach( $param as $attr => $val ) - $attributes .= $attr == 'MAX_FILE_SIZE' ? $this->addHidden( 'MAX_FILE_SIZE', $val ) : " $attr=\"$val\""; - return ""; - } - - - - private function _textarea( $name, $value, $param ){ - - $param['rows'] = isset( $param['rows'] ) ? $param['rows'] : ''; - $param['cols'] = isset( $param['cols'] ) ? $param['cols'] : ''; - $attributes = ""; - if( is_array( $param ) ) - foreach( $param as $attr => $val ) - $attributes .= " $attr=\"$val\""; - return ""; - } - - - - private function _checkbox( $name, $value, $param ){ - $attributes = ""; - if( is_array( $param ) ) - foreach( $param as $attr => $val ) - if( $attr != 'options' ) - $attributes .= " $attr=\"$val\""; - $html = '
'; - if( isset( $param['options'] ) && ($options = $param['options'])) - foreach( $options as $v => $n ) - $html .= '     '; - - $html .= '
'; - return $html; - } - - - - private function _radio( $name, $value, $param ){ - $i=0; - $html = ''; - foreach( $param['options'] as $val => $key ){ - $html .= " " . "\n" . - "   " . "\n"; - $i++; - } - return $html; - } - - - - private function _yes( $name, $value = true ){ - return $this->_radio( $name, $value, array( 'options'=>array( true => _YES_ , false => _NO_ ) ), null ); - } - - - - private function _select( $name, $value, $param ){ - - $attributes = ""; - if( is_array( $param ) ) - foreach( $param as $attr => $val ) - if( $attr != 'options' ) - $attributes .= " $attr=\"$val\""; - - $options = ""; - if( is_array($param['options']) ) - foreach( $param['options'] as $option_value => $option_name ) - $options .= $value == $option_value ? "" : ""; - - return ""; - } - - function _word( $name, $value, $param){ - - add_script( "jquery.tinymce.js", LIBRARY_DIR . "Form/plugins/tiny_mce/" ); - $mode = isset( $param['mode'] ) && $param['mode'] == 'simple' ? 'simple' : 'advanced'; - $css = isset( $param['css'] ) ? ',content_css:"' . $param['css'] . '"' : null; - - if( !isset($param['rows']) and !isset($param['height']) ) - $param['rows'] = $mode == 'simple' ? 8 : 18; - $param['rows'] = isset( $param['rows'] ) ? $param['rows'] : ''; - $param['cols'] = isset( $param['cols'] ) ? $param['cols'] : ''; - - /* autoresize */ - if( $mode == 'advanced' ) - // add plugin: ,rain - $tinymce_param = ' - plugins: "safari,fullscreen,searchreplace,media,paste,autosave,inlinepopups,print,pagebreak", - theme_advanced_buttons1 : "bold,italic,underline,|,justifyleft,justifycenter,justifyright,justifyfull,fontsizeselect,|,forecolor,backcolor,|,fullscreen,pagebreak", - theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,replace,|,bullist,numlist,|,undo,redo,|,link,unlink,image,media,code,|,hr,removeformat,|,charmap", - theme_advanced_buttons3 : "", - paste_auto_cleanup_on_paste : true, - theme_advanced_toolbar_location: "top", - theme_advanced_toolbar_align: "left", - theme_advanced_path_location: "bottom", - theme_advanced_resizing : true, - theme_advanced_resize_horizontal : false, - theme_advanced_resizing_use_cookie : false, - valid_elements: "*[*]", - pagebreak_separator : ""' . $css; - else - $tinymce_param = ' - theme_advanced_buttons1 : "bold,italic,underline, strikethrough, separator,justifyleft, justifycenter,justifyright,justifyfull", - theme_advanced_buttons2: "", - theme_advanced_buttons3: "", - paste_auto_cleanup_on_paste : true, - theme_advanced_toolbar_location : "top", - theme_advanced_toolbar_align : "left", - theme_advanced_resize_vertical : true, - theme_advanced_path_location: "bottom", - theme_advanced_resizing : true, - theme_advanced_resize_horizontal : false, - theme_advanced_resizing_use_cookie : false, - auto_resize : true, - valid_elements: "*[*]"' . $css; - - add_javascript( '$("textarea.mce_'.$name.'").tinymce({ - script_url : "' . URL . APPLICATION_LIBRARY_DIR . 'Form/plugins/tiny_mce/tiny_mce.js", - theme: "advanced", - language: "'.LANG_ID.'", - mode: "exact", - elements: "'.$name.'", - force_br_newlines: true, - tab_focus: ":prev,:next", - convert_fonts_to_spans: false, - onchange_callback: function(editor) { - tinyMCE.triggerSave(); - $("#" + editor.id).valid(); - }, - '.$tinymce_param.' - }) - ', $onload = true ); - - $attributes = ""; - if( is_array( $param ) ) - foreach( $param as $attr => $val ) - if( $attr != 'css' && $attr != 'mode' ) - $attributes .= " $attr=\"$val\""; - - $this->tiny_mce = true; - - return ""; - - } - - - private function _layout_replace( $title, $description, $input, $layout ){ - return str_replace( array( '{$title}', '{$description}', '{$input}', '{$counter}' ), array( $title, $description, $input, $this->counter%2 ), $this->layout[$layout] ); - } - - } - - - +action = $action; + $this->name = $name ? $name : "form__" . self::$form_counter; + $this->method = $method; + $this->target = $target; + $this->layout = $GLOBALS['form_layout'][ $layout ]; + $this->counter = 0; + + self::$form_counter++; + + } + + + function open_table( $name, $subtitle = null, $class = "table" ){ + $this->html .= str_replace( array('{$title}','{$subtitle}','{$class}'), array($name,$subtitle,$class), $this->layout['openTable'] ); + } + + function close_table( ){ + $this->html .= $this->layout['closeTable']; + } + + function add_item( $item, $name, $title = null, $description = null, $value = null, $validation = null, $param = null, $layout = null ){ + + $this->counter++; + + $this->add_validation( $name, $validation ); + + if( !$layout ) + $layout = in_array( $item, array('textarea', 'word') ) ? "row" : "layout"; + + if( method_exists( $this, "_".$item ) ){ + $method = "_".$item; + return $this->html .= $this->_layout_replace( $title, $description, $this->$method( $name, $value, $param ), $layout ); + } + else{ + + $function = "form_" . $item; + + if( function_exists( $function ) ); + elseif( !file_exists( $plugin = "plugins/$item.php" ) ) + return $this->html .= $this->layoutReplace( $title, $description, "plugins not found", $layout ); + else + include_once $plugin; + return $this->html .= $this->layoutReplace( $title, $description, $function( $name, $value, $param, $validation, $this ), $layout ); + + } + } + + + + function add_hidden( $name, $value ){ + $this->hidden .= ""; + } + + + + // wife comment :) nov.12.09 + // hello php...i found youuu. now i work..see? it works now...im sure it does...working...working...working. working hard. im done. + function add_html( $html ){ + $this->counter++; + $this->html .= str_replace( array('{$html}','{$counter}'), array($html,$this->counter), $this->layout['html'] ); + } + + + + + //button can be a list or a string + function add_button( $button = null ){ + $this->counter++; + if( null === $button ) + $button = get_msg( "submit" ); + + if( is_array($button) ){ + for($i=0,$html="";$i'.$button[$i]['button'].''; + + } + $this->html .= str_replace( array('{$button}','{$counter}'), array( $html,$this->counter%2), $this->layout['buttons'] ); + } + else { + $this->html .= str_replace( array('{$button}','{$counter}'), array('',$this->counter%2), $this->layout['buttons'] ); + } + } + + + // accepted validation method + //required,remote,minlength,maxlength,rangelength,min,max,range,email,url,date,dateISO,dateDE,number,numberDE,digits, creditcard,accept,equalTo + function add_validation( $name, $validation, $message = null ){ + + if( $validation ){ + + $val = explode( ",", $validation ); + + foreach( $val as $validation ){ + + $array = explode( "=", $validation ); + $validation = $array[0]; + $value = isset( $array[1] ) ? $array[1] : true; + + if( !in_array( $validation, explode( ',', 'required,remote,minlength,maxlength,rangelength,min,max,range,email,url,date,dateISO,dateDE,number,numberDE,digits,creditcard,accept,equalTo') ) ) + echo "Validation method not found: $validation
"; + + $message = $message ? $message : str_replace( '{$value}', $value, get_msg( $validation ) ); + $message = "$validation: '$message'"; + $rule = "$validation: $value"; + + if( !isset($this->validation[$name]) ) + $this->validation[$name] = array('rules'=>'','messages'=>''); + + $this->validation[$name]['rules'][] = $rule; + $this->validation[$name]['messages'][] = $message; + $message = null; + } + } + } + + // add array of paramters : functons to trigger on ajax returns : + // "complete"=>"","success"=>"","fail"=>"" + function draw( $ajax = false, $return_string = false,$triggers=null ){ + + $fnComplete=isset($triggers["complete"])?$triggers["complete"]:""; + $fnSuccess=isset($triggers["success"])?$triggers["success"]:""; + $fnFail=isset($triggers["fail"])?$triggers["fail"]:""; + + if( $ajax ){ + // add ajax jquery script + add_script( "jquery/jquery.form.js" ); + $ajax = + +" debug:true, + submitHandler: function(form) + { + $('#{$this->name}_loading').fadeIn('slow') + $('#{$this->name}').hide(); + $('#{$this->name}_result').html('').hide(); + $(form).ajaxSubmit({ + target: '#{$this->name}_result', + complete:function( data ){ + $('#{$this->name}_loading').slideUp('slow', function(){ + $('#{$this->name}').fadeIn('slow'); + $('#{$this->name}_result').fadeIn('slow'); + $fnComplete + }); + }, + error:function( data ){ + $fnFail + }, + success:function( data ){ + $fnSuccess + } + }); + } +"; + } + + $validation = null; + + // create the validation html + if( $this->validation ){ + if( $ajax ) $ajax .= ","; + $rules = $messages = ""; + $j = 0; + foreach( $this->validation as $name => $array){ + + $rules .= " $name : { "; + $messages .= " $name : { "; + + for( $i = 0; $i < count( $array['rules'] ); $i++ ){ + $rules .= $array['rules'][$i] . ( $i+1 < count( $array['rules'] ) ? "," : "" ); + $messages .= $array['messages'][$i] . ( $i+1 < count( $array['messages'] ) ? "," : "" ); + } + + $rules .= " }" . ( $j+1 < count( $this->validation ) ? "," : "" ) . "\n"; + $messages .= " }" . ( $j+1 < count( $this->validation ) ? "," : "" ) . "\n"; + $j++; + } + + $validation = " rules: { " . "\n" . + $rules . "\n" . + " }, " . "\n" . + " messages: { " . "\n" . + $messages . "\n" . + " } " . "\n"; + } + + // add javascript (and enable a reload of the form with jquery) + $script = '$("#'.$this->name.' button").live("click",function(){$("#'.$this->name.'").validate({' . "\n" . ( $this->tiny_mce ?'submit: function(){ tinyMCE.triggerSave() },':null) . "\n" . $ajax . "\n" . $validation . "\n" . ' })});'; + // add the javascript + add_javascript( $script, $onLoad = true ); + + $html = '' . "\n" . + '' . "\n" . + '
target ? 'target="'.$this->target.'"' : null ) . ( $this->upload_file ? ' enctype="multipart/form-data"' : '' ) . ">" . "\n" . $this->hidden . "\n" . $this->html . "\n" . "
" . "\n"; + + if( $return_string ) return $html; else echo $html; + } + + + + private function _text( $name, $value, $param, $type='text' ){ + $attributes = ''; + if( is_array( $param ) ) + foreach( $param as $attr => $val ) + $attributes .= $attr == 'disabled' ? ' disabled' : " $attr=\"$val\""; + return ""; + } + + + + private function _password( $name, $value, $param ){ + return $this->_text( $name, $value, $param, "password" ); + } + + + + private function _file( $name, $value, $param ){ + $attributes = ""; + if( is_array( $param ) ) + foreach( $param as $attr => $val ) + $attributes .= $attr == 'MAX_FILE_SIZE' ? $this->addHidden( 'MAX_FILE_SIZE', $val ) : " $attr=\"$val\""; + return ""; + } + + + + private function _textarea( $name, $value, $param ){ + + $param['rows'] = isset( $param['rows'] ) ? $param['rows'] : ''; + $param['cols'] = isset( $param['cols'] ) ? $param['cols'] : ''; + $attributes = ""; + if( is_array( $param ) ) + foreach( $param as $attr => $val ) + $attributes .= " $attr=\"$val\""; + return ""; + } + + + + private function _checkbox( $name, $value, $param ){ + $attributes = ""; + if( is_array( $param ) ) + foreach( $param as $attr => $val ) + if( $attr != 'options' ) + $attributes .= " $attr=\"$val\""; + $html = '
'; + if( isset( $param['options'] ) && ($options = $param['options'])) + foreach( $options as $v => $n ) + $html .= '     '; + + $html .= '
'; + return $html; + } + + + + private function _radio( $name, $value, $param ){ + $i=0; + $html = ''; + foreach( $param['options'] as $val => $key ){ + $html .= " " . "\n" . + "   " . "\n"; + $i++; + } + return $html; + } + + + + private function _yes( $name, $value = true ){ + return $this->_radio( $name, $value, array( 'options'=>array( true => _YES_ , false => _NO_ ) ), null ); + } + + + + private function _select( $name, $value, $param ){ + + $attributes = ""; + if( is_array( $param ) ) + foreach( $param as $attr => $val ) + if( $attr != 'options' ) + $attributes .= " $attr=\"$val\""; + + $options = ""; + if( is_array($param['options']) ) + foreach( $param['options'] as $option_value => $option_name ) + $options .= $value == $option_value ? "" : ""; + + return ""; + } + + function _word( $name, $value, $param){ + + add_script( "jquery.tinymce.js", LIBRARY_DIR . "Form/plugins/tiny_mce/" ); + + $mode = isset( $param['mode'] ) && $param['mode'] == 'simple' ? 'simple' : 'advanced'; + $css = isset( $param['css'] ) ? ',content_css:"' . $param['css'] . '"' : null; + + if( !isset($param['rows']) and !isset($param['height']) ) + $param['rows'] = $mode == 'simple' ? 8 : 18; + $param['rows'] = isset( $param['rows'] ) ? $param['rows'] : ''; + $param['cols'] = isset( $param['cols'] ) ? $param['cols'] : ''; + + /* autoresize */ + if( $mode == 'advanced' ) + // add plugin: ,rain + $tinymce_param = ' + plugins: "safari,fullscreen,searchreplace,media,paste,autosave,inlinepopups,print,pagebreak", + theme_advanced_buttons1 : "bold,italic,underline,|,justifyleft,justifycenter,justifyright,justifyfull,fontsizeselect,|,forecolor,backcolor,|,fullscreen,pagebreak", + theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,replace,|,bullist,numlist,|,undo,redo,|,link,unlink,image,media,code,|,hr,removeformat,|,charmap", + theme_advanced_buttons3 : "", + paste_auto_cleanup_on_paste : true, + theme_advanced_toolbar_location: "top", + theme_advanced_toolbar_align: "left", + theme_advanced_path_location: "bottom", + theme_advanced_resizing : true, + theme_advanced_resize_horizontal : false, + theme_advanced_resizing_use_cookie : false, + valid_elements: "*[*]", + pagebreak_separator : ""' . $css; + else + $tinymce_param = ' + theme_advanced_buttons1 : "bold,italic,underline, strikethrough, separator,justifyleft, justifycenter,justifyright,justifyfull", + theme_advanced_buttons2: "", + theme_advanced_buttons3: "", + paste_auto_cleanup_on_paste : true, + theme_advanced_toolbar_location : "top", + theme_advanced_toolbar_align : "left", + theme_advanced_resize_vertical : true, + theme_advanced_path_location: "bottom", + theme_advanced_resizing : true, + theme_advanced_resize_horizontal : false, + theme_advanced_resizing_use_cookie : false, + auto_resize : true, + valid_elements: "*[*]"' . $css; + + add_javascript( '$("textarea.mce_'.$name.'").tinymce({ + theme: "advanced", + language: "'.LANG_ID.'", + mode: "exact", + elements: "'.$name.'", + force_br_newlines: true, + tab_focus: ":prev,:next", + convert_fonts_to_spans: false, + onchange_callback: function(editor) { + tinyMCE.triggerSave(); + $("#" + editor.id).valid(); + }, + '.$tinymce_param.' + }) + ', $onload = true ); + + $attributes = ""; + if( is_array( $param ) ) + foreach( $param as $attr => $val ) + if( $attr != 'css' && $attr != 'mode' ) + $attributes .= " $attr=\"$val\""; + + $this->tiny_mce = true; + + return ""; + + } + + + private function _layout_replace( $title, $description, $input, $layout ){ + return str_replace( array( '{$title}', '{$description}', '{$input}', '{$counter}' ), array( $title, $description, $input, $this->counter%2 ), $this->layout[$layout] ); + } + + } + + + ?> \ No newline at end of file diff --git a/Rain/library/Form/lang/en.php b/system/library/Form/lang/en.php similarity index 100% rename from Rain/library/Form/lang/en.php rename to system/library/Form/lang/en.php diff --git a/Rain/library/Form/lang/es.php b/system/library/Form/lang/es.php similarity index 100% rename from Rain/library/Form/lang/es.php rename to system/library/Form/lang/es.php diff --git a/Rain/library/Form/lang/it.php b/system/library/Form/lang/it.php similarity index 100% rename from Rain/library/Form/lang/it.php rename to system/library/Form/lang/it.php diff --git a/Rain/library/Form/plugins/tiny_mce/jquery.tinymce.js b/system/library/Form/plugins/tiny_mce/jquery.tinymce.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/jquery.tinymce.js rename to system/library/Form/plugins/tiny_mce/jquery.tinymce.js diff --git a/Rain/library/Form/plugins/tiny_mce/langs/en.js b/system/library/Form/plugins/tiny_mce/langs/en.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/langs/en.js rename to system/library/Form/plugins/tiny_mce/langs/en.js diff --git a/Rain/library/Form/plugins/tiny_mce/license.txt b/system/library/Form/plugins/tiny_mce/license.txt similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/license.txt rename to system/library/Form/plugins/tiny_mce/license.txt diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/advhr/css/advhr.css b/system/library/Form/plugins/tiny_mce/plugins/advhr/css/advhr.css similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/advhr/css/advhr.css rename to system/library/Form/plugins/tiny_mce/plugins/advhr/css/advhr.css diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/advhr/editor_plugin.js b/system/library/Form/plugins/tiny_mce/plugins/advhr/editor_plugin.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/advhr/editor_plugin.js rename to system/library/Form/plugins/tiny_mce/plugins/advhr/editor_plugin.js diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/advhr/editor_plugin_src.js b/system/library/Form/plugins/tiny_mce/plugins/advhr/editor_plugin_src.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/advhr/editor_plugin_src.js rename to system/library/Form/plugins/tiny_mce/plugins/advhr/editor_plugin_src.js diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/advhr/js/rule.js b/system/library/Form/plugins/tiny_mce/plugins/advhr/js/rule.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/advhr/js/rule.js rename to system/library/Form/plugins/tiny_mce/plugins/advhr/js/rule.js diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/advhr/langs/en_dlg.js b/system/library/Form/plugins/tiny_mce/plugins/advhr/langs/en_dlg.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/advhr/langs/en_dlg.js rename to system/library/Form/plugins/tiny_mce/plugins/advhr/langs/en_dlg.js diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/advhr/rule.htm b/system/library/Form/plugins/tiny_mce/plugins/advhr/rule.htm similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/advhr/rule.htm rename to system/library/Form/plugins/tiny_mce/plugins/advhr/rule.htm diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/advimage/css/advimage.css b/system/library/Form/plugins/tiny_mce/plugins/advimage/css/advimage.css similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/advimage/css/advimage.css rename to system/library/Form/plugins/tiny_mce/plugins/advimage/css/advimage.css diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/advimage/editor_plugin.js b/system/library/Form/plugins/tiny_mce/plugins/advimage/editor_plugin.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/advimage/editor_plugin.js rename to system/library/Form/plugins/tiny_mce/plugins/advimage/editor_plugin.js diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/advimage/editor_plugin_src.js b/system/library/Form/plugins/tiny_mce/plugins/advimage/editor_plugin_src.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/advimage/editor_plugin_src.js rename to system/library/Form/plugins/tiny_mce/plugins/advimage/editor_plugin_src.js diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/advimage/image.htm b/system/library/Form/plugins/tiny_mce/plugins/advimage/image.htm similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/advimage/image.htm rename to system/library/Form/plugins/tiny_mce/plugins/advimage/image.htm diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/advimage/img/sample.gif b/system/library/Form/plugins/tiny_mce/plugins/advimage/img/sample.gif similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/advimage/img/sample.gif rename to system/library/Form/plugins/tiny_mce/plugins/advimage/img/sample.gif diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/advimage/js/image.js b/system/library/Form/plugins/tiny_mce/plugins/advimage/js/image.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/advimage/js/image.js rename to system/library/Form/plugins/tiny_mce/plugins/advimage/js/image.js diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/advimage/langs/en_dlg.js b/system/library/Form/plugins/tiny_mce/plugins/advimage/langs/en_dlg.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/advimage/langs/en_dlg.js rename to system/library/Form/plugins/tiny_mce/plugins/advimage/langs/en_dlg.js diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/advlink/css/advlink.css b/system/library/Form/plugins/tiny_mce/plugins/advlink/css/advlink.css similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/advlink/css/advlink.css rename to system/library/Form/plugins/tiny_mce/plugins/advlink/css/advlink.css diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/advlink/editor_plugin.js b/system/library/Form/plugins/tiny_mce/plugins/advlink/editor_plugin.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/advlink/editor_plugin.js rename to system/library/Form/plugins/tiny_mce/plugins/advlink/editor_plugin.js diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/advlink/editor_plugin_src.js b/system/library/Form/plugins/tiny_mce/plugins/advlink/editor_plugin_src.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/advlink/editor_plugin_src.js rename to system/library/Form/plugins/tiny_mce/plugins/advlink/editor_plugin_src.js diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/advlink/js/advlink.js b/system/library/Form/plugins/tiny_mce/plugins/advlink/js/advlink.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/advlink/js/advlink.js rename to system/library/Form/plugins/tiny_mce/plugins/advlink/js/advlink.js diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/advlink/langs/en_dlg.js b/system/library/Form/plugins/tiny_mce/plugins/advlink/langs/en_dlg.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/advlink/langs/en_dlg.js rename to system/library/Form/plugins/tiny_mce/plugins/advlink/langs/en_dlg.js diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/advlink/link.htm b/system/library/Form/plugins/tiny_mce/plugins/advlink/link.htm similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/advlink/link.htm rename to system/library/Form/plugins/tiny_mce/plugins/advlink/link.htm diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/advlist/editor_plugin.js b/system/library/Form/plugins/tiny_mce/plugins/advlist/editor_plugin.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/advlist/editor_plugin.js rename to system/library/Form/plugins/tiny_mce/plugins/advlist/editor_plugin.js diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/advlist/editor_plugin_src.js b/system/library/Form/plugins/tiny_mce/plugins/advlist/editor_plugin_src.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/advlist/editor_plugin_src.js rename to system/library/Form/plugins/tiny_mce/plugins/advlist/editor_plugin_src.js diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/autoresize/editor_plugin.js b/system/library/Form/plugins/tiny_mce/plugins/autoresize/editor_plugin.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/autoresize/editor_plugin.js rename to system/library/Form/plugins/tiny_mce/plugins/autoresize/editor_plugin.js diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/autoresize/editor_plugin_src.js b/system/library/Form/plugins/tiny_mce/plugins/autoresize/editor_plugin_src.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/autoresize/editor_plugin_src.js rename to system/library/Form/plugins/tiny_mce/plugins/autoresize/editor_plugin_src.js diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/autosave/editor_plugin.js b/system/library/Form/plugins/tiny_mce/plugins/autosave/editor_plugin.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/autosave/editor_plugin.js rename to system/library/Form/plugins/tiny_mce/plugins/autosave/editor_plugin.js diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/autosave/editor_plugin_src.js b/system/library/Form/plugins/tiny_mce/plugins/autosave/editor_plugin_src.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/autosave/editor_plugin_src.js rename to system/library/Form/plugins/tiny_mce/plugins/autosave/editor_plugin_src.js diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/autosave/langs/en.js b/system/library/Form/plugins/tiny_mce/plugins/autosave/langs/en.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/autosave/langs/en.js rename to system/library/Form/plugins/tiny_mce/plugins/autosave/langs/en.js diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/bbcode/editor_plugin.js b/system/library/Form/plugins/tiny_mce/plugins/bbcode/editor_plugin.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/bbcode/editor_plugin.js rename to system/library/Form/plugins/tiny_mce/plugins/bbcode/editor_plugin.js diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/bbcode/editor_plugin_src.js b/system/library/Form/plugins/tiny_mce/plugins/bbcode/editor_plugin_src.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/bbcode/editor_plugin_src.js rename to system/library/Form/plugins/tiny_mce/plugins/bbcode/editor_plugin_src.js diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/contextmenu/editor_plugin.js b/system/library/Form/plugins/tiny_mce/plugins/contextmenu/editor_plugin.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/contextmenu/editor_plugin.js rename to system/library/Form/plugins/tiny_mce/plugins/contextmenu/editor_plugin.js diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/contextmenu/editor_plugin_src.js b/system/library/Form/plugins/tiny_mce/plugins/contextmenu/editor_plugin_src.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/contextmenu/editor_plugin_src.js rename to system/library/Form/plugins/tiny_mce/plugins/contextmenu/editor_plugin_src.js diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/directionality/editor_plugin.js b/system/library/Form/plugins/tiny_mce/plugins/directionality/editor_plugin.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/directionality/editor_plugin.js rename to system/library/Form/plugins/tiny_mce/plugins/directionality/editor_plugin.js diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/directionality/editor_plugin_src.js b/system/library/Form/plugins/tiny_mce/plugins/directionality/editor_plugin_src.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/directionality/editor_plugin_src.js rename to system/library/Form/plugins/tiny_mce/plugins/directionality/editor_plugin_src.js diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/emotions/editor_plugin.js b/system/library/Form/plugins/tiny_mce/plugins/emotions/editor_plugin.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/emotions/editor_plugin.js rename to system/library/Form/plugins/tiny_mce/plugins/emotions/editor_plugin.js diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/emotions/editor_plugin_src.js b/system/library/Form/plugins/tiny_mce/plugins/emotions/editor_plugin_src.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/emotions/editor_plugin_src.js rename to system/library/Form/plugins/tiny_mce/plugins/emotions/editor_plugin_src.js diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/emotions/emotions.htm b/system/library/Form/plugins/tiny_mce/plugins/emotions/emotions.htm similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/emotions/emotions.htm rename to system/library/Form/plugins/tiny_mce/plugins/emotions/emotions.htm diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/emotions/img/smiley-cool.gif b/system/library/Form/plugins/tiny_mce/plugins/emotions/img/smiley-cool.gif similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/emotions/img/smiley-cool.gif rename to system/library/Form/plugins/tiny_mce/plugins/emotions/img/smiley-cool.gif diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/emotions/img/smiley-cry.gif b/system/library/Form/plugins/tiny_mce/plugins/emotions/img/smiley-cry.gif similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/emotions/img/smiley-cry.gif rename to system/library/Form/plugins/tiny_mce/plugins/emotions/img/smiley-cry.gif diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/emotions/img/smiley-embarassed.gif b/system/library/Form/plugins/tiny_mce/plugins/emotions/img/smiley-embarassed.gif similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/emotions/img/smiley-embarassed.gif rename to system/library/Form/plugins/tiny_mce/plugins/emotions/img/smiley-embarassed.gif diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/emotions/img/smiley-foot-in-mouth.gif b/system/library/Form/plugins/tiny_mce/plugins/emotions/img/smiley-foot-in-mouth.gif similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/emotions/img/smiley-foot-in-mouth.gif rename to system/library/Form/plugins/tiny_mce/plugins/emotions/img/smiley-foot-in-mouth.gif diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/emotions/img/smiley-frown.gif b/system/library/Form/plugins/tiny_mce/plugins/emotions/img/smiley-frown.gif similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/emotions/img/smiley-frown.gif rename to system/library/Form/plugins/tiny_mce/plugins/emotions/img/smiley-frown.gif diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/emotions/img/smiley-innocent.gif b/system/library/Form/plugins/tiny_mce/plugins/emotions/img/smiley-innocent.gif similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/emotions/img/smiley-innocent.gif rename to system/library/Form/plugins/tiny_mce/plugins/emotions/img/smiley-innocent.gif diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/emotions/img/smiley-kiss.gif b/system/library/Form/plugins/tiny_mce/plugins/emotions/img/smiley-kiss.gif similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/emotions/img/smiley-kiss.gif rename to system/library/Form/plugins/tiny_mce/plugins/emotions/img/smiley-kiss.gif diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/emotions/img/smiley-laughing.gif b/system/library/Form/plugins/tiny_mce/plugins/emotions/img/smiley-laughing.gif similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/emotions/img/smiley-laughing.gif rename to system/library/Form/plugins/tiny_mce/plugins/emotions/img/smiley-laughing.gif diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/emotions/img/smiley-money-mouth.gif b/system/library/Form/plugins/tiny_mce/plugins/emotions/img/smiley-money-mouth.gif similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/emotions/img/smiley-money-mouth.gif rename to system/library/Form/plugins/tiny_mce/plugins/emotions/img/smiley-money-mouth.gif diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/emotions/img/smiley-sealed.gif b/system/library/Form/plugins/tiny_mce/plugins/emotions/img/smiley-sealed.gif similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/emotions/img/smiley-sealed.gif rename to system/library/Form/plugins/tiny_mce/plugins/emotions/img/smiley-sealed.gif diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/emotions/img/smiley-smile.gif b/system/library/Form/plugins/tiny_mce/plugins/emotions/img/smiley-smile.gif similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/emotions/img/smiley-smile.gif rename to system/library/Form/plugins/tiny_mce/plugins/emotions/img/smiley-smile.gif diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/emotions/img/smiley-surprised.gif b/system/library/Form/plugins/tiny_mce/plugins/emotions/img/smiley-surprised.gif similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/emotions/img/smiley-surprised.gif rename to system/library/Form/plugins/tiny_mce/plugins/emotions/img/smiley-surprised.gif diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/emotions/img/smiley-tongue-out.gif b/system/library/Form/plugins/tiny_mce/plugins/emotions/img/smiley-tongue-out.gif similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/emotions/img/smiley-tongue-out.gif rename to system/library/Form/plugins/tiny_mce/plugins/emotions/img/smiley-tongue-out.gif diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/emotions/img/smiley-undecided.gif b/system/library/Form/plugins/tiny_mce/plugins/emotions/img/smiley-undecided.gif similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/emotions/img/smiley-undecided.gif rename to system/library/Form/plugins/tiny_mce/plugins/emotions/img/smiley-undecided.gif diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/emotions/img/smiley-wink.gif b/system/library/Form/plugins/tiny_mce/plugins/emotions/img/smiley-wink.gif similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/emotions/img/smiley-wink.gif rename to system/library/Form/plugins/tiny_mce/plugins/emotions/img/smiley-wink.gif diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/emotions/img/smiley-yell.gif b/system/library/Form/plugins/tiny_mce/plugins/emotions/img/smiley-yell.gif similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/emotions/img/smiley-yell.gif rename to system/library/Form/plugins/tiny_mce/plugins/emotions/img/smiley-yell.gif diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/emotions/js/emotions.js b/system/library/Form/plugins/tiny_mce/plugins/emotions/js/emotions.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/emotions/js/emotions.js rename to system/library/Form/plugins/tiny_mce/plugins/emotions/js/emotions.js diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/emotions/langs/en_dlg.js b/system/library/Form/plugins/tiny_mce/plugins/emotions/langs/en_dlg.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/emotions/langs/en_dlg.js rename to system/library/Form/plugins/tiny_mce/plugins/emotions/langs/en_dlg.js diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/example/dialog.htm b/system/library/Form/plugins/tiny_mce/plugins/example/dialog.htm similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/example/dialog.htm rename to system/library/Form/plugins/tiny_mce/plugins/example/dialog.htm diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/example/editor_plugin.js b/system/library/Form/plugins/tiny_mce/plugins/example/editor_plugin.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/example/editor_plugin.js rename to system/library/Form/plugins/tiny_mce/plugins/example/editor_plugin.js diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/example/editor_plugin_src.js b/system/library/Form/plugins/tiny_mce/plugins/example/editor_plugin_src.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/example/editor_plugin_src.js rename to system/library/Form/plugins/tiny_mce/plugins/example/editor_plugin_src.js diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/example/img/example.gif b/system/library/Form/plugins/tiny_mce/plugins/example/img/example.gif similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/example/img/example.gif rename to system/library/Form/plugins/tiny_mce/plugins/example/img/example.gif diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/example/js/dialog.js b/system/library/Form/plugins/tiny_mce/plugins/example/js/dialog.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/example/js/dialog.js rename to system/library/Form/plugins/tiny_mce/plugins/example/js/dialog.js diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/example/langs/en.js b/system/library/Form/plugins/tiny_mce/plugins/example/langs/en.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/example/langs/en.js rename to system/library/Form/plugins/tiny_mce/plugins/example/langs/en.js diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/example/langs/en_dlg.js b/system/library/Form/plugins/tiny_mce/plugins/example/langs/en_dlg.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/example/langs/en_dlg.js rename to system/library/Form/plugins/tiny_mce/plugins/example/langs/en_dlg.js diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/fullpage/css/fullpage.css b/system/library/Form/plugins/tiny_mce/plugins/fullpage/css/fullpage.css similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/fullpage/css/fullpage.css rename to system/library/Form/plugins/tiny_mce/plugins/fullpage/css/fullpage.css diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/fullpage/editor_plugin.js b/system/library/Form/plugins/tiny_mce/plugins/fullpage/editor_plugin.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/fullpage/editor_plugin.js rename to system/library/Form/plugins/tiny_mce/plugins/fullpage/editor_plugin.js diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/fullpage/editor_plugin_src.js b/system/library/Form/plugins/tiny_mce/plugins/fullpage/editor_plugin_src.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/fullpage/editor_plugin_src.js rename to system/library/Form/plugins/tiny_mce/plugins/fullpage/editor_plugin_src.js diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/fullpage/fullpage.htm b/system/library/Form/plugins/tiny_mce/plugins/fullpage/fullpage.htm similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/fullpage/fullpage.htm rename to system/library/Form/plugins/tiny_mce/plugins/fullpage/fullpage.htm diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/fullpage/js/fullpage.js b/system/library/Form/plugins/tiny_mce/plugins/fullpage/js/fullpage.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/fullpage/js/fullpage.js rename to system/library/Form/plugins/tiny_mce/plugins/fullpage/js/fullpage.js diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/fullpage/langs/en_dlg.js b/system/library/Form/plugins/tiny_mce/plugins/fullpage/langs/en_dlg.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/fullpage/langs/en_dlg.js rename to system/library/Form/plugins/tiny_mce/plugins/fullpage/langs/en_dlg.js diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/fullscreen/editor_plugin.js b/system/library/Form/plugins/tiny_mce/plugins/fullscreen/editor_plugin.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/fullscreen/editor_plugin.js rename to system/library/Form/plugins/tiny_mce/plugins/fullscreen/editor_plugin.js diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/fullscreen/editor_plugin_src.js b/system/library/Form/plugins/tiny_mce/plugins/fullscreen/editor_plugin_src.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/fullscreen/editor_plugin_src.js rename to system/library/Form/plugins/tiny_mce/plugins/fullscreen/editor_plugin_src.js diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/fullscreen/fullscreen.htm b/system/library/Form/plugins/tiny_mce/plugins/fullscreen/fullscreen.htm similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/fullscreen/fullscreen.htm rename to system/library/Form/plugins/tiny_mce/plugins/fullscreen/fullscreen.htm diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/iespell/editor_plugin.js b/system/library/Form/plugins/tiny_mce/plugins/iespell/editor_plugin.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/iespell/editor_plugin.js rename to system/library/Form/plugins/tiny_mce/plugins/iespell/editor_plugin.js diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/iespell/editor_plugin_src.js b/system/library/Form/plugins/tiny_mce/plugins/iespell/editor_plugin_src.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/iespell/editor_plugin_src.js rename to system/library/Form/plugins/tiny_mce/plugins/iespell/editor_plugin_src.js diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/inlinepopups/editor_plugin.js b/system/library/Form/plugins/tiny_mce/plugins/inlinepopups/editor_plugin.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/inlinepopups/editor_plugin.js rename to system/library/Form/plugins/tiny_mce/plugins/inlinepopups/editor_plugin.js diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/inlinepopups/editor_plugin_src.js b/system/library/Form/plugins/tiny_mce/plugins/inlinepopups/editor_plugin_src.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/inlinepopups/editor_plugin_src.js rename to system/library/Form/plugins/tiny_mce/plugins/inlinepopups/editor_plugin_src.js diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/alert.gif b/system/library/Form/plugins/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/alert.gif similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/alert.gif rename to system/library/Form/plugins/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/alert.gif diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/button.gif b/system/library/Form/plugins/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/button.gif similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/button.gif rename to system/library/Form/plugins/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/button.gif diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/buttons.gif b/system/library/Form/plugins/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/buttons.gif similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/buttons.gif rename to system/library/Form/plugins/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/buttons.gif diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/confirm.gif b/system/library/Form/plugins/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/confirm.gif similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/confirm.gif rename to system/library/Form/plugins/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/confirm.gif diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/corners.gif b/system/library/Form/plugins/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/corners.gif similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/corners.gif rename to system/library/Form/plugins/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/corners.gif diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/horizontal.gif b/system/library/Form/plugins/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/horizontal.gif similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/horizontal.gif rename to system/library/Form/plugins/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/horizontal.gif diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/vertical.gif b/system/library/Form/plugins/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/vertical.gif similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/vertical.gif rename to system/library/Form/plugins/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/vertical.gif diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/inlinepopups/skins/clearlooks2/window.css b/system/library/Form/plugins/tiny_mce/plugins/inlinepopups/skins/clearlooks2/window.css similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/inlinepopups/skins/clearlooks2/window.css rename to system/library/Form/plugins/tiny_mce/plugins/inlinepopups/skins/clearlooks2/window.css diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/inlinepopups/template.htm b/system/library/Form/plugins/tiny_mce/plugins/inlinepopups/template.htm similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/inlinepopups/template.htm rename to system/library/Form/plugins/tiny_mce/plugins/inlinepopups/template.htm diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/insertdatetime/editor_plugin.js b/system/library/Form/plugins/tiny_mce/plugins/insertdatetime/editor_plugin.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/insertdatetime/editor_plugin.js rename to system/library/Form/plugins/tiny_mce/plugins/insertdatetime/editor_plugin.js diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/insertdatetime/editor_plugin_src.js b/system/library/Form/plugins/tiny_mce/plugins/insertdatetime/editor_plugin_src.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/insertdatetime/editor_plugin_src.js rename to system/library/Form/plugins/tiny_mce/plugins/insertdatetime/editor_plugin_src.js diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/layer/editor_plugin.js b/system/library/Form/plugins/tiny_mce/plugins/layer/editor_plugin.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/layer/editor_plugin.js rename to system/library/Form/plugins/tiny_mce/plugins/layer/editor_plugin.js diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/layer/editor_plugin_src.js b/system/library/Form/plugins/tiny_mce/plugins/layer/editor_plugin_src.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/layer/editor_plugin_src.js rename to system/library/Form/plugins/tiny_mce/plugins/layer/editor_plugin_src.js diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/legacyoutput/editor_plugin.js b/system/library/Form/plugins/tiny_mce/plugins/legacyoutput/editor_plugin.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/legacyoutput/editor_plugin.js rename to system/library/Form/plugins/tiny_mce/plugins/legacyoutput/editor_plugin.js diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/legacyoutput/editor_plugin_src.js b/system/library/Form/plugins/tiny_mce/plugins/legacyoutput/editor_plugin_src.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/legacyoutput/editor_plugin_src.js rename to system/library/Form/plugins/tiny_mce/plugins/legacyoutput/editor_plugin_src.js diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/media/css/content.css b/system/library/Form/plugins/tiny_mce/plugins/media/css/content.css similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/media/css/content.css rename to system/library/Form/plugins/tiny_mce/plugins/media/css/content.css diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/media/css/media.css b/system/library/Form/plugins/tiny_mce/plugins/media/css/media.css similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/media/css/media.css rename to system/library/Form/plugins/tiny_mce/plugins/media/css/media.css diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/media/editor_plugin.js b/system/library/Form/plugins/tiny_mce/plugins/media/editor_plugin.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/media/editor_plugin.js rename to system/library/Form/plugins/tiny_mce/plugins/media/editor_plugin.js diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/media/editor_plugin_src.js b/system/library/Form/plugins/tiny_mce/plugins/media/editor_plugin_src.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/media/editor_plugin_src.js rename to system/library/Form/plugins/tiny_mce/plugins/media/editor_plugin_src.js diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/media/img/flash.gif b/system/library/Form/plugins/tiny_mce/plugins/media/img/flash.gif similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/media/img/flash.gif rename to system/library/Form/plugins/tiny_mce/plugins/media/img/flash.gif diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/media/img/flv_player.swf b/system/library/Form/plugins/tiny_mce/plugins/media/img/flv_player.swf similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/media/img/flv_player.swf rename to system/library/Form/plugins/tiny_mce/plugins/media/img/flv_player.swf diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/media/img/quicktime.gif b/system/library/Form/plugins/tiny_mce/plugins/media/img/quicktime.gif similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/media/img/quicktime.gif rename to system/library/Form/plugins/tiny_mce/plugins/media/img/quicktime.gif diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/media/img/realmedia.gif b/system/library/Form/plugins/tiny_mce/plugins/media/img/realmedia.gif similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/media/img/realmedia.gif rename to system/library/Form/plugins/tiny_mce/plugins/media/img/realmedia.gif diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/media/img/shockwave.gif b/system/library/Form/plugins/tiny_mce/plugins/media/img/shockwave.gif similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/media/img/shockwave.gif rename to system/library/Form/plugins/tiny_mce/plugins/media/img/shockwave.gif diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/media/img/trans.gif b/system/library/Form/plugins/tiny_mce/plugins/media/img/trans.gif similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/media/img/trans.gif rename to system/library/Form/plugins/tiny_mce/plugins/media/img/trans.gif diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/media/img/windowsmedia.gif b/system/library/Form/plugins/tiny_mce/plugins/media/img/windowsmedia.gif similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/media/img/windowsmedia.gif rename to system/library/Form/plugins/tiny_mce/plugins/media/img/windowsmedia.gif diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/media/js/embed.js b/system/library/Form/plugins/tiny_mce/plugins/media/js/embed.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/media/js/embed.js rename to system/library/Form/plugins/tiny_mce/plugins/media/js/embed.js diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/media/js/media.js b/system/library/Form/plugins/tiny_mce/plugins/media/js/media.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/media/js/media.js rename to system/library/Form/plugins/tiny_mce/plugins/media/js/media.js diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/media/langs/en_dlg.js b/system/library/Form/plugins/tiny_mce/plugins/media/langs/en_dlg.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/media/langs/en_dlg.js rename to system/library/Form/plugins/tiny_mce/plugins/media/langs/en_dlg.js diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/media/media.htm b/system/library/Form/plugins/tiny_mce/plugins/media/media.htm similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/media/media.htm rename to system/library/Form/plugins/tiny_mce/plugins/media/media.htm diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/nonbreaking/editor_plugin.js b/system/library/Form/plugins/tiny_mce/plugins/nonbreaking/editor_plugin.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/nonbreaking/editor_plugin.js rename to system/library/Form/plugins/tiny_mce/plugins/nonbreaking/editor_plugin.js diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/nonbreaking/editor_plugin_src.js b/system/library/Form/plugins/tiny_mce/plugins/nonbreaking/editor_plugin_src.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/nonbreaking/editor_plugin_src.js rename to system/library/Form/plugins/tiny_mce/plugins/nonbreaking/editor_plugin_src.js diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/noneditable/editor_plugin.js b/system/library/Form/plugins/tiny_mce/plugins/noneditable/editor_plugin.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/noneditable/editor_plugin.js rename to system/library/Form/plugins/tiny_mce/plugins/noneditable/editor_plugin.js diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/noneditable/editor_plugin_src.js b/system/library/Form/plugins/tiny_mce/plugins/noneditable/editor_plugin_src.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/noneditable/editor_plugin_src.js rename to system/library/Form/plugins/tiny_mce/plugins/noneditable/editor_plugin_src.js diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/pagebreak/css/content.css b/system/library/Form/plugins/tiny_mce/plugins/pagebreak/css/content.css similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/pagebreak/css/content.css rename to system/library/Form/plugins/tiny_mce/plugins/pagebreak/css/content.css diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/pagebreak/editor_plugin.js b/system/library/Form/plugins/tiny_mce/plugins/pagebreak/editor_plugin.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/pagebreak/editor_plugin.js rename to system/library/Form/plugins/tiny_mce/plugins/pagebreak/editor_plugin.js diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/pagebreak/editor_plugin_src.js b/system/library/Form/plugins/tiny_mce/plugins/pagebreak/editor_plugin_src.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/pagebreak/editor_plugin_src.js rename to system/library/Form/plugins/tiny_mce/plugins/pagebreak/editor_plugin_src.js diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/pagebreak/img/pagebreak.gif b/system/library/Form/plugins/tiny_mce/plugins/pagebreak/img/pagebreak.gif similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/pagebreak/img/pagebreak.gif rename to system/library/Form/plugins/tiny_mce/plugins/pagebreak/img/pagebreak.gif diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/pagebreak/img/trans.gif b/system/library/Form/plugins/tiny_mce/plugins/pagebreak/img/trans.gif similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/pagebreak/img/trans.gif rename to system/library/Form/plugins/tiny_mce/plugins/pagebreak/img/trans.gif diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/paste/editor_plugin.js b/system/library/Form/plugins/tiny_mce/plugins/paste/editor_plugin.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/paste/editor_plugin.js rename to system/library/Form/plugins/tiny_mce/plugins/paste/editor_plugin.js diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/paste/editor_plugin_src.js b/system/library/Form/plugins/tiny_mce/plugins/paste/editor_plugin_src.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/paste/editor_plugin_src.js rename to system/library/Form/plugins/tiny_mce/plugins/paste/editor_plugin_src.js diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/paste/js/pastetext.js b/system/library/Form/plugins/tiny_mce/plugins/paste/js/pastetext.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/paste/js/pastetext.js rename to system/library/Form/plugins/tiny_mce/plugins/paste/js/pastetext.js diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/paste/js/pasteword.js b/system/library/Form/plugins/tiny_mce/plugins/paste/js/pasteword.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/paste/js/pasteword.js rename to system/library/Form/plugins/tiny_mce/plugins/paste/js/pasteword.js diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/paste/langs/en_dlg.js b/system/library/Form/plugins/tiny_mce/plugins/paste/langs/en_dlg.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/paste/langs/en_dlg.js rename to system/library/Form/plugins/tiny_mce/plugins/paste/langs/en_dlg.js diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/paste/pastetext.htm b/system/library/Form/plugins/tiny_mce/plugins/paste/pastetext.htm similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/paste/pastetext.htm rename to system/library/Form/plugins/tiny_mce/plugins/paste/pastetext.htm diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/paste/pasteword.htm b/system/library/Form/plugins/tiny_mce/plugins/paste/pasteword.htm similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/paste/pasteword.htm rename to system/library/Form/plugins/tiny_mce/plugins/paste/pasteword.htm diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/preview/editor_plugin.js b/system/library/Form/plugins/tiny_mce/plugins/preview/editor_plugin.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/preview/editor_plugin.js rename to system/library/Form/plugins/tiny_mce/plugins/preview/editor_plugin.js diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/preview/editor_plugin_src.js b/system/library/Form/plugins/tiny_mce/plugins/preview/editor_plugin_src.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/preview/editor_plugin_src.js rename to system/library/Form/plugins/tiny_mce/plugins/preview/editor_plugin_src.js diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/preview/example.html b/system/library/Form/plugins/tiny_mce/plugins/preview/example.html similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/preview/example.html rename to system/library/Form/plugins/tiny_mce/plugins/preview/example.html diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/preview/jscripts/embed.js b/system/library/Form/plugins/tiny_mce/plugins/preview/jscripts/embed.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/preview/jscripts/embed.js rename to system/library/Form/plugins/tiny_mce/plugins/preview/jscripts/embed.js diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/preview/preview.html b/system/library/Form/plugins/tiny_mce/plugins/preview/preview.html similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/preview/preview.html rename to system/library/Form/plugins/tiny_mce/plugins/preview/preview.html diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/print/editor_plugin.js b/system/library/Form/plugins/tiny_mce/plugins/print/editor_plugin.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/print/editor_plugin.js rename to system/library/Form/plugins/tiny_mce/plugins/print/editor_plugin.js diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/print/editor_plugin_src.js b/system/library/Form/plugins/tiny_mce/plugins/print/editor_plugin_src.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/print/editor_plugin_src.js rename to system/library/Form/plugins/tiny_mce/plugins/print/editor_plugin_src.js diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/save/editor_plugin.js b/system/library/Form/plugins/tiny_mce/plugins/save/editor_plugin.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/save/editor_plugin.js rename to system/library/Form/plugins/tiny_mce/plugins/save/editor_plugin.js diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/save/editor_plugin_src.js b/system/library/Form/plugins/tiny_mce/plugins/save/editor_plugin_src.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/save/editor_plugin_src.js rename to system/library/Form/plugins/tiny_mce/plugins/save/editor_plugin_src.js diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/searchreplace/css/searchreplace.css b/system/library/Form/plugins/tiny_mce/plugins/searchreplace/css/searchreplace.css similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/searchreplace/css/searchreplace.css rename to system/library/Form/plugins/tiny_mce/plugins/searchreplace/css/searchreplace.css diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/searchreplace/editor_plugin.js b/system/library/Form/plugins/tiny_mce/plugins/searchreplace/editor_plugin.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/searchreplace/editor_plugin.js rename to system/library/Form/plugins/tiny_mce/plugins/searchreplace/editor_plugin.js diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/searchreplace/editor_plugin_src.js b/system/library/Form/plugins/tiny_mce/plugins/searchreplace/editor_plugin_src.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/searchreplace/editor_plugin_src.js rename to system/library/Form/plugins/tiny_mce/plugins/searchreplace/editor_plugin_src.js diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/searchreplace/js/searchreplace.js b/system/library/Form/plugins/tiny_mce/plugins/searchreplace/js/searchreplace.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/searchreplace/js/searchreplace.js rename to system/library/Form/plugins/tiny_mce/plugins/searchreplace/js/searchreplace.js diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/searchreplace/langs/en_dlg.js b/system/library/Form/plugins/tiny_mce/plugins/searchreplace/langs/en_dlg.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/searchreplace/langs/en_dlg.js rename to system/library/Form/plugins/tiny_mce/plugins/searchreplace/langs/en_dlg.js diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/searchreplace/searchreplace.htm b/system/library/Form/plugins/tiny_mce/plugins/searchreplace/searchreplace.htm similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/searchreplace/searchreplace.htm rename to system/library/Form/plugins/tiny_mce/plugins/searchreplace/searchreplace.htm diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/spellchecker/css/content.css b/system/library/Form/plugins/tiny_mce/plugins/spellchecker/css/content.css similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/spellchecker/css/content.css rename to system/library/Form/plugins/tiny_mce/plugins/spellchecker/css/content.css diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/spellchecker/editor_plugin.js b/system/library/Form/plugins/tiny_mce/plugins/spellchecker/editor_plugin.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/spellchecker/editor_plugin.js rename to system/library/Form/plugins/tiny_mce/plugins/spellchecker/editor_plugin.js diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/spellchecker/editor_plugin_src.js b/system/library/Form/plugins/tiny_mce/plugins/spellchecker/editor_plugin_src.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/spellchecker/editor_plugin_src.js rename to system/library/Form/plugins/tiny_mce/plugins/spellchecker/editor_plugin_src.js diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/spellchecker/img/wline.gif b/system/library/Form/plugins/tiny_mce/plugins/spellchecker/img/wline.gif similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/spellchecker/img/wline.gif rename to system/library/Form/plugins/tiny_mce/plugins/spellchecker/img/wline.gif diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/style/css/props.css b/system/library/Form/plugins/tiny_mce/plugins/style/css/props.css similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/style/css/props.css rename to system/library/Form/plugins/tiny_mce/plugins/style/css/props.css diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/style/editor_plugin.js b/system/library/Form/plugins/tiny_mce/plugins/style/editor_plugin.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/style/editor_plugin.js rename to system/library/Form/plugins/tiny_mce/plugins/style/editor_plugin.js diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/style/editor_plugin_src.js b/system/library/Form/plugins/tiny_mce/plugins/style/editor_plugin_src.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/style/editor_plugin_src.js rename to system/library/Form/plugins/tiny_mce/plugins/style/editor_plugin_src.js diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/style/js/props.js b/system/library/Form/plugins/tiny_mce/plugins/style/js/props.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/style/js/props.js rename to system/library/Form/plugins/tiny_mce/plugins/style/js/props.js diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/style/langs/en_dlg.js b/system/library/Form/plugins/tiny_mce/plugins/style/langs/en_dlg.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/style/langs/en_dlg.js rename to system/library/Form/plugins/tiny_mce/plugins/style/langs/en_dlg.js diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/style/props.htm b/system/library/Form/plugins/tiny_mce/plugins/style/props.htm similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/style/props.htm rename to system/library/Form/plugins/tiny_mce/plugins/style/props.htm diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/tabfocus/editor_plugin.js b/system/library/Form/plugins/tiny_mce/plugins/tabfocus/editor_plugin.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/tabfocus/editor_plugin.js rename to system/library/Form/plugins/tiny_mce/plugins/tabfocus/editor_plugin.js diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/tabfocus/editor_plugin_src.js b/system/library/Form/plugins/tiny_mce/plugins/tabfocus/editor_plugin_src.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/tabfocus/editor_plugin_src.js rename to system/library/Form/plugins/tiny_mce/plugins/tabfocus/editor_plugin_src.js diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/table/cell.htm b/system/library/Form/plugins/tiny_mce/plugins/table/cell.htm similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/table/cell.htm rename to system/library/Form/plugins/tiny_mce/plugins/table/cell.htm diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/table/css/cell.css b/system/library/Form/plugins/tiny_mce/plugins/table/css/cell.css similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/table/css/cell.css rename to system/library/Form/plugins/tiny_mce/plugins/table/css/cell.css diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/table/css/row.css b/system/library/Form/plugins/tiny_mce/plugins/table/css/row.css similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/table/css/row.css rename to system/library/Form/plugins/tiny_mce/plugins/table/css/row.css diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/table/css/table.css b/system/library/Form/plugins/tiny_mce/plugins/table/css/table.css similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/table/css/table.css rename to system/library/Form/plugins/tiny_mce/plugins/table/css/table.css diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/table/editor_plugin.js b/system/library/Form/plugins/tiny_mce/plugins/table/editor_plugin.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/table/editor_plugin.js rename to system/library/Form/plugins/tiny_mce/plugins/table/editor_plugin.js diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/table/editor_plugin_src.js b/system/library/Form/plugins/tiny_mce/plugins/table/editor_plugin_src.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/table/editor_plugin_src.js rename to system/library/Form/plugins/tiny_mce/plugins/table/editor_plugin_src.js diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/table/js/cell.js b/system/library/Form/plugins/tiny_mce/plugins/table/js/cell.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/table/js/cell.js rename to system/library/Form/plugins/tiny_mce/plugins/table/js/cell.js diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/table/js/merge_cells.js b/system/library/Form/plugins/tiny_mce/plugins/table/js/merge_cells.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/table/js/merge_cells.js rename to system/library/Form/plugins/tiny_mce/plugins/table/js/merge_cells.js diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/table/js/row.js b/system/library/Form/plugins/tiny_mce/plugins/table/js/row.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/table/js/row.js rename to system/library/Form/plugins/tiny_mce/plugins/table/js/row.js diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/table/js/table.js b/system/library/Form/plugins/tiny_mce/plugins/table/js/table.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/table/js/table.js rename to system/library/Form/plugins/tiny_mce/plugins/table/js/table.js diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/table/langs/en_dlg.js b/system/library/Form/plugins/tiny_mce/plugins/table/langs/en_dlg.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/table/langs/en_dlg.js rename to system/library/Form/plugins/tiny_mce/plugins/table/langs/en_dlg.js diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/table/merge_cells.htm b/system/library/Form/plugins/tiny_mce/plugins/table/merge_cells.htm similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/table/merge_cells.htm rename to system/library/Form/plugins/tiny_mce/plugins/table/merge_cells.htm diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/table/row.htm b/system/library/Form/plugins/tiny_mce/plugins/table/row.htm similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/table/row.htm rename to system/library/Form/plugins/tiny_mce/plugins/table/row.htm diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/table/table.htm b/system/library/Form/plugins/tiny_mce/plugins/table/table.htm similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/table/table.htm rename to system/library/Form/plugins/tiny_mce/plugins/table/table.htm diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/template/blank.htm b/system/library/Form/plugins/tiny_mce/plugins/template/blank.htm similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/template/blank.htm rename to system/library/Form/plugins/tiny_mce/plugins/template/blank.htm diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/template/css/template.css b/system/library/Form/plugins/tiny_mce/plugins/template/css/template.css similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/template/css/template.css rename to system/library/Form/plugins/tiny_mce/plugins/template/css/template.css diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/template/editor_plugin.js b/system/library/Form/plugins/tiny_mce/plugins/template/editor_plugin.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/template/editor_plugin.js rename to system/library/Form/plugins/tiny_mce/plugins/template/editor_plugin.js diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/template/editor_plugin_src.js b/system/library/Form/plugins/tiny_mce/plugins/template/editor_plugin_src.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/template/editor_plugin_src.js rename to system/library/Form/plugins/tiny_mce/plugins/template/editor_plugin_src.js diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/template/js/template.js b/system/library/Form/plugins/tiny_mce/plugins/template/js/template.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/template/js/template.js rename to system/library/Form/plugins/tiny_mce/plugins/template/js/template.js diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/template/langs/en_dlg.js b/system/library/Form/plugins/tiny_mce/plugins/template/langs/en_dlg.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/template/langs/en_dlg.js rename to system/library/Form/plugins/tiny_mce/plugins/template/langs/en_dlg.js diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/template/template.htm b/system/library/Form/plugins/tiny_mce/plugins/template/template.htm similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/template/template.htm rename to system/library/Form/plugins/tiny_mce/plugins/template/template.htm diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/visualchars/editor_plugin.js b/system/library/Form/plugins/tiny_mce/plugins/visualchars/editor_plugin.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/visualchars/editor_plugin.js rename to system/library/Form/plugins/tiny_mce/plugins/visualchars/editor_plugin.js diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/visualchars/editor_plugin_src.js b/system/library/Form/plugins/tiny_mce/plugins/visualchars/editor_plugin_src.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/visualchars/editor_plugin_src.js rename to system/library/Form/plugins/tiny_mce/plugins/visualchars/editor_plugin_src.js diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/wordcount/editor_plugin.js b/system/library/Form/plugins/tiny_mce/plugins/wordcount/editor_plugin.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/wordcount/editor_plugin.js rename to system/library/Form/plugins/tiny_mce/plugins/wordcount/editor_plugin.js diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/wordcount/editor_plugin_src.js b/system/library/Form/plugins/tiny_mce/plugins/wordcount/editor_plugin_src.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/wordcount/editor_plugin_src.js rename to system/library/Form/plugins/tiny_mce/plugins/wordcount/editor_plugin_src.js diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/xhtmlxtras/abbr.htm b/system/library/Form/plugins/tiny_mce/plugins/xhtmlxtras/abbr.htm similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/xhtmlxtras/abbr.htm rename to system/library/Form/plugins/tiny_mce/plugins/xhtmlxtras/abbr.htm diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/xhtmlxtras/acronym.htm b/system/library/Form/plugins/tiny_mce/plugins/xhtmlxtras/acronym.htm similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/xhtmlxtras/acronym.htm rename to system/library/Form/plugins/tiny_mce/plugins/xhtmlxtras/acronym.htm diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/xhtmlxtras/attributes.htm b/system/library/Form/plugins/tiny_mce/plugins/xhtmlxtras/attributes.htm similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/xhtmlxtras/attributes.htm rename to system/library/Form/plugins/tiny_mce/plugins/xhtmlxtras/attributes.htm diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/xhtmlxtras/cite.htm b/system/library/Form/plugins/tiny_mce/plugins/xhtmlxtras/cite.htm similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/xhtmlxtras/cite.htm rename to system/library/Form/plugins/tiny_mce/plugins/xhtmlxtras/cite.htm diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/xhtmlxtras/css/attributes.css b/system/library/Form/plugins/tiny_mce/plugins/xhtmlxtras/css/attributes.css similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/xhtmlxtras/css/attributes.css rename to system/library/Form/plugins/tiny_mce/plugins/xhtmlxtras/css/attributes.css diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/xhtmlxtras/css/popup.css b/system/library/Form/plugins/tiny_mce/plugins/xhtmlxtras/css/popup.css similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/xhtmlxtras/css/popup.css rename to system/library/Form/plugins/tiny_mce/plugins/xhtmlxtras/css/popup.css diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/xhtmlxtras/del.htm b/system/library/Form/plugins/tiny_mce/plugins/xhtmlxtras/del.htm similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/xhtmlxtras/del.htm rename to system/library/Form/plugins/tiny_mce/plugins/xhtmlxtras/del.htm diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/xhtmlxtras/editor_plugin.js b/system/library/Form/plugins/tiny_mce/plugins/xhtmlxtras/editor_plugin.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/xhtmlxtras/editor_plugin.js rename to system/library/Form/plugins/tiny_mce/plugins/xhtmlxtras/editor_plugin.js diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/xhtmlxtras/editor_plugin_src.js b/system/library/Form/plugins/tiny_mce/plugins/xhtmlxtras/editor_plugin_src.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/xhtmlxtras/editor_plugin_src.js rename to system/library/Form/plugins/tiny_mce/plugins/xhtmlxtras/editor_plugin_src.js diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/xhtmlxtras/ins.htm b/system/library/Form/plugins/tiny_mce/plugins/xhtmlxtras/ins.htm similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/xhtmlxtras/ins.htm rename to system/library/Form/plugins/tiny_mce/plugins/xhtmlxtras/ins.htm diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/xhtmlxtras/js/abbr.js b/system/library/Form/plugins/tiny_mce/plugins/xhtmlxtras/js/abbr.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/xhtmlxtras/js/abbr.js rename to system/library/Form/plugins/tiny_mce/plugins/xhtmlxtras/js/abbr.js diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/xhtmlxtras/js/acronym.js b/system/library/Form/plugins/tiny_mce/plugins/xhtmlxtras/js/acronym.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/xhtmlxtras/js/acronym.js rename to system/library/Form/plugins/tiny_mce/plugins/xhtmlxtras/js/acronym.js diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/xhtmlxtras/js/attributes.js b/system/library/Form/plugins/tiny_mce/plugins/xhtmlxtras/js/attributes.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/xhtmlxtras/js/attributes.js rename to system/library/Form/plugins/tiny_mce/plugins/xhtmlxtras/js/attributes.js diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/xhtmlxtras/js/cite.js b/system/library/Form/plugins/tiny_mce/plugins/xhtmlxtras/js/cite.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/xhtmlxtras/js/cite.js rename to system/library/Form/plugins/tiny_mce/plugins/xhtmlxtras/js/cite.js diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/xhtmlxtras/js/del.js b/system/library/Form/plugins/tiny_mce/plugins/xhtmlxtras/js/del.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/xhtmlxtras/js/del.js rename to system/library/Form/plugins/tiny_mce/plugins/xhtmlxtras/js/del.js diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/xhtmlxtras/js/element_common.js b/system/library/Form/plugins/tiny_mce/plugins/xhtmlxtras/js/element_common.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/xhtmlxtras/js/element_common.js rename to system/library/Form/plugins/tiny_mce/plugins/xhtmlxtras/js/element_common.js diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/xhtmlxtras/js/ins.js b/system/library/Form/plugins/tiny_mce/plugins/xhtmlxtras/js/ins.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/xhtmlxtras/js/ins.js rename to system/library/Form/plugins/tiny_mce/plugins/xhtmlxtras/js/ins.js diff --git a/Rain/library/Form/plugins/tiny_mce/plugins/xhtmlxtras/langs/en_dlg.js b/system/library/Form/plugins/tiny_mce/plugins/xhtmlxtras/langs/en_dlg.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/plugins/xhtmlxtras/langs/en_dlg.js rename to system/library/Form/plugins/tiny_mce/plugins/xhtmlxtras/langs/en_dlg.js diff --git a/Rain/library/Form/plugins/tiny_mce/themes/advanced/about.htm b/system/library/Form/plugins/tiny_mce/themes/advanced/about.htm similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/themes/advanced/about.htm rename to system/library/Form/plugins/tiny_mce/themes/advanced/about.htm diff --git a/Rain/library/Form/plugins/tiny_mce/themes/advanced/anchor.htm b/system/library/Form/plugins/tiny_mce/themes/advanced/anchor.htm similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/themes/advanced/anchor.htm rename to system/library/Form/plugins/tiny_mce/themes/advanced/anchor.htm diff --git a/Rain/library/Form/plugins/tiny_mce/themes/advanced/charmap.htm b/system/library/Form/plugins/tiny_mce/themes/advanced/charmap.htm similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/themes/advanced/charmap.htm rename to system/library/Form/plugins/tiny_mce/themes/advanced/charmap.htm diff --git a/Rain/library/Form/plugins/tiny_mce/themes/advanced/color_picker.htm b/system/library/Form/plugins/tiny_mce/themes/advanced/color_picker.htm similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/themes/advanced/color_picker.htm rename to system/library/Form/plugins/tiny_mce/themes/advanced/color_picker.htm diff --git a/Rain/library/Form/plugins/tiny_mce/themes/advanced/editor_template.js b/system/library/Form/plugins/tiny_mce/themes/advanced/editor_template.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/themes/advanced/editor_template.js rename to system/library/Form/plugins/tiny_mce/themes/advanced/editor_template.js diff --git a/Rain/library/Form/plugins/tiny_mce/themes/advanced/editor_template_src.js b/system/library/Form/plugins/tiny_mce/themes/advanced/editor_template_src.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/themes/advanced/editor_template_src.js rename to system/library/Form/plugins/tiny_mce/themes/advanced/editor_template_src.js diff --git a/Rain/library/Form/plugins/tiny_mce/themes/advanced/image.htm b/system/library/Form/plugins/tiny_mce/themes/advanced/image.htm similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/themes/advanced/image.htm rename to system/library/Form/plugins/tiny_mce/themes/advanced/image.htm diff --git a/Rain/library/Form/plugins/tiny_mce/themes/advanced/img/colorpicker.jpg b/system/library/Form/plugins/tiny_mce/themes/advanced/img/colorpicker.jpg similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/themes/advanced/img/colorpicker.jpg rename to system/library/Form/plugins/tiny_mce/themes/advanced/img/colorpicker.jpg diff --git a/Rain/library/Form/plugins/tiny_mce/themes/advanced/img/icons.gif b/system/library/Form/plugins/tiny_mce/themes/advanced/img/icons.gif similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/themes/advanced/img/icons.gif rename to system/library/Form/plugins/tiny_mce/themes/advanced/img/icons.gif diff --git a/Rain/library/Form/plugins/tiny_mce/themes/advanced/js/about.js b/system/library/Form/plugins/tiny_mce/themes/advanced/js/about.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/themes/advanced/js/about.js rename to system/library/Form/plugins/tiny_mce/themes/advanced/js/about.js diff --git a/Rain/library/Form/plugins/tiny_mce/themes/advanced/js/anchor.js b/system/library/Form/plugins/tiny_mce/themes/advanced/js/anchor.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/themes/advanced/js/anchor.js rename to system/library/Form/plugins/tiny_mce/themes/advanced/js/anchor.js diff --git a/Rain/library/Form/plugins/tiny_mce/themes/advanced/js/charmap.js b/system/library/Form/plugins/tiny_mce/themes/advanced/js/charmap.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/themes/advanced/js/charmap.js rename to system/library/Form/plugins/tiny_mce/themes/advanced/js/charmap.js diff --git a/Rain/library/Form/plugins/tiny_mce/themes/advanced/js/color_picker.js b/system/library/Form/plugins/tiny_mce/themes/advanced/js/color_picker.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/themes/advanced/js/color_picker.js rename to system/library/Form/plugins/tiny_mce/themes/advanced/js/color_picker.js diff --git a/Rain/library/Form/plugins/tiny_mce/themes/advanced/js/image.js b/system/library/Form/plugins/tiny_mce/themes/advanced/js/image.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/themes/advanced/js/image.js rename to system/library/Form/plugins/tiny_mce/themes/advanced/js/image.js diff --git a/Rain/library/Form/plugins/tiny_mce/themes/advanced/js/link.js b/system/library/Form/plugins/tiny_mce/themes/advanced/js/link.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/themes/advanced/js/link.js rename to system/library/Form/plugins/tiny_mce/themes/advanced/js/link.js diff --git a/Rain/library/Form/plugins/tiny_mce/themes/advanced/js/source_editor.js b/system/library/Form/plugins/tiny_mce/themes/advanced/js/source_editor.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/themes/advanced/js/source_editor.js rename to system/library/Form/plugins/tiny_mce/themes/advanced/js/source_editor.js diff --git a/Rain/library/Form/plugins/tiny_mce/themes/advanced/langs/en.js b/system/library/Form/plugins/tiny_mce/themes/advanced/langs/en.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/themes/advanced/langs/en.js rename to system/library/Form/plugins/tiny_mce/themes/advanced/langs/en.js diff --git a/Rain/library/Form/plugins/tiny_mce/themes/advanced/langs/en_dlg.js b/system/library/Form/plugins/tiny_mce/themes/advanced/langs/en_dlg.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/themes/advanced/langs/en_dlg.js rename to system/library/Form/plugins/tiny_mce/themes/advanced/langs/en_dlg.js diff --git a/Rain/library/Form/plugins/tiny_mce/themes/advanced/link.htm b/system/library/Form/plugins/tiny_mce/themes/advanced/link.htm similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/themes/advanced/link.htm rename to system/library/Form/plugins/tiny_mce/themes/advanced/link.htm diff --git a/Rain/library/Form/plugins/tiny_mce/themes/advanced/skins/default/content.css b/system/library/Form/plugins/tiny_mce/themes/advanced/skins/default/content.css similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/themes/advanced/skins/default/content.css rename to system/library/Form/plugins/tiny_mce/themes/advanced/skins/default/content.css diff --git a/Rain/library/Form/plugins/tiny_mce/themes/advanced/skins/default/dialog.css b/system/library/Form/plugins/tiny_mce/themes/advanced/skins/default/dialog.css similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/themes/advanced/skins/default/dialog.css rename to system/library/Form/plugins/tiny_mce/themes/advanced/skins/default/dialog.css diff --git a/Rain/library/Form/plugins/tiny_mce/themes/advanced/skins/default/img/buttons.png b/system/library/Form/plugins/tiny_mce/themes/advanced/skins/default/img/buttons.png similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/themes/advanced/skins/default/img/buttons.png rename to system/library/Form/plugins/tiny_mce/themes/advanced/skins/default/img/buttons.png diff --git a/Rain/library/Form/plugins/tiny_mce/themes/advanced/skins/default/img/items.gif b/system/library/Form/plugins/tiny_mce/themes/advanced/skins/default/img/items.gif similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/themes/advanced/skins/default/img/items.gif rename to system/library/Form/plugins/tiny_mce/themes/advanced/skins/default/img/items.gif diff --git a/Rain/library/Form/plugins/tiny_mce/themes/advanced/skins/default/img/menu_arrow.gif b/system/library/Form/plugins/tiny_mce/themes/advanced/skins/default/img/menu_arrow.gif similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/themes/advanced/skins/default/img/menu_arrow.gif rename to system/library/Form/plugins/tiny_mce/themes/advanced/skins/default/img/menu_arrow.gif diff --git a/Rain/library/Form/plugins/tiny_mce/themes/advanced/skins/default/img/menu_check.gif b/system/library/Form/plugins/tiny_mce/themes/advanced/skins/default/img/menu_check.gif similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/themes/advanced/skins/default/img/menu_check.gif rename to system/library/Form/plugins/tiny_mce/themes/advanced/skins/default/img/menu_check.gif diff --git a/Rain/library/Form/plugins/tiny_mce/themes/advanced/skins/default/img/progress.gif b/system/library/Form/plugins/tiny_mce/themes/advanced/skins/default/img/progress.gif similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/themes/advanced/skins/default/img/progress.gif rename to system/library/Form/plugins/tiny_mce/themes/advanced/skins/default/img/progress.gif diff --git a/Rain/library/Form/plugins/tiny_mce/themes/advanced/skins/default/img/tabs.gif b/system/library/Form/plugins/tiny_mce/themes/advanced/skins/default/img/tabs.gif similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/themes/advanced/skins/default/img/tabs.gif rename to system/library/Form/plugins/tiny_mce/themes/advanced/skins/default/img/tabs.gif diff --git a/Rain/library/Form/plugins/tiny_mce/themes/advanced/skins/default/ui.css b/system/library/Form/plugins/tiny_mce/themes/advanced/skins/default/ui.css similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/themes/advanced/skins/default/ui.css rename to system/library/Form/plugins/tiny_mce/themes/advanced/skins/default/ui.css diff --git a/Rain/library/Form/plugins/tiny_mce/themes/advanced/skins/o2k7/content.css b/system/library/Form/plugins/tiny_mce/themes/advanced/skins/o2k7/content.css similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/themes/advanced/skins/o2k7/content.css rename to system/library/Form/plugins/tiny_mce/themes/advanced/skins/o2k7/content.css diff --git a/Rain/library/Form/plugins/tiny_mce/themes/advanced/skins/o2k7/dialog.css b/system/library/Form/plugins/tiny_mce/themes/advanced/skins/o2k7/dialog.css similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/themes/advanced/skins/o2k7/dialog.css rename to system/library/Form/plugins/tiny_mce/themes/advanced/skins/o2k7/dialog.css diff --git a/Rain/library/Form/plugins/tiny_mce/themes/advanced/skins/o2k7/img/button_bg.png b/system/library/Form/plugins/tiny_mce/themes/advanced/skins/o2k7/img/button_bg.png similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/themes/advanced/skins/o2k7/img/button_bg.png rename to system/library/Form/plugins/tiny_mce/themes/advanced/skins/o2k7/img/button_bg.png diff --git a/Rain/library/Form/plugins/tiny_mce/themes/advanced/skins/o2k7/img/button_bg_black.png b/system/library/Form/plugins/tiny_mce/themes/advanced/skins/o2k7/img/button_bg_black.png similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/themes/advanced/skins/o2k7/img/button_bg_black.png rename to system/library/Form/plugins/tiny_mce/themes/advanced/skins/o2k7/img/button_bg_black.png diff --git a/Rain/library/Form/plugins/tiny_mce/themes/advanced/skins/o2k7/img/button_bg_silver.png b/system/library/Form/plugins/tiny_mce/themes/advanced/skins/o2k7/img/button_bg_silver.png similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/themes/advanced/skins/o2k7/img/button_bg_silver.png rename to system/library/Form/plugins/tiny_mce/themes/advanced/skins/o2k7/img/button_bg_silver.png diff --git a/Rain/library/Form/plugins/tiny_mce/themes/advanced/skins/o2k7/ui.css b/system/library/Form/plugins/tiny_mce/themes/advanced/skins/o2k7/ui.css similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/themes/advanced/skins/o2k7/ui.css rename to system/library/Form/plugins/tiny_mce/themes/advanced/skins/o2k7/ui.css diff --git a/Rain/library/Form/plugins/tiny_mce/themes/advanced/skins/o2k7/ui_black.css b/system/library/Form/plugins/tiny_mce/themes/advanced/skins/o2k7/ui_black.css similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/themes/advanced/skins/o2k7/ui_black.css rename to system/library/Form/plugins/tiny_mce/themes/advanced/skins/o2k7/ui_black.css diff --git a/Rain/library/Form/plugins/tiny_mce/themes/advanced/skins/o2k7/ui_silver.css b/system/library/Form/plugins/tiny_mce/themes/advanced/skins/o2k7/ui_silver.css similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/themes/advanced/skins/o2k7/ui_silver.css rename to system/library/Form/plugins/tiny_mce/themes/advanced/skins/o2k7/ui_silver.css diff --git a/Rain/library/Form/plugins/tiny_mce/themes/advanced/source_editor.htm b/system/library/Form/plugins/tiny_mce/themes/advanced/source_editor.htm similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/themes/advanced/source_editor.htm rename to system/library/Form/plugins/tiny_mce/themes/advanced/source_editor.htm diff --git a/Rain/library/Form/plugins/tiny_mce/themes/simple/editor_template.js b/system/library/Form/plugins/tiny_mce/themes/simple/editor_template.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/themes/simple/editor_template.js rename to system/library/Form/plugins/tiny_mce/themes/simple/editor_template.js diff --git a/Rain/library/Form/plugins/tiny_mce/themes/simple/editor_template_src.js b/system/library/Form/plugins/tiny_mce/themes/simple/editor_template_src.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/themes/simple/editor_template_src.js rename to system/library/Form/plugins/tiny_mce/themes/simple/editor_template_src.js diff --git a/Rain/library/Form/plugins/tiny_mce/themes/simple/img/icons.gif b/system/library/Form/plugins/tiny_mce/themes/simple/img/icons.gif similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/themes/simple/img/icons.gif rename to system/library/Form/plugins/tiny_mce/themes/simple/img/icons.gif diff --git a/Rain/library/Form/plugins/tiny_mce/themes/simple/langs/en.js b/system/library/Form/plugins/tiny_mce/themes/simple/langs/en.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/themes/simple/langs/en.js rename to system/library/Form/plugins/tiny_mce/themes/simple/langs/en.js diff --git a/Rain/library/Form/plugins/tiny_mce/themes/simple/skins/default/content.css b/system/library/Form/plugins/tiny_mce/themes/simple/skins/default/content.css similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/themes/simple/skins/default/content.css rename to system/library/Form/plugins/tiny_mce/themes/simple/skins/default/content.css diff --git a/Rain/library/Form/plugins/tiny_mce/themes/simple/skins/default/ui.css b/system/library/Form/plugins/tiny_mce/themes/simple/skins/default/ui.css similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/themes/simple/skins/default/ui.css rename to system/library/Form/plugins/tiny_mce/themes/simple/skins/default/ui.css diff --git a/Rain/library/Form/plugins/tiny_mce/themes/simple/skins/o2k7/content.css b/system/library/Form/plugins/tiny_mce/themes/simple/skins/o2k7/content.css similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/themes/simple/skins/o2k7/content.css rename to system/library/Form/plugins/tiny_mce/themes/simple/skins/o2k7/content.css diff --git a/Rain/library/Form/plugins/tiny_mce/themes/simple/skins/o2k7/img/button_bg.png b/system/library/Form/plugins/tiny_mce/themes/simple/skins/o2k7/img/button_bg.png similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/themes/simple/skins/o2k7/img/button_bg.png rename to system/library/Form/plugins/tiny_mce/themes/simple/skins/o2k7/img/button_bg.png diff --git a/Rain/library/Form/plugins/tiny_mce/themes/simple/skins/o2k7/ui.css b/system/library/Form/plugins/tiny_mce/themes/simple/skins/o2k7/ui.css similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/themes/simple/skins/o2k7/ui.css rename to system/library/Form/plugins/tiny_mce/themes/simple/skins/o2k7/ui.css diff --git a/Rain/library/Form/plugins/tiny_mce/tiny_mce.js b/system/library/Form/plugins/tiny_mce/tiny_mce.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/tiny_mce.js rename to system/library/Form/plugins/tiny_mce/tiny_mce.js diff --git a/Rain/library/Form/plugins/tiny_mce/tiny_mce_popup.js b/system/library/Form/plugins/tiny_mce/tiny_mce_popup.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/tiny_mce_popup.js rename to system/library/Form/plugins/tiny_mce/tiny_mce_popup.js diff --git a/Rain/library/Form/plugins/tiny_mce/tiny_mce_src.js b/system/library/Form/plugins/tiny_mce/tiny_mce_src.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/tiny_mce_src.js rename to system/library/Form/plugins/tiny_mce/tiny_mce_src.js diff --git a/Rain/library/Form/plugins/tiny_mce/utils/editable_selects.js b/system/library/Form/plugins/tiny_mce/utils/editable_selects.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/utils/editable_selects.js rename to system/library/Form/plugins/tiny_mce/utils/editable_selects.js diff --git a/Rain/library/Form/plugins/tiny_mce/utils/form_utils.js b/system/library/Form/plugins/tiny_mce/utils/form_utils.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/utils/form_utils.js rename to system/library/Form/plugins/tiny_mce/utils/form_utils.js diff --git a/Rain/library/Form/plugins/tiny_mce/utils/mctabs.js b/system/library/Form/plugins/tiny_mce/utils/mctabs.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/utils/mctabs.js rename to system/library/Form/plugins/tiny_mce/utils/mctabs.js diff --git a/Rain/library/Form/plugins/tiny_mce/utils/validate.js b/system/library/Form/plugins/tiny_mce/utils/validate.js similarity index 100% rename from Rain/library/Form/plugins/tiny_mce/utils/validate.js rename to system/library/Form/plugins/tiny_mce/utils/validate.js diff --git a/Rain/library/Form/tpl/default.css b/system/library/Form/tpl/default.css similarity index 100% rename from Rain/library/Form/tpl/default.css rename to system/library/Form/tpl/default.css diff --git a/Rain/library/Form/tpl/default.php b/system/library/Form/tpl/default.php similarity index 100% rename from Rain/library/Form/tpl/default.php rename to system/library/Form/tpl/default.php diff --git a/Rain/library/Form/tpl/img/loading.gif b/system/library/Form/tpl/img/loading.gif old mode 100644 new mode 100755 similarity index 100% rename from Rain/library/Form/tpl/img/loading.gif rename to system/library/Form/tpl/img/loading.gif diff --git a/Rain/library/Group.php b/system/library/Group.php old mode 100644 new mode 100755 similarity index 99% rename from Rain/library/Group.php rename to system/library/Group.php index 9017f75..1ecbf11 --- a/Rain/library/Group.php +++ b/system/library/Group.php @@ -56,4 +56,4 @@ static function configure( $setting, $value ){ -?> \ No newline at end of file +// -- end \ No newline at end of file diff --git a/Rain/library/Loader.php b/system/library/Loader.php old mode 100644 new mode 100755 similarity index 67% rename from Rain/library/Loader.php rename to system/library/Loader.php index bb5984b..e179a23 --- a/Rain/library/Loader.php +++ b/system/library/Loader.php @@ -3,8 +3,8 @@ /** * RainFramework * ------------- - * Realized by Federico Ulfo & maintained by the Rain Team - * Distributed under MIT license http://www.opensource.org/licenses/mit-license.php + * Realized by Federico Ulfo & maintained by the Rain Team + * Distributed under MIT license http://www.opensource.org/licenses/mit-license.php */ @@ -40,7 +40,7 @@ class Loader{ $load_javascript = false, $load_style = false; - protected $var, // variables assigned to the page layout + protected $var = array(), // variables assigned to the page layout $load_area_array = array(); // variables assigned to the page layout // selected controller @@ -89,26 +89,27 @@ function auto_load_controller(){ function load_controller( $controller = null, $action = null, $params = array(), $load_area = "center" ){ - // transform the controller string to capitalized. e.g. user => User, news_list => News_List - $controller = implode( "_", array_map( "ucfirst", array_map( "strtolower", explode( "_", $controller ) ) ) ); - + // transform the controller string to capitalized. e.g. user => user, news_list => news_list + $controller = strtolower( $controller ); + $controller_file = self::$controllers_dir . "$controller/$controller." . self::$controller_extension; // include the file if( file_exists( $controller_file = self::$controllers_dir . "$controller/$controller." . self::$controller_extension ) ) - require_once $controller_file; + require_once $controller_file; else - return trigger_error( "CONTROLLER: FILE {$controller_file} NOT FOUND ", E_USER_WARNING ); + return trigger_error( "CONTROLLER: FILE {$controller_file} NOT FOUND ", E_USER_WARNING ); // define the class name of the controller $class = $controller . self::$controller_class_name; + // check if the controller class exists if( class_exists($class) ) - $controller_obj = new $class( $this ); + $controller_obj = new $class( $this ); else - return trigger_error( "CONTROLLER: CLASS {$controller} NOT FOUND ", E_USER_WARNING ); + return trigger_error( "CONTROLLER: CLASS {$controller} NOT FOUND ", E_USER_WARNING ); if( $action ){ @@ -124,7 +125,7 @@ function load_controller( $controller = null, $action = null, $params = array(), call_user_func_array( array( $controller_obj, "filter_before" ), $params ); // call the selected action - call_user_func_array( array( $controller_obj, $action ), $params ); + $action_status = call_user_func_array( array( $controller_obj, $action ), $params ); //call the method filter_after call_user_func_array( array( $controller_obj, "filter_after" ), $params ); @@ -135,6 +136,11 @@ function load_controller( $controller = null, $action = null, $params = array(), ob_end_clean(); + // verify that the action was executed + if( false === $action_status ) + $html = "Action $action not found in controller $class! Method not declared or declared with different private access"; + + $this->loaded_controller[] = array( "controller" => $controller, "execution_time" => timer("controller"), "memory_used" => memory_usage("controller") ); // if it is in ajax mode print and stop the execution of the script @@ -166,30 +172,30 @@ function load_controller( $controller = null, $action = null, $params = array(), */ function load_model( $model ){ - // load the model class - require_once LIBRARY_DIR . "Model.php"; + // load the model class + require_once LIBRARY_DIR . "Model.php"; - // transform the model string to capitalized. e.g. user => User, news_list => News_List - $model = implode( "_", array_map( "ucfirst", array_map( "strtolower", explode( "_", $model ) ) ) ); - - // include the file - if( file_exists($file = self::$models_dir . $model . ".php") ) - require_once $file; - else{ - trigger_error( "MODEL: FILE {$file} NOT FOUND ", E_USER_WARNING ); - return false; - } - - // class name - $class = $model . "_Model"; - - // test if the class exists - if( class_exists($class) ) - return new $class; - else{ - trigger_error( "MODEL: CLASS {$model} NOT FOUND", E_USER_WARNING ); - return false; - } + // transform the model string to capitalized. e.g. user => User, news_list => News_List + $model = implode( "_", array_map( "ucfirst", explode( "_", $model ) ) ); + + // include the file + if( file_exists($file = self::$models_dir . $model . ".php") ) + require_once $file; + else{ + trigger_error( "MODEL: FILE {$file} NOT FOUND ", E_USER_WARNING ); + return false; + } + + // class name + $class = $model . "_Model"; + + // test if the class exists + if( class_exists($class) ) + return new $class; + else{ + trigger_error( "MODEL: CLASS {$model} NOT FOUND", E_USER_WARNING ); + return false; + } } @@ -221,6 +227,7 @@ function load_helper( $helper ){ */ function init_settings( $config_dir = CONFIG_DIR, $settings_file = "settings.php" ){ require_once $config_dir . $settings_file; + require_once CONFIG_DIR . "url.php"; } @@ -228,8 +235,13 @@ function init_settings( $config_dir = CONFIG_DIR, $settings_file = "settings.php /** * Init the database class */ - function init_db(){ + function init_db($name = null){ require_once LIBRARY_DIR . "DB.php"; + + if(!$name) + $name = DB::DEFAULT_CONNECTION_NAME; + + db::init($name); } @@ -267,18 +279,47 @@ function auth_user(){ - /** - * Init the language - * - * @param string $lang_id selected language - */ - function init_language( $lang_id = "en" ){ - if( file_exists( LANGUAGE_DIR . $lang_id . '/generic.php') ){ - require_once LANGUAGE_DIR . $lang_id . '/generic.php'; - define( "LANG_ID", $lang_id ); - } - else - $this->page_not_found = true; + function init_language() { + + $installed_language = get_installed_language(); + $installed_language = array_flip( $installed_language ); + + $priority_lang = array(); + + // get the languages + $requested_lang = get('set_lang_id'); + if ($requested_lang)// the first in the priority list is the GET query like ?set_lang_id=en + $priority_lang[] = $requested_lang; + + if (isset($_SESSION['lang_id']))// the second on the priority list is the previously established + $priority_lang[] = $_SESSION['lang_id']; + + if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { // the third is the sent by the browser + + foreach (explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']) as $part) { + $priority_lang[] = strtolower(substr($part, 0, 2)); + } + } + + $priority_lang[] = get_setting('lang_id');// the fourth is the system + + $priority_lang = array_unique( $priority_lang ); + + // through the list of langs ​​to see which is the best to use + while ((list(,$lang) = each($priority_lang)) && !defined("LANG_ID")) { + if(isset($installed_language[ $lang ])) + define("LANG_ID", $lang); + } + + if(!defined("LANG_ID"))// whether the languages listed is not available + throw new Exception("Can not find the language file"); + + // set the language in session + $_SESSION['lang_id'] = LANG_ID; + + // load the dictionaries + load_lang('generic'); + } @@ -325,6 +366,9 @@ function init_js(){ */ function init_page_layout( $page_layout ){ $this->page_layout = $page_layout; + + // init the load area array + $this->_get_load_area(); } @@ -477,13 +521,42 @@ protected function _draw_ajax(){ */ protected function _blocks_wrapper( $block_array = array() ){ $html = null; - foreach( $block_array as $block_html ) - $html .= $block_html; + if( $block_array ) + foreach( $block_array as $block_html ) + $html .= $block_html; return $html; } + + /** + * init the load_area.php file that define all the load area of the template page + */ + protected function _get_load_area( ){ + + if( !file_exists( $src = CACHE_DIR . "load_area." . md5( THEME_DIR . $this->page_layout ) . ".php" ) || ( filemtime($src) != filemtime( THEME_DIR . $this->page_layout . ".html" ) ) ){ + + $dir = explode( "/", CACHE_DIR . THEME_DIR ); + for( $i=0, $base=""; $ipage_layout . '.html' ), $match ); + $php = "'',"; + $php .= ");\n?>"; + + file_put_contents( $src, $php ); + } + + require $src; + $this->load_area_array = $load_area; + } + protected function __construct() {} -} \ No newline at end of file +} diff --git a/system/library/Model.php b/system/library/Model.php new file mode 100755 index 0000000..f203a1e --- /dev/null +++ b/system/library/Model.php @@ -0,0 +1,64 @@ + User, news_list => News_List + $model = implode( "/", array_map( "ucfirst", array_map( "strtolower", explode( "/", $model ) ) ) ); + $model = implode( "_", array_map( "ucfirst", explode( "_", $model ) ) ); + + + // include the file + + if( file_exists($file = self::$models_dir . $model . ".php") ) { + require_once $file; + } + else{ + + trigger_error( "MODEL: FILE {$file} NOT FOUND ", E_USER_WARNING ); + return false; + } + + if(!$object_name) + $object_name = $model; + + $tModel = explode("/",$model); + $class=$tModel[count($tModel)-1]; + $class.="_Model"; + + //$class = ($real_name)?$real_name."_Model":$model . "_Model"; + + if( class_exists($class) ){ + $this->$object_name = new $class; + + } + else{ + + trigger_error( "MODEL: CLASS {$model} NOT FOUND", E_USER_WARNING ); + return false; + } + return true; + } + + + } + + + +?> \ No newline at end of file diff --git a/Rain/library/Router.php b/system/library/Router.php old mode 100644 new mode 100755 similarity index 100% rename from Rain/library/Router.php rename to system/library/Router.php diff --git a/Rain/library/Session.php b/system/library/Session.php old mode 100644 new mode 100755 similarity index 100% rename from Rain/library/Session.php rename to system/library/Session.php diff --git a/Rain/library/User.php b/system/library/User.php similarity index 94% rename from Rain/library/User.php rename to system/library/User.php index 371e2fb..7eb2a04 100755 --- a/Rain/library/User.php +++ b/system/library/User.php @@ -75,7 +75,7 @@ static function set_user_lang( $lang_id ){ } static function user_where_is_init( $id, $link, $online_time = USER_ONLINE_TIME ){ - return self::$user_obj->user_where_id_init( $id, $link, $online_time ); + return self::$user_obj->user_where_is_init( $id, $link, $online_time ); } static function user_where_is_refresh(){ diff --git a/system/library/User/Rain_Group.php b/system/library/User/Rain_Group.php new file mode 100755 index 0000000..004d3b1 --- /dev/null +++ b/system/library/User/Rain_Group.php @@ -0,0 +1,34 @@ +0? " LIMIT $limit" : null ) ); + } + +} + + + +?> \ No newline at end of file diff --git a/Rain/library/User/Rain_User.php b/system/library/User/Rain_User.php old mode 100644 new mode 100755 similarity index 77% rename from Rain/library/User/Rain_User.php rename to system/library/User/Rain_User.php index c7805fa..6e4591d --- a/Rain/library/User/Rain_User.php +++ b/system/library/User/Rain_User.php @@ -43,18 +43,17 @@ function login( $login = null, $password = null, $enable_cookies = false, $logou //check if there's login and pw, or salt_pw if( $login AND ($password OR $salt_and_pw) ){ - $db = DB::get_instance(); if( !$salt_and_pw ) - $salt_and_pw = md5( $db->get_field( "SELECT salt FROM ".DB_PREFIX."user WHERE email = '{$login}'" ) . $password ); + $salt_and_pw = md5( DB::get_field( "SELECT salt FROM ".DB_PREFIX."user WHERE email = '{$login}'" ) . $password ); - if( $user = $db->get_row( "SELECT * FROM ".DB_PREFIX."user WHERE email = '$login' AND password = '$salt_and_pw'" ) ){ + if( $user = DB::get_row( "SELECT * FROM ".DB_PREFIX."user WHERE email = '$login' AND password = '$salt_and_pw'" ) ){ // create new salt and password if( $password ){ $user_id = $user['user_id']; $salt=rand( 0, 99999 ); $md5_password = md5( $salt . $password ); - $db->query( "UPDATE ".DB_PREFIX."user SET password='$md5_password', salt='$salt', activation_code='' WHERE user_id='$user_id'" ); + DB::query( "UPDATE ".DB_PREFIX."user SET password='$md5_password', salt='$salt', activation_code='' WHERE user_id='$user_id'" ); } if( $enable_cookies ){ @@ -69,7 +68,7 @@ function login( $login = null, $password = null, $enable_cookies = false, $logou self::$user = $_SESSION['user'] = $user; //update date and IP - $db->query( "UPDATE ".DB_PREFIX."user SET last_ip='".get_ip()."', data_login=UNIX_TIMESTAMP() WHERE user_id='{$user['user_id']}'" ); + DB::query( "UPDATE ".DB_PREFIX."user SET last_ip='".get_ip()."', data_login=UNIX_TIMESTAMP() WHERE user_id='{$user['user_id']}'" ); return LOGIN_DONE; } @@ -90,7 +89,7 @@ function login( $login = null, $password = null, $enable_cookies = false, $logou } function logout(){ - if( $user_id = get_user_id() ) + if( $user_id = $this->get_user_id() ) $this->user_where_is_logout( $user_id ); self::$user = null; unset($_SESSION['user']); @@ -106,7 +105,6 @@ function get_user_id(){ function refresh_user_info(){ - $db = DB::get_instance(); self::$user = $_SESSION['user'] = $this->get_user(); self::$user['check'] = $_SESSION['user']['check'] = BASE_DIR; return self::$user; @@ -114,8 +112,7 @@ function refresh_user_info(){ function get_user($user_id=null){ if( $user_id ){ - $db = DB::get_instance(); - $user = $db->get_row( "SELECT * FROM ".DB_PREFIX."user WHERE user_id = '{$user_id}'" ); + $user = DB::get_row( "SELECT * FROM ".DB_PREFIX."user WHERE user_id = '{$user_id}'" ); $user['level'] = get_msg( strtolower($GLOBALS['user_level'][ $user['status'] ]) ); return $user; } @@ -161,8 +158,7 @@ function get_user_field( $field, $user_id = NULL ){ */ function set_user_lang( $lang_id ){ if( $user_id=$this->get_user_id() ){ - $db = DB::get_instance(); - $db->query( "UPDATE ".DB_PREFIX."user SET lang_id='{$lang_id}' WHERE user_id={$user_id}" ); + DB::query( "UPDATE ".DB_PREFIX."user SET lang_id='{$lang_id}' WHERE user_id={$user_id}" ); $_SESSION['user']['lang_id']=$lang_id; } } @@ -173,7 +169,6 @@ function set_user_lang( $lang_id ){ * Set the User geolocation and page */ function user_where_is_init( $id, $link, $online_time = USER_ONLINE_TIME ){ - $db = DB::get_instance(); $file = basename( $_SERVER['PHP_SELF'] ); $url = $_SERVER['REQUEST_URI']; $where_is = isset( $_SESSION['where_is'] ) ? $_SESSION['where_is'] : null; @@ -184,32 +179,32 @@ function user_where_is_init( $id, $link, $online_time = USER_ONLINE_TIME ){ if( !$where_is ){ $time = TIME - HOUR; - $db->query( "DELETE FROM ".DB_PREFIX."user_where_is WHERE time < " . HOUR ); + DB::query( "DELETE FROM ".DB_PREFIX."user_where_is WHERE time < " . HOUR ); } - $user_where_is_id = $where_is ? $_SESSION['where_is']['user_where_is_id'] : $db->get_field( "SELECT user_where_is_id FROM ".DB_PREFIX."user_where_is WHERE sid='$sid'" ); + $user_where_is_id = $where_is ? $_SESSION['where_is']['user_where_is_id'] : DB::get_field( "SELECT user_where_is_id FROM ".DB_PREFIX."user_where_is WHERE sid='$sid'" ); if( $user_id = $this->get_user_id() ){ $guest_id = 0; $name = $this->get_user_field( "name" ); } else{ - $guest_id = isset( $where_is['guest_id'] ) ? $where_is['guest_id'] : ( 1 + $db->get_field( "SELECT guest_id FROM ".DB_PREFIX."user_where_is ORDER BY guest_id DESC LIMIT 1;" ) ); + $guest_id = isset( $where_is['guest_id'] ) ? $where_is['guest_id'] : ( 1 + DB::get_field( "SELECT guest_id FROM ".DB_PREFIX."user_where_is ORDER BY guest_id DESC LIMIT 1;" ) ); $name = _GUEST_ . " " . $guest_id; } if( $user_where_is_id ) - $db->query( "UPDATE ".DB_PREFIX."user_where_is SET ip='$ip', user_id='$user_id', name='$name', url='$url', id='$id', file='$file', time='".TIME."', sid='$sid' WHERE user_where_is_id='$user_where_is_id'" ); + DB::query( "UPDATE ".DB_PREFIX."user_where_is SET ip='$ip', user_id='$user_id', name='$name', url='$url', id='$id', file='$file', time='".TIME."', sid='$sid' WHERE user_where_is_id='$user_where_is_id'" ); else{ if( !($location = ip_to_location( $ip, $type = 'array' )) ) $location = array( 'CountryCode'=>null, 'CountryName'=>null, 'RegionCode'=>null, 'RegionName'=>null, 'City'=>null, 'ZipPostalCode'=>null, 'Latitude'=>null, 'Longitude'=>null, 'TimezoneName'=>null, 'Gmtoffset'=>null ); - $db->query( "INSERT INTO ".DB_PREFIX."user_where_is + DB::query( "INSERT INTO ".DB_PREFIX."user_where_is (ip,sid,user_id,guest_id,name,url,id,file,os,browser,time,time_first_click,country_code,country_name,region_code,region_name,city_name,zip,latitude,longitude,timezone_name,gmt_offset) VALUES ('$ip','$sid','$user_id','$guest_id','$name','$url','$id','$file','$os','$browser', ".TIME.", ".TIME.", '{$location['CountryCode']}', '{$location['CountryName']}', '{$location['RegionCode']}', '{$location['RegionName']}','{$location['City']}', '{$location['ZipPostalCode']}', '{$location['Latitude']}', '{$location['Longitude']}', '{$location['TimezoneName']}', '{$location['Gmtoffset']}')" ); - $user_where_is_id = $db->get_insert_id(); + $user_where_is_id = DB::get_last_id(); } $_SESSION['where_is'] = array( 'user_where_is_id' => $user_where_is_id, 'id' => $id, 'guest_id'=>$guest_id, 'name'=>$name, 'time' => TIME, 'file' => $file, 'user_id' => $user_id, 'os' => $os, 'browser' => $browser ); @@ -221,9 +216,8 @@ function user_where_is_init( $id, $link, $online_time = USER_ONLINE_TIME ){ * Refresh all the user info */ function user_where_is_refresh(){ - $db = DB::get_instance(); if( isset( $_SESSION['where_is'] ) ){ - $db->query( "UPDATE ".DB_PREFIX."user_where_is SET time='".TIME."' WHERE user_where_is_id='{$_SESSION['where_is']['user_where_is_id']}'" ); + DB::query( "UPDATE ".DB_PREFIX."user_where_is SET time='".TIME."' WHERE user_where_is_id='{$_SESSION['where_is']['user_where_is_id']}'" ); $_SESSION['where_is']['time'] = TIME; } } @@ -234,8 +228,7 @@ function user_where_is_refresh(){ * Get the userWhereIs info */ function get_user_where_is_user( $user_where_is_id, $online_time = USER_ONLINE_TIME ){ - $db = DB::get_instance(); - return $db->get_row( "SELECT ".DB_PREFIX."user.*, ".DB_PREFIX."user_where_is.* + return DB::get_row( "SELECT ".DB_PREFIX."user.*, ".DB_PREFIX."user_where_is.* FROM ".DB_PREFIX."user_where_is LEFT JOIN ".DB_PREFIX."user ON ".DB_PREFIX."user_where_is.user_id = ".DB_PREFIX."user.user_id WHERE ( ".TIME." - time ) < $online_time @@ -248,8 +241,7 @@ function get_user_where_is_user( $user_where_is_id, $online_time = USER_ONLINE_T * Get the list of all user online */ function get_user_where_is_list( $id = null, $yourself = true, $online_time = USER_ONLINE_TIME ){ - $db = DB::get_instance(); - return $db->get_list( "SELECT ".DB_PREFIX."user.*, ".DB_PREFIX."user_where_is.*, IF (".DB_PREFIX."user.user_id > 0, ".DB_PREFIX."user.name, ".DB_PREFIX."user_where_is.name ) AS name + return DB::get_list( "SELECT ".DB_PREFIX."user.*, ".DB_PREFIX."user_where_is.*, IF (".DB_PREFIX."user.user_id > 0, ".DB_PREFIX."user.name, ".DB_PREFIX."user_where_is.name ) AS name FROM ".DB_PREFIX."user_where_is LEFT JOIN ".DB_PREFIX."user ON ".DB_PREFIX."user_where_is.user_id = ".DB_PREFIX."user.user_id WHERE ( ".TIME." - time ) < $online_time @@ -273,8 +265,7 @@ function get_user_where_is( ){ * Delete the user where is info */ function user_where_is_logout( $user_id ){ - $db = DB::get_instance(); - $db->query( "DELETE FROM ".DB_PREFIX."user_where_is WHERE user_id='$user_id'" ); + DB::query( "DELETE FROM ".DB_PREFIX."user_where_is WHERE user_id='$user_id'" ); unset( $_SESSION['where_is'] ); } @@ -283,8 +274,7 @@ function user_where_is_logout( $user_id ){ */ function get_user_group_list(){ if( $user_id = $this->get_user_id() ){ - $db = DB::get_instance(); - return $db->get_list( "SELECT * + return DB::get_list( "SELECT * FROM ".DB_PREFIX."usergroup AS g JOIN ".DB_PREFIX."usergroup_user AS gu ON g.group_id=gu.group_id WHERE gu.user_id=? diff --git a/system/library/User/Rain_User_Localization.php b/system/library/User/Rain_User_Localization.php new file mode 100755 index 0000000..1a234c8 --- /dev/null +++ b/system/library/User/Rain_User_Localization.php @@ -0,0 +1,142 @@ +null, 'CountryName'=>null, 'RegionCode'=>null, 'RegionName'=>null, 'City'=>null, 'ZipPostalCode'=>null, 'Latitude'=>null, 'Longitude'=>null, 'TimezoneName'=>null, 'Gmtoffset'=>null ); + + //replace_sql_injection( $location ); + + DB::query( "INSERT INTO ".DB_PREFIX."user_localization + (ip,sid,user_id,guest_id,name,url,id,file,os,browser,time,time_first_click,country_code,country_name,region_code,region_name,city_name,zip,latitude,longitude,timezone_name,gmt_offset) + VALUES + ('$ip','$sid','$user_id','$guest_id','$name','$url','$id','$file','$os','$browser', ".TIME.", ".TIME.", '{$location['CountryCode']}', '{$location['CountryName']}', '{$location['RegionCode']}', '{$location['RegionName']}','{$location['City']}', '{$location['ZipPostalCode']}', '{$location['Latitude']}', '{$location['Longitude']}', '{$location['TimezoneName']}', '{$location['Gmtoffset']}')" ); + $user_localization_id = DB::get_last_id(); + } + + $_SESSION['user_localization'] = array( 'user_localization_id' => $user_localization_id, 'id' => $id, 'guest_id'=>$guest_id, 'name'=>$name, 'time' => TIME, 'file' => $file, 'user_id' => $user_id, 'os' => $os, 'browser' => $browser ); + } + + + + /** + * Refresh all the user info + */ + function refresh(){ + if( isset( $_SESSION['user_localization'] ) ){ + DB::query( "UPDATE ".DB_PREFIX."user_localization SET time='".TIME."' WHERE user_localization_id='{$_SESSION['user_localization']['user_localization_id']}'" ); + $_SESSION['user_localization']['time'] = TIME; + } + } + + + + /** + * Refresh all the user info + */ + function get_user_localization_id(){ + if( isset( $_SESSION['user_localization'] ) ) + return $_SESSION['user_localization']['user_localization_id']; + } + + + + /** + * Get the userWhereIs info + */ + function get_user_localization( $user_localization_id = null, $online_time = USER_ONLINE_TIME ){ + + if( !$user_localization_id ) + $user_localization_id = $this->get_user_localization_id(); + + return DB::get_row( "SELECT ".DB_PREFIX."user.*, ".DB_PREFIX."user_localization.* + FROM ".DB_PREFIX."user_localization + LEFT JOIN ".DB_PREFIX."user ON ".DB_PREFIX."user_localization.user_id = ".DB_PREFIX."user.user_id + WHERE ( ".TIME." - time ) < $online_time + AND user_localization_id = $user_localization_id"); + } + + + + /** + * Get the list of all user online + */ + function get_user_localization_list( $id = null, $yourself = true, $online_time = USER_ONLINE_TIME ){ + return DB::get_list( "SELECT ".DB_PREFIX."user.*, ".DB_PREFIX."user_localization.*, IF (".DB_PREFIX."user.user_id > 0, ".DB_PREFIX."user.name, ".DB_PREFIX."user_localization.name ) AS name + FROM ".DB_PREFIX."user_localization + LEFT JOIN ".DB_PREFIX."user ON ".DB_PREFIX."user_localization.user_id = ".DB_PREFIX."user.user_id + WHERE ( ".TIME." - time ) < $online_time + " . ( $id!=null ? "AND ".DB_PREFIX."user_localization.id = $id" : null ) + . ( !$yourself ? " AND ".DB_PREFIX."user_localization.sid != '".session_id()."'" : null ) + ); + } + + + + /** + * Delete the user where is info + */ + function logout( $user_localization_id = null ){ + + if( !$user_localization_id ) + $user_localization_id = $this->get_user_localization_id(); + + DB::query( "DELETE FROM ".DB_PREFIX."user_localization WHERE user_localization_id='$user_localization_id'" ); + unset( $_SESSION['user_localization'] ); + } + + +} + + + +// -- end \ No newline at end of file diff --git a/Rain/library/User_Localization.php b/system/library/User_Localization.php similarity index 96% rename from Rain/library/User_Localization.php rename to system/library/User_Localization.php index 111ade2..4b2cb15 100755 --- a/Rain/library/User_Localization.php +++ b/system/library/User_Localization.php @@ -55,4 +55,4 @@ static function configure( $setting, $value ){ -?> \ No newline at end of file +// -- end \ No newline at end of file diff --git a/Rain/library/View.php b/system/library/View.php similarity index 100% rename from Rain/library/View.php rename to system/library/View.php diff --git a/system/library/View/Rain/Tpl.php b/system/library/View/Rain/Tpl.php new file mode 100755 index 0000000..2232a06 --- /dev/null +++ b/system/library/View/Rain/Tpl.php @@ -0,0 +1,85 @@ + $value ) + self::configure( $key, $value ); + else if( property_exists( __CLASS__, $setting ) ){ + self::$$setting = $value; + self::$config_check_sum .= $value; // take trace of all config + } + } + + static protected function _check_template( $template ){ + // set filename + $template_name = basename( $template ); + $template_basedir = strpos($template,"/") ? dirname($template) . '/' : null; + $template_directory = self::$tpl_dir . $template_basedir; + $template_filepath = $template_directory . $template_name . '.' . self::$tpl_ext; + $parsed_template_filepath = self::$cache_dir . $template_name . "." . md5( $template_directory . self::$config_check_sum ) . '.rtpl.php'; + $class_name = str_replace( array(".","/"), "_", $parsed_template_filepath ); + + // if the template doesn't exsist throw an error + if( !file_exists( $template_filepath ) ){ + $e = new RainTpl_NotFoundException( 'Template '. $template_name .' not found!' ); + throw $e->setTemplateFile($template_filepath); + } + + // Compile the template if the original has been updated + if( self::$debug || !file_exists( $parsed_template_filepath ) || ( filemtime($parsed_template_filepath) < filemtime( $template_filepath ) ) ){ + + // compile template + $compiler_class = "TplCompile" . ucfirst( strtolower( self::$template_syntax ) ); + include_once $compiler_class . ".php"; + + $compiler_class::configure( get_class_vars( __CLASS__ ) ); + $compiler_class::compileFile( $template_name, $template_basedir, $template_filepath, $parsed_template_filepath ); + + } + return $parsed_template_filepath; + } + +} \ No newline at end of file diff --git a/system/library/View/Rain/TplCompileRain 2.php b/system/library/View/Rain/TplCompileRain 2.php new file mode 100755 index 0000000..6106083 --- /dev/null +++ b/system/library/View/Rain/TplCompileRain 2.php @@ -0,0 +1,569 @@ + $value ){ + if( property_exists( __CLASS__, $key ) ){ + self::$$key = $value; + } + } + } + + /** + * Compile template + * @access protected + */ + static function _compileTemplate( $code, $template_basedir ){ + + //tag list + $tag_regexp = array( 'loop' => '(\{loop(?: name){0,1}="\${0,1}[^"]*"\})', + 'loop_close' => '(\{\/loop\})', + 'if' => '(\{if(?: condition){0,1}="[^"]*"\})', + 'elseif' => '(\{elseif(?: condition){0,1}="[^"]*"\})', + 'else' => '(\{else\})', + 'if_close' => '(\{\/if\})', + 'function' => '(\{function="[^"]*"\})', + 'noparse' => '(\{noparse\})', + 'noparse_close'=> '(\{\/noparse\})', + 'ignore' => '(\{ignore\})', + 'ignore_close' => '(\{\/ignore\})', + 'include' => '(\{include="[^"]*"\})', + 'template_info'=> '(\{\$template_info\})', + 'function' => '(\{function="(\w*?)(?:.*?)"\})' + ); + + $tag_regexp = "/" . join( "|", $tag_regexp ) . "/"; + + //split the code with the tags regexp + $code = preg_split ( $tag_regexp, $code, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY ); + + //path replace (src of img, background and href of link) + $code = self::path_replace( $code, $template_basedir ); + + //compile the code + $compiled_code = self::compileCode( $code ); + + //return the compiled code + return $compiled_code; + + } + + + + /** + * Compile the code + * @access protected + */ + protected function compileCode( $parsed_code ){ + + //variables initialization + $compiled_code = $open_if = $comment_is_open = $ignore_is_open = null; + $loop_level = 0; + + //read all parsed code + while( $html = array_shift( $parsed_code ) ){ + + //close ignore tag + if( !$comment_is_open && strpos( $html, '{/ignore}' ) !== FALSE ) + $ignore_is_open = false; + + //code between tag ignore id deleted + elseif( $ignore_is_open ){ + //ignore the code + } + + //close no parse tag + elseif( strpos( $html, '{/noparse}' ) !== FALSE ) + $comment_is_open = false; + + //code between tag noparse is not compiled + elseif( $comment_is_open ) + $compiled_code .= $html; + + //ignore + elseif( strpos( $html, '{ignore}' ) !== FALSE ) + $ignore_is_open = true; + + //noparse + elseif( strpos( $html, '{noparse}' ) !== FALSE ) + $comment_is_open = true; + + //include tag + elseif( preg_match( '/\{include="([^"]*)"\}/', $html, $code ) ){ + + //variables substitution + $include_var = self::var_replace( $code[ 1 ], $left_delimiter = null, $right_delimiter = null, $php_left_delimiter = '".' , $php_right_delimiter = '."', $loop_level ); + + + //dynamic include + $compiled_code .= 'assign( $variables );' . + ( !$loop_level ? null : '$tpl->assign( "key", $key'.$loop_level.' ); $tpl->assign( "value", $value'.$loop_level.' );' ). + '$tpl->draw( dirname("'.$include_var.'") . ( substr("'.$include_var.'",-1,1) != "/" ? "/" : "" ) . basename("'.$include_var.'") );'. + '?>'; + + } + + //loop + elseif( preg_match( '/\{loop(?: name){0,1}="\${0,1}([^"]*)"\}/', $html, $code ) ){ + + //increase the loop counter + $loop_level++; + + //replace the variable in the loop + $var = self::var_replace( '$' . $code[ 1 ], $tag_left_delimiter=null, $tag_right_delimiter=null, $php_left_delimiter=null, $php_right_delimiter=null, $loop_level-1 ); + + //loop variables + $counter = "\$counter$loop_level"; // count iteration + $key = "\$key$loop_level"; // key + $value = "\$value$loop_level"; // value + + //loop code + $compiled_code .= " $value ){ $counter++; ?>"; + + } + + //close loop tag + elseif( strpos( $html, '{/loop}' ) !== FALSE ) { + + //iterator + $counter = "\$counter$loop_level"; + + //decrease the loop counter + $loop_level--; + + //close loop code + $compiled_code .= ""; + + } + + //if + elseif( preg_match( '/\{if(?: condition){0,1}="([^"]*)"\}/', $html, $code ) ){ + + //increase open if counter (for intendation) + $open_if++; + + //tag + $tag = $code[ 0 ]; + + //condition attribute + $condition = $code[ 1 ]; + + //variable substitution into condition (no delimiter into the condition) + $parsed_condition = self::var_replace( $condition, $tag_left_delimiter = null, $tag_right_delimiter = null, $php_left_delimiter = null, $php_right_delimiter = null, $loop_level ); + + //if code + $compiled_code .= ""; + + } + + //elseif + elseif( preg_match( '/\{elseif(?: condition){0,1}="([^"]*)"\}/', $html, $code ) ){ + + //tag + $tag = $code[ 0 ]; + + //condition attribute + $condition = $code[ 1 ]; + + //variable substitution into condition (no delimiter into the condition) + $parsed_condition = self::var_replace( $condition, $tag_left_delimiter = null, $tag_right_delimiter = null, $php_left_delimiter = null, $php_right_delimiter = null, $loop_level ); + + //elseif code + $compiled_code .= ""; + } + + //else + elseif( strpos( $html, '{else}' ) !== FALSE ) { + + //else code + $compiled_code .= ''; + + } + + //close if tag + elseif( strpos( $html, '{/if}' ) !== FALSE ) { + + //decrease if counter + $open_if--; + + // close if code + $compiled_code .= ''; + + } + + //function + elseif( preg_match( '/\{function="(\w*)(.*?)"\}/', $html, $code ) ){ + + //tag + $tag = $code[ 0 ]; + + //function + $function = $code[ 1 ]; + + if( empty( $code[ 2 ] ) ) + $parsed_function = $function . "()"; + else + // parse the function + $parsed_function = $function . self::var_replace( $code[ 2 ], $tag_left_delimiter = null, $tag_right_delimiter = null, $php_left_delimiter = null, $php_right_delimiter = null, $loop_level ); + + //if code + $compiled_code .= ""; + } + + // show all vars + elseif ( strpos( $html, '{$template_info}' ) !== FALSE ) { + + //tag + $tag = '{$template_info}'; + + //if code + $compiled_code .= '"; print_r( self::var ); echo ""; ?>'; + } + + + //all html code + else{ + + //variables substitution (es. {$title}) + $html = self::var_replace( $html, $left_delimiter = '\{', $right_delimiter = '\}', $php_left_delimiter = '', $loop_level, $echo = true ); + //const substitution (es. {#CONST#}) + $html = self::const_replace( $html, $left_delimiter = '\{', $right_delimiter = '\}', $php_left_delimiter = '', $loop_level, $echo = true ); + //functions substitution (es. {"string"|functions}) + $compiled_code .= self::func_replace( $html, $left_delimiter = '\{', $right_delimiter = '\}', $php_left_delimiter = '', $loop_level, $echo = true ); + } + } + + if( $open_if > 0 ) { + $e = new RainTpl_SyntaxException('Error! You need to close an {if} tag in ' . $template_filepath . ' template'); + throw $e->setTemplateFile($template_filepath); + } + return $compiled_code; + } + + + + /** + * replace the path of image src, link href and a href. + * url => template_dir/url + * url# => url + * http://url => http://url + * + * @param string $html + * @return string html sostituito + */ + protected function path_replace( $html, $template_basedir ){ + + if( self::$path_replace ){ + + $template_directory = self::$base_url . self::$tpl_dir . $template_basedir; + + // reduce the path + $path = preg_replace('/\w+\/\.\.\//', '', $template_directory ); + + $exp = $sub = array(); + + if( in_array( "img", self::$path_replace_list ) ){ + $exp = array( '/title) + $temp = preg_split( "/\.|\[|\-\>/", $var ); + + //variable name + $var_name = $temp[ 0 ]; + + //variable path + $variable_path = substr( $var, strlen( $var_name ) ); + + //parentesis transform [ e ] in [" e in "] + $variable_path = str_replace( '[', '["', $variable_path ); + $variable_path = str_replace( ']', '"]', $variable_path ); + + //transform .$variable in ["$variable"] + $variable_path = preg_replace('/\.\$(\w+)/', '["$\\1"]', $variable_path ); + + //transform [variable] in ["variable"] + $variable_path = preg_replace('/\.(\w+)/', '["\\1"]', $variable_path ); + + //if there's a function + if( $function_var ){ + + // check if there's a function or a static method and separate, function by parameters + $function_var = str_replace("::", "@double_dot@", $function_var ); + + // get the position of the first : + if( $dot_position = strpos( $function_var, ":" ) ){ + + // get the function and the parameters + $function = substr( $function_var, 0, $dot_position ); + $params = substr( $function_var, $dot_position+1 ); + + } + else{ + + //get the function + $function = str_replace( "@double_dot@", "::", $function_var ); + $params = null; + + } + + // replace back the @double_dot@ with :: + $function = str_replace( "@double_dot@", "::", $function ); + $params = str_replace( "@double_dot@", "::", $params ); + + + } + else + $function = $params = null; + + $php_var = $var_name . $variable_path; + + // compile the variable for php + if( isset( $function ) ){ + if( $php_var ) + $php_var = $php_left_delimiter . ( !$is_init_variable && $echo ? 'echo ' : null ) . ( $params ? "( $function( $php_var, $params ) )" : "$function( $php_var )" ) . $php_right_delimiter; + else + $php_var = $php_left_delimiter . ( !$is_init_variable && $echo ? 'echo ' : null ) . ( $params ? "( $function( $params ) )" : "$function()" ) . $php_right_delimiter; + } + else + $php_var = $php_left_delimiter . ( !$is_init_variable && $echo ? 'echo ' : null ) . $php_var . $extra_var . $php_right_delimiter; + + $html = str_replace( $tag, $php_var, $html ); + + } + + return $html; + + } + + + + function var_replace( $html, $tag_left_delimiter, $tag_right_delimiter, $php_left_delimiter = null, $php_right_delimiter = null, $loop_level = null, $echo = null ){ + + //all variables + if( preg_match_all( '/' . $tag_left_delimiter . '\$(\w+(?:\.\${0,1}[A-Za-z0-9_]+)*(?:(?:\[\${0,1}[A-Za-z0-9_]+\])|(?:\-\>\${0,1}[A-Za-z0-9_]+))*)(.*?)' . $tag_right_delimiter . '/', $html, $matches ) ){ + + for( $parsed=array(), $i=0, $n=count($matches[0]); $i<$n; $i++ ) + $parsed[$matches[0][$i]] = array('var'=>$matches[1][$i],'extra_var'=>$matches[2][$i]); + + foreach( $parsed as $tag => $array ){ + + //variable name ex: news.title + $var = $array['var']; + + //function and parameters associate to the variable ex: substr:0,100 + $extra_var = $array['extra_var']; + + // check if there's any function disabled by black_list + self::function_check( $tag ); + + $extra_var = self::var_replace( $extra_var, null, null, null, null, $loop_level ); + + // check if there's an operator = in the variable tags, if there's this is an initialization so it will not output any value + $is_init_variable = preg_match( "/^[a-z_A-Z\.\[\](\-\>)]*=[^=]*$/", $extra_var ); + + //function associate to variable + $function_var = ( $extra_var and $extra_var[0] == '|') ? substr( $extra_var, 1 ) : null; + + //variable path split array (ex. $news.title o $news[title]) or object (ex. $news->title) + $temp = preg_split( "/\.|\[|\-\>/", $var ); + + //variable name + $var_name = $temp[ 0 ]; + + //variable path + $variable_path = substr( $var, strlen( $var_name ) ); + + //parentesis transform [ e ] in [" e in "] + $variable_path = str_replace( '[', '["', $variable_path ); + $variable_path = str_replace( ']', '"]', $variable_path ); + + //transform .$variable in ["$variable"] and .variable in ["variable"] + $variable_path = preg_replace('/\.(\${0,1}\w+)/', '["\\1"]', $variable_path ); + + // if is an assignment also assign the variable to self::var['value'] + if( $is_init_variable ) + $extra_var = "=\$variables['{$var_name}']{$variable_path}" . $extra_var; + + + + //if there's a function + if( $function_var ){ + + // check if there's a function or a static method and separate, function by parameters + $function_var = str_replace("::", "@double_dot@", $function_var ); + + + // get the position of the first : + if( $dot_position = strpos( $function_var, ":" ) ){ + + // get the function and the parameters + $function = substr( $function_var, 0, $dot_position ); + $params = substr( $function_var, $dot_position+1 ); + + } + else{ + + //get the function + $function = str_replace( "@double_dot@", "::", $function_var ); + $params = null; + + } + + // replace back the @double_dot@ with :: + $function = str_replace( "@double_dot@", "::", $function ); + $params = str_replace( "@double_dot@", "::", $params ); + } + else + $function = $params = null; + + //if it is inside a loop + if( $loop_level ){ + //verify the variable name + if( $var_name == 'key' ) + $php_var = '$key' . $loop_level; + elseif( $var_name == 'value' ) + $php_var = '$value' . $loop_level . $variable_path; + elseif( $var_name == 'counter' ) + $php_var = '$counter' . $loop_level; + else + $php_var = '$' . $var_name . $variable_path; + }else + $php_var = '$' . $var_name . $variable_path; + + // compile the variable for php + if( isset( $function ) ) + $php_var = $php_left_delimiter . ( !$is_init_variable && $echo ? 'echo ' : null ) . ( $params ? "( $function( $php_var, $params ) )" : "$function( $php_var )" ) . $php_right_delimiter; + else + $php_var = $php_left_delimiter . ( !$is_init_variable && $echo ? 'echo ' : null ) . $php_var . $extra_var . $php_right_delimiter; + + $html = str_replace( $tag, $php_var, $html ); + + + } + } + + return $html; + } + + + + /** + * Check if function is in black list (sandbox) + * + * @param string $code + * @param string $tag + */ + protected function function_check( $code ){ + + $preg = '#(\W|\s)' . implode( '(\W|\s)|(\W|\s)', self::$black_list ) . '(\W|\s)#'; + + // check if the function is in the black list (or not in white list) + if( count(self::$black_list) && preg_match( $preg, $code, $match ) ){ + + // find the line of the error + $line = 0; + $rows=explode("\n",$this->tpl['source']); + while( !strpos($rows[$line],$code) ) + $line++; + + // stop the execution of the script + $e = new RainTpl_SyntaxException('Unallowed syntax in ' . $this->tpl['tpl_filename'] . ' template'); + throw $e->setTemplateFile($this->tpl['tpl_filename']) + ->setTag($code) + ->setTemplateLine($line); + } + + } + + +} \ No newline at end of file diff --git a/system/library/View/Rain/TplCompileRain.php b/system/library/View/Rain/TplCompileRain.php new file mode 100755 index 0000000..af32521 --- /dev/null +++ b/system/library/View/Rain/TplCompileRain.php @@ -0,0 +1,424 @@ + $value ){ + if( property_exists( __CLASS__, $key ) ){ + self::$$key = $value; + } + } + } + + /** + * Compile the file + */ + static function compileFile( $template_name, $template_basedir, $template_filepath, $parsed_template_filepath ){ + + // open the template + $fp = fopen( $template_filepath, "r" ); + + // lock the file + if( flock( $fp, LOCK_SH ) ){ + + // read the file + $code = fread($fp, filesize( $template_filepath ) ); + + //xml substitution + $code = preg_replace( "/<\?xml(.*?)\?>/s", "##XML\\1XML##", $code ); + + // disable php tag + if( !self::$php_enabled ) + $code = str_replace( array(""), array("<?","?>"), $code ); + + //xml re-substitution + $code = preg_replace_callback ( "/##XML(.*?)XML##/s", function( $match ){ + return "'; ?>"; + }, $code ); + + $parsed_code = self::_compileTemplate( $code, $template_basedir, self::$debug, self::$tpl_dir, self::$cache_dir, self::$path_replace, self::$path_replace_list, self::$black_list ); + $parsed_code = "" . $parsed_code; + + // fix the php-eating-newline-after-closing-tag-problem + $parsed_code = str_replace( "?>\n", "?>\n\n", $parsed_code ); + + // create directories + if( !is_dir( self::$cache_dir ) ) + mkdir( self::$cache_dir, 0755, true ); + + // check if the cache is writable + if( !is_writable( self::$cache_dir ) ) + throw new RainTpl_Exception ('Cache directory ' . self::$cache_dir . 'doesn\'t have write permission. Set write permission or set RAINTPL_CHECK_TEMPLATE_UPDATE to false. More details on http://www.raintpl.com/Documentation/Documentation-for-PHP-developers/Configuration/'); + + //write compiled file + file_put_contents( $parsed_template_filepath, $parsed_code ); + + // release the file lock + return flock($fp, LOCK_UN); + + } + + } + + /** + * Compile template + * @access protected + */ + static function _compileTemplate( $code, $template_basedir ){ + + //path replace (src of img, background and href of link) + if( self::$path_replace ) + $code = self::path_replace( $code, $template_basedir ); + + // tags + $tags = array( '({loop.*?})', + '({\/loop})', + '({if.*?})', + '({elseif.*?})', + '({else})', + '({\/if})', + '({noparse})', + '({\/noparse})', + '({ignore})', + '({\/ignore})', + '({include.*?})', + '({\$.*?})', + '({#.*?})' + ); + + //split the code with the tags regexp + $code_split = preg_split( "/" . implode( "|", $tags ) . "/", $code, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY ); + + //compile the code + return self::_parseCode( $code_split ); + + } + + + + /** + * Compile the code + * @access protected + */ + static protected function _parseCode( $code_split ){ + + //variables initialization + $parsed_code = $comment_is_open = $ignore_is_open = NULL; + $open_if = $loop_level = 0; + + //read all parsed code + while( $html = array_shift( $code_split ) ){ + + //close ignore tag + if( !$comment_is_open && strpos( $html, '{/ignore}' ) !== FALSE ) + $ignore_is_open = FALSE; + + //code between tag ignore id deleted + elseif( $ignore_is_open ){ + //ignore the code + } + + //close no parse tag + elseif( strpos( $html, '{/noparse}' ) !== FALSE ) + $comment_is_open = FALSE; + + //code between tag noparse is not compiled + elseif( $comment_is_open ) + $parsed_code .= $html; + + //ignore + elseif( strpos( $html, '{ignore}' ) !== FALSE ) + $ignore_is_open = TRUE; + + //noparse + elseif( strpos( $html, '{noparse}' ) !== FALSE ) + $comment_is_open = TRUE; + + //include tag + elseif( preg_match( '/{include="([^"]*)"}/', $html, $matches ) ){ + + //variables substitution + $include_var = self::var_replace( $matches[ 1 ], $loop_level ); + + + //dynamic include + $parsed_code .= ''; + + } + + //loop + elseif( preg_match( '/{loop="\${0,1}([^"]*)"}/', $html, $matches ) ){ + + //increase the loop counter + $loop_level++; + + //replace the variable in the loop + $var = self::var_replace( '$' . $matches[ 1 ], $loop_level-1 ); + + //loop variables + $counter = "\$counter$loop_level"; // count iteration + $key = "\$key$loop_level"; // key + $value = "\$value$loop_level"; // value + + //loop code + $parsed_code .= " $value ){ $counter++; ?>"; + + } + + //close loop tag + elseif( strpos( $html, '{/loop}' ) !== FALSE ) { + + //iterator + $counter = "\$counter$loop_level"; + + //decrease the loop counter + $loop_level--; + + //close loop code + $parsed_code .= ""; + + } + + //if + elseif( preg_match( '/{if(?: condition){0,1}="([^"]*)"}/', $html, $matches ) ){ + + //increase open if counter (for intendation) + $open_if++; + + //tag + $tag = $matches[ 0 ]; + + //condition attribute + $condition = $matches[ 1 ]; + + //variable substitution into condition (no delimiter into the condition) + $parsed_condition = self::var_replace( $condition, $loop_level ); + + //if code + $parsed_code .= ""; + + } + + //elseif + elseif( preg_match( '/{elseif(?: condition){0,1}="([^"]*)"}/', $html, $matches ) ){ + + //tag + $tag = $matches[ 0 ]; + + //condition attribute + $condition = $matches[ 1 ]; + + //variable substitution into condition (no delimiter into the condition) + $parsed_condition = self::var_replace( $condition, $loop_level ); + + //elseif code + $parsed_code .= ""; + } + + //else + elseif( strpos( $html, '{else}' ) !== FALSE ) { + + //else code + $parsed_code .= ''; + + } + + //close if tag + elseif( strpos( $html, '{/if}' ) !== FALSE ) { + + //decrease if counter + $open_if--; + + // close if code + $parsed_code .= ''; + + } + + //variables + elseif( preg_match( '/{(\$.*?)}/', $html, $matches ) ){ + //variables substitution (es. {$title}) + $parsed_code .= ""; + } + + //constants + elseif( preg_match( '/{#(.*?)#{0,1}}/', $html, $matches ) ){ + $parsed_code .= ""; + } + + // template info + else{ + $parsed_code .= $html; + } + + } + + if( $open_if > 0 ) { + $e = new RainTpl_SyntaxException('Error! You need to close an {if} tag in ' . $template_filepath . ' template'); + throw $e->setTemplateFile($template_filepath); + } + + return $parsed_code; + + } + + + + /** + * replace the path of image src, link href and a href. + * url => template_dir/url + * url# => url + * http://url => http://url + * + * @param string $html + * @return string html sostituito + */ + static protected function path_replace( $html, $template_basedir ){ + + if( self::$path_replace ){ + + // get the template base directory + $template_directory = self::$base_url . self::$tpl_dir . $template_basedir; + + // reduce the path + $path = preg_replace('/\w+\/\.\.\//', '', $template_directory ); + + $exp = $sub = array(); + + if( in_array( "img", self::$path_replace_list ) ){ + $exp = array( '/tpl['source']); + while( !strpos($rows[$line],$code) ) + $line++; + + // stop the execution of the script + $e = new RainTpl_SyntaxException('Unallowed syntax in ' . $this->tpl['tpl_filename'] . ' template'); + throw $e->setTemplateFile($this->tpl['tpl_filename']) + ->setTag($code) + ->setTemplateLine($line); + } + + } + + +} diff --git a/system/library/View/Rain/TplCompileRain_1.php b/system/library/View/Rain/TplCompileRain_1.php new file mode 100755 index 0000000..0bf685b --- /dev/null +++ b/system/library/View/Rain/TplCompileRain_1.php @@ -0,0 +1,615 @@ + $value ){ + if( property_exists( __CLASS__, $key ) ){ + self::$$key = $value; + } + } + } + + /** + * Compile the file + */ + static function compileFile( $template_name, $template_basedir, $template_filepath, $parsed_template_filepath ){ + + // open the template + $fp = fopen( $template_filepath, "r" ); + + // lock the file + if( flock( $fp, LOCK_SH ) ){ + + // read the file + $code = fread($fp, filesize( $template_filepath ) ); + + //xml substitution + $code = preg_replace( "/<\?xml(.*?)\?>/s", "##XML\\1XML##", $code ); + + // disable php tag + if( !self::$php_enabled ) + $code = str_replace( array(""), array("<?","?>"), $code ); + + //xml re-substitution + $code = preg_replace_callback ( "/##XML(.*?)XML##/s", function( $match ){ + return "'; ?>"; + }, $code ); + + $parsed_code = self::_compileTemplate( $code, $template_basedir, self::$debug, self::$tpl_dir, self::$cache_dir, self::$path_replace, self::$path_replace_list, self::$black_list ); + $parsed_code = "" . $parsed_code; + + // fix the php-eating-newline-after-closing-tag-problem + $parsed_code = str_replace( "?>\n", "?>\n\n", $parsed_code ); + + // create directories + if( !is_dir( self::$cache_dir ) ) + mkdir( self::$cache_dir, 0755, true ); + + // check if the cache is writable + if( !is_writable( self::$cache_dir ) ) + throw new RainTpl_Exception ('Cache directory ' . self::$cache_dir . 'doesn\'t have write permission. Set write permission or set RAINTPL_CHECK_TEMPLATE_UPDATE to false. More details on http://www.raintpl.com/Documentation/Documentation-for-PHP-developers/Configuration/'); + + //write compiled file + file_put_contents( $parsed_template_filepath, $parsed_code ); + + // release the file lock + return flock($fp, LOCK_UN); + + } + + } + + /** + * Compile template + * @access protected + */ + static function _compileTemplate( $code, $template_basedir ){ + + //path replace (src of img, background and href of link) + if( self::$path_replace ) + $code = self::path_replace( $code, $template_basedir ); + + // tags + $tags = array( '({loop.*?})', + '({\/loop})', + '({if.*?})', + '({elseif.*?})', + '({else})', + '({\/if})', + '({function.*?})', + '({noparse})', + '({\/noparse})', + '({ignore})', + '({\/ignore})', + '({include.*?})' + ); + + //split the code with the tags regexp + $code_split = preg_split( "/" . implode( "|", $tags ) . "/", $code, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY ); + + //compile the code + return self::_parseCode( $code_split ); + + } + + + + /** + * Compile the code + * @access protected + */ + protected function _parseCode( $code_split ){ + + //variables initialization + $parsed_code = $comment_is_open = $ignore_is_open = NULL; + $open_if = $loop_level = 0; + + //read all parsed code + while( $html = array_shift( $code_split ) ){ + + //close ignore tag + if( !$comment_is_open && strpos( $html, '{/ignore}' ) !== FALSE ) + $ignore_is_open = FALSE; + + //code between tag ignore id deleted + elseif( $ignore_is_open ){ + //ignore the code + } + + //close no parse tag + elseif( strpos( $html, '{/noparse}' ) !== FALSE ) + $comment_is_open = FALSE; + + //code between tag noparse is not compiled + elseif( $comment_is_open ) + $parsed_code .= $html; + + //ignore + elseif( strpos( $html, '{ignore}' ) !== FALSE ) + $ignore_is_open = TRUE; + + //noparse + elseif( strpos( $html, '{noparse}' ) !== FALSE ) + $comment_is_open = TRUE; + + //include tag + elseif( preg_match( '/{include="([^"]*)"}/', $html, $matches ) ){ + + //variables substitution + $include_var = self::var_replace( $matches[ 1 ], $left_delimiter = NULL, $right_delimiter = NULL, $php_left_delimiter = '".' , $php_right_delimiter = '."', $loop_level ); + + //dynamic include + $parsed_code .= 'assign( "key", $key'.$loop_level.' ); $tpl->assign( "value", $value'.$loop_level.' );' ) . + 'use Rain\\TPL; + echo Rain\\TPL::draw( dirname("'.$include_var.'") . ( substr("'.$include_var.'",-1,1) != "/" ? "/" : "" ) . basename("'.$include_var.'"), $variables );'. + '?>'; + + } + + //loop + elseif( preg_match( '/{loop(?: name){0,1}="\${0,1}([^"]*)"}/', $html, $matches ) ){ + + //increase the loop counter + $loop_level++; + + //replace the variable in the loop + $var = self::var_replace( '$' . $matches[ 1 ], $tag_left_delimiter=NULL, $tag_right_delimiter=NULL, $php_left_delimiter=NULL, $php_right_delimiter=NULL, $loop_level-1 ); + + //loop variables + $counter = "\$counter$loop_level"; // count iteration + $key = "\$key$loop_level"; // key + $value = "\$value$loop_level"; // value + + //loop code + $parsed_code .= " $value ){ $counter++; ?>"; + + } + + //close loop tag + elseif( strpos( $html, '{/loop}' ) !== FALSE ) { + + //iterator + $counter = "\$counter$loop_level"; + + //decrease the loop counter + $loop_level--; + + //close loop code + $parsed_code .= ""; + + } + + //if + elseif( preg_match( '/{if(?: condition){0,1}="([^"]*)"}/', $html, $matches ) ){ + + //increase open if counter (for intendation) + $open_if++; + + //tag + $tag = $matches[ 0 ]; + + //condition attribute + $condition = $matches[ 1 ]; + + //variable substitution into condition (no delimiter into the condition) + $parsed_condition = self::var_replace( $condition, $tag_left_delimiter = NULL, $tag_right_delimiter = NULL, $php_left_delimiter = NULL, $php_right_delimiter = NULL, $loop_level ); + + //if code + $parsed_code .= ""; + + } + + //elseif + elseif( preg_match( '/{elseif(?: condition){0,1}="([^"]*)"}/', $html, $matches ) ){ + + //tag + $tag = $matches[ 0 ]; + + //condition attribute + $condition = $matches[ 1 ]; + + //variable substitution into condition (no delimiter into the condition) + $parsed_condition = self::var_replace( $condition, $tag_left_delimiter = NULL, $tag_right_delimiter = NULL, $php_left_delimiter = NULL, $php_right_delimiter = NULL, $loop_level ); + + //elseif code + $parsed_code .= ""; + } + + //else + elseif( strpos( $html, '{else}' ) !== FALSE ) { + + //else code + $parsed_code .= ''; + + } + + //close if tag + elseif( strpos( $html, '{/if}' ) !== FALSE ) { + + //decrease if counter + $open_if--; + + // close if code + $parsed_code .= ''; + + } + + //function + elseif( preg_match( '/{function="(\w*)(.*?)"}/', $html, $matches ) ){ + + //tag + $tag = $matches[ 0 ]; + + //function + $function = $matches[ 1 ]; + + if( empty( $matches[ 2 ] ) ) + $parsed_function = $function . "()"; + else + // parse the function + $parsed_function = $function . self::var_replace( $matches[ 2 ], $tag_left_delimiter = NULL, $tag_right_delimiter = NULL, $php_left_delimiter = NULL, $php_right_delimiter = NULL, $loop_level ); + + //if code + $parsed_code .= ""; + } + + // show all vars + elseif ( strpos( $html, '{$template_info}' ) !== FALSE ) { + + //tag + $tag = '{$template_info}'; + + //if code + $parsed_code .= '" . print_r( self::$var, 1 ) . ""; ?>'; + } + + + //all html code + else{ + + //variables substitution (es. {$title}) + $html = self::var_replace( $html, $left_delimiter = '{', $right_delimiter = '}', $php_left_delimiter = '', $loop_level, $echo = TRUE ); + //const substitution (es. {#CONST#}) + $html = self::const_replace( $html, $left_delimiter = '{', $right_delimiter = '}', $php_left_delimiter = '', $loop_level, $echo = TRUE ); + //functions substitution (es. {"string"|functions}) + $parsed_code .= self::func_replace( $html, $left_delimiter = '{', $right_delimiter = '}', $php_left_delimiter = '', $loop_level, $echo = TRUE ); + } + } + + if( $open_if > 0 ) { + $e = new RainTpl_SyntaxException('Error! You need to close an {if} tag in ' . $template_filepath . ' template'); + throw $e->setTemplateFile($template_filepath); + } + return $parsed_code; + } + + + + /** + * replace the path of image src, link href and a href. + * url => template_dir/url + * url# => url + * http://url => http://url + * + * @param string $html + * @return string html sostituito + */ + protected function path_replace( $html, $template_basedir ){ + + if( self::$path_replace ){ + + // get the template base directory + $template_directory = self::$base_url . self::$tpl_dir . $template_basedir; + + // reduce the path + $path = preg_replace('/\w+\/\.\.\//', '', $template_directory ); + + $exp = $sub = array(); + + if( in_array( "img", self::$path_replace_list ) ){ + $exp = array( '/title) + $temp = preg_split( "/\.|\[|\-\>/", $var ); + + //variable name + $var_name = $temp[ 0 ]; + + //variable path + $variable_path = substr( $var, strlen( $var_name ) ); + + //parentesis transform [ e ] in [" e in "] + $variable_path = str_replace( '[', '["', $variable_path ); + $variable_path = str_replace( ']', '"]', $variable_path ); + + //transform .$variable in ["$variable"] + $variable_path = preg_replace('/\.\$(\w+)/', '["$\\1"]', $variable_path ); + + //transform [variable] in ["variable"] + $variable_path = preg_replace('/\.(\w+)/', '["\\1"]', $variable_path ); + + //if there's a function + if( $function_var ){ + + // check if there's a function or a static method and separate, function by parameters + $function_var = str_replace("::", "@double_dot@", $function_var ); + + // get the position of the first : + if( $dot_position = strpos( $function_var, ":" ) ){ + + // get the function and the parameters + $function = substr( $function_var, 0, $dot_position ); + $params = substr( $function_var, $dot_position+1 ); + + } + else{ + + //get the function + $function = str_replace( "@double_dot@", "::", $function_var ); + $params = NULL; + + } + + // replace back the @double_dot@ with :: + $function = str_replace( "@double_dot@", "::", $function ); + $params = str_replace( "@double_dot@", "::", $params ); + + + } + else + $function = $params = NULL; + + $php_var = $var_name . $variable_path; + + // compile the variable for php + if( isset( $function ) ){ + if( $php_var ) + $php_var = $php_left_delimiter . ( !$is_init_variable && $echo ? 'echo ' : NULL ) . ( $params ? "( $function( $php_var, $params ) )" : "$function( $php_var )" ) . $php_right_delimiter; + else + $php_var = $php_left_delimiter . ( !$is_init_variable && $echo ? 'echo ' : NULL ) . ( $params ? "( $function( $params ) )" : "$function()" ) . $php_right_delimiter; + } + else + $php_var = $php_left_delimiter . ( !$is_init_variable && $echo ? 'echo ' : NULL ) . $php_var . $extra_var . $php_right_delimiter; + + $html = str_replace( $tag, $php_var, $html ); + + } + + return $html; + + } + + + + function var_replace( $html, $tag_left_delimiter, $tag_right_delimiter, $php_left_delimiter = NULL, $php_right_delimiter = NULL, $loop_level = NULL, $echo = NULL ){ + + //all variables + if( preg_match_all( '/' . $tag_left_delimiter . '\$(\w+(?:\.\${0,1}[A-Za-z0-9_]+)*(?:(?:\[\${0,1}[A-Za-z0-9_]+\])|(?:\-\>\${0,1}[A-Za-z0-9_]+))*)(.*?)' . $tag_right_delimiter . '/', $html, $matches ) ){ + + for( $parsed=array(), $i=0, $n=count($matches[0]); $i<$n; $i++ ) + $parsed[$matches[0][$i]] = array('var'=>$matches[1][$i],'extra_var'=>$matches[2][$i]); + + foreach( $parsed as $tag => $array ){ + + //variable name ex: news.title + $var = $array['var']; + + //function and parameters associate to the variable ex: substr:0,100 + $extra_var = $array['extra_var']; + + // check if there's any function disabled by black_list + self::function_check( $tag ); + + $extra_var = self::var_replace( $extra_var, NULL, NULL, NULL, NULL, $loop_level ); + + // check if there's an operator = in the variable tags, if there's this is an initialization so it will not output any value + $is_init_variable = preg_match( "/^[a-z_A-Z\.\[\](->)]*\s*=\s*[^=]*$/", $extra_var ); + + //function associate to variable + $function_var = ( $extra_var and $extra_var[0] == '|') ? substr( $extra_var, 1 ) : NULL; + + //variable path split array (ex. $news.title o $news[title]) or object (ex. $news->title) + $temp = preg_split( "/\.|\[|->/", $var ); + + //variable name + $var_name = $temp[ 0 ]; + + //variable path + $variable_path = substr( $var, strlen( $var_name ) ); + + //parentesis transform [ e ] in [" e in "] + $variable_path = str_replace( '[', '["', $variable_path ); + $variable_path = str_replace( ']', '"]', $variable_path ); + + //transform .$variable in ["$variable"] and .variable in ["variable"] + $variable_path = preg_replace('/\.(\${0,1}\w+)/', '["\\1"]', $variable_path ); + + // if is an assignment also assign the variable to self::var['value'] + if( $is_init_variable ) + $extra_var = "=\${$var_name}{$variable_path}" . $extra_var; + + + + //if there's a function + if( $function_var ){ + + // check if there's a function or a static method and separate, function by parameters + $function_var = str_replace("::", "@double_dot@", $function_var ); + + + // get the position of the first : + if( $dot_position = strpos( $function_var, ":" ) ){ + + // get the function and the parameters + $function = substr( $function_var, 0, $dot_position ); + $params = substr( $function_var, $dot_position+1 ); + + } + else{ + + //get the function + $function = str_replace( "@double_dot@", "::", $function_var ); + $params = NULL; + + } + + // replace back the @double_dot@ with :: + $function = str_replace( "@double_dot@", "::", $function ); + $params = str_replace( "@double_dot@", "::", $params ); + } + else + $function = $params = NULL; + + //if it is inside a loop + if( $loop_level ){ + //verify the variable name + if( $var_name == 'key' ) + $php_var = '$key' . $loop_level; + elseif( $var_name == 'value' ) + $php_var = '$value' . $loop_level . $variable_path; + elseif( $var_name == 'counter' ) + $php_var = '$counter' . $loop_level; + else + $php_var = '$' . $var_name . $variable_path; + }else + $php_var = '$' . $var_name . $variable_path; + + // compile the variable for php + if( isset( $function ) ) + $php_var = $php_left_delimiter . ( !$is_init_variable && $echo ? 'echo ' : NULL ) . ( $params ? "( $function( $php_var, $params ) )" : "$function( $php_var )" ) . $php_right_delimiter; + else + $php_var = $php_left_delimiter . ( !$is_init_variable && $echo ? 'echo ' : NULL ) . $php_var . $extra_var . $php_right_delimiter; + + $html = str_replace( $tag, $php_var, $html ); + + + } + } + + return $html; + } + + + + /** + * Check if function is in black list (sandbox) + * + * @param string $code + * @param string $tag + */ + protected function function_check( $code ){ + + $preg = '#(\W|\s)' . implode( '(\W|\s)|(\W|\s)', self::$black_list ) . '(\W|\s)#'; + + // check if the function is in the black list (or not in white list) + if( count(self::$black_list) && preg_match( $preg, $code, $match ) ){ + + // find the line of the error + $line = 0; + $rows=explode("\n",$this->tpl['source']); + while( !strpos($rows[$line],$code) ) + $line++; + + // stop the execution of the script + $e = new RainTpl_SyntaxException('Unallowed syntax in ' . $this->tpl['tpl_filename'] . ' template'); + throw $e->setTemplateFile($this->tpl['tpl_filename']) + ->setTag($code) + ->setTemplateLine($line); + } + + } + + +} \ No newline at end of file diff --git a/system/library/View/Rain/TplCompileTwig.php b/system/library/View/Rain/TplCompileTwig.php new file mode 100755 index 0000000..ef4a1ee --- /dev/null +++ b/system/library/View/Rain/TplCompileTwig.php @@ -0,0 +1,571 @@ + $value ){ + if( property_exists( __CLASS__, $key ) ){ + self::$$key = $value; + } + } + } + + /** + * Compile template + * @access protected + */ + static function _compileTemplate( $code, $template_basedir ){ + + //tag list + $tag_regexp = array( 'for' => '(\{% for ([a-zA-Z0-9_]*) in ([a-zA-Z0-9_]*) %\})', + 'endfor' => '(\{% endfor %\})', + 'if' => '(\{if(?: condition){0,1}="[^"]*"\})', + 'elseif' => '(\{elseif(?: condition){0,1}="[^"]*"\})', + 'else' => '(\{else\})', + 'if_close' => '(\{\/if\})', + 'function' => '(\{function="[^"]*"\})', + 'noparse' => '(\{noparse\})', + 'noparse_close'=> '(\{\/noparse\})', + 'ignore' => '(\{ignore\})', + 'ignore_close' => '(\{\/ignore\})', + 'include' => '(\{include="[^"]*"?\})', + 'template_info'=> '(\{\$template_info\})', + 'function' => '(\{function="(\w*?)(?:.*?)"\})' + ); + + $tag_regexp = "/" . join( "|", $tag_regexp ) . "/"; + + //split the code with the tags regexp + $code = preg_split ( $tag_regexp, $code, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY ); + + //path replace (src of img, background and href of link) + $code = self::path_replace( $code, $template_basedir ); + + //compile the code + $compiled_code = self::compileCode( $code ); + + //return the compiled code + return $compiled_code; + + } + + + + /** + * Compile the code + * @access protected + */ + protected function compileCode( $parsed_code ){ + + //variables initialization + $compiled_code = $open_if = $comment_is_open = $ignore_is_open = null; + $loop_level = 0; + + //read all parsed code + while( $html = array_shift( $parsed_code ) ){ + + //close ignore tag + if( !$comment_is_open && strpos( $html, '{/ignore}' ) !== FALSE ) + $ignore_is_open = false; + + //code between tag ignore id deleted + elseif( $ignore_is_open ){ + //ignore the code + } + + //close no parse tag + elseif( strpos( $html, '{/noparse}' ) !== FALSE ) + $comment_is_open = false; + + //code between tag noparse is not compiled + elseif( $comment_is_open ) + $compiled_code .= $html; + + //ignore + elseif( strpos( $html, '{ignore}' ) !== FALSE ) + $ignore_is_open = true; + + //noparse + elseif( strpos( $html, '{noparse}' ) !== FALSE ) + $comment_is_open = true; + + //include tag + elseif( preg_match( '/\{include="([^"]*)"\}/', $html, $code ) ){ + + //variables substitution + $include_var = self::var_replace( $code[ 1 ], $left_delimiter = null, $right_delimiter = null, $php_left_delimiter = '".' , $php_right_delimiter = '."', $loop_level ); + + + //dynamic include + $compiled_code .= 'assign( $variables );' . + ( !$loop_level ? null : '$tpl->assign( "key", $key'.$loop_level.' ); $tpl->assign( "value", $value'.$loop_level.' );' ). + '$tpl->draw( dirname("'.$include_var.'") . ( substr("'.$include_var.'",-1,1) != "/" ? "/" : "" ) . basename("'.$include_var.'") );'. + '?>'; + + } + + //loop + elseif( preg_match( '/\{loop(?: name){0,1}="\${0,1}([^"]*)"\}/', $html, $code ) ){ + + //increase the loop counter + $loop_level++; + + //replace the variable in the loop + $var = self::var_replace( '$' . $code[ 1 ], $tag_left_delimiter=null, $tag_right_delimiter=null, $php_left_delimiter=null, $php_right_delimiter=null, $loop_level-1 ); + + //loop variables + $counter = "\$counter$loop_level"; // count iteration + $key = "\$key$loop_level"; // key + $value = "\$value$loop_level"; // value + + //loop code + $compiled_code .= " $value ){ $counter++; ?>"; + + } + + //close loop tag + elseif( strpos( $html, '{/loop}' ) !== FALSE ) { + + //iterator + $counter = "\$counter$loop_level"; + + //decrease the loop counter + $loop_level--; + + //close loop code + $compiled_code .= ""; + + } + + //if + elseif( preg_match( '/\{if(?: condition){0,1}="([^"]*)"\}/', $html, $code ) ){ + + //increase open if counter (for intendation) + $open_if++; + + //tag + $tag = $code[ 0 ]; + + //condition attribute + $condition = $code[ 1 ]; + + //variable substitution into condition (no delimiter into the condition) + $parsed_condition = self::var_replace( $condition, $tag_left_delimiter = null, $tag_right_delimiter = null, $php_left_delimiter = null, $php_right_delimiter = null, $loop_level ); + + //if code + $compiled_code .= ""; + + } + + //elseif + elseif( preg_match( '/\{elseif(?: condition){0,1}="([^"]*)"\}/', $html, $code ) ){ + + //tag + $tag = $code[ 0 ]; + + //condition attribute + $condition = $code[ 1 ]; + + //variable substitution into condition (no delimiter into the condition) + $parsed_condition = self::var_replace( $condition, $tag_left_delimiter = null, $tag_right_delimiter = null, $php_left_delimiter = null, $php_right_delimiter = null, $loop_level ); + + //elseif code + $compiled_code .= ""; + } + + //else + elseif( strpos( $html, '{else}' ) !== FALSE ) { + + //else code + $compiled_code .= ''; + + } + + //close if tag + elseif( strpos( $html, '{/if}' ) !== FALSE ) { + + //decrease if counter + $open_if--; + + // close if code + $compiled_code .= ''; + + } + + //function + elseif( preg_match( '/\{function="(\w*)(.*?)"\}/', $html, $code ) ){ + + //tag + $tag = $code[ 0 ]; + + //function + $function = $code[ 1 ]; + + if( empty( $code[ 2 ] ) ) + $parsed_function = $function . "()"; + else + // parse the function + $parsed_function = $function . self::var_replace( $code[ 2 ], $tag_left_delimiter = null, $tag_right_delimiter = null, $php_left_delimiter = null, $php_right_delimiter = null, $loop_level ); + + //if code + $compiled_code .= ""; + } + + // show all vars + elseif ( strpos( $html, '{$template_info}' ) !== FALSE ) { + + //tag + $tag = '{$template_info}'; + + //if code + $compiled_code .= '"; print_r( self::var ); echo ""; ?>'; + } + + + //all html code + else{ + + //variables substitution (es. {$title}) + $html = self::var_replace( $html, $left_delimiter = '\{\{', $right_delimiter = '\}\}', $php_left_delimiter = '', $loop_level, $echo = true ); + //const substitution (es. {#CONST#}) + $html = self::const_replace( $html, $left_delimiter = '\{', $right_delimiter = '\}', $php_left_delimiter = '', $loop_level, $echo = true ); + //functions substitution (es. {"string"|functions}) + $compiled_code .= self::func_replace( $html, $left_delimiter = '\{', $right_delimiter = '\}', $php_left_delimiter = '', $loop_level, $echo = true ); + } + } + + if( $open_if > 0 ) { + $e = new RainTpl_SyntaxException('Error! You need to close an {if} tag in ' . $template_filepath . ' template'); + throw $e->setTemplateFile($template_filepath); + } + return $compiled_code; + } + + + + /** + * replace the path of image src, link href and a href. + * url => template_dir/url + * url# => url + * http://url => http://url + * + * @param string $html + * @return string html sostituito + */ + protected function path_replace( $html, $template_basedir ){ + + if( self::$path_replace ){ + + $template_directory = self::$base_url . self::$tpl_dir . $template_basedir; + + // reduce the path + $path = preg_replace('/\w+\/\.\.\//', '', $template_directory ); + + $exp = $sub = array(); + + if( in_array( "img", self::$path_replace_list ) ){ + $exp = array( '/title) + $temp = preg_split( "/\.|\[|\-\>/", $var ); + + //variable name + $var_name = $temp[ 0 ]; + + //variable path + $variable_path = substr( $var, strlen( $var_name ) ); + + //parentesis transform [ e ] in [" e in "] + $variable_path = str_replace( '[', '["', $variable_path ); + $variable_path = str_replace( ']', '"]', $variable_path ); + + //transform .$variable in ["$variable"] + $variable_path = preg_replace('/\.\$(\w+)/', '["$\\1"]', $variable_path ); + + //transform [variable] in ["variable"] + $variable_path = preg_replace('/\.(\w+)/', '["\\1"]', $variable_path ); + + //if there's a function + if( $function_var ){ + + // check if there's a function or a static method and separate, function by parameters + $function_var = str_replace("::", "@double_dot@", $function_var ); + + // get the position of the first : + if( $dot_position = strpos( $function_var, ":" ) ){ + + // get the function and the parameters + $function = substr( $function_var, 0, $dot_position ); + $params = substr( $function_var, $dot_position+1 ); + + } + else{ + + //get the function + $function = str_replace( "@double_dot@", "::", $function_var ); + $params = null; + + } + + // replace back the @double_dot@ with :: + $function = str_replace( "@double_dot@", "::", $function ); + $params = str_replace( "@double_dot@", "::", $params ); + + + } + else + $function = $params = null; + + $php_var = $var_name . $variable_path; + + // compile the variable for php + if( isset( $function ) ){ + if( $php_var ) + $php_var = $php_left_delimiter . ( !$is_init_variable && $echo ? 'echo ' : null ) . ( $params ? "( $function( $php_var, $params ) )" : "$function( $php_var )" ) . $php_right_delimiter; + else + $php_var = $php_left_delimiter . ( !$is_init_variable && $echo ? 'echo ' : null ) . ( $params ? "( $function( $params ) )" : "$function()" ) . $php_right_delimiter; + } + else + $php_var = $php_left_delimiter . ( !$is_init_variable && $echo ? 'echo ' : null ) . $php_var . $extra_var . $php_right_delimiter; + + $html = str_replace( $tag, $php_var, $html ); + + } + + return $html; + + } + + + + function var_replace( $html, $tag_left_delimiter, $tag_right_delimiter, $php_left_delimiter = null, $php_right_delimiter = null, $loop_level = null, $echo = null ){ + + //all variables + if( preg_match_all( '/' . $tag_left_delimiter . '([a-zA-Z0-9_]+)' . $tag_right_delimiter . '/', $html, $matches ) ){ + + for( $parsed=array(), $i=0, $n=count($matches[0]); $i<$n; $i++ ) + $parsed[$matches[0][$i]] = array('var'=>$matches[1][$i],'extra_var'=>$matches[2][$i]); + + foreach( $parsed as $tag => $array ){ + + //variable name ex: news.title + $var = $array['var']; + + //function and parameters associate to the variable ex: substr:0,100 + $extra_var = $array['extra_var']; + + // check if there's any function disabled by black_list + self::function_check( $tag ); + + $extra_var = self::var_replace( $extra_var, null, null, null, null, $loop_level ); + + // check if there's an operator = in the variable tags, if there's this is an initialization so it will not output any value + $is_init_variable = preg_match( "/^[a-z_A-Z\.\[\](\-\>)]*=[^=]*$/", $extra_var ); + + //function associate to variable + $function_var = ( $extra_var and $extra_var[0] == '|') ? substr( $extra_var, 1 ) : null; + + //variable path split array (ex. $news.title o $news[title]) or object (ex. $news->title) + $temp = preg_split( "/\.|\[|\-\>/", $var ); + + //variable name + $var_name = $temp[ 0 ]; + + //variable path + $variable_path = substr( $var, strlen( $var_name ) ); + + //parentesis transform [ e ] in [" e in "] + $variable_path = str_replace( '[', '["', $variable_path ); + $variable_path = str_replace( ']', '"]', $variable_path ); + + //transform .$variable in ["$variable"] and .variable in ["variable"] + $variable_path = preg_replace('/\.(\${0,1}\w+)/', '["\\1"]', $variable_path ); + + // if is an assignment also assign the variable to self::var['value'] + if( $is_init_variable ) + $extra_var = "=\$variables['{$var_name}']{$variable_path}" . $extra_var; + + + + //if there's a function + if( $function_var ){ + + // check if there's a function or a static method and separate, function by parameters + $function_var = str_replace("::", "@double_dot@", $function_var ); + + + // get the position of the first : + if( $dot_position = strpos( $function_var, ":" ) ){ + + // get the function and the parameters + $function = substr( $function_var, 0, $dot_position ); + $params = substr( $function_var, $dot_position+1 ); + + } + else{ + + //get the function + $function = str_replace( "@double_dot@", "::", $function_var ); + $params = null; + + } + + // replace back the @double_dot@ with :: + $function = str_replace( "@double_dot@", "::", $function ); + $params = str_replace( "@double_dot@", "::", $params ); + } + else + $function = $params = null; + + //if it is inside a loop + if( $loop_level ){ + //verify the variable name + if( $var_name == 'key' ) + $php_var = '$key' . $loop_level; + elseif( $var_name == 'value' ) + $php_var = '$value' . $loop_level . $variable_path; + elseif( $var_name == 'counter' ) + $php_var = '$counter' . $loop_level; + else + $php_var = '$' . $var_name . $variable_path; + }else + $php_var = '$' . $var_name . $variable_path; + + // compile the variable for php + if( isset( $function ) ) + $php_var = $php_left_delimiter . ( !$is_init_variable && $echo ? 'echo ' : null ) . ( $params ? "( $function( $php_var, $params ) )" : "$function( $php_var )" ) . $php_right_delimiter; + else + $php_var = $php_left_delimiter . ( !$is_init_variable && $echo ? 'echo ' : null ) . $php_var . $extra_var . $php_right_delimiter; + + $html = str_replace( $tag, $php_var, $html ); + + + } + } + + return $html; + } + + + + /** + * Check if function is in black list (sandbox) + * + * @param string $code + * @param string $tag + */ + protected function function_check( $code ){ + + $preg = '#(\W|\s)' . implode( '(\W|\s)|(\W|\s)', self::$black_list ) . '(\W|\s)#'; + + // check if the function is in the black list (or not in white list) + if( count(self::$black_list) && preg_match( $preg, $code, $match ) ){ + + // find the line of the error + $line = 0; + $rows=explode("\n",$this->tpl['source']); + while( !strpos($rows[$line],$code) ) + $line++; + + // stop the execution of the script + $e = new RainTpl_SyntaxException('Unallowed syntax in ' . $this->tpl['tpl_filename'] . ' template'); + throw $e->setTemplateFile($this->tpl['tpl_filename']) + ->setTag($code) + ->setTemplateLine($line); + } + + } + + +} \ No newline at end of file diff --git a/Rain/library/View/Raintpl_View.php b/system/library/View/Raintpl_View.php old mode 100644 new mode 100755 similarity index 100% rename from Rain/library/View/Raintpl_View.php rename to system/library/View/Raintpl_View.php diff --git a/Rain/library/View/rain.tpl.class.php b/system/library/View/rain.tpl.class.php similarity index 98% rename from Rain/library/View/rain.tpl.class.php rename to system/library/View/rain.tpl.class.php index acfea8a..1cea077 100755 --- a/Rain/library/View/rain.tpl.class.php +++ b/system/library/View/rain.tpl.class.php @@ -411,10 +411,8 @@ private function compileCode( $parsed_code ){ 'else{ ' . '$tpl_dir_temp = self::$tpl_dir;' . '$tpl->assign( $this->var );' . - 'self::$tpl_dir .= dirname("'.$include_var.'") . ( substr("'.$include_var.'",-1,1) != "/" ? "/" : "" );' . ( !$loop_level ? null : '$tpl->assign( "key", $key'.$loop_level.' ); $tpl->assign( "value", $value'.$loop_level.' );' ). - '$tpl->draw( $template );'. - 'self::$tpl_dir = $tpl_dir_temp;' . + '$tpl->draw( dirname("'.$include_var.'") . ( substr("'.$include_var.'",-1,1) != "/" ? "/" : "" ) . $template );'. '}' . '?>'; else @@ -422,10 +420,8 @@ private function compileCode( $parsed_code ){ $compiled_code .= 'assign( $this->var );' . - 'self::$tpl_dir .= dirname("'.$include_var.'") . ( substr("'.$include_var.'",-1,1) != "/" ? "/" : "" );' . ( !$loop_level ? null : '$tpl->assign( "key", $key'.$loop_level.' ); $tpl->assign( "value", $value'.$loop_level.' );' ). - '$tpl->draw( basename("'.$include_var.'") );'. - 'self::$tpl_dir = $tpl_dir_temp;' . + '$tpl->draw( dirname("'.$include_var.'") . ( substr("'.$include_var.'",-1,1) != "/" ? "/" : "" ) . basename("'.$include_var.'") );'. '?>'; } diff --git a/Rain/library/error.functions.php b/system/library/error.functions.php similarity index 80% rename from Rain/library/error.functions.php rename to system/library/error.functions.php index 4e0886c..903d1af 100755 --- a/Rain/library/error.functions.php +++ b/system/library/error.functions.php @@ -48,18 +48,22 @@ // errors name $error_levels = array( - E_USER_NOTICE => 'User Notice', - E_USER_WARNING => 'User Warning', - E_USER_ERROR => 'User Error', - E_COMPILE_WARNING => 'Compile warning', - E_COMPILE_ERROR => 'Compile Error', - E_CORE_WARNING => 'Core Warning', - E_CORE_ERROR => 'Core Error', - E_NOTICE => 'Notice', - E_WARNING => 'Warning', - E_ERROR => 'Error', - E_STRICT => 'Strict' - ); + E_ERROR => 'Error', + E_WARNING => 'Warning', + E_PARSE => 'Warning', + E_NOTICE => 'Notice', + E_CORE_ERROR => 'Core Error', + E_CORE_WARNING => 'Core Warning', + E_COMPILE_ERROR => 'Compile Error', + E_COMPILE_WARNING => 'Compile warning', + E_USER_ERROR => 'User Error', + E_USER_WARNING => 'User Warning', + E_USER_NOTICE => 'User Notice', + E_STRICT => 'Strict', + E_RECOVERABLE_ERROR => 'Cachable fatal error', + E_DEPRECATED => 'Deprecated', + E_USER_DEPRECATED => 'User deprecated', + ); /** diff --git a/Rain/library/functions.php b/system/library/functions.php old mode 100644 new mode 100755 similarity index 64% rename from Rain/library/functions.php rename to system/library/functions.php index 8fce695..b1480a3 --- a/Rain/library/functions.php +++ b/system/library/functions.php @@ -28,10 +28,10 @@ * Get GET input */ function get( $key = null, $filter = FILTER_SANITIZE_MAGIC_QUOTES ){ - if( !$key ) - return $filter ? filter_input_array( INPUT_GET, $filter ) : $_GET; - if( isset($_GET[$key]) ) - return $filter ? filter_input(INPUT_GET, $key, $filter ) : $_GET[$key]; + if( !$key ) + return $filter ? filter_input_array( INPUT_GET, $filter ) : $_GET; + if( isset($_GET[$key]) ) + return $filter ? filter_input(INPUT_GET, $key, $filter ) : $_GET[$key]; } @@ -39,8 +39,8 @@ function get( $key = null, $filter = FILTER_SANITIZE_MAGIC_QUOTES ){ * Get POST input */ function post( $key = null, $filter = FILTER_SANITIZE_MAGIC_QUOTES ){ - if( !$key ) - return $filter ? filter_input_array( INPUT_POST, $filter ) : $_POST; + if( !$key ) + return $filter ? filter_input_array( INPUT_POST, $filter ) : $_POST; if( isset($_POST[$key]) ) return $filter ? filter_input(INPUT_POST, $key, $filter ) : $_POST[$key]; } @@ -51,12 +51,14 @@ function post( $key = null, $filter = FILTER_SANITIZE_MAGIC_QUOTES ){ * Get GET_POST input */ function get_post( $key = null, $filter = FILTER_SANITIZE_MAGIC_QUOTES ){ - if( !isset($GLOBALS['_GET_POST'] ) ) - $GLOBALS['_GET_POST'] = $_GET + $_POST; - if( !$key ) - return $filter ? filter_input_array( $GLOBALS['_GET_POST'], $filter ) : $GLOBALS['_GET_POST']; + + if( !isset($GLOBALS['_GET_POST'] ) ) + $GLOBALS['_GET_POST'] = $_GET + $_POST; + if( !$key ) + return $filter ? filter_input_array( $GLOBALS['_GET_POST'], $filter ) : $GLOBALS['_GET_POST']; + if( isset($GLOBALS['_GET_POST'][$key] ) ) - return $filter ? filter_input(INPUT_GET & INPUT_POST, $key, $filter ) : $GLOBALS['_GET_POST'][$key]; + return $filter ? filter_var($GLOBALS['_GET_POST'][$key], $filter ) : $GLOBALS['_GET_POST'][$key]; } @@ -92,7 +94,7 @@ function dump( $mixed, $exit = 1 ){ * Save the memory used at this point */ function memory_usage_start( $memName = "execution_time" ){ - return $GLOBALS['memoryCounter'][$memName] = memory_get_usage(); + return $GLOBALS['memoryCounter'][$memName] = memory_get_usage(); } @@ -101,8 +103,8 @@ function memory_usage_start( $memName = "execution_time" ){ * Get the memory used */ function memory_usage( $memName = "execution_time", $byte_format = true ){ - $totMem = memory_get_usage() - $GLOBALS['memoryCounter'][ $memName ]; - return $byte_format ? byte_format($totMem) : $totMem; + $totMem = memory_get_usage() - $GLOBALS['memoryCounter'][ $memName ]; + return $byte_format ? byte_format($totMem) : $totMem; } @@ -117,16 +119,16 @@ function memory_usage( $memName = "execution_time", $byte_format = true ){ */ function timer_start( $timeName = "execution_time" ){ $stimer = explode( ' ', microtime( ) ); - $GLOBALS['timeCounter'][$timeName] = $stimer[ 1 ] + $stimer[ 0 ]; + $GLOBALS['timeCounter'][$timeName] = $stimer[ 1 ] + $stimer[ 0 ]; } /** * Get the time passed */ function timer( $timeName = "execution_time", $precision = 6 ){ - $etimer = explode( ' ', microtime( ) ); - $timeElapsed = $etimer[ 1 ] + $etimer[ 0 ] - $GLOBALS['timeCounter'][ $timeName ]; - return substr( $timeElapsed, 0, $precision ); + $etimer = explode( ' ', microtime( ) ); + $timeElapsed = $etimer[ 1 ] + $etimer[ 0 ] - $GLOBALS['timeCounter'][ $timeName ]; + return substr( $timeElapsed, 0, $precision ); } /** @@ -163,6 +165,7 @@ function time_elapsed( $time = null, $format ){ return ceil($diff/DAY) . " " . get_msg('days_ago') . " " . strftime( TIME_FORMAT, $time ); else return strftime( $format, $time ); + } @@ -202,8 +205,6 @@ function sec_to_string($sec) { // //------------------------------------------------------------- - - /** * Cut html * text, length, ending, tag allowed, $remove_image true / false, $exact true=the ending words are not cutted @@ -306,13 +307,13 @@ function cut( $string, $length, $ending = "..." ){ * Return a random string */ function rand_str($length = 5, $chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890'){ - $chars_length = (strlen($chars) - 1); - $string = $chars{rand(0, $chars_length)}; - for ($i = 1; $i < $length; $i = strlen($string)){ - $r = $chars{rand(0, $chars_length)}; - if ($r != $string{$i - 1}) $string .= $r; - } - return $string; + $chars_length = (strlen($chars) - 1); + $string = $chars{rand(0, $chars_length)}; + for ($i = 1; $i < $length; $i = strlen($string)){ + $r = $chars{rand(0, $chars_length)}; + if ($r != $string{$i - 1}) $string .= $r; + } + return $string; } @@ -325,14 +326,14 @@ function rand_str($length = 5, $chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklm /** * Convert byte to more readable format, like "1 KB" instead of "1024". - * cut_zero, remove the 0 after comma ex: 10,00 => 10 14,30 => 14,3 + * cut_zero, remove the 0 after comma ex: 10,00 => 10 14,30 => 14,3 */ function byte_format( $size ){ if( $size > 0 ){ - $unim = array("B","KB","MB","GB","TB","PB"); - for( $i=0; $size >= 1024; $i++ ) - $size = $size / 1024; - return number_format($size,$i?2:0,DEC_POINT,THOUSANDS_SEP)." ".$unim[$i]; + $unim = array("B","KB","MB","GB","TB","PB"); + for( $i=0; $size >= 1024; $i++ ) + $size = $size / 1024; + return number_format($size,$i?2:0, DEC_POINT, THOUSANDS_SEP )." ".$unim[$i]; } } @@ -355,10 +356,10 @@ function format_money( $number, $add_currency = false ){ /** - * Return true if the email is valid + * Return true if the email is valid else false */ - function is_email( $string ){ - return eregi( "^[[:alnum:]][a-z0-9_.-]*@[a-z0-9.-]+\.[a-z]{2,4}$", $string ); + function is_email( $email ){ + return preg_match('|^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$|i', $email ); } /** @@ -367,7 +368,7 @@ function is_email( $string ){ */ function email_send( $to, $subject, $body, $from = null, $from_name = null, $attachment = null, $embed_images = false ){ - // TO DO: use the email class + // TO DO: use the email class } @@ -474,14 +475,15 @@ function dir_copy( $source, $dest) { /** * Upload one file selected with $file. Use it when you pass only one file with a form. - * The file is saved into UPS_DIR, the name created as "md5(time()) . file_extension" + * The file is saved into UPLOADS_DIR, the name created as "md5(time()) . file_extension" * it return the filename * * @return string uploaded filename */ function upload_file($file){ if( $_FILES[$file]["tmp_name"] ){ - move_uploaded_file( $_FILES[$file]["tmp_name"], UPS_DIR . ( $filename = md5(time()).".".( strtolower( file_ext($_FILES[$file]['name'] ) ) ) ) ); + $upload_filepath = UPLOADS_DIR . ( $filename = md5(time()).".".( strtolower( file_ext($_FILES[$file]['name'] ) ) ) ); + move_uploaded_file( $_FILES[$file]["tmp_name"], $upload_filepath ); return $filename; } } @@ -491,7 +493,7 @@ function upload_file($file){ * Upload an image file and create a thumbnail * * @param string $file - * @param string $upload_dir + * @param string $UPLOADS_DIR * @param string $thumb_prefix Prefisso della thumbnail * @param int $max_width * @param int $max_height @@ -500,9 +502,13 @@ function upload_file($file){ */ function upload_image( $file, $thumb_prefix = null, $max_width = 128, $max_height = 128, $square = false ){ if( $filename = upload_file( $file ) ){ - //se voglio creare la thumb e $square=true, tento di creare la thumbnails - if( $thumb_prefix && !image_resize( UPS_DIR . $filename, UPS_DIR . $thumb_prefix . $filename, $max_width, $max_height, $square ) ){ - unlink( UPS_DIR . $filename ); + + image_resize( UPLOADS_DIR . $filename, UPLOADS_DIR . $thumb_prefix . $filename, $max_width, $max_height, $square ); + return $filename; + + //try to create the thumbnail + if( $thumb_prefix && !image_resize( UPLOADS_DIR . $filename, UPLOADS_DIR . $thumb_prefix . $filename, $max_width, $max_height, $square ) ){ + unlink( UPLOADS_DIR . $filename ); return false; } return $filename; @@ -511,6 +517,18 @@ function upload_image( $file, $thumb_prefix = null, $max_width = 128, $max_heigh + function reduce_path( $path ){ + $path = str_replace( "://", "@not_replace@", $path ); + $path = preg_replace( "#(/+)#", "/", $path ); + $path = preg_replace( "#(/\./+)#", "/", $path ); + $path = str_replace( "@not_replace@", "://", $path ); + + while( preg_match( '#\.\./#', $path ) ){ + $path = preg_replace('#\w+/\.\./#', '', $path ); + } + return $path; + } + //------------------------------------------------------------- // @@ -520,71 +538,88 @@ function upload_image( $file, $thumb_prefix = null, $max_width = 128, $max_heigh - /** - * Create thumb from image - */ - function image_resize( $source, $dest, $maxx = 100, $maxy = 100, $square = false, $quality = 70 ){ + /** + * resize + */ + function image_resize($source, $dest, $new_width, $new_height, $quality) { - switch( $ext = file_eXT( $source ) ){ - case 'jpg': - case 'jpeg': $source_img = imagecreatefromjpeg( $source ); break; - case 'png': $source_img = imagecreatefrompng( $source ); break; - case 'gif': $source_img = imagecreatefromgif( $source ); break; - default: return false; - } + if( $memory_limit = get_setting('memory_limit') ){ + $old_memory_limit = ini_get('memory_limit'); + ini_set('memory_limit', $memory_limit ); + } - list($width, $height) = getimagesize( $source ); - if( $square ){ - $new_width = $new_height = $maxx; - if( $width > $height ) { - $x = ceil( ( $width - $height ) / 2 ); - $width = $height; - } else{ - $y = ceil( ( $height - $width ) / 2 ); - $height = $width; - } - } - else{ - if( $maxx != 0 && $maxy != 0 ){ - if( $maxx < $width or $maxy < $height ){ - $percent1 = $width / $maxx; - $percent2 = $height / $maxy; - $percent = max($percent1,$percent2); - $new_height = round($height/$percent); - $new_width = round($width/$percent); - } - } - elseif( $maxx == 0 && $maxy != 0 ){ - if( $height > $maxy ){ - $new_height = $maxy; - $new_width = $width * ( $maxy / $height ); - } - } - else{ - if( $width > $maxx ){ - $new_width = $maxx; - $new_height = $height * ( $maxx / $width ); - } - } - } - if( !isset($new_width) or !$new_width ) - $new_width = $width; - if( !isset($new_height) or !$new_height ) - $new_height = $height; + // increase the memory limit for resizing the image + switch ($ext = file_ext($source)) { + case 'jpg': + case 'jpeg': $source_img = imagecreatefromjpeg($source); + break; + case 'png': $source_img = imagecreatefrompng($source); + break; + case 'gif': $source_img = imagecreatefromgif($source); + break; + default: + return false; + } - $dest_img = ImageCreateTrueColor($new_width, $new_height); - imageCopyResampled( $dest_img, $source_img, 0, 0, 0, 0, $new_width, $new_height, $width, $height ); + list($width, $height) = getimagesize($source); - switch( $ext ){ - case 'png': imagepng( $dest_img, $dest, $quality ); break; - case 'gif': imagegif( $dest_img, $dest, $quality ); break; - default: imagejpeg( $dest_img, $dest, $quality ); - } + // create a new true color image + $dest_img = imagecreatetruecolor($new_width, $new_height); - imagedestroy( $source_img ); - imagedestroy( $dest_img ); - } + imagealphablending($dest_img, false); + + $origin_x = $origin_y = 0; + + $dest_canvas_color = 'ffffff'; + $dest_img_color_R = hexdec(substr($dest_canvas_color, 0, 2)); + $dest_img_color_G = hexdec(substr($dest_canvas_color, 2, 2)); + $dest_img_color_B = hexdec(substr($dest_canvas_color, 2, 2)); + + // Create a new transparent color for image + $color = imagecolorallocatealpha($dest_img, $dest_img_color_R, $dest_img_color_G, $dest_img_color_B, 127); + + // Completely fill the background of the new image with allocated color. + imagefill($dest_img, 0, 0, $color); + + // Restore transparency blending + imagesavealpha($dest_img, true); + + $src_x = $src_y = 0; + $src_w = $width; + $src_h = $height; + + + $cmp_x = $width / $new_width; + $cmp_y = $height / $new_height; + + // calculate x or y coordinate and width or height of source + if ($cmp_x > $cmp_y) { + $src_w = round($width / $cmp_x * $cmp_y); + $src_x = round(($width - ($width / $cmp_x * $cmp_y)) / 2); + } else if ($cmp_y > $cmp_x) { + $src_h = round($height / $cmp_y * $cmp_x); + $src_y = round(($height - ($height / $cmp_y * $cmp_x)) / 2); + } + + imagecopyresampled($dest_img, $source_img, $origin_x, $origin_y, $src_x, $src_y, $new_width, $new_height, $src_w, $src_h); + + switch ($ext) { + case 'png': imagepng($dest_img, $dest, ceil($quality / 10)); + break; + case 'gif': imagegif($dest_img, $dest, $quality); + break; + default: imagejpeg($dest_img, $dest, $quality); + } + + imagedestroy($source_img); + imagedestroy($dest_img); + + if( !$memory_limit ) + ini_set( 'memory_limit', $old_memory_limit ); + + return true; + } @@ -728,10 +763,14 @@ function get_lang(){ function load_lang( $file ){ require_once LANGUAGE_DIR . get_lang() . "/" . $file . ".php"; } + + function get_installed_language(){ + return dir_list(LANGUAGE_DIR); + } // draw a message styled as SUCCESS, WARNING, ERROR or INFO. See .box in style.css for the style function draw_msg( $msg, $type = SUCCESS, $close = false, $autoclose = 0 ){ - add_script("jquery/jquery.min.js" ); + add_script("jquery.min.js", JQUERY_DIR ); add_style( "box.css", CSS_DIR ); $box_id = rand(0,9999) . "_" . time(); if( $close ) @@ -765,13 +804,17 @@ function draw_msg( $msg, $type = SUCCESS, $close = false, $autoclose = 0 ){ //add style sheet - function add_style( $style_file, $dir = CSS_DIR ){ - $GLOBALS['style'][$dir . $style_file] = URL . $dir . $style_file; + function add_style( $file, $dir = CSS_DIR, $url = null ){ + if( !$url ) + $url = URL . $dir; + $GLOBALS['style'][$dir . $file] = $url . $file; } //add javascript file - function add_script( $script_file, $dir = JAVASCRIPT_DIR ){ - $GLOBALS['script'][$dir . $script_file] = URL . $dir . $script_file; + function add_script( $file, $dir = JAVASCRIPT_DIR, $url = null ){ + if( !$url ) + $url = URL . $dir; + $GLOBALS['script'][$dir . $file] = $url . $file; } //add javascript code @@ -785,12 +828,24 @@ function add_javascript( $javascript, $onload = false ){ /** * get javascript */ - function get_javascript( $compress = false ){ - global $script, $javascript, $javascript_onload; + function get_javascript( $compression = false ){ + global $script, $javascript, $javascript_onload; $html = ""; - if( $script ) - foreach( $script as $s ) - $html .= '' . "\n"; + if( $script ){ + + if( $compression ){ + $js_file = ""; + foreach( $script as $file => $url) + $js_file .= "$url,"; + $html = '' . "\n"; + + } + else{ + foreach( $script as $s ) + $html .= '' . "\n"; + } + + } if( $javascript_onload ) $javascript .= "\n" . "$(function(){" . "\n" . " $javascript_onload" . "\n" . "});" . "\n"; if( $javascript ) $html .= ""; return $html; @@ -799,13 +854,27 @@ function get_javascript( $compress = false ){ /** * get the style */ - function get_style(){ + function get_style( $compression = false ){ global $style; $html = ""; - if( $style ) - foreach( $style as $s ) - $html .= ' ' . "\n"; + + if( $style ){ + + if( $compression ){ + $css_file = ""; + foreach( $style as $file => $url) + $css_file .= "$url,"; + $html = ' ' . "\n"; + } + else{ + foreach( $style as $file => $url) + $html .= ' ' . "\n"; + } + + } + return $html; + } @@ -815,14 +884,14 @@ function get_style(){ // //------------------------------------------------------------- - function get_ip(){ - if( !defined("IP") ){ - $ip = getenv( "HTTP_X_FORWARDED_FOR" ) ? getenv( "HTTP_X_FORWARDED_FOR" ) : getenv( "REMOTE_ADDR" ); - if( !preg_match("^([1-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(\.([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])){3}^", $ip ) ) $ip = null; - define( "IP", $ip ); - } - return IP; - } + function get_ip(){ + if( !defined("IP") ){ + $ip = getenv( "HTTP_X_FORWARDED_FOR" ) ? getenv( "HTTP_X_FORWARDED_FOR" ) : getenv( "REMOTE_ADDR" ); + if( !preg_match("^([1-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(\.([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])){3}^", $ip ) ) $ip = null; + define( "IP", $ip ); + } + return IP; + } @@ -830,43 +899,63 @@ function get_ip(){ * Return true if $ip is a valid ip */ function is_ip($ip){ - return preg_match("^([1-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(\.([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])){3}^", $ip ); + return preg_match("^([1-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(\.([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])){3}^", $ip ); } /** * Return the array with all geolocation info of user selected by IP + * ip = your IP + * assoc = true if you want the result as array */ - define( "IPINFODB_KEY", "YOUR_KEY" ); - function ip_to_location( $ip = IP ){ - if( is_ip( $ip ) ) - return json_decode( file_get_contents( "http://api.ipinfodb.com/v2/ip_query.php?key=".IPINFODB_KEY."&ip={$ip}&output=json&timezone=true" ) ); + if( !defined("IPINFODB_KEY" ) ) + define( "IPINFODB_KEY", "YOUR_KEY" ); + function ip_to_location( $ip = IP, $assoc = true ){ + // if ip is correct and it can access to the URL it will get the array with all the user localization info + if( is_ip( $ip ) && file_exists( $url = "http://api.ipinfodb.com/v2/ip_query.php?key=".IPINFODB_KEY."&ip={$ip}&output=json&timezone=true" ) && ($json = file_get_contents( $url ) ) ) + return json_decode( $json, $assoc ); } - /** - * Return the browser information of the logged user - */ - function get_browser_info(){ + /** + * Return the browser information of the logged user + */ + function get_browser_info(){ - if( !isset( $GLOBALS['rain_browser_info'] ) ){ - $known = array('msie', 'firefox', 'safari', 'webkit', 'opera', 'netscape', 'konqueror', 'gecko'); - preg_match( '#(' . join('|', $known) . ')[/ ]+([0-9]+(?:\.[0-9]+)?)#', strtolower($_SERVER['HTTP_USER_AGENT']), $br ); - preg_match_all( '#\((.*?);#', $_SERVER['HTTP_USER_AGENT'], $os ); + if( !isset( $GLOBALS['rain_browser_info'] ) ){ + $known = array('msie', 'firefox', 'safari', 'webkit', 'opera', 'netscape', 'konqueror', 'gecko'); + preg_match( '#(' . join('|', $known) . ')[/ ]+([0-9]+(?:\.[0-9]+)?)#', strtolower($_SERVER['HTTP_USER_AGENT']), $br ); + preg_match_all( '#\((.*?);#', $_SERVER['HTTP_USER_AGENT'], $os ); - global $rain_browser_info; - $rain_browser_info['lang_id'] = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2); - $rain_browser_info['browser'] = isset( $br[1][1] ) ? $br[1][1] : null; - $rain_browser_info['version'] = isset( $br[2][1] ) ? $br[2][1] : null; - $rain_browser_info['os'] = $od[1][0]; + global $rain_browser_info; + $rain_browser_info['lang_id'] = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2); + $rain_browser_info['browser'] = isset( $br[1][1] ) ? $br[1][1] : null; + $rain_browser_info['version'] = isset( $br[2][1] ) ? $br[2][1] : null; + $rain_browser_info['os'] = $od[1][0]; - } - return $GLOBALS['rain_browser_info']; + } + return $GLOBALS['rain_browser_info']; - } + } + + + + //------------------------------------------------------------- + // + // URL FUNCTIONS + // + //------------------------------------------------------------- + // alias for redirect + function reindex( $url ){ + redirect( $url ); + } + + function redirect( $url ){ + header( "location: $url" ); + } // -- end \ No newline at end of file diff --git a/website/config/index.html b/system/library/index.html old mode 100644 new mode 100755 similarity index 100% rename from website/config/index.html rename to system/library/index.html diff --git a/web/assign_execution_time.csv b/web/assign_execution_time.csv new file mode 100755 index 0000000..1ef5dc0 --- /dev/null +++ b/web/assign_execution_time.csv @@ -0,0 +1,6 @@ +execution_time,php,raintpl,savant,smarty,twig +1,292,390,706,1576,1446 +10,301,458,772,1535,1279 +20,328,680,829,1358,1406 +50,345,554,833,1352,1876 +100,430,696,793,1624,1443 \ No newline at end of file diff --git a/website/css/box.css b/web/css/box.css old mode 100644 new mode 100755 similarity index 100% rename from website/css/box.css rename to web/css/box.css diff --git a/website/js/jquery/jquery.form.js b/web/js/jquery/jquery.form.js similarity index 100% rename from website/js/jquery/jquery.form.js rename to web/js/jquery/jquery.form.js diff --git a/website/js/jquery/jquery.min.js b/web/js/jquery/jquery.min.js similarity index 100% rename from website/js/jquery/jquery.min.js rename to web/js/jquery/jquery.min.js diff --git a/website/js/jquery/jquery.validate.min.js b/web/js/jquery/jquery.validate.min.js old mode 100644 new mode 100755 similarity index 100% rename from website/js/jquery/jquery.validate.min.js rename to web/js/jquery/jquery.validate.min.js diff --git a/website/uploads/index.html b/web/uploads/index.html old mode 100644 new mode 100755 similarity index 100% rename from website/uploads/index.html rename to web/uploads/index.html diff --git a/website/ajax.php b/website/ajax.php deleted file mode 100644 index a8c1f2b..0000000 --- a/website/ajax.php +++ /dev/null @@ -1,24 +0,0 @@ - \ No newline at end of file diff --git a/website/config/directory.php b/website/config/directory.php deleted file mode 100755 index 9f3a29c..0000000 --- a/website/config/directory.php +++ /dev/null @@ -1,37 +0,0 @@ - \ No newline at end of file diff --git a/website/config/website.directory.php b/website/config/website.directory.php deleted file mode 100755 index 3fef6ea..0000000 --- a/website/config/website.directory.php +++ /dev/null @@ -1,36 +0,0 @@ - \ No newline at end of file