• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP func类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: createMap

		function createMap() {
			global $database, $db;

			func::mkpath($this->cacheDir);
			if (!is_dir($this->cacheDir) || !is_writable($this->cacheDir))
				return false;

			requireComponent('LZ.PHP.XMLStruct');
			requireComponent('LZ.PHP.XMLWriter');

			$case = array();
			$program = array();

			$xmls = new XMLStruct;

			$db->query("SELECT domain, program FROM {$database['prefix']}Exports WHERE status='on' ORDER BY id ASC"); // 활성화 된 플러그인 목록
			while ($data = $db->fetch()) {
				if (!$xmls->openFile(ROOT . '/exports/'. $data->program . '/index.xml')) continue;
				for ($i=1; $func=$xmls->getValue("/export/binding/listener[$i]"); $i++) {
					$action = $xmls->getAttribute("/export/binding/listener[$i]", 'action');
					if (!isset($case[$data->domain])) $case[$data->domain] = array();
					if (!isset($program[$data->domain])) $program[$data->domain] = $data->program;
					array_push($case[$data->domain], array("program"=>$data->program, "action"=> $action, "listener"=>$func));
				}
			}

			// bloglounge 

			$xml = new XMLFile($this->cacheDir.'/export_1.xml.php');
			$xml->startGroup('map');
			foreach ($case as $domain=>$binders) {
				$xml->startGroup('event', array('domain'=>$domain, 'program'=>$program[$domain]));
				foreach ($binders as $bind) {
					$xml->write('bind', $bind['listener'], false, array('action'=>$bind['action']));
				}
				$xml->endGroup();
			}
			
			$xml->endAllGroups();
			$xml->close();	

			return true;
		}
开发者ID:ncloud,项目名称:bloglounge,代码行数:43,代码来源:Bloglounge.Model.Exports.php


示例17: write

 function write()
 {
     if (bff::$isAjax) {
         $nUserID = $this->security->getUserID();
         $p = $this->input->postm(array('email' => TYPE_STR, 'phone' => TYPE_NOHTML, 'message' => TYPE_NOHTML, 'captcha' => TYPE_STR));
         if (!$nUserID) {
             if (empty($p['email']) || !Func::IsEmailAddress($p['email'])) {
                 $this->errors->set('wrong_email');
             }
         }
         $p['phone'] = func::cleanComment($p['phone']);
         if (empty($p['phone'])) {
             $this->errors->set('no_phone');
         }
         $p['message'] = func::cleanComment($p['message']);
         if (empty($p['message'])) {
             $this->errors->set('no_message');
         }
         if (!$nUserID) {
             $oProtection = new CCaptchaProtection();
             if (!$oProtection->valid(isset($_SESSION['c2']) ? $_SESSION['c2'] : '', $p['captcha'])) {
                 $this->errors->set('wrong_captcha');
             }
         }
         if ($this->errors->no()) {
             unset($_SESSION['c2']);
             $this->db->execute('INSERT INTO ' . TABLE_CONTACTS . ' (user_id, email, phone, message, created) 
                            VALUES (' . $nUserID . ', ' . $this->db->str2sql($p['email']) . ', 
                                    ' . $this->db->str2sql($p['phone']) . ', ' . $this->db->str2sql(nl2br($p['message'])) . ', 
                                    ' . $this->db->getNOW() . ')');
             $nRecordID = $this->db->insert_id(TABLE_CONTACTS, 'id');
             if ($nRecordID) {
                 config::saveCount('contacts_new', 1);
                 bff::sendMailTemplate(array('user' => !$nUserID ? 'Аноним' : $this->security->getUserEmail(), 'email' => !$nUserID ? $p['email'] : $this->security->getUserEmail(), 'phone' => $p['phone'], 'message' => nl2br($p['message'])), 'admin_contacts', config::get('mail_admin', BFF_EMAIL_SUPPORT));
             }
         }
         $this->ajaxResponse(Errors::SUCCESS);
     }
     config::set('title', 'Связь с редактором - ' . config::get('title', ''));
     return $this->tplFetch('write.tpl');
 }
开发者ID:Sywooch,项目名称:dobox,代码行数:41,代码来源:contacts.class.php


示例18: show

 function show($nPageID = null)
 {
     $nRecordID = !isset($nPageID) ? func::POSTGET('page') : (int) $nPageID;
     $aData = $this->db->one_array('SELECT title, mkeywords, mdescription, filename 
                               FROM ' . TABLE_PAGES . ' 
                               WHERE filename = ' . $this->db->str2sql($nRecordID) . ' 
                               LIMIT 1');
     if (empty($aData)) {
         Errors::httpError(404);
     }
     //get page content
     $aData['content'] = CDir::getFileContent(PAGES_PATH . $aData['filename'] . PAGES_EXTENSION);
     config::set(array('title' => $aData['title'] . ' | ' . config::get('title', ''), 'mkeywords' => $aData['mkeywords'], 'mdescription' => $aData['mdescription']));
     if ($aData['content'] === false) {
         Errors::httpError(404);
     }
     $aData['menu'] = bff::i()->Sitemap_getmenu('info', 'all-sub');
     // echo '<pre>', print_r($aData['menu'], true), '</pre>'; exit;
     $this->tplAssign('aData', $aData);
     return $this->tplFetch('page.tpl');
 }
开发者ID:Sywooch,项目名称:dobox,代码行数:21,代码来源:pages.class.php


示例19: 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);
             $bFileMoved = false;
             foreach ($this->sizes as $s) {
                 if (!empty($s['original'])) {
                     $oUpload->save($this->path, $nRecordID . '_' . $s['p'] . $sFilename, false, false);
                     $bFileMoved = true;
                     break;
                 }
                 $oThumb->createTumbnail_if_more_then($this->path . $nRecordID . '_' . $s['p'] . $sFilename, $s['w'], $s['h'], isset($s['autofit']) ? $s['autofit'] : true);
             }
             if (!$bFileMoved) {
                 @unlink($_FILES[$this->input]['tmp_name']);
             }
             if ($bDoUpdateQuery) {
                 $oDb->execute("UPDATE {$this->table} \n                                   SET {$this->fieldPreview} =" . $oDb->str2sql($sFilename) . "\n                                   WHERE {$this->fieldID} = {$nRecordID}");
             }
             return $sFilename;
         }
     }
     return false;
 }
