当前位置: 首页>>代码示例>>PHP>>正文


PHP utils类代码示例

本文整理汇总了PHP中utils的典型用法代码示例。如果您正苦于以下问题:PHP utils类的具体用法?PHP utils怎么用?PHP utils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了utils类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: index

 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');
 }
开发者ID:yindonghai,项目名称:msk.com,代码行数:30,代码来源:wxqrlogin.php

示例2: addAction

 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;
 }
开发者ID:zhaozhiliang,项目名称:yaf_shop,代码行数:27,代码来源:User.php

示例3: login

 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'];
 }
开发者ID:sss201413,项目名称:ecstore,代码行数:26,代码来源:basic.php

示例4: post_login

 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, '登录成功');
 }
开发者ID:noikiy,项目名称:snk.com,代码行数:25,代码来源:passport.php

示例5: OnMenuCreation

 public static function OnMenuCreation()
 {
     if (UserRights::IsAdministrator()) {
         $oAdminMenu = new MenuGroup('AdminTools', 80);
         new WebPageMenuNode('ConfigEditor', utils::GetAbsoluteUrlModulesRoot() . 'itop-config/config.php', $oAdminMenu->GetIndex(), 18);
     }
 }
开发者ID:leandroborgeseng,项目名称:bhtm,代码行数:7,代码来源:main.itop-config.php

示例6: goods_goodsfilter

 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;
 }
开发者ID:syjzwjj,项目名称:quyeba,代码行数:33,代码来源:goodsfilter.php

示例7: pingUrl

 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);
 }
开发者ID:psyb0t,项目名称:websiteMaster.php,代码行数:30,代码来源:ping.php

示例8: index

 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);
 }
开发者ID:lzmyoyo,项目名称:ninxingfu,代码行数:28,代码来源:systemProductController.php

示例9: multi_dump_sdf

 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;
 }
开发者ID:453111208,项目名称:bbc,代码行数:27,代码来源:mysqldumper.php

示例10: init

 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;
 }
开发者ID:WebPassions,项目名称:2012-11-10,代码行数:35,代码来源:details.CRUD.php

示例11: post_login

 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, '登录成功');
 }
开发者ID:yindonghai,项目名称:msk.com,代码行数:33,代码来源:passport.php

示例12: run

    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]);
                    }
                }
            }
        }
    }
开发者ID:schwarer2006,项目名称:wikia,代码行数:60,代码来源:ApiQueryPatch.php

示例13: __construct

 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');
 }
开发者ID:dalinhuang,项目名称:shopexts,代码行数:7,代码来源:dba.php

示例14: seller_login

 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'];
 }
开发者ID:noikiy,项目名称:snk,代码行数:26,代码来源:basic.php

示例15: __construct

 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);
 }
开发者ID:leandroborgeseng,项目名称:bhtm,代码行数:27,代码来源:mutex.class.inc.php


注:本文中的utils类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。