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


PHP Phpfox_File::instance方法代码示例

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


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


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