开发者ID:Sywooch,项目名称:dobox,代码行数:44,代码来源:preview.php


示例20: getBBSCategories

 function getBBSCategories($aSelectedID = array(), $bOptions = false)
 {
     if (!is_array($aSelectedID)) {
         $aSelectedID = array($aSelectedID);
     }
     bff::i()->GetModule('bbs');
     $aCats = $this->db->select('SELECT id, title, 0 as disabled FROM ' . TABLE_BBS_CATEGORIES . ' WHERE numlevel=1 ORDER BY numleft');
     if ($bOptions) {
         $sOptions = '';
         array_unshift($aCats, array('id' => 0, 'title' => 'любой', 'disabled' => 0), array('id' => -2, 'title' => '------------------------', 'disabled' => 1), array('id' => 1, 'title' => 'Все разделы сайта', 'disabled' => 0));
         foreach ($aCats as $v) {
             $sOptions .= '<option value="' . $v['id'] . '" class="' . ($v['id'] == 0 || $v['id'] == 1 ? 'bold' : '') . '" ' . ($v['id'] == -2 ? 'disabled' : '') . ' ' . (in_array($v['id'], $aSelectedID) ? ' selected="selected"' : '') . '>' . $v['title'] . '</option>';
         }
     } else {
         array_unshift($aCats, array('id' => 1, 'title' => 'Все разделы сайта'));
         $sCheckbox = '';
         foreach ($aCats as $v) {
             $sCheckbox .= '<label><input type="checkbox" name="cat[]" class="catcheck ' . ($v['id'] == 1 ? 'all bold' : 'cat') . '" value="' . $v['id'] . '"' . (in_array($v['id'], $aSelectedID) ? ' checked="checked"' : '') . '/> ' . $v['title'] . '</label><br/>';
         }
     }
     $aCats = func::array_transparent($aCats, 'id', true);
     return array('cats' => $aCats, 'options' => !empty($sOptions) ? $sOptions : '', 'checks' => !empty($sCheckbox) ? $sCheckbox : '');
 }
开发者ID:Sywooch,项目名称:dobox,代码行数:23,代码来源:banners.bl.class.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP funciones类代码示例发布时间:2022-05-23
下一篇:
PHP fs_var类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap