Example #1
0
 public function dogetword()
 {
     global $_M;
     $lang = $_M['form']['lang'] ? $_M['form']['lang'] : $_M['lang'];
     $word = $_M['form']['word'];
     $site = $_M['form']['site'];
     if (!file_get_contents(PATH_WEB . 'cache/lang_' . $lang . '.php')) {
         $query = "select * from {$_M['table'][language]} where lang='{$lang}' and site='{$site}' and name='{$word}'";
         $result = DB::get_one($query);
         $getword = $result['value'];
     } else {
         if ($site == 1) {
             require_once PATH_WEB . 'cache/langadmin_' . $lang . '.php';
         } else {
             require_once PATH_WEB . 'cache/lang_' . $lang . '.php';
         }
         $word = "lang_{$word}";
         $getword = ${$word};
     }
     if ($getword) {
         $back['error'] = 0;
         $back['word'] = $getword;
     } else {
         $back['error'] = 1;
     }
     jsoncallback($back);
 }
Example #2
0
/**
 * 判断COOKIE是否超过一个小时,如果没有超过则更新$_M['user']['cookie']中的信息
 */
function met_cooike_start()
{
    global $_M;
    $_M['user']['cookie'] = array();
    $met_webkeys = $_M['config']['met_webkeys'];
    list($username, $password) = explode("\t", authcode($_M['form']['met_auth'], 'DECODE', $met_webkeys . $_COOKIE['met_key']));
    $username = sqlinsert($username);
    $query = "SELECT * from {$_M['table']['admin_table']} WHERE admin_id = '{$username}'";
    $user = DB::get_one($query);
    $usercooike = json_decode($user['cookie']);
    if (md5($user['admin_pass']) == $password && time() - $usercooike->time < 3600) {
        foreach ($usercooike as $key => $val) {
            $_M['user']['cookie'][$key] = $val;
        }
        if (defined('IN_ADMIN')) {
            $_M['user']['admin_name'] = get_met_cookie('metinfo_admin_name');
            $_M['user']['admin_id'] = $_M['user']['cookie']['metinfo_admin_id'];
            $privilege = background_privilege();
            $_M['user']['langok'] = $privilege['langok'];
        }
        $_M['user']['cookie']['time'] = time();
        $json = json_encode($_M['user']['cookie']);
        $query = "update {$_M['table']['admin_table']} set cookie = '{$json}' WHERE admin_id = '{$username}'";
        $user = DB::query($query);
    }
}
Example #3
0
function news_search($id)
{
    global $_M;
    $query = "SELECT * FROM {$_M['table']['infoprompt']} where id='{$id}'";
    $result = DB::get_one($query);
    return $result;
}
Example #4
0
 /**
  * 基础统计全部数据查询语句
  * @return unknown_type
  */
 function _count()
 {
     if (!$this->_check()) {
         return false;
     }
     $result = $this->_db->get_one("SELECT COUNT(*) as total FROM " . $this->_tableName);
     return $result['total'];
 }
Example #5
0
 public function read($sess_id)
 {
     global $user;
     // Handle the case of first time visitors and clients that don't store cookies (eg. web crawlers).
     if (!isset($_COOKIE[session_name()])) {
         $this->anonymous_user($user);
         return '';
     }
     // Query db and see user status
     $sess = $this->_db->get_one("SELECT s.`uid`, s.`lastip`, s.`data` AS session FROM `{$this->_dbtable}` s WHERE s.`sid`='%s'", $sess_id);
     if (empty($sess)) {
         $this->anonymous_user($user, isset($user->session) ? $user->session : '');
     } else {
         $user->uid = $sess['uid'];
         $user->lastip = $sess['lastip'];
         $user->session = $sess['session'];
     }
     return $user->session;
 }
Example #6
0
 public function authinfo()
 {
     global $_M;
     $query = "SELECT * FROM {$_M['table']['otherinfo']} WHERE id='1'";
     $key_info = DB::get_one($query);
     $curl = load::sys_class('curl', 'new');
     $curl->set('file', "index.php?n=platform&c=authcheck&m=web&a=doauth_json&key={$key_info['authpass']}&code={$key_info['authcode']}&domain={$_M['url']['site']}&datatype=data&weblang=cn");
     $post = array('post' => '');
     $info = $curl->curl_post($post);
     $re = jsondecode($info);
     $query = "update {$_M['table']['otherinfo']} set info1='{$re['webtype_h']}' where id=1";
     DB::query($query);
     return $re;
 }
Example #7
0
 public function check_filename($filename, $id, $module)
 {
     global $_M;
     if ($filename != '') {
         if (!preg_match("/^[a-zA-Z0-9_^�-�]+\$/", $filename)) {
             $this->errorno = 'error_filename_cha';
             return false;
         }
         $query = "SELECT * FROM {$this->tablename($module)} WHERE filename='{$filename}' and lang='{$_M['lang']}'";
         $list = DB::get_one($query);
         if ($list && $list['id'] != $id) {
             $this->errorno = 'error_filename_exist';
             return false;
         }
     }
     return true;
 }
Example #8
0
 public function doappdetail()
 {
     global $_M;
     $return_this = 1;
     $appdetail['type'] = $_M['form']['type'];
     $appdetail['no'] = $_M['form']['no'];
     //$appdetail['appid'] = $_M['form']['appid'];
     if ($appdetail['type'] == 'app') {
         nav::select_nav(2);
         $getapp = load::mod_class('myapp/class/getapp', 'new');
         $app = $getapp->get_oneapp($appdetail['no']);
         if ($app) {
             $app['url'] = "<a href=\"{$app['url']}\">{$_M['word']['dlapptips5']}</a>";
         }
         $buy_Explain = $_M['word']['langshuom'];
         $buy_Explain1 = $_M['word']['purchase_application'];
         $demonstration = "<span class='demo_url'></span>";
     }
     if ($appdetail['type'] == 'tem') {
         nav::select_nav(3);
         $query = "SELECT * FROM {$_M['table']['skin_table']} WHERE skin_file ='{$appdetail['no']}'";
         $app = DB::get_one($query);
         if ($app) {
             $app['ver'] = '1.0';
             $app['url'] = "<a target=\"_blank\" href=\"{$_M['url']['adminurl']}n=theme&c=theme&a=doindex&mobile={$app['devices']}&anyid=70&lang={$_M['lang']}\">{$_M['word']['configuratio_template']}</a>";
         }
         $appdetail['no'] = $_M['form']['appid'];
         $buy_Explain = $_M['word']['template_domain'];
         $buy_Explain1 = $_M['word']['buy_template_must'];
     }
     if ($app) {
         $appdetail['download'] = 1;
     } else {
         $appdetail['download'] = 0;
     }
     $appdetail['ver'] = $app['ver'];
     $appdetail['url'] = $app['url'];
     $query = "SELECT * FROM {$_M['table']['otherinfo']} where id=1";
     $th = DB::get_one($query);
     $authkey = $th['authpass'];
     $authcode = $th['authcode'];
     require $this->template('tem/appdetail');
 }
Example #9
0
 /**
  * 初始化
  */
 public function __construct()
 {
     global $_M;
     parent::__construct();
     $this->check();
     $this->userclass = load::sys_class('user', 'new');
     $query = "SELECT * FROM {$_M['table']['column']} WHERE module='10' AND lang='{$_M['lang']}'";
     $member = DB::get_one($query);
     if ($_M['config']['met_title_type'] == 0) {
         $_M['tem_data']['title'] = $member['name'];
     } else {
         if ($_M['config']['met_title_type'] == 1) {
             $_M['tem_data']['title'] = $member['name'] . '-' . $_M['config']['met_keywords'];
         } else {
             if ($_M['config']['met_title_type'] == 2) {
                 $_M['tem_data']['title'] = $member['name'] . '-' . $_M['config']['met_webname'];
             } else {
                 if ($_M['config']['met_title_type'] == 3) {
                     $_M['tem_data']['title'] = $member['name'] . '-' . $_M['config']['met_keywords'] . '-' . $_M['config']['met_webname'];
                 }
             }
         }
     }
     $query = "SELECT * FROM {$_M['table']['ifmember_left']}";
     $navigation = DB::get_all($query);
     foreach ($navigation as $key => $val) {
         if ($val[columnid]) {
             //$column = $class_list[$val[columnid]];
             $query = "SELECT * FROM {$_M['table']['column']} WHERE id = '{$val[columnid]}'";
             $column = DB::get_one($query);
             $val['foldername'] = $val['foldername'] ? $val['foldername'] : $column['foldername'];
             $val['filename'] = $val['filename'] ? $val['filename'] : 'index.php';
             $list['url'] = "../{$val['foldername']}/{$val['filename']}";
             $list['title'] = $column['name'];
         } else {
             $list['url'] = "../{$val['foldername']}/{$val['filename']}";
             $list['title'] = $val['title'];
         }
         $_M['html']['app_sidebar'][] = $list;
     }
 }
Example #10
0
 public function dodelapp()
 {
     global $_M;
     $no = $_M['form']['no'];
     $getapp = load::mod_class('myapp/class/getapp', 'new');
     $app = $getapp->get_oneapp($no);
     if ($app['m_class']) {
         $uninstall = load::app_class($app['m_name'] . '/admin/uninstall', 'new');
         $uninstall->dodel();
         turnover($_M['url']['own_name'] . '&c=myapp&a=doindex', $_M['word']['physicaldelok']);
     } else {
         $query = "DELETE FROM {$_M['table']['applist']} WHERE no='{$no}'";
         DB::query($query);
         $query = "SELECT * FROM {$_M['table']['app']} WHERE no='{$no}' AND download=1";
         $app_old = DB::get_one($query);
         if (file_exists(PATH_WEB . $_M['config']['met_adminfile'] . '/app/' . $app['m_name'] . '/delapp.php')) {
             header('location:' . $_M['url']['site_admin'] . 'app/' . $app['m_name'] . '/delapp.php?lang=' . $_M['lang'] . '&id=' . $app_old['id'] . '&action=del');
         } else {
             header('location:' . $_M['url']['site_admin'] . 'app/dlapp/delapp.php?lang=' . $_M['lang'] . '&id=' . $app_old['id'] . '&action=del');
         }
     }
 }
Example #11
0
 public function get_para($listid, $module, $class1, $class2, $class3)
 {
     global $_M;
     $paralist = $this->get_para_list($module, $class1, $class2, $class3);
     foreach ($paralist as $val) {
         $para = DB::get_one("SELECT * FROM {$this->table($module)} WHERE listid='{$listid}' and paraid='{$val[id]}' and lang = '{$this->lang}'");
         if ($val['type'] == 7) {
             $para7 = explode("-", $para['info']);
             $list['info_' . $val['id'] . '_1'] = $para7[0];
             $list['info_' . $val['id'] . '_2'] = $para7[1];
             if ($para7[2]) {
                 $list['info_' . $val['id'] . '_3'] = $para7[2];
             }
         }
         $list['info_' . $val['id']] = $para['info'];
         if (!$para) {
             $infos[$val['id']] = '';
         }
     }
     if ($infos) {
         $this->insert_para($listid, $infos, $module);
     }
     return $list;
 }
