Ejemplo n.º 1
0
 public function assign_global($config = array())
 {
     $cfg = Model('app')->get_cfg();
     if (isset($config['c'])) {
         foreach ($config['c'] as $k => $v) {
             if (isset($cfg[$k])) {
                 $cfg[$k] = $v;
             }
         }
     }
     C($cfg);
     C('lang', DEFAULT_LANG);
     //样式路径
     $path = SUBDIR . "/Mobile/Webroot/" . C('home_tpl') . '/';
     $this->set_tpl_dir('', C('home_tpl'));
     C('hy_path', $path);
     if ($_GET['m'] != 'index' && $_GET['a'] != 'index') {
         if (empty($_SESSION['wxid'])) {
             $this->check_member();
         }
     }
     //配置
     $this->assign("web_title", Model('app')->get_cfg('site_name'));
     $this->assign('_GET', $_GET);
     $this->assign('_C', C());
     $this->assign('_L', Lang());
 }
Ejemplo n.º 2
0
Archivo: stat.php Proyecto: romlg/cms36
 function TStat()
 {
     global $str, $actions;
     TTable::TTable();
     $this->selector = false;
     // активируем менюшку слева для окна stat
     $GLOBALS['_elems'] = true;
     // Общие слова для всех файлов статистики
     $actions['tstat'] = array('view_table' => array('Таблица', 'Table', 'link' => 'cnt.ViewIn(\'table\')', 'img' => 'icon.table.gif', 'display' => 'block'), 'view_grapf' => array('График', 'Graph', 'link' => 'cnt.ViewIn(\'graph\')', 'img' => 'icon.graph.gif', 'display' => 'block'), 'view_bargrapf' => array('Гистограмма', 'Bar graph', 'link' => 'cnt.ViewIn(\'bargraph\')', 'img' => 'icon.bargraph.gif', 'display' => 'block'), 'view_diag' => array('Диаграмма', 'Diagram', 'link' => 'cnt.ViewIn(\'diag\')', 'img' => 'icon.diag.gif', 'display' => 'block'), 'view_csv' => array('Экспорт в CSV', 'Export in CSV', 'link' => 'cnt.ViewIn(\'csv\')', 'img' => 'xls.gif', 'display' => 'block'));
     $str['tstat'] = array('stat' => array('Статистика', 'Statistics'), 't_from_server' => array('пользователи с сервера "%s"', 'visitors from server "%s"'), 't_from_search_ph' => array('пользователи по поисковой фразе "%s"', 'visitors from search phrase "%s"'), 't_points' => array('пользователи с входом со страницы "%s"', 'visitors from enter page "%s"'), 't_outs' => array('пользователи с последней страницей "%s"', 'visitors with last page "%s"'), 't_ip' => array('посетители с ip "%s"', 'visitors with ip "%s"'), 't_robot' => array('поисковая машина: "%s"', 'search machine: "%s"'), 't_client' => array('пользователь "#%u"', 'client "#%u"'), 't_country' => array('пользователи из страны "%s"', 'visitors from country "%s"'), 't_path' => array('путь "%s"', 'path "%s"'), 't_ref_page' => array('пользователи, пришедшие со страницы "%s"', 'visitors from reference page "%s"'), 't_see_page' => array('пользователи, просмотревшие страниц "%s"', 'visitors who viewed pages "%s"'), 't_reklama' => array('рекламная кампания "%s"', 'advertising campaign "%s"'), 'no_data' => array('Нет данных', 'No data'), 'total_period' => array('Всего за данный период', 'Summary for this period'), 'csv_file' => array('Скачать CSV файл', 'Download CSV file'), 'percent' => array('Процент от всех', 'Percent from all'), 'amount' => array('Кол-во', 'Amount'), 'more' => array('подробнее...', 'more...'), 'compare' => array('сравнить...', 'compare...'), 'reports' => array('Отчеты', 'Reports'), 'settings' => array('Настройки', 'Settings'), 'others' => array('Остальные', 'Others'), 'count_rows' => array('Всего', 'Count rows'), 'show_from' => array('C', 'From'), 'show_to' => array('по', 'to'), 'nav_period' => array('Период', 'Period'), 'nav_more' => array('Дополнительно', 'More'), 'nav_select_period' => array('Выбор периода', 'Select period'), 'nav_today' => array('за сегодня', 'today'), 'nav_today_title' => array('Смотреть статистику за сегодня по часам', 'View statistic for today by hours'), 'nav_yesterday' => array('вчера', 'yesterday'), 'nav_yesterday_title' => array('Смотреть статистику за вчера по часам', 'View statistic for yesterday by hours'), 'nav_week' => array('за неделю', 'last week'), 'nav_week_title' => array('Смотреть статистику за прошедшую неделю по дням', 'View statistic for the last week by days'), 'nav_month' => array('за месяц', 'last month'), 'nav_month_title' => array('Смотреть статистику за прошедший месяц по дням', 'View statistic for the last month by days'), 'nav_all' => array('за все время', 'all time'), 'nav_all_title' => array('Смотреть статистику за все время по месяцам', 'View statistic for all time by months'), 'nav_analyze_page' => array('Просмотры выбранной страницы', 'Analyzing page'), 'select_date' => array('Выбрать дату', 'Select date'), 'nav_use_filter' => array('использовать фильтр', 'use filter'), 'nav_edit_filter' => array('настроить', 'edit'), 'nav_show' => array('показать', 'show'), 'dayweek_0' => array('Понедельник', 'Monday'), 'dayweek_1' => array('Вторник', 'Tuesday'), 'dayweek_2' => array('Среда', 'Wednesday'), 'dayweek_3' => array('Четверг', 'Thursday'), 'dayweek_4' => array('Пятница', 'Friday'), 'dayweek_5' => array('Суббота', 'Saturday'), 'dayweek_6' => array('Воскресенье', 'Sunday'), 'sm_dayweek_0' => array('Пон', 'Mon'), 'sm_dayweek_1' => array('Вт', 'Tue'), 'sm_dayweek_2' => array('Ср', 'Wed'), 'sm_dayweek_3' => array('Чет', 'Thu'), 'sm_dayweek_4' => array('Пят', 'Fri'), 'sm_dayweek_5' => array('Суб', 'Sat'), 'sm_dayweek_6' => array('Вос', 'Sun'), 'month_1' => array('Январь', 'January'), 'month_2' => array('Февраль', 'February'), 'month_3' => array('Март', 'March'), 'month_4' => array('Апрель', 'April'), 'month_5' => array('Май', 'May'), 'month_6' => array('Июнь', 'June'), 'month_7' => array('Июль', 'July'), 'month_8' => array('Август', 'August'), 'month_9' => array('Сентябрь', 'September'), 'month_10' => array('Октябрь', 'October'), 'month_11' => array('Ноябрь', 'November'), 'month_12' => array('Декабрь', 'December'), 'sm_month_1' => array('Янв', 'Jan'), 'sm_month_2' => array('Фев', 'Feb'), 'sm_month_3' => array('Мар', 'Mar'), 'sm_month_4' => array('Апр', 'Apr'), 'sm_month_5' => array('Май', 'May'), 'sm_month_6' => array('Июн', 'Jun'), 'sm_month_7' => array('Июл', 'Jul'), 'sm_month_8' => array('Авг', 'Aug'), 'sm_month_9' => array('Сен', 'Sep'), 'sm_month_10' => array('Окт', 'Oct'), 'sm_month_11' => array('Ноя', 'Nov'), 'sm_month_12' => array('Дек', 'Dec'), 'ok' => array('  OK  ', '  OK  '), 'reset' => array('Сброс', 'Reset'), 'find' => array('Найти', 'Find'), 'search' => array('Поиск', 'Search'), 'help' => array('Поиск ведется по шаблону для выражения LIKE', 'Search by the template for LIKE statement'), 'count_find' => array('Всего найдено', 'Find sum total'), 'not_find' => array('По Вашему запросу ничего не найдено', 'Nothing was found'), 'all' => array('-- все --', '-- all --'), 'alias_for' => array('алиас для', 'alias for'), 'site_selection' => array('Выбор сайта', 'Site selection'), 'site' => array('Сайт', 'Site'));
     // Определяем дополнительные отчеты:
     $reklama_str = "";
     if (isset($_GET['adv']['reklama'])) {
         $identifiers = explode(', ', $_GET['adv']['reklama']);
         $reklama_str = " (";
         foreach ($identifiers as $k2 => $v2) {
             $reklama_str .= "page.uri like '***from=" . $v2 . "'";
             if ($k2 < count($identifiers) - 1) {
                 $reklama_str .= " OR ";
             }
         }
         $reklama_str .= ")";
     }
     $advanced = array('server' => array('title' => 't_from_server', 'exclude' => array('stat/stat_ref_server', 'stat/stat_robots', 'stat/stat_settings', 'stat/stat_now'), 'join' => "", 'where' => "sess.host='%s'"), 'search_ph' => array('title' => 't_from_search_ph', 'exclude' => array('stat/stat_search_ph', 'stat/stat_robots', 'stat/stat_settings', 'stat/stat_now'), 'join' => "LEFT JOIN " . STAT_PAGES_TABLE . " AS pag ON pag.id=sess.ref_id", 'where' => "pag.search_ph='%s'"), 'points' => array('title' => 't_points', 't_name' => "SELECT CONCAT('http://', host, uri) FROM " . STAT_PAGES_TABLE . " WHERE id=%u", 'exclude' => array('stat/stat_points', 'stat/stat_robots', 'stat/stat_settings', 'stat/stat_now'), 'join' => '', 'where' => "sess.first_page='%u'"), 'outs' => array('title' => 't_outs', 't_name' => "SELECT CONCAT('http://', host, uri) FROM " . STAT_PAGES_TABLE . " WHERE id=%u", 'exclude' => array('stat/stat_outs', 'stat/stat_robots', 'stat/stat_settings', 'stat/stat_now'), 'join' => '', 'where' => "sess.last_page='%u'"), 'ip' => array('title' => 't_ip', 'exclude' => array('stat/stat_ip', 'stat/stat_robots', 'stat/stat_settings', 'stat/stat_now'), 'join' => '', 'where' => "IF(ip<0, INET_NTOA(ip+4294967296), INET_NTOA(ip))='%s'"), 'robot' => array('title' => 't_robot', 'exclude' => array(), 'join' => '', 'where' => ''), 'client' => array('title' => 't_client', 'exclude' => array('stat/stat_clients', 'stat/stat_robots', 'stat/stat_settings', 'stat/stat_now'), 'join' => '', 'where' => "sess.client_id='%u'"), 'country' => array('title' => 't_country', 't_name' => "SELECT name_" . (Lang() == 'ru' ? 'ru' : 'en') . " FROM " . STAT_COUNTRIES_TABLE . " WHERE country_id='%s'", 'exclude' => array('stat/stat_geography', 'stat/stat_robots', 'stat/stat_settings', 'stat/stat_now'), 'join' => '', 'where' => "sess.country='%s'"), 'robots' => array('title' => 't_robots', 't_name' => "SELECT name_" . (Lang() == 'ru' ? 'ru' : 'en') . " FROM " . STAT_COUNTRIES_TABLE . " WHERE country_id='%s'", 'exclude' => array('stat/stat_geography', 'stat/stat_robots', 'stat/stat_settings', 'stat/stat_now'), 'join' => '', 'where' => "sess.country='%s'"), 'path' => array('title' => 't_path', 'exclude' => array('stat/stat_popular', 'stat/stat_pathes', 'stat/stat_points', 'stat/stat_outs', 'stat/stat_robots', 'stat/stat_now'), 'join' => "", 'where' => "sess.path = '%s'"), 'ref_page' => array('title' => 't_ref_page', 'exclude' => array('stat/stat_ref_server', 'stat/stat_ref_pages', 'stat/stat_popular', 'stat/stat_robots', 'stat/stat_now'), 'join' => "LEFT JOIN " . STAT_PAGES_TABLE . " AS pag ON pag.id=sess.ref_id", 'where' => "sess.ref_id <> 0 AND CONCAT(pag.host,pag.uri) = '%s'"), 'see_page' => array('title' => 't_see_page', 'exclude' => array(), 'join' => "", 'where' => "LENGTH(sess.path)-LENGTH(REPLACE(sess.path,' ',''))+1 %s"), 'reklama' => array('title' => 't_reklama', 'exclude' => array('stat/stat_reklama', 'stat/stat_robots', 'stat/stat_error', 'stat/stat_popular'), 'join' => "LEFT JOIN " . STAT_PAGES_TABLE . " AS page ON page.id=sess.first_page", 'where' => $reklama_str));
     // Если есть дополнительный отчет
     $this->MakeAdvanced($advanced);
 }
