Exemple #1
0
 public function pageListMproduct()
 {
     $page = intval($_REQUEST['page']);
     if ($page <= 0) {
         $page = 1;
     }
     $page_count = 20;
     $count = 0;
     $order = $_REQUEST['order'] or 'id';
     //排序字段
     $list = daocall('mproduct', 'pageList', array($page, $page_count, &$count, $order));
     $mproduct_group = daocall('mproductgroup', 'getMproductgroup', array());
     if (is_array($list)) {
         for ($i = 0; $i < count($list); $i++) {
             foreach ($mproduct_group as $mproduct) {
                 if ($list[$i]['group_id'] == $mproduct['id']) {
                     $list[$i]['group_name'] = $mproduct['name'];
                 }
             }
         }
     }
     $total_page = ceil($count / $page_count);
     if ($page >= $total_page) {
         $page = $total_page;
     }
     $this->_tpl->assign('order', $order);
     $this->_tpl->assign('count', $count);
     $this->_tpl->assign('total_page', $total_page);
     $this->_tpl->assign('page', $page);
     $this->_tpl->assign('page_count', $page_count);
     $this->_tpl->assign('list', $list);
     $this->_tpl->display('mproduct/pagelistmproduct.html');
 }
Exemple #2
0
 public function operatelogPageList()
 {
     $page = intval($_REQUEST['page']);
     if ($page <= 0) {
         $page = 1;
     }
     $page_count = 20;
     $count = 0;
     $order = $_REQUEST['order'] ? $_REQUEST['order'] : 'id';
     if ($_REQUEST['id']) {
         $select_where['id'] = $_REQUEST['id'];
     } else {
         if ($_REQUEST['admin']) {
             $select_where['admin'] = $_REQUEST['admin'];
         } else {
             $select_where = null;
         }
     }
     $list = daocall('operatelog', 'operatelogPageList', array($page, $page_count, &$count, $order, $select_where));
     $total_page = ceil($count / $page_count);
     if ($page >= $total_page) {
         $page = $total_page;
     }
     $this->_tpl->assign('order', $order);
     $this->_tpl->assign('count', $count);
     $this->_tpl->assign('total_page', $total_page);
     $this->_tpl->assign('page', $page);
     $this->_tpl->assign('page_count', $page_count);
     $this->_tpl->assign('list', $list);
     return $this->_tpl->display('operatelog/pagelist.html');
 }
Exemple #3
0
 public function showMproductFrom()
 {
     $id = intval($_REQUEST['id']);
     $mproductinfo = daocall('mproduct', 'getMproductById', array($id));
     $this->_tpl->assign('mproductinfo', $mproductinfo);
     return $this->_tpl->fetch('mproduct/showmproduct.html');
 }
Exemple #4
0
 public static function singleton()
 {
     require_once SYS_ROOT . "/smarty/Smarty.class.php";
     if (!isset(self::$instance)) {
         self::$instance = new Smarty();
         self::$instance->use_sub_dirs = true;
         //防止没有第一次使用的时候,无法连接数据库
         if (file_exists(dirname(dirname(__FILE__)) . '/config.php')) {
             $view_dir = daocall('setting', 'get', array('view_dir'));
         }
         if (!$view_dir) {
             $view_dir = 'default';
         }
         self::$instance->template_dir = APPLICATON_ROOT . '/view/' . $view_dir;
         self::$instance->compile_dir = SYS_ROOT . '/templates_c/' . $view_dir;
         if (!defined(TPL_ROOT)) {
             //define(TPL_ROOT,dirname($_SERVER["REQUEST_URI"]));
             define(TPL_ROOT, dirname($_SERVER['PHP_SELF']));
         }
         self::$instance->assign("STATIC", TPL_ROOT . '/view/' . $view_dir . '/');
         //self::$instance->assign("PSTATIC","/");
         //self::$instance->assign('role',getRoles());
         //self::$instance->caching = false;
         self::$instance->left_delimiter = '{{';
         self::$instance->right_delimiter = '}}';
     }
     return self::$instance;
 }