Example #12
0
 public function complete()
 {
     global $_M;
     $this->del_dl_file();
     if ($this->info['type'] == 'cms') {
         return $this->suc_data('end', 0, "{$_M['word']['installation_complete']},3{$_M['word']['seconds_background']}", 1, 'refresh');
     }
     if ($this->info['type'] == 'app') {
         $this->add_power($this->info['no']);
         $getapp = load::mod_class('myapp/class/getapp', 'new');
         $app = $getapp->get_oneapp($this->info['no']);
         $html = "<a href=\"{$app['url']}\">{$_M['word']['dlapptips5']}</a>";
         return $this->suc_data('end', 0, $html);
     }
     if ($this->info['type'] == 'tem') {
         $query = "SELECT * FROM {$_M['table']['skin_table']} ORDER BY id DESC";
         $tem = DB::get_one($query);
         $html = "<a target=\"_blank\" href=\"{$_M['url']['adminurl']}n=theme&c=theme&a=doindex&mobile={$tem['devices']}&anyid=70&lang={$_M['lang']}\">{$_M['word']['configuratio_template']}</a>";
         return $this->suc_data('end', 0, $html);
     }
 }
Example #13
0
 public function get_other_user($unionid)
 {
     $query = "SELECT * FROM {$this->table} WHERE unionid = '{$unionid}' and type='{$this->type}'";
     return DB::get_one($query);
 }
Example #14
0
 public function get_product($pid)
 {
     global $_M;
     $query = "SELECT * FROM {$_M['table']['shopv2_product']} WHERE pid='{$pid}'";
     $product = DB::get_one($query);
     return $product;
 }
Example #15
0
 public function dosetsave()
 {
     global $_M;
     $list = explode(",", $_M[form][allid]);
     $type = $_M[form][submit_type];
     $i = 0;
     foreach ($list as $id) {
         if ($id) {
             $i++;
             if ($type == 'save' || !$type) {
                 $name = $_M['form']['name-' . $id];
                 $defaultvalue = $_M['form']['defaultvalue-' . $id];
                 $valueinfo = $_M['form']['valueinfo-' . $id];
                 $type1 = $_M['form']['type-' . $id];
                 $tips = $_M['form']['tips-' . $id];
                 $selectd = $_M['form']['selectd-' . $id];
                 $style = $_M['form']['style-' . $id];
                 $no = $_M['form']['no'];
                 $pos = $_M['form']['pos-' . $id];
                 $no_order = $i;
                 if ($pos != $_M['form']['pos']) {
                     $counter = DB::counter($_M['table']['templates'], " WHERE no='{$_M['form']['no']}' and pos='{$pos}'  and lang='{$_M['form']['lang']}'", '*');
                     $no_order = $no_order + $counter;
                 }
                 $query = "\n\t\t\t\t\t\tno           = '{$no}',\n\t\t\t\t\t\tpos          = '{$pos}',\n\t\t\t\t\t\tno_order     = '{$no_order}',\n\t\t\t\t\t\tname         = '{$name}',\n\t\t\t\t\t\tdefaultvalue = '{$defaultvalue}',\n\t\t\t\t\t\tvalueinfo    = '{$valueinfo}',\n\t\t\t\t\t\ttype\t     = '{$type1}',\n\t\t\t\t\t\ttips\t     = '{$tips}',\n\t\t\t\t\t\tselectd\t     = '{$selectd}',\n\t\t\t\t\t\tstyle\t     = '{$style}',\n\t\t\t\t\t\tlang         = '{$_M['form']['lang']}'\n\t\t\t\t\t";
                 if (is_number($id)) {
                     //修改
                     $query = "UPDATE {$_M['table']['templates']} SET {$query} WHERE id = '{$id}' ";
                 } else {
                     //新增
                     $query = "INSERT INTO {$_M['table']['templates']} SET value = '{$defaultvalue}', {$query} ";
                 }
             } elseif ($type == 'del') {
                 //删除
                 if (is_number($id)) {
                     $query = "DELETE FROM {$_M['table']['templates']} WHERE id='{$id}' and pos = '{$_M['form']['pos']}' and lang='{$_M['form']['lang']}' ";
                 }
             }
             DB::query($query);
         }
     }
     /*同步到其它语言*/
     $query = "SELECT * FROM {$_M['table']['templates']} where no='{$_M['form']['no']}' AND lang='{$_M['form']['lang']}' ORDER BY no_order,id";
     $tems = DB::get_all($query);
     foreach ($_M['langlist']['web'] as $key => $val) {
         if ($key != $_M['form']['lang']) {
             $query = "DELETE FROM {$_M['table']['templates']} WHERE no='{$_M['form']['no']}' AND lang='{$key}'";
             DB::query($query);
             foreach ($tems as $keytems => $valtems) {
                 $query = "INSERT INTO {$_M['table']['templates']} SET no='{$valtems['no']}',pos ='{$valtems['pos']}',no_order='{$valtems['no_order']}',type='{$valtems['type']}',style='{$valtems['style']}',selectd='{$valtems['selectd']}',name ='{$valtems['name']}',value='{$valtems['value']}',defaultvalue='{$valtems['defaultvalue']}',valueinfo ='{$valtems['valueinfo']}',tips='{$valtems['tips']}',lang='{$key}'";
                 DB::query($query);
             }
         }
     }
     /*生成安装文件*/
     load::sys_func('file');
     $file = "templates/{$_M['form']['no']}/install/install.class.php";
     makefile($file);
     $query = "SELECT * FROM {$_M['table']['skin_table']} where skin_file='{$_M['form']['no']}'";
     $tem = DB::get_one($query);
     $query = "SELECT * FROM {$_M['table']['templates']} where no='{$_M['form']['no']}' AND lang='{$_M['form']['lang']}' ORDER BY no_order,id";
     $tems = DB::get_all($query);
     foreach ($tems as $keytems => $valtems) {
         $sql[] = "pos ='{$valtems['pos']}',no_order='{$valtems['no_order']}',type='{$valtems['type']}',style='{$valtems['style']}',selectd='{$valtems['selectd']}',name ='{$valtems['name']}',value='{$valtems['defaultvalue']}',defaultvalue='{$valtems['defaultvalue']}',valueinfo ='{$valtems['valueinfo']}',tips='{$valtems['tips']}'";
     }
     $sql_info = var_export($sql, true);
     $info .= "\n\$sql = {$sql_info};\n\$no='{$_M['form']['no']}';\n\$devices='{$tem['devices']}';";
     $str = file_get_contents(PATH_OWN_FILE . 'file/install.class.php');
     $str = str_replace('/*<!--sql-->*/', $info, $str);
     file_put_contents(PATH_WEB . $file, $str);
     turnover("{$_M[url][own_form]}a=doset&no={$_M['form']['no']}&pos={$_M['form']['pos']}", '操作成功');
 }
