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; }
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); }
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(); }