Exemplo n.º 1
1
 public function getAllowedFileExtensions()
 {
     $u = new User();
     $extensions = array();
     if ($u->isSuperUser()) {
         $extensions = Loader::helper('concrete/file')->getAllowedFileExtensions();
         return $extensions;
     }
     $pae = $this->getPermissionAccessObject();
     if (!is_object($pae)) {
         return array();
     }
     $accessEntities = $u->getUserAccessEntityObjects();
     $accessEntities = $pae->validateAndFilterAccessEntities($accessEntities);
     $list = $this->getAccessListItems(FileSetPermissionKey::ACCESS_TYPE_ALL, $accessEntities);
     $list = PermissionDuration::filterByActive($list);
     foreach ($list as $l) {
         if ($l->getFileTypesAllowedPermission() == 'N') {
             $extensions = array();
         }
         if ($l->getFileTypesAllowedPermission() == 'C') {
             $extensions = array_unique(array_merge($extensions, $l->getFileTypesAllowedArray()));
         }
         if ($l->getFileTypesAllowedPermission() == 'A') {
             $extensions = Loader::helper('concrete/file')->getAllowedFileExtensions();
         }
     }
     return $extensions;
 }
Exemplo n.º 2
0
 function update_modern_thumbnail()
 {
     if ($this->token->validate('update_modern_thumbnail')) {
         if (intval($this->post('remove_icon')) == 1) {
             Config::save('MODERN_TILE_THUMBNAIL_FID', 0);
             $this->redirect('/dashboard/system/basics/icons/', 'modern_icon_removed');
         } else {
             Loader::library('file/importer');
             $fi = new FileImporter();
             $resp = $fi->import($_FILES['favicon_file']['tmp_name'], $_FILES['favicon_file']['name'], $fr);
             if (!$resp instanceof FileVersion) {
                 switch ($resp) {
                     case FileImporter::E_FILE_INVALID_EXTENSION:
                         $this->error->add(t('Invalid file extension.'));
                         break;
                     case FileImporter::E_FILE_INVALID:
                         $this->error->add(t('Invalid file.'));
                         break;
                 }
             } else {
                 Config::save('MODERN_TILE_THUMBNAIL_FID', $resp->getFileID());
                 Config::save('MODERN_TILE_THUMBNAIL_BGCOLOR', Loader::helper('security')->sanitizeString($this->post('favicon_bgcolor')));
                 $this->redirect('/dashboard/system/basics/icons/', 'modern_icon_saved');
             }
         }
     } else {
         $this->set('error', array($this->token->getErrorMessage()));
     }
 }
Exemplo n.º 3
0
 public function view($nodeID = 1, $auxMessage = false)
 {
     $dh = Loader::helper('concrete/dashboard/sitemap');
     if ($dh->canRead()) {
         $this->set('nodeID', $nodeID);
         $nodes = $dh->getSubNodes($nodeID, 1, false, false);
         $instanceID = time();
         $this->set('listHTML', $dh->outputRequestHTML($instanceID, 'explore', false, $nodes));
         $this->set('instanceID', $instanceID);
     }
     if (isset($_REQUEST['task']) && isset($_REQUEST['cNodeID'])) {
         $nc = Page::getByID($_REQUEST['cNodeID']);
         if ($_REQUEST['task'] == 'send_to_top') {
             $nc->movePageDisplayOrderToTop();
         } else {
             if ($_REQUEST['task'] == 'send_to_bottom') {
                 $nc->movePageDisplayOrderToBottom();
             }
         }
         $this->redirect('/dashboard/sitemap/explore', $nc->getCollectionParentID(), 'order_updated');
     }
     if ($auxMessage != false) {
         switch ($auxMessage) {
             case 'order_updated':
                 $this->set('message', t('Sort order saved'));
                 break;
         }
     }
     $this->set('dh', $dh);
 }
Exemplo n.º 4
0
	public function execute($encrypt = false) {
		$db = Loader::db();
		if (!file_exists(DIR_FILES_BACKUPS)) {
			mkdir(DIR_FILES_BACKUPS);
			file_put_contents(DIR_FILES_BACKUPS . "/.htaccess","Order Deny,Allow\nDeny from all");
		}
		$str_bkupfile = "dbu_". time() .".sql";
		$arr_tables = $db->getCol("SHOW TABLES FROM `" . DB_DATABASE . "`");
		foreach ($arr_tables as $bkuptable) {
			$tableobj = new Concrete5_Library_Backup_BackupTable($bkuptable);
			$str_backupdata .= "DROP TABLE IF EXISTS $bkuptable;\n\n";
			$str_backupdata .= $tableobj->str_createTableSql . "\n\n";
			if ($tableobj->str_createTableSql != "" ) {
				$str_backupdata .= $tableobj->str_insertionSql . "\n\n";
			}
		}
		$fh_backupfile = @fopen(DIR_FILES_BACKUPS . "/". $str_bkupfile,"w");
		if (!$fh_backupfile) {
			throw new Exception(t('Unable to create backup file: %s', $str_bkupfile));
		}
		if ($encrypt == true) {
			$crypt = Loader::helper('encryption');
			fwrite($fh_backupfile,$crypt->encrypt($str_backupdata));
		} else  {
			fwrite($fh_backupfile,$str_backupdata);
		}
		fclose($fh_backupfile);
		//for security
		chmod(DIR_FILES_BACKUPS . "/". $str_bkupfile,000);
	}
Exemplo n.º 5
0
 public function view($page = 0)
 {
     $this->set('title', t('Logs'));
     $pageBase = View::url('/dashboard/reports/logs', 'view');
     $paginator = Loader::helper('pagination');
     $total = Log::getTotal($_REQUEST['keywords'], $_REQUEST['logType']);
     $paginator->init(intval($page), $total, $pageBase . '/%pageNum%/?keywords=' . $_REQUEST['keywords'] . '&logType=' . $_REQUEST['logType'], 10);
     $limit = $paginator->getLIMIT();
     $types = Log::getTypeList();
     $txt = Loader::helper('text');
     $logTypes = array();
     $logTypes[''] = '** ' . t('All');
     foreach ($types as $t) {
         if ($t == '') {
             $logTypes[''] = '** ' . t('All');
         } else {
             $logTypes[$t] = $txt->unhandle($t);
         }
     }
     $entries = Log::getList($_REQUEST['keywords'], $_REQUEST['logType'], $limit);
     $this->set('keywords', $keywords);
     $this->set('pageBase', $pageBase);
     $this->set('entries', $entries);
     $this->set('paginator', $paginator);
     $this->set('logTypes', $logTypes);
 }
Exemplo n.º 6
0
 public function __construct()
 {
     parent::__construct();
     $html = Loader::helper('html');
     $this->set('av', Loader::helper('concrete/avatar'));
     $this->addHeaderItem($html->javascript('swfobject.js'));
 }
 public function update_library()
 {
     if (Loader::helper("validation/token")->validate('update_library')) {
         if ($this->post('activeLibrary')) {
             $scl = SystemAntispamLibrary::getByHandle($this->post('activeLibrary'));
             if (is_object($scl)) {
                 $scl->activate();
                 Config::save('ANTISPAM_NOTIFY_EMAIL', $this->post('ANTISPAM_NOTIFY_EMAIL'));
                 Config::save('ANTISPAM_LOG_SPAM', $this->post('ANTISPAM_LOG_SPAM'));
                 if ($scl->hasOptionsForm() && $this->post('ccm-submit-submit')) {
                     $controller = $scl->getController();
                     $controller->saveOptions($this->post());
                 }
                 $this->redirect('/dashboard/system/permissions/antispam', 'saved');
             } else {
                 $this->error->add(t('Invalid anti-spam library.'));
             }
         } else {
             SystemAntispamLibrary::deactivateAll();
         }
     } else {
         $this->error->add(Loader::helper('validation/token')->getErrorMessage());
     }
     $this->view();
 }
Exemplo n.º 8
0
 public function add_set()
 {
     $this->category($this->post('categoryID'));
     if ($this->token->validate('add_set')) {
         if (!trim($this->post('asHandle'))) {
             $this->error->add(t("Specify a handle for your attribute set."));
         } else {
             $as = AttributeSet::getByHandle($this->post('asHandle'));
             if (is_object($as)) {
                 $this->error->add(t('That handle is in use.'));
             }
         }
         if (!trim($this->post('asName'))) {
             $this->error->add(t("Specify a name for your attribute set."));
         } else {
             if (preg_match('/[<>;{}?"`]/', trim($this->post('asName')))) {
                 $this->error->add(t('Name cannot contain the characters: %s', Loader::helper('text')->entities('<>;{}?`')));
             }
         }
         if (!$this->error->has()) {
             if (!$this->category->allowAttributeSets()) {
                 $this->category->setAllowAttributeSets(AttributeKeyCategory::ASET_ALLOW_SINGLE);
             }
             $this->category->addSet($this->post('asHandle'), $this->post('asName'), false, 0);
             $this->redirect('dashboard/system/attributes/sets', 'category', $this->category->getAttributeKeyCategoryID(), 'set_added');
         }
     } else {
         $this->error->add($this->token->getErrorMessage());
     }
 }
Exemplo n.º 9
0
 public function view($userID = 0)
 {
     if (!ENABLE_USER_PROFILES) {
         $this->render("/page_not_found");
     }
     $html = Loader::helper('html');
     $canEdit = false;
     $u = new User();
     if ($userID > 0) {
         $profile = UserInfo::getByID($userID);
         if (!is_object($profile)) {
             throw new Exception('Invalid User ID.');
         }
     } else {
         if ($u->isRegistered()) {
             $profile = UserInfo::getByID($u->getUserID());
             $canEdit = true;
         } else {
             $this->set('intro_msg', t('You must sign in order to access this page!'));
             $this->render('/login');
         }
     }
     $this->set('profile', $profile);
     $this->set('av', Loader::helper('concrete/avatar'));
     $this->set('t', Loader::helper('text'));
     $this->set('canEdit', $canEdit);
 }
Exemplo n.º 10
0
 /** 
  * Display the captcha
  */
 public function display()
 {
     // @TODO: How do we properly print a picture using a helper function?
     $ci = Loader::helper('concrete/urls');
     echo '<img src="' . $ci->getToolsURL('captcha') . '?nocache=' . time() . '" alt="' . t('Captcha Code') . '" onclick="this.src = \'' . $ci->getToolsURL('captcha') . '?nocache=' . $time . '\'" class="ccm-captcha-image" />';
     echo t('Click the image to see another captcha.');
 }
Exemplo n.º 11
0
 public function view()
 {
     $uh = Loader::helper('concrete/urls');
     $bt = BlockType::getByHandle('switch_language');
     Loader::model('section', 'multilingual');
     $ml = MultilingualSection::getList();
     $c = Page::getCurrentPage();
     $al = MultilingualSection::getBySectionOfSite($c);
     $languages = array();
     $locale = ACTIVE_LOCALE;
     if (is_object($al)) {
         $locale = $al->getLanguage();
     }
     foreach ($ml as $m) {
         $languages[$m->getCollectionID()] = $m->getLanguageText($locale) . ' ' . (strlen($m->msIcon) ? '(' . $m->msIcon . ')' : '');
     }
     $this->set('languages', $languages);
     $this->set('languageSections', $ml);
     $this->set('action', $uh->getBlockTypeToolsURL($bt) . '/switch');
     if (is_object($al)) {
         $this->set('activeLanguage', $al->getCollectionID());
     }
     $pkg = Package::getByHandle('multilingual');
     $mdl = Loader::helper('default_language', 'multilingual');
     $this->set('defaultLanguage', $mdl->getSessionDefaultLocale());
     $this->set('cID', $c->getCollectionID());
 }
