예제 #1
0
if (sensitiveIO::isPositiveInteger($templateId)) {
    $template = CMS_pageTemplatesCatalog::getByID($templateId);
    if (!$template || $template->hasError()) {
        CMS_grandFather::raiseError('Unknown template for given Id : ' . $templateId);
        $view->show();
    }
} else {
    //create new user
    $template = new CMS_pageTemplate();
}
//MAIN TAB
//Need to sanitize all datas which can contain single quotes
$label = sensitiveIO::sanitizeJSString($template->getLabel());
$description = sensitiveIO::sanitizeJSString($template->getDescription(), false, true, true);
//this is a textarea, we must keep cariage return
$templateDefinition = $template->getDefinition();
$imageName = $template->getImage();
$templateGroups = $template->getGroups();
$websitesDenied = $template->getWebsitesDenied();
//image
$maxFileSize = CMS_file::getMaxUploadFileSize('K');
if ($imageName && file_exists(PATH_TEMPLATES_IMAGES_FS . '/' . $imageName) && $imageName != 'nopicto.gif') {
    $image = new CMS_file(PATH_TEMPLATES_IMAGES_FS . '/' . $imageName);
    $imageDatas = array('filename' => $image->getName(false), 'filepath' => $image->getFilePath(CMS_file::WEBROOT), 'filesize' => $image->getFileSize(), 'fileicon' => $image->getFileIcon(CMS_file::WEBROOT), 'extension' => $image->getExtension());
} else {
    $imageDatas = array('filename' => '', 'filepath' => '', 'filesize' => '', 'fileicon' => '', 'extension' => '');
}
$imageDatas = sensitiveIO::jsonEncode($imageDatas);
$fileDatas = array('filename' => '', 'filepath' => '', 'filesize' => '', 'fileicon' => '', 'extension' => '');
//Groups
$allGroups = CMS_pageTemplatesCatalog::getAllGroups();