public function uninstall() { parent::uninstall(); $db = Loader::db(); $db->Execute('DROP TABLE btCustomContactForm'); //Do NOT drop package-level tables -- we don't want to accidentally lose submission data! }
protected function getAllowedPageTypeIDs() { $u = new User(); $pae = $this->getPermissionAccessObject(); if (!is_object($pae)) { return array(); } $accessEntities = $u->getUserAccessEntityObjects(); $accessEntities = $pae->validateAndFilterAccessEntities($accessEntities); $list = $this->getAccessListItems(PagePermissionKey::ACCESS_TYPE_ALL, $accessEntities); $list = PermissionDuration::filterByActive($list); $db = Loader::db(); $allCTIDs = $db->GetCol('select ctID from PageTypes where ctIsInternal = 0'); $ctIDs = array(); foreach ($list as $l) { if ($l->getPageTypesAllowedPermission() == 'N') { $ctIDs = array(); } if ($l->getPageTypesAllowedPermission() == 'C') { if ($l->getAccessType() == PagePermissionKey::ACCESS_TYPE_EXCLUDE) { $ctIDs = array_values(array_diff($ctIDs, $l->getPageTypesAllowedArray())); } else { $ctIDs = array_unique(array_merge($ctIDs, $l->getPageTypesAllowedArray())); } } if ($l->getPageTypesAllowedPermission() == 'A') { $ctIDs = $allCTIDs; } } return $ctIDs; }
public function run() { $sp = Page::getByPath('/dashboard/system/seo/excluded'); if (!is_object($sp) || $sp->isError()) { $sp = SinglePage::add('/dashboard/system/seo/excluded'); $sp->update(array('cName' => t('Excluded URL Word List'))); $sp->setAttribute('meta_keywords', 'pretty, slug'); } $bt = BlockType::getByHandle('next_previous'); if (is_object($bt)) { $bt->refresh(); } $db = Loader::db(); $columns = $db->MetaColumns('Pages'); if (isset($columns['PTID'])) { $db->Execute('alter table Pages drop column ptID'); } if (isset($columns['CTID'])) { $db->Execute('alter table Pages drop column ctID'); } $bt = BlockType::getByHandle('search'); if (is_object($bt)) { $bt->refresh(); } }
public function save($args) { parent::save(); $db = Loader::db(); $db->Execute('delete from FileSetPermissionFileTypeAccessList where paID = ?', array($this->getPermissionAccessID())); $db->Execute('delete from FileSetPermissionFileTypeAccessListCustom where paID = ?', array($this->getPermissionAccessID())); if (is_array($args['fileTypesIncluded'])) { foreach ($args['fileTypesIncluded'] as $peID => $permission) { $v = array($this->getPermissionAccessID(), $peID, $permission); $db->Execute('insert into FileSetPermissionFileTypeAccessList (paID, peID, permission) values (?, ?, ?)', $v); } } if (is_array($args['fileTypesExcluded'])) { foreach ($args['fileTypesExcluded'] as $peID => $permission) { $v = array($this->getPermissionAccessID(), $peID, $permission); $db->Execute('insert into FileSetPermissionFileTypeAccessList (paID, peID, permission) values (?, ?, ?)', $v); } } if (is_array($args['extensionInclude'])) { foreach ($args['extensionInclude'] as $peID => $extensions) { foreach ($extensions as $extension) { $v = array($this->getPermissionAccessID(), $peID, $extension); $db->Execute('insert into FileSetPermissionFileTypeAccessListCustom (paID, peID, extension) values (?, ?, ?)', $v); } } } if (is_array($args['extensionExclude'])) { foreach ($args['extensionExclude'] as $peID => $extensions) { foreach ($extensions as $extension) { $v = array($this->getPermissionAccessID(), $peID, $extension); $db->Execute('insert into FileSetPermissionFileTypeAccessListCustom (paID, peID, extension) values (?, ?, ?)', $v); } } } }
public static function addEntry($bID, $commentText, $name, $email, $approved, $cID, $uID = 0, $timestamp = null) { $txt = Loader::helper('text'); $db = Loader::db(); $query = "INSERT INTO btGuestBookEntries (bID, cID, uID, user_name, user_email, commentText, approved, entryDate) VALUES (?, ?, ?, ?, ?, ?, ?, ?)"; $v = array($bID, $cID, intval($uID), $txt->sanitize($name), $txt->sanitize($email), $txt->sanitize($commentText), $approved, $timestamp); $res = $db->query($query, $v); $number = 1; //stupid cache stuff $ca = new Cache(); $db = Loader::db(); $count = $ca->get('GuestBookCount', $cID . "-" . $bID); if ($count && $number) { $count += $number; } else { $q = 'SELECT count(bID) as count FROM btGuestBookEntries WHERE bID = ? AND cID = ? AND approved=1'; $v = array($bID, $cID); $rs = $db->query($q, $v); $row = $rs->FetchRow(); $count = $row['count']; } $ca->set('GuestBookCount', $cID . "-" . $bID, $count); }
/** Executes the job. * @return string Returns a string describing the job result in case of success. * @throws Exception Throws an exception in case of errors. */ public function run() { Cache::disableCache(); Cache::disableLocalCache(); try { $db = Loader::db(); $instances = array( 'navigation' => Loader::helper('navigation'), 'dashboard' => Loader::helper('concrete/dashboard'), 'view_page' => PermissionKey::getByHandle('view_page') ); $rsPages = $db->query('SELECT cID FROM Pages WHERE (cID > 1) ORDER BY cID'); $relName = ltrim(SITEMAPXML_FILE, '\\/'); $osName = rtrim(DIR_BASE, '\\/') . '/' . $relName; $urlName = rtrim(BASE_URL . DIR_REL, '\\/') . '/' . $relName; if(!file_exists($osName)) { @touch($osName); } if(!is_writable($osName)) { throw new Exception(t('The file %s is not writable', $osName)); } if(!$hFile = fopen($osName, 'w')) { throw new Exception(t('Cannot open file %s', $osName)); } if(!@fprintf($hFile, '<?xml version="1.0" encoding="%s"?>' . self::EOL . '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">', APP_CHARSET)) { throw new Exception(t('Error writing header of %s', $osName)); } $addedPages = 0; if(self::AddPage($hFile, 1, $instances)) { $addedPages++; } while($rowPage = $rsPages->FetchRow()) { if(self::AddPage($hFile, intval($rowPage['cID']), $instances)) { $addedPages++; } } $rsPages->Close(); unset($rsPages); if(!@fwrite($hFile, self::EOL . '</urlset>')) { throw new Exception(t('Error writing footer of %s', $osName)); } @fflush($hFile); @fclose($hFile); unset($hFile); return t('%1$s file saved (%2$d pages).', $urlName, $addedPages); } catch(Exception $x) { if(isset($rsPages) && $rsPages) { $rsPages->Close(); $rsPages = null; } if(isset($hFile) && $hFile) { @fflush($hFile); @ftruncate($hFile, 0); @fclose($hFile); $hFile = null; } throw $x; } }
public function assignPermissionAccess(PermissionAccess $pa) { $db = Loader::db(); $db->Replace('PagePermissionAssignments', array('cID' => $this->getPermissionObject()->getPermissionsCollectionID(), 'paID' => $pa->getPermissionAccessID(), 'pkID' => $this->pk->getPermissionKeyID()), array('cID', 'pkID'), true); $pa->markAsInUse(); PermissionCache::clearAccessObject($this->pk, $this->getPermissionObject()); }
public static function buildAnswerSetsArray($questionSet, $orderBy = '', $limit = '') { $db = Loader::db(); if (strlen(trim($limit)) > 0 && !strstr(strtolower($limit), 'limit')) { $limit = ' LIMIT ' . $limit; } if (strlen(trim($orderBy)) > 0 && array_key_exists($orderBy, self::$sortChoices)) { $orderBySQL = self::$sortChoices[$orderBy]; } else { $orderBySQL = self::$sortChoices['newest']; } //get answers sets $sql = 'SELECT * FROM btFormAnswerSet AS aSet ' . 'WHERE aSet.questionSetId=' . $questionSet . ' ORDER BY ' . $orderBySQL . ' ' . $limit; $answerSetsRS = $db->query($sql); //load answers into a nicer multi-dimensional array $answerSets = array(); $answerSetIds = array(0); while ($answer = $answerSetsRS->fetchRow()) { //answer set id - question id $answerSets[$answer['asID']] = $answer; $answerSetIds[] = $answer['asID']; } //get answers $sql = 'SELECT * FROM btFormAnswers AS a WHERE a.asID IN (' . join(',', $answerSetIds) . ')'; $answersRS = $db->query($sql); //load answers into a nicer multi-dimensional array while ($answer = $answersRS->fetchRow()) { //answer set id - question id $answerSets[$answer['asID']]['answers'][$answer['msqID']] = $answer; } return $answerSets; }
public function restore_backup() { $tp = new TaskPermission(); if (!$tp->canBackup()) { return false; } $file = $this->post('backup_file'); $db = Loader::db(); chmod(DIR_FILES_BACKUPS . '/' . $file, 0666); $str_restSql = file_get_contents(DIR_FILES_BACKUPS . '/' . $file); if (!$str_restSql) { $this->set("error", array("There was an error trying to restore the database. This file was empty.")); $this->view(); return false; } $crypt = Loader::helper('encryption'); if (!preg_match('/INSERT/m', $str_restSql) && !preg_match('/CREATE/m', $str_restSql)) { $str_restSql = $crypt->decrypt($str_restSql); } $arr_sqlStmts = explode("\n\n", $str_restSql); foreach ($arr_sqlStmts as $str_stmt) { if (trim($str_stmt) != "") { $res_restoration = $db->execute($str_stmt); if (!$res_restoration) { $this->set("error", array("There was an error trying to restore the database. In query {$str_stmt}")); return; } } } $this->set("message", "Restoration Sucessful"); //reset perms for security! chmod(DIR_FILES_BACKUPS . '/' . $file, 00); Cache::flush(); $this->view(); }
/** * Gets a full URL to the directory containing all of a block's items, including JavaScript, tools, icons, etc... * @param BlockType $bt * @return string $url */ public function getBlockTypeAssetsURL($bt, $file = false) { $ff = ''; if ($file != false) { $ff = '/' . $file; } if (file_exists(DIR_FILES_BLOCK_TYPES . '/' . $bt->getBlockTypeHandle() . $ff)) { $url = BASE_URL . DIR_REL . '/' . DIRNAME_BLOCKS . '/' . $bt->getBlockTypeHandle() . $ff; } else { if ($bt->getPackageID() > 0) { $db = Loader::db(); $h = $bt->getPackageHandle(); $dirp = is_dir(DIR_PACKAGES . '/' . $h) ? DIR_PACKAGES . '/' . $h : DIR_PACKAGES_CORE . '/' . $h; if (file_exists($dirp . '/' . DIRNAME_BLOCKS . '/' . $bt->getBlockTypeHandle() . $ff)) { $url = is_dir(DIR_PACKAGES . '/' . $h) ? BASE_URL . DIR_REL : ASSETS_URL; $url = $url . '/' . DIRNAME_PACKAGES . '/' . $h . '/' . DIRNAME_BLOCKS . '/' . $bt->getBlockTypeHandle() . $ff; } } else { if (file_exists(DIR_FILES_BLOCK_TYPES_CORE . '/' . $bt->getBlockTypeHandle() . $ff)) { $url = ASSETS_URL . '/' . DIRNAME_BLOCKS . '/' . $bt->getBlockTypeHandle() . $ff; } } } return $url; }
public function save($args) { $db = Loader::db(); parent::save(); $db->Execute('delete from AreaPermissionBlockTypeAccessList where paID = ?', array($this->getPermissionAccessID())); $db->Execute('delete from AreaPermissionBlockTypeAccessListCustom where paID = ?', array($this->getPermissionAccessID())); if (is_array($args['blockTypesIncluded'])) { foreach ($args['blockTypesIncluded'] as $peID => $permission) { $v = array($this->getPermissionAccessID(), $peID, $permission); $db->Execute('insert into AreaPermissionBlockTypeAccessList (paID, peID, permission) values (?, ?, ?)', $v); } } if (is_array($args['blockTypesExcluded'])) { foreach ($args['blockTypesExcluded'] as $peID => $permission) { $v = array($this->getPermissionAccessID(), $peID, $permission); $db->Execute('insert into AreaPermissionBlockTypeAccessList (paID, peID, permission) values (?, ?, ?)', $v); } } if (is_array($args['btIDInclude'])) { foreach ($args['btIDInclude'] as $peID => $btIDs) { foreach ($btIDs as $btID) { $v = array($this->getPermissionAccessID(), $peID, $btID); $db->Execute('insert into AreaPermissionBlockTypeAccessListCustom (paID, peID, btID) values (?, ?, ?)', $v); } } } if (is_array($args['btIDExclude'])) { foreach ($args['btIDExclude'] as $peID => $btIDs) { foreach ($btIDs as $btID) { $v = array($this->getPermissionAccessID(), $peID, $btID); $db->Execute('insert into AreaPermissionBlockTypeAccessListCustom (paID, peID, btID) values (?, ?, ?)', $v); } } } }
function txt_editor_config(){ if (!$this->token->validate("txt_editor_config")) { $this->error->add($this->token->getErrorMessage()); } $textEditorWidth = intval($this->post('CONTENTS_TXT_EDITOR_WIDTH')); if( $textEditorWidth<580 ) { $this->error->add(t('The editor must be at least 580 pixels wide.')); } $textEditorHeight = intval($this->post('CONTENTS_TXT_EDITOR_HEIGHT')); if( $textEditorHeight<100 ) { $this->error->add(t('The editor must be at least 100 pixels tall.')); } if (!$this->error->has()) { Config::save('CONTENTS_TXT_EDITOR_MODE', $this->post('CONTENTS_TXT_EDITOR_MODE') ); Config::save( 'CONTENTS_TXT_EDITOR_WIDTH', $textEditorWidth ); Config::save( 'CONTENTS_TXT_EDITOR_HEIGHT', $textEditorHeight ); $db = Loader::db(); $values=array( $textEditorWidth, $textEditorHeight ); $db->query( 'UPDATE BlockTypes SET btInterfaceWidth=?, btInterfaceHeight=? where btHandle = "content"', $values ); if($this->post('CONTENTS_TXT_EDITOR_MODE')=='CUSTOM') Config::save('CONTENTS_TXT_EDITOR_CUSTOM_CODE', $this->post('CONTENTS_TXT_EDITOR_CUSTOM_CODE') ); $this->redirect('/dashboard/system/basics/editor', 'txt_editor_config_saved'); } }
public function save($args) { parent::save(); $db = Loader::db(); $db->Execute('delete from ' . $this->dbTableAccessList . ' where paID = ?', array($this->getPermissionAccessID())); $db->Execute('delete from ' . $this->dbTableAccessListCustom . ' where paID = ?', array($this->getPermissionAccessID())); if (is_array($args['groupsIncluded'])) { foreach ($args['groupsIncluded'] as $peID => $permission) { $v = array($peID, $this->getPermissionAccessID(), $permission); $db->Execute('insert into ' . $this->dbTableAccessList . ' (peID, paID, permission) values (?, ?, ?)', $v); } } if (is_array($args['groupsExcluded'])) { foreach ($args['groupsExcluded'] as $peID => $permission) { $v = array($peID, $this->getPermissionAccessID(), $permission); $db->Execute('insert into ' . $this->dbTableAccessList . ' (peID, paID, permission) values (?, ?, ?)', $v); } } if (is_array($args['gIDInclude'])) { foreach ($args['gIDInclude'] as $peID => $gIDs) { foreach ($gIDs as $gID) { $v = array($peID, $this->getPermissionAccessID(), $gID); $db->Execute('insert into ' . $this->dbTableAccessListCustom . ' (peID, paID, gID) values (?, ?, ?)', $v); } } } if (is_array($args['gIDExclude'])) { foreach ($args['gIDExclude'] as $peID => $gIDs) { foreach ($gIDs as $gID) { $v = array($peID, $this->getPermissionAccessID(), $gID); $db->Execute('insert into ' . $this->dbTableAccessListCustom . ' (peID, paID, gID) values (?, ?, ?)', $v); } } } }
protected function loadRepositories() { $db = Loader::db(); $sql = "SELECT * FROM btGithubRepositories WHERE bID = ?"; $repositories = $db->getAll($sql, array(intval($this->bID))); return $repositories; }
public function tearDown() { if (count($this->tables)) { foreach ($this->tables as $table) { // drop table $conn = $this->getConnection(); $pdo = $conn->getConnection(); $pdo->exec("DROP TABLE IF EXISTS `{$table}`;"); } } $allTables = $this->getDataSet($this->fixtures)->getTableNames(); foreach ($allTables as $table) { // drop table $conn = $this->getConnection(); $pdo = $conn->getConnection(); $pdo->exec("DROP TABLE IF EXISTS `{$table}`;"); } $db = Loader::db(); $db->getEntityManager()->clear(); Database::purge(); if ($this->conn) { $this->conn = null; } parent::tearDown(); }
/** * @return ConfigStore */ private static function getStore() { if (!self::$store) { self::$store = new ConfigStore(Loader::db()); } return self::$store; }
public static function replaceFilePlaceHolderOnImport($match) { $filename = $match[1]; $db = Loader::db(); $fID = $db->GetOne('select fID from FileVersions where filename = ?', array($filename)); return '{CCM:FID_DL_' . $fID . '}'; }
public function filterByKeywords($kw) { static $reverseLookup = array(); $db = Loader::db(); $locale = Localization::activeLocale(); if (!array_key_exists($locale, $reverseLookup)) { $reverseLookup[$locale] = false; if (Localization::activeLocale() != 'en_US' || ENABLE_TRANSLATE_LOCALE_EN_US) { $limit = defined('GROUPNAME_REVERSELOOKUP_LIMIT') ? GROUPNAME_REVERSELOOKUP_LIMIT : 100; $count = $db->GetOne('select count(*) from Groups'); if ($count > 0 && $count <= $limit) { $reverseLookup[$locale] = array(); $rs = $db->Query('select gID, gName, gDescription from Groups'); while ($row = $rs->FetchRow()) { $reverseLookup[$locale][$row['gID']] = array('name' => tc('GroupName', $row['gName']), 'description' => tc('GroupDescription', $row['gDescription'])); } $rs->Close(); } } } if ($reverseLookup[$locale]) { $foundIDs = array(); foreach ($reverseLookup[$locale] as $gID => $gTranslated) { if (stripos($gTranslated['name'], $kw) !== false || stripos($gTranslated['description'], $kw) !== false) { $foundIDs[] = $gID; } } if (count($foundIDs)) { $this->filter(false, '(Groups.gID in (' . implode(', ', $foundIDs) . '))'); return; } } $this->filter(false, "(Groups.gName like " . $db->qstr('%' . $kw . '%') . " or Groups.gDescription like " . $db->qstr('%' . $kw . '%') . ")"); }
public function uninstall() { parent::uninstall(); $db = Loader::db(); $db->Execute('drop table if exists atHandleHttps'); $db->Execute('drop table if exists atHandleHttpsConfig'); }
protected function getAllowedAttributeKeyIDs($list = false) { if (!$list) { $u = new User(); $accessEntities = $u->getUserAccessEntityObjects(); $list = $this->getAccessListItems(UserPermissionKey::ACCESS_TYPE_ALL, $accessEntities); $list = PermissionDuration::filterByActive($list); } $db = Loader::db(); $allakIDs = $db->GetCol('select akID from UserAttributeKeys'); $akIDs = array(); foreach ($list as $l) { if ($l->getAttributesAllowedPermission() == 'N') { $akIDs = array(); } if ($l->getAttributesAllowedPermission() == 'C') { if ($l->getAccessType() == PermissionKey::ACCESS_TYPE_EXCLUDE) { $akIDs = array_values(array_diff($akIDs, $l->getAttributesAllowedArray())); } else { $akIDs = array_unique(array_merge($akIDs, $l->getAttributesAllowedArray())); } } if ($l->getAttributesAllowedPermission() == 'A') { $akIDs = $allakIDs; } } return $akIDs; }
public function run() { $db = Loader::db(); $cnt = $db->GetOne('select count(*) from TaskPermissions where tpHandle = ?', array('delete_user')); if ($cnt < 1) { $g3 = Group::getByID(ADMIN_GROUP_ID); $tip = TaskPermission::addTask('delete_user', t('Delete Users'), false); if (is_object($g3)) { $tip->addAccess($g3); } } Loader::model('single_page'); $sp = Page::getByPath('/dashboard/settings/multilingual'); if ($sp->isError()) { $d1a = SinglePage::add('/dashboard/settings/multilingual'); $d1a->update(array('cName' => t('Multilingual Setup'))); } $sp = Page::getByPath('/dashboard/composer'); if ($sp->isError()) { $d2 = SinglePage::add('/dashboard/composer'); $d2->update(array('cName' => t('Composer Beta'), 'cDescription' => t('Write for your site.'))); } $sp = Page::getByPath('/dashboard/composer/write'); if ($sp->isError()) { $d3 = SinglePage::add('/dashboard/composer/write'); } $sp = Page::getByPath('/dashboard/composer/drafts'); if ($sp->isError()) { $d4 = SinglePage::add('/dashboard/composer/drafts'); } $sp = Page::getByPath('/dashboard/pages/types/composer'); if ($sp->isError()) { $d5 = SinglePage::add('/dashboard/pages/types/composer'); } }
public function submit_add() { if (!Loader::helper('validation/token')->validate('add_workflow')) { $this->error->add(Loader::helper('validation/token')->getErrorMessage()); } $wfName = trim($this->post('wfName')); if (!$wfName) { $this->error->add(t('You must give the workflow a name.')); } if (!Loader::helper('validation/strings')->alphanum($wfName, true)) { $this->error->add(t('Workflow Names must only include alphanumerics and spaces.')); } $db = Loader::db(); $wfID = $db->getOne('SELECT wfID FROM Workflows WHERE wfName=?', array($wfName)); if ($wfID) { $this->error->add(t('Workflow with that name already exists.')); } if (!$this->error->has()) { $type = WorkflowType::getByID($this->post('wftID')); if (!is_object($type) || !$type instanceof WorkflowType) { $this->error->add(t('Invalid Workflow Type.')); $this->add(); return; } $wf = Workflow::add($type, $wfName); $wf->updateDetails($this->post()); $this->redirect('/dashboard/workflow/list/', 'view_detail', $wf->getWorkflowID(), 'workflow_created'); } $this->add(); }
public function testSave() { $bt = BlockType::installBlockType($this->btHandle); $btx = BlockType::getByID(1); $class = $btx->getBlockTypeClass(); $btc = new $class(); $bID = 1; foreach ($this->requestData as $type => $requestData) { $nb = $bt->add($requestData); $data = $this->expectedRecordData[$type]; $db = Loader::db(); $r = $db->GetRow('select * from `' . $btc->getBlockTypeDatabaseTable() . '` where bID = ?', array($bID)); foreach ($data as $key => $value) { $this->assertTrue($r[$key] == $value, 'Key `' . $key . '` did not equal expected value `' . $value . '` instead equalled `' . $r[$key] . '` (type `' . $type . '`)'); } $bID++; ob_start(); $bv = new BlockView($nb); $bv->render('view'); $contents = ob_get_contents(); ob_end_clean(); $contents = trim($contents); if (isset($this->expectedOutput[$type])) { $this->assertTrue($this->expectedOutput[$type] == $contents, 'Output `' . $contents . '` did not equal expected output `' . $this->expectedOutput[$type] . '` (type `' . $type . '`)'); } } }
public function run() { $tables_for_optimization = array(); $count = 0; $db = Loader::db(); $v = array(); $q = "SHOW TABLE STATUS"; $rs = $db->query($q, $v); foreach ($rs as $table) { if ($table["Data_free"] > 0) { $tables_for_optimization[] = $table["Name"]; } } unset($rs); foreach ($tables_for_optimization as $table) { $db->execute("OPTIMIZE TABLE " . $table); $count++; } $return_message = t("The Job was run successfully."); if ($count > 0) { return $return_message . " " . t("Optimized %s tables.", $count); } else { return $return_message . " " . t("There were no tables to optimize."); } }
public function __construct($tbl = null) { if ($tbl) { $db = Loader::db(); $this->_table = $tbl; parent::__construct($tbl); } }
public function getAccessListItems($accessType = PagePermissionKey::ACCESS_TYPE_INCLUDE, $filterEntities = array()) { $db = Loader::db(); $list = parent::getAccessListItems($accessType, $filterEntities); $list = PermissionDuration::filterByActive($list); foreach ($list as $l) { $pe = $l->getAccessEntityObject(); $prow = $db->GetRow('select permission, externalLink from PagePermissionPageTypeAccessList where peID = ? and paID = ?', array($pe->getAccessEntityID(), $l->getPermissionAccessID())); if (is_array($prow) && $prow['permission']) { $l->setPageTypesAllowedPermission($prow['permission']); $l->setAllowExternalLinks($prow['externalLink']); $permission = $prow['permission']; } else { if ($l->getAccessType() == PagePermissionKey::ACCESS_TYPE_INCLUDE) { $l->setPageTypesAllowedPermission('A'); $l->setAllowExternalLinks(1); } else { $l->setPageTypesAllowedPermission('N'); $l->setAllowExternalLinks(0); } } if ($permission == 'C') { $ctIDs = $db->GetCol('select ctID from PagePermissionPageTypeAccessListCustom where peID = ? and paID = ?', array($pe->getAccessEntityID(), $l->getPermissionAccessID())); $l->setPageTypesAllowedArray($ctIDs); } } return $list; }
public function run() { // Since we added the origfilename column in 5.0.0b1 we need to populate it Loader::block('library_file'); $bl = new LibraryFileBlockController(); $bl->populateOriginalFilenames(); // install the new block types made available BlockType::installBlockType('flash_content'); BlockType::installBlockType('guestbook'); BlockType::installBlockType('slideshow'); BlockType::installBlockType('search'); BlockType::installBlockType('google_map'); BlockType::installBlockType('video'); BlockType::installBlockType('rss_displayer'); BlockType::installBlockType('youtube'); BlockType::installBlockType('survey'); // rename external form $bt = BlockType::getByHandle('custom_form'); $db = Loader::db(); $tables = $db->MetaTables('TABLES'); if (isset($tables['btCustomForm']) && !isset($tables['btExternalForm'])) { $db->Execute("alter table btCustomForm rename btExternalForm"); } if (is_object($bt)) { BlockType::installBlockType('external_form', $bt->getBlockTypeID()); } // add new theme $th = PageTheme::getByHandle('greensalad'); if (!is_object($th)) { PageTheme::add('greensalad'); } }
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 function uninstall() { $db = Loader::db(); $dashPage = Page::getByPath("/dashboard/wordpress_import"); $dashPage->delete(); $db->Execute('drop table WordpressItems'); parent::uninstall(); }
public function delete() { $db = Loader::db(); $db->Execute('delete from GatheringItemFeatureAssignments where faID = ? and gaiID = ?', array($this->getFeatureAssignmentID(), $this->gaiID)); if (!$this->assignmentIsInUse()) { parent::delete(); } }