Exemplo n.º 1
0
 public function __construct()
 {
     Loader::model('system/captcha/library');
     Loader::model('system/captcha/controller');
     $captcha = SystemCaptchaLibrary::getActive();
     $this->controller = $captcha->getController();
 }
Exemplo n.º 2
0
	public static function getListByPackage($pkg) {
		$db = Loader::db();
		$sclHandles = $db->GetCol('select sclHandle from SystemCaptchaLibraries where pkgID = ? order by sclHandle asc', array($pkg->getPackageID()));
		$libraries = array();
		foreach($sclHandles as $sclHandle) {
			$scl = SystemCaptchaLibrary::getByHandle($sclHandle);
			$libraries[] = $scl;
		}
		return $libraries;
	}
Exemplo n.º 3
0
 public function run()
 {
     $db = Loader::db();
     $columns = $db->MetaColumns('Pages');
     if (!isset($columns['CISSYSTEMPAGE'])) {
         $db->Execute('alter table Pages add column cIsSystemPage tinyint(1) not null default 0');
         $db->Execute('alter table Pages add index (cIsSystemPage)');
     }
     $columns = $db->MetaColumns('Pages');
     if (!isset($columns['CISACTIVE'])) {
         $db->Execute('alter table Pages add column cIsActive tinyint(1) not null default 1');
         $db->Execute('alter table Pages add index (cIsActive)');
         $db->Execute('update Pages set cIsActive = 1');
     }
     $columns = $db->MetaColumns('PageSearchIndex');
     if (!isset($columns['CREQUIRESREINDEX'])) {
         $db->Execute('alter table PageSearchIndex add column cRequiresReindex tinyint(1) not null default 0');
         $db->Execute('alter table PageSearchIndex add index (cRequiresReindex)');
     }
     // install version job
     Loader::model("job");
     Job::installByHandle('remove_old_page_versions');
     // flag system pages appropriately
     Page::rescanSystemPages();
     // add a newsflow task permission
     $db = Loader::db();
     $cnt = $db->GetOne('select count(*) from TaskPermissions where tpHandle = ?', array('view_newsflow'));
     if ($cnt < 1) {
         $g3 = Group::getByID(ADMIN_GROUP_ID);
         $tip = TaskPermission::addTask('view_newsflow', t('View Newsflow'), false);
         if (is_object($g3)) {
             $tip->addAccess($g3);
         }
     }
     // Install new block types
     $this->installBlockTypes();
     // install stacks, trash and drafts
     $this->installSinglePages();
     // move the old dashboard
     $newDashPage = Page::getByPath('/dashboard/welcome');
     if (!is_object($newDashPage) || $newDashPage->isError()) {
         $dashboard = Page::getByPath('/dashboard');
         $dashboard->moveToTrash();
         // install new dashboard + page types
         $this->installDashboard();
         $this->migrateOldDashboard();
     }
     Loader::model('system/captcha/library');
     $scl = SystemCaptchaLibrary::getByHandle('securimage');
     if (!is_object($scl)) {
         $scl = SystemCaptchaLibrary::add('securimage', t('SecurImage (Default)'));
         $scl->activate();
     }
     Config::save('SEEN_INTRODUCTION', 1);
 }
Exemplo n.º 4
0
 public function run()
 {
     $this->x = new SimpleXMLElement("<concrete5-cif></concrete5-cif>");
     $this->x->addAttribute('version', '1.0');
     // First, attribute categories
     AttributeKeyCategory::exportList($this->x);
     // attribute types
     AttributeType::exportList($this->x);
     // then block types
     BlockTypeList::exportList($this->x);
     // now attribute keys (including user)
     AttributeKey::exportList($this->x);
     // now attribute keys (including user)
     AttributeSet::exportList($this->x);
     // now theme
     PageTheme::exportList($this->x);
     // now packages
     PackageList::export($this->x);
     // permission access entity types
     PermissionAccessEntityType::exportList($this->x);
     // now task permissions
     PermissionKey::exportList($this->x);
     // workflow types
     WorkflowType::exportList($this->x);
     // now jobs
     Loader::model('job');
     Job::exportList($this->x);
     // now single pages
     $singlepages = $this->x->addChild("singlepages");
     $db = Loader::db();
     $r = $db->Execute('select cID from Pages where cFilename is not null and cFilename <> "" and cID not in (select cID from Stacks) order by cID asc');
     while ($row = $r->FetchRow()) {
         $pc = Page::getByID($row['cID'], 'RECENT');
         $pc->export($singlepages);
     }
     // now page types
     CollectionType::exportList($this->x);
     // now stacks/global areas
     Loader::model('stack/list');
     StackList::export($this->x);
     // now content pages
     $pages = $this->x->addChild("pages");
     $db = Loader::db();
     $r = $db->Execute('select Pages.cID from Pages left join ComposerDrafts on Pages.cID = ComposerDrafts.cID where ComposerDrafts.cID is null and cIsTemplate = 0 and cFilename is null or cFilename = "" order by cID asc');
     while ($row = $r->FetchRow()) {
         $pc = Page::getByID($row['cID'], 'RECENT');
         $pc->export($pages);
     }
     Loader::model("system/captcha/library");
     SystemCaptchaLibrary::exportList($this->x);
     Config::exportList($this->x);
 }
