├── LICENSE ├── README.md ├── ab_batch.txt ├── application ├── .htaccess ├── cache │ ├── .htaccess │ └── index.html ├── config │ ├── autoload.php │ ├── config.php │ ├── constants.php │ ├── database.php │ ├── doctypes.php │ ├── foreign_chars.php │ ├── hooks.php │ ├── index.html │ ├── migration.php │ ├── mimes.php │ ├── profiler.php │ ├── routes.php │ ├── smileys.php │ └── user_agents.php ├── controllers │ ├── admin │ │ └── main.php │ ├── help.php │ ├── index.html │ ├── myct.php │ ├── test.php │ └── welcome.php ├── core │ ├── MY_Controller.php │ └── index.html ├── errors │ ├── error_404.php │ ├── error_db.php │ ├── error_general.php │ ├── error_php.php │ └── index.html ├── helpers │ ├── common_helper.php │ └── index.html ├── hooks │ ├── index.html │ └── testhook.php ├── index.html ├── language │ ├── english │ │ └── index.html │ └── index.html ├── libraries │ ├── Cookie.php │ ├── My_Session.php │ ├── RandomKey.php │ ├── cache │ │ └── FileCache.php │ └── index.html ├── logs │ └── index.html ├── models │ ├── index.html │ └── testmodel.php ├── third_party │ └── index.html └── views │ ├── admin │ └── main.php │ ├── dbtest.php │ ├── index.html │ ├── phpinfo.php │ └── welcome_message.php ├── ciswoole.conf ├── contrast_db.jpg ├── contrast_page.jpg ├── httpindex.php ├── index.php ├── server ├── error_php.php ├── http_server.php └── test.php ├── static ├── css │ └── welcome.css └── images │ └── ci_main.jpg └── 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 ├── Security.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 │ ├── cubrid │ │ ├── cubrid_driver.php │ │ ├── cubrid_forge.php │ │ ├── cubrid_result.php │ │ ├── cubrid_utility.php │ │ └── index.html │ ├── 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 │ ├── pdo │ │ ├── index.html │ │ ├── pdo_driver.php │ │ ├── pdo_forge.php │ │ ├── pdo_result.php │ │ └── pdo_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 │ └── sqlsrv │ │ ├── index.html │ │ ├── sqlsrv_driver.php │ │ ├── sqlsrv_forge.php │ │ ├── sqlsrv_result.php │ │ └── sqlsrv_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 │ ├── migration_lang.php │ ├── 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 │ └── index.html └── index.html ├── Calendar.php ├── Cart.php ├── Driver.php ├── Email.php ├── Encrypt.php ├── Form_validation.php ├── Ftp.php ├── Image_lib.php ├── Javascript.php ├── Log.php ├── Migration.php ├── Pagination.php ├── Parser.php ├── Profiler.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 └── index.html /README.md: -------------------------------------------------------------------------------- 1 | 2 | ciswoole 3 | ======== 4 | 5 | CodeIgniter 2.2 with Swoole Http_Server 6 | ## Requirements 7 | 8 | * PHP 5.3+ 9 | * Swoole 1.7.16 10 | * Linux, OS X and basic Windows support (Thinks to cygwin) 11 | 12 | ## Installation Swoole 13 | 14 | 1. Install via pecl 15 | 16 | ``` 17 | pecl install swoole 18 | ``` 19 | 20 | 2. Install from source 21 | 22 | ``` 23 | sudo apt-get install php5-dev 24 | git clone https://github.com/swoole/swoole-src.git 25 | cd swoole-src 26 | phpize 27 | ./configure 28 | make && make install 29 | ``` 30 | 31 | ## How to run 32 | 33 | 1. cd ciswoole/server 34 | 2. php http_server.php 35 | 3. Open your browser and enter http://ip:9501 36 | 37 | ## Comparison test 38 | 39 | 1. This is the home page comparison test 40 | ![index](https://raw.githubusercontent.com/smalleyes/ciswoole/master/contrast_page.jpg) 41 | 2. This is a data query comparison test 42 | ![db](https://raw.githubusercontent.com/smalleyes/ciswoole/master/contrast_db.jpg) 43 | 44 | ## batch test 45 | 46 | 1. See document file ab_batch.txt 47 | -------------------------------------------------------------------------------- /ab_batch.txt: -------------------------------------------------------------------------------- 1 | 压侧对同一个数据库,数据表进行读取操作 2 | 测试在虚拟机下进行导致QPS两个都很低,主要是比较两种框架在相同模式下性能差别 3 | 第一个是ciswoole,后面的是CodeIgniter 2.2 4 | 5 | [xmc@localhost ciswoole]$ ab -c500 -n5000 -k http://192.168.1.10:9501/welcome/dbtest 6 | This is ApacheBench, Version 2.3 <$Revision: 1604373 $> 7 | Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ 8 | Licensed to The Apache Software Foundation, http://www.apache.org/ 9 | 10 | Benchmarking 192.168.1.10 (be patient) 11 | Completed 500 requests 12 | Completed 1000 requests 13 | Completed 1500 requests 14 | Completed 2000 requests 15 | Completed 2500 requests 16 | Completed 3000 requests 17 | Completed 3500 requests 18 | Completed 4000 requests 19 | Completed 4500 requests 20 | Completed 5000 requests 21 | Finished 5000 requests 22 | 23 | 24 | Server Software: swoole-http-server 25 | Server Hostname: 192.168.1.10 26 | Server Port: 9501 27 | 28 | Document Path: /welcome/dbtest 29 | Document Length: 1756 bytes 30 | 31 | Concurrency Level: 500 32 | Time taken for tests: 6.077 seconds 33 | Complete requests: 5000 34 | Failed requests: 0 35 | Keep-Alive requests: 5000 36 | Total transferred: 9625000 bytes 37 | HTML transferred: 8780000 bytes 38 | Requests per second: 822.73 [#/sec] (mean) 39 | Time per request: 607.729 [ms] (mean) 40 | Time per request: 1.215 [ms] (mean, across all concurrent requests) 41 | Transfer rate: 1546.65 [Kbytes/sec] received 42 | 43 | Connection Times (ms) 44 | min mean[+/-sd] median max 45 | Connect: 0 2 6.2 0 28 46 | Processing: 54 575 128.3 589 896 47 | Waiting: 54 575 128.3 589 896 48 | Total: 81 577 124.6 589 896 49 | 50 | Percentage of the requests served within a certain time (ms) 51 | 50% 589 52 | 66% 624 53 | 75% 647 54 | 80% 666 55 | 90% 721 56 | 95% 761 57 | 98% 818 58 | 99% 843 59 | 100% 896 (longest request) 60 | 61 | 62 | [xmc@localhost ciswoole]$ ab -c500 -n 5000 -k http://ci22.iizhu.com/welcome/dbtest 63 | This is ApacheBench, Version 2.3 <$Revision: 1604373 $> 64 | Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ 65 | Licensed to The Apache Software Foundation, http://www.apache.org/ 66 | 67 | Benchmarking ci22.iizhu.com (be patient) 68 | Completed 500 requests 69 | Completed 1000 requests 70 | Completed 1500 requests 71 | Completed 2000 requests 72 | Completed 2500 requests 73 | Completed 3000 requests 74 | Completed 3500 requests 75 | Completed 4000 requests 76 | Completed 4500 requests 77 | Completed 5000 requests 78 | Finished 5000 requests 79 | 80 | 81 | Server Software: nginx/1.6.2 82 | Server Hostname: ci22.iizhu.com 83 | Server Port: 80 84 | 85 | Document Path: /welcome/dbtest 86 | Document Length: 1756 bytes 87 | 88 | Concurrency Level: 500 89 | Time taken for tests: 35.462 seconds 90 | Complete requests: 5000 91 | Failed requests: 313 92 | (Connect: 0, Receive: 0, Length: 313, Exceptions: 0) 93 | Non-2xx responses: 313 94 | Keep-Alive requests: 313 95 | Total transferred: 9087643 bytes 96 | HTML transferred: 8284208 bytes 97 | Requests per second: 140.99 [#/sec] (mean) 98 | Time per request: 3546.239 [ms] (mean) 99 | Time per request: 7.092 [ms] (mean, across all concurrent requests) 100 | Transfer rate: 250.26 [Kbytes/sec] received 101 | 102 | Connection Times (ms) 103 | min mean[+/-sd] median max 104 | Connect: 0 3 8.2 0 32 105 | Processing: 126 2906 4831.2 1116 29236 106 | Waiting: 126 2906 4831.2 1116 29236 107 | Total: 154 2909 4835.0 1116 29262 108 | 109 | Percentage of the requests served within a certain time (ms) 110 | 50% 1116 111 | 66% 2011 112 | 75% 2090 113 | 80% 2173 114 | 90% 5457 115 | 95% 13938 116 | 98% 26615 117 | 99% 26700 118 | 100% 29262 (longest request) 119 | 120 | 结论:ciswoole的qps达到822.73 [#/sec] (mean) 而使用nginx+php-fpm的qps只达到140.99 [#/sec] (mean) 121 | 不难的出,ciswoole效率比ci+nginx+php-fpm强五倍 -------------------------------------------------------------------------------- /application/.htaccess: -------------------------------------------------------------------------------- 1 | Deny from all -------------------------------------------------------------------------------- /application/cache/.htaccess: -------------------------------------------------------------------------------- 1 | Deny from all -------------------------------------------------------------------------------- /application/cache/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 403 Forbidden 4 | 5 | 6 | 7 |

Directory access is forbidden.

8 | 9 | 10 | -------------------------------------------------------------------------------- /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/foreign_chars.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 | 'testhook', 15 | 'function' => 'test', 16 | 'filename' => 'testhook.php', 17 | 'filepath' => 'hooks' 18 | ); 19 | 20 | $hook['pre_controller'][] = array( 21 | 'class' => 'testhook', 22 | 'function' => 'test1', 23 | 'filename' => 'testhook.php', 24 | 'filepath' => 'hooks' 25 | ); 26 | 27 | /* End of file hooks.php */ 28 | /* Location: ./application/config/hooks.php */ -------------------------------------------------------------------------------- /application/config/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 403 Forbidden 4 | 5 | 6 | 7 |

Directory access is forbidden.

8 | 9 | 10 | -------------------------------------------------------------------------------- /application/config/migration.php: -------------------------------------------------------------------------------- 1 | migration->latest() this is the version that schema will 21 | | be upgraded / downgraded to. 22 | | 23 | */ 24 | $config['migration_version'] = 0; 25 | 26 | 27 | /* 28 | |-------------------------------------------------------------------------- 29 | | Migrations Path 30 | |-------------------------------------------------------------------------- 31 | | 32 | | Path to your migrations folder. 33 | | Typically, it will be within your application path. 34 | | Also, writing permission is required within the migrations path. 35 | | 36 | */ 37 | $config['migration_path'] = APPPATH . 'migrations/'; 38 | 39 | 40 | /* End of file migration.php */ 41 | /* Location: ./application/config/migration.php */ -------------------------------------------------------------------------------- /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', 'application/x-csv', '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' => array('audio/x-wav', 'audio/wave', 'audio/wav'), 69 | 'bmp' => array('image/bmp', 'image/x-windows-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' => array('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/zip'), 97 | 'xlsx' => array('application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'application/zip'), 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 */ 107 | -------------------------------------------------------------------------------- /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/admin/main.php: -------------------------------------------------------------------------------- 1 | admin:ciswoole"; 8 | $this->load->view('admin/main'); 9 | } 10 | } 11 | 12 | /* End of file main.php */ 13 | /* Location: ./application/controllers/main.php */ -------------------------------------------------------------------------------- /application/controllers/help.php: -------------------------------------------------------------------------------- 1 | load->helper('common'); 8 | } 9 | 10 | public function index($id) { 11 | if (checkId($id)) { 12 | echo 'id='.$id; 13 | } else { 14 | echo 'value='.$id.', isn\'t id'; 15 | } 16 | } 17 | } 18 | 19 | /* End of file help.php */ 20 | /* Location: ./application/controllers/help.php */ -------------------------------------------------------------------------------- /application/controllers/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 403 Forbidden 4 | 5 | 6 | 7 |

Directory access is forbidden.

8 | 9 | 10 | -------------------------------------------------------------------------------- /application/controllers/myct.php: -------------------------------------------------------------------------------- 1 | 'ciswoole','version'=>'1.0'); 20 | $this->format($version); 21 | } 22 | } 23 | 24 | /* End of file myct.php */ 25 | /* Location: ./application/controllers/myct.php */ -------------------------------------------------------------------------------- /application/controllers/test.php: -------------------------------------------------------------------------------- 1 | 18 | * @see http://codeigniter.com/user_guide/general/urls.html 19 | */ 20 | public function __construct() { 21 | parent::__construct(); 22 | $this->load->library('My_Session'); 23 | $this->mysession = new My_Session(); 24 | $this->mysession->start(); 25 | } 26 | public function index() { 27 | show_error('a php error' , 500 , 'An Error Was Encountered'); 28 | } 29 | public function test_echo() { 30 | echo 'im test echo'; 31 | } 32 | public function set_session() { 33 | $_SESSION['name'] = 'xmc'; 34 | var_dump($_SESSION); 35 | $this->mysession->save(); 36 | } 37 | public function get_session() { 38 | // $_SESSION['name'] = 'xmc'; 39 | var_dump($_SESSION['name']); 40 | } 41 | 42 | } 43 | 44 | /* End of file test.php */ 45 | /* Location: ./application/controllers/test.php */ -------------------------------------------------------------------------------- /application/controllers/welcome.php: -------------------------------------------------------------------------------- 1 | 18 | * @see http://codeigniter.com/user_guide/general/urls.html 19 | */ 20 | public function index() { 21 | $this->load->view('welcome_message'); 22 | } 23 | public function test() { 24 | $data = array('email'=>'smalleyes@live.cn','tel'=>'123456789'); 25 | $this->load->view('phpinfo',$data); 26 | } 27 | public function dbtest() { 28 | $this->load->model('testmodel'); 29 | $res = $this->testmodel->get_last_ten(); 30 | $data['res'] = $res; 31 | $this->load->view('dbtest',$data); 32 | } 33 | public function tiaoz() { 34 | $this->load->helper("url"); 35 | redirect("welcome/test"); 36 | } 37 | } 38 | 39 | /* End of file welcome.php */ 40 | /* Location: ./application/controllers/welcome.php */ -------------------------------------------------------------------------------- /application/core/MY_Controller.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 403 Forbidden 4 | 5 | 6 | 7 |

Directory access is forbidden.

8 | 9 | 10 | -------------------------------------------------------------------------------- /application/errors/error_404.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 404 Page Not Found 5 | 55 | 56 | 57 |
58 |

59 | 60 |
61 | 62 | -------------------------------------------------------------------------------- /application/errors/error_db.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Database Error 5 | 55 | 56 | 57 |
58 |

59 | 60 |
61 | 62 | -------------------------------------------------------------------------------- /application/errors/error_general.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Error 5 | 55 | 56 | 57 |
58 |

59 | 60 |
61 | 62 | -------------------------------------------------------------------------------- /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/helpers/common_helper.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 403 Forbidden 4 | 5 | 6 | 7 |

Directory access is forbidden.

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

Directory access is forbidden.

8 | 9 | 10 | -------------------------------------------------------------------------------- /application/hooks/testhook.php: -------------------------------------------------------------------------------- 1 | '; 7 | } 8 | 9 | public function test1() { 10 | echo 'for pre controller one
'; 11 | } 12 | } 13 | 14 | /* End of file UriArgs.php */ 15 | /* Location: ./system/application/hooks/UriArgs.php */ -------------------------------------------------------------------------------- /application/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 403 Forbidden 4 | 5 | 6 | 7 |

Directory access is forbidden.

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

Directory access is forbidden.

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

Directory access is forbidden.

8 | 9 | 10 | -------------------------------------------------------------------------------- /application/libraries/Cookie.php: -------------------------------------------------------------------------------- 1 | response->setcookie($key,$value,$expire,Cookie::$path,Cookie::$domain,Cookie::$secure,Cookie::$httponly); 23 | } 24 | else 25 | { 26 | setcookie($key, $value, $expire, Cookie::$path, Cookie::$domain, Cookie::$secure, Cookie::$httponly); 27 | } 28 | } 29 | 30 | static function delete($key) 31 | { 32 | unset($_COOKIE[$key]); 33 | self::set($key, null); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /application/libraries/My_Session.php: -------------------------------------------------------------------------------- 1 | load->library('cache/FileCache'); 38 | $cache = new FileCache(); 39 | } 40 | $this->cache = $cache; 41 | $CI->load->helper('cookie'); 42 | $CI->load->library('RandomKey'); 43 | $this->readonly = new RandomKey(); 44 | } 45 | 46 | public function start($readonly = false) 47 | { 48 | if ($this->use_php_session) { 49 | session_start(); 50 | } else { 51 | $this->readonly = $readonly; 52 | $this->open = true; 53 | $sessid = get_cookie(self::$cookie_key); 54 | if(empty($sessid)) { 55 | $sessid = RandomKey::randmd5(40); 56 | set_cookie(self::$cookie_key, $sessid, self::$cache_life); 57 | } 58 | $_SESSION = $this->load($sessid); 59 | } 60 | } 61 | 62 | public function load($sessId) 63 | { 64 | $this->sessID = $sessId; 65 | $data = $this->get($sessId); 66 | if($data) return unserialize($data); 67 | else return array(); 68 | } 69 | 70 | public function save() 71 | { 72 | return $this->set($this->sessID, serialize($_SESSION)); 73 | } 74 | /** 75 | * 打开Session 76 | * @param String $pSavePath 77 | * @param String $pSessName 78 | * @return Bool TRUE/FALSE 79 | */ 80 | public function open($save_path='',$sess_name='') 81 | { 82 | self::$cache_prefix = $save_path.'_'.$sess_name; 83 | return true; 84 | } 85 | /** 86 | * 关闭Session 87 | * @param NULL 88 | * @return Bool TRUE/FALSE 89 | */ 90 | public function close() 91 | { 92 | return true; 93 | } 94 | /** 95 | * 读取Session 96 | * @param String $sessId 97 | * @return Bool TRUE/FALSE 98 | */ 99 | public function get($sessId) 100 | { 101 | $session = $this->cache->get(self::$cache_prefix.$sessId); 102 | //先读数据,如果没有,就初始化一个 103 | if(!empty($session)) return $session; 104 | else return array(); 105 | } 106 | /** 107 | * 设置Session的值 108 | * @param String $wSessId 109 | * @param String $wData 110 | * @return Bool true/FALSE 111 | */ 112 | public function set($sessId, $session='') 113 | { 114 | $key = self::$cache_prefix.$sessId; 115 | $ret = $this->cache->set($key, $session, self::$cache_life); 116 | return $ret; 117 | } 118 | /** 119 | * 销毁Session 120 | * @param String $wSessId 121 | * @return Bool true/FALSE 122 | */ 123 | public function delete($sessId = '') 124 | { 125 | return $this->cache->delete(self::$cache_prefix.$sessId); 126 | } 127 | /** 128 | * 内存回收 129 | * @param NULL 130 | * @return Bool true/FALSE 131 | */ 132 | public function gc() 133 | { 134 | return true; 135 | } 136 | /** 137 | * 初始化Session,配置Session 138 | * @param NULL 139 | * @return Bool true/FALSE 140 | */ 141 | function initSess() 142 | { 143 | //不使用 GET/POST 变量方式 144 | ini_set('session.use_trans_sid',0); 145 | //设置垃圾回收最大生存时间 146 | ini_set('session.gc_maxlifetime',self::$cache_life); 147 | //使用 COOKIE 保存 SESSION ID 的方式 148 | ini_set('session.use_cookies',1); 149 | ini_set('session.cookie_path','/'); 150 | //多主机共享保存 SESSION ID 的 COOKIE 151 | ini_set('session.cookie_domain', self::$sess_domain); 152 | //将 session.save_handler 设置为 user,而不是默认的 files 153 | session_module_name('user'); 154 | //定义 SESSION 各项操作所对应的方法名 155 | session_set_save_handler( 156 | array($this, 'open'), 157 | array($this, 'close'), 158 | array($this, 'get'), 159 | array($this, 'set'), 160 | array($this, 'delete'), 161 | array($this, 'gc')); 162 | session_start(); 163 | return true; 164 | } 165 | } 166 | -------------------------------------------------------------------------------- /application/libraries/RandomKey.php: -------------------------------------------------------------------------------- 1 | config = $config; 22 | } 23 | 24 | protected function getFileName($key) 25 | { 26 | $file = $this->config['cache_dir'] . '/' . trim(str_replace('_', '/', $key), '/'); 27 | $dir = dirname($file); 28 | if(!is_dir($dir)) 29 | { 30 | mkdir($dir, 0755, true); 31 | } 32 | return $file; 33 | } 34 | 35 | function set($key, $value, $timeout=0) 36 | { 37 | $file = $this->getFileName($key); 38 | $data["value"] = $value; 39 | $data["timeout"] = $timeout; 40 | $data["mktime"] = time(); 41 | return file_put_contents($file, serialize($data)); 42 | } 43 | 44 | function get($key) 45 | { 46 | $file = $this->getFileName($key); 47 | if(!is_file($file)) return false; 48 | $data = unserialize(file_get_contents($file)); 49 | if (empty($data) or !isset($data['timeout']) or !isset($data["value"])) 50 | { 51 | return false; 52 | } 53 | //已过期 54 | if ($data["timeout"] != 0 and ($data["mktime"] + $data["timeout"]) < time()) 55 | { 56 | $this->delete($key); 57 | return false; 58 | } 59 | return $data['value']; 60 | } 61 | 62 | function delete($key) 63 | { 64 | $file = $this->getFileName($key); 65 | return unlink($file); 66 | } 67 | } -------------------------------------------------------------------------------- /application/libraries/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 403 Forbidden 4 | 5 | 6 | 7 |

Directory access is forbidden.

8 | 9 | 10 | -------------------------------------------------------------------------------- /application/logs/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/models/testmodel.php: -------------------------------------------------------------------------------- 1 | db->query("SELECT * FROM `test` limit 30"); 12 | return $query->result(); 13 | } 14 | } -------------------------------------------------------------------------------- /application/third_party/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 403 Forbidden 4 | 5 | 6 | 7 |

Directory access is forbidden.

8 | 9 | 10 | -------------------------------------------------------------------------------- /application/views/admin/main.php: -------------------------------------------------------------------------------- 1 |

welcome to this page,supen admin.

-------------------------------------------------------------------------------- /application/views/dbtest.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Welcome to CodeIgniter 6 | 7 | 66 | 67 | 68 | 69 |
70 | 71 | 72 |
73 | 74 | 75 | -------------------------------------------------------------------------------- /application/views/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 403 Forbidden 4 | 5 | 6 | 7 |

Directory access is forbidden.

8 | 9 | 10 | -------------------------------------------------------------------------------- /application/views/phpinfo.php: -------------------------------------------------------------------------------- 1 | {$do}hello world"; 4 | echo "email:{$email},tel:{$tel}"; -------------------------------------------------------------------------------- /application/views/welcome_message.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Welcome to CodeIgniter 6 | 7 | 8 | 9 | 10 | 11 |
12 |

Welcome to CodeIgniter!

13 | 14 |
15 |

16 |

The page you are looking at is being generated dynamically by CodeIgniter.

17 | 18 |

If you would like to edit this page you'll find it located at:

19 | application/views/welcome_message.php 20 | 21 |

The corresponding controller for this page is found at:

22 | application/controllers/welcome.php 23 | 24 |

If you are exploring CodeIgniter for the very first time, you should start by reading the User Guide.

25 |
26 | 27 | 28 |
29 | 30 | 31 | -------------------------------------------------------------------------------- /ciswoole.conf: -------------------------------------------------------------------------------- 1 | # ciswoole nginx + php-fpm 反向代理实现 2 | # by smalleyes 3 | # 2015 04 01 4 | upstream swoolephp { 5 | server 127.0.0.1:9501; #swoole_http_server 6 | } 7 | 8 | ## Start www.ciswoole.com ## 9 | server { 10 | listen 80; 11 | server_name www.ciswoole.com ciswoole.com; 12 | 13 | root /var/www/code/ciswoole/; 14 | index index.html index.htm index.php; 15 | 16 | ## send request back to apache ## 17 | location / { 18 | #proxy_pass http://127.0.0.1:9501; 19 | proxy_pass http://swoolephp; 20 | 21 | #Proxy Settings 22 | proxy_redirect off; 23 | proxy_set_header Host $host; 24 | proxy_set_header X-Real-IP $remote_addr; 25 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 26 | proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504; 27 | proxy_max_temp_file_size 0; 28 | proxy_connect_timeout 90; 29 | proxy_send_timeout 90; 30 | proxy_read_timeout 90; 31 | proxy_buffer_size 4k; 32 | proxy_buffers 4 32k; 33 | proxy_busy_buffers_size 64k; 34 | proxy_temp_file_write_size 64k; 35 | } 36 | 37 | location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|js|css|ico)$ 38 | { 39 | access_log off; 40 | expires 30d; 41 | } 42 | } 43 | 44 | -------------------------------------------------------------------------------- /contrast_db.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/toxmc/ciswoole/8246f3cad7da1c50c5b7811f3b3b0bd64ae302ba/contrast_db.jpg -------------------------------------------------------------------------------- /contrast_page.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/toxmc/ciswoole/8246f3cad7da1c50c5b7811f3b3b0bd64ae302ba/contrast_page.jpg -------------------------------------------------------------------------------- /httpindex.php: -------------------------------------------------------------------------------- 1 | header)) { 96 | $_SERVER['server_head'] = $request->header; 97 | } 98 | if (isset($request->get)) { 99 | $_GET = $request->get; 100 | } 101 | if (isset($request->post)) { 102 | $_POST = $request->post; 103 | } 104 | include BASEPATH.'core/CodeIgniter.php'; 105 | } 106 | 107 | public function __destruct() 108 | { 109 | self::$httpdefined=false; 110 | } 111 | } 112 | /* End of file index.php */ 113 | /* Location: ./index.php */ -------------------------------------------------------------------------------- /server/error_php.php: -------------------------------------------------------------------------------- 1 |
2 | 3 |

A PHP Error was encountered

4 | 5 |

Severity:

6 |

Message:

7 |

Filename:

8 |

Line Number:

9 | 10 |
-------------------------------------------------------------------------------- /server/http_server.php: -------------------------------------------------------------------------------- 1 | set (array( 17 | 'worker_num' => 8, //worker进程数量 18 | 'daemonize' => false, //守护进程设置成true 19 | 'max_request' => 10000, //最大请求次数,当请求大于它时,将会自动重启该worker 20 | 'dispatch_mode' => 1 21 | )); 22 | $http->on('WorkerStart', array($this, 'onWorkerStart')); 23 | $http->on('request', array($this, 'onRequest')); 24 | $http->on('start', array($this, 'onStart')); 25 | $http->start(); 26 | } 27 | 28 | /** 29 | * server start的时候调用 30 | * @param unknown $serv 31 | */ 32 | public function onStart($serv) 33 | { 34 | echo 'swoole version'.swoole_version().PHP_EOL; 35 | } 36 | /** 37 | * worker start时调用 38 | * @param unknown $serv 39 | * @param int $worker_id 40 | */ 41 | public function onWorkerStart($serv, $worker_id) 42 | { 43 | global $argv; 44 | if($worker_id >= $serv->setting['worker_num']) { 45 | swoole_set_process_name("php {$argv[0]}: task"); 46 | } else { 47 | swoole_set_process_name("php {$argv[0]}: worker"); 48 | } 49 | echo "WorkerStart: MasterPid={$serv->master_pid}|Manager_pid={$serv->manager_pid}|WorkerId={$serv->worker_id}|WorkerPid={$serv->worker_pid}\n"; 50 | define('APPLICATION_PATH', dirname(__DIR__)); 51 | include APPLICATION_PATH.'/httpindex.php'; 52 | } 53 | 54 | /** 55 | * 当request时调用 56 | * @param unknown $request 57 | * @param unknown $response 58 | */ 59 | public function onRequest($request, $response) 60 | { 61 | try { 62 | ob_start(); 63 | Httpindex::getInstance($request, $response); 64 | // include 'test.php'; 65 | $result = ob_get_contents(); 66 | ob_end_clean(); 67 | $response->header("Content-Type", "text/html;charset=utf-8"); 68 | $result = empty($result) ? 'No message' : $result; 69 | !$GLOBALS['ISEND'] && $response->end($result); 70 | unset($result); 71 | } catch (Exception $e) { 72 | $response->end($e->getMessage()); 73 | } 74 | } 75 | 76 | /** 77 | * 致命错误处理 78 | */ 79 | public function handleFatal() 80 | { 81 | $error = error_get_last(); 82 | if (isset($error['type'])) { 83 | switch ($error['type']) { 84 | case E_ERROR : 85 | $severity = 'ERROR:Fatal run-time errors. Errors that can not be recovered from. Execution of the script is halted'; 86 | break; 87 | case E_PARSE : 88 | $severity = 'PARSE:Compile-time parse errors. Parse errors should only be generated by the parser'; 89 | break; 90 | case E_DEPRECATED: 91 | $severity = 'DEPRECATED:Run-time notices. Enable this to receive warnings about code that will not work in future versions'; 92 | break; 93 | case E_CORE_ERROR : 94 | $severity = 'CORE_ERROR :Fatal errors at PHP startup. This is like an E_ERROR in the PHP core'; 95 | break; 96 | case E_COMPILE_ERROR : 97 | $severity = 'COMPILE ERROR:Fatal compile-time errors. This is like an E_ERROR generated by the Zend Scripting Engine'; 98 | break; 99 | default: 100 | $severity = 'OTHER ERROR'; 101 | break; 102 | } 103 | $message = $error['message']; 104 | $file = $error['file']; 105 | $line = $error['line']; 106 | $log = "$message ($file:$line)\nStack trace:\n"; 107 | $trace = debug_backtrace(); 108 | foreach ($trace as $i => $t) { 109 | if (!isset($t['file'])) { 110 | $t['file'] = 'unknown'; 111 | } 112 | if (!isset($t['line'])) { 113 | $t['line'] = 0; 114 | } 115 | if (!isset($t['function'])) { 116 | $t['function'] = 'unknown'; 117 | } 118 | $log .= "#$i {$t['file']}({$t['line']}): "; 119 | if (isset($t['object']) && is_object($t['object'])) { 120 | $log .= get_class($t['object']) . '->'; 121 | } 122 | $log .= "{$t['function']}()\n"; 123 | } 124 | if (isset($_SERVER['REQUEST_URI'])) { 125 | $log .= '[QUERY] ' . $_SERVER['REQUEST_URI']; 126 | } 127 | ob_start(); 128 | include 'error_php.php'; 129 | $log = ob_get_contents(); 130 | ob_end_clean(); 131 | $GLOBALS['RESPONSE']->end($log); 132 | } 133 | } 134 | 135 | public static function getInstance() 136 | { 137 | if (!self::$instance) { 138 | self::$instance = new self(); 139 | } 140 | return self::$instance; 141 | } 142 | } 143 | HttpServer::getInstance (); -------------------------------------------------------------------------------- /server/test.php: -------------------------------------------------------------------------------- 1 | hello world"; -------------------------------------------------------------------------------- /static/css/welcome.css: -------------------------------------------------------------------------------- 1 | @CHARSET "UTF-8"; 2 | ::selection{ background-color: #E13300; color: white; } 3 | ::moz-selection{ background-color: #E13300; color: white; } 4 | ::webkit-selection{ background-color: #E13300; color: white; } 5 | 6 | body { 7 | background-color: #fff; 8 | margin: 40px; 9 | font: 13px/20px normal Helvetica, Arial, sans-serif; 10 | color: #4F5155; 11 | } 12 | 13 | a { 14 | color: #003399; 15 | background-color: transparent; 16 | font-weight: normal; 17 | } 18 | 19 | h1 { 20 | color: #444; 21 | background-color: transparent; 22 | border-bottom: 1px solid #D0D0D0; 23 | font-size: 19px; 24 | font-weight: normal; 25 | margin: 0 0 14px 0; 26 | padding: 14px 15px 10px 15px; 27 | } 28 | 29 | code { 30 | font-family: Consolas, Monaco, Courier New, Courier, monospace; 31 | font-size: 12px; 32 | background-color: #f9f9f9; 33 | border: 1px solid #D0D0D0; 34 | color: #002166; 35 | display: block; 36 | margin: 14px 0 14px 0; 37 | padding: 12px 10px 12px 10px; 38 | } 39 | 40 | #body{ 41 | margin: 0 15px 0 15px; 42 | } 43 | 44 | p.footer{ 45 | text-align: right; 46 | font-size: 11px; 47 | border-top: 1px solid #D0D0D0; 48 | line-height: 32px; 49 | padding: 0 10px 0 10px; 50 | margin: 20px 0 0 0; 51 | } 52 | 53 | #container{ 54 | margin: 10px; 55 | border: 1px solid #D0D0D0; 56 | -webkit-box-shadow: 0 0 8px #D0D0D0; 57 | } -------------------------------------------------------------------------------- /static/images/ci_main.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/toxmc/ciswoole/8246f3cad7da1c50c5b7811f3b3b0bd64ae302ba/static/images/ci_main.jpg -------------------------------------------------------------------------------- /system/.htaccess: -------------------------------------------------------------------------------- 1 | Deny from all -------------------------------------------------------------------------------- /system/core/Benchmark.php: -------------------------------------------------------------------------------- 1 | marker[$name] = microtime(); 54 | } 55 | 56 | // -------------------------------------------------------------------- 57 | 58 | /** 59 | * Calculates the time difference between two marked points. 60 | * 61 | * If the first parameter is empty this function instead returns the 62 | * {elapsed_time} pseudo-variable. This permits the full system 63 | * execution time to be shown in a template. The output class will 64 | * swap the real value for this variable. 65 | * 66 | * @access public 67 | * @param string a particular marked point 68 | * @param string a particular marked point 69 | * @param integer the number of decimal places 70 | * @return mixed 71 | */ 72 | function elapsed_time($point1 = '', $point2 = '', $decimals = 4) 73 | { 74 | if ($point1 == '') 75 | { 76 | return '{elapsed_time}'; 77 | } 78 | if ( ! isset($this->marker[$point1])) 79 | { 80 | return ''; 81 | } 82 | 83 | if ( ! isset($this->marker[$point2])) 84 | { 85 | $this->marker[$point2] = microtime(); 86 | } 87 | 88 | list($sm, $ss) = explode(' ', $this->marker[$point1]); 89 | list($em, $es) = explode(' ', $this->marker[$point2]); 90 | 91 | return number_format(($em + $es) - ($sm + $ss), $decimals); 92 | } 93 | 94 | // -------------------------------------------------------------------- 95 | 96 | /** 97 | * Memory Usage 98 | * 99 | * This function returns the {memory_usage} pseudo-variable. 100 | * This permits it to be put it anywhere in a template 101 | * without the memory being calculated until the end. 102 | * The output class will swap the real value for this variable. 103 | * 104 | * @access public 105 | * @return string 106 | */ 107 | function memory_usage() 108 | { 109 | return '{memory_usage}'; 110 | } 111 | 112 | } 113 | 114 | // END CI_Benchmark class 115 | 116 | /* End of file Benchmark.php */ 117 | /* 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->initialize(); 52 | 53 | log_message('debug', "Controller Class Initialized"); 54 | } 55 | 56 | public static function &get_instance() 57 | { 58 | if (!self::$instance) { 59 | self::$instance = new self(); 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/Lang.php: -------------------------------------------------------------------------------- 1 | is_loaded, TRUE)) 77 | { 78 | return; 79 | } 80 | 81 | $config =& get_config(); 82 | 83 | if ($idiom == '') 84 | { 85 | $deft_lang = ( ! isset($config['language'])) ? 'english' : $config['language']; 86 | $idiom = ($deft_lang == '') ? 'english' : $deft_lang; 87 | } 88 | 89 | // Determine where the language file is and load it 90 | if ($alt_path != '' && file_exists($alt_path.'language/'.$idiom.'/'.$langfile)) 91 | { 92 | include($alt_path.'language/'.$idiom.'/'.$langfile); 93 | } 94 | else 95 | { 96 | $found = FALSE; 97 | 98 | foreach (get_instance()->load->get_package_paths(TRUE) as $package_path) 99 | { 100 | if (file_exists($package_path.'language/'.$idiom.'/'.$langfile)) 101 | { 102 | include($package_path.'language/'.$idiom.'/'.$langfile); 103 | $found = TRUE; 104 | break; 105 | } 106 | } 107 | 108 | if ($found !== TRUE) 109 | { 110 | show_error('Unable to load the requested language file: language/'.$idiom.'/'.$langfile); 111 | } 112 | } 113 | 114 | 115 | if ( ! isset($lang)) 116 | { 117 | log_message('error', 'Language file contains no data: language/'.$idiom.'/'.$langfile); 118 | return; 119 | } 120 | 121 | if ($return == TRUE) 122 | { 123 | return $lang; 124 | } 125 | 126 | $this->is_loaded[] = $langfile; 127 | $this->language = array_merge($this->language, $lang); 128 | unset($lang); 129 | 130 | log_message('debug', 'Language file loaded: language/'.$idiom.'/'.$langfile); 131 | return TRUE; 132 | } 133 | 134 | // -------------------------------------------------------------------- 135 | 136 | /** 137 | * Fetch a single line of text from the language array 138 | * 139 | * @access public 140 | * @param string $line the language line 141 | * @return string 142 | */ 143 | function line($line = '') 144 | { 145 | $value = ($line == '' OR ! isset($this->language[$line])) ? FALSE : $this->language[$line]; 146 | 147 | // Because killer robots like unicorns! 148 | if ($value === FALSE) 149 | { 150 | log_message('error', 'Could not find the language line "'.$line.'"'); 151 | } 152 | 153 | return $value; 154 | } 155 | 156 | } 157 | // END Language Class 158 | 159 | /* End of file Lang.php */ 160 | /* Location: ./system/core/Lang.php */ 161 | -------------------------------------------------------------------------------- /system/core/Model.php: -------------------------------------------------------------------------------- 1 | $key; 52 | } 53 | } 54 | // END Model Class 55 | 56 | /* End of file Model.php */ 57 | /* Location: ./system/core/Model.php */ -------------------------------------------------------------------------------- /system/core/Utf8.php: -------------------------------------------------------------------------------- 1 | _is_ascii($str) === FALSE) 86 | { 87 | $str = @iconv('UTF-8', 'UTF-8//IGNORE', $str); 88 | } 89 | 90 | return $str; 91 | } 92 | 93 | // -------------------------------------------------------------------- 94 | 95 | /** 96 | * Remove ASCII control characters 97 | * 98 | * Removes all ASCII control characters except horizontal tabs, 99 | * line feeds, and carriage returns, as all others can cause 100 | * problems in XML 101 | * 102 | * @access public 103 | * @param string 104 | * @return string 105 | */ 106 | function safe_ascii_for_xml($str) 107 | { 108 | return remove_invisible_characters($str, FALSE); 109 | } 110 | 111 | // -------------------------------------------------------------------- 112 | 113 | /** 114 | * Convert to UTF-8 115 | * 116 | * Attempts to convert a string to UTF-8 117 | * 118 | * @access public 119 | * @param string 120 | * @param string - input encoding 121 | * @return string 122 | */ 123 | function convert_to_utf8($str, $encoding) 124 | { 125 | if (function_exists('iconv')) 126 | { 127 | $str = @iconv($encoding, 'UTF-8', $str); 128 | } 129 | elseif (function_exists('mb_convert_encoding')) 130 | { 131 | $str = @mb_convert_encoding($str, 'UTF-8', $encoding); 132 | } 133 | else 134 | { 135 | return FALSE; 136 | } 137 | 138 | return $str; 139 | } 140 | 141 | // -------------------------------------------------------------------- 142 | 143 | /** 144 | * Is ASCII? 145 | * 146 | * Tests if a string is standard 7-bit ASCII or not 147 | * 148 | * @access public 149 | * @param string 150 | * @return bool 151 | */ 152 | function _is_ascii($str) 153 | { 154 | return (preg_match('/[^\x00-\x7F]/S', $str) == 0); 155 | } 156 | 157 | // -------------------------------------------------------------------- 158 | 159 | } 160 | // End Utf8 Class 161 | 162 | /* End of file Utf8.php */ 163 | /* 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'], 77 | 'hostname' => (isset($dns['host'])) ? rawurldecode($dns['host']) : '', 78 | 'username' => (isset($dns['user'])) ? rawurldecode($dns['user']) : '', 79 | 'password' => (isset($dns['pass'])) ? rawurldecode($dns['pass']) : '', 80 | 'database' => (isset($dns['path'])) ? rawurldecode(substr($dns['path'], 1)) : '' 81 | ); 82 | 83 | // were additional config items set? 84 | if (isset($dns['query'])) 85 | { 86 | parse_str($dns['query'], $extra); 87 | 88 | foreach ($extra as $key => $val) 89 | { 90 | // booleans please 91 | if (strtoupper($val) == "TRUE") 92 | { 93 | $val = TRUE; 94 | } 95 | elseif (strtoupper($val) == "FALSE") 96 | { 97 | $val = FALSE; 98 | } 99 | 100 | $params[$key] = $val; 101 | } 102 | } 103 | } 104 | 105 | // No DB specified yet? Beat them senseless... 106 | if ( ! isset($params['dbdriver']) OR $params['dbdriver'] == '') 107 | { 108 | show_error('You have not selected a database type to connect to.'); 109 | } 110 | 111 | // Load the DB classes. Note: Since the active record class is optional 112 | // we need to dynamically create a class that extends proper parent class 113 | // based on whether we're using the active record class or not. 114 | // Kudos to Paul for discovering this clever use of eval() 115 | 116 | if ($active_record_override !== NULL) 117 | { 118 | $active_record = $active_record_override; 119 | } 120 | 121 | require_once(BASEPATH.'database/DB_driver.php'); 122 | 123 | if ( ! isset($active_record) OR $active_record == TRUE) 124 | { 125 | require_once(BASEPATH.'database/DB_active_rec.php'); 126 | 127 | if ( ! class_exists('CI_DB')) 128 | { 129 | eval('class CI_DB extends CI_DB_active_record { }'); 130 | } 131 | } 132 | else 133 | { 134 | if ( ! class_exists('CI_DB')) 135 | { 136 | eval('class CI_DB extends CI_DB_driver { }'); 137 | } 138 | } 139 | 140 | require_once(BASEPATH.'database/drivers/'.$params['dbdriver'].'/'.$params['dbdriver'].'_driver.php'); 141 | 142 | // Instantiate the DB adapter 143 | $driver = 'CI_DB_'.$params['dbdriver'].'_driver'; 144 | $DB = new $driver($params); 145 | 146 | if ($DB->autoinit == TRUE) 147 | { 148 | $DB->initialize(); 149 | } 150 | 151 | if (isset($params['stricton']) && $params['stricton'] == TRUE) 152 | { 153 | $DB->query('SET SESSION sql_mode="STRICT_ALL_TABLES"'); 154 | } 155 | 156 | return $DB; 157 | } 158 | 159 | 160 | 161 | /* End of file DB.php */ 162 | /* 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/cubrid/cubrid_utility.php: -------------------------------------------------------------------------------- 1 | conn_id) 41 | { 42 | return "SELECT '" . $this->database . "'"; 43 | } 44 | else 45 | { 46 | return FALSE; 47 | } 48 | } 49 | 50 | // -------------------------------------------------------------------- 51 | 52 | /** 53 | * Optimize table query 54 | * 55 | * Generates a platform-specific query so that a table can be optimized 56 | * 57 | * @access private 58 | * @param string the table name 59 | * @return object 60 | * @link http://www.cubrid.org/manual/840/en/Optimize%20Database 61 | */ 62 | function _optimize_table($table) 63 | { 64 | // No SQL based support in CUBRID as of version 8.4.0. Database or 65 | // table optimization can be performed using CUBRID Manager 66 | // database administration tool. See the link above for more info. 67 | return FALSE; 68 | } 69 | 70 | // -------------------------------------------------------------------- 71 | 72 | /** 73 | * Repair table query 74 | * 75 | * Generates a platform-specific query so that a table can be repaired 76 | * 77 | * @access private 78 | * @param string the table name 79 | * @return object 80 | * @link http://www.cubrid.org/manual/840/en/Checking%20Database%20Consistency 81 | */ 82 | function _repair_table($table) 83 | { 84 | // Not supported in CUBRID as of version 8.4.0. Database or 85 | // table consistency can be checked using CUBRID Manager 86 | // database administration tool. See the link above for more info. 87 | return FALSE; 88 | } 89 | 90 | // -------------------------------------------------------------------- 91 | /** 92 | * CUBRID Export 93 | * 94 | * @access private 95 | * @param array Preferences 96 | * @return mixed 97 | */ 98 | function _backup($params = array()) 99 | { 100 | // No SQL based support in CUBRID as of version 8.4.0. Database or 101 | // table backup can be performed using CUBRID Manager 102 | // database administration tool. 103 | return $this->db->display_error('db_unsuported_feature'); 104 | } 105 | } 106 | 107 | /* End of file cubrid_utility.php */ 108 | /* Location: ./system/database/drivers/cubrid/cubrid_utility.php */ -------------------------------------------------------------------------------- /system/database/drivers/cubrid/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 403 Forbidden 4 | 5 | 6 | 7 |

Directory access is forbidden.

8 | 9 | 10 | -------------------------------------------------------------------------------- /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_object($this->result_id)) 88 | { 89 | preg_match('/([a-zA-Z]+)(\(\d+\))?/', $field->Type, $matches); 90 | 91 | $type = (array_key_exists(1, $matches)) ? $matches[1] : NULL; 92 | $length = (array_key_exists(2, $matches)) ? preg_replace('/[^\d]/', '', $matches[2]) : NULL; 93 | 94 | $F = new stdClass(); 95 | $F->name = $field->Field; 96 | $F->type = $type; 97 | $F->default = $field->Default; 98 | $F->max_length = $length; 99 | $F->primary_key = ( $field->Key == 'PRI' ? 1 : 0 ); 100 | 101 | $retval[] = $F; 102 | } 103 | 104 | return $retval; 105 | } 106 | 107 | // -------------------------------------------------------------------- 108 | 109 | /** 110 | * Free the result 111 | * 112 | * @return null 113 | */ 114 | function free_result() 115 | { 116 | if (is_resource($this->result_id)) 117 | { 118 | mysql_free_result($this->result_id); 119 | $this->result_id = FALSE; 120 | } 121 | } 122 | 123 | // -------------------------------------------------------------------- 124 | 125 | /** 126 | * Data Seek 127 | * 128 | * Moves the internal pointer to the desired offset. We call 129 | * this internally before fetching results to make sure the 130 | * result set starts at zero 131 | * 132 | * @access private 133 | * @return array 134 | */ 135 | function _data_seek($n = 0) 136 | { 137 | return mysql_data_seek($this->result_id, $n); 138 | } 139 | 140 | // -------------------------------------------------------------------- 141 | 142 | /** 143 | * Result - associative array 144 | * 145 | * Returns the result set as an array 146 | * 147 | * @access private 148 | * @return array 149 | */ 150 | function _fetch_assoc() 151 | { 152 | return mysql_fetch_assoc($this->result_id); 153 | } 154 | 155 | // -------------------------------------------------------------------- 156 | 157 | /** 158 | * Result - object 159 | * 160 | * Returns the result set as an object 161 | * 162 | * @access private 163 | * @return object 164 | */ 165 | function _fetch_object() 166 | { 167 | return mysql_fetch_object($this->result_id); 168 | } 169 | 170 | } 171 | 172 | 173 | /* End of file mysql_result.php */ 174 | /* Location: ./system/database/drivers/mysql/mysql_result.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_object($this->result_id)) 88 | { 89 | preg_match('/([a-zA-Z]+)(\(\d+\))?/', $field->Type, $matches); 90 | 91 | $type = (array_key_exists(1, $matches)) ? $matches[1] : NULL; 92 | $length = (array_key_exists(2, $matches)) ? preg_replace('/[^\d]/', '', $matches[2]) : NULL; 93 | 94 | $F = new stdClass(); 95 | $F->name = $field->Field; 96 | $F->type = $type; 97 | $F->default = $field->Default; 98 | $F->max_length = $length; 99 | $F->primary_key = ( $field->Key == 'PRI' ? 1 : 0 ); 100 | 101 | $retval[] = $F; 102 | } 103 | 104 | return $retval; 105 | } 106 | 107 | // -------------------------------------------------------------------- 108 | 109 | /** 110 | * Free the result 111 | * 112 | * @return null 113 | */ 114 | function free_result() 115 | { 116 | if (is_object($this->result_id)) 117 | { 118 | mysqli_free_result($this->result_id); 119 | $this->result_id = FALSE; 120 | } 121 | } 122 | 123 | // -------------------------------------------------------------------- 124 | 125 | /** 126 | * Data Seek 127 | * 128 | * Moves the internal pointer to the desired offset. We call 129 | * this internally before fetching results to make sure the 130 | * result set starts at zero 131 | * 132 | * @access private 133 | * @return array 134 | */ 135 | function _data_seek($n = 0) 136 | { 137 | return mysqli_data_seek($this->result_id, $n); 138 | } 139 | 140 | // -------------------------------------------------------------------- 141 | 142 | /** 143 | * Result - associative array 144 | * 145 | * Returns the result set as an array 146 | * 147 | * @access private 148 | * @return array 149 | */ 150 | function _fetch_assoc() 151 | { 152 | return mysqli_fetch_assoc($this->result_id); 153 | } 154 | 155 | // -------------------------------------------------------------------- 156 | 157 | /** 158 | * Result - object 159 | * 160 | * Returns the result set as an object 161 | * 162 | * @access private 163 | * @return object 164 | */ 165 | function _fetch_object() 166 | { 167 | return mysqli_fetch_object($this->result_id); 168 | } 169 | 170 | } 171 | 172 | 173 | /* End of file mysqli_result.php */ 174 | /* 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_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_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/pdo/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 403 Forbidden 4 | 5 | 6 | 7 |

Directory access is forbidden.

8 | 9 | 10 | -------------------------------------------------------------------------------- /system/database/drivers/pdo/pdo_result.php: -------------------------------------------------------------------------------- 1 | num_rows)) 39 | { 40 | return $this->num_rows; 41 | } 42 | elseif (($this->num_rows = $this->result_id->rowCount()) > 0) 43 | { 44 | return $this->num_rows; 45 | } 46 | 47 | $this->num_rows = count($this->result_id->fetchAll()); 48 | $this->result_id->execute(); 49 | return $this->num_rows; 50 | } 51 | 52 | // -------------------------------------------------------------------- 53 | 54 | /** 55 | * Number of fields in the result set 56 | * 57 | * @access public 58 | * @return integer 59 | */ 60 | function num_fields() 61 | { 62 | return $this->result_id->columnCount(); 63 | } 64 | 65 | // -------------------------------------------------------------------- 66 | 67 | /** 68 | * Fetch Field Names 69 | * 70 | * Generates an array of column names 71 | * 72 | * @access public 73 | * @return array 74 | */ 75 | function list_fields() 76 | { 77 | if ($this->db->db_debug) 78 | { 79 | return $this->db->display_error('db_unsuported_feature'); 80 | } 81 | return FALSE; 82 | } 83 | 84 | // -------------------------------------------------------------------- 85 | 86 | /** 87 | * Field data 88 | * 89 | * Generates an array of objects containing field meta-data 90 | * 91 | * @access public 92 | * @return array 93 | */ 94 | function field_data() 95 | { 96 | $data = array(); 97 | 98 | try 99 | { 100 | for($i = 0; $i < $this->num_fields(); $i++) 101 | { 102 | $data[] = $this->result_id->getColumnMeta($i); 103 | } 104 | 105 | return $data; 106 | } 107 | catch (Exception $e) 108 | { 109 | if ($this->db->db_debug) 110 | { 111 | return $this->db->display_error('db_unsuported_feature'); 112 | } 113 | return FALSE; 114 | } 115 | } 116 | 117 | // -------------------------------------------------------------------- 118 | 119 | /** 120 | * Free the result 121 | * 122 | * @return null 123 | */ 124 | function free_result() 125 | { 126 | if (is_object($this->result_id)) 127 | { 128 | $this->result_id = FALSE; 129 | } 130 | } 131 | 132 | // -------------------------------------------------------------------- 133 | 134 | /** 135 | * Data Seek 136 | * 137 | * Moves the internal pointer to the desired offset. We call 138 | * this internally before fetching results to make sure the 139 | * result set starts at zero 140 | * 141 | * @access private 142 | * @return array 143 | */ 144 | function _data_seek($n = 0) 145 | { 146 | return FALSE; 147 | } 148 | 149 | // -------------------------------------------------------------------- 150 | 151 | /** 152 | * Result - associative array 153 | * 154 | * Returns the result set as an array 155 | * 156 | * @access private 157 | * @return array 158 | */ 159 | function _fetch_assoc() 160 | { 161 | return $this->result_id->fetch(PDO::FETCH_ASSOC); 162 | } 163 | 164 | // -------------------------------------------------------------------- 165 | 166 | /** 167 | * Result - object 168 | * 169 | * Returns the result set as an object 170 | * 171 | * @access private 172 | * @return object 173 | */ 174 | function _fetch_object() 175 | { 176 | return $this->result_id->fetchObject(); 177 | } 178 | 179 | } 180 | 181 | 182 | /* End of file pdo_result.php */ 183 | /* Location: ./system/database/drivers/pdo/pdo_result.php */ -------------------------------------------------------------------------------- /system/database/drivers/pdo/pdo_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 PDO 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 PDO 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 | * PDO 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 pdo_utility.php */ 103 | /* Location: ./system/database/drivers/pdo/pdo_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/drivers/sqlsrv/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 403 Forbidden 4 | 5 | 6 | 7 |

Directory access is forbidden.

8 | 9 | 10 | -------------------------------------------------------------------------------- /system/database/drivers/sqlsrv/sqlsrv_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 @sqlsrv_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 | foreach(sqlsrv_field_metadata($this->result_id) as $offset => $field) 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 | foreach(sqlsrv_field_metadata($this->result_id) as $offset => $field) 88 | { 89 | $F = new stdClass(); 90 | $F->name = $field['Name']; 91 | $F->type = $field['Type']; 92 | $F->max_length = $field['Size']; 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 | sqlsrv_free_stmt($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 | // Not implemented 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 sqlsrv_fetch_array($this->result_id, SQLSRV_FETCH_ASSOC); 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 sqlsrv_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/sqlsrv/sqlsrv_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/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/fonts/texb.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/toxmc/ciswoole/8246f3cad7da1c50c5b7811f3b3b0bd64ae302ba/system/fonts/texb.ttf -------------------------------------------------------------------------------- /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 | $prefix = ''; 71 | if(!isset($_COOKIE[$index]) && config_item('cookie_prefix')!='') { 72 | $prefix = config_item('cookie_prefix'); 73 | } 74 | if(defined('CISWOOLE')) { 75 | $cookie = isset($GLOBALS['REQUEST']->cookie[$prefix.$index]) ? $GLOBALS['REQUEST']->cookie[$prefix.$index] : ''; 76 | return $cookie; 77 | } else { 78 | return $CI->input->cookie($prefix.$index, $xss_clean); 79 | } 80 | } 81 | } 82 | 83 | // -------------------------------------------------------------------- 84 | 85 | /** 86 | * Delete a COOKIE 87 | * 88 | * @param mixed 89 | * @param string the cookie domain. Usually: .yourdomain.com 90 | * @param string the cookie path 91 | * @param string the cookie prefix 92 | * @return void 93 | */ 94 | if ( ! function_exists('delete_cookie')) 95 | { 96 | function delete_cookie($name = '', $domain = '', $path = '/', $prefix = '') 97 | { 98 | set_cookie($name, '', '', $domain, $path, $prefix); 99 | } 100 | } 101 | 102 | 103 | /* End of file cookie_helper.php */ 104 | /* 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/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 | * @access public 71 | * @param string 72 | * @return string 73 | */ 74 | if ( ! function_exists('do_hash')) 75 | { 76 | function do_hash($str, $type = 'sha1') 77 | { 78 | if ($type == 'sha1') 79 | { 80 | return sha1($str); 81 | } 82 | else 83 | { 84 | return md5($str); 85 | } 86 | } 87 | } 88 | 89 | // ------------------------------------------------------------------------ 90 | 91 | /** 92 | * Strip Image Tags 93 | * 94 | * @access public 95 | * @param string 96 | * @return string 97 | */ 98 | if ( ! function_exists('strip_image_tags')) 99 | { 100 | function strip_image_tags($str) 101 | { 102 | $str = preg_replace("##", "\\1", $str); 103 | $str = preg_replace("##", "\\1", $str); 104 | 105 | return $str; 106 | } 107 | } 108 | 109 | // ------------------------------------------------------------------------ 110 | 111 | /** 112 | * Convert PHP tags to entities 113 | * 114 | * @access public 115 | * @param string 116 | * @return string 117 | */ 118 | if ( ! function_exists('encode_php_tags')) 119 | { 120 | function encode_php_tags($str) 121 | { 122 | return str_replace(array(''), array('<?php', '<?PHP', '<?', '?>'), $str); 123 | } 124 | } 125 | 126 | 127 | /* End of file security_helper.php */ 128 | /* 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 | global $SEC; 88 | return $SEC->entity_decode($str, $charset); 89 | } 90 | } 91 | 92 | /* End of file typography_helper.php */ 93 | /* 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/migration_lang.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 403 Forbidden 4 | 5 | 6 | 7 |

Directory access is forbidden.

8 | 9 | 10 | -------------------------------------------------------------------------------- /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 ini_get('apc.enabled') != "1") 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 | /* End of file Cache_apc.php */ 147 | /* 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 | $mtime = filemtime($this->_cache_path.$id); 161 | 162 | if ( ! isset($data['ttl'])) 163 | { 164 | return FALSE; 165 | } 166 | 167 | return array( 168 | 'expire' => $mtime + $data['ttl'], 169 | 'mtime' => $mtime 170 | ); 171 | } 172 | 173 | return FALSE; 174 | } 175 | 176 | // ------------------------------------------------------------------------ 177 | 178 | /** 179 | * Is supported 180 | * 181 | * In the file driver, check to see that the cache directory is indeed writable 182 | * 183 | * @return boolean 184 | */ 185 | public function is_supported() 186 | { 187 | return is_really_writable($this->_cache_path); 188 | } 189 | 190 | } 191 | 192 | /* End of file Cache_file.php */ 193 | /* Location: ./system/libraries/Cache/drivers/Cache_file.php */ -------------------------------------------------------------------------------- /system/libraries/Cache/drivers/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 403 Forbidden 4 | 5 | 6 | 7 |

Directory access is forbidden.

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

Directory access is forbidden.

8 | 9 | 10 | -------------------------------------------------------------------------------- /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').'.php'; 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/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 403 Forbidden 4 | 5 | 6 | 7 |

Directory access is forbidden.

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

Directory access is forbidden.

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