Exemple #5
0
 public function set()
 {
     daocall('setting', 'add', array('view_dir', $_REQUEST['view_dir']));
     daocall('setting', 'add', array('reg_user_price', $_REQUEST['reg_user_price'] * 100));
     daocall('setting', 'add', array('reg_off', $_REQUEST['reg_off']));
     daocall('setting', 'add', array('findpasswd_off', $_REQUEST['findpasswd_off']));
     daocall('setting', 'add', array('try_day', $_REQUEST['try_day']));
     if ($_REQUEST['view_dir'] != $this->setting['view_dir']) {
         $log = array('operate_object' => 'view_dir=' . $_REQUEST['view_dir'], 'admin' => getRole('admin'), 'operate' => $_REQUEST['c'] . "&a=" . $_REQUEST['a']);
         apicall('operatelog', 'operatelogAdd', array($log));
     }
     if ($_REQUEST['reg_user_price'] * 100 != $this->setting['reg_user_price']) {
         $log = array('operate_object' => 'reg_user_price=' . $_REQUEST['reg_user_price'], 'admin' => getRole('admin'), 'operate' => $_REQUEST['c'] . "&a=" . $_REQUEST['a']);
         apicall('operatelog', 'operatelogAdd', array($log));
     }
     if ($_REQUEST['reg_off'] != $this->setting['reg_off']) {
         $log = array('operate_object' => 'reg_off=' . $_REQUEST['reg_off'], 'admin' => getRole('admin'), 'operate' => $_REQUEST['c'] . "&a=" . $_REQUEST['a']);
         apicall('operatelog', 'operatelogAdd', array($log));
     }
     if ($_REQUEST['findpasswd_off'] != $this->setting['findpasswd_off']) {
         $log = array('operate_object' => 'findpasswd_off=' . $_REQUEST['findpasswd_off'], 'admin' => getRole('admin'), 'operate' => $_REQUEST['c'] . "&a=" . $_REQUEST['a']);
         apicall('operatelog', 'operatelogAdd', array($log));
     }
     return header('Location: ?c=function&a=setFrom');
 }
Exemple #6
0
 public function setMail()
 {
     daocall('setting', 'add', array('set_mail', $_REQUEST['set_mail']));
     daocall('setting', 'add', array('mail_smtp', $_REQUEST['mail_smtp']));
     if ($_REQUEST['mail_username']) {
         daocall('setting', 'add', array('mail_username', $_REQUEST['mail_username']));
     }
     if ($_REQUEST['mail_host']) {
         daocall('setting', 'add', array('mail_host', $_REQUEST['mail_host']));
     }
     if ($_REQUEST['mail_port']) {
         daocall('setting', 'add', array('mail_port', $_REQUEST['mail_port']));
     }
     if ($_REQUEST['mail_secure']) {
         daocall('setting', 'add', array('mail_secure', $_REQUEST['mail_secure']));
     }
     if ($_REQUEST['mail_passwd']) {
         daocall('setting', 'add', array('mail_passwd', $_REQUEST['mail_passwd']));
     }
     if ($_REQUEST['mail_from']) {
         daocall('setting', 'add', array('mail_from', $_REQUEST['mail_from']));
     }
     if ($_REQUEST['mail_fromname']) {
         daocall('setting', 'add', array('mail_fromname', $_REQUEST['mail_fromname']));
     }
     if ($_REQUEST['mail_subject']) {
         daocall('setting', 'add', array('mail_subject', $_REQUEST['mail_subject']));
         daocall('setting', 'add', array('mail_body', $_REQUEST['mail_body']));
     }
     return $this->mailFrom();
 }
Exemple #7
0
 public function showProductFrom()
 {
     $product_id = $_REQUEST['product_id'];
     $product_info = daocall('vhostproduct', 'getProduct', array($product_id));
     $this->_tpl->assign('product_info', $product_info);
     return $this->_tpl->fetch('host/showProductFrom.html');
 }
Exemple #8
0
 public function findPasswd($username, $email)
 {
     $user_info = daocall('user', 'getUser', array($username));
     if (!$user_info) {
         return '2';
     }
     if ($user_info['email'] == "") {
         return '3';
     }
     if (md5($user_info['email']) != md5($email)) {
         return '4';
     }
     $passwd = getRandPasswd(8);
     $file = '../file/findpasswd.html';
     if (file_exists($file)) {
         $body = file_get_contents($file);
     } else {
         $body = "您的新密码为:{{passwd}}<br>";
         $body .= "欢迎使用本网产品,<a href='http://www.kanglesoft.com/' target=_blank>http://www.kanglesoft.com/</a>";
     }
     $body = str_replace('{{passwd}}', $passwd, $body);
     $subject = $username . "密码找回";
     $address[] = $user_info['email'];
     $mail_result = apicall('mail', 'sendMail', array($address, $subject, $body));
     if ($mail_result !== false) {
         daocall('user', 'updatePassword', array($username, $passwd));
         return '0';
     }
     return '1';
 }
Exemple #9
0
 /**
  * 插入订单数据库
  * 1.username
  * 2.product_id
  * 3.arr 用户的输入信息
  * Enter description here ...
  * @param $username
  */
 protected function create($susername, &$params = array(), $product_info = array())
 {
     $arr['username'] = $susername;
     $arr['product_id'] = $params['product_id'];
     $arr['client_msg'] = $params['client_msg'];
     //一个月的价格
     $month_price = $product_info['price'] / 12 / 100;
     if ($params['group_id']) {
         $arr['group_id'] = $params['group_id'];
     }
     if ($params['admin_msg']) {
         $arr['admin_msg'] = $params['admin_msg'];
     }
     if ($params['admin_mem']) {
         $arr['admin_mem'] = $params['admin_mem'];
     }
     if ($params['status']) {
         $arr['status'] = $params['status'];
     }
     if ($params['month']) {
         $arr['month'] = $params['month'];
         $arr['price'] = $params['month'] * $month_price;
     }
     return daocall('mproductorder', 'add', array($arr));
 }
Exemple #10
0
 public function info()
 {
     $arr = $_GET;
     $ret = daocall('admin_user', 'getUser', array($arr['username']));
     if ($ret) {
         $this->_tpl->assign('row', $ret);
         $this->_tpl->display('user/userinfo.html');
     }
 }
Exemple #11
0
 /**
  * 每日运行
  */
 public function runDay()
 {
     /*
      * 设置过期用户 
      */
     daocall('vhost', 'expireUser');
     /*
      * 通知所有节点重新加载虚拟主机
      */
     $nodes = daocall('nodes', 'listNodes');
     for ($i = 0; $i < count($nodes); $i++) {
         $this->reloadNode($nodes[$i]);
     }
 }
Exemple #12
0
 private function checkPassword($username, $passwd)
 {
     $user = daocall('admin_user', 'getUser', array($username));
     if (!$user) {
         return false;
     }
     if (strtolower($user["passwd"]) != strtolower(md5($passwd))) {
         return false;
     }
     $attr['last_login'] = '******';
     $attr['last_ip'] = $_SERVER['REMOTE_ADDR'];
     daocall('admin_user', 'updateUser', array($username, $attr));
     return $user;
 }
Exemple #13
0
 public function webSetup()
 {
     daocall('setting', 'add', array('web_name', $_REQUEST['web_name']));
     daocall('setting', 'add', array('logo', $_REQUEST['logo']));
     daocall('setting', 'add', array('contact', $_REQUEST['contact']));
     daocall('setting', 'add', array('footer', $_REQUEST['footer']));
     daocall('setting', 'add', array('stat_code', $_REQUEST['stat_code']));
     daocall('setting', 'add', array('banner', $_REQUEST['banner']));
     daocall('setting', 'add', array('links', $_REQUEST['links']));
     daocall('setting', 'add', array('vhost_name', $_REQUEST['vhost_name']));
     $list = daocall('setting', 'getAll');
     apicall('utils', 'writeConfig', array($list, 'name', 'setting'));
     return $this->setupMain();
 }
Exemple #14
0
 public function left()
 {
     $nodes = daocall('nodes', 'getAllNodes', array());
     if (count($nodes) < 0 || $nodes == null) {
         $js_str = '<script language="javascript">jQuery(document).ready(function(){';
         $js_str .= 'jQuery("#p44").append("' . "&nbsp;<b class='one'><--第一步</b>" . '");';
         $js_str .= 'jQuery("#p66").append("' . "&nbsp;<b class='one'><--第二步</b>" . '");});</script>';
     } else {
         $products = daocall('vhostproduct', 'selectProduct', array());
         if (count($products) < 0 || $products == null) {
             $js_str = '<script language="javascript">jQuery(document).ready(function(){';
             $js_str .= 'jQuery("#p66").append("' . "&nbsp;<b class='one'><--下一步</b>" . '");});</script>';
         }
     }
     if ($js_str) {
         $this->assign('js_str', $js_str);
     }
     return $this->display('left.html');
 }
