/** * Returns the Debug instance of this class. * * The Debug class uses the logfile core.log. * * @return Debug */ public static function getDebug() { if (self::$debug === null) { self::$debug = new Debug('core.log'); } return self::$debug; }
public function insertAction() { #Refer to the documentation for fields if (!empty($this->params['name']) && !empty($this->params['surname']) && !empty($this->params['birth_place']) && !empty($this->params['birth_date']) && !empty($this->params['sex']) && !empty($this->params['city']) && !empty($this->params['index']) && !empty($this->params['email']) && !empty($this->params['mobile']) && !empty($this->params['state'])) { $api_params = @array('controller' => 'depositor', 'action' => 'create', 'name' => $this->params['name'], 'surname' => $this->params['surname'], 'birth_place' => $this->params['birth_place'], 'birth_date' => $this->params['birth_date'], 'sex' => $this->params['sex'], 'street' => $this->params['street'], 'civic' => $this->params['civic'], 'city' => $this->params['city'], 'province' => $this->params['province'], 'index' => $this->params['index'], 'email' => $this->params['email'], 'mobile' => $this->params['mobile'], 'telephone' => $this->params['telephone'], 'document' => $this->params['document'], 'document_type' => $this->params['document_type'], 'profession' => $this->params['profession'], 'degree' => $this->params['degree'], 'info_from' => $this->params['info_from'], 'associations' => $this->params['associations'], 'state' => $this->params['state'], 'hours' => $this->params['hours'], 'notes' => $this->params['notes']); try { $data = $this->_API->sendRequest($api_params); } catch (Exception $e) { #catch any exceptions and report the problem @ErrorHandling::APIException('depo:insert', $data, $api_params, $e, $this->params); } $this->params['page_title'] = $this->params['insert_a_depositor_text']; $str = View::render('depositor_insert/success', $this->params, true); $this->render($str); } else { $this->params['page_title'] = $this->params['blank_field_text']; $str = View::render('depositor_insert/blank', $this->params, true); $this->render($str); } }
/** * Retrieves the classname for a given file. * * @param string File to scan for class name. * @todo token_get_all war bei Implementierung nicht Unicode-kompatibel. Entferne Workaround... */ private function parse($file) { $result = preg_match(self::FILE_PATTERN, $file, $match); if (function_exists('token_get_all') == false) { // use the file names as an indicator for the class name if ($result > 0 && !empty($match[2])) { if (isset($this->index[$match[2]]) == true) { ErrorHandling::getDebug()->addText( "Class with name '{$match[2]}' found more than once." ); } $this->index[$match[2]] = $file; } } else { if (file_exists($file) == true) { $next = false; $tokens = token_get_all(file_get_contents($file)); foreach ($tokens as $token) { if (!isset($token[0])) { continue; } // next T_STRING token after this one is our desired class name if ($token[0] == T_CLASS || $token[0] == T_INTERFACE) { $next = true; } if ($token[0] == T_STRING && $next === true) { // Workaround for unicoede incompatible token_get_all function // Remove workaround when function is unicode compatible settype($token[1], 'unicode'); // End Workaround if (isset($this->index[$token[1]]) == true) { ErrorHandling::getDebug()->addText( "Class with name '{$token[1]}' found more than once." ); } $this->index[$token[1]] = $file; // We found what we need, stop the search break; } } } } }