コード例 #1
0
ファイル: Notify.class.php プロジェクト: AntiqS/altocms
 protected function _getTemplatePathByPlugin($sName, $xPlugin, $sSubDir)
 {
     $sSavedSubDir = $this->sDir;
     $this->sDir = $sSubDir;
     $sFileName = parent::GetTemplatePath($sName, $xPlugin);
     $this->sDir = $sSavedSubDir;
     $sResult = $sFileName;
     if (!F::File_Exists($sFileName)) {
         if (strpos(basename($sFileName), 'email.notify.') === 0) {
             if (F::File_Exists($sFileName = str_replace('email.notify.', 'notify.', $sFileName))) {
                 $sResult = $sFileName;
             } elseif (F::File_Exists($sFileName = str_replace('email.notify.', 'email.', $sFileName))) {
                 $sResult = $sFileName;
             } elseif (F::File_Exists($sFileName = str_replace('email.notify.', '', $sFileName))) {
                 $sResult = $sFileName;
             }
         } elseif (strpos(basename($sFileName), 'notify.notify.') === 0) {
             if (F::File_Exists($sFileName = str_replace('notify.notify.', 'notify.', $sFileName))) {
                 $sResult = $sFileName;
             } elseif (F::File_Exists($sFileName = str_replace('notify.notify.', 'email.', $sFileName))) {
                 $sResult = $sFileName;
             } elseif (F::File_Exists($sFileName = str_replace('notify.notify.', '', $sFileName))) {
                 $sResult = $sFileName;
             }
         }
     }
     return $sResult;
 }
コード例 #2
0
ファイル: ActionAsset.class.php プロジェクト: AntiqS/altocms
 protected function EventSkin()
 {
     $aParams = $this->GetParams();
     $sSkinName = array_shift($aParams);
     $sRelPath = implode('/', $aParams);
     $sOriginalFile = Config::Get('path.skins.dir') . $sSkinName . '/' . $sRelPath;
     if (F::File_Exists($sOriginalFile)) {
         $sAssetFile = F::File_GetAssetDir() . 'skin/' . $sSkinName . '/' . $sRelPath;
         if (F::File_Copy($sOriginalFile, $sAssetFile)) {
             if (headers_sent($sFile, $nLine)) {
                 $sUrl = F::File_GetAssetUrl() . 'skin/' . $sSkinName . '/' . $sRelPath;
                 if (strpos($sUrl, '?')) {
                     $sUrl .= '&' . uniqid();
                 } else {
                     $sUrl .= '?' . uniqid();
                 }
                 R::Location($sUrl);
             } else {
                 header_remove();
                 if ($sMimeType = F::File_MimeType($sAssetFile)) {
                     header('Content-Type: ' . $sMimeType);
                 }
                 echo file_get_contents($sAssetFile);
                 exit;
             }
         }
     }
     F::HttpHeader('404 Not Found');
     exit;
 }
コード例 #3
0
ファイル: Skin.class.php プロジェクト: Azany/altocms
 /**
  * Load skin manifest from XML
  *
  * @param string $sSkin
  * @param string $sSkinDir
  *
  * @return string|bool
  */
 public function GetSkinManifest($sSkin, $sSkinDir = null)
 {
     if (!$sSkinDir) {
         $sSkinDir = Config::Get('path.skins.dir') . $sSkin . '/';
     }
     if (F::File_Exists($sSkinDir . '/' . self::SKIN_XML_FILE)) {
         $sXmlFile = $sSkinDir . '/' . self::SKIN_XML_FILE;
     } else {
         $sXmlFile = $sSkinDir . '/settings/' . self::SKIN_XML_FILE;
     }
     if ($sXml = F::File_GetContents($sXmlFile)) {
         return $sXml;
     }
     return null;
 }
コード例 #4
0
ファイル: Lang.class.php プロジェクト: AntiqS/altocms
 /**
  * Make file list for loading
  *
  * @param      $aPaths
  * @param      $sPattern
  * @param      $sLang
  * @param bool $bExactMatch
  * @param bool $bCheckAliases
  *
  * @return array
  */
 public function _makeFileList($aPaths, $sPattern, $sLang, $bExactMatch = true, $bCheckAliases = true)
 {
     if (!is_array($aPaths)) {
         $aPaths = array((string) $aPaths);
     }
     $aResult = array();
     foreach ($aPaths as $sPath) {
         $sPathPattern = $sPath . '/' . $sPattern;
         $sLangFile = str_replace(static::LANG_PATTERN, $sLang, $sPathPattern);
         if ($bExactMatch) {
             if (F::File_Exists($sLangFile)) {
                 $aResult[] = $sLangFile;
             }
         } else {
             if ($aFiles = glob($sLangFile)) {
                 $aResult = array_merge($aResult, $aFiles);
             }
         }
         if (!$aResult && $bCheckAliases && ($aAliases = F::Str2Array(Config::Get('lang.aliases.' . $sLang)))) {
             //If the language file is not found, then check its aliases
             foreach ($aAliases as $sLangAlias) {
                 $aSubResult = $this->_makeFileList($aPaths, $sPattern, $sLangAlias, $bExactMatch, false);
                 if ($aSubResult) {
                     $aResult = array_merge($aResult, $aSubResult);
                     break;
                 }
             }
         }
     }
     return $aResult;
 }
