public function set_site_permissions() { Loader::model('file_set'); $fs = FileSet::getGlobal(); $g1 = Group::getByID(GUEST_GROUP_ID); $g2 = Group::getByID(REGISTERED_GROUP_ID); $g3 = Group::getByID(ADMIN_GROUP_ID); $fs->assignPermissions($g1, array('view_file_set_file')); $fs->assignPermissions($g3, array('view_file_set_file', 'search_file_set', 'edit_file_set_file_properties', 'edit_file_set_file_contents', 'copy_file_set_files', 'edit_file_set_permissions', 'delete_file_set_files', 'delete_file_set', 'add_file')); if (defined('ACTIVE_LOCALE') && ACTIVE_LOCALE != '' && ACTIVE_LOCALE != 'en_US') { Config::save('SITE_LOCALE', ACTIVE_LOCALE); } Config::save('SITE', SITE); Config::save('SITE_APP_VERSION', APP_VERSION); Config::save('SITE_INSTALLED_APP_VERSION', APP_VERSION); $u = new User(); $u->saveConfig('NEWSFLOW_LAST_VIEWED', 'FIRSTRUN'); $home = Page::getByID(1, "RECENT"); $home->assignPermissions($g1, array('view_page')); $home->assignPermissions($g3, array('view_page_versions', 'preview_page_as_user', 'edit_page_properties', 'edit_page_contents', 'edit_page_speed_settings', 'edit_page_theme', 'edit_page_type', 'edit_page_permissions', 'delete_page', 'delete_page_versions', 'approve_page_versions', 'add_subpage', 'move_or_copy_page', 'schedule_page_contents_guest_access')); }
protected function finishLogin($loginData = array()) { $u = new User(); if ($this->post('uMaintainLogin')) { $u->setUserForeverCookie(); } if (count($this->locales) > 0) { if (Config::get('LANGUAGE_CHOOSE_ON_LOGIN') && $this->post('USER_LOCALE') != '') { $u->setUserDefaultLanguage($this->post('USER_LOCALE')); } } // Verify that the user has filled out all // required items that are required on register // That means users logging in after new user attributes // have been created and required will be prompted here to // finish their profile $this->set('invalidRegistrationFields', false); Loader::model('attribute/categories/user'); $ui = UserInfo::getByID($u->getUserID()); $aks = UserAttributeKey::getRegistrationList(); $unfilledAttributes = array(); foreach ($aks as $uak) { if ($uak->isAttributeKeyRequiredOnRegister()) { $av = $ui->getAttributeValueObject($uak); if (!is_object($av)) { $unfilledAttributes[] = $uak; } } } if ($this->post('completePartialProfile')) { foreach ($unfilledAttributes as $uak) { $e1 = $uak->validateAttributeForm(); if ($e1 == false) { $this->error->add(t('The field "%s" is required', $uak->getAttributeKeyName())); } else { if ($e1 instanceof ValidationErrorHelper) { $this->error->add($e1); } } } if (!$this->error->has()) { // the user has needed to complete a partial profile, and they have done so, // and they have no errors. So we save our profile data against the account. foreach ($unfilledAttributes as $uak) { $uak->saveAttributeForm($ui); $unfilledAttributes = array(); } } } if (count($unfilledAttributes) > 0) { $u->logout(); $this->set('invalidRegistrationFields', true); $this->set('unfilledAttributes', $unfilledAttributes); } $txt = Loader::helper('text'); $rcID = $this->post('rcID'); $nh = Loader::helper('validation/numbers'); //set redirect url if ($nh->integer($rcID)) { $nh = Loader::helper('navigation'); $rc = Page::getByID($rcID); $url = $nh->getLinkToCollection($rc, true); $loginData['redirectURL'] = $url; } elseif (strlen($rcID)) { $rcID = trim($rcID, '/'); $nc2 = Page::getByPath('/' . $rcID); if (is_object($nc2) && !$nc2->isError()) { $loginData['redirectURL'] = BASE_URL . DIR_REL . '/' . DISPATCHER_FILENAME . '/' . $rcID; } } /* //full page login redirect (non-ajax login) if( strlen($loginData['redirectURL']) && $_REQUEST['format']!='JSON' ){ header('Location: ' . $loginData['redirectURL']); exit; } */ $dash = Page::getByPath("/dashboard", "RECENT"); $dbp = new Permissions($dash); Events::fire('on_user_login', $this); //End JSON Login if ($_REQUEST['format'] == 'JSON') { return $loginData; } //should administrator be redirected to dashboard? defaults to yes if not set. $adminToDash = intval(Config::get('LOGIN_ADMIN_TO_DASHBOARD')); //Full page login, standard redirection $u = new User(); // added for the required registration attribute change above. We recalc the user and make sure they're still logged in if ($u->isRegistered()) { if ($u->config('NEWSFLOW_LAST_VIEWED') == 'FIRSTRUN') { $u->saveConfig('NEWSFLOW_LAST_VIEWED', 0); } if ($loginData['redirectURL']) { //make double secretly sure there's no caching going on header("Cache-Control: no-store, no-cache, must-revalidate"); header("Pragma: no-cache"); header('Expires: Fri, 30 Oct 1998 14:19:41 GMT'); //in the past $this->externalRedirect($loginData['redirectURL']); } else { if ($dbp->canRead() && $adminToDash) { $this->redirect('/dashboard'); } else { //options set in dashboard/users/registration $login_redirect_cid = intval(Config::get('LOGIN_REDIRECT_CID')); $login_redirect_mode = Config::get('LOGIN_REDIRECT'); //redirect to user profile if ($login_redirect_mode == 'PROFILE' && ENABLE_USER_PROFILES) { $this->redirect('/profile/', $u->uID); //redirect to custom page } elseif ($login_redirect_mode == 'CUSTOM' && $login_redirect_cid > 0) { $redirectTarget = Page::getByID($login_redirect_cid); if (intval($redirectTarget->cID) > 0) { $this->redirect($redirectTarget->getCollectionPath()); } else { $this->redirect('/'); } //redirect home } else { $this->redirect('/'); } } } } }
public function update_user_settings() { if ($this->token->validate("update_user_settings")) { if ($this->isPost()) { $u = new User(); $u->saveConfig('UI_BREADCRUMB', $this->post('ui_breadcrumb')); $u->saveConfig('UI_FILEMANAGER', $this->post('ui_filemanager')); $u->saveConfig('UI_SITEMAP', $this->post('ui_sitemap')); $this->redirect('/dashboard/settings', 'editing_preferences_saved'); } } else { $this->set('error', array($this->token->getErrorMessage())); } }
$selectedAKIDs = array(); $fldc = FileManagerColumnSet::getCurrent(); $fldca = new FileManagerAvailableColumnSet(); $searchInstance = Loader::helper('text')->alphanum($_REQUEST['searchInstance']); if ($_POST['task'] == 'update_columns') { $fdc = new FileManagerColumnSet(); foreach($_POST['column'] as $key) { $fdc->addColumn($fldca->getColumnByKey($key)); } $sortCol = $fldca->getColumnByKey($_POST['fSearchDefaultSort']); $fdc->setDefaultSortColumn($sortCol, $_POST['fSearchDefaultSortDirection']); $u->saveConfig('FILE_LIST_DEFAULT_COLUMNS', serialize($fdc)); $fileList = new FileList(); $fileList->resetSearchRequest(); exit; } $list = FileAttributeKey::getList(); ?> <div class="ccm-ui"> <form method="post" id="ccm-<?php echo $searchInstance; ?> -customize-search-columns-form" action="<?php
?> <?php if (!$_c->isCheckedOut()) { ?> <a href="<?php echo DIR_REL; ?> /<?php echo DISPATCHER_FILENAME; ?> ?cID=<?php echo $c->getCollectionID(); ?> &ctask=check-out<?php echo $token; ?> " id="ccm-nav-check-out" class="btn"><?php echo t('Edit Page'); ?> </a><?php } ?> </div> <?php } ?> <?php $u = new User(); $u->saveConfig('NEWSFLOW_LAST_VIEWED', time());
$ish = Loader::helper('concrete/interface'); $canAdd = false; if ($ih->integer($_REQUEST['cID'])) { $c = Page::getByID($_REQUEST['cID']); if (is_object($c) && !$c->isError()) { $cp = new Permissions($c); if ($dh->inDashboard($c)) { if ($cp->canViewPage()) { $canAdd = true; } } } } $ish->clearInterfaceItemsCache(); if ($canAdd) { $u = new User(); $r = new stdClass(); if (Loader::helper('validation/token')->validate('access_quick_nav', $_REQUEST['token'])) { $qn = ConcreteDashboardMenu::getMine(); if ($qn->contains($c)) { $qn->remove($c); $task = 'add'; } else { $qn->add($c); $task = 'remove'; } $u->saveConfig('QUICK_NAV_BOOKMARKS', serialize($qn)); print $dh->getDashboardAndSearchMenus(); exit; } }
<?php defined('C5_EXECUTE') or die("Access Denied."); $dh = Loader::helper('concrete/dashboard/sitemap'); if (!$dh->canRead()) { die(t("Access Denied.")); } if (isset($_REQUEST['selectedPageID'])) { $dh->setSelectedPageID($_REQUEST['selectedPageID']); } if (isset($_REQUEST['task']) && $_REQUEST['task'] == 'save_sitemap_display_mode') { $u = new User(); $u->saveConfig('SITEMAP_OVERLAY_DISPLAY_MODE', $_REQUEST['display_mode']); exit; } if (isset($_REQUEST['show_system'])) { $_SESSION['dsbSitemapShowSystem'] = $_REQUEST['show_system']; $js = Loader::helper('json'); print $js->encode(array()); exit; } if (!$_REQUEST['keywords']) { // if there ARE keywords then we don't want to cache the node if (!is_array($_SESSION['dsbSitemapNodes'])) { $_SESSION['dsbSitemapNodes'] = array(); if (isset($_REQUEST['node'])) { $_SESSION['dsbSitemapNodes'][] = $_REQUEST['node']; } else { $_SESSION['dsbSitemapNodes'][] = 1; } } else {
public function getDashboardAndSearchMenus() { if (isset($_SESSION['dashboardMenus'][Localization::activeLocale()])) { return $_SESSION['dashboardMenus'][Localization::activeLocale()]; } $d = ConcreteDashboardMenu::getMine(); $items = $d->getItems(); ob_start(); ?> <div id="ccm-intelligent-search-results"> <?php $page = Page::getByPath('/dashboard'); $children = $page->getCollectionChildrenArray(true); $packagepages = array(); $corepages = array(); foreach ($children as $ch) { $page = Page::getByID($ch); $pageP = new Permissions($page); if ($pageP->canRead()) { if (!$page->getAttribute("exclude_nav")) { if ($page->getPackageID() > 0) { $packagepages[] = $page; } else { $corepages[] = $page; } } } else { continue; } if ($page->getAttribute('exclude_search_index')) { continue; } if ($page->getCollectionPath() == '/dashboard/system') { $ch2 = $page->getCollectionChildrenArray(); } else { $ch2 = $page->getCollectionChildrenArray(true); } ?> <div class="ccm-intelligent-search-results-module ccm-intelligent-search-results-module-onsite"> <h1><?php echo t($page->getCollectionName()); ?> </h1> <ul class="ccm-intelligent-search-results-list"> <?php if (count($ch2) == 0) { ?> <li><a href="<?php echo Loader::helper('navigation')->getLinkTocollection($page, false, true); ?> "><?php echo t($page->getCollectionName()); ?> </a><span><?php echo t($page->getCollectionName()); ?> <?php echo t($page->getAttribute('meta_keywords')); ?> </span></li> <?php } ?> <?php if ($page->getCollectionPath() == '/dashboard/system') { ?> <li><a href="<?php echo Loader::helper('navigation')->getLinkTocollection($page, false, true); ?> "><?php echo t('View All'); ?> </a><span><?php echo t($page->getCollectionName()); ?> <?php echo t($page->getAttribute('meta_keywords')); ?> </span></li> <?php } foreach ($ch2 as $chi) { $subpage = Page::getByID($chi); $subpageP = new Permissions($subpage); if (!$subpageP->canRead()) { continue; } if ($subpage->getAttribute('exclude_search_index')) { continue; } ?> <li><a href="<?php echo Loader::helper('navigation')->getLinkTocollection($subpage, false, true); ?> "><?php echo t($subpage->getCollectionName()); ?> </a><span><?php if ($page->getCollectionPath() != '/dashboard/system') { echo t($page->getCollectionName()); ?> <?php echo t($page->getAttribute('meta_keywords')); ?> <?php } echo t($subpage->getCollectionName()); ?> <?php echo t($subpage->getAttribute('meta_keywords')); ?> </span></li> <?php } ?> </ul> </div> <?php } $custHome = Page::getByPath('/dashboard/home'); $custHomeP = new Permissions($custHome); if ($custHomeP->canRead()) { ?> <div class="ccm-intelligent-search-results-module ccm-intelligent-search-results-module-onsite"> <h1><?php echo t('Dashboard Home'); ?> </h1> <ul class="ccm-intelligent-search-results-list"> <li><a href="<?php echo View::url('/dashboard/home'); ?> "><?php echo t('Customize'); ?> <span><?php echo t('Customize Dashboard Home'); ?> </span></a></li> </ul> </div> <?php } ?> <div class="ccm-intelligent-search-results-module ccm-intelligent-search-results-module-loading"> <h1><?php echo t('Your Site'); ?> </h1> <ul class="ccm-intelligent-search-results-list" id="ccm-intelligent-search-results-list-your-site"> </ul> </div> <?php if (ENABLE_INTELLIGENT_SEARCH_HELP) { ?> <div class="ccm-intelligent-search-results-module ccm-intelligent-search-results-module-offsite ccm-intelligent-search-results-module-loading"> <h1><?php echo t('Help'); ?> </h1> <ul class="ccm-intelligent-search-results-list" id="ccm-intelligent-search-results-list-help"> </ul> </div> <?php } ?> <?php if (ENABLE_INTELLIGENT_SEARCH_MARKETPLACE) { ?> <div class="ccm-intelligent-search-results-module ccm-intelligent-search-results-module-offsite ccm-intelligent-search-results-module-loading"> <h1><?php echo t('Add-Ons'); ?> </h1> <ul class="ccm-intelligent-search-results-list" id="ccm-intelligent-search-results-list-marketplace"> </ul> </div> <?php } ?> </div> <div id="ccm-dashboard-overlay"> <div id="ccm-dashboard-overlay-core"> <div class="ccm-dashboard-overlay-inner" id="ccm-dashboard-overlay-main"> <!--recent--> <?php $currentHeader = false; $x = 0; $itemsChanged = false; foreach ($items as $path) { $p = Page::getByPath($path, 'ACTIVE'); // If page is not found etc, remove it from items if ($p->isError()) { $d->remove($p); $itemsChanged = true; continue; } $pc = new Permissions($p); if ($pc->canViewPage()) { $name = t($p->getCollectionName()); $parent = Page::getByID($p->getCollectionParentID(), 'ACTIVE'); if ($parent->getCollectionPath() == '/dashboard') { $parent = $p; $name = t('Home'); } if ($currentHeader != $parent->getCollectionID()) { ?> <?php if ($currentHeader != false) { ?> </ul> </div> <?php $x++; ?> <?php if ($x % 4 == 0) { ?> <div class="clearfix" style="padding-bottom: 0px"></div> <?php } ?> <?php } ?> <div class="ccm-dashboard-overlay-module"> <h1><?php echo t($parent->getCollectionName()); ?> </h1> <ul> <?php $currentHeader = $parent->getCollectionID(); ?> <?php } ?> <li><a href="<?php echo Loader::helper('navigation')->getLinkToCollection($p, false, true); ?> "><?php echo $name; ?> </a></li> <?php } ?> <?php } ?> <?php if ($itemsChanged) { $u = new User(); $u->saveConfig('QUICK_NAV_BOOKMARKS', serialize($d)); } ?> <?php if ($currentHeader != false) { ?> </ul> </div> <?php } ?> </div> </div> <div id="ccm-dashboard-overlay-misc" class="ccm-dashboard-overlay-misc-rounded"> <div class="ccm-dashboard-overlay-inner"> <?php // Before we throw in a UL, we check permissions, etc. to see if any of the LI items need to be shown. $systemNews = Page::getByPath('/dashboard/news'); $systemNewsP = new Permissions($systemNews); $canAccessNews = $systemNewsP->canRead(); $systemSettings = Page::getByPath('/dashboard/system'); $systemSettingsP = new Permissions($systemSettings); $canAccessSystem = $systemSettingsP->canRead(); $tpa = new TaskPermission(); $canAccessExtend = $tpa->canInstallPackages(); $systemExtend = Page::getByPath('/dashboard/extend'); $systemExtendP = new Permissions($systemExtend); $canViewExtend = $systemExtendP->canRead(); // If any need to be shown then we proceed... if ($canAccessNews || $canAccessSystem || $canAccessExtend && $canViewExtend) { ?> <ul> <?php if ($canAccessNews) { ?> <li><a href="<?php echo View::url('/dashboard/news'); ?> "><strong><?php echo t('News'); ?> </strong></a> – <?php echo t('Learn about your site and concrete5.'); ?> </li> <?php } ?> <?php if ($canAccessSystem) { ?> <li><a href="<?php echo View::url('/dashboard/system'); ?> "><strong><?php echo t('System & Settings'); ?> </strong></a> – <?php echo t('Secure and setup your site.'); ?> </li> <?php } ?> <?php if ($canAccessExtend && $canViewExtend) { ?> <li><a href="<?php echo View::url('/dashboard/extend'); ?> "><strong><?php echo t("Extend concrete5"); ?> </strong></a> – <?php if (ENABLE_MARKETPLACE_SUPPORT) { ?> <?php echo sprintf(t('<a href="%s">Install</a>, <a href="%s">update</a> or download more <a href="%s">themes</a> and <a href="%s">add-ons</a>.'), View::url('/dashboard/extend/install'), View::url('/dashboard/extend/update'), View::url('/dashboard/extend/themes'), View::url('/dashboard/extend/add-ons')); ?> <?php } else { ?> <?php echo sprintf(t('<a href="%s">Install</a> or <a href="%s">update</a> packages.'), View::url('/dashboard/extend/install'), View::url('/dashboard/extend/update')); ?> <?php } ?> </li> <?php } ?> </ul> <?php } ?> </div> </div> <div id="ccm-dashboard-overlay-footer"> <div class="ccm-dashboard-overlay-inner"> <a href="<?php echo View::url('/dashboard'); ?> "><?php echo t('View Full Dashboard'); ?> <i class="icon-arrow-right"></i></a> </div> </div> </div> <?php $html = ob_get_contents(); ob_end_clean(); return str_replace(array("\n", "\r", "\t"), "", $html); }
public function set_site_permissions() { $ci = new ContentImporter(); $ci->importContentFile(DIR_BASE_CORE. '/config/install/base/permissions.xml'); Loader::model('file_set'); $fs = FileSet::getGlobal(); $g1 = Group::getByID(GUEST_GROUP_ID); $g2 = Group::getByID(REGISTERED_GROUP_ID); $g3 = Group::getByID(ADMIN_GROUP_ID); $fs->setPermissions($g1, FilePermissions::PTYPE_NONE, FilePermissions::PTYPE_ALL, FilePermissions::PTYPE_NONE, FilePermissions::PTYPE_NONE, FilePermissions::PTYPE_NONE); $fs->setPermissions($g2, FilePermissions::PTYPE_NONE, FilePermissions::PTYPE_ALL, FilePermissions::PTYPE_NONE, FilePermissions::PTYPE_NONE, FilePermissions::PTYPE_NONE); $fs->setPermissions($g3, FilePermissions::PTYPE_ALL, FilePermissions::PTYPE_ALL, FilePermissions::PTYPE_ALL, FilePermissions::PTYPE_ALL, FilePermissions::PTYPE_ALL); Config::save('SITE', SITE); Config::save('SITE_APP_VERSION', APP_VERSION); $u = new User(); $u->saveConfig('NEWSFLOW_LAST_VIEWED', 'FIRSTRUN'); $args = array(); $args['cInheritPermissionsFrom'] = 'OVERRIDE'; $args['cOverrideTemplatePermissions'] = 1; $args['collectionRead'][] = 'gID:' . GUEST_GROUP_ID; $args['collectionAdmin'][] = 'gID:' . ADMIN_GROUP_ID; $args['collectionRead'][] = 'gID:' . ADMIN_GROUP_ID; $args['collectionApprove'][] = 'gID:' . ADMIN_GROUP_ID; $args['collectionReadVersions'][] = 'gID:' . ADMIN_GROUP_ID; $args['collectionWrite'][] = 'gID:' . ADMIN_GROUP_ID; $args['collectionDelete'][] = 'gID:' . ADMIN_GROUP_ID; $home = Page::getByID(1, "RECENT"); $home->updatePermissions($args); }