Пример #1
0
 /**
  *
  * @param string $tester
  * @return string dsn or null
  */
 public static function getTesterTimeZone($tester)
 {
     if (DataValidator::validate_testername($tester, MULTIPROVIDER) === FALSE) {
         return NULL;
     }
     // FIXME:usare require_once?
     include_once ROOT_DIR . '/clients/' . $tester . '/client_conf.inc.php';
     $tester_in_uppercase = strtoupper($tester);
     $tester_timezone = $tester_in_uppercase . '_TIMEZONE';
     if (defined($tester_timezone)) {
         return constant($tester_timezone);
     }
     return null;
 }
Пример #2
0
 public function addTester($tester)
 {
     $tester = DataValidator::validate_testername($tester, MULTIPROVIDER);
     if ($tester !== FALSE) {
         array_push($this->testers, $tester);
         return TRUE;
     }
     return FALSE;
 }
Пример #3
0
 if (DataValidator::validate_not_empty_string($_POST['tester_country']) === FALSE) {
     $errorsAr['tester_country'] = true;
 }
 if (DataValidator::validate_phone($_POST['tester_phone']) === FALSE) {
     $errorsAr['tester_phone'] = true;
 }
 if (DataValidator::validate_email($_POST['tester_email']) === FALSE) {
     $errorsAr['tester_email'] = true;
 }
 if (DataValidator::validate_string($_POST['tester_desc']) === FALSE) {
     $errorsAr['tester_desc'] = true;
 }
 if (DataValidator::validate_string($_POST['tester_resp']) === FALSE) {
     $errorsAr['tester_resp'] = true;
 }
 if (DataValidator::validate_testername($_POST['tester_pointer'], MULTIPROVIDER) === FALSE) {
     $errorsAr['tester_pointer'] = true;
 }
 if (count($errorsAr) > 0) {
     $tester_dataAr = $_POST;
     $form = AdminModuleHtmlLib::getEditTesterForm($testersAr, $tester_dataAr, $errorsAr);
 } else {
     unset($_POST['submit']);
     $tester_dataAr = $_POST;
     $result = $common_dh->set_tester($tester_dataAr['tester_id'], $tester_dataAr);
     if (AMA_Common_DataHandler::isError($result)) {
         $errObj = new ADA_Error($result);
         $form = new CText('');
     } else {
         header('Location: ' . HTTP_ROOT_DIR . '/admin/tester_profile.php?id_tester=' . $tester_dataAr['tester_id']);
         exit;
Пример #4
0
 /**
  * getDefaultTester implementation:
  * - if it's not a multiprovider environment, return the user selected provider
  * - else return parent's method
  *
  * @see ADAAbstractUser::getDefaultTester()
  */
 public function getDefaultTester()
 {
     if (!MULTIPROVIDER) {
         $candidate = null;
         /**
          * the default tester is the only one in which the user is listed
          * that is NOT the public tester. So let's take the list of all
          * providers the user is registered into, remove the public one and
          * if what is left has only one element, this is the default tester.
          * Else we cannot tell for certain the default testers and return null.
          */
         $testersArr = $this->getTesters();
         if (!empty($testersArr)) {
             $testersArr = array_values(array_diff($testersArr, array(ADA_PUBLIC_TESTER)));
             if (count($testersArr) === 1) {
                 $candidate = $testersArr[0];
             }
         }
         $tester = DataValidator::validate_testername($candidate, MULTIPROVIDER);
         if ($tester !== false) {
             return $tester;
         } else {
             return NULL;
         }
     } else {
         return parent::getDefaultTester();
     }
 }