Ejemplo n.º 3
0
 function TCities()
 {
     global $str, $actions;
     TStat::TStat();
     $actions[str_replace('/', '__', $this->name)] = array('view_table' => &$actions['tstat']['view_table']);
     $str[get_class_name($this)] = $str['tstat'] + array('unknown_city' => array('Город неопределен', 'Uknown city'), 'city' => array('Город (Область)', 'Cities (Region)'), 'visitors' => array('Посетители', 'Visitors'), 'tip' => array('Отчет расскажет вам, в каких городах интересно то, о чем вы хотите рассказать на вашем сайте.', ''));
     // На каком языке писать название страны
     $this->country_lang = Lang() == 'ru' ? 'ru' : 'en';
 }
Ejemplo n.º 4
0
 function TGeography()
 {
     global $str, $actions;
     TStat::TStat();
     $actions[str_replace('/', '__', $this->name)] = array('view_table' => &$actions['tstat']['view_table'], 'view_diag' => &$actions['tstat']['view_diag'], 'view_csv' => &$actions['tstat']['view_csv']);
     $str[get_class_name($this)] = $str['tstat'] + array('countries' => array('Страны', 'Countries'), 'country' => array('Страна', 'Country'), 'visitors' => array('Посетители', 'Visitors'), 'tip' => array('Отчет расскажет вам, в каких странах интересно то, о чем вы хотите рассказать на вашем сайте.', ''));
     // На каком языке писать название страны
     $this->country_lang = Lang() == 'ru' ? 'ru' : 'en';
 }
Ejemplo n.º 5
0
 /**
  * 创建关键字或绑定
  * @param unknown $info
  * @return multitype:number string Ambigous <boolean, void, multitype:, string>
  */
 public function create_key($info)
 {
     $result = array('error' => 0, 'content' => '');
     $data = yf_set_insert($info);
     $sql = "INSERT INTO " . $this->table('wxkeyword') . " (" . $data['key'] . ") VALUES(" . $data['val'] . ")";
     if (!($res = $this->query($sql))) {
         $result['error'] = 1;
         $result['content'] = Lang('SQL_ERROR');
     }
     return $result;
 }
Ejemplo n.º 6
0
 /**
  * 删除已备份的数据库文件
  */
 public function delsql()
 {
     $file_name = empty($_GET['file_name']) ? '' : trim($_GET['file_name']);
     $filename = TEMP_PATH . '/sqldata/' . $file_name;
     $result = array('error' => 1, 'content' => Lang('INVALID_OPERATION'));
     if (is_file($filename)) {
         @unlink($filename);
         $result['error'] = 0;
         $result['content'] = Lang('VALID_OPERATION');
     }
     $this->showMsg($result);
 }
Ejemplo n.º 7
0
 public function sumbit()
 {
     $info['name'] = isset($_POST['name']) ? $_POST['name'] : '';
     $info['phone'] = isset($_POST['phone']) ? $_POST['phone'] : '';
     $info['email'] = isset($_POST['email']) ? $_POST['email'] : '';
     $info['content'] = isset($_POST['content']) ? $_POST['content'] : '';
     if (Model('msg')->insert_msg($info)) {
         $this->showMsg(Lang('VALID_OPERATION'), 'index.php');
     } else {
         $this->showMsg(Lang('INVALID_OPERATION'));
     }
 }
Ejemplo n.º 8
0
 public function assign_global($config = array())
 {
     $cfg = Model('app')->get_cfg();
     if (isset($config['c'])) {
         foreach ($config['c'] as $k => $v) {
             if (isset($cfg[$k])) {
                 $cfg[$k] = $v;
             }
         }
     }
     C($cfg);
     C('lang', DEFAULT_LANG);
     //样式路径
     $path = SUBDIR . "/Home/Webroot/" . C('home_tpl') . '/';
     $this->set_tpl_dir('', C('home_tpl'));
     C('hy_path', $path);
     //配置
     $this->assign('_GET', $_GET);
     $this->assign('_C', C());
     $this->assign('_L', Lang());
 }
Ejemplo n.º 9
0
 /**
  *  权限管理
  * @access public
  * @param $action 权限名
  *  @param $type 消息类型
  * @return void
  */
 public function admin_priv($action, $type = 1)
 {
     $priv_id = Model('app')->get_action_id($action);
     if ($_SESSION['admin_action'] == '-1') {
         return true;
     }
     $admin_mod = explode(",", $_SESSION['admin_mod']);
     if (!in_array($priv_id, $admin_mod)) {
         if ($_POST) {
             $result = array('error' => 1, 'content' => Lang('PERMISSION_DENIED'));
             $this->showMsg($result);
         } else {
             if (strpos($_GET['a'], 'del') !== false) {
                 $result = array('error' => 1, 'content' => Lang('PERMISSION_DENIED'));
                 $this->showMsg($result);
             }
             echo "你没有操作的权限";
             exit;
         }
         return false;
     } else {
         return true;
     }
 }
Ejemplo n.º 10
0
 /**
  * 备份数据库数据
  * @return 
  */
 public function backup()
 {
     $db = $this->db;
     global $prefix;
     $path = ROOT_PATH . '/Temp/sqldata';
     $mask = file_exists($path);
     $result = array('error' => 1, 'content' => '');
     if ($mask === false) {
         $warning = sprintf(Lang('dir_not_exist'), $path);
         $result['content'] = $warning;
         return $result;
     } elseif ($mask != 15) {
         $warning = sprintf(Lang('dir_priv'), $path);
         if (($mask & 1) < 1) {
             $warning .= Lang('cannot_read');
         }
         if (($mask & 2) < 1) {
             $warning .= Lang('cannot_write');
         }
         if (($mask & 4) < 1) {
             $warning .= Lang('cannot_add');
         }
         if (($mask & 8) < 1) {
             $warning .= Lang('cannot_modify');
         }
         $result['content'] = $warning;
         return $result;
     }
     /* 设置最长执行时间为5分钟 */
     @set_time_limit(300);
     /* 初始化 */
     $dump = new sql_dumpDB($db);
     $run_log = ROOT_PATH . '/Temp/sqldata/run.log';
     /* 初始化输入变量 */
     if (empty($_REQUEST['sql_file_name'])) {
         $sql_file_name = $dump->get_random_name();
     } else {
         $sql_file_name = str_replace("0xa", '', trim($_REQUEST['sql_file_name']));
         // 过滤 0xa 非法字符
         $pos = strpos($sql_file_name, '.sql');
         if ($pos !== false) {
             $sql_file_name = substr($sql_file_name, 0, $pos);
         }
     }
     $max_size = empty($_REQUEST['vol_size']) ? 0 : intval($_REQUEST['vol_size']);
     $vol = empty($_REQUEST['vol']) ? 1 : intval($_REQUEST['vol']);
     $is_short = empty($_REQUEST['ext_insert']) ? false : true;
     $dump->is_short = $is_short;
     /* 变量验证 */
     $allow_max_size = intval(@ini_get('upload_max_filesize'));
     //单位M
     if ($allow_max_size > 0 && $max_size > $allow_max_size * 1024) {
         $max_size = $allow_max_size * 1024;
         //单位K
     }
     if ($max_size > 0) {
         $dump->max_size = $max_size * 1024;
     }
     /* 获取要备份数据列表 */
     $type = empty($_POST['type']) ? 'full' : trim($_POST['type']);
     $tables = array();
     switch ($type) {
         case 'full':
             $except = array($prefix . 'sessions', $prefix . 'sessions_data');
             $temp = $db->GetCol("SHOW TABLES LIKE '" . mysql_like_quote($prefix) . "%'");
             foreach ($temp as $table) {
                 if (in_array($table, $except)) {
                     continue;
                 }
                 $tables[$table] = -1;
             }
             $dump->put_tables_list($run_log, $tables);
             break;
         case 'stand':
             $temp = array('admin_user', 'area_region', 'article', 'article_cat', 'attribute', 'brand', 'cart', 'category', 'comment', 'goods', 'goods_attr', 'goods_cat', 'goods_gallery', 'goods_type', 'group_goods', 'link_goods', 'member_price', 'order_action', 'order_goods', 'order_info', 'payment', 'region', 'shipping', 'shipping_area', 'shop_config', 'user_address', 'user_bonus', 'user_rank', 'users', 'virtual_card');
             foreach ($temp as $table) {
                 $tables[$ecs->prefix . $table] = -1;
             }
             $dump->put_tables_list($run_log, $tables);
             break;
         case 'min':
             $temp = array('attribute', 'brand', 'cart', 'category', 'goods', 'goods_attr', 'goods_cat', 'goods_gallery', 'goods_type', 'group_goods', 'link_goods', 'member_price', 'order_action', 'order_goods', 'order_info', 'shop_config', 'user_address', 'user_bonus', 'user_rank', 'users', 'virtual_card');
             foreach ($temp as $table) {
                 $tables[$ecs->prefix . $table] = -1;
             }
             $dump->put_tables_list($run_log, $tables);
             break;
         case 'custom':
             foreach ($_POST['customtables'] as $table) {
                 $tables[$table] = -1;
             }
             $dump->put_tables_list($run_log, $tables);
             break;
     }
     /* 开始备份 */
     $tables = $dump->dump_table($run_log, $vol);
     if ($tables === false) {
         die($dump->errorMsg());
     }
     if (empty($tables)) {
         /* 备份结束 */
         if ($vol > 1) {
             /* 有多个文件 */
             if (!@file_put_contents(ROOT_PATH . '/Temp/sqldata/' . $sql_file_name . '_' . $vol . '.sql', $dump->dump_sql)) {
                 //sys_msg(sprintf($_LANG['fail_write_file'], $sql_file_name . '_' . $vol . '.sql'), 1, array(array('text'=>$_LANG['02_db_manage'], 'href'=>'database.php?act=backup')), false);
                 $result['content'] = Lang('backup_fail');
                 return $result;
             }
             $list = array();
             for ($i = 1; $i <= $vol; $i++) {
                 $list[] = array('name' => $sql_file_name . '_' . $i . '.sql', 'href' => '../' . DATA_DIR . '/sqldata/' . $sql_file_name . '_' . $i . '.sql');
             }
             $result['error'] = 0;
             $result['content'] = Lang('backup_success');
             return $result;
         } else {
             /* 只有一个文件 */
             if (!@file_put_contents(ROOT_PATH . '/Temp/sqldata/' . $sql_file_name . '.sql', $dump->dump_sql)) {
                 $result['content'] = Lang('backup_fail');
             } else {
                 $result['error'] = 0;
                 $result['content'] = Lang('backup_success');
             }
             return $result;
         }
     } else {
         /* 下一个页面处理 */
         if (!@file_put_contents(ROOT_PATH . '/Temp/sqldata/' . $sql_file_name . '_' . $vol . '.sql', $dump->dump_sql)) {
             $result['content'] = Lang('backup_fail');
         } else {
             $result['error'] = 0;
             $result['content'] = Lang('backup_success');
         }
         return $result;
     }
 }
Ejemplo n.º 11
0
 function DrawFooter()
 {
     $aString = explode("_", str_replace("]", "]_", str_replace("[", "_[", Lang("Powered by [AWSTART]AWStats[END]. Made beautiful by [JAWSTART]JAWStats Web Statistics and Analytics[END]."))));
     for ($i = 0; $i < count($aString); $i++) {
         if (strlen(trim($aString[$i])) > 0 && substr($aString[$i], 0, 1) != "[" && substr($aString[$i + 1], 0, 5) != "[END]") {
             $aString[$i] = "<span>" . $aString[$i] . "</span>";
         } else {
             switch ($aString[$i]) {
                 case "[AWSTART]":
                     $aString[$i] = "<a href=\"http://www.awstats.org/\" target=\"_blank\">";
                     break;
                 case "[END]":
                     $aString[$i] = "</a>";
                     break;
                 case "[JAWSTART]":
                     $aString[$i] = "<a href=\"http://jawstats.com/\" target=\"_blank\">";
                     break;
             }
         }
     }
     return implode($aString);
 }
Ejemplo n.º 12
0
function Error($sReason, $sExtra = "")
{
    // echo "ERROR!<br />" . $sReason;
    switch ($sReason) {
        case "BadConfig":
            $sProblem = str_replace("[FILENAME]", "\"config.php\"", Lang("There is an error in [FILENAME]"));
            $sResolution = "<p>" . str_replace("[VARIABLE]", "<i>" . $sExtra . "</i>", Lang("The variable [VARIABLE] is missing or invalid.")) . "</p>";
            break;
        case "BadConfigNoSites":
            $sProblem = str_replace("[FILENAME]", "\"config.php\"", Lang("There is an error in [FILENAME]"));
            $sResolution = "<p>" . Lang("No individual AWStats configurations have been defined.") . "</p>";
            break;
        case "CannotLoadClass":
            $sProblem = str_replace("[FILENAME]", "\"clsAWStats.php\"", Lang("Cannot find required file [FILENAME]"));
            $sResolution = "<p>" . Lang("At least one file required by JAWStats has been deleted, renamed or corrupted.") . "</p>";
            break;
        case "CannotLoadConfig":
            $sProblem = str_replace("[FILENAME]", "\"config.php\"", Lang("Cannot find required file [FILENAME]"));
            $sResolution = "<p>" . str_replace("[CONFIGDIST]", "<i>config.dist.php</i>", str_replace("[CONFIG]", "<i>config.php</i>", Lang("JAWStats cannot find it's configuration file, [CONFIG]. Did you successfully copy and rename the [CONFIGDIST] file?"))) . "</p>";
            break;
        case "CannotLoadLanguage":
            $sProblem = str_replace("[FILENAME]", "\"languages/translations.php\"", Lang("Cannot find required file [FILENAME]"));
            $sResolution = "<p>" . Lang("At least one file required by JAWStats has been deleted, renamed or corrupted.") . "</p>";
            break;
        case "CannotOpenLog":
            $aConfig = $GLOBALS["aConfig"][$GLOBALS["g_sConfig"]];
            $sStatsPath = $aConfig["statspath"];
            /* 	$aConfig = $GLOBALS["aConfig"][$GLOBALS["g_sConfig"]];
                 $sStatsPath = $aConfig["statspath"];
                 $sStatsName = "awstats" . date("mY") . "." . $GLOBALS["g_sConfig"];
                 $parts = array_key_exists("parts", $aConfig)?$aConfig["parts"]:NULL;
                 if (strlen($parts) > 0) {
                 $arr=explode(",",$parts);
                 $sStatsName.=".".$arr[0];
                 }
                 $sStatsName.=".txt";
                 if ($GLOBALS["bUTF8LogFiles"])
                 $sStatsName .= ".utf8";
                */
            $sProblem = Lang("JAWStats could not open an AWStats log file");
            $sResolution = "<p>" . Lang("Is the specified AWStats log file directory correct? Does it have a trailing slash?") . "<br />" . str_replace("[VARIABLE]", "<strong>\"statspath\"</strong>", str_replace("[CONFIG]", "<i>config.php</i>", Lang("The problem may be the variable [VARIABLE] in your [CONFIG] file."))) . "</p>" . "<p>" . str_replace("[FOLDER]", "<strong>" . $sStatsPath . "</strong>\n", str_replace("[FILE]", "<strong>" . $sExtra . "</strong>", Lang("The data file being looked for is [FILE] in folder [FOLDER]")));
            if (substr($sStatsPath, -1) != "/") {
                $sResolution .= "<br />" . str_replace("[FOLDER]", "<strong>" . $sStatsPath . "/</strong>", Lang("Try changing the folder to [FOLDER]"));
            }
            $sResolution .= "</p>";
            $sResolution .= "<p> Last PHP Error Message : " . $GLOBALS["errstr"] . "</p>";
            break;
        case "NoLogsFound":
            $sStatsPath = $GLOBALS["aConfig"][$GLOBALS["g_sConfig"]]["statspath"];
            $sProblem = Lang("No AWStats Log Files Found");
            $sResolution = "<p>JAWStats cannot find any AWStats log files in the specified directory: <strong>" . $sStatsPath . "</strong><br />" . "Is this the correct folder? Is your config name, <i>" . $GLOBALS["g_sConfig"] . "</i>, correct?</p>\n";
            if ($GLOBALS["bUTF8LogFiles"]) {
                $sResolution .= "<p> Note : I was looking for files with '.utf8' extension, as specified in the configuration file</p>";
            }
            break;
        case "Unknown":
            $sProblem = "";
            $sResolution = "<p>" . $sExtra . "</p>\n";
            break;
    }
    echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" " . "\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n" . "<html xmlns=\"http://www.w3.org/1999/xhtml\">\n" . "<head>\n" . "<title>JAWStats</title>\n" . "<style type=\"text/css\">\n" . "html, body { background: #33332d; border: 0; color: #eee; font-family: arial, helvetica, sans-serif; font-size: 15px; margin: 20px; padding: 0; }\n" . "a { color: #9fb4cc; text-decoration: none; }\n" . "a:hover { color: #fff; text-decoration: underline; }\n" . "h1 { border-bottom: 1px solid #cccc9f; color: #eee; font-size: 22px; font-weight: normal; } \n" . "h1 span { color: #cccc9f !important; font-size: 16px; } \n" . "p { margin: 20px 30px; }\n" . "</style>\n" . "</head>\n<body>\n" . "<h1><span>" . Lang("An error has occured") . ":</span><br />" . $sProblem . "</h1>\n" . $sResolution . "<p>" . str_replace("[LINKSTART]", "<a href=\"http://www.jawstats.com/documentation\" target=\"_blank\">", str_replace("[LINKEND]", "</a>", Lang("Please refer to the [LINKSTART]installation instructions[LINKEND] for more information."))) . "</p>\n" . "</body>\n</html>";
    exit;
}
Ejemplo n.º 13
0
function ToolUpdateSite()
{
    if ($GLOBALS["bConfigUpdateSites"] != true) {
        return "";
    }
    // create html
    $aHTML = array();
    $aHTML[] = "<div id=\"toolUpdate\" class=\"tool\">\n<div>";
    $aHTML[] = "<h1>" . Lang("Please enter the password to update this site") . "<span onclick=\"ShowTools('toolUpdate')\">(" . Lang("Cancel") . ")</span></h1>\n<div id=\"siteupdate\">";
    $aHTML[] = "<input type=\"password\" id=\"password\" onkeyup=\"UpdateSiteKeyUp(event)\" />";
    $aHTML[] = "<input type=\"button\" onclick=\"UpdateSite()\" value=\"" . Lang("Update") . "\" />";
    $aHTML[] = "</div>\n</div>\n</div>";
    return implode($aHTML, "\n");
}
Ejemplo n.º 14
0
 /**
  * 保存用户资料
  * @param array $info
  * @return boolean
  */
 function saveInfo($info = array())
 {
     $where = '';
     $update_pwd = false;
     foreach ($info as $k => $v) {
         if ($v != '') {
             if ($k == 'password') {
                 $where .= " {$k}='" . md5($v) . "',";
                 $update_pwd = true;
             } else {
                 $where .= " {$k}='{$v}',";
             }
         }
     }
     $where .= "modified=" . $_SERVER['REQUEST_TIME'];
     $result == array('error' => 0, 'content' => '');
     $sql = "UPDATE " . $this->table('admin') . " SET " . $where . " WHERE id='" . session('admin_id') . "'";
     if ($res = $this->query($sql)) {
         if ($update_pwd) {
             $result['error'] = -1;
         }
     } else {
         $result['error'] = 1;
         $result['content'] = Lang('SQL_ERROR');
     }
     return $result;
     //invalid_operation
 }
