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


PHP Func::SESSION方法代码示例

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


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

示例1: add

 function add()
 {
     if (!$this->haveAccessTo('edit')) {
         return $this->showAccessDenied();
     }
     $nParentID = Func::POSTGET('pid', false, true);
     $aData = array('title' => '', 'pid' => $nParentID, 'keyword' => '', 'keyword' => '', 'menu_link' => '', 'menu_target' => '', 'mkeywords' => '', 'mdescription' => '');
     if (Func::isPostMethod()) {
         Func::setSESSION('pid', $nParentID);
         $sKeyword = Func::POST('keyword', true);
         $sMenuTarget = Func::POST('target');
         if (!in_array($sMenuTarget, array('_self', '_blank'))) {
             $sMenuTarget = '_self';
         }
         $sType = Func::POST('type');
         switch ($sType) {
             case 'menu_type':
                 $sMenuTitle = Func::POST('menu_title4', true);
                 $sMetaKeywords = Func::POST('mkeywords4', true);
                 $sMetaDescription = Func::POST('mdescription4', true);
                 $sMenuLink = '#';
                 break;
             case 'page':
                 $nPageID = Func::POST('page_id', false, true);
                 $aPageInfo = $this->db->one_array('SELECT * FROM ' . TABLE_PAGES . ' WHERE id=' . $nPageID . ' LIMIT 1');
                 if (!$aPageInfo) {
                     $this->adminRedirect(Errors::IMPOSSIBLE);
                 }
                 $sMenuTitle = Func::POST('menu_title3', true);
                 if (!$sMenuTitle) {
                     $sMenuTitle = $aPageInfo['title'];
                 }
                 $sMetaKeywords = $aPageInfo['mkeywords'];
                 $sMetaDescription = $aPageInfo['mdescription'];
                 $sMenuLink = $aPageInfo['filename'] . PAGES_EXTENSION;
                 break;
             case 'link':
             default:
                 $sMenuTitle = Func::POST('menu_title2', true);
                 $sMenuLink = Func::POST('menu_link2', true);
                 $sMetaDescription = Func::POST('mdescription2', true);
                 $sMetaKeywords = Func::POST('mkeywords2', true);
         }
         $_POST['menu_title'] = $sMenuTitle;
         $_POST['menu_link'] = $sMenuLink;
         $_POST['mdescription'] = $sMetaDescription;
         $_POST['mkeywords'] = $sMetaKeywords;
         if (!$sMenuTitle || !trim($sMenuTitle)) {
             $this->errors->set('empty:title');
         }
         if ($this->errors->no()) {
             $nNodeID = $this->tree_insertNode($nParentID);
             $this->addItem($nNodeID, $sMenuTitle, $sKeyword, $sMenuLink, $sMetaKeywords, $sMetaDescription, $sMenuTarget);
             $this->adminRedirect(Errors::SUCCESS);
         }
         $aData = $_POST;
     }
     if (!$nParentID) {
         $nParentID = Func::SESSION('pid');
     }
     //parent options
     $sParentOptions = '';
     $aItems = $this->db->select('SELECT I.menu_title, T.id, T.numlevel, I.keyword FROM ' . TABLE_SITEMAP_TREE . ' T, ' . TABLE_SITEMAP . ' I
                             WHERE T.id=I.node_id AND T.numlevel<=2 
                             ORDER BY T.numleft');
     foreach ($aItems as $v) {
         if (!empty($v['keyword'])) {
             $sParentOptions .= '<option value="' . $v['id'] . '" style="padding-left:' . $v['numlevel'] * 18 . 'px;" 
                                 ' . ($nParentID == $v['id'] ? ' selected' : '') . '>' . $v['menu_title'] . '</option>';
         }
     }
     $this->tplAssign('aData', $aData);
     $this->tplAssign('pid_options', $sParentOptions);
     $this->tplAssign('target_options', $this->getTargetsOptions($this->aTargets, $aData['menu_target']));
     $this->tplAssign('pages_options', func::MakeOptionsListEx($this->db->select('SELECT * FROM ' . TABLE_PAGES), Func::POSTGET('page_id', false, true), 'title', 'id'));
     return $this->tplFetch('admin.add.tpl');
 }
开发者ID:Sywooch,项目名称:dobox,代码行数:77,代码来源:sitemap.adm.class.php

示例2: mm_add

 function mm_add()
 {
     if (!FORDEV || !$this->security->isSuperAdmin()) {
         return $this->showAccessDenied();
     }
     $aData = array('method' => '', 'title' => '', 'module' => '');
     if (Func::isPostMethod()) {
         $sMethod = Func::POST('method', true);
         $sTitle = Func::POST('title', true);
         $sModule = $this->db->str2sql(Func::POST('module'));
         Func::setSESSION('save_module', $sModule);
         if (!$sMethod) {
             $sMethod = $sModule;
         }
         if (!$sTitle) {
             $sTitle = ucwords($sModule . ' ' . $sMethod);
         }
         //get max module number
         $nNumber = (int) $this->db->one_data('SELECT max(number) FROM ' . TABLE_MODULE_METHODS . " \n                                            WHERE module={$sModule} AND method!={$sModule} ");
         $nNumber++;
         //insert module-method
         $this->db->execute('INSERT INTO ' . TABLE_MODULE_METHODS . " (module, method, title, number)\n                       VALUES ({$sModule}, " . $this->db->str2sql($sMethod) . ', ' . $this->db->str2sql($sTitle) . ", {$nNumber})");
         if ($this->errors->no()) {
             $this->adminRedirect(Errors::SUCCESSFULL, 'mm_listing');
         }
     }
     if (!$aData['module']) {
         $aData['module'] = Func::SESSION('save_module');
     }
     $aModules = CDir::getDirs(PATH_MODULES, false, false, false);
     foreach ($aModules as $k => $v) {
         if ($v[0] != '.' && $v[0] != '_') {
             $aModules[$v] = $v;
         }
         unset($aModules[$k]);
     }
     $this->tplAssign(array('aModules' => $aModules, 'aData' => $aData));
     return $this->tplFetch('admin.mm.create.tpl');
 }
开发者ID:Sywooch,项目名称:dobox,代码行数:39,代码来源:dev.adm.class.php

示例3: isFORDEV

 /** Режим FORDEV */
 function isFORDEV()
 {
     $fordev = Func::POSTGET('fordev');
     if (!$fordev) {
         $fordev = Func::SESSION('fordev');
     }
     if ($fordev) {
         if ($fordev === 'off') {
             $fordev = false;
             Func::setSESSION('fordev', false);
         } else {
             Func::setSESSION('fordev', true);
         }
     }
     if ($fordev) {
         return TRUE;
     }
     return FALSE;
 }
开发者ID:Sywooch,项目名称:dobox,代码行数:20,代码来源:security.php

示例4: edit

 function edit()
 {
     if (!$this->haveAccessTo('edit')) {
         return $this->showAccessDenied();
     }
     $nRecordID = Func::POSTGET('rec', false, true);
     if (!$nRecordID) {
         $this->adminRedirect(Errors::IMPOSSIBLE);
     }
     $aData = $this->db->one_array('SELECT * FROM ' . TABLE_BANNERS . ' WHERE id=' . $nRecordID);
     if (empty($aData)) {
         $this->adminRedirect(Errors::IMPOSSIBLE);
     }
     $sPrevPosition = $aData['position'];
     if (bff::$isPost) {
         $this->input->postm(array('position' => TYPE_STR, 'cat' => TYPE_ARRAY_UINT, 'enabled' => TYPE_BOOL, 'banner_type' => TYPE_UINT, 'show_limit' => TYPE_UINT, 'resize_img' => TYPE_BOOL, 'code' => TYPE_STR, 'show_start' => TYPE_STR, 'show_finish' => TYPE_STR, 'clickurl' => TYPE_STR, 'showurl' => TYPE_STR, 'showurl_recursive' => TYPE_BOOL, 'flash_width' => TYPE_UINT, 'flash_height' => TYPE_UINT, 'flash_key' => TYPE_STR, 'title' => TYPE_STR, 'alt' => TYPE_STR, 'description' => TYPE_STR), $aData);
         if (!$aData['position']) {
             $this->errors->set('position');
         }
         /* если при редактировании позиция меняется, проверить новую позицию на возможность ротации */
         if ($aData['position'] != $sPrevPosition) {
             if (!$this->checkRotation($aData['position'])) {
                 $this->errors->set('no_rotation');
             }
         }
         $aData['clickurl'] = preg_replace("[^http://|www\\.|https://|ftp://]", '', $aData['clickurl']);
         $aData['showurl'] = preg_replace("[^http://|www\\.|https://|ftp://]", '', $aData['showurl']);
         $sFlashAddFields = '';
         if ($aData['banner_type'] == BANNERS_TYPE_FLASH) {
             if (!$aData['flash_width'] || !$aData['flash_height']) {
                 $this->errors->set('no_flash_size');
             }
             $sFlashAddFields = 'flash = ' . $this->db->str2sql(serialize(array('width' => $aData['flash_width'], 'height' => $aData['flash_height'], 'key' => $aData['flash_key']))) . ',';
         }
         Func::setSESSION('banner_position', $aData['position']);
         if ($this->errors->no()) {
             $this->db->execute('UPDATE ' . TABLE_BANNERS . '
                         SET clickurl = :clickurl,
                             position = :position,
                             cat = :cat,
                             show_start = :show_start,
                             show_finish = :show_finish,
                             showurl = :showurl,
                             showurl_recursive =' . $aData['showurl_recursive'] . ',
                             enabled =' . $aData['enabled'] . ',
                             banner_type =' . $aData['banner_type'] . ',' . $sFlashAddFields . '
                             show_limit = ' . $aData['show_limit'] . ',
                             title = :title,  alt = :alt, description = :description
                         WHERE id=' . $nRecordID, array(':clickurl' => $aData['clickurl'], ':position' => $aData['position'], ':cat' => join(',', $aData['cat']), ':show_start' => date('Y-m-d H:i', strtotime($aData['show_start'])), ':show_finish' => date('Y-m-d H:i', strtotime($aData['show_finish'])), ':showurl' => $aData['showurl'], ':title' => $aData['title'], ':alt' => $aData['alt'], ':description' => $aData['description']));
             do {
                 if ($aData['banner_type'] == BANNERS_TYPE_IMG) {
                     $oUpload = new Upload('bnrimg', false);
                     if (isset($_FILES['bnrimg']) && $_FILES['bnrimg']['error'] == 4) {
                         break;
                     }
                     $oUpload->checkIsIMG();
                     if ($oUpload->isSuccessfull()) {
                         $this->delImages($nRecordID, array('banner' => $aData['banner']));
                         $aImgInfo = getimagesize($_FILES['bnrimg']['tmp_name']);
                         $sExtension = image_type_to_extension($aImgInfo[2], false);
                         $sFilename = func::generateRandomName(5, true, true) . '.' . $sExtension;
                         $aPositionInfo = $this->positions[$aData['position']];
                         if (!isset($aPositionInfo['height']) || !$aPositionInfo['height']) {
                             $aPositionInfo['height'] = false;
                         }
                         if (!$aData['resize_img']) {
                             $aWorkingImg = array('filename' => BANNERS_PATH . $nRecordID . '_work_' . $sFilename, 'width' => $aImgInfo[0], 'height' => $aImgInfo[1], 'autofit' => true, 'crop_v' => 'center', 'crop_h' => 'center');
                         } else {
                             $aWorkingImg = array('filename' => BANNERS_PATH . $nRecordID . '_work_' . $sFilename, 'width' => $aPositionInfo['width'], 'height' => $aPositionInfo['height'], 'autofit' => true, 'crop_v' => 'center', 'crop_h' => 'center');
                         }
                         $aParams = array(array('filename' => BANNERS_PATH . $nRecordID . '_th_' . $sFilename, 'width' => 100, 'height' => false, 'autofit' => true, 'crop_v' => 'center', 'crop_h' => 'center'), $aWorkingImg ? $aWorkingImg : '');
                         $oThumb = new CThumbnail($_FILES['bnrimg']['tmp_name'], false);
                         $oThumb->save($aParams);
                         $this->db->execute('UPDATE ' . TABLE_BANNERS . '
                                    SET banner=' . $this->db->str2sql($sFilename) . '
                                    WHERE id=' . $nRecordID);
                     }
                 } elseif ($aData['banner_type'] == BANNERS_TYPE_FLASH) {
                     $fUpload = new Upload('flash', false);
                     if (!empty($fUpload->filename)) {
                         $this->delImages($nRecordID, array('banner' => $aData['banner']));
                         $fUpload->save(BANNERS_PATH, $nRecordID . '_src_');
                         $this->db->execute('UPDATE ' . TABLE_BANNERS . '
                                    SET banner=' . $this->db->str2sql($fUpload->getFilename()) . '
                                    WHERE id=' . $nRecordID);
                     }
                 } else {
                     $this->db->execute('UPDATE ' . TABLE_BANNERS . '
                                SET banner=' . $this->db->str2sql($aData['code']) . '
                                WHERE id=' . $nRecordID);
                 }
             } while (false);
             $this->adminRedirect(Errors::SUCCESSFULL);
         }
         $aData['banner'] = $this->db->one_data('SELECT banner FROM ' . TABLE_BANNERS . ' WHERE id=' . $nRecordID);
     }
     $aData['cat'] = explode(',', $aData['cat']);
     if (empty($aData['position'])) {
         $aData['position'] = Func::SESSION('banner_position');
     }
//.........这里部分代码省略.........
开发者ID:Sywooch,项目名称:dobox,代码行数:101,代码来源:banners.adm.class.php


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