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

PHP Phpfox_File类代码示例

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

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



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

示例1: process

 /**
  * Controller
  */
 public function process()
 {
     if (!$this->getParam('bIsValidImage')) {
         return false;
     }
     $aUser = $this->getParam('aUser');
     $aPhoto = $this->getParam('aPhoto');
     $bIsInPhoto = $this->getParam('is_in_photo');
     if ($aPhoto === null) {
         return false;
     }
     $sCategories = '';
     if (isset($aPhoto['categories']) && is_array($aPhoto['categories'])) {
         foreach ($aPhoto['categories'] as $aCategory) {
             $sCategories .= $aCategory[0] . ',';
         }
         $sCategories = rtrim($sCategories, ',');
     }
     $aInfo = array(Phpfox::getPhrase('photo.added') => '<span itemprop="dateCreated">' . Phpfox::getTime(Phpfox::getParam('photo.photo_image_details_time_stamp'), $aPhoto['time_stamp']) . '</span>', Phpfox::getPhrase('photo.category') => $sCategories, Phpfox::getPhrase('photo.file_size') => Phpfox_File::instance()->filesize($aPhoto['file_size']), Phpfox::getPhrase('photo.resolution') => $aPhoto['width'] . '×' . $aPhoto['height'], Phpfox::getPhrase('photo.comments') => $aPhoto['total_comment'], Phpfox::getPhrase('photo.views') => '<span itemprop="interactionCount">' . $aPhoto['total_view'] . '</span>', Phpfox::getPhrase('photo.rating') => round($aPhoto['total_rating']), Phpfox::getPhrase('photo.battle_wins') => round($aPhoto['total_battle']), Phpfox::getPhrase('photo.downloads') => $aPhoto['total_download']);
     if ($bIsInPhoto) {
         unset($aInfo[Phpfox::getPhrase('photo.added')]);
     }
     foreach ($aInfo as $sKey => $mValue) {
         if (empty($mValue)) {
             unset($aInfo[$sKey]);
         }
     }
     $this->template()->assign(array('sHeader' => Phpfox::getPhrase('photo.image_details'), 'aPhotoDetails' => $aInfo, 'bIsInPhoto' => $bIsInPhoto, 'sUrlPath' => preg_match("/\\{file\\/pic\\/(.*)\\/(.*)\\.jpg\\}/i", $aPhoto['destination'], $aMatches) ? Phpfox::getParam('core.path') . str_replace(array('{', '}'), '', $aMatches[0]) : ($aPhoto['server_id'] && Phpfox::getParam('core.allow_cdn') ? Phpfox::getLib('cdn')->getUrl(Phpfox::getParam('photo.url_photo') . sprintf($aPhoto['destination'], '_500'), $aPhoto['server_id']) : Phpfox::getParam('photo.url_photo') . sprintf($aPhoto['destination'], '_500'))));
     // return 'block';
 }
开发者ID:nima7r,项目名称:phpfox-dist,代码行数:33,代码来源:detail.class.php


示例2: process

 public function process()
 {
     $check = array();
     $unknown = array();
     if ($this->request()->get('check')) {
         $this->template()->assign('check', true);
         $lines = file(PHPFOX_DIR_INCLUDE . 'checksum/md5');
         foreach ($lines as $line) {
             $line = trim($line);
             $parts = explode(' ', $line);
             $check[trim($parts[1])] = true;
         }
         $files = Phpfox_File::instance()->getAllFiles(PHPFOX_DIR);
         foreach ($files as $file) {
             $file = str_replace(PHPFOX_DIR, '', $file);
             if (substr($file, -15) == 'server.sett.php' || substr($file, 0, 5) == 'file/' || substr($file, 0, 8) == 'install/' || $file == '.DS_Store' || $file == '.htaccess' || $file == 'include/setting/dev.sett.php') {
                 continue;
             }
             if (!isset($check[$file])) {
                 $unknown[] = $file;
             }
             // $check[str_replace(PHPFOX_DIR, '', $file)] = md5(file_get_contents($file));
             // echo $hash . " " . $file . "\n";
         }
     }
     $this->template()->setTitle('Checking Unknown Files')->setSectionTitle('Unknown Files')->assign(array('url' => $this->url()->makeUrl('admincp.checksum.unknown', ['check' => true]), 'unknown' => $unknown, 'total' => count($unknown)));
 }
开发者ID:lev1976g,项目名称:core,代码行数:27,代码来源:unknown.class.php


示例3: export

 public function export($sIso)
 {
     $aCountry = $this->database()->select('*')->from(Phpfox::getT('country'))->where('country_iso = \'' . $this->database()->escape($sIso) . '\'')->execute('getRow');
     if (!isset($aCountry['country_iso'])) {
         return false;
     }
     $aChildren = $this->database()->select('*')->from(Phpfox::getT('country_child'))->where('country_iso = \'' . $this->database()->escape($sIso) . '\'')->execute('getRows');
     if (!count($aChildren)) {
         return false;
     }
     $oXmlBuilder = Phpfox::getLib('xml.builder');
     $oXmlBuilder->addGroup('country');
     $oXmlBuilder->addGroup('info');
     $oXmlBuilder->addTag('iso', $aCountry['country_iso']);
     $oXmlBuilder->addTag('name', $aCountry['name']);
     $oXmlBuilder->closeGroup();
     if (count($aChildren)) {
         $oXmlBuilder->addGroup('children');
         foreach ($aChildren as $aChild) {
             $oXmlBuilder->addTag('child', $aChild['name']);
         }
         $oXmlBuilder->closeGroup();
     }
     $oXmlBuilder->closeGroup();
     $sCacheName = 'country_export_cache_' . md5($aCountry['country_iso'] . PHPFOX_TIME) . '.xml';
     Phpfox_File::instance()->writeToCache($sCacheName, $oXmlBuilder->output());
     return array('name' => $aCountry['country_iso'], 'file' => $sCacheName);
 }
开发者ID:nima7r,项目名称:phpfox-dist,代码行数:28,代码来源:country.class.php


示例4: set

 public function set($content)
 {
     $dir = $this->_theme->getPath() . 'html/';
     if (!is_dir($dir)) {
         mkdir($dir);
     }
     $path = $this->_theme->getPath() . 'html/layout.html';
     file_put_contents($path, $content);
     $twig = PHPFOX_DIR_FILE . 'cache/twig/';
     if (is_dir($twig)) {
         \Phpfox_File::instance()->delete_directory($twig);
     }
     /*
     if ($this->_get()) {
     	$this->db->update(':theme_template', [
     		'html_data' => $content,
     		'time_stamp_update' => PHPFOX_TIME
     	], [
     		'folder' => $this->_theme->folder, 'type_id' => 'theme', 'name' => 'layout.html'
     	]);
     
     	return true;
     }
     
     $this->db->insert(':theme_template', [
     	'folder' => $this->_theme->folder,
     	'type_id' => 'theme',
     	'name' => 'layout.html',
     	'html_data' => $content,
     	'html_data_original' => $content,
     	'time_stamp' => PHPFOX_TIME
     ]);
     */
     return true;
 }
开发者ID:lev1976g,项目名称:core,代码行数:35,代码来源:HTML.php


示例5: make

 /**
  * @param $val
  * @param null $files
  * @return Theme\Object
  */
 public function make($val, $files = null)
 {
     /*
     $check = $this->db->select('COUNT(*) AS total')
     	->from(':theme')
     	->where(['folder' => $val['folder']])
     	->get();
     
     if ($check['total']) {
     	throw error('Folder already exists.');
     }
     */
     $id = $this->db->insert(':theme', ['name' => $val['name'], 'website' => isset($val['extra']) ? $val['extra'] : null, 'created' => PHPFOX_TIME, 'is_active' => 1]);
     $this->db->update(':theme', ['folder' => $id], ['theme_id' => $id]);
     if ($files !== null) {
         foreach ($files as $name => $content) {
             $path = PHPFOX_DIR_SITE . 'themes/' . $id . '/' . $name;
             $parts = pathinfo($path);
             if (!is_dir($parts['dirname'])) {
                 mkdir($parts['dirname'], 0777, true);
             }
             file_put_contents($path, $content);
         }
         return $id;
     }
     $flavorId = $this->db->insert(':theme_style', ['theme_id' => $id, 'is_active' => 1, 'is_default' => 1, 'name' => 'Default']);
     $this->db->update(':theme_style', ['folder' => $flavorId], ['style_id' => $flavorId]);
     $File = \Phpfox_File::instance();
     $copy = [];
     $dirs = [];
     $files = $File->getAllFiles(PHPFOX_DIR . 'theme/default/');
     foreach ($files as $file) {
         if (!in_array($File->extension($file), ['html', 'js', 'css', 'less'])) {
             continue;
         }
         $parts = pathinfo($file);
         $dirs[] = str_replace(PHPFOX_DIR . 'theme/default/', '', $parts['dirname']);
         $copy[] = $file;
     }
     $path = PHPFOX_DIR_SITE . 'themes/' . $id . '/';
     foreach ($dirs as $dir) {
         if (!is_dir($path . $dir)) {
             mkdir($path . $dir, 0777, true);
         }
     }
     foreach ($copy as $file) {
         $newFile = $path . str_replace(PHPFOX_DIR . 'theme/default/', '', $file);
         if (in_array($File->extension($file), ['less', 'css'])) {
             $newFile = str_replace('default.' . $File->extension($file), $flavorId . '.' . $File->extension($file), $newFile);
         }
         copy($file, $newFile);
         if ($File->extension($file) == 'less') {
             $content = file_get_contents($newFile);
             $content = str_replace('../../../', '../../../../PF.Base/', $content);
             file_put_contents($newFile, $content);
         }
     }
     return $this->get($id);
 }
开发者ID:JerwinPRO,项目名称:phpfox,代码行数:64,代码来源:Theme.php


示例6: process

 /**
  * Controller
  */
 public function process()
 {
     $aUser = Phpfox::getService('user')->get(Phpfox::getUserId(), true);
     $aGroup = Phpfox::getService('user.group')->getGroup($aUser['user_group_id']);
     $aInfo = array(Phpfox::getPhrase('core.membership') => (empty($aGroup['icon_ext']) ? '' : '<img src="' . Phpfox::getParam('core.url_icon') . $aGroup['icon_ext'] . '" class="v_middle" alt="' . Phpfox_Locale::instance()->convert($aGroup['title']) . '" title="' . Phpfox_Locale::instance()->convert($aGroup['title']) . '" /> ') . $aGroup['prefix'] . Phpfox_Locale::instance()->convert($aGroup['title']) . $aGroup['suffix'], Phpfox::getPhrase('core.activity_points') => $aUser['activity_points'], Phpfox::getPhrase('core.profile_views') => $aUser['total_view'], Phpfox::getPhrase('core.space_used') => Phpfox::getUserParam('user.total_upload_space') === 0 ? Phpfox::getPhrase('user.space_total_out_of_unlimited', array('space_total' => Phpfox_File::instance()->filesize($aUser['space_total']))) : Phpfox::getPhrase('user.space_total_out_of_total', array('space_total' => Phpfox_File::instance()->filesize($aUser['space_total']), 'total' => Phpfox::getUserParam('user.total_upload_space'))), Phpfox::getPhrase('core.member_since') => Phpfox::getLib('date')->convertTime($aUser['joined'], 'core.profile_time_stamps'));
     if (Phpfox::isModule('rss')) {
         $aInfo[Phpfox::getPhrase('rss.rss_subscribers')] = '<a href="#" onclick="tb_show(\'' . Phpfox::getPhrase('rss.rss_subscribers_log') . '\', $.ajaxBox(\'rss.log\', \'height=500&amp;width=500\')); return false;">' . $aUser['rss_count'] . '</a>';
     }
     $this->template()->assign(array('aInfos' => $aInfo));
 }
开发者ID:nima7r,项目名称:phpfox-dist,代码行数:13,代码来源:info.class.php


示例7: add

 public function add()
 {
     /*
     @title
     @info Create a page. On success it will return information about the new page.
     @method POST
     @extra title=#{Title of the page|string|yes}&info=#{Information about the page|string|yes}&type_id=#{Parent category ID#. Use [action]page.categories[/action]|int|yes}&category_id=#{Sub-category ID#. Use [action]page.categories[/action]|int|yes}&image=#{Default avatar/logo for the page. Must be an HTTP path to an image|string|no}
     @return page_id=#{Page ID#|int}&profile_user_id=#{This is the profile user ID# for the page|int}&title=#{Title of the page|string}&likes=#{Total number of likes|int}&permalink=#{Link to the page|string}&info=#{Information about the page|string}&created_by=#{Person who created the page|string}&created_by_url=#{Profile link of the person who created the page|string}&photo_100px=#{Photo of the page. 100px|string}&photo_100px_square=#{Square photo of the page. 100px|string}
     */
     if ($this->_oApi->isAllowed('pages.add_page') == false) {
         return $this->_oApi->error('pages.add_page', 'Unable to create a page for this user.');
     }
     $aInsert = array('title' => $this->_oApi->get('title'), 'info' => $this->_oApi->get('info'), 'type_id' => $this->_oApi->get('type_id'), 'category_id' => $this->_oApi->get('category_id'));
     $iId = Phpfox::getService('pages.process')->add($aInsert);
     if (!$iId) {
         return $this->_oApi->error('pages.unable_to_add_page', implode('', Phpfox_Error::get()));
     }
     $aPages = $this->get($iId);
     if ($this->_oApi->get('image') != '') {
         $sType = $this->_oApi->get('image_type');
         $sImageContent = file_get_contents($this->_oApi->get('image'));
         $sImagePath = Phpfox::getParam('pages.dir_image') . $aPages[0]['page_id'] . '.' . $sType;
         $hFile = fopen($sImagePath, 'w');
         fwrite($hFile, $sImageContent);
         fclose($hFile);
         $_FILES['photo']['error'] = '';
         $_FILES['photo']['tmp_name'] = $sImagePath;
         $_FILES['photo']['name'] = $this->_oApi->get('photo_name');
         $oFile = Phpfox_File::instance();
         $oImage = Phpfox_Image::instance();
         $aImage = $oFile->load('photo', array('jpg', 'gif', 'png'), Phpfox::getUserParam('pages.max_upload_size_pages') === 0 ? null : Phpfox::getUserParam('pages.max_upload_size_pages') / 1024);
         $sFileName = $oFile->upload('photo', Phpfox::getParam('pages.dir_image'), $iId);
         $sPath = Phpfox::getParam('pages.dir_image');
         $iFileSizes = filesize(Phpfox::getParam('pages.dir_image') . sprintf($sFileName, ''));
         $aUpdate['image_path'] = $sFileName;
         $aUpdate['image_server_id'] = Phpfox_Request::instance()->getServer('PHPFOX_SERVER_ID');
         $iSize = 50;
         $oImage->createThumbnail(Phpfox::getParam('pages.dir_image') . sprintf($sFileName, ''), Phpfox::getParam('pages.dir_image') . sprintf($sFileName, '_' . $iSize), $iSize, $iSize);
         $iFileSizes += filesize(Phpfox::getParam('pages.dir_image') . sprintf($sFileName, '_' . $iSize));
         $iSize = 120;
         $oImage->createThumbnail(Phpfox::getParam('pages.dir_image') . sprintf($sFileName, ''), Phpfox::getParam('pages.dir_image') . sprintf($sFileName, '_' . $iSize), $iSize, $iSize);
         $iFileSizes += filesize(Phpfox::getParam('pages.dir_image') . sprintf($sFileName, '_' . $iSize));
         $iSize = 200;
         $oImage->createThumbnail(Phpfox::getParam('pages.dir_image') . sprintf($sFileName, ''), Phpfox::getParam('pages.dir_image') . sprintf($sFileName, '_' . $iSize), $iSize, $iSize);
         $iFileSizes += filesize(Phpfox::getParam('pages.dir_image') . sprintf($sFileName, '_' . $iSize));
         define('PHPFOX_PAGES_IS_IN_UPDATE', true);
         Phpfox::getService('user.process')->uploadImage($aPages[0]['profile_user_id'], true, Phpfox::getParam('pages.dir_image') . sprintf($sFileName, ''));
         // Update user space usage
         Phpfox::getService('user.space')->update(Phpfox::getUserId(), 'pages', $iFileSizes);
         $this->database()->update($this->_sTable, $aUpdate, 'page_id = ' . (int) $iId);
         $aPages = $this->get($iId);
     }
     return $aPages[0];
 }
开发者ID:nima7r,项目名称:phpfox-dist,代码行数:54,代码来源:api.class.php


示例8: add

 public function add($aVals, $iUpdateId = null)
 {
     $aForms = array('title' => array('message' => Phpfox::getPhrase('subscribe.provide_a_message_for_the_package'), 'type' => array('string:required')), 'description' => array('message' => Phpfox::getPhrase('subscribe.provide_a_description_for_the_package'), 'type' => 'string:required'), 'user_group_id' => array('message' => Phpfox::getPhrase('subscribe.provide_a_user_group_on_success'), 'type' => 'int:required'), 'fail_user_group' => array('message' => Phpfox::getPhrase('subscribe.provide_a_user_group_on_cancellation'), 'type' => 'int:required'), 'is_registration' => array('message' => Phpfox::getPhrase('subscribe.provide_if_the_package_should_be_added_to_the_registration_form'), 'type' => 'int:required'), 'is_active' => array('message' => Phpfox::getPhrase('subscribe.select_if_the_package_is_active_or_not'), 'type' => 'int:required'), 'cost' => array('message' => Phpfox::getPhrase('subscribe.provide_a_price_for_the_package'), 'type' => 'currency:required'), 'show_price' => array('type' => 'int:required'), 'background_color' => array('type' => 'string'));
     $bIsRecurring = false;
     if (isset($aVals['is_recurring']) && $aVals['is_recurring']) {
         $aForms['recurring_cost'] = array('message' => Phpfox::getPhrase('subscribe.provide_a_recurring_cost'), 'type' => 'currency:required');
         $aForms['recurring_period'] = array('message' => Phpfox::getPhrase('subscribe.provide_a_recurring_period'), 'type' => 'int:required');
         $bIsRecurring = true;
     }
     if ($iUpdateId !== null) {
         if (isset($aVals['is_recurring']) && !$aVals['is_recurring']) {
             $aCacheForm = $aVals;
         }
     }
     $aVals = $this->validator()->process($aForms, $aVals);
     if (!Phpfox_Error::isPassed()) {
         return false;
     }
     if ($iUpdateId !== null) {
         if (isset($aCacheForm['is_recurring']) && !$aCacheForm['is_recurring']) {
             $aVals['recurring_period'] = 0;
             $aVals['recurring_cost'] = null;
         }
     }
     $aVals['cost'] = serialize($aVals['cost']);
     if ($bIsRecurring) {
         $aVals['recurring_cost'] = serialize($aVals['recurring_cost']);
     }
     if (!empty($_FILES['image']['name'])) {
         $aImage = Phpfox_File::instance()->load('image', array('jpg', 'gif', 'png'));
         if ($aImage === false) {
             return false;
         }
     }
     $aVals['title'] = $this->preParse()->convert($aVals['title']);
     $aVals['description'] = $this->preParse()->convert($aVals['description']);
     $aVals['background_color'] = Phpfox::getLib('parse.input')->clean($aVals['background_color']);
     if ($iUpdateId !== null) {
         $iId = $iUpdateId;
         $this->database()->update($this->_sTable, $aVals, 'package_id = ' . (int) $iUpdateId);
     } else {
         $iLastOrderId = $this->database()->select('ordering')->from($this->_sTable)->order('ordering DESC')->execute('getSlaveField');
         $aVals['ordering'] = $iLastOrderId + 1;
         $iId = $this->database()->insert($this->_sTable, $aVals);
     }
     if (!empty($_FILES['image']['name']) && ($sFileName = Phpfox_File::instance()->upload('image', Phpfox::getParam('subscribe.dir_image'), $iId))) {
         $this->database()->update($this->_sTable, array('image_path' => $sFileName, 'server_id' => Phpfox_Request::instance()->getServer('PHPFOX_SERVER_ID')), 'package_id = ' . (int) $iId);
         Phpfox_Image::instance()->createThumbnail(Phpfox::getParam('subscribe.dir_image') . sprintf($sFileName, ''), Phpfox::getParam('subscribe.dir_image') . sprintf($sFileName, '_120'), 120, 120);
         unlink(Phpfox::getParam('subscribe.dir_image') . sprintf($sFileName, ''));
     }
     return $iId;
 }
开发者ID:lev1976g,项目名称:core,代码行数:52,代码来源:process.class.php


示例9: add

 public function add()
 {
     /*
     @title
     @info 
     @method POST
     @extra title=#{Title of the listing|string|yes}&currency_id=#{Currency ID. Use [action]core.getCurrencies[/action] to get a list of valid currencies|string|yes}&price=#{Price|decimal|no}&country_iso=#{Country ISO ID. Use [action]core.getCurrencies[/action]|string|no}&country_child_id=#{State/Province ID#. Use [action]core.getCurrencies[/action]|int|no}&postal_code=#{Postal code|string|no}&city=#{City|string|no}&mini_description=#{Mini description|string|yes}&description=#{Description|string|yes}&category=#{Comma separated category ID#'s. Use [action]marketplace.categories[/action]|string|yes}&images=#{Comma separated URL to images|string|no}  
     @return id=#{Item ID#|int}&title=#{Title of the item|string}&description=#{Description of the item|string}&likes=#{Total number of likes|int}&permalink=#{Link to the item|string}&mini_description=#{Mini description of the listing|string}&currency_id=#{Currency ID|string}&price=#{Price|decimal}&country_iso=#{Country ISO|string}&postal_code=#{Postal code|string}&city=#{City|string}&images=#{Array of images|array}
     */
     $aCategories = array();
     if ($this->_oApi->get('category')) {
         $aCategories = explode(',', $this->_oApi->get('category'));
     }
     $aVals = array('title' => $this->_oApi->get('title'), 'currency_id' => $this->_oApi->get('currency_id'), 'price' => $this->_oApi->get('price'), 'country_iso' => $this->_oApi->get('country_iso'), 'country_child_id' => $this->_oApi->get('country_child_id'), 'postal_code' => $this->_oApi->get('postal_code'), 'city' => $this->_oApi->get('city'), 'mini_description' => $this->_oApi->get('mini_description'), 'description' => $this->_oApi->get('description'), 'category' => (array) $aCategories);
     if (($iId = Phpfox::getService('marketplace.process')->add($aVals)) !== false) {
         if ($this->_oApi->get('images') != '') {
             $oImage = Phpfox_Image::instance();
             $oFile = Phpfox_File::instance();
             $aSizes = array(50, 120, 200, 400);
             $iFileSizes = 0;
             foreach (explode(',', $this->_oApi->get('images')) as $sImage) {
                 $sType = $oFile->getFileExt($sImage);
                 $sImageContent = file_get_contents($sImage);
                 $sImagePath = Phpfox::getParam('marketplace.dir_image') . $iId . '.' . $sType;
                 $hFile = fopen($sImagePath, 'w');
                 fwrite($hFile, $sImageContent);
                 fclose($hFile);
                 $_FILES['photo']['error'] = '';
                 $_FILES['photo']['tmp_name'] = $sImagePath;
                 $_FILES['photo']['name'] = basename($sImagePath);
                 if ($aImage = $oFile->load('photo', array('jpg', 'gif', 'png'), Phpfox::getUserParam('marketplace.max_upload_size_listing') === 0 ? null : Phpfox::getUserParam('marketplace.max_upload_size_listing') / 1024)) {
                     $sFileName = Phpfox_File::instance()->upload('photo', Phpfox::getParam('marketplace.dir_image'), $iId);
                     $iFileSizes += filesize(Phpfox::getParam('marketplace.dir_image') . sprintf($sFileName, ''));
                     $this->database()->insert(Phpfox::getT('marketplace_image'), array('listing_id' => $iId, 'image_path' => $sFileName, 'server_id' => Phpfox_Request::instance()->getServer('PHPFOX_SERVER_ID')));
                     foreach ($aSizes as $iSize) {
                         $oImage->createThumbnail(Phpfox::getParam('marketplace.dir_image') . sprintf($sFileName, ''), Phpfox::getParam('marketplace.dir_image') . sprintf($sFileName, '_' . $iSize), $iSize, $iSize);
                         $oImage->createThumbnail(Phpfox::getParam('marketplace.dir_image') . sprintf($sFileName, ''), Phpfox::getParam('marketplace.dir_image') . sprintf($sFileName, '_' . $iSize . '_square'), $iSize, $iSize, false);
                         $iFileSizes += filesize(Phpfox::getParam('marketplace.dir_image') . sprintf($sFileName, '_' . $iSize));
                     }
                 }
             }
             if ($iFileSizes === 0) {
                 return false;
             }
             $this->database()->update($this->_sTable, array('image_path' => $sFileName, 'server_id' => Phpfox_Request::instance()->getServer('PHPFOX_SERVER_ID')), 'listing_id = ' . $iId);
             Phpfox::getService('user.space')->update(Phpfox::getUserId(), 'marketplace', $iFileSizes);
         }
         $aReturn = $this->get($iId);
         return $aReturn[0];
     }
 }
开发者ID:nima7r,项目名称:phpfox-dist,代码行数:51,代码来源:api.class.php


示例10: isAllowedToUpload

 public function isAllowedToUpload($iUserId, $iUploaded = null)
 {
     $this->_build($iUserId);
     if ($this->_iTotalUploadSpace === 0) {
         return true;
     }
     if ($this->_iTotalSpaceUsed > $this->_iTotalUploadSpace) {
         return Phpfox_Error::set(Phpfox::getPhrase('user.unable_to_upload_you_have_reached_your_limit_of_current_you_are_currently_using_total', array('current' => Phpfox_File::instance()->filesize($this->_iTotalUploadSpace), 'total' => Phpfox_File::instance()->filesize($this->_iTotalSpaceUsed))));
     }
     if ($iUploaded !== null && $this->_iTotalSpaceUsed + $iUploaded > $this->_iTotalUploadSpace) {
         return Phpfox_Error::set(Phpfox::getPhrase('user.unable_to_upload_you_have_reached_your_limit_of_limit_with_this_upload_you_will_be_using_total', array('limit' => Phpfox_File::instance()->filesize($this->_iTotalUploadSpace), 'total' => Phpfox_File::instance()->filesize($this->_iTotalSpaceUsed + $iUploaded))));
     }
     return true;
 }
开发者ID:lev1976g,项目名称:core,代码行数:14,代码来源:space.class.php


示例11: download

 /**
  * Method used to compress data and then send it to the user to download on the spot.
  *
  * @param string $sName Name of the archive
  * @param string $sExt File extension of the archive (zip, tar.gz, xml)
  * @param string $sFolder Folder to compress. Must be located within the "file/cache/" folder.
  * @return bool Only returns false if we were unable to compress the data
  */
 public function download($sName, $sExt, $sFolder, $iServerId = 0)
 {
     if (!($sNewFile = Phpfox::getLib('phpfox.archive', $sExt)->compress($sName, $sFolder))) {
         return false;
     }
     if (Phpfox::getParam('core.allow_cdn')) {
         Phpfox::getLib('cdn')->put($sNewFile);
     }
     if (is_dir(PHPFOX_DIR_CACHE . $sFolder . PHPFOX_DS)) {
         Phpfox_File::instance()->delete_directory(PHPFOX_DIR_CACHE . $sFolder . PHPFOX_DS);
     }
     ($sPlugin = Phpfox_Plugin::get('archive_export_download')) ? eval($sPlugin) : false;
     // Phpfox::getlib('phpfox.file')->forceDownload($sNewFile, $sName . '.' . $sExt);
     Phpfox::getlib('phpfox.file')->forceDownload($sNewFile, $sName . '.' . $sExt, '', '', $iServerId);
 }
开发者ID:nima7r,项目名称:phpfox-dist,代码行数:23,代码来源:export.class.php


示例12: process

 /**
  * Controller
  */
 public function process()
 {
     if (!Phpfox::isModule('ad')) {
         return false;
     }
     if (defined('PHPFOX_IS_GROUP_VIEW') || defined('PHPFOX_IS_PAGES_VIEW') || defined('PHPFOX_IS_USER_PROFILE')) {
         return false;
     }
     $aSponsorPhoto = Phpfox::getService('photo')->getRandomSponsored();
     if (empty($aSponsorPhoto)) {
         return false;
     }
     Phpfox::getService('ad.process')->addSponsorViewsCount($aSponsorPhoto['sponsor_id'], 'photo');
     $aSponsorPhoto['details'] = array(Phpfox::getPhrase('photo.submitted') => Phpfox::getTime(Phpfox::getParam('photo.photo_image_details_time_stamp'), $aSponsorPhoto['time_stamp']), Phpfox::getPhrase('photo.file_size') => Phpfox_File::instance()->filesize($aSponsorPhoto['file_size']), Phpfox::getPhrase('photo.resolution') => $aSponsorPhoto['width'] . '×' . $aSponsorPhoto['height'], Phpfox::getPhrase('photo.views') => $aSponsorPhoto['total_view']);
     $this->template()->assign(array('aSponsorPhoto' => $aSponsorPhoto, 'sHeader' => Phpfox::getPhrase('photo.sponsored_photo'), 'aFooter' => array(Phpfox::getPhrase('photo.encourage_sponsor') => $this->url()->makeUrl('profile.photo', array('sponsor' => '1')))));
     return 'block';
 }
开发者ID:lev1976g,项目名称:core,代码行数:20,代码来源:sponsored.class.php


示例13: process

 /**
  * Controller
  */
 public function process()
 {
     $iId = $this->request()->get('id');
     $aRow = Phpfox::getService('attachment')->getForDownload($iId);
     if (!isset($aRow['destination'])) {
         return Phpfox_Error::display(Phpfox::getPhrase('attachment.no_such_download_found'));
     }
     $sPath = Phpfox::getParam('core.dir_attachment') . sprintf($aRow['destination'], '');
     if (Phpfox::hasCallback($aRow['category_id'], 'attachmentControl')) {
         $bAllowed = Phpfox::callback($aRow['category_id'] . '.attachmentControl', $aRow['item_id']);
         if ($bAllowed == false) {
             return Phpfox_Error::display(Phpfox::getPhrase('attachment.you_are_not_allowed_to_download_this_attachment'));
         }
     }
     Phpfox::getService('attachment.process')->updateCounter($aRow['attachment_id']);
     Phpfox_File::instance()->forceDownload($sPath, $aRow['file_name'], $aRow['mime_type'], $aRow['file_size'], $aRow['server_id']);
     exit;
 }
开发者ID:lev1976g,项目名称:core,代码行数:21,代码来源:download.class.php


示例14: init

 /**
  * Start the session.
  *
  * @return mixed NULL if no errors, however FALSE if session cannot start.
  */
 public function init()
 {
     session_set_save_handler(array($this, 'open'), array($this, 'close'), array($this, 'read'), array($this, 'write'), array($this, 'destroy'), array($this, 'gc'));
     if (PHPFOX_SAFE_MODE) {
         $this->_sSavePath = PHPFOX_DIR_CACHE;
     } else {
         $sSessionSavePath = PHPFOX_OPEN_BASE_DIR ? PHPFOX_DIR_FILE . 'session' . PHPFOX_DS : session_save_path();
         if (empty($sSessionSavePath) || !empty($sSessionSavePath) && !Phpfox_File::instance()->isWritable($sSessionSavePath)) {
             $this->_sSavePath = rtrim(Phpfox_File::instance()->getTempDir(), PHPFOX_DS) . PHPFOX_DS;
         } else {
             $this->_sSavePath = rtrim($sSessionSavePath, PHPFOX_DS) . PHPFOX_DS;
         }
     }
     if (!Phpfox_File::instance()->isWritable($this->_sSavePath)) {
         return Phpfox_Error::trigger('Session path is not wriable: ' . $this->_sSavePath, E_USER_ERROR);
     }
     if (!isset($_SESSION)) {
         session_start();
     }
 }
开发者ID:lev1976g,项目名称:core,代码行数:25,代码来源:file.class.php


示例15: compress

 /**
  * Compress data into the archive
  *
  * @param string $sFile Name of the ZIP file
  * @param string $sFolder Name of the folder we are going to compress. Must be located within the "file/cache/" folder.
  * @return mixed Returns the full path to the newly created ZIP file.
  */
 public function compress($sFile, $sFolder)
 {
     // Create random ZIP
     $sArchive = PHPFOX_DIR_CACHE . md5((is_array($sFile) ? serialize($sFile) : $sFile) . Phpfox::getParam('core.salt') . PHPFOX_TIME) . '.zip';
     chdir(PHPFOX_DIR_CACHE . $sFolder . PHPFOX_DS);
     if (is_object($this->_oZip)) {
         if ($this->_oZip->open($sArchive, ZipArchive::CREATE)) {
             $aFiles = Phpfox_File::instance()->getAllFiles(PHPFOX_DIR_CACHE . $sFolder . PHPFOX_DS);
             foreach ($aFiles as $sNewFile) {
                 $sNewFile = str_replace(PHPFOX_DIR_CACHE . $sFolder . PHPFOX_DS, '', $sNewFile);
                 $this->_oZip->addFile($sNewFile);
             }
             $this->_oZip->close();
         }
     } else {
         shell_exec(Phpfox::getParam('core.zip_path') . ' -r ' . escapeshellarg($sArchive) . ' ./');
     }
     chdir(PHPFOX_DIR);
     return $sArchive;
 }
开发者ID:nima7r,项目名称:phpfox-dist,代码行数:27,代码来源:zip.class.php


示例16: get

 public function get()
 {
     $oFile = Phpfox_File::instance();
     $bSlaveEnabled = Phpfox::getParam(array('db', 'slave'));
     $sDriver = Phpfox::getParam(array('db', 'driver'));
     $aStats = array(Phpfox::getPhrase('admincp.phpfox_version') => PhpFox::getVersion() . '<i>(build ' . Phpfox::getBuild() . ')</i>', Phpfox::getPhrase('admincp.php_version') => '<a href="' . Phpfox_Url::instance()->makeUrl('admincp.core.phpinfo') . '">' . PHP_VERSION . '</a>', Phpfox::getPhrase('admincp.php_sapi') => php_sapi_name(), Phpfox::getPhrase('admincp.php_safe_mode') => PHPFOX_SAFE_MODE ? Phpfox::getPhrase('admincp.true') : Phpfox::getPhrase('admincp.false'), Phpfox::getPhrase('admincp.php_open_basedir') => PHPFOX_OPEN_BASE_DIR ? Phpfox::getPhrase('admincp.true') : Phpfox::getPhrase('admincp.false'), Phpfox::getPhrase('admincp.php_disabled_functions') => @ini_get('disable_functions') ? str_replace(",", ", ", @ini_get('disable_functions')) : Phpfox::getPhrase('admincp.none'), Phpfox::getPhrase('admincp.php_loaded_extensions') => implode(' ', get_loaded_extensions()), Phpfox::getPhrase('admincp.operating_system') => PHP_OS, Phpfox::getPhrase('admincp.server_time_stamp') => date('F j, Y, g:i a', PHPFOX_TIME) . ' (GMT)', Phpfox::getPhrase('admincp.gzip') => Phpfox::getParam('core.use_gzip') ? Phpfox::getPhrase('admincp.enabled') : Phpfox::getPhrase('admincp.disabled'), Phpfox::getPhrase('admincp.sql_driver_version') => $sDriver == 'DATABASE_DRIVER' ? Phpfox::getPhrase('admincp.n_a') : Phpfox_Database::instance()->getServerInfo(), Phpfox::getPhrase('admincp.sql_slave_enabled') => $bSlaveEnabled ? Phpfox::getPhrase('admincp.yes') : Phpfox::getPhrase('admincp.no'), Phpfox::getPhrase('admincp.sql_total_slaves') => $bSlaveEnabled ? count(Phpfox::getParam(array('db', 'slave_servers'))) : Phpfox::getPhrase('admincp.n_a'), Phpfox::getPhrase('admincp.sql_slave_server') => $bSlaveEnabled ? Phpfox_Database::instance()->sSlaveServer : Phpfox::getPhrase('admincp.n_a'), Phpfox::getPhrase('admincp.memory_limit') => $oFile->filesize($this->_getUsableMemory()) . ' (' . @ini_get('memory_limit') . ')', Phpfox::getPhrase('admincp.load_balancing_enabled') => Phpfox::getParam(array('balancer', 'enabled')) ? Phpfox::getPhrase('admincp.yes') : Phpfox::getPhrase('admincp.no'));
     if (strpos(strtolower(PHP_OS), 'win') === 0 || PHPFOX_SAFE_MODE || PHPFOX_OPEN_BASE_DIR) {
     } else {
         if (function_exists('shell_exec')) {
             $sMemory = @shell_exec("free -m");
             $aMemory = explode("\n", str_replace("\r", "", $sMemory));
             if (is_array($aMemory)) {
                 $aMemory = array_slice($aMemory, 1, 1);
                 if (isset($aMemory[0])) {
                     $aMemory = preg_split("#\\s+#", $aMemory[0]);
                     $aStats[Phpfox::getPhrase('admincp.total_server_memory')] = isset($aMemory[1]) ? $aMemory[1] . ' MB' : '--';
                     $aStats[Phpfox::getPhrase('admincp.available_server_memory')] = isset($aMemory[3]) ? $aMemory[3] . ' MB' : '--';
                 }
             }
         } else {
             if (stristr(PHP_OS, "win") === false) {
                 $sMemory = file_get_contents('/proc/meminfo');
                 $aMemoryStats = explode("n", $sMemory);
                 // escape the "new line"
                 $aMem = null;
                 foreach ($aMemoryStats as $iKey => $sMemoryStat) {
                     $aMemoryStats[$iKey] = preg_replace('/s+/', ' ', $sMemoryStat);
                     if (preg_match('/[0-9]+/', $sMemoryStat, $aMem)) {
                         $aMemoryStats[$iKey] = $aMem[0] / 1024;
                     }
                 }
                 $aStats[Phpfox::getPhrase('admincp.total_server_memory')] = (int) $aMemoryStats[0] . ' MB';
                 $aStats[Phpfox::getPhrase('admincp.available_server_memory')] = (int) $aMemoryStats[1] . ' MB';
             }
         }
     }
     if (!PHPFOX_OPEN_BASE_DIR && ($sLoad = Phpfox::getService('core.load')->get()) !== null) {
         $aStats[Phpfox::getPhrase('admincp.current_server_load')] = $sLoad;
     }
     return $aStats;
 }
开发者ID:nima7r,项目名称:phpfox-dist,代码行数:41,代码来源:system.class.php


示例17: process

 /**
  * Controller
  */
 public function process()
 {
     $this->_setMenuName('admincp.theme');
     $aStyle = Theme_Service_Style_Style::instance()->getStyle($this->request()->getInt('id'));
     if (!isset($aStyle['theme_id'])) {
         return Phpfox_Error::display(Phpfox::getPhrase('theme.not_a_valid_style'));
     }
     if ($this->request()->get('revert')) {
         if (Theme_Service_Style_Process::instance()->revertLogo($aStyle['style_id'])) {
             $this->url()->send('admincp.theme.style.logo', array('id' => $aStyle['style_id']), Phpfox::getPhrase('theme.logo_successfully_reverted'));
         }
     }
     if (!empty($_FILES['logo'])) {
         $aImage = Phpfox_File::instance()->load('logo', array('jpg', 'gif', 'png'));
         if (isset($aImage['tmp_name']) && Theme_Service_Style_Process::instance()->changeLogo($aStyle['style_id'], $aImage, $this->request()->get('resize') == '1' ? true : false)) {
             $this->url()->send('admincp.theme.style.logo', array('id' => $aStyle['style_id']), Phpfox::getPhrase('theme.logo_successfully_uploaded'));
         }
     }
     list($sCurrentStyleLogo, $bIsNewLogo, $iWidth, $iHeight) = Theme_Service_Style_Style::instance()->getCurrentLogo($aStyle['style_id']);
     $this->template()->setTitle(Phpfox::getPhrase('theme.change_site_logo'))->setBreadcrumb(Phpfox::getPhrase('theme.themes'), $this->url()->makeUrl('admincp.theme'))->setBreadcrumb($aStyle['theme_name'], $this->url()->makeUrl('admincp.theme'))->setBreadcrumb(Phpfox::getPhrase('theme.styles'), $this->url()->makeUrl('admincp.theme.style', array('id' => $aStyle['theme_id'])))->setBreadcrumb($aStyle['name'], $this->url()->makeUrl('admincp.theme.style', array('id' => $aStyle['theme_id'])))->setBreadcrumb(Phpfox::getPhrase('theme.change_logo'), null, true)->assign(array('aStyle' => $aStyle, 'sCurrentStyleLogo' => $sCurrentStyleLogo, 'bIsNewLogo' => $bIsNewLogo, 'iWidth' => 100, 'iHeight' => 100));
 }
开发者ID:nima7r,项目名称:phpfox-dist,代码行数:24,代码来源:logo.class.php


示例18: process

 /**
  * Controller
  */
 public function process()
 {
     Phpfox::getUserParam('photo.can_view_photos', true);
     // Make sure the user group can download this photo
     Phpfox::getUserParam('photo.can_download_user_photos', true);
     // Check if we want to download a specific photo size
     $iDownloadSize = $this->request()->get('size');
     // Get photo array
     $aPhoto = $this->getParam('aPhoto');
     if (!$aPhoto['allow_download']) {
         return Phpfox_Error::display(Phpfox::getPhrase('photo.not_allowed_to_download_this_image'));
     }
     // Prepare the image path
     $sPath = Phpfox::getParam('photo.dir_photo') . sprintf($aPhoto['original_destination'], is_numeric($iDownloadSize) ? '_' . $iDownloadSize : '');
     // Increment the download counter
     Phpfox::getService('photo.process')->updateCounter($aPhoto['photo_id'], 'total_download');
     // Download the photo
     Phpfox_File::instance()->forceDownload($sPath, $aPhoto['file_name'], $aPhoto['mime_type'], $aPhoto['file_size'], $aPhoto['server_id']);
     // We are done, lets get out of here
     exit;
 }
开发者ID:nima7r,项目名称:phpfox-dist,代码行数:24,代码来源:download.class.php


示例19: process

 /**
  * Controller
  */
 public function process()
 {
     if (!Phpfox::isUser()) {
         exit;
     }
     $aImage = Phpfox_File::instance()->load('image', array('jpg', 'gif', 'png'));
     if ($aImage === f 

鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP Phpfox_Locale类代码示例发布时间:2022-05-23
下一篇:
PHP Phpfox_Error类代码示例发布时间: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