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


PHP func类代码示例

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


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

示例1: ajax

 function ajax()
 {
     if (!$this->haveAccessTo('edit') || !bff::$isAjax) {
         $this->ajaxResponse(Errors::ACCESSDENIED);
     }
     switch (func::GET('act')) {
         case 'del':
             $nContactID = func::POST('rec', false, true);
             if ($nContactID <= 0) {
                 $this->ajaxResponse(Errors::IMPOSSIBLE);
             }
             $this->db->execute('DELETE FROM ' . TABLE_CONTACTS . ' WHERE id = ' . $nContactID);
             $this->ajaxResponse(Errors::SUCCESSFULL);
             break;
         case 'send':
             $nType = func::POST('type', false, true);
             switch ($nType) {
                 case CONTACTS_TYPE_CONTACT:
                     //
                     break;
             }
             $this->ajaxResponse(Errors::IMPOSSIBLE);
             break;
     }
     $this->ajaxResponse(Errors::IMPOSSIBLE);
 }
开发者ID:Sywooch,项目名称:dobox,代码行数:26,代码来源:contacts.adm.class.php

示例2: init

 public function init()
 {
     parent::init();
     if (!func::extensionLoaded('apc')) {
         throw new Exception('CApcCache requires PHP apc extension to be loaded.');
     }
 }
开发者ID:Sywooch,项目名称:dobox,代码行数:7,代码来源:cache.apc.php

示例3: requireAdmin

function requireAdmin() {
	global $service, $session;
	if (isAdmin()) return true;
	if (empty($session['id']) || !isLoggedIn()) requireLogin();
	func::printError(_t('이 페이지에 접근할 권한이 없습니다.'));
	requireLogin();
}
开发者ID:ncloud,项目名称:bloglounge,代码行数:7,代码来源:auth.php

示例4: create

 function create()
 {
     if (!FORDEV) {
         return $this->showAccessDenied();
     }
     $aData = $this->input->postm(array('title' => TYPE_STR, 'type' => TYPE_UINT, 'keyword' => TYPE_STR));
     if (bff::$isPost) {
         if (empty($aData['title'])) {
             $this->errors->set(_t('services', 'Название услуги указано некорректно'));
         }
         if (empty($aData['keyword'])) {
             $this->errors->set(_t('services', 'Keyword услуги указан некорректно'));
         } else {
             $aKeywordExists = $this->db->one_array('SELECT id, title FROM ' . TABLE_SERVICES . ' WHERE keyword = ' . $this->db->str2sql($aData['keyword']));
             if (!empty($aKeywordExists)) {
                 $this->errors->set(_t('services', 'Указанный keyword уже используется услугой "[title]"', array('title' => $aKeywordExists['title'])));
             }
         }
         if ($this->errors->no()) {
             $aSettings = array();
             $aSettings = serialize($aSettings);
             $res = $this->db->execute('INSERT INTO ' . TABLE_SERVICES . ' (type, keyword, title, settings, enabled)
                 VALUES(' . $aData['type'] . ', :keyword, :title, :settings, 1)', array(':keyword' => $aData['keyword'], ':title' => $aData['title'], ':settings' => $aSettings));
             $this->adminRedirect(!empty($res) ? Errors::SUCCESS : Errors::IMPOSSIBLE, 'settings');
         }
         $aData = func::array_2_htmlspecialchars($aData, array('title', 'keyword'));
     }
     return $this->tplFetchPHP($aData, 'admin.create.php');
 }
开发者ID:Sywooch,项目名称:dobox,代码行数:29,代码来源:services.adm.class.php

示例5: init

 /**
  * @return bffBase object
  */
 function init($isFrontend = true)
 {
     global $oDb, $oSm, $oSecurity;
     self::$isFrontend = $isFrontend;
     self::$isAjax = func::isAjaxRequest();
     self::$isPost = func::isPostMethod();
     if ($isFrontend) {
         define('TPL_PATH', PATH_BASE . 'tpl/main/');
         $oSm->template_dir = TPL_PATH;
     } else {
         define('TPL_PATH', PATH_BASE . 'tpl/main/admin/');
         define('THEME_URL', SITEURL . '/styles/default');
         //default admin theme!
         $oSm->template_dir = TPL_PATH;
     }
     spl_autoload_register(array('bffBase', 'autoload'));
     $oSecurity->checkExpired();
     if (!defined('THEME_URL')) {
         define('THEME_URL', SITEURL . '/styles/' . THEMES_DEFAULTTHEME_KEY);
     }
     $oSm->assign('theme_url', THEME_URL);
     $oSm->assign('class', self::$class = substr(strtolower(func::GETPOST('s')), 0, 30));
     $oSm->assign('event', self::$event = substr(strtolower(func::GETPOST('ev')), 0, 30));
     $oSm->assign_by_ref('tplJSIncludes', self::$includesJS);
     $oSm->assign_by_ref('tplCSSIncludes', self::$includesCSS);
     bff::initApp($isFrontend);
     return $this;
 }
开发者ID:Sywooch,项目名称:dobox,代码行数:31,代码来源:bff.base.php

示例6: getuserinfo

function getuserinfo($userid)
{
    global $db, $cfg;
    $row_poster = $db->qry_first("SELECT username, type, avatar_path, signature FROM %prefix%user WHERE userid=%int%", $userid);
    $count_rows = $db->qry_first("SELECT COUNT(*) AS posts FROM %prefix%board_posts WHERE userid = %int%", $userid);
    $html_image = '<img src="%s" alt="%s" border="0">';
    $user["username"] = $row_poster["username"];
    $user["avatar"] = func::chk_img_path($row_poster["avatar_path"]) ? sprintf($html_image, $row_poster["avatar_path"], "") : "";
    $user["signature"] = $row_poster["signature"];
    if ($cfg['board_ranking'] == TRUE) {
        $user["rank"] = getboardrank($count_rows["posts"]);
    }
    $user["posts"] = $count_rows["posts"];
    switch ($row_poster["type"]) {
        case 1:
            $user["type"] = t('Benutzer');
            break;
        case 2:
            $user["type"] = t('Organisator');
            break;
        case 3:
            $user["type"] = t('Superadmin');
            break;
    }
    return $user;
}
开发者ID:eistr2n,项目名称:lansuite,代码行数:26,代码来源:thread.php

示例7: update

 /** загрузка(сохранение/обновление) аватара
  * @param integer ID записи
  * @param boolean удалять предыдущий аватар
  * @return имя файла успешно загруженной аватары | false
  */
 function update($nRecordID, $bDeletePrevious = false, $bDoUpdateQuery = false)
 {
     global $oDb;
     if ($nRecordID && !empty($_FILES) && $_FILES[$this->input]['error'] == UPLOAD_ERR_OK) {
         $oUpload = new Upload($this->input, false);
         $aImageSize = getimagesize($_FILES[$this->input]['tmp_name']);
         if ($oUpload->isSuccessfull() && $aImageSize !== FALSE && in_array($aImageSize[2], array(IMAGETYPE_GIF, IMAGETYPE_JPEG, IMAGETYPE_PNG))) {
             if ($bDeletePrevious) {
                 $this->delete($nRecordID, false);
             }
             $sExtension = func::image_type_to_extension($aImageSize[2], false);
             $sFilename = Func::generateRandomName($this->filenameLetters, true, true) . '.' . $sExtension;
             //проверяем размер файла
             if (!$oUpload->checkSize($this->maxsize)) {
                 return false;
             }
             //создаем thumbnail
             $oThumb = new thumbnail($_FILES[$this->input]['tmp_name']);
             $oThumb->jpeg_quality(85);
             $oThumb->crop_proportionaly(1, 1, 'middle', 'center');
             $oThumb->createTumbnail_if_more_then($this->path . $nRecordID . '_' . $sFilename, $this->width, $this->height, true);
             @unlink($_FILES[$this->input]['tmp_name']);
             if ($bDoUpdateQuery) {
                 $oDb->execute("UPDATE {$this->table} \n                                   SET {$this->fieldAvatar} =" . $oDb->str2sql($sFilename) . "\n                                   WHERE {$this->fieldID} = {$nRecordID} ");
             }
             return $sFilename;
         }
     }
     return false;
 }
开发者ID:Sywooch,项目名称:dobox,代码行数:35,代码来源:avatar.php

示例8: getAsArray

		function getAsArray($names) {
			global $database, $db;
			
			$names = explode(',',$names);
			if (!$data = $db->queryAll('SELECT name, value FROM '.$database['prefix'].'ServiceSettings WHERE name IN ('.func::implode_string(',',$names).')',MYSQL_ASSOC))
				return false;
		
				
			$result = array();
		
			foreach($names as $name) {
		
				$result[trim($name)] = '';
			
			}

			foreach($data as $item) {
			
				$result[$item['name']] = $item['value'];
	
			}
		
				
			return $result;
		}
开发者ID:ncloud,项目名称:bloglounge,代码行数:25,代码来源:Bloglounge.Data.ServiceSettings.php

示例9: users

 function users()
 {
     if (!$this->haveAccessTo('ban')) {
         return $this->showAccessDenied();
     }
     $aData = array();
     if (Func::isPostMethod()) {
         if (Func::POST('action') == 'massdel') {
             $mBanID = func::POST('banid', false);
             $this->removeBan($mBanID);
         } else {
             $sMode = Func::POST('banmode');
             if (empty($sMode)) {
                 $sMode = 'ip';
             }
             $ban = func::POST('ban_' . $sMode, true);
             $nBanPeriod = func::POST('banlength', false, true);
             $nBanPeriodDate = func::POST('bandate', true);
             $nExclude = func::POST('exclude') ? 1 : 0;
             $sDescription = func::POST('description', true);
             $sReason = func::POST('reason', true);
             if (!empty($ban)) {
                 $this->createBan($sMode, $ban, $nBanPeriod, $nBanPeriodDate, $nExclude, $sDescription, $sReason);
                 $this->adminRedirect(Errors::SUCCESSFULL, 'users');
             }
         }
     }
     $aBanEndText = array(0 => 'бессрочно', 30 => '30 минут', 60 => '1 час', 360 => '6 часов', 1440 => '1 день', 10080 => '7 дней', 20160 => '2 недели', 40320 => '1 месяц');
     /*                                     
        `uid` int(11) unsigned NOT NULL default '0',
        `ip` varchar(40) NOT NULL default '',
        `email` varchar(100) NOT NULL default '',
        `started` int(11) unsigned NOT NULL default '0',
        `finished` int(11) unsigned NOT NULL default '0',
        `exclude` tinyint(1) unsigned NOT NULL default '0',
        `description` varchar(255) NOT NULL default '',
        `reason` varchar(255) NOT NULL default '',
        `status` tinyint(1) unsigned NOT NULL default '0',  
     */
     $aData['bans'] = $this->db->select('SELECT B.* 
                                    FROM ' . TABLE_USERS_BANLIST . ' B
                                    WHERE (B.finished >= ' . time() . ' OR B.finished = 0) 
                                    ORDER BY B.ip, B.email');
     foreach ($aData['bans'] as $key => &$ban) {
         $timeLength = $ban['finished'] ? ($ban['finished'] - $ban['started']) / 60 : 0;
         $ban['till'] = isset($aBanEndText[$timeLength]) ? $aBanEndText[$timeLength] : '';
         $ban['finished_formated'] = date('Y-m-d H:i:s', $ban['finished']);
         //0000-00-00 00:00:00
     }
     $this->tplAssign('aData', $aData);
     $this->adminCustomCenterArea();
     return $this->tplFetch('admin.listing.tpl');
 }
开发者ID:Sywooch,项目名称:dobox,代码行数:53,代码来源:ban.adm.class.php

示例10: group_edit

 function group_edit()
 {
     if (!FORDEV && !$this->manageNonSystemGroups) {
         return $this->showAccessDenied();
     }
     if (!$this->haveAccessTo('groups-edit')) {
         return $this->showAccessDenied();
     }
     $aData = array();
     if (!($nGroupID = $this->input->id())) {
         $this->adminRedirect(Errors::IMPOSSIBLE, 'group_listing');
     }
     $aGroupInfo = $this->getGroup($nGroupID);
     if ($aGroupInfo && $aGroupInfo['issystem'] && !FORDEV) {
         return $this->showAccessDenied();
     }
     if (func::isPostMethod()) {
         $this->input->postm(array('title' => TYPE_STR, 'keyword' => TYPE_STR, 'adminpanel' => TYPE_BOOL, 'color' => TYPE_STR, 'issystem' => TYPE_BOOL), $aData);
         if (!$aData['title']) {
             $this->errors->set('no_group_title');
         }
         if (empty($aData['keyword'])) {
             $this->errors->set('no_group_keyword');
         } else {
             $aData['keyword'] = mb_strtolower($aData['keyword']);
             if ($this->isGroupKeywordExists($aData['keyword'])) {
                 $this->errors->set('group_keyword_exists');
             }
         }
         if (empty($aData['color'])) {
             $aData['color'] = '#000';
         }
         if ($this->errors->no()) {
             $sQueryAdd = '';
             if (isset($aData['keyword']) && $aData['keyword']) {
                 $sQueryAdd .= ' keyword = ' . $this->db->str2sql($aData['keyword']) . ', ';
             }
             $this->db->execute('UPDATE ' . TABLE_USERS_GROUPS . '
                         SET title = ' . $this->db->str2sql($aData['title']) . ',
                             color = ' . $this->db->str2sql($aData['color']) . ',
                             adminpanel = ' . $aData['adminpanel'] . ',
                             ' . (FORDEV ? 'issystem = ' . $this->db->str2sql($aData['issystem']) . ', ' : '') . '
                             ' . $sQueryAdd . ' modified = ' . $this->db->getNOW() . '
                         WHERE group_id=' . $nGroupID);
             $this->adminRedirect(Errors::SUCCESSFULL, 'group_listing');
         }
     } else {
         $aData = $aGroupInfo;
     }
     $aData['deletable'] = !in_array($nGroupID, array(self::GROUPID_MEMBER, self::GROUPID_MODERATOR, self::GROUPID_SUPERADMIN));
     $this->tplAssign('aData', $aData);
     return $this->tplFetch('admin.group.form.tpl', PATH_CORE . 'modules/users/tpl/' . LANG_DEFAULT . '/');
 }
开发者ID:Sywooch,项目名称:dobox,代码行数:53,代码来源:users.adm.class.php

示例11: saveImageFileCustom

 /** 
  * Сохранение файла изображения
  * @param string путь для сохранения
  * @param integer ID объекта
  * @param array данные о загрузке   
  */
 function saveImageFileCustom($sPath, $nID, $aUploadData)
 {
     $sFilename = func::generator(12) . '.' . $aUploadData['ext'];
     $oThumb = new CThumbnail($aUploadData['tmp_name'], false);
     $aSave = array();
     $aSave[] = array('filename' => $sPath . $nID . 's' . $sFilename, 'width' => 74, 'height' => 74, 'autofit' => true, 'crop_h' => 'center', 'crop_v' => 'center', 'quality' => 90);
     $aSave[] = array('filename' => $sPath . $nID . 't' . $sFilename, 'width' => 102, 'height' => 102, 'autofit' => true, 'crop_h' => 'center', 'crop_v' => 'center', 'quality' => 90);
     $aSave[] = array('filename' => $sPath . $nID . $sFilename, 'width' => 600, 'height' => 480, 'autofit' => true, 'crop_h' => 'center', 'crop_v' => 'center', 'quality' => 90);
     if (!$oThumb->save($aSave)) {
         return false;
     }
     return $sFilename;
 }
开发者ID:Sywooch,项目名称:dobox,代码行数:19,代码来源:bbs.items.images.class.php

示例12: executeMainPageTrigger

 public function executeMainPageTrigger(sfWebRequest $request)
 {
     sfApplicationConfiguration::getActive()->loadHelpers(array('Partial'));
     $this->filename = 'error';
     $post = Doctrine::getTable('Post')->find(array($this->getRequestParameter('post_id')));
     $admin = sfGuardUser::getAdminUser();
     if ($admin && $admin->getProfile()->getUsecrossposting() && urldecode($this->getRequestParameter('login')) == $admin->getProfile()->getLjlogin() && urldecode($this->getRequestParameter('pass')) == $admin->getProfile()->getLjpassword() && $post != null) {
         if (!$post->getLj() && $post->getRating() >= sfConfig::get('app_post_mainpage_threshold')) {
             func::crossposting($admin->getProfile()->getLjlogin(), $admin->getProfile()->getLjpassword(), get_partial('post/post_lj', array('post' => $post, 'showUsername' => 1)), $post->getMoodNameI18N(), $post->getMoodSmile());
             $post->setLj(1);
             $post->save();
             $this->filename = 'ok';
         }
     }
     return $this->renderPartial('upload', array('filename' => $this->filename));
 }
开发者ID:auphau,项目名称:joyreactor,代码行数:16,代码来源:actions.class.php

示例13: FetchDataRow

function FetchDataRow($username)
{
    global $func, $dsp, $line;
    $html_image = '<img src="%s" alt="%s" border="0">';
    $avatar = func::chk_img_path($line['avatar_path']) ? sprintf($html_image, $line['avatar_path'], t('Avatar')) : '';
    if ($line['userid']) {
        $ret .= $dsp->FetchUserIcon($line['userid'], $username);
    } else {
        $ret = '<i>' . t('Gast') . '</i>';
    }
    $ret .= HTML_NEWLINE;
    $ret .= $func->unixstamp2date($line['date'], datetime) . HTML_NEWLINE;
    if ($avatar) {
        $ret .= $avatar . HTML_NEWLINE;
    }
    return $ret;
}
开发者ID:eistr2n,项目名称:lansuite,代码行数:17,代码来源:class_mastercomment.php

示例14: SendQueue

 static function SendQueue($sType, $aParams)
 {
     global $oDb;
     $time = time();
     switch ($sType) {
         case 'subscribe':
             $res = $oDb->execute('INSERT INTO ' . TABLE_ENOTIFY_SUBSCRIBE . ' (user_id, created) 
                         VALUES(' . $aParams['user_id'] . ', ' . $time . ') ');
             if (empty($res)) {
                 func::log('Ошибка sql-запроса CMail::SendQueue(' . $sType . ', uid=' . $aParams['user_id'] . '); ');
                 return false;
             }
             return true;
             break;
     }
     return false;
 }
开发者ID:Sywooch,项目名称:dobox,代码行数:17,代码来源:class.phpmailer.ex.php

示例15: detectLang

 public function detectLang()
 {
     $lng = !empty($_GET[LANG_VAR]) ? $_GET[LANG_VAR] : (!empty($_POST[LANG_VAR]) ? $_POST[LANG_VAR] : false);
     if ($lng) {
         //инициировали смену языка
         func::setCOOKIE(LANG_VAR, $lng);
     } else {
         $lng = isset($_COOKIE[LANG_VAR]) ? $_COOKIE[LANG_VAR] : false;
     }
     if (!$lng) {
         $lng = $this->defaultLanguage;
         func::setCOOKIE(LANG_VAR, $lng);
     }
     $this->currentLanguage = $lng;
     $this->detected = true;
     return $lng;
 }
开发者ID:Sywooch,项目名称:dobox,代码行数:17,代码来源:lang.php


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