• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP JO_Request类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: installWithoutDemo

 public static function installWithoutDemo(JO_Db_Adapter_Abstract $db)
 {
     mysql_connect($db->getConfig('host'), $db->getConfig('username'), $db->getConfig('password'));
     mysql_select_db($db->getConfig('dbname'));
     mysql_set_charset('utf8');
     $structure = APPLICATION_PATH . '/modules/install/structure.sql';
     if (!file_exists($structure)) {
         return false;
     }
     $queryes = self::getQueryes(file($structure));
     $results = array();
     foreach ($queryes as $query) {
         if (trim($query)) {
             try {
                 /*$results[] = */
                 (bool) mysql_query($query);
             } catch (JO_Exception $e) {
                 /*$results[] = false;*/
             }
         }
     }
     $request = JO_Request::getInstance();
     $results[] = $db->insert('users', array('user_id' => 1, 'username' => $request->getPost('username'), 'password' => md5(md5($request->getPost('password'))), 'register_datetime' => new JO_Db_Expr('NOW()'), 'status' => 'activate', 'groups' => 'a:1:{i:2;s:2:"on";}'));
     /*$results[] = */
     $db->update('system', array('value' => $request->getPost('admin_mail')), array('`key` = ?' => 'admin_mail'));
     /*$results[] = */
     $db->update('system', array('value' => $request->getPost('report_mail')), array('`key` = ?' => 'report_mail'));
     if (!in_array(false, $results)) {
         $db_set = "\r\r\n\tdb.adapter = \"MYSQLi\"\r\r\n\tdb.params.host = \"" . $db->getConfig('host') . "\"\r\r\n\tdb.params.username = \"" . $db->getConfig('username') . "\"\r\r\n\tdb.params.password = \"" . $db->getConfig('password') . "\"\r\r\n\tdb.params.dbname = \"" . $db->getConfig('dbname') . "\"\r\r\n\tdb.params.charset =\"utf8\"";
         $results[] = (bool) @file_put_contents(APPLICATION_PATH . '/config/config_db.ini', $db_set);
     }
     return !in_array(false, $results);
 }
开发者ID:noikiy,项目名称:PD,代码行数:33,代码来源:Install.php


示例2: logoutAction

 public function logoutAction()
 {
     $this->setInvokeArg('noViewRenderer', true);
     @setcookie('csrftoken_', md5(JO_Session::get('user[user_id]') . $this->getRequest()->getDomain() . JO_Session::get('user[date_added]')), time() - 100, '/', '.' . $this->getRequest()->getDomain());
     JO_Session::set(array('user' => false));
     $this->redirect(JO_Request::getInstance()->getBaseUrl());
 }
开发者ID:NareshChennuri,项目名称:pyng,代码行数:7,代码来源:LoginController.php


示例3: editeSmile

 public static function editeSmile($id, $data)
 {
     $db = JO_Db::getDefaultAdapter();
     $info = self::getSmile($id);
     if (!$info) {
         return;
     }
     $update = array('name' => $data['name'], 'visible' => $data['visible'], 'code' => $data['code']);
     if (isset($data['deletePhoto'])) {
         $update['photo'] = '';
         if ($info && $info['photo']) {
             @unlink(BASE_PATH . '/uploads/' . $info['photo']);
         }
     }
     $image = JO_Request::getInstance()->getFile('photo');
     if (!file_exists(BASE_PATH . '/uploads/smiles/')) {
         mkdir(BASE_PATH . '/uploads/smiles/', 0777, true);
     }
     $upload_folder = realpath(BASE_PATH . '/uploads/smiles/');
     $upload_folder .= '/';
     $upload = new JO_Upload();
     $upload->setFile($image)->setExtension(array('.jpg', '.jpeg', '.png', '.gif'))->setUploadDir($upload_folder);
     $new_name = md5(time() . serialize($image));
     if ($upload->upload($new_name)) {
         $info1 = $upload->getFileInfo();
         if ($info1) {
             $update['photo'] = '/smiles/' . $info1['name'];
             if ($info && $info['photo']) {
                 @unlink(BASE_PATH . '/uploads/' . $info['photo']);
             }
         }
     }
     $db->update('smiles', $update, array('id = ?' => (int) $id));
     return $id;
 }
开发者ID:noikiy,项目名称:PD,代码行数:35,代码来源:Smiles.php


