예제 #1
0
 public function agree($apply_id)
 {
     $conditions['apply_id'] = $apply_id;
     $apply = $this->find_one($conditions);
     if ($apply) {
         $this->update(array('apply_id' => $apply_id), array('status' => 1));
         $ptx_user = spClass("ptx_user");
         if ($apply['apply_type'] == 1) {
             $ptx_user->update_staruser($apply['user_id'], 1);
             $ptx_staruser = spClass("ptx_staruser");
             $data['user_id'] = $apply['user_id'];
             $data['medal_id'] = $apply['medal_id'];
             $data['star_reason'] = $apply['message_txt'];
             $ptx_staruser->add_one($data);
             $ptx_staruser->update_staruser_cache();
         } elseif ($apply['apply_type'] == 2) {
             $data['user_id'] = $apply['user_id'];
             $data['store_category_id'] = $apply['store_category_id'];
             $data['shop_desc'] = $apply['message_txt'];
             $ptx_goodshop = spClass('ptx_goodshop');
             $ptx_goodshop->add_one($data);
             $ptx_user->update_shopuser($apply['user_id'], 1);
         }
         $this->deleteByPk($apply_id);
     }
     return;
 }
예제 #2
0
파일: main.php 프로젝트: wateronface/php
 function logout()
 {
     unset($_SESSION['username']);
     unset($_SESSION['password']);
     spClass('spAcl')->set("");
     $this->display("login.htm");
     // 显示模板,这里使用的模板是根目录/tpl/green/index.html。
 }
예제 #3
0
 function updatesave()
 {
     $i_order = spClass("i_order");
     $param = $this->spArgs();
     $conditions = array('id' => $param['chk_list'][0]);
     $this->results = $i_order->find($conditions);
     $this->display("i_order_updateform.htm");
     // 显示模板
 }
예제 #4
0
파일: main.php 프로젝트: eon-hong/anypay
 /** @brief 显示首页 */
 function index()
 {
     if (!$this->visitor->is_login()) {
         $this->login();
     } else {
         $members = spClass('UserModel')->findAll(array('store_id' => $this->visitor['user']['store_id']));
         $this->member = $members;
         $this->display('index.html');
     }
 }
예제 #5
0
 function updatesave()
 {
     $model = spClass("product");
     $param = $this->spArgs();
     $conditions = array('id' => $param['id']);
     $model->update($conditions, $param);
     //		echo($model->dumpSql());
     $this->results = spUrl("product_action", "index");
     $this->display("ok.htm");
     // 显示模板
 }
예제 #6
0
파일: model_user.php 프로젝트: daolei/grw
 public function userlogin($uname, $upass)
 {
     $conditions = array('uname' => $uname, 'upass' => $upass);
     if ($result = $this->find($conditions)) {
         spClass('FeiAcl')->set($result['acl']);
         $_SESSION["userinfo"] = $result;
         return true;
     } else {
         return false;
     }
 }
예제 #7
0
파일: spView.php 프로젝트: eon-hong/anypay
 /**
  * 注册已挂靠的视图函数
  */
 public function addfuncs()
 {
     if (is_array($GLOBALS['G_SP']["view_registered_functions"]) && method_exists($this->engine, 'register_function')) {
         foreach ($GLOBALS['G_SP']["view_registered_functions"] as $alias => $func) {
             if (is_array($func) && !is_object($func[0])) {
                 $func = array(spClass($func[0]), $func[1]);
             }
             $this->engine->register_function($alias, $func);
         }
     }
 }
예제 #8
0
파일: spView.php 프로젝트: ngsoqia/soupian
 /**
  * 注册视图函数
  */
 public function addfuncs()
 {
     if (is_array($GLOBALS['G_SP']["view_registered_functions"])) {
         foreach ($GLOBALS['G_SP']["view_registered_functions"] as $alias => $func) {
             if (is_array($func) && !is_object($func[0])) {
                 $func = array(spClass($func[0]), $func[1]);
             }
             $this->engine->registerPlugin("function", $alias, $func);
             unset($GLOBALS['G_SP']["view_registered_functions"][$alias]);
         }
     }
 }
예제 #9
0
 public function verify($var)
 {
     if (empty($var)) {
         return false;
     }
     $text = spClass('spSession')->get('vcode');
     if ($var != $text) {
         return false;
     } else {
         return true;
     }
 }
예제 #10
0
 public function login($username, $password)
 {
     $conditions = array('username' => $username, 'password' => $password);
     if ($result = $this->find($conditions)) {
         spClass('spAcl')->set($result['acl_name']);
         $result['password'] = md5($result['password']);
         $_SESSION["user"] = $result;
         return true;
     } else {
         return false;
     }
 }
예제 #11
0
 public function user()
 {
     $this->parameter_need('sname');
     $ptx_user = spClass('ptx_user');
     $user = $ptx_user->find(array('domain' => $this->sname), ' ptx_user.user_id ');
     $this->user_id = $user['user_id'];
     $act = $this->spArgs("act");
     if (in_array($act, array('focus', 'shares', 'album', 'favorite_share', 'following', 'fans', 'timeline', 'forumline'))) {
         eval("\$this->{$act}();");
     } else {
         $this->timeline();
     }
 }
예제 #12
0
파일: dbTest.php 프로젝트: as3long/as3long
 public function action()
 {
     $user = spClass("users");
     $userAppId = $this->spArgs("userAppId", 123);
     $sql = "select * from users where users.userAppId=" . $userAppId;
     $result = $user->findSql($sql);
     // 执行查找
     //dump($result);                                                        //输出数组
     $json_Str = json_encode($result);
     if ($json_Str != "false") {
         echo $json_Str;
     }
 }
예제 #13
0
 private function getUserSkin($bid = 0)
 {
     if ($this->spArgs('domain') != 'home' && $this->spArgs('domain') != '') {
         $rs = spClass('db_theme')->getByDomain($this->spArgs('domain'));
     } elseif ($this->spArgs('uid') != '') {
         $rs = spClass('db_theme')->getByUid($this->spArgs('uid'));
     } else {
         $rs = spClass('db_theme')->getByBid($this->spArgs('bid'));
     }
     if (!is_array($rs)) {
         err404('您访问的用户不存在,用户可能已经更改了个性域名');
     }
     $skin = spClass('db_theme')->find(array('uid' => $rs['uid']));
     $this->user_data = $rs;
     $this->user_skin = $skin;
     //将数据赋值给全局变量
 }
예제 #14
0
 private function alert()
 {
     $this->ajax_check_login();
     $ptx_event_log = spClass('ptx_event_log');
     $conditions['to_user_id'] = $this->current_user['user_id'];
     $conditions['event_type'] = 'alert';
     $conditions['is_read'] = '0';
     $message_count = $ptx_event_log->findCount($conditions);
     if ($message_count > 99) {
         $message_html = "<em>N</em>";
     } elseif ($message_count) {
         $message_html = "<em>{$message_count}</em>";
     } else {
         $message_html = "";
     }
     $this->ajax_success_response(array('message_html' => $message_html), 'alert');
 }
예제 #15
0
 /**
  * 魔术函数  通过函数名来调用不同的缓存驱动类
  */
 public function __call($name, $args)
 {
     $driverClass = 'access_driver_' . $name;
     if (!class_exists($driverClass)) {
         spError('spAccess无法找到名为{$name}缓存驱动程序,请检查!');
     }
     extract(array_pop($args));
     if ('w' == $method) {
         // 写数据
         $life_time = -1 == $life_time ? '300000000' : $life_time;
         return spClass($driverClass)->set($name, serialize($value), $life_time);
     } elseif ('c' == $method) {
         // 清除数据
         return spClass($driverClass)->del($name);
     } else {
         // 读数据
         return unserialize(spClass($driverClass)->get($name));
     }
 }
예제 #16
0
 public function step3()
 {
     $config = spClass('Options');
     if ($this->spArgs("db_host")) {
         if ($config->load('config.php')) {
             $db = array('host' => $this->spArgs("db_host"), 'port' => $this->spArgs("db_port"), 'login' => $this->spArgs("db_login"), 'password' => $this->spArgs("db_password"), 'database' => $this->spArgs("db_database"), 'prefix' => $this->spArgs("db_prefix"));
             $admin = array('email' => $this->spArgs("admin_email"), 'nickname' => $this->spArgs("admin_nickname"), 'password' => $this->spArgs("admin_password"));
             $config->set_item('db', $db);
             $config->set_item('default_controller', 'welcome');
             $config->save('config.php');
             $do_install = $this->do_install($db, $admin);
             if ($do_install['status'] != 200) {
                 $this->install_error = $do_install;
             } else {
                 $this->jump(spUrl('install', 'step4'));
             }
         } else {
             $this->install_error = array('status' => 500, 'msg' => 'config.php 文件不存在,请检查文件目录是否完整');
         }
     }
     $this->display("install/step3.php");
 }
예제 #17
0
파일: user.php 프로젝트: eon-hong/anypay
 /** @brief 显示首页 */
 function add()
 {
     if (empty($this->visitor['user'])) {
         $this->display('login.html');
         exit;
     }
     $username = $this->spArgs('user_name');
     $password = $this->spArgs('password');
     $realname = $this->spArgs('real_name');
     $email = $this->spArgs('email');
     $gender = $this->spArgs('gender');
     $mobile = $this->spArgs('mobile');
     if (empty($username) || empty($password) || empty($realname) || empty($email) || empty($gender) || empty($mobile)) {
         $this->display('user/add.html');
     } else {
         $result = spClass('UserModel')->create(array('store_id' => $this->visitor['store']['store_id'], 'user_name' => $username, 'password' => $password, 'real_name' => $realname, 'mobile' => $mobile, 'gender' => $gender, 'email' => $email, 'pid' => 'N/A'));
         if ($result) {
             $this->show_message('USER_ADD_SUCCESS', 'GO_TO_INDEX', 'index.php');
         } else {
             show_error('USER_ADD_FAILURE', 'GO_TO_HISTORY');
         }
     }
 }
예제 #18
0
 public function init($params)
 {
     if (is_array($params)) {
         foreach (array('sess_encrypt_cookie', 'sess_use_database', 'sess_table_name', 'sess_expiration', 'sess_expire_on_close', 'sess_match_ip', 'sess_match_useragent', 'sess_cookie_name', 'cookie_path', 'cookie_domain', 'cookie_secure', 'sess_time_to_update', 'time_reference', 'cookie_prefix', 'encryption_key') as $key) {
             $this->{$key} = isset($params[$key]) ? $params[$key] : $this->{$key};
         }
     }
     // Set the "now" time.  Can either be GMT or server time, based on the
     // config prefs.  We use this to set the "last activity" time
     $this->now = $this->_get_time();
     $this->security = spClass('Security');
     // Do we need encryption? If so, load the encryption class
     if ($this->sess_encrypt_cookie == TRUE) {
         $this->encrypt = spClass('Encrypt');
     }
     // Set the session length. If the session expiration is
     // set to zero we'll set the expiration two years from now.
     if ($this->sess_expiration == 0) {
         $this->sess_expiration = 60 * 60 * 24 * 365 * 2;
     }
     // Set the cookie name
     $this->sess_cookie_name = $this->cookie_prefix . $this->sess_cookie_name;
     // Run the Session routine. If a session doesn't exist we'll
     // create a new one.  If it does, we'll update it.
     if (!$this->sess_read()) {
         $this->sess_create();
     } else {
         $this->sess_update();
     }
     // Delete 'old' flashdata (from last request)
     $this->_flashdata_sweep();
     // Mark all new flashdata as old (data will be deleted before next request)
     $this->_flashdata_mark();
     // Delete expired sessions if necessary
     $this->_sess_gc();
 }
