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


PHP URL::baseUrl方法代码示例

本文整理汇总了PHP中URL::baseUrl方法的典型用法代码示例。如果您正苦于以下问题:PHP URL::baseUrl方法的具体用法?PHP URL::baseUrl怎么用?PHP URL::baseUrl使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在URL的用法示例。


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

示例1: before

 public function before()
 {
     $userAccess = new UserAccess();
     if (!$userAccess->isSupport()) {
         if ($this->request->isAjax()) {
             die('{ "ok" : false, "msg" : "Access denied" }');
         } else {
             Header::redirect(URL::baseUrl() . '/login');
         }
     }
     try {
         $pkSupportUserAccess = array('id_support_user' => $_SESSION['support_user']['id_user']);
         $supportUserAccess = $this->orm->support_user_access[$pkSupportUserAccess];
         if (!$supportUserAccess['maintain_user']) {
             $view = View::instance();
             $view->message = 'Access denied';
             $view->render('error');
             die;
         }
     } catch (Exception $e) {
         $view = View::instance();
         $view->message = 'Error occurred';
         $view->render('error');
         die;
     }
 }
开发者ID:sandroalvesperes,项目名称:chat,代码行数:26,代码来源:Users.php

示例2: get_index

 public function get_index()
 {
     $view = View::instance();
     try {
         if (isset($_SESSION['client_user'])) {
             $chat = $this->orm->chat[$_SESSION['client_user']['id_chat']];
             if ($chat['closed']) {
                 unset($_SESSION['client_user']);
             } elseif ($chat['id_support_user']) {
                 Header::redirect(URL::baseUrl() . '/conversation');
             } else {
                 Header::redirect(URL::baseUrl() . '/client/wait');
             }
         }
         $param = $this->orm->param();
         $param->select('value');
         $param->where('name', 'STATUS');
         $supportStatus = $param->fetch();
         $supportUser = $this->orm->support_user();
         $supportUser->where('active', 1);
         $supportUser->and('online', 1);
         $supportOnlineCount = $supportUser->count('id_support_user');
         if ($supportStatus['value'] == 1 && $supportOnlineCount > 0) {
             $view->render('form-client');
         } else {
             $view->render('offline');
         }
     } catch (Exception $e) {
         $view->render('offline');
     }
 }
开发者ID:sandroalvesperes,项目名称:chat,代码行数:31,代码来源:Start.php

示例3: before

 public function before()
 {
     $userAccess = new UserAccess();
     if (!$userAccess->isSupport()) {
         if ($this->request->isAjax()) {
             die('{ "ok" : false, "msg" : "Access denied" }');
         } else {
             Header::redirect(URL::baseUrl() . '/login');
         }
     }
 }
开发者ID:sandroalvesperes,项目名称:chat,代码行数:11,代码来源:Support.php

示例4: get_signOut

 public function get_signOut()
 {
     try {
         $idUser = @$_SESSION['support_user']['id_user'];
         if ($idUser) {
             $this->orm->support_user[$idUser]->update(array('online' => 0, 'typing' => 0, 'last_activity' => new NotORM_Literal('NOW()')));
         }
         if (isset($_SESSION['support_user']) && count($_SESSION) == 1) {
             unset($_SESSION['support_user']);
             session_unset();
             session_destroy();
         } else {
             unset($_SESSION['support_user']);
         }
         Header::redirect(URL::baseUrl() . '/login');
     } catch (Exception $e) {
         $view = View::instance();
         $view->render('error');
     }
 }
开发者ID:sandroalvesperes,项目名称:chat,代码行数:20,代码来源:Login.php

示例5: get_index

 public function get_index()
 {
     try {
         $idChat = @$this->request->get('id', FILTER_VALIDATE_INT);
         $userChat = new UserChat($this->orm, $idChat);
         if (!$userChat->isValid()) {
             if ($userChat->isSupport()) {
                 Header::redirect(URL::baseUrl() . '/login');
             } else {
                 Header::redirect(URL::baseUrl());
             }
         }
         $this->orm->{$userChat->table}[$userChat->idUser]->update(array('typing' => 0, 'last_activity' => new NotORM_Literal('NOW()')));
         $userChat->talkingTo()->sex = str_replace(array('M', 'F'), array('male', 'female'), $userChat->talkingTo()->sex);
         # Get the chat messages
         # ------------------------------------------------------------------
         $chatMessage = $this->orm->chat_message();
         $chatMessage->select('id_chat_message, created, message, sent_by');
         $chatMessage->where('id_chat', $userChat->idChat);
         $chatMessage->order('id_chat_message ASC');
         $messages = array();
         $format = new DateTimeFormat();
         $format->setSupHtmlSuffix(true);
         foreach ($chatMessage as $message) {
             $format->setValue($message['created']);
             $messages[] = array('who' => $userChat->type == $message['sent_by'] ? 'me' : 'you', 'id_chat_message' => $message['id_chat_message'], 'message' => nl2br(htmlspecialchars($message['message'])), 'datetime' => $format->format());
         }
         $view = View::instance();
         $view->idChat = $userChat->idChat;
         $view->messages = $messages;
         $view->talkingTo = $userChat->talkingTo();
         $view->render('conversation');
     } catch (Exception $e) {
         $view = View::instance();
         $view->render('error');
     }
 }
开发者ID:sandroalvesperes,项目名称:chat,代码行数:37,代码来源:Conversation.php

示例6:

<?php

$this->layout = 'chat';
?>

<div class="error-page">
    
    <div class="info-bar">
        Sorry for the inconvenience
    </div>
    
    <div class="error-panel">
        
        <img src="<?php 
echo URL::baseUrl();
?>
/public/images/error-404.png" alt="" />
        
        <p>Page not found</p>
        
    </div>     
    
</div>
开发者ID:sandroalvesperes,项目名称:chat,代码行数:23,代码来源:not-found.php

示例7: validateSession

 /**
  * Validates the user session to allow or deny access
  *
  * @access private
  * @return void
  */
 private function validateSession()
 {
     if (!UserAccess::isClient()) {
         if ($this->request->isAjax()) {
             die('{ "ok" : false, "msg" : "Access denied" }');
         } else {
             Header::redirect(URL::baseUrl());
         }
     }
 }
开发者ID:sandroalvesperes,项目名称:chat,代码行数:16,代码来源:Client.php

示例8: render

 /**
  * Renderize a view
  * <b>Note:</b> if the layout is set inside a view it will
  * overrive the layout set as parameter
  *
  * @param string $view
  * @param string $layout = null
  * @param boolean $return = false
  * @access public
  * @return void | string
  */
 public function render($view, $layout = null, $return = false)
 {
     $view = preg_replace('/\\.php$/i', '', $view);
     if ($layout) {
         $this->layout = $layout;
     }
     ob_start();
     require_once "views/{$view}.php";
     $body = ob_get_contents();
     ob_clean();
     if ($this->layout) {
         if (file_exists("views/layout/{$this->layout}.php")) {
             $js = '';
             $css = '';
             $widgets = array();
             if ($this->js) {
                 $js = array_map(create_function('$path', 'return "<script src=\\"{$path}\\" type=\\"text/javascript\\"></script>";'), $this->js);
                 $js = implode(PHP_EOL, $js);
             }
             if ($this->css) {
                 $css = array_map(create_function('$path', 'return "<link href=\\"{$path}\\" rel=\\"stylesheet\\" type=\\"text/css\\" />";'), $this->css);
                 $css = implode(PHP_EOL, $css);
             }
             if (count($this->widget->getWidgets()) > 0) {
                 $widgets = array();
                 foreach ($this->widget->getWidgets() as $widget) {
                     foreach ($widget['files'] as $file) {
                         if (preg_match('/\\.js$/i', $file)) {
                             $widgets[] = '<script src="' . URL::baseUrl() . $file . '" type="text/javascript"></script>';
                         } elseif (preg_match('/\\.css$/i', $file)) {
                             $widgets[] = '<link href="' . URL::baseUrl() . $file . '" rel="stylesheet" type="text/css" />';
                         }
                     }
                 }
                 $widgets = implode(PHP_EOL, $widgets);
             } else {
                 $widgets = '';
             }
             require_once "views/layout/{$this->layout}.php";
             $body = ob_get_contents();
             ob_clean();
         }
     }
     if ($return) {
         ob_end_clean();
         return $body;
     } else {
         print $body;
         ob_end_flush();
     }
 }
开发者ID:sandroalvesperes,项目名称:chat,代码行数:62,代码来源:View.php


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