Example #1
0
 public function activate_files($ptID)
 {
     try {
         Loader::model("collection_types");
         $pt = PageTheme::getByID($ptID);
         $txt = Loader::helper('text');
         if (!is_array($this->post('pageTypes'))) {
             throw new Exception(t("You must specify at least one template to make into a page type."));
         }
         $pkg = false;
         $pkgHandle = $pt->getPackageHandle();
         if ($pkgHandle) {
             $pkg = Package::getByHandle($pkgHandle);
         }
         foreach ($this->post('pageTypes') as $ptHandle) {
             $data['ctName'] = $txt->unhandle($ptHandle);
             $data['ctHandle'] = $ptHandle;
             $ct = CollectionType::add($data, $pkg);
         }
         $this->set('message', t('Files in the theme were activated successfully.'));
     } catch (Exception $e) {
         $this->set('error', $e);
     }
     $this->view($ptID);
 }
Example #2
0
	public function reset() {
		$vt = Loader::helper('validation/token');
		if ($vt->validate()) {
			$themeID = $this->post('themeID');
			$pt = PageTheme::getByID($themeID);
			if (is_object($pt)) {
				$values = $pt->reset();
				$this->redirect('/dashboard/pages/themes/customize', 'view', $themeID, 'reset');
			}
		}
	}
Example #3
0
<?php

defined('C5_EXECUTE') or die("Access Denied.");
$u = new User();
$form = Loader::helper('form');
$sh = Loader::helper('concrete/dashboard/sitemap');
if (!$sh->canRead()) {
    die(t('Access Denied'));
}
if ($_POST['task'] == 'design_pages') {
    $json['error'] = false;
    if ($_POST['plID'] > 0) {
        $pl = PageTheme::getByID($_POST['plID']);
    }
    if ($_POST['ctID'] > 0) {
        $ct = CollectionType::getByID($_POST['ctID']);
    }
    if (is_array($_POST['cID'])) {
        foreach ($_POST['cID'] as $cID) {
            $c = Page::getByID($cID);
            $cp = new Permissions($c);
            if ($cp->canEditPageTheme($pl)) {
                if ($_POST['plID'] > 0) {
                    $c->setTheme($pl);
                }
                if ($_POST['ctID'] > 0 && (!$c->isMasterCollection() && !$c->isGeneratedCollection())) {
                    $parentC = Page::getByID($c->getCollectionParentID());
                    $parentCP = new Permissions($parentC);
                    if ($c->getCollectionID() == HOME_CID || $parentCP->canAddSubCollection($ct)) {
                        $data = array('ctID' => $_POST['ctID']);
                        $c->update($data);
Example #4
0
 /**
  * Returns Collection's theme object
  * @return PageTheme
  */
 function getCollectionThemeObject()
 {
     if ($this->vObj->ptID < 1) {
         return PageTheme::getSiteTheme();
     } else {
         $pl = PageTheme::getByID($this->vObj->ptID);
         return $pl;
     }
 }
Example #5
0
	public function getSiteTheme() {
		$c = Page::getByID(HOME_CID);
		return PageTheme::getByID($c->getCollectionThemeID());
	}
Example #6
0
 public function activate_confirm($ptID, $token)
 {
     $l = PageTheme::getByID($ptID);
     $val = Loader::helper('validation/error');
     $valt = Loader::helper('validation/token');
     if (!$valt->validate('activate', $token)) {
         $val->add($valt->getErrorMessage());
         $this->set('error', $val);
     } else {
         if (!is_object($l)) {
             $val->add('Invalid Theme');
             $this->set('error', $val);
         } else {
             $l->applyToSite();
             $this->set('message', t('Theme activated'));
         }
     }
     $this->view();
 }
Example #7
0
<?php

defined('C5_EXECUTE') or die("Access Denied.");
Loader::model('collection_types');
Loader::library('view');
if (isset($_POST['ttask']) && $_POST['ttask'] == 'preview_theme_customization') {
    Cache::set('preview_theme_style', $_REQUEST['themeID'], $_POST, 30);
}
$previewCID = intval($_REQUEST['previewCID']);
$themeID = intval($_REQUEST['themeID']);
$ctID = intval($_REQUEST['ctID']);
$collectionType = CollectionType::getByID($ctID);
$c = Page::getByID($previewCID, 'RECENT');
//,"ACTIVE"
$cp = new Permissions($c);
if (!$cp->canEditPageTheme()) {
    throw new Exception(t('Access Denied'));
}
$v = View::getInstance();
if ($themeID > 0) {
    $th = PageTheme::getByID($themeID);
    if (!file_exists($th->getThemeDirectory())) {
        throw new Exception(t('Theme not found in %s', $th->getThemeDirectory()));
    }
    $v->setTheme($th);
}
$v->disableEditing();
$v->disableLinks();
$v->enablePreview();
$v->render($c);
Example #8
0
 public function checkMobileView()
 {
     if (isset($_COOKIE['ccmDisableMobileView']) && $_COOKIE['ccmDisableMobileView'] == true) {
         define('MOBILE_THEME_IS_ACTIVE', false);
         return false;
         // break out if we've said we don't want the mobile theme
     }
     $page = Page::getCurrentPage();
     if ($page instanceof Page && $page->isAdminArea()) {
         define('MOBILE_THEME_IS_ACTIVE', false);
         return false;
         // no mobile theme for the dashboard
     }
     Loader::library('3rdparty/mobile_detect');
     $md = new Mobile_Detect();
     if ($md->isMobile()) {
         $themeId = Config::get('MOBILE_THEME_ID');
         if ($themeId > 0) {
             $mobileTheme = PageTheme::getByID($themeId);
             if ($mobileTheme instanceof PageTheme) {
                 define('MOBILE_THEME_IS_ACTIVE', true);
                 // we have to grab the instance of the view
                 // since on_page_view doesn't give it to us
                 $this->setTheme($mobileTheme);
             }
         }
     }
     if (!defined('MOBILE_THEME_IS_ACTIVE')) {
         define('MOBILE_THEME_IS_ACTIVE', false);
     }
 }