本文整理汇总了PHP中Cx\Lib\FileSystem\FileSystem类的典型用法代码示例。如果您正苦于以下问题:PHP FileSystem类的具体用法?PHP FileSystem怎么用?PHP FileSystem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了FileSystem类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: fileSharingUpdate
function fileSharingUpdate()
{
try {
//update module name
\Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "modules` SET `name` = 'FileSharing' WHERE `id` = 68");
//update navigation url
\Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "backend_areas` SET `uri` = 'index.php?cmd=media&archive=FileSharing' WHERE `area_id` = 187");
//Insert component entry
\Cx\Lib\UpdateUtil::sql("INSERT INTO `" . DBPREFIX . "component` (`id`, `name`, `type`) VALUES ('68', 'FileSharing', 'module')");
//update module name for frontend pages
\Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "content_page` SET `module` = 'FileSharing' WHERE `module` = 'filesharing'");
//update section
\Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "core_setting` SET `section` = 'FileSharing',`value` = 'on' WHERE\n `section` = 'filesharing' AND `name` = 'permission' AND `group` = 'config'");
} catch (\Cx\Lib\UpdateException $e) {
return "Error: {$e->sql}";
}
$sourcePath = ASCMS_DOCUMENT_ROOT . '/media/filesharing';
$targetPath = ASCMS_DOCUMENT_ROOT . '/media/FileSharing';
try {
if (file_exists($sourcePath) && !file_exists($targetPath)) {
\Cx\Lib\FileSystem\FileSystem::makeWritable($sourcePath);
if (!\Cx\Lib\FileSystem\FileSystem::move($sourcePath, $targetPath)) {
return 'Failed to Moved the files from ' . $sourcePath . ' to ' . $targetPath . '.<br>';
}
}
} catch (\Cx\Lib\FileSystem\FileSystemException $e) {
return $e->getMessage();
}
return 'FileSharing updated successfully';
}
开发者ID:Cloudrexx,项目名称:cloudrexx,代码行数:30,代码来源:FileSharing.php
示例2: calendarUpdate
function calendarUpdate()
{
try {
//update module name
\Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "modules` SET `name` = 'Calendar' WHERE `id` = 21");
//update navigation url
\Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "backend_areas` SET `uri` = 'index.php?cmd=Calendar' WHERE `area_id` = 16");
//Insert component entry
\Cx\Lib\UpdateUtil::sql("INSERT INTO `" . DBPREFIX . "component` (`id`, `name`, `type`) VALUES ('21', 'Calendar', 'module')");
//update module name for frontend pages
\Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "content_page` SET `module` = 'Calendar' WHERE `module` = 'calendar'");
//following queries for changing the path from images/calendar into images/Calendar
\Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "module_calendar_event` SET `pic` = REPLACE(`pic`, 'images/calendar', 'images/Calendar'),\n `attach` = REPLACE(`attach`, 'images/calendar', 'images/Calendar'),\n `place_map` = REPLACE(`place_map`, 'images/calendar', 'images/Calendar')\n WHERE `pic` LIKE ('" . ASCMS_PATH_OFFSET . "/images/calendar%') ");
} catch (\Cx\Lib\UpdateException $e) {
return "Error: {$e->sql}";
}
$sourcePath = ASCMS_DOCUMENT_ROOT . '/images/calendar';
$targetPath = ASCMS_DOCUMENT_ROOT . '/images/Calendar';
try {
if (file_exists($sourcePath) && !file_exists($targetPath)) {
\Cx\Lib\FileSystem\FileSystem::makeWritable($sourcePath);
if (!\Cx\Lib\FileSystem\FileSystem::move($sourcePath, $targetPath)) {
return 'Failed to Moved the files from ' . $sourcePath . ' to ' . $targetPath . '.<br>';
}
}
} catch (\Cx\Lib\FileSystem\FileSystemException $e) {
return $e->getMessage();
}
return 'Calendar Component Updated Successfully';
}
开发者ID:Niggu,项目名称:cloudrexx,代码行数:30,代码来源:Calendar.php
示例3: forumUpdates
function forumUpdates()
{
//Update the database changes
try {
//update module name
\Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "modules` SET `name` = 'Forum' WHERE `id` = 20");
//update navigation url
\Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "backend_areas` SET `uri` = 'index.php?cmd=Forum' WHERE `area_id` = 106");
//Insert component entry
\Cx\Lib\UpdateUtil::sql("INSERT INTO `" . DBPREFIX . "component` (`id`, `name`, `type`) VALUES ('20', 'Forum', 'module')");
//update module name for frontend pages
\Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "content_page` SET `module` = 'Forum' WHERE `module` = 'forum'");
} catch (\Cx\Lib\UpdateException $e) {
return "Error: {$e->sql}";
}
//Update script for moving the folder
$sourcePath = ASCMS_DOCUMENT_ROOT . '/media/forum';
$destinationPath = ASCMS_DOCUMENT_ROOT . '/media/Forum';
try {
if (file_exists($sourcePath) && !file_exists($destinationPath)) {
\Cx\Lib\FileSystem\FileSystem::makeWritable($sourcePath);
if (!\Cx\Lib\FileSystem\FileSystem::move($sourcePath, $destinationPath)) {
return 'Failed to move the folder from ' . $sourcePath . ' to ' . $destinationPath . '.';
}
}
} catch (\Cx\Lib\FileSystem\FileSystemException $e) {
return $e->getMessage();
}
return 'Forum updated successfully.';
}
开发者ID:Cloudrexx,项目名称:cloudrexx,代码行数:30,代码来源:Forum.php
示例4: downloadsUpdate
function downloadsUpdate()
{
try {
//update module name
\Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "modules` SET `name` = 'Downloads' WHERE `id` = 53");
//update navigation url
\Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "backend_areas` SET `uri` = 'index.php?cmd=Downloads' WHERE `area_id` = 132");
//Insert component entry
\Cx\Lib\UpdateUtil::sql("INSERT INTO `" . DBPREFIX . "component` (`id`, `name`, `type`) VALUES ('53', 'Downloads', 'module')");
//update module name for frontend pages
\Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "content_page` SET `module` = 'Downloads' WHERE `module` = 'downloads'");
//following queries for changing the path from images/downloads into images/Downloads
\Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "module_downloads_download`\n SET `image` = REPLACE(`image`, 'images/downloads', 'images/Downloads')\n WHERE `image` LIKE ('" . ASCMS_PATH_OFFSET . "/images/downloads%')");
\Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "module_downloads_category`\n SET `image` = REPLACE(`image`, 'images/downloads', 'images/Downloads')\n WHERE `image` LIKE ('" . ASCMS_PATH_OFFSET . "/images/downloads%')");
\Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "module_downloads_download_locale`\n SET `source` = REPLACE(`source`, 'images/downloads', 'images/Downloads')\n WHERE `source` LIKE ('" . ASCMS_PATH_OFFSET . "/images/downloads%')");
} catch (\Cx\Lib\UpdateException $e) {
return "Error: {$e->sql}";
}
$sourcePath = ASCMS_DOCUMENT_ROOT . '/images/downloads';
$targetPath = ASCMS_DOCUMENT_ROOT . '/images/Downloads';
try {
if (file_exists($sourcePath) && !file_exists($targetPath)) {
\Cx\Lib\FileSystem\FileSystem::makeWritable($sourcePath);
if (!\Cx\Lib\FileSystem\FileSystem::move($sourcePath, $targetPath)) {
return 'Failed to Moved the files from ' . $sourcePath . ' to ' . $targetPath . '.<br>';
}
}
} catch (\Cx\Lib\FileSystem\FileSystemException $e) {
return $e->getMessage();
}
return 'Downloads Updated successfully';
}
开发者ID:Cloudrexx,项目名称:cloudrexx,代码行数:32,代码来源:Downloads.php
示例5: galleryUpdate
function galleryUpdate()
{
try {
//update module name
\Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "modules` SET `name` = 'Gallery' WHERE `id` = 3");
//update navigation url
\Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "backend_areas` SET `uri` = 'index.php?cmd=Gallery' WHERE `area_id` = 12");
//Insert component entry
\Cx\Lib\UpdateUtil::sql("INSERT INTO `" . DBPREFIX . "component` (`id`, `name`, `type`) VALUES ('3', 'Gallery', 'module')");
//update module name for frontend pages
\Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "content_page` SET `module` = 'Gallery' WHERE `module` = 'gallery'");
} catch (\Cx\Lib\UpdateException $e) {
return "Error: {$e->sql}";
}
$sourcePath = ASCMS_DOCUMENT_ROOT . '/images/gallery';
$targetPath = ASCMS_DOCUMENT_ROOT . '/images/Gallery';
try {
if (file_exists($sourcePath) && !file_exists($targetPath)) {
\Cx\Lib\FileSystem\FileSystem::makeWritable($sourcePath);
if (!\Cx\Lib\FileSystem\FileSystem::move($sourcePath, $targetPath)) {
return 'Failed to Moved the files from ' . $sourcePath . ' to ' . $targetPath . '.<br>';
}
}
} catch (\Cx\Lib\FileSystem\FileSystemException $e) {
return $e->getMessage();
}
return 'Gallery Component Updated Successfully';
}
开发者ID:Niggu,项目名称:cloudrexx,代码行数:28,代码来源:Gallery.php
示例6: accessUpdates
function accessUpdates()
{
//Update the database changes
try {
//update module name
\Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "modules` SET `name` = 'Access' WHERE `id` = 23");
//update navigation url
\Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "backend_areas` SET `uri` = 'index.php?cmd=Access', `module_id` = '23' WHERE `area_id` = 18");
\Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "backend_areas` SET `uri` = 'index.php?cmd=Access' WHERE `area_id` = 208");
//Insert component entry
\Cx\Lib\UpdateUtil::sql("INSERT INTO `" . DBPREFIX . "component` (`id`, `name`, `type`) VALUES ('23', 'Access', 'core_module')");
//update module name for frontend pages
\Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "content_page` SET `module` = 'Access' WHERE `module` = 'access'");
//update module name for crm core settings
\Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "core_setting` SET `section` = 'Access' WHERE `section` = 'access' AND `name` = 'providers' AND `group` = 'sociallogin'");
} catch (\Cx\Lib\UpdateException $e) {
return "Error: {$e->sql}";
}
//Update script for moving the folder
$accessImgPath = ASCMS_DOCUMENT_ROOT . '/images';
try {
if (file_exists($accessImgPath . '/access') && !file_exists($accessImgPath . '/Access')) {
\Cx\Lib\FileSystem\FileSystem::makeWritable($accessImgPath . '/access');
if (!\Cx\Lib\FileSystem\FileSystem::move($accessImgPath . '/access', $accessImgPath . '/Access')) {
return 'Failed to move the folder from ' . $accessImgPath . '/access to ' . $accessImgPath . '/Access.';
}
}
} catch (\Cx\Lib\FileSystem\FileSystemException $e) {
return $e->getMessage();
}
return 'Access updated successfully.';
}
开发者ID:Cloudrexx,项目名称:cloudrexx,代码行数:32,代码来源:Access.php
示例7: marketUpdates
function marketUpdates()
{
//Update the database changes
try {
//update module name
\Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "modules` SET `name` = 'Market' WHERE `id` = 33");
//update navigation url
\Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "backend_areas` SET `uri` = 'index.php?cmd=Market' WHERE `area_id` = 98");
//Insert component entry
\Cx\Lib\UpdateUtil::sql("INSERT INTO `" . DBPREFIX . "component` (`id`, `name`, `type`) VALUES ('33', 'Market', 'module')");
//update module name for frontend pages
\Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "content_page` SET `module` = 'Market' WHERE `module` = 'market'");
} catch (\Cx\Lib\UpdateException $e) {
return "Error: {$e->sql}";
}
//Update script for moving the folder
$marketMediaPath = ASCMS_DOCUMENT_ROOT . '/media';
try {
if (file_exists($marketMediaPath . '/market') && !file_exists($marketMediaPath . '/Market')) {
\Cx\Lib\FileSystem\FileSystem::makeWritable($marketMediaPath . '/market');
if (!\Cx\Lib\FileSystem\FileSystem::move($marketMediaPath . '/market', $marketMediaPath . '/Market')) {
return 'Failed to move the folder from ' . $marketMediaPath . '/market to ' . $marketMediaPath . '/Market.';
}
}
} catch (\Cx\Lib\FileSystem\FileSystemException $e) {
return $e->getMessage();
}
return 'Market updated successfully.';
}
开发者ID:Niggu,项目名称:cloudrexx,代码行数:29,代码来源:Market.php
示例8: showNewsRefresh
function showNewsRefresh($id, $time, $path)
{
global $objDatabase;
//delete old #01
$query = "SELECT link,\n filename\n FROM " . DBPREFIX . "module_feed_news\n WHERE id = '" . $id . "'";
$objResult = $objDatabase->Execute($query);
$old_link = $objResult->fields['link'];
$old_filename = $objResult->fields['filename'];
if ($old_link != '') {
$filename = 'feed_' . $time . '_' . \Cx\Lib\FileSystem\FileSystem::replaceCharacters(basename($old_link));
@copy($old_link, $path . $filename);
//rss class
$rss = new \XML_RSS($path . $filename);
$rss->parse();
$content = '';
foreach ($rss->getStructure() as $array) {
$content .= $array;
}
}
if ($old_link == '') {
$filename = $old_filename;
}
$query = "UPDATE " . DBPREFIX . "module_feed_news\n SET filename = '" . $filename . "',\n time = '" . $time . "'\n WHERE id = '" . $id . "'";
$objDatabase->Execute($query);
//delete old #02
if ($old_link != '') {
@unlink($path . $old_filename);
}
}
开发者ID:nahakiole,项目名称:cloudrexx,代码行数:29,代码来源:FeedLibrary.class.php
示例9: _podcastUpdate
function _podcastUpdate()
{
global $objDatabase, $_ARRAYLANG, $objUpdate, $_CONFIG;
//move podcast images directory
$path = ASCMS_DOCUMENT_ROOT . '/images';
$oldImagesPath = '/content/podcast';
$newImagesPath = '/podcast';
if ($objUpdate->_isNewerVersion($_CONFIG['coreCmsVersion'], '1.2.1')) {
if (!file_exists($path . $newImagesPath) && file_exists($path . $oldImagesPath)) {
\Cx\Lib\FileSystem\FileSystem::makeWritable($path . $oldImagesPath);
if (!\Cx\Lib\FileSystem\FileSystem::copy_folder($path . $oldImagesPath, $path . $newImagesPath)) {
setUpdateMsg(sprintf($_ARRAYLANG['TXT_UNABLE_TO_MOVE_DIRECTORY'], $path . $oldImagesPath, $path . $newImagesPath));
return false;
}
}
\Cx\Lib\FileSystem\FileSystem::makeWritable($path . $newImagesPath);
\Cx\Lib\FileSystem\FileSystem::makeWritable($path . $newImagesPath . '/youtube_thumbnails');
//change thumbnail paths
$query = "UPDATE `" . DBPREFIX . "module_podcast_medium` SET `thumbnail` = REPLACE(`thumbnail`, '/images/content/podcast/', '/images/podcast/')";
if ($objDatabase->Execute($query) === false) {
return _databaseError($query, $objDatabase->ErrorMsg());
}
}
//set new default settings
$query = "UPDATE `" . DBPREFIX . "module_podcast_settings` SET `setvalue` = '50' WHERE `setname` = 'thumb_max_size' AND `setvalue` = ''";
if ($objDatabase->Execute($query) === false) {
return _databaseError($query, $objDatabase->ErrorMsg());
}
$query = "UPDATE `" . DBPREFIX . "module_podcast_settings` SET `setvalue` = '85' WHERE `setname` = 'thumb_max_size_homecontent' AND `setvalue` = ''";
if ($objDatabase->Execute($query) === false) {
return _databaseError($query, $objDatabase->ErrorMsg());
}
// only update if installed version is at least a version 2.0.0
// older versions < 2.0 have a complete other structure of the content page and must therefore completely be reinstalled
if (!$objUpdate->_isNewerVersion($_CONFIG['coreCmsVersion'], '2.0.0')) {
try {
// migrate content page to version 3.0.1
$search = array('/(.*)/ms');
$callback = function ($matches) {
$content = $matches[1];
if (empty($content)) {
return $content;
}
// add missing placeholder {PODCAST_JAVASCRIPT}
if (strpos($content, '{PODCAST_JAVASCRIPT}') === false) {
$content .= "\n{PODCAST_JAVASCRIPT}";
}
// add missing placeholder {PODCAST_PAGING}
if (strpos($content, '{PODCAST_PAGING}') === false) {
$content = preg_replace('/(\\s+)(<!--\\s+END\\s+podcast_media\\s+-->)/ms', '$1$2$1<div class="noMedium">$1 {PODCAST_PAGING}$1</div>', $content);
}
return $content;
};
\Cx\Lib\UpdateUtil::migrateContentPageUsingRegexCallback(array('module' => 'podcast'), $search, $callback, array('content'), '3.0.1');
} catch (\Cx\Lib\UpdateException $e) {
return \Cx\Lib\UpdateUtil::DefaultActionHandler($e);
}
}
return true;
}
开发者ID:nahakiole,项目名称:cloudrexx,代码行数:60,代码来源:podcast.php
示例10: Create
function Create()
{
$this->content = utf8_decode($this->_ParseHTML($this->content));
$pdf = new HTML2FPDF();
$pdf->ShowNOIMG_GIF();
$pdf->DisplayPreferences('HideWindowUI');
$pdf->AddPage();
$pdf->WriteHTML($this->content);
$pdf->Output(\Cx\Lib\FileSystem\FileSystem::replaceCharacters($this->title));
}
开发者ID:nahakiole,项目名称:cloudrexx,代码行数:10,代码来源:pdf.class.php
示例11: __construct
/**
* Constructor
*/
public function __construct()
{
$cx = \Cx\Core\Core\Controller\Cx::instanciate();
$folderPath = $cx->getWebsiteTempPath() . '/Update';
if (!file_exists($folderPath)) {
\Cx\Lib\FileSystem\FileSystem::make_folder($folderPath);
}
if (!file_exists($folderPath . '/' . self::PENDING_DB_UPDATES_YML)) {
\Cx\Lib\FileSystem\FileSystem::copy_file($cx->getCodeBaseCoreModulePath() . '/Update/Data/' . self::PENDING_DB_UPDATES_YML, $folderPath . '/' . self::PENDING_DB_UPDATES_YML);
}
parent::__construct($folderPath . '/' . self::PENDING_DB_UPDATES_YML);
}
开发者ID:nahakiole,项目名称:cloudrexx,代码行数:15,代码来源:DeltaRepository.class.php
示例12: ecardUpdates
function ecardUpdates()
{
//Update database changes
try {
//update module name
\Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "modules` SET `name` = 'Ecard' WHERE `id` = 49");
//update navigation url
\Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "backend_areas` SET `uri` = 'index.php?cmd=Ecard' WHERE `area_id` = 130");
//Insert component entry
\Cx\Lib\UpdateUtil::sql("INSERT INTO `" . DBPREFIX . "component` (`id`, `name`, `type`) VALUES ('49', 'Ecard', 'module')");
//update module name for frontend pages
\Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "content_page` SET `module` = 'Ecard' WHERE `module` = 'ecard'");
} catch (\Cx\Lib\UpdateException $e) {
return "Error: {$e->sql}";
}
//Update script for moving the folders
$imgModulesfolderPath = ASCMS_DOCUMENT_ROOT . '/images/modules/ecard';
$mediafolderPath = ASCMS_DOCUMENT_ROOT . '/media/Ecard';
try {
if (!file_exists($mediafolderPath)) {
\Cx\Lib\FileSystem\FileSystem::make_folder($mediafolderPath);
\Cx\Lib\FileSystem\FileSystem::makeWritable($mediafolderPath);
}
//move the folder from '/images/modules/ecard/ecards_optimized' to '/media/Ecard/ecards_optimized'
if (file_exists($imgModulesfolderPath . '/ecards_optimized') && !file_exists($mediafolderPath . '/ecards_optimized')) {
\Cx\Lib\FileSystem\FileSystem::makeWritable($imgModulesfolderPath . '/ecards_optimized');
if (!\Cx\Lib\FileSystem\FileSystem::move($imgModulesfolderPath . '/ecards_optimized', $mediafolderPath . '/ecards_optimized')) {
return 'Failed to Move the folders from ' . $imgModulesfolderPath . '/ecards_optimized to ' . $mediafolderPath . '/ecards_optimized.';
}
}
//move the folder from '/images/modules/ecard/send_ecards' to '/media/Ecard/send_ecards'
if (file_exists($imgModulesfolderPath . '/send_ecards') && !file_exists($mediafolderPath . '/send_ecards')) {
\Cx\Lib\FileSystem\FileSystem::makeWritable($imgModulesfolderPath . '/send_ecards');
if (!\Cx\Lib\FileSystem\FileSystem::move($imgModulesfolderPath . '/send_ecards', $mediafolderPath . '/send_ecards')) {
return 'Failed to Move the folders from ' . $imgModulesfolderPath . '/send_ecards to ' . $mediafolderPath . '/send_ecards.';
}
}
//move the folder from '/images/modules/ecard/thumbnails' to '/media/Ecard/thumbnails'
if (file_exists($imgModulesfolderPath . '/thumbnails') && !file_exists($mediafolderPath . '/thumbnails')) {
\Cx\Lib\FileSystem\FileSystem::makeWritable($imgModulesfolderPath . '/thumbnails');
if (!\Cx\Lib\FileSystem\FileSystem::move($imgModulesfolderPath . '/thumbnails', $mediafolderPath . '/thumbnails')) {
return 'Failed to Move the folders from ' . $imgModulesfolderPath . '/thumbnails to ' . $mediafolderPath . '/thumbnails.';
}
}
return 'Successfully updated.';
} catch (\Cx\Lib\FileSystem\FileSystemException $e) {
return $e->getMessage();
}
}
开发者ID:Cloudrexx,项目名称:cloudrexx,代码行数:49,代码来源:Ecard.php
示例13: createThumbnail
/**
* Create all the thumbnails for a picture.
*
* @param string $path Path to the file. This can be a virtual path or a absolute path.
* @param string $fileNamePlain Plain file name without extension
* @param string $fileExtension Extension of the file
* @param \ImageManager $imageManager
*
* <code>
* <?php
* \Cx\Core_Modules\MediaBrowser\Model\FileSystem::createThumbnail(
* 'files/',
* 'Django,
* 'jpg',
* new ImageManager() // Please recycle the instance and don't create a new anonymous instance for each call.
* // This is just a simple example.
* );
* ?>
* </code>
*
* @return array With all thumbnail types and if they were generated successfully.
*/
public static function createThumbnail($path, $fileNamePlain, $fileExtension, \ImageManager $imageManager, $generateThumbnailByRatio = false)
{
$success = array();
foreach (UploaderConfiguration::getInstance()->getThumbnails() as $thumbnail) {
if (\Cx\Lib\FileSystem\FileSystem::exists(MediaSourceManager::getAbsolutePath($path) . $fileNamePlain . $thumbnail['value'] . '.' . $fileExtension)) {
$success[$thumbnail['value']] = self::THUMBNAIL_GENERATOR_NEUTRAL;
continue;
}
if ($imageManager->_createThumb(MediaSourceManager::getAbsolutePath($path) . '/', '', $fileNamePlain . '.' . $fileExtension, $thumbnail['size'], $thumbnail['quality'], $fileNamePlain . $thumbnail['value'] . '.' . $fileExtension, $generateThumbnailByRatio)) {
$success[$thumbnail['value']] = self::THUMBNAIL_GENERATOR_SUCCESS;
continue;
}
$success[$thumbnail['value']] = self::THUMBNAIL_GENERATOR_FAIL;
}
return $success;
}
开发者ID:nahakiole,项目名称:cloudrexx,代码行数:38,代码来源:ThumbnailGenerator.class.php
示例14: execute
/**
* Execute this command
* @param array $arguments Array of commandline arguments
*/
public function execute(array $arguments)
{
if (!$this->interface->yesNo('Removing workbench requires re-installing workbench to use it again. Are you sure?')) {
return;
}
// Remove component from Db and FileSystem
$component = new \Cx\Core\Core\Model\Entity\ReflectionComponent('Workbench', 'core_module');
$component->remove();
// Remove additional files (config, command line script)
foreach ($this->interface->getWorkbench()->getFileList() as $file) {
if (is_dir($file)) {
\Cx\Lib\FileSystem\FileSystem::delete_folder(ASCMS_DOCUMENT_ROOT . $file, true);
} else {
\Cx\Lib\FileSystem\FileSystem::delete_file(ASCMS_DOCUMENT_ROOT . $file);
}
}
$this->interface->show('Done');
}
开发者ID:Cloudrexx,项目名称:cloudrexx,代码行数:22,代码来源:RemoveCommand.class.php
示例15: initContrexxCaching
protected function initContrexxCaching()
{
global $_CONFIG;
// in case the request's origin is from a mobile devie
// and this is the first request (the InitCMS object wasn't yet
// able to determine of the mobile device wishes to be served
// with the system's mobile view), we shall deactivate the caching system
if (\InitCMS::_is_mobile_phone() && !\InitCMS::_is_tablet() && !isset($_REQUEST['smallscreen'])) {
$this->boolIsEnabled = false;
return;
}
if ($_CONFIG['cacheEnabled'] == 'off') {
$this->boolIsEnabled = false;
return;
}
if (isset($_REQUEST['caching']) && $_REQUEST['caching'] == '0') {
$this->boolIsEnabled = false;
return;
}
// TODO: Reimplement - see #1205
/*if ($this->isException()) {
$this->boolIsEnabled = false;
return;
}*/
$this->boolIsEnabled = true;
// check the cache directory
if (!is_dir(ASCMS_CACHE_PATH)) {
\Cx\Lib\FileSystem\FileSystem::make_folder(ASCMS_CACHE_PATH);
}
if (!is_writable(ASCMS_CACHE_PATH)) {
\Cx\Lib\FileSystem\FileSystem::makeWritable(ASCMS_CACHE_PATH);
}
$this->strCachePath = ASCMS_CACHE_PATH . '/';
$this->intCachingTime = intval($_CONFIG['cacheExpiration']);
// Use data of $_GET and $_POST to uniquely identify a request.
// Important: You must not use $_REQUEST instead. $_REQUEST also contains
// the data of $_COOKIE. Whereas the cookie information might
// change in each request, which might break the caching-
// system.
$request = array_merge_recursive($_GET, $_POST);
ksort($request);
$this->arrPageContent = array('url' => $_SERVER['REQUEST_URI'], 'request' => $request);
$this->strCacheFilename = md5(serialize($this->arrPageContent));
}
开发者ID:nahakiole,项目名称:cloudrexx,代码行数:44,代码来源:Cache.class.php
示例16: handleRequest
/**
* @override
*/
public function handleRequest()
{
global $_FILES;
//get a writable directory
$targetDir = '/upload_' . $this->uploadId;
$tempPath = $_SESSION->getTempPath();
$webTempPath = $_SESSION->getWebTempPath();
//make sure target directory exists
if (!file_exists($tempPath . $targetDir)) {
\Cx\Lib\FileSystem\FileSystem::make_folder($webTempPath . $targetDir);
}
//move all uploaded file to this upload's temp directory
foreach ($_FILES["uploaderFiles"]["error"] as $key => $error) {
if ($error == UPLOAD_ERR_OK) {
$tmpName = $_FILES["uploaderFiles"]["tmp_name"][$key];
$name = $_FILES["uploaderFiles"]["name"][$key];
if (!\FWValidator::is_file_ending_harmless($name)) {
die('Error:' . sprintf('The file %s was refused due to its file extension which is not allowed!', htmlentities($name, ENT_QUOTES, CONTREXX_CHARSET)));
}
//TODO: Uploader::addChunk does this also -> centralize in function
// remember the "raw" file name, we want to store all original
// file names in the session.
$originalFileName = $name;
// Clean the fileName for security reasons
$name = preg_replace('/[^\\w\\._]+/', '', $name);
$originalFileNames = array();
if (isset($_SESSION['upload']['handlers'][$this->uploadId]['originalFileNames'])) {
$originalFileNames = $_SESSION['upload']['handlers'][$this->uploadId]['originalFileNames'];
}
$originalFileNames[$name] = $originalFileName;
$_SESSION['upload']['handlers'][$this->uploadId]['originalFileNames'] = $originalFileNames;
//end of TODO-region
//move file somewhere we know both the web- and normal path...
@move_uploaded_file($tmpName, ASCMS_TEMP_PATH . '/' . $name);
//...then do a safe-mode-safe (yeah) move operation
\Cx\Lib\FileSystem\FileSystem::move(ASCMS_TEMP_WEB_PATH . '/' . $name, $webTempPath . $targetDir . '/' . $name, true);
}
}
//and call back.
$this->notifyCallback();
//redirect the user where he belongs
$this->redirect();
}
开发者ID:nahakiole,项目名称:cloudrexx,代码行数:46,代码来源:FormUploader.class.php
示例17: _ecardUpdate
function _ecardUpdate()
{
global $objDatabase, $_ARRAYLANG, $_CORELANG;
try {
\Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_ecard_ecards', array('code' => array('type' => 'VARCHAR(35)', 'notnull' => true, 'default' => '', 'primary' => true), 'date' => array('type' => 'INT(10)', 'notnull' => true, 'default' => 0, 'unsigned' => true), 'TTL' => array('type' => 'INT(10)', 'notnull' => true, 'default' => 0, 'unsigned' => true), 'salutation' => array('type' => 'VARCHAR(100)', 'notnull' => true, 'default' => ''), 'senderName' => array('type' => 'VARCHAR(100)', 'notnull' => true, 'default' => ''), 'senderEmail' => array('type' => 'VARCHAR(100)', 'notnull' => true, 'default' => ''), 'recipientName' => array('type' => 'VARCHAR(100)', 'notnull' => true, 'default' => ''), 'recipientEmail' => array('type' => 'VARCHAR(100)', 'notnull' => true, 'default' => ''), 'message' => array('type' => 'TEXT', 'notnull' => true)));
\Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_ecard_settings', array('setting_name' => array('type' => 'VARCHAR(100)', 'notnull' => true, 'default' => '', 'primary' => true), 'setting_value' => array('type' => 'TEXT', 'notnull' => true, 'default' => 0)));
} catch (\Cx\Lib\UpdateException $e) {
return \Cx\Lib\UpdateUtil::DefaultActionHandler($e);
}
$ins_tpl = "\n INSERT INTO " . DBPREFIX . "module_ecard_settings (setting_name, setting_value)\n VALUES ('%s', '%s')\n ON DUPLICATE KEY UPDATE `setting_name` = `setting_name`\n ";
$insert_values = array(array('maxCharacters', '100'), array('maxLines', '50'), array('motive_0', 'Bild_001.jpg'), array('motive_1', 'Bild_002.jpg'), array('motive_2', ''), array('motive_3', ''), array('motive_4', ''), array('motive_5', ''), array('motive_6', ''), array('motive_7', ''), array('motive_8', ''), array('maxHeight', '300'), array('validdays', '30'), array('maxWidth', '300'), array('maxHeightThumb', '80'), array('maxWidthThumb', '80'), array('subject', 'Sie haben eine E-Card erhalten!'), array('emailText', "[[ECARD_SENDER_NAME]] hat Ihnen eine E-Card geschickt.<br />\n Sie können diese während den nächsten [[ECARD_VALID_DAYS]] Tagen unter [[ECARD_URL]] abrufen."));
foreach ($insert_values as $setting) {
$query = sprintf($ins_tpl, addslashes($setting[0]), addslashes($setting[1]));
if (!$objDatabase->Execute($query)) {
return _databaseError($query, $objDatabase->ErrorMsg());
}
}
/* * **********************************************
* BUGFIX: Set write access to the image dir *
* ********************************************** */
$arrImagePaths = array(array(ASCMS_DOCUMENT_ROOT . '/images/modules/ecard', ASCMS_PATH_OFFSET . '/images/modules/ecard'), array(ASCMS_ECARD_OPTIMIZED_PATH, ASCMS_ECARD_OPTIMIZED_WEB_PATH), array(ASCMS_ECARD_SEND_ECARDS_PATH, ASCMS_ECARD_SEND_ECARDS_WEB_PATH), array(ASCMS_ECARD_THUMBNAIL_PATH, ASCMS_ECARD_THUMBNAIL_WEB_PATH));
foreach ($arrImagePaths as $arrImagePath) {
if (\Cx\Lib\FileSystem\FileSystem::makeWritable($arrImagePath[0])) {
if ($mediaDir = @opendir($arrImagePath[0])) {
while ($file = readdir($mediaDir)) {
if ($file != '.' && $file != '..') {
if (!\Cx\Lib\FileSystem\FileSystem::makeWritable($arrImagePath[0] . '/' . $file)) {
setUpdateMsg(sprintf($_ARRAYLANG['TXT_SET_WRITE_PERMISSON_TO_FILE'], $arrImagePath[0] . '/' . $file, $_CORELANG['TXT_UPDATE_TRY_AGAIN']), 'msg');
return false;
}
}
}
} else {
setUpdateMsg(sprintf($_ARRAYLANG['TXT_SET_WRITE_PERMISSON_TO_DIR_AND_CONTENT'], $arrImagePath[0] . '/', $_CORELANG['TXT_UPDATE_TRY_AGAIN']), 'msg');
return false;
}
} else {
setUpdateMsg(sprintf($_ARRAYLANG['TXT_SET_WRITE_PERMISSON_TO_DIR_AND_CONTENT'], $arrImagePath[0] . '/', $_CORELANG['TXT_UPDATE_TRY_AGAIN']), 'msg');
return false;
}
}
return true;
}
开发者ID:nahakiole,项目名称:cloudrexx,代码行数:43,代码来源:ecard.php
示例18: crmUpdates
function crmUpdates()
{
//Update the database changes
try {
//update module name
\Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "modules` SET `name` = 'Crm' WHERE `id` = 69");
//update navigation url
\Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "backend_areas` SET `uri` = 'index.php?cmd=Crm&act=customers' WHERE `area_id` = 191");
\Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "backend_areas` SET `uri` = 'index.php?cmd=Crm&act=task' WHERE `area_id` = 192");
\Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "backend_areas` SET `uri` = 'index.php?cmd=Crm&act=deals' WHERE `area_id` = 193");
\Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "backend_areas` SET `uri` = 'index.php?cmd=Crm&act=settings' WHERE `area_id` = 195");
//Insert component entry
\Cx\Lib\UpdateUtil::sql("INSERT INTO `" . DBPREFIX . "component` (`id`, `name`, `type`) VALUES ('69', 'Crm', 'module')");
//update module name for email templates
\Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "core_mail_template` SET `section` = 'Crm' WHERE `section` = 'crm'");
\Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "core_text` SET `section` = 'Crm' WHERE `section` = 'crm'");
//update module name for crm core settings
\Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "core_setting` SET `section` = 'Crm' WHERE `section` = 'crm'");
} catch (\Cx\Lib\UpdateException $e) {
return "Error: {$e->sql}";
}
//Update script for moving the folder
$crmImgPath = ASCMS_DOCUMENT_ROOT . '/images';
$crmMediaPath = ASCMS_DOCUMENT_ROOT . '/media';
try {
if (file_exists($crmImgPath . '/crm') && !file_exists($crmImgPath . '/Crm')) {
\Cx\Lib\FileSystem\FileSystem::makeWritable($crmImgPath . '/crm');
if (!\Cx\Lib\FileSystem\FileSystem::move($crmImgPath . '/crm', $crmImgPath . '/Crm')) {
return 'Failed to move the folder from ' . $crmImgPath . '/crm to ' . $crmImgPath . '/Crm.';
}
}
if (file_exists($crmMediaPath . '/crm') && !file_exists($crmMediaPath . '/Crm')) {
\Cx\Lib\FileSystem\FileSystem::makeWritable($crmMediaPath . '/crm');
if (!\Cx\Lib\FileSystem\FileSystem::move($crmMediaPath . '/crm', $crmMediaPath . '/Crm')) {
return 'Failed to move the folder from ' . $crmMediaPath . '/crm to ' . $crmMediaPath . '/Crm.';
}
}
} catch (\Cx\Lib\FileSystem\FileSystemException $e) {
return $e->getMessage();
}
return 'Crm updated successfully.';
}
开发者ID:Cloudrexx,项目名称:cloudrexx,代码行数:42,代码来源:Crm.php
示例19: shopUpdates
function shopUpdates()
{
//Update the database changes
try {
//update module name
\Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "modules` SET `name` = 'Shop' WHERE `id` = 16");
//update navigation url
\Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "backend_areas` SET `uri` = 'index.php?cmd=Shop' WHERE `area_id` = 13");
//Insert component entry
\Cx\Lib\UpdateUtil::sql("INSERT INTO `" . DBPREFIX . "component` (`id`, `name`, `type`) VALUES ('16', 'Shop', 'module')");
//update module name for frontend pages
\Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "content_page` SET `module` = 'Shop' WHERE `module` = 'shop'");
//update module name for crm core settings
\Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "core_setting` SET `section` = 'Shop' WHERE `section` = 'shop'");
//update module name for email templates
\Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "core_mail_template` SET `section` = 'Shop' WHERE `section` = 'shop'");
\Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "core_text` SET `section` = 'Shop' WHERE `section` = 'shop'");
} catch (\Cx\Lib\UpdateException $e) {
return "Error: {$e->sql}";
}
//Update script for moving the folder
$shopImgPath = ASCMS_DOCUMENT_ROOT . '/images';
$shopMediaPath = ASCMS_DOCUMENT_ROOT . '/media';
try {
if (file_exists($shopIm
|
请发表评论