public function getCMSActions(GlobalContent $record)
 {
     if ($record->hasMethod('getAllCMSActions')) {
         $actions = $record->getAllCMSActions();
     } else {
         $actions = $record->getCMSActions();
         // add default actions if none are defined
         if (!$actions || !$actions->Count()) {
             if ($record->hasMethod('canEdit') && $record->canEdit()) {
                 $actions->push(FormAction::create('save', _t('CMSMain.SAVE', 'Save'))->addExtraClass('ss-ui-action-constructive')->setAttribute('data-icon', 'accept'));
             }
             if ($record->hasMethod('canDelete') && $record->canDelete()) {
                 $actions->push(FormAction::create('delete', _t('ModelAdmin.DELETE', 'Delete'))->addExtraClass('ss-ui-action-destructive'));
             }
         }
     }
     // Use <button> to allow full jQuery UI styling
     $actionsFlattened = $actions->dataFields();
     if ($actionsFlattened) {
         foreach ($actionsFlattened as $action) {
             $action->setUseButtonTag(true);
         }
     }
     return $actions;
 }
check_login();
$gCms = cmsms();
$gcbops = $gCms->GetGlobalContentOperations();
$userid = get_userid();
$adminaccess = check_permission($userid, 'Modify Global Content Blocks');
$isowner = $gcbops->CheckOwnership($htmlblob_id, $userid);
$access = $adminaccess || $isowner || $gcbops->CheckAuthorship($htmlblob_id, $userid);
if (isset($_POST["cancel"])) {
    redirect("listhtmlblobs.php" . $urlext);
    return;
}
$the_blob = '';
if ($htmlblob_id > 0) {
    $the_blob = $gcbops->LoadHtmlBlobById($htmlblob_id);
} else {
    $the_blob = new GlobalContent();
}
$htmlblob = $the_blob->name;
$oldhtmlblob = $the_blob->name;
$owner_id = $the_blob->owner;
$content = $the_blob->content;
$use_wysiwyg = $the_blob->use_wysiwyg;
$description = $the_blob->description;
$ajax = false;
$error = "";
if (isset($_POST['htmlblob'])) {
    $htmlblob = trim($_POST['htmlblob']);
}
if (isset($_POST['oldhtmlblob'])) {
    $oldhtmlblob = trim($_POST['oldhtmlblob']);
}
Exemple #3
0
         $error .= "<li>" . lang('blobexists') . "</li>";
         $validinfo = false;
     } elseif (preg_match('<^[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*$>', $htmlblob) == 0) {
         $error .= "<li>" . lang('illegalcharacters', lang('name')) . "</li>";
         $validinfo = false;
     } else {
         if ($content == "") {
             $error .= '<li>' . lang('nofieldgiven', array(lang('content'))) . '</li>';
             $validinfo = false;
         }
     }
 }
 if ($validinfo) {
     $gCms = cmsms();
     $gcbops = $gCms->GetGlobalContentOperations();
     $blobobj = new GlobalContent();
     $blobobj->name = $htmlblob;
     $blobobj->content = $content;
     $blobobj->owner = $userid;
     $blobobj->use_wysiwyg = $use_wysiwyg;
     $blobobj->description = $description;
     Events::SendEvent('Core', 'AddGlobalContentPre', array('global_content' => &$blobobj));
     $result = $blobobj->save();
     if ($result) {
         if (isset($_POST["additional_editors"])) {
             foreach ($_POST["additional_editors"] as $addt_user_id) {
                 $blobobj->AddAuthor($addt_user_id);
             }
         }
         // put mention into the admin log
         audit($blobobj->id, 'Global Content Block: ' . $blobobj->name, 'Added');
 public static function GlobalContent($key = null)
 {
     $inst = GlobalContent::inst();
     return is_null($key) ? $inst : $inst->{$key};
 }
Exemple #5
0
}
if (isset($_POST["cancel"])) {
    redirect("listhtmlblobs.php" . $urlext);
    return;
}
global $gCms;
$gcbops =& $gCms->GetGlobalContentOperations();
$userid = get_userid();
$adminaccess = check_permission($userid, 'Modify Global Content Blocks');
$isowner = $gcbops->CheckOwnership($htmlblob_id, $userid);
$access = $adminaccess || $isowner || $gcbops->CheckAuthorship($htmlblob_id, $userid);
$the_blob = '';
if ($htmlblob_id > 0) {
    $the_blob = $gcbops->LoadHtmlBlobById($htmlblob_id);
} else {
    $the_blob = new GlobalContent();
}
/*
$htmlarea_flag = false;
$use_javasyntax = false;

if (get_preference($userid, 'use_wysiwyg') == "1")
{
	$htmlarea_flag = true;
    $use_javasyntax = false;
}
else if (get_preference($userid, 'use_javasyntax') == "1")
{
    $use_javasyntax = true;
}
*/