Advertisement
johnburn

Decode for yanti@waraxe.us

Feb 20th, 2012
261
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 6.62 KB | None | 0 0
  1. <?php  
  2. if (!defined('BASEPATH')) exit('No direct script access allowed');
  3. /**
  4.  * CodeIgniter
  5.  *
  6.  * An open source application development framework for PHP 4.3.2 or newer
  7.  *
  8.  * @package     CodeIgniter
  9.  * @author      Rick Ellis
  10.  * @copyright   Copyright (c) 2006, EllisLab, Inc.
  11.  * @license     http://www.codeignitor.com/user_guide/license.html
  12.  * @link        http://www.codeigniter.com
  13.  * @since       Version 1.0
  14.  * @filesource
  15.  */
  16.  
  17.  
  18. function &load_class($class, $instantiate = TRUE)
  19. {
  20.     static $objects = array();
  21.  
  22.     // Does the class exist?  If so, we're done...
  23.     if (isset($objects[$class]))
  24.     {
  25.         return $objects[$class];
  26.     }
  27.            
  28.     // If the requested class does not exist in the application/libraries
  29.     // folder we'll load the native class from the system/libraries folder.
  30.     if (file_exists(APPPATH.'libraries/'.config_item('subclass_prefix').$class.EXT))
  31.     {
  32.         require(BASEPATH.'libraries/'.$class.EXT); 
  33.         require(APPPATH.'libraries/'.config_item('subclass_prefix').$class.EXT);
  34.         $is_subclass = TRUE;   
  35.     }
  36.     else
  37.     {
  38.         if (file_exists(APPPATH.'libraries/'.$class.EXT))
  39.         {
  40.             require(APPPATH.'libraries/'.$class.EXT);  
  41.             $is_subclass = FALSE;  
  42.         }
  43.         else
  44.         {
  45.             require(BASEPATH.'libraries/'.$class.EXT);
  46.             $is_subclass = FALSE;
  47.         }
  48.     }
  49.  
  50.     if ($instantiate == FALSE)
  51.     {
  52.         $objects[$class] = TRUE;
  53.         return $objects[$class];
  54.     }
  55.        
  56.     if ($is_subclass == TRUE)
  57.     {
  58.         $name = config_item('subclass_prefix').$class;
  59.         $objects[$class] =& new $name();
  60.         return $objects[$class];
  61.     }
  62.  
  63.     $name = ($class != 'Controller') ? 'CI_'.$class : $class;
  64.    
  65.     $objects[$class] =& new $name();
  66.     return $objects[$class];
  67. }
  68.  
  69. // adding by ALI for load konfigurasi from db
  70. function &database(){
  71.     require_once(BASEPATH.'database/DB'.EXT);
  72.  
  73.     return DB();
  74. }
  75.  
  76. // Added by ALI for checking lisence
  77. function check_system(){
  78.     if( !file_exists(BASEPATH.'libraries/System'.EXT) ){
  79.         die('Lisensi anda tidak valid. Silahkan hubungi <a href="http://indowebmaker.com">IndoWebMaker</a> untuk pembelian lisensi') ;
  80.     }
  81.    
  82.     require(BASEPATH.'libraries/System'.EXT);
  83.    
  84.     if( !class_exists('System') ){
  85.         die('Lisensi anda tidak valid. Silahkan hubungi <a href="http://indowebmaker.com">IndoWebMaker</a> untuk pembelian lisensi') ;
  86.     }
  87.    
  88.     if( !in_array('check_system', get_class_methods('System')) ){
  89.         die('Lisensi anda tidak valid. Silahkan hubungi <a href="http://indowebmaker.com">IndoWebMaker</a> untuk pembelian lisensi') ;
  90.     }
  91.    
  92.     $s = new System();
  93.     $s->check_system();
  94. }
  95.  
  96. /**
  97. * Loads the main config.php file
  98. *
  99. * @access   private
  100. * @return   array
  101. */
  102. function &get_config()
  103. {
  104.     static $main_conf;
  105.        
  106.     if ( ! isset($main_conf))
  107.     {
  108.         if ( ! file_exists(ROOTPATH.'config/config'.EXT))
  109.         {
  110.             exit('The configuration file config'.EXT.' does not exist.');
  111.         }
  112.        
  113.         require(ROOTPATH.'config/config'.EXT);
  114.        
  115.         if ( ! isset($config) OR ! is_array($config))
  116.         {
  117.             exit('Your config file does not appear to be formatted correctly.');
  118.         }
  119.  
  120.         $main_conf[0] =& $config;
  121.     }
  122.     return $main_conf[0];
  123. }
  124.  
  125. /**
  126. * Gets a config item
  127. *
  128. * @access   public
  129. * @return   mixed
  130. */
  131. function config_item($item)
  132. {
  133.     static $config_item = array();
  134.  
  135.     if ( ! isset($config_item[$item]))
  136.     {
  137.         $config =& get_config();
  138.        
  139.         if ( ! isset($config[$item]))
  140.         {
  141.             return FALSE;
  142.         }
  143.         $config_item[$item] = $config[$item];
  144.     }
  145.  
  146.     return $config_item[$item];
  147. }
  148.  
  149.  
  150. /**
  151. * Error Handler
  152. *
  153. * This function lets us invoke the exception class and
  154. * display errors using the standard error template located
  155. * in application/errors/errors.php
  156. * This function will send the error page directly to the
  157. * browser and exit.
  158. *
  159. * @access   public
  160. * @return   void
  161. */
  162. function show_error($message)
  163. {
  164.     $error =& load_class('Exceptions');
  165.     echo $error->show_error('An Error Was Encountered', $message);
  166.     exit;
  167. }
  168.  
  169. function noauth($message='Anda tidak berhak untuk mengakses halaman ini'){
  170.     $error =& load_class('Exceptions');
  171.     echo $error->show_error('PERINGATAN', $message);
  172.     exit;
  173. }
  174.  
  175.  
  176. /**
  177. * 404 Page Handler
  178. *
  179. * This function is similar to the show_error() function above
  180. * However, instead of the standard error template it displays
  181. * 404 errors.
  182. *
  183. * @access   public
  184. * @return   void
  185. */
  186. function show_404($page = '')
  187. {
  188.     $error =& load_class('Exceptions');
  189.     $error->show_404($page);
  190.     exit;
  191. }
  192.  
  193.  
  194. /**
  195. * Error Logging Interface
  196. *
  197. * We use this as a simple mechanism to access the logging
  198. * class and send messages to be logged.
  199. *
  200. * @access   public
  201. * @return   void
  202. */
  203. function log_message($level = 'error', $message, $php_error = FALSE)
  204. {
  205.     static $LOG;
  206.    
  207.     $config =& get_config();
  208.     if ($config['log_threshold'] == 0)
  209.     {
  210.         return;
  211.     }
  212.  
  213.     $LOG =& load_class('Log'); 
  214.     $LOG->write_log($level, $message, $php_error);
  215. }
  216.  
  217. /**
  218. * Exception Handler
  219. *
  220. * This is the custom exception handler that is declaired at the top
  221. * of Codeigniter.php.  The main reason we use this is permit
  222. * PHP errors to be logged in our own log files since we may
  223. * not have access to server logs. Since this function
  224. * effectively intercepts PHP errors, however, we also need
  225. * to display errors based on the current error_reporting level.
  226. * We do that with the use of a PHP error template.
  227. *
  228. * @access   private
  229. * @return   void
  230. */
  231. function _exception_handler($severity, $message, $filepath, $line)
  232. {  
  233.      // We don't bother with "strict" notices since they will fill up
  234.      // the log file with information that isn't normally very
  235.      // helpful.  For example, if you are running PHP 5 and you
  236.      // use version 4 style class functions (without prefixes
  237.      // like "public", "private", etc.) you'll get notices telling
  238.      // you that these have been deprecated.
  239.    
  240.     if ($severity == E_STRICT)
  241.     {
  242.         return;
  243.     }
  244.  
  245.     $error =& load_class('Exceptions');
  246.  
  247.     // Should we display the error?
  248.     // We'll get the current error_reporting level and add its bits
  249.     // with the severity bits to find out.
  250.    
  251.     if (($severity & error_reporting()) == $severity)
  252.     {
  253.         $error->show_php_error($severity, $message, $filepath, $line);
  254.     }
  255.    
  256.     // Should we log the error?  No?  We're done...
  257.     $config =& get_config();
  258.     if ($config['log_threshold'] == 0)
  259.     {
  260.         return;
  261.     }
  262.  
  263.     $error->log_exception($severity, $message, $filepath, $line);
  264. }
  265.  
  266. function _print_r($obj, $return=false){
  267.     ob_start();
  268.     echo '<pre>';
  269.     print_r($obj);
  270.     echo '</pre>';
  271.     if( $return ){
  272.         $rtn = ob_get_contents();
  273.         ob_end_clean();
  274.         return $rtn;
  275.     }
  276.    
  277.     ob_end_flush();
  278. }
  279.  
  280. function get_base_url(){
  281.     $proto = "http" .((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on") ? "s" : "") . "://";
  282.     $server = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : $_SERVER['SERVER_NAME'];
  283.     $base_url = $proto . $server.'/';
  284.    
  285.     return $base_url;
  286. }
  287. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement