├── .scrutinizer.yml ├── .travis.yml ├── LICENSE.md ├── README.md ├── api ├── .htaccess ├── application │ ├── .htaccess │ ├── cache │ │ ├── .htaccess │ │ └── index.html │ ├── config │ │ ├── autoload.php │ │ ├── config.php │ │ ├── constants.php │ │ ├── database.php │ │ ├── doctypes.php │ │ ├── foreign_chars.php │ │ ├── hooks.php │ │ ├── index.html │ │ ├── jwt.php │ │ ├── migration.php │ │ ├── mimes.php │ │ ├── profiler.php │ │ ├── routes.php │ │ ├── smileys.php │ │ └── user_agents.php │ ├── controllers │ │ ├── cli.php │ │ ├── index.html │ │ ├── resource.php │ │ ├── role.php │ │ └── user.php │ ├── core │ │ ├── REST_Controller.php │ │ └── index.html │ ├── errors │ │ ├── error_404.php │ │ ├── error_db.php │ │ ├── error_general.php │ │ ├── error_php.php │ │ └── index.html │ ├── helpers │ │ ├── acl_helper.php │ │ ├── index.html │ │ ├── jwt_helper.php │ │ ├── password_helper.php │ │ └── validation_helper.php │ ├── hooks │ │ └── index.html │ ├── index.html │ ├── language │ │ ├── english │ │ │ ├── form_validation_lang.php │ │ │ └── index.html │ │ └── index.html │ ├── libraries │ │ └── index.html │ ├── logs │ │ └── index.html │ ├── models │ │ ├── index.html │ │ ├── resources.php │ │ ├── roles.php │ │ └── users.php │ ├── third_party │ │ └── index.html │ └── views │ │ ├── index.html │ │ └── json.php ├── index.php └── system │ ├── .htaccess │ ├── core │ ├── Benchmark.php │ ├── CodeIgniter.php │ ├── Common.php │ ├── Config.php │ ├── Controller.php │ ├── Exceptions.php │ ├── Hooks.php │ ├── Input.php │ ├── Lang.php │ ├── Loader.php │ ├── Model.php │ ├── Output.php │ ├── Router.php │ ├── 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 ├── build ├── bootstrap.php ├── sauce.patch └── travis-ci-apache ├── composer.json ├── css └── application.css ├── index.html ├── js ├── application.js ├── controllers.js ├── directives.js ├── filters.js └── services.js ├── locales └── en-US.js ├── partials ├── administrator.html ├── alert.html ├── home.html ├── login.html ├── navigation-administrator.html ├── navigation.html ├── register.html ├── role.html ├── roles.html ├── user.html └── users.html └── tests ├── SeleniumTest.php ├── UnitTest.php └── phpunit.xml /.scrutinizer.yml: -------------------------------------------------------------------------------- 1 | tools: 2 | external_code_coverage: true -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: php 2 | 3 | php: '5.5' 4 | 5 | before_script: 6 | - sudo apt-get update 7 | - sudo apt-get install apache2 libapache2-mod-fastcgi 8 | - sudo cp ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf.default ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf 9 | - sudo a2enmod rewrite actions fastcgi alias 10 | - echo "cgi.fix_pathinfo = 1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini 11 | - ~/.phpenv/versions/$(phpenv version-name)/sbin/php-fpm 12 | - sudo cp -f build/travis-ci-apache /etc/apache2/sites-available/default 13 | - sudo sed -e "s?%TRAVIS_BUILD_DIR%?$(pwd)?g" --in-place /etc/apache2/sites-available/default 14 | - sudo service apache2 restart 15 | - mysql -e 'create database acs;' 16 | - php api/index.php cli install 17 | - php api/index.php cli add administrator foo@bar.com password123 18 | - composer install 19 | - patch -p0 < build/sauce.patch 20 | 21 | script: 22 | - vendor/bin/phpunit --configuration `pwd`/tests/phpunit.xml --coverage-clover ../build/logs/clover.xml 23 | - vendor/bin/paratest -p 8 -f --phpunit=vendor/bin/phpunit tests/SeleniumTest.php 24 | 25 | after_script: 26 | - wget https://scrutinizer-ci.com/ocular.phar 27 | - php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml 28 | 29 | env: 30 | global: 31 | - secure: my2TT2Gq1b58eKJtiF9pg1WTr2Qj7V1TtB95JaJ0NPOmWaeC1yNEeGRDkxm+Exjq6OTaEtZjmbAmMVq9/37abCjS4uYYPplRb1yDKBSMV0LdEVeJCHGI7mwX8LPVbH7CbolPmE9zUwXud5/4+ZCgvAQ0TGe2/CIG7egJ/uZm4XM= 32 | - secure: TckfdYl2c+D47wg6sMIe3JCvN6pSd0W0e3xGV2KQxn9zJUAYr2Ee+s8VjBGJ5QolcsjRGkhm36EPOMzmo+m6I707b189+rzBx0+UpnD9FUozvK1tCtu/ZqQ9lXfMFXX6pBXxpSxJp5BQ92meZbRpPuUKz4GiPEqUdEtLduaeM5s= 33 | - SAUCE_TUNNEL_IDENTIFIER=$TRAVIS_JOB_NUMBER 34 | - SAUCE_DONT_VERIFY_CERTS=1 35 | - TRAVIS_JOB_ID=$TRAVIS_JOB_NUMBER 36 | addons: 37 | sauce_connect: true 38 | code_climate: 39 | repo_token: 33757f44ff7a8f1bdb175e3325a302d5e748dfee9b1e946cbcd266f0156f006f -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Richard McDaniel 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![Build Status](https://travis-ci.org/rmcdaniel/angular-codeigniter-seed.svg?branch=master)](https://travis-ci.org/rmcdaniel/angular-codeigniter-seed) [![Code Coverage](https://scrutinizer-ci.com/g/rmcdaniel/angular-codeigniter-seed/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/rmcdaniel/angular-codeigniter-seed/?branch=master) 2 | # angular-codeigniter-seed 3 | 4 | ## Features 5 | 6 | - Single-page application (AngularJS) 7 | - Responsive (Bootstrap 3) 8 | - Multi-language 9 | - User manager 10 | - Role-based ACL 11 | 12 | ## Requires 13 | 14 | mcrypt 15 | 16 | ```` 17 | sudo apt-get install php5-mcrypt 18 | sudo php5enmod mcrypt 19 | sudo service apache2 restart 20 | ```` 21 | 22 | ## Installation 23 | 24 | ```` 25 | php api/index.php cli install 26 | php api/index.php cli add administrator foo@bar.com password123 27 | ```` 28 | -------------------------------------------------------------------------------- /api/.htaccess: -------------------------------------------------------------------------------- 1 | RewriteEngine on 2 | RewriteCond $1 !^(index\.php) 3 | RewriteRule ^(.*)$ index.php/$1 [L] -------------------------------------------------------------------------------- /api/application/.htaccess: -------------------------------------------------------------------------------- 1 | Deny from all -------------------------------------------------------------------------------- /api/application/cache/.htaccess: -------------------------------------------------------------------------------- 1 | Deny from all -------------------------------------------------------------------------------- /api/application/cache/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 403 Forbidden 4 | 5 | 6 | 7 |

Directory access is forbidden.

8 | 9 | 10 | -------------------------------------------------------------------------------- /api/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 */ -------------------------------------------------------------------------------- /api/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 */ -------------------------------------------------------------------------------- /api/application/config/hooks.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 403 Forbidden 4 | 5 | 6 | 7 |

Directory access is forbidden.

8 | 9 | 10 | -------------------------------------------------------------------------------- /api/application/config/jwt.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 */ -------------------------------------------------------------------------------- /api/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 */ -------------------------------------------------------------------------------- /api/application/controllers/cli.php: -------------------------------------------------------------------------------- 1 | input->is_cli_request()) return; 12 | 13 | $this->load->dbforge(); 14 | 15 | // create acl table 16 | $fields = array( 17 | 'key' => array( 18 | 'type' => 'VARCHAR', 19 | 'constraint' => '255' 20 | ), 21 | 'value' => array( 22 | 'type' => 'TEXT' 23 | ) 24 | ); 25 | $this->dbforge->drop_table('acl'); 26 | $this->dbforge->add_field($fields); 27 | $this->dbforge->add_key('key', true); 28 | $this->dbforge->create_table('acl'); 29 | 30 | // create users table 31 | $fields = array( 32 | 'id' => array( 33 | 'type' => 'INT', 34 | 'constraint' => 11, 35 | 'null' => false, 36 | 'auto_increment' => true 37 | ), 38 | 'email' => array( 39 | 'type' => 'VARCHAR', 40 | 'constraint' => '255', 41 | 'null' => false 42 | ), 43 | 'password' => array( 44 | 'type' => 'VARCHAR', 45 | 'constraint' => '255', 46 | 'null' => false 47 | ) 48 | ); 49 | $this->dbforge->drop_table('users'); 50 | $this->dbforge->add_field($fields); 51 | $this->dbforge->add_key('id', true); 52 | $this->dbforge->create_table('users'); 53 | 54 | // default resources to protect 55 | $acl = new ACL(); 56 | $acl->addResource('administrator'); 57 | $acl->addResource('user'); 58 | $acl->addResource('role'); 59 | $acl->addResource('resource'); 60 | 61 | // create administrator role and grant all access 62 | $acl->addRole('administrator'); 63 | $acl->addPermissions('administrator', 'administrator', 'read'); 64 | $acl->addPermissions('administrator', 'user', ['create', 'read', 'update', 'delete']); 65 | $acl->addPermissions('administrator', 'role', ['create', 'read', 'update', 'delete']); 66 | $acl->addPermissions('administrator', 'resource', ['create', 'read', 'update', 'delete']); 67 | 68 | // custom resources 69 | 70 | // ... 71 | // ... add your custom resources to protect here 72 | // ... 73 | 74 | if (!defined('PHPUNIT_TEST')) 75 | echo "installed\r\n"; 76 | } 77 | 78 | public function add($type, $email, $password) 79 | { 80 | if (!$this->input->is_cli_request()) return; 81 | 82 | if ($type == 'user') 83 | { 84 | $this->Users->register($email, $password); 85 | 86 | if (!defined('PHPUNIT_TEST')) 87 | echo "user added\r\n"; 88 | } 89 | else if ($type == 'administrator') 90 | { 91 | $id = $this->Users->register($email, $password); 92 | $acl = new ACL(); 93 | $acl->addUserRoles($id, 'administrator'); 94 | 95 | if (!defined('PHPUNIT_TEST')) 96 | echo "administrator added\r\n"; 97 | } 98 | } 99 | 100 | } 101 | 102 | /* End of file cli.php */ 103 | /* Location: ./application/controllers/cli.php */ -------------------------------------------------------------------------------- /api/application/controllers/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 403 Forbidden 4 | 5 | 6 | 7 |

Directory access is forbidden.

8 | 9 | 10 | -------------------------------------------------------------------------------- /api/application/controllers/resource.php: -------------------------------------------------------------------------------- 1 | form_validation->set_rules('params', 'params', 'required'); 8 | $this->form_validation->set_rules('role', 'role', 'required'); 9 | return Validation::validate($this, 'resource', 'read', function($token, $output) 10 | { 11 | $params = json_decode(stripslashes($this->input->post('params'))); 12 | $role = $this->input->post('role'); 13 | $table = $this->Resources->table($params, $role); 14 | $output['status'] = true; 15 | $output['total'] = $table['total']; 16 | $output['resources'] = $table['resources']; 17 | return $output; 18 | }); 19 | } 20 | 21 | } 22 | 23 | /* End of file resource.php */ 24 | /* Location: ./application/controllers/resource.php */ -------------------------------------------------------------------------------- /api/application/controllers/role.php: -------------------------------------------------------------------------------- 1 | form_validation->set_rules('email', 'email', 'required|valid_email|max_length[256]'); 8 | $this->form_validation->set_rules('password', 'password', 'required|min_length[8]|max_length[256]'); 9 | return Validation::validate($this, '', '', function($token, $output) 10 | { 11 | $email = $this->input->post('email'); 12 | $password = $this->input->post('password'); 13 | $id = $this->Users->login($email, $password); 14 | if ($id != false) { 15 | $token = array(); 16 | $token['id'] = $id; 17 | $output['status'] = true; 18 | $output['email'] = $email; 19 | $output['token'] = JWT::encode($token, $this->config->item('jwt_key')); 20 | } 21 | else 22 | { 23 | $output['errors'] = '{"type": "invalid"}'; 24 | } 25 | return $output; 26 | }); 27 | } 28 | 29 | public function register() 30 | { 31 | $this->form_validation->set_rules('email', 'email', 'required|valid_email|is_unique[users.email]|max_length[256]'); 32 | $this->form_validation->set_rules('password', 'password', 'required|min_length[8]|max_length[256]'); 33 | return Validation::validate($this, '', '', function($token, $output) 34 | { 35 | $email = $this->input->post('email'); 36 | $password = $this->input->post('password'); 37 | $this->Users->register($email, $password); 38 | $output['status'] = true; 39 | return $output; 40 | }); 41 | } 42 | 43 | public function permissions() 44 | { 45 | $this->form_validation->set_rules('resource', 'resource', 'required'); 46 | return Validation::validate($this, 'user', 'read', function($token, $output) 47 | { 48 | $resource = $this->input->post('resource'); 49 | $acl = new ACL(); 50 | $permissions = $acl->userPermissions($token->id, $resource); 51 | $output['status'] = true; 52 | $output['resource'] = $resource; 53 | $output['permissions'] = $permissions; 54 | return $output; 55 | }); 56 | } 57 | 58 | } 59 | 60 | /* End of file user.php */ 61 | /* Location: ./application/controllers/user.php */ -------------------------------------------------------------------------------- /api/application/core/REST_Controller.php: -------------------------------------------------------------------------------- 1 | model = $this->$modelName; 15 | $this->resource = strtolower($className); 16 | $this->resources = strtolower($modelName); 17 | } 18 | 19 | public function table() 20 | { 21 | $this->__load(); 22 | $this->form_validation->set_rules('params', 'params', 'required'); 23 | return Validation::validate($this, $this->resource, 'read', function($token, $output) 24 | { 25 | $params = json_decode(stripslashes($this->input->post('params'))); 26 | $table = $this->model->table($params); 27 | $output['status'] = true; 28 | $output['total'] = $table['total']; 29 | $output[$this->resources] = $table[$this->resources]; 30 | return $output; 31 | }); 32 | } 33 | 34 | public function create() 35 | { 36 | $this->__load(); 37 | $this->form_validation->set_rules($this->resource, $this->resource, 'required'); 38 | return Validation::validate($this, $this->resource, 'create', function($token, $output) 39 | { 40 | $resource = $this->input->post($this->resource); 41 | $this->model->create($resource); 42 | $output['status'] = true; 43 | return $output; 44 | }); 45 | } 46 | 47 | public function read() 48 | { 49 | $this->__load(); 50 | $this->form_validation->set_rules('id', 'id', 'required'); 51 | return Validation::validate($this, $this->resource, 'read', function($token, $output) 52 | { 53 | $id = $this->input->post('id'); 54 | $resource = $this->model->read($id); 55 | $output['status'] = true; 56 | $output[$this->resource] = $resource; 57 | return $output; 58 | }); 59 | } 60 | 61 | public function update() 62 | { 63 | $this->__load(); 64 | $this->form_validation->set_rules($this->resource, $this->resource, 'required'); 65 | return Validation::validate($this, $this->resource, 'update', function($token, $output) 66 | { 67 | $resource = json_decode(stripslashes($this->input->post($this->resource))); 68 | $resource = $this->model->update($resource); 69 | $output['status'] = true; 70 | $output[$this->resource] = $resource; 71 | return $output; 72 | }); 73 | } 74 | 75 | public function delete() 76 | { 77 | $this->__load(); 78 | $this->form_validation->set_rules('id', 'id', 'required'); 79 | return Validation::validate($this, $this->resource, 'delete', function($token, $output) 80 | { 81 | $id = $this->input->post('id'); 82 | $this->model->delete($id); 83 | $output['status'] = true; 84 | return $output; 85 | }); 86 | } 87 | 88 | } 89 | -------------------------------------------------------------------------------- /api/application/core/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 403 Forbidden 4 | 5 | 6 | 7 |

Directory access is forbidden.

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

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

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

59 | 60 |
61 | 62 | -------------------------------------------------------------------------------- /api/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 |
-------------------------------------------------------------------------------- /api/application/errors/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 403 Forbidden 4 | 5 | 6 | 7 |

Directory access is forbidden.

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

Directory access is forbidden.

8 | 9 | 10 | -------------------------------------------------------------------------------- /api/application/helpers/password_helper.php: -------------------------------------------------------------------------------- 1 | $output)); 14 | } else { 15 | $context->load->view('json', array('output' => $output)); 16 | } 17 | } 18 | } 19 | $context->form_validation->set_error_delimiters('', ''); 20 | $validated = $context->form_validation->run(); 21 | if ($validated) 22 | { 23 | $output = $callback($token, $output); 24 | } 25 | else 26 | { 27 | $output['errors'] = validation_errors(); 28 | } 29 | if (array_key_exists('errors', $output)) { 30 | $errors = explode("\n", $output['errors']); 31 | foreach ($errors as $key => $error) { 32 | $errors[$key] = json_decode($error); 33 | } 34 | $output['errors'] = $errors; 35 | } 36 | if (defined('PHPUNIT_TEST')) { 37 | return json_encode(array('output' => $output)); 38 | } else { 39 | $context->load->view('json', array('output' => $output)); 40 | } 41 | } 42 | 43 | } -------------------------------------------------------------------------------- /api/application/hooks/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 403 Forbidden 4 | 5 | 6 | 7 |

Directory access is forbidden.

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

Directory access is forbidden.

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

Directory access is forbidden.

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

Directory access is forbidden.

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

Directory access is forbidden.

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

Directory access is forbidden.

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

Directory access is forbidden.

8 | 9 | 10 | -------------------------------------------------------------------------------- /api/application/models/resources.php: -------------------------------------------------------------------------------- 1 | count); 8 | $offset = intval(($params->page - 1) * $params->count); 9 | $sorting = get_object_vars($params->sorting); 10 | $direction = reset($sorting); 11 | $key = key($sorting); 12 | if ($limit > 100) return; 13 | if ($limit < 0) return; 14 | if ($offset < 0) return; 15 | if (!in_array($direction, array('asc', 'desc'))) return; 16 | if (!in_array($key, array('resource'))) return; 17 | 18 | $acl = new ACL(); 19 | $resources = $acl->resources(); 20 | sort($resources); 21 | foreach ($resources as $key => $value) { 22 | $resource = new stdClass(); 23 | $resource->name = $value; 24 | $resource->permissions = $acl->rolePermissions($role, $resource->name); 25 | $resources[$key] = $resource; 26 | } 27 | 28 | $data = array(); 29 | $data['total'] = count($resources); 30 | $data['resources'] = $resources; 31 | return $data; 32 | } 33 | 34 | public function create($resource) 35 | { 36 | $acl = new ACL(); 37 | $acl->addResource($resource); 38 | } 39 | 40 | public function delete($resource) 41 | { 42 | $acl = new ACL(); 43 | $acl->removeResource($resource); 44 | } 45 | 46 | } 47 | 48 | /* End of file resources.php */ 49 | /* Location: ./application/models/resources.php */ 50 | -------------------------------------------------------------------------------- /api/application/models/roles.php: -------------------------------------------------------------------------------- 1 | roles(); 9 | 10 | $data = array(); 11 | $data['total'] = count($roles); 12 | $data['roles'] = $roles; 13 | return $data; 14 | } 15 | 16 | public function create($role) 17 | { 18 | $acl = new ACL(); 19 | $acl->addRole($role); 20 | } 21 | 22 | public function read($role, $resource) 23 | { 24 | $acl = new ACL(); 25 | return $acl->rolePermissions($role, $resource); 26 | } 27 | 28 | public function update($role, $resource, $permissions) 29 | { 30 | $acl = new ACL(); 31 | $acl->removePermissions($role, $resource, $acl->rolePermissions($role, $resource)); 32 | $acl->addPermissions($role, $resource, $permissions); 33 | } 34 | 35 | public function delete($role) 36 | { 37 | $acl = new ACL(); 38 | $acl->removeRole($role); 39 | } 40 | 41 | } 42 | 43 | /* End of file roles.php */ 44 | /* Location: ./application/models/roles.php */ 45 | -------------------------------------------------------------------------------- /api/application/models/users.php: -------------------------------------------------------------------------------- 1 | db->select('*'); 8 | $this->db->from('users'); 9 | $this->db->where('email', $email); 10 | $this->db->limit(1); 11 | $query = $this->db->get(); 12 | if ($query->num_rows() == 1) 13 | { 14 | $result = $query->result(); 15 | if (Password::validate_password($password, $result[0]->password)) 16 | { 17 | return $result[0]->id; 18 | } 19 | return false; 20 | } 21 | return false; 22 | } 23 | 24 | public function register($email, $password) 25 | { 26 | $this->db->set('email', $email); 27 | $this->db->set('password', Password::create_hash($password)); 28 | $this->db->insert('users'); 29 | return $this->db->insert_id(); 30 | } 31 | 32 | public function table($params) 33 | { 34 | $limit = intval($params->count); 35 | $offset = intval(($params->page - 1) * $params->count); 36 | $sorting = get_object_vars($params->sorting); 37 | $direction = reset($sorting); 38 | $key = key($sorting); 39 | if ($limit > 100) return; 40 | if ($limit < 0) return; 41 | if ($offset < 0) return; 42 | if (!in_array($direction, array('asc', 'desc'))) return; 43 | if (!in_array($key, array('id', 'email'))) return; 44 | $this->db->select('*'); 45 | $this->db->from('users'); 46 | $this->db->order_by($key, $direction); 47 | $this->db->limit($limit, $offset); 48 | $query = $this->db->get(); 49 | if ($query->num_rows() >= 1) 50 | { 51 | $results = $query->result(); 52 | } 53 | $users = array(); 54 | foreach ($results as $result) 55 | { 56 | $user = new stdClass(); 57 | $user->id = $result->id; 58 | $user->email = $result->email; 59 | $users[] = $user; 60 | } 61 | $total = $this->db->count_all('users'); 62 | 63 | $data = array(); 64 | $data['total'] = $total; 65 | $data['users'] = $users; 66 | return $data; 67 | } 68 | 69 | public function read($id) 70 | { 71 | $user = new stdClass(); 72 | 73 | $this->db->select('*'); 74 | $this->db->from('users'); 75 | $this->db->where('id', $id); 76 | $this->db->limit(1); 77 | 78 | $query = $this->db->get(); 79 | if ($query->num_rows() == 1) 80 | { 81 | $result = $query->result(); 82 | $user->id = $result[0]->id; 83 | $user->email = $result[0]->email; 84 | $acl = new ACL(); 85 | $user->roles = $acl->userRoles($user->id); 86 | } 87 | 88 | return $user; 89 | } 90 | 91 | public function update($user) 92 | { 93 | $this->db->select('*'); 94 | $this->db->from('users'); 95 | $this->db->where('id', $user->id); 96 | $this->db->limit(1); 97 | 98 | $query = $this->db->get(); 99 | if ($query->num_rows() == 1) 100 | { 101 | $acl = new ACL(); 102 | $roles = $acl->userRoles($user->id); 103 | if ($user->roles != $roles) 104 | { 105 | $acl->removeUserRoles($user->id, $roles); 106 | $acl->addUserRoles($user->id, $user->roles); 107 | } 108 | $this->db->where('id', $user->id); 109 | $this->db->update('users', $user); 110 | 111 | $user = $this->read($user->id); 112 | } 113 | 114 | return $user; 115 | } 116 | 117 | public function delete($id) 118 | { 119 | $this->db->where('id', $id); 120 | $this->db->delete('users'); 121 | $this->db->limit(1); 122 | } 123 | 124 | } 125 | 126 | /* End of file users.php */ 127 | /* Location: ./application/models/users.php */ -------------------------------------------------------------------------------- /api/application/third_party/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 403 Forbidden 4 | 5 | 6 | 7 |

Directory access is forbidden.

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

Directory access is forbidden.

8 | 9 | 10 | -------------------------------------------------------------------------------- /api/application/views/json.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 | 79 | if ( ! isset($this->marker[$point1])) 80 | { 81 | return ''; 82 | } 83 | 84 | if ( ! isset($this->marker[$point2])) 85 | { 86 | $this->marker[$point2] = microtime(); 87 | } 88 | 89 | list($sm, $ss) = explode(' ', $this->marker[$point1]); 90 | list($em, $es) = explode(' ', $this->marker[$point2]); 91 | 92 | return number_format(($em + $es) - ($sm + $ss), $decimals); 93 | } 94 | 95 | // -------------------------------------------------------------------- 96 | 97 | /** 98 | * Memory Usage 99 | * 100 | * This function returns the {memory_usage} pseudo-variable. 101 | * This permits it to be put it anywhere in a template 102 | * without the memory being calculated until the end. 103 | * The output class will swap the real value for this variable. 104 | * 105 | * @access public 106 | * @return string 107 | */ 108 | function memory_usage() 109 | { 110 | return '{memory_usage}'; 111 | } 112 | 113 | } 114 | 115 | // END CI_Benchmark class 116 | 117 | /* End of file Benchmark.php */ 118 | /* Location: ./system/core/Benchmark.php */ -------------------------------------------------------------------------------- /api/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 | return self::$instance; 59 | } 60 | } 61 | // END Controller class 62 | 63 | /* End of file Controller.php */ 64 | /* Location: ./system/core/Controller.php */ -------------------------------------------------------------------------------- /api/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 | -------------------------------------------------------------------------------- /api/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 */ -------------------------------------------------------------------------------- /api/system/core/Utf8.php: -------------------------------------------------------------------------------- 1 | item('charset') == 'UTF-8' // Application charset must be UTF-8 50 | ) 51 | { 52 | log_message('debug', "UTF-8 Support Enabled"); 53 | 54 | define('UTF8_ENABLED', TRUE); 55 | 56 | // set internal encoding for multibyte string functions if necessary 57 | // and set a flag so we don't have to repeatedly use extension_loaded() 58 | // or function_exists() 59 | if (extension_loaded('mbstring')) 60 | { 61 | define('MB_ENABLED', TRUE); 62 | mb_internal_encoding('UTF-8'); 63 | } 64 | else 65 | { 66 | define('MB_ENABLED', FALSE); 67 | } 68 | } 69 | else 70 | { 71 | log_message('debug', "UTF-8 Support Disabled"); 72 | define('UTF8_ENABLED', FALSE); 73 | } 74 | } 75 | 76 | // -------------------------------------------------------------------- 77 | 78 | /** 79 | * Clean UTF-8 strings 80 | * 81 | * Ensures strings are UTF-8 82 | * 83 | * @access public 84 | * @param string 85 | * @return string 86 | */ 87 | function clean_string($str) 88 | { 89 | if ($this->_is_ascii($str) === FALSE) 90 | { 91 | $str = @iconv('UTF-8', 'UTF-8//IGNORE', $str); 92 | } 93 | 94 | return $str; 95 | } 96 | 97 | // -------------------------------------------------------------------- 98 | 99 | /** 100 | * Remove ASCII control characters 101 | * 102 | * Removes all ASCII control characters except horizontal tabs, 103 | * line feeds, and carriage returns, as all others can cause 104 | * problems in XML 105 | * 106 | * @access public 107 | * @param string 108 | * @return string 109 | */ 110 | function safe_ascii_for_xml($str) 111 | { 112 | return remove_invisible_characters($str, FALSE); 113 | } 114 | 115 | // -------------------------------------------------------------------- 116 | 117 | /** 118 | * Convert to UTF-8 119 | * 120 | * Attempts to convert a string to UTF-8 121 | * 122 | * @access public 123 | * @param string 124 | * @param string - input encoding 125 | * @return string 126 | */ 127 | function convert_to_utf8($str, $encoding) 128 | { 129 | if (function_exists('iconv')) 130 | { 131 | $str = @iconv($encoding, 'UTF-8', $str); 132 | } 133 | elseif (function_exists('mb_convert_encoding')) 134 | { 135 | $str = @mb_convert_encoding($str, 'UTF-8', $encoding); 136 | } 137 | else 138 | { 139 | return FALSE; 140 | } 141 | 142 | return $str; 143 | } 144 | 145 | // -------------------------------------------------------------------- 146 | 147 | /** 148 | * Is ASCII? 149 | * 150 | * Tests if a string is standard 7-bit ASCII or not 151 | * 152 | * @access public 153 | * @param string 154 | * @return bool 155 | */ 156 | function _is_ascii($str) 157 | { 158 | return (preg_match('/[^\x00-\x7F]/S', $str) == 0); 159 | } 160 | 161 | // -------------------------------------------------------------------- 162 | 163 | } 164 | // End Utf8 Class 165 | 166 | /* End of file Utf8.php */ 167 | /* Location: ./system/core/Utf8.php */ -------------------------------------------------------------------------------- /api/system/core/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 403 Forbidden 4 | 5 | 6 | 7 |

Directory access is forbidden.

8 | 9 | 10 | -------------------------------------------------------------------------------- /api/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 */ -------------------------------------------------------------------------------- /api/system/database/drivers/cubrid/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 403 Forbidden 4 | 5 | 6 | 7 |

Directory access is forbidden.

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

Directory access is forbidden.

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

Directory access is forbidden.

8 | 9 | 10 | -------------------------------------------------------------------------------- /api/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 */ -------------------------------------------------------------------------------- /api/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 */ -------------------------------------------------------------------------------- /api/system/database/drivers/mysql/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 403 Forbidden 4 | 5 | 6 | 7 |

Directory access is forbidden.

8 | 9 | 10 | -------------------------------------------------------------------------------- /api/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 */ -------------------------------------------------------------------------------- /api/system/database/drivers/mysqli/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 403 Forbidden 4 | 5 | 6 | 7 |

Directory access is forbidden.

8 | 9 | 10 | -------------------------------------------------------------------------------- /api/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 */ -------------------------------------------------------------------------------- /api/system/database/drivers/oci8/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 403 Forbidden 4 | 5 | 6 | 7 |

Directory access is forbidden.

8 | 9 | 10 | -------------------------------------------------------------------------------- /api/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 */ -------------------------------------------------------------------------------- /api/system/database/drivers/odbc/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 403 Forbidden 4 | 5 | 6 | 7 |

Directory access is forbidden.

8 | 9 | 10 | -------------------------------------------------------------------------------- /api/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 */ -------------------------------------------------------------------------------- /api/system/database/drivers/pdo/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 403 Forbidden 4 | 5 | 6 | 7 |

Directory access is forbidden.

8 | 9 | 10 | -------------------------------------------------------------------------------- /api/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 */ -------------------------------------------------------------------------------- /api/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 */ -------------------------------------------------------------------------------- /api/system/database/drivers/postgre/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 403 Forbidden 4 | 5 | 6 | 7 |

Directory access is forbidden.

8 | 9 | 10 | -------------------------------------------------------------------------------- /api/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 */ -------------------------------------------------------------------------------- /api/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 */ -------------------------------------------------------------------------------- /api/system/database/drivers/sqlite/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 403 Forbidden 4 | 5 | 6 | 7 |

Directory access is forbidden.

8 | 9 | 10 | -------------------------------------------------------------------------------- /api/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 */ -------------------------------------------------------------------------------- /api/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 */ -------------------------------------------------------------------------------- /api/system/database/drivers/sqlsrv/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 403 Forbidden 4 | 5 | 6 | 7 |

Directory access is forbidden.

8 | 9 | 10 | -------------------------------------------------------------------------------- /api/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 */ -------------------------------------------------------------------------------- /api/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 */ -------------------------------------------------------------------------------- /api/system/database/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 403 Forbidden 4 | 5 | 6 | 7 |

Directory access is forbidden.

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

Directory access is forbidden.

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

Directory access is forbidden.

8 | 9 | 10 | -------------------------------------------------------------------------------- /api/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 */ -------------------------------------------------------------------------------- /api/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 */ -------------------------------------------------------------------------------- /api/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 */ -------------------------------------------------------------------------------- /api/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 */ -------------------------------------------------------------------------------- /api/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 */ -------------------------------------------------------------------------------- /api/system/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 403 Forbidden 4 | 5 | 6 | 7 |

Directory access is forbidden.

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

Directory access is forbidden.

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

Directory access is forbidden.

8 | 9 | 10 | -------------------------------------------------------------------------------- /api/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 */ -------------------------------------------------------------------------------- /api/system/libraries/Cache/drivers/Cache_dummy.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 403 Forbidden 4 | 5 | 6 | 7 |

Directory access is forbidden.

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

Directory access is forbidden.

8 | 9 | 10 | -------------------------------------------------------------------------------- /api/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 */ -------------------------------------------------------------------------------- /api/system/libraries/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 403 Forbidden 4 | 5 | 6 | 7 |

Directory access is forbidden.

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

Directory access is forbidden.

8 | 9 | 10 | -------------------------------------------------------------------------------- /build/sauce.patch: -------------------------------------------------------------------------------- 1 | --- vendor/sauce/sausage/src/Sauce/Sausage/SauceAPI.php 2015-05-15 19:10:35.163364000 -0400 2 | +++ vendor/sauce/sausage/src/Sauce/Sausage/SauceAPI.php 2015-05-15 19:10:33.203364000 -0400 3 | @@ -78,7 +78,7 @@ 4 | $response = curl_exec($ch); 5 | 6 | if (curl_errno($ch)) 7 | - throw new \Exception("Got an error while making a request: ".curl_error($ch)); 8 | + return ''; 9 | 10 | curl_close($ch); 11 | 12 | -------------------------------------------------------------------------------- /build/travis-ci-apache: -------------------------------------------------------------------------------- 1 | 2 | 3 | DocumentRoot %TRAVIS_BUILD_DIR% 4 | 5 | 6 | Options FollowSymLinks MultiViews ExecCGI 7 | AllowOverride All 8 | Order deny,allow 9 | Allow from all 10 | 11 | 12 | # Wire up Apache to use Travis CI's php-fpm. 13 | 14 | AddHandler php5-fcgi .php 15 | Action php5-fcgi /php5-fcgi 16 | Alias /php5-fcgi /usr/lib/cgi-bin/php5-fcgi 17 | FastCgiExternalServer /usr/lib/cgi-bin/php5-fcgi -host 127.0.0.1:9000 -pass-header Authorization 18 | 19 | 20 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "require": { 3 | "sauce/sausage": ">=0.16.0", 4 | "codeclimate/php-test-reporter": "dev-master" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | AngularJS CodeIgniter Seed 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 |
19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /js/application.js: -------------------------------------------------------------------------------- 1 | /* global angular, i18n */ 2 | 'use strict'; 3 | 4 | angular.module('acs', ['acs.filters', 'acs.services', 'acs.directives', 'acs.controllers', 'ngRoute', 'ui.bootstrap', 'ngTable']). 5 | config(['$routeProvider', '$httpProvider', function($routeProvider, $httpProvider) { 6 | 7 | $routeProvider.when('/home', { 8 | controller: 'home', 9 | templateUrl: 'partials/home.html' 10 | }); 11 | 12 | $routeProvider.when('/administrator', { 13 | controller: 'administrator', 14 | templateUrl: 'partials/administrator.html' 15 | }); 16 | 17 | $routeProvider.when('/administrator/users', { 18 | controller: 'users', 19 | templateUrl: 'partials/users.html' 20 | }); 21 | 22 | $routeProvider.when('/administrator/user/:id', { 23 | controller: 'user', 24 | templateUrl: 'partials/user.html' 25 | }); 26 | 27 | $routeProvider.when('/administrator/roles', { 28 | controller: 'roles', 29 | templateUrl: 'partials/roles.html' 30 | }); 31 | 32 | $routeProvider.when('/administrator/role/:role', { 33 | controller: 'role', 34 | templateUrl: 'partials/role.html' 35 | }); 36 | 37 | $routeProvider.when('/login', { 38 | controller: 'login', 39 | templateUrl: 'partials/login.html' 40 | }); 41 | 42 | $routeProvider.when('/register', { 43 | controller: 'register', 44 | templateUrl: 'partials/register.html' 45 | }); 46 | 47 | $routeProvider.otherwise({ 48 | redirectTo: '/home' 49 | }); 50 | 51 | $httpProvider.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded;charset=utf-8'; 52 | 53 | var param = function(obj) { 54 | var query = '', 55 | name, value, fullSubName, subName, subValue, innerObj, i; 56 | 57 | for (name in obj) { 58 | value = obj[name]; 59 | 60 | if (value instanceof Array) { 61 | for (i = 0; i < value.length; ++i) { 62 | subValue = value[i]; 63 | fullSubName = name + '[' + i + ']'; 64 | innerObj = {}; 65 | innerObj[fullSubName] = subValue; 66 | query += param(innerObj) + '&'; 67 | } 68 | } 69 | else if (value instanceof Object) { 70 | for (subName in value) { 71 | subValue = value[subName]; 72 | fullSubName = name + '[' + subName + ']'; 73 | innerObj = {}; 74 | innerObj[fullSubName] = subValue; 75 | query += param(innerObj) + '&'; 76 | } 77 | } 78 | else if (value !== undefined && value !== null) query += encodeURIComponent(name) + '=' + encodeURIComponent(value) + '&'; 79 | } 80 | 81 | return query.length ? query.substr(0, query.length - 1) : query; 82 | }; 83 | 84 | $httpProvider.defaults.transformRequest = [function(data) { 85 | return angular.isObject(data) && String(data) !== '[object File]' ? param(data) : data; 86 | }]; 87 | 88 | }]); 89 | 90 | Array.prototype.contains = function(obj) { 91 | return this.indexOf(obj) > -1; 92 | }; 93 | -------------------------------------------------------------------------------- /js/filters.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | angular.module('acs.filters', []); -------------------------------------------------------------------------------- /js/services.js: -------------------------------------------------------------------------------- 1 | /* global _ angular store moment */ 2 | 'use strict'; 3 | 4 | angular.module('acs.services', []). 5 | factory('user', function($q, $http) { 6 | return { 7 | clear: function() { 8 | store.set('user', {}); 9 | }, 10 | permissions: function(resource) { 11 | var deferred = $q.defer(); 12 | var user = _.isUndefined(store.get('user')) ? {} : store.get('user'); 13 | $http.post('api/user/permissions', { 14 | token: user.token, 15 | resource: resource 16 | }).success(function(data) { 17 | if (data.status) { 18 | deferred.resolve(data.permissions); 19 | return; 20 | } 21 | deferred.reject(); 22 | }); 23 | return deferred.promise; 24 | }, 25 | loggedIn: function() { 26 | var user = _.isUndefined(store.get('user')) ? {} : store.get('user'); 27 | return !_.isEmpty(user) && !_.isEmpty(user.token) && !_.isUndefined(user.token); 28 | }, 29 | getEmail: function() { 30 | var user = _.isUndefined(store.get('user')) ? {} : store.get('user'); 31 | return user.email; 32 | }, 33 | getToken: function() { 34 | var user = _.isUndefined(store.get('user')) ? {} : store.get('user'); 35 | return user.token; 36 | }, 37 | setEmail: function(email) { 38 | var user = _.isUndefined(store.get('user')) ? {} : store.get('user'); 39 | user.email = email; 40 | store.set('user', user); 41 | }, 42 | setToken: function(token) { 43 | var user = _.isUndefined(store.get('user')) ? {} : store.get('user'); 44 | user.token = token; 45 | store.set('user', user); 46 | } 47 | }; 48 | }). 49 | factory('alerts', function($interval) { 50 | var alerts = undefined; 51 | if (!window.alertsInterval) { 52 | window.alertsInterval = $interval(function() { 53 | var alive = []; 54 | _.forEach(alerts, function(alert) { 55 | if (!moment().isAfter(moment(alert.timestamp).add(5, 'seconds'))) { 56 | alive.push(alert); 57 | } 58 | }); 59 | alerts = alive; 60 | store.set('alerts', alerts); 61 | }, 1000); 62 | } 63 | return { 64 | clear: function() { 65 | store.set('alerts', []); 66 | }, 67 | get: function() { 68 | if (_.isUndefined(alerts)) { 69 | alerts = store.get('alerts'); 70 | } 71 | if (_.isEmpty(alerts)) { 72 | alerts = []; 73 | } 74 | return alerts; 75 | }, 76 | set: function(val) { 77 | alerts = val; 78 | store.set('alerts', alerts); 79 | }, 80 | success: function(msg) { 81 | alerts.push({id: Math.random().toString(16), success: msg, timestamp: new Date().getTime()}); 82 | store.set('alerts', alerts); 83 | }, 84 | fail: function(msg) { 85 | alerts.push({id: Math.random().toString(16), danger: msg, timestamp: new Date().getTime()}); 86 | store.set('alerts', alerts); 87 | } 88 | }; 89 | }); 90 | -------------------------------------------------------------------------------- /partials/alert.html: -------------------------------------------------------------------------------- 1 |
2 | 3 | 4 | 5 | 6 |
-------------------------------------------------------------------------------- /partials/login.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |
5 |
6 |
7 |

8 | 9 |

10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 | 18 | 19 |
20 |
21 | 22 | 23 |
24 | 25 |
26 |
27 |
28 |
29 |
30 |
-------------------------------------------------------------------------------- /partials/navigation-administrator.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /partials/navigation.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /partials/register.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |
5 |
6 |
7 |

8 | 9 |

10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 | 18 | 19 |
20 |
21 | 22 | 23 |
24 |
25 | 26 | 27 |
28 | 29 |
30 |
31 |
32 |
33 |
34 |
-------------------------------------------------------------------------------- /partials/role.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |

5 |

6 |
7 |
8 |
9 |
10 |
11 | 12 | 13 | 14 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 34 | 35 | 36 |
18 |
19 |
27 | 33 |
37 |
38 |
39 |
40 |
41 | 44 | 47 | 50 | 53 |
54 |
55 |
-------------------------------------------------------------------------------- /partials/roles.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |

5 |
6 |
7 |
8 |
9 |
10 | 11 | 12 | 13 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 43 | 44 | 45 |
17 |
18 |
26 | 42 |
46 |
47 |
48 |
49 |
50 |
51 | 52 | 53 | 54 | 55 |
56 |
57 |
58 |
-------------------------------------------------------------------------------- /partials/users.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |

5 |
6 |
7 |
8 |
9 |
10 | 11 | 12 | 13 | 16 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 44 | 45 | 46 |
14 |
15 |
17 |
18 |
27 | 43 |
47 |
48 |
49 |
-------------------------------------------------------------------------------- /tests/SeleniumTest.php: -------------------------------------------------------------------------------- 1 | 'chrome', 13 | 'desiredCapabilities' => array( 14 | 'platform' => 'Linux' 15 | ) 16 | ) 17 | ); 18 | 19 | public function testTitle() 20 | { 21 | $this->assertContains("AngularJS CodeIgniter Seed", $this->title()); 22 | } 23 | 24 | 25 | public function testUrl() 26 | { 27 | $this->assertContains("http://localhost/#/home", $this->url()); 28 | } 29 | 30 | public function testLogin() 31 | { 32 | $this->url('http://localhost/#/login'); 33 | $this->assertTextNotPresent("Logout"); 34 | $this->byName('email')->value('foo@bar.com'); 35 | $this->byName('password')->value('password123'); 36 | $this->byName('login')->submit(); 37 | $this->assertTextPresent("Logout"); 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /tests/UnitTest.php: -------------------------------------------------------------------------------- 1 | CI->User = load_controller('User'); 12 | return json_decode($this->CI->User->login())->output; 13 | } 14 | 15 | private function register($email = 'biz@baz.com', $password = 'password123') 16 | { 17 | $_POST['email'] = $email; 18 | $_POST['password'] = $password; 19 | $this->CI->User = load_controller('User'); 20 | return json_decode($this->CI->User->register())->output; 21 | } 22 | 23 | private function permissions($resource = 'administrator') 24 | { 25 | $output = $this->login(); 26 | $_POST['token'] = $output->token; 27 | $_POST['resource'] = $resource; 28 | return json_decode($this->CI->User->permissions())->output; 29 | } 30 | 31 | public function setUp() 32 | { 33 | $this->CI = &get_instance(); 34 | $this->CI->CLI = load_controller('CLI'); 35 | $this->CI->CLI->install(); 36 | $this->CI->CLI->add('administrator', 'foo@bar.com', 'password123'); 37 | } 38 | 39 | public function testLoginSuccess() 40 | { 41 | $this->assertTrue($this->login()->status); 42 | } 43 | 44 | public function testLoginFail() 45 | { 46 | $this->assertFalse($this->login('')->status); 47 | $this->assertFalse($this->login('foo@bar.com', 'password456')->status); 48 | } 49 | 50 | public function testRegisterSuccess() 51 | { 52 | $this->assertTrue($this->register()->status); 53 | } 54 | 55 | public function testRegisterFail() 56 | { 57 | $this->assertFalse($this->register('')->status); 58 | } 59 | 60 | public function testPermissionsSuccess() 61 | { 62 | $this->assertTrue($this->permissions()->status); 63 | } 64 | 65 | public function testPermissionsFail() 66 | { 67 | $this->assertFalse($this->permissions('')->status); 68 | } 69 | 70 | } -------------------------------------------------------------------------------- /tests/phpunit.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16 | 17 | 18 | UnitTest.php 19 | 20 | 21 | 22 | 23 | ../api/application/core 24 | ../api/application/models 25 | ../api/application/views 26 | ../api/application/controllers 27 | ../api/application/helpers 28 | 29 | 30 | --------------------------------------------------------------------------------