コード例 #5
0
ファイル: Action.class.php プロジェクト: anp135/altocms
 /**
  * Устанавливает какой шаблон выводить
  *
  * @param string $sTemplate Путь до шаблона относительно каталога шаблонов экшена
  */
 protected function SetTemplateAction($sTemplate)
 {
     if (substr($sTemplate, -4) != '.tpl') {
         $sTemplate = $sTemplate . '.tpl';
     }
     $sActionTemplatePath = $sTemplate;
     if (!F::File_IsLocalDir($sActionTemplatePath)) {
         // If not absolute path then defines real path of template
         $aDelegates = E::ModulePlugin()->GetDelegationChain('action', $this->GetActionClass());
         foreach ($aDelegates as $sAction) {
             if (preg_match('/^(Plugin([\\w]+)_)?Action([\\w]+)$/i', $sAction, $aMatches)) {
                 // for LS-compatibility
                 $sActionNameOriginal = $aMatches[3];
                 // New-style action templates
                 $sActionName = strtolower($sActionNameOriginal);
                 $sTemplatePath = E::ModulePlugin()->GetDelegate('template', 'actions/' . $sActionName . '/action.' . $sActionName . '.' . $sTemplate);
                 $sActionTemplatePath = $sTemplatePath;
                 if (!empty($aMatches[1])) {
                     $aPluginTemplateDirs = array(Plugin::GetTemplateDir($sAction));
                     if (basename($aPluginTemplateDirs[0]) !== 'default') {
                         $aPluginTemplateDirs[] = dirname($aPluginTemplateDirs[0]) . '/default/';
                     }
                     if ($sTemplatePath = F::File_Exists('tpls/' . $sTemplatePath, $aPluginTemplateDirs)) {
                         $sActionTemplatePath = $sTemplatePath;
                         break;
                     }
                     if ($sTemplatePath = F::File_Exists($sTemplatePath, $aPluginTemplateDirs)) {
                         $sActionTemplatePath = $sTemplatePath;
                         break;
                     }
                     // LS-compatibility
                     if (E::ModulePlugin()->IsActivePlugin('ls')) {
                         $sLsTemplatePath = E::ModulePlugin()->GetDelegate('template', 'actions/Action' . ucfirst($sActionName) . '/' . $sTemplate);
                         if ($sTemplatePath = F::File_Exists($sLsTemplatePath, $aPluginTemplateDirs)) {
                             $sActionTemplatePath = $sTemplatePath;
                             break;
                         }
                         $sLsTemplatePath = E::ModulePlugin()->GetDelegate('template', 'actions/Action' . ucfirst($sActionNameOriginal) . '/' . $sTemplate);
                         if ($sTemplatePath = F::File_Exists($sLsTemplatePath, $aPluginTemplateDirs)) {
                             $sActionTemplatePath = $sTemplatePath;
                             break;
                         }
                     }
                 }
             }
         }
     }
     $this->sActionTemplate = $sActionTemplatePath;
 }
コード例 #6
0
 /**
  * Вырезает из временной фотки область нужного размера, ту что задал пользователь
  */
 protected function EventResizePhoto()
 {
     // * Устанавливаем формат Ajax ответа
     $this->Viewer_SetResponseAjax('json');
     // * Достаем из сессии временный файл
     $sTmpFile = $this->Session_Get('sPhotoTmp');
     $sPreviewFile = $this->Session_Get('sPhotoPreview');
     if (!F::File_Exists($sTmpFile)) {
         $this->Message_AddErrorSingle($this->Lang_Get('system_error'));
         return;
     }
     // * Определяем размер большого фото для подсчета множителя пропорции
     $fRation = 1;
     if (($aSizeFile = getimagesize($sTmpFile)) && isset($aSizeFile[0])) {
         // в self::PREVIEW_RESIZE задана максимальная сторона
         $fRation = max($aSizeFile[0], $aSizeFile[1]) / self::PREVIEW_RESIZE;
         // 200 - размер превью по которой пользователь определяет область для ресайза
         if ($fRation < 1) {
             $fRation = 1;
         }
     }
     // * Получаем размер области из параметров
     $aSize = $this->_getImageSize('size');
     if ($aSize) {
         $aSize = array('x1' => round($fRation * $aSize['x1']), 'y1' => round($fRation * $aSize['y1']), 'x2' => round($fRation * $aSize['x2']), 'y2' => round($fRation * $aSize['y2']));
     }
     // * Вырезаем фото
     if ($sFileWeb = $this->User_UploadPhoto($sTmpFile, $this->oUserCurrent, $aSize)) {
         // * Удаляем старые аватарки
         $this->oUserCurrent->setProfilePhoto($sFileWeb);
         $this->User_Update($this->oUserCurrent);
         $this->Img_Delete($sTmpFile);
         $this->Img_Delete($sPreviewFile);
         // * Удаляем из сессии
         $this->Session_Drop('sPhotoTmp');
         $this->Session_Drop('sPhotoPreview');
         $this->Viewer_AssignAjax('sFile', $this->oUserCurrent->getPhotoUrl());
         $this->Viewer_AssignAjax('sTitleUpload', $this->Lang_Get('settings_profile_photo_change'));
     } else {
         $this->Message_AddError($this->Lang_Get('settings_profile_avatar_error'), $this->Lang_Get('error'));
     }
 }
コード例 #7
0
ファイル: Viewer.class.php プロジェクト: anp135/altocms
 /**
  * Initialization of skin
  *
  */
 protected function _initSkin()
 {
     $this->sViewSkin = $this->GetConfigSkin();
     // Load skin's config
     $aConfig = array();
     Config::ResetLevel(Config::LEVEL_SKIN);
     $aSkinConfigPaths['sSkinConfigCommonPath'] = Config::Get('path.smarty.template') . '/settings/config/';
     $aSkinConfigPaths['sSkinConfigAppPath'] = Config::Get('path.dir.app') . F::File_LocalPath($aSkinConfigPaths['sSkinConfigCommonPath'], Config::Get('path.dir.common'));
     // Может загружаться основной конфиг скина, так и внешние секции конфига,
     // которые задаются ключом 'config_load'
     // (обычно это 'classes', 'assets', 'jevix', 'widgets', 'menu')
     $aConfigNames = array('config') + F::Str2Array(Config::Get('config_load'));
     // Config section that are loaded for the current skin
     $aSkinConfigNames = array();
     // ** Old skin version compatibility
     $oSkin = E::ModuleSkin()->GetSkin($this->sViewSkin);
     if (!$oSkin || !$oSkin->GetCompatible() || $oSkin->SkinCompatible('1.1', '<')) {
         // 'head.default' may be used in skin config
         C::Set('head.default', C::Get('assets.default'));
     }
     // Load configs from paths
     foreach ($aConfigNames as $sConfigName) {
         foreach ($aSkinConfigPaths as $sPath) {
             $sFile = $sPath . $sConfigName . '.php';
             if (F::File_Exists($sFile)) {
                 $aSubConfig = F::IncludeFile($sFile, false, true);
                 if ($sConfigName != 'config' && !isset($aSubConfig[$sConfigName])) {
                     $aSubConfig = array($sConfigName => $aSubConfig);
                 } elseif ($sConfigName == 'config' && isset($aSubConfig['head'])) {
                     // ** Old skin version compatibility
                     $aSubConfig['assets'] = $aSubConfig['head'];
                     unset($aSubConfig['head']);
                 }
                 // загружаем конфиг, что позволяет сразу использовать значения
                 // в остальных конфигах скина (assets и кастомном config.php) через Config::Get()
                 Config::Load($aSubConfig, false, null, null, $sFile);
                 if ($sConfigName != 'config' && !isset($aSkinConfigNames[$sConfigName])) {
                     $aSkinConfigNames[$sConfigName] = $sFile;
                 }
             }
         }
     }
     if (!$oSkin || !$oSkin->GetCompatible() || $oSkin->SkinCompatible('1.1', '<')) {
         // 'head.default' may be used in skin config
         C::Set('head.default', false);
     }
     Config::ResetLevel(Config::LEVEL_SKIN_CUSTOM);
     $aStorageConfig = Config::ReadStorageConfig(null, true);
     // Reload sections changed by user
     if ($aSkinConfigNames) {
         foreach (array_keys($aSkinConfigNames) as $sConfigName) {
             if (isset($aStorageConfig[$sConfigName])) {
                 if (empty($aConfig)) {
                     $aConfig[$sConfigName] = $aStorageConfig[$sConfigName];
                 } else {
                     $aConfig = F::Array_MergeCombo($aConfig, array($sConfigName => $aStorageConfig[$sConfigName]));
                 }
             }
         }
     }
     // Checks skin's config from users settings
     $sUserConfigKey = 'skin.' . $this->sViewSkin . '.config';
     $aUserConfig = Config::Get($sUserConfigKey);
     if ($aUserConfig) {
         if (!$aConfig) {
             $aConfig = $aUserConfig;
         } else {
             $aConfig = F::Array_MergeCombo($aConfig, $aUserConfig);
         }
     }
     if ($aConfig) {
         Config::Load($aConfig, false, null, null, $sUserConfigKey);
     }
     // Check skin theme and set one in config if it was changed
     if ($this->GetConfigTheme() != Config::Get('view.theme')) {
         Config::Set('view.theme', $this->GetConfigTheme());
     }
     // Load lang files for skin
     E::ModuleLang()->LoadLangFileTemplate(E::ModuleLang()->GetLang());
     // Load template variables from config
     if (($aVars = Config::Get('view.assign')) && is_array($aVars)) {
         $this->Assign($aVars);
     }
 }
コード例 #8
0
ファイル: Engine.class.php プロジェクト: anp135/altocms
 /**
  * Возвращает информацию о пути до файла класса.
  * Используется в {@link autoload автозагрузке}
  *
  * @static
  *
  * @param LsObject|string $oObject Объект - модуль, экшен, плагин, хук, сущность
  * @param int             $iArea   В какой области проверять (классы движка, общие классы, плагины)
  *
  * @return null|string
  */
 public static function GetClassPath($oObject, $iArea = self::CI_AREA_ACTUAL)
 {
     $aInfo = static::GetClassInfo($oObject, self::CI_OBJECT);
     $sPluginDir = '';
     if ($aInfo[self::CI_PLUGIN]) {
         $sPlugin = F::StrUnderscore($aInfo[self::CI_PLUGIN]);
         $aPlugins = F::GetPluginsList($iArea & self::CI_AREA_ALL_PLUGINS, false);
         if (isset($aPlugins[$sPlugin]['dirname'])) {
             $sPluginDir = $aPlugins[$sPlugin]['dirname'];
         } else {
             $sPluginDir = $sPlugin;
         }
     }
     $aPathSeek = Config::Get('path.root.seek');
     if ($aInfo[self::CI_ENTITY]) {
         // Сущность
         if ($aInfo[self::CI_PLUGIN]) {
             // Сущность модуля плагина
             $sFile = 'plugins/' . $sPluginDir . '/classes/modules/' . F::StrUnderscore($aInfo[self::CI_MODULE]) . '/entity/' . $aInfo[self::CI_ENTITY] . '.entity.class.php';
         } else {
             // Сущность модуля ядра
             $sFile = 'classes/modules/' . strtolower($aInfo[self::CI_MODULE]) . '/entity/' . $aInfo[self::CI_ENTITY] . '.entity.class.php';
         }
     } elseif ($aInfo[self::CI_MAPPER]) {
         // Маппер
         if ($aInfo[self::CI_PLUGIN]) {
             // Маппер модуля плагина
             $sFile = 'plugins/' . $sPluginDir . '/classes/modules/' . F::StrUnderscore($aInfo[self::CI_MODULE]) . '/mapper/' . $aInfo[self::CI_MAPPER] . '.mapper.class.php';
         } else {
             // Маппер модуля ядра
             $sFile = 'classes/modules/' . strtolower($aInfo[self::CI_MODULE]) . '/mapper/' . $aInfo[self::CI_MAPPER] . '.mapper.class.php';
         }
     } elseif ($aInfo[self::CI_ACTION]) {
         // Экшн
         if ($aInfo[self::CI_PLUGIN]) {
             // Экшн плагина
             $sFile = 'plugins/' . $sPluginDir . '/classes/actions/Action' . $aInfo[self::CI_ACTION] . '.class.php';
         } else {
             // Экшн ядра
             $sFile = 'classes/actions/Action' . $aInfo[self::CI_ACTION] . '.class.php';
         }
     } elseif ($aInfo[self::CI_MODULE]) {
         // Модуль
         if ($aInfo[self::CI_PLUGIN]) {
             // Модуль плагина
             $sFile = 'plugins/' . $sPluginDir . '/classes/modules/' . F::StrUnderscore($aInfo[self::CI_MODULE]) . '/' . $aInfo[self::CI_MODULE] . '.class.php';
         } else {
             // Модуль ядра
             $sFile = 'classes/modules/' . strtolower($aInfo[self::CI_MODULE]) . '/' . $aInfo[self::CI_MODULE] . '.class.php';
         }
     } elseif ($aInfo[self::CI_HOOK]) {
         // Хук
         if ($aInfo[self::CI_PLUGIN]) {
             // Хук плагина
             $sFile = 'plugins/' . $sPluginDir . '/classes/hooks/Hook' . $aInfo[self::CI_HOOK] . '.class.php';
         } else {
             // Хук ядра
             $sFile = 'classes/hooks/Hook' . $aInfo[self::CI_HOOK] . '.class.php';
         }
     } elseif ($aInfo[self::CI_BLOCK]) {
         // LS-compatible
         if ($aInfo[self::CI_PLUGIN]) {
             // Блок плагина
             $sFile = 'plugins/' . $sPluginDir . '/classes/blocks/Block' . $aInfo[self::CI_BLOCK] . '.class.php';
         } else {
             // Блок ядра
             $sFile = 'classes/blocks/Block' . $aInfo[self::CI_BLOCK] . '.class.php';
         }
     } elseif ($aInfo[self::CI_WIDGET]) {
         // Виджет
         if ($aInfo[self::CI_PLUGIN]) {
             // Виджет плагина
             $sFile = 'plugins/' . $sPluginDir . '/classes/widgets/Widget' . $aInfo[self::CI_WIDGET] . '.class.php';
         } else {
             // Блок ядра
             $sFile = 'classes/widgets/Widget' . $aInfo[self::CI_WIDGET] . '.class.php';
         }
     } elseif ($aInfo[self::CI_PLUGIN]) {
         // Плагин
         $sFile = 'plugins/' . $sPluginDir . '/Plugin' . $aInfo[self::CI_PLUGIN] . '.class.php';
     } else {
         $sClassName = is_string($oObject) ? $oObject : get_class($oObject);
         $sFile = $sClassName . '.class.php';
         $aPathSeek = array(Config::Get('path.dir.engine') . '/classes/core/', Config::Get('path.dir.engine') . '/classes/abstract/');
     }
     $sPath = F::File_Exists($sFile, $aPathSeek);
     return $sPath ? $sPath : null;
 }
コード例 #9
0
ファイル: Cache.class.php プロジェクト: AlexSSN/altocms
 /**
  * Инициализируем нужный тип кеша
  *
  */
 public function Init()
 {
     $this->bUseCache = C::Get('sys.cache.use');
     $this->sCacheType = C::Get('sys.cache.type');
     $this->sCachePrefix = $this->GetCachePrefix();
     $aCacheTypes = (array) C::Get('sys.cache.backends');
     // Доступные механизмы кеширования
     $this->aCacheTypesAvailable = array_map('strtolower', array_keys($aCacheTypes));
     // Механизмы принудительного кеширования
     $this->aCacheTypesForce = (array) C::Get('sys.cache.force');
     if ($this->aCacheTypesForce === true) {
         // Разрешены все
         $this->aCacheTypesForce = $this->aCacheTypesAvailable;
     } else {
         // Разрешены только те, которые есть в списке доступных
         $this->aCacheTypesForce = array_intersect(array_map('strtolower', $this->aCacheTypesForce), $this->aCacheTypesAvailable);
     }
     // По умолчанию кеширование данных полностью отключено
     $this->nCacheMode = self::CACHE_MODE_NONE;
     if ($this->_backendIsAvailable($this->sCacheType)) {
         if ($this->bUseCache) {
             // Включено автокеширование
             $this->nCacheMode = $this->nCacheMode | self::CACHE_MODE_AUTO | self::CACHE_MODE_REQUEST;
         } else {
             // Включено кеширование по запросу
             $this->nCacheMode = $this->nCacheMode | self::CACHE_MODE_REQUEST;
         }
         // Инициализация механизма кеширования по умолчанию
         $this->_backendInit($this->sCacheType);
     }
     if ($this->aCacheTypesForce) {
         // Разрешено принудительное кеширование
         $this->nCacheMode = $this->nCacheMode | self::CACHE_MODE_FORCE;
     }
     if ($this->nCacheMode != self::CACHE_MODE_NONE) {
         // Дабы не засорять место протухшим кешем, удаляем его в случайном порядке, например 1 из 50 раз
         if (rand(1, $this->nRandClearOld) == 33) {
             $this->Clean(Zend_Cache::CLEANING_MODE_OLD);
         }
     }
     $sCheckFile = C::Get('sys.cache.dir') . self::CHECK_FILENAME;
     if (F::File_CheckDir(C::Get('sys.cache.dir'), true)) {
         // If the control file is not present, then we need to clear cache and create
         if (!F::File_Exists($sCheckFile)) {
             $this->Clean();
         }
     }
     return $this->nCacheMode;
 }
コード例 #10
0
ファイル: ActionAdmin.class.php プロジェクト: ZeoNish/altocms
 protected function _getSkinFromConfig($sSkin)
 {
     $sSkinTheme = null;
     if (F::File_Exists($sFile = Config::Get('path.skins.dir') . $sSkin . '/settings/config/config.php')) {
         $aSkinConfig = F::IncludeFile($sFile, false, true);
         if (isset($aSkinConfig['view']) && isset($aSkinConfig['view']['theme'])) {
             $sSkinTheme = $aSkinConfig['view']['theme'];
         } elseif (isset($aSkinConfig['view.theme'])) {
             $sSkinTheme = $aSkinConfig['view.theme'];
         }
     }
     return $sSkinTheme;
 }
コード例 #11
0
ファイル: ViewerAsset.class.php プロジェクト: AntiqS/altocms
 /**
  * @param  string $sLocalFile
  * @param  string $sParentDir
  *
  * @return bool|string
  */
 public function File2Link($sLocalFile, $sParentDir = null)
 {
     $sAssetFile = $this->AssetFileDir($sLocalFile, $sParentDir);
     if (F::File_Exists($sAssetFile) || F::File_Copy($sLocalFile, $sAssetFile)) {
         return $this->AssetFileUrl($sLocalFile, $sParentDir);
     }
     return false;
 }
コード例 #12
0
ファイル: User.entity.class.php プロジェクト: anp135/altocms
 /**
  * Возвращает дефолтный аватар пользователя
  *
  * @param int|string $xSize
  * @param string     $sSex
  *
  * @return string
  */
 public function getDefaultAvatarUrl($xSize = null, $sSex = null)
 {
     if (!$sSex) {
         $sSex = $this->getProfileSex() === 'woman' ? 'female' : 'male';
     }
     if ($sSex !== 'female' && $sSex !== 'male') {
         $sSex = 'male';
     }
     $sPath = E::ModuleUploader()->GetUserAvatarDir(0) . 'avatar_' . Config::Get('view.skin', Config::LEVEL_CUSTOM) . '_' . $sSex . '.png';
     if (!$xSize) {
         if (Config::Get('module.user.profile_avatar_size')) {
             $xSize = Config::Get('module.user.profile_avatar_size');
         } else {
             $xSize = self::DEFAULT_AVATAR_SIZE;
         }
     }
     if ($sRealSize = C::Get('module.uploader.images.profile_avatar.size.' . $xSize)) {
         $xSize = $sRealSize;
     }
     if (is_string($xSize) && strpos($xSize, 'x')) {
         list($nW, $nH) = array_map('intval', explode('x', $xSize));
     } else {
         $nW = $nH = intval($xSize);
     }
     $sResizePath = $sPath . '-' . $nW . 'x' . $nH . '.' . pathinfo($sPath, PATHINFO_EXTENSION);
     if (Config::Get('module.image.autoresize') && !F::File_Exists($sResizePath)) {
         $sResizePath = E::ModuleImg()->AutoresizeSkinImage($sResizePath, 'avatar', max($nH, $nW));
     }
     if ($sResizePath) {
         $sPath = $sResizePath;
     } elseif (!F::File_Exists($sPath)) {
         $sPath = E::ModuleImg()->AutoresizeSkinImage($sPath, 'avatar', null);
     }
     return E::ModuleUploader()->Dir2Url($sPath);
 }
コード例 #13
0
ファイル: ViewerAsset.class.php プロジェクト: anp135/altocms
 /**
  * @param  string $sLocalFile
  * @param  string $sParentDir
  *
  * @return bool|string
  */
 public function File2Link($sLocalFile, $sParentDir = null)
 {
     $sAssetFile = $this->AssetFileDir($sLocalFile, $sParentDir);
     $aInfo = F::File_PathInfo($sLocalFile);
     if (F::File_Exists($sAssetFile) || F::File_Copy($aInfo['dirname'] . '/' . $aInfo['basename'], $sAssetFile)) {
         return $this->AssetFileUrl($sLocalFile, $sParentDir);
     }
     return false;
 }
コード例 #14
0
ファイル: Img.class.php プロジェクト: hard990/altocms
 /**
  * Copy image file with other sizes
  *
  * @param string $sFile        - full path of source image file
  * @param string $sDestination - full path or newname only
  * @param int    $iWidth       - new width
  * @param int    $iHeight      - new height
  * @param bool   $bFit         - to fit image's sizes into new sizes
  * @param array  $aOptions     - to fit image's sizes into new sizes
  *
  * @return string|bool
  */
 public function Copy($sFile, $sDestination, $iWidth = null, $iHeight = null, $bFit = true, $aOptions = array())
 {
     if (basename($sDestination) == $sDestination) {
         $sDestination = dirname($sFile) . '/' . $sDestination;
     }
     try {
         if (F::File_Exists($sFile) && ($oImg = $this->Read($sFile))) {
             if ($iWidth || $iHeight) {
                 $oImg->Resize($iWidth, $iHeight, $bFit);
             }
             $oImg->Save($sDestination, $aOptions);
             return $sDestination;
         }
     } catch (ErrorException $oE) {
         $this->nError = -1;
     }
     return false;
 }
コード例 #15
0
 /**
  * @param int $nStage
  *
  * @return bool
  */
 protected function _stageBegin($nStage)
 {
     $sFile = F::File_GetAssetDir() . '_check/' . $this->GetHash();
     if ($aCheckFiles = glob($sFile . '.{1,2,3}.begin.tmp', GLOB_BRACE)) {
         $sCheckFile = reset($aCheckFiles);
         // check time of tmp file
         $nTime = filectime($sCheckFile);
         if (!$nTime) {
             $nTime = F::File_GetContents($sCheckFile);
         }
         if (time() < $nTime + ModuleViewerAsset::TMP_TIME) {
             return false;
         }
     }
     if ($nStage == 2 && ($aCheckFiles = glob($sFile . '.{2,3}.end.tmp', GLOB_BRACE))) {
         return false;
     } elseif ($nStage == 3 && F::File_Exists($sFile . '.3.end.tmp')) {
         return false;
     }
     return F::File_PutContents($sFile . '.' . $nStage . '.begin.tmp', time());
 }
コード例 #16
0
ファイル: Widget.class.php プロジェクト: hard990/altocms
 /**
  * Проверяет существование файла класса исполняемого виджета
  *
  * @param   string      $sName
  * @param   string|null $sPlugin
  * @param   bool        $bReturnClassName
  * @return  string|bool
  */
 public function FileClassExists($sName, $sPlugin = null, $bReturnClassName = false)
 {
     $sName = ucfirst($sName);
     if (!$sPlugin) {
         $aPathSeek = Config::Get('path.root.seek');
         $sFile = '/classes/widgets/Widget' . $sName . '.class.php';
         $sClass = 'Widget' . $sName;
     } else {
         $aPathSeek = F::GetPluginsDir();
         $sFile = $sPlugin . '/classes/widgets/Widget' . $sName . '.class.php';
         $sClass = 'Plugin' . ucfirst($sPlugin) . '_Widget' . $sName;
     }
     if (F::File_Exists($sFile, $aPathSeek)) {
         return $bReturnClassName ? $sClass : $sFile;
     }
     return false;
 }
コード例 #17
0
ファイル: Viewer.class.php プロジェクト: AntiqS/altocms
 /**
  * @param string $sTplName
  *
  * @return string|bool
  */
 protected function _autocreateOldTemplate($sTplName)
 {
     $sOldTemplatesDir = $this->_getAutocreateOldTemplatesDir();
     if ($sFile = F::File_Exists($sTplName, $sOldTemplatesDir)) {
         return $sFile;
     }
     $aSourceTemplatesDir = array(Config::Get('path.skin.dir') . '/themes/default/layouts');
     if ($sTplName == 'header.tpl' || $sTplName == 'footer.tpl') {
         if ($sSourceFile = F::File_Exists('default.tpl', $aSourceTemplatesDir)) {
             $sSource = F::File_GetContents($sSourceFile);
             $sStr1 = "{hook run='content_begin'}";
             $sStr2 = "{hook run='content_end'}";
             if (stripos($sSource, '<!DOCTYPE') !== false) {
                 $iPos1 = stripos($sSource, $sStr1);
                 $iPos2 = stripos($sSource, $sStr2);
                 $sHeaderSrc = $this->_clearUnclosedBlocks(substr($sSource, 0, $iPos1 + strlen($sStr1)));
                 $sFooterSrc = $this->_clearUnclosedBlocks(substr($sSource, $iPos2));
                 F::File_PutContents($sOldTemplatesDir . 'header.tpl', $sHeaderSrc);
                 F::File_PutContents($sOldTemplatesDir . 'footer.tpl', $sFooterSrc);
             }
         }
     }
     if ($sFile = F::File_Exists($sTplName, $sOldTemplatesDir)) {
         return $sFile;
     }
     return false;
 }
コード例 #18
0
 public function getImgSize($sSize = null)
 {
     $aSize = $this->getProp('_size-' . $sSize . '-imgsize');
     if (!$aSize) {
         $sFile = $this->getProp('_size-' . $sSize . '-file');
         if (!$sFile) {
             $sUrl = $this->getLink($sSize);
             $sFile = E::ModuleUploader()->Url2Dir($sUrl);
             $this->setProp('_size-' . $sSize . '-file', $sFile);
         }
         if ($sFile && F::File_Exists($sFile)) {
             $aSize = getimagesize($sFile);
             $this->setProp('_size-' . $sSize . '-imgsize', $aSize);
         }
     }
     return $aSize;
 }
コード例 #19
0
 /**
  * Отмена загрузки в окне ресайза
  */
 public function EventCancelImage()
 {
     // * Устанавливаем формат Ajax ответа
     E::ModuleViewer()->SetResponseAjax('json');
     // Проверяем, целевой объект и права на его редактирование
     if (!($oTarget = E::ModuleUploader()->CheckAccessAndGetTarget($sTarget = F::GetRequest('target', FALSE), $sTargetId = F::GetRequest('target_id', FALSE)))) {
         E::ModuleMessage()->AddErrorSingle(E::ModuleLang()->Get('not_access'), E::ModuleLang()->Get('error'));
         return;
     }
     $sTmpFile = E::ModuleSession()->Get("sTmp-{$sTarget}-{$sTargetId}");
     if (!F::File_Exists($sTmpFile)) {
         E::ModuleMessage()->AddErrorSingle(E::ModuleLang()->Get('system_error'));
         return;
     }
     E::ModuleImg()->Delete($sTmpFile);
     // * Удаляем из сессии
     E::ModuleSession()->Drop('sTarget');
     E::ModuleSession()->Drop('sTargetId');
     E::ModuleSession()->Drop("sTmp-{$sTarget}-{$sTargetId}");
     E::ModuleSession()->Drop("sPreview-{$sTarget}-{$sTargetId}");
 }
コード例 #20
0
ファイル: Uploader.class.php プロジェクト: anp135/altocms
 /**
  * Возвращает URL изображения по новому размеру
  *
  * @param string $sOriginalPath
  * @param string $xSize
  *
  * @return string
  */
 public function ResizeTargetImage($sOriginalPath, $xSize)
 {
     $sModSuffix = F::File_ImgModSuffix($xSize, pathinfo($sOriginalPath, PATHINFO_EXTENSION));
     $sUrl = $sOriginalPath . $sModSuffix;
     if (Config::Get('module.image.autoresize')) {
         $sFile = $this->Url2Dir($sUrl);
         if ($sFile && !F::File_Exists($sFile)) {
             E::ModuleImg()->Duplicate($sFile);
         }
     }
     $sUrl = $this->CompleteUrl($sUrl);
     return $sUrl;
 }
コード例 #21
0
ファイル: Viewer.class.php プロジェクト: ZeoNish/altocms
 /**
  * Initialization of skin
  *
  */
 protected function _initSkin()
 {
     $this->sViewSkin = $this->GetConfigSkin();
     // Load skin's config
     $aConfig = array();
     if (F::File_Exists($sFile = Config::Get('path.smarty.template') . '/settings/config/config.php')) {
         $aConfig = F::IncludeFile($sFile, FALSE, TRUE);
     }
     if (F::File_Exists($sFile = Config::Get('path.smarty.template') . '/settings/config/menu.php')) {
         $aConfig = F::Array_MergeCombo($aConfig, F::IncludeFile($sFile, false, true));
     }
     //        $aConfigLoad = F::Str2Array(Config::Get('config_load'));
     //        if ($aConfigLoad) {
     //            foreach ($aConfigLoad as $sConfigName) {
     //                if (F::File_Exists($sFile = Config::Get('path.smarty.template') . "/settings/config/$sConfigName.php")) {
     //                    $aConfig = array_merge($aConfig, F::IncludeFile($sFile, false, true));
     //                }
     //            }
     //        }
     // Checks skin's config in app dir
     $sFile = Config::Get('path.dir.app') . F::File_LocalPath($sFile, Config::Get('path.dir.common'));
     if (F::File_Exists($sFile)) {
         $aConfig = F::Array_MergeCombo($aConfig, F::IncludeFile($sFile, false, true));
     }
     // Checks skin's config from users settings
     $aUserConfig = Config::Get('skin.' . $this->sViewSkin . '.config');
     if ($aUserConfig) {
         if (!$aConfig) {
             $aConfig = $aUserConfig;
         } else {
             $aConfig = F::Array_MergeCombo($aConfig, $aUserConfig);
         }
     }
     Config::ResetLevel(Config::LEVEL_SKIN);
     if ($aConfig) {
         Config::Load($aConfig, false, null, null, 'skin');
     }
     // Check skin theme and set one in config if it was changed
     if ($this->GetConfigTheme() != Config::Get('view.theme')) {
         Config::Set('view.theme', $this->GetConfigTheme());
     }
     // Load lang files for skin
     E::ModuleLang()->LoadLangFileTemplate(E::ModuleLang()->GetLang());
     // Skip skin widgets for local viewer
     if (!$this->bLocal) {
         // * Load skin widgets
         if (F::File_Exists($sFile = Config::Get('path.smarty.template') . '/settings/config/widgets.php')) {
             $aSkinWidgets = F::IncludeFile($sFile, false, true);
             if (isset($aSkinWidgets['widgets']) && is_array($aSkinWidgets['widgets']) && count($aSkinWidgets['widgets'])) {
                 $aWidgets = array_merge(Config::Get('widgets'), $aSkinWidgets['widgets']);
                 Config::Set('widgets', $aWidgets);
             }
         }
     }
     // Load template variables from config
     if (($aVars = Config::Get('view.assign')) && is_array($aVars)) {
         $this->Assign($aVars);
     }
 }
コード例 #22
0
ファイル: Config.class.php プロジェクト: ZeoNish/altocms
 /**
  * Возвращает полный путь к кеш-файлу кастомной конфигуации
  * или просто проверяет его наличие
  *
  * @param bool $bCheckOnly
  *
  * @return  string
  */
 protected static function _checkCustomCfg($bCheckOnly = false)
 {
     $sFile = self::Get('sys.cache.dir') . 'data/custom.cfg';
     if ($bCheckOnly) {
         return F::File_Exists($sFile);
     }
     return $sFile;
 }
コード例 #23
0
ファイル: User.entity.class.php プロジェクト: Azany/altocms
 /**
  * Returns URL for default photo of current skin
  *
  * @param int|string $xSize
  *
  * @return string
  */
 public function GetDefaultPhotoUrl($xSize = null)
 {
     $sPath = E::ModuleUploader()->GetUserAvatarDir(0) . 'user_photo_' . Config::Get('view.skin', Config::LEVEL_CUSTOM) . '_' . ($this->getProfileSex() == 'woman' ? 'female' : 'male') . '.png';
     if ($xSize) {
         if (strpos($xSize, 'x') !== false) {
             list($nW, $nH) = array_map('intval', explode('x', $xSize));
         } else {
             $nW = $nH = intval($xSize);
         }
         $sPath .= '-' . $nW . 'x' . $nH . '.' . pathinfo($sPath, PATHINFO_EXTENSION);
     } else {
         $nW = $nH = self::DEFAULT_PHOTO_SIZE;
     }
     if (Config::Get('module.image.autoresize') && !F::File_Exists($sPath)) {
         E::ModuleImg()->AutoresizeSkinImage($sPath, 'user_photo', max($nH, $nW));
     }
     return E::ModuleUploader()->Dir2Url($sPath);
 }
