From 06f1e5bb19d2b2d4747e84f2bfa5d50b1770cd3d Mon Sep 17 00:00:00 2001 From: Chuck Scott Date: Thu, 15 Sep 2016 10:02:11 -0400 Subject: [PATCH] initial commit --- activate.php | 51 + classes/serverBandwidthSupport.php | 412 ++ css/admin.css | 409 ++ deactivate.php | 38 + defines.php | 55 + index.php | 151 + lib/Smarty-3.1.21/COPYING.lib | 165 + lib/Smarty-3.1.21/README | 574 +++ lib/Smarty-3.1.21/SMARTY_2_BC_NOTES.txt | 109 + lib/Smarty-3.1.21/SMARTY_3.0_BC_NOTES.txt | 24 + lib/Smarty-3.1.21/SMARTY_3.1_NOTES.txt | 306 ++ lib/Smarty-3.1.21/change_log.txt | 2415 +++++++++ lib/Smarty-3.1.21/demo/configs/test.conf | 5 + lib/Smarty-3.1.21/demo/index.php | 30 + .../demo/plugins/cacheresource.apc.php | 83 + .../demo/plugins/cacheresource.memcache.php | 97 + .../demo/plugins/cacheresource.mysql.php | 162 + .../demo/plugins/resource.extendsall.php | 60 + .../demo/plugins/resource.mysql.php | 81 + .../demo/plugins/resource.mysqls.php | 62 + lib/Smarty-3.1.21/demo/templates/footer.tpl | 2 + lib/Smarty-3.1.21/demo/templates/header.tpl | 5 + lib/Smarty-3.1.21/demo/templates/index.tpl | 87 + lib/Smarty-3.1.21/libs/Smarty.class.php | 1680 ++++++ lib/Smarty-3.1.21/libs/SmartyBC.class.php | 467 ++ lib/Smarty-3.1.21/libs/debug.tpl | 137 + .../libs/plugins/block.textformat.php | 110 + .../libs/plugins/function.counter.php | 78 + .../libs/plugins/function.cycle.php | 107 + .../libs/plugins/function.fetch.php | 221 + .../libs/plugins/function.html_checkboxes.php | 237 + .../libs/plugins/function.html_image.php | 163 + .../libs/plugins/function.html_options.php | 196 + .../libs/plugins/function.html_radios.php | 221 + .../plugins/function.html_select_date.php | 387 ++ .../plugins/function.html_select_time.php | 364 ++ .../libs/plugins/function.html_table.php | 176 + .../libs/plugins/function.mailto.php | 155 + .../libs/plugins/function.math.php | 91 + .../libs/plugins/modifier.capitalize.php | 90 + .../libs/plugins/modifier.date_format.php | 65 + .../libs/plugins/modifier.debug_print_var.php | 104 + .../libs/plugins/modifier.escape.php | 198 + .../libs/plugins/modifier.regex_replace.php | 57 + .../libs/plugins/modifier.replace.php | 34 + .../libs/plugins/modifier.spacify.php | 27 + .../libs/plugins/modifier.truncate.php | 64 + .../libs/plugins/modifiercompiler.cat.php | 29 + .../modifiercompiler.count_characters.php | 32 + .../modifiercompiler.count_paragraphs.php | 27 + .../modifiercompiler.count_sentences.php | 27 + .../plugins/modifiercompiler.count_words.php | 31 + .../libs/plugins/modifiercompiler.default.php | 35 + .../libs/plugins/modifiercompiler.escape.php | 126 + .../plugins/modifiercompiler.from_charset.php | 33 + .../libs/plugins/modifiercompiler.indent.php | 33 + .../libs/plugins/modifiercompiler.lower.php | 31 + .../libs/plugins/modifiercompiler.noprint.php | 21 + .../modifiercompiler.string_format.php | 25 + .../libs/plugins/modifiercompiler.strip.php | 33 + .../plugins/modifiercompiler.strip_tags.php | 29 + .../plugins/modifiercompiler.to_charset.php | 33 + .../plugins/modifiercompiler.unescape.php | 50 + .../libs/plugins/modifiercompiler.upper.php | 29 + .../plugins/modifiercompiler.wordwrap.php | 47 + .../plugins/outputfilter.trimwhitespace.php | 90 + .../plugins/shared.escape_special_chars.php | 53 + .../plugins/shared.literal_compiler_param.php | 35 + .../libs/plugins/shared.make_timestamp.php | 43 + .../libs/plugins/shared.mb_str_replace.php | 55 + .../libs/plugins/shared.mb_unicode.php | 54 + .../libs/plugins/shared.mb_wordwrap.php | 73 + .../variablefilter.htmlspecialchars.php | 19 + .../libs/sysplugins/smarty_cacheresource.php | 442 ++ .../smarty_cacheresource_custom.php | 284 + .../smarty_cacheresource_keyvaluestore.php | 493 ++ .../libs/sysplugins/smarty_config_source.php | 94 + .../smarty_internal_cacheresource_file.php | 297 ++ .../smarty_internal_compile_append.php | 50 + .../smarty_internal_compile_assign.php | 86 + .../smarty_internal_compile_block.php | 444 ++ .../smarty_internal_compile_break.php | 75 + .../smarty_internal_compile_call.php | 127 + .../smarty_internal_compile_capture.php | 96 + .../smarty_internal_compile_config_load.php | 82 + .../smarty_internal_compile_continue.php | 75 + .../smarty_internal_compile_debug.php | 41 + .../smarty_internal_compile_eval.php | 71 + .../smarty_internal_compile_extends.php | 85 + .../smarty_internal_compile_for.php | 145 + .../smarty_internal_compile_foreach.php | 229 + .../smarty_internal_compile_function.php | 162 + .../sysplugins/smarty_internal_compile_if.php | 210 + .../smarty_internal_compile_include.php | 265 + .../smarty_internal_compile_include_php.php | 107 + .../smarty_internal_compile_insert.php | 140 + .../smarty_internal_compile_ldelim.php | 39 + .../smarty_internal_compile_nocache.php | 70 + ..._internal_compile_private_block_plugin.php | 85 + ...ternal_compile_private_function_plugin.php | 71 + ...arty_internal_compile_private_modifier.php | 139 + ..._compile_private_object_block_function.php | 86 + ...ternal_compile_private_object_function.php | 84 + ...ernal_compile_private_print_expression.php | 151 + ...ernal_compile_private_registered_block.php | 111 + ...al_compile_private_registered_function.php | 79 + ...ernal_compile_private_special_variable.php | 114 + .../smarty_internal_compile_rdelim.php | 39 + .../smarty_internal_compile_section.php | 206 + .../smarty_internal_compile_setfilter.php | 70 + .../smarty_internal_compile_while.php | 93 + .../smarty_internal_compilebase.php | 174 + .../sysplugins/smarty_internal_config.php | 306 ++ .../smarty_internal_config_file_compiler.php | 159 + .../smarty_internal_configfilelexer.php | 646 +++ .../smarty_internal_configfileparser.php | 1042 ++++ .../libs/sysplugins/smarty_internal_data.php | 576 +++ .../libs/sysplugins/smarty_internal_debug.php | 254 + .../smarty_internal_filter_handler.php | 67 + .../smarty_internal_function_call_handler.php | 52 + .../smarty_internal_get_include_path.php | 46 + .../smarty_internal_nocache_insert.php | 51 + .../sysplugins/smarty_internal_parsetree.php | 361 ++ .../smarty_internal_resource_eval.php | 96 + .../smarty_internal_resource_extends.php | 112 + .../smarty_internal_resource_file.php | 89 + .../smarty_internal_resource_php.php | 119 + .../smarty_internal_resource_registered.php | 98 + .../smarty_internal_resource_stream.php | 81 + .../smarty_internal_resource_string.php | 97 + ...smarty_internal_smartytemplatecompiler.php | 140 + .../sysplugins/smarty_internal_template.php | 738 +++ .../smarty_internal_templatebase.php | 860 ++++ .../smarty_internal_templatecompilerbase.php | 823 +++ .../smarty_internal_templatelexer.php | 1552 ++++++ .../smarty_internal_templateparser.php | 4568 +++++++++++++++++ .../sysplugins/smarty_internal_utility.php | 837 +++ .../sysplugins/smarty_internal_write_file.php | 86 + .../libs/sysplugins/smarty_resource.php | 912 ++++ .../sysplugins/smarty_resource_custom.php | 95 + .../sysplugins/smarty_resource_recompiled.php | 33 + .../sysplugins/smarty_resource_uncompiled.php | 41 + .../libs/sysplugins/smarty_security.php | 480 ++ .../00_MODIFIED_DONT_UPDATE | 0 lib/phpgraphlib-master/LICENSE.txt | 33 + lib/phpgraphlib-master/README.md | 29 + lib/phpgraphlib-master/composer.json | 11 + lib/phpgraphlib-master/examples/example1.php | 9 + lib/phpgraphlib-master/examples/example10.php | 16 + lib/phpgraphlib-master/examples/example11.php | 36 + lib/phpgraphlib-master/examples/example2.php | 11 + lib/phpgraphlib-master/examples/example3.php | 22 + lib/phpgraphlib-master/examples/example4.php | 20 + lib/phpgraphlib-master/examples/example5.php | 13 + lib/phpgraphlib-master/examples/example6.php | 17 + lib/phpgraphlib-master/examples/example7.php | 18 + lib/phpgraphlib-master/examples/example8.php | 11 + lib/phpgraphlib-master/examples/example9.php | 19 + lib/phpgraphlib-master/examples/index.html | 94 + lib/phpgraphlib-master/phpgraphlib.php | 1663 ++++++ lib/phpgraphlib-master/phpgraphlib_pie.php | 383 ++ .../phpgraphlib_stacked.php | 213 + lib/smartyTemplateSupport.php | 105 + ...e8a6603e49a.file.adminServerStats.html.php | 29 + ...0d4cf.file.adminServerStatsConfig.html.php | 121 + ...3a7a0811e948cca0c2472.file.footer.html.php | 39 + ...570b445d05711f940888b.file.header.html.php | 26 + ...fb8.file.adminServerStatsAllSites.html.php | 29 + models/adminServerStats.php | 57 + models/adminServerStatsAllSites.php | 58 + models/adminServerStatsConfig.php | 135 + models/ajaxServerBandwidthGraphs.php | 163 + readme.txt | 28 + setup/adminMenus.php | 51 + setup/standardTemplateParams.php | 27 + uninstall.php | 27 + views/adminServerStats.html | 5 + views/adminServerStatsAllSites.html | 5 + views/adminServerStatsConfig.html | 73 + views/footer.html | 11 + views/header.html | 4 + 181 files changed, 36644 insertions(+) create mode 100644 activate.php create mode 100644 classes/serverBandwidthSupport.php create mode 100644 css/admin.css create mode 100644 deactivate.php create mode 100644 defines.php create mode 100644 index.php create mode 100644 lib/Smarty-3.1.21/COPYING.lib create mode 100644 lib/Smarty-3.1.21/README create mode 100644 lib/Smarty-3.1.21/SMARTY_2_BC_NOTES.txt create mode 100644 lib/Smarty-3.1.21/SMARTY_3.0_BC_NOTES.txt create mode 100644 lib/Smarty-3.1.21/SMARTY_3.1_NOTES.txt create mode 100644 lib/Smarty-3.1.21/change_log.txt create mode 100644 lib/Smarty-3.1.21/demo/configs/test.conf create mode 100644 lib/Smarty-3.1.21/demo/index.php create mode 100644 lib/Smarty-3.1.21/demo/plugins/cacheresource.apc.php create mode 100644 lib/Smarty-3.1.21/demo/plugins/cacheresource.memcache.php create mode 100644 lib/Smarty-3.1.21/demo/plugins/cacheresource.mysql.php create mode 100644 lib/Smarty-3.1.21/demo/plugins/resource.extendsall.php create mode 100644 lib/Smarty-3.1.21/demo/plugins/resource.mysql.php create mode 100644 lib/Smarty-3.1.21/demo/plugins/resource.mysqls.php create mode 100644 lib/Smarty-3.1.21/demo/templates/footer.tpl create mode 100644 lib/Smarty-3.1.21/demo/templates/header.tpl create mode 100644 lib/Smarty-3.1.21/demo/templates/index.tpl create mode 100644 lib/Smarty-3.1.21/libs/Smarty.class.php create mode 100644 lib/Smarty-3.1.21/libs/SmartyBC.class.php create mode 100644 lib/Smarty-3.1.21/libs/debug.tpl create mode 100644 lib/Smarty-3.1.21/libs/plugins/block.textformat.php create mode 100644 lib/Smarty-3.1.21/libs/plugins/function.counter.php create mode 100644 lib/Smarty-3.1.21/libs/plugins/function.cycle.php create mode 100644 lib/Smarty-3.1.21/libs/plugins/function.fetch.php create mode 100644 lib/Smarty-3.1.21/libs/plugins/function.html_checkboxes.php create mode 100644 lib/Smarty-3.1.21/libs/plugins/function.html_image.php create mode 100644 lib/Smarty-3.1.21/libs/plugins/function.html_options.php create mode 100644 lib/Smarty-3.1.21/libs/plugins/function.html_radios.php create mode 100644 lib/Smarty-3.1.21/libs/plugins/function.html_select_date.php create mode 100644 lib/Smarty-3.1.21/libs/plugins/function.html_select_time.php create mode 100644 lib/Smarty-3.1.21/libs/plugins/function.html_table.php create mode 100644 lib/Smarty-3.1.21/libs/plugins/function.mailto.php create mode 100644 lib/Smarty-3.1.21/libs/plugins/function.math.php create mode 100644 lib/Smarty-3.1.21/libs/plugins/modifier.capitalize.php create mode 100644 lib/Smarty-3.1.21/libs/plugins/modifier.date_format.php create mode 100644 lib/Smarty-3.1.21/libs/plugins/modifier.debug_print_var.php create mode 100644 lib/Smarty-3.1.21/libs/plugins/modifier.escape.php create mode 100644 lib/Smarty-3.1.21/libs/plugins/modifier.regex_replace.php create mode 100644 lib/Smarty-3.1.21/libs/plugins/modifier.replace.php create mode 100644 lib/Smarty-3.1.21/libs/plugins/modifier.spacify.php create mode 100644 lib/Smarty-3.1.21/libs/plugins/modifier.truncate.php create mode 100644 lib/Smarty-3.1.21/libs/plugins/modifiercompiler.cat.php create mode 100644 lib/Smarty-3.1.21/libs/plugins/modifiercompiler.count_characters.php create mode 100644 lib/Smarty-3.1.21/libs/plugins/modifiercompiler.count_paragraphs.php create mode 100644 lib/Smarty-3.1.21/libs/plugins/modifiercompiler.count_sentences.php create mode 100644 lib/Smarty-3.1.21/libs/plugins/modifiercompiler.count_words.php create mode 100644 lib/Smarty-3.1.21/libs/plugins/modifiercompiler.default.php create mode 100644 lib/Smarty-3.1.21/libs/plugins/modifiercompiler.escape.php create mode 100644 lib/Smarty-3.1.21/libs/plugins/modifiercompiler.from_charset.php create mode 100644 lib/Smarty-3.1.21/libs/plugins/modifiercompiler.indent.php create mode 100644 lib/Smarty-3.1.21/libs/plugins/modifiercompiler.lower.php create mode 100644 lib/Smarty-3.1.21/libs/plugins/modifiercompiler.noprint.php create mode 100644 lib/Smarty-3.1.21/libs/plugins/modifiercompiler.string_format.php create mode 100644 lib/Smarty-3.1.21/libs/plugins/modifiercompiler.strip.php create mode 100644 lib/Smarty-3.1.21/libs/plugins/modifiercompiler.strip_tags.php create mode 100644 lib/Smarty-3.1.21/libs/plugins/modifiercompiler.to_charset.php create mode 100644 lib/Smarty-3.1.21/libs/plugins/modifiercompiler.unescape.php create mode 100644 lib/Smarty-3.1.21/libs/plugins/modifiercompiler.upper.php create mode 100644 lib/Smarty-3.1.21/libs/plugins/modifiercompiler.wordwrap.php create mode 100644 lib/Smarty-3.1.21/libs/plugins/outputfilter.trimwhitespace.php create mode 100644 lib/Smarty-3.1.21/libs/plugins/shared.escape_special_chars.php create mode 100644 lib/Smarty-3.1.21/libs/plugins/shared.literal_compiler_param.php create mode 100644 lib/Smarty-3.1.21/libs/plugins/shared.make_timestamp.php create mode 100644 lib/Smarty-3.1.21/libs/plugins/shared.mb_str_replace.php create mode 100644 lib/Smarty-3.1.21/libs/plugins/shared.mb_unicode.php create mode 100644 lib/Smarty-3.1.21/libs/plugins/shared.mb_wordwrap.php create mode 100644 lib/Smarty-3.1.21/libs/plugins/variablefilter.htmlspecialchars.php create mode 100644 lib/Smarty-3.1.21/libs/sysplugins/smarty_cacheresource.php create mode 100644 lib/Smarty-3.1.21/libs/sysplugins/smarty_cacheresource_custom.php create mode 100644 lib/Smarty-3.1.21/libs/sysplugins/smarty_cacheresource_keyvaluestore.php create mode 100644 lib/Smarty-3.1.21/libs/sysplugins/smarty_config_source.php create mode 100644 lib/Smarty-3.1.21/libs/sysplugins/smarty_internal_cacheresource_file.php create mode 100644 lib/Smarty-3.1.21/libs/sysplugins/smarty_internal_compile_append.php create mode 100644 lib/Smarty-3.1.21/libs/sysplugins/smarty_internal_compile_assign.php create mode 100644 lib/Smarty-3.1.21/libs/sysplugins/smarty_internal_compile_block.php create mode 100644 lib/Smarty-3.1.21/libs/sysplugins/smarty_internal_compile_break.php create mode 100644 lib/Smarty-3.1.21/libs/sysplugins/smarty_internal_compile_call.php create mode 100644 lib/Smarty-3.1.21/libs/sysplugins/smarty_internal_compile_capture.php create mode 100644 lib/Smarty-3.1.21/libs/sysplugins/smarty_internal_compile_config_load.php create mode 100644 lib/Smarty-3.1.21/libs/sysplugins/smarty_internal_compile_continue.php create mode 100644 lib/Smarty-3.1.21/libs/sysplugins/smarty_internal_compile_debug.php create mode 100644 lib/Smarty-3.1.21/libs/sysplugins/smarty_internal_compile_eval.php create mode 100644 lib/Smarty-3.1.21/libs/sysplugins/smarty_internal_compile_extends.php create mode 100644 lib/Smarty-3.1.21/libs/sysplugins/smarty_internal_compile_for.php create mode 100644 lib/Smarty-3.1.21/libs/sysplugins/smarty_internal_compile_foreach.php create mode 100644 lib/Smarty-3.1.21/libs/sysplugins/smarty_internal_compile_function.php create mode 100644 lib/Smarty-3.1.21/libs/sysplugins/smarty_internal_compile_if.php create mode 100644 lib/Smarty-3.1.21/libs/sysplugins/smarty_internal_compile_include.php create mode 100644 lib/Smarty-3.1.21/libs/sysplugins/smarty_internal_compile_include_php.php create mode 100644 lib/Smarty-3.1.21/libs/sysplugins/smarty_internal_compile_insert.php create mode 100644 lib/Smarty-3.1.21/libs/sysplugins/smarty_internal_compile_ldelim.php create mode 100644 lib/Smarty-3.1.21/libs/sysplugins/smarty_internal_compile_nocache.php create mode 100644 lib/Smarty-3.1.21/libs/sysplugins/smarty_internal_compile_private_block_plugin.php create mode 100644 lib/Smarty-3.1.21/libs/sysplugins/smarty_internal_compile_private_function_plugin.php create mode 100644 lib/Smarty-3.1.21/libs/sysplugins/smarty_internal_compile_private_modifier.php create mode 100644 lib/Smarty-3.1.21/libs/sysplugins/smarty_internal_compile_private_object_block_function.php create mode 100644 lib/Smarty-3.1.21/libs/sysplugins/smarty_internal_compile_private_object_function.php create mode 100644 lib/Smarty-3.1.21/libs/sysplugins/smarty_internal_compile_private_print_expression.php create mode 100644 lib/Smarty-3.1.21/libs/sysplugins/smarty_internal_compile_private_registered_block.php create mode 100644 lib/Smarty-3.1.21/libs/sysplugins/smarty_internal_compile_private_registered_function.php create mode 100644 lib/Smarty-3.1.21/libs/sysplugins/smarty_internal_compile_private_special_variable.php create mode 100644 lib/Smarty-3.1.21/libs/sysplugins/smarty_internal_compile_rdelim.php create mode 100644 lib/Smarty-3.1.21/libs/sysplugins/smarty_internal_compile_section.php create mode 100644 lib/Smarty-3.1.21/libs/sysplugins/smarty_internal_compile_setfilter.php create mode 100644 lib/Smarty-3.1.21/libs/sysplugins/smarty_internal_compile_while.php create mode 100644 lib/Smarty-3.1.21/libs/sysplugins/smarty_internal_compilebase.php create mode 100644 lib/Smarty-3.1.21/libs/sysplugins/smarty_internal_config.php create mode 100644 lib/Smarty-3.1.21/libs/sysplugins/smarty_internal_config_file_compiler.php create mode 100644 lib/Smarty-3.1.21/libs/sysplugins/smarty_internal_configfilelexer.php create mode 100644 lib/Smarty-3.1.21/libs/sysplugins/smarty_internal_configfileparser.php create mode 100644 lib/Smarty-3.1.21/libs/sysplugins/smarty_internal_data.php create mode 100644 lib/Smarty-3.1.21/libs/sysplugins/smarty_internal_debug.php create mode 100644 lib/Smarty-3.1.21/libs/sysplugins/smarty_internal_filter_handler.php create mode 100644 lib/Smarty-3.1.21/libs/sysplugins/smarty_internal_function_call_handler.php create mode 100644 lib/Smarty-3.1.21/libs/sysplugins/smarty_internal_get_include_path.php create mode 100644 lib/Smarty-3.1.21/libs/sysplugins/smarty_internal_nocache_insert.php create mode 100644 lib/Smarty-3.1.21/libs/sysplugins/smarty_internal_parsetree.php create mode 100644 lib/Smarty-3.1.21/libs/sysplugins/smarty_internal_resource_eval.php create mode 100644 lib/Smarty-3.1.21/libs/sysplugins/smarty_internal_resource_extends.php create mode 100644 lib/Smarty-3.1.21/libs/sysplugins/smarty_internal_resource_file.php create mode 100644 lib/Smarty-3.1.21/libs/sysplugins/smarty_internal_resource_php.php create mode 100644 lib/Smarty-3.1.21/libs/sysplugins/smarty_internal_resource_registered.php create mode 100644 lib/Smarty-3.1.21/libs/sysplugins/smarty_internal_resource_stream.php create mode 100644 lib/Smarty-3.1.21/libs/sysplugins/smarty_internal_resource_string.php create mode 100644 lib/Smarty-3.1.21/libs/sysplugins/smarty_internal_smartytemplatecompiler.php create mode 100644 lib/Smarty-3.1.21/libs/sysplugins/smarty_internal_template.php create mode 100644 lib/Smarty-3.1.21/libs/sysplugins/smarty_internal_templatebase.php create mode 100644 lib/Smarty-3.1.21/libs/sysplugins/smarty_internal_templatecompilerbase.php create mode 100644 lib/Smarty-3.1.21/libs/sysplugins/smarty_internal_templatelexer.php create mode 100644 lib/Smarty-3.1.21/libs/sysplugins/smarty_internal_templateparser.php create mode 100644 lib/Smarty-3.1.21/libs/sysplugins/smarty_internal_utility.php create mode 100644 lib/Smarty-3.1.21/libs/sysplugins/smarty_internal_write_file.php create mode 100644 lib/Smarty-3.1.21/libs/sysplugins/smarty_resource.php create mode 100644 lib/Smarty-3.1.21/libs/sysplugins/smarty_resource_custom.php create mode 100644 lib/Smarty-3.1.21/libs/sysplugins/smarty_resource_recompiled.php create mode 100644 lib/Smarty-3.1.21/libs/sysplugins/smarty_resource_uncompiled.php create mode 100644 lib/Smarty-3.1.21/libs/sysplugins/smarty_security.php create mode 100644 lib/phpgraphlib-master/00_MODIFIED_DONT_UPDATE create mode 100644 lib/phpgraphlib-master/LICENSE.txt create mode 100644 lib/phpgraphlib-master/README.md create mode 100644 lib/phpgraphlib-master/composer.json create mode 100644 lib/phpgraphlib-master/examples/example1.php create mode 100644 lib/phpgraphlib-master/examples/example10.php create mode 100644 lib/phpgraphlib-master/examples/example11.php create mode 100644 lib/phpgraphlib-master/examples/example2.php create mode 100644 lib/phpgraphlib-master/examples/example3.php create mode 100644 lib/phpgraphlib-master/examples/example4.php create mode 100644 lib/phpgraphlib-master/examples/example5.php create mode 100644 lib/phpgraphlib-master/examples/example6.php create mode 100644 lib/phpgraphlib-master/examples/example7.php create mode 100644 lib/phpgraphlib-master/examples/example8.php create mode 100644 lib/phpgraphlib-master/examples/example9.php create mode 100644 lib/phpgraphlib-master/examples/index.html create mode 100644 lib/phpgraphlib-master/phpgraphlib.php create mode 100644 lib/phpgraphlib-master/phpgraphlib_pie.php create mode 100644 lib/phpgraphlib-master/phpgraphlib_stacked.php create mode 100644 lib/smartyTemplateSupport.php create mode 100644 misc/smarty/templates_c/424fa8075e980e0b540d7353dc3dee8a6603e49a.file.adminServerStats.html.php create mode 100644 misc/smarty/templates_c/5cc7f37bdbecb309b4681cb8d3e4e23f95a0d4cf.file.adminServerStatsConfig.html.php create mode 100644 misc/smarty/templates_c/6520e3a746eb38303d33a7a0811e948cca0c2472.file.footer.html.php create mode 100644 misc/smarty/templates_c/9a9cab5b5e177e644dc570b445d05711f940888b.file.header.html.php create mode 100644 misc/smarty/templates_c/d5ca03ee0040131e1874111dbe0e154353afefb8.file.adminServerStatsAllSites.html.php create mode 100644 models/adminServerStats.php create mode 100644 models/adminServerStatsAllSites.php create mode 100644 models/adminServerStatsConfig.php create mode 100644 models/ajaxServerBandwidthGraphs.php create mode 100644 readme.txt create mode 100644 setup/adminMenus.php create mode 100644 setup/standardTemplateParams.php create mode 100644 uninstall.php create mode 100644 views/adminServerStats.html create mode 100644 views/adminServerStatsAllSites.html create mode 100644 views/adminServerStatsConfig.html create mode 100644 views/footer.html create mode 100644 views/header.html diff --git a/activate.php b/activate.php new file mode 100644 index 0000000..b7c7de3 --- /dev/null +++ b/activate.php @@ -0,0 +1,51 @@ + + * @license http://www.gaslightmedia.com Gaslightmedia + * @release activate.php,v 1.0 2014/10/31 19:31:47 cscott Exp $ + * @link http://dev.gaslightmedia.com/ + */ + +// Check that we're being called by WordPress. +if (!defined('ABSPATH')) { + die("Please do not call this code directly!"); +} + +/* + * This class performs all necessary additional work when this + * plugin is activated. + * + * Currently the only actions are to add role capability to display and modify + * prototypes. + */ +class glmServerStatsPluginActivate +{ + + /* + * Constructor + * + * Note that the $noDatabaseCheck is used to access the database versions + * without triggering a database check. + * + * Performs all the work for this model + */ + public function __construct() + { + + // Make sure the current user has this capability + if (! current_user_can('activate_plugins')) { + $this->addNotice("Interesting, you don't have permission to activate plugins."); + die(); + } + + } + +} diff --git a/classes/serverBandwidthSupport.php b/classes/serverBandwidthSupport.php new file mode 100644 index 0000000..c7c7b77 --- /dev/null +++ b/classes/serverBandwidthSupport.php @@ -0,0 +1,412 @@ + + * @license http://www.gaslightmedia.com Gaslightmedia + * @release serverBandwidthSupport.php,v 1.0 2014/10/31 19:31:47 cscott Exp $ + * @link http://dev.gaslightmedia.com/ + */ + +/* + * This class provides support for the reporting of server bandwidth stats + * for simple day and month values as well as detailed lists of values for + * a day (by 10 min intervals), month (by days), or 2 years (by months). + * + */ +class glmServerStatsBandwidthSupport +{ + + /** + * Bandwidth database object + * + * @var $bwdb + * @access public + */ + public $bwdb = false; + /** + * Web site ID + * + * @var $siteId + * @access public + */ + public $siteId = false; + /** + * Sort full list by + * + * @var $sortBy + * @access public + */ + public $sortBy = false; + + public function __construct() + { + } + + /* + * Connect to desired database or trigger error if unable to connect. + * + * @param string $host Hostname of database server + * @param string $user Username for database + * @param string $pass Password for database + * @param string $database Name of database + * @param string $website Website name in database + * + * @return string Error message. If blank, then no error. + */ + public function bandwidthDataConnect($host, $user, $pass, $database, $website) + { + + // Connect to MySQL + $this->bwdb = mysqli_connect($host, $user, $pass, $database); + + if (!$this->bwdb) { + $this->bwdb = false; + return mysqli_connect_error(); + } + + // Get index for this site (site ID) + $this->bandwidthGetWebsiteID($website); + + if (!$this->siteId) { + $this->bwdb = false; + return "Website Name not found: ".$website; + } + + return ''; + + } + + /* + * Get Web site ID from Web site name. + * + * The Website ID is the index used to find bandwidth data for a + * particular Web site + */ + public function bandwidthGetWebsiteID($website) + { + + // Get Website ID + $sql = " + SELECT websitepk + FROM website + WHERE name = '$website' + ;"; + $websiteResult = $this->bwdb->query($sql); + if (!$websiteResult) { + trigger_error("Website ID query failed: " . mysqli_error($bwdb) ); + } + $row = mysqli_fetch_assoc($websiteResult); + if (!$row){ + trigger_error("Website '$website' not found."); + } + $this->siteId = $row['websitepk']; + + } + + /* + * Get bandwidth stats for the current day, and month for all sites + */ + public function bandwidthGetAllSitesStats($sortByRequest = 'name') + { + $stats = array(); + + // Determine output table sort order + $this->sortBy = 'name'; + + if (in_array($sortByRequest, array('name', 'today', 'thisMonth', 'lastMonth'))) { + $this->sortBy = $sortByRequest; + } + + // Check for good database connection + if ($this->bwdb == false) { + return false; + } + + // Get stats so far for today in Megabytes + $today = date('Y-m-d 0:0:0.0'); + $tomorrow = date('Y-m-d 0:0:0.0', strtotime(date('Y-m-d')." + 1day")); + $sql = " + SELECT B.websitefk as id, + W.name as name, + COALESCE ( SUM(B.bytesin)/1000000, 0 ) as data_in, + COALESCE ( SUM(B.bytesout)/1000000, 0 ) as data_out, + COALESCE ( SUM(B.total)/1000000, 0 ) as data_total + FROM bytes B, website W + WHERE W.websitepk = B.websitefk + AND time BETWEEN '$today' AND '$tomorrow' + GROUP BY B.websitefk + ORDER BY W.name + ;"; + $todayStats = $this->bwdb->query($sql); + $todayStats->data_seek(0); + while ($row = $todayStats->fetch_assoc()) { + $stats[$row['id']]['today'] = $row; + } + + // Get stats for this month in Gigabytes + $firstDayOfMonth = date('Y-m-01'); + $lastDayOfMonth = date('Y-m-t'); + $sql = " + SELECT R.websitefk as id, + W.name as name, + COALESCE ( SUM(R.bytesin)/1000000000, 0 ) as data_in, + COALESCE ( SUM(R.bytesout)/1000000000, 0 ) as data_out, + COALESCE ( SUM(R.total)/1000000000, 0 ) as data_total + FROM rollup R, website W + WHERE W.websitepk = R.websitefk + AND date BETWEEN '$firstDayOfMonth' AND '$lastDayOfMonth' + GROUP BY R.websitefk + ORDER BY W.name + ;"; + $thisMonthStats = $this->bwdb->query($sql); + $thisMonthStats->data_seek(0); + while ($row = $thisMonthStats->fetch_assoc()) { + $stats[$row['id']]['thisMonth'] = $row; + } + + // Get stats for last month in Gigabytes + $firstDayOfMonth = date('Y-m-01', strtotime(date('Y-m-01').' -1 month')); + $lastDayOfMonth = date('Y-m-t', strtotime($firstDayOfMonth)); + $sql = " + SELECT R.websitefk as id, + W.name as name, + COALESCE ( SUM(R.bytesin)/1000000000, 0 ) as data_in, + COALESCE ( SUM(R.bytesout)/1000000000, 0 ) as data_out, + COALESCE ( SUM(total)/1000000000, 0 ) as data_total + FROM rollup R, website W + WHERE W.websitepk = R.websitefk + AND date BETWEEN '$firstDayOfMonth' AND '$lastDayOfMonth' + GROUP BY R.websitefk + ORDER BY W.name + ;"; + $lastMonthStats = $this->bwdb->query($sql); + $lastMonthStats->data_seek(0); + while ($row = $lastMonthStats->fetch_assoc()) { + $stats[$row['id']]['lastMonth'] = $row; + } + + // Scan all results to fill in empty data for situations where there was no results + reset($stats); + while (list($key, $value) = each($stats)) { + + // Get name from the first available data + if (isset($value['today'])) { + $name = $value['today']['name']; + } elseif (isset($value['thisMonth'])) { + $name = $value['thisMonth']['name']; + } elseif (isset($value['lastMonth'])) { + $name = $value['lastMonth']['name']; + } + $stats[$key]['name'] = $name; + $stats[$key]['id'] = $key; + + // Fill in any missing results + if (!isset($value['today'])) { + $stats[$key]['today'] = array('id' => $key, 'name' => $name, 'data_in' => 0, 'data_out' => 0, 'data_total' => 0); + } + if (!isset($value['thisMonth'])) { + $stats[$key]['thisMonth'] = array('id' => $key, 'name' => $name, 'data_in' => 0, 'data_out' => 0, 'data_total' => 0); + } + if (!isset($value['lastMonth'])) { + $stats[$key]['lastMonth'] = array('id' => $key, 'name' => $name, 'data_in' => 0, 'data_out' => 0, 'data_total' => 0); + } + + } + + // Sort output array as requested. + uasort($stats, array( $this, 'bwSort')); + + return $stats; + + } + + public function bwSort($a, $b) { + + if ($this->sortBy == 'name') { + if ($a['name'] == $b['name']) { + return 0; + } + return ($a['name'] < $b['name']) ? -1 : 1; + } else { + if ($a[$this->sortBy]['data_total'] == $b[$this->sortBy]['data_total']) { + return 0; + } + return ($a[$this->sortBy]['data_total'] < $b[$this->sortBy]['data_total']) ? 1 : -1; + } + } + + /* + * Get bandwidth stats for the current day, and month + */ + public function bandwidthGetStats() + { + $stats = array(); + + // Check for good database connection + if ($this->bwdb == false) { + return false; + } + + // Get stats so far for today in Megabytes + $today = date('Y-m-d 0:0:0.0'); + $tomorrow = date('Y-m-d 0:0:0.0', strtotime(date('Y-m-d')." + 1day")); + $sql = " + SELECT + COALESCE ( SUM(bytesin)/1000000, 0 ) as data_in, + COALESCE ( SUM(bytesout)/1000000, 0 ) as data_out, + COALESCE ( SUM(total)/1000000, 0 ) as data_total + FROM bytes + WHERE websitefk = ".$this->siteId." + AND time BETWEEN '$today' AND '$tomorrow' + ;"; + $todayStats = $this->bwdb->query($sql); + $stats['today'] = $todayStats->fetch_array(MYSQLI_ASSOC); + + // Get stats for this month in Gigabytes + $firstDayOfMonth = date('Y-m-01'); + $lastDayOfMonth = date('Y-m-t'); + $sql = " + SELECT + COALESCE ( SUM(bytesin)/1000000000, 0 ) as data_in, + COALESCE ( SUM(bytesout)/1000000000, 0 ) as data_out, + COALESCE ( SUM(total)/1000000000, 0 ) as data_total + FROM rollup + WHERE websitefk = ".$this->siteId." + AND date BETWEEN '$firstDayOfMonth' AND '$lastDayOfMonth' + ;"; + $thisMonthStats = $this->bwdb->query($sql); + $stats['thisMonth'] = $thisMonthStats->fetch_array(MYSQLI_ASSOC); + + // Get stats for last month in Gigabytes + $firstDayOfMonth = date('Y-m-01', strtotime(date('Y-m-01').' -1 month')); + $lastDayOfMonth = date('Y-m-t', strtotime($firstDayOfMonth)); + $sql = " + SELECT + COALESCE ( SUM(bytesin)/1000000000, 0 ) as data_in, + COALESCE ( SUM(bytesout)/1000000000, 0 ) as data_out, + COALESCE ( SUM(total)/1000000000, 0 ) as data_total + FROM rollup + WHERE websitefk = ".$this->siteId." + AND date BETWEEN '$firstDayOfMonth' AND '$lastDayOfMonth' + ;"; + $lastMonthStats = $this->bwdb->query($sql); + $stats['lastMonth'] = $lastMonthStats->fetch_array(MYSQLI_ASSOC); + + return $stats; + + } + + /* + * Get bandwidth graph data for Today, Last two months, Last two years + */ + public function bandwidthGetGraphData($graphType = false, $siteId = false) + { + + if (!$siteId) { + $siteId = $this->siteId; + } + + $bandwidth = array('data_in' => array(), 'data_out' => array(), 'data_total' => array()); + + // Produce data for specified intervals + switch ($graphType) { + + case 'twoDay': + + // Get data for today in Megabytes (10 min intervals) + $startOfToday = date('Y-m-d 0:0:0.0', strtotime('today - 1day')); + $endOfToday = date('Y-m-d 23:59:59.9999'); + $sql = " + SELECT time, + bytesin/1000000 as data_in, + bytesout/1000000 as data_out, + total/1000000 as data_total + FROM bytes + WHERE websitefk = $siteId + AND time BETWEEN '$startOfToday' AND '$endOfToday' + ORDER BY time ASC + ;"; + $dayData = $this->bwdb->query($sql); + $dayData->data_seek(0); + while ($row = $dayData->fetch_assoc()) { + $time = date('d-H:i', strtotime($row['time'])); + $bandwidth['data_in'][$time] = $row['data_in']; + $bandwidth['data_out'][$time] = $row['data_out']; + $bandwidth['data_total'][$time] = $row['data_total']; + } + + break; + + case 'twoMonth': + + // Get data for this month in Gigabytes (1 day intervals) + $firstDayOfMonth = date('Y-m-01', strtotime('today - 1month')); + $lastDayOfMonth = date('Y-m-t'); + $sql = " + SELECT date as time, + bytesin/1000000000 as data_in, + bytesout/1000000000 as data_out, + total/1000000000 as data_total + FROM rollup + WHERE websitefk = $siteId + AND date BETWEEN '$firstDayOfMonth' AND '$lastDayOfMonth' + ORDER BY date ASC + ;"; + $monthData = $this->bwdb->query($sql); + $monthData->data_seek(0); + while ($row = $monthData->fetch_assoc()) { + $time = date('m-d', strtotime($row['time'])); + $bandwidth['data_in'][$time] = $row['data_in']; + $bandwidth['data_out'][$time] = $row['data_out']; + $bandwidth['data_total'][$time] = $row['data_total']; + } + + break; + + case 'twoYear': + + // Get stats for this year and last year in Gigabytes + $firstMonth = date('Y-01-01', strtotime('today -1 year')); + $lastMonth = date('Y-12-31'); + $sql = " + SELECT date as time, + COALESCE ( SUM(bytesin)/1000000000, 0 ) as data_in, + COALESCE ( SUM(bytesout)/1000000000, 0 ) as data_out, + COALESCE ( SUM(total)/1000000000, 0 ) as data_total + FROM rollup + WHERE websitefk = $siteId + AND date BETWEEN '$firstMonth' AND '$lastMonth' + GROUP BY YEAR(date), MONTH(date) + ORDER BY date ASC + ;"; + $twoYearData = $this->bwdb->query($sql); + $twoYearData->data_seek(0); + while ($row = $twoYearData->fetch_assoc()) { + $time = date('Y-m', strtotime($row['time'])); + $bandwidth['data_in'][$time] = $row['data_in']; + $bandwidth['data_out'][$time] = $row['data_out']; + $bandwidth['data_total'][$time] = $row['data_total']; + } + + break; + + default: + + die("Graph Type not specified or valid."); + break; + + } + + return $bandwidth; + + } + + + +} \ No newline at end of file diff --git a/css/admin.css b/css/admin.css new file mode 100644 index 0000000..6f06b8b --- /dev/null +++ b/css/admin.css @@ -0,0 +1,409 @@ +/* + + Gaslight Media Members Database Admin Styles + +*/ + +#glm_members_admin_dashboard_widget > H2 > span:before { + content: url('../assets/flame.png'); + width: 25px; + float: left; + margin-top: 1px; +} + +.glm-error { + color: red; + font-weight: bold; +} +.glm-warning { + color: green; + font-weight: bold; +} +.glm-notice { + color: #0073AA; + font-weight: bold; +} +.glm-required { + color: red !important; +} +.glm-active { + color: blue; +} +.glm-right { + float: right; +} +.glm-left { + float: left; +} +.glm-indent { + margin-left: 2em; +} +.glm-center { + text-align: center; +} +.glm-copyright { + text-align: center; + margin: 2em; +} +.glm-clear { + clear: both; +} +.glm-nowrap { + white-space: nowrap; +} +.glm-hidden { + display: none !important; +} +.glm-button { + margin-left: 4px !important; + margin-right: 4px !important; +} +.glm-button-small { + font-size: 0.9em !important; + padding: .0em .3em 0em .3em !important; + margin-right: 2px !important; + line-height: 1.8em !important; + height: 1.8em !important; +} + +/* Admin Area - General */ +#glm-admin-content-container { + margin-top: 1em; + border: 1px #ccc solid; + padding: 1em; + background-color: #fff; +} +.glm-item-container { + border: 1px #ccc solid; + padding: .4em; + background: #fff; +} + +/* Admin Tabs */ +.disabled { + pointer-events: none; + cursor: default; + color: #ccc; +} + +/* Admin Forms */ +.glm-bad-input-area { + background: #FFaBa9 !important; +} +.glm-form-bad-input { + background: #FFaBa9; + padding: .2em; +} +.glm-form-text-input { + width: 90%; +} +.glm-form-numeric-input { + padding-right: 6px; + width: 3.5em; + text-align: right; +} +.glm-form-text-input-character { + width: 2em; +} +.glm-form-text-input-veryshort { + width: 6em; +} +.glm-form-text-input-short { + width: 15em; +} +.glm-form-text-input-medium { + width: 30em; +} +.glm-form-text-input-medium-long { + width: 50em; +} +.glm-form-textarea { + width: 60%; +} + +/* Admin table additions */ +.glm-admin-table { + margin-bottom: 5px; +} +.glm-admin-table-narrow { + width: 10%; + margin-bottom: 5px; +} +.glm-admin-table th, +.glm-admin-table-narrow th { + text-align: left; + vertical-align: top; + white-space: nowrap; + padding-right: 1em; + padding-bottom: .4em; +} +.glm-admin-table td { + text-align: left; + vertical-align: top; + padding-bottom: .2em; +} +.glm-admin-table thead th{ + font-size: 15px; + font-weight: bold; +} +.glm-admin-table-active { + background: #99FFFF; +} +.glm-admin-table-large-bold-text { + font-size: 1.4em; + font-weight: bold; + margin: 0px; +} +.glm-admin-table-medium-text { + font-size: 0.9em; + margin: 0px; +} +.glm-admin-table-small-text { + font-size: 0.8em; + margin: 0px; +} +.glm-admin-image-edit-table { + border: 2px #ddd solid; +} +.glm-admin-image-edit-table td { + padding: 5px; +} +#video-url-msg { + display: block; + font-size: 12px; + margin-bottom: 10px; +} +td.glm-shrink { + white-space: nowrap; + width: 1px; +} +td.glm-nowrap { + white-space: nowrap; +} + +/* Misc Admin */ +.glm-code { + font-size: .8em; + font-family: "Courier New", Courier, monospace; + white-space: pre; +} +.glm-li { + list-style-type: circle; + padding-left: 1em; +} + +/* Overlay dialog box */ +.glm-dialog-box { + display: none; +} +.ui-dialog { + background: #fff; + border: 1px black solid; + border-radius: 7px; + padding: 5px; +} +.glm-dialog-no-close .ui-dialog-titlebar-close { + display: none; +} + +/* Dynamic Select Active Values Box */ +.glm-dynSelect-box, .glm-group-dynSelect-box { + width: 90%; +} +.glm-dynSelect-box, #shortcode_preview_box, .glm-group-dynSelect-box { + border: 2px #ddd solid; + min-height: 2.5em; + min-width: 100px; + float: left; + background: #fff; + margin: .2em; +} +.glm-dynSelect-item, .glm-group-dynSelect-item { + border: 2px #ddd solid; + border-radius: 5px; + background: #eee; + float: left; + padding: .2em; + margin: .4em; +} +.glm-dynSelect-delete, .glm-group-dynSelect-delete { + font-weight: bold; + font-size: 1.1em; + color: #bbb; + border-left: 2px #ccc solid; + padding-left: .5em; + margin-left: .5em; +} +.glm-dynSelect-delete:hover, .glm-group-dynSelect-delete:hover { + font-size: 1.1em; + color: #000; + cursor: pointer; +} + +/* Map Edit */ +.glm-map-edit { + width:90%; + min-width: 400px; + height:400px; + border: 2px black solid; +} +.glm-map-edit-small { + width: 450px; + height: 300px; + border: 2px black solid; +} + +/* Debug Window */ +#glm-debug-header { + font-weight: bold; + font-size: 1.3em; +} +#glm-debug-timestamp { + float: right; + font-weight: bold; + font-size: 1.3em; +} +.glm-debug-section-title { + weight: bold; +} +.glm-debug-section-body { + border: 1px black solid; + padding: 5px; + background-color: #eee; + font-size: .8em; +} +.glm-galleryContainer +{ + clear: both; + border: 1px #ccc solid; + height: 8em; + padding: .2em; + margin: .4em .1em .4em .1em; + background-color: #eee; +} +.glm-galleryContainerFlexible +{ + clear: both; + border: 1px #ccc solid; + padding: .2em; + margin: .4em .1em .4em .1em; + background-color: #eee; +} +.glm-galleryContainerContent +{ + width: 95%; +} +.glm-imageGalleryContainer +{ + border: 1px #ddd solid !important; +} +.glm-galleryImage +{ + float: left; + height: 100%; +/* width: 20%;*/ + overflow: hidden; +} +.glm-galleryImage img +{ + position: relative; + top: 0px; + right: 0px; + bottom: 0px; + left: 0px; + max-height: 100%; + max-width: 100%; +} +.glm-imageDialog +{ + display: none; + height: auto; + width: auto; +} +.glm-galleryImageData +{ + float: right; + height: 90%; + width: 78%; + text-align: left; + white-space: nowrap; +} +.glm-galleryImageData textarea +{ + height: 4em; + width: 70%; + resize: none; +} +.glm-ol-selected +{ + font-weight: bold; + color: green; +} +.glm-calendar { + border-collapse: collapse; +} +.glm-calendar td { + border: 1px solid black; +} +.glm-calendar td { + padding: .2em; +} +.nav-tab:hover { + cursor: pointer; +} +input[type=submit], input[type=file] { + cursor: pointer; +} +.showLists, .showDetails{ +/* margin:0; + float:left; + width:50%; */ +} +#showDetail > label, #categoryBox > label{ +/* margin:0; + float:left; + width:50%;*/ + display: block; +} +#categoryTitle > span, #groupsTitle > span { + font-weight: bold; +} +#categoryTitle, #shortcodesTitle, #groupsTitle { + font-weight: bold; + font-size: 16px; + border-bottom: 2px #ddd solid; +} +#shortcode_builder > h2::before{ + position: relative; + top: 2px; + content: url(../assets/flame.png); +} +#shortcode_builder > h2 > span{ + padding-left: 10px; +} +#preview_pane{ + padding: 10px; + font-weight: bold; +} + +/* Placeholder fixes for certain browsers */ +::-webkit-input-placeholder { /* Chrome, Safari, Opera */ + color: #888; + font-weight: 400; +} +::-moz-placeholder { /* Firefox */ + color: #888; + font-weight: 400; +} +:-ms-input-placeholder { /* IE10–11 */ + color: #888 !important; + font-weight: 400 !important; +} +::-ms-input-placeholder { /* Edge */ + color: #888; + font-weight: 400; +} +::placeholder { /* CSS Working Draft */ + color: #888; + font-weight: 400; +} diff --git a/deactivate.php b/deactivate.php new file mode 100644 index 0000000..08d00b1 --- /dev/null +++ b/deactivate.php @@ -0,0 +1,38 @@ + + * @license http://www.gaslightmedia.com Gaslightmedia + * @release admin.php,v 1.0 2014/10/31 19:31:47 cscott Exp $ + * @link http://dev.gaslightmedia.com/ + */ + +// Check that we're being called by WordPress. +if (!defined('ABSPATH')) { + die("Please do not call this code directly!"); +} + +/* + * This class performs all necessary additional work when this + * plugin is deactivated. + */ +class glmServerStatsPluginDeactivate +{ + + /* + * Constructor + * + * Performs all the work for this model + */ + public function __construct() + { + + } + +} diff --git a/defines.php b/defines.php new file mode 100644 index 0000000..6fe4d5d --- /dev/null +++ b/defines.php @@ -0,0 +1,55 @@ + + * @license http://www.gaslightmedia.com Gaslightmedia + * @version 1.0.0 + */ + +define('GLM_SERVERSTATS_PLUGIN_VERSION', '1.0.0'); + +// Check that we're being called by WordPress. +if (!defined('ABSPATH')) { + die("Please do not call this code directly!"); +} + + +// Required to be able to get user capabilities when being called as a filter from the main plugin +require_once ABSPATH . 'wp-includes/pluggable.php'; + +// Include defines to tell if a plugin is active +include_once ABSPATH . 'wp-admin/includes/plugin.php'; + + +// If this is an admin request +if (is_admin()) { + + require_once 'defines.php'; + require_once GLM_SERVERSTATS_PLUGIN_LIB_PATH.'/smartyTemplateSupport.php'; + + add_action('admin_menu', 'configureMenus'); + +} else { + + // No front-end functionality + return; + +} + +/* + * Function to configure admin menus + */ +function configureMenus () +{ + require_once GLM_SERVERSTATS_PLUGIN_PATH.'/setup/adminMenus.php'; +} + +/* + * + * Load CSS and Scripts + * + */ +function glmServerStatsScripts() +{ + + // jQuery scripts + wp_enqueue_script('jquery', false, array(), false, true); + wp_enqueue_script('jquery-style', false, array(), false, true); + wp_enqueue_script('jquery-ui-core', false, array(), false, true); + wp_enqueue_script('jquery-ui-widget', false, array(), false, true); + wp_enqueue_script('jquery-ui-dialog', false, array(), false, true); + + wp_enqueue_style('jquery-style', 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.css'); + wp_enqueue_style('glm-server-stats-admin-css', GLM_SERVERSTATS_PLUGIN_CSS_URL.'/admin.css'); + +} + +/* + * + * Controller Function + * + * This is a very simple controller where $model is the name for both the + * model and the view. + * + */ +function serverStatsController($model) +{ + + // Enque admin scripts and css here so that only happens when we're doing something + glmServerStatsScripts(); + + // Load and execute the specified model + require_once GLM_SERVERSTATS_PLUGIN_MODEL_PATH.'/'.$model.'.php'; + $Model = new $model(); + $results = $Model->model(); + + /* + * Merge data returned from the model with the selected view + */ + + // Load Smarty Template support + $smarty = new glmBandwidthStatsSmartyTemplateSupport(); + + // Add standard template parameters + require GLM_SERVERSTATS_PLUGIN_SETUP_PATH.'/standardTemplateParams.php'; + + // Add data from model to Smarty template + if (is_array($results['data']) && count($results['data']) > 0) { + foreach ($results['data'] as $k => $d) { + $smarty->templateAssign($k, $d); + } + } + + // Update the Smarty view path - *** NEEED TO FIX THIS TO SUPPORT THEME VIEWS SOMEHOW **** + $smarty->template->addTemplateDir(GLM_SERVERSTATS_PLUGIN_VIEW_PATH); + + // Generate output from model data and view + $smarty->template->display(GLM_SERVERSTATS_PLUGIN_VIEW_PATH.'/'.$model.'.html'); + +} + +/* +* +* Activate and Deactivate hooks +* +*/ + +// Activate +function glmServerStatsPluginActivate () +{ + global $wpdb, $config; + require_once GLM_SERVERSTATS_PLUGIN_PATH . '/activate.php'; + new glmServerStatsPluginActivate($wpdb, $config); +} +register_activation_hook(__FILE__, 'glmServerStatsPluginActivate'); + +// Deactivate +function glmServerStatsPluginDeactivate () +{ + global $wpdb, $config; + require_once GLM_SERVERSTATS_PLUGIN_PATH . '/deactivate.php'; + $x = new glmServerStatsPluginDeactivate($wpdb, $config); + return false; +} +register_deactivation_hook(__FILE__, 'glmServerStatsPluginDeactivate'); + diff --git a/lib/Smarty-3.1.21/COPYING.lib b/lib/Smarty-3.1.21/COPYING.lib new file mode 100644 index 0000000..02bbb60 --- /dev/null +++ b/lib/Smarty-3.1.21/COPYING.lib @@ -0,0 +1,165 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + + This version of the GNU Lesser General Public License incorporates +the terms and conditions of version 3 of the GNU General Public +License, supplemented by the additional permissions listed below. + + 0. Additional Definitions. + + As used herein, "this License" refers to version 3 of the GNU Lesser +General Public License, and the "GNU GPL" refers to version 3 of the GNU +General Public License. + + "The Library" refers to a covered work governed by this License, +other than an Application or a Combined Work as defined below. + + An "Application" is any work that makes use of an interface provided +by the Library, but which is not otherwise based on the Library. +Defining a subclass of a class defined by the Library is deemed a mode +of using an interface provided by the Library. + + A "Combined Work" is a work produced by combining or linking an +Application with the Library. The particular version of the Library +with which the Combined Work was made is also called the "Linked +Version". + + The "Minimal Corresponding Source" for a Combined Work means the +Corresponding Source for the Combined Work, excluding any source code +for portions of the Combined Work that, considered in isolation, are +based on the Application, and not on the Linked Version. + + The "Corresponding Application Code" for a Combined Work means the +object code and/or source code for the Application, including any data +and utility programs needed for reproducing the Combined Work from the +Application, but excluding the System Libraries of the Combined Work. + + 1. Exception to Section 3 of the GNU GPL. + + You may convey a covered work under sections 3 and 4 of this License +without being bound by section 3 of the GNU GPL. + + 2. Conveying Modified Versions. + + If you modify a copy of the Library, and, in your modifications, a +facility refers to a function or data to be supplied by an Application +that uses the facility (other than as an argument passed when the +facility is invoked), then you may convey a copy of the modified +version: + + a) under this License, provided that you make a good faith effort to + ensure that, in the event an Application does not supply the + function or data, the facility still operates, and performs + whatever part of its purpose remains meaningful, or + + b) under the GNU GPL, with none of the additional permissions of + this License applicable to that copy. + + 3. Object Code Incorporating Material from Library Header Files. + + The object code form of an Application may incorporate material from +a header file that is part of the Library. You may convey such object +code under terms of your choice, provided that, if the incorporated +material is not limited to numerical parameters, data structure +layouts and accessors, or small macros, inline functions and templates +(ten or fewer lines in length), you do both of the following: + + a) Give prominent notice with each copy of the object code that the + Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the object code with a copy of the GNU GPL and this license + document. + + 4. Combined Works. + + You may convey a Combined Work under terms of your choice that, +taken together, effectively do not restrict modification of the +portions of the Library contained in the Combined Work and reverse +engineering for debugging such modifications, if you also do each of +the following: + + a) Give prominent notice with each copy of the Combined Work that + the Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the Combined Work with a copy of the GNU GPL and this license + document. + + c) For a Combined Work that displays copyright notices during + execution, include the copyright notice for the Library among + these notices, as well as a reference directing the user to the + copies of the GNU GPL and this license document. + + d) Do one of the following: + + 0) Convey the Minimal Corresponding Source under the terms of this + License, and the Corresponding Application Code in a form + suitable for, and under terms that permit, the user to + recombine or relink the Application with a modified version of + the Linked Version to produce a modified Combined Work, in the + manner specified by section 6 of the GNU GPL for conveying + Corresponding Source. + + 1) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (a) uses at run time + a copy of the Library already present on the user's computer + system, and (b) will operate properly with a modified version + of the Library that is interface-compatible with the Linked + Version. + + e) Provide Installation Information, but only if you would otherwise + be required to provide such information under section 6 of the + GNU GPL, and only to the extent that such information is + necessary to install and execute a modified version of the + Combined Work produced by recombining or relinking the + Application with a modified version of the Linked Version. (If + you use option 4d0, the Installation Information must accompany + the Minimal Corresponding Source and Corresponding Application + Code. If you use option 4d1, you must provide the Installation + Information in the manner specified by section 6 of the GNU GPL + for conveying Corresponding Source.) + + 5. Combined Libraries. + + You may place library facilities that are a work based on the +Library side by side in a single library together with other library +facilities that are not Applications and are not covered by this +License, and convey such a combined library under terms of your +choice, if you do both of the following: + + a) Accompany the combined library with a copy of the same work based + on the Library, uncombined with any other library facilities, + conveyed under the terms of this License. + + b) Give prominent notice with the combined library that part of it + is a work based on the Library, and explaining where to find the + accompanying uncombined form of the same work. + + 6. Revised Versions of the GNU Lesser General Public License. + + The Free Software Foundation may publish revised and/or new versions +of the GNU Lesser General Public License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. + + Each version is given a distinguishing version number. If the +Library as you received it specifies that a certain numbered version +of the GNU Lesser General Public License "or any later version" +applies to it, you have the option of following the terms and +conditions either of that published version or of any later version +published by the Free Software Foundation. If the Library as you +received it does not specify a version number of the GNU Lesser +General Public License, you may choose any version of the GNU Lesser +General Public License ever published by the Free Software Foundation. + + If the Library as you received it specifies that a proxy can decide +whether future versions of the GNU Lesser General Public License shall +apply, that proxy's public statement of acceptance of any version is +permanent authorization for you to choose that version for the +Library. \ No newline at end of file diff --git a/lib/Smarty-3.1.21/README b/lib/Smarty-3.1.21/README new file mode 100644 index 0000000..6367f03 --- /dev/null +++ b/lib/Smarty-3.1.21/README @@ -0,0 +1,574 @@ +Smarty 3.1.21 + +Author: Monte Ohrt +Author: Uwe Tews + +AN INTRODUCTION TO SMARTY 3 + +NOTICE FOR 3.1 release: + +Please see the SMARTY_3.1_NOTES.txt file that comes with the distribution. + +NOTICE for 3.0.5 release: + +Smarty now follows the PHP error_reporting level by default. If PHP does not mask E_NOTICE and you try to access an unset template variable, you will now get an E_NOTICE warning. To revert to the old behavior: + +$smarty->error_reporting = E_ALL & ~E_NOTICE; + +NOTICE for 3.0 release: + +IMPORTANT: Some API adjustments have been made between the RC4 and 3.0 release. +We felt it is better to make these now instead of after a 3.0 release, then have to +immediately deprecate APIs in 3.1. Online documentation has been updated +to reflect these changes. Specifically: + +---- API CHANGES RC4 -> 3.0 ---- + +$smarty->register->* +$smarty->unregister->* +$smarty->utility->* +$samrty->cache->* + +Have all been changed to local method calls such as: + +$smarty->clearAllCache() +$smarty->registerFoo() +$smarty->unregisterFoo() +$smarty->testInstall() +etc. + +Registration of function, block, compiler, and modifier plugins have been +consolidated under two API calls: + +$smarty->registerPlugin(...) +$smarty->unregisterPlugin(...) + +Registration of pre, post, output and variable filters have been +consolidated under two API calls: + +$smarty->registerFilter(...) +$smarty->unregisterFilter(...) + +Please refer to the online documentation for all specific changes: + +http://www.smarty.net/documentation + +---- + +The Smarty 3 API has been refactored to a syntax geared +for consistency and modularity. The Smarty 2 API syntax is still supported, but +will throw a deprecation notice. You can disable the notices, but it is highly +recommended to adjust your syntax to Smarty 3, as the Smarty 2 syntax must run +through an extra rerouting wrapper. + +Basically, all Smarty methods now follow the "fooBarBaz" camel case syntax. Also, +all Smarty properties now have getters and setters. So for example, the property +$smarty->cache_dir can be set with $smarty->setCacheDir('foo/') and can be +retrieved with $smarty->getCacheDir(). + +Some of the Smarty 3 APIs have been revoked such as the "is*" methods that were +just duplicate functions of the now available "get*" methods. + +Here is a rundown of the Smarty 3 API: + +$smarty->fetch($template, $cache_id = null, $compile_id = null, $parent = null) +$smarty->display($template, $cache_id = null, $compile_id = null, $parent = null) +$smarty->isCached($template, $cache_id = null, $compile_id = null) +$smarty->createData($parent = null) +$smarty->createTemplate($template, $cache_id = null, $compile_id = null, $parent = null) +$smarty->enableSecurity() +$smarty->disableSecurity() +$smarty->setTemplateDir($template_dir) +$smarty->addTemplateDir($template_dir) +$smarty->templateExists($resource_name) +$smarty->loadPlugin($plugin_name, $check = true) +$smarty->loadFilter($type, $name) +$smarty->setExceptionHandler($handler) +$smarty->addPluginsDir($plugins_dir) +$smarty->getGlobal($varname = null) +$smarty->getRegisteredObject($name) +$smarty->getDebugTemplate() +$smarty->setDebugTemplate($tpl_name) +$smarty->assign($tpl_var, $value = null, $nocache = false) +$smarty->assignGlobal($varname, $value = null, $nocache = false) +$smarty->assignByRef($tpl_var, &$value, $nocache = false) +$smarty->append($tpl_var, $value = null, $merge = false, $nocache = false) +$smarty->appendByRef($tpl_var, &$value, $merge = false) +$smarty->clearAssign($tpl_var) +$smarty->clearAllAssign() +$smarty->configLoad($config_file, $sections = null) +$smarty->getVariable($variable, $_ptr = null, $search_parents = true, $error_enable = true) +$smarty->getConfigVariable($variable) +$smarty->getStreamVariable($variable) +$smarty->getConfigVars($varname = null) +$smarty->clearConfig($varname = null) +$smarty->getTemplateVars($varname = null, $_ptr = null, $search_parents = true) +$smarty->clearAllCache($exp_time = null, $type = null) +$smarty->clearCache($template_name, $cache_id = null, $compile_id = null, $exp_time = null, $type = null) + +$smarty->registerPlugin($type, $tag, $callback, $cacheable = true, $cache_attr = array()) + +$smarty->registerObject($object_name, $object_impl, $allowed = array(), $smarty_args = true, $block_methods = array()) + +$smarty->registerFilter($type, $function_name) +$smarty->registerResource($resource_type, $function_names) +$smarty->registerDefaultPluginHandler($function_name) +$smarty->registerDefaultTemplateHandler($function_name) + +$smarty->unregisterPlugin($type, $tag) +$smarty->unregisterObject($object_name) +$smarty->unregisterFilter($type, $function_name) +$smarty->unregisterResource($resource_type) + +$smarty->compileAllTemplates($extension = '.tpl', $force_compile = false, $time_limit = 0, $max_errors = null) +$smarty->clearCompiledTemplate($resource_name = null, $compile_id = null, $exp_time = null) +$smarty->testInstall() + +// then all the getters/setters, available for all properties. Here are a few: + +$caching = $smarty->getCaching(); // get $smarty->caching +$smarty->setCaching(true); // set $smarty->caching +$smarty->setDeprecationNotices(false); // set $smarty->deprecation_notices +$smarty->setCacheId($id); // set $smarty->cache_id +$debugging = $smarty->getDebugging(); // get $smarty->debugging + + +FILE STRUCTURE + +The Smarty 3 file structure is similar to Smarty 2: + +/libs/ + Smarty.class.php +/libs/sysplugins/ + internal.* +/libs/plugins/ + function.mailto.php + modifier.escape.php + ... + +A lot of Smarty 3 core functionality lies in the sysplugins directory; you do +not need to change any files here. The /libs/plugins/ folder is where Smarty +plugins are located. You can add your own here, or create a separate plugin +directory, just the same as Smarty 2. You will still need to create your own +/cache/, /templates/, /templates_c/, /configs/ folders. Be sure /cache/ and +/templates_c/ are writable. + +The typical way to use Smarty 3 should also look familiar: + +require('Smarty.class.php'); +$smarty = new Smarty; +$smarty->assign('foo','bar'); +$smarty->display('index.tpl'); + + +However, Smarty 3 works completely different on the inside. Smarty 3 is mostly +backward compatible with Smarty 2, except for the following items: + +*) Smarty 3 is PHP 5 only. It will not work with PHP 4. +*) The {php} tag is disabled by default. Enable with $smarty->allow_php_tag=true. +*) Delimiters surrounded by whitespace are no longer treated as Smarty tags. + Therefore, { foo } will not compile as a tag, you must use {foo}. This change + Makes Javascript/CSS easier to work with, eliminating the need for {literal}. + This can be disabled by setting $smarty->auto_literal = false; +*) The Smarty 3 API is a bit different. Many Smarty 2 API calls are deprecated + but still work. You will want to update your calls to Smarty 3 for maximum + efficiency. + + +There are many things that are new to Smarty 3. Here are the notable items: + +LEXER/PARSER +============ + +Smarty 3 now uses a lexing tokenizer for its parser/compiler. Basically, this +means Smarty has some syntax additions that make life easier such as in-template +math, shorter/intuitive function parameter options, infinite function recursion, +more accurate error handling, etc. + + +WHAT IS NEW IN SMARTY TEMPLATE SYNTAX +===================================== + +Smarty 3 allows expressions almost anywhere. Expressions can include PHP +functions as long as they are not disabled by the security policy, object +methods and properties, etc. The {math} plugin is no longer necessary but +is still supported for BC. + +Examples: +{$x+$y} will output the sum of x and y. +{$foo = strlen($bar)} function in assignment +{assign var=foo value= $x+$y} in attributes +{$foo = myfunct( ($x+$y)*3 )} as function parameter +{$foo[$x+3]} as array index + +Smarty tags can be used as values within other tags. +Example: {$foo={counter}+3} + +Smarty tags can also be used inside double quoted strings. +Example: {$foo="this is message {counter}"} + +You can define arrays within templates. +Examples: +{assign var=foo value=[1,2,3]} +{assign var=foo value=['y'=>'yellow','b'=>'blue']} +Arrays can be nested. +{assign var=foo value=[1,[9,8],3]} + +There is a new short syntax supported for assigning variables. +Example: {$foo=$bar+2} + +You can assign a value to a specific array element. If the variable exists but +is not an array, it is converted to an array before the new values are assigned. +Examples: +{$foo['bar']=1} +{$foo['bar']['blar']=1} + +You can append values to an array. If the variable exists but is not an array, +it is converted to an array before the new values are assigned. +Example: {$foo[]=1} + +You can use a PHP-like syntax for accessing array elements, as well as the +original "dot" notation. +Examples: +{$foo[1]} normal access +{$foo['bar']} +{$foo['bar'][1]} +{$foo[$x+$x]} index may contain any expression +{$foo[$bar[1]]} nested index +{$foo[section_name]} smarty section access, not array access! + +The original "dot" notation stays, and with improvements. +Examples: +{$foo.a.b.c} => $foo['a']['b']['c'] +{$foo.a.$b.c} => $foo['a'][$b]['c'] with variable index +{$foo.a.{$b+4}.c} => $foo['a'][$b+4]['c'] with expression as index +{$foo.a.{$b.c}} => $foo['a'][$b['c']] with nested index + +note that { and } are used to address ambiguties when nesting the dot syntax. + +Variable names themselves can be variable and contain expressions. +Examples: +$foo normal variable +$foo_{$bar} variable name containing other variable +$foo_{$x+$y} variable name containing expressions +$foo_{$bar}_buh_{$blar} variable name with multiple segments +{$foo_{$x}} will output the variable $foo_1 if $x has a value of 1. + +Object method chaining is implemented. +Example: {$object->method1($x)->method2($y)} + +{for} tag added for looping (replacement for {section} tag): +{for $x=0, $y=count($foo); $x<$y; $x++} .... {/for} +Any number of statements can be used separated by comma as the first +inital expression at {for}. + +{for $x = $start to $end step $step} ... {/for}is in the SVN now . +You can use also +{for $x = $start to $end} ... {/for} +In this case the step value will be automaticall 1 or -1 depending on the start and end values. +Instead of $start and $end you can use any valid expression. +Inside the loop the following special vars can be accessed: +$x@iteration = number of iteration +$x@total = total number of iterations +$x@first = true on first iteration +$x@last = true on last iteration + + +The Smarty 2 {section} syntax is still supported. + +New shorter {foreach} syntax to loop over an array. +Example: {foreach $myarray as $var}...{/foreach} + +Within the foreach loop, properties are access via: + +$var@key foreach $var array key +$var@iteration foreach current iteration count (1,2,3...) +$var@index foreach current index count (0,1,2...) +$var@total foreach $var array total +$var@first true on first iteration +$var@last true on last iteration + +The Smarty 2 {foreach} tag syntax is still supported. + +NOTE: {$bar[foo]} still indicates a variable inside of a {section} named foo. +If you want to access an array element with index foo, you must use quotes +such as {$bar['foo']}, or use the dot syntax {$bar.foo}. + +while block tag is now implemented: +{while $foo}...{/while} +{while $x lt 10}...{/while} + +Direct access to PHP functions: +Just as you can use PHP functions as modifiers directly, you can now access +PHP functions directly, provided they are permitted by security settings: +{time()} + +There is a new {function}...{/function} block tag to implement a template function. +This enables reuse of code sequences like a plugin function. It can call itself recursively. +Template function must be called with the new {call name=foo...} tag. + +Example: + +Template file: +{function name=menu level=0} +
    + {foreach $data as $entry} + {if is_array($entry)} +
  • {$entry@key}
  • + {call name=menu data=$entry level=$level+1} + {else} +
  • {$entry}
  • + {/if} + {/foreach} +
