sentence1
stringlengths
52
3.87M
sentence2
stringlengths
1
47.2k
label
stringclasses
1 value
protected function authorizeIp() { //In unit test REMOTE_ADDR is not available and will return null $request = $this->getRequest(); // E.g. command line user if (! $request instanceof \Zend_Controller_Request_Http) { return true; } $remoteIp = $request->...
Checks if the user is allowed to login using the current IP address according to the group he is in An adapter authorizes and if the end resultis boolean, string or array it is converted into a Zend\Authenticate\Result. @return mixed Zend\Authentication\Adapter\AdapterInterface|Zend\Authenticate\Result|boolean|string...
entailment
protected function authorizeOrgIp() { //special case: project user should have no restriction if ($this->project->getSuperAdminName() == $this->getLoginName()) { return true; } //In unit test REMOTE_ADDR is not available and will return null $request = $this->get...
Checks if the user is allowed to login using the current IP address according to his BASE organization An adapter authorizes and if the end resultis boolean, string or array it is converted into a Zend\Authenticate\Result. @return mixed Zend\Authentication\Adapter\AdapterInterface|Zend\Authenticate\Result|boolean|str...
entailment
public function canLoginHere() { if (! $this->_hasVar('can_login_here')) { $this->_setVar('can_login_here', true); if ($orgId = $this->userLoader->getOrganizationIdByUrl()) { if (! $this->isAllowedOrganization($orgId)) { $this->_setVar('can_login_h...
True when the current url is one where this user is allowed to login. If the url is a fixed organization url and the user is not allowed to access this organization, then this function returns false. @return boolean
entailment
public function checkRegistryRequestsAnswers() { if (! (($this->db instanceof \Zend_Db_Adapter_Abstract) && ($this->session instanceof \Zend_Session_Namespace))) { return false; } // Checks if this is the current user if (! $this->_vars instanceof \Zend_Session_Namespace...
Should be called after answering the request to allow the Target to check if all required registry values have been set correctly. @return boolean False if required values are missing.
entailment
public function clearTwoFactorKey() { $this->_setVar('user_two_factor_key', null); $this->definition->setTwoFactorKey($this, null); return $this; }
Clear the two factor authentication key @return $this
entailment
public function getAllowedRoles() { $userRole = $this->getRole(); if ($userRole === 'master') { $output = $this->acl->getRoles(); return array_combine($output, $output); } $output = array($userRole => $userRole); foreach ($this->acl->getRoles() as $ro...
Returns the current roles a user may set. NOTE! A user can set a role, unless it <em>requires a higher role level</em>. I.e. an admin is not allowed to set a super role as super inherits and expands admin. But it is allowed to set the nologin and respondent roles that are not inherited by the admin as they are in a d...
entailment
public function getAllowedStaffGroups($current = true) { // Always refresh because these values are otherwise not responsive to change $dbLookup = $this->util->getDbLookup(); $groupId = $this->getGroupId($current); $groups = $dbLookup->getActiveStaffGroups(); if ('master'...
Retrieve an array of groups the user is allowed to assign: his own group and all groups he/she inherits rights from @param boolean $current Return the current list or the original list when true @return array
entailment
public function getChangePasswordForm($args_array = null) { if (! $this->canSetPassword()) { return; } $args = \MUtil_Ra::args(func_get_args()); if (isset($args['askCheck']) && $args['askCheck']) { $args['checkFields'] = $this->loadResetPasswordCheckFields();...
Returns a form to change the possword for this user. @param boolean $askOld Ask for the old password, calculated when not set. @return \Gems_Form
entailment
public function getCurrentOrganizationId() { $orgId = $this->_getVar('user_organization_id'); //If not set, read it from the cookie if ($this->isCurrentUser() && ((null === $orgId) || (\Gems_User_UserLoader::SYSTEM_NO_ORG === $orgId))) { $request = $this->getRequest(); ...
Returns the organization id that is currently used by this user. @return int
entailment
public function getFrom() { // Gather possible sources of a from address $sources[] = $this->getBaseOrganization(); if ($this->getBaseOrganizationId() != $this->getCurrentOrganizationId()) { $sources[] = $this->getCurrentOrganization(); } $sources[] = $this->proje...
Returns the from address @return string E-Mail address
entailment
public function getFullName() { if (! $this->_getVar('user_name')) { $name = ltrim($this->_getVar('user_first_name') . ' ') . ltrim($this->_getVar('user_surname_prefix') . ' ') . $this->_getVar('user_last_name'); if (! $name) { ...
Returns the full user name (first, prefix, last). @return string
entailment
protected function getGenderGreeting($locale = null) { $greetings = $this->util->getTranslated()->getGenderGreeting($locale); if (isset($greetings[$this->_getVar('user_gender')])) { return $greetings[$this->_getVar('user_gender')]; } }
Returns the gender for use as part of a sentence, e.g. Dear Mr/Mrs In practice: starts lowercase @param string $locale @return array gender => string
entailment
public function getGreeting($locale = null) { if (! $this->_getVar('user_greeting')) { $greeting[] = $this->getGenderGreeting($locale); if ($this->_getVar('user_last_name')) { $greeting[] = $this->_getVar('user_surname_prefix'); $greeting[] = $this->_...
Returns a standard greeting for the current user. @param string $locale @return int
entailment
public function getGroup() { if (! $this->_group) { $this->_group = $this->userLoader->getGroup($this->getGroupId()); } return $this->_group; }
Returns the group of this user. @return \Gems\User\Group
entailment
public function getGroupId($current = true) { if ($current && $this->_hasVar('current_user_group')) { return $this->_getVar('current_user_group'); } return $this->_getVar('user_group'); }
Returns the group number of this user. @param boolean $current Checks value for current role (when false for normal role); @return int
entailment
public function getMailFields($locale = null) { $org = $this->getBaseOrganization(); $orgResults = $org->getMailFields(); $projResults = $this->project->getMailFields(); $result['bcc'] = $projResults['project_bcc']; $result['email'] = $this->getE...
Array of field name => values for sending E-Mail @param string $locale @return array
entailment
public function getPasswordAge() { $date = \MUtil_Date::ifDate( $this->_getVar('user_password_last_changed'), array(\Gems_Tracker::DB_DATETIME_FORMAT, \Gems_Tracker::DB_DATE_FORMAT, \Zend_Date::ISO_8601) ); if ($date instanceof \MUtil_Date) { ...
Return the number of days since last change of password @return int
entailment
public function getRequest() { if (! $this->request) { $this->request = \Zend_Controller_Front::getInstance()->getRequest(); } return $this->request; }
Return the Request object @return \Zend_Controller_Request_Abstract
entailment
public function getResetPasswordMailFields($locale = null) { $result['reset_key'] = $this->getPasswordResetKey(); $result['reset_url'] = $this->getBaseOrganization()->getLoginUrl() . '/index/resetpassword/key/' . $result['reset_key']; $result['reset_in_hours'] = $this->definition->getResetKe...
Array of field name => values for sending a reset password E-Mail @param string $locale @return array
entailment
public function getRespondentOrganizations() { if (! $this->_hasVar('__allowedRespOrgs')) { $availableOrganizations = $this->util->getDbLookup()->getOrganizationsWithRespondents(); $allowedOrganizations = $this->getAllowedOrganizations(); $this->_setVar('__allowedResp...
Get an array of OrgId => Org Name for all allowed organizations that can have respondents for the current logged in user @return array
entailment
public function getRole($current = true) { if ($current && $this->_hasVar('current_user_role')) { return $this->_getRole('current_user_role'); } return $this->_getRole('user_role'); }
Returns the current user role. @param boolean $current Checks value for current role (when false for normal role); @return string
entailment
public function gotoStartPage(\Gems_Menu $menu, \Zend_Controller_Request_Abstract $request) { if (false && $this->isPasswordResetRequired()) { // Set menu OFF // This code may be obsolete from 1.8.4 $menu->setVisible(false); $menuItem = $menu->findController(...
Redirects the user to his/her start page. @param \Gems_Menu $menu @param \Zend_Controller_Request_Abstract $request @return \Gems_Menu_SubMenuItem
entailment
public function hasPrivilege($privilege, $current = true) { if (! $this->acl) { return true; } $role = $this->getRole($current); return $this->acl->isAllowed($role, null, $privilege); }
Returns true if the role of the current user has the given privilege @param string $privilege @param boolean $current Checks value for current role (when false for normal role); @return bool
entailment
public function inAllowedGroup() { if ($this->isCurrentUser() || (! $this->isStaff())) { // Always allow editing of non-staff user // for the time being return true; } $group = $this->getGroupId(); $groups = $this->util->getDbLookup()->getActiveS...
Return true if this user has a role that is accessible by the current user, i.e. is the current user allowed to change this specific user @return boolean
entailment
public function isAllowedOrganization($organizationId) { $orgs = $this->getAllowedOrganizations(); return isset($orgs[$organizationId]) || (\Gems_User_UserLoader::SYSTEM_NO_ORG == $organizationId); }
Is this organization in the list of currently allowed organizations? @param int $organizationId @return boolean
entailment
public function isTwoFactorRequired($ipAddress) { return $this->definition->isTwoFactorRequired($ipAddress, $this->isTwoFactorEnabled(), $this->getGroup()); }
Should this user be authorized using two factor authentication? @param string $ipAddress @return boolean
entailment
protected function loadAuthorizers($password, $testPassword = true) { if ($this->isBlockable()) { $auths['block'] = array($this, 'authorizeBlock'); } // organization ip restriction $auths['orgip'] = array($this, 'authorizeOrgIp'); // group ip restriction ...
Load the callables | results needed to authenticate/authorize this user A callable will be called, then an adapter authorizes and if the end result is boolean, string or array it is converted into a Zend\Authenticate\Result. @param string $password @param boolean $testPassword Set to false to test on the non-password...
entailment
protected function loadResetPasswordCheckFields() { // CHECK ON SOMEONES BIRTHDAY // Birthdays are usually not defined for staff but they do exist for respondents if ($value = $this->_getVar('user_birthday')) { $label = $this->_('Your birthday'); $birthdayElem = n...
Returns an array of elements for check fields during password reset and/or 'label name' => 'required value' pairs. For asking extra questions before allowing a password change. Default is asking for the username but you can e.g. ask for someones birthday. @return array Of 'label name' => 'required values' or \Zend_Fo...
entailment
public function refreshAllowedOrganizations() { // Privilege overrules organizational settings if ($this->hasPrivilege('pr.organization-switch')) { $orgs = $this->util->getDbLookup()->getOrganizations(); } else { $org = $this->getBaseOrganization(); $orgs...
Allowes a refresh of the existing list of organizations for this user. @return \Gems_User_User (continuation pattern)
entailment
public function reportPasswordWeakness($password = null, $skipAge = false) { if ($this->canSetPassword()) { $checker = $this->userLoader->getPasswordChecker(); $codes[] = $this->getCurrentOrganization()->getCode(); $codes[] = $this->getRoles(); $codes[] = $th...
Check for password weakness. @param string $password Or null when you want a report on all the rules for this password. @param boolean $skipAge When setting a new password, we should not check for age @return mixed String or array of strings containing warning messages or nothing
entailment
public function sendMail($subjectTemplate, $bbBodyTemplate, $useResetFields = false, $locale = null) { if ($useResetFields && (! $this->canResetPassword())) { return $this->_('Trying to send a password reset to a user that cannot be reset.'); } $mail = $this->loader->getMail(); ...
Send an e-mail to this user @param string $subjectTemplate A subject template in which {fields} are replaced @param string $bbBodyTemplate A BB Code body template in which {fields} are replaced @param boolean $useResetFields When true get a reset key for this user @param string $locale Optional locale @return mixed St...
entailment
public function setAsCurrentUser($signalLoader = true, $resetSessionId = true) { // Get the current variables $oldStore = $this->_getVariableStore(); // When $oldStore is a \Zend_Session_Namespace, then this user is already the current user. if (! $this->isCurrentUser()) { ...
Set this user as the current user. This means that the data about this user will be stored in a session. @param boolean $signalLoader Do not set, except from UserLoader @param boolean $resetSessionId Should the session be reset? @return \Gems_User_User (continuation pattern)
entailment
public function setCurrentOrganization($organization) { if (!($organization instanceof \Gems_User_Organization)) { $organization = $this->userLoader->getOrganization($organization); } $organizationId = $organization->getId(); $oldOrganizationId = $this->getCurrentOrga...
Set the currently selected organization for this user @param mixed $organization \Gems_User_Organization or an organization id. @return \Gems_User_User (continuation pattern)
entailment
public function setGroupTemp($groupId) { if ($groupId == $this->_getVar('user_group')) { $this->_unsetVar('current_user_group'); $this->_unsetVar('current_user_role'); } else { $groups = $this->getAllowedStaffGroups(false); $group = $this->userLoader-...
(Temporarily) the group of the current user. @param int $groupId @return self
entailment
public function setPassword($password) { $this->definition->setPassword($this, $password); $this->setPasswordResetRequired(false); $this->refresh(); // force refresh return $this; }
Set the password, if allowed for this user type. @param string $password @return \Gems_User_User (continuation pattern)
entailment
public function setSurveyReturn($return = null) { if (null === $return) { $this->_unsetVar('surveyReturn'); return $this; } if ($return instanceof \Zend_Controller_Request_Abstract) { $return = $return->getParams(); } elseif (! is_array($return)) ...
Set the parameters where the survey should return to @param mixed $return \Zend_Controller_Request_Abstract, array of something that can be turned into one. @return \Gems_User_User
entailment
public function switchLocale($locale = null) { if (null === $locale) { $locale = $this->getLocale(); } elseif ($this->getLocale() != $locale) { $this->setLocale($locale); } $this->locale->setLocale($locale); $this->translateAdapter->setLocale($locale)...
Switch to new locale @param string $locale Current if omitted @return boolean true if cookie was set
entailment
public function unsetAsCurrentUser($signalLoader = true) { // When $oldStore is a \Zend_Session_Namespace, then this user is already the current user. if ($this->isCurrentUser()) { // Get the current variables $oldStore = $this->_vars; $this->_vars = new \ArrayOb...
Unsets this user as the current user. This means that the data about this user will no longer be stored in a session. @param boolean $signalLoader Do not set, except from UserLoader @return \Gems_User_User (continuation pattern)
entailment
public function afterRegistry() { parent::afterRegistry(); $allowedGroups = $this->loader->getCurrentUser()->getAllowedStaffGroups(); if ($allowedGroups) { $expr = new \Zend_Db_Expr(sprintf( "CASE WHEN gsf_id_primary_group IN (%s) THEN 1 ELSE 0 END", ...
Called after the check that all required registry values have been set correctly has run. @return void
entailment
public function save(array $newValues, array $filter = null, array $saveTables = null) { //First perform a save $savedValues = parent::save($newValues, $filter, $saveTables); //Now check if we need to set the password if(isset($newValues['fld_password']) && !empty($newValues['fld_pa...
Save a single model item. Makes sure the password is saved too using the userclass @param array $newValues The values to store for a single model item. @param array $filter If the filter contains old key values these are used to decide on update versus insert. @param array $saveTables Optional array containing the ta...
entailment
public function matchEpisode(EpisodeOfCare $episode) { foreach ($episode->getAppointments() as $appointment) { if ($appointment instanceof \Gems_Agenda_Appointment) { if ($this->matchAppointment($appointment)) { return true; } ...
Check a filter for a match @param \Gems\Agenda\EpisodeOfCare $episode @return boolean
entailment
public function getUserData($login_name, $organization) { $orgs = null; try { $orgs = $this->db->fetchPairs("SELECT gor_id_organization, gor_name FROM gems__organizations WHERE gor_active = 1 ORDER BY gor_name"); natsort($orgs); } catch (\Zend_Db_Exception $zde) { ...
Returns the data for a user object. It may be empty if the user is unknown. @param string $login_name @param int $organization @return array Of data to fill the user with.
entailment
protected function getRespondentMailfields() { if ($this->respondent) { $result = array(); $result['bcc'] = $this->mailFields['project_bcc']; $result['email'] = $this->respondent->getEmailAddress(); $result['from'] = ''; ...
Get the respondent mailfields @return array
entailment
protected function afterLoad() { if ($this->_data && $this->agenda instanceof \Gems_Agenda && ! $this->_subFilters) { // Flexible determination of filters to load. Save for future expansion of number of fields $i = 1; $field = ...
Override this function when you need to perform any actions when the data is loaded. Test for the availability of variables as these objects can be loaded data first after deserialization or registry variables first after normal instantiation. That is why this function called both at the end of afterRegistry() and af...
entailment
public function getTab() { // $this->_logger->zflog('test'); $tab = " Log"; if ($this->_writer->getErrorCount()) { $tab .= " (".$this->_writer->getErrorCount().")"; $_COOKIE['ZFDebugCollapsed'] = 'ZFDebug_'.$this->getIdentifier(); } return $tab; }
Has to return html code for the menu tab @return string
entailment
public function getPanel() { $request = Zend_Controller_Front::getInstance()->getRequest(); $module = $request->getModuleName(); if ('default' !== $module) { $module = " ($module module)"; } else { $module = ''; } $controller = $request->getCon...
Has to return html code for the content panel @return string
entailment
public function mark($name, $logFirst = false) { if (isset($this->_marks[$name])) { $this->_marks[$name]['time'] = round((microtime(true)-$_SERVER['REQUEST_TIME'])*1000-$this->_marks[$name]['time']).'ms'; if (function_exists('memory_get_usage')) { $this->_marks[$name]['me...
Sets a time mark identified with $name @param string $name
entailment
public function addField(FieldInterface $field) { $key = $field->getFieldKey(); $this->addDependsOn($field->getDataModelDependsOn()); $this->addEffected($key, $field->getDataModelEffecteds()); $this->_fields[$key] = $field; return $this; }
Add a field to this dependency @param FieldInterface $field @return \Gems\Tracker\Model\FieldDataDependency
entailment
public function getChanges(array $context, $new) { $output = array(); foreach ($this->_fields as $key => $field) { if ($field instanceof FieldInterface) { $changes = $field->getDataModelDependyChanges($context, $new); if ($changes) { ...
Returns the changes that must be made in an array consisting of <code> array( field1 => array(setting1 => $value1, setting2 => $value2, ...), field2 => array(setting3 => $value3, setting4 => $value4, ...), </code> By using [] array notation in the setting name you can append to existing values. Use the setting 'valu...
entailment
public function calculateFieldInfo($currentValue, array $fieldData) { if (! $currentValue) { return $currentValue; } $agenda = $this->loader->getAgenda(); $appointment = $agenda->getAppointment($currentValue); if ($appointment && $appointment->isActive()) {...
Calculation the field info display for this type @param array $currentValue The current value @param array $fieldData The other values loaded so far @return mixed the new value
entailment
public function calculateFieldValue($currentValue, array $fieldData, array $trackData) { if ($currentValue || isset($this->_fieldDefinition['gtf_filter_id'])) { $agenda = $this->loader->getAgenda(); if ($this->_lastActiveKey && isset($this->_fieldDefinition['gtf_filter_id'])) { ...
Calculate the field value using the current values @param array $currentValue The current value @param array $fieldData The other known field values @param array $trackData The currently available track data (track id may be empty) @return mixed the new value
entailment
public function calculationStart(array $trackData) { if (isset($trackData['gr2t_id_respondent_track'])) { $this->_lastActiveKey = $trackData['gr2t_id_respondent_track']; } elseif (isset($trackData['gr2t_id_user'], $trackData['gr2t_id_organization'])) { $this->_lastActiveKey =...
Signal the start of a new calculation round (for all fields) @param array $trackData The currently available track data (track id may be empty) @return \Gems\Tracker\Field\FieldAbstract
entailment
public function getDataModelDependyChanges(array $context, $new) { if ($this->isReadOnly()) { return null; } $agenda = $this->loader->getAgenda(); $empty = $this->util->getTranslated()->getEmptyDropdownArray(); $output['multiOptions'] = $empty + $agenda->getAct...
Returns the changes to the model for this field that must be made in an array consisting of <code> array(setting1 => $value1, setting2 => $value2, ...), </code> By using [] array notation in the setting array key you can append to existing values. Use the setting 'value' to change a value in the original data. When...
entailment
public function showAppointment($value) { if (! $value) { return $this->_('Unknown'); } if ($value instanceof \Gems_Agenda_Appointment) { $appointment = $value; } else { $appointment = $this->loader->getAgenda()->getAppointment($value); } ...
Dispaly an appoitment as text @param value $value @return string
entailment
public function commJob() { $batch = $this->loader->getMailLoader()->getCronBatch(); $batch->autoStart = true; $this->_helper->BatchRunner($batch, $this->_('Executing all cron jobs'), $this->accesslog); // $this->html->br(); }
Perform automatic job mail
entailment
public function cronLockAction() { // Switch lock $this->util->getCronJobLock()->reverse(); // Redirect $request = $this->getRequest(); $this->_reroute($this->menu->getCurrentParent()->toRouteUrl()); }
Action that switches the cron job lock on or off.
entailment
public function indexAction() { $this->initHtml(); if ($this->util->getMaintenanceLock()->isLocked()) { $this->addMessage($this->_('Cannot run cron job in maintenance mode.')); } elseif ($this->util->getCronJobLock()->isLocked()) { $this->addMessage($this->_('Cron job...
The general "do the jobs" action
entailment
public function execute() { $batch = $this->getBatch(); $import = $batch->getVariable('import'); if (! (isset($import['trackId']) && $import['trackId'])) { // Do nothing return; } $tracker = $this->loader->getTracker(); $trackEngine = $t...
Should handle execution of the task, taking as much (optional) parameters as needed The parameters should be optional and failing to provide them should be handled by the task
entailment
protected function getAutoSearchElements(array $data) { // Search text $elements = parent::getAutoSearchElements($data); $this->_addPeriodSelectors($elements, array('grco_created' => $this->_('Date sent'))); $br = \MUtil_Html::create()->br(); $elements[] = null; ...
Returns a text element for autosearch. Can be overruled. The form / html elements to search on. Elements can be grouped by inserting null's between them. That creates a distinct group of elements @param array $data The $form field values (can be usefull, but no need to set them) @return array Of \Zend_Form_Element's ...
entailment
protected function addFormElements(\Zend_Form $form) { $this->saveLabel = $this->_('Save Two Factor Setup'); $this->authenticator->addSetupFormElements($form, $this->user, $this->formData); if ($this->user->canSaveTwoFactorKey()) { $options = [ 'label' => $this-...
Add the elements to the form @param \Zend_Form $form
entailment
protected function getDefaultFormValues() { if ($this->formData) { return $this->formData; } if ($this->user->hasTwoFactor()) { $authKey = $this->user->getTwoFactorKey(); } else { $authKey = null; } if (! $authKey) { ...
Return the default values for the form @return array
entailment
public function hasHtmlOutput() { if (! ($this->user->hasTwoFactor() || $this->user->canSaveTwoFactorKey())) { $this->addMessage(sprintf( $this->_('A two factor key cannot be set for %s.'), $this->user->getFullName() )); ret...
The place to check if the data set in the snippet is valid to generate the snippet. When invalid data should result in an error, you can throw it here but you can also perform the check in the checkRegistryRequestsAnswers() function from the {@see MUtil_Registry_TargetInterface}. @return boolean
entailment
protected function saveData() { $newKey = $this->formData['twoFactorKey']; if ($newKey) { if ($this->user->canSaveTwoFactorKey()) { $enabled = $this->formData['twoFactorEnabled'] ? 1 : 0; } else { $enabled = null; } $t...
Hook containing the actual save code. @return int The number of "row level" items changed
entailment
protected function createModel() { $groupby['period_1'] = new \Zend_Db_Expr("YEAR($this->dateFrom)"); $date = new \MUtil_Date(); switch ($this->dateType) { case 'D': $keyCount = 1; $groupby['period_1'] = new \Zend_Db_Expr("CONVERT($this->dateFrom...
Creates the base model. @return \MUtil_Model_SelectModel
entailment
protected function getDefaultRow() { $results = array(); foreach ($this->getFields() as $name => $field) { $results[$name] = $field->getDefault(); } return $results; }
Returns defaults for all field values. Can be overruled. @return array An array with appropriate default values for use in \MUtil_Model_Transform_RequiredRowsTransformer
entailment
public function getFilter(\Zend_Controller_Request_Abstract $request, array $filter = array(), $dateField = null) { $this->_actionKey = $request->getActionKey(); // \MUtil_Echo::r($filter, __CLASS__ . '->' . __FUNCTION__ .' 1'); $filter = $this->processFilter($request, $filter); if...
Prcesses the filter for the date selector and return the filter to use instead @param \Zend_Controller_Request_Abstract $request @param array $filter @param string $dateField @return array The new complete filter to use
entailment
protected function processFilter(\Zend_Controller_Request_Abstract $request, array $filter) { $defaults = $this->getDefaultSearchData(); $this->dateFactor = $this->processFilterName(self::DATE_FACTOR, $request, $filter, $defaults); $this->dateGroup = $this->processFilterName(self::DATE_GRO...
Processing of filter, can be overriden. @param \Zend_Controller_Request_Abstract $request @param array $filter @return array
entailment
public function checkRegistryRequestsAnswers() { $this->escort = \GemsEscort::getInstance(); //Load the dbaModel $model = new \Gems_Model_DbaModel($this->db, $this->escort->getDatabasePaths()); if ($this->project->databaseFileEncoding) { $model->setFileEncoding($this->pr...
Now we have the requests answered, add the DatabasePatcher as it needs the db object @return boolean
entailment
protected function _getPasswordRules(array $current, array $codes, array &$rules) { foreach ($current as $key => $value) { if (is_array($value)) { // Only act when this is in the set of key values if (isset($codes[strtolower($key)])) { $t...
Add recursively the rules active for this specific set of codes. @param array $current The current (part)sub) array of $this->passwords to check @param array $codes An array of code names that identify rules that should be used only for those codes. @param array $rules The array that stores the activated rules. @retur...
entailment
public function checkRequiredValues() { $missing = array(); foreach ($this->requiredKeys as $key => $names) { if (is_array($names)) { if (! ($this->offsetExists($key) && $this->offsetGet($key))) { $subarray = array(); } else { ...
This function checks for the required project settings. Overrule this function or the $requiredParameters to add extra required settings. @see $requiredParameters @return void
entailment
public function decrypt($input) { if (! $input) { return $input; } $methods = $this->getEncryptionMethods(); if (':' == $input[0]) { list($empty, $mkey, $base64) = explode(':', $input, 3); if (! isset($methods[$mkey])) { ...
Decrypt a string encrypted with encrypt() @param string $input String to decrypt @return decrypted string
entailment
protected function decryptMcrypt($input) { $ivlen = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_CBC); $iv = substr($input, 0, $ivlen); $key = md5($this->offsetExists('salt') ? $this->offsetGet('salt') : 'vadf2646fakjndkjn24656452vqk'); // Remove trailing zero byte...
Decrypt a string encrypted with encrypt() @param string $input String to decrypt @return string decrypted string of false
entailment
protected function decryptOpenSsl($input, $method) { $ivlen = openssl_cipher_iv_length($method); $iv = substr($input, 0, $ivlen); $key = $this->getEncryptionSaltKey(); return openssl_decrypt(substr($input, $ivlen), $method, $key, 0, $iv); }
Reversibly encrypt a string @param string $input String to decrypt @param string $method The cipher method, one of openssl_get_cipher_methods(). @return string decrypted string of false
entailment
public function encrypt($input) { if (! $input) { return $input; } $methods = $this->getEncryptionMethods(); $method = reset($methods); $mkey = key($methods); if ('mcrypt' == $method) { $result = $this->encryptMcrypt($input); ...
Reversibly encrypt a string @param string $input String to decrypt @return encrypted string
entailment
protected function encryptMcrypt($input) { $ivlen = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_CBC); $iv = mcrypt_create_iv($ivlen, MCRYPT_RAND); $key = $this->getEncryptionSaltKey(); return $iv . mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $key, $input, MCRYPT_MODE_CBC,...
Reversibly encrypt a string @param string $input String to encrypt @return encrypted string
entailment
protected function encryptOpenSsl($input, $method) { $ivlen = openssl_cipher_iv_length($method); $iv = openssl_random_pseudo_bytes($ivlen); $key = $this->getEncryptionSaltKey(); return $iv . openssl_encrypt($input, $method, $key, 0, $iv); }
Reversibly encrypt a string @param string $input String to encrypt @param string $method The cipher method, one of openssl_get_cipher_methods(). @return encrypted string
entailment
public function getAskDelay(\Zend_Controller_Request_Abstract $request, $wasAnswered) { if ($request->getParam('delay_cancelled', false)) { return -1; } $delay = $request->getParam('delay', null); if (null != $delay) { return $delay; } ...
Calculate the delay between surveys being asked for this request. Zero means forward at once, a negative value means wait forever. @param \Zend_Controller_Request_Abstract $request @param boolean $wasAnswered When true use the ask delay @return int -1 means waiting indefinitely
entailment
public function getConsoleRole() { if ($this->offsetExists('console')) { $cons = $this->offsetGet('console'); if (isset($cons['role'])) { return $cons['role']; } } return false; }
Get the specified role for the console user from the project setttings. If the role is not defined (or does not exist) running GemsTracker in console mode requires the users login name, organization and password to be specified on the command line. @return string
entailment
public function getCronLogfile() { if (! ($this->offsetExists('cron') && isset($this->cron['logfile']))) { return null; } $file = trim($this->cron['logfile']); if (\MUtil_File::isRootPath($file)) { return $file; } return GEMS_ROOT_DI...
The logfile for cron jobs @return string
entailment
public function getEmailBounce() { if ($this->offsetExists('email') && isset($this->email['bounce'])) { return (boolean) $this->email['bounce']; } return false; }
Should all mail be bounced to the sender? @return boolean
entailment
public function getEmailCreateAccount() { if ($this->offsetExists('email') && isset($this->email['createAccountTemplate'])) { return (string) $this->email['createAccountTemplate']; } return false; }
The default Email Template for Create Account @return string Template Code
entailment
public function getEmailMultiLanguage() { if ($this->offsetExists('email') && isset($this->email['multiLanguage'])) { return (boolean) $this->email['multiLanguage']; } else { return true; } }
Check if multiple language mail templates is supported @return boolean
entailment
public function getEmailResetPassword() { if ($this->offsetExists('email') && isset($this->email['resetPasswordTemplate'])) { return (string) $this->email['resetPasswordTemplate']; } return false; }
The default Email template for Reset password @return string Template Code
entailment
public function getLogLevel() { if (isset($this['logLevel'])) { $logLevel = $this['logLevel']; } else { $logLevel = $this->getLogLevelDefault(); } return (int) $logLevel; }
Get the logLevel to use with the \Gems_Log Default settings is for development and testing environment to use \Zend_Log::DEBUG and for all other environments to use the \Zend_Log::ERR level. This can be overruled by specifying a logLevel in the project.ini Using a level higher than \Zend_Log::ERR will output full err...
entailment
public function getLogLevelDefault() { if ('development' == APPLICATION_ENV || 'testing' == APPLICATION_ENV) { $logLevel = \Zend_Log::DEBUG; } else { $logLevel = \Zend_Log::ERR; } return $logLevel; }
Return the default logLevel to use with the \Gems_Log Default settings is for development and testing environment to use \Zend_Log::DEBUG and for all other environments to use the \Zend_Log::ERR level. This can be overruled by specifying a logLevel in the project.ini @return int The loglevel to use
entailment
public function getLongDescription($language) { if (isset($this['longDescr' . ucfirst($language)])) { return $this['longDescr' . ucfirst($language)]; } if (isset($this['longDescr'])) { return $this['longDescr']; } }
Return a long description, in the correct language if available @param string $language Iso code languahe @return string
entailment
public function getMailFields() { $result['project'] = $this->getName(); $result['project_bcc'] = $this->getEmailBcc(); $result['project_description'] = $this->getDescription(); $result['project_from'] = $this->getFrom(); return $result;...
Array of field name => values for sending E-Mail @return array
entailment
public function getMonitorFrom($name = null) { if ($name) { if (isset($this['monitor'], $this['monitor'][$name], $this['monitor'][$name]['from']) && trim($this['monitor'][$name]['from'])) { return $this['monitor'][$name]['from']; } }...
Get the form address for monitor messages @param string $name Optional section name @return string
entailment
public function getMonitorPeriod($name = null) { if ($name) { if (isset($this['monitor'], $this['monitor'][$name], $this['monitor'][$name]['period']) && strlen(trim($this['monitor'][$name]['period']))) { return $this['monitor'][$name]['period']; ...
Get the period for monitor messages, optionally for a name @param string $name Optional section name @return string
entailment
public function getMonitorTo($name = null) { if ($name) { if (isset($this['monitor'], $this['monitor'][$name], $this['monitor'][$name]['to']) && trim($this['monitor'][$name]['to'])) { return $this['monitor'][$name]['to']; } } ...
Get the to addresses for monitor messages, optionally for a name @param string $name Optional section name @return string
entailment
public function getPasswordRules(array $codes) { // Process the codes array to a format better used for filtering $codes = array_change_key_case(array_flip(array_filter($codes))); // \MUtil_Echo::track($codes); $rules = array(); if ($this->offsetExists('passwords') &&...
Get the rules active for this specific set of codes. @param array $codes An array of code names that identify rules that should be used only for those codes. @return array
entailment
public function getMetaHeaders() { if ($this->offsetExists('meta') && is_array($this->meta)) { $meta = $this->meta; } else { $meta = []; } if (!array_key_exists('Content-Type', $meta)) { $meta['Content-Type'] = 'text/html;charset=UTF-8'; ...
Get additional meta headers @return array Of http-equiv => content values for meta tags
entailment
public function getResponseDatabase() { if ((!$this->_responsesDb) && $this->hasResponseDatabase()) { $adapter = $this['responses']['adapter']; if (isset($this['responses'], $this['responses']['params'])) { $options = $this['responses']['params']; ...
The response database with a table with one row for each token answer. @return \Zend_Db_Adapter_Abstract
entailment
public function getResponseHeaders() { if ($this->offsetExists('headers') && is_array($this->headers)) { $headers = $this->headers; } else { $headers = []; } if (!array_key_exists('X-UA-Compatible', $headers)) { $headers['X-UA-Compatible'] ...
Get additional response headers @return array Of name => value for HTTP response headers
entailment
public function getSessionTimeOut() { if ($this->offsetExists('session') && isset($this->session['idleTimeout'])) { return $this->session['idleTimeout']; } else { return $this->defaultSessionTimeout; } }
Timeout for sessions in seconds. @return int
entailment
public function getStaffBounce() { if ($this->offsetExists('email') && isset($this->email['staffBounce'])) { return (boolean) $this->email['staffBounce']; } return $this->getEmailBounce(); }
Should staff mail be bounced to the sender? @return boolean
entailment
public function getSuperAdminTwoFactorIpExclude() { if ($this->offsetExists('admin') && isset($this->admin['2fa'], $this->admin['2fa']['exclude'])) { return trim($this->admin['2fa']['exclude']); } }
Get the super admin two factor authentication ip exclude range @return string
entailment
public function getSuperAdminTwoFactorKey() { if ($this->offsetExists('admin') && isset($this->admin['2fa'], $this->admin['2fa']['key'])) { return trim($this->admin['2fa']['key']); } }
Get the super admin two factor authentication key @return string
entailment
public function getValueHash($value, $algorithm = null) { $salt = $this->offsetExists('salt') ? $this->offsetGet('salt') : ''; if (false === strpos($salt, '%s')) { $salted = $salt . $value; } else { $salted = sprintf($salt, $value); } // \M...
Returns a salted hash optionally using the specified hash algorithm @param string $value The value to hash @param string $algoritm Optional, hash() algorithm; uses md5() otherwise @return string The salted hexadecimal hash, length depending on the algorithm (32 for md5, 128 for sha512.
entailment
public function hasAnySupportUrl() { return isset($this['contact']) && ( isset($this['contact']['docsUrl']) || isset($this['contact']['forumUrl']) || isset($this['contact']['manualUrl']) || isset($this['contact']['supportUrl']) ...
True at least one support url exists. @return boolean @deprecated Since 1.8.2 No longer in use
entailment