Example #1
1
 public function index($enc_str)
 {
     $app_define = utils::decrypt($enc_str);
     $action_url = urldecode($action_url);
     $obj_wstage = vmc::singleton('wechat_stage');
     $access_token = $obj_wstage->get_access_token(false, $app_define);
     $app_id = $app_define['app_id'];
     vmc::singleton('base_session')->start();
     $session_str = utils::encrypt(array('session_id' => vmc::singleton('base_session')->sess_id() . '|' . time()));
     $session_str = app::get('mobile')->router()->encode_args($session_str);
     $redirect_uri = vmc::openapi_url('openapi.toauth', 'callback', array('wechat_toauth_pam' => 'callback')) . '?qrlp=' . $session_str;
     $forward = $_GET['forward'];
     $state = app::get('mobile')->router()->gen_url(array('app' => 'wechat', 'ctl' => 'mobile_wxqrlogin', 'act' => 'dologin'));
     $long_url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid={$app_id}&redirect_uri={$redirect_uri}&response_type=code&scope=snsapi_userinfo&state={$state}#wechat_redirect";
     if (!$access_token) {
         $this->splash('error', '', '二维码生成失败');
     }
     if ($surl = $obj_wstage->gen_surl($long_url, $access_token, $msg)) {
         $this->pagedata['surl'] = $surl;
     } else {
         $this->splash('error', '', '二维码生成失败:' . $msg);
     }
     // if($this->_reqeust->is_ajax()){
     //     $qrcode = vmc::singleton('wechat_qrcode')->create($surl);
     //     $qrcode_url = base_storager::inmage_path($qrcode['image_id']);
     //     $this->splash('success','',array('qrcode_url'=>$qrcode_url));
     // }
     $this->pagedata['forward'] = $forward;
     $this->page('site/loginqrcode.html');
 }
Example #2
0
 public function addAction()
 {
     if ($this->getRequest()->isPost()) {
         $posts = $this->getRequest()->getPost();
         $posts['password'] = sha1($posts['password']);
         $posts['repassword'] = sha1($posts['repassword']);
         foreach ($posts as $v) {
             if (empty($v)) {
                 exit("不能为空");
             }
         }
         if ($posts['password'] != $posts['repassword']) {
             exit("两次密码不一致");
         }
         unset($posts['repassword']);
         unset($posts['submit']);
         $posts['is_del'] = '';
         $_utils = new utils();
         $posts['user_uuid'] = $_utils->guid();
         if ($this->_user->insert($posts)) {
             exit("添加成功");
         } else {
             exit("添加失败");
         }
     }
     return false;
 }
Example #3
0
 public function login($userData, $vcode = false, &$msg)
 {
     $userData = utils::_filter_input($userData);
     //过滤xss攻击
     if ($vcode && !$this->vcode_verify($vcode)) {
         $msg = app::get('pam')->_('验证码错误');
         return false;
     }
     //如果指定了登录类型,则不再进行获取(邮箱登录,手机号登录,用户名登录)
     if (!$userData['login_type']) {
         $userPassport = kernel::single('b2c_user_passport');
         $userData['login_type'] = $userPassport->get_login_account_type($userData['login_account']);
     }
     $filter = array('login_type' => $userData['login_type'], 'login_account' => $userData['login_account']);
     $account = app::get('pam')->model('members')->getList('member_id,password_account,login_password,createtime', $filter);
     if (!$account) {
         $msg = app::get('pam')->_('用户名或密码错误');
         return false;
     }
     $login_password = pam_encrypt::get_encrypted_password($userData['login_password'], 'member', array('createtime' => $account[0]['createtime'], 'login_name' => $account[0]['password_account']));
     if ($account[0]['login_password'] != $login_password) {
         $msg = app::get('pam')->_('用户名或密码错误');
         return false;
     }
     return $account[0]['member_id'];
 }
Example #4
0
 public function post_login()
 {
     $login_url = $this->gen_url(array('app' => 'seller', 'ctl' => 'site_passport', 'act' => 'login'));
     //_POST过滤
     $params = utils::_filter_input($_POST);
     unset($_POST);
     $account_data = array('login_account' => $params['uname'], 'login_password' => $params['password']);
     if (empty($params['vcode'])) {
         $this->splash('error', $login_url, '请输入验证码');
     }
     //尝试登陆
     $seller_id = vmc::singleton('pam_passport_site_basic')->login($account_data, $params['vcode'], $msg, 'sellers');
     if (!$seller_id) {
         $this->splash('error', $login_url, $msg);
     }
     //设置session
     $this->user_obj->set_seller_session($seller_id);
     //设置客户端cookie
     $this->bind_seller($seller_id);
     $forward = $params['forward'];
     if (!$forward) {
         $forward = $this->gen_url(array('app' => 'seller', 'ctl' => 'site_seller', 'act' => 'index'));
     }
     $this->splash('success', $forward, '登录成功');
 }
 public static function OnMenuCreation()
 {
     if (UserRights::IsAdministrator()) {
         $oAdminMenu = new MenuGroup('AdminTools', 80);
         new WebPageMenuNode('ConfigEditor', utils::GetAbsoluteUrlModulesRoot() . 'itop-config/config.php', $oAdminMenu->GetIndex(), 18);
     }
 }
Example #6
0
 function goods_goodsfilter($type_id, $app)
 {
     $modTag = app::get('desktop')->model('tag');
     $brand = $app->model('brand');
     $object = $app->model('goods_cat');
     $obj_type = $app->model('goods_type');
     if (!$object->catMap) {
         $object->catMap = $object->getMapTree(0, '');
     }
     $return['cats'] = $object->catMap;
     $return['brands'] = $brand->getList('*', null, 0, -1);
     $row = $obj_type->dump($type_id, '*');
     if ($row['props']) {
         $row['props'] = $row['props'];
     }
     if ($row['type_id']) {
         $row['brand'] = $object->db->select('SELECT b.brand_id,b.brand_name,brand_url,brand_logo FROM sdb_b2c_type_brand t
                     LEFT JOIN sdb_b2c_brand b ON b.brand_id=t.brand_id
                     WHERE disabled="false" AND t.type_id=' . intval($row['type_id']) . ' ORDER BY brand_order');
     } else {
         $row['brand'] = $brand->getList('*', null, 0, -1);
     }
     if ($row) {
         $return['props'] = $row['props'];
         $row = $object->db->selectrow('SELECT max(price) as max,min(price) as min FROM sdb_b2c_goods where type_id=' . intval($type_id));
     } else {
         $row = $object->db->selectrow('SELECT max(price) as max,min(price) as min FROM sdb_b2c_products ');
     }
     $return['type_id'] = $type_id;
     $return['tags'] = $modTag->getList('*', array('tag_type' => 'goods'), 0, -1);
     $return['prices'] = utils::steprange($row['min'], $row['max'], 5);
     return $return;
 }
Example #7
0
 public function pingUrl()
 {
     if (!utils::keysOk($this->data, ['url', 'title'])) {
         return $this->response('ERROR', 'required keys not set');
     }
     $url = $this->data['url'];
     if (!utils::validUrl($url)) {
         return $this->response('ERROR', 'invalid url');
     }
     $title = $this->data['title'];
     main::loadLibs(['httpRequest/httpRequest.class.php']);
     $pingomaticUrl = 'http://pingomatic.com/ping/' . '?title=' . urlencode($title) . '&blogurl=' . urlencode($url) . '&rssurl=' . '&chk_weblogscom=on' . '&chk_blogs=on' . '&chk_feedburner=on' . '&chk_newsgator=on' . '&chk_myyahoo=on' . '&chk_pubsubcom=on' . '&chk_blogdigger=on' . '&chk_weblogalot=on' . '&chk_newsisfree=on' . '&chk_topicexchange=on' . '&chk_google=on' . '&chk_tailrank=on' . '&chk_skygrid=on' . '&chk_collecta=on' . '&chk_superfeedr=on' . '&chk_audioweblogs=on' . '&chk_rubhub=on' . '&chk_a2b=on' . '&chk_blogshares=on';
     $request = new httpRequest($pingomaticUrl);
     $request->setRandUserAgent();
     if (array_key_exists('proxy', $this->data)) {
         try {
             $request->setProxy($this->data['proxy']);
         } catch (Exception $e) {
             return $this->response('ERROR', $e->getMessage());
         }
     }
     $request = $request->exec();
     if (!$request['status'] == 'OK') {
         return $this->response('ERROR', $request['message']);
     }
     if (strrpos($request['data'], 'Pinging complete!') === false) {
         return $this->response('ERROR', 'pingomatic failed to ping ' . $url);
     }
     return $this->response('OK', 'successfully pinged ' . $url);
 }
 public function index()
 {
     $this->actionMenu = array(array('name' => '发布商品', 'url' => utils::getUrl('admin/system-product/add/' . base64_encode($this->url))));
     $this->menuTitle = '我的商品列表';
     $tableName = utils::getTableName($this->systemProductService->modelName);
     $systemProductList = $this->systemProductService->model->querySql($tableName);
     $hasSkuProductIdArr = $newProductList = array();
     if ($systemProductList) {
         foreach ($systemProductList['resultList'] as $product) {
             $newProductList[$product['id']] = $product;
             if ($product['is_has_sku']) {
                 $hasSkuProductIdArr[] = $product['id'];
             }
         }
     }
     $productSkuService = new productSkuService();
     $skuList = $productSkuService->getSkuListByProductIdArr($hasSkuProductIdArr);
     if ($skuList) {
         foreach ($skuList as $skuInfo) {
             $newProductList[$skuInfo['sysproduct_id']]['skuList'][] = $skuInfo;
         }
     }
     $showCategoryModel = new showCategoryModel();
     $showCategoryList = $showCategoryModel->getCacheFileCategory();
     $productAllStatus = $this->systemProductService->productStatus;
     $data = array('showCategoryList' => $showCategoryList, 'systemProductList' => $newProductList, 'productAllStatus' => $productAllStatus);
     $this->setView($data);
 }
Example #9
0
 public function multi_dump_sdf($appId, $bakdir)
 {
     $dirname = $bakdir . '/sdf';
     $dbschema_dirname = $bakdir . '/dbschema';
     is_dir($dirname) or mkdir($dirname, 0755, true);
     is_dir($dbschema_dirname) or mkdir($dbschema_dirname, 0755, true);
     $appIds = array_column(app::get('base')->database()->executeQuery('SELECT app_id FROM base_apps WHERE status=?', ['active'])->fetchAll(), 'app_id');
     if ($appId) {
         $appIds = array_slice($appIds, array_flip($appIds)[$appId]);
         $nextAppId = next($appIds);
     } else {
         $appId = current($appIds);
         $nextAppId = next($appIds);
     }
     if ($appId === false) {
         return false;
     }
     if (is_dir(APP_DIR . '/' . $appId . '/dbschema')) {
         foreach (with(new base_application_dbtable())->detect($appId) as $item) {
             //echo $item->key();
             $columnDefine = $item->load();
             $this->dump_data($dirname, $appId, $item->key());
         }
         utils::cp(APP_DIR . '/' . $appId . '/dbschema', $dbschema_dirname . '/' . $appId);
     }
     return $nextAppId;
 }
Example #10
0
 function init($module, $lang, $language, $idURL, $categorie, $sscategorie, $type, $sort, $order, $page, $settings, $search, $archive)
 {
     $getEntry = Db::select(TABLE_PREFIX . CATEGORIE_NOM, $idURL);
     $entry = Db::fetch_row($getEntry);
     $getColumn = Db::select(TABLE_PREFIX . CATEGORIE_NOM, "0");
     $output = "";
     $output = TemplateDetails::debutdetails($module, $lang, $categorie, $sscategorie, $idURL, $archive);
     for ($i = 0; $i < Db::num_fields($getColumn); $i++) {
         // Boucle sur les colonnes
         $column = Db::fetch_field($getColumn);
         $column = $column->name;
         $details = $entry[$i];
         $column = Utils::findColumn($column, $language);
         $field = utils::findField($column);
         // Trouve le type de donné et affiche le input adéquat
         if ($field == "id" && $settings['blanc']['showId'] == true || $field != "id") {
             if (@(!(include_once 'fields/' . $field . '.field.php'))) {
                 // Regarde si le champ est prédéfini. Si pas, on utilise le champ txt par défaut
                 $field = "txt";
             } else {
                 if (class_exists($field)) {
                     if ($field == "date") {
                         $details = Utils::datefr($details);
                     }
                     $details = stripslashes(htmlentities($details, ENT_QUOTES, "iso-8859-1"));
                     $getValue = new $field($lang, $details, $column, $idURL, $categorie, $sscategorie, $type, $sort, $page, $settings);
                     $details = $getValue->details;
                     $output .= TemplateDetails::details($details);
                 }
             }
         }
     }
     $output .= TemplateDetails::findetails($module, $lang);
     return $output;
 }
Example #11
0
 public function post_login()
 {
     $login_url = $this->gen_url(array('app' => 'b2c', 'ctl' => 'mobile_passport', 'act' => 'login'));
     //_POST过滤
     $params = utils::_filter_input($_POST);
     unset($_POST);
     $account_data = array('login_account' => $params['uname'], 'login_password' => $params['password']);
     if (empty($params['vcode'])) {
         $this->splash('error', $login_url, '请输入验证码');
     }
     //尝试登陆
     $member_id = vmc::singleton('pam_passport_site_basic')->login($account_data, $params['vcode'], $msg);
     if (!$member_id) {
         $this->splash('error', $login_url, $msg);
     }
     $mdl_members = $this->app->model('members');
     $member_data = $mdl_members->getRow('member_lv_id,experience', array('member_id' => $member_id));
     if (!$member_data) {
         $this->splash('error', $login_url, '会员数据异常!');
     }
     $member_data['order_num'] = $this->app->model('orders')->count(array('member_id' => $member_id));
     //更新会员数据
     $mdl_members->update($member_data, array('member_id' => $member_id));
     //设置session
     $this->user_obj->set_member_session($member_id);
     //设置客户端cookie
     $this->bind_member($member_id);
     $forward = $params['forward'];
     if (!$forward) {
         $forward = $this->gen_url(array('app' => 'b2c', 'ctl' => 'mobile_member', 'act' => 'index'));
     }
     $this->splash('success', $forward, '登录成功');
 }
Example #12
0
    private function run()
    {
        global $wgServerName, $wgScriptPath;
        $params = $this->extractRequestParams();
        wfDebugLog('p2p', 'ApiQueryPatch params ' . $params['patchId']);
        $array = array(1 => 'id', 2 => 'onPage', 3 => 'operation', 4 => 'previous', 5 => 'siteID', 6 => 'mime', 7 => 'size', 8 => 'url', 9 => 'DateAtt', 10 => 'siteUrl', 11 => 'causal');
        $array1 = array(1 => 'patchID', 2 => 'onPage', 3 => 'hasOperation', 4 => 'previous', 5 => 'siteID', 6 => 'mime', 7 => 'size', 8 => 'url', 9 => 'DateAtt', 10 => 'siteUrl', 11 => 'causal');
        $query = '';
        for ($j = 1; $j <= count($array1); $j++) {
            $query = $query . '?' . $array1[$j] . '
';
        }
        $res = utils::getSemanticQuery('[[patchID::' . $params['patchId'] . ']]', $query);
        $count = $res->getCount();
        for ($i = 0; $i < $count; $i++) {
            $row = $res->getNext();
            if ($row === false) {
                break;
            }
            for ($j = 1; $j <= count($array); $j++) {
                if ($j == 3) {
                    $col = $row[$j]->getContent();
                    // SMWResultArray object
                    foreach ($col as $object) {
                        // SMWDataValue object
                        $wikiValue = $object->getWikiValue();
                        $op[] = $wikiValue;
                    }
                    $results[$j] = $op;
                } else {
                    $col = $row[$j]->getContent();
                    // SMWResultArray object
                    foreach ($col as $object) {
                        // SMWDataValue object
                        $wikiValue = $object->getWikiValue();
                        $results[$j] = $wikiValue;
                    }
                }
            }
        }
        $result = $this->getResult();
        // $data = str_replace('"', '', $data);
        // $data = explode('!',$data);
        if ($results[1]) {
            for ($i = 1; $i <= count($array); $i++) {
                if ($results[$i] != null) {
                    if ($i == 2) {
                        $title = trim($results[$i], ":");
                        $result->addValue(array('query', $this->getModuleName()), $array[$i], $title);
                    } elseif ($i == 3) {
                        $op = $results[$i];
                        $result->setIndexedTagName($op, $array[$i]);
                        $result->addValue('query', $this->getModuleName(), $op);
                    } else {
                        $result->addValue(array('query', $this->getModuleName()), $array[$i], $results[$i]);
                    }
                }
            }
        }
    }
Example #13
0
 function __construct($prefix)
 {
     if (!is_dir(DATA_DIR . '/kvstore/')) {
         utils::mkdir_p(DATA_DIR . '/kvstore/');
     }
     $this->rs = dba_popen(DATA_DIR . '/kvstore/dba.db', 'c');
 }
Example #14
0
File: basic.php Project: noikiy/snk
 public function seller_login($userData, $vcode = false, &$msg)
 {
     $userData = utils::_filter_input($userData);
     //过滤xss攻击
     if (!$vcode || !base_vcode::verify('passport', $vcode)) {
         $msg = '验证码错误';
         return false;
     }
     //如果指定了登录类型,则不再进行获取(邮箱登录,手机号登录,用户名登录)
     if (!$userData['login_type']) {
         $userPassport = vmc::singleton('seller_user_passport');
         $userData['login_type'] = $userPassport->get_login_account_type($userData['login_name']);
     }
     $filter = array('login_type' => $userData['login_type'], 'login_name' => $userData['login_name']);
     $account = app::get('seller')->model('sellers')->getList('member_id, login_name, createtime', $filter);
     if (!$account) {
         $msg = '不存在的用户';
         return false;
     }
     $login_password = pam_encrypt::get_encrypted_password($userData['login_password'], 'member', array('createtime' => $account[0]['createtime'], 'login_name' => $account[0]['login_name']));
     if ($account[0]['login_password'] != $login_password) {
         $msg = '登录密码错误';
         return false;
     }
     return $account[0]['member_id'];
 }
Example #15
0
 public function __construct($sName, $sDBHost = null, $sDBUser = null, $sDBPwd = null)
 {
     // Compute the name of a lock for mysql
     // Note: names are server-wide!!! So let's make the name specific to this iTop instance
     $oConfig = utils::GetConfig();
     // Will return an empty config when called during the setup
     $sDBName = $oConfig->GetDBName();
     $sDBSubname = $oConfig->GetDBSubname();
     $this->sName = 'itop.' . $sName;
     if (substr($sName, -strlen($sDBName . $sDBSubname)) != $sDBName . $sDBSubname) {
         // If the name supplied already ends with the expected suffix
         // don't add it twice, since the setup may try to detect an already
         // running cron job by its mutex, without knowing if the config already exists or not
         $this->sName .= $sDBName . $sDBSubname;
     }
     $this->bLocked = false;
     // Not yet locked
     if (!array_key_exists($this->sName, self::$aAcquiredLocks)) {
         self::$aAcquiredLocks[$this->sName] = 0;
     }
     // It is a MUST to create a dedicated session each time a lock is required, because
     // using GET_LOCK anytime on the same session will RELEASE the current and unique session lock (known issue)
     $sDBHost = is_null($sDBHost) ? $oConfig->GetDBHost() : $sDBHost;
     $sDBUser = is_null($sDBUser) ? $oConfig->GetDBUser() : $sDBUser;
     $sDBPwd = is_null($sDBPwd) ? $oConfig->GetDBPwd() : $sDBPwd;
     $this->InitMySQLSession($sDBHost, $sDBUser, $sDBPwd);
 }
Example #16
0
 private function begin_transaction($method, $params, $rpc_id = null)
 {
     $obj_rpc_poll = app::get('base')->model('rpcpoll');
     if (is_null($rpc_id)) {
         $time = time();
         $microtime = utils::microtime();
         $rpc_id = str_replace('.', '', strval($microtime));
         //mt_srand($microtime);
         //$randval = mt_rand();
         $randval = uniqid('', true);
         $rpc_id .= strval($randval);
         $rpc_id = md5($rpc_id);
         //$rpc_id = rand(0,$microtime);
         $data = array('id' => $rpc_id, 'network' => $this->network_id, 'calltime' => $time, 'method' => $method, 'params' => $params, 'type' => 'request', 'callback' => $this->callback_class . ':' . $this->callback_method, 'callback_params' => $this->callback_params);
         $rpc_id = $rpc_id . '-' . $time;
         $obj_rpc_poll->insert($data);
     } else {
         $arr_pk = explode('-', $rpc_id);
         $rpc_id = $arr_pk[0];
         $rpc_calltime = $arr_pk[1];
         $tmp = $obj_rpc_poll->getList('*', array('id' => $rpc_id, 'calltime' => $rpc_calltime));
         if ($tmp) {
             $data = array('fail_times' => $tmp[0]['fail_times'] + 1);
             $fiter = array('id' => $rpc_id, 'calltime' => $rpc_calltime);
             $obj_rpc_poll->update($data, $fiter);
         }
         $rpc_id = $rpc_id . '-' . $rpc_calltime;
     }
     return $rpc_id;
 }
Example #17
0
 public function insert()
 {
     $address = request::postParam('mobileaddress');
     $homeInfo = request::postParam('home');
     $homeAddressId = implode(',', $address);
     $nowTime = time();
     //获取省市地区的名字,组合后保存到社区地址详情里。
     $addressList = addressService::getCacheFileAddress();
     $cityAddressStr = '';
     foreach ($address as $aid) {
         $cityAddressStr .= $addressList[$aid]['title'];
     }
     $homeData = array('title' => $homeInfo['title'], 'address_ids' => $homeAddressId, 'mobileaddress' => $cityAddressStr . $homeInfo['mobileaddress'], 'lng' => $homeInfo['lng'], 'lat' => $homeInfo['lat'], 'firstchar' => $homeInfo['firstchar'], 'image' => $homeInfo['image'], 'paddtime' => $nowTime);
     $homeModel = homeService::getSelfModel(homeService::$modelName);
     //判断是否添加了该社区。
     $hasHomeInfo = homeService::getHomeInfoByTitle($homeData['title']);
     if (!$hasHomeInfo) {
         $homeId = $homeModel->insert($homeData);
         //保存对应地址信息
         homeAddressService::getSelfModel(homeAddressService::$modelName);
         foreach ($address as $aid) {
             $addressData = array('address_id' => $aid, 'home_id' => $homeId);
             homeAddressService::$model->insert($addressData);
         }
     } else {
         utils::pexit('已有该社区');
     }
 }
Example #18
0
 /**
  *批量确认收藏及数量
  */
 public function check_favs($member_id = null, $goods_id = null)
 {
     if (!$goods_id || !is_array($goods_id)) {
         return false;
     }
     $filter['goods_id'] = $goods_id;
     $filter['type'] = 'fav';
     $fav_list = $this->getList('member_id,goods_id', $filter);
     $fav_list_group = utils::array_change_key($fav_list, 'goods_id', true);
     foreach ($fav_list_group as $gid => $fav_group) {
         $tmp_fav_group = utils::array_change_key($fav_group, 'member_id');
         $tmp_fav_group = array_keys($tmp_fav_group);
         $fav_count = count($tmp_fav_group);
         if (in_array($member_id, $tmp_fav_group)) {
             $is_fav = true;
         } else {
             $is_fav = false;
         }
         unset($fav_list_group[$gid]);
         $fav_list_group[$gid]['goods_id'] = $gid;
         $fav_list_group[$gid]['is_fav'] = $is_fav;
         $fav_list_group[$gid]['fav_count'] = $fav_count;
     }
     return array_values($fav_list_group);
 }
Example #19
0
 public function request_log($method, $params, $rpc_id)
 {
     $class = isset(self::$_res_service[$method]) ? self::$_res_service[$method] : '';
     $api_mdl = app::get('apiactionlog')->model('apilog');
     if ($class) {
         $obj = kernel::single($class);
         $title = $obj->get_title();
         $time = time();
         $original_bn = $params['tid'];
         if (is_null($rpc_id)) {
             $microtime = utils::microtime();
             $rpc_id = str_replace('.', '', strval($microtime));
             $randval = uniqid('', true);
             $rpc_id .= strval($randval);
             $rpc_id = md5($rpc_id);
             $data = array('apilog' => $rpc_id, 'calltime' => $time, 'params' => $params, 'api_type' => 'request', 'msg_id' => '', 'worker' => $method, 'original_bn' => $original_bn, 'task_name' => $title, 'log_type' => 'order', 'createtime' => $time, 'last_modified' => $time, 'retry' => $retry ? $retry : 0);
         } else {
             $arr_pk = explode('-', $rpc_id);
             $rpc_id = $arr_pk[0];
             $tmp = $api_mdl->getList('*', array('apilog' => $rpc_id));
             if ($tmp && $tmp[0]['status'] != 'sending') {
                 $retry = $tmp[0]['retry'] + 1;
             }
             $data = array('apilog_id' => $tmp[0]['apilog_id'], 'apilog' => $rpc_id, 'calltime' => $time, 'api_type' => 'request', 'worker' => $method, 'original_bn' => $original_bn, 'task_name' => $title, 'log_type' => 'order', 'createtime' => $time, 'last_modified' => $time);
         }
         $result = $api_mdl->save($data);
         $rpc_id = $rpc_id . "-" . $time;
         return $rpc_id;
     }
 }
Example #20
0
 function gen_id()
 {
     $sign = '9' . date("Ymd");
     /*$sqlString = 'SELECT MAX(reship_id) AS maxno FROM sdb_b2c_reship WHERE reship_id LIKE \''.$sign.'%\'';
             $aRet = $this->db->selectrow($sqlString);
             if(is_null($aRet['maxno'])) $aRet['maxno'] = 0;
             $maxno = substr($aRet['maxno'], -6) + 1;
             if ($maxno==1000000){
                 $maxno = 1;
             }
             return $sign.substr("00000".$maxno, -6);
     		$microtime = utils::microtime();
     		mt_srand($microtime);
     		$randval = mt_rand();*/
     while (true) {
         $microtime = utils::microtime();
         mt_srand($microtime);
         $randval = substr(mt_rand(), 0, -3) . rand(100, 999);
         $aRet = $this->db->selectrow("SELECT COUNT(*) as c FROM sdb_b2c_reship WHERE reship_id='" . ($sign . $randval) . "'");
         if (!$aRet['c']) {
             break;
         }
     }
     return $sign . $randval;
 }
Example #21
0
function api_remove_table($activeUser, $con, $character_get)
{
    if (isset($_GET['rm'])) {
        $remove = mysqli_real_escape_string($con, $_GET['rm']);
        $remove_name = utils::mysqli_result(mysqli_query($con, "SELECT name FROM characters WHERE eve_idcharacter = '{$remove}'"), 0, 0);
        //character is only dissossiated with the account, not removed from the database
        $remove_character_account = mysqli_query($con, "DELETE FROM aggr WHERE user_iduser = (SELECT iduser FROM user WHERE username = '******') AND character_eve_idcharacter = '{$remove}'") or die(mysqli_error($con));
        //$remove_character = mysqli_query($con, "DELETE FROM characters WHERE eve_idcharacter = '$remove'") or die(mysqli_error($con));
        echo "Character " . $remove_name . " removed successfully.";
        return;
    } else {
        $charsKeys = mysqli_query($con, "SELECT character_eve_idcharacter, name, username, apikey FROM v_user_characters WHERE username = '******'") or die(mysqli_error($con));
        ?>
   <table class='table table-striped table-bordered table-hover' id='dataTables-api'>
       <tr><th align="center">Character</th>
           <th align="center">API Key</th>
           <th></th>
<?php 
        while ($chars = mysqli_fetch_array($charsKeys)) {
            $name = $chars['name'];
            $api = $chars['apikey'];
            $charid = $chars['character_eve_idcharacter'];
            $imgpath = "https://image.eveonline.com/Character/" . $charid . "_32.jpg";
            echo "<tr><td>" . "<img src=" . $imgpath . ">" . "  " . $name . "</td><td >" . $api . "</td><td align='center'>" . "<a href= 'api_remove.php?character={$character_get}&rm={$charid}'<button type='button' class='btn btn-danger'>Remove</button>" . "</td></tr>";
        }
        ?>
   </table>
<?php 
    }
}
function val_email_form($character_get, $con, $username)
{
    if (isset($_POST['Send'])) {
        $new_email = mysqli_real_escape_string($con, $_POST['email']);
        $password = mysqli_real_escape_string($con, $_POST['password']);
        //check if password is correct, check if email is valid
        $get_password = utils::mysqli_result(mysqli_query($con, "SELECT password FROM user WHERE username = '******'"), 0, 0);
        $get_salt = utils::mysqli_result(mysqli_query($con, "SELECT salt FROM user WHERE username = '******'"), 0, 0);
        //hash provided pw with salt
        $newpassword_hash = crypt($password, $get_salt);
        if ($newpassword_hash == $get_password) {
            //passwords match, check if email is valid (again)
            if (!filter_var($new_email, FILTER_VALIDATE_EMAIL)) {
                echo "Invalid email format";
                return;
            } else {
                //email is valid, password is valid, proceed to change
                $update_email = mysqli_query($con, "UPDATE user SET email = '{$new_email}' WHERE username ='******' ");
                if ($update_email) {
                    echo "Email changed sucessfully";
                } else {
                    echo "There was an error processing your request. Try again later.";
                }
            }
        } else {
            echo "Wrong password";
            return;
        }
        //validation goes here
    } else {
        drawForm($character_get, $username);
    }
}
 public function stackData($params)
 {
     if (is_object($params)) {
         $paramsArray = utils::o2a($params);
     }
     nodejs::pushUpdate('influxdb::stackDataEqLogic', $paramsArray);
 }
Example #24
0
 /**
  * 初始化商品促销过滤.
  *
  * @param array $aGoodsId // array(xxx,xxx,xxx);
  */
 private function _init_config($goods_id_arr, $filter = array())
 {
     if (empty($goods_id_arr)) {
         return false;
     }
     $filter['goods_id'] = $goods_id_arr;
     $current_member = vmc::singleton('b2c_cart_stage')->get_member();
     if (!$filter['member_lv']) {
         $filter['member_lv'] = $current_member['member_lv'] ? $current_member['member_lv'] : -1;
     }
     //开启的促销
     $where[] = "pref.status = 'true'";
     //一定商品范围的促销
     $where[] = 'pref.goods_id IN (' . implode(',', $filter['goods_id']) . ')';
     //一定会员级别的促销
     $where[] = ' (find_in_set(\'' . $filter['member_lv'] . '\', pref.member_lv_ids))';
     //促销时间限制
     if (!empty($filter['current_time'])) {
         $where[] = sprintf('(%s >= pref.from_time or pref.from_time=0)', $filter['current_time']);
         $where[] = sprintf('(%s <= pref.to_time or pref.to_time=0)', $filter['current_time']);
     }
     $SQL = 'SELECT pref.*,srg.name,srg.s_template
                 FROM vmc_b2c_sales_rule_goods AS srg
                 JOIN vmc_b2c_goods_promotion_ref AS pref  ON pref.rule_id = srg.rule_id
                 WHERE ' . implode(' AND ', $where) . '
                 ORDER BY pref.sort_order ASC,pref.ref_id DESC';
     $res = vmc::database()->select($SQL);
     if (empty($res)) {
         return false;
     }
     return utils::array_change_key($res, 'goods_id', true);
 }
Example #25
0
 public function insertProduct($data, $productImg = array(), $productDescImg = array())
 {
     $oldData = $this->model->select(array('where' => 'tid = ?', 'param' => array($data['tid']), 'isRow' => true));
     if ($oldData) {
         return 'hasOld';
     }
     $nowTime = time();
     $productData = array('tid' => $data['tid'], 'title' => $data['title'], 'price' => $data['price'], 'prop_price' => isset($data['prop_price']) ? $data['prop_price'] : 0, 'add_time' => $nowTime, 'url' => $data['url'], 'extra_price' => isset($data['extra_price']) ? $data['extra_price'] : 0, 'image' => '');
     if (isset($productImg[0])) {
         $productData['image'] = $productImg[0];
     }
     $id = $this->model->insert($productData);
     if ($productImg) {
         $productImgService = utils::getService('productImg');
         foreach ($productImg as $img) {
             if ($img) {
                 $imgData = array('product_id' => $id, 'image' => $img, 'add_time' => $nowTime);
                 $productImgService->model->insert($imgData);
                 unset($imgData);
             }
         }
     }
     if ($productDescImg) {
         $productDescImgService = utils::getService('productDescImg');
         foreach ($productDescImg as $img) {
             if ($img) {
                 $imgDescData = array('product_id' => $id, 'image' => $img, 'add_time' => $nowTime);
                 $productDescImgService->model->insert($imgDescData);
                 unset($imgDescData);
             }
         }
     }
     return $id;
 }
Example #26
0
 public function login($userData, $vcode = false, &$msg, $type = 'b2c')
 {
     $userData = utils::_filter_input($userData);
     //过滤xss攻击
     //快速登录不用验证码
     if ($vcode != 'quick') {
         if (!$vcode || !base_vcode::verify('passport', $vcode)) {
             $msg = '验证码错误';
             return false;
         }
     }
     //如果指定了登录类型,则不再进行获取(邮箱登录,手机号登录,用户名登录)
     if (!$userData['login_type']) {
         $userPassport = vmc::singleton('b2c_user_passport');
         $userData['login_type'] = $userPassport->get_login_account_type($userData['login_account']);
     }
     $filter = array('login_type' => $userData['login_type'], 'login_account' => $userData['login_account']);
     $model = 'members';
     $id = 'member_id';
     if ($type == 'sellers') {
         $model = 'sellers';
         $id = 'seller_id';
     }
     $account = app::get('pam')->model($model)->getList($id . ',password_account,login_password,createtime', $filter);
     if (!$account) {
         $msg = '不存在的用户';
         return false;
     }
     $login_password = pam_encrypt::get_encrypted_password($userData['login_password'], 'member', array('createtime' => $account[0]['createtime'], 'login_name' => $account[0]['password_account']));
     if ($account[0]['login_password'] != $login_password) {
         $msg = '登录密码错误';
         return false;
     }
     return $account[0][$id];
 }
Example #27
0
 public function getAll($ID_post, $status = null)
 {
     $C = new comment();
     $rows = array();
     if (is_null($status) === true) {
         $rows = $C->findAll('comments.*, md5(comments.email) as md5_email', 'created ASC', null, "WHERE ID_post={$ID_post}");
     } else {
         if (is_array($status)) {
             $status_sql = "";
             foreach ($status as $st) {
                 $status_sql .= "status = '{$st}' OR ";
             }
             $status_sql = substr($status_sql, 0, -4);
             $rows = $C->findAll('comments.*, md5(comments.email) as md5_email', 'created ASC', null, "WHERE ID_post={$ID_post} AND ({$status_sql})");
         } else {
             $rows = $C->findAll('comments.*, md5(comments.email) as md5_email', 'created ASC', null, "WHERE ID_post={$ID_post} AND status='{$status}'");
         }
     }
     foreach ($rows as $key => $comment) {
         $comment['content'] = utils::htmlentities($comment['content']);
         $comment['content'] = utils::nl2br($comment['content']);
         $rows[$key] = $comment;
     }
     return $rows;
 }
Example #28
0
File: chdb.php Project: noikiy/snk
 private function _get_prev_pathname()
 {
     if (!is_dir(TMP_DIR)) {
         utils::mkdir_p(TMP_DIR);
     }
     return TMP_DIR . '/' . $this->get_prev_key() . '.chdb';
 }
Example #29
0
 public function column_tag(&$colList, $list)
 {
     //todo  如果list为空则 retunn
     if (!$list) {
         return;
     }
     $idColumnKey = $list[0]['idColumn'];
     $appId = $list[0]['app_id'];
     $tagType = $list[0]['tag_type'];
     $list = utils::array_change_key($list, $idColumnKey);
     // 获取所有当前finder主键列表
     $relatedIds = array_keys(utils::array_change_key($list, $idColumnKey));
     $filter = array('rel_id' => $relatedIds, 'tag_type' => $tagType, 'app_id' => $appId);
     // 获取tag列表
     $tagRows = app::get('desktop')->model('tag_rel')->getList('tag_id, rel_id', $filter);
     /*-----start------>*/
     $tagIds = array_keys(utils::array_change_key($tagRows, 'tag_id'));
     if ($tagIds) {
         $tagList = app::get('desktop')->model('tag')->getList('*', array('tag_id' => $tagIds));
         $tagList = utils::array_change_key($tagList, 'tag_id');
     }
     /*<----end-------->*/
     foreach ($tagRows as $row) {
         $relatedRows[$row['rel_id']][] = $tagList[$row['tag_id']];
     }
     $i = 0;
     foreach ($relatedIds as $id) {
         $colList[$i] = $this->getColumnTagHtml($relatedRows[$id]);
         $i++;
     }
 }
Example #30
0
 function __construct()
 {
     $this->dir = ROOT_DIR . '/data/search/zend/lucene/';
     if (!is_dir($this->dir)) {
         utils::mkdir_p($this->dir, 0777, true);
     }
 }