+{/function} + +{$menu = ['item1','item2','item3' => ['item3-1','item3-2','item3-3' => + ['item3-3-1','item3-3-2']],'item4']} + +{call name=menu data=$menu} + + +Generated output: + * item1 + * item2 + * item3 + o item3-1 + o item3-2 + o item3-3 + + item3-3-1 + + item3-3-2 + * item4 + +The function tag itself must have the "name" attribute. This name is the tag +name when calling the function. The function tag may have any number of +additional attributes. These will be default settings for local variables. + +New {nocache} block function: +{nocache}...{/nocache} will declare a section of the template to be non-cached +when template caching is enabled. + +New nocache attribute: +You can declare variable/function output as non-cached with the nocache attribute. +Examples: + +{$foo nocache=true} +{$foo nocache} /* same */ + +{foo bar="baz" nocache=true} +{foo bar="baz" nocache} /* same */ + +{time() nocache=true} +{time() nocache} /* same */ + +Or you can also assign the variable in your script as nocache: +$smarty->assign('foo',$something,true); // third param is nocache setting +{$foo} /* non-cached */ + +$smarty.current_dir returns the directory name of the current template. + +You can use strings directly as templates with the "string" resource type. +Examples: +$smarty->display('string:This is my template, {$foo}!'); // php +{include file="string:This is my template, {$foo}!"} // template + + + +VARIABLE SCOPE / VARIABLE STORAGE +================================= + +In Smarty 2, all assigned variables were stored within the Smarty object. +Therefore, all variables assigned in PHP were accessible by all subsequent +fetch and display template calls. + +In Smarty 3, we have the choice to assign variables to the main Smarty object, +to user-created data objects, and to user-created template objects. +These objects can be chained. The object at the end of a chain can access all +variables belonging to that template and all variables within the parent objects. +The Smarty object can only be the root of a chain, but a chain can be isolated +from the Smarty object. + +All known Smarty assignment interfaces will work on the data and template objects. + +Besides the above mentioned objects, there is also a special storage area for +global variables. + +A Smarty data object can be created as follows: +$data = $smarty->createData(); // create root data object +$data->assign('foo','bar'); // assign variables as usual +$data->config_load('my.conf'); // load config file + +$data= $smarty->createData($smarty); // create data object having a parent link to +the Smarty object + +$data2= $smarty->createData($data); // create data object having a parent link to +the $data data object + +A template object can be created by using the createTemplate method. It has the +same parameter assignments as the fetch() or display() method. +Function definition: +function createTemplate($template, $cache_id = null, $compile_id = null, $parent = null) + +The first parameter can be a template name, a smarty object or a data object. + +Examples: +$tpl = $smarty->createTemplate('mytpl.tpl'); // create template object not linked to any parent +$tpl->assign('foo','bar'); // directly assign variables +$tpl->config_load('my.conf'); // load config file + +$tpl = $smarty->createTemplate('mytpl.tpl',$smarty); // create template having a parent link to the Smarty object +$tpl = $smarty->createTemplate('mytpl.tpl',$data); // create template having a parent link to the $data object + +The standard fetch() and display() methods will implicitly create a template object. +If the $parent parameter is not specified in these method calls, the template object +is will link back to the Smarty object as it's parent. + +If a template is called by an {include...} tag from another template, the +subtemplate links back to the calling template as it's parent. + +All variables assigned locally or from a parent template are accessible. If the +template creates or modifies a variable by using the {assign var=foo...} or +{$foo=...} tags, these new values are only known locally (local scope). When the +template exits, none of the new variables or modifications can be seen in the +parent template(s). This is same behavior as in Smarty 2. + +With Smarty 3, we can assign variables with a scope attribute which allows the +availablility of these new variables or modifications globally (ie in the parent +templates.) + +Possible scopes are local, parent, root and global. +Examples: +{assign var=foo value='bar'} // no scope is specified, the default 'local' +{$foo='bar'} // same, local scope +{assign var=foo value='bar' scope='local'} // same, local scope + +{assign var=foo value='bar' scope='parent'} // Values will be available to the parent object +{$foo='bar' scope='parent'} // (normally the calling template) + +{assign var=foo value='bar' scope='root'} // Values will be exported up to the root object, so they can +{$foo='bar' scope='root'} // be seen from all templates using the same root. + +{assign var=foo value='bar' scope='global'} // Values will be exported to global variable storage, +{$foo='bar' scope='global'} // they are available to any and all templates. + + +The scope attribute can also be attached to the {include...} tag. In this case, +the specified scope will be the default scope for all assignments within the +included template. + + +PLUGINS +======= + +Smarty3 are following the same coding rules as in Smarty2. +The only difference is that the template object is passed as additional third parameter. + +smarty_plugintype_name (array $params, object $smarty, object $template) + +The Smarty 2 plugins are still compatible as long as they do not make use of specific Smarty2 internals. + + +TEMPLATE INHERITANCE: +===================== + +With template inheritance you can define blocks, which are areas that can be +overriden by child templates, so your templates could look like this: + +parent.tpl: + + + {block name='title'}My site name{/block} + + +

