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


PHP JO_Request类代码示例

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


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


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