示例4: getRequest

 /**
  * @return JO_Request
  */
 public function getRequest()
 {
     if ($this->request == null) {
         $this->setRequest(JO_Request::getInstance());
     }
     return $this->request;
 }
开发者ID:noikiy,项目名称:amatteur,代码行数:10,代码来源:Response.php


示例5: initSession

 public static function initSession($user_id)
 {
     $db = JO_Db::getDefaultAdapter();
     $query = $db->select()->from(self::getPrefixDB() . 'users')->where('user_id = ?', (int) $user_id)->limit(1, 0);
     $user_data = $db->fetchRow($query);
     if ($user_data && $user_data['status'] == 'activate') {
         $groups = unserialize($user_data['groups']);
         if (is_array($groups) && count($groups) > 0) {
             $query_group = $db->select()->from(self::getPrefixDB() . 'user_groups')->where("ug_id IN (?)", new JO_Db_Expr(implode(',', array_keys($groups))));
             $fetch_all = $db->fetchAll($query_group);
             $user_data['access'] = array();
             if ($fetch_all) {
                 foreach ($fetch_all as $row) {
                     $modules = unserialize($row['rights']);
                     if (is_array($modules)) {
                         foreach ($modules as $module => $ison) {
                             $user_data['access'][$module] = $module;
                         }
                     }
                 }
             }
         }
         if (isset($user_data['access']) && count($user_data['access'])) {
             $user_data['is_admin'] = true;
         }
         $db->update(self::getPrefixDB() . 'users', array('last_login_datetime' => new JO_Db_Expr('NOW()'), 'ip_address' => JO_Request::getInstance()->getClientIp()), array('user_id = ?' => (int) $user_id));
         JO_Session::set($user_data);
     }
     return $user_data;
 }
开发者ID:noikiy,项目名称:PD,代码行数:30,代码来源:Users.php


示例6: __construct

 public function __construct($options = array())
 {
     $PHPSESSID = JO_Request::getInstance()->getRequest('PHPSESSID');
     if (strlen($PHPSESSID) >= 8) {
         $this->sid($PHPSESSID);
     }
     //		$adapter = false;
     //		if(isset($options['adapter'])) {
     //			$adapter = $options['adapter'];
     //			unset($options['adapter']);
     //		}
     foreach ($options as $name => $value) {
         $method = 'set' . $name;
         if (method_exists($this, $method)) {
             $this->{$method}($value);
         }
     }
     //		if($adapter) {
     //			$this->setAdapter($adapter);
     //		}
     session_start();
     self::$data =& $_SESSION;
     if (!isset(self::$data[self::$namespace]) || !is_array(self::$data[self::$namespace])) {
         self::$data[self::$namespace] = array();
     }
 }
开发者ID:NareshChennuri,项目名称:pyng,代码行数:26,代码来源:Session.php


示例7: getInstance

 /**
  * @param array $options
  * @return JO_Request
  */
 public static function getInstance($options = array())
 {
     if (self::$_instance == null) {
         self::$_instance = new self($options);
     }
     return self::$_instance;
 }
开发者ID:noikiy,项目名称:amatteur,代码行数:11,代码来源:Request.php


示例8: editeSocials

 public static function editeSocials($id, $data)
 {
     $db = JO_Db::getDefaultAdapter();
     $upload_folder = realpath(BASE_PATH . '/uploads/socials/') . '/';
     $info = self::getSocial($data['id']);
     $updates = array('name' => $data['name'], 'link' => $data['link'], 'visible' => $data['visible']);
     $image = JO_Request::getInstance()->getFile('photo');
     if (!empty($image['tmp_name'])) {
         if ($info && file_exists($upload_folder . $info['photo'])) {
             @unlink($upload_folder . $info['photo']);
         }
         $upload = new JO_Upload();
         $upload->setFile($image)->setExtension(array('.jpg', '.jpeg', '.png', '.gif'))->setUploadDir($upload_folder);
         $new_name = md5(time() . serialize($image));
         if ($upload->upload($new_name)) {
             $info = $upload->getFileInfo();
             if ($info) {
                 $updates['photo'] = $info['name'];
             }
         }
     } elseif ($data['deletePhoto']) {
         if (file_exists($upload_folder . $info['photo'])) {
             @unlink($upload_folder . $info['photo']);
         }
         $updates['photo'] = '';
     }
     $db->update('socials', $updates);
 }
开发者ID:noikiy,项目名称:PD,代码行数:28,代码来源:Socials.php


示例9: sendContact

    public static function sendContact($id, $data = array())
    {
        $info = self::getContact($id);
        if (!$info) {
            return false;
        }
        $db = JO_Db::getDefaultAdapter();
        $db->update('contacts', array('answer' => $data['answer'], 'answer_datetime' => new JO_Db_Expr('NOW()')), array('id = ?' => (int) $id));
        $request = JO_Request::getInstance();
        $domain = $request->getDomain();
        $translate = JO_Translate::getInstance();
        $mail = new JO_Mail();
        if (JO_Registry::get('mail_smtp')) {
            $mail->setSMTPParams(JO_Registry::forceGet('mail_smtp_host'), JO_Registry::forceGet('mail_smtp_port'), JO_Registry::forceGet('mail_smtp_user'), JO_Registry::forceGet('mail_smtp_password'));
        }
        $mail->setFrom('no-reply@' . $domain);
        $mail->setSubject("[" . $domain . "] " . $translate->translate('Contact form'));
        $html = nl2br($data['answer'] . '
				
		' . $info['name'] . ' ' . $translate->translate('wrote') . ' =======================================
		' . $info['short_text']);
        $mail->setHTML($html);
        $result = (int) $mail->send(array($info['email']), JO_Registry::get('mail_smtp') ? 'smtp' : 'mail');
        return $result;
    }
开发者ID:noikiy,项目名称:PD,代码行数:25,代码来源:Contacts.php


示例10: fixExternallinks

 public function fixExternallinks($text)
 {
     static $request = null, $external_urls = null;
     if ($request === null) {
         $request = JO_Request::getInstance();
     }
     if ($external_urls === null) {
         $external_urls = JO_Registry::get('config_fix_external_urls');
     }
     if (!$external_urls) {
         return $text;
     }
     $dom = new JO_Html_Dom();
     $dom->load($text);
     $tags = $dom->find('a[href!^=' . $request->getDomain() . ']');
     foreach ($tags as $tag) {
         if (stripos(trim($tag->href), 'http') === 0) {
             $tag->rel = 'nofollow';
             if ($tag->target) {
                 unset($tag->target);
             }
             $tag->onclick = ($tag->onclick ? $tag->onclick . ';' : '') . "target='_blank';";
         }
     }
     return (string) $dom;
 }
开发者ID:NareshChennuri,项目名称:pyng,代码行数:26,代码来源:Externallinks.php


示例11: updateViewed

 public static function updateViewed($board_id)
 {
     $db = JO_Db::getDefaultAdapter();
     if (!self::isViewedBoard($board_id)) {
         $db->update('boards', array('views' => new JO_Db_Expr('views+1')), array('board_id = ?' => (string) $board_id));
         $db->insert('boards_views', array('user_id' => (string) JO_Session::get('user[user_id]'), 'date_added' => new JO_Db_Expr('NOW()'), 'board_id' => (string) $board_id, 'user_ip' => JO_Request_Server::encode_ip(JO_Request::getInstance()->getClientIp())));
     }
     $db->update('boards', array('total_views' => new JO_Db_Expr('total_views+1')), array('board_id = ?' => (string) $board_id));
 }
开发者ID:noikiy,项目名称:amatteur,代码行数:9,代码来源:Boards.php


示例12: __construct

 public function __construct($key = null, $secret = null, $redirect_uri = null)
 {
     $this->key = $key ? $key : Helper_Config::get('instagram_oauth_key');
     $this->secret = $secret ? $secret : Helper_Config::get('instagram_oauth_secret');
     if (!$redirect_uri) {
         $redirect_uri = WM_Router::create(JO_Request::getInstance()->getBaseUrl() . '?controller=modules_instagram_login');
     }
     parent::__construct(array('client_id' => $this->key, 'client_secret' => $this->secret, 'grant_type' => 'authorization_code', 'redirect_uri' => $redirect_uri));
 }
开发者ID:NareshChennuri,项目名称:pyng,代码行数:9,代码来源:Instagram.php


示例13: _initTranslate

 public function _initTranslate()
 {
     $request = JO_Request::getInstance();
     if ($request->getModule() == 'install') {
         return '';
     }
     $translate = new WM_Gettranslate();
     JO_Registry::set('JO_Translate', WM_Translate::getInstance(array('data' => $translate->getTranslate())));
 }
开发者ID:NareshChennuri,项目名称:pyng,代码行数:9,代码来源:Bootstrap.php


示例14: getRandom

 public static function getRandom()
 {
     $db = JO_Db::getDefaultAdapter();
     $query = $db->select()->from('topbanner')->where("(`from` <= CURDATE() OR `from` = '0000-00-00') and (`to` >=  CURDATE() OR `to` = '0000-00-00')")->limit(1);
     $clbanner = JO_Request::getInstance()->getCookie('clbanner');
     if ($clbanner == true) {
         $query->where("close = 'false'");
     }
     return $db->fetchRow($query);
 }
开发者ID:noikiy,项目名称:PD,代码行数:10,代码来源:Topbanner.php


示例15: translate

 public function translate($value)
 {
     $value = trim($value);
     $db = JO_Db::getDefaultAdapter();
     $check_query = $db->select()->from('language_keywords', 'COUNT(language_keywords_id)')->where('`key` = ?', new JO_Db_Expr("MD5(" . $db->quote($value) . ")"))->where('module = ?', JO_Request::getInstance()->getModule());
     $check = $db->fetchOne($check_query);
     if ($check < 1) {
         $db->insert('language_keywords', array('keyword' => $value, 'key' => new JO_Db_Expr("MD5(" . $db->quote($value) . ")"), 'module' => JO_Request::getInstance()->getModule()));
     }
     return parent::translate($value, $value);
 }
开发者ID:noikiy,项目名称:amatteur,代码行数:11,代码来源:Translate.php


示例16: getTranslateJs

 public static function getTranslateJs()
 {
     self::initDB();
     $db = JO_Db::getDefaultAdapter();
     $query = $db->select()->from('language_keywords', array('keyword'))->joinLeft('language_translate', 'language_keywords.language_keywords_id = language_translate.language_keywords_id AND language_translate.language_id = ' . (int) JO_Registry::get('config_language_id'), array('translate' => new JO_Db_Expr('IF(language_translate.keyword != \'\',language_translate.keyword,language_keywords.keyword)')))->where('language_keywords.module = ?', JO_Request::getInstance()->getModule());
     $result = $db->fetchPairs($query);
     foreach ($result as $k => $v) {
         $result[$k] = html_entity_decode($v, ENT_QUOTES, 'utf-8');
     }
     return $result;
 }
开发者ID:noikiy,项目名称:PD,代码行数:11,代码来源:Gettranslate.php


示例17: __construct

 public function __construct($options = array())
 {
     parent::__construct($options);
     $cache_host = str_replace('www.', '', JO_Request::getInstance()->getServer('HTTP_HOST'));
     $request_path = trim(JO_Request::getInstance()->getFullUri(), ' /');
     $request_path = str_replace(array('?', '&', ' '), '/', $request_path);
     $request_path = date('Y-m-d') . '/' . JO_Request::getInstance()->getController() . '/' . $request_path;
     $request_path = preg_replace('/([\\/]{2,})/', '/', $request_path);
     $request_path = trim($request_path, '/');
     $request_path = self::fixEncoding($request_path);
     //		var_dump($request_path); exit;
     if (strpos($request_path, '/') !== false) {
         $path = dirname($request_path) . '/';
         $tmp = explode('/', $request_path);
         $name = $this->clearString(end($tmp));
         $name = $name == 'index' ? $name . '.' . mt_rand(00, 5) : $name;
         $this->cache_name = $name . '.cache';
     } else {
         $path = '';
         $name = $this->clearString(trim($request_path) ? $request_path : 'home');
         $name = $name == 'index' ? $name . '.' . mt_rand(00, 5) : $name;
         $this->cache_name = $name . '.cache';
     }
     $folder = '';
     if (class_exists('WM_Currency')) {
         $folder = '/' . WM_Currency::getCurrencyCode();
     }
     //		$cache_folder = BASE_PATH . '/cache/' . $cache_host . '/' . JO_Locale::findLocale() . $folder . '/' . $path;
     $cache_folder = BASE_PATH . '/cache/' . $cache_host . '/' . $path;
     if (!file_exists($cache_folder) || !is_dir($cache_folder)) {
         if (!file_exists($cache_folder) || !is_dir($cache_folder)) {
             if (@mkdir($cache_folder, 0777, true)) {
                 $this->is_writable = true;
             }
         } else {
             $this->is_writable = true;
         }
     } elseif (is_writable($cache_folder)) {
         $this->is_writable = true;
     }
     $this->cache_dir = $cache_folder;
     $this->cache_path = BASE_PATH . '/cache/' . $cache_host . '/';
     $this->ignore_cache[] = 'vieworder';
     $this->ignore_cache[] = 'prices';
     $this->ignore_cache[] = 'cron';
     $this->ignore_cache[] = 'bulidUrl';
     $this->ignore_cache[] = 'latest_view';
     if (in_array(JO_Request::getInstance()->getController(), $this->ignore_cache)) {
         $this->is_writable = false;
     }
     if (in_array(JO_Request::getInstance()->getAction(), $this->ignore_cache)) {
         $this->is_writable = false;
     }
 }
开发者ID:noikiy,项目名称:amatteur,代码行数:54,代码来源:Static.php


示例18: getTranslateJs

 public static function getTranslateJs()
 {
     self::initDB();
     $db = JO_Db::getDefaultAdapter();
     $query = $db->select()->from('language_keywords', array('keyword', 'translate' => new JO_Db_Expr('IF(translate != \'\',translate,keyword)')))->where('language_keywords.module = ?', JO_Request::getInstance()->getModule());
     $result = $db->fetchPairs($query);
     foreach ($result as $k => $v) {
         $result[$k] = html_entity_decode($v, ENT_QUOTES, 'utf-8');
     }
     return $result;
 }
开发者ID:noikiy,项目名称:amatteur,代码行数:11,代码来源:Gettranslate.php


示例19: fatal_error_handler

    public function fatal_error_handler($buffer)
    {
        $error = error_get_last();
        if ($error['type'] == 1) {
            $request = JO_Request::getInstance();
            if ($request->isXmlHttpRequest()) {
                $callback = $request->getRequest('callback');
                if (!preg_match('/^([a-z0-9_.]{1,})$/i', $callback)) {
                    $callback = false;
                }
                if ($callback) {
                    $return = $callback . '(' . JO_Json::encode(array('error' => $error)) . ')';
                } else {
                    $return = JO_Json::encode(array('error' => $error));
                }
                return $return;
            }
            // type, message, file, line
            $newBuffer = '<html><header><title>Fatal Error </title></header>
	                    <style>                 
	                    .error_content{                     
	                        background: ghostwhite;
	                        vertical-align: middle;
	                        margin:0 auto;
	                        padding:10px;
	                        width:80%;                              
	                     } 
	                     .error_content label{color: red;font-family: Georgia;font-size: 16pt;font-style: italic;}
	                     .error_content ul li{ background: none repeat scroll 0 0 FloralWhite;                   
	                                border: 1px solid AliceBlue;
	                                display: block;
	                                font-family: monospace;
	                                padding: 8px 10px;
	                                text-align: left;
	                      }
	                    </style>
	                    <body style="text-align: center;">  
	                      <div class="error_content">
	                          <label >Fatal Error </label>
	                          <ul>
	                          	<li><b>Type:</b> ' . $error['type'] . '</li>
	                            <li><b>Line:</b> ' . $error['line'] . '</li>
	                            <li><b>Message:</b> ' . $error['message'] . '</li>
	                            <li><b>File:</b> ' . $error['file'] . '</li>                             
	                          </ul>
	
	                          <a href="javascript:history.back()"> Back </a>                          
	                      </div>
	                    </body></html>';
            return $newBuffer;
        }
        return $buffer;
    }
开发者ID:NareshChennuri,项目名称:pyng,代码行数:53,代码来源:Error.php


示例20: indexAction

 public function indexAction()
 {
     $this->noLayout(true);
     $request = JO_Request::getInstance();
     $this->view->field = $request->getRequest('field', 'image');
     if ($request->getQuery('CKEditorFuncNum')) {
         $this->view->fckeditor = $request->getQuery('CKEditorFuncNum');
     } else {
         $this->view->fckeditor = false;
     }
     $this->view->directory = rtrim($this->httpImages, '/');
 }
开发者ID:noikiy,项目名称:PD,代码行数:12,代码来源:FilemanagerController.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP JO_Session类代码示例发布时间:2022-05-23
下一篇:
PHP JO_Registry类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap