public function run() { // Since 5.1.0 we've moved around a number of pages in the dashboard Loader::model('single_page'); // Rename Forms to Reports $p = Page::getByPath('/dashboard/form_results'); // We can only run these once so we do a check to see if that's the case. if ($p->isError()) { return false; } $p->update(array('cName' => t('Reports'), 'cDescription' => t('Get data from forms and logs.'), 'cHandle' => 'reports')); $p->rescanCollectionPath(); $p = SinglePage::getByID($p->getCollectionID()); $p->refresh(); $d3a = SinglePage::add('/dashboard/reports/forms'); $d3b = SinglePage::add('/dashboard/reports/logs'); $d3c = SinglePage::add('/dashboard/reports/database'); $d4 = Page::getByPath('/dashboard/users'); $d4a = SinglePage::add('/dashboard/users/search'); $d4b = SinglePage::add('/dashboard/users/add'); $d4c = SinglePage::add('/dashboard/users/groups'); $d4d = Page::getByPath("/dashboard/users/attributes"); $db = Loader::db(); $db->query("update Pages set cDisplayOrder = 0 where cID = ?", array($d4a->getCollectionID())); $db->query("update Pages set cDisplayOrder = 1 where cID = ?", array($d4b->getCollectionID())); $db->query("update Pages set cDisplayOrder = 2 where cID = ?", array($d4c->getCollectionID())); $db->query("update Pages set cDisplayOrder = 3 where cID = ?", array($d4d->getCollectionID())); $p = Page::getByPath('/dashboard/groups'); $p->delete(); $p = Page::getByPath('/dashboard/collection_types'); $p->update(array('cHandle' => 'pages')); $p->rescanCollectionPath(); $p = SinglePage::getByID($p->getCollectionID()); $p->refresh(); $p = Page::getByPath('/dashboard/pages/attributes'); $p->delete(); $d7a = SinglePage::add('/dashboard/pages/themes'); $d7b = SinglePage::add('/dashboard/pages/themes/add'); $d7c = SinglePage::add('/dashboard/pages/themes/inspect'); $d7d = SinglePage::add('/dashboard/pages/themes/customize'); $d7e = SinglePage::add('/dashboard/pages/themes/marketplace'); $d7f = SinglePage::add('/dashboard/pages/types'); $d7g = SinglePage::add('/dashboard/pages/types/attributes'); $d7h = SinglePage::add('/dashboard/pages/single'); $p = Page::getByPath('/dashboard/themes'); $p->delete(); $d3a->update(array('cName' => t('Form Results'), 'cDescription' => t('Get submission data.'))); $d4->update(array('cName' => t('Users and Groups'), 'cDescription' => t('Add and manage people.'))); $d4a->update(array('cName' => t('Find Users'))); $d4b->update(array('cName' => t('Add User'))); $d4c->update(array('cName' => t('Groups'))); $d4d->update(array('cName' => t('User Attributes'))); $d7 = Page::getByPath('/dashboard/pages'); $d7->update(array('cName' => t('Pages and Themes'), 'cDescription' => t('Reskin your site.'))); $d7f->update(array('cName' => t('Page Types'), 'cDescription' => t('What goes in your site.'))); $d7h->update(array('cName' => t('Single Pages'))); $p = Page::getByPath('/dashboard/logs'); $p->delete(); }
public static function getListByPackage($pkg) { $db = Loader::db(); $r = $db->Execute("select cID from Pages where ctID = 0 and cFilename is not null and pkgID = ?", $pkg->getPackageID()); $singlePages = array(); while ($row = $r->FetchRow()) { $singlePages[] = SinglePage::getByID($row['cID']); } return $singlePages; }
public function refresh($cID = 0, $token) { if (intval($cID) > 0) { if ($this->token->validate('refresh', $token)) { Loader::model('single_page'); $p = SinglePage::getByID($cID); $cp = new Permissions($p); if ($cp->canAdmin()) { $p->refresh(); $this->redirect('/dashboard/pages/single', t('Page Successfully Refreshed.')); } $this->redirect('/dashboard/pages/single', t('You do not have permissions to refresh this page.'), 1); } $this->redirect('/dashboard/pages/single', $this->token->getErrorMessage(), 1); } $this->redirect('/dashboard/pages/single', t('Page Unsuccessfully Refreshed.'), 1); }
protected function updateDashboard() { $sp = Page::getByPath('/dashboard/sitemap/full'); if ($sp->isError()) { $d1a = SinglePage::add('/dashboard/sitemap/full'); $d1a->update(array('cName' => t('Full Sitemap'))); } $sp = Page::getByPath('/dashboard/sitemap/explore'); if ($sp->isError()) { $d1b = SinglePage::add('/dashboard/sitemap/explore'); $d1b->update(array('cName' => t('Flat View'))); } $sp = Page::getByPath('/dashboard/sitemap/search'); if ($sp->isError()) { $d1c = SinglePage::add('/dashboard/sitemap/search'); $d1c->update(array('cName' => t('Page Search'))); } $sp = Page::getByPath('/dashboard/sitemap/access'); if ($sp->isError()) { $d1d = SinglePage::add('/dashboard/sitemap/access'); } // refresh the sitemap page so it points to sitemap/view.php rather than sitemap.php $em = Page::getByPath('/dashboard/sitemap'); if (!$em->isError()) { $em = SinglePage::getByID($em->getCollectionID()); $em->refresh(); } // move dashboard attributes $sp = Page::getByPath('/dashboard/pages/attributes'); if ($sp->isError()) { $d7f = SinglePage::add('/dashboard/pages/attributes'); } $d7p = Page::getByPath('/dashboard/pages/types/attributes'); if (is_object($d7p) && !$d7p->isError()) { $d7p->delete(); } $sp = Page::getByPath('/dashboard/system'); if ($sp->isError()) { $d9 = SinglePage::add('/dashboard/system'); $d9->update(array('cName' => t('System & Maintenance'), 'cDescription' => t('Backup, cleanup and update.'))); } $sp = Page::getByPath('/dashboard/system/jobs'); if ($sp->isError()) { $d9a = SinglePage::add('/dashboard/system/jobs'); } $sp = Page::getByPath('/dashboard/system/backup'); if ($sp->isError()) { $d9b = SinglePage::add('/dashboard/system/backup'); $d9b->update(array('cName' => t('Backup & Restore'))); } $sp = Page::getByPath('/dashboard/system/update'); if ($sp->isError()) { $d9c = SinglePage::add('/dashboard/system/update'); } $sp = Page::getByPath('/dashboard/system/notifications'); if ($sp->isError()) { $d9d = SinglePage::add('/dashboard/system/notifications'); } $oldJobsPage = Page::getByPath('/dashboard/jobs'); if (is_object($oldJobsPage) && !$oldJobsPage->isError()) { $oldJobsPage->delete(); } $sp = Page::getByPath('/dashboard/settings/marketplace'); if ($sp->isError()) { $d12 = SinglePage::add('/dashboard/settings/marketplace'); } }
<?php defined('C5_EXECUTE') or die("Access Denied."); $ih = Loader::helper('concrete/interface'); Loader::model('single_page'); $valt = Loader::helper('validation/token'); if ($_REQUEST['p'] && $_REQUEST['task'] == 'refresh' && $valt->validate('refresh')) { $p = SinglePage::getByID($_REQUEST['p']); $p->refresh(); $this->controller->redirect('/dashboard/pages/single?refreshed=1'); exit; } if ($_POST['add_static_page']) { if ($valt->validate("add_single_page")) { $pathToNode = SinglePage::getPathToNode($_POST['pageURL'], false); $path = SinglePage::sanitizePath($_POST['pageURL']); if (strlen($pathToNode) > 0) { // now we check to see if this is already added $pc = Page::getByPath('/' . $path, 'RECENT'); if ($pc->getError() == COLLECTION_NOT_FOUND) { SinglePage::add($_POST['pageURL']); $this->controller->redirect('/dashboard/pages/single?page_created=1'); } else { $error[] = t("That page has already been added."); } } else { $error[] = t('That specified path doesn\'t appear to be a valid static page.'); } } else { $error[] = $valt->getErrorMessage(); }
public function run() { $db = Loader::db(); Cache::disableLocalCache(); Loader::model('attribute/categories/collection'); Loader::model('attribute/categories/file'); Loader::model('attribute/categories/user'); $collectionErrors = array(); $fileErrors = array(); $userErrors = array(); //add the new collection attribute keys $this->installCoreAttributeItems(); $dict = NewDataDictionary($db->db, DB_TYPE); $tables = $db->MetaTables(); if (in_array('_CollectionAttributeKeys', $tables)) { $collectionErrors = $this->upgradeCollectionAttributes(); } if (in_array('_FileAttributeKeys', $tables)) { $fileErrors = $this->upgradeFileAttributes(); } if (in_array('_UserAttributeKeys', $tables)) { $userErrors = $this->upgradeUserAttributes(); } $cak=CollectionAttributeKey::getByHandle('exclude_sitemapxml'); if (!is_object($cak)) { $cak = CollectionAttributeKey::add('exclude_sitemapxml', t('Exclude From sitemap.xml'), true, null, 'BOOLEAN'); } //change the page/tab name of the dashboard users registration page $dashboardRegistrationPage=Page::getByPath('/dashboard/users/registration'); if( intval($dashboardRegistrationPage->cID) ) $dashboardRegistrationPage->update(array('cName'=>t('Login & Registration'))); Config::save('LOGIN_ADMIN_TO_DASHBOARD', 1); //profile friends page install Loader::model('single_page'); $friendsPage=Page::getByPath('/profile/friends'); if( !intval($friendsPage->cID)) { SinglePage::add('/profile/friends'); } $membersPage =Page::getByPath('/members'); if( !intval($membersPage->cID)) { SinglePage::add('/members'); } $messagesPage =Page::getByPath('/profile/messages'); if( !intval($messagesPage->cID)) { SinglePage::add('/profile/messages'); } $ppme = UserAttributeKey::getByHandle('profile_private_messages_enabled'); if (!is_object($ppme)) { UserAttributeKey::add('BOOLEAN', array('akHandle' => 'profile_private_messages_enabled', 'akName' => t('I would like to receive private messages.'), 'akIsSearchable' => true)); } $ppmne = UserAttributeKey::getByHandle('profile_private_messages_notification_enabled'); if (!is_object($ppmne)) { UserAttributeKey::add('BOOLEAN', array('akHandle' => 'profile_private_messages_notification_enabled', 'akName' => t('Send me email notifications when I receive a private message.'), 'akIsSearchable' => true)); } $em = Page::getByPath('/dashboard/settings'); if (!$em->isError()) { $em = SinglePage::getByID($em->getCollectionID()); $em->refresh(); } $em1=Page::getByPath('/dashboard/settings/mail'); if ($em1->isError()) { $em1 = SinglePage::add('/dashboard/settings/mail'); $em1->update(array('cName'=>t('Email'), 'cDescription'=>t('Enable post via email and other settings.'))); } // remove adodb database logs $databaseReports = Page::getByPath('/dashboard/reports/database'); if (!$databaseReports->isError()) { $databaseReports->delete(); } if (in_array('adodb_logsql', $tables)) { @$db->query('DROP TABLE adodb_logsql'); } Loader::library('mail/importer'); $mi = MailImporter::getByHandle("private_message"); if (!is_object($mi)) { MailImporter::add(array('miHandle' => 'private_message')); } Loader::model("job"); Job::installByHandle('process_email'); Cache::enableLocalCache(); return array_merge($collectionErrors, $fileErrors, $userErrors); }