Пример #1
0
 /**
  * Set the debug ouput environment.
  * Setting a value of null causes Aimo_Debug to use PHP_SAPI.
  *
  * @param string $sapi
  * @return void;
  */
 public static function setSapi($sapi)
 {
     self::$_sapi = $sapi;
 }
Пример #2
0
 /**
  * Prepares and executes an SQL statement with bound data.
  *
  * @param  mixed  $sql  The SQL statement with placeholders.
  *                      May be a string or Zend_Db_Select.
  * @param  String $fetchMode Set the fetch mode..
  * @return resource
  * @throw  Exception
  */
 public function query($sql, $bind = array())
 {
     // connect to the database if needed
     $this->_connect();
     if (count($bind)) {
         foreach ($bind as $key => $value) {
             $bind[$key] = $this->_quote($value);
         }
         //unset($bind);
         $sql = vsprintf($sql, $bind);
     }
     $result = @mysql_query($sql);
     array_push($this->_debug, $sql);
     if (!$result) {
         $e = new Exception(mysql_errno() . ":" . mysql_error($this->_connection) . PHP_EOL . "SQL:" . $sql);
         Aimo_Debug::dump($e->getTrace());
         throw $e;
     }
     $this->_count++;
     return $result;
 }
Пример #3
0
 /**
  * include a header or a footer file in module path
  *
  * @param  Strng $filename
  * @return void
  */
 public function layout($filename)
 {
     $path = $this->_appRoot . 'templets' . DIRECTORY_SEPARATOR . $this->_tplDir . DIRECTORY_SEPARATOR . $this->_params['_m'] . DIRECTORY_SEPARATOR;
     //.$this->_params['_c'].DIRECTORY_SEPARATOR;
     $tplfile = $path . $filename . '.phtml';
     if (is_file($tplfile)) {
         include $path . $filename . '.phtml';
     } else {
         $e = new Exception('Sub template ' . $tplfile . ' does not exists!');
         throw $e;
         Aimo_Debug::dump($e->getTrace());
     }
 }
Пример #4
0
 /**
  * Get the values and Filtered
  *
  * @return array
  */
 public function getValues()
 {
     if ($this->isPost()) {
         $post =& $_POST;
     } else {
         $post =& $_GET;
     }
     require_once 'Aimo/Filter.php';
     $elements = $this->getElements();
     foreach ($elements as $name) {
         $element = $this->{$name};
         if (!count($element->filters)) {
             continue;
         }
         foreach ($element->filters as $method => $args) {
             if (is_int($method)) {
                 $method = $args;
                 unset($args);
             }
             $method = ucfirst($method);
             if (!method_exists('Aimo_Filter', $method)) {
                 $e = new Exception("Aimo_Filter::{$method} does not exist");
                 Aimo_Debug::dump($e->getTrace());
                 throw $e;
             }
             $args = empty($args) ? array() : $args;
             $post[$name] = isset($post[$name]) ? $post[$name] : '';
             if (is_array($post[$name])) {
                 foreach ($post[$name] as $key => $value) {
                     $args = array_merge(array($value), $args);
                     $post[$name][$key] = call_user_func_array("Aimo_Filter::{$method}", $args);
                 }
             } else {
                 $args = array_merge(array($post[$name]), $args);
                 $post[$name] = call_user_func_array("Aimo_Filter::{$method}", $args);
             }
         }
     }
     return $post;
 }