├── .htaccess ├── README.md ├── application ├── .htaccess ├── config │ ├── autoload.php │ ├── config.php │ ├── constants.php │ ├── database.php │ ├── doctypes.php │ ├── facebook.php │ ├── foreign_chars.php │ ├── hooks.php │ ├── index.html │ ├── mimes.php │ ├── profiler.php │ ├── routes.php │ ├── smileys.php │ └── user_agents.php ├── controllers │ ├── ci_fb_oauth.php │ └── facebook_oauth.php ├── errors │ ├── error_404.php │ ├── error_db.php │ ├── error_general.php │ ├── error_php.php │ └── index.html ├── index.html ├── libraries │ └── Facebook_oauth.php ├── models │ └── index.html └── views │ ├── facebook_oauth.php │ └── facebook_oauth_results.php ├── assets ├── css │ └── fb_app.css └── images │ └── flogin.gif ├── index.php └── system ├── .htaccess ├── core ├── Benchmark.php ├── CodeIgniter.php ├── Common.php ├── Config.php ├── Controller.php ├── Exceptions.php ├── Hooks.php ├── Input.php ├── Lang.php ├── Loader.php ├── Model.php ├── Output.php ├── Router.php ├── URI.php ├── Utf8.php └── index.html ├── database ├── DB.php ├── DB_active_rec.php ├── DB_cache.php ├── DB_driver.php ├── DB_forge.php ├── DB_result.php ├── DB_utility.php ├── drivers │ ├── index.html │ ├── mssql │ │ ├── index.html │ │ ├── mssql_driver.php │ │ ├── mssql_forge.php │ │ ├── mssql_result.php │ │ └── mssql_utility.php │ ├── mysql │ │ ├── index.html │ │ ├── mysql_driver.php │ │ ├── mysql_forge.php │ │ ├── mysql_result.php │ │ └── mysql_utility.php │ ├── mysqli │ │ ├── index.html │ │ ├── mysqli_driver.php │ │ ├── mysqli_forge.php │ │ ├── mysqli_result.php │ │ └── mysqli_utility.php │ ├── oci8 │ │ ├── index.html │ │ ├── oci8_driver.php │ │ ├── oci8_forge.php │ │ ├── oci8_result.php │ │ └── oci8_utility.php │ ├── odbc │ │ ├── index.html │ │ ├── odbc_driver.php │ │ ├── odbc_forge.php │ │ ├── odbc_result.php │ │ └── odbc_utility.php │ ├── postgre │ │ ├── index.html │ │ ├── postgre_driver.php │ │ ├── postgre_forge.php │ │ ├── postgre_result.php │ │ └── postgre_utility.php │ └── sqlite │ │ ├── index.html │ │ ├── sqlite_driver.php │ │ ├── sqlite_forge.php │ │ ├── sqlite_result.php │ │ └── sqlite_utility.php └── index.html ├── fonts ├── index.html └── texb.ttf ├── helpers ├── array_helper.php ├── captcha_helper.php ├── cookie_helper.php ├── date_helper.php ├── directory_helper.php ├── download_helper.php ├── email_helper.php ├── file_helper.php ├── form_helper.php ├── html_helper.php ├── index.html ├── inflector_helper.php ├── language_helper.php ├── number_helper.php ├── path_helper.php ├── security_helper.php ├── smiley_helper.php ├── string_helper.php ├── text_helper.php ├── typography_helper.php ├── url_helper.php └── xml_helper.php ├── index.html ├── language ├── english │ ├── calendar_lang.php │ ├── date_lang.php │ ├── db_lang.php │ ├── email_lang.php │ ├── form_validation_lang.php │ ├── ftp_lang.php │ ├── imglib_lang.php │ ├── index.html │ ├── number_lang.php │ ├── profiler_lang.php │ ├── unit_test_lang.php │ └── upload_lang.php └── index.html └── libraries ├── Cache ├── Cache.php └── drivers │ ├── Cache_apc.php │ ├── Cache_dummy.php │ ├── Cache_file.php │ └── Cache_memcached.php ├── Calendar.php ├── Cart.php ├── Driver.php ├── Email.php ├── Encrypt.php ├── Form_validation.php ├── Ftp.php ├── Image_lib.php ├── Javascript.php ├── Log.php ├── Pagination.php ├── Parser.php ├── Profiler.php ├── Security.php ├── Session.php ├── Sha1.php ├── Table.php ├── Trackback.php ├── Typography.php ├── Unit_test.php ├── Upload.php ├── User_agent.php ├── Xmlrpc.php ├── Xmlrpcs.php ├── Zip.php ├── index.html └── javascript └── Jquery.php /.htaccess: -------------------------------------------------------------------------------- 1 | 2 | AddHandler php5-script .php 3 | 4 | RewriteEngine on 5 | RewriteCond $1 !^(index\.php|assets|robots\.txt) 6 | RewriteRule ^(.*)$ index.php/$1 [L] -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | CodeIgniter Facebook Oauth 2 | ========================== 3 | 4 | 5 | Installation Instructions 6 | ========================= 7 | 8 | * Upload files to Web server. These files already include CodeIgniter along with your /application folder 9 | * Create an application on Facebook http://www.facebook.com/developers/ 10 | * Input the following values into application/config/facebook.php (facebook_app_id, facebook_api_key, facebook_secret_key) 11 | * Go to https://mywebhost/ in your browser 12 | * It should present you with a facebook connect login button, click on it, walking you through the process 13 | * Enjoy the results, and check your wall! 14 | * Have a cup of tea :) 15 | 16 | 17 | Contributors 18 | ============ 19 | * http://github.com/BrennanNovak 20 | * http://github.com/EdwardHotchkiss 21 | 22 | Based On 23 | ======== 24 | * https://github.com/Zae/FacebookOAuth 25 | * https://github.com/abraham/twitteroauth 26 | 27 | 28 | License 29 | ======= 30 | 31 | MIT License, CodeIgniter License -------------------------------------------------------------------------------- /application/.htaccess: -------------------------------------------------------------------------------- 1 | Deny from all -------------------------------------------------------------------------------- /application/config/autoload.php: -------------------------------------------------------------------------------- 1 | '', 5 | 'xhtml1-strict' => '', 6 | 'xhtml1-trans' => '', 7 | 'xhtml1-frame' => '', 8 | 'html5' => '', 9 | 'html4-strict' => '', 10 | 'html4-trans' => '', 11 | 'html4-frame' => '' 12 | ); 13 | 14 | /* End of file doctypes.php */ 15 | /* Location: ./application/config/doctypes.php */ -------------------------------------------------------------------------------- /application/config/facebook.php: -------------------------------------------------------------------------------- 1 | 'ae', 12 | '/ö|œ/' => 'oe', 13 | '/ü/' => 'ue', 14 | '/Ä/' => 'Ae', 15 | '/Ü/' => 'Ue', 16 | '/Ö/' => 'Oe', 17 | '/À|Á|Â|Ã|Ä|Å|Ǻ|Ā|Ă|Ą|Ǎ/' => 'A', 18 | '/à|á|â|ã|å|ǻ|ā|ă|ą|ǎ|ª/' => 'a', 19 | '/Ç|Ć|Ĉ|Ċ|Č/' => 'C', 20 | '/ç|ć|ĉ|ċ|č/' => 'c', 21 | '/Ð|Ď|Đ/' => 'D', 22 | '/ð|ď|đ/' => 'd', 23 | '/È|É|Ê|Ë|Ē|Ĕ|Ė|Ę|Ě/' => 'E', 24 | '/è|é|ê|ë|ē|ĕ|ė|ę|ě/' => 'e', 25 | '/Ĝ|Ğ|Ġ|Ģ/' => 'G', 26 | '/ĝ|ğ|ġ|ģ/' => 'g', 27 | '/Ĥ|Ħ/' => 'H', 28 | '/ĥ|ħ/' => 'h', 29 | '/Ì|Í|Î|Ï|Ĩ|Ī|Ĭ|Ǐ|Į|İ/' => 'I', 30 | '/ì|í|î|ï|ĩ|ī|ĭ|ǐ|į|ı/' => 'i', 31 | '/Ĵ/' => 'J', 32 | '/ĵ/' => 'j', 33 | '/Ķ/' => 'K', 34 | '/ķ/' => 'k', 35 | '/Ĺ|Ļ|Ľ|Ŀ|Ł/' => 'L', 36 | '/ĺ|ļ|ľ|ŀ|ł/' => 'l', 37 | '/Ñ|Ń|Ņ|Ň/' => 'N', 38 | '/ñ|ń|ņ|ň|ʼn/' => 'n', 39 | '/Ò|Ó|Ô|Õ|Ō|Ŏ|Ǒ|Ő|Ơ|Ø|Ǿ/' => 'O', 40 | '/ò|ó|ô|õ|ō|ŏ|ǒ|ő|ơ|ø|ǿ|º/' => 'o', 41 | '/Ŕ|Ŗ|Ř/' => 'R', 42 | '/ŕ|ŗ|ř/' => 'r', 43 | '/Ś|Ŝ|Ş|Š/' => 'S', 44 | '/ś|ŝ|ş|š|ſ/' => 's', 45 | '/Ţ|Ť|Ŧ/' => 'T', 46 | '/ţ|ť|ŧ/' => 't', 47 | '/Ù|Ú|Û|Ũ|Ū|Ŭ|Ů|Ű|Ų|Ư|Ǔ|Ǖ|Ǘ|Ǚ|Ǜ/' => 'U', 48 | '/ù|ú|û|ũ|ū|ŭ|ů|ű|ų|ư|ǔ|ǖ|ǘ|ǚ|ǜ/' => 'u', 49 | '/Ý|Ÿ|Ŷ/' => 'Y', 50 | '/ý|ÿ|ŷ/' => 'y', 51 | '/Ŵ/' => 'W', 52 | '/ŵ/' => 'w', 53 | '/Ź|Ż|Ž/' => 'Z', 54 | '/ź|ż|ž/' => 'z', 55 | '/Æ|Ǽ/' => 'AE', 56 | '/ß/'=> 'ss', 57 | '/IJ/' => 'IJ', 58 | '/ij/' => 'ij', 59 | '/Œ/' => 'OE', 60 | '/ƒ/' => 'f' 61 | ); 62 | 63 | /* End of file foreign_chars.php */ 64 | /* Location: ./application/config/foreign_chars.php */ -------------------------------------------------------------------------------- /application/config/hooks.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 403 Forbidden 4 | 5 | 6 | 7 |

Directory access is forbidden.

8 | 9 | 10 | -------------------------------------------------------------------------------- /application/config/mimes.php: -------------------------------------------------------------------------------- 1 | 'application/mac-binhex40', 12 | 'cpt' => 'application/mac-compactpro', 13 | 'csv' => array('text/x-comma-separated-values', 'text/comma-separated-values', 'application/octet-stream', 'application/vnd.ms-excel', 'text/x-csv', 'text/csv', 'application/csv', 'application/excel', 'application/vnd.msexcel'), 14 | 'bin' => 'application/macbinary', 15 | 'dms' => 'application/octet-stream', 16 | 'lha' => 'application/octet-stream', 17 | 'lzh' => 'application/octet-stream', 18 | 'exe' => array('application/octet-stream', 'application/x-msdownload'), 19 | 'class' => 'application/octet-stream', 20 | 'psd' => 'application/x-photoshop', 21 | 'so' => 'application/octet-stream', 22 | 'sea' => 'application/octet-stream', 23 | 'dll' => 'application/octet-stream', 24 | 'oda' => 'application/oda', 25 | 'pdf' => array('application/pdf', 'application/x-download'), 26 | 'ai' => 'application/postscript', 27 | 'eps' => 'application/postscript', 28 | 'ps' => 'application/postscript', 29 | 'smi' => 'application/smil', 30 | 'smil' => 'application/smil', 31 | 'mif' => 'application/vnd.mif', 32 | 'xls' => array('application/excel', 'application/vnd.ms-excel', 'application/msexcel'), 33 | 'ppt' => array('application/powerpoint', 'application/vnd.ms-powerpoint'), 34 | 'wbxml' => 'application/wbxml', 35 | 'wmlc' => 'application/wmlc', 36 | 'dcr' => 'application/x-director', 37 | 'dir' => 'application/x-director', 38 | 'dxr' => 'application/x-director', 39 | 'dvi' => 'application/x-dvi', 40 | 'gtar' => 'application/x-gtar', 41 | 'gz' => 'application/x-gzip', 42 | 'php' => 'application/x-httpd-php', 43 | 'php4' => 'application/x-httpd-php', 44 | 'php3' => 'application/x-httpd-php', 45 | 'phtml' => 'application/x-httpd-php', 46 | 'phps' => 'application/x-httpd-php-source', 47 | 'js' => 'application/x-javascript', 48 | 'swf' => 'application/x-shockwave-flash', 49 | 'sit' => 'application/x-stuffit', 50 | 'tar' => 'application/x-tar', 51 | 'tgz' => array('application/x-tar', 'application/x-gzip-compressed'), 52 | 'xhtml' => 'application/xhtml+xml', 53 | 'xht' => 'application/xhtml+xml', 54 | 'zip' => array('application/x-zip', 'application/zip', 'application/x-zip-compressed'), 55 | 'mid' => 'audio/midi', 56 | 'midi' => 'audio/midi', 57 | 'mpga' => 'audio/mpeg', 58 | 'mp2' => 'audio/mpeg', 59 | 'mp3' => array('audio/mpeg', 'audio/mpg', 'audio/mpeg3', 'audio/mp3'), 60 | 'aif' => 'audio/x-aiff', 61 | 'aiff' => 'audio/x-aiff', 62 | 'aifc' => 'audio/x-aiff', 63 | 'ram' => 'audio/x-pn-realaudio', 64 | 'rm' => 'audio/x-pn-realaudio', 65 | 'rpm' => 'audio/x-pn-realaudio-plugin', 66 | 'ra' => 'audio/x-realaudio', 67 | 'rv' => 'video/vnd.rn-realvideo', 68 | 'wav' => 'audio/x-wav', 69 | 'bmp' => 'image/bmp', 70 | 'gif' => 'image/gif', 71 | 'jpeg' => array('image/jpeg', 'image/pjpeg'), 72 | 'jpg' => array('image/jpeg', 'image/pjpeg'), 73 | 'jpe' => array('image/jpeg', 'image/pjpeg'), 74 | 'png' => array('image/png', 'image/x-png'), 75 | 'tiff' => 'image/tiff', 76 | 'tif' => 'image/tiff', 77 | 'css' => 'text/css', 78 | 'html' => 'text/html', 79 | 'htm' => 'text/html', 80 | 'shtml' => 'text/html', 81 | 'txt' => 'text/plain', 82 | 'text' => 'text/plain', 83 | 'log' => array('text/plain', 'text/x-log'), 84 | 'rtx' => 'text/richtext', 85 | 'rtf' => 'text/rtf', 86 | 'xml' => 'text/xml', 87 | 'xsl' => 'text/xml', 88 | 'mpeg' => 'video/mpeg', 89 | 'mpg' => 'video/mpeg', 90 | 'mpe' => 'video/mpeg', 91 | 'qt' => 'video/quicktime', 92 | 'mov' => 'video/quicktime', 93 | 'avi' => 'video/x-msvideo', 94 | 'movie' => 'video/x-sgi-movie', 95 | 'doc' => 'application/msword', 96 | 'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 97 | 'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 98 | 'word' => array('application/msword', 'application/octet-stream'), 99 | 'xl' => 'application/excel', 100 | 'eml' => 'message/rfc822', 101 | 'json' => array('application/json', 'text/json') 102 | ); 103 | 104 | 105 | /* End of file mimes.php */ 106 | /* Location: ./application/config/mimes.php */ -------------------------------------------------------------------------------- /application/config/profiler.php: -------------------------------------------------------------------------------- 1 | array('grin.gif', '19', '19', 'grin'), 20 | ':lol:' => array('lol.gif', '19', '19', 'LOL'), 21 | ':cheese:' => array('cheese.gif', '19', '19', 'cheese'), 22 | ':)' => array('smile.gif', '19', '19', 'smile'), 23 | ';-)' => array('wink.gif', '19', '19', 'wink'), 24 | ';)' => array('wink.gif', '19', '19', 'wink'), 25 | ':smirk:' => array('smirk.gif', '19', '19', 'smirk'), 26 | ':roll:' => array('rolleyes.gif', '19', '19', 'rolleyes'), 27 | ':-S' => array('confused.gif', '19', '19', 'confused'), 28 | ':wow:' => array('surprise.gif', '19', '19', 'surprised'), 29 | ':bug:' => array('bigsurprise.gif', '19', '19', 'big surprise'), 30 | ':-P' => array('tongue_laugh.gif', '19', '19', 'tongue laugh'), 31 | '%-P' => array('tongue_rolleye.gif', '19', '19', 'tongue rolleye'), 32 | ';-P' => array('tongue_wink.gif', '19', '19', 'tongue wink'), 33 | ':P' => array('raspberry.gif', '19', '19', 'raspberry'), 34 | ':blank:' => array('blank.gif', '19', '19', 'blank stare'), 35 | ':long:' => array('longface.gif', '19', '19', 'long face'), 36 | ':ohh:' => array('ohh.gif', '19', '19', 'ohh'), 37 | ':grrr:' => array('grrr.gif', '19', '19', 'grrr'), 38 | ':gulp:' => array('gulp.gif', '19', '19', 'gulp'), 39 | '8-/' => array('ohoh.gif', '19', '19', 'oh oh'), 40 | ':down:' => array('downer.gif', '19', '19', 'downer'), 41 | ':red:' => array('embarrassed.gif', '19', '19', 'red face'), 42 | ':sick:' => array('sick.gif', '19', '19', 'sick'), 43 | ':shut:' => array('shuteye.gif', '19', '19', 'shut eye'), 44 | ':-/' => array('hmm.gif', '19', '19', 'hmmm'), 45 | '>:(' => array('mad.gif', '19', '19', 'mad'), 46 | ':mad:' => array('mad.gif', '19', '19', 'mad'), 47 | '>:-(' => array('angry.gif', '19', '19', 'angry'), 48 | ':angry:' => array('angry.gif', '19', '19', 'angry'), 49 | ':zip:' => array('zip.gif', '19', '19', 'zipper'), 50 | ':kiss:' => array('kiss.gif', '19', '19', 'kiss'), 51 | ':ahhh:' => array('shock.gif', '19', '19', 'shock'), 52 | ':coolsmile:' => array('shade_smile.gif', '19', '19', 'cool smile'), 53 | ':coolsmirk:' => array('shade_smirk.gif', '19', '19', 'cool smirk'), 54 | ':coolgrin:' => array('shade_grin.gif', '19', '19', 'cool grin'), 55 | ':coolhmm:' => array('shade_hmm.gif', '19', '19', 'cool hmm'), 56 | ':coolmad:' => array('shade_mad.gif', '19', '19', 'cool mad'), 57 | ':coolcheese:' => array('shade_cheese.gif', '19', '19', 'cool cheese'), 58 | ':vampire:' => array('vampire.gif', '19', '19', 'vampire'), 59 | ':snake:' => array('snake.gif', '19', '19', 'snake'), 60 | ':exclaim:' => array('exclaim.gif', '19', '19', 'excaim'), 61 | ':question:' => array('question.gif', '19', '19', 'question') // no comma after last item 62 | 63 | ); 64 | 65 | /* End of file smileys.php */ 66 | /* Location: ./application/config/smileys.php */ -------------------------------------------------------------------------------- /application/controllers/ci_fb_oauth.php: -------------------------------------------------------------------------------- 1 | load->config('facebook'); 10 | 11 | $facebook_config = array( 12 | 'client_id' => config_item('facebook_app_id'), 13 | 'client_secret' => config_item('facebook_secret_key'), 14 | 'callback_url' => base_url(), 15 | 'access_token' => NULL 16 | ); 17 | 18 | $this->load->library('facebook_oauth', $facebook_config); 19 | 20 | } 21 | 22 | function index() { 23 | 24 | $data = array(); 25 | 26 | if (isset($_GET['code'])) { 27 | 28 | $this->data['token'] = $this->facebook_oauth->getAccessToken($_GET['code']); 29 | $this->data['me'] = $this->facebook_oauth->get('/me'); 30 | //$this->data['friends'] = $this->facebook_oauth->get('/me/friends'); 31 | 32 | $parameters = array( 33 | 34 | "message" => "This post came from my app!" 35 | 36 | ); 37 | 38 | $this->data['post'] = $this->facebook_oauth->post('/me/feed', $parameters); 39 | 40 | $this->load->vars('data', $this->data); 41 | $this->load->view('facebook_oauth_results', $this->data); 42 | 43 | 44 | } else { 45 | 46 | $scope = "publish_stream,offline_access,publish_stream"; 47 | 48 | $this->data['auth_url'] = $this->facebook_oauth->getAuthorizeUrl($scope); 49 | 50 | $this->load->vars('data', $this->data); 51 | $this->load->view('facebook_oauth', $this->data); 52 | 53 | } 54 | 55 | } 56 | 57 | 58 | } -------------------------------------------------------------------------------- /application/controllers/facebook_oauth.php: -------------------------------------------------------------------------------- 1 | load->config('facebook'); 9 | 10 | $facebook_config = array( 11 | 'client_id' => config_item('facebook_app_id'), 12 | 'client_secret' => config_item('facebook_secret'), 13 | 'callback_url' => base_url().'facebook/oauth', 14 | 'access_token' => NULL 15 | ); 16 | 17 | $this->load->library('facebook_oauth', $facebook_config); 18 | 19 | } 20 | 21 | function index() 22 | { 23 | // If Returning from Facebook with "code" in query string 24 | if (isset($_GET['code'])) 25 | { 26 | $this->data['result'] = $this->facebook_oauth->getAccessToken($_GET['code']); 27 | } 28 | else 29 | { 30 | $auth_url = $this->facebook_oauth->getAuthorizeUrl(); 31 | 32 | $this->data['result'] = ''.$auth_url.''; 33 | } 34 | 35 | $this->load->view('facebook_oauth', $this->data); 36 | 37 | } 38 | 39 | 40 | } -------------------------------------------------------------------------------- /application/errors/error_404.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 404 Page Not Found 4 | 27 | 28 | 29 |
30 |

31 | 32 |
33 | 34 | -------------------------------------------------------------------------------- /application/errors/error_db.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | Database Error 4 | 27 | 28 | 29 |
30 |

31 | 32 |
33 | 34 | -------------------------------------------------------------------------------- /application/errors/error_general.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | Error 4 | 27 | 28 | 29 |
30 |

31 | 32 |
33 | 34 | -------------------------------------------------------------------------------- /application/errors/error_php.php: -------------------------------------------------------------------------------- 1 |
2 | 3 |

A PHP Error was encountered

4 | 5 |

Severity:

6 |

Message:

7 |

Filename:

8 |

Line Number:

9 | 10 |
-------------------------------------------------------------------------------- /application/errors/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 403 Forbidden 4 | 5 | 6 | 7 |

Directory access is forbidden.

8 | 9 | 10 | -------------------------------------------------------------------------------- /application/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 403 Forbidden 4 | 5 | 6 | 7 |

Directory access is forbidden.

8 | 9 | 10 | -------------------------------------------------------------------------------- /application/models/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 403 Forbidden 4 | 5 | 6 | 7 |

Directory access is forbidden.

8 | 9 | 10 | -------------------------------------------------------------------------------- /application/views/facebook_oauth.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeIgniter Facebook OAuth 6 | 7 | 8 | 9 | 10 | 11 | 12 |

13 | 14 | 15 | 16 | Facebook Login 17 | 18 | 19 | 20 |

21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /application/views/facebook_oauth_results.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeIgniter Facebook OAuth Results Example 6 | 7 | 8 | 9 | 10 | 11 | 12 |

Token:

13 | 14 |

Me: name; ?>

15 | 16 |

Friends:

17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /assets/css/fb_app.css: -------------------------------------------------------------------------------- 1 | 2 | body { 3 | font-family: 'Lucida Grande', Verdana, Arial, sans-serif; 4 | font-size: 11px; 5 | color: #333333; 6 | } 7 | 8 | h1 a { 9 | text-decoration: none; 10 | color: #3b5998; 11 | } 12 | 13 | h1 a:hover { 14 | text-decoration: underline; 15 | } 16 | 17 | .clearfix:after { 18 | content: "."; 19 | display: block; 20 | clear: both; 21 | visibility: hidden; 22 | line-height: 0; 23 | height: 0; 24 | } 25 | 26 | a { 27 | color: #3b5998; 28 | font-size: 11px; 29 | font-weight: bold; 30 | outline-style: none; 31 | text-decoration: none; 32 | } 33 | 34 | a:hover { 35 | text-decoration: underline; 36 | } 37 | 38 | a img { 39 | border: none; 40 | text-decoration: none; 41 | } 42 | 43 | .fbgreybox { 44 | background-color: #f7f7f7; 45 | border: 1px solid #cccccc; 46 | color: #333333; 47 | font-size: 13px; 48 | font-weight: bold; 49 | padding: 10px; 50 | } 51 | 52 | .fbbluebox { 53 | background-color: #eceff6; 54 | border: 1px solid #d4dae8; 55 | color: #333333; 56 | font-size: 13px; 57 | font-weight: bold; 58 | padding: 10px; 59 | } 60 | 61 | .fbinfobox { 62 | background-color: #fff9d7; 63 | border: 1px solid #e2c822; 64 | color: #333333; 65 | font-size: 13px; 66 | font-weight: bold; 67 | padding: 10px; 68 | } 69 | 70 | .fberrorbox { 71 | background-color: #ffebe8; 72 | border: 1px solid #dd3c10; 73 | color: #333333; 74 | font-size: 13px; 75 | font-weight: bold; 76 | padding: 10px; 77 | } 78 | 79 | .fbcontentdivider { 80 | background-color: #d8dfea; 81 | height: 1px; 82 | margin-bottom: 15px; 83 | margin-top: 15px; 84 | width: 520px; 85 | } 86 | 87 | .fbtab { 88 | background-color: #d8dfea; 89 | color: #3b5998; 90 | float: left; 91 | font-weight: bold; 92 | margin-right: 4px; 93 | padding: 8px; 94 | text-decoration: none; 95 | } 96 | 97 | .fbtab:hover { 98 | background-color: #3b5998; 99 | color: #ffffff; 100 | cursor: hand; 101 | } 102 | 103 | #main { 104 | width: 400px; 105 | position: relative; 106 | margin: 0 auto 0 auto; 107 | } 108 | 109 | #main_title { 110 | width: 400px; 111 | position: relative; 112 | margin: 0 auto 0 auto; 113 | margin-bottom: 10px; 114 | } 115 | 116 | #main_footer { 117 | width: 420px; 118 | position: relative; 119 | margin: 0 auto 0 auto; 120 | margin-top: 10px; 121 | } 122 | 123 | #main_footer p { 124 | text-align: right; 125 | } 126 | 127 | #main_footer p a { 128 | color: #3b5998; 129 | font-weight: normal; 130 | text-decoration: none; 131 | border-bottom: 1px solid #3b5998; 132 | } 133 | 134 | #main_like { 135 | width: 420px; 136 | position: relative; 137 | margin: 0 auto 0 auto; 138 | margin-bottom: 5px; 139 | margin-top: 150px; 140 | } 141 | 142 | a:hover { 143 | font-weight: bold; 144 | } 145 | 146 | /* EOF */ 147 | 148 | 149 | 150 | 151 | -------------------------------------------------------------------------------- /assets/images/flogin.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bnvk/codeigniter-facebook-oauth/6dc54ada0d569c3f1016e0572f13a74086af5702/assets/images/flogin.gif -------------------------------------------------------------------------------- /system/.htaccess: -------------------------------------------------------------------------------- 1 | Deny from all -------------------------------------------------------------------------------- /system/core/Benchmark.php: -------------------------------------------------------------------------------- 1 | marker[$name] = microtime(); 49 | } 50 | 51 | // -------------------------------------------------------------------- 52 | 53 | /** 54 | * Calculates the time difference between two marked points. 55 | * 56 | * If the first parameter is empty this function instead returns the 57 | * {elapsed_time} pseudo-variable. This permits the full system 58 | * execution time to be shown in a template. The output class will 59 | * swap the real value for this variable. 60 | * 61 | * @access public 62 | * @param string a particular marked point 63 | * @param string a particular marked point 64 | * @param integer the number of decimal places 65 | * @return mixed 66 | */ 67 | function elapsed_time($point1 = '', $point2 = '', $decimals = 4) 68 | { 69 | if ($point1 == '') 70 | { 71 | return '{elapsed_time}'; 72 | } 73 | 74 | if ( ! isset($this->marker[$point1])) 75 | { 76 | return ''; 77 | } 78 | 79 | if ( ! isset($this->marker[$point2])) 80 | { 81 | $this->marker[$point2] = microtime(); 82 | } 83 | 84 | list($sm, $ss) = explode(' ', $this->marker[$point1]); 85 | list($em, $es) = explode(' ', $this->marker[$point2]); 86 | 87 | return number_format(($em + $es) - ($sm + $ss), $decimals); 88 | } 89 | 90 | // -------------------------------------------------------------------- 91 | 92 | /** 93 | * Memory Usage 94 | * 95 | * This function returns the {memory_usage} pseudo-variable. 96 | * This permits it to be put it anywhere in a template 97 | * without the memory being calculated until the end. 98 | * The output class will swap the real value for this variable. 99 | * 100 | * @access public 101 | * @return string 102 | */ 103 | function memory_usage() 104 | { 105 | return '{memory_usage}'; 106 | } 107 | 108 | } 109 | 110 | // END CI_Benchmark class 111 | 112 | /* End of file Benchmark.php */ 113 | /* Location: ./system/core/Benchmark.php */ -------------------------------------------------------------------------------- /system/core/Controller.php: -------------------------------------------------------------------------------- 1 | $class) 45 | { 46 | $this->$var =& load_class($class); 47 | } 48 | 49 | $this->load =& load_class('Loader', 'core'); 50 | 51 | $this->load->_base_classes =& is_loaded(); 52 | 53 | $this->load->_ci_autoloader(); 54 | 55 | log_message('debug', "Controller Class Initialized"); 56 | 57 | } 58 | 59 | public static function &get_instance() 60 | { 61 | return self::$instance; 62 | } 63 | } 64 | // END Controller class 65 | 66 | /* End of file Controller.php */ 67 | /* Location: ./system/core/Controller.php */ -------------------------------------------------------------------------------- /system/core/Exceptions.php: -------------------------------------------------------------------------------- 1 | 'Error', 37 | E_WARNING => 'Warning', 38 | E_PARSE => 'Parsing Error', 39 | E_NOTICE => 'Notice', 40 | E_CORE_ERROR => 'Core Error', 41 | E_CORE_WARNING => 'Core Warning', 42 | E_COMPILE_ERROR => 'Compile Error', 43 | E_COMPILE_WARNING => 'Compile Warning', 44 | E_USER_ERROR => 'User Error', 45 | E_USER_WARNING => 'User Warning', 46 | E_USER_NOTICE => 'User Notice', 47 | E_STRICT => 'Runtime Notice' 48 | ); 49 | 50 | 51 | /** 52 | * Constructor 53 | */ 54 | public function __construct() 55 | { 56 | $this->ob_level = ob_get_level(); 57 | // Note: Do not log messages from this constructor. 58 | } 59 | 60 | // -------------------------------------------------------------------- 61 | 62 | /** 63 | * Exception Logger 64 | * 65 | * This function logs PHP generated error messages 66 | * 67 | * @access private 68 | * @param string the error severity 69 | * @param string the error string 70 | * @param string the error filepath 71 | * @param string the error line number 72 | * @return string 73 | */ 74 | function log_exception($severity, $message, $filepath, $line) 75 | { 76 | $severity = ( ! isset($this->levels[$severity])) ? $severity : $this->levels[$severity]; 77 | 78 | log_message('error', 'Severity: '.$severity.' --> '.$message. ' '.$filepath.' '.$line, TRUE); 79 | } 80 | 81 | // -------------------------------------------------------------------- 82 | 83 | /** 84 | * 404 Page Not Found Handler 85 | * 86 | * @access private 87 | * @param string 88 | * @return string 89 | */ 90 | function show_404($page = '', $log_error = TRUE) 91 | { 92 | $heading = "404 Page Not Found"; 93 | $message = "The page you requested was not found."; 94 | 95 | // By default we log this, but allow a dev to skip it 96 | if ($log_error) 97 | { 98 | log_message('error', '404 Page Not Found --> '.$page); 99 | } 100 | 101 | echo $this->show_error($heading, $message, 'error_404', 404); 102 | exit; 103 | } 104 | 105 | // -------------------------------------------------------------------- 106 | 107 | /** 108 | * General Error Page 109 | * 110 | * This function takes an error message as input 111 | * (either as a string or an array) and displays 112 | * it using the specified template. 113 | * 114 | * @access private 115 | * @param string the heading 116 | * @param string the message 117 | * @param string the template name 118 | * @return string 119 | */ 120 | function show_error($heading, $message, $template = 'error_general', $status_code = 500) 121 | { 122 | set_status_header($status_code); 123 | 124 | $message = '

'.implode('

', ( ! is_array($message)) ? array($message) : $message).'

'; 125 | 126 | if (ob_get_level() > $this->ob_level + 1) 127 | { 128 | ob_end_flush(); 129 | } 130 | ob_start(); 131 | include(APPPATH.'errors/'.$template.EXT); 132 | $buffer = ob_get_contents(); 133 | ob_end_clean(); 134 | return $buffer; 135 | } 136 | 137 | // -------------------------------------------------------------------- 138 | 139 | /** 140 | * Native PHP error handler 141 | * 142 | * @access private 143 | * @param string the error severity 144 | * @param string the error string 145 | * @param string the error filepath 146 | * @param string the error line number 147 | * @return string 148 | */ 149 | function show_php_error($severity, $message, $filepath, $line) 150 | { 151 | $severity = ( ! isset($this->levels[$severity])) ? $severity : $this->levels[$severity]; 152 | 153 | $filepath = str_replace("\\", "/", $filepath); 154 | 155 | // For safety reasons we do not show the full file path 156 | if (FALSE !== strpos($filepath, '/')) 157 | { 158 | $x = explode('/', $filepath); 159 | $filepath = $x[count($x)-2].'/'.end($x); 160 | } 161 | 162 | if (ob_get_level() > $this->ob_level + 1) 163 | { 164 | ob_end_flush(); 165 | } 166 | ob_start(); 167 | include(APPPATH.'errors/error_php'.EXT); 168 | $buffer = ob_get_contents(); 169 | ob_end_clean(); 170 | echo $buffer; 171 | } 172 | 173 | 174 | } 175 | // END Exceptions Class 176 | 177 | /* End of file Exceptions.php */ 178 | /* Location: ./system/core/Exceptions.php */ -------------------------------------------------------------------------------- /system/core/Hooks.php: -------------------------------------------------------------------------------- 1 | _initialize(); 42 | log_message('debug', "Hooks Class Initialized"); 43 | } 44 | 45 | // -------------------------------------------------------------------- 46 | 47 | /** 48 | * Initialize the Hooks Preferences 49 | * 50 | * @access private 51 | * @return void 52 | */ 53 | function _initialize() 54 | { 55 | $CFG =& load_class('Config', 'core'); 56 | 57 | // If hooks are not enabled in the config file 58 | // there is nothing else to do 59 | 60 | if ($CFG->item('enable_hooks') == FALSE) 61 | { 62 | return; 63 | } 64 | 65 | // Grab the "hooks" definition file. 66 | // If there are no hooks, we're done. 67 | 68 | @include(APPPATH.'config/hooks'.EXT); 69 | 70 | if ( ! isset($hook) OR ! is_array($hook)) 71 | { 72 | return; 73 | } 74 | 75 | $this->hooks =& $hook; 76 | $this->enabled = TRUE; 77 | } 78 | 79 | // -------------------------------------------------------------------- 80 | 81 | /** 82 | * Call Hook 83 | * 84 | * Calls a particular hook 85 | * 86 | * @access private 87 | * @param string the hook name 88 | * @return mixed 89 | */ 90 | function _call_hook($which = '') 91 | { 92 | if ( ! $this->enabled OR ! isset($this->hooks[$which])) 93 | { 94 | return FALSE; 95 | } 96 | 97 | if (isset($this->hooks[$which][0]) AND is_array($this->hooks[$which][0])) 98 | { 99 | foreach ($this->hooks[$which] as $val) 100 | { 101 | $this->_run_hook($val); 102 | } 103 | } 104 | else 105 | { 106 | $this->_run_hook($this->hooks[$which]); 107 | } 108 | 109 | return TRUE; 110 | } 111 | 112 | // -------------------------------------------------------------------- 113 | 114 | /** 115 | * Run Hook 116 | * 117 | * Runs a particular hook 118 | * 119 | * @access private 120 | * @param array the hook details 121 | * @return bool 122 | */ 123 | function _run_hook($data) 124 | { 125 | if ( ! is_array($data)) 126 | { 127 | return FALSE; 128 | } 129 | 130 | // ----------------------------------- 131 | // Safety - Prevents run-away loops 132 | // ----------------------------------- 133 | 134 | // If the script being called happens to have the same 135 | // hook call within it a loop can happen 136 | 137 | if ($this->in_progress == TRUE) 138 | { 139 | return; 140 | } 141 | 142 | // ----------------------------------- 143 | // Set file path 144 | // ----------------------------------- 145 | 146 | if ( ! isset($data['filepath']) OR ! isset($data['filename'])) 147 | { 148 | return FALSE; 149 | } 150 | 151 | $filepath = APPPATH.$data['filepath'].'/'.$data['filename']; 152 | 153 | if ( ! file_exists($filepath)) 154 | { 155 | return FALSE; 156 | } 157 | 158 | // ----------------------------------- 159 | // Set class/function name 160 | // ----------------------------------- 161 | 162 | $class = FALSE; 163 | $function = FALSE; 164 | $params = ''; 165 | 166 | if (isset($data['class']) AND $data['class'] != '') 167 | { 168 | $class = $data['class']; 169 | } 170 | 171 | if (isset($data['function'])) 172 | { 173 | $function = $data['function']; 174 | } 175 | 176 | if (isset($data['params'])) 177 | { 178 | $params = $data['params']; 179 | } 180 | 181 | if ($class === FALSE AND $function === FALSE) 182 | { 183 | return FALSE; 184 | } 185 | 186 | // ----------------------------------- 187 | // Set the in_progress flag 188 | // ----------------------------------- 189 | 190 | $this->in_progress = TRUE; 191 | 192 | // ----------------------------------- 193 | // Call the requested class and/or function 194 | // ----------------------------------- 195 | 196 | if ($class !== FALSE) 197 | { 198 | if ( ! class_exists($class)) 199 | { 200 | require($filepath); 201 | } 202 | 203 | $HOOK = new $class; 204 | $HOOK->$function($params); 205 | } 206 | else 207 | { 208 | if ( ! function_exists($function)) 209 | { 210 | require($filepath); 211 | } 212 | 213 | $function($params); 214 | } 215 | 216 | $this->in_progress = FALSE; 217 | return TRUE; 218 | } 219 | 220 | } 221 | 222 | // END CI_Hooks class 223 | 224 | /* End of file Hooks.php */ 225 | /* Location: ./system/core/Hooks.php */ -------------------------------------------------------------------------------- /system/core/Lang.php: -------------------------------------------------------------------------------- 1 | is_loaded, TRUE)) 64 | { 65 | return; 66 | } 67 | 68 | $config =& get_config(); 69 | 70 | if ($idiom == '') 71 | { 72 | $deft_lang = ( ! isset($config['language'])) ? 'english' : $config['language']; 73 | $idiom = ($deft_lang == '') ? 'english' : $deft_lang; 74 | } 75 | 76 | // Determine where the language file is and load it 77 | if ($alt_path != '' && file_exists($alt_path.'language/'.$idiom.'/'.$langfile)) 78 | { 79 | include($alt_path.'language/'.$idiom.'/'.$langfile); 80 | } 81 | else 82 | { 83 | $found = FALSE; 84 | 85 | foreach (get_instance()->load->get_package_paths(TRUE) as $package_path) 86 | { 87 | if (file_exists($package_path.'language/'.$idiom.'/'.$langfile)) 88 | { 89 | include($package_path.'language/'.$idiom.'/'.$langfile); 90 | $found = TRUE; 91 | break; 92 | } 93 | } 94 | 95 | if ($found !== TRUE) 96 | { 97 | show_error('Unable to load the requested language file: language/'.$idiom.'/'.$langfile); 98 | } 99 | } 100 | 101 | 102 | if ( ! isset($lang)) 103 | { 104 | log_message('error', 'Language file contains no data: language/'.$idiom.'/'.$langfile); 105 | return; 106 | } 107 | 108 | if ($return == TRUE) 109 | { 110 | return $lang; 111 | } 112 | 113 | $this->is_loaded[] = $langfile; 114 | $this->language = array_merge($this->language, $lang); 115 | unset($lang); 116 | 117 | log_message('debug', 'Language file loaded: language/'.$idiom.'/'.$langfile); 118 | return TRUE; 119 | } 120 | 121 | // -------------------------------------------------------------------- 122 | 123 | /** 124 | * Fetch a single line of text from the language array 125 | * 126 | * @access public 127 | * @param string $line the language line 128 | * @return string 129 | */ 130 | function line($line = '') 131 | { 132 | $line = ($line == '' OR ! isset($this->language[$line])) ? FALSE : $this->language[$line]; 133 | return $line; 134 | } 135 | 136 | } 137 | // END Language Class 138 | 139 | /* End of file Lang.php */ 140 | /* Location: ./system/core/Lang.php */ -------------------------------------------------------------------------------- /system/core/Model.php: -------------------------------------------------------------------------------- 1 | $key; 51 | } 52 | } 53 | // END Model Class 54 | 55 | /* End of file Model.php */ 56 | /* Location: ./system/core/Model.php */ -------------------------------------------------------------------------------- /system/core/Utf8.php: -------------------------------------------------------------------------------- 1 | item('charset') == 'UTF-8' // Application charset must be UTF-8 48 | ) 49 | { 50 | log_message('debug', "UTF-8 Support Enabled"); 51 | 52 | define('UTF8_ENABLED', TRUE); 53 | 54 | // set internal encoding for multibyte string functions if necessary 55 | // and set a flag so we don't have to repeatedly use extension_loaded() 56 | // or function_exists() 57 | if (extension_loaded('mbstring')) 58 | { 59 | define('MB_ENABLED', TRUE); 60 | mb_internal_encoding('UTF-8'); 61 | } 62 | else 63 | { 64 | define('MB_ENABLED', FALSE); 65 | } 66 | } 67 | else 68 | { 69 | log_message('debug', "UTF-8 Support Disabled"); 70 | define('UTF8_ENABLED', FALSE); 71 | } 72 | } 73 | 74 | // -------------------------------------------------------------------- 75 | 76 | /** 77 | * Clean UTF-8 strings 78 | * 79 | * Ensures strings are UTF-8 80 | * 81 | * @access public 82 | * @param string 83 | * @return string 84 | */ 85 | function clean_string($str) 86 | { 87 | if ($this->_is_ascii($str) === FALSE) 88 | { 89 | $str = @iconv('UTF-8', 'UTF-8//IGNORE', $str); 90 | } 91 | 92 | return $str; 93 | } 94 | 95 | // -------------------------------------------------------------------- 96 | 97 | /** 98 | * Remove ASCII control characters 99 | * 100 | * Removes all ASCII control characters except horizontal tabs, 101 | * line feeds, and carriage returns, as all others can cause 102 | * problems in XML 103 | * 104 | * @access public 105 | * @param string 106 | * @return string 107 | */ 108 | function safe_ascii_for_xml($str) 109 | { 110 | return preg_replace('/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]+/S', '', $str); 111 | } 112 | 113 | // -------------------------------------------------------------------- 114 | 115 | /** 116 | * Convert to UTF-8 117 | * 118 | * Attempts to convert a string to UTF-8 119 | * 120 | * @access public 121 | * @param string 122 | * @param string - input encoding 123 | * @return string 124 | */ 125 | function convert_to_utf8($str, $encoding) 126 | { 127 | if (function_exists('iconv')) 128 | { 129 | $str = @iconv($encoding, 'UTF-8', $str); 130 | } 131 | elseif (function_exists('mb_convert_encoding')) 132 | { 133 | $str = @mb_convert_encoding($str, 'UTF-8', $encoding); 134 | } 135 | else 136 | { 137 | return FALSE; 138 | } 139 | 140 | return $str; 141 | } 142 | 143 | // -------------------------------------------------------------------- 144 | 145 | /** 146 | * Is ASCII? 147 | * 148 | * Tests if a string is standard 7-bit ASCII or not 149 | * 150 | * @access public 151 | * @param string 152 | * @return bool 153 | */ 154 | function _is_ascii($str) 155 | { 156 | return (preg_match('/[^\x00-\x7F]/S', $str) == 0); 157 | } 158 | 159 | // -------------------------------------------------------------------- 160 | 161 | } 162 | // End Utf8 Class 163 | 164 | /* End of file Utf8.php */ 165 | /* Location: ./system/core/Utf8.php */ -------------------------------------------------------------------------------- /system/core/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 403 Forbidden 4 | 5 | 6 | 7 |

Directory access is forbidden.

8 | 9 | 10 | -------------------------------------------------------------------------------- /system/database/DB.php: -------------------------------------------------------------------------------- 1 | $dns['scheme'], 80 | 'hostname' => (isset($dns['host'])) ? rawurldecode($dns['host']) : '', 81 | 'username' => (isset($dns['user'])) ? rawurldecode($dns['user']) : '', 82 | 'password' => (isset($dns['pass'])) ? rawurldecode($dns['pass']) : '', 83 | 'database' => (isset($dns['path'])) ? rawurldecode(substr($dns['path'], 1)) : '' 84 | ); 85 | 86 | // were additional config items set? 87 | if (isset($dns['query'])) 88 | { 89 | parse_str($dns['query'], $extra); 90 | 91 | foreach ($extra as $key => $val) 92 | { 93 | // booleans please 94 | if (strtoupper($val) == "TRUE") 95 | { 96 | $val = TRUE; 97 | } 98 | elseif (strtoupper($val) == "FALSE") 99 | { 100 | $val = FALSE; 101 | } 102 | 103 | $params[$key] = $val; 104 | } 105 | } 106 | } 107 | 108 | // No DB specified yet? Beat them senseless... 109 | if ( ! isset($params['dbdriver']) OR $params['dbdriver'] == '') 110 | { 111 | show_error('You have not selected a database type to connect to.'); 112 | } 113 | 114 | // Load the DB classes. Note: Since the active record class is optional 115 | // we need to dynamically create a class that extends proper parent class 116 | // based on whether we're using the active record class or not. 117 | // Kudos to Paul for discovering this clever use of eval() 118 | 119 | if ($active_record_override !== NULL) 120 | { 121 | $active_record = $active_record_override; 122 | } 123 | 124 | require_once(BASEPATH.'database/DB_driver'.EXT); 125 | 126 | if ( ! isset($active_record) OR $active_record == TRUE) 127 | { 128 | require_once(BASEPATH.'database/DB_active_rec'.EXT); 129 | 130 | if ( ! class_exists('CI_DB')) 131 | { 132 | eval('class CI_DB extends CI_DB_active_record { }'); 133 | } 134 | } 135 | else 136 | { 137 | if ( ! class_exists('CI_DB')) 138 | { 139 | eval('class CI_DB extends CI_DB_driver { }'); 140 | } 141 | } 142 | 143 | require_once(BASEPATH.'database/drivers/'.$params['dbdriver'].'/'.$params['dbdriver'].'_driver'.EXT); 144 | 145 | // Instantiate the DB adapter 146 | $driver = 'CI_DB_'.$params['dbdriver'].'_driver'; 147 | $DB = new $driver($params); 148 | 149 | if ($DB->autoinit == TRUE) 150 | { 151 | $DB->initialize(); 152 | } 153 | 154 | if (isset($params['stricton']) && $params['stricton'] == TRUE) 155 | { 156 | $DB->query('SET SESSION sql_mode="STRICT_ALL_TABLES"'); 157 | } 158 | 159 | return $DB; 160 | } 161 | 162 | 163 | 164 | /* End of file DB.php */ 165 | /* Location: ./system/database/DB.php */ -------------------------------------------------------------------------------- /system/database/DB_cache.php: -------------------------------------------------------------------------------- 1 | CI 39 | // and load the file helper since we use it a lot 40 | $this->CI =& get_instance(); 41 | $this->db =& $db; 42 | $this->CI->load->helper('file'); 43 | } 44 | 45 | // -------------------------------------------------------------------- 46 | 47 | /** 48 | * Set Cache Directory Path 49 | * 50 | * @access public 51 | * @param string the path to the cache directory 52 | * @return bool 53 | */ 54 | function check_path($path = '') 55 | { 56 | if ($path == '') 57 | { 58 | if ($this->db->cachedir == '') 59 | { 60 | return $this->db->cache_off(); 61 | } 62 | 63 | $path = $this->db->cachedir; 64 | } 65 | 66 | // Add a trailing slash to the path if needed 67 | $path = preg_replace("/(.+?)\/*$/", "\\1/", $path); 68 | 69 | if ( ! is_dir($path) OR ! is_really_writable($path)) 70 | { 71 | // If the path is wrong we'll turn off caching 72 | return $this->db->cache_off(); 73 | } 74 | 75 | $this->db->cachedir = $path; 76 | return TRUE; 77 | } 78 | 79 | // -------------------------------------------------------------------- 80 | 81 | /** 82 | * Retrieve a cached query 83 | * 84 | * The URI being requested will become the name of the cache sub-folder. 85 | * An MD5 hash of the SQL statement will become the cache file name 86 | * 87 | * @access public 88 | * @return string 89 | */ 90 | function read($sql) 91 | { 92 | if ( ! $this->check_path()) 93 | { 94 | return $this->db->cache_off(); 95 | } 96 | 97 | $segment_one = ($this->CI->uri->segment(1) == FALSE) ? 'default' : $this->CI->uri->segment(1); 98 | 99 | $segment_two = ($this->CI->uri->segment(2) == FALSE) ? 'index' : $this->CI->uri->segment(2); 100 | 101 | $filepath = $this->db->cachedir.$segment_one.'+'.$segment_two.'/'.md5($sql); 102 | 103 | if (FALSE === ($cachedata = read_file($filepath))) 104 | { 105 | return FALSE; 106 | } 107 | 108 | return unserialize($cachedata); 109 | } 110 | 111 | // -------------------------------------------------------------------- 112 | 113 | /** 114 | * Write a query to a cache file 115 | * 116 | * @access public 117 | * @return bool 118 | */ 119 | function write($sql, $object) 120 | { 121 | if ( ! $this->check_path()) 122 | { 123 | return $this->db->cache_off(); 124 | } 125 | 126 | $segment_one = ($this->CI->uri->segment(1) == FALSE) ? 'default' : $this->CI->uri->segment(1); 127 | 128 | $segment_two = ($this->CI->uri->segment(2) == FALSE) ? 'index' : $this->CI->uri->segment(2); 129 | 130 | $dir_path = $this->db->cachedir.$segment_one.'+'.$segment_two.'/'; 131 | 132 | $filename = md5($sql); 133 | 134 | if ( ! @is_dir($dir_path)) 135 | { 136 | if ( ! @mkdir($dir_path, DIR_WRITE_MODE)) 137 | { 138 | return FALSE; 139 | } 140 | 141 | @chmod($dir_path, DIR_WRITE_MODE); 142 | } 143 | 144 | if (write_file($dir_path.$filename, serialize($object)) === FALSE) 145 | { 146 | return FALSE; 147 | } 148 | 149 | @chmod($dir_path.$filename, FILE_WRITE_MODE); 150 | return TRUE; 151 | } 152 | 153 | // -------------------------------------------------------------------- 154 | 155 | /** 156 | * Delete cache files within a particular directory 157 | * 158 | * @access public 159 | * @return bool 160 | */ 161 | function delete($segment_one = '', $segment_two = '') 162 | { 163 | if ($segment_one == '') 164 | { 165 | $segment_one = ($this->CI->uri->segment(1) == FALSE) ? 'default' : $this->CI->uri->segment(1); 166 | } 167 | 168 | if ($segment_two == '') 169 | { 170 | $segment_two = ($this->CI->uri->segment(2) == FALSE) ? 'index' : $this->CI->uri->segment(2); 171 | } 172 | 173 | $dir_path = $this->db->cachedir.$segment_one.'+'.$segment_two.'/'; 174 | 175 | delete_files($dir_path, TRUE); 176 | } 177 | 178 | // -------------------------------------------------------------------- 179 | 180 | /** 181 | * Delete all existing cache files 182 | * 183 | * @access public 184 | * @return bool 185 | */ 186 | function delete_all() 187 | { 188 | delete_files($this->db->cachedir, TRUE); 189 | } 190 | 191 | } 192 | 193 | 194 | /* End of file DB_cache.php */ 195 | /* Location: ./system/database/DB_cache.php */ -------------------------------------------------------------------------------- /system/database/drivers/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 403 Forbidden 4 | 5 | 6 | 7 |

Directory access is forbidden.

8 | 9 | 10 | -------------------------------------------------------------------------------- /system/database/drivers/mssql/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 403 Forbidden 4 | 5 | 6 | 7 |

Directory access is forbidden.

8 | 9 | 10 | -------------------------------------------------------------------------------- /system/database/drivers/mssql/mssql_result.php: -------------------------------------------------------------------------------- 1 | result_id); 38 | } 39 | 40 | // -------------------------------------------------------------------- 41 | 42 | /** 43 | * Number of fields in the result set 44 | * 45 | * @access public 46 | * @return integer 47 | */ 48 | function num_fields() 49 | { 50 | return @mssql_num_fields($this->result_id); 51 | } 52 | 53 | // -------------------------------------------------------------------- 54 | 55 | /** 56 | * Fetch Field Names 57 | * 58 | * Generates an array of column names 59 | * 60 | * @access public 61 | * @return array 62 | */ 63 | function list_fields() 64 | { 65 | $field_names = array(); 66 | while ($field = mssql_fetch_field($this->result_id)) 67 | { 68 | $field_names[] = $field->name; 69 | } 70 | 71 | return $field_names; 72 | } 73 | 74 | // -------------------------------------------------------------------- 75 | 76 | /** 77 | * Field data 78 | * 79 | * Generates an array of objects containing field meta-data 80 | * 81 | * @access public 82 | * @return array 83 | */ 84 | function field_data() 85 | { 86 | $retval = array(); 87 | while ($field = mssql_fetch_field($this->result_id)) 88 | { 89 | $F = new stdClass(); 90 | $F->name = $field->name; 91 | $F->type = $field->type; 92 | $F->max_length = $field->max_length; 93 | $F->primary_key = 0; 94 | $F->default = ''; 95 | 96 | $retval[] = $F; 97 | } 98 | 99 | return $retval; 100 | } 101 | 102 | // -------------------------------------------------------------------- 103 | 104 | /** 105 | * Free the result 106 | * 107 | * @return null 108 | */ 109 | function free_result() 110 | { 111 | if (is_resource($this->result_id)) 112 | { 113 | mssql_free_result($this->result_id); 114 | $this->result_id = FALSE; 115 | } 116 | } 117 | 118 | // -------------------------------------------------------------------- 119 | 120 | /** 121 | * Data Seek 122 | * 123 | * Moves the internal pointer to the desired offset. We call 124 | * this internally before fetching results to make sure the 125 | * result set starts at zero 126 | * 127 | * @access private 128 | * @return array 129 | */ 130 | function _data_seek($n = 0) 131 | { 132 | return mssql_data_seek($this->result_id, $n); 133 | } 134 | 135 | // -------------------------------------------------------------------- 136 | 137 | /** 138 | * Result - associative array 139 | * 140 | * Returns the result set as an array 141 | * 142 | * @access private 143 | * @return array 144 | */ 145 | function _fetch_assoc() 146 | { 147 | return mssql_fetch_assoc($this->result_id); 148 | } 149 | 150 | // -------------------------------------------------------------------- 151 | 152 | /** 153 | * Result - object 154 | * 155 | * Returns the result set as an object 156 | * 157 | * @access private 158 | * @return object 159 | */ 160 | function _fetch_object() 161 | { 162 | return mssql_fetch_object($this->result_id); 163 | } 164 | 165 | } 166 | 167 | 168 | /* End of file mssql_result.php */ 169 | /* Location: ./system/database/drivers/mssql/mssql_result.php */ -------------------------------------------------------------------------------- /system/database/drivers/mssql/mssql_utility.php: -------------------------------------------------------------------------------- 1 | db->display_error('db_unsuported_feature'); 83 | } 84 | 85 | } 86 | 87 | /* End of file mssql_utility.php */ 88 | /* Location: ./system/database/drivers/mssql/mssql_utility.php */ -------------------------------------------------------------------------------- /system/database/drivers/mysql/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 403 Forbidden 4 | 5 | 6 | 7 |

Directory access is forbidden.

8 | 9 | 10 | -------------------------------------------------------------------------------- /system/database/drivers/mysql/mysql_result.php: -------------------------------------------------------------------------------- 1 | result_id); 38 | } 39 | 40 | // -------------------------------------------------------------------- 41 | 42 | /** 43 | * Number of fields in the result set 44 | * 45 | * @access public 46 | * @return integer 47 | */ 48 | function num_fields() 49 | { 50 | return @mysql_num_fields($this->result_id); 51 | } 52 | 53 | // -------------------------------------------------------------------- 54 | 55 | /** 56 | * Fetch Field Names 57 | * 58 | * Generates an array of column names 59 | * 60 | * @access public 61 | * @return array 62 | */ 63 | function list_fields() 64 | { 65 | $field_names = array(); 66 | while ($field = mysql_fetch_field($this->result_id)) 67 | { 68 | $field_names[] = $field->name; 69 | } 70 | 71 | return $field_names; 72 | } 73 | 74 | // -------------------------------------------------------------------- 75 | 76 | /** 77 | * Field data 78 | * 79 | * Generates an array of objects containing field meta-data 80 | * 81 | * @access public 82 | * @return array 83 | */ 84 | function field_data() 85 | { 86 | $retval = array(); 87 | while ($field = mysql_fetch_field($this->result_id)) 88 | { 89 | $F = new stdClass(); 90 | $F->name = $field->name; 91 | $F->type = $field->type; 92 | $F->default = $field->def; 93 | $F->max_length = $field->max_length; 94 | $F->primary_key = $field->primary_key; 95 | 96 | $retval[] = $F; 97 | } 98 | 99 | return $retval; 100 | } 101 | 102 | // -------------------------------------------------------------------- 103 | 104 | /** 105 | * Free the result 106 | * 107 | * @return null 108 | */ 109 | function free_result() 110 | { 111 | if (is_resource($this->result_id)) 112 | { 113 | mysql_free_result($this->result_id); 114 | $this->result_id = FALSE; 115 | } 116 | } 117 | 118 | // -------------------------------------------------------------------- 119 | 120 | /** 121 | * Data Seek 122 | * 123 | * Moves the internal pointer to the desired offset. We call 124 | * this internally before fetching results to make sure the 125 | * result set starts at zero 126 | * 127 | * @access private 128 | * @return array 129 | */ 130 | function _data_seek($n = 0) 131 | { 132 | return mysql_data_seek($this->result_id, $n); 133 | } 134 | 135 | // -------------------------------------------------------------------- 136 | 137 | /** 138 | * Result - associative array 139 | * 140 | * Returns the result set as an array 141 | * 142 | * @access private 143 | * @return array 144 | */ 145 | function _fetch_assoc() 146 | { 147 | return mysql_fetch_assoc($this->result_id); 148 | } 149 | 150 | // -------------------------------------------------------------------- 151 | 152 | /** 153 | * Result - object 154 | * 155 | * Returns the result set as an object 156 | * 157 | * @access private 158 | * @return object 159 | */ 160 | function _fetch_object() 161 | { 162 | return mysql_fetch_object($this->result_id); 163 | } 164 | 165 | } 166 | 167 | 168 | /* End of file mysql_result.php */ 169 | /* Location: ./system/database/drivers/mysql/mysql_result.php */ -------------------------------------------------------------------------------- /system/database/drivers/mysql/mysql_utility.php: -------------------------------------------------------------------------------- 1 | db->_escape_identifiers($table); 52 | } 53 | 54 | // -------------------------------------------------------------------- 55 | 56 | /** 57 | * Repair table query 58 | * 59 | * Generates a platform-specific query so that a table can be repaired 60 | * 61 | * @access private 62 | * @param string the table name 63 | * @return object 64 | */ 65 | function _repair_table($table) 66 | { 67 | return "REPAIR TABLE ".$this->db->_escape_identifiers($table); 68 | } 69 | 70 | // -------------------------------------------------------------------- 71 | /** 72 | * MySQL Export 73 | * 74 | * @access private 75 | * @param array Preferences 76 | * @return mixed 77 | */ 78 | function _backup($params = array()) 79 | { 80 | if (count($params) == 0) 81 | { 82 | return FALSE; 83 | } 84 | 85 | // Extract the prefs for simplicity 86 | extract($params); 87 | 88 | // Build the output 89 | $output = ''; 90 | foreach ((array)$tables as $table) 91 | { 92 | // Is the table in the "ignore" list? 93 | if (in_array($table, (array)$ignore, TRUE)) 94 | { 95 | continue; 96 | } 97 | 98 | // Get the table schema 99 | $query = $this->db->query("SHOW CREATE TABLE `".$this->db->database.'`.'.$table); 100 | 101 | // No result means the table name was invalid 102 | if ($query === FALSE) 103 | { 104 | continue; 105 | } 106 | 107 | // Write out the table schema 108 | $output .= '#'.$newline.'# TABLE STRUCTURE FOR: '.$table.$newline.'#'.$newline.$newline; 109 | 110 | if ($add_drop == TRUE) 111 | { 112 | $output .= 'DROP TABLE IF EXISTS '.$table.';'.$newline.$newline; 113 | } 114 | 115 | $i = 0; 116 | $result = $query->result_array(); 117 | foreach ($result[0] as $val) 118 | { 119 | if ($i++ % 2) 120 | { 121 | $output .= $val.';'.$newline.$newline; 122 | } 123 | } 124 | 125 | // If inserts are not needed we're done... 126 | if ($add_insert == FALSE) 127 | { 128 | continue; 129 | } 130 | 131 | // Grab all the data from the current table 132 | $query = $this->db->query("SELECT * FROM $table"); 133 | 134 | if ($query->num_rows() == 0) 135 | { 136 | continue; 137 | } 138 | 139 | // Fetch the field names and determine if the field is an 140 | // integer type. We use this info to decide whether to 141 | // surround the data with quotes or not 142 | 143 | $i = 0; 144 | $field_str = ''; 145 | $is_int = array(); 146 | while ($field = mysql_fetch_field($query->result_id)) 147 | { 148 | // Most versions of MySQL store timestamp as a string 149 | $is_int[$i] = (in_array( 150 | strtolower(mysql_field_type($query->result_id, $i)), 151 | array('tinyint', 'smallint', 'mediumint', 'int', 'bigint'), //, 'timestamp'), 152 | TRUE) 153 | ) ? TRUE : FALSE; 154 | 155 | // Create a string of field names 156 | $field_str .= '`'.$field->name.'`, '; 157 | $i++; 158 | } 159 | 160 | // Trim off the end comma 161 | $field_str = preg_replace( "/, $/" , "" , $field_str); 162 | 163 | 164 | // Build the insert string 165 | foreach ($query->result_array() as $row) 166 | { 167 | $val_str = ''; 168 | 169 | $i = 0; 170 | foreach ($row as $v) 171 | { 172 | // Is the value NULL? 173 | if ($v === NULL) 174 | { 175 | $val_str .= 'NULL'; 176 | } 177 | else 178 | { 179 | // Escape the data if it's not an integer 180 | if ($is_int[$i] == FALSE) 181 | { 182 | $val_str .= $this->db->escape($v); 183 | } 184 | else 185 | { 186 | $val_str .= $v; 187 | } 188 | } 189 | 190 | // Append a comma 191 | $val_str .= ', '; 192 | $i++; 193 | } 194 | 195 | // Remove the comma at the end of the string 196 | $val_str = preg_replace( "/, $/" , "" , $val_str); 197 | 198 | // Build the INSERT string 199 | $output .= 'INSERT INTO '.$table.' ('.$field_str.') VALUES ('.$val_str.');'.$newline; 200 | } 201 | 202 | $output .= $newline.$newline; 203 | } 204 | 205 | return $output; 206 | } 207 | } 208 | 209 | /* End of file mysql_utility.php */ 210 | /* Location: ./system/database/drivers/mysql/mysql_utility.php */ -------------------------------------------------------------------------------- /system/database/drivers/mysqli/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 403 Forbidden 4 | 5 | 6 | 7 |

Directory access is forbidden.

8 | 9 | 10 | -------------------------------------------------------------------------------- /system/database/drivers/mysqli/mysqli_result.php: -------------------------------------------------------------------------------- 1 | result_id); 38 | } 39 | 40 | // -------------------------------------------------------------------- 41 | 42 | /** 43 | * Number of fields in the result set 44 | * 45 | * @access public 46 | * @return integer 47 | */ 48 | function num_fields() 49 | { 50 | return @mysqli_num_fields($this->result_id); 51 | } 52 | 53 | // -------------------------------------------------------------------- 54 | 55 | /** 56 | * Fetch Field Names 57 | * 58 | * Generates an array of column names 59 | * 60 | * @access public 61 | * @return array 62 | */ 63 | function list_fields() 64 | { 65 | $field_names = array(); 66 | while ($field = mysqli_fetch_field($this->result_id)) 67 | { 68 | $field_names[] = $field->name; 69 | } 70 | 71 | return $field_names; 72 | } 73 | 74 | // -------------------------------------------------------------------- 75 | 76 | /** 77 | * Field data 78 | * 79 | * Generates an array of objects containing field meta-data 80 | * 81 | * @access public 82 | * @return array 83 | */ 84 | function field_data() 85 | { 86 | $retval = array(); 87 | while ($field = mysqli_fetch_field($this->result_id)) 88 | { 89 | $F = new stdClass(); 90 | $F->name = $field->name; 91 | $F->type = $field->type; 92 | $F->default = $field->def; 93 | $F->max_length = $field->max_length; 94 | $F->primary_key = ($field->flags & MYSQLI_PRI_KEY_FLAG) ? 1 : 0; 95 | 96 | $retval[] = $F; 97 | } 98 | 99 | return $retval; 100 | } 101 | 102 | // -------------------------------------------------------------------- 103 | 104 | /** 105 | * Free the result 106 | * 107 | * @return null 108 | */ 109 | function free_result() 110 | { 111 | if (is_object($this->result_id)) 112 | { 113 | mysqli_free_result($this->result_id); 114 | $this->result_id = FALSE; 115 | } 116 | } 117 | 118 | // -------------------------------------------------------------------- 119 | 120 | /** 121 | * Data Seek 122 | * 123 | * Moves the internal pointer to the desired offset. We call 124 | * this internally before fetching results to make sure the 125 | * result set starts at zero 126 | * 127 | * @access private 128 | * @return array 129 | */ 130 | function _data_seek($n = 0) 131 | { 132 | return mysqli_data_seek($this->result_id, $n); 133 | } 134 | 135 | // -------------------------------------------------------------------- 136 | 137 | /** 138 | * Result - associative array 139 | * 140 | * Returns the result set as an array 141 | * 142 | * @access private 143 | * @return array 144 | */ 145 | function _fetch_assoc() 146 | { 147 | return mysqli_fetch_assoc($this->result_id); 148 | } 149 | 150 | // -------------------------------------------------------------------- 151 | 152 | /** 153 | * Result - object 154 | * 155 | * Returns the result set as an object 156 | * 157 | * @access private 158 | * @return object 159 | */ 160 | function _fetch_object() 161 | { 162 | return mysqli_fetch_object($this->result_id); 163 | } 164 | 165 | } 166 | 167 | 168 | /* End of file mysqli_result.php */ 169 | /* Location: ./system/database/drivers/mysqli/mysqli_result.php */ -------------------------------------------------------------------------------- /system/database/drivers/mysqli/mysqli_utility.php: -------------------------------------------------------------------------------- 1 | db->_escape_identifiers($table); 52 | } 53 | 54 | // -------------------------------------------------------------------- 55 | 56 | /** 57 | * Repair table query 58 | * 59 | * Generates a platform-specific query so that a table can be repaired 60 | * 61 | * @access private 62 | * @param string the table name 63 | * @return object 64 | */ 65 | function _repair_table($table) 66 | { 67 | return "REPAIR TABLE ".$this->db->_escape_identifiers($table); 68 | } 69 | 70 | // -------------------------------------------------------------------- 71 | 72 | /** 73 | * MySQLi Export 74 | * 75 | * @access private 76 | * @param array Preferences 77 | * @return mixed 78 | */ 79 | function _backup($params = array()) 80 | { 81 | // Currently unsupported 82 | return $this->db->display_error('db_unsuported_feature'); 83 | } 84 | } 85 | 86 | /* End of file mysqli_utility.php */ 87 | /* Location: ./system/database/drivers/mysqli/mysqli_utility.php */ -------------------------------------------------------------------------------- /system/database/drivers/oci8/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 403 Forbidden 4 | 5 | 6 | 7 |

Directory access is forbidden.

8 | 9 | 10 | -------------------------------------------------------------------------------- /system/database/drivers/oci8/oci8_result.php: -------------------------------------------------------------------------------- 1 | result_array()); 46 | @ociexecute($this->stmt_id); 47 | 48 | if ($this->curs_id) 49 | { 50 | @ociexecute($this->curs_id); 51 | } 52 | 53 | return $rowcount; 54 | } 55 | 56 | // -------------------------------------------------------------------- 57 | 58 | /** 59 | * Number of fields in the result set 60 | * 61 | * @access public 62 | * @return integer 63 | */ 64 | function num_fields() 65 | { 66 | $count = @ocinumcols($this->stmt_id); 67 | 68 | // if we used a limit we subtract it 69 | if ($this->limit_used) 70 | { 71 | $count = $count - 1; 72 | } 73 | 74 | return $count; 75 | } 76 | 77 | // -------------------------------------------------------------------- 78 | 79 | /** 80 | * Fetch Field Names 81 | * 82 | * Generates an array of column names 83 | * 84 | * @access public 85 | * @return array 86 | */ 87 | function list_fields() 88 | { 89 | $field_names = array(); 90 | $fieldCount = $this->num_fields(); 91 | for ($c = 1; $c <= $fieldCount; $c++) 92 | { 93 | $field_names[] = ocicolumnname($this->stmt_id, $c); 94 | } 95 | return $field_names; 96 | } 97 | 98 | // -------------------------------------------------------------------- 99 | 100 | /** 101 | * Field data 102 | * 103 | * Generates an array of objects containing field meta-data 104 | * 105 | * @access public 106 | * @return array 107 | */ 108 | function field_data() 109 | { 110 | $retval = array(); 111 | $fieldCount = $this->num_fields(); 112 | for ($c = 1; $c <= $fieldCount; $c++) 113 | { 114 | $F = new stdClass(); 115 | $F->name = ocicolumnname($this->stmt_id, $c); 116 | $F->type = ocicolumntype($this->stmt_id, $c); 117 | $F->max_length = ocicolumnsize($this->stmt_id, $c); 118 | 119 | $retval[] = $F; 120 | } 121 | 122 | return $retval; 123 | } 124 | 125 | // -------------------------------------------------------------------- 126 | 127 | /** 128 | * Free the result 129 | * 130 | * @return null 131 | */ 132 | function free_result() 133 | { 134 | if (is_resource($this->result_id)) 135 | { 136 | ocifreestatement($this->result_id); 137 | $this->result_id = FALSE; 138 | } 139 | } 140 | 141 | // -------------------------------------------------------------------- 142 | 143 | /** 144 | * Result - associative array 145 | * 146 | * Returns the result set as an array 147 | * 148 | * @access private 149 | * @return array 150 | */ 151 | function _fetch_assoc(&$row) 152 | { 153 | $id = ($this->curs_id) ? $this->curs_id : $this->stmt_id; 154 | 155 | return ocifetchinto($id, $row, OCI_ASSOC + OCI_RETURN_NULLS); 156 | } 157 | 158 | // -------------------------------------------------------------------- 159 | 160 | /** 161 | * Result - object 162 | * 163 | * Returns the result set as an object 164 | * 165 | * @access private 166 | * @return object 167 | */ 168 | function _fetch_object() 169 | { 170 | $result = array(); 171 | 172 | // If PHP 5 is being used we can fetch an result object 173 | if (function_exists('oci_fetch_object')) 174 | { 175 | $id = ($this->curs_id) ? $this->curs_id : $this->stmt_id; 176 | 177 | return @oci_fetch_object($id); 178 | } 179 | 180 | // If PHP 4 is being used we have to build our own result 181 | foreach ($this->result_array() as $key => $val) 182 | { 183 | $obj = new stdClass(); 184 | if (is_array($val)) 185 | { 186 | foreach ($val as $k => $v) 187 | { 188 | $obj->$k = $v; 189 | } 190 | } 191 | else 192 | { 193 | $obj->$key = $val; 194 | } 195 | 196 | $result[] = $obj; 197 | } 198 | 199 | return $result; 200 | } 201 | 202 | // -------------------------------------------------------------------- 203 | 204 | /** 205 | * Query result. "array" version. 206 | * 207 | * @access public 208 | * @return array 209 | */ 210 | function result_array() 211 | { 212 | if (count($this->result_array) > 0) 213 | { 214 | return $this->result_array; 215 | } 216 | 217 | // oracle's fetch functions do not return arrays. 218 | // The information is returned in reference parameters 219 | $row = NULL; 220 | while ($this->_fetch_assoc($row)) 221 | { 222 | $this->result_array[] = $row; 223 | } 224 | 225 | return $this->result_array; 226 | } 227 | 228 | // -------------------------------------------------------------------- 229 | 230 | /** 231 | * Data Seek 232 | * 233 | * Moves the internal pointer to the desired offset. We call 234 | * this internally before fetching results to make sure the 235 | * result set starts at zero 236 | * 237 | * @access private 238 | * @return array 239 | */ 240 | function _data_seek($n = 0) 241 | { 242 | return FALSE; // Not needed 243 | } 244 | 245 | } 246 | 247 | 248 | /* End of file oci8_result.php */ 249 | /* Location: ./system/database/drivers/oci8/oci8_result.php */ -------------------------------------------------------------------------------- /system/database/drivers/oci8/oci8_utility.php: -------------------------------------------------------------------------------- 1 | db->display_error('db_unsuported_feature'); 83 | } 84 | } 85 | 86 | /* End of file oci8_utility.php */ 87 | /* Location: ./system/database/drivers/oci8/oci8_utility.php */ -------------------------------------------------------------------------------- /system/database/drivers/odbc/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 403 Forbidden 4 | 5 | 6 | 7 |

Directory access is forbidden.

8 | 9 | 10 | -------------------------------------------------------------------------------- /system/database/drivers/odbc/odbc_result.php: -------------------------------------------------------------------------------- 1 | result_id); 38 | } 39 | 40 | // -------------------------------------------------------------------- 41 | 42 | /** 43 | * Number of fields in the result set 44 | * 45 | * @access public 46 | * @return integer 47 | */ 48 | function num_fields() 49 | { 50 | return @odbc_num_fields($this->result_id); 51 | } 52 | 53 | // -------------------------------------------------------------------- 54 | 55 | /** 56 | * Fetch Field Names 57 | * 58 | * Generates an array of column names 59 | * 60 | * @access public 61 | * @return array 62 | */ 63 | function list_fields() 64 | { 65 | $field_names = array(); 66 | for ($i = 0; $i < $this->num_fields(); $i++) 67 | { 68 | $field_names[] = odbc_field_name($this->result_id, $i); 69 | } 70 | 71 | return $field_names; 72 | } 73 | 74 | // -------------------------------------------------------------------- 75 | 76 | /** 77 | * Field data 78 | * 79 | * Generates an array of objects containing field meta-data 80 | * 81 | * @access public 82 | * @return array 83 | */ 84 | function field_data() 85 | { 86 | $retval = array(); 87 | for ($i = 0; $i < $this->num_fields(); $i++) 88 | { 89 | $F = new stdClass(); 90 | $F->name = odbc_field_name($this->result_id, $i); 91 | $F->type = odbc_field_type($this->result_id, $i); 92 | $F->max_length = odbc_field_len($this->result_id, $i); 93 | $F->primary_key = 0; 94 | $F->default = ''; 95 | 96 | $retval[] = $F; 97 | } 98 | 99 | return $retval; 100 | } 101 | 102 | // -------------------------------------------------------------------- 103 | 104 | /** 105 | * Free the result 106 | * 107 | * @return null 108 | */ 109 | function free_result() 110 | { 111 | if (is_resource($this->result_id)) 112 | { 113 | odbc_free_result($this->result_id); 114 | $this->result_id = FALSE; 115 | } 116 | } 117 | 118 | // -------------------------------------------------------------------- 119 | 120 | /** 121 | * Data Seek 122 | * 123 | * Moves the internal pointer to the desired offset. We call 124 | * this internally before fetching results to make sure the 125 | * result set starts at zero 126 | * 127 | * @access private 128 | * @return array 129 | */ 130 | function _data_seek($n = 0) 131 | { 132 | return FALSE; 133 | } 134 | 135 | // -------------------------------------------------------------------- 136 | 137 | /** 138 | * Result - associative array 139 | * 140 | * Returns the result set as an array 141 | * 142 | * @access private 143 | * @return array 144 | */ 145 | function _fetch_assoc() 146 | { 147 | if (function_exists('odbc_fetch_object')) 148 | { 149 | return odbc_fetch_array($this->result_id); 150 | } 151 | else 152 | { 153 | return $this->_odbc_fetch_array($this->result_id); 154 | } 155 | } 156 | 157 | // -------------------------------------------------------------------- 158 | 159 | /** 160 | * Result - object 161 | * 162 | * Returns the result set as an object 163 | * 164 | * @access private 165 | * @return object 166 | */ 167 | function _fetch_object() 168 | { 169 | if (function_exists('odbc_fetch_object')) 170 | { 171 | return odbc_fetch_object($this->result_id); 172 | } 173 | else 174 | { 175 | return $this->_odbc_fetch_object($this->result_id); 176 | } 177 | } 178 | 179 | 180 | /** 181 | * Result - object 182 | * 183 | * subsititutes the odbc_fetch_object function when 184 | * not available (odbc_fetch_object requires unixODBC) 185 | * 186 | * @access private 187 | * @return object 188 | */ 189 | function _odbc_fetch_object(& $odbc_result) { 190 | $rs = array(); 191 | $rs_obj = FALSE; 192 | if (odbc_fetch_into($odbc_result, $rs)) { 193 | foreach ($rs as $k=>$v) { 194 | $field_name= odbc_field_name($odbc_result, $k+1); 195 | $rs_obj->$field_name = $v; 196 | } 197 | } 198 | return $rs_obj; 199 | } 200 | 201 | 202 | /** 203 | * Result - array 204 | * 205 | * subsititutes the odbc_fetch_array function when 206 | * not available (odbc_fetch_array requires unixODBC) 207 | * 208 | * @access private 209 | * @return array 210 | */ 211 | function _odbc_fetch_array(& $odbc_result) { 212 | $rs = array(); 213 | $rs_assoc = FALSE; 214 | if (odbc_fetch_into($odbc_result, $rs)) { 215 | $rs_assoc=array(); 216 | foreach ($rs as $k=>$v) { 217 | $field_name= odbc_field_name($odbc_result, $k+1); 218 | $rs_assoc[$field_name] = $v; 219 | } 220 | } 221 | return $rs_assoc; 222 | } 223 | 224 | } 225 | 226 | 227 | /* End of file odbc_result.php */ 228 | /* Location: ./system/database/drivers/odbc/odbc_result.php */ -------------------------------------------------------------------------------- /system/database/drivers/odbc/odbc_utility.php: -------------------------------------------------------------------------------- 1 | db->db_debug) 37 | { 38 | return $this->db->display_error('db_unsuported_feature'); 39 | } 40 | return FALSE; 41 | } 42 | 43 | // -------------------------------------------------------------------- 44 | 45 | /** 46 | * Optimize table query 47 | * 48 | * Generates a platform-specific query so that a table can be optimized 49 | * 50 | * @access private 51 | * @param string the table name 52 | * @return object 53 | */ 54 | function _optimize_table($table) 55 | { 56 | // Not a supported ODBC feature 57 | if ($this->db->db_debug) 58 | { 59 | return $this->db->display_error('db_unsuported_feature'); 60 | } 61 | return FALSE; 62 | } 63 | 64 | // -------------------------------------------------------------------- 65 | 66 | /** 67 | * Repair table query 68 | * 69 | * Generates a platform-specific query so that a table can be repaired 70 | * 71 | * @access private 72 | * @param string the table name 73 | * @return object 74 | */ 75 | function _repair_table($table) 76 | { 77 | // Not a supported ODBC feature 78 | if ($this->db->db_debug) 79 | { 80 | return $this->db->display_error('db_unsuported_feature'); 81 | } 82 | return FALSE; 83 | } 84 | 85 | // -------------------------------------------------------------------- 86 | 87 | /** 88 | * ODBC Export 89 | * 90 | * @access private 91 | * @param array Preferences 92 | * @return mixed 93 | */ 94 | function _backup($params = array()) 95 | { 96 | // Currently unsupported 97 | return $this->db->display_error('db_unsuported_feature'); 98 | } 99 | 100 | } 101 | 102 | /* End of file odbc_utility.php */ 103 | /* Location: ./system/database/drivers/odbc/odbc_utility.php */ -------------------------------------------------------------------------------- /system/database/drivers/postgre/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 403 Forbidden 4 | 5 | 6 | 7 |

Directory access is forbidden.

8 | 9 | 10 | -------------------------------------------------------------------------------- /system/database/drivers/postgre/postgre_result.php: -------------------------------------------------------------------------------- 1 | result_id); 38 | } 39 | 40 | // -------------------------------------------------------------------- 41 | 42 | /** 43 | * Number of fields in the result set 44 | * 45 | * @access public 46 | * @return integer 47 | */ 48 | function num_fields() 49 | { 50 | return @pg_num_fields($this->result_id); 51 | } 52 | 53 | // -------------------------------------------------------------------- 54 | 55 | /** 56 | * Fetch Field Names 57 | * 58 | * Generates an array of column names 59 | * 60 | * @access public 61 | * @return array 62 | */ 63 | function list_fields() 64 | { 65 | $field_names = array(); 66 | for ($i = 0; $i < $this->num_fields(); $i++) 67 | { 68 | $field_names[] = pg_field_name($this->result_id, $i); 69 | } 70 | 71 | return $field_names; 72 | } 73 | 74 | // -------------------------------------------------------------------- 75 | 76 | /** 77 | * Field data 78 | * 79 | * Generates an array of objects containing field meta-data 80 | * 81 | * @access public 82 | * @return array 83 | */ 84 | function field_data() 85 | { 86 | $retval = array(); 87 | for ($i = 0; $i < $this->num_fields(); $i++) 88 | { 89 | $F = new stdClass(); 90 | $F->name = pg_field_name($this->result_id, $i); 91 | $F->type = pg_field_type($this->result_id, $i); 92 | $F->max_length = pg_field_size($this->result_id, $i); 93 | $F->primary_key = 0; 94 | $F->default = ''; 95 | 96 | $retval[] = $F; 97 | } 98 | 99 | return $retval; 100 | } 101 | 102 | // -------------------------------------------------------------------- 103 | 104 | /** 105 | * Free the result 106 | * 107 | * @return null 108 | */ 109 | function free_result() 110 | { 111 | if (is_resource($this->result_id)) 112 | { 113 | pg_free_result($this->result_id); 114 | $this->result_id = FALSE; 115 | } 116 | } 117 | 118 | // -------------------------------------------------------------------- 119 | 120 | /** 121 | * Data Seek 122 | * 123 | * Moves the internal pointer to the desired offset. We call 124 | * this internally before fetching results to make sure the 125 | * result set starts at zero 126 | * 127 | * @access private 128 | * @return array 129 | */ 130 | function _data_seek($n = 0) 131 | { 132 | return pg_result_seek($this->result_id, $n); 133 | } 134 | 135 | // -------------------------------------------------------------------- 136 | 137 | /** 138 | * Result - associative array 139 | * 140 | * Returns the result set as an array 141 | * 142 | * @access private 143 | * @return array 144 | */ 145 | function _fetch_assoc() 146 | { 147 | return pg_fetch_assoc($this->result_id); 148 | } 149 | 150 | // -------------------------------------------------------------------- 151 | 152 | /** 153 | * Result - object 154 | * 155 | * Returns the result set as an object 156 | * 157 | * @access private 158 | * @return object 159 | */ 160 | function _fetch_object() 161 | { 162 | return pg_fetch_object($this->result_id); 163 | } 164 | 165 | } 166 | 167 | 168 | /* End of file postgre_result.php */ 169 | /* Location: ./system/database/drivers/postgre/postgre_result.php */ -------------------------------------------------------------------------------- /system/database/drivers/postgre/postgre_utility.php: -------------------------------------------------------------------------------- 1 | db->display_error('db_unsuported_feature'); 83 | } 84 | } 85 | 86 | 87 | /* End of file postgre_utility.php */ 88 | /* Location: ./system/database/drivers/postgre/postgre_utility.php */ -------------------------------------------------------------------------------- /system/database/drivers/sqlite/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 403 Forbidden 4 | 5 | 6 | 7 |

Directory access is forbidden.

8 | 9 | 10 | -------------------------------------------------------------------------------- /system/database/drivers/sqlite/sqlite_result.php: -------------------------------------------------------------------------------- 1 | result_id); 38 | } 39 | 40 | // -------------------------------------------------------------------- 41 | 42 | /** 43 | * Number of fields in the result set 44 | * 45 | * @access public 46 | * @return integer 47 | */ 48 | function num_fields() 49 | { 50 | return @sqlite_num_fields($this->result_id); 51 | } 52 | 53 | // -------------------------------------------------------------------- 54 | 55 | /** 56 | * Fetch Field Names 57 | * 58 | * Generates an array of column names 59 | * 60 | * @access public 61 | * @return array 62 | */ 63 | function list_fields() 64 | { 65 | $field_names = array(); 66 | for ($i = 0; $i < $this->num_fields(); $i++) 67 | { 68 | $field_names[] = sqlite_field_name($this->result_id, $i); 69 | } 70 | 71 | return $field_names; 72 | } 73 | 74 | // -------------------------------------------------------------------- 75 | 76 | /** 77 | * Field data 78 | * 79 | * Generates an array of objects containing field meta-data 80 | * 81 | * @access public 82 | * @return array 83 | */ 84 | function field_data() 85 | { 86 | $retval = array(); 87 | for ($i = 0; $i < $this->num_fields(); $i++) 88 | { 89 | $F = new stdClass(); 90 | $F->name = sqlite_field_name($this->result_id, $i); 91 | $F->type = 'varchar'; 92 | $F->max_length = 0; 93 | $F->primary_key = 0; 94 | $F->default = ''; 95 | 96 | $retval[] = $F; 97 | } 98 | 99 | return $retval; 100 | } 101 | 102 | // -------------------------------------------------------------------- 103 | 104 | /** 105 | * Free the result 106 | * 107 | * @return null 108 | */ 109 | function free_result() 110 | { 111 | // Not implemented in SQLite 112 | } 113 | 114 | // -------------------------------------------------------------------- 115 | 116 | /** 117 | * Data Seek 118 | * 119 | * Moves the internal pointer to the desired offset. We call 120 | * this internally before fetching results to make sure the 121 | * result set starts at zero 122 | * 123 | * @access private 124 | * @return array 125 | */ 126 | function _data_seek($n = 0) 127 | { 128 | return sqlite_seek($this->result_id, $n); 129 | } 130 | 131 | // -------------------------------------------------------------------- 132 | 133 | /** 134 | * Result - associative array 135 | * 136 | * Returns the result set as an array 137 | * 138 | * @access private 139 | * @return array 140 | */ 141 | function _fetch_assoc() 142 | { 143 | return sqlite_fetch_array($this->result_id); 144 | } 145 | 146 | // -------------------------------------------------------------------- 147 | 148 | /** 149 | * Result - object 150 | * 151 | * Returns the result set as an object 152 | * 153 | * @access private 154 | * @return object 155 | */ 156 | function _fetch_object() 157 | { 158 | if (function_exists('sqlite_fetch_object')) 159 | { 160 | return sqlite_fetch_object($this->result_id); 161 | } 162 | else 163 | { 164 | $arr = sqlite_fetch_array($this->result_id, SQLITE_ASSOC); 165 | if (is_array($arr)) 166 | { 167 | $obj = (object) $arr; 168 | return $obj; 169 | } else { 170 | return NULL; 171 | } 172 | } 173 | } 174 | 175 | } 176 | 177 | 178 | /* End of file sqlite_result.php */ 179 | /* Location: ./system/database/drivers/sqlite/sqlite_result.php */ -------------------------------------------------------------------------------- /system/database/drivers/sqlite/sqlite_utility.php: -------------------------------------------------------------------------------- 1 | db_debug) 41 | { 42 | return $this->db->display_error('db_unsuported_feature'); 43 | } 44 | return array(); 45 | } 46 | 47 | // -------------------------------------------------------------------- 48 | 49 | /** 50 | * Optimize table query 51 | * 52 | * Is optimization even supported in SQLite? 53 | * 54 | * @access private 55 | * @param string the table name 56 | * @return object 57 | */ 58 | function _optimize_table($table) 59 | { 60 | return FALSE; 61 | } 62 | 63 | // -------------------------------------------------------------------- 64 | 65 | /** 66 | * Repair table query 67 | * 68 | * Are table repairs even supported in SQLite? 69 | * 70 | * @access private 71 | * @param string the table name 72 | * @return object 73 | */ 74 | function _repair_table($table) 75 | { 76 | return FALSE; 77 | } 78 | 79 | // -------------------------------------------------------------------- 80 | 81 | /** 82 | * SQLite Export 83 | * 84 | * @access private 85 | * @param array Preferences 86 | * @return mixed 87 | */ 88 | function _backup($params = array()) 89 | { 90 | // Currently unsupported 91 | return $this->db->display_error('db_unsuported_feature'); 92 | } 93 | } 94 | 95 | /* End of file sqlite_utility.php */ 96 | /* Location: ./system/database/drivers/sqlite/sqlite_utility.php */ -------------------------------------------------------------------------------- /system/database/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 403 Forbidden 4 | 5 | 6 | 7 |

Directory access is forbidden.

8 | 9 | 10 | -------------------------------------------------------------------------------- /system/fonts/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 403 Forbidden 4 | 5 | 6 | 7 |

Directory access is forbidden.

8 | 9 | 10 | -------------------------------------------------------------------------------- /system/helpers/array_helper.php: -------------------------------------------------------------------------------- 1 | input->set_cookie($name, $value, $expire, $domain, $path, $prefix, $secure); 52 | } 53 | } 54 | 55 | // -------------------------------------------------------------------- 56 | 57 | /** 58 | * Fetch an item from the COOKIE array 59 | * 60 | * @access public 61 | * @param string 62 | * @param bool 63 | * @return mixed 64 | */ 65 | if ( ! function_exists('get_cookie')) 66 | { 67 | function get_cookie($index = '', $xss_clean = FALSE) 68 | { 69 | $CI =& get_instance(); 70 | 71 | $prefix = ''; 72 | 73 | if ( ! isset($_COOKIE[$index]) && config_item('cookie_prefix') != '') 74 | { 75 | $prefix = config_item('cookie_prefix'); 76 | } 77 | 78 | return $CI->input->cookie($prefix.$index, $xss_clean); 79 | } 80 | } 81 | 82 | // -------------------------------------------------------------------- 83 | 84 | /** 85 | * Delete a COOKIE 86 | * 87 | * @param mixed 88 | * @param string the cookie domain. Usually: .yourdomain.com 89 | * @param string the cookie path 90 | * @param string the cookie prefix 91 | * @return void 92 | */ 93 | if ( ! function_exists('delete_cookie')) 94 | { 95 | function delete_cookie($name = '', $domain = '', $path = '/', $prefix = '') 96 | { 97 | set_cookie($name, '', '', $domain, $path, $prefix); 98 | } 99 | } 100 | 101 | 102 | /* End of file cookie_helper.php */ 103 | /* Location: ./system/helpers/cookie_helper.php */ -------------------------------------------------------------------------------- /system/helpers/directory_helper.php: -------------------------------------------------------------------------------- 1 | 0) && @is_dir($source_dir.$file)) 61 | { 62 | $filedata[$file] = directory_map($source_dir.$file.DIRECTORY_SEPARATOR, $new_depth, $hidden); 63 | } 64 | else 65 | { 66 | $filedata[] = $file; 67 | } 68 | } 69 | 70 | closedir($fp); 71 | return $filedata; 72 | } 73 | 74 | return FALSE; 75 | } 76 | } 77 | 78 | 79 | /* End of file directory_helper.php */ 80 | /* Location: ./system/helpers/directory_helper.php */ -------------------------------------------------------------------------------- /system/helpers/download_helper.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 403 Forbidden 4 | 5 | 6 | 7 |

Directory access is forbidden.

8 | 9 | 10 | -------------------------------------------------------------------------------- /system/helpers/inflector_helper.php: -------------------------------------------------------------------------------- 1 | regular plural 91 | $vowels = array('a', 'e', 'i', 'o', 'u'); 92 | $str = in_array(substr($str, -2, 1), $vowels) ? $str.'s' : substr($str, 0, -1).'ies'; 93 | } 94 | elseif ($end == 'h') 95 | { 96 | if (substr($str, -2) == 'ch' OR substr($str, -2) == 'sh') 97 | { 98 | $str .= 'es'; 99 | } 100 | else 101 | { 102 | $str .= 's'; 103 | } 104 | } 105 | elseif ($end == 's') 106 | { 107 | if ($force == TRUE) 108 | { 109 | $str .= 'es'; 110 | } 111 | } 112 | else 113 | { 114 | $str .= 's'; 115 | } 116 | 117 | return $str; 118 | } 119 | } 120 | 121 | // -------------------------------------------------------------------- 122 | 123 | /** 124 | * Camelize 125 | * 126 | * Takes multiple words separated by spaces or underscores and camelizes them 127 | * 128 | * @access public 129 | * @param string 130 | * @return str 131 | */ 132 | if ( ! function_exists('camelize')) 133 | { 134 | function camelize($str) 135 | { 136 | $str = 'x'.strtolower(trim($str)); 137 | $str = ucwords(preg_replace('/[\s_]+/', ' ', $str)); 138 | return substr(str_replace(' ', '', $str), 1); 139 | } 140 | } 141 | 142 | // -------------------------------------------------------------------- 143 | 144 | /** 145 | * Underscore 146 | * 147 | * Takes multiple words separated by spaces and underscores them 148 | * 149 | * @access public 150 | * @param string 151 | * @return str 152 | */ 153 | if ( ! function_exists('underscore')) 154 | { 155 | function underscore($str) 156 | { 157 | return preg_replace('/[\s]+/', '_', strtolower(trim($str))); 158 | } 159 | } 160 | 161 | // -------------------------------------------------------------------- 162 | 163 | /** 164 | * Humanize 165 | * 166 | * Takes multiple words separated by underscores and changes them to spaces 167 | * 168 | * @access public 169 | * @param string 170 | * @return str 171 | */ 172 | if ( ! function_exists('humanize')) 173 | { 174 | function humanize($str) 175 | { 176 | return ucwords(preg_replace('/[_]+/', ' ', strtolower(trim($str)))); 177 | } 178 | } 179 | 180 | 181 | /* End of file inflector_helper.php */ 182 | /* Location: ./system/helpers/inflector_helper.php */ -------------------------------------------------------------------------------- /system/helpers/language_helper.php: -------------------------------------------------------------------------------- 1 | lang->line($line); 46 | 47 | if ($id != '') 48 | { 49 | $line = '"; 50 | } 51 | 52 | return $line; 53 | } 54 | } 55 | 56 | // ------------------------------------------------------------------------ 57 | /* End of file language_helper.php */ 58 | /* Location: ./system/helpers/language_helper.php */ -------------------------------------------------------------------------------- /system/helpers/number_helper.php: -------------------------------------------------------------------------------- 1 | lang->load('number'); 43 | 44 | if ($num >= 1000000000000) 45 | { 46 | $num = round($num / 1099511627776, $precision); 47 | $unit = $CI->lang->line('terabyte_abbr'); 48 | } 49 | elseif ($num >= 1000000000) 50 | { 51 | $num = round($num / 1073741824, $precision); 52 | $unit = $CI->lang->line('gigabyte_abbr'); 53 | } 54 | elseif ($num >= 1000000) 55 | { 56 | $num = round($num / 1048576, $precision); 57 | $unit = $CI->lang->line('megabyte_abbr'); 58 | } 59 | elseif ($num >= 1000) 60 | { 61 | $num = round($num / 1024, $precision); 62 | $unit = $CI->lang->line('kilobyte_abbr'); 63 | } 64 | else 65 | { 66 | $unit = $CI->lang->line('bytes'); 67 | return number_format($num).' '.$unit; 68 | } 69 | 70 | return number_format($num, $precision).' '.$unit; 71 | } 72 | } 73 | 74 | 75 | /* End of file number_helper.php */ 76 | /* Location: ./system/helpers/number_helper.php */ -------------------------------------------------------------------------------- /system/helpers/path_helper.php: -------------------------------------------------------------------------------- 1 | security->xss_clean($str, $is_image); 44 | } 45 | } 46 | 47 | // ------------------------------------------------------------------------ 48 | 49 | /** 50 | * Sanitize Filename 51 | * 52 | * @access public 53 | * @param string 54 | * @return string 55 | */ 56 | if ( ! function_exists('sanitize_filename')) 57 | { 58 | function sanitize_filename($filename) 59 | { 60 | $CI =& get_instance(); 61 | return $CI->security->sanitize_filename($filename); 62 | } 63 | } 64 | 65 | // -------------------------------------------------------------------- 66 | 67 | /** 68 | * Hash encode a string 69 | * 70 | * This is simply an alias for do_hash() 71 | * dohash() is now deprecated 72 | */ 73 | if ( ! function_exists('dohash')) 74 | { 75 | function dohash($str, $type = 'sha1') 76 | { 77 | return do_hash($str, $type); 78 | } 79 | } 80 | 81 | // -------------------------------------------------------------------- 82 | 83 | /** 84 | * Hash encode a string 85 | * 86 | * @access public 87 | * @param string 88 | * @return string 89 | */ 90 | if ( ! function_exists('do_hash')) 91 | { 92 | function do_hash($str, $type = 'sha1') 93 | { 94 | if ($type == 'sha1') 95 | { 96 | if ( ! function_exists('sha1')) 97 | { 98 | if ( ! function_exists('mhash')) 99 | { 100 | require_once(BASEPATH.'libraries/Sha1'.EXT); 101 | $SH = new CI_SHA; 102 | return $SH->generate($str); 103 | } 104 | else 105 | { 106 | return bin2hex(mhash(MHASH_SHA1, $str)); 107 | } 108 | } 109 | else 110 | { 111 | return sha1($str); 112 | } 113 | } 114 | else 115 | { 116 | return md5($str); 117 | } 118 | } 119 | } 120 | 121 | // ------------------------------------------------------------------------ 122 | 123 | /** 124 | * Strip Image Tags 125 | * 126 | * @access public 127 | * @param string 128 | * @return string 129 | */ 130 | if ( ! function_exists('strip_image_tags')) 131 | { 132 | function strip_image_tags($str) 133 | { 134 | $str = preg_replace("##", "\\1", $str); 135 | $str = preg_replace("##", "\\1", $str); 136 | 137 | return $str; 138 | } 139 | } 140 | 141 | // ------------------------------------------------------------------------ 142 | 143 | /** 144 | * Convert PHP tags to entities 145 | * 146 | * @access public 147 | * @param string 148 | * @return string 149 | */ 150 | if ( ! function_exists('encode_php_tags')) 151 | { 152 | function encode_php_tags($str) 153 | { 154 | return str_replace(array(''), array('<?php', '<?PHP', '<?', '?>'), $str); 155 | } 156 | } 157 | 158 | 159 | /* End of file security_helper.php */ 160 | /* Location: ./system/helpers/security_helper.php */ -------------------------------------------------------------------------------- /system/helpers/typography_helper.php: -------------------------------------------------------------------------------- 1 | load->library('typography'); 44 | 45 | return $CI->typography->nl2br_except_pre($str); 46 | } 47 | } 48 | 49 | // ------------------------------------------------------------------------ 50 | 51 | /** 52 | * Auto Typography Wrapper Function 53 | * 54 | * 55 | * @access public 56 | * @param string 57 | * @param bool whether to allow javascript event handlers 58 | * @param bool whether to reduce multiple instances of double newlines to two 59 | * @return string 60 | */ 61 | if ( ! function_exists('auto_typography')) 62 | { 63 | function auto_typography($str, $strip_js_event_handlers = TRUE, $reduce_linebreaks = FALSE) 64 | { 65 | $CI =& get_instance(); 66 | $CI->load->library('typography'); 67 | return $CI->typography->auto_typography($str, $strip_js_event_handlers, $reduce_linebreaks); 68 | } 69 | } 70 | 71 | 72 | // -------------------------------------------------------------------- 73 | 74 | /** 75 | * HTML Entities Decode 76 | * 77 | * This function is a replacement for html_entity_decode() 78 | * 79 | * @access public 80 | * @param string 81 | * @return string 82 | */ 83 | if ( ! function_exists('entity_decode')) 84 | { 85 | function entity_decode($str, $charset='UTF-8') 86 | { 87 | $CI =& get_instance(); 88 | $CI->load->library('security'); 89 | return $CI->security->entity_decode($str, $charset); 90 | } 91 | } 92 | 93 | /* End of file typography_helper.php */ 94 | /* Location: ./system/helpers/typography_helper.php */ -------------------------------------------------------------------------------- /system/helpers/xml_helper.php: -------------------------------------------------------------------------------- 1 | ","\"", "'", "-"), 53 | array("&", "<", ">", """, "'", "-"), 54 | $str); 55 | 56 | // Decode the temp markers back to entities 57 | $str = preg_replace("/$temp(\d+);/","&#\\1;",$str); 58 | 59 | if ($protect_all === TRUE) 60 | { 61 | $str = preg_replace("/$temp(\w+);/","&\\1;", $str); 62 | } 63 | 64 | return $str; 65 | } 66 | } 67 | 68 | // ------------------------------------------------------------------------ 69 | 70 | /* End of file xml_helper.php */ 71 | /* Location: ./system/helpers/xml_helper.php */ -------------------------------------------------------------------------------- /system/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 403 Forbidden 4 | 5 | 6 | 7 |

Directory access is forbidden.

8 | 9 | 10 | -------------------------------------------------------------------------------- /system/language/english/calendar_lang.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 403 Forbidden 4 | 5 | 6 | 7 |

Directory access is forbidden.

8 | 9 | 10 | -------------------------------------------------------------------------------- /system/language/english/number_lang.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 403 Forbidden 4 | 5 | 6 | 7 |

Directory access is forbidden.

8 | 9 | 10 | -------------------------------------------------------------------------------- /system/libraries/Cache/Cache.php: -------------------------------------------------------------------------------- 1 | _initialize($config); 49 | } 50 | } 51 | 52 | // ------------------------------------------------------------------------ 53 | 54 | /** 55 | * Get 56 | * 57 | * Look for a value in the cache. If it exists, return the data 58 | * if not, return FALSE 59 | * 60 | * @param string 61 | * @return mixed value that is stored/FALSE on failure 62 | */ 63 | public function get($id) 64 | { 65 | return $this->{$this->_adapter}->get($id); 66 | } 67 | 68 | // ------------------------------------------------------------------------ 69 | 70 | /** 71 | * Cache Save 72 | * 73 | * @param string Unique Key 74 | * @param mixed Data to store 75 | * @param int Length of time (in seconds) to cache the data 76 | * 77 | * @return boolean true on success/false on failure 78 | */ 79 | public function save($id, $data, $ttl = 60) 80 | { 81 | return $this->{$this->_adapter}->save($id, $data, $ttl); 82 | } 83 | 84 | // ------------------------------------------------------------------------ 85 | 86 | /** 87 | * Delete from Cache 88 | * 89 | * @param mixed unique identifier of the item in the cache 90 | * @return boolean true on success/false on failure 91 | */ 92 | public function delete($id) 93 | { 94 | return $this->{$this->_adapter}->delete($id); 95 | } 96 | 97 | // ------------------------------------------------------------------------ 98 | 99 | /** 100 | * Clean the cache 101 | * 102 | * @return boolean false on failure/true on success 103 | */ 104 | public function clean() 105 | { 106 | return $this->{$this->_adapter}->clean(); 107 | } 108 | 109 | // ------------------------------------------------------------------------ 110 | 111 | /** 112 | * Cache Info 113 | * 114 | * @param string user/filehits 115 | * @return mixed array on success, false on failure 116 | */ 117 | public function cache_info($type = 'user') 118 | { 119 | return $this->{$this->_adapter}->cache_info($type); 120 | } 121 | 122 | // ------------------------------------------------------------------------ 123 | 124 | /** 125 | * Get Cache Metadata 126 | * 127 | * @param mixed key to get cache metadata on 128 | * @return mixed return value from child method 129 | */ 130 | public function get_metadata($id) 131 | { 132 | return $this->{$this->_adapter}->get_metadata($id); 133 | } 134 | 135 | // ------------------------------------------------------------------------ 136 | 137 | /** 138 | * Initialize 139 | * 140 | * Initialize class properties based on the configuration array. 141 | * 142 | * @param array 143 | * @return void 144 | */ 145 | private function _initialize($config) 146 | { 147 | $default_config = array( 148 | 'adapter', 149 | 'memcached' 150 | ); 151 | 152 | foreach ($default_config as $key) 153 | { 154 | if (isset($config[$key])) 155 | { 156 | $param = '_'.$key; 157 | 158 | $this->{$param} = $config[$key]; 159 | } 160 | } 161 | 162 | if (isset($config['backup'])) 163 | { 164 | if (in_array('cache_'.$config['backup'], $this->valid_drivers)) 165 | { 166 | $this->_backup_driver = $config['backup']; 167 | } 168 | } 169 | } 170 | 171 | // ------------------------------------------------------------------------ 172 | 173 | /** 174 | * Is the requested driver supported in this environment? 175 | * 176 | * @param string The driver to test. 177 | * @return array 178 | */ 179 | public function is_supported($driver) 180 | { 181 | static $support = array(); 182 | 183 | if ( ! isset($support[$driver])) 184 | { 185 | $support[$driver] = $this->{$driver}->is_supported(); 186 | } 187 | 188 | return $support[$driver]; 189 | } 190 | 191 | // ------------------------------------------------------------------------ 192 | 193 | /** 194 | * __get() 195 | * 196 | * @param child 197 | * @return object 198 | */ 199 | public function __get($child) 200 | { 201 | $obj = parent::__get($child); 202 | 203 | if ( ! $this->is_supported($child)) 204 | { 205 | $this->_adapter = $this->_backup_driver; 206 | } 207 | 208 | return $obj; 209 | } 210 | 211 | // ------------------------------------------------------------------------ 212 | } 213 | // End Class 214 | 215 | /* End of file Cache.php */ 216 | /* Location: ./system/libraries/Cache/Cache.php */ -------------------------------------------------------------------------------- /system/libraries/Cache/drivers/Cache_apc.php: -------------------------------------------------------------------------------- 1 | $time + $ttl, 121 | 'mtime' => $time, 122 | 'data' => $data 123 | ); 124 | } 125 | 126 | // ------------------------------------------------------------------------ 127 | 128 | /** 129 | * is_supported() 130 | * 131 | * Check to see if APC is available on this system, bail if it isn't. 132 | */ 133 | public function is_supported() 134 | { 135 | if ( ! extension_loaded('apc') OR ! function_exists('apc_store')) 136 | { 137 | log_message('error', 'The APC PHP extension must be loaded to use APC Cache.'); 138 | return FALSE; 139 | } 140 | 141 | return TRUE; 142 | } 143 | 144 | // ------------------------------------------------------------------------ 145 | 146 | 147 | } 148 | // End Class 149 | 150 | /* End of file Cache_apc.php */ 151 | /* Location: ./system/libraries/Cache/drivers/Cache_apc.php */ -------------------------------------------------------------------------------- /system/libraries/Cache/drivers/Cache_dummy.php: -------------------------------------------------------------------------------- 1 | load->helper('file'); 39 | 40 | $path = $CI->config->item('cache_path'); 41 | 42 | $this->_cache_path = ($path == '') ? APPPATH.'cache/' : $path; 43 | } 44 | 45 | // ------------------------------------------------------------------------ 46 | 47 | /** 48 | * Fetch from cache 49 | * 50 | * @param mixed unique key id 51 | * @return mixed data on success/false on failure 52 | */ 53 | public function get($id) 54 | { 55 | if ( ! file_exists($this->_cache_path.$id)) 56 | { 57 | return FALSE; 58 | } 59 | 60 | $data = read_file($this->_cache_path.$id); 61 | $data = unserialize($data); 62 | 63 | if (time() > $data['time'] + $data['ttl']) 64 | { 65 | unlink($this->_cache_path.$id); 66 | return FALSE; 67 | } 68 | 69 | return $data['data']; 70 | } 71 | 72 | // ------------------------------------------------------------------------ 73 | 74 | /** 75 | * Save into cache 76 | * 77 | * @param string unique key 78 | * @param mixed data to store 79 | * @param int length of time (in seconds) the cache is valid 80 | * - Default is 60 seconds 81 | * @return boolean true on success/false on failure 82 | */ 83 | public function save($id, $data, $ttl = 60) 84 | { 85 | $contents = array( 86 | 'time' => time(), 87 | 'ttl' => $ttl, 88 | 'data' => $data 89 | ); 90 | 91 | if (write_file($this->_cache_path.$id, serialize($contents))) 92 | { 93 | @chmod($this->_cache_path.$id, 0777); 94 | return TRUE; 95 | } 96 | 97 | return FALSE; 98 | } 99 | 100 | // ------------------------------------------------------------------------ 101 | 102 | /** 103 | * Delete from Cache 104 | * 105 | * @param mixed unique identifier of item in cache 106 | * @return boolean true on success/false on failure 107 | */ 108 | public function delete($id) 109 | { 110 | return unlink($this->_cache_path.$id); 111 | } 112 | 113 | // ------------------------------------------------------------------------ 114 | 115 | /** 116 | * Clean the Cache 117 | * 118 | * @return boolean false on failure/true on success 119 | */ 120 | public function clean() 121 | { 122 | return delete_files($this->_cache_path); 123 | } 124 | 125 | // ------------------------------------------------------------------------ 126 | 127 | /** 128 | * Cache Info 129 | * 130 | * Not supported by file-based caching 131 | * 132 | * @param string user/filehits 133 | * @return mixed FALSE 134 | */ 135 | public function cache_info($type = NULL) 136 | { 137 | return get_dir_file_info($this->_cache_path); 138 | } 139 | 140 | // ------------------------------------------------------------------------ 141 | 142 | /** 143 | * Get Cache Metadata 144 | * 145 | * @param mixed key to get cache metadata on 146 | * @return mixed FALSE on failure, array on success. 147 | */ 148 | public function get_metadata($id) 149 | { 150 | if ( ! file_exists($this->_cache_path.$id)) 151 | { 152 | return FALSE; 153 | } 154 | 155 | $data = read_file($this->_cache_path.$id); 156 | $data = unserialize($data); 157 | 158 | if (is_array($data)) 159 | { 160 | $data = $data['data']; 161 | $mtime = filemtime($this->_cache_path.$id); 162 | 163 | if ( ! isset($data['ttl'])) 164 | { 165 | return FALSE; 166 | } 167 | 168 | return array( 169 | 'expire' => $mtime + $data['ttl'], 170 | 'mtime' => $mtime 171 | ); 172 | } 173 | 174 | return FALSE; 175 | } 176 | 177 | // ------------------------------------------------------------------------ 178 | 179 | /** 180 | * Is supported 181 | * 182 | * In the file driver, check to see that the cache directory is indeed writable 183 | * 184 | * @return boolean 185 | */ 186 | public function is_supported() 187 | { 188 | return is_really_writable($this->_cache_path); 189 | } 190 | 191 | // ------------------------------------------------------------------------ 192 | } 193 | // End Class 194 | 195 | /* End of file Cache_file.php */ 196 | /* Location: ./system/libraries/Cache/drivers/Cache_file.php */ -------------------------------------------------------------------------------- /system/libraries/Cache/drivers/Cache_memcached.php: -------------------------------------------------------------------------------- 1 | array( 34 | 'default_host' => '127.0.0.1', 35 | 'default_port' => 11211, 36 | 'default_weight' => 1 37 | ) 38 | ); 39 | 40 | // ------------------------------------------------------------------------ 41 | 42 | /** 43 | * Fetch from cache 44 | * 45 | * @param mixed unique key id 46 | * @return mixed data on success/false on failure 47 | */ 48 | public function get($id) 49 | { 50 | $data = $this->_memcached->get($id); 51 | 52 | return (is_array($data)) ? $data[0] : FALSE; 53 | } 54 | 55 | // ------------------------------------------------------------------------ 56 | 57 | /** 58 | * Save 59 | * 60 | * @param string unique identifier 61 | * @param mixed data being cached 62 | * @param int time to live 63 | * @return boolean true on success, false on failure 64 | */ 65 | public function save($id, $data, $ttl = 60) 66 | { 67 | return $this->_memcached->add($id, array($data, time(), $ttl), $ttl); 68 | } 69 | 70 | // ------------------------------------------------------------------------ 71 | 72 | /** 73 | * Delete from Cache 74 | * 75 | * @param mixed key to be deleted. 76 | * @return boolean true on success, false on failure 77 | */ 78 | public function delete($id) 79 | { 80 | return $this->_memcached->delete($id); 81 | } 82 | 83 | // ------------------------------------------------------------------------ 84 | 85 | /** 86 | * Clean the Cache 87 | * 88 | * @return boolean false on failure/true on success 89 | */ 90 | public function clean() 91 | { 92 | return $this->_memcached->flush(); 93 | } 94 | 95 | // ------------------------------------------------------------------------ 96 | 97 | /** 98 | * Cache Info 99 | * 100 | * @param null type not supported in memcached 101 | * @return mixed array on success, false on failure 102 | */ 103 | public function cache_info($type = NULL) 104 | { 105 | return $this->_memcached->getStats(); 106 | } 107 | 108 | // ------------------------------------------------------------------------ 109 | 110 | /** 111 | * Get Cache Metadata 112 | * 113 | * @param mixed key to get cache metadata on 114 | * @return mixed FALSE on failure, array on success. 115 | */ 116 | public function get_metadata($id) 117 | { 118 | $stored = $this->_memcached->get($id); 119 | 120 | if (count($stored) !== 3) 121 | { 122 | return FALSE; 123 | } 124 | 125 | list($data, $time, $ttl) = $stored; 126 | 127 | return array( 128 | 'expire' => $time + $ttl, 129 | 'mtime' => $time, 130 | 'data' => $data 131 | ); 132 | } 133 | 134 | // ------------------------------------------------------------------------ 135 | 136 | /** 137 | * Setup memcached. 138 | */ 139 | private function _setup_memcached() 140 | { 141 | // Try to load memcached server info from the config file. 142 | $CI =& get_instance(); 143 | if ($CI->config->load('memcached', TRUE, TRUE)) 144 | { 145 | if (is_array($CI->config->config['memcached'])) 146 | { 147 | $this->_memcache_conf = NULL; 148 | 149 | foreach ($CI->config->config['memcached'] as $name => $conf) 150 | { 151 | $this->_memcache_conf[$name] = $conf; 152 | } 153 | } 154 | } 155 | 156 | $this->_memcached = new Memcached(); 157 | 158 | foreach ($this->_memcache_conf as $name => $cache_server) 159 | { 160 | if ( ! array_key_exists('hostname', $cache_server)) 161 | { 162 | $cache_server['hostname'] = $this->_default_options['default_host']; 163 | } 164 | 165 | if ( ! array_key_exists('port', $cache_server)) 166 | { 167 | $cache_server['port'] = $this->_default_options['default_port']; 168 | } 169 | 170 | if ( ! array_key_exists('weight', $cache_server)) 171 | { 172 | $cache_server['weight'] = $this->_default_options['default_weight']; 173 | } 174 | 175 | $this->_memcached->addServer( 176 | $cache_server['hostname'], $cache_server['port'], $cache_server['weight'] 177 | ); 178 | } 179 | } 180 | 181 | // ------------------------------------------------------------------------ 182 | 183 | 184 | /** 185 | * Is supported 186 | * 187 | * Returns FALSE if memcached is not supported on the system. 188 | * If it is, we setup the memcached object & return TRUE 189 | */ 190 | public function is_supported() 191 | { 192 | if ( ! extension_loaded('memcached')) 193 | { 194 | log_message('error', 'The Memcached Extension must be loaded to use Memcached Cache.'); 195 | 196 | return FALSE; 197 | } 198 | 199 | $this->_setup_memcached(); 200 | return TRUE; 201 | } 202 | 203 | // ------------------------------------------------------------------------ 204 | 205 | } 206 | // End Class 207 | 208 | /* End of file Cache_memcached.php */ 209 | /* Location: ./system/libraries/Cache/drivers/Cache_memcached.php */ -------------------------------------------------------------------------------- /system/libraries/Log.php: -------------------------------------------------------------------------------- 1 | '1', 'DEBUG' => '2', 'INFO' => '3', 'ALL' => '4'); 34 | 35 | /** 36 | * Constructor 37 | */ 38 | public function __construct() 39 | { 40 | $config =& get_config(); 41 | 42 | $this->_log_path = ($config['log_path'] != '') ? $config['log_path'] : APPPATH.'logs/'; 43 | 44 | if ( ! is_dir($this->_log_path) OR ! is_really_writable($this->_log_path)) 45 | { 46 | $this->_enabled = FALSE; 47 | } 48 | 49 | if (is_numeric($config['log_threshold'])) 50 | { 51 | $this->_threshold = $config['log_threshold']; 52 | } 53 | 54 | if ($config['log_date_format'] != '') 55 | { 56 | $this->_date_fmt = $config['log_date_format']; 57 | } 58 | } 59 | 60 | // -------------------------------------------------------------------- 61 | 62 | /** 63 | * Write Log File 64 | * 65 | * Generally this function will be called using the global log_message() function 66 | * 67 | * @param string the error level 68 | * @param string the error message 69 | * @param bool whether the error is a native PHP error 70 | * @return bool 71 | */ 72 | public function write_log($level = 'error', $msg, $php_error = FALSE) 73 | { 74 | if ($this->_enabled === FALSE) 75 | { 76 | return FALSE; 77 | } 78 | 79 | $level = strtoupper($level); 80 | 81 | if ( ! isset($this->_levels[$level]) OR ($this->_levels[$level] > $this->_threshold)) 82 | { 83 | return FALSE; 84 | } 85 | 86 | $filepath = $this->_log_path.'log-'.date('Y-m-d').EXT; 87 | $message = ''; 88 | 89 | if ( ! file_exists($filepath)) 90 | { 91 | $message .= "<"."?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); ?".">\n\n"; 92 | } 93 | 94 | if ( ! $fp = @fopen($filepath, FOPEN_WRITE_CREATE)) 95 | { 96 | return FALSE; 97 | } 98 | 99 | $message .= $level.' '.(($level == 'INFO') ? ' -' : '-').' '.date($this->_date_fmt). ' --> '.$msg."\n"; 100 | 101 | flock($fp, LOCK_EX); 102 | fwrite($fp, $message); 103 | flock($fp, LOCK_UN); 104 | fclose($fp); 105 | 106 | @chmod($filepath, FILE_WRITE_MODE); 107 | return TRUE; 108 | } 109 | 110 | } 111 | // END Log Class 112 | 113 | /* End of file Log.php */ 114 | /* Location: ./system/libraries/Log.php */ -------------------------------------------------------------------------------- /system/libraries/Parser.php: -------------------------------------------------------------------------------- 1 | load->view($template, $data, TRUE); 49 | 50 | return $this->_parse($template, $data, $return); 51 | } 52 | 53 | // -------------------------------------------------------------------- 54 | 55 | /** 56 | * Parse a String 57 | * 58 | * Parses pseudo-variables contained in the specified string, 59 | * replacing them with the data in the second param 60 | * 61 | * @access public 62 | * @param string 63 | * @param array 64 | * @param bool 65 | * @return string 66 | */ 67 | function parse_string($template, $data, $return = FALSE) 68 | { 69 | return $this->_parse($template, $data, $return); 70 | } 71 | 72 | // -------------------------------------------------------------------- 73 | 74 | /** 75 | * Parse a template 76 | * 77 | * Parses pseudo-variables contained in the specified template, 78 | * replacing them with the data in the second param 79 | * 80 | * @access public 81 | * @param string 82 | * @param array 83 | * @param bool 84 | * @return string 85 | */ 86 | function _parse($template, $data, $return = FALSE) 87 | { 88 | if ($template == '') 89 | { 90 | return FALSE; 91 | } 92 | 93 | foreach ($data as $key => $val) 94 | { 95 | if (is_array($val)) 96 | { 97 | $template = $this->_parse_pair($key, $val, $template); 98 | } 99 | else 100 | { 101 | $template = $this->_parse_single($key, (string)$val, $template); 102 | } 103 | } 104 | 105 | if ($return == FALSE) 106 | { 107 | $CI =& get_instance(); 108 | $CI->output->append_output($template); 109 | } 110 | 111 | return $template; 112 | } 113 | 114 | // -------------------------------------------------------------------- 115 | 116 | /** 117 | * Set the left/right variable delimiters 118 | * 119 | * @access public 120 | * @param string 121 | * @param string 122 | * @return void 123 | */ 124 | function set_delimiters($l = '{', $r = '}') 125 | { 126 | $this->l_delim = $l; 127 | $this->r_delim = $r; 128 | } 129 | 130 | // -------------------------------------------------------------------- 131 | 132 | /** 133 | * Parse a single key/value 134 | * 135 | * @access private 136 | * @param string 137 | * @param string 138 | * @param string 139 | * @return string 140 | */ 141 | function _parse_single($key, $val, $string) 142 | { 143 | return str_replace($this->l_delim.$key.$this->r_delim, $val, $string); 144 | } 145 | 146 | // -------------------------------------------------------------------- 147 | 148 | /** 149 | * Parse a tag pair 150 | * 151 | * Parses tag pairs: {some_tag} string... {/some_tag} 152 | * 153 | * @access private 154 | * @param string 155 | * @param array 156 | * @param string 157 | * @return string 158 | */ 159 | function _parse_pair($variable, $data, $string) 160 | { 161 | if (FALSE === ($match = $this->_match_pair($string, $variable))) 162 | { 163 | return $string; 164 | } 165 | 166 | $str = ''; 167 | foreach ($data as $row) 168 | { 169 | $temp = $match['1']; 170 | foreach ($row as $key => $val) 171 | { 172 | if ( ! is_array($val)) 173 | { 174 | $temp = $this->_parse_single($key, $val, $temp); 175 | } 176 | else 177 | { 178 | $temp = $this->_parse_pair($key, $val, $temp); 179 | } 180 | } 181 | 182 | $str .= $temp; 183 | } 184 | 185 | return str_replace($match['0'], $str, $string); 186 | } 187 | 188 | // -------------------------------------------------------------------- 189 | 190 | /** 191 | * Matches a variable pair 192 | * 193 | * @access private 194 | * @param string 195 | * @param string 196 | * @return mixed 197 | */ 198 | function _match_pair($string, $variable) 199 | { 200 | if ( ! preg_match("|" . preg_quote($this->l_delim) . $variable . preg_quote($this->r_delim) . "(.+?)". preg_quote($this->l_delim) . '/' . $variable . preg_quote($this->r_delim) . "|s", $string, $match)) 201 | { 202 | return FALSE; 203 | } 204 | 205 | return $match; 206 | } 207 | 208 | } 209 | // END Parser Class 210 | 211 | /* End of file Parser.php */ 212 | /* Location: ./system/libraries/Parser.php */ 213 | -------------------------------------------------------------------------------- /system/libraries/Sha1.php: -------------------------------------------------------------------------------- 1 | > 6) + 1; 62 | 63 | for ($i = 0; $i < $n * 16; $i++) 64 | { 65 | $x[$i] = 0; 66 | } 67 | 68 | for ($i = 0; $i < strlen($str); $i++) 69 | { 70 | $x[$i >> 2] |= ord(substr($str, $i, 1)) << (24 - ($i % 4) * 8); 71 | } 72 | 73 | $x[$i >> 2] |= 0x80 << (24 - ($i % 4) * 8); 74 | 75 | $x[$n * 16 - 1] = strlen($str) * 8; 76 | 77 | $a = 1732584193; 78 | $b = -271733879; 79 | $c = -1732584194; 80 | $d = 271733878; 81 | $e = -1009589776; 82 | 83 | for ($i = 0; $i < count($x); $i += 16) 84 | { 85 | $olda = $a; 86 | $oldb = $b; 87 | $oldc = $c; 88 | $oldd = $d; 89 | $olde = $e; 90 | 91 | for ($j = 0; $j < 80; $j++) 92 | { 93 | if ($j < 16) 94 | { 95 | $w[$j] = $x[$i + $j]; 96 | } 97 | else 98 | { 99 | $w[$j] = $this->_rol($w[$j - 3] ^ $w[$j - 8] ^ $w[$j - 14] ^ $w[$j - 16], 1); 100 | } 101 | 102 | $t = $this->_safe_add($this->_safe_add($this->_rol($a, 5), $this->_ft($j, $b, $c, $d)), $this->_safe_add($this->_safe_add($e, $w[$j]), $this->_kt($j))); 103 | 104 | $e = $d; 105 | $d = $c; 106 | $c = $this->_rol($b, 30); 107 | $b = $a; 108 | $a = $t; 109 | } 110 | 111 | $a = $this->_safe_add($a, $olda); 112 | $b = $this->_safe_add($b, $oldb); 113 | $c = $this->_safe_add($c, $oldc); 114 | $d = $this->_safe_add($d, $oldd); 115 | $e = $this->_safe_add($e, $olde); 116 | } 117 | 118 | return $this->_hex($a).$this->_hex($b).$this->_hex($c).$this->_hex($d).$this->_hex($e); 119 | } 120 | 121 | // -------------------------------------------------------------------- 122 | 123 | /** 124 | * Convert a decimal to hex 125 | * 126 | * @access private 127 | * @param string 128 | * @return string 129 | */ 130 | function _hex($str) 131 | { 132 | $str = dechex($str); 133 | 134 | if (strlen($str) == 7) 135 | { 136 | $str = '0'.$str; 137 | } 138 | 139 | return $str; 140 | } 141 | 142 | // -------------------------------------------------------------------- 143 | 144 | /** 145 | * Return result based on iteration 146 | * 147 | * @access private 148 | * @return string 149 | */ 150 | function _ft($t, $b, $c, $d) 151 | { 152 | if ($t < 20) 153 | return ($b & $c) | ((~$b) & $d); 154 | if ($t < 40) 155 | return $b ^ $c ^ $d; 156 | if ($t < 60) 157 | return ($b & $c) | ($b & $d) | ($c & $d); 158 | 159 | return $b ^ $c ^ $d; 160 | } 161 | 162 | // -------------------------------------------------------------------- 163 | 164 | /** 165 | * Determine the additive constant 166 | * 167 | * @access private 168 | * @return string 169 | */ 170 | function _kt($t) 171 | { 172 | if ($t < 20) 173 | { 174 | return 1518500249; 175 | } 176 | else if ($t < 40) 177 | { 178 | return 1859775393; 179 | } 180 | else if ($t < 60) 181 | { 182 | return -1894007588; 183 | } 184 | else 185 | { 186 | return -899497514; 187 | } 188 | } 189 | 190 | // -------------------------------------------------------------------- 191 | 192 | /** 193 | * Add integers, wrapping at 2^32 194 | * 195 | * @access private 196 | * @return string 197 | */ 198 | function _safe_add($x, $y) 199 | { 200 | $lsw = ($x & 0xFFFF) + ($y & 0xFFFF); 201 | $msw = ($x >> 16) + ($y >> 16) + ($lsw >> 16); 202 | 203 | return ($msw << 16) | ($lsw & 0xFFFF); 204 | } 205 | 206 | // -------------------------------------------------------------------- 207 | 208 | /** 209 | * Bitwise rotate a 32-bit number 210 | * 211 | * @access private 212 | * @return integer 213 | */ 214 | function _rol($num, $cnt) 215 | { 216 | return ($num << $cnt) | $this->_zero_fill($num, 32 - $cnt); 217 | } 218 | 219 | // -------------------------------------------------------------------- 220 | 221 | /** 222 | * Pad string with zero 223 | * 224 | * @access private 225 | * @return string 226 | */ 227 | function _zero_fill($a, $b) 228 | { 229 | $bin = decbin($a); 230 | 231 | if (strlen($bin) < $b) 232 | { 233 | $bin = 0; 234 | } 235 | else 236 | { 237 | $bin = substr($bin, 0, strlen($bin) - $b); 238 | } 239 | 240 | for ($i=0; $i < $b; $i++) 241 | { 242 | $bin = "0".$bin; 243 | } 244 | 245 | return bindec($bin); 246 | } 247 | } 248 | // END CI_SHA 249 | 250 | /* End of file Sha1.php */ 251 | /* Location: ./system/libraries/Sha1.php */ -------------------------------------------------------------------------------- /system/libraries/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 403 Forbidden 4 | 5 | 6 | 7 |

Directory access is forbidden.

8 | 9 | 10 | --------------------------------------------------------------------------------