Exemplo n.º 5
0
 public function exportAll()
 {
     $this->x = $this->getXMLRoot();
     // First, attribute categories
     AttributeKeyCategory::exportList($this->x);
     // attribute types
     AttributeType::exportList($this->x);
     // then block types
     BlockTypeList::exportList($this->x);
     // now attribute keys (including user)
     AttributeKey::exportList($this->x);
     // now attribute keys (including user)
     AttributeSet::exportList($this->x);
     // now theme
     PageTheme::exportList($this->x);
     // now packages
     PackageList::export($this->x);
     // permission access entity types
     PermissionAccessEntityType::exportList($this->x);
     // now task permissions
     PermissionKey::exportList($this->x);
     // workflow types
     WorkflowType::exportList($this->x);
     // now jobs
     Loader::model('job');
     Job::exportList($this->x);
     // now single pages
     $singlepages = $this->x->addChild("singlepages");
     $db = Loader::db();
     $r = $db->Execute('select cID from Pages where cFilename is not null and cFilename <> "" and cID not in (select cID from Stacks) order by cID asc');
     while ($row = $r->FetchRow()) {
         $pc = Page::getByID($row['cID'], 'RECENT');
         $pc->export($singlepages);
     }
     // now page types
     CollectionType::exportList($this->x);
     // now stacks/global areas
     Loader::model('stack/list');
     StackList::export($this->x);
     $this->exportPages($this->x);
     Loader::model("system/captcha/library");
     SystemCaptchaLibrary::exportList($this->x);
     Config::exportList($this->x);
 }
 public function update_captcha()
 {
     if (Loader::helper("validation/token")->validate('update_captcha')) {
         $scl = SystemCaptchaLibrary::getByHandle($this->post('activeCaptcha'));
         if (is_object($scl)) {
             $scl->activate();
             if ($scl->hasOptionsForm() && $this->post('ccm-submit-submit')) {
                 $controller = $scl->getController();
                 $controller->saveOptions($this->post());
             }
             $this->redirect('/dashboard/system/permissions/captcha', 'captcha_saved');
         } else {
             $this->error->add(t('Invalid captcha library.'));
         }
     } else {
         $this->error->add(Loader::helper('validation/token')->getErrorMessage());
     }
     $this->view();
 }
Exemplo n.º 7
0
 /** 
  * Returns an array of package items (e.g. blocks, themes)
  */
 public function getPackageItems()
 {
     $items = array();
     Loader::model('single_page');
     Loader::library('mail/importer');
     Loader::model('job');
     Loader::model('collection_types');
     Loader::model('system/captcha/library');
     Loader::model('system/antispam/library');
     $items['attribute_categories'] = AttributeKeyCategory::getListByPackage($this);
     $items['permission_categories'] = PermissionKeyCategory::getListByPackage($this);
     $items['permission_access_entity_types'] = PermissionAccessEntityType::getListByPackage($this);
     $items['attribute_keys'] = AttributeKey::getListByPackage($this);
     $items['attribute_sets'] = AttributeSet::getListByPackage($this);
     $items['group_sets'] = GroupSet::getListByPackage($this);
     $items['page_types'] = CollectionType::getListByPackage($this);
     $items['mail_importers'] = MailImporter::getListByPackage($this);
     $items['configuration_values'] = Config::getListByPackage($this);
     $items['block_types'] = BlockTypeList::getByPackage($this);
     $items['page_themes'] = PageTheme::getListByPackage($this);
     $items['permissions'] = PermissionKey::getListByPackage($this);
     $items['single_pages'] = SinglePage::getListByPackage($this);
     $items['attribute_types'] = AttributeType::getListByPackage($this);
     $items['captcha_libraries'] = SystemCaptchaLibrary::getListByPackage($this);
     $items['antispam_libraries'] = SystemAntispamLibrary::getListByPackage($this);
     $items['jobs'] = Job::getListByPackage($this);
     $items['workflow_types'] = WorkflowType::getListByPackage($this);
     ksort($items);
     return $items;
 }
Exemplo n.º 8
0
	protected function importSystemCaptchaLibraries(SimpleXMLElement $sx) {
		if (isset($sx->systemcaptcha)) {
			Loader::model('system/captcha/library');
			foreach($sx->systemcaptcha->library as $th) {
				$pkg = ContentImporter::getPackageObject($th['package']);
				$scl = SystemCaptchaLibrary::add($th['handle'], $th['name'], $pkg);
				if ($th['activated'] == '1') {
					$scl->activate();
				}
			}
		}
	}
Exemplo n.º 9
0
 /** 
  * Returns an array of package items (e.g. blocks, themes)
  */
 public function getPackageItems()
 {
     $items = array();
     Loader::model('single_page');
     Loader::library('mail/importer');
     Loader::model('job');
     Loader::model('collection_types');
     Loader::model('system/captcha/library');
     Loader::model('system/antispam/library');
     $items['attribute_categories'] = AttributeKeyCategory::getListByPackage($this);
     $items['attribute_keys'] = AttributeKey::getListByPackage($this);
     $items['attribute_sets'] = AttributeSet::getListByPackage($this);
     $items['page_types'] = CollectionType::getListByPackage($this);
     $items['mail_importers'] = MailImporter::getListByPackage($this);
     $items['configuration_values'] = Config::getListByPackage($this);
     $items['block_types'] = BlockTypeList::getByPackage($this);
     $items['page_themes'] = PageTheme::getListByPackage($this);
     $tp = new TaskPermissionList();
     $items['task_permissions'] = $tp->populatePackagePermissions($this);
     $items['single_pages'] = SinglePage::getListByPackage($this);
     $items['attribute_types'] = AttributeType::getListByPackage($this);
     $items['captcha_libraries'] = SystemCaptchaLibrary::getListByPackage($this);
     $items['antispam_libraries'] = SystemAntispamLibrary::getListByPackage($this);
     $items['jobs'] = Job::getListByPackage($this);
     ksort($items);
     return $items;
 }