diff --git a/upload/blocks/1_notify.php b/upload/blocks/1_notify.php index 9fbf20b..d9f7631 100644 --- a/upload/blocks/1_notify.php +++ b/upload/blocks/1_notify.php @@ -2,22 +2,32 @@ if(!defined("MCR")){ exit("Hacking Attempt!"); } -if(isset($_SESSION['mcr_notify'])){ +class block_notify{ + private $core, $db; - $new_data = array( - "TYPE" => $this->db->HSC($_SESSION['notify_type']), - "TITLE" => $this->db->HSC($_SESSION['notify_title']), - "MESSAGE" => $this->db->HSC($_SESSION['notify_msg']) - ); + public function __construct($core){ + $this->core = $core; + $this->db = $core->db; + } - echo $this->sp(MCR_THEME_PATH."blocks/notify/alert.html", $new_data); + public function content(){ + if(!isset($_SESSION['mcr_notify'])){ return ''; } + + $new_data = array( + "TYPE" => $this->db->HSC($_SESSION['notify_type']), + "TITLE" => $this->db->HSC($_SESSION['notify_title']), + "MESSAGE" => $this->db->HSC($_SESSION['notify_msg']) + ); + + $result = $this->core->sp(MCR_THEME_PATH."blocks/notify/alert.html", $new_data); - unset($_SESSION['mcr_notify']); - unset($_SESSION['notify_type']); - unset($_SESSION['notify_title']); - unset($_SESSION['notify_msg']); + unset($_SESSION['mcr_notify']); + unset($_SESSION['notify_type']); + unset($_SESSION['notify_title']); + unset($_SESSION['notify_msg']); + + return $result; + } } - - ?> \ No newline at end of file diff --git a/upload/blocks/2_profile.php b/upload/blocks/2_profile.php index 7457109..9f43399 100644 --- a/upload/blocks/2_profile.php +++ b/upload/blocks/2_profile.php @@ -2,8 +2,19 @@ if(!defined("MCR")){ exit("Hacking Attempt!"); } -$authfile = (!$this->user->is_auth) ? "unauth" : "auth"; +class block_profile{ + private $core, $user; -echo $this->sp(MCR_THEME_PATH."blocks/profile/$authfile.html"); + public function __construct($core){ + $this->core = $core; + $this->user = $core->user; + } + + public function content(){ + $authfile = (!$this->user->is_auth) ? "unauth" : "auth"; + + return $this->core->sp(MCR_THEME_PATH."blocks/profile/$authfile.html"); + } +} ?> \ No newline at end of file diff --git a/upload/blocks/3_monitor.php b/upload/blocks/3_monitor.php index 65096ed..78a693c 100644 --- a/upload/blocks/3_monitor.php +++ b/upload/blocks/3_monitor.php @@ -2,8 +2,59 @@ if(!defined("MCR")){ exit("Hacking Attempt!"); } -if($this->is_access("sys_monitoring")){ - echo $this->sp(MCR_THEME_PATH."blocks/monitor/main.html"); +class block_monitor{ + private $core, $db, $user, $lng; + + public function __construct($core){ + $this->core = $core; + $this->db = $core->db; + $this->user = $core->user; + $this->lng = $core->lng_b; + } + + private function server_array(){ + $query = $this->db->query("SELECT id, title, `text`, ip, `port`, `status`, online, slots, players FROM `mcr_monitoring`"); + + if(!$query || $this->db->num_rows($query)<=0){ return $this->lng['empty']; } + + ob_start(); + + while($ar = $this->db->fetch_assoc($query)){ + + $status = (intval($ar['status'])===1) ? 'progress-info' : 'progress-danger'; + $slots = intval($ar['slots']); + $online = intval($ar['online']); + + $progress = ($online<=0) ? 0 : ceil(100 / ($slots / $online)); + + if(intval($ar['status'])!=1){ $progress = 100; } + + $data = array( + 'ID' => intval($ar['id']), + 'TITLE' => $this->db->HSC($ar['title']), + 'TEXT' => $this->db->HSC($ar['text']), + 'IP' => $this->db->HSC($ar['ip']), + 'PORT' => intval($ar['port']), + 'PROGRESS' => $progress, + 'STATUS' => $status, + 'STATS' => (intval($ar['status'])===1) ? $online.' / '.$slots : $this->lng['offline'], + ); + + echo $this->core->sp(MCR_THEME_PATH."blocks/monitor/monitor-id.html", $data); + } + + return ob_get_clean(); + } + + public function content(){ + if(!$this->core->is_access("sys_monitoring")){ return; } + + $data = array( + 'CONTENT' => $this->server_array(), + ); + + return $this->core->sp(MCR_THEME_PATH."blocks/monitor/main.html", $data); + } } ?> \ No newline at end of file diff --git a/upload/blocks/4_banner.php b/upload/blocks/4_banner.php new file mode 100644 index 0000000..5dfcf70 --- /dev/null +++ b/upload/blocks/4_banner.php @@ -0,0 +1,19 @@ +core = $core; + } + + public function content(){ + if(!$this->core->is_access("sys_adm_main")){ return; } + + return $this->core->sp(MCR_THEME_PATH."blocks/banner/main.html"); + } +} + +?> \ No newline at end of file diff --git a/upload/blocks/4_top.php b/upload/blocks/4_top.php deleted file mode 100644 index 6abc466..0000000 --- a/upload/blocks/4_top.php +++ /dev/null @@ -1,9 +0,0 @@ -is_access("sys_adm_main")){ - echo $this->sp(MCR_THEME_PATH."blocks/top/main.html"); -} - -?> \ No newline at end of file diff --git a/upload/cache/.htaccess b/upload/cache/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/upload/cache/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/upload/configs/db.php b/upload/configs/db.php index ceec5b0..0206a38 100644 --- a/upload/configs/db.php +++ b/upload/configs/db.php @@ -3,8 +3,9 @@ 'host' => 'localhost', 'user' => 'root', 'pass' => '', - 'base' => 'webmcr', + 'base' => 'minecraft', 'port' => 3306, 'backend' => 'mysqli', + 'log' => true, ); ?> \ No newline at end of file diff --git a/upload/configs/main.php b/upload/configs/main.php index df373bc..f722765 100644 --- a/upload/configs/main.php +++ b/upload/configs/main.php @@ -9,18 +9,17 @@ 'log' => false, 'install' => true, 'p_logic' => 'usual', - 'debug' => false, + 'debug' => true, 's_lang' => 'ru_RU', 's_root' => '/', - 's_root_full' => 'http://site.ru', - 'mcr_secury' => '', + 's_root_full' => 'http://localhost', + 'mcr_secury' => 'IRmMO5hR$U3IypSR@KBH', 'crypt' => 0, 'reg_accept' => true, - 'captcha' => 0, - 'rc_public' => '', - 'rc_private' => '', - 'kc_public' => '', - 'kc_private' => '', - 'mon_type' => 1 + 'captcha' => 1, + 'rc_public' => '6LdNLf8SAAAAABs0jjSANg543acy6NGi4bH1MX-A', + 'rc_private' => '6LdNLf8SAAAAAO-XQUcGglTRw4ZZw2tO8163hudD', + 'kc_public' => '78758', + 'kc_private' => 'nBJjeiTqRAuXZlqwklPHSgtlCj', ); ?> \ No newline at end of file diff --git a/upload/configs/modules/admin.php b/upload/configs/modules/admin.php new file mode 100644 index 0000000..a9dea8c --- /dev/null +++ b/upload/configs/modules/admin.php @@ -0,0 +1,17 @@ + true, + 'MOD_TITLE' => 'Панель управления', + 'MOD_DESC' => 'Модуль панели управления', + 'MOD_AUTHOR' => 'Qexy', + 'MOD_SITE' => 'http://qexy.org', + 'MOD_EMAIL' => 'admin@qexy.org', + 'MOD_VERSION' => '1.0', + 'MOD_URL_UPDATE' => 'http://update.webmcr.com/?do=modules&op=admin', + 'MOD_CHECK_UPDATE' => true, +); + +?> \ No newline at end of file diff --git a/upload/configs/modules/ajax.php b/upload/configs/modules/ajax.php new file mode 100644 index 0000000..59482c3 --- /dev/null +++ b/upload/configs/modules/ajax.php @@ -0,0 +1,17 @@ + true, + 'MOD_TITLE' => 'Ajax', + 'MOD_DESC' => 'Модуль Ajax запросов', + 'MOD_AUTHOR' => 'Qexy', + 'MOD_SITE' => 'http://qexy.org', + 'MOD_EMAIL' => 'admin@qexy.org', + 'MOD_VERSION' => '1.0', + 'MOD_URL_UPDATE' => 'http://update.webmcr.com/?do=modules&op=ajax', + 'MOD_CHECK_UPDATE' => true, +); + +?> \ No newline at end of file diff --git a/upload/configs/modules/auth.php b/upload/configs/modules/auth.php new file mode 100644 index 0000000..f234f2d --- /dev/null +++ b/upload/configs/modules/auth.php @@ -0,0 +1,17 @@ + true, + 'MOD_TITLE' => 'Авторизация', + 'MOD_DESC' => 'Модуль авторизации пользователей', + 'MOD_AUTHOR' => 'Qexy', + 'MOD_SITE' => 'http://qexy.org', + 'MOD_EMAIL' => 'admin@qexy.org', + 'MOD_VERSION' => '1.0', + 'MOD_URL_UPDATE' => 'http://update.webmcr.com/?do=modules&op=auth', + 'MOD_CHECK_UPDATE' => true, +); + +?> \ No newline at end of file diff --git a/upload/configs/modules/file.php b/upload/configs/modules/file.php new file mode 100644 index 0000000..8105fff --- /dev/null +++ b/upload/configs/modules/file.php @@ -0,0 +1,13 @@ + true, + 'MOD_TITLE' => 'Файловый загрузчик', + 'MOD_DESC' => 'Модуль скачивания файлов', + 'MOD_AUTHOR' => 'Qexy', + 'MOD_SITE' => 'http://qexy.org', + 'MOD_EMAIL' => 'admin@qexy.org', + 'MOD_VERSION' => '1.0', + 'MOD_URL_UPDATE' => 'http://update.webmcr.com/?do=modules&op=file', + 'MOD_CHECK_UPDATE' => true, +); +?> \ No newline at end of file diff --git a/upload/configs/modules/logout.php b/upload/configs/modules/logout.php new file mode 100644 index 0000000..5613ab1 --- /dev/null +++ b/upload/configs/modules/logout.php @@ -0,0 +1,13 @@ + true, + 'MOD_TITLE' => 'Выход', + 'MOD_DESC' => 'Модуль выхода пользователя с сайта', + 'MOD_AUTHOR' => 'Qexy', + 'MOD_SITE' => 'http://qexy.org', + 'MOD_EMAIL' => 'admin@qexy.org', + 'MOD_VERSION' => '1.0', + 'MOD_URL_UPDATE' => 'http://update.webmcr.com/?do=modules&op=logout', + 'MOD_CHECK_UPDATE' => true, +); +?> \ No newline at end of file diff --git a/upload/configs/modules/news.php b/upload/configs/modules/news.php new file mode 100644 index 0000000..53d5f30 --- /dev/null +++ b/upload/configs/modules/news.php @@ -0,0 +1,13 @@ + true, + 'MOD_TITLE' => 'Новости', + 'MOD_DESC' => 'Модуль новостей', + 'MOD_AUTHOR' => 'Qexy', + 'MOD_SITE' => 'http://qexy.org', + 'MOD_EMAIL' => 'admin@qexy.org', + 'MOD_VERSION' => '1.0', + 'MOD_URL_UPDATE' => 'http://update.webmcr.com/?do=modules&amp;amp;op=news', + 'MOD_CHECK_UPDATE' => true, +); +?> \ No newline at end of file diff --git a/upload/configs/modules/profile.php b/upload/configs/modules/profile.php new file mode 100644 index 0000000..6f78ab4 --- /dev/null +++ b/upload/configs/modules/profile.php @@ -0,0 +1,13 @@ + true, + 'MOD_TITLE' => 'Профиль пользователя', + 'MOD_DESC' => 'Модуль личного кабинета пользователя', + 'MOD_AUTHOR' => 'Qexy', + 'MOD_SITE' => 'http://qexy.org', + 'MOD_EMAIL' => 'admin@qexy.org', + 'MOD_VERSION' => '1.0', + 'MOD_URL_UPDATE' => 'http://update.webmcr.com/?do=modules&op=profile', + 'MOD_CHECK_UPDATE' => true, +); +?> \ No newline at end of file diff --git a/upload/configs/modules/register.php b/upload/configs/modules/register.php new file mode 100644 index 0000000..d6e90a5 --- /dev/null +++ b/upload/configs/modules/register.php @@ -0,0 +1,13 @@ + true, + 'MOD_TITLE' => 'Регистрация', + 'MOD_DESC' => 'Модуль регистрации', + 'MOD_AUTHOR' => 'Qexy', + 'MOD_SITE' => 'http://qexy.org', + 'MOD_EMAIL' => 'admin@qexy.org', + 'MOD_VERSION' => '1.0', + 'MOD_URL_UPDATE' => 'http://update.webmcr.com/?do=modules&op=register', + 'MOD_CHECK_UPDATE' => true, +); +?> \ No newline at end of file diff --git a/upload/configs/modules/restore.php b/upload/configs/modules/restore.php new file mode 100644 index 0000000..6384204 --- /dev/null +++ b/upload/configs/modules/restore.php @@ -0,0 +1,17 @@ + true, + 'MOD_TITLE' => 'Сброс пароля', + 'MOD_DESC' => 'Модуль сброса пароля пользователя', + 'MOD_AUTHOR' => 'Qexy', + 'MOD_SITE' => 'http://qexy.org', + 'MOD_EMAIL' => 'admin@qexy.org', + 'MOD_VERSION' => '1.0', + 'MOD_URL_UPDATE' => 'http://update.webmcr.com/?do=modules&op=restore', + 'MOD_CHECK_UPDATE' => true, +); + +?> \ No newline at end of file diff --git a/upload/configs/modules/search.php b/upload/configs/modules/search.php new file mode 100644 index 0000000..a2822d0 --- /dev/null +++ b/upload/configs/modules/search.php @@ -0,0 +1,13 @@ + true, + 'MOD_TITLE' => 'Поиск', + 'MOD_DESC' => 'Модуль поиска', + 'MOD_AUTHOR' => 'Qexy', + 'MOD_SITE' => 'http://qexy.org', + 'MOD_EMAIL' => 'admin@qexy.org', + 'MOD_VERSION' => '1.0', + 'MOD_URL_UPDATE' => 'http://update.webmcr.com/?do=modules&op=search', + 'MOD_CHECK_UPDATE' => true, +); +?> \ No newline at end of file diff --git a/upload/configs/modules/statics.php b/upload/configs/modules/statics.php new file mode 100644 index 0000000..947c577 --- /dev/null +++ b/upload/configs/modules/statics.php @@ -0,0 +1,13 @@ + true, + 'MOD_TITLE' => 'Статические страницы', + 'MOD_DESC' => 'Модуль статических страниц', + 'MOD_AUTHOR' => 'Qexy', + 'MOD_SITE' => 'http://qexy.org', + 'MOD_EMAIL' => 'admin@qexy.org', + 'MOD_VERSION' => '1.0', + 'MOD_URL_UPDATE' => 'http://update.webmcr.com/?do=modules&op=statics', + 'MOD_CHECK_UPDATE' => true, +); +?> \ No newline at end of file diff --git a/upload/configs/pagin.php b/upload/configs/pagin.php index c3890d7..31d2990 100644 --- a/upload/configs/pagin.php +++ b/upload/configs/pagin.php @@ -19,5 +19,6 @@ 'adm_groups' => 10, 'adm_permissions' => 10, 'adm_statics' => 10, + 'adm_logs' => 10, ); ?> \ No newline at end of file diff --git a/upload/engine/cloak.class.php b/upload/engine/cloak.class.php index 0d35518..102ebe3 100644 --- a/upload/engine/cloak.class.php +++ b/upload/engine/cloak.class.php @@ -13,7 +13,7 @@ $this->db = $core->db; $this->lng = $core->lng; - if(!is_writable(MCR_CLOAK_PATH)){ $this->core->notify($this->lng['e_msg'], $this->lng['e_load_cloak_folder'], 2, '?mode=profile'); } + if(!is_writable(MCR_CLOAK_PATH)){ $this->core->notify($this->lng['e_msg'], $this->lng['cloak_e_folder_perm'], 2, '?mode=profile'); } $size = intval($obj['size']); $tmp = $obj['tmp_name']; @@ -22,52 +22,52 @@ case 0: break; case 1: - case 2: $this->core->notify($this->lng['e_msg'], $this->lng['e_load_size'], 2, '?mode=profile'); break; + case 2: $this->core->notify($this->lng['e_msg'], $this->lng['cloak_e_size'], 2, '?mode=profile'); break; case 3: - case 4: $this->core->notify("", $this->lng['e_load_cloak'], 2, '?mode=profile'); break; + case 4: $this->core->notify("", $this->lng['cloak_e'], 2, '?mode=profile'); break; - case 6: $this->core->notify($this->lng['e_msg'], $this->lng['e_load_temp'], 2, '?mode=profile'); break; + case 6: $this->core->notify($this->lng['e_msg'], $this->lng['cloak_e_temp'], 2, '?mode=profile'); break; - case 7: $this->core->notify($this->lng['e_msg'], $this->lng['e_load_perm'], 2, '?mode=profile'); break; + case 7: $this->core->notify($this->lng['e_msg'], $this->lng['cloak_e_perm'], 2, '?mode=profile'); break; - default: $this->core->notify("", $this->lng['e_load_undefined'], 2, '?mode=profile'); break; + default: $this->core->notify("", $this->lng['cloak_e_undefined'], 2, '?mode=profile'); break; } - if(($size/1024)>$this->user->permissions->sys_max_file_size){ $this->core->notify($this->lng['e_msg'], $this->lng['e_load_size'], 2, '?mode=profile'); } + if(($size/1024)>$this->user->permissions->sys_max_file_size){ $this->core->notify($this->lng['e_msg'], $this->lng['cloak_e_size'], 2, '?mode=profile'); } if(!file_exists($tmp)){ - $this->core->notify($this->lng['e_msg'], $this->lng['e_load_tempfile'], 2, '?mode=profile'); + $this->core->notify($this->lng['e_msg'], $this->lng['cloak_e_tempfile'], 2, '?mode=profile'); } - if(substr($obj['name'], -4)!='.png'){ $this->core->notify($this->lng['e_msg'], $this->lng['e_load_png'], 2, '?mode=profile'); } + if(substr($obj['name'], -4)!='.png'){ $this->core->notify($this->lng['e_msg'], $this->lng['cloak_e_png'], 2, '?mode=profile'); } $get_size = @getimagesize($tmp); - if(!$get_size){ $this->core->notify($this->lng['e_msg'], $this->lng['e_load_png'], 2, '?mode=profile'); } + if(!$get_size){ $this->core->notify($this->lng['e_msg'], $this->lng['cloak_e_png'], 2, '?mode=profile'); } $width = $get_size[0]; $height = $get_size[1]; - if(!$this->is_cloak_valid($get_size)){ $this->core->notify($this->lng['e_msg'], $this->lng['e_load_format'], 2, '?mode=profile'); } + if(!$this->is_cloak_valid($get_size)){ $this->core->notify($this->lng['e_msg'], $this->lng['cloak_e_format'], 2, '?mode=profile'); } // Resave head of skin + if(!file_exists(MCR_SKIN_PATH.'interface/'.$this->user->login.'_mini.png')){ - if(!copy(MCR_SKIN_PATH.'interface/.default_mini.png', MCR_SKIN_PATH.'interface/'.$this->user->login.'_mini.png')){ $this->core->notify("", $this->lng['e_load_save'], 2, '?mode=profile'); } + if(!copy(MCR_SKIN_PATH.'interface/default_mini.png', MCR_SKIN_PATH.'interface/'.$this->user->login.'_mini.png')){ $this->core->notify("", $this->lng['cloak_e_save'], 2, '?mode=profile'); } } // Resave head of skin - // Create and save preview of cloak + $new_preview = $this->create_preview($tmp); - if($new_preview===false){ $this->core->notify($this->lng['e_msg'], $this->lng['e_load_png'], 2, '?mode=profile'); } + if($new_preview===false){ $this->core->notify($this->lng['e_msg'], $this->lng['cloak_e_png'], 2, '?mode=profile'); } imagepng($new_preview, MCR_SKIN_PATH.'interface/'.$this->user->login.'.png'); // Create and save preview of cloak - // Save new cloak + if(!file_exists(MCR_CLOAK_PATH.$this->user->login.'.png')){ - if(!copy($tmp, MCR_CLOAK_PATH.$this->user->login.'.png')){ $this->core->notify("", $this->lng['e_load_save'], 2, '?mode=profile'); } + if(!copy($tmp, MCR_CLOAK_PATH.$this->user->login.'.png')){ $this->core->notify("", $this->lng['cloak_e_save'], 2, '?mode=profile'); } } // Save new cloak - } @@ -90,8 +90,8 @@ $skin_path_int = MCR_SKIN_PATH.'interface/'.$this->user->skin.'.png'; $skin_path = MCR_SKIN_PATH.$this->user->skin.'.png'; }else{ - $skin_path_int = MCR_SKIN_PATH.'interface/.default.png'; - $skin_path = MCR_SKIN_PATH.'.default.png'; + $skin_path_int = MCR_SKIN_PATH.'interface/default.png'; + $skin_path = MCR_SKIN_PATH.'default.png'; } $skin_string = file_get_contents($skin_path_int); diff --git a/upload/engine/config.class.php b/upload/engine/config.class.php index 8336a28..c32ec8f 100644 --- a/upload/engine/config.class.php +++ b/upload/engine/config.class.php @@ -24,6 +24,23 @@ $this->pagin = $pagin; $this->search = $search; } + + public function savecfg($cfg=array(), $file='main.php', $var='main'){ + + if(!is_array($cfg) || empty($cfg)){ return false; } + + $filename = MCR_ROOT."configs/".$file; + + $txt = ''; + + $result = file_put_contents($filename, $txt); + + if($result === false){ return false; } + + return true; + } } diff --git a/upload/engine/core.class.php b/upload/engine/core.class.php index 61a6d2b..d5dc68d 100644 --- a/upload/engine/core.class.php +++ b/upload/engine/core.class.php @@ -4,17 +4,14 @@ class core{ // Set default scope and values - public $config = array(); public $bc, $title, $header, $r_block, $l_block, $menu; public $def_header = ''; - public $db = false; + public $db, $user, $config = false; - public $user = false; - - public $lng = array(); + public $lng, $lng_m, $lng_b = array(); public $csrf_time = 1800; @@ -32,10 +29,10 @@ // Create & set new object of config $this->config = new config(); - if(!file_exists(MCR_LANG_PATH.$this->config->main['s_lang'].'/main.php')){ exit("Language path not found"); } + if(!file_exists(MCR_LANG_PATH.$this->config->main['s_lang'].'/system.php')){ exit("Language path not found"); } // Load language package - require_once(MCR_LANG_PATH.$this->config->main['s_lang'].'/main.php'); + require_once(MCR_LANG_PATH.$this->config->main['s_lang'].'/system.php'); // Set language var $this->lng = $lng; @@ -60,8 +57,26 @@ // Create & set new object of menu $this->menu = new menu($this); + $base_url = ($this->config->main['install']) ? $this->base_url() : $this->config->main['s_root']; + // Generate CSRF Secure key - define("MCR_SECURE_KEY", $this->gen_csrf_secure()); + define("MCR_SECURE_KEY", $this->gen_csrf_secure());// System constants + define('MCR_LANG', $this->config->main['s_lang']); + define('MCR_LANG_DIR', MCR_LANG_PATH.MCR_LANG.'/'); + define('MCR_THEME_PATH', MCR_ROOT.'themes/'.$this->config->main['s_theme'].'/'); + define('MCR_THEME_MOD', MCR_THEME_PATH.'modules/'); + define('MCR_THEME_BLOCK', MCR_THEME_PATH.'blocks/'); + define('BASE_URL', $base_url); + define('ADMIN_URL', BASE_URL.'?mode=admin'); + define('STYLE_URL', BASE_URL.'themes/'.$this->config->main['s_theme'].'/'); + define('UPLOAD_URL', BASE_URL.'uploads/'); + define('LANG_URL', BASE_URL.'language/'.MCR_LANG.'/'); + + $bc = array( + $this->lng['e_msg'] => BASE_URL, + ); + + $this->bc = $this->gen_bc($bc); } /** @@ -95,16 +110,20 @@ /** * Генерация AJAX оповещений + * @param String $title - Название * @param String $message - Сообщение - * @param Boolean $status - Статус ошибки (true|false - Истина|Ложь) + * @param Boolean $type - Тип ошибки (true|false - Истина|Ложь) * @param Array $data - Основное содержимое оповещения и доп. поля * @return JSON exit */ - public function js_notify($message='', $status=false, $data=array()){ + public function js_notify($message='', $title='', $type=false, $data=array()){ + + if(empty($title)){ $title = $this->lng['e_msg']; } $data = array( - "_status" => $status, + "_title" => $title, "_message" => $message, + "_type" => $type, "_data" => $data ); @@ -268,9 +287,9 @@ * @return object */ public function load_bb_class(){ - include(MCR_TOOL_PATH.'libs/bb.class.php'); + include(MCR_TOOL_PATH.'libs/bbcode.parse.php'); - return new bb($this); + return new bbcode($this); } /** @@ -279,21 +298,21 @@ */ public function csrf_check(){ if($_SERVER['REQUEST_METHOD']=='POST'){ - if(!isset($_POST['mcr_secure'])){ $this->notify('Hacking Attempt!'); } + if(!isset($_POST['mcr_secure'])){ $this->notify($this->lng['e_hack']); } $secure_key = explode('_', $_POST['mcr_secure']); - if(!isset($secure_key[1])){ $this->notify('Hacking Attempt!'); } + if(!isset($secure_key[1])){ $this->notify($this->lng['e_hack']); } $secure_time = intval($secure_key[0]); - if(($secure_time+$this->csrf_time)notify('Hacking Attempt!'); } + if(($secure_time+$this->csrf_time)notify($this->lng['e_hack']); } $secure_var = $secure_key[1]; $mcr_secure = $secure_time.'_'.md5($this->user->ip.$this->config->main['mcr_secury'].$secure_time); - if($mcr_secure!==$_POST['mcr_secure']){ $this->notify('Hacking Attempt!'); } + if($mcr_secure!==$_POST['mcr_secure']){ $this->notify($this->lng['e_hack']); } } } @@ -333,6 +352,7 @@ ob_start(); foreach($array as $title => $url){ + $string .= ($i==0) ? $title : ' — '.$title; if($count==$i){ echo $this->sp(MCR_THEME_PATH."breadcrumbs/id-active.html", array("TITLE" => $title)); }else{ @@ -343,6 +363,8 @@ $i++; } + $this->title = $this->db->HSC($string); + return ob_get_clean(); } @@ -352,32 +374,81 @@ * @return Buffer string */ public function gen_bc($array=array()){ - if(!$this->config->func['breadcrumbs']){ return false; } $data['LIST'] = $this->gen_bc_list($array); + if(!$this->config->func['breadcrumbs']){ return false; } + return $this->sp(MCR_THEME_PATH."breadcrumbs/list.html", $data); } + public function check_cfg($cfg){ + $validator = array('MOD_ENABLE', + 'MOD_TITLE', + 'MOD_DESC', + 'MOD_AUTHOR', + 'MOD_SITE', + 'MOD_EMAIL', + 'MOD_VERSION', + 'MOD_URL_UPDATE', + 'MOD_CHECK_UPDATE', + ); + + $result = true; + + foreach($validator as $key => $val){ + if(!isset($cfg[$val])){ $result = false; } + } + + return $result; + } + /** * Подгрузчик модулей * @param String $mode - название модуля * @return Object */ public function load_mode($mode){ - if(!preg_match("/^\w+$/i", $mode) || !file_exists(MCR_MODE_PATH.$mode.".php")){ $this->title = $this->lng['e_mode_found']; return $this->sp(MCR_THEME_PATH."default_sp/404.html"); } + if(!preg_match("/^\w+$/i", $mode) || !file_exists(MCR_MODE_PATH.$mode.".php")){ + $this->title = $this->lng['e_mode_found']; + return $this->sp(MCR_THEME_PATH."default_sp/404.html"); + } + if(!file_exists(MCR_CONF_PATH.'modules/'.$mode.'.php')){ + return $this->sp(MCR_THEME_PATH."default_sp/mod_disable.html"); + } + + require_once(MCR_CONF_PATH.'modules/'.$mode.'.php'); + + if(!isset($cfg) || !$this->check_cfg($cfg) || !$cfg['MOD_ENABLE']){ + return $this->sp(MCR_THEME_PATH."default_sp/mod_disable.html"); + } + include_once(MCR_MODE_PATH.$mode.".php"); if(!class_exists("module")){ return $this->lng['e_mode_class']; } + $this->lng_m = $this->load_language($mode); + $module = new module($this); + + @$module->cfg = $cfg; if(!method_exists($module, "content")){ return $this->lng['e_mode_method']; } return $module->content(); } + private function load_language($mod){ + if(!file_exists(MCR_LANG_DIR.$mod.'.php')){ + return array(); + } + + require(MCR_LANG_DIR.$mod.'.php'); + + return $lng; + } + /** * Системный генератор хэшей паролей пользователей * @param String $string - исходный пароль @@ -431,8 +502,18 @@ include_once(MCR_MODE_PATH.$mode.".php"); + require_once(MCR_CONF_PATH.'modules/'.$mode.'.php'); + + require(MCR_LANG_PATH.$this->config->main['s_lang'].'/'.$mode.'.php'); + + if(!$cfg['MOD_ENABLE']){ return $this->sp(MCR_THEME_PATH."default_sp/mod_disable.html"); } + + $this->lng_m = $lng; + $module = new module($this); + $module->cfg = $cfg; + return $module->content(); } @@ -443,18 +524,39 @@ public function load_def_blocks(){ $list = scandir(MCR_SIDE_PATH); - if(empty($list)){ return false;; } + if(empty($list)){ return false; } - ob_start(); + $content = ''; foreach($list as $key => $file){ if($file=='.' || $file=='..' || substr($file, -4)!='.php'){ continue; } + $expl = explode('_', $file); + + if(file_exists(MCR_LANG_DIR.'blocks/'.$expl[1])){ + require_once(MCR_LANG_DIR.'blocks/'.$expl[1]); + $this->lng_b = $lng; + }else{ + $this->lng_b = array(); + } + include_once(MCR_SIDE_PATH.$file); + $classname = 'block_'.substr($expl[1], 0, -4); + + if(!class_exists($classname)){ continue; } + + $obj = new $classname($this); + + if(!method_exists($obj, 'content')){ continue; } + + $content .= $obj->content(); + + unset($obj); + } - return ob_get_clean(); + return $content; } /** @@ -570,11 +672,11 @@ * @return Boolean */ public function send_mail($to, $subject='[WebMCR]', $message='', $altmassage='', $smtp=false, $cc=false){ - require(MCR_TOOL_PATH.'smtp/PHPMailerAutoload.php'); + require(MCR_LIBS_PATH.'smtp/PHPMailerAutoload.php'); PHPMailerAutoload('smtp'); - include_once(MCR_TOOL_PATH.'smtp/class.phpmailer.php'); + include_once(MCR_LIBS_PATH.'smtp/class.phpmailer.php'); $mail = new PHPMailer; @@ -591,7 +693,7 @@ } $mail->CharSet = 'UTF-8'; - $mail->setLanguage('ru', MCR_TOOL_PATH.'smpt/language/'); + $mail->setLanguage('ru', MCR_LANG_DIR.'smpt/'); $mail->From = ($this->config->mail['smtp']) ? $this->config->mail['smtp_user'] : $this->config->mail['from']; $mail->FromName = $this->config->mail['from_name']; if(is_array($to)){ @@ -733,25 +835,6 @@ return ob_get_clean(); } - - public function savecfg($cfg=array(), $file='main.php', $var='main'){ - - if(empty($cfg)){ return false; } - - $filename = MCR_ROOT."configs/".$file; - - $txt = ''; - - if(file_exists($filename) && !is_writable($filename)){ return false; } - - $result = file_put_contents($filename, $txt); - - if (is_bool($result) and $result == false){return false;} - - return true; - } public function validate_perm($perm){ $perm = $this->db->safesql($perm); @@ -763,6 +846,14 @@ return ($ar[0]<=0) ? false : true; } + + public function file_manager(){ + + if(!$this->is_access('sys_adm_manager')){ return; } + + + return $this->sp(MCR_THEME_PATH."default_sp/file_manager.html"); + } } ?> \ No newline at end of file diff --git a/upload/engine/db/mysql.class.php b/upload/engine/db/mysql.class.php index 91f264d..f164e66 100644 --- a/upload/engine/db/mysql.class.php +++ b/upload/engine/db/mysql.class.php @@ -60,6 +60,54 @@ public function error(){ return mysql_error(); } + + public function remove_fast($from="", $where=""){ + if(empty($from) || empty($where)){ return false; } + + $delete = $this->query("DELETE FROM `$from` WHERE $where"); + + if(!$delete){ return false; } + + return true; + } + + public function actlog($msg='', $uid=0){ + if(!$this->config->db['log']){ return false; } + + $uid = intval($uid); + $msg = $this->safesql($msg); + $date = time(); + + $insert = $this->query("INSERT INTO `mcr_logs` + (uid, `message`, `date`) + VALUES + ('$uid', '$msg', '$date')"); + + if(!$insert){ return false; } + + return true; + } + + public function update_user($user){ + if(!$user->is_auth){ return false; } + + $data = array( + 'time_create' => $user->data->time_create, + 'time_last' => time(), + 'firstname' => $user->data->firstname, + 'lastname' => $user->data->lastname, + 'gender' => $user->data->gender, + 'birthday' => $user->data->birthday, + ); + + $data = $this->safesql(json_encode($data)); + + $update = $this->query("UPDATE `mcr_users` SET `ip_last`='{$user->ip}', `data`='$data' WHERE id='{$user->id}'"); + + if(!$update){ return false; } + + return true; + } } ?> \ No newline at end of file diff --git a/upload/engine/db/mysqli.class.php b/upload/engine/db/mysqli.class.php index 337083e..172ba13 100644 --- a/upload/engine/db/mysqli.class.php +++ b/upload/engine/db/mysqli.class.php @@ -12,6 +12,8 @@ public function __construct($config, $lng){ + $this->config = $config; + $this->obj = @new mysqli($config->db['host'], $config->db['user'], $config->db['pass'], $config->db['base'], $config->db['port']); if(mysqli_connect_errno($this->obj)){ return; } @@ -62,6 +64,54 @@ public function error(){ return $this->obj->error; } + + public function remove_fast($from="", $where=""){ + if(empty($from) || empty($where)){ return false; } + + $delete = $this->query("DELETE FROM `$from` WHERE $where"); + + if(!$delete){ return false; } + + return true; + } + + public function actlog($msg='', $uid=0){ + if(!$this->config->db['log']){ return false; } + + $uid = intval($uid); + $msg = $this->safesql($msg); + $date = time(); + + $insert = $this->query("INSERT INTO `mcr_logs` + (uid, `message`, `date`) + VALUES + ('$uid', '$msg', '$date')"); + + if(!$insert){ return false; } + + return true; + } + + public function update_user($user){ + if(!$user->is_auth){ return false; } + + $data = array( + 'time_create' => $user->data->time_create, + 'time_last' => time(), + 'firstname' => $user->data->firstname, + 'lastname' => $user->data->lastname, + 'gender' => $user->data->gender, + 'birthday' => $user->data->birthday, + ); + + $data = $this->safesql(json_encode($data)); + + $update = $this->query("UPDATE `mcr_users` SET `ip_last`='{$user->ip}', `data`='$data' WHERE id='{$user->id}'"); + + if(!$update){ return false; } + + return true; + } } ?> \ No newline at end of file diff --git a/upload/engine/libs/bb.class.php b/upload/engine/libs/bb.class.php deleted file mode 100644 index 790216d..0000000 --- a/upload/engine/libs/bb.class.php +++ /dev/null @@ -1,122 +0,0 @@ -core = $core; - $this->lng = $core->lng; - } - - public function bb_panel($for=''){ - - $data['PANEL_ID'] = $for; - $data['SMILES'] = $this->get_smiles_bb(); - - ob_start(); - - echo $this->core->sp(MCR_THEME_PATH.'default_sp/bb-panel.html', $data); - - return ob_get_clean(); - } - - /** - * BBquote(@param) - Recursive function for bb codes - * - * @param - String - * - * @return callback function - * - */ - private function BBquote($text){ - - $reg = '#\[quote]((?:[^[]|\[(?!/?quote])|(?R)?)+)\[/quote]#isu'; - - if (is_array($text)){$text = '
'.$text[1].'
';} - - return preg_replace_callback($reg, 'self::BBquote', $text); - } - - public function get_smiles_bb(){ - include(MCR_TOOL_PATH.'libs/smiles.php'); - - ob_start(); - - foreach($smiles as $key => $img){ - - $data = array( - "NAME" => $key, - "IMG" => $img - ); - - echo $this->core->sp(MCR_THEME_PATH.'default_sp/smile-id.html', $data); - } - - return ob_get_clean(); - } - - private function smile_decode($text){ - include(MCR_TOOL_PATH.'libs/smiles.php'); - - foreach($smiles as $key => $value){ - $smiles[$key] = ''.$key.''; - } - - $search = array_keys($smiles); - $replace = array_values($smiles); - - return str_replace($search, $replace, $text); - } - - /** - * bb_decode(@param) - Change BB-code to HTML - * - * @param - String - * - * @return String - * - */ - public function decode($text){ - - $text = nl2br($text); - - $patern = array( - '/\[b\](.*?)\[\/b\]/Usi', - '/\[i\](.*?)\[\/i\]/Usi', - '/\[s\](.*?)\[\/s\]/Usi', - '/\[u\](.*?)\[\/u\]/Usi', - '/\[left\](.*?)\[\/left\]/Usi', - '/\[center\](.*?)\[\/center\]/Usi', - '/\[right\](.*?)\[\/right\]/Usi', - '/\[code\](.*?)\[\/code\]/Usi', - ); - - $replace = array( - '$1', - '$1', - '$1', - '$1', - '

$1

', - '

$1

', - '

$1

', - '$1', - ); - - $text = preg_replace($patern, $replace, $text); - $text = preg_replace("/\[url=(?:'|"|\'|\")((((ht|f)tps?|mailto):(?:\/\/)?)(?:[^<\s\'\"]+))(?:'|"|\'|\")\](.*?)\[\/url\]/Usi", "$5", $text); - $text = preg_replace("/\[img\](((ht|f)tps?:(?:\/\/)?)(?:[^<\s\'\"]+))\[\/img\]/Usi", "", $text); - $text = preg_replace("/\[color=(?:'|"|\'|\")((\#[a-z0-9]{6})|([a-z]{1,30}))(?:'|"|\'|\")\](.*?)\[\/color\]/Usi", "$4", $text); - $text = preg_replace("/\[size=(?:'|"|\'|\")([1-6]{1})(?:'|"|\'|\")\](.*?)\[\/size\]/Usi", "$2", $text); - - $text = $this->smile_decode($text); - - $text = $this->BBquote($text); - - return $text; - - } - -} -?> \ No newline at end of file diff --git a/upload/engine/libs/bbcode.parse.php b/upload/engine/libs/bbcode.parse.php new file mode 100644 index 0000000..8df8cbf --- /dev/null +++ b/upload/engine/libs/bbcode.parse.php @@ -0,0 +1,368 @@ +core = $core; + $this->smiles_url = MCR_ROOT.'qx_upload/smiles/'; + } + + public function get_smiles_bb(){ + include(MCR_TOOL_PATH.'libs/smiles.php'); + + ob_start(); + + foreach($smiles as $key => $img){ + + $data = array( + "NAME" => $key, + "IMG" => $img + ); + + echo $this->core->sp(MCR_THEME_PATH.'default_sp/smile-id.html', $data); + } + + return ob_get_clean(); + } + + public function bb_panel($for=''){ + + $data['PANEL_ID'] = $for; + $data['SMILES'] = $this->get_smiles_bb(); + + return $this->core->sp(MCR_THEME_PATH.'default_sp/bb-panel.html', $data); + } + + // Шаблоны обычных ББ-кодов (рекурсивные) + public $codes = array( + 'b' => array( + 'left_tag' => '', + 'right_tag' => '' + ), + + 'i' => array( + 'left_tag' => '', + 'right_tag' => '' + ), + + 'u' => array( + 'left_tag' => '', + 'right_tag' => '' + ), + + 's' => array( + 'left_tag' => '', + 'right_tag' => '' + ), + + 'code' => array( + 'left_tag' => '
', + 'right_tag' => '
' + ), + + 'quote' => array( + 'left_tag' => '
', + 'right_tag' => '
' + ), + + 'offtop' => array( + 'left_tag' => '', + 'right_tag' => '' + ), + + 'spoiler' => array( + 'left_tag' => '
', + 'right_tag' => '
' + ), + + 'reverse' => array( + 'left_tag' => '', + 'right_tag' => '' + ), + + 'left' => array( + 'left_tag' => '
', + 'right_tag' => '
' + ), + + 'center' => array( + 'left_tag' => '
', + 'right_tag' => '
' + ), + + 'right' => array( + 'left_tag' => '
', + 'right_tag' => '
' + ), + ); + + // Шаблоны ББ-кодов с опциями и тонкими настройками регулярок (рекурсивные) + private $codes_options = array( + 'quote' => array( + 'pattern' => '/\[(quote)\=\"(([\w]+) \| (\d{2}\.\d{2}\.\d{2} \- \d{2}\:\d{2}\:\d{2}))\"\]((?:[^[]|(?R))*)\[\/quote\]/Usi', + 'replace' => '
{2}
{5}
', + 'values' => array(1,2,5), + 'escapes' => false, + ), + + 'code' => array( + 'pattern' => '/\[(code)\=\"(php|html|css|javascript)\"\]((?:[^[]|(?R))*)\[\/code\]/Usi', + 'replace' => '
Тип: {2}
{3}
', + 'values' => array(1,2,3), + 'escapes' => 3, + ), + + 'color' => array( + 'pattern' => '/\[(color)\=\"(\#[0-9a-f]{6})\"\]((?:[^[]|\[(?!\/?(color)\])|(?R))+)\[\/color\]/Usi', + 'replace' => '{3}', + 'values' => array(1,2,3), + 'escapes' => false, + ), + + 'background' => array( + 'pattern' => '/\[(background)\=\"(\#[0-9a-f]{6})\"\]((?:[^[]|(?R))*)\[\/background\]/Usi', + 'replace' => '{3}', + 'values' => array(1,2,3), + 'escapes' => false, + ), + + 'size' => array( + 'pattern' => '/\[(size)\=\"([1-7])\"\]((?:[^[]|(?R))*)\[\/size\]/Usi', + 'replace' => '{3}', + 'values' => array(1,2,3), + 'escapes' => false, + ), + + 'font' => array( + 'pattern' => '/\[(font)\=\"(Arial|Arial Black|Comic Sans MS|Courier New|Georgia|Impact|Tahoma|Times New Roman|Trebuchet MS|Verdana)\"\]((?:[^[]|(?R))*)\[\/font\]/Usi', + 'replace' => '{3}', + 'values' => array(1,2,3), + 'escapes' => false, + ), + + 'url' => array( + 'pattern' => '/\[(url)\=\"(http(s)?\:\/\/[\w\.\/\?\=\&\%\+\~\*\-]+)\"\]((?:[^[]|(?R))*)\[\/url\]/Usi', + 'replace' => '{4}', + 'values' => array(1,2,4), + 'escapes' => false, + ), + + 'spoiler' => array( + 'pattern' => '/\[(spoiler)\=\"([\w\s\-\.\:\;\+\|\,]{1,32})\"\]((?:[^[]|(?R))*)\[\/spoiler\]/Usui', + 'replace' => '
{3}
', + 'values' => array(1,2,3), + 'escapes' => false, + ), + ); + + // Шаблоны ББ-кодов с опциями и тонкими настройками регулярок (не рекурсивные) + private $codes_once = array( + 'img' => array( + 'pattern' => '/\[img\](http(s)?\:\/\/[\w\.\/\?\=\&\%\+\~\*\-]+)\[\/img\]/Usi', + 'replace' => 'IMG', + ), + + 'line' => array( + 'pattern' => '/\[line\]/Usi', + 'replace' => '
', + ), + + 'url' => array( + 'pattern' => '/\[url\](http(s)?\:\/\/[\w\.\/\?\=\&\%\+\~\*\-]+)\[\/url\]/Usi', + 'replace' => '$1', + ), + + 'email' => array( + 'pattern' => '/\[email\]([\w\.\-]+\@[a-z0-9\.\-]+)\[\/email\]/Usi', + 'replace' => '$1', + ), + ); + + // Шаблоны ББ-кодов для обработки тегов видео ([video]) с тонкими настройками регулярок (не рекурсивные) + private $codes_video = array( + 'youtube' => array( + 'pattern' => '((youtube\.com\/watch\?v\=([\w\-]+))|(youtu\.be\/([\w\-]+))|(youtube.com\/embed\/([\w\-]+)))', + 'replace' => 'https://www.youtube.com/embed/$5', + ), + + 'vk' => array( + 'pattern' => 'vk.com\/video_ext.php\?oid=(\d+)\&id\=(\d+)\&hash\=(\w+)', + 'replace' => 'http://vk.com/video_ext.php?oid=$3&id=$4&hash=$5', + ), + + 'vimeo' => array( + 'pattern' => 'vimeo\.com\/(\d+)', + 'replace' => 'https://player.vimeo.com/video/$3', + ), + + 'coub' => array( + 'pattern' => 'coub.com\/view\/(\w+)', + 'replace' => 'http://coub.com/embed/$3', + ), + + 'twitch' => array( + 'pattern' => 'twitch\.tv\/(\w+)', + 'replace' => 'http://www.twitch.tv/$3/embed', + ), + + 'vine' => array( + 'pattern' => 'vine\.co\/v\/(\w+)', + 'replace' => 'https://vine.co/v/$3/embed/simple', + ), + ); + + // Обработчик смайликов + private function parse_smiles($text){ + + $smile_list = $smile_replace = array(); + + include(MCR_TOOL_PATH.'libs/smiles.php'); + + foreach($smiles as $key => $val){ + $smile_list[] = $key; + $smile_replace[] = ''.$key.''; + } + + return str_replace($smile_list, $smile_replace, $text); + } + + // Обработчик единичных тегов + private function parse_once($text){ + + $replace = $pattern = array(); + + foreach($this->codes_once as $key => $value){ + $pattern[] = $value['pattern']; + $replace[] = $value['replace']; + } + + return preg_replace($pattern, $replace, $text); + } + + // Обработчик обычных тегов с открывающими и загрывающими тегами + private function parse_simple_tags($text){ + + $pattern = '/\[('.implode('|', array_keys($this->codes)).')\]((?:[^[]|\[(?!\/?(\\1)\])|(?R))+)\[\/\\1\]/Usi'; + + if(is_array($text)){ + $left_tag = $this->codes[$text[1]]['left_tag']; + $right_tag = $this->codes[$text[1]]['right_tag']; + $content = $text[2]; + + if($text[1]=='code'){ + $content = str_replace(array('[', ']'), array('[', ']'), $content); + } + + $text = $left_tag.$content.$right_tag; // result + }else{ + $text = nl2br(htmlspecialchars($text, ENT_NOQUOTES)); + } + + return preg_replace_callback($pattern, array($this, 'parse_simple_tags'), $text); + } + + // Обработчик тегов с опциями + private function parse_with_options($text){ + + if(is_array($text)){ + $codes = $this->codes_options; + + if(isset($codes[$text[1]])){ + $escape = $codes[$text[1]]['escapes']; + + if($escape!==false){ + $text[$escape] = str_replace(array('[', ']'), array('[', ']'), $text[$escape]); + } + + $replace = $codes[$text[1]]['replace']; + + unset($codes[$text[1]]['values'][0]); + + foreach($codes[$text[1]]['values'] as $key => $value){ + + $replace = str_replace('{'.$value.'}', $text[$value], $replace); + } + + $text = $replace; + } + } + + $patterns = array(); + + foreach($this->codes_options as $key => $value){ + $patterns[] = $value['pattern']; + } + + return preg_replace_callback($patterns, array($this, 'parse_with_options'), $text); + } + + // Обработчик видео тегов + private function parse_video($text){ + + $pattern = $replace = array(); + + foreach($this->codes_video as $name => $value){ + $pattern[] = '/\[video\=\"'.$name.'\"\]http(s)?\:\/\/(www\.)?'.$value['pattern'].'\[\/video\]/Usi'; + $replace[] = ''; + } + + return preg_replace($pattern, $replace, $text); + } + + // Обработчик списковых тегов + private function parse_list_line($text){ + + if(is_array($text)){ + $text = '
  • '.$text[1].'
  • '; + } + + return preg_replace_callback('/\[\*\]((?:[^[]|(?R))*)/si', array($this, 'parse_list_line'), $text); + } + + private function parse_list($text){ + + if(is_array($text)){ + + $text = ($text['1']=='numbers') ? '
      '.$text[2].'
    ' : ''; + }else{ + $text = $this->parse_list_line($text); + } + + return preg_replace_callback('/\[list\=\"(markers|numbers)\"\]((?:[^[]|(?R))*)\[\/list\]/Usi', array($this, 'parse_list'), $text); + } + + public function parse($text){ + $text = $this->parse_simple_tags($text); + + $text = $this->parse_smiles($text); + + $text = $this->parse_once($text); + + $text = $this->parse_video($text); + + $text = $this->parse_list($text); + + return $this->parse_with_options($text); + } +} + +?> \ No newline at end of file diff --git a/upload/engine/libs/smiles.php b/upload/engine/libs/smiles.php index 82a5ddb..c8379fb 100644 --- a/upload/engine/libs/smiles.php +++ b/upload/engine/libs/smiles.php @@ -1,20 +1,20 @@ "1.gif", - ":(" => "2.gif", - ";)" => "3.gif", - ":bear:" => "4.gif", - ":like:" => "5.gif", - ":wall:" => "6.gif", - ":D" => "7.gif", - ":shy:" => "8.gif", - ":secret:" => "9.gif", - ":party:" => "10.gif", - ":steep:" => "11.gif", - ":help:" => "12.gif", - ":girl:" => "13.gif", - ":facepalm:" => "14.gif", + "[:)]" => "1.gif", + "[:(]" => "2.gif", + "[;)]" => "3.gif", + "[:bear:]" => "4.gif", + "[:like:]" => "5.gif", + "[:wall:]" => "6.gif", + "[:D]" => "7.gif", + "[:shy:]" => "8.gif", + "[:secret:]" => "9.gif", + "[:party:]" => "10.gif", + "[:steep:]" => "11.gif", + "[:help:]" => "12.gif", + "[:girl:]" => "13.gif", + "[:facepalm:]" => "14.gif", ); ?> \ No newline at end of file diff --git a/upload/engine/libs/smtp/PHPMailerAutoload.php b/upload/engine/libs/smtp/PHPMailerAutoload.php new file mode 100644 index 0000000..eaa2e30 --- /dev/null +++ b/upload/engine/libs/smtp/PHPMailerAutoload.php @@ -0,0 +1,49 @@ + + * @author Jim Jagielski (jimjag) + * @author Andy Prevost (codeworxtech) + * @author Brent R. Matzelle (original founder) + * @copyright 2012 - 2014 Marcus Bointon + * @copyright 2010 - 2012 Jim Jagielski + * @copyright 2004 - 2009 Andy Prevost + * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License + * @note This program is distributed in the hope that it will be useful - WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. + */ + +/** + * PHPMailer SPL autoloader. + * @param string $classname The name of the class to load + */ +function PHPMailerAutoload($classname) +{ + //Can't use __DIR__ as it's only in PHP 5.3+ + $filename = dirname(__FILE__).DIRECTORY_SEPARATOR.'class.'.strtolower($classname).'.php'; + if (is_readable($filename)) { + require $filename; + } +} + +if (version_compare(PHP_VERSION, '5.1.2', '>=')) { + //SPL autoloading was introduced in PHP 5.1.2 + if (version_compare(PHP_VERSION, '5.3.0', '>=')) { + spl_autoload_register('PHPMailerAutoload', true, true); + } else { + spl_autoload_register('PHPMailerAutoload'); + } +} else { + /** + * Fall back to traditional autoload for old PHP versions + * @param string $classname The name of the class to load + */ + function __autoload($classname) + { + PHPMailerAutoload($classname); + } +} diff --git a/upload/engine/libs/smtp/class.html2text.php b/upload/engine/libs/smtp/class.html2text.php new file mode 100644 index 0000000..2060991 --- /dev/null +++ b/upload/engine/libs/smtp/class.html2text.php @@ -0,0 +1,677 @@ + * + * * + * This script is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * The GNU General Public License can be found at * + * http://www.gnu.org/copyleft/gpl.html. * + * * + * This script is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + *************************************************************************/ + +/** + * Converts HTML to formatted plain text + */ +class Html2Text +{ + /** + * Contains the HTML content to convert. + * + * @type string + */ + protected $html; + + /** + * Contains the converted, formatted text. + * + * @type string + */ + protected $text; + + /** + * Maximum width of the formatted text, in columns. + * + * Set this value to 0 (or less) to ignore word wrapping + * and not constrain text to a fixed-width column. + * + * @type integer + */ + protected $width = 70; + + /** + * List of preg* regular expression patterns to search for, + * used in conjunction with $replace. + * + * @type array + * @see $replace + */ + protected $search = array( + "/\r/", // Non-legal carriage return + "/[\n\t]+/", // Newlines and tabs + '/]*>.*?<\/head>/i', // + '/]*>.*?<\/script>/i', // @@ -70,6 +65,13 @@
    + +
    + × +
    +
    +
    +
    @@ -87,6 +89,8 @@ +
    Loading...
    +