Exemplo n.º 12
0
 public function view($updated = false)
 {
     Loader::library('database_indexed_search');
     if ($this->post('reindex')) {
         IndexedSearch::clearSearchIndex();
         $this->redirect('/dashboard/system/seo/search_index', 'index_cleared');
     } else {
         if ($updated) {
             $this->set('message', t('Search Index Preferences Updated'));
         }
         if ($this->isPost()) {
             if ($this->token->validate('update_search_index')) {
                 $areas = $this->post('arHandle');
                 if (!is_array($areas)) {
                     $areas = array();
                 }
                 Config::save('SEARCH_INDEX_AREA_LIST', serialize($areas));
                 Config::save('SEARCH_INDEX_AREA_METHOD', Loader::helper('security')->sanitizeString($this->post('SEARCH_INDEX_AREA_METHOD')));
                 $this->redirect('/dashboard/system/seo/search_index', 'updated');
             } else {
                 $this->set('error', array($this->token->getErrorMessage()));
             }
         }
         $areas = Area::getHandleList();
         $selectedAreas = array();
         $this->set('areas', $areas);
         $this->set('selectedAreas', IndexedSearch::getSavedSearchableAreas());
     }
 }
Exemplo n.º 13
0
 public function flush()
 {
     $fh = Loader::helper("file");
     $fh->removeAll(DIR_FILES_PAGE_CACHE);
     /* WEIYM: tune to support cache for mobile */
     $fh->removeAll(DIR_FILES_PAGE_CACHE_MOBILE);
 }
 public function getThumbnailRelativePath($prefix, $filename, $level)
 {
     switch ($level) {
         case 2:
             $rel = REL_DIR_FILES_UPLOADED_THUMBNAILS_LEVEL2;
             $base = DIR_FILES_UPLOADED_THUMBNAILS_LEVEL2;
             break;
         case 3:
             $rel = REL_DIR_FILES_UPLOADED_THUMBNAILS_LEVEL3;
             $base = DIR_FILES_UPLOADED_THUMBNAILS_LEVEL3;
             break;
         default:
             // level 1
             $rel = REL_DIR_FILES_UPLOADED_THUMBNAILS;
             $base = DIR_FILES_UPLOADED_THUMBNAILS;
             break;
     }
     $hi = Loader::helper('file');
     $fullpath = $this->mapSystemPath($prefix, $filename, $createDirectories, $base);
     if (!file_exists($fullpath)) {
         $filename = $hi->replaceExtension($filename, 'jpg');
     }
     $path = $this->mapSystemPath($prefix, $filename, $createDirectories, $rel);
     return $path;
 }
Exemplo n.º 15
0
 public function init()
 {
     Loader::helper('admin:global');
     $list = template_list(1);
     $big_menu = big_menu('?app=template&controller=style&action=import', 'import', L('import_style'), 500, 250);
     include $this->view('style_list');
 }
Exemplo n.º 16
0
	/** 
	 * Creates form fields and JavaScript includes to add a color picker widget.
	 * <code>
	 *     $dh->datetime('yourStartDate', '2008-07-12 3:00:00');
	 * </code>
	 * @param string $fieldFormName
	 * @param string $fieldLabel
	 * @param string $value
	 * @param bool $includeJavaScript
	 */
	
	public function output($fieldFormName, $fieldLabel, $value = null, $includeJavaScript = true) {
		$html = '';
		$form = Loader::helper('form');

		$html .= '<div class="ccm-color-swatch-wrapper"><div class="ccm-color-swatch"><div id="f' . $fieldFormName . '" hex-color="' . $value . '" style="background-color:' . $value . '"></div></div></div>';
		$html .= $form->hidden($fieldFormName, $value);
		$html .= $form->label($fieldFormName, $fieldLabel);

		if ($includeJavaScript) { 
			$html .= "<script type=\"text/javascript\">
				$(function() {
					var f" .$fieldFormName. "Div =$('div#f" .$fieldFormName. "');
					var c" .$fieldFormName. " = f" .$fieldFormName. "Div.attr('hex-color'); 
					f" .$fieldFormName. "Div.ColorPicker({
						color: c" .$fieldFormName. ",  
						onSubmit: function(hsb, hex, rgb, cal) { 
							$('input[name=" . $fieldFormName . "]').val('#' + hex);				
							$('div#f" . $fieldFormName. "').css('backgroundColor', '#' + hex); 
							cal.hide();
						},  
						onNone: function(cal) {  
							$('input[name=" . $fieldFormName . "]').val('');		
							$('div#f" . $fieldFormName. "').css('backgroundColor',''); 
						}
					});
				
				});
				</script>";
		}
		return $html;		
		
	}
 public function save()
 {
     if (Loader::helper('validation/token')->validate('save_permissions')) {
         $tp = new TaskPermission();
         if ($tp->canAccessTaskPermissions()) {
             $permissions = PermissionKey::getList('sitemap');
             $permissions = array_merge($permissions, PermissionKey::getList('marketplace_newsflow'));
             $permissions = array_merge($permissions, PermissionKey::getList('admin'));
             foreach ($permissions as $pk) {
                 $paID = $_POST['pkID'][$pk->getPermissionKeyID()];
                 $pt = $pk->getPermissionAssignmentObject();
                 $pt->clearPermissionAssignment();
                 if ($paID > 0) {
                     $pa = PermissionAccess::getByID($paID, $pk);
                     if (is_object($pa)) {
                         $pt->assignPermissionAccess($pa);
                     }
                 }
             }
             $this->redirect('/dashboard/system/permissions/tasks', 'updated');
         }
     } else {
         $this->error->add(Loader::helper("validation/token")->getErrorMessage());
     }
 }
Exemplo n.º 18
0
 public function on_before_render()
 {
     $tabs = array();
     foreach ($this->categories as $cat) {
         $active = $cat->getWorkflowProgressCategoryHandle() == $this->wpCategoryHandleActive;
         if ($active) {
             $this->set('category', $cat);
         }
         switch ($cat->getWorkflowProgressCategoryHandle()) {
             case 'page':
                 $tabName = t('Pages');
                 break;
             case 'file':
                 $tabName = t('Files');
                 break;
             case 'user':
                 $tabName = t('Users');
                 break;
             default:
                 $tabName = t(sprintf('%ss', Loader::helper('text')->unhandle($cat->getWorkflowProgressCategoryHandle())));
                 break;
         }
         $tabs[] = array(View::url('/dashboard/workflow/me/', 'view', $cat->getWorkflowProgressCategoryHandle()), $tabName, $active);
     }
     $this->set('tabs', $tabs);
 }
Exemplo n.º 19
0
	public function delete($delGroupId, $token = ''){

		$u=new User();
		try {
		
			if(!$u->isSuperUser()) {
				throw new Exception(t('You do not have permission to perform this action.'));
			}
			
			$group = Group::getByID($delGroupId);			
			
			if(!($group instanceof Group)) {
				throw new Exception(t('Invalid group ID.'));
			}
			
			$valt = Loader::helper('validation/token');
			if (!$valt->validate('delete_group_' . $delGroupId, $token)) {
				throw new Exception($valt->getErrorMessage());
			}
			
			$group->delete(); 
			$resultMsg=t('Group deleted successfully.');		
			
			$_REQUEST=array();
			$_GET=array();
			$_POST=array();			
			$this->set('message', $resultMsg);
			$this->view(); 
		} catch(Exception $e) {
			$this->set('error', $e);
		}
	}	
Exemplo n.º 20
0
 /**
  * @return mixed AttributeValue
  */
 public function getContent()
 {
     $c = \Page::getCurrentPage();
     $content = "";
     switch ($this->attributeHandle) {
         case "rpv_pageName":
             $content = $c->getCollectionName();
             break;
         case "rpv_pageDescription":
             $content = $c->getCollectionDescription();
             break;
         case "rpv_pageDateCreated":
             $content = $c->getCollectionDateAdded();
             break;
         case "rpv_pageDateLastModified":
             $content = $c->getCollectionDateLastModified();
             break;
         case "rpv_pageDatePublic":
             $content = $c->getCollectionDatePublic();
             break;
         default:
             $content = $c->getAttribute($this->attributeHandle);
             if (is_object($content) && get_class($content) === 'File') {
                 $im = Loader::helper('image');
                 $thumb = $im->getThumbnail($content, $this->thumbnailWidth, $this->thumbnailHeight);
                 //<-- set these 2 numbers to max width and height of thumbnails
                 $content = "<img src=\"{$thumb->src}\" width=\"{$thumb->width}\" height=\"{$thumb->height}\" alt=\"\" />";
             }
             break;
     }
     if (!strlen($content) && $c->isMasterCollection()) {
         $content = $this->getPlaceHolderText($this->attributeHandle);
     }
     return $content;
 }
Exemplo n.º 21
0
 public function on_start()
 {
     Loader::helper('ms_route', 'multisite');
     if (!User::isLoggedIn()) {
         Events::extend('on_before_render', 'MsRouter', 'render', 'packages/' . $this->pkgHandle . '/models/ms_router.php');
     }
 }
Exemplo n.º 22
0
 public function save()
 {
     $helper_file = Loader::helper('concrete/file');
     $validation_token = Loader::helper('validation/token');
     Loader::model('file_storage_location');
     if (!$validation_token->validate("file_storage")) {
         $this->set('error', array($validation_token->getErrorMessage()));
         return;
     }
     if ($_POST['delete']) {
         $fsl = FileStorageLocation::getByID(FileStorageLocation::ALTERNATE_ID);
         if (is_object($fsl)) {
             $fsl->delete();
             $this->redirect('/dashboard/system/environment/file_storage_locations', 'storage_deleted');
         }
     } else {
         Config::save('DIR_FILES_UPLOADED', $this->post('DIR_FILES_UPLOADED'));
         if ($this->post('fslName') != '' && $this->post('fslDirectory') != '') {
             $fsl = FileStorageLocation::getByID(FileStorageLocation::ALTERNATE_ID);
             if (!is_object($fsl)) {
                 FileStorageLocation::add($this->post('fslName'), $this->post('fslDirectory'), FileStorageLocation::ALTERNATE_ID);
             } else {
                 $fsl->update($this->post('fslName'), $this->post('fslDirectory'));
             }
         }
         $this->redirect('/dashboard/system/environment/file_storage_locations', 'storage_saved');
     }
 }
Exemplo n.º 23
0
 public function highlightedExtendedMarkup($fulltext, $highlight)
 {
     $text = @preg_replace("#\n|\r#", ' ', $fulltext);
     $matches = array();
     $highlight = str_replace(array('"', "'", "&quot;"), '', $highlight);
     // strip the quotes as they mess the regex
     if (!$highlight) {
         $text = Loader::helper('text')->shortenTextWord($fulltext, 180);
         if (strlen($fulltext) > 180) {
             $text . '&hellip;<wbr>';
         }
         return $text;
     }
     $regex = '(^|\\s)([[:alnum:]|\'|\\.|_|\\s]{0,45})' . preg_quote($highlight, '#') . '([[:alnum:]|\\.|’|_|\\s]{0,45})($|\\s)';
     preg_match_all("#{$regex}#ui", $text, $matches);
     if (!empty($matches[0])) {
         $body_length = 0;
         $body_string = array();
         foreach ($matches[0] as $line) {
             $body_length += strlen($line);
             $r = $this->highlightedMarkup($line, $highlight);
             if ($r) {
                 $body_string[] = $r;
             }
             if ($body_length > 150) {
                 break;
             }
         }
         if (!empty($body_string)) {
             return @implode("&hellip;<wbr>", $body_string);
         }
     }
 }
Exemplo n.º 24
0
 /**
  * 推送选择界面
  */
 public function init()
 {
     if (isset($_POST['dosubmit'])) {
         $c = Loader::model('content_model');
         $c->set_model($_POST['modelid']);
         $info = array();
         $ids = explode('|', $_POST['id']);
         if (is_array($ids)) {
             foreach ($ids as $id) {
                 $info[$id] = $c->get_content($_POST['catid'], $id);
             }
         }
         $_GET['add_action'] = isset($_GET['add_action']) ? $_GET['add_action'] : $_GET['act'];
         $this->push->{$_GET}['add_action']($info, $_POST);
         showmessage(L('success'), '', '', 'push');
     } else {
         Loader::helper('template:global');
         if (method_exists($this->push, $_GET['act'])) {
             $html = $this->push->{$_GET['act']}(array('modelid' => $_GET['modelid'], 'catid' => $_GET['catid']));
             $tpl = isset($_GET['tpl']) ? 'push_to_category' : 'push_list';
             include $this->view($tpl);
         } else {
             showmessage('CLASS METHOD NO EXISTS!', 'blank');
         }
     }
 }
Exemplo n.º 25
0
 public function form()
 {
     if (is_object($this->attributeValue)) {
         $value = $this->getAttributeValue()->getValue();
     }
     print Loader::helper('form')->text($this->field('value'), $value, array('style' => 'width:80px'));
 }
Exemplo n.º 26
0
	public function uninstall($btID = 0, $token = '') {
		$valt = Loader::helper('validation/token');

		if ($btID > 0) {
			$bt = BlockType::getByID($btID);
		}
		
		$u = new User();
		if (!$u->isSuperUser()) {
			$this->error->add(t('Only the super user may remove block types.'));
		} else if (isset($bt) && ($bt instanceof BlockType)) {
			if (!$valt->validate('uninstall', $token)) {
				$this->error->add($valt->getErrorMessage());
			} else if ($bt->canUnInstall()) {
				$bt->delete();
				$this->redirect('/dashboard/blocks/types', 'block_type_deleted');
			} else {
				$this->error->add(t('This block type is internal. It cannot be uninstalled.'));
			}
		} else {
			$this->error->add('Invalid block type.');
		}
		
		if ($this->error->has()) {
			$this->set('error', $this->error);
		}
		$this->inspect($btID);
	}
Exemplo n.º 27
0
	public static function add($typeID, $title, $description, $body, $url, $url2 = null) {
		$db = Loader::db();
		$date = Loader::helper('date')->getLocalDateTime();
		$db->Execute('insert into SystemNotifications (snTypeID, snTitle, snDescription, snBody, snURL, snURL2, snDateTime, snIsNew) values (?, ?, ?, ?, ?, ?, ?, ?)', array(
			$typeID, $title, $description, $body, $url, $url2, $date, 1
		));	
	}
Exemplo n.º 28
0
 public function on_page_view()
 {
     $html = Loader::helper('html');
     $bv = new BlockView();
     $bv->setBlockObject($this->getBlockObject());
     $this->addFooterItem($html->javascript($bv->getBlockURL() . '/magnific/magnific-combined-1.0.0.min.js', array('minify' => true)));
 }
Exemplo n.º 29
0
 public function buttons()
 {
     $ih = Loader::helper('concrete/interface');
     $btnStr = $ih->submit('Save', null, 'right', 'primary');
     $btnStr .= $ih->button_js('Cancel', 'history.back()', 'left');
     return $btnStr;
 }
Exemplo n.º 30
0
 public function output($field, $value, $isEditableField = false, $includeJS = true)
 {
     if ($isEditableField == false) {
         return $this->outputDisplay($value);
     }
     $form = Loader::helper("form");
     $v = $form->getRequestValue($field);
     if ($v !== false) {
         $value = $v;
     }
     $html = '';
     $checked1 = $value == 20 ? 'checked' : '';
     $checked2 = $value == 40 ? 'checked' : '';
     $checked3 = $value == 60 ? 'checked' : '';
     $checked4 = $value == 80 ? 'checked' : '';
     $checked5 = $value == 100 ? 'checked' : '';
     if ($isEditableField == false) {
         $disabled = 'disabled';
     }
     $html .= "<div class=\"ccm-rating\" id=\"ccm-rating-{$field}\">\n\t\t\t<input name=\"{$field}\" type=\"radio\" value=\"20\" {$checked1} {$disabled}/>\n\t\t\t<input name=\"{$field}\" type=\"radio\" value=\"40\" {$checked2} {$disabled}/>\n\t\t\t<input name=\"{$field}\" type=\"radio\" value=\"60\" {$checked3} {$disabled} />\n\t\t\t<input name=\"{$field}\" type=\"radio\" value=\"80\" {$checked4} {$disabled}/>\n\t\t\t<input name=\"{$field}\" type=\"radio\" value=\"100\" {$checked5} {$disabled}/>\n\t\t</div>";
     if ($includeJS) {
         $html .= "<script type=\"text/javascript\">\n\t\t\t\t\$(function() {\n\t\t\t\t\t\$('input[name=\"{$field}\"]').rating();\n\t\t\t\t});\n\t\t\t\t</script>";
     }
     return $html;
 }