예제 #19
0
 /**
  * 在控制器/动作执行前,对路由进行改装,使其可以解析URL_WRITE的地址
  */
 public function setReWrite()
 {
     global $__controller, $__action;
     if (isset($_SERVER['HTTP_X_REWRITE_URL'])) {
         $_SERVER['REQUEST_URI'] = $_SERVER['HTTP_X_REWRITE_URL'];
     }
     $request = ltrim(strtolower(substr($_SERVER["REQUEST_URI"], strlen(dirname($GLOBALS['G_SP']['url']['url_path_base'])))), "\\/\\");
     if ('?' == substr($request, 0, 1) or 'index.php?' == substr($request, 0, 10)) {
         return;
     }
     if (empty($request) or 'index.php' == $request) {
         $__controller = $GLOBALS['G_SP']['default_controller'];
         $__action = $GLOBALS['G_SP']['default_action'];
         return;
     }
     $this->params['suffix'] = '' == $this->params['suffix'] ? '?' : $this->params['suffix'];
     $request = explode($this->params['suffix'], $request, 2);
     $uri = array('first' => array_shift($request), 'last' => ltrim(implode($request), '?'));
     $request = explode($this->params['sep'], $uri['first']);
     $uri['first'] = array('pattern' => array_shift($request), 'args' => $request);
     if (array_key_exists($uri['first']['pattern'], $this->params['map'])) {
         @(list($__controller, $__action) = explode('@', $this->params['map'][$uri['first']['pattern']]));
         if (!empty($this->params['args'][$uri['first']['pattern']])) {
             foreach ($this->params['args'][$uri['first']['pattern']] as $v) {
                 spClass("spArgs")->set($v, array_shift($uri['first']['args']));
             }
         }
     } elseif (isset($this->params['map']['@']) && !in_array($uri['first']['pattern'] . '.php', array_map('strtolower', scandir($GLOBALS['G_SP']['controller_path'])))) {
         @(list($__controller, $__action) = explode('@', $this->params['map']['@']));
         if (!empty($this->params['args']['@'])) {
             $uri['first']['args'] = array_merge(array($uri['first']['pattern']), $uri['first']['args']);
             foreach ($this->params['args']['@'] as $v) {
                 spClass("spArgs")->set($v, array_shift($uri['first']['args']));
             }
         }
     } else {
         $__controller = $uri['first']['pattern'];
         $__action = array_shift($uri['first']['args']);
     }
     if (!empty($uri['first']['args'])) {
         for ($u = 0; $u < count($uri['first']['args']); $u++) {
             spClass("spArgs")->set($uri['first']['args'][$u], isset($uri['first']['args'][$u + 1]) ? $uri['first']['args'][$u + 1] : "");
             $u += 1;
         }
     }
     if (!empty($uri['last'])) {
         $uri['last'] = explode('&', $uri['last']);
         foreach ($uri['last'] as $val) {
             @(list($k, $v) = explode('=', $val));
             if (!empty($k)) {
                 spClass("spArgs")->set($k, isset($v) ? $v : "");
             }
         }
     }
 }
예제 #20
0
 private function checkNewbieTask($user_id, $event)
 {
     if (in_array($event, array('first_post_share', 'first_add_follow', 'first_create_album', 'create_avatar', 'first_like_topic'))) {
         $condition['event_type'] = 'reward';
         $condition['event_code'] = $event;
         $condition['to_user_id'] = $user_id;
         if (spClass('ptx_event_log')->find_one($condition)) {
             return true;
         }
     }
     return false;
 }
예제 #21
0
 /**
  * 魔术函数,实现对控制器扩展类的自动加载
  */
 public function __call($name, $args)
 {
     if (in_array($name, $GLOBALS['G_SP']["auto_load_controller"])) {
         return spClass($name)->__input($args);
     } elseif (!method_exists($this, $name)) {
         spError("方法 {$name}未定义!<br />请检查是否控制器类(" . get_class($this) . ")与数据模型类重名?");
     }
 }
예제 #22
0
/**
 *	@brief 获取model对象
 */
function m($model)
{
    return spClass("{$model}Model");
}
예제 #23
0
파일: spModel.php 프로젝트: eon-hong/anypay
 /** 
  * 私有函数,进行关联查找数据操作
  * @param thelinker    关联的描述
  * @param run_result    主表执行查找后返回的结果
  */
 private function do_select($thelinker, $run_result)
 {
     if (empty($thelinker['mapkey'])) {
         $thelinker['mapkey'] = $this->model_obj->pk;
     }
     if ('manytomany' == $thelinker['type']) {
         $do_func = 'findAll';
         $midcondition = array($thelinker['mapkey'] => $run_result[$thelinker['mapkey']]);
         if (!($midresult = spClass($thelinker['midclass'])->findAll($midcondition, null, $thelinker['fkey']))) {
             return FALSE;
         }
         $tmpkeys = array();
         foreach ($midresult as $val) {
             $tmpkeys[] = "'" . $val[$thelinker['fkey']] . "'";
         }
         if (!empty($thelinker['condition'])) {
             if (is_array($thelinker['condition'])) {
                 $fcondition = "{$thelinker['fkey']} in (" . join(',', $tmpkeys) . ")";
                 foreach ($thelinker['condition'] as $tmpkey => $tmpvalue) {
                     $fcondition .= " AND {$tmpkey} = '{$tmpvalue}'";
                 }
             } else {
                 $fcondition = "{$thelinker['fkey']} in (" . join(',', $tmpkeys) . ") AND {$thelinker['condition']}";
             }
         } else {
             $fcondition = "{$thelinker['fkey']} in (" . join(',', $tmpkeys) . ")";
         }
     } else {
         $do_func = 'hasone' == $thelinker['type'] ? 'find' : 'findAll';
         if (!empty($thelinker['condition'])) {
             if (is_array($thelinker['condition'])) {
                 $fcondition = array($thelinker['fkey'] => $run_result[$thelinker['mapkey']]) + $thelinker['condition'];
             } else {
                 $fcondition = "{$thelinker['fkey']} = '{$run_result[$thelinker['mapkey']]}' AND {$thelinker['condition']}";
             }
         } else {
             $fcondition = array($thelinker['fkey'] => $run_result[$thelinker['mapkey']]);
         }
     }
     if (TRUE == $thelinker['countonly']) {
         $do_func = "findCount";
     }
     return spClass($thelinker['fclass'])->{$do_func}($fcondition, $thelinker['sort'], $thelinker['field'], $thelinker['limit']);
 }
예제 #24
0
 function json_encode($content)
 {
     return spClass("Services_JSON")->encode($content);
 }
예제 #25
0
 function modify_go()
 {
     $old_pwd = $this->spArgs('old_password');
     $pwd1 = $this->spArgs('password1');
     $pwd2 = $this->spArgs('password2');
     if ($pwd1 == $pwd2) {
         if (spClass('user')->modify_password($old_pwd, $pwd1)) {
             $_SESSION = array();
             session_destroy();
             $this->success('密码修改成功!请重新登陆');
         } else {
             $this->error('原密码输入错误!');
         }
     } else {
         $this->error('两次密码输入不一致!');
     }
 }
예제 #26
0
 /**
  * 无权限提示跳转
  */
 public function prompt()
 {
     $prompt = $this->prompt;
     if (is_array($prompt)) {
         return spClass($prompt[0])->{$prompt[1]}();
     } else {
         return call_user_func_array($prompt, array());
     }
 }
예제 #27
0
 function updatesave()
 {
     //更新o_order表
     $o_order = spClass("o_order");
     $row = $this->spArgs();
     $order_id = $row['id'];
     $orderTime = $row['orderTime'];
     $row["username"] = $_SESSION["username"];
     $conditions = array('id' => $row['id']);
     $o_order->update($conditions, $row);
     //		echo $o_order->dumpSql();
     //删除o_order_detail表中的有关$order_id记录
     $o_order_detail = spClass("o_order_detail");
     $o_order_detail->delete(array('orderId' => $order_id));
     //插入o_order_detail表
     $o_order_detail = spClass("o_order_detail");
     if (strlen(trim($row['detail'])) > 0) {
         $records = explode("@@@", $row['detail']);
         for ($i = 0; $i < sizeOf($records); $i++) {
             $single = $records[$i];
             $arr = explode("___", $single);
             $conditions = array("orderId" => $order_id, "productId" => $arr[0], "price" => $arr[1], "amount" => $arr[2]);
             $o_order_detail->create($conditions);
         }
     }
     $this->results = spUrl("o_order_action", "index");
     $this->display("ok.htm");
     // 显示模板
 }
예제 #28
0
 function _email()
 {
     $mail = spClass('spEmail');
     $mailsubject = "[旅游笔记本用户密码找回";
     //邮件主题
     $mailbody = "尊敬的用户,你的密码为:123456";
     //邮件内容
     $mailtype = "HTML";
     //邮件格式(HTML/TXT),TXT为文本邮件
     $mail->sendmail('*****@*****.**', $mailsubject, $mailbody, $mailtype);
     echo "success";
 }