Ejemplo n.º 15
0
 /**
  * 更新菜单信息
  */
 public function update_menu()
 {
     $this->admin_priv('edit_wx_menu');
     $menu = isset($_POST) ? $_POST : '';
     $result = array('error' => 1, 'content' => '');
     $wm = Model('wxmenu');
     if (empty($menu['name'])) {
         $result['content'] = Lang('NAME_EMPTY');
         $this->showMsg($result);
     }
     $old_pid = $menu['old_pid'];
     unset($menu['old_pid']);
     if ($old_pid != $menu['parent_id']) {
         if ($menu['parent_id'] == 0) {
             if (count($wm->get_parent_menu()) > 2) {
                 $result['content'] = '根目录菜单不能超过三个';
                 $this->showMsg($result);
             }
         } else {
             if (count($wm->get_child_menu($menu['parent_id'])) > 4) {
                 $result['content'] = '子目录菜单不能超过五个';
                 $this->showMsg($result);
             }
         }
     }
     if ($menu['type'] == 1) {
         unset($menu['rule']);
     } else {
         unset($menu['url']);
     }
     $id = $menu['id'];
     unset($menu['id']);
     $res = $wm->update($menu, array('id' => $id, 'table' => 'wxmenu'));
     if ($res) {
         $result['error'] = 0;
         $result['content'] = Lang('SUCCESS_edit');
     } else {
         $result['content'] = Lang('INVALID_OPERATION');
     }
     $this->showMsg($result);
 }
Ejemplo n.º 16
0
      <input type='hidden' name='step' value='2'>
      <input type='hidden' name='r_key' value='<?php 
    echo $_POST['r_key'];
    ?>
'>
        <div style="margin:4px;padding:6px 9px 6px 9px;text-align:left;">
        <h2 style="margin:2px;"> <?php 
    echo $lang['rules_agreement'];
    ?>
 </h2>
        <font color="red"><?php 
    echo $lang['warn_email'];
    ?>
</font>
        <?php 
    Lang('acc_create_rules');
    ?>
        </div>
        <div style="margin:4px;padding:6px 9px 0px 9px;text-align:left;">
        <input type='button' class='button' value="<?php 
    echo $lang['disagree'];
    ?>
" onClick="location.href='index.php'"> &nbsp;&nbsp;
        <input type='submit' class='button' value="<?php 
    echo $lang['agree'];
    ?>
">
        </div>
      </form>
<?php 
} elseif (empty($_POST['step']) && $config['req_reg_key'] === true && $allow_reg === true) {
Ejemplo n.º 17
0
 public function act_login()
 {
     $result = array('error' => 1, 'content' => '', 'url' => '');
     if (isset($_SESSION['account']) && isset($_SESSION['pwd'])) {
         $username = isset($_POST[$_SESSION['account']]) ? hy_check($_POST[$_SESSION['account']], 'n', 15) : '';
         $password = isset($_POST[$_SESSION['pwd']]) ? hy_check($_POST[$_SESSION['pwd']], '', 30) : '';
         if ($username == '#@_error' || $password == '#@_error') {
             $result['content'] = Lang('LOGIN_ERR');
         } else {
             if (Model('user')->check_user($username, $password)) {
                 $result['error'] = 0;
                 $result['content'] = Lang('WELCOME_BACK');
                 if (REWRITE == 1) {
                     $result['url'] = '/user/index.html';
                 } else {
                     $result['url'] = '/index.php?g=home&m=user&a=index';
                 }
             } else {
                 $result['content'] = Lang('LOGIN_ERR');
             }
         }
         die(json_encode($result));
     } else {
         exit;
     }
 }
Ejemplo n.º 18
0
 public function insert_pro()
 {
     $info['cat_id'] = isset($_POST['cat_id']) ? $_POST['cat_id'] : '';
     $info['title'] = isset($_POST['title']) ? $_POST['title'] : '';
     $info['abstract'] = isset($_POST['abstract']) ? $_POST['abstract'] : '';
     $info['keywords'] = isset($_POST['keywords']) ? $_POST['keywords'] : '';
     $info['model'] = isset($_POST['model']) ? $_POST['model'] : '';
     $info['size'] = isset($_POST['size']) ? $_POST['size'] : '';
     $info['content'] = isset($_POST['content']) ? $_POST['content'] : '';
     $info['hits'] = isset($_POST['hits']) ? $_POST['hits'] : '';
     $info['is_show'] = isset($_POST['is_show']) ? $_POST['is_show'] : '';
     $info['is_push'] = isset($_POST['is_push']) ? $_POST['is_push'] : '';
     $img_array = isset($_POST['img_array']) ? (array) json_decode(stripslashes($_POST['img_array'])) : '';
     $info['page_title'] = isset($_POST['page_title']) ? $_POST['page_title'] : '';
     $info['created'] = $_SERVER['REQUEST_TIME'];
     $info['page_title'] = isset($_POST['page_title']) ? $_POST['page_title'] : '';
     $info['thumb'] = isset($_POST['thumb']) ? $_POST['thumb'] : '';
     if ($info['title'] == '') {
         $data['content'] = Lang('NAME_EMPTY');
         $this->showMsg($data);
     }
     $result = Model('pro')->create_pro($info, $img_array);
     $data = array('error' => 0, 'content' => '', 'url' => '');
     if ($result['error'] == 0) {
         $data['content'] = Lang('SUCCESS_ADD');
         $data['url'] = "index.php?g=admin&m=content&a=add_content&id=" . $info['cat_id'];
     } else {
         $data['content'] = Lang('INVALID_OPERATION');
         //$data['url']=$_SERVER['REQUEST_URI'];
     }
     $this->showMsg($data);
 }
Ejemplo n.º 19
0
function ElapsedTime($iSeconds)
{
    if ($GLOBALS["g_iThisLog"] == 0) {
        if ($iSeconds < 60) {
            return " (<" . Lang("1 min ago") . ")";
        }
        $iMinutes = floor($iSeconds / 60);
        if ($iMinutes < 60) {
            if ($iMinutes == 1) {
                return " (" . Lang("1 min ago") . ")";
            } else {
                return " (" . str_replace("[MINUTES]", $iMinutes, Lang("[MINUTES] mins ago")) . ")";
            }
        }
        $iHours = floor($iMinutes / 60);
        if ($iHours < 24) {
            $iMinutes = $iMinutes - $iHours * 60;
            return " (" . str_replace("[HOURS]", $iHours, str_replace("[MINUTES]", $iMinutes, Lang("[HOURS]h [MINUTES]m ago"))) . ")";
        }
        $iDays = floor($iHours / 24);
        if ($iDays == 1) {
            return " (" . Lang("1 day ago") . ")";
        } else {
            return " (" . str_replace("[DAYS]", $iDays, Lang("[DAYS] days ago")) . ")";
        }
    }
}
Ejemplo n.º 20
0
 /**
  * 登录操作
  */
 public function act_login()
 {
     $username = isset($_POST['username']) ? hy_check($_POST['username'], 'un', 15) : '';
     $password = isset($_POST['password']) ? hy_check($_POST['password'], '', 20) : '';
     $captcha = isset($_POST['captcha']) ? $_POST['captcha'] : '';
     $check_vali = $this->validator($captcha);
     if (!$check_vali || $captcha == '') {
         $this->showMsg('验证码错误', 'index.php?g=admin&m=index&a=login');
     }
     if ($username == '#@_error' || $password == '#@_error') {
         Error::log('[后台登录错误]' . $_POST['username'] . '--' . hy_getIP(), ADMIN_LOG);
         $this->showMsg(Lang('账号或者密码错误'), '/qq_admin.php');
     }
     if (Model('index')->check_user($username, $password)) {
         header("Location:index.php?g=admin&m=index&a=index");
     } else {
         Error::log('[后台登录错误]' . $_POST['username'] . '--' . hy_getIP(), ADMIN_LOG);
         $this->showMsg(Lang('账号或者密码错误'), 'index.php?g=admin&m=index&a=login');
     }
 }
Ejemplo n.º 21
0
 /**
  * 插入关键字信息
  */
 public function new_key()
 {
     $this->admin_priv('add_key');
     $info['keyword'] = yf_empty($_POST['keyword'], '关键字名称不能为空');
     $info['rid'] = yf_empty(intval($_POST['rule_id']), '', true);
     $info['status'] = yf_empty($_POST['status'], 1, true);
     $info['type'] = yf_empty($_POST['type'], 0, true);
     $data = array('error' => 1, 'content' => '');
     $res = Model('wxkey')->check_key($info['keyword']);
     if ($res['error'] == 0) {
         if (Model('wxkey')->create_key($info)) {
             $data['error'] = 0;
             $data['content'] = Lang('SUCCESS_ADD');
         } else {
             $data['content'] = Lang('INVALID_OPERATION');
         }
     }
     $this->showMsg($data);
 }
Ejemplo n.º 22
0
 /**
  * 更新规则数据
  */
 public function update_rule()
 {
     $this->admin_priv('edit_rule');
     $img_arr = array();
     $i = 0;
     foreach ($_POST as $k => $v) {
         $i++;
         if (strstr($k, 'field')) {
             $img_arr[$i]['title'] = $v[0];
             $img_arr[$i]['description'] = $v[1];
             $img_arr[$i]['url'] = $v[2];
             $img_arr[$i]['thumb'] = $v[3];
             $img_arr[$i]['id'] = $v[4];
         }
     }
     $id = yf_empty(intval($_POST['id']), '', true);
     $info['name'] = yf_empty($_POST['name'], '标题不能为空');
     $info['createtime'] = yf_time();
     //$info['status'] = isset($_POST['is_show'])?intval($_POST['is_show']):0;
     $data = array('error' => 0, 'content' => '');
     if ($_POST['type'] == 1) {
         $content = yf_empty($_POST['content'], '', true);
     } else {
         $content = $img_arr;
     }
     $result = Model('wxrule')->update_rule($info, $content, $id);
     if ($result) {
         $data['content'] = Lang('SUCCESS_EDIT');
         $data['url'] = "index.php?g=admin&m=wxrule&a=index";
     } else {
         $data['error'] = 1;
         $data['content'] = Lang('INVALID_OPERATION');
     }
     $this->showMsg($data);
 }
Ejemplo n.º 23
0
 public function create_pro($info, $img_array)
 {
     $field = '';
     $value = '';
     $result = array('error' => 0, 'content' => '');
     foreach ($info as $k => $v) {
         if ($v != '') {
             $field .= "{$k},";
             $value .= "'{$v}',";
         }
     }
     $field = substr($field, 0, strlen($field) - 1);
     $value = substr($value, 0, strlen($value) - 1);
     $sql = "INSERT INTO " . $this->table('product') . " (" . $field . ") VALUES(" . $value . ")";
     if (!($res = $this->query($sql))) {
         $result['error'] = 1;
         $result['content'] = Lang('SQL_ERROR');
     } else {
         //添加产品图片
         $product_id = $this->insert_id();
         if (count($img_array) > 0) {
             foreach ($img_array as $key => $val) {
                 if (is_file(ROOT_PATH . "/" . $val)) {
                     $middle_pic = $this->make_thumb('/' . $val, '200', '200');
                     $small_pic = $this->make_thumb('/' . $val, '80', '80');
                 }
                 $sql = "INSERT INTO " . $this->table('product_img') . " (product_id,original_pic,middle_pic,small_pic) VALUES('{$product_id}','{$val}','{$middle_pic}','{$small_pic}')";
                 if (!($res = $this->query($sql))) {
                     $result['error'] = 1;
                     $result['content'] = Lang('SQL_ERROR');
                 }
             }
         }
     }
     return $result;
     //$this->make_thumb('/Uploads/ad/1398673595657549402.jpg','200','200');
 }
Ejemplo n.º 24
0
                <tr>
                    <td colspan="5">
                        <b><?php echo $lang['post_pages'];?>:</b> <?php echo $pages_str; ?>
                    </td>
                </tr>
            </tfoot>
            <tbody>
                <tr class="normal">
                    <td class="n_checkbox" width="22">&nbsp;</td>
<?php if ($_GET['dir'] == 'in'){ ?>
                    <td class="n_sender" width="130"><?php Lang('post_from');?></td>
<?php }elseif ($_GET['dir'] == 'out'){ ?>
                    <td class="n_for" width="130"><?php Lang('post_for');?></td>
<?php } ?>
                    <td class="n_title"><?php Lang('post_subj');?></td>
                    <td class="n_time" width="140"><?php Lang('time');?></td>
                </tr>
<?php foreach($items as $item){ ?>
                <tr class="normal <?php echo ($item['showed']=='1'?'read':'unread')?>">
                    <td class="n_checkbox" width="22"><input name="checkpm[]" type="checkbox" value="<?php echo $item['id']; ?>" class="<?php echo ($item['showed']=='1'?'read':'unread')?>" /></td>
<?php if ($_GET['dir'] == 'in'){ ?>
                    <td class="n_sender" width="130"><a href="index.php?n=account&sub=view&action=find&name=<?php echo $item['sender'];?>"><?php echo $item['sender']; ?></a></td>
<?php }elseif ($_GET['dir'] == 'out'){ ?>
                    <td class="n_for" width="130"><a href="index.php?n=account&sub=view&action=find&name=<?php echo $item['for'];?>"><?php echo $item['for']; ?></a></td>
<?php } ?>
                    <td class="n_title"><a href="index.php?n=account&sub=pms&action=viewpm&dir=<?php echo $_GET['dir']; ?>&iid=<?php echo $item['id']; ?>"><?php echo $item['subject']; ?></a></td>
                    <td class="n_time" width="140"><a href="index.php?n=account&sub=pms&action=viewpm&dir=<?php echo $_GET['dir']; ?>&iid=<?php echo $item['id']; ?>"><?php echo date('d-m-Y, H:i',$item['posted']);?></a></td>
                </tr>
<?php } ?>
            </tbody>
        </table>
Ejemplo n.º 25
0
 public function update_info()
 {
     $info['username'] = isset($_POST['username']) ? trim($_POST['username']) : '';
     $info['qq'] = isset($_POST['qq']) ? intval($_POST['qq']) : '';
     $info['email'] = isset($_POST['email']) ? $_POST['email'] : '';
     $info['password'] = isset($_POST['new_password']) ? trim($_POST['new_password']) : '';
     $confirm_password = isset($_POST['confirm_password']) ? trim($_POST['confirm_password']) : '';
     $result = array('error' => 1, 'content' => '');
     if ($info['password'] != '' && $confirm_password != '') {
         if ($confirm_password != $info['password']) {
             $result['content'] = Lang('TWICE_PWD_NOT_MATCH');
             $this->showMsg($result);
         }
     }
     if (Model('admin')->checkInfo($info['username'], $info['email'])) {
         $res = Model('admin')->saveInfo($info);
         if ($res['error'] < 0) {
             $result['error'] = 0;
             $result['content'] = Lang('SUCCESS_EDIT');
         } elseif ($res['error'] == 0) {
             $result['error'] = 0;
             $result['content'] = Lang('SUCCESS_EDIT');
         } else {
             $result['content'] = Lang('INVALID_OPERATION');
         }
         $this->showMsg($result);
     }
 }
Ejemplo n.º 26
0
 /**
  * 添加文章数据
  */
 public function new_art()
 {
     $this->admin_priv('add_news');
     $data = array('error' => 1, 'content' => '');
     $info['cat_id'] = yf_empty(intval($_POST['cat_id']), '', true);
     //自动截取summary
     if ($_POST['summary'] === '' && $_POST['content'] != '') {
         $_POST['summary'] = hy_substr(str_replace(PHP_EOL, '', strip_tags($_POST['content'])), 200);
     }
     if ($_POST['en_summary'] === '' && $_POST['en_content'] != '') {
         $_POST['en_summary'] = hy_substr(str_replace(PHP_EOL, '', strip_tags($_POST['en_content'])), 200);
     }
     $en_summary = yf_empty($_POST['en_summary'], "", true);
     $info['summary'] = isset($_POST['summary']) ? CH_SC . $_POST['summary'] . DIG_EC . EN_SC . $en_summary . DIG_EC : '';
     $en_title = yf_empty($_POST['en_title'], '', true);
     $en_author = yf_empty($_POST['en_author'], '', true);
     $en_content = yf_empty($_POST['en_content'], '', true);
     $title = yf_empty($_POST['title'], Lang('KEY_EMPTY'));
     $info['title'] = isset($_POST['title']) ? CH_SC . $title . DIG_EC . EN_SC . $en_title . DIG_EC : '';
     $info['abstract'] = yf_empty($_POST['abstract'], '', true);
     $info['flags'] = is_array($_POST['flags']) ? implode(',', $_POST['flags']) : $_POST['flags'];
     $info['keywords'] = yf_empty($_POST['keywords'], '', true);
     $info['author'] = isset($_POST['author']) ? CH_SC . $_POST['author'] . DIG_EC . EN_SC . $en_author . DIG_EC : '';
     $info['source'] = yf_empty($_POST['source'], '', true);
     $info['content'] = isset($_POST['content']) ? CH_SC . $_POST['content'] . DIG_EC . EN_SC . $en_content . DIG_EC : '';
     $info['ordering'] = yf_empty($_POST['ordering'], 0, true);
     $info['hits'] = yf_empty($_POST['hits'], 0, true);
     $info['source_url'] = yf_empty($_POST['source_url'], '', true);
     $info['page_title'] = yf_empty($_POST['page_title'], '', true);
     $info['created'] = empty($_POST['created']) ? yf_time() : strtotime($_POST['created']);
     $info['thumb'] = yf_empty($_POST['thumb'], '', true);
     $info['is_show'] = yf_empty($_POST['is_show'], 1, true);
     if (!empty($_POST['photo'])) {
         $photo = is_array($_POST['photo']) ? $_POST['photo'] : array($_POST['photo']);
     } else {
         $photo = array();
     }
     $info['form_id'] = yf_empty($_POST['form_id'], 0, true);
     $pattern = "/<[img|IMG].*?src=[\\'|\"](.*?(?:[\\.gif|\\.jpg|\\.png]))[\\'|\"].*?[\\/]?>/";
     preg_match_all($pattern, stripslashes($info['content']), $match);
     if ($match) {
         $file = array('name' => '', 'type' => 'image/png', 'tmp_name' => '', 'size' => '', 'error' => 0);
         //上传word图片-start
         foreach ($match[1] as $k => $v) {
             $pattern2 = '/^(file:\\/\\/).*$/';
             if (preg_match($pattern2, $v)) {
                 $file['name'] = basename($v);
                 $ex = explode(".", $file['name']);
                 $ext = end($ex);
                 switch ($ext) {
                     case "png":
                         $file['type'] = 'image/png';
                         break;
                     case "jpeg":
                         $file['type'] = 'image/jpeg';
                         break;
                     case "jpg":
                         $file['type'] = 'image/jpeg';
                         break;
                     case "gif":
                         $file['type'] = 'image/gif';
                         break;
                 }
                 $file['tmp_name'] = $v;
                 $thumb_url = Model('image')->upload_image($file, 'article/' . date('Ym'));
                 if ($thumb_url) {
                     $info['content'] = str_replace(addslashes($v), addslashes($thumb_url), $info['content']);
                 }
             } else {
                 //对于已经上传的图片,自动截取文章第一个图片为缩略图
                 if (empty($info['thumb'])) {
                     $info['thumb'] = $match[1][0];
                 }
             }
         }
         //上传word图片-end
     }
     if (Model('article')->create_art($info, $photo)) {
         $data['content'] = Lang('SUCCESS_ADD');
         $data['error'] = 0;
     } else {
         $data['content'] = Lang('INVALID_OPERATION');
     }
     $this->showMsg($data);
 }
Ejemplo n.º 27
0
 /**
  * 添加版块内容
  */
 public function sumbit_content()
 {
     $this->admin_priv('addimage');
     $en_title = yf_empty($_POST['en_title'], '', true);
     $title = yf_empty($_POST['title'], Lang('标题不能为空'));
     $info['title'] = isset($_POST['title']) ? CH_SC . $title . DIG_EC . EN_SC . $en_title . DIG_EC : '';
     $en_des = yf_empty($_POST['en_description'], '', true);
     $info['description'] = isset($_POST['description']) ? CH_SC . $_POST['description'] . DIG_EC . EN_SC . $en_des . DIG_EC : '';
     $info['url'] = yf_empty($_POST['url'], '#', true);
     $info['ordering'] = yf_empty(intval($_POST['ordering']), 0, true);
     $info['block_id'] = yf_empty($_POST['block_id'], '', true);
     $info['pic_path'] = yf_empty($_POST['pic_path'], '', true);
     $data = array('error' => 1, 'content' => Lang('INVALID_OPERATION'));
     $info['created'] = yf_time();
     $result = Model('ad')->add_images($info);
     if ($result) {
         $data['error'] = 0;
         $data['content'] = Lang('SUCCESS_ADD');
     } else {
         $data['content'] = "添加失败";
     }
     $this->showMsg($data);
 }
Ejemplo n.º 28
0
			<td class="windowbg2"><?php 
        echo $attach['attach_hits'];
        ?>
</td>
			<td class="windowbg"><?php 
        echo date('d-m-Y, H:i', $attach['attach_date']);
        ?>
</td>
			<td class="windowbg" align="center"><a href="index.php?n=forum&sub=attach&action=delete&attid=<?php 
        echo $attach['attach_id'];
        ?>
&tid=<?php 
        echo $_GET['tid'];
        ?>
" title="<?php 
        Lang('delete');
        ?>
"><img src="images/trash.png" alt="[del]" align="absmiddle"></a></td>
		</tr>
		<?php 
    }
    ?>
        <tr class="tablebottom">
			<td colspan="8">Files summary: <?php 
    echo $all_attachs_count;
    ?>
 | Size summary: <?php 
    echo $this['goodsize'];
    ?>
 </td>
		</tr>
