codeigniter_vender 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -0
- data/MIT-LICENSE +20 -0
- data/README +40 -0
- data/Rakefile +18 -0
- data/VERSION +1 -0
- data/codeigniter_vender.gemspec +389 -0
- data/generators/ci_app/USAGE +8 -0
- data/generators/ci_app/ci_app_generator.rb +12 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/index.php +118 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/license.txt +52 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/application/config/autoload.php +116 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/application/config/config.php +329 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/application/config/constants.php +41 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/application/config/database.php +55 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/application/config/doctypes.php +15 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/application/config/hooks.php +16 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/application/config/index.html +10 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/application/config/mimes.php +105 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/application/config/routes.php +48 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/application/config/smileys.php +66 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/application/config/user_agents.php +175 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/application/controllers/index.html +10 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/application/controllers/welcome.php +17 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/application/errors/error_404.php +34 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/application/errors/error_db.php +34 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/application/errors/error_general.php +34 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/application/errors/error_php.php +10 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/application/errors/index.html +10 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/application/helpers/index.html +10 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/application/hooks/index.html +10 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/application/index.html +10 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/application/language/english/index.html +10 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/application/libraries/index.html +10 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/application/models/index.html +10 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/application/views/index.html +10 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/application/views/welcome_message.php +62 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/cache/index.html +10 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/codeigniter/Base4.php +69 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/codeigniter/Base5.php +56 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/codeigniter/CodeIgniter.php +280 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/codeigniter/Common.php +421 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/codeigniter/Compat.php +93 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/codeigniter/index.html +10 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/DB.php +146 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/DB_active_rec.php +1820 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/DB_cache.php +195 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/DB_driver.php +1366 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/DB_forge.php +375 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/DB_result.php +342 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/DB_utility.php +389 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/index.html +10 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/mssql/index.html +10 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/mssql/mssql_driver.php +667 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/mssql/mssql_forge.php +248 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/mssql/mssql_result.php +169 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/mssql/mssql_utility.php +123 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/mysql/index.html +10 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/mysql/mysql_driver.php +670 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/mysql/mysql_forge.php +254 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/mysql/mysql_result.php +169 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/mysql/mysql_utility.php +245 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/mysqli/index.html +10 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/mysqli/mysqli_driver.php +671 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/mysqli/mysqli_forge.php +254 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/mysqli/mysqli_result.php +169 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/mysqli/mysqli_utility.php +123 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/oci8/index.html +10 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/oci8/oci8_driver.php +780 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/oci8/oci8_forge.php +248 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/oci8/oci8_result.php +249 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/oci8/oci8_utility.php +122 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/odbc/index.html +10 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/odbc/odbc_driver.php +639 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/odbc/odbc_forge.php +266 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/odbc/odbc_result.php +228 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/odbc/odbc_utility.php +148 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/postgre/index.html +10 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/postgre/postgre_driver.php +684 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/postgre/postgre_forge.php +248 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/postgre/postgre_result.php +169 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/postgre/postgre_utility.php +124 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/sqlite/index.html +10 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/sqlite/sqlite_driver.php +657 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/sqlite/sqlite_forge.php +265 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/sqlite/sqlite_result.php +179 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/sqlite/sqlite_utility.php +141 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/index.html +10 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/fonts/index.html +10 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/fonts/texb.ttf +0 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/helpers/array_helper.php +78 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/helpers/compatibility_helper.php +498 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/helpers/cookie_helper.php +144 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/helpers/date_helper.php +611 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/helpers/directory_helper.php +84 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/helpers/download_helper.php +100 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/helpers/email_helper.php +62 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/helpers/file_helper.php +464 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/helpers/form_helper.php +1025 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/helpers/html_helper.php +416 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/helpers/index.html +10 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/helpers/inflector_helper.php +171 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/helpers/language_helper.php +58 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/helpers/number_helper.php +75 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/helpers/path_helper.php +72 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/helpers/security_helper.php +126 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/helpers/smiley_helper.php +273 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/helpers/string_helper.php +273 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/helpers/text_helper.php +462 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/helpers/typography_helper.php +71 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/helpers/url_helper.php +593 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/helpers/xml_helper.php +62 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/index.html +10 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/language/english/calendar_lang.php +51 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/language/english/date_lang.php +60 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/language/english/db_lang.php +28 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/language/english/email_lang.php +24 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/language/english/form_validation_lang.php +24 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/language/english/ftp_lang.php +17 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/language/english/imglib_lang.php +24 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/language/english/index.html +10 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/language/english/number_lang.php +10 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/language/english/profiler_lang.php +19 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/language/english/scaffolding_lang.php +17 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/language/english/unit_test_lang.php +24 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/language/english/upload_lang.php +22 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/language/english/validation_lang.php +24 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/language/index.html +10 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Benchmark.php +113 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Calendar.php +477 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Cart.php +550 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Config.php +244 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Controller.php +127 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Email.php +2041 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Encrypt.php +484 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Exceptions.php +174 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Form_validation.php +1278 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Ftp.php +618 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Hooks.php +226 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Image_lib.php +1544 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Input.php +1067 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Language.php +123 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Loader.php +1085 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Log.php +117 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Model.php +83 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Output.php +409 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Pagination.php +244 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Parser.php +173 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Profiler.php +392 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Router.php +389 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Session.php +758 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Sha1.php +251 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Table.php +440 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Trackback.php +547 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Typography.php +406 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/URI.php +586 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Unit_test.php +347 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Upload.php +970 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/User_agent.php +502 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Validation.php +875 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Xmlrpc.php +1421 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Xmlrpcs.php +536 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Zip.php +359 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/index.html +10 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/logs/index.html +10 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/plugins/captcha_pi.php +356 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/plugins/index.html +10 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/plugins/js_calendar_pi.php +629 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/scaffolding/Scaffolding.php +291 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/scaffolding/images/background.jpg +0 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/scaffolding/images/index.html +10 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/scaffolding/images/logo.jpg +0 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/scaffolding/index.html +10 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/scaffolding/views/add.php +32 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/scaffolding/views/delete.php +9 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/scaffolding/views/edit.php +33 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/scaffolding/views/footer.php +10 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/scaffolding/views/header.php +29 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/scaffolding/views/index.html +10 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/scaffolding/views/no_data.php +8 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/scaffolding/views/stylesheet.css +143 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/scaffolding/views/view.php +27 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/changelog.html +1080 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/database/active_record.html +757 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/database/caching.html +220 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/database/call_function.html +118 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/database/configuration.html +157 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/database/connecting.html +186 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/database/examples.html +217 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/database/fields.html +163 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/database/forge.html +234 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/database/helpers.html +151 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/database/index.html +99 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/database/queries.html +153 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/database/results.html +238 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/database/table_data.html +113 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/database/transactions.html +200 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/database/utilities.html +295 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/doc_style/index.html +86 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/doc_style/template.html +128 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/general/alternative_php.html +147 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/general/ancillary_classes.html +117 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/general/autoloader.html +101 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/general/caching.html +115 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/general/common_functions.html +119 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/general/controllers.html +385 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/general/core_classes.html +185 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/general/creating_libraries.html +298 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/general/credits.html +86 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/general/errors.html +138 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/general/helpers.html +185 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/general/hooks.html +167 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/general/libraries.html +94 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/general/managing_apps.html +133 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/general/models.html +251 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/general/plugins.html +127 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/general/profiling.html +104 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/general/quick_reference.html +77 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/general/requirements.html +82 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/general/reserved_names.html +156 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/general/routing.html +176 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/general/scaffolding.html +147 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/general/security.html +153 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/general/styleguide.html +687 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/general/urls.html +151 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/general/views.html +274 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/helpers/array_helper.html +119 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/helpers/compatibility_helper.html +118 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/helpers/cookie_helper.html +147 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/helpers/date_helper.html +408 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/helpers/directory_helper.html +143 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/helpers/download_helper.html +112 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/helpers/email_helper.html +102 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/helpers/file_helper.html +178 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/helpers/form_helper.html +484 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/helpers/html_helper.html +385 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/helpers/inflector_helper.html +151 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/helpers/language_helper.html +98 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/helpers/number_helper.html +107 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/helpers/path_helper.html +106 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/helpers/security_helper.html +125 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/helpers/smiley_helper.html +215 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/helpers/string_helper.html +176 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/helpers/text_helper.html +192 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/helpers/typography_helper.html +112 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/helpers/url_helper.html +289 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/helpers/xml_helper.html +105 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/images/appflowchart.gif +0 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/images/arrow.gif +0 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/images/ci_logo.jpg +0 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/images/ci_logo_flame.jpg +0 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/images/ci_quick_ref.png +0 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/images/codeigniter_1.7.1_helper_reference.pdf +0 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/images/codeigniter_1.7.1_helper_reference.png +0 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/images/codeigniter_1.7.1_library_reference.pdf +0 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/images/codeigniter_1.7.1_library_reference.png +0 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/images/file.gif +0 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/images/folder.gif +0 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/images/nav_bg_darker.jpg +0 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/images/nav_separator_darker.jpg +0 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/images/nav_toggle_darker.jpg +0 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/images/smile.gif +0 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/images/transparent.gif +0 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/index.html +99 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/installation/downloads.html +105 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/installation/index.html +97 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/installation/troubleshooting.html +90 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/installation/upgrade_120.html +92 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/installation/upgrade_130.html +203 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/installation/upgrade_131.html +102 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/installation/upgrade_132.html +100 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/installation/upgrade_133.html +112 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/installation/upgrade_140.html +145 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/installation/upgrade_141.html +148 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/installation/upgrade_150.html +178 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/installation/upgrade_152.html +111 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/installation/upgrade_153.html +100 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/installation/upgrade_154.html +116 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/installation/upgrade_160.html +125 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/installation/upgrade_161.html +98 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/installation/upgrade_162.html +106 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/installation/upgrade_163.html +99 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/installation/upgrade_170.html +121 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/installation/upgrade_171.html +98 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/installation/upgrade_172.html +105 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/installation/upgrade_b11.html +144 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/installation/upgrading.html +101 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/libraries/benchmark.html +198 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/libraries/calendar.html +249 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/libraries/cart.html +346 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/libraries/config.html +181 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/libraries/email.html +307 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/libraries/encryption.html +182 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/libraries/file_uploading.html +451 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/libraries/form_validation.html +1221 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/libraries/ftp.html +303 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/libraries/image_lib.html +666 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/libraries/input.html +231 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/libraries/language.html +137 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/libraries/loader.html +214 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/libraries/output.html +145 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/libraries/pagination.html +218 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/libraries/parser.html +208 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/libraries/sessions.html +311 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/libraries/table.html +292 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/libraries/trackback.html +246 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/libraries/typography.html +160 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/libraries/unit_testing.html +205 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/libraries/uri.html +252 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/libraries/user_agent.html +201 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/libraries/validation.html +740 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/libraries/xmlrpc.html +517 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/libraries/zip.html +278 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/license.html +107 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/nav/hacks.txt +9 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/nav/moo.fx.js +119 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/nav/moo.fx.pack.js +241 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/nav/nav.js +139 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/nav/prototype.lite.js +127 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/nav/user_guide_menu.js +4 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/overview/appflow.html +95 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/overview/at_a_glance.html +172 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/overview/cheatsheets.html +83 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/overview/features.html +120 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/overview/getting_started.html +92 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/overview/goals.html +98 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/overview/index.html +84 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/overview/mvc.html +100 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/toc.html +209 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/userguide.css +406 -0
- data/generators/ci_app/templates/README +1 -0
- data/generators/ci_controller/USAGE +2 -0
- data/generators/ci_controller/ci_controller_generator.rb +11 -0
- data/generators/ci_controller/templates/ci_controller.php.erb +15 -0
- data/generators/ci_controller/templates/ci_view.php.erb +8 -0
- data/generators/ci_layout/USAGE +2 -0
- data/generators/ci_layout/ci_layout_generator.rb +24 -0
- data/generators/ci_layout/templates/application_layout.php.erb +19 -0
- data/generators/ci_model/USAGE +2 -0
- data/generators/ci_model/ci_model_generator.rb +42 -0
- data/generators/ci_model/templates/ci_model.php.erb +15 -0
- data/generators/ci_model/templates/model.rb +5 -0
- data/generators/ci_model/templates/model_migration.rb.erb +16 -0
- data/init.rb +1 -0
- data/install.rb +1 -0
- data/lib/codeigniter_vender.rb +1 -0
- data/lib/tasks/app.rake +8 -0
- data/test/codeigniter_vender_test.rb +8 -0
- data/test/test_helper.rb +3 -0
- data/uninstall.rb +1 -0
- metadata +411 -0
@@ -0,0 +1,970 @@
|
|
1
|
+
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
2
|
+
/**
|
3
|
+
* CodeIgniter
|
4
|
+
*
|
5
|
+
* An open source application development framework for PHP 4.3.2 or newer
|
6
|
+
*
|
7
|
+
* @package CodeIgniter
|
8
|
+
* @author ExpressionEngine Dev Team
|
9
|
+
* @copyright Copyright (c) 2008 - 2010, EllisLab, Inc.
|
10
|
+
* @license http://codeigniter.com/user_guide/license.html
|
11
|
+
* @link http://codeigniter.com
|
12
|
+
* @since Version 1.0
|
13
|
+
* @filesource
|
14
|
+
*/
|
15
|
+
|
16
|
+
// ------------------------------------------------------------------------
|
17
|
+
|
18
|
+
/**
|
19
|
+
* File Uploading Class
|
20
|
+
*
|
21
|
+
* @package CodeIgniter
|
22
|
+
* @subpackage Libraries
|
23
|
+
* @category Uploads
|
24
|
+
* @author ExpressionEngine Dev Team
|
25
|
+
* @link http://codeigniter.com/user_guide/libraries/file_uploading.html
|
26
|
+
*/
|
27
|
+
class CI_Upload {
|
28
|
+
|
29
|
+
var $max_size = 0;
|
30
|
+
var $max_width = 0;
|
31
|
+
var $max_height = 0;
|
32
|
+
var $max_filename = 0;
|
33
|
+
var $allowed_types = "";
|
34
|
+
var $file_temp = "";
|
35
|
+
var $file_name = "";
|
36
|
+
var $orig_name = "";
|
37
|
+
var $file_type = "";
|
38
|
+
var $file_size = "";
|
39
|
+
var $file_ext = "";
|
40
|
+
var $upload_path = "";
|
41
|
+
var $overwrite = FALSE;
|
42
|
+
var $encrypt_name = FALSE;
|
43
|
+
var $is_image = FALSE;
|
44
|
+
var $image_width = '';
|
45
|
+
var $image_height = '';
|
46
|
+
var $image_type = '';
|
47
|
+
var $image_size_str = '';
|
48
|
+
var $error_msg = array();
|
49
|
+
var $mimes = array();
|
50
|
+
var $remove_spaces = TRUE;
|
51
|
+
var $xss_clean = FALSE;
|
52
|
+
var $temp_prefix = "temp_file_";
|
53
|
+
var $client_name = '';
|
54
|
+
|
55
|
+
var $_file_name_override = '';
|
56
|
+
/**
|
57
|
+
* Constructor
|
58
|
+
*
|
59
|
+
* @access public
|
60
|
+
*/
|
61
|
+
function CI_Upload($props = array())
|
62
|
+
{
|
63
|
+
if (count($props) > 0)
|
64
|
+
{
|
65
|
+
$this->initialize($props);
|
66
|
+
}
|
67
|
+
|
68
|
+
log_message('debug', "Upload Class Initialized");
|
69
|
+
}
|
70
|
+
|
71
|
+
// --------------------------------------------------------------------
|
72
|
+
|
73
|
+
/**
|
74
|
+
* Initialize preferences
|
75
|
+
*
|
76
|
+
* @access public
|
77
|
+
* @param array
|
78
|
+
* @return void
|
79
|
+
*/
|
80
|
+
function initialize($config = array())
|
81
|
+
{
|
82
|
+
$defaults = array(
|
83
|
+
'max_size' => 0,
|
84
|
+
'max_width' => 0,
|
85
|
+
'max_height' => 0,
|
86
|
+
'max_filename' => 0,
|
87
|
+
'allowed_types' => "",
|
88
|
+
'file_temp' => "",
|
89
|
+
'file_name' => "",
|
90
|
+
'orig_name' => "",
|
91
|
+
'file_type' => "",
|
92
|
+
'file_size' => "",
|
93
|
+
'file_ext' => "",
|
94
|
+
'upload_path' => "",
|
95
|
+
'overwrite' => FALSE,
|
96
|
+
'encrypt_name' => FALSE,
|
97
|
+
'is_image' => FALSE,
|
98
|
+
'image_width' => '',
|
99
|
+
'image_height' => '',
|
100
|
+
'image_type' => '',
|
101
|
+
'image_size_str' => '',
|
102
|
+
'error_msg' => array(),
|
103
|
+
'mimes' => array(),
|
104
|
+
'remove_spaces' => TRUE,
|
105
|
+
'xss_clean' => FALSE,
|
106
|
+
'temp_prefix' => "temp_file_",
|
107
|
+
'client_name' => ''
|
108
|
+
);
|
109
|
+
|
110
|
+
|
111
|
+
foreach ($defaults as $key => $val)
|
112
|
+
{
|
113
|
+
if (isset($config[$key]))
|
114
|
+
{
|
115
|
+
$method = 'set_'.$key;
|
116
|
+
if (method_exists($this, $method))
|
117
|
+
{
|
118
|
+
$this->$method($config[$key]);
|
119
|
+
}
|
120
|
+
else
|
121
|
+
{
|
122
|
+
$this->$key = $config[$key];
|
123
|
+
}
|
124
|
+
}
|
125
|
+
else
|
126
|
+
{
|
127
|
+
$this->$key = $val;
|
128
|
+
}
|
129
|
+
}
|
130
|
+
|
131
|
+
// if a file_name was provided in the config, use it instead of the user input
|
132
|
+
// supplied file name for all uploads until initialized again
|
133
|
+
$this->_file_name_override = $this->file_name;
|
134
|
+
}
|
135
|
+
|
136
|
+
// --------------------------------------------------------------------
|
137
|
+
|
138
|
+
/**
|
139
|
+
* Perform the file upload
|
140
|
+
*
|
141
|
+
* @access public
|
142
|
+
* @return bool
|
143
|
+
*/
|
144
|
+
function do_upload($field = 'userfile')
|
145
|
+
{
|
146
|
+
// Is $_FILES[$field] set? If not, no reason to continue.
|
147
|
+
if ( ! isset($_FILES[$field]))
|
148
|
+
{
|
149
|
+
$this->set_error('upload_no_file_selected');
|
150
|
+
return FALSE;
|
151
|
+
}
|
152
|
+
|
153
|
+
// Is the upload path valid?
|
154
|
+
if ( ! $this->validate_upload_path())
|
155
|
+
{
|
156
|
+
// errors will already be set by validate_upload_path() so just return FALSE
|
157
|
+
return FALSE;
|
158
|
+
}
|
159
|
+
|
160
|
+
// Was the file able to be uploaded? If not, determine the reason why.
|
161
|
+
if ( ! is_uploaded_file($_FILES[$field]['tmp_name']))
|
162
|
+
{
|
163
|
+
$error = ( ! isset($_FILES[$field]['error'])) ? 4 : $_FILES[$field]['error'];
|
164
|
+
|
165
|
+
switch($error)
|
166
|
+
{
|
167
|
+
case 1: // UPLOAD_ERR_INI_SIZE
|
168
|
+
$this->set_error('upload_file_exceeds_limit');
|
169
|
+
break;
|
170
|
+
case 2: // UPLOAD_ERR_FORM_SIZE
|
171
|
+
$this->set_error('upload_file_exceeds_form_limit');
|
172
|
+
break;
|
173
|
+
case 3: // UPLOAD_ERR_PARTIAL
|
174
|
+
$this->set_error('upload_file_partial');
|
175
|
+
break;
|
176
|
+
case 4: // UPLOAD_ERR_NO_FILE
|
177
|
+
$this->set_error('upload_no_file_selected');
|
178
|
+
break;
|
179
|
+
case 6: // UPLOAD_ERR_NO_TMP_DIR
|
180
|
+
$this->set_error('upload_no_temp_directory');
|
181
|
+
break;
|
182
|
+
case 7: // UPLOAD_ERR_CANT_WRITE
|
183
|
+
$this->set_error('upload_unable_to_write_file');
|
184
|
+
break;
|
185
|
+
case 8: // UPLOAD_ERR_EXTENSION
|
186
|
+
$this->set_error('upload_stopped_by_extension');
|
187
|
+
break;
|
188
|
+
default : $this->set_error('upload_no_file_selected');
|
189
|
+
break;
|
190
|
+
}
|
191
|
+
|
192
|
+
return FALSE;
|
193
|
+
}
|
194
|
+
|
195
|
+
// Set the uploaded data as class variables
|
196
|
+
$this->file_temp = $_FILES[$field]['tmp_name'];
|
197
|
+
$this->file_size = $_FILES[$field]['size'];
|
198
|
+
$this->file_type = preg_replace("/^(.+?);.*$/", "\\1", $_FILES[$field]['type']);
|
199
|
+
$this->file_type = strtolower(trim(stripslashes($this->file_type), '"'));
|
200
|
+
$this->file_name = $this->_prep_filename($_FILES[$field]['name']);
|
201
|
+
$this->file_ext = $this->get_extension($this->file_name);
|
202
|
+
$this->client_name = $this->file_name;
|
203
|
+
|
204
|
+
// Is the file type allowed to be uploaded?
|
205
|
+
if ( ! $this->is_allowed_filetype())
|
206
|
+
{
|
207
|
+
$this->set_error('upload_invalid_filetype');
|
208
|
+
return FALSE;
|
209
|
+
}
|
210
|
+
|
211
|
+
// if we're overriding, let's now make sure the new name and type is allowed
|
212
|
+
if ($this->_file_name_override != '')
|
213
|
+
{
|
214
|
+
$this->file_name = $this->_prep_filename($this->_file_name_override);
|
215
|
+
$this->file_ext = $this->get_extension($this->file_name);
|
216
|
+
|
217
|
+
if ( ! $this->is_allowed_filetype(TRUE))
|
218
|
+
{
|
219
|
+
$this->set_error('upload_invalid_filetype');
|
220
|
+
return FALSE;
|
221
|
+
}
|
222
|
+
}
|
223
|
+
|
224
|
+
// Convert the file size to kilobytes
|
225
|
+
if ($this->file_size > 0)
|
226
|
+
{
|
227
|
+
$this->file_size = round($this->file_size/1024, 2);
|
228
|
+
}
|
229
|
+
|
230
|
+
// Is the file size within the allowed maximum?
|
231
|
+
if ( ! $this->is_allowed_filesize())
|
232
|
+
{
|
233
|
+
$this->set_error('upload_invalid_filesize');
|
234
|
+
return FALSE;
|
235
|
+
}
|
236
|
+
|
237
|
+
// Are the image dimensions within the allowed size?
|
238
|
+
// Note: This can fail if the server has an open_basdir restriction.
|
239
|
+
if ( ! $this->is_allowed_dimensions())
|
240
|
+
{
|
241
|
+
$this->set_error('upload_invalid_dimensions');
|
242
|
+
return FALSE;
|
243
|
+
}
|
244
|
+
|
245
|
+
// Sanitize the file name for security
|
246
|
+
$this->file_name = $this->clean_file_name($this->file_name);
|
247
|
+
|
248
|
+
// Truncate the file name if it's too long
|
249
|
+
if ($this->max_filename > 0)
|
250
|
+
{
|
251
|
+
$this->file_name = $this->limit_filename_length($this->file_name, $this->max_filename);
|
252
|
+
}
|
253
|
+
|
254
|
+
// Remove white spaces in the name
|
255
|
+
if ($this->remove_spaces == TRUE)
|
256
|
+
{
|
257
|
+
$this->file_name = preg_replace("/\s+/", "_", $this->file_name);
|
258
|
+
}
|
259
|
+
|
260
|
+
/*
|
261
|
+
* Validate the file name
|
262
|
+
* This function appends an number onto the end of
|
263
|
+
* the file if one with the same name already exists.
|
264
|
+
* If it returns false there was a problem.
|
265
|
+
*/
|
266
|
+
$this->orig_name = $this->file_name;
|
267
|
+
|
268
|
+
if ($this->overwrite == FALSE)
|
269
|
+
{
|
270
|
+
$this->file_name = $this->set_filename($this->upload_path, $this->file_name);
|
271
|
+
|
272
|
+
if ($this->file_name === FALSE)
|
273
|
+
{
|
274
|
+
return FALSE;
|
275
|
+
}
|
276
|
+
}
|
277
|
+
|
278
|
+
/*
|
279
|
+
* Move the file to the final destination
|
280
|
+
* To deal with different server configurations
|
281
|
+
* we'll attempt to use copy() first. If that fails
|
282
|
+
* we'll use move_uploaded_file(). One of the two should
|
283
|
+
* reliably work in most environments
|
284
|
+
*/
|
285
|
+
if ( ! @copy($this->file_temp, $this->upload_path.$this->file_name))
|
286
|
+
{
|
287
|
+
if ( ! @move_uploaded_file($this->file_temp, $this->upload_path.$this->file_name))
|
288
|
+
{
|
289
|
+
$this->set_error('upload_destination_error');
|
290
|
+
return FALSE;
|
291
|
+
}
|
292
|
+
}
|
293
|
+
|
294
|
+
/*
|
295
|
+
* Run the file through the XSS hacking filter
|
296
|
+
* This helps prevent malicious code from being
|
297
|
+
* embedded within a file. Scripts can easily
|
298
|
+
* be disguised as images or other file types.
|
299
|
+
*/
|
300
|
+
if ($this->xss_clean == TRUE)
|
301
|
+
{
|
302
|
+
$this->do_xss_clean();
|
303
|
+
}
|
304
|
+
|
305
|
+
/*
|
306
|
+
* Set the finalized image dimensions
|
307
|
+
* This sets the image width/height (assuming the
|
308
|
+
* file was an image). We use this information
|
309
|
+
* in the "data" function.
|
310
|
+
*/
|
311
|
+
$this->set_image_properties($this->upload_path.$this->file_name);
|
312
|
+
|
313
|
+
return TRUE;
|
314
|
+
}
|
315
|
+
|
316
|
+
// --------------------------------------------------------------------
|
317
|
+
|
318
|
+
/**
|
319
|
+
* Finalized Data Array
|
320
|
+
*
|
321
|
+
* Returns an associative array containing all of the information
|
322
|
+
* related to the upload, allowing the developer easy access in one array.
|
323
|
+
*
|
324
|
+
* @access public
|
325
|
+
* @return array
|
326
|
+
*/
|
327
|
+
function data()
|
328
|
+
{
|
329
|
+
return array (
|
330
|
+
'file_name' => $this->file_name,
|
331
|
+
'file_type' => $this->file_type,
|
332
|
+
'file_path' => $this->upload_path,
|
333
|
+
'full_path' => $this->upload_path.$this->file_name,
|
334
|
+
'raw_name' => str_replace($this->file_ext, '', $this->file_name),
|
335
|
+
'orig_name' => $this->orig_name,
|
336
|
+
'client_name' => $this->client_name,
|
337
|
+
'file_ext' => $this->file_ext,
|
338
|
+
'file_size' => $this->file_size,
|
339
|
+
'is_image' => $this->is_image(),
|
340
|
+
'image_width' => $this->image_width,
|
341
|
+
'image_height' => $this->image_height,
|
342
|
+
'image_type' => $this->image_type,
|
343
|
+
'image_size_str' => $this->image_size_str,
|
344
|
+
);
|
345
|
+
}
|
346
|
+
|
347
|
+
// --------------------------------------------------------------------
|
348
|
+
|
349
|
+
/**
|
350
|
+
* Set Upload Path
|
351
|
+
*
|
352
|
+
* @access public
|
353
|
+
* @param string
|
354
|
+
* @return void
|
355
|
+
*/
|
356
|
+
function set_upload_path($path)
|
357
|
+
{
|
358
|
+
// Make sure it has a trailing slash
|
359
|
+
$this->upload_path = rtrim($path, '/').'/';
|
360
|
+
}
|
361
|
+
|
362
|
+
// --------------------------------------------------------------------
|
363
|
+
|
364
|
+
/**
|
365
|
+
* Set the file name
|
366
|
+
*
|
367
|
+
* This function takes a filename/path as input and looks for the
|
368
|
+
* existence of a file with the same name. If found, it will append a
|
369
|
+
* number to the end of the filename to avoid overwriting a pre-existing file.
|
370
|
+
*
|
371
|
+
* @access public
|
372
|
+
* @param string
|
373
|
+
* @param string
|
374
|
+
* @return string
|
375
|
+
*/
|
376
|
+
function set_filename($path, $filename)
|
377
|
+
{
|
378
|
+
if ($this->encrypt_name == TRUE)
|
379
|
+
{
|
380
|
+
mt_srand();
|
381
|
+
$filename = md5(uniqid(mt_rand())).$this->file_ext;
|
382
|
+
}
|
383
|
+
|
384
|
+
if ( ! file_exists($path.$filename))
|
385
|
+
{
|
386
|
+
return $filename;
|
387
|
+
}
|
388
|
+
|
389
|
+
$filename = str_replace($this->file_ext, '', $filename);
|
390
|
+
|
391
|
+
$new_filename = '';
|
392
|
+
for ($i = 1; $i < 100; $i++)
|
393
|
+
{
|
394
|
+
if ( ! file_exists($path.$filename.$i.$this->file_ext))
|
395
|
+
{
|
396
|
+
$new_filename = $filename.$i.$this->file_ext;
|
397
|
+
break;
|
398
|
+
}
|
399
|
+
}
|
400
|
+
|
401
|
+
if ($new_filename == '')
|
402
|
+
{
|
403
|
+
$this->set_error('upload_bad_filename');
|
404
|
+
return FALSE;
|
405
|
+
}
|
406
|
+
else
|
407
|
+
{
|
408
|
+
return $new_filename;
|
409
|
+
}
|
410
|
+
}
|
411
|
+
|
412
|
+
// --------------------------------------------------------------------
|
413
|
+
|
414
|
+
/**
|
415
|
+
* Set Maximum File Size
|
416
|
+
*
|
417
|
+
* @access public
|
418
|
+
* @param integer
|
419
|
+
* @return void
|
420
|
+
*/
|
421
|
+
function set_max_filesize($n)
|
422
|
+
{
|
423
|
+
$this->max_size = ((int) $n < 0) ? 0: (int) $n;
|
424
|
+
}
|
425
|
+
|
426
|
+
// --------------------------------------------------------------------
|
427
|
+
|
428
|
+
/**
|
429
|
+
* Set Maximum File Name Length
|
430
|
+
*
|
431
|
+
* @access public
|
432
|
+
* @param integer
|
433
|
+
* @return void
|
434
|
+
*/
|
435
|
+
function set_max_filename($n)
|
436
|
+
{
|
437
|
+
$this->max_filename = ((int) $n < 0) ? 0: (int) $n;
|
438
|
+
}
|
439
|
+
|
440
|
+
// --------------------------------------------------------------------
|
441
|
+
|
442
|
+
/**
|
443
|
+
* Set Maximum Image Width
|
444
|
+
*
|
445
|
+
* @access public
|
446
|
+
* @param integer
|
447
|
+
* @return void
|
448
|
+
*/
|
449
|
+
function set_max_width($n)
|
450
|
+
{
|
451
|
+
$this->max_width = ((int) $n < 0) ? 0: (int) $n;
|
452
|
+
}
|
453
|
+
|
454
|
+
// --------------------------------------------------------------------
|
455
|
+
|
456
|
+
/**
|
457
|
+
* Set Maximum Image Height
|
458
|
+
*
|
459
|
+
* @access public
|
460
|
+
* @param integer
|
461
|
+
* @return void
|
462
|
+
*/
|
463
|
+
function set_max_height($n)
|
464
|
+
{
|
465
|
+
$this->max_height = ((int) $n < 0) ? 0: (int) $n;
|
466
|
+
}
|
467
|
+
|
468
|
+
// --------------------------------------------------------------------
|
469
|
+
|
470
|
+
/**
|
471
|
+
* Set Allowed File Types
|
472
|
+
*
|
473
|
+
* @access public
|
474
|
+
* @param string
|
475
|
+
* @return void
|
476
|
+
*/
|
477
|
+
function set_allowed_types($types)
|
478
|
+
{
|
479
|
+
$this->allowed_types = explode('|', $types);
|
480
|
+
}
|
481
|
+
|
482
|
+
// --------------------------------------------------------------------
|
483
|
+
|
484
|
+
/**
|
485
|
+
* Set Image Properties
|
486
|
+
*
|
487
|
+
* Uses GD to determine the width/height/type of image
|
488
|
+
*
|
489
|
+
* @access public
|
490
|
+
* @param string
|
491
|
+
* @return void
|
492
|
+
*/
|
493
|
+
function set_image_properties($path = '')
|
494
|
+
{
|
495
|
+
if ( ! $this->is_image())
|
496
|
+
{
|
497
|
+
return;
|
498
|
+
}
|
499
|
+
|
500
|
+
if (function_exists('getimagesize'))
|
501
|
+
{
|
502
|
+
if (FALSE !== ($D = @getimagesize($path)))
|
503
|
+
{
|
504
|
+
$types = array(1 => 'gif', 2 => 'jpeg', 3 => 'png');
|
505
|
+
|
506
|
+
$this->image_width = $D['0'];
|
507
|
+
$this->image_height = $D['1'];
|
508
|
+
$this->image_type = ( ! isset($types[$D['2']])) ? 'unknown' : $types[$D['2']];
|
509
|
+
$this->image_size_str = $D['3']; // string containing height and width
|
510
|
+
}
|
511
|
+
}
|
512
|
+
}
|
513
|
+
|
514
|
+
// --------------------------------------------------------------------
|
515
|
+
|
516
|
+
/**
|
517
|
+
* Set XSS Clean
|
518
|
+
*
|
519
|
+
* Enables the XSS flag so that the file that was uploaded
|
520
|
+
* will be run through the XSS filter.
|
521
|
+
*
|
522
|
+
* @access public
|
523
|
+
* @param bool
|
524
|
+
* @return void
|
525
|
+
*/
|
526
|
+
function set_xss_clean($flag = FALSE)
|
527
|
+
{
|
528
|
+
$this->xss_clean = ($flag == TRUE) ? TRUE : FALSE;
|
529
|
+
}
|
530
|
+
|
531
|
+
// --------------------------------------------------------------------
|
532
|
+
|
533
|
+
/**
|
534
|
+
* Validate the image
|
535
|
+
*
|
536
|
+
* @access public
|
537
|
+
* @return bool
|
538
|
+
*/
|
539
|
+
function is_image()
|
540
|
+
{
|
541
|
+
// IE will sometimes return odd mime-types during upload, so here we just standardize all
|
542
|
+
// jpegs or pngs to the same file type.
|
543
|
+
|
544
|
+
$png_mimes = array('image/x-png');
|
545
|
+
$jpeg_mimes = array('image/jpg', 'image/jpe', 'image/jpeg', 'image/pjpeg');
|
546
|
+
|
547
|
+
if (in_array($this->file_type, $png_mimes))
|
548
|
+
{
|
549
|
+
$this->file_type = 'image/png';
|
550
|
+
}
|
551
|
+
|
552
|
+
if (in_array($this->file_type, $jpeg_mimes))
|
553
|
+
{
|
554
|
+
$this->file_type = 'image/jpeg';
|
555
|
+
}
|
556
|
+
|
557
|
+
$img_mimes = array(
|
558
|
+
'image/gif',
|
559
|
+
'image/jpeg',
|
560
|
+
'image/png',
|
561
|
+
);
|
562
|
+
|
563
|
+
return (in_array($this->file_type, $img_mimes, TRUE)) ? TRUE : FALSE;
|
564
|
+
}
|
565
|
+
|
566
|
+
// --------------------------------------------------------------------
|
567
|
+
|
568
|
+
/**
|
569
|
+
* Verify that the filetype is allowed
|
570
|
+
*
|
571
|
+
* @access public
|
572
|
+
* @return bool
|
573
|
+
*/
|
574
|
+
function is_allowed_filetype($ignore_mime = FALSE)
|
575
|
+
{
|
576
|
+
if (count($this->allowed_types) == 0 OR ! is_array($this->allowed_types))
|
577
|
+
{
|
578
|
+
$this->set_error('upload_no_file_types');
|
579
|
+
return FALSE;
|
580
|
+
}
|
581
|
+
|
582
|
+
$ext = strtolower(ltrim($this->file_ext, '.'));
|
583
|
+
|
584
|
+
if ( ! in_array($ext, $this->allowed_types))
|
585
|
+
{
|
586
|
+
return FALSE;
|
587
|
+
}
|
588
|
+
|
589
|
+
// Images get some additional checks
|
590
|
+
$image_types = array('gif', 'jpg', 'jpeg', 'png', 'jpe');
|
591
|
+
|
592
|
+
if (in_array($ext, $image_types))
|
593
|
+
{
|
594
|
+
if (getimagesize($this->file_temp) === FALSE)
|
595
|
+
{
|
596
|
+
return FALSE;
|
597
|
+
}
|
598
|
+
}
|
599
|
+
|
600
|
+
if ($ignore_mime === TRUE)
|
601
|
+
{
|
602
|
+
return TRUE;
|
603
|
+
}
|
604
|
+
|
605
|
+
$mime = $this->mimes_types($ext);
|
606
|
+
|
607
|
+
if (is_array($mime))
|
608
|
+
{
|
609
|
+
if (in_array($this->file_type, $mime, TRUE))
|
610
|
+
{
|
611
|
+
return TRUE;
|
612
|
+
}
|
613
|
+
}
|
614
|
+
elseif ($mime == $this->file_type)
|
615
|
+
{
|
616
|
+
return TRUE;
|
617
|
+
}
|
618
|
+
|
619
|
+
return FALSE;
|
620
|
+
}
|
621
|
+
|
622
|
+
// --------------------------------------------------------------------
|
623
|
+
|
624
|
+
/**
|
625
|
+
* Verify that the file is within the allowed size
|
626
|
+
*
|
627
|
+
* @access public
|
628
|
+
* @return bool
|
629
|
+
*/
|
630
|
+
function is_allowed_filesize()
|
631
|
+
{
|
632
|
+
if ($this->max_size != 0 AND $this->file_size > $this->max_size)
|
633
|
+
{
|
634
|
+
return FALSE;
|
635
|
+
}
|
636
|
+
else
|
637
|
+
{
|
638
|
+
return TRUE;
|
639
|
+
}
|
640
|
+
}
|
641
|
+
|
642
|
+
// --------------------------------------------------------------------
|
643
|
+
|
644
|
+
/**
|
645
|
+
* Verify that the image is within the allowed width/height
|
646
|
+
*
|
647
|
+
* @access public
|
648
|
+
* @return bool
|
649
|
+
*/
|
650
|
+
function is_allowed_dimensions()
|
651
|
+
{
|
652
|
+
if ( ! $this->is_image())
|
653
|
+
{
|
654
|
+
return TRUE;
|
655
|
+
}
|
656
|
+
|
657
|
+
if (function_exists('getimagesize'))
|
658
|
+
{
|
659
|
+
$D = @getimagesize($this->file_temp);
|
660
|
+
|
661
|
+
if ($this->max_width > 0 AND $D['0'] > $this->max_width)
|
662
|
+
{
|
663
|
+
return FALSE;
|
664
|
+
}
|
665
|
+
|
666
|
+
if ($this->max_height > 0 AND $D['1'] > $this->max_height)
|
667
|
+
{
|
668
|
+
return FALSE;
|
669
|
+
}
|
670
|
+
|
671
|
+
return TRUE;
|
672
|
+
}
|
673
|
+
|
674
|
+
return TRUE;
|
675
|
+
}
|
676
|
+
|
677
|
+
// --------------------------------------------------------------------
|
678
|
+
|
679
|
+
/**
|
680
|
+
* Validate Upload Path
|
681
|
+
*
|
682
|
+
* Verifies that it is a valid upload path with proper permissions.
|
683
|
+
*
|
684
|
+
*
|
685
|
+
* @access public
|
686
|
+
* @return bool
|
687
|
+
*/
|
688
|
+
function validate_upload_path()
|
689
|
+
{
|
690
|
+
if ($this->upload_path == '')
|
691
|
+
{
|
692
|
+
$this->set_error('upload_no_filepath');
|
693
|
+
return FALSE;
|
694
|
+
}
|
695
|
+
|
696
|
+
if (function_exists('realpath') AND @realpath($this->upload_path) !== FALSE)
|
697
|
+
{
|
698
|
+
$this->upload_path = str_replace("\\", "/", realpath($this->upload_path));
|
699
|
+
}
|
700
|
+
|
701
|
+
if ( ! @is_dir($this->upload_path))
|
702
|
+
{
|
703
|
+
$this->set_error('upload_no_filepath');
|
704
|
+
return FALSE;
|
705
|
+
}
|
706
|
+
|
707
|
+
if ( ! is_really_writable($this->upload_path))
|
708
|
+
{
|
709
|
+
$this->set_error('upload_not_writable');
|
710
|
+
return FALSE;
|
711
|
+
}
|
712
|
+
|
713
|
+
$this->upload_path = preg_replace("/(.+?)\/*$/", "\\1/", $this->upload_path);
|
714
|
+
return TRUE;
|
715
|
+
}
|
716
|
+
|
717
|
+
// --------------------------------------------------------------------
|
718
|
+
|
719
|
+
/**
|
720
|
+
* Extract the file extension
|
721
|
+
*
|
722
|
+
* @access public
|
723
|
+
* @param string
|
724
|
+
* @return string
|
725
|
+
*/
|
726
|
+
function get_extension($filename)
|
727
|
+
{
|
728
|
+
$x = explode('.', $filename);
|
729
|
+
return '.'.end($x);
|
730
|
+
}
|
731
|
+
|
732
|
+
// --------------------------------------------------------------------
|
733
|
+
|
734
|
+
/**
|
735
|
+
* Clean the file name for security
|
736
|
+
*
|
737
|
+
* @access public
|
738
|
+
* @param string
|
739
|
+
* @return string
|
740
|
+
*/
|
741
|
+
function clean_file_name($filename)
|
742
|
+
{
|
743
|
+
$bad = array(
|
744
|
+
"<!--",
|
745
|
+
"-->",
|
746
|
+
"'",
|
747
|
+
"<",
|
748
|
+
">",
|
749
|
+
'"',
|
750
|
+
'&',
|
751
|
+
'$',
|
752
|
+
'=',
|
753
|
+
';',
|
754
|
+
'?',
|
755
|
+
'/',
|
756
|
+
"%20",
|
757
|
+
"%22",
|
758
|
+
"%3c", // <
|
759
|
+
"%253c", // <
|
760
|
+
"%3e", // >
|
761
|
+
"%0e", // >
|
762
|
+
"%28", // (
|
763
|
+
"%29", // )
|
764
|
+
"%2528", // (
|
765
|
+
"%26", // &
|
766
|
+
"%24", // $
|
767
|
+
"%3f", // ?
|
768
|
+
"%3b", // ;
|
769
|
+
"%3d" // =
|
770
|
+
);
|
771
|
+
|
772
|
+
$filename = str_replace($bad, '', $filename);
|
773
|
+
|
774
|
+
return stripslashes($filename);
|
775
|
+
}
|
776
|
+
|
777
|
+
// --------------------------------------------------------------------
|
778
|
+
|
779
|
+
/**
|
780
|
+
* Limit the File Name Length
|
781
|
+
*
|
782
|
+
* @access public
|
783
|
+
* @param string
|
784
|
+
* @return string
|
785
|
+
*/
|
786
|
+
function limit_filename_length($filename, $length)
|
787
|
+
{
|
788
|
+
if (strlen($filename) < $length)
|
789
|
+
{
|
790
|
+
return $filename;
|
791
|
+
}
|
792
|
+
|
793
|
+
$ext = '';
|
794
|
+
if (strpos($filename, '.') !== FALSE)
|
795
|
+
{
|
796
|
+
$parts = explode('.', $filename);
|
797
|
+
$ext = '.'.array_pop($parts);
|
798
|
+
$filename = implode('.', $parts);
|
799
|
+
}
|
800
|
+
|
801
|
+
return substr($filename, 0, ($length - strlen($ext))).$ext;
|
802
|
+
}
|
803
|
+
|
804
|
+
// --------------------------------------------------------------------
|
805
|
+
|
806
|
+
/**
|
807
|
+
* Runs the file through the XSS clean function
|
808
|
+
*
|
809
|
+
* This prevents people from embedding malicious code in their files.
|
810
|
+
* I'm not sure that it won't negatively affect certain files in unexpected ways,
|
811
|
+
* but so far I haven't found that it causes trouble.
|
812
|
+
*
|
813
|
+
* @access public
|
814
|
+
* @return void
|
815
|
+
*/
|
816
|
+
function do_xss_clean()
|
817
|
+
{
|
818
|
+
$file = $this->upload_path.$this->file_name;
|
819
|
+
|
820
|
+
if (filesize($file) == 0)
|
821
|
+
{
|
822
|
+
return FALSE;
|
823
|
+
}
|
824
|
+
|
825
|
+
if (($data = @file_get_contents($file)) === FALSE)
|
826
|
+
{
|
827
|
+
return FALSE;
|
828
|
+
}
|
829
|
+
|
830
|
+
if ( ! $fp = @fopen($file, FOPEN_READ_WRITE))
|
831
|
+
{
|
832
|
+
return FALSE;
|
833
|
+
}
|
834
|
+
|
835
|
+
$CI =& get_instance();
|
836
|
+
$data = $CI->input->xss_clean($data);
|
837
|
+
|
838
|
+
flock($fp, LOCK_EX);
|
839
|
+
fwrite($fp, $data);
|
840
|
+
flock($fp, LOCK_UN);
|
841
|
+
fclose($fp);
|
842
|
+
}
|
843
|
+
|
844
|
+
// --------------------------------------------------------------------
|
845
|
+
|
846
|
+
/**
|
847
|
+
* Set an error message
|
848
|
+
*
|
849
|
+
* @access public
|
850
|
+
* @param string
|
851
|
+
* @return void
|
852
|
+
*/
|
853
|
+
function set_error($msg)
|
854
|
+
{
|
855
|
+
$CI =& get_instance();
|
856
|
+
$CI->lang->load('upload');
|
857
|
+
|
858
|
+
if (is_array($msg))
|
859
|
+
{
|
860
|
+
foreach ($msg as $val)
|
861
|
+
{
|
862
|
+
$msg = ($CI->lang->line($val) == FALSE) ? $val : $CI->lang->line($val);
|
863
|
+
$this->error_msg[] = $msg;
|
864
|
+
log_message('error', $msg);
|
865
|
+
}
|
866
|
+
}
|
867
|
+
else
|
868
|
+
{
|
869
|
+
$msg = ($CI->lang->line($msg) == FALSE) ? $msg : $CI->lang->line($msg);
|
870
|
+
$this->error_msg[] = $msg;
|
871
|
+
log_message('error', $msg);
|
872
|
+
}
|
873
|
+
}
|
874
|
+
|
875
|
+
// --------------------------------------------------------------------
|
876
|
+
|
877
|
+
/**
|
878
|
+
* Display the error message
|
879
|
+
*
|
880
|
+
* @access public
|
881
|
+
* @param string
|
882
|
+
* @param string
|
883
|
+
* @return string
|
884
|
+
*/
|
885
|
+
function display_errors($open = '<p>', $close = '</p>')
|
886
|
+
{
|
887
|
+
$str = '';
|
888
|
+
foreach ($this->error_msg as $val)
|
889
|
+
{
|
890
|
+
$str .= $open.$val.$close;
|
891
|
+
}
|
892
|
+
|
893
|
+
return $str;
|
894
|
+
}
|
895
|
+
|
896
|
+
// --------------------------------------------------------------------
|
897
|
+
|
898
|
+
/**
|
899
|
+
* List of Mime Types
|
900
|
+
*
|
901
|
+
* This is a list of mime types. We use it to validate
|
902
|
+
* the "allowed types" set by the developer
|
903
|
+
*
|
904
|
+
* @access public
|
905
|
+
* @param string
|
906
|
+
* @return string
|
907
|
+
*/
|
908
|
+
function mimes_types($mime)
|
909
|
+
{
|
910
|
+
global $mimes;
|
911
|
+
|
912
|
+
if (count($this->mimes) == 0)
|
913
|
+
{
|
914
|
+
if (@require_once(APPPATH.'config/mimes'.EXT))
|
915
|
+
{
|
916
|
+
$this->mimes = $mimes;
|
917
|
+
unset($mimes);
|
918
|
+
}
|
919
|
+
}
|
920
|
+
|
921
|
+
return ( ! isset($this->mimes[$mime])) ? FALSE : $this->mimes[$mime];
|
922
|
+
}
|
923
|
+
|
924
|
+
// --------------------------------------------------------------------
|
925
|
+
|
926
|
+
/**
|
927
|
+
* Prep Filename
|
928
|
+
*
|
929
|
+
* Prevents possible script execution from Apache's handling of files multiple extensions
|
930
|
+
* http://httpd.apache.org/docs/1.3/mod/mod_mime.html#multipleext
|
931
|
+
*
|
932
|
+
* @access private
|
933
|
+
* @param string
|
934
|
+
* @return string
|
935
|
+
*/
|
936
|
+
function _prep_filename($filename)
|
937
|
+
{
|
938
|
+
if (strpos($filename, '.') === FALSE)
|
939
|
+
{
|
940
|
+
return $filename;
|
941
|
+
}
|
942
|
+
|
943
|
+
$parts = explode('.', $filename);
|
944
|
+
$ext = array_pop($parts);
|
945
|
+
$filename = array_shift($parts);
|
946
|
+
|
947
|
+
foreach ($parts as $part)
|
948
|
+
{
|
949
|
+
if ( ! in_array(strtolower($part), $this->allowed_types) OR $this->mimes_types(strtolower($part)) === FALSE)
|
950
|
+
{
|
951
|
+
$filename .= '.'.$part.'_';
|
952
|
+
}
|
953
|
+
else
|
954
|
+
{
|
955
|
+
$filename .= '.'.$part;
|
956
|
+
}
|
957
|
+
}
|
958
|
+
|
959
|
+
$filename .= '.'.$ext;
|
960
|
+
|
961
|
+
return $filename;
|
962
|
+
}
|
963
|
+
|
964
|
+
// --------------------------------------------------------------------
|
965
|
+
|
966
|
+
}
|
967
|
+
// END Upload Class
|
968
|
+
|
969
|
+
/* End of file Upload.php */
|
970
|
+
/* Location: ./system/libraries/Upload.php */
|