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


PHP Frontend类代码示例

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


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

示例1: checkLoginFromAdmin

function checkLoginFromAdmin($userid_from_zend)
{
    $front = Frontend::getInstance();
    if (isset($userid_from_zend) && $userid_from_zend != "" && $userid_from_zend != -2) {
        //echo "0*".$userid_from_zend."*";
        $user_id = (int) $userid_from_zend;
        if ($user_id == 0) {
            die("Admin session expired");
        }
        if ($front->isUserLoggedIn() && isset($_SESSION["userid"]) && $_SESSION["userid"] != 0 && $_SESSION["userid"] == $user_id) {
            // already logged nothing to do
        } else {
            if ($front->isUserLoggedIn() && isset($_SESSION["userid"]) && $_SESSION["userid"] != 0 && $_SESSION["userid"] != $user_id) {
                die("You are logged in Love application with another userid in this session. Please, logout from Love application!" . $_SESSION["userid"] . "**" . $user_id);
            } else {
                $sql = "SELECT " . USERS . ".*, " . COMPANY . ".name as company_name  " . "FROM " . USERS . ", " . COMPANY . " " . "WHERE " . USERS . ".id = " . mysql_real_escape_string($user_id) . " AND " . USERS . ".company_id = " . COMPANY . ".id";
                $row = doQuery($sql);
                $username = $row->username;
                $nickname = $row->nickname;
                //           $admin = $row->admin;
                $_SESSION["userid"] = $user_id;
                $_SESSION["username"] = $username;
                $_SESSION["nickname"] = $nickname;
                //         $_SESSION["admin"] = $admin;
                $_SESSION['running'] = "true";
                if (!$front->isUserLoggedIn()) {
                    $front = new Frontend();
                    if (!$front->isUserLoggedIn()) {
                        clearSession();
                        die("You are still not logged! Click on another tab, and come back back here it could work");
                    }
                }
                if (!isAdmin($user_id)) {
                    clearSession();
                    die("You should have admin right to get access to this page." . $admin . "**" . USERS);
                }
            }
        }
    }
    if (!$front->isUserLoggedIn()) {
        clearSession();
        $front->getUser()->askUserToAuthenticate();
    }
    if (!isAdmin($_SESSION["userid"])) {
        clearSession();
        die("You should have admin right to get access to this page.");
    }
}
开发者ID:highfidelity,项目名称:love,代码行数:48,代码来源:loginFromAdmin.php

示例2: __dbConnectionResource

 private static function __dbConnectionResource()
 {
     if (class_exists('Frontend')) {
         return Frontend::instance()->Database->getConnectionResource();
     }
     return Administration::instance()->Database->getConnectionResource();
 }
开发者ID:bauhouse,项目名称:sym-spectrum-members,代码行数:7,代码来源:class.asdc.php

示例3: setting

 /**
  * setting
  *
  * @param VirtualConnectionInterface $conn     database connection
  * @param bool               $revision 리비전 처리
  * @return \Illuminate\View\View
  */
 public function setting(VirtualConnectionInterface $conn, $revision = false)
 {
     /** @var \Xpressengine\DynamicField\DynamicFieldHandler $dynamicField */
     $dynamicField = app('xe.dynamicField');
     $parent = $dynamicField->getConfigHandler()->parent($this->group);
     $configs = [];
     if ($parent !== null) {
         /**
          * @var ConfigEntity $config
          */
         foreach (Cfg::children($parent) as $config) {
             if ($config->get('use') === true) {
                 $configs[$config->get('id')] = $config;
             }
         }
     }
     /**
      * @var \Xpressengine\DynamicField\RegisterHandler $registerHandler
      */
     $dynamicFieldHandler = app('xe.dynamicField');
     $registerHandler = $dynamicFieldHandler->getRegisterHandler();
     $types = $registerHandler->getTypes($dynamicFieldHandler);
     $fieldTypes = [];
     foreach ($types as $types) {
         $fieldTypes[] = $types;
     }
     \Frontend::rule('dynamicFieldSection', $this->getRules());
     return View::make('dynamicField.setting', ['databaseName' => $conn->getName(), 'group' => $this->group, 'configs' => $configs, 'fieldTypes' => $fieldTypes, 'revision' => $revision]);
 }
开发者ID:mint-soft-com,项目名称:xpressengine,代码行数:36,代码来源:DynamicFieldSection.php

示例4: instance

 public static function instance()
 {
     if (!self::$_instance instanceof Frontend) {
         self::$_instance = new self();
     }
     return self::$_instance;
 }
开发者ID:njmcgee,项目名称:taxcheck,代码行数:7,代码来源:class.frontend.php

示例5: getLoveHistory

 public function getLoveHistory($page, $justUser = false)
 {
     $front = Frontend::getInstance();
     $page--;
     $l = $this->getLimit() * $page;
     $where = '';
     $sql = "SELECT count(*) " . "FROM " . LOVE_LOVE;
     $res = mysql_query($sql);
     $row = mysql_fetch_row($res);
     $loves = $row[0];
     $sql = "SELECT count(*) " . "FROM " . LOVE_LOVE . " " . "WHERE " . LOVE_LOVE . ".receiver = '" . $front->getUser()->getUsername() . "' " . "OR " . LOVE_LOVE . ".giver = '" . $front->getUser()->getUsername() . "' " . ($sql .= $justUser ? '' : "OR " . LOVE_LOVE . ".company_id = '" . $front->getUser()->getCompany_id() . "' ");
     $sql .= $where . " " . "ORDER BY id DESC";
     $res = mysql_query($sql);
     $row = mysql_fetch_row($res);
     $count = $row[0];
     $cPages = ceil($count / $this->getLimit());
     $sql = "SELECT id,giver,receiver,why,private,TIMESTAMPDIFF(SECOND,at,NOW()) as delta " . "FROM " . LOVE_LOVE . " " . "WHERE " . LOVE_LOVE . ".receiver = '" . $front->getUser()->getUsername() . "' " . "OR " . LOVE_LOVE . ".giver = '" . $front->getUser()->getUsername() . "' ";
     $sql .= $justUser ? '' : "OR " . LOVE_LOVE . ".company_id = '" . $front->getUser()->getCompany_id() . "' ";
     $sql .= $where . " " . "ORDER BY id DESC " . "LIMIT " . $l . "," . $this->getLimit();
     $res = mysql_query($sql);
     // Construct json for history
     $this->pages = array(array($page, $cPages, number_format($loves)));
     for ($i = 1; $row = mysql_fetch_assoc($res); $i++) {
         $givernickname = getNickName($row['giver']);
         $givernickname = !empty($givernickname) ? $givernickname : $row['giver'];
         $receivernickname = getNickName($row['receiver']);
         $receivernickname = !empty($receivernickname) ? $receivernickname : $row['receiver'];
         $why = $row['why'];
         if ($row['private']) {
             $why .= " (love sent quietly)";
         }
         $history[] = array("id" => $row['id'], "giver" => $row['giver'], "giverNickname" => $givernickname, "receiver" => $row['receiver'], "receiverNickname" => $receivernickname, "why" => $why, "delta" => Utils::relativeTime($row['delta']));
     }
     return $history;
 }
开发者ID:highfidelity,项目名称:love,代码行数:35,代码来源:Love.class.php

示例6: Database

 public static function Database()
 {
     if (class_exists('Frontend')) {
         return Frontend::instance()->Database;
     }
     return Administration::instance()->Database;
 }
开发者ID:bauhouse,项目名称:sym-spectrum,代码行数:7,代码来源:class.symphony.php

示例7: start

 public static function start($lifetime = 0, $path = '/', $domain = NULL)
 {
     if (!self::$_initialized) {
         ## Crude method of determining if we're in the admin or frontend
         if (class_exists('Frontend')) {
             self::$_db =& Frontend::instance()->Database;
         } elseif (class_exists('Administration')) {
             self::$_db =& Administration::instance()->Database;
         } else {
             return false;
         }
         if (!is_object(self::$_db) || !self::$_db->isConnected()) {
             return false;
         }
         self::$_cache = new Cacheable(self::$_db);
         $installed = self::$_cache->check('_session_config');
         if (!$installed) {
             if (!self::createTable()) {
                 return false;
             }
             self::$_cache->write('_session_config', true);
         }
         ini_set('session.save_handler', 'user');
         session_set_save_handler(array('Session', 'open'), array('Session', 'close'), array('Session', 'read'), array('Session', 'write'), array('Session', 'destroy'), array('Session', 'gc'));
         session_set_cookie_params($lifetime, $path, $domain ? $domain : self::getDomain(), false, false);
         self::$_initialized = true;
         if (session_id() == '') {
             session_start();
         }
     }
     return session_id();
 }
开发者ID:bauhouse,项目名称:sym-fluid960gs,代码行数:32,代码来源:class.session.php

示例8: driver

 public static function driver()
 {
     if (class_exists('Administration')) {
         return Administration::instance()->Configuration;
     }
     return Frontend::instance()->Configuration;
 }
开发者ID:bauhouse,项目名称:library,代码行数:7,代码来源:class.configurationaccessor.php

示例9: makeView

 /**
  * makeView
  *
  * @param $target
  * @param $instanceId
  * @param $mode
  *
  * @return \Illuminate\Contracts\View\View
  */
 protected function makeView($target, $instanceId, $mode)
 {
     /** @var SkinHandler $skinHandler */
     $skinHandler = app('xe.skin');
     $skinInstanceId = $skinHandler->mergeKey($target, $instanceId);
     $selectedSkin = $skinHandler->getAssigned([$target, $instanceId], $mode);
     if ($selectedSkin !== null) {
         $settingView = $selectedSkin->getSettingView();
     } else {
         $settingView = null;
     }
     // get skin list
     $skinList = $skinHandler->getList($target);
     $skins = function ($skinList, $selectedSkin) {
         (yield ['text' => '선택하세요', 'selected' => false]);
         foreach ($skinList as $id => $skin) {
             $support = [];
             $support[] = $skin->supportDesktop() ? '데스크탑' : '';
             $support[] = $skin->supportMobile() ? '모바일' : '';
             $support = '[' . implode('|', $support) . ']';
             (yield ['value' => $id, 'text' => $skin->getTitle() . $support, 'selected' => $selectedSkin === null ? false : $id === $selectedSkin->getId()]);
         }
     };
     $skins = $skins($skinList, $selectedSkin);
     \Frontend::js('assets/skin/section.js')->load();
     $url = route('settings.skin.section.setting');
     \Frontend::html('skin.loadSkinSetting')->content("<script>\n            XE.\$(function(\$){\n                \$('.__xe_skinSetting').xeSkinSetting({\n                    'loadUrl': '{$url}',\n                    'saveUrl': '{$url}'\n                });\n            });\n        </script>")->load();
     return View::make('skin.setting', compact('skinInstanceId', 'settingView', 'skins', 'mode', 'selectedSkin'));
 }
开发者ID:mint-soft-com,项目名称:xpressengine,代码行数:38,代码来源:SkinSection.php

示例10: getForTemplate

 /**
  * Generate array representation for download
  *
  * @param bool $blnOrderPaid
  *
  * @return array
  */
 public function getForTemplate($blnOrderPaid = false)
 {
     global $objPage;
     $objDownload = $this->getRelated('download_id');
     if (null === $objDownload) {
         return array();
     }
     $arrDownloads = array();
     $allowedDownload = trimsplit(',', strtolower($GLOBALS['TL_CONFIG']['allowedDownload']));
     foreach ($objDownload->getFiles() as $objFileModel) {
         $objFile = new \File($objFileModel->path, true);
         if (!in_array($objFile->extension, $allowedDownload) || preg_match('/^meta(_[a-z]{2})?\\.txt$/', $objFile->basename)) {
             continue;
         }
         // Send file to the browser
         if ($blnOrderPaid && $this->canDownload() && \Input::get('download') == $objDownload->id && \Input::get('file') == $objFileModel->path) {
             $this->download($objFileModel->path);
         }
         $arrMeta = \Frontend::getMetaData($objFileModel->meta, $objPage->language);
         // Use the file name as title if none is given
         if ($arrMeta['title'] == '') {
             $arrMeta['title'] = specialchars(str_replace('_', ' ', preg_replace('/^[0-9]+_/', '', $objFile->filename)));
         }
         $strHref = '';
         if (TL_MODE == 'FE') {
             $strHref = \Haste\Util\Url::addQueryString('download=' . $objDownload->id . '&amp;file=' . $objFileModel->path);
         }
         // Add the image
         $arrDownloads[] = array('id' => $this->id, 'name' => $objFile->basename, 'title' => $arrMeta['title'], 'link' => $arrMeta['title'], 'caption' => $arrMeta['caption'], 'href' => $strHref, 'filesize' => \System::getReadableSize($objFile->filesize, 1), 'icon' => TL_ASSETS_URL . 'assets/contao/images/' . $objFile->icon, 'mime' => $objFile->mime, 'meta' => $arrMeta, 'extension' => $objFile->extension, 'path' => $objFile->dirname, 'remaining' => $objDownload->downloads_allowed > 0 ? sprintf($GLOBALS['TL_LANG']['MSC']['downloadsRemaining'], intval($this->downloads_remaining)) : '', 'downloadable' => $blnOrderPaid && $this->canDownload());
     }
     return $arrDownloads;
 }
开发者ID:rpquadrat,项目名称:core,代码行数:39,代码来源:ProductCollectionDownload.php

示例11: Context

 public function Context()
 {
     if (class_exists('Frontend')) {
         return (object) Frontend::instance();
     }
     return (object) Administration::instance();
 }
开发者ID:klaftertief,项目名称:entry_versions,代码行数:7,代码来源:class.entryversionsmanager.php

示例12: lookup

 public static function lookup($ip)
 {
     $ch = curl_init();
     // Notice: the request back to the Symphony services API includes your domain name
     // and the version of Symphony that you're using
     $version = Frontend::instance()->Configuration->get('version', 'symphony');
     $domain = $_SERVER[SERVER_NAME];
     curl_setopt($ch, CURLOPT_URL, "http://symphony-cms.net/_netspeed/1.0/?symphony=" . $version . "&domain=" . $domain . "&ip=" . $ip);
     curl_setopt($ch, CURLOPT_HEADER, 0);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
     $speedinfo = curl_exec($ch);
     $info = curl_getinfo($ch);
     curl_close($ch);
     if ($speedinfo === false || $info['http_code'] != 200) {
         return;
     } else {
         $speedinfo = explode(',', $speedinfo);
     }
     $result = new XMLElement("netspeed");
     $included = array('id', 'connection', 'error');
     $i = 0;
     foreach ($included as $netspeed) {
         $result->appendChild(new XMLElement($netspeed, $speedinfo[$i]));
         $i++;
     }
     return $result;
 }
开发者ID:josephdenne,项目名称:netspeed-service,代码行数:27,代码来源:class.netspeed_service.php

示例13: frontendPreRenderHeaders

 public function frontendPreRenderHeaders($context)
 {
     $page = Frontend::Page();
     foreach (self::$headers as $name => $value) {
         $page->addHeaderToPage($name, $value);
     }
 }
开发者ID:psychoticmeowArchives,项目名称:rewrite,代码行数:7,代码来源:extension.driver.php

示例14: renderer

function renderer($mode = 'frontend')
{
    if (!in_array($mode, array('frontend', 'administration'))) {
        throw new Exception('Invalid Symphony Renderer mode specified. Must be either "frontend" or "administration".');
    }
    require_once CORE . "/class.{$mode}.php";
    return $mode == 'administration' ? Administration::instance() : Frontend::instance();
}
开发者ID:nils-werner,项目名称:symphony-2,代码行数:8,代码来源:index.php

示例15: handle

 /**
  * The main handler for the specfied handle.
  *
  * @param string $handle The instance handle.
  *
  * @return Handler
  */
 public function handle($handle)
 {
     // Sanitize the handle name.
     $this->handle = $this->utility->sanitize_handle($handle);
     // Register this handle with the frontend class.
     $this->frontend->register_handle($this->handle);
     // Register the Ajax handler in the WordPress hook system.
     add_action('wp_ajax_' . $this->handle, array($this, 'ajax_handler'));
     add_action('wp_ajax_nopriv_' . $this->handle, array($this, 'ajax_handler'));
     return $this;
 }
开发者ID:philipnewcomer,项目名称:wp-ajax-helper,代码行数:18,代码来源:Handler.php


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