コード例 #24
0
ファイル: Loader.class.php プロジェクト: Azany/altocms
 /**
  * Try load class using PSR-4 standards
  * Used code from http://www.php-fig.org/psr/psr-4/examples/
  *
  * @param string $sClassName
  *
  * @return bool
  */
 protected static function _autoloadPSR4($sClassName)
 {
     // An associative array where the key is a namespace prefix and the value
     // is an array of base directories for classes in that namespace.
     $aVendorNamespaces = Config::Get('classes.namespace');
     if (!strpos($sClassName, '\\') || !$aVendorNamespaces) {
         return false;
     }
     // the current namespace prefix
     $sPrefix = $sClassName;
     // work backwards through the namespace names of the fully-qualified
     // class name to find a mapped file name
     while (false !== ($iPos = strrpos($sPrefix, '\\'))) {
         // seeking namespace prefix
         $sPrefix = substr($sClassName, 0, $iPos);
         // the rest is the relative class name
         $sRelativeClass = substr($sClassName, $iPos + 1);
         $sFileName = str_replace('\\', DIRECTORY_SEPARATOR, $sRelativeClass) . '.php';
         // try to load a mapped file for the prefix and relative class
         if (isset($aVendorNamespaces[$sPrefix])) {
             if ($sFile = F::File_Exists($sFileName, $aVendorNamespaces[$sPrefix])) {
                 return self::_includeFile($sFile, $sClassName);
             }
         }
     }
     // файл так и не был найден
     return false;
 }
コード例 #25
0
/**
 * Plugin for Smarty
 *
 * @param   array                    $aParams
 * @param   Smarty_Internal_Template $oSmartyTemplate
 *
 * @return  string|null
 */
function smarty_function_widget_exec($aParams, $oSmartyTemplate)
{
    if (!isset($aParams['name'])) {
        trigger_error('Parameter "name" does not define in {widget ...} function', E_USER_WARNING);
        return null;
    }
    $sWidgetName = $aParams['name'];
    $sPlugin = !empty($aParams['plugin']) ? $aParams['plugin'] : '';
    $aWidgetParams = isset($aParams['params']) ? array_merge($aParams['params'], $aParams) : $aParams;
    $sWidget = ucfirst(basename($sWidgetName));
    $sTemplate = '';
    $sDelegatedClass = E::ModulePlugin()->GetDelegate('widget', $sWidget);
    if ($sDelegatedClass == $sWidget) {
        // Пробуем получить делегата по старинке, для совместимости с LS
        // * LS-compatible * //
        $sDelegatedClass = E::ModulePlugin()->GetDelegate('block', $sWidget);
    }
    // Если делегатов нет, то определаем класс виджета
    if ($sDelegatedClass == $sWidget) {
        // Проверяем наличие класса виджета штатными средствами
        $sWidgetClass = E::ModuleWidget()->FileClassExists($sWidget, $sPlugin, true);
        if ($sWidgetClass) {
            // Проверяем делегирование найденного класса
            $sWidgetClass = E::ModulePlugin()->GetDelegate('widget', $sWidgetClass);
            if ($sPlugin) {
                $sPluginTplDir = Plugin::GetTemplateDir($sPlugin);
                $sTemplate = $sPluginTplDir . 'tpls/widgets/widget.' . $sWidgetName . '.tpl';
                if ($sFound = F::File_Exists('/widgets/widget.' . $sWidgetName . '.tpl', array($sPluginTplDir . 'tpls/', $sPluginTplDir))) {
                    $sTemplate = $sFound;
                } else {
                    // * LS-compatible * //
                    $sLsTemplate = Plugin::GetTemplateDir($sPlugin) . '/blocks/block.' . $sWidgetName . '.tpl';
                    if (F::File_Exists($sLsTemplate)) {
                        $sTemplate = $sLsTemplate;
                    }
                }
            } else {
                $sTemplate = E::ModulePlugin()->GetDelegate('template', 'widgets/widget.' . $sWidgetName . '.tpl');
                $sTemplate = F::File_Exists($sTemplate, $oSmartyTemplate->smarty->getTemplateDir());
                if (!$sTemplate) {
                    // * LS-compatible * //
                    $sLsTemplate = E::ModulePlugin()->GetDelegate('template', 'blocks/block.' . $sWidgetName . '.tpl');
                    if (F::File_Exists($sLsTemplate, $oSmartyTemplate->smarty->getTemplateDir())) {
                        $sTemplate = $sLsTemplate;
                    }
                }
            }
        } else {
            // * LS-compatible * //
            // Класс не найден
            if ($sPlugin) {
                // Если класс виджета не найден, то пытаемся по старинке задать класс "LS-блока"
                $sWidgetClass = 'Plugin' . ucfirst($sPlugin) . '_Block' . $sWidget;
            } else {
                // Если класс виджета не найден, то пытаемся по старинке задать класс "LS-блока"
                $sWidgetClass = 'Block' . $sWidget;
            }
            // Проверяем делигирование найденного класса
            $sWidgetClass = E::ModulePlugin()->GetDelegate('block', $sWidgetClass);
            if (!$sTemplate) {
                $sLsTemplate = E::ModulePlugin()->GetDelegate('template', 'blocks/block.' . $sWidgetName . '.tpl');
                if (F::File_Exists($sLsTemplate, $oSmartyTemplate->smarty->getTemplateDir())) {
                    $sTemplate = $sLsTemplate;
                }
            }
        }
    } else {
        $sWidgetClass = $sDelegatedClass;
    }
    // * Подключаем необходимый обработчик
    /** @var Widget $oWidgetHandler */
    $oWidgetHandler = new $sWidgetClass($aWidgetParams);
    // * Запускаем обработчик
    $sResult = $oWidgetHandler->Exec();
    // Если обработчик ничего не вернул, то рендерим шаблон
    if (!$sResult && $sTemplate) {
        if ($aWidgetParams) {
            $oSmartyTemplate->smarty->assign('aWidgetParams', $aWidgetParams);
        }
        $sResult = $oSmartyTemplate->smarty->fetch($sTemplate);
    }
    return $sResult;
}
コード例 #26
0
ファイル: Uploader.class.php プロジェクト: AntiqS/altocms
 /**
  * Возвращает URL изображения по новому размеру
  *
  * @param string $sOriginalPath
  * @param string $xSize
  *
  * @return string
  */
 public function ResizeTargetImage($sOriginalPath, $xSize)
 {
     $sModSuffix = F::File_ImgModSuffix($xSize, pathinfo($sOriginalPath, PATHINFO_EXTENSION));
     $sUrl = $sOriginalPath . $sModSuffix;
     if (Config::Get('module.image.autoresize')) {
         $sFile = $this->Url2Dir($sUrl);
         if (!F::File_Exists($sFile)) {
             E::ModuleImg()->Duplicate($sFile);
         }
     }
     if ($sUrl[0] == '@') {
         $sUrl = Config::Get('path.root.url') . substr($sUrl, 1);
     }
     return $sUrl;
 }
コード例 #27
0
ファイル: Blog.entity.class.php プロジェクト: AntiqS/altocms
 /**
  * Returns default avatar of the blog
  *
  * @param int|string $xSize
  *
  * @return string
  */
 public function getDefaultAvatarUrl($xSize = null)
 {
     if (!$xSize) {
         if (Config::Get('module.user.profile_avatar_size')) {
             $xSize = Config::Get('module.user.profile_avatar_size');
         } else {
             $xSize = self::DEFAULT_AVATAR_SIZE;
         }
     }
     $sPath = E::ModuleUploader()->GetUserAvatarDir(0) . 'avatar_blog_' . Config::Get('view.skin', Config::LEVEL_CUSTOM) . '.png';
     $sResizePath = null;
     if ($xSize) {
         if ($sRealSize = C::Get('module.uploader.images.profile_avatar.size.' . $xSize)) {
             $xSize = $sRealSize;
         }
         if (is_string($xSize) && $xSize[0] == 'x') {
             $xSize = substr($xSize, 1);
         }
         if ($iSize = intval($xSize)) {
             $sResizePath = $sPath . '-' . $iSize . 'x' . $iSize . '.' . strtolower(pathinfo($sPath, PATHINFO_EXTENSION));
             if (Config::Get('module.image.autoresize') && !F::File_Exists($sResizePath)) {
                 $sResizePath = E::ModuleImg()->AutoresizeSkinImage($sResizePath, 'avatar_blog', $iSize ? $iSize : null);
             }
         }
     }
     if ($sResizePath) {
         $sPath = $sResizePath;
     } elseif (!F::File_Exists($sPath)) {
         $sPath = E::ModuleImg()->AutoresizeSkinImage($sPath, 'avatar_blog', null);
     }
     return E::ModuleUploader()->Dir2Url($sPath);
 }
コード例 #28
0
 /**
  * Returns image URL with requested size
  *
  * @param string|int $xSize
  *
  * @return string
  */
 public function GetImgUrl($xSize = null)
 {
     $sUrl = $this->GetUrl();
     if (!$xSize) {
         return $sUrl;
     }
     $sModSuffix = F::File_ImgModSuffix($xSize, pathinfo($sUrl, PATHINFO_EXTENSION));
     $sPropKey = '_img-url-' . ($sModSuffix ? $sModSuffix : $xSize);
     $sResultUrl = $this->getProp($sPropKey);
     if ($sResultUrl) {
         return $sResultUrl;
     }
     if (!$this->IsLink() && $this->IsType(ModuleMresource::TYPE_IMAGE | ModuleMresource::TYPE_PHOTO)) {
         if (F::File_IsLocalUrl($sUrl) && $sModSuffix) {
             $sUrl = $sUrl . $sModSuffix;
             if (Config::Get('module.image.autoresize')) {
                 $sFile = E::ModuleUploader()->Url2Dir($sUrl);
                 if (!F::File_Exists($sFile)) {
                     E::ModuleImg()->Duplicate($sFile);
                 }
             }
         }
     }
     $this->setProp($sPropKey, $sUrl);
     return $sUrl;
 }
コード例 #29
0
ファイル: Plugin.class.php プロジェクト: ZeoNish/altocms
 /**
  * Seek template for current or default skin
  *
  * @param string $sPluginName
  * @param string $sTemplateName
  *
  * @return string
  */
 public static function GetTemplateFile($sPluginName, $sTemplateName)
 {
     $sPluginName = self::_pluginName($sPluginName);
     $sViewSkin = Config::Get('view.skin');
     if (!isset(self::$aTemplateDir[$sViewSkin][$sPluginName][$sTemplateName])) {
         $sPluginDir = self::GetDir($sPluginName);
         $aDirs = array(self::GetTemplateDir($sPluginName), $sPluginDir . '/templates/skin/' . Config::Get('view.skin'), $sPluginDir . '/templates/skin/' . self::GetDefaultSkin($sPluginName));
         if (substr($sTemplateName, -4) == '.tpl') {
             $aSeekDirs = array();
             foreach ($aDirs as $sDir) {
                 $aSeekDirs[] = $sDir . '/tpls/';
             }
             $aSeekDirs = array_merge($aSeekDirs, $aDirs);
         } else {
             $aSeekDirs = $aDirs;
         }
         $sFile = F::File_Exists($sTemplateName, $aSeekDirs);
         if ($sFile) {
             self::$aTemplateDir[$sViewSkin][$sPluginName][$sTemplateName] = $sFile;
         } else {
             self::$aTemplateDir[$sViewSkin][$sPluginName][$sTemplateName] = $sPluginDir . '/templates/skin/' . self::GetDefaultSkin($sPluginName) . '/' . $sTemplateName;
         }
     }
     return self::$aTemplateDir[$sViewSkin][$sPluginName][$sTemplateName];
 }
コード例 #30
0
ファイル: User.class.php プロジェクト: anp135/altocms
 /**
  * @param int|string $xSize
  * @param string     $sSex
  *
  * @return string
  */
 public function GetDefaultPhotoUrl($xSize, $sSex)
 {
     $sPath = E::ModuleUploader()->GetUserAvatarDir(0) . 'user_photo_' . Config::Get('view.skin', Config::LEVEL_CUSTOM) . '_' . $sSex . '.png';
     if (strpos($xSize, 'x') !== false) {
         list($nW, $nH) = array_map('intval', explode('x', $xSize));
     } else {
         $nW = $nH = (int) $xSize;
     }
     $sPath .= '-' . $nW . 'x' . $nH . '.' . pathinfo($sPath, PATHINFO_EXTENSION);
     if (Config::Get('module.image.autoresize') && !F::File_Exists($sPath)) {
         $sPath = E::ModuleImg()->AutoresizeSkinImage($sPath, 'user_photo', max($nH, $nW));
     }
     return E::ModuleUploader()->Dir2Url($sPath);
 }