public function setUp()
 {
     $this->connection = getConnection();
     $this->collectionHandler = new CollectionHandler($this->connection);
     $this->collectionHandler->create('ArangoDB_PHP_TestSuite_IndexTestCollection');
     $adminHandler = new AdminHandler($this->connection);
     $version = $adminHandler->getServerVersion();
     $this->hasSparseIndexes = version_compare($version, '2.5.0') >= 0;
     $this->hasSelectivityEstimates = version_compare($version, '2.5.0') >= 0;
 }
function isCluster(Connection $connection)
{
    static $isCluster = null;
    if ($isCluster === null) {
        $adminHandler = new AdminHandler($connection);
        try {
            $role = $adminHandler->getServerRole();
            $isCluster = $role === 'COORDINATOR' || $role === 'DBSERVER';
        } catch (\Exception $e) {
            // maybe server version is too "old"
            $isCluster = false;
        }
    }
    return $isCluster;
}
Example #3
0
 public function __construct()
 {
     self::$facets = array(_t('More than .. posts') => 'morethan', _t('Less than .. posts') => 'lessthan', _t('Order by') => 'orderby');
     self::$facet_values = array('orderby' => array(_t('Publication date (descending)') => 'pubdate_desc', _t('Publication date (ascending)') => 'pubdate_asc', _t('Post count (descending)') => 'count_desc', _t('Post count (ascending)') => 'count_asc', _t('Alphabetical (descending)') => 'alphabetical_desc', _t('Alphabetical (ascending)') => 'alphabetical_asc'));
     // We could avoid "translating" for sure, but it adds an additional layer of security, so we keep it
     self::$orderby_translate = array('pubdate' => 'pubdate', 'count' => 'count', 'alphabetical' => 'term_display');
     return parent::__construct();
 }
Example #4
0
 /**
  * Display site admin index page.
  */
 function index()
 {
     AdminHandler::validate();
     AdminHandler::setupTemplate();
     $templateMgr =& TemplateManager::getManager();
     $templateMgr->assign('helpTopicId', 'site.index');
     $templateMgr->display('admin/index.tpl');
 }
 public function setUp()
 {
     $this->connection = getConnection();
     $this->collectionHandler = new CollectionHandler($this->connection);
     // clean up first
     try {
         $this->collectionHandler->drop('ArangoDB_PHP_TestSuite_TestCollection');
     } catch (\Exception $e) {
         // don't bother us, if it's already deleted.
     }
     $this->collection = new Collection();
     $this->collection->setName('ArangoDB_PHP_TestSuite_TestCollection');
     $this->collectionHandler->add($this->collection);
     $this->documentHandler = new DocumentHandler($this->connection);
     $adminHandler = new AdminHandler($this->connection);
     $version = preg_replace("/-[a-z0-9]+\$/", "", $adminHandler->getServerVersion());
     $this->hasExportApi = version_compare($version, '2.6.0') >= 0;
 }
Example #6
0
 public function __construct()
 {
     $self = $this;
     FormUI::register('add_group', function (FormUI $form, $name) use($self) {
         $form->set_settings(array('use_session_errors' => true));
         $form->append(FormControlText::create('groupname')->add_validator('validate_required', _t('The group must have a name'))->add_validator('validate_groupname')->label(_t('Group Name'))->add_class('incontent')->set_template('control.label.outsideleft'));
         $form->append(FormControlSubmit::create('newgroup')->set_caption('Add Group'));
         $form->add_validator(array($self, 'validate_add_group'));
         $form->on_success(array($self, 'do_add_group'));
     });
     parent::__construct();
 }
Example #7
0
 public function __construct()
 {
     parent::__construct();
     // Let's register the options page form so we can use it with ajax
     $self = $this;
     FormUI::register('admin_options', function ($form, $name, $extra_data) use($self) {
         $option_items = array();
         $timezones = \DateTimeZone::listIdentifiers();
         $timezones = array_merge(array('' => ''), array_combine(array_values($timezones), array_values($timezones)));
         $option_items[_t('Name & Tagline')] = array('title' => array('label' => _t('Site Name'), 'type' => 'text', 'helptext' => ''), 'tagline' => array('label' => _t('Site Tagline'), 'type' => 'text', 'helptext' => ''), 'about' => array('label' => _t('About'), 'type' => 'textarea', 'helptext' => ''));
         $option_items[_t('Publishing')] = array('pagination' => array('label' => _t('Items per Page'), 'type' => 'text', 'helptext' => ''), 'atom_entries' => array('label' => _t('Entries to show in Atom feed'), 'type' => 'text', 'helptext' => ''), 'comments_require_id' => array('label' => _t('Require Comment Author Email'), 'type' => 'checkbox', 'helptext' => ''), 'spam_percentage' => array('label' => _t('Comment SPAM Threshold'), 'type' => 'text', 'helptext' => _t('The likelihood a comment is considered SPAM, in percent.')));
         $option_items[_t('Time & Date')] = array('timezone' => array('label' => _t('Time Zone'), 'type' => 'select', 'selectarray' => $timezones, 'helptext' => _t('Current Date Time: %s', array(DateTime::create()->format()))), 'dateformat' => array('label' => _t('Date Format'), 'type' => 'text', 'helptext' => _t('Current Date: %s', array(DateTime::create()->date))), 'timeformat' => array('label' => _t('Time Format'), 'type' => 'text', 'helptext' => _t('Current Time: %s', array(DateTime::create()->time))));
         $option_items[_t('Language')] = array('locale' => array('label' => _t('Locale'), 'type' => 'select', 'selectarray' => array_merge(array('' => 'default'), array_combine(Locale::list_all(), Locale::list_all())), 'helptext' => Config::exists('locale') ? _t('International language code : This value is set in your config.php file, and cannot be changed here.') : _t('International language code'), 'disabled' => Config::exists('locale'), 'value' => Config::get('locale', Options::get('locale', 'en-us'))), 'system_locale' => array('label' => _t('System Locale'), 'type' => 'text', 'helptext' => _t('The appropriate locale code for your server')));
         $option_items[_t('Troubleshooting')] = array('log_min_severity' => array('label' => _t('Minimum Severity'), 'type' => 'select', 'selectarray' => LogEntry::list_severities(), 'helptext' => _t('Only log entries with a this or higher severity.')), 'log_backtraces' => array('label' => _t('Log Backtraces'), 'type' => 'checkbox', 'helptext' => _t('Logs error backtraces to the log table\'s data column. Can drastically increase log size!')));
         $option_items = Plugins::filter('admin_option_items', $option_items);
         $tab_index = 3;
         foreach ($option_items as $name => $option_fields) {
             /** @var FormControlFieldset $fieldset  */
             $fieldset = $form->append(FormControlWrapper::create(Utils::slugify(_u($name)))->set_properties(array('class' => 'container main settings')));
             $fieldset->append(FormControlStatic::create($name)->set_static('<h2 class="lead">' . htmlentities($name, ENT_COMPAT, 'UTF-8') . '</h2>'));
             $fieldset->set_wrap_each('<div>%s</div>');
             foreach ($option_fields as $option_name => $option) {
                 /** @var FormControlLabel $label */
                 $label = $fieldset->append(FormControlLabel::create('label_for_' . $option_name, null)->set_label($option['label']));
                 /** @var FormControl $field */
                 $field = $label->append($option['type'], $option_name, $option_name);
                 $label->set_for($field);
                 if (isset($option['value'])) {
                     $field->set_value($option['value']);
                 }
                 if (isset($option['disabled']) && $option['disabled'] == true) {
                     $field->set_properties(array('disabled' => 'disabled'));
                 }
                 if ($option['type'] == 'select' && isset($option['selectarray'])) {
                     $field->set_options($option['selectarray']);
                 }
                 $field->tabindex = $tab_index;
                 $tab_index++;
                 if (isset($option['helptext'])) {
                     $field->set_helptext($option['helptext']);
                 }
             }
         }
         $buttons = $form->append(new FormControlWrapper('buttons', null, array('class' => 'container')));
         $buttons->append(FormControlSubmit::create('apply', null, array('tabindex' => $tab_index))->set_caption(_t('Apply')));
         $form->on_success(array($self, 'form_options_success'));
         $form = Plugins::filter('admin_options_form', $form);
     });
 }
 /**
  * Validate and save changes to site settings.
  */
 function saveSettings()
 {
     parent::validate();
     parent::setupTemplate(true);
     $site =& Request::getSite();
     import('admin.form.SiteSettingsForm');
     $settingsForm =& new SiteSettingsForm();
     $settingsForm->readInputData();
     if (Request::getUserVar('uploadSiteStyleSheet')) {
         if (!$settingsForm->uploadSiteStyleSheet()) {
             $settingsForm->addError('siteStyleSheet', Locale::translate('admin.settings.siteStyleSheetInvalid'));
         }
     } elseif (Request::getUserVar('deleteSiteStyleSheet')) {
         $publicFileManager =& new PublicFileManager();
         $publicFileManager->removeSiteFile($site->getSiteStyleFilename());
     } elseif (Request::getUserVar('uploadPageHeaderTitleImage')) {
         if (!$settingsForm->uploadPageHeaderTitleImage($settingsForm->getFormLocale())) {
             $settingsForm->addError('pageHeaderTitleImage', Locale::translate('admin.settings.homeHeaderImageInvalid'));
         }
     } elseif (Request::getUserVar('deletePageHeaderTitleImage')) {
         $publicFileManager =& new PublicFileManager();
         $setting = $site->getData('pageHeaderTitleImage');
         $formLocale = $settingsForm->getFormLocale();
         if (isset($setting[$formLocale])) {
             $publicFileManager->removeSiteFile($setting[$formLocale]['uploadName']);
             unset($setting[$formLocale]);
             $site->setData('pageHeaderTitleImage', $setting);
             $siteSettingsDao =& DAORegistry::getDAO('SiteSettingsDAO');
             $siteSettingsDao->deleteSetting('pageHeaderTitleImage', $formLocale);
             // Refresh site header
             $templateMgr =& TemplateManager::getManager();
             $templateMgr->assign('displayPageHeaderTitle', $site->getSitePageHeaderTitle());
         }
     } elseif ($settingsForm->validate()) {
         $settingsForm->execute();
         $templateMgr =& TemplateManager::getManager();
         $templateMgr->assign(array('currentUrl' => Request::url(null, null, 'settings'), 'pageTitle' => 'admin.siteSettings', 'message' => 'common.changesSaved', 'backLink' => Request::url(null, Request::getRequestedPage()), 'backLinkLabel' => 'admin.siteAdmin'));
         $templateMgr->display('common/message.tpl');
         exit;
     }
     $settingsForm->display();
 }
Example #9
0
 /**
  * Constructor
  **/
 function AdminFunctionsHandler()
 {
     parent::AdminHandler();
 }
Example #10
0
        return new Response('Unauthorized', 401);
    }
    $object = array('admin_id' => $admin_id, 'role_id' => $request->get('role_id'));
    $handler = new AdminHandler();
    $result = $handler->updateRole($object);
    return new Response($result['message'], $result['status_code']);
});
// Update password
$app->POST('/admin/{admin_id}/password', function (Application $app, Request $request, $admin_id) {
    if (!authenticate('user', $admin_id)) {
        return new Response('Unauthorized', 401);
    }
    $object = array('admin_id' => $admin_id, 'password' => $request->get('password'));
    $handler = new AdminHandler();
    $result = $handler->updatePassword($object);
    return new Response($result['message'], $result['status_code']);
});
// Delete admin
$app->DELETE('/admin/{admin_id}', function (Application $app, Request $request, $admin_id) {
    if (!authenticate('1', null)) {
        return new Response('Unauthorized', 401);
    }
    $handler = new AdminHandler();
    $result = $handler->delete($admin_id);
    return new Response($result['message'], $result['status_code']);
});
// optional geolocation in body
$app->GET('/businesses/{category}/{subcategory}', function (Application $app, Request $request, $subcategory) {
    return new Response('How about implementing businessRepairSubcategoryGet as a GET method ?');
});
$app->run();
Example #11
0
require_once 'common.php';
if ($CONF['configured'] !== true) {
    print "Installation not yet configured; please edit config.inc.php or write your settings to config.local.php";
    exit;
}
if ($_SERVER['REQUEST_METHOD'] == "POST") {
    $lang = safepost('lang');
    $fUsername = trim(safepost('fUsername'));
    $fPassword = safepost('fPassword');
    if ($lang != check_language(0)) {
        # only set cookie if language selection was changed
        setcookie('lang', $lang, time() + 60 * 60 * 24 * 30);
        # language cookie, lifetime 30 days
        # (language preference cookie is processed even if username and/or password are invalid)
    }
    $h = new AdminHandler();
    if ($h->login($fUsername, $fPassword)) {
        session_regenerate_id();
        $_SESSION['sessid'] = array();
        $_SESSION['sessid']['roles'] = array();
        $_SESSION['sessid']['roles'][] = 'admin';
        $_SESSION['sessid']['username'] = $fUsername;
        $_SESSION['PFA_token'] = md5(uniqid(rand(), true));
        # they've logged in, so see if they are a domain admin, as well.
        if (!$h->init($fUsername)) {
            flash_error($PALANG['pLogin_failed']);
        }
        if (!$h->view()) {
            flash_error($PALANG['pLogin_failed']);
        }
        $adminproperties = $h->result();
 /**
  * Download a locale from the PKP web site.
  */
 function downloadLocale()
 {
     parent::validate();
     $locale = Request::getUserVar('locale');
     import('i18n.LanguageAction');
     $languageAction =& new LanguageAction();
     if (!$languageAction->isDownloadAvailable()) {
         Request::redirect(null, null, 'languages');
     }
     if (!preg_match('/^[a-z]{2}_[A-Z]{2}$/', $locale)) {
         Request::redirect(null, null, 'languages');
     }
     $templateMgr =& TemplateManager::getManager();
     $errors = array();
     if (!$languageAction->downloadLocale($locale, $errors)) {
         $templateMgr->assign('errors', $errors);
         $templateMgr->display('admin/languageDownloadErrors.tpl');
         return;
     }
     $templateMgr->assign('messageTranslated', Locale::translate('admin.languages.localeInstalled', array('locale' => $locale)));
     $templateMgr->assign('backLink', Request::url(null, null, 'languages'));
     $templateMgr->assign('backLinkLabel', 'admin.languages.languageSettings');
     $templateMgr->display('common/message.tpl');
 }
Example #13
0
 /**
  * Constructor
  */
 function AdminLanguagesHandler()
 {
     parent::AdminHandler();
 }
 function AdminSettingsHandler()
 {
     parent::AdminHandler();
 }
 /**
  * Set up the template.
  */
 function setupTemplate()
 {
     parent::setupTemplate(true);
     AppLocale::requireComponents(array(LOCALE_COMPONENT_OJS_MANAGER));
 }
 /**
  * Validate the request. If a category ID is supplied, the category object
  * will be fetched and validated against. If,
  * additionally, the user ID is supplied, the user and membership
  * objects will be validated and fetched.
  * @param $categoryId int optional
  */
 function validate($categoryId = null)
 {
     parent::validate();
     $passedValidation = true;
     $categoryDao =& DAORegistry::getDAO('CategoryDAO');
     $this->categoryControlledVocab =& $categoryDao->build();
     if ($categoryId !== null) {
         $categoryEntryDao =& $categoryDao->getEntryDAO();
         $category =& $categoryEntryDao->getById($categoryId, $this->categoryControlledVocab->getId());
         if (!$category) {
             $passedValidation = false;
         } else {
             $this->category =& $category;
         }
     } else {
         $this->category = null;
     }
     if (!$passedValidation) {
         Request::redirect(null, null, 'categories');
     }
     return true;
 }
Example #17
0
 /**
  * Allow the Site Administrator to merge user accounts, including attributed articles etc.
  */
 function mergeUsers($args)
 {
     parent::validate();
     parent::setupTemplate(true);
     $roleDao =& DAORegistry::getDAO('RoleDAO');
     $userDao =& DAORegistry::getDAO('UserDAO');
     $templateMgr =& TemplateManager::getManager();
     $oldUserId = Request::getUserVar('oldUserId');
     $newUserId = Request::getUserVar('newUserId');
     if (!empty($oldUserId) && !empty($newUserId)) {
         // Both user IDs have been selected. Merge the accounts.
         $articleDao =& DAORegistry::getDAO('ArticleDAO');
         foreach ($articleDao->getArticlesByUserId($oldUserId) as $article) {
             $article->setUserId($newUserId);
             $articleDao->updateArticle($article);
             unset($article);
         }
         $commentDao =& DAORegistry::getDAO('CommentDAO');
         foreach ($commentDao->getCommentsByUserId($oldUserId) as $comment) {
             $comment->setUserId($newUserId);
             $commentDao->updateComment($comment);
             unset($comment);
         }
         $articleNoteDao =& DAORegistry::getDAO('ArticleNoteDAO');
         $articleNotes =& $articleNoteDao->getArticleNotesByUserId($oldUserId);
         while ($articleNote =& $articleNotes->next()) {
             $articleNote->setUserId($newUserId);
             $articleNoteDao->updateArticleNote($articleNote);
             unset($articleNote);
         }
         $editAssignmentDao =& DAORegistry::getDAO('EditAssignmentDAO');
         $editAssignments =& $editAssignmentDao->getEditAssignmentsByUserId($oldUserId);
         while ($editAssignment =& $editAssignments->next()) {
             $editAssignment->setEditorId($newUserId);
             $editAssignmentDao->updateEditAssignment($editAssignment);
             unset($editAssignment);
         }
         $editorSubmissionDao =& DAORegistry::getDAO('EditorSubmissionDAO');
         $editorSubmissionDao->transferEditorDecisions($oldUserId, $newUserId);
         $reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO');
         foreach ($reviewAssignmentDao->getReviewAssignmentsByUserId($oldUserId) as $reviewAssignment) {
             $reviewAssignment->setReviewerId($newUserId);
             $reviewAssignmentDao->updateReviewAssignment($reviewAssignment);
             unset($reviewAssignment);
         }
         $copyeditorSubmissionDao =& DAORegistry::getDAO('CopyeditorSubmissionDAO');
         $copyeditorSubmissions =& $copyeditorSubmissionDao->getCopyeditorSubmissionsByCopyeditorId($oldUserId);
         while ($copyeditorSubmission =& $copyeditorSubmissions->next()) {
             $copyeditorSubmission->setCopyeditorId($newUserId);
             $copyeditorSubmissionDao->updateCopyeditorSubmission($copyeditorSubmission);
             unset($copyeditorSubmission);
         }
         $layoutEditorSubmissionDao =& DAORegistry::getDAO('LayoutEditorSubmissionDAO');
         $layoutEditorSubmissions =& $layoutEditorSubmissionDao->getSubmissions($oldUserId);
         while ($layoutEditorSubmission =& $layoutEditorSubmissions->next()) {
             $layoutAssignment =& $layoutEditorSubmission->getLayoutAssignment();
             $layoutAssignment->setEditorId($newUserId);
             $layoutEditorSubmissionDao->updateSubmission($layoutEditorSubmission);
             unset($layoutAssignment);
             unset($layoutEditorSubmission);
         }
         $proofreaderSubmissionDao =& DAORegistry::getDAO('ProofreaderSubmissionDAO');
         $proofreaderSubmissions =& $proofreaderSubmissionDao->getSubmissions($oldUserId);
         while ($proofreaderSubmission =& $proofreaderSubmissions->next()) {
             $proofAssignment =& $proofreaderSubmission->getProofAssignment();
             $proofAssignment->setProofreaderId($newUserId);
             $proofreaderSubmissionDao->updateSubmission($proofreaderSubmission);
             unset($proofAssignment);
             unset($proofreaderSubmission);
         }
         $articleEmailLogDao =& DAORegistry::getDAO('ArticleEmailLogDAO');
         $articleEmailLogDao->transferArticleLogEntries($oldUserId, $newUserId);
         $articleEventLogDao =& DAORegistry::getDAO('ArticleEventLogDAO');
         $articleEventLogDao->transferArticleLogEntries($oldUserId, $newUserId);
         $articleCommentDao =& DAORegistry::getDAO('ArticleCommentDAO');
         foreach ($articleCommentDao->getArticleCommentsByUserId($oldUserId) as $articleComment) {
             $articleComment->setAuthorId($newUserId);
             $articleCommentDao->updateArticleComment($articleComment);
             unset($articleComment);
         }
         $accessKeyDao =& DAORegistry::getDAO('AccessKeyDAO');
         $accessKeyDao->transferAccessKeys($oldUserId, $newUserId);
         // Delete the old user and associated info.
         $sessionDao =& DAORegistry::getDAO('SessionDAO');
         $sessionDao->deleteSessionsByUserId($oldUserId);
         $subscriptionDao =& DAORegistry::getDAO('SubscriptionDAO');
         $subscriptionDao->deleteSubscriptionsByUserId($oldUserId);
         $temporaryFileDao =& DAORegistry::getDAO('TemporaryFileDAO');
         $temporaryFileDao->deleteTemporaryFilesByUserId($oldUserId);
         $notificationStatusDao =& DAORegistry::getDAO('NotificationStatusDAO');
         $notificationStatusDao->deleteNotificationStatusByUserId($oldUserId);
         $userSettingsDao =& DAORegistry::getDAO('UserSettingsDAO');
         $userSettingsDao->deleteSettings($oldUserId);
         $groupMembershipDao =& DAORegistry::getDAO('GroupMembershipDAO');
         $groupMembershipDao->deleteMembershipByUserId($oldUserId);
         $sectionEditorsDao =& DAORegistry::getDAO('SectionEditorsDAO');
         $sectionEditorsDao->deleteEditorsByUserId($oldUserId);
         // Transfer old user's roles
         $roles =& $roleDao->getRolesByUserId($oldUserId);
         foreach ($roles as $role) {
             if (!$roleDao->roleExists($role->getJournalId(), $newUserId, $role->getRoleId())) {
                 $role->setUserId($newUserId);
                 $roleDao->insertRole($role);
             }
         }
         $roleDao->deleteRoleByUserId($oldUserId);
         $userDao->deleteUserById($oldUserId);
         Request::redirect(null, 'admin', 'mergeUsers');
     }
     if (!empty($oldUserId)) {
         // Get the old username for the confirm prompt.
         $oldUser =& $userDao->getUser($oldUserId);
         $templateMgr->assign('oldUsername', $oldUser->getUsername());
         unset($oldUser);
     }
     // The administrator must select one or both IDs.
     if (Request::getUserVar('roleSymbolic') != null) {
         $roleSymbolic = Request::getUserVar('roleSymbolic');
     } else {
         $roleSymbolic = isset($args[0]) ? $args[0] : 'all';
     }
     if ($roleSymbolic != 'all' && String::regexp_match_get('/^(\\w+)s$/', $roleSymbolic, $matches)) {
         $roleId = $roleDao->getRoleIdFromPath($matches[1]);
         if ($roleId == null) {
             Request::redirect(null, null, null, 'all');
         }
         $roleName = $roleDao->getRoleName($roleId, true);
     } else {
         $roleId = 0;
         $roleName = 'admin.mergeUsers.allUsers';
     }
     $searchType = null;
     $searchMatch = null;
     $search = Request::getUserVar('search');
     $searchInitial = Request::getUserVar('searchInitial');
     if (isset($search)) {
         $searchType = Request::getUserVar('searchField');
         $searchMatch = Request::getUserVar('searchMatch');
     } else {
         if (isset($searchInitial)) {
             $searchInitial = String::strtoupper($searchInitial);
             $searchType = USER_FIELD_INITIAL;
             $search = $searchInitial;
         }
     }
     $rangeInfo = Handler::getRangeInfo('users');
     if ($roleId) {
         $users =& $roleDao->getUsersByRoleId($roleId, null, $searchType, $search, $searchMatch, $rangeInfo);
         $templateMgr->assign('roleId', $roleId);
     } else {
         $users =& $userDao->getUsersByField($searchType, $searchMatch, $search, true, $rangeInfo);
     }
     $templateMgr->assign('currentUrl', Request::url(null, null, 'mergeUsers'));
     $templateMgr->assign('helpTopicId', 'site.administrativeFunctions');
     $templateMgr->assign('roleName', $roleName);
     $templateMgr->assign_by_ref('users', $users);
     $templateMgr->assign_by_ref('thisUser', Request::getUser());
     $templateMgr->assign('isReviewer', $roleId == ROLE_ID_REVIEWER);
     $templateMgr->assign('searchField', $searchType);
     $templateMgr->assign('searchMatch', $searchMatch);
     $templateMgr->assign('search', $search);
     $templateMgr->assign('searchInitial', Request::getUserVar('searchInitial'));
     if ($roleId == ROLE_ID_REVIEWER) {
         $reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO');
         $templateMgr->assign('rateReviewerOnQuality', $journal->getSetting('rateReviewerOnQuality'));
         $templateMgr->assign('qualityRatings', $journal->getSetting('rateReviewerOnQuality') ? $reviewAssignmentDao->getAverageQualityRatings($journalId) : null);
     }
     $templateMgr->assign('fieldOptions', array(USER_FIELD_FIRSTNAME => 'user.firstName', USER_FIELD_LASTNAME => 'user.lastName', USER_FIELD_USERNAME => 'user.username', USER_FIELD_EMAIL => 'user.email', USER_FIELD_INTERESTS => 'user.interests'));
     $templateMgr->assign('alphaList', explode(' ', Locale::translate('common.alphaList')));
     $templateMgr->assign('oldUserId', $oldUserId);
     $templateMgr->assign('rolePath', $roleDao->getRolePath($roleId));
     $templateMgr->assign('roleSymbolic', $roleSymbolic);
     $templateMgr->display('admin/selectMergeUser.tpl');
 }
Example #18
0
 function AdminPressHandler()
 {
     parent::AdminHandler();
 }
<?php

error_reporting(E_ALL);
ini_set('display_errors', 'on');
require_once 'init.php';
checkInstalled($pollDb, $config);
$pollRepository = new DbPollRepository($pollDb, $config['database']['prefix']);
$requestRepository = new DefaultRequestRepository();
if ($config['admin']['type'] == 'default') {
    $adminInteractor = new AdminInteractor($config['admin']);
} elseif (isset($config['admin']['interactor']) && $config['admin']['interactor'] instanceof AdminInteractorInterface) {
    $adminInteractor = $config['admin']['interactor'];
}
$pollInteractor = new PollInteractor($pollRepository, $requestRepository);
$adminHandler = new AdminHandler($pollInteractor, $adminInteractor);
$indexHandler = new IndexHandler($pollInteractor);
if (!isset($_GET['c'])) {
    $_GET['c'] = '';
}
if (!isset($_GET['a'])) {
    $_GET['a'] = '';
}
switch ($_GET['c']) {
    case 'admin':
        $adminHandler->Route($_GET['a']);
        break;
    case 'index':
    default:
        $indexHandler->Route($_GET['a']);
        break;
}
 /**
  * Constructor
  */
 function AdminFunctionsHandler()
 {
     parent::AdminHandler();
     $this->addRoleAssignment(array(ROLE_ID_SITE_ADMIN), array('systemInfo', 'editSystemConfig', 'saveSystemConfig', 'phpinfo', 'expireSessions', 'clearTemplateCache', 'clearDataCache', 'downloadScheduledTaskLogFile', 'clearScheduledTaskLogFiles'));
 }
 /**
  * Constructor
  **/
 function AdminConferenceHandler()
 {
     parent::AdminHandler();
 }
 /**
  * Constructor
  */
 function __construct()
 {
     parent::__construct();
     $this->addRoleAssignment(array(ROLE_ID_SITE_ADMIN), array('contexts'));
 }
 /**
  * Setup common template variables.
  * @param $subclass boolean set to true if caller is below this handler in the hierarchy
  */
 function setupTemplate($subclass = false)
 {
     parent::setupTemplate();
     $templateMgr =& TemplateManager::getManager();
     $pageHierarchy = array(array(Request::url('admin'), 'admin.siteAdmin'));
     if ($subclass) {
         $pageHierarchy[] = array(Request::url('admin', 'archives'), 'admin.archives');
     }
     $templateMgr->assign('pageHierarchy', $pageHierarchy);
 }
 /**
  * Import data from an OJS 1.x journal.
  */
 function doImportOJS1()
 {
     parent::validate();
     import('admin.form.ImportOJS1Form');
     $importForm =& new ImportOJS1Form();
     $importForm->readInputData();
     if ($importForm->validate() && ($journalId = $importForm->execute()) !== false) {
         $redirects = $importForm->getRedirects();
         $conflicts = $importForm->getConflicts();
         $templateMgr =& TemplateManager::getManager();
         $templateMgr->assign('journalId', $journalId);
         $templateMgr->assign('redirects', $redirects);
         $templateMgr->assign('conflicts', $conflicts);
         $templateMgr->display('admin/importComplete.tpl');
     } else {
         parent::setupTemplate(true);
         $importForm->display();
     }
 }
 /**
  * Constructor
  **/
 function AuthSourcesHandler()
 {
     parent::AdminHandler();
 }
 /**
  * Constructor
  **/
 function PluginManagementHandler()
 {
     parent::AdminHandler();
 }
 /**
  * Try to create and delete a document with several keys
  */
 public function testCreateAndDeleteDocumentWithSeveralKeys()
 {
     $connection = $this->connection;
     $collection = $this->collection;
     $documentHandler = new DocumentHandler($connection);
     $keys = array("_", "foo", "bar", "bar:bar", "baz", "1", "0", "a-b-c", "a:b", "this-is-a-test", "FOO", "BAR", "Bar", "bAr");
     $adminHandler = new AdminHandler($this->connection);
     $version = preg_replace("/-[a-z0-9]+\$/", "", $adminHandler->getServerVersion());
     if (version_compare($version, '2.6.0') >= 0) {
         // 2.6 will also allow the following document keys, while 2.5 will not
         $keys[] = ".";
         $keys[] = ":";
         $keys[] = "@";
         $keys[] = "-.:@";
         $keys[] = "*****@*****.**";
         $keys[] = ":.foo@bar-bar_bar.baz.com.:";
     }
     foreach ($keys as $key) {
         $document = new Document();
         $document->someAttribute = 'someValue';
         $document->set('_key', $key);
         $documentId = $documentHandler->add($collection->getName(), $document);
         $resultingDocument = $documentHandler->get($collection->getName(), $documentId);
         $resultingAttribute = $resultingDocument->someAttribute;
         $resultingKey = $resultingDocument->getKey();
         $this->assertTrue($resultingAttribute === 'someValue', 'Resulting Attribute should be "someValue". It\'s :' . $resultingAttribute);
         $this->assertTrue($resultingKey === $key, 'Resulting Attribute should be "someValue". It\'s :' . $resultingKey);
         $documentHandler->delete($document);
     }
 }
Example #28
0
function create_admin($values)
{
    DEFINE('POSTFIXADMIN_SETUP', 1);
    # avoids instant redirect to login.php after creating the admin
    $handler = new AdminHandler(1, 'setup.php');
    $formconf = $handler->webformConfig();
    if (!$handler->init($values['username'])) {
        return array(1, "", $handler->errormsg);
    }
    if (!$handler->set($values)) {
        return array(1, "", $handler->errormsg);
    }
    if (!$handler->store()) {
        return array(1, "", $handler->errormsg);
    }
    return array(0, $handler->infomsg['success'], array());
}
Example #29
0
 /**
  * Constructor
  **/
 function AdminPeopleHandler()
 {
     parent::AdminHandler();
 }
Example #30
0
 /**
  * Constructor
  */
 function AdminContextHandler()
 {
     parent::AdminHandler();
     $this->addRoleAssignment(array(ROLE_ID_SITE_ADMIN), array('contexts'));
 }