Exemple #15
0
 public function pageMoneyin()
 {
     $page = intval($_REQUEST['page']);
     if ($page <= 0) {
         $page = 1;
     }
     $page_count = 20;
     $count = 0;
     $list = daocall('moneyin', 'pageMoneyin', array($page, $page_count, &$count));
     $total_page = ceil($count / $page_count);
     if ($page >= $total_page) {
         $page = $total_page;
     }
     $this->_tpl->assign('count', $count);
     $this->_tpl->assign('total_page', $total_page);
     $this->_tpl->assign('page', $page);
     $this->_tpl->assign('page_count', $page_count);
     $this->_tpl->assign('list', $list);
     $this->_tpl->display('money/pagemoneyin.html');
 }
Exemple #16
0
 public function moneyout()
 {
     $page = intval($_REQUEST['page']);
     if ($page <= 0) {
         $page = 1;
     }
     $page_count = 15;
     $count = 0;
     $list = daocall('moneyout', 'pageByUser', array(getRole('user'), $page, $page_count, &$count));
     $total_page = ceil($count / $page_count);
     if ($page >= $total_page) {
         $page = $total_page;
     }
     $this->_tpl->assign('count', $count);
     $this->_tpl->assign('total_page', $total_page);
     $this->_tpl->assign('page', $page);
     $this->_tpl->assign('page_count', $page_count);
     $this->_tpl->assign('list', $list);
     return $this->_tpl->fetch('money/moneyout.html');
 }
Exemple #17
0
 public function productgroupPageList()
 {
     $page = intval($_REQUEST['page']);
     if ($page <= 0) {
         $page = 1;
     }
     $page_count = 20;
     $count = 0;
     $list = daocall('productgroup', 'productgroupPageList', array($page, $page_count, &$count));
     $total_page = ceil($count / $page_count);
     if ($page >= $total_page) {
         $page = $total_page;
     }
     $this->_tpl->assign('count', $count);
     $this->_tpl->assign('total_page', $total_page);
     $this->_tpl->assign('page', $page);
     $this->_tpl->assign('page_count', $page_count);
     $this->_tpl->assign('list', $list);
     return $this->_tpl->display('productgroup/productgrouplist.html');
 }
Exemple #18
0
 function upload_pic($file = array(), $other = array())
 {
     if (!$file || !$other) {
         return false;
     }
     $upload = new upload("pic");
     $upload->out_file_dir = "./statics/images/idea";
     $upload->out_file_name = "idea" . time();
     $upload->upload_process();
     $error_no = $upload->error_no;
     if ($error_no > 0) {
         return flase;
     }
     $other["add_time"] = time();
     $other["location"] = trim($upload->saved_upload_name, ".");
     $other["belong_to"] = "idea";
     $rs = daocall("admin", "insert_pic", array($other));
     if (!$rs) {
         return false;
     }
     return true;
 }
Exemple #19
0
 public function pageListMproductorder()
 {
     $page = intval($_REQUEST['page']);
     if ($page <= 0) {
         $page = 1;
     }
     $page_count = 20;
     $count = 0;
     $order = $_REQUEST['order'] or 'id';
     //排序字段
     $where = "";
     if ($_REQUEST['username']) {
         $where['username'] = $_REQUEST['username'];
     }
     $list = daocall('mproductorder', 'pageList', array($page, $page_count, &$count, $order, $where));
     //获取产品信息
     $mproducts = daocall('mproduct', 'getMproductById', array());
     //将product_id替换为product_name显示
     if (is_array($list) && is_array($mproducts)) {
         for ($i = 0; $i < count($list); $i++) {
             foreach ($mproducts as $mproduct) {
                 if ($list[$i]['product_id'] == $mproduct['id']) {
                     $list[$i]['product_name'] = $mproduct['name'];
                 }
             }
         }
     }
     $total_page = ceil($count / $page_count);
     if ($page >= $total_page) {
         $page = $total_page;
     }
     $this->_tpl->assign('order', $order);
     $this->_tpl->assign('count', $count);
     $this->_tpl->assign('total_page', $total_page);
     $this->_tpl->assign('page', $page);
     $this->_tpl->assign('page_count', $page_count);
     $this->_tpl->assign('list', $list);
     return $this->_tpl->fetch('mproductorder/pagelistmproductorder.html');
 }
Exemple #20
0
 public function pageByuser()
 {
     $sortname = $_REQUEST['sortname'];
     $page = intval($_REQUEST['page']);
     if ($page <= 0) {
         $page = 1;
     }
     $page_count = 30;
     $count = 0;
     $list = daocall('question', 'pageByuser', array(getRole('user'), $page, $page_count, &$count, $sortname));
     $total_page = ceil($count / $page_count);
     if ($page >= $total_page) {
         $page = $total_page;
     }
     $this->_tpl->assign('sortname', $sortname);
     $this->_tpl->assign('count', $count);
     $this->_tpl->assign('total_page', $total_page);
     $this->_tpl->assign('page', $page);
     $this->_tpl->assign('page_count', $page_count);
     $this->_tpl->assign('list', $list);
     return $this->_tpl->fetch('question/pagelist.html');
 }
Exemple #21
0
 public function step2()
 {
     $host = $_REQUEST['db_host'];
     $dbname = $_REQUEST['db_name'];
     $user = $_REQUEST['db_user'];
     $passwd = $_REQUEST['db_passwd'];
     $ucswitch = $_REQUEST['uc_switch'];
     $dzappname = $_REQUEST['dz_appname'];
     /*创建数据库*/
     $dbconnect = mysql_connect($host, $user, $passwd);
     @mysql_query("CREATE DATABASE " . $dbname);
     @mysql_close($dbconnect);
     /* 数据库innodb环境检查*/
     $pdo = $GLOBALS['default_db'] = $this->check_connect($host, "3306", $dbname, $user, $passwd);
     if (!$pdo) {
         $this->_tpl->assign("msg", "数据库连接出错");
         $this->_tpl->assign("request", $_REQUEST);
         return $this->_tpl->fetch('install/step1.html');
     }
     $result = $pdo->query('SHOW VARIABLES LIKE "have_%"');
     $have = $result->fetchAll(PDO::FETCH_ASSOC);
     if (is_array($have)) {
         foreach ($have as $h) {
             if ($h['Variable_name'] == 'have_innodb') {
                 if (strcasecmp($h['Value'], 'no') == 0) {
                     die("数据库不支持innodb数据库引擎,请升级mysql数据库");
                 }
             }
         }
     }
     $this->create_sql($GLOBALS['default_db']);
     $this->create_config($host, "3306", $dbname, $user, $passwd, $ucswitch, $dzappname);
     daocall('admin_user', 'newUser', array($_REQUEST['admin_user'], $_REQUEST['admin_passwd']));
     if (!apicall('install', 'writeVersion')) {
         die("未能写入版本信息");
     }
     return $this->_tpl->fetch('install/step2.html');
 }
Exemple #22
0
 public function pageListMproductgroup()
 {
     $page = intval($_REQUEST['page']);
     if ($page <= 0) {
         $page = 1;
     }
     $page_count = 20;
     $count = 0;
     $order = $_REQUEST['order'] or 'id';
     //排序字段
     $list = daocall('mproductgroup', 'pageList', array($page, $page_count, &$count, $order));
     $total_page = ceil($count / $page_count);
     if ($page >= $total_page) {
         $page = $total_page;
     }
     $this->_tpl->assign('order', $order);
     $this->_tpl->assign('count', $count);
     $this->_tpl->assign('total_page', $total_page);
     $this->_tpl->assign('page', $page);
     $this->_tpl->assign('page_count', $page_count);
     $this->_tpl->assign('list', $list);
     return $this->_tpl->fetch('mproductgroup/pagelistmproductgroup.html');
 }
Exemple #23
0
 protected function refreshHostTemplete($node)
 {
     daocall('vhosttemplete', 'updateNodeState', array($node['name']));
     $whm = new WhmClient();
     $whm->setAuth($node['user'], $node['passwd']);
     $whm->setWhmUrl("http://" . $node['host'] . ":" . $node['port'] . "/core.whm");
     $call = new WhmCall("list_tvh");
     $result = $whm->call($call);
     if (!$result) {
         die('failed');
         return false;
     }
     $templete = array();
     for ($i = 0;; $i++) {
         $value = $result->get("name", $i);
         if (!$value) {
             break;
         }
         $templete[] = $value;
         //echo "tvh=".$value."\n";
     }
     daocall('vhosttemplete', 'updateNodeTemplete', array($node['name'], $templete));
     //die('success');
 }
Exemple #24
0
 public function payReturn($id, $money = null)
 {
     global $default_db;
     $moneyin = daocall('moneyin', 'get', array($id));
     $user = daocall('user', 'getUser', array($moneyin['username']));
     if (!$default_db->beginTransaction()) {
         trigger_error('开始事务失败');
         return false;
     }
     $result = daocall('moneyin', 'updateStatus', array($id, $money));
     if (!$result) {
         $default_db->rollBack();
         //trigger_error('充值失败');			//回滚
         return false;
     }
     $result = $this->addMoney($moneyin['username'], $moneyin['money']);
     if (!$result) {
         $default_db->rollBack();
         //trigger_error('充值失败');			//回滚
         return false;
     }
     return $default_db->commit();
     //提交
 }
Exemple #25
0
 public function updateNews()
 {
     $body = apicall('utils', 'klencode', array($_REQUEST['body'], true));
     $new = daocall('news', 'updateNews', array($_REQUEST['id'], $_REQUEST['title'], $body));
     return $this->pageNews();
 }
Exemple #26
0
 function albulm_list()
 {
     $belong_to = $_GET["belong_to"] ? trim($_GET["belong_to"]) : false;
     $rs = daocall("admin", "get_albulm", array("albulm_id,albulm_name", "belong_to='{$belong_to}'"));
     if (!$rs) {
         echo json_encode(array());
         exit;
     }
     echo json_encode($rs);
 }
Exemple #27
0
 public function insert()
 {
     //		$os = $this->getOs();
     //		if(!$os){
     //			return false;
     //		}
     $data = array('name' => $_REQUEST['name'], 'host' => $_REQUEST['host'], 'nickname' => $_REQUEST['nickname'], 'port' => intval($_REQUEST['port']), 'passwd' => $_REQUEST['passwd']);
     $ret = daocall("nodes", "insertNode", array($data));
     if ($ret !== false) {
         //	header("Location: ?c=nodes&a=listNode");
     }
     $log = array('operate_object' => 'name=' . $_REQUEST['name'], 'admin' => getRole('admin'), 'operate' => $_REQUEST['a']);
     apicall('operatelog', 'operatelogAdd', array($log));
     $this->flush();
 }
Exemple #28
0
 public function listUser()
 {
     $username = $_REQUEST['username'];
     if ($username != "") {
         $this->_tpl->assign('username', $username);
         $list = daocall('user', 'listUser', array($username));
         if (!$list) {
             $this->_tpl->assign("msg", "没有找到用户:" . $username);
         }
     }
     $agents = daocall('agent', 'selectList', array());
     $this->_tpl->assign('agents', $agents);
     $this->_tpl->assign('sum', count($list));
     $this->_tpl->assign('list', $list);
     $this->_tpl->display('user/userlist.html');
 }
Exemple #29
0
 function updatecredit($get, $post)
 {
     if (!API_UPDATECREDIT) {
         return API_RETURN_FORBIDDEN;
     }
     $credit = intval($get['credit']);
     $amount = $get['amount'];
     $uid = $get['uid'];
     if ($return = daocall('user', 'getUserById', array($get['uid']))) {
         daocall('user', 'addMoney', array($return['username'], abs($get['amount']) * 100));
         return API_RETURN_SUCCEED;
     }
     return API_RETURN_FASLE;
 }
Exemple #30
0
 public function operatelogAdd($arr)
 {
     return daocall('operatelog', 'operatelogAdd', array($arr));
 }