예제 #29
0
파일: app.php 프로젝트: eon-hong/anypay
 /** @brief 注册 */
 function signon()
 {
     $username = $this->spArgs('user_name');
     $password = $this->spArgs('password');
     $realname = $this->spArgs('real_name');
     $email = $this->spArgs('email');
     $gender = $this->spArgs('gender');
     $mobile = $this->spArgs('mobile');
     $pid = $this->spArgs('pid');
     $store = $this->spArgs('store');
     if (!empty($username) && !empty($password) && !empty($realname) && !empty($mobile) && !empty($pid) && !empty($store)) {
         $result = spClass('UserModel')->create(array('store_id' => $store, 'user_name' => $username, 'password' => $password, 'real_name' => $realname, 'pid' => $pid, 'open_id' => md5("{$store} {$username}"), 'mobile' => $mobile));
         $this->user = m('User')->find(array('user_id' => $result));
         if ($result === false) {
             $this->ecode = spClass('UserModel')->getDBErrorCode();
             $this->message = spClass('UserModel')->getDBErrorMsg();
         } else {
             $this->ecode = $this->ERROR_OK;
         }
     } else {
         $this->ecode = $this->ERROR_FAILURE;
         $this->message = 'ERROR_INVALID_PARAMETERS';
     }
     $this->display('register.html');
 }
    public function genModelAction()
    {
        $actionType = $this->spArgs('genAction', 'preview');
        $this->tpl_modelName = $modelName = $this->spArgs('modelName');
        $modelTable = preg_replace('/' . $this->spArgs('modelTablePrefix') . '/', '', $this->spArgs('modelTable'), 1);
        //表名不含前缀
        $this->tpl_modelTable = $realTable = $this->spArgs('modelTable');
        //表名含前缀
        $this->tpl_modelTablePrefix = $this->spArgs('modelTablePrefix');
        $tableColInfo = spClass('spModel')->findSql('show columns from ' . $realTable . ';');
        $tablePk = $this->_findPK($tableColInfo);
        $genCode = <<<EOT
<?php
class M{$modelName} extends spModel{
\tpublic \$table = '{$modelTable}';
\tpublic \$pk = '{$tablePk}';
\t\t
\tpublic function getAttributes(){
\t\treturn array(
\t\t\t{$this->_getAttributes($tableColInfo)});
\t}
\t
\tpublic function getAttributeFormsets(){
\t\treturn array(
\t\t\t//'columnName'=>array('type'=>'dropDownList', 'options'=>array('false'=>'选项一','true'=>'选择二'), 'htmlOptions'=>array()),
\t\t\t//'columnName'=>array('type'=>'textField', 'htmlOptions'=>array('readonly'=>'true')),
\t\t\t//'columnName'=>array('type'=>'password', 'htmlOptions'=>array()),
\t\t\t//'columnName'=>array('type'=>'textArea', 'htmlOptions'=>array('rows'=>'6')),
\t\t\t//'columnName'=>array('type'=>'checkBox', 'checkBoxText'=>'钓鱼岛是中国的吗?', 'checkBoxValue'=>'yes', 'htmlOptions'=>array()),
\t\t\t//'columnName'=>array('type'=>'radio', 'options'=>array('A'=>'钓鱼岛是中国的','B'=>'苍老师是世界的')),
\t\t\t//'columnName'=>array('type'=>'file', 'htmlOptions'=>array()),
\t\t);
\t}
}
EOT;
        if ($actionType == 'preview') {
            $this->tpl_preview = true;
            $this->tpl_codePath = $GLOBALS['G_SP']['model_path'] . '/M' . $modelName . '.php';
            $this->tpl_codePreview = $genCode;
            $this->_checkOverwrite($this->tpl_codePath);
            $this->genModel();
        }
        if ($actionType == 'gen') {
            if (!preg_match('/[0-9a-zA-Z]/', $modelName)) {
                $this->tpl_success = -1;
            } else {
                $this->tpl_success = file_put_contents($GLOBALS['G_SP']['model_path'] . '/M' . $modelName . '.php', $genCode);
            }
            $this->tpl_gen = true;
            $this->tpl_codePath = $GLOBALS['G_SP']['model_path'] . '/M' . $modelName . '.php';
            $this->genModel();
        }
    }