Example #16
0
<?php

session_start();
header("Content-Type: text/html;charset=utf-8");
$folder_name = '/manage';
//网站目录名称
include './config.inc.php';
include $_SERVER['DOCUMENT_ROOT'] . $folder_name . '/db.php';
include $_SERVER['DOCUMENT_ROOT'] . $folder_name . '/common/common.php';
$db = new DB();
$listCate = $db->get_one('SELECT * FROM `document_category` where `id` = ' . $_GET["id"]);
$listCate['show_type'];
$listCategory = $db->query('SELECT * FROM `document_category` where `project_id` = ' . $_GET["id"]);
$resultProject = array();
while ($row = mysql_fetch_array($listCategory)) {
    $resultProject[] = $row;
}
if (isset($_GET['id'])) {
    $list = $db->query('SELECT * FROM `document_doc` where `category_id` =' . $_GET["id"]);
} else {
    $list = $db->query('SELECT * FROM `document_doc`');
}
$result = array();
while ($row = mysql_fetch_array($list)) {
    $result[] = $row;
}
//var_dump($resultProject);
$tpl->assign("showType", $listCate['show_type']);
//文档列表显示样式
$tpl->assign("listCategory", $resultProject);
$tpl->assign("list", $result);
Example #17
0
 /**
  * 权限验证
  * @param string $type:	应用类型;
  * @return  array 		返回值(re:返回状态;md5:验证码)
  */
 protected function varcodeb($type)
 {
     global $_M;
     $blcode = DB::get_one("SELECT * FROM {$_M['table']['otherinfo']} where id='1'");
     $authcode = $blcode['authcode'];
     $authpass = $blcode['authpass'];
     $this->set('file', '/test/varcode.php');
     if ($authcode && $authpass) {
         $post = array('code' => $authcode, 'pass' => $authpass, 'type' => $type);
         $md5 = $this->curl_post($post, 30);
         if (preg_match("/^[a-zA-Z0-9]{32}\$/", $md5)) {
             if (!is_dir(PATH_WEB . 'cache/')) {
                 mkdir(PATH_WEB . 'cache/', '0755');
             }
             if (file_put_contents(PATH_WEB . "cache/{$md5}.txt", $md5)) {
                 $this->set('file', '/test/check.php');
                 $post = array('md5' => $md5);
                 $result = $this->curl_post($post, 30);
                 if ($result == 'SUC') {
                     return array('re' => 'SUC', 'md5' => $md5);
                 } else {
                     $this->delcodeb($md5);
                     return array('re' => $result, 'md5' => '');
                 }
             } else {
                 $this->delcodeb($md5);
                 return array('re' => 'DISREAD', 'md5' => '');
             }
         } else {
             return array('re' => $md5, 'md5' => '');
         }
     } else {
         return array('re' => 'DISBUS', 'md5' => '');
     }
 }
Example #18
0
 public function get_user_by_tel($tel)
 {
     global $_M;
     $query = "SELECT * FROM {$_M['table']['user']} WHERE tel='{$tel}'";
     $user = DB::get_one($query);
     return $user;
 }
Example #19
0
/**
 * 重新生成robots.txt
 * @param string $sitemaptype sitemap 地图后缀 xml/txt
 */