Ejemplo n.º 29
0
 /**
  * 更新微信规则
  * @param $info
  * @param $content
  * @param $id
  * @return 
  */
 public function update_rule($info, $content, $id)
 {
     $result = array('error' => 0, 'content' => '');
     if ($id) {
         $info['modifytime'] = yf_time();
         $data = yf_set_update($info);
         $sql = "UPDATE " . $this->table('rule') . " SET " . $data . " WHERE id='" . $id . "'";
         $res = $this->query($sql);
         if (!$res) {
             $result['error'] = 1;
             $result['content'] = Lang('SQL_ERROR');
         } else {
             if (is_array($content)) {
                 if (is_array($content) && count($content) > 0) {
                     foreach ($content as $key => $val) {
                         $content[$key]['rid'] = $id;
                     }
                     $error = 0;
                     foreach ($content as $kk => $vv) {
                         $reply_id = "";
                         if (!empty($vv['id'])) {
                             $reply_id = $vv['id'];
                         }
                         unset($vv['id']);
                         if (!empty($reply_id)) {
                             $yf_data = yf_set_update($vv);
                             $sql = "update " . $this->table('news_reply') . " set " . $yf_data . " where id=" . $reply_id;
                             if (!($res = $this->query($sql))) {
                                 $error++;
                             }
                         } else {
                             $yf_data = yf_set_insert($vv);
                             $sql = "insert into " . $this->table('news_reply') . " (" . $yf_data['key'] . ") values (" . $yf_data['val'] . ")";
                             if (!($res = $this->query($sql))) {
                                 $error++;
                             }
                         }
                     }
                     if ($error != 0) {
                         $result['error'] = 1;
                         $result['content'] = Lang('SQL_ERROR');
                     }
                 }
             } else {
                 $sql = "UPDATE " . $this->table('basic_reply') . " SET content='" . $content . "' WHERE rid='" . $id . "'";
                 $res = $this->query($sql);
             }
         }
     }
     return $result;
 }
Ejemplo n.º 30
0
            ?>
<font color="red">[<?php 
            Lang('newmessages');
            ?>
]</font><?php 
        }
        ?>
                    <?php 
        if ($topic['pnum'] > 1) {
            ?>
                    <br /> <img src="<?php 
            echo $config['template_href'];
            ?>
images/pixel.gif" width="15" height="12" />
                    <small>[<?php 
            Lang('post_pages');
            ?>
: <small><?php 
            echo $topic['pages_str'];
            ?>
</small>]
                    <?php 
        }
        ?>
                </td>
                <td class="ta3"><span class="blue"><?php 
        echo $topic['username'];
        ?>
</span></td>
                <td class="ta4"><?php 
        echo $topic['num_replies'];