{block name='page-title'}Default page title{/block}

+
+ {block name='content'} + Default content + {/block} +
+ + + +child.tpl: +{extends file='parent.tpl'} +{block name='title'} +Child title +{/block} + +grandchild.tpl: +{extends file='child.tpl'} +{block name='title'}Home - {$smarty.block.parent}{/block} +{block name='page-title'}My home{/block} +{block name='content'} + {foreach $images as $img} + {$img.description} + {/foreach} +{/block} + +We redefined all the blocks here, however in the title block we used {$smarty.block.parent}, +which tells Smarty to insert the default content from the parent template in its place. +The content block was overriden to display the image files, and page-title has also be +overriden to display a completely different title. + +If we render grandchild.tpl we will get this: + + + Home - Child title + + +

My home

+
+ image + image + image +
+ + + +NOTE: In the child templates everything outside the {extends} or {block} tag sections +is ignored. + +The inheritance tree can be as big as you want (meaning you can extend a file that +extends another one that extends another one and so on..), but be aware that all files +have to be checked for modifications at runtime so the more inheritance the more overhead you add. + +Instead of defining the parent/child relationships with the {extends} tag in the child template you +can use the resource as follow: + +$smarty->display('extends:parent.tpl|child.tpl|grandchild.tpl'); + +Child {block} tags may optionally have a append or prepend attribute. In this case the parent block content +is appended or prepended to the child block content. + +{block name='title' append} My title {/block} + + +PHP STREAMS: +============ + +(see online documentation) + +VARIBLE FILTERS: +================ + +(see online documentation) + + +STATIC CLASS ACCESS AND NAMESPACE SUPPORT +========================================= + +You can register a class with optional namespace for the use in the template like: + +$smarty->register->templateClass('foo','name\name2\myclass'); + +In the template you can use it like this: +{foo::method()} etc. + + +======================= + +Please look through it and send any questions/suggestions/etc to the forums. + +http://www.phpinsider.com/smarty-forum/viewtopic.php?t=14168 + +Monte and Uwe diff --git a/lib/Smarty-3.1.21/SMARTY_2_BC_NOTES.txt b/lib/Smarty-3.1.21/SMARTY_2_BC_NOTES.txt new file mode 100644 index 0000000..79a2cb1 --- /dev/null +++ b/lib/Smarty-3.1.21/SMARTY_2_BC_NOTES.txt @@ -0,0 +1,109 @@ += Known incompatibilities with Smarty 2 = + +== Syntax == + +Smarty 3 API has a new syntax. Much of the Smarty 2 syntax is supported +by a wrapper but deprecated. See the README that comes with Smarty 3 for more +information. + +The {$array|@mod} syntax has always been a bit confusing, where an "@" is required +to apply a modifier to an array instead of the individual elements. Normally you +always want the modifier to apply to the variable regardless of its type. In Smarty 3, +{$array|mod} and {$array|@mod} behave identical. It is safe to drop the "@" and the +modifier will still apply to the array. If you really want the modifier to apply to +each array element, you must loop the array in-template, or use a custom modifier that +supports array iteration. Most smarty functions already escape values where necessary +such as {html_options} + +== PHP Version == +Smarty 3 is PHP 5 only. It will not work with PHP 4. + +== {php} Tag == +The {php} tag is disabled by default. The use of {php} tags is +deprecated. It can be enabled with $smarty->allow_php_tag=true. + +But if you scatter PHP code which belongs together into several +{php} tags it may not work any longer. + +== Delimiters and whitespace == +Delimiters surrounded by whitespace are no longer treated as Smarty tags. +Therefore, { foo } will not compile as a tag, you must use {foo}. This change +Makes Javascript/CSS easier to work with, eliminating the need for {literal}. +This can be disabled by setting $smarty->auto_literal = false; + +== Unquoted Strings == +Smarty 2 was a bit more forgiving (and ambiguous) when it comes to unquoted strings +in parameters. Smarty3 is more restrictive. You can still pass strings without quotes +so long as they contain no special characters. (anything outside of A-Za-z0-9_) + +For example filename strings must be quoted + +{include file='path/foo.tpl'} + + +== Extending the Smarty class == +Smarty 3 makes use of the __construct method for initialization. If you are extending +the Smarty class, its constructor is not called implicitly if the your child class defines +its own constructor. In order to run Smarty's constructor, a call to parent::__construct() +within your child constructor is required. + + +class MySmarty extends Smarty { + function __construct() { + parent::__construct(); + + // your initialization code goes here + + } +} + + +== Autoloader == +Smarty 3 does register its own autoloader with spl_autoload_register. If your code has +an existing __autoload function then this function must be explicitly registered on +the __autoload stack. See http://us3.php.net/manual/en/function.spl-autoload-register.php +for further details. + +== Plugin Filenames == +Smarty 3 optionally supports the PHP spl_autoloader. The autoloader requires filenames +to be lower case. Because of this, Smarty plugin file names must also be lowercase. +In Smarty 2, mixed case file names did work. + +== Scope of Special Smarty Variables == +In Smarty 2 the special Smarty variables $smarty.section... and $smarty.foreach... +had global scope. If you had loops with the same name in subtemplates you could accidentally +overwrite values of parent template. + +In Smarty 3 these special Smarty variable have only local scope in the template which +is defining the loop. If you need their value in a subtemplate you have to pass them +as parameter. + +{include file='path/foo.tpl' index=$smarty.section.foo.index} + + +== SMARTY_RESOURCE_CHAR_SET == +Smarty 3 sets the constant SMARTY_RESOURCE_CHAR_SET to utf-8 as default template charset. +This is now used also on modifiers like escape as default charset. If your templates use +other charsets make sure that you define the constant accordingly. Otherwise you may not +get any output. + +== newline at {if} tags == +A \n was added to the compiled code of the {if},{else},{elseif},{/if} tags to get output of newlines as expected by the template source. +If one of the {if} tags is at the line end you will now get a newline in the HTML output. + +== trigger_error() == +The API function trigger_error() has been removed because it did just map to PHP trigger_error. +However it's still included in the Smarty2 API wrapper. + +== Smarty constants == +The constants +SMARTY_PHP_PASSTHRU +SMARTY_PHP_QUOTE +SMARTY_PHP_REMOVE +SMARTY_PHP_ALLOW +have been replaced with class constants +Smarty::PHP_PASSTHRU +Smarty::PHP_QUOTE +Smarty::PHP_REMOVE +Smarty::PHP_ALLOW + diff --git a/lib/Smarty-3.1.21/SMARTY_3.0_BC_NOTES.txt b/lib/Smarty-3.1.21/SMARTY_3.0_BC_NOTES.txt new file mode 100644 index 0000000..fd8b540 --- /dev/null +++ b/lib/Smarty-3.1.21/SMARTY_3.0_BC_NOTES.txt @@ -0,0 +1,24 @@ +== Smarty2 backward compatibility == +All Smarty2 specific API functions and deprecated functionallity has been moved +to the SmartyBC class. + +== {php} Tag == +The {php} tag is no longer available in the standard Smarty calls. +The use of {php} tags is deprecated and only available in the SmartyBC class. + +== {include_php} Tag == +The {include_php} tag is no longer available in the standard Smarty calls. +The use of {include_php} tags is deprecated and only available in the SmartyBC class. + +== php template resource == +The support of the php template resource is removed. + +== $cache_dir, $compile_dir, $config_dir, $template_dir access == +The mentioned properties can't be accessed directly any longer. You must use +corresponding getter/setters like addConfigDir(), setConfigDir(), getConfigDir() + +== obsolete Smarty class properties == +The following no longer used properties are removed: +$allow_php_tag +$allow_php_template +$deprecation_notices \ No newline at end of file diff --git a/lib/Smarty-3.1.21/SMARTY_3.1_NOTES.txt b/lib/Smarty-3.1.21/SMARTY_3.1_NOTES.txt new file mode 100644 index 0000000..57709f0 --- /dev/null +++ b/lib/Smarty-3.1.21/SMARTY_3.1_NOTES.txt @@ -0,0 +1,306 @@ +Smarty 3.1 Notes +================ + +Smarty 3.1 is a departure from 2.0 compatibility. Most notably, all +backward compatibility has been moved to a separate class file named +SmartyBC.class.php. If you require compatibility with 2.0, you will +need to use this class. + +Some differences from 3.0 are also present. 3.1 begins the journey of +requiring setters/getters for property access. So far this is only +implemented on the five directory properties: template_dir, +plugins_dir, configs_dir, compile_dir and cache_dir. These properties +are now protected, it is required to use the setters/getters instead. +That said, direct property access will still work, however slightly +slower since they will now fall through __set() and __get() and in +turn passed through the setter/getter methods. 3.2 will exhibit a full +list of setter/getter methods for all (currently) public properties, +so code-completion in your IDE will work as expected. + +There is absolutely no PHP allowed in templates any more. All +deprecated features of Smarty 2.0 are gone. Again, use the SmartyBC +class if you need any backward compatibility. + +Internal Changes + + Full UTF-8 Compatibility + +The plugins shipped with Smarty 3.1 have been rewritten to fully +support UTF-8 strings if Multibyte String is available. Without +MBString UTF-8 cannot be handled properly. For those rare cases where +templates themselves have to juggle encodings, the new modifiers +to_charset and from_charset may come in handy. + + Plugin API and Performance + +All Plugins (modifiers, functions, blocks, resources, +default_template_handlers, etc) are now receiving the +Smarty_Internal_Template instance, where they were supplied with the +Smarty instance in Smarty 3.0. *. As The Smarty_Internal_Template +mimics the behavior of Smarty, this API simplification should not +require any changes to custom plugins. + +The plugins shipped with Smarty 3.1 have been rewritten for better +performance. Most notably {html_select_date} and {html_select_time} +have been improved vastly. Performance aside, plugins have also been +reviewed and generalized in their API. {html_select_date} and +{html_select_time} now share almost all available options. + +The escape modifier now knows the $double_encode option, which will +prevent entities from being encoded again. + +The capitalize modifier now know the $lc_rest option, which makes sure +all letters following a captial letter are lower-cased. + +The count_sentences modifier now accepts (.?!) as +legitimate endings of a sentence - previously only (.) was +accepted + +The new unescape modifier is there to reverse the effects of the +escape modifier. This applies to the escape formats html, htmlall and +entity. + + default_template_handler_func + +The invocation of $smarty->$default_template_handler_func had to be +altered. Instead of a Smarty_Internal_Template, the fifth argument is +now provided with the Smarty instance. New footprint: + + +/** + * Default Template Handler + * + * called when Smarty's file: resource is unable to load a requested file + * + * @param string $type resource type (e.g. "file", "string", "eval", "resource") + * @param string $name resource name (e.g. "foo/bar.tpl") + * @param string &$content template's content + * @param integer &$modified template's modification time + * @param Smarty $smarty Smarty instance + * @return string|boolean path to file or boolean true if $content and $modified + * have been filled, boolean false if no default template + * could be loaded + */ +function default_template_handler_func($type, $name, &$content, &$modified, Smarty $smarty) { + if (false) { + // return corrected filepath + return "/tmp/some/foobar.tpl"; + } elseif (false) { + // return a template directly + $content = "the template source"; + $modified = time(); + return true; + } else { + // tell smarty that we failed + return false; + } +} + + Stuff done to the compiler + +Many performance improvements have happened internally. One notable +improvement is that all compiled templates are now handled as PHP +functions. This speeds up repeated templates tremendously, as each one +calls an (in-memory) PHP function instead of performing another file +include/scan. + +New Features + + Template syntax + + {block}..{/block} + +The {block} tag has a new hide option flag. It does suppress the block +content if no corresponding child block exists. +EXAMPLE: +parent.tpl +{block name=body hide} child content "{$smarty.block.child}" was +inserted {block} +In the above example the whole block will be suppressed if no child +block "body" is existing. + + {setfilter}..{/setfilter} + +The new {setfilter} block tag allows the definition of filters which +run on variable output. +SYNTAX: +{setfilter filter1|filter2|filter3....} +Smarty3 will lookup up matching filters in the following search order: +1. varibale filter plugin in plugins_dir. +2. a valid modifier. A modifier specification will also accept +additional parameter like filter2:'foo' +3. a PHP function +{/setfilter} will turn previous filter setting off again. +{setfilter} tags can be nested. +EXAMPLE: +{setfilter filter1} + {$foo} + {setfilter filter2} + {$bar} + {/setfilter} + {$buh} +{/setfilter} +{$blar} +In the above example filter1 will run on the output of $foo, filter2 +on $bar, filter1 again on $buh and no filter on $blar. +NOTES: +- {$foo nofilter} will suppress the filters +- These filters will run in addition to filters defined by +registerFilter('variable',...), autoLoadFilter('variable',...) and +defined default modifier. +- {setfilter} will effect only the current template, not included +subtemplates. + + Resource API + +Smarty 3.1 features a new approach to resource management. The +Smarty_Resource API allows simple, yet powerful integration of custom +resources for templates and configuration files. It offers simple +functions for loading data from a custom resource (e.g. database) as +well as define new template types adhering to the special +non-compiling (e,g, plain php) and non-compile-caching (e.g. eval: +resource type) resources. + +See demo/plugins/resource.mysql.php for an example custom database +resource. + +Note that old-fashioned registration of callbacks for resource +management has been deprecated but is still possible with SmartyBC. + + CacheResource API + +In line with the Resource API, the CacheResource API offers a more +comfortable handling of output-cache data. With the +Smarty_CacheResource_Custom accessing databases is made simple. With +the introduction of Smarty_CacheResource_KeyValueStore the +implementation of resources like memcache or APC became a no-brainer; +simple hash-based storage systems are now supporting hierarchical +output-caches. + +See demo/plugins/cacheresource.mysql.php for an example custom +database CacheResource. +See demo/plugins/cacheresource.memcache.php for an example custom +memcache CacheResource using the KeyValueStore helper. + +Note that old-fashioned registration of $cache_handler is not possible +anymore. As the functionality had not been ported to Smarty 3.0.x +properly, it has been dropped from 3.1 completely. + +Locking facilities have been implemented to avoid concurrent cache +generation. Enable cache locking by setting +$smarty->cache_locking = true; + + Relative Paths in Templates (File-Resource) + +As of Smarty 3.1 {include file="../foo.tpl"} and {include +file="./foo.tpl"} will resolve relative to the template they're in. +Relative paths are available with {include file="..."} and +{extends file="..."}. As $smarty->fetch('../foo.tpl') and +$smarty->fetch('./foo.tpl') cannot be relative to a template, an +exception is thrown. + + Addressing a specific $template_dir + +Smarty 3.1 introduces the $template_dir index notation. +$smarty->fetch('[foo]bar.tpl') and {include file="[foo]bar.tpl"} +require the template bar.tpl to be loaded from $template_dir['foo']; +Smarty::setTemplateDir() and Smarty::addTemplateDir() offer ways to +define indexes along with the actual directories. + + Mixing Resources in extends-Resource + +Taking the php extends: template resource one step further, it is now +possible to mix resources within an extends: call like +$smarty->fetch("extends:file:foo.tpl|db:bar.tpl"); + +To make eval: and string: resources available to the inheritance +chain, eval:base64:TPL_STRING and eval:urlencode:TPL_STRING have been +introduced. Supplying the base64 or urlencode flags will trigger +decoding the TPL_STRING in with either base64_decode() or urldecode(). + + extends-Resource in template inheritance + +Template based inheritance may now inherit from php's extends: +resource like {extends file="extends:foo.tpl|db:bar.tpl"}. + + New Smarty property escape_html + +$smarty->escape_html = true will autoescape all template variable +output by calling htmlspecialchars({$output}, ENT_QUOTES, +SMARTY_RESOURCE_CHAR_SET). +NOTE: +This is a compile time option. If you change the setting you must make +sure that the templates get recompiled. + + New option at Smarty property compile_check + +The automatic recompilation of modified templates can now be +controlled by the following settings: +$smarty->compile_check = COMPILECHECK_OFF (false) - template files +will not be checked +$smarty->compile_check = COMPILECHECK_ON (true) - template files will +always be checked +$smarty->compile_check = COMPILECHECK_CACHEMISS - template files will +be checked if caching is enabled and there is no existing cache file +or it has expired + + Automatic recompilation on Smarty version change + +Templates will now be automatically recompiled on Smarty version +changes to avoide incompatibillities in the compiled code. Compiled +template checked against the current setting of the SMARTY_VERSION +constant. + + default_config_handler_func() + +Analogous to the default_template_handler_func() +default_config_handler_func() has been introduced. + + default_plugin_handler_func() + +An optional default_plugin_handler_func() can be defined which gets called +by the compiler on tags which can't be resolved internally or by plugins. +The default_plugin_handler() can map tags to plugins on the fly. + +New getters/setters + +The following setters/getters will be part of the official +documentation, and will be strongly recommended. Direct property +access will still work for the foreseeable future... it will be +transparently routed through the setters/getters, and consequently a +bit slower. + +array|string getTemplateDir( [string $index] ) +replaces $smarty->template_dir; and $smarty->template_dir[$index]; +Smarty setTemplateDir( array|string $path ) +replaces $smarty->template_dir = "foo"; and $smarty->template_dir = +array("foo", "bar"); +Smarty addTemplateDir( array|string $path, [string $index]) +replaces $smarty->template_dir[] = "bar"; and +$smarty->template_dir[$index] = "bar"; + +array|string getConfigDir( [string $index] ) +replaces $smarty->config_dir; and $smarty->config_dir[$index]; +Smarty setConfigDir( array|string $path ) +replaces $smarty->config_dir = "foo"; and $smarty->config_dir = +array("foo", "bar"); +Smarty addConfigDir( array|string $path, [string $index]) +replaces $smarty->config_dir[] = "bar"; and +$smarty->config_dir[$index] = "bar"; + +array getPluginsDir() +replaces $smarty->plugins_dir; +Smarty setPluginsDir( array|string $path ) +replaces $smarty->plugins_dir = "foo"; +Smarty addPluginsDir( array|string $path ) +replaces $smarty->plugins_dir[] = "bar"; + +string getCompileDir() +replaces $smarty->compile_dir; +Smarty setCompileDir( string $path ) +replaces $smarty->compile_dir = "foo"; + +string getCacheDir() +replaces $smarty->cache_dir; +Smarty setCacheDir( string $path ) +replaces $smarty->cache_dir; diff --git a/lib/Smarty-3.1.21/change_log.txt b/lib/Smarty-3.1.21/change_log.txt new file mode 100644 index 0000000..a016165 --- /dev/null +++ b/lib/Smarty-3.1.21/change_log.txt @@ -0,0 +1,2415 @@ + ===== 3.1.22-dev ===== (xx.xx.2014) + ===== 3.1.21 ===== (18.10.2014) + 18.10.2014 + - composer moved to github + - add COMPOSER_RELEASE_NOTES + + 17.10.2014 + - bugfix on $php_handling security and optimization of smarty_internal_parsetree (Thue Kristensen) + + 16.10.2014 + - bugfix composer.json update + + 15.10.2014 + - bugfix calling a new created cache file with fetch() and Smarty::CACHING_LIFETIME_SAVED multiple times did fail (forum 22350) + + 14.10.2014 + - bugfix any tag placed within " diff --git a/lib/Smarty-3.1.21/libs/plugins/block.textformat.php b/lib/Smarty-3.1.21/libs/plugins/block.textformat.php new file mode 100644 index 0000000..abf5449 --- /dev/null +++ b/lib/Smarty-3.1.21/libs/plugins/block.textformat.php @@ -0,0 +1,110 @@ + + * Name: textformat
+ * Purpose: format text a certain way with preset styles + * or custom wrap/indent settings
+ * Params: + *
+ * - style         - string (email)
+ * - indent        - integer (0)
+ * - wrap          - integer (80)
+ * - wrap_char     - string ("\n")
+ * - indent_char   - string (" ")
+ * - wrap_boundary - boolean (true)
+ * 
+ * + * @link http://www.smarty.net/manual/en/language.function.textformat.php {textformat} + * (Smarty online manual) + * + * @param array $params parameters + * @param string $content contents of the block + * @param Smarty_Internal_Template $template template object + * @param boolean &$repeat repeat flag + * + * @return string content re-formatted + * @author Monte Ohrt + */ +function smarty_block_textformat($params, $content, $template, &$repeat) +{ + if (is_null($content)) { + return; + } + + $style = null; + $indent = 0; + $indent_first = 0; + $indent_char = ' '; + $wrap = 80; + $wrap_char = "\n"; + $wrap_cut = false; + $assign = null; + + foreach ($params as $_key => $_val) { + switch ($_key) { + case 'style': + case 'indent_char': + case 'wrap_char': + case 'assign': + $$_key = (string) $_val; + break; + + case 'indent': + case 'indent_first': + case 'wrap': + $$_key = (int) $_val; + break; + + case 'wrap_cut': + $$_key = (bool) $_val; + break; + + default: + trigger_error("textformat: unknown attribute '$_key'"); + } + } + + if ($style == 'email') { + $wrap = 72; + } + // split into paragraphs + $_paragraphs = preg_split('![\r\n]{2}!', $content); + + foreach ($_paragraphs as &$_paragraph) { + if (!$_paragraph) { + continue; + } + // convert mult. spaces & special chars to single space + $_paragraph = preg_replace(array('!\s+!' . Smarty::$_UTF8_MODIFIER, '!(^\s+)|(\s+$)!' . Smarty::$_UTF8_MODIFIER), array(' ', ''), $_paragraph); + // indent first line + if ($indent_first > 0) { + $_paragraph = str_repeat($indent_char, $indent_first) . $_paragraph; + } + // wordwrap sentences + if (Smarty::$_MBSTRING) { + require_once(SMARTY_PLUGINS_DIR . 'shared.mb_wordwrap.php'); + $_paragraph = smarty_mb_wordwrap($_paragraph, $wrap - $indent, $wrap_char, $wrap_cut); + } else { + $_paragraph = wordwrap($_paragraph, $wrap - $indent, $wrap_char, $wrap_cut); + } + // indent lines + if ($indent > 0) { + $_paragraph = preg_replace('!^!m', str_repeat($indent_char, $indent), $_paragraph); + } + } + $_output = implode($wrap_char . $wrap_char, $_paragraphs); + + if ($assign) { + $template->assign($assign, $_output); + } else { + return $_output; + } +} diff --git a/lib/Smarty-3.1.21/libs/plugins/function.counter.php b/lib/Smarty-3.1.21/libs/plugins/function.counter.php new file mode 100644 index 0000000..4da85a1 --- /dev/null +++ b/lib/Smarty-3.1.21/libs/plugins/function.counter.php @@ -0,0 +1,78 @@ + + * Name: counter
+ * Purpose: print out a counter value + * + * @author Monte Ohrt + * @link http://www.smarty.net/manual/en/language.function.counter.php {counter} + * (Smarty online manual) + * + * @param array $params parameters + * @param Smarty_Internal_Template $template template object + * + * @return string|null + */ +function smarty_function_counter($params, $template) +{ + static $counters = array(); + + $name = (isset($params['name'])) ? $params['name'] : 'default'; + if (!isset($counters[$name])) { + $counters[$name] = array( + 'start' => 1, + 'skip' => 1, + 'direction' => 'up', + 'count' => 1 + ); + } + $counter =& $counters[$name]; + + if (isset($params['start'])) { + $counter['start'] = $counter['count'] = (int) $params['start']; + } + + if (!empty($params['assign'])) { + $counter['assign'] = $params['assign']; + } + + if (isset($counter['assign'])) { + $template->assign($counter['assign'], $counter['count']); + } + + if (isset($params['print'])) { + $print = (bool) $params['print']; + } else { + $print = empty($counter['assign']); + } + + if ($print) { + $retval = $counter['count']; + } else { + $retval = null; + } + + if (isset($params['skip'])) { + $counter['skip'] = $params['skip']; + } + + if (isset($params['direction'])) { + $counter['direction'] = $params['direction']; + } + + if ($counter['direction'] == "down") { + $counter['count'] -= $counter['skip']; + } else { + $counter['count'] += $counter['skip']; + } + + return $retval; +} diff --git a/lib/Smarty-3.1.21/libs/plugins/function.cycle.php b/lib/Smarty-3.1.21/libs/plugins/function.cycle.php new file mode 100644 index 0000000..8dc5cd9 --- /dev/null +++ b/lib/Smarty-3.1.21/libs/plugins/function.cycle.php @@ -0,0 +1,107 @@ + + * Name: cycle
+ * Date: May 3, 2002
+ * Purpose: cycle through given values
+ * Params: + *
+ * - name      - name of cycle (optional)
+ * - values    - comma separated list of values to cycle, or an array of values to cycle
+ *               (this can be left out for subsequent calls)
+ * - reset     - boolean - resets given var to true
+ * - print     - boolean - print var or not. default is true
+ * - advance   - boolean - whether or not to advance the cycle
+ * - delimiter - the value delimiter, default is ","
+ * - assign    - boolean, assigns to template var instead of printed.
+ * 
+ * Examples:
+ *
+ * {cycle values="#eeeeee,#d0d0d0d"}
+ * {cycle name=row values="one,two,three" reset=true}
+ * {cycle name=row}
+ * 
+ * + * @link http://www.smarty.net/manual/en/language.function.cycle.php {cycle} + * (Smarty online manual) + * @author Monte Ohrt + * @author credit to Mark Priatel + * @author credit to Gerard + * @author credit to Jason Sweat + * @version 1.3 + * + * @param array $params parameters + * @param Smarty_Internal_Template $template template object + * + * @return string|null + */ + +function smarty_function_cycle($params, $template) +{ + static $cycle_vars; + + $name = (empty($params['name'])) ? 'default' : $params['name']; + $print = (isset($params['print'])) ? (bool) $params['print'] : true; + $advance = (isset($params['advance'])) ? (bool) $params['advance'] : true; + $reset = (isset($params['reset'])) ? (bool) $params['reset'] : false; + + if (!isset($params['values'])) { + if (!isset($cycle_vars[$name]['values'])) { + trigger_error("cycle: missing 'values' parameter"); + + return; + } + } else { + if (isset($cycle_vars[$name]['values']) + && $cycle_vars[$name]['values'] != $params['values'] + ) { + $cycle_vars[$name]['index'] = 0; + } + $cycle_vars[$name]['values'] = $params['values']; + } + + if (isset($params['delimiter'])) { + $cycle_vars[$name]['delimiter'] = $params['delimiter']; + } elseif (!isset($cycle_vars[$name]['delimiter'])) { + $cycle_vars[$name]['delimiter'] = ','; + } + + if (is_array($cycle_vars[$name]['values'])) { + $cycle_array = $cycle_vars[$name]['values']; + } else { + $cycle_array = explode($cycle_vars[$name]['delimiter'], $cycle_vars[$name]['values']); + } + + if (!isset($cycle_vars[$name]['index']) || $reset) { + $cycle_vars[$name]['index'] = 0; + } + + if (isset($params['assign'])) { + $print = false; + $template->assign($params['assign'], $cycle_array[$cycle_vars[$name]['index']]); + } + + if ($print) { + $retval = $cycle_array[$cycle_vars[$name]['index']]; + } else { + $retval = null; + } + + if ($advance) { + if ($cycle_vars[$name]['index'] >= count($cycle_array) - 1) { + $cycle_vars[$name]['index'] = 0; + } else { + $cycle_vars[$name]['index'] ++; + } + } + + return $retval; +} diff --git a/lib/Smarty-3.1.21/libs/plugins/function.fetch.php b/lib/Smarty-3.1.21/libs/plugins/function.fetch.php new file mode 100644 index 0000000..3506d4a --- /dev/null +++ b/lib/Smarty-3.1.21/libs/plugins/function.fetch.php @@ -0,0 +1,221 @@ + + * Name: fetch
+ * Purpose: fetch file, web or ftp data and display results + * + * @link http://www.smarty.net/manual/en/language.function.fetch.php {fetch} + * (Smarty online manual) + * @author Monte Ohrt + * + * @param array $params parameters + * @param Smarty_Internal_Template $template template object + * + * @throws SmartyException + * @return string|null if the assign parameter is passed, Smarty assigns the result to a template variable + */ +function smarty_function_fetch($params, $template) +{ + if (empty($params['file'])) { + trigger_error("[plugin] fetch parameter 'file' cannot be empty", E_USER_NOTICE); + + return; + } + + // strip file protocol + if (stripos($params['file'], 'file://') === 0) { + $params['file'] = substr($params['file'], 7); + } + + $protocol = strpos($params['file'], '://'); + if ($protocol !== false) { + $protocol = strtolower(substr($params['file'], 0, $protocol)); + } + + if (isset($template->smarty->security_policy)) { + if ($protocol) { + // remote resource (or php stream, …) + if (!$template->smarty->security_policy->isTrustedUri($params['file'])) { + return; + } + } else { + // local file + if (!$template->smarty->security_policy->isTrustedResourceDir($params['file'])) { + return; + } + } + } + + $content = ''; + if ($protocol == 'http') { + // http fetch + if ($uri_parts = parse_url($params['file'])) { + // set defaults + $host = $server_name = $uri_parts['host']; + $timeout = 30; + $accept = "image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*"; + $agent = "Smarty Template Engine " . Smarty::SMARTY_VERSION; + $referer = ""; + $uri = !empty($uri_parts['path']) ? $uri_parts['path'] : '/'; + $uri .= !empty($uri_parts['query']) ? '?' . $uri_parts['query'] : ''; + $_is_proxy = false; + if (empty($uri_parts['port'])) { + $port = 80; + } else { + $port = $uri_parts['port']; + } + if (!empty($uri_parts['user'])) { + $user = $uri_parts['user']; + } + if (!empty($uri_parts['pass'])) { + $pass = $uri_parts['pass']; + } + // loop through parameters, setup headers + foreach ($params as $param_key => $param_value) { + switch ($param_key) { + case "file": + case "assign": + case "assign_headers": + break; + case "user": + if (!empty($param_value)) { + $user = $param_value; + } + break; + case "pass": + if (!empty($param_value)) { + $pass = $param_value; + } + break; + case "accept": + if (!empty($param_value)) { + $accept = $param_value; + } + break; + case "header": + if (!empty($param_value)) { + if (!preg_match('![\w\d-]+: .+!', $param_value)) { + trigger_error("[plugin] invalid header format '" . $param_value . "'", E_USER_NOTICE); + + return; + } else { + $extra_headers[] = $param_value; + } + } + break; + case "proxy_host": + if (!empty($param_value)) { + $proxy_host = $param_value; + } + break; + case "proxy_port": + if (!preg_match('!\D!', $param_value)) { + $proxy_port = (int) $param_value; + } else { + trigger_error("[plugin] invalid value for attribute '" . $param_key . "'", E_USER_NOTICE); + + return; + } + break; + case "agent": + if (!empty($param_value)) { + $agent = $param_value; + } + break; + case "referer": + if (!empty($param_value)) { + $referer = $param_value; + } + break; + case "timeout": + if (!preg_match('!\D!', $param_value)) { + $timeout = (int) $param_value; + } else { + trigger_error("[plugin] invalid value for attribute '" . $param_key . "'", E_USER_NOTICE); + + return; + } + break; + default: + trigger_error("[plugin] unrecognized attribute '" . $param_key . "'", E_USER_NOTICE); + + return; + } + } + if (!empty($proxy_host) && !empty($proxy_port)) { + $_is_proxy = true; + $fp = fsockopen($proxy_host, $proxy_port, $errno, $errstr, $timeout); + } else { + $fp = fsockopen($server_name, $port, $errno, $errstr, $timeout); + } + + if (!$fp) { + trigger_error("[plugin] unable to fetch: $errstr ($errno)", E_USER_NOTICE); + + return; + } else { + if ($_is_proxy) { + fputs($fp, 'GET ' . $params['file'] . " HTTP/1.0\r\n"); + } else { + fputs($fp, "GET $uri HTTP/1.0\r\n"); + } + if (!empty($host)) { + fputs($fp, "Host: $host\r\n"); + } + if (!empty($accept)) { + fputs($fp, "Accept: $accept\r\n"); + } + if (!empty($agent)) { + fputs($fp, "User-Agent: $agent\r\n"); + } + if (!empty($referer)) { + fputs($fp, "Referer: $referer\r\n"); + } + if (isset($extra_headers) && is_array($extra_headers)) { + foreach ($extra_headers as $curr_header) { + fputs($fp, $curr_header . "\r\n"); + } + } + if (!empty($user) && !empty($pass)) { + fputs($fp, "Authorization: BASIC " . base64_encode("$user:$pass") . "\r\n"); + } + + fputs($fp, "\r\n"); + while (!feof($fp)) { + $content .= fgets($fp, 4096); + } + fclose($fp); + $csplit = preg_split("!\r\n\r\n!", $content, 2); + + $content = $csplit[1]; + + if (!empty($params['assign_headers'])) { + $template->assign($params['assign_headers'], preg_split("!\r\n!", $csplit[0])); + } + } + } else { + trigger_error("[plugin fetch] unable to parse URL, check syntax", E_USER_NOTICE); + + return; + } + } else { + $content = @file_get_contents($params['file']); + if ($content === false) { + throw new SmartyException("{fetch} cannot read resource '" . $params['file'] . "'"); + } + } + + if (!empty($params['assign'])) { + $template->assign($params['assign'], $content); + } else { + return $content; + } +} diff --git a/lib/Smarty-3.1.21/libs/plugins/function.html_checkboxes.php b/lib/Smarty-3.1.21/libs/plugins/function.html_checkboxes.php new file mode 100644 index 0000000..d786803 --- /dev/null +++ b/lib/Smarty-3.1.21/libs/plugins/function.html_checkboxes.php @@ -0,0 +1,237 @@ + + * Type: function
+ * Name: html_checkboxes
+ * Date: 24.Feb.2003
+ * Purpose: Prints out a list of checkbox input types
+ * Examples: + *
+ * {html_checkboxes values=$ids output=$names}
+ * {html_checkboxes values=$ids name='box' separator='
' output=$names} + * {html_checkboxes values=$ids checked=$checked separator='
' output=$names} + *
+ * Params: + *
+ * - name       (optional) - string default "checkbox"
+ * - values     (required) - array
+ * - options    (optional) - associative array
+ * - checked    (optional) - array default not set
+ * - separator  (optional) - ie 
or   + * - output (optional) - the output next to each checkbox + * - assign (optional) - assign the output as an array to this variable + * - escape (optional) - escape the content (not value), defaults to true + *
+ * + * @link http://www.smarty.net/manual/en/language.function.html.checkboxes.php {html_checkboxes} + * (Smarty online manual) + * @author Christopher Kvarme + * @author credits to Monte Ohrt + * @version 1.0 + * + * @param array $params parameters + * @param object $template template object + * + * @return string + * @uses smarty_function_escape_special_chars() + */ +function smarty_function_html_checkboxes($params, $template) +{ + require_once(SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php'); + + $name = 'checkbox'; + $values = null; + $options = null; + $selected = array(); + $separator = ''; + $escape = true; + $labels = true; + $label_ids = false; + $output = null; + + $extra = ''; + + foreach ($params as $_key => $_val) { + switch ($_key) { + case 'name': + case 'separator': + $$_key = (string) $_val; + break; + + case 'escape': + case 'labels': + case 'label_ids': + $$_key = (bool) $_val; + break; + + case 'options': + $$_key = (array) $_val; + break; + + case 'values': + case 'output': + $$_key = array_values((array) $_val); + break; + + case 'checked': + case 'selected': + if (is_array($_val)) { + $selected = array(); + foreach ($_val as $_sel) { + if (is_object($_sel)) { + if (method_exists($_sel, "__toString")) { + $_sel = smarty_function_escape_special_chars((string) $_sel->__toString()); + } else { + trigger_error("html_checkboxes: selected attribute contains an object of class '" . get_class($_sel) . "' without __toString() method", E_USER_NOTICE); + continue; + } + } else { + $_sel = smarty_function_escape_special_chars((string) $_sel); + } + $selected[$_sel] = true; + } + } elseif (is_object($_val)) { + if (method_exists($_val, "__toString")) { + $selected = smarty_function_escape_special_chars((string) $_val->__toString()); + } else { + trigger_error("html_checkboxes: selected attribute is an object of class '" . get_class($_val) . "' without __toString() method", E_USER_NOTICE); + } + } else { + $selected = smarty_function_escape_special_chars((string) $_val); + } + break; + + case 'checkboxes': + trigger_error('html_checkboxes: the use of the "checkboxes" attribute is deprecated, use "options" instead', E_USER_WARNING); + $options = (array) $_val; + break; + + case 'assign': + break; + + case 'strict': + break; + + case 'disabled': + case 'readonly': + if (!empty($params['strict'])) { + if (!is_scalar($_val)) { + trigger_error("html_options: $_key attribute must be a scalar, only boolean true or string '$_key' will actually add the attribute", E_USER_NOTICE); + } + + if ($_val === true || $_val === $_key) { + $extra .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_key) . '"'; + } + + break; + } + // omit break; to fall through! + + default: + if (!is_array($_val)) { + $extra .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_val) . '"'; + } else { + trigger_error("html_checkboxes: extra attribute '$_key' cannot be an array", E_USER_NOTICE); + } + break; + } + } + + if (!isset($options) && !isset($values)) { + return ''; + } /* raise error here? */ + + $_html_result = array(); + + if (isset($options)) { + foreach ($options as $_key => $_val) { + $_html_result[] = smarty_function_html_checkboxes_output($name, $_key, $_val, $selected, $extra, $separator, $labels, $label_ids, $escape); + } + } else { + foreach ($values as $_i => $_key) { + $_val = isset($output[$_i]) ? $output[$_i] : ''; + $_html_result[] = smarty_function_html_checkboxes_output($name, $_key, $_val, $selected, $extra, $separator, $labels, $label_ids, $escape); + } + } + + if (!empty($params['assign'])) { + $template->assign($params['assign'], $_html_result); + } else { + return implode("\n", $_html_result); + } +} + +function smarty_function_html_checkboxes_output($name, $value, $output, $selected, $extra, $separator, $labels, $label_ids, $escape = true) +{ + $_output = ''; + + if (is_object($value)) { + if (method_exists($value, "__toString")) { + $value = (string) $value->__toString(); + } else { + trigger_error("html_options: value is an object of class '" . get_class($value) . "' without __toString() method", E_USER_NOTICE); + + return ''; + } + } else { + $value = (string) $value; + } + + if (is_object($output)) { + if (method_exists($output, "__toString")) { + $output = (string) $output->__toString(); + } else { + trigger_error("html_options: output is an object of class '" . get_class($output) . "' without __toString() method", E_USER_NOTICE); + + return ''; + } + } else { + $output = (string) $output; + } + + if ($labels) { + if ($label_ids) { + $_id = smarty_function_escape_special_chars(preg_replace('![^\w\-\.]!' . Smarty::$_UTF8_MODIFIER, '_', $name . '_' . $value)); + $_output .= '