function sitemap_robots($sitemaptype = 0)
{
    global $_M;
    $suffix = $sitemaptype;
    $met_weburl_de = DB::get_one("select * from {$_M['table']['config']} where name='met_weburl' and lang='{$_M[config][met_index_type]}'");
    $met_weburl_de = $met_weburl_de['value'];
    $robots = file_get_contents(PATH_WEB . 'robots.txt');
    if ($suffix) {
        if (stripos($robots, 'Sitemap: ') === false) {
            $robots .= "\nSitemap: {$met_weburl_de}sitemap.{$suffix}";
        } else {
            $robots = preg_replace('/Sitemap:.*/', "Sitemap: {$met_weburl_de}sitemap.{$suffix}", $robots);
        }
    } else {
        $robots = preg_replace("/Sitemap:.*/", "", $robots);
    }
    $robots = str_replace("\n\n", "\n", $robots);
    file_put_contents(PATH_WEB . 'robots.txt', $robots);
}
Example #20
0
 /**
  * 检测是否登陆
  * 有权限则程序向后运行,无权限则提示物权限
  */
 protected function check()
 {
     global $_M;
     $current_url = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
     if (strstr($current_url, $_M['url']['site_admin'] . "index.php")) {
         $admin_index = 1;
     } else {
         $admin_index = '';
     }
     $met_adminfile = $_M['config']['met_adminfile'];
     $met_admin_table = $_M['table']['admin_table'];
     $metinfo_admin_name = get_met_cookie('metinfo_admin_name');
     $metinfo_admin_pass = get_met_cookie('metinfo_admin_pass');
     if (!$metinfo_admin_name || !$metinfo_admin_pass) {
         if ($admin_index) {
             met_cooike_unset();
             met_setcookie("re_url", $re_url, time() - 3600);
             Header("Location: " . $_M['url']['site_admin'] . "login/login.php");
         } else {
             if (!$re_url) {
                 $re_url = $_SERVER[HTTP_REFERER];
                 $HTTP_REFERERs = explode('?', $_SERVER[HTTP_REFERER]);
                 $admin_file_len1 = strlen("/{$met_adminfile}/");
                 $admin_file_len2 = strlen("/{$met_adminfile}/index.php");
                 if (strrev(substr(strrev($HTTP_REFERERs[0]), 0, $admin_file_len1)) == "/{$met_adminfile}/" || strrev(substr(strrev($HTTP_REFERERs[0]), 0, $admin_file_len2)) == "/{$met_adminfile}/index.php" || !$HTTP_REFERERs[0]) {
                     $re_url = "http://{$_SERVER[SERVER_NAME]}{$_SERVER[REQUEST_URI]}";
                 }
             }
             if (!$_COOKIE[re_url] && !strstr($re_url, "return.php")) {
                 met_setcookie("re_url", $re_url, time() + 3600);
             }
             met_cooike_unset();
             Header("Location: " . $_M['url']['site_admin'] . "login/login.php");
         }
         exit;
     } else {
         $query = "SELECT * FROM {$_M['table']['admin_table']} WHERE admin_id = '{$metinfo_admin_name}' AND admin_pass = '******' AND usertype = '3'";
         $admincp_ok = DB::get_one($query);
         if (!$admincp_ok) {
             if ($admin_index) {
                 met_cooike_unset();
                 met_setcookie("re_url", $re_url, time() - 3600);
                 Header("Location: " . $_M['url']['site_admin'] . "login/login.php");
             } else {
                 if (!$re_url) {
                     $re_url = $_SERVER[HTTP_REFERER];
                     $HTTP_REFERERs = explode('?', $_SERVER[HTTP_REFERER]);
                     $admin_file_len1 = strlen("/{$met_adminfile}/");
                     $admin_file_len2 = strlen("/{$met_adminfile}/index.php");
                     if (strrev(substr(strrev($HTTP_REFERERs[0]), 0, $admin_file_len1)) == "/{$met_adminfile}/" || strrev(substr(strrev($HTTP_REFERERs[0]), 0, $admin_file_len2)) == "/{$met_adminfile}/index.php" || !$HTTP_REFERERs[0]) {
                         $re_url = "http://{$_SERVER[SERVER_NAME]}{$_SERVER[REQUEST_URI]}";
                     }
                 }
                 if (!strstr($re_url, "return.php")) {
                     if (!$_COOKIE['re_url']) {
                         met_setcookie("re_url", $re_url, time() + 3600);
                     }
                 }
                 met_cooike_unset();
                 Header("Location: " . $_M['url']['site_admin'] . "login/login.php");
             }
             exit;
         }
     }
     $query = "SELECT * FROM {$_M['table']['admin_table']} WHERE admin_id='{$metinfo_admin_name}' AND admin_pass='******'";
     $membercp_ok = DB::get_one($query);
     if (!strstr($membercp_ok['admin_op'], "metinfo")) {
         if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest') {
             $return_url = "";
         } else {
             $return_url = "javascript:window.history.back();";
         }
         if (stristr(M_ACTION, 'add')) {
             if (!strstr($membercp_ok['admin_op'], "add")) {
                 okinfo($return_url, $_M['word']['loginadd']);
             }
         }
         if (stristr(M_ACTION, 'editor')) {
             if (!strstr($membercp_ok['admin_op'], "editor")) {
                 okinfo($return_url, $_M['word']['loginedit']);
             }
         }
         if (stristr(M_ACTION, 'del')) {
             if (!strstr($membercp_ok['admin_op'], "del")) {
                 okinfo($return_url, $_M['word']['logindelete']);
             }
         }
         if (stristr(M_ACTION, 'all')) {
             if (!strstr($membercp_ok['admin_op'], "metinfo")) {
                 okinfo($return_url, $_M['word']['loginall']);
             }
         }
         if (stristr(M_ACTION, 'table')) {
             if (stristr($_M['form']['submit_type'], 'save')) {
                 if ($_M['form']['allid']) {
                     $power_ids = explode(',', $_M['form']['allid']);
                     $e = 0;
                     $a = 0;
                     foreach ($power_ids as $val) {
                         if ($val) {
                             if (is_numeric($val)) {
                                 $e++;
                             } else {
                                 $a++;
                             }
                         }
                         if ($e > 0) {
                             if (!strstr($membercp_ok['admin_op'], "editor")) {
                                 okinfo($return_url, $_M['word']['loginedit']);
                             }
                         }
                         if ($a > 0) {
                             if (!strstr($membercp_ok['admin_op'], "add")) {
                                 okinfo($return_url, $_M['word']['loginadd']);
                             }
                         }
                     }
                 }
             }
             if (stristr($_M['form']['submit_type'], 'del')) {
                 if (!strstr($membercp_ok['admin_op'], "del")) {
                     okinfo($return_url, $_M['word']['logindelete']);
                 }
             }
         }
     }
     if (stristr($_M['url']['own'], 'admin/appstore')) {
         if (!stristr($membercp_ok['admin_type'], '1507') && $membercp_ok['admin_type'] != 'metinfo') {
             echo "<script type='text/javascript'> alert('{$_M['word']['appmarket_jurisdiction']}');window.history.back();</script>";
             exit;
         }
     }
     if (stristr($_M['url']['own'], 'admin/theme')) {
         if ($_M['form']['mobile']) {
             if (!stristr($membercp_ok['admin_type'], '1102') && $membercp_ok['admin_type'] != 'metinfo') {
                 echo "<script type='text/javascript'> alert('{$_M['word']['setup_permissions']}');window.history.back();</script>";
                 exit;
             }
         } else {
             if (!stristr($membercp_ok['admin_type'], '1101') && $membercp_ok['admin_type'] != 'metinfo') {
                 echo "<script type='text/javascript'> alert('{$_M['word']['setup_permissions']}');window.history.back();</script>";
                 exit;
             }
         }
     }
 }
Example #21
0
 public function dohome()
 {
     global $_M;
     /*获取统计数据*/
     function statime($ymd, $day = '')
     {
         $day = $day == '' ? time() : strtotime($day);
         $time = strtotime(date($ymd, $day));
         return $time;
     }
     $stat = array();
     for ($i = 1; $i <= 5; $i++) {
         $stats = $i == 1 ? statime("Y-m-d") : statime("Y-m-d", 0 - $i + 1 . " day");
         $query = "select * from {$_M[table][visit_summary]} WHERE stattime ='{$stats}'";
         $stat[$i] = DB::get_one($query);
         if (!$stat[$i]) {
             $stat[$i]['pv'] = 0;
             $stat[$i]['alone'] = 0;
             $stat[$i]['ip'] = 0;
         }
         $stat[$i]['day'] = date('Y-m-d', $stats);
         if ($i == 1) {
             $stat[$i]['day'] = $_M['word']['today'];
         }
         if ($i == 2) {
             $stat[$i]['day'] = $_M['word']['yesterday'];
         }
     }
     /*图表数据*/
     $dm = date('H', time());
     $dt = $dm - 8;
     $dt = $dt < 0 ? $dt + 24 : $dt;
     for ($i = 0; $i <= 23; $i++) {
         if ($i <= $dm && $i >= $dt) {
             $d = $i < 10 ? '0' . $i : $i;
             $chartdata['labels'][] = "{$d}:59";
         }
     }
     $chartcolor[0] = "#23b7e5";
     $chartcolor[1] = "#7266ba";
     $chartcolor[2] = "#23ad44";
     foreach ($chartcolor as $key => $val) {
         $chartdata['datasets'][$key]['fillColor'] = $val;
         $chartdata['datasets'][$key]['strokeColor'] = $val;
         $chartdata['datasets'][$key]['pointColor'] = $val;
         $chartdata['datasets'][$key]['pointStrokeColor'] = '#fff';
     }
     $nowcrt = explode("|", $stat[1]['parttime']);
     $i = 0;
     foreach ($nowcrt as $val) {
         if ($i <= $dm && $i >= $dt) {
             $aowcrt = '';
             if ($val) {
                 $aowcrt = explode("-", $val);
                 $val = array();
                 $val[0] = $aowcrt[0];
                 $val[1] = $aowcrt[1];
                 $val[2] = $aowcrt[2];
             } else {
                 $val[0] = 0;
                 $val[1] = 0;
                 $val[2] = 0;
             }
             $chartdata['datasets'][0]['data'][] = $val[0];
             $chartdata['datasets'][1]['data'][] = $val[1];
             $chartdata['datasets'][2]['data'][] = $val[2];
         }
         $i++;
     }
     $chartdata = jsonencode($chartdata);
     /*我的应用*/
     $query = "select * from {$_M['table']['admin_column']} where bigclass='44'";
     $app_in = DB::get_all($query);
     $privilege = background_privilege();
     require $this->template('tem/home');
 }
Example #22
0
     for ($i = 9; $i <= $_creditNum; $i++) {
         $_sql = sprintf($sql, 'pw_windid_user_data', $i);
         $targetDb->query($_sql);
         $_sql = sprintf($sql, 'pw_user_data', $i);
         $targetDb->query($_sql);
     }
 }
 //4、更新windid_config
 $sql = sprintf("REPLACE INTO pw_windid_config (`name`, `namespace`, `value`, `vtype`) VALUES ('credits', 'credit', '%s', 'array')", serialize($creditConfig));
 $targetDb->query($sql);
 //5、更新pw_common_config
 $_commonConfig['credits'] = $creditConfig;
 //6、全局积分策略
 $pointMap = array('Digest' => 'digest_topic', 'Post' => 'post_topic', 'Reply' => 'post_reply', 'Undigest' => 'remove_digest', 'Delete' => 'delete_topic', 'Deleterp' => 'delete_reply');
 $sql = "SELECT * FROM pw_config WHERE db_name = 'db_creditset'";
 $row = $srcDb->get_one($sql);
 $strategy = unserialize($row['db_value']);
 $newStrategy = array();
 foreach ($strategy as $key => $value) {
     $newStrategy[$pointMap[$key]] = array('limit' => '', 'credit' => array());
     $_vAb = in_array($key, array('Undigest', 'Delete', 'Deleterp'));
     foreach ($value as $_k => $_v) {
         $_nk = $creditMap[$_k];
         $_v = abs($_v);
         $_vAb && ($_v = -$_v);
         $newStrategy[$pointMap[$key]]['credit'][$_nk] = $_v;
     }
 }
 $_commonConfig['strategy'] = $newStrategy;
 Config::storeConfig('credit', $_commonConfig);
 refreshTo('usergroups', 'init');
Example #23
0
//flash兼容
global $methtml_flash, $met_flasharray, $classnow, $met_flashimg, $navurl;
//设置左边和中间内容页面显示的页面
$control['content'] = $_M['custom_template']['content'];
$control['left'] = $_M['custom_template']['left'];
if (substr($control['content'], 0, 4) != 'own/') {
    $control['content'] = 'own/' . $control['content'];
}
if ($control['left'] > 1) {
    $is_memberleft = 1;
}
//获取当前应用栏目信息
$PHP_SELF = $_SERVER['PHP_SELF'] ? $_SERVER['PHP_SELF'] : $_SERVER['SCRIPT_NAME'];
$PHP_SELFs = explode('/', $PHP_SELF);
$query = "SELECT * FROM {$_M['table'][column]} where foldername = '{$PHP_SELFs[count($PHP_SELFs) - 2]}' and lang='{$_M['lang']}'";
$column = DB::get_one($query);
$met_module = $column['module'];
if ($met_module > 1000) {
    //设置SEO参数
    switch ($_M['config']['met_title_type']) {
        case 0:
            $webtitle = '';
            break;
        case 1:
            $webtitle = $_M['config']['met_keywords'];
            break;
        case 2:
            $webtitle = $_M['config']['met_webname'];
            break;
        case 3:
            $webtitle = $_M['config']['met_keywords'] . '-' . $_M['config']['met_webname'];
Example #24
0
        $dbop->insert("interviewrecord", $accessInfoArr);
    }
}
//update 走访信息
if ($type == "accessInfoUpdate") {
    $interviewid = $_REQUEST['interviewid'];
    $interviewstatus = $_REQUEST['interviewstatus'];
    $interviewcomment = $_REQUEST['interviewcomment'];
    $arr = array("interviewstatus" => $interviewstatus, "interviewcomment" => $interviewcomment);
    $result = $dbop->update("interviewrecord", $arr, "interviewid='{$interviewid}'");
}
//为人员属性修改界面设定初始值
if ($type == "setPeopleValuesForModify") {
    $personid = $_REQUEST['personid'];
    $arr = array();
    $result = $dbop->get_one("select * from person where personid='{$personid}'");
    foreach ($result as $name => $value) {
        if ($value != "") {
            $arr[$name] = $value;
        }
    }
    echo json_encode($arr);
}
//add 居民
if ($type == "addPeople") {
    $arr = $_REQUEST['dataArr'];
    $result = $dbop->insert("person", $arr);
    if ($result) {
        echo "success";
    } else {
        echo "fail";
Example #25
0
function add_exteninfo($exten, $uname, $fromtime = null)
{
    $maxtime = 1850401485;
    //超大的数,到现在
    if ($fromtime > 0 and $fromtime < 1850401485) {
        global $dbhost, $dbuser, $dbpass, $cdrdbname;
        $db = new DB($dbhost, $dbuser, $dbpass, $cdrdbname);
        $db->conn();
        if ($fromtime == null) {
            $fromtime = time();
            $totime = 1850401485;
            $sql_update = "update exteninfo set totime=from_unixtime({$fromtime}) where exten='{$exten}' and totime=from_unixtime({$maxtime})";
            $db->query($sql_update);
            //更新现在在用的用户
        } else {
            $sql_select = "select max(UNIX_TIMESTAMP(fromtime)) from exteninfo where exten='{$exten}'";
            $maxfromtime = $db->get_one($db->query($sql_select));
            if (isset($maxfromtime)) {
                $maxfromtime = $maxfromtime;
            } else {
                $maxfromtime = 0;
            }
            if ($fromtime > $maxfromtime) {
                $db->query("update exteninfo set totime=from_unixtime({$fromtime}) where exten='{$exten}' and totime=from_unixtime({$maxtime})");
                $totime = $maxtime;
            } else {
                $sql_select_min = "select UNIX_TIMESTAMP(fromtime) from exteninfo where exten='{$exten}' and UNIX_TIMESTAMP(fromtime)<{$fromtime} order by fromtime desc limit 1";
                //查找小于该时间点的最大时间
                $sql_select_max = "select UNIX_TIMESTAMP(fromtime) from exteninfo where exten='{$exten}' and UNIX_TIMESTAMP(fromtime)>{$fromtime} order by fromtime asc limit 1";
                //查找大于该时间点的最小时间
                $minfromtime = $db->get_one($db->query($sql_select_min));
                if (isset($minfromtime)) {
                    $db->query("update exteninfo set totime=from_unixtime({$fromtime}) where exten='{$exten}' and fromtime=from_unixtime({$minfromtime})");
                }
                $totime = $db->get_one($db->query($sql_select_max));
            }
        }
        $sql_add = "insert into exteninfo(exten,uname,fromtime,totime) values('{$exten}','{$uname}',from_unixtime({$fromtime}),from_unixtime({$totime}))";
        $db->query($sql_add);
        $db->close();
        return "ok";
    } else {
        return "error";
    }
}
Example #26
0
<?php

session_start();
$folder_name = '/manage';
//网站目录名称
include './config.inc.php';
include $_SERVER['DOCUMENT_ROOT'] . $folder_name . '/db.php';
$tpl->assign("title", "招聘试题");
$tpl->assign("description", "招聘试题管理系统");
$db = new DB();
if (isset($_GET['id'])) {
    $id = intval($_GET['id']);
    $sql = "SELECT * FROM `interview_question` where id = " . $id;
    $result = $db->get_one($sql);
    $tagId = $result['tag'];
    $tagSql = "SELECT * FROM `interview_tag` where id = " . $tagId;
    $tagRes = $db->get_one($tagSql);
    $result['tag'] = $tagRes['name'];
    $tpl->assign("list", $result);
    $tpl->display("update.tpl");
}
if (isset($_POST['title'])) {
    $data['title'] = $_POST['title'];
    if (isset($_POST['tag'])) {
        $tagData['id'] = "";
        $tagData['name'] = $_POST['tag'];
        $db->insert('interview_tag', $tagData);
        $data['tag'] = $db->insert_id();
    }
    $data['content'] = $_POST['content'];
    $data['answer'] = $_POST['answer'];
Example #27
0
 /**
  * Get max level category
  *
  * @author MinhNV
  * Date 2010/07/06
  */
 private function getMaxLevel($table, $where = '')
 {
     $sql = 'SELECT max(level) FROM ' . $table . ' ' . $where;
     /// WHERE status = 1';
     $max = (int) DB::get_one($sql);
     return $max;
 }
Example #28
0
<?php

require_once './conf/config.php';
require_once BASE_PATH . 'conf/config.db.php';
$db = new DB();
$res = $db->get_one("select pwd from user where uname='admin'");
var_dump($res);
Example #29
0
<?php

session_start();
$folder_name = '/manage';
//网站目录名称
include './config.inc.php';
include $_SERVER['DOCUMENT_ROOT'] . $folder_name . '/db.php';
$tpl->assign("title", "文档修改");
$tpl->assign("description", "文档修改");
$db = new DB();
if (isset($_GET['id'])) {
    $id = intval($_GET['id']);
    $sql = "SELECT * FROM `document_doc` where id = " . $id;
    $result = $db->get_one($sql);
    //$tagId = $result['project_id'];
    //echo $tagId;
    //$tagSql = "SELECT * FROM `document_category` where id = ".$tagId;
    //$tagRes = $db->get_one($tagSql);
    //$result['tag'] = $tagRes['name'];
    $tpl->assign("list", $result);
    $tpl->display("update.tpl");
}
if (isset($_POST['title'])) {
    $data['title'] = $_POST['title'];
    $data['content'] = $_POST['content'];
    $db->update('document_doc', $data, 'id=' . $_POST['id']);
    $url = "http://" . $_SERVER['HTTP_HOST'] . $folder_name . "/routes/document/";
    //header("Location: ".$url);
    echo "<script language='javascript' type='text/javascript'>";
    echo "window.location.href='{$url}'";
    echo "</script>";
Example #30
0
 public function dopos()
 {
     global $_M;
     $metinfo['citylist'][0]['p']['name'] = '全局';
     $metinfo['citylist'][0]['p']['value'] = 0;
     $metinfo['citylist'][0]['c'][0]['n']['name'] = '首项';
     $metinfo['citylist'][0]['c'][0]['n']['value'] = 0;
     $metinfo['citylist'][1]['p']['name'] = '首页';
     $metinfo['citylist'][1]['p']['value'] = 1;
     $query = "SELECT * FROM {$_M['table']['templates']} WHERE no='{$_M['form']['no']}' AND lang='{$_M['form']['lang']}' AND pos = '0' ORDER BY no_order DESC,id DESC ";
     $max_order = DB::get_one($query);
     $max_order['id'] = $max_order['id'] ? $max_order['id'] : 0;
     $metinfo['citylist'][1]['c'][0]['n']['name'] = '首项';
     $metinfo['citylist'][1]['c'][0]['n']['value'] = $max_order['id'];
     $metinfo['citylist'][2]['p']['name'] = '列表页';
     $metinfo['citylist'][2]['p']['value'] = 2;
     $query = "SELECT * FROM {$_M['table']['templates']} WHERE no='{$_M['form']['no']}' AND lang='{$_M['form']['lang']}' AND (pos='0' OR pos='1') ORDER BY no_order DESC,id DESC ";
     $max_order = DB::get_one($query);
     $max_order['id'] = $max_order['id'] ? $max_order['id'] : 0;
     $metinfo['citylist'][2]['c'][0]['n']['name'] = '首项';
     $metinfo['citylist'][2]['c'][0]['n']['value'] = $max_order['id'];
     $metinfo['citylist'][3]['p']['name'] = '详细页';
     $metinfo['citylist'][3]['p']['value'] = 3;
     $query = "SELECT * FROM {$_M['table']['templates']} WHERE no='{$_M['form']['no']}' AND lang='{$_M['form']['lang']}' AND (pos='0' OR pos='1' OR pos='2') ORDER BY no_order DESC,id DESC ";
     $max_order = DB::get_one($query);
     $max_order['id'] = $max_order['id'] ? $max_order['id'] : 0;
     $metinfo['citylist'][3]['c'][0]['n']['name'] = '首项';
     $metinfo['citylist'][3]['c'][0]['n']['value'] = $max_order['id'];
     $query = "SELECT * FROM {$_M['table']['templates']} where no='{$_M['form']['no']}' AND lang='{$_M['form']['lang']}' ORDER BY no_order,id";
     $tems = DB::get_all($query);
     foreach ($tems as $key => $val) {
         $val['pos'] = $val['pos'];
         $tem = array();
         $tem['n']['name'] = $val['valueinfo'];
         $tem['n']['value'] = $val['id'];
         $metinfo['citylist'][$val['pos']]['c'][] = $tem;
     }
     echo jsonencode($metinfo);
 }