Exemplo n.º 1
0
 public function __construct()
 {
     $this->_properties = array_keys(get_object_vars($this));
     if (array_pop($this->_properties) != '_properties') {
         core_debug::i()->add('500', 'Core Error', '_properties is not last item in array');
     }
 }
Exemplo n.º 2
0
 function read($query = false, $query_column = false, $query_order = false, $query_dir = false, $query_start = false, $query_limit = false)
 {
     $int_time_start = lib_datetime_microtime();
     parent::read($query, $query_column, $query_order, $query_dir, $query_start, $query_limit);
     $array_data['results'] = count($this->array_result);
     if (count($this->array_result) > 0) {
         for ($i = 0; $i < count($this->array_result); $i++) {
             try {
                 $array_data['nodes'][] = new model_forum_categories($this->array_result[$i]);
             } catch (Exception $e) {
                 core_debug::i()->add('500', $e->getMessage(), '');
             }
         }
     }
     $array_data['elapsed'] = lib_datetime_microtime() - $int_time_start;
     return $array_data;
 }
Exemplo n.º 3
0
 public final function connect()
 {
     if (core_settings::i()->get('CONFIG_SETTINGS_AUTH') == 2) {
         if ($_SERVER['REMOTE_ADDR'] == core_settings::i()->get('CONFIG_AUTH_NTLM_IP') && strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE')) {
             if (!$this->connect_ntlm()) {
                 if ($this->http_auth_complete) {
                     // Only display a 403 if the NTLM is complete.
                     core_debug::i()->add('403', 'Cannot find user in Database: ', '');
                 } else {
                     exit;
                 }
             }
         } else {
             if (!$this->connect_ldap()) {
                 header('HTTP/1.0 401 Unauthorized');
                 header('WWW-Authenticate: Basic realm="iTrafford Login"');
                 exit('Unauthorized <a href="/">Retry</a>');
             }
         }
     }
     if (core_settings::i()->get('CONFIG_SETTINGS_AUTH') == 1) {
         $this->connect_db();
     }
 }
Exemplo n.º 4
0
 public function columns($table)
 {
     if (core_settings::i()->get('CONFIG_SETTINGS_DEBUG')) {
         $starttime = lib_datetime_microtime();
     }
     $store = array();
     $object_result = core_database::i()->query("\n\t\t\t\tselect * from `" . core_database::i()->real_escape_string($table) . "` LIMIT 1;\n\t\t\t");
     $object_fields = $object_result->fetch_fields();
     for ($i = 0; $i < count($object_fields); $i++) {
         $store[] = $object_fields[$i]->name;
     }
     if (core_settings::i()->get('CONFIG_SETTINGS_DEBUG')) {
         $endtime = lib_datetime_microtime();
         core_debug::i()->add('query', $query, round($endtime - $starttime, 6));
     }
     return $store;
 }
Exemplo n.º 5
0
        }
    } else {
        // Can't find the presenter at all.
        // Show a 404
        core_debug::i()->add('404', 'File not found: ', __DIR__ . '/../../application/presenters/presenter_' . core_requests::i()->get('presenter') . '.php');
    }
}
// </editor-fold>
// <editor-fold defaultstate="collapsed" desc="DISPLAY RESULTS">
core_paper::i()->add($presenter->data);
core_paper::i()->template = core_requests::i()->get('presenter') . '.html';
core_paper::i()->display();
// </editor-fold>
// <editor-fold defaultstate="collapsed" desc="DEBUGGING + LOGGING">
if (core_settings::i()->get('CONFIG_SETTINGS_DEBUG')) {
    // Only display the debug data in xml or html files
    if (core_paper::i()->mime == 'text/html' && core_paper::i()->mime == 'text/xml') {
        print "<!--[\n\n";
        if (isset($_SESSION)) {
            print session_id() . "\n\n";
            print_r($_SESSION);
            print "\n\n";
        }
        print_r(core_debug::i()->get());
        print "\n]-->";
    }
}
if (core_settings::i()->get('CONFIG_SETTINGS_LOGFILE')) {
    core_logging::i()->write();
}
// </editor-fold>
Exemplo n.º 6
0
 /**
  * Prints the Paper buffer to the screen 
  */
 public function display()
 {
     try {
         header('Content-Type: ' . $this->mime . '; charset=' . strtoupper($this->encoding) . '');
         header('Expires: ' . date('D, d M Y H:i:s ', time() + core_settings::i()->get('CONFIG_PAPER_EXPIRES')) . 'GMT');
         $handle = fopen($this->template, "r");
         $contents = fread($handle, filesize($this->template));
         fclose($handle);
         $find = array_keys($this->data);
         $replace = array_values($this->data);
         $xhtml = str_replace($find, $replace, $contents);
         print $xhtml;
     } catch (Exception $e) {
         core_debug::i()->add('500', $e->getMessage(), '');
     }
 }
Exemplo n.º 7
0
 /**
  * Delete record prototype
  */
 public function delete()
 {
     // <editor-fold defaultstate="collapsed" desc="BUILD QUERY">
     $pad = '                       ';
     $str_ident = '##' . get_called_class() . ' ' . __FUNCTION__ . '()' . " \n";
     $obj_data->sanitize();
     $str_update = 'DELETE FROM ' . static::$db_table . " \n";
     if (array_key_exists($query_column, static::$db_columns)) {
         $str_where = 'WHERE `' . core_database::i()->real_escape_string($query_column) . '` = "' . core_database::i()->real_escape_string($query) . '"' . " \n";
     } else {
         core_debug::i()->add('500', 'Unknown db_column', '"' . $query_column . '"');
     }
     // </editor-fold>
     // <editor-fold defaultstate="collapsed" desc="QUERY DATABASE">
     try {
         $this->array_result = core_database::i()->debug_query($str_update . $pad . $str_set . $pad . $str_where);
     } catch (Exception $e) {
         core_debug::i()->add('500', $e->getMessage(), '');
     }
     // </editor-fold>
 }
Exemplo n.º 8
0
 /**
  * Sets $request_method
  * Throws an error if not GET, POST, PUT or DELETE
  * 
  * @param string $method 
  */
 private function set_request_method($method)
 {
     if ($method == "GET" || $method == "POST" || $method == "PUT" || $method == "DELETE") {
         $this->request_method = $method;
     } else {
         core_debug::i()->add('500', $e->getMessage(), '');
     }
 }