本文整理匯總了PHP中Cx\Lib\FileSystem\FileSystem::sanitizeFile方法的典型用法代碼示例。如果您正苦於以下問題:PHP FileSystem::sanitizeFile方法的具體用法?PHP FileSystem::sanitizeFile怎麽用?PHP FileSystem::sanitizeFile使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Cx\Lib\FileSystem\FileSystem
的用法示例。
在下文中一共展示了FileSystem::sanitizeFile方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: __construct
/**
* PHP5 constructor
* @param string $template
* @param array $_ARRAYLANG
* @access public
*/
function __construct($pageContent, $archive)
{
$this->_arrSettings = $this->createSettingsArray();
$this->archive = intval(substr($archive, -1, 1)) == 0 ? 'Media1' : $archive;
$this->arrPaths = array(ASCMS_MEDIA1_PATH . '/', ASCMS_MEDIA2_PATH . '/', ASCMS_MEDIA3_PATH . '/', ASCMS_MEDIA4_PATH . '/');
$this->arrWebPaths = array('Media1' => ASCMS_MEDIA1_WEB_PATH . '/', 'Media2' => ASCMS_MEDIA2_WEB_PATH . '/', 'Media3' => ASCMS_MEDIA3_WEB_PATH . '/', 'Media4' => ASCMS_MEDIA4_WEB_PATH . '/');
$this->docRoot = \Env::get('cx')->getWebsitePath();
// sigma template
$this->pageContent = $pageContent;
$this->_objTpl = new \Cx\Core\Html\Sigma('.');
\Cx\Core\Csrf\Controller\Csrf::add_placeholder($this->_objTpl);
$this->_objTpl->setErrorHandling(PEAR_ERROR_DIE);
$this->_objTpl->setTemplate($this->pageContent, true, true);
// get variables
$this->getAct = (isset($_GET['act']) and !empty($_GET['act'])) ? trim($_GET['act']) : '';
$this->getFile = (isset($_GET['file']) and !empty($_GET['file'])) ? \Cx\Lib\FileSystem\FileSystem::sanitizeFile(trim($_GET['file'])) : '';
if ($this->getFile === false) {
$this->getFile = '';
}
$this->sortBy = !empty($_GET['sort']) ? trim($_GET['sort']) : 'name';
$this->sortDesc = !empty($_GET['sort_desc']);
}
示例2: __construct
/**
* PHP5 constructor
* @param string $objTemplate
* @param array $_ARRAYLANG
* @access public
*/
function __construct()
{
global $_ARRAYLANG, $_FTPCONFIG, $objTemplate, $objDatabase;
// sigma template
$this->_objTpl = new \Cx\Core\Html\Sigma(ASCMS_CORE_MODULE_PATH . '/Media/View/Template/Backend');
\Cx\Core\Csrf\Controller\Csrf::add_placeholder($this->_objTpl);
$this->_objTpl->setErrorHandling(PEAR_ERROR_DIE);
$this->arrPaths = array(ASCMS_MEDIA1_PATH . DIRECTORY_SEPARATOR, ASCMS_MEDIA2_PATH . DIRECTORY_SEPARATOR, ASCMS_MEDIA3_PATH . DIRECTORY_SEPARATOR, ASCMS_MEDIA4_PATH . DIRECTORY_SEPARATOR, ASCMS_FILESHARING_PATH . DIRECTORY_SEPARATOR, ASCMS_CONTENT_IMAGE_PATH . DIRECTORY_SEPARATOR, ASCMS_SHOP_IMAGES_PATH . DIRECTORY_SEPARATOR, ASCMS_THEMES_PATH . DIRECTORY_SEPARATOR, ASCMS_ATTACH_PATH . DIRECTORY_SEPARATOR, ASCMS_ACCESS_PATH . DIRECTORY_SEPARATOR, ASCMS_BLOG_IMAGES_PATH . DIRECTORY_SEPARATOR, ASCMS_CALENDAR_IMAGE_PATH . DIRECTORY_SEPARATOR, ASCMS_DOWNLOADS_IMAGES_PATH . DIRECTORY_SEPARATOR, ASCMS_GALLERY_PATH . DIRECTORY_SEPARATOR, ASCMS_MEDIADIR_IMAGES_PATH . DIRECTORY_SEPARATOR, ASCMS_PODCAST_IMAGES_PATH . DIRECTORY_SEPARATOR);
$this->arrWebPaths = array('archive1' => ASCMS_MEDIA1_WEB_PATH . '/', 'archive2' => ASCMS_MEDIA2_WEB_PATH . '/', 'archive3' => ASCMS_MEDIA3_WEB_PATH . '/', 'archive4' => ASCMS_MEDIA4_WEB_PATH . '/', 'FileSharing' => ASCMS_FILESHARING_WEB_PATH . '/', 'content' => ASCMS_CONTENT_IMAGE_WEB_PATH . '/', 'Contact' => ASCMS_ATTACH_WEB_PATH . '/', 'Shop' => ASCMS_SHOP_IMAGES_WEB_PATH . '/', 'themes' => ASCMS_THEMES_WEB_PATH . '/', 'attach' => ASCMS_ATTACH_WEB_PATH . '/', 'Access' => ASCMS_ACCESS_WEB_PATH . '/', 'Blog' => ASCMS_BLOG_IMAGES_WEB_PATH . '/', 'Calendar' => ASCMS_CALENDAR_IMAGE_WEB_PATH . '/', 'Downloads' => ASCMS_DOWNLOADS_IMAGES_WEB_PATH . '/', 'Gallery' => ASCMS_GALLERY_WEB_PATH . '/', 'MediaDir' => ASCMS_MEDIADIR_IMAGES_WEB_PATH . '/', 'Podcast' => ASCMS_PODCAST_IMAGES_WEB_PATH . '/');
$moduleMatchTable = array('archive1' => 'Media1', 'archive2' => 'Media2', 'archive3' => 'Media3', 'archive4' => 'Media4', 'content' => 'core', 'themes' => 'core', 'attach' => 'core');
$license = \Cx\Core_Modules\License\License::getCached($_CONFIG, $objDatabase);
$license->check();
foreach ($this->arrWebPaths as $module => $path) {
$moduleName = $module;
if (isset($moduleMatchTable[$module])) {
$moduleName = $moduleMatchTable[$module];
}
if (!$license->isInLegalComponents($moduleName)) {
\DBG::msg('Module "' . $module . '" is deactivated');
unset($this->arrWebPaths[$module]);
}
}
if (empty($this->arrWebPaths)) {
\Permission::noAccess();
}
if (isset($_REQUEST['archive']) && array_key_exists($_REQUEST['archive'], $this->arrWebPaths)) {
$this->archive = $_REQUEST['archive'];
} else {
$this->archive = 'content';
}
// get variables
$this->getAct = isset($_POST['deleteMedia']) && $_POST['deleteMedia'] ? 'delete' : (!empty($_GET['act']) ? trim($_GET['act']) : '');
$this->getPath = isset($_GET['path']) ? \Cx\Lib\FileSystem\FileSystem::sanitizePath($_GET['path']) : false;
if ($this->getPath === false) {
$this->getPath = $this->arrWebPaths[$this->archive];
}
$this->getFile = isset($_REQUEST['file']) ? \Cx\Lib\FileSystem\FileSystem::sanitizeFile($_REQUEST['file']) : false;
if ($this->getFile === false) {
$this->getFile = '';
}
$this->getData = !empty($_GET['data']) ? $_GET['data'] : '';
$this->sortBy = !empty($_GET['sort']) ? trim($_GET['sort']) : 'name';
$this->sortDesc = !empty($_GET['sort_desc']);
$this->shopEnabled = $this->checkModule('Shop');
if ($this->archive == 'themes') {
$_SESSION["skins"] = true;
} else {
$_SESSION["skins"] = false;
}
switch ($this->archive) {
case 'themes':
\Permission::checkAccess(21, 'static');
$objTemplate->setVariable("CONTENT_NAVIGATION", "<a href='index.php?cmd=Media&archive=content'>" . $_ARRAYLANG['TXT_IMAGE_CONTENT'] . "</a>\n <a href='index.php?cmd=Media&archive=attach'>" . $_ARRAYLANG['TXT_MODULE'] . "</a>\n <a href='index.php?cmd=Media&archive=themes' class='active'>" . $_ARRAYLANG['TXT_MEDIA_LAYOUT'] . "</a>");
break;
case 'content':
\Permission::checkAccess(32, 'static');
$objTemplate->setVariable('CONTENT_NAVIGATION', '
<a href="index.php?cmd=Media&archive=content" class="active">' . $_ARRAYLANG['TXT_IMAGE_CONTENT'] . '</a>
<a href="index.php?cmd=Media&archive=attach">' . $_ARRAYLANG['TXT_MODULE'] . '</a>
<a href="index.php?cmd=Media&archive=themes">' . $_ARRAYLANG['TXT_MEDIA_LAYOUT'] . '</a>');
break;
case 'Contact':
\Permission::checkAccess(84, 'static');
$objTemplate->setVariable('CONTENT_NAVIGATION', '
<a href="index.php?cmd=Contact" title="' . $_ARRAYLANG['TXT_CONTACT_CONTACT_FORMS'] . '">' . $_ARRAYLANG['TXT_FORMS'] . '</a>
<a hreF="index.php?cmd=Media&archive=Contact" title="' . $_ARRAYLANG['TXT_FILE_UPLOADS'] . '" class="active">' . $_ARRAYLANG['TXT_FILE_UPLOADS'] . '</a>
<a href="index.php?cmd=Contact&act=settings" title="' . $_ARRAYLANG['TXT_CONTACT_SETTINGS'] . '">' . $_ARRAYLANG['TXT_CONTACT_SETTINGS'] . '</a>
');
break;
case 'FileSharing':
\Permission::checkAccess(8, 'static');
$objTemplate->setVariable('CONTENT_NAVIGATION', '
<a href="index.php?cmd=Media&archive=FileSharing"' . (!isset($_GET['act']) || $_GET['act'] == 'filesharing' ? ' class="active"' : '') . '>' . $_ARRAYLANG['TXT_FILESHARING_MODULE'] . '</a>
<a href="index.php?cmd=Media&archive=FileSharing&act=settings"' . (isset($_GET['act']) && $_GET['act'] == 'settings' ? ' class="active"' : '') . '>' . $_ARRAYLANG['TXT_MEDIA_SETTINGS'] . '</a>
');
break;
case 'attach':
\Permission::checkAccess(84, 'static');
$objTemplate->setVariable('CONTENT_NAVIGATION', '
<a href="index.php?cmd=Media&archive=content">' . $_ARRAYLANG['TXT_IMAGE_CONTENT'] . '</a>
<a href="index.php?cmd=Media&archive=attach" class="active">' . $_ARRAYLANG['TXT_MODULE'] . '</a>
<a href="index.php?cmd=Media&archive=themes">' . $_ARRAYLANG['TXT_MEDIA_LAYOUT'] . '</a>
');
break;
case 'Access':
\Permission::checkAccess(18, 'static');
$objTemplate->setVariable('CONTENT_NAVIGATION', '
<a href="index.php?cmd=Media&archive=content">' . $_ARRAYLANG['TXT_IMAGE_CONTENT'] . '</a>
<a href="index.php?cmd=Media&archive=attach" class="active">' . $_ARRAYLANG['TXT_MODULE'] . '</a>
<a href="index.php?cmd=Media&archive=themes">' . $_ARRAYLANG['TXT_MEDIA_LAYOUT'] . '</a>
');
break;
case 'Blog':
\Permission::checkAccess(119, 'static');
//.........這裏部分代碼省略.........