From 60d166324f183471d2a7f6bc3e019ad04034d395 Mon Sep 17 00:00:00 2001 From: "de Castro Sanchez, Julio Ezequiel" Date: Mon, 23 Feb 2026 19:26:28 +0100 Subject: [PATCH 1/2] Prepare for PHP 8.5 and PHP 9.0: Rule: NullToStrictStringFuncCallArgRector (https://getrector.com/rule-detail/null-to-strict-string-func-call-arg-rector) In versions of PHP prior to 8.1, passing null to native functions that expected a string (such as strlen(), explode(), trim(), or str_replace()) would trigger an internal "coercion." PHP would silently convert the null value into an empty string (""), allowing the execution to continue without warnings. As of PHP 8.1, this behavior was deprecated, and in PHP 8.4 and 8.5, the engine has moved towards strict type enforcement. This Rector rule explicitly adds a (string) cast to arguments passed to these native functions whenever the variable could potentially be null. --- class2.php | 36 +- comment.php | 6 +- contact.php | 14 +- e107_admin/admin_log.php | 42 +- e107_admin/auth.php | 8 +- e107_admin/banlist.php | 4 +- e107_admin/banlist_export.php | 4 +- e107_admin/boot.php | 4 +- e107_admin/cpage.php | 42 +- e107_admin/cron.php | 10 +- e107_admin/db.php | 52 +- e107_admin/docs.php | 2 +- e107_admin/emoticon.php | 28 +- e107_admin/eurl.php | 28 +- e107_admin/fileinspector.php | 20 +- e107_admin/footer.php | 20 +- e107_admin/frontpage.php | 12 +- e107_admin/header.php | 4 +- e107_admin/history.php | 44 +- e107_admin/image.php | 232 +++--- e107_admin/includes/flexpanel.php | 2 +- e107_admin/includes/infopanel.php | 194 ++--- e107_admin/lancheck.php | 160 ++--- e107_admin/language.php | 50 +- e107_admin/links.php | 10 +- e107_admin/mailout.php | 122 ++-- e107_admin/menus.php | 4 +- e107_admin/meta.php | 6 +- e107_admin/newspost.php | 32 +- e107_admin/notify.php | 4 +- e107_admin/plugin.php | 36 +- e107_admin/prefs.php | 218 +++--- e107_admin/theme.php | 40 +- e107_admin/ugflag.php | 12 +- e107_admin/update_routines.php | 28 +- e107_admin/updateadmin.php | 2 +- e107_admin/upload.php | 2 +- e107_admin/users.php | 378 +++++----- e107_admin/users_extended.php | 8 +- e107_admin/wmessage.php | 30 +- e107_core/bbcodes/bb_block.php | 4 +- e107_core/bbcodes/bb_code.php | 2 +- e107_core/bbcodes/bb_h.php | 4 +- e107_core/bbcodes/bb_img.php | 2 +- e107_core/bbcodes/bb_nobr.php | 2 +- e107_core/bbcodes/bb_p.php | 8 +- e107_core/bbcodes/bb_youtube.php | 28 +- .../shortcodes/batch/admin_shortcodes.php | 46 +- .../shortcodes/batch/bbcode_shortcodes.php | 10 +- .../shortcodes/batch/comment_shortcodes.php | 8 +- .../shortcodes/batch/contact_shortcodes.php | 2 +- .../batch/navigation_shortcodes.php | 16 +- .../shortcodes/batch/news_shortcodes.php | 16 +- .../shortcodes/batch/page_shortcodes.php | 16 +- .../shortcodes/batch/signup_shortcodes.php | 2 +- .../shortcodes/batch/user_shortcodes.php | 32 +- .../batch/usersettings_shortcodes.php | 4 +- e107_core/shortcodes/single/custom.php | 2 +- e107_core/shortcodes/single/iconpicker.php | 4 +- e107_core/shortcodes/single/imagepreview.php | 4 +- e107_core/shortcodes/single/imageselector.php | 8 +- e107_core/shortcodes/single/lan.php | 2 +- e107_core/shortcodes/single/menu.php | 4 +- e107_core/shortcodes/single/nextprev.php | 16 +- e107_core/shortcodes/single/sitelinks_alt.php | 8 +- e107_core/shortcodes/single/sublinks.php | 2 +- e107_core/shortcodes/single/uploadfile.php | 2 +- e107_core/shortcodes/single/user_avatar.php | 22 +- e107_core/shortcodes/single/user_extended.php | 4 +- e107_core/templates/email_template.php | 10 +- e107_core/templates/footer_default.php | 26 +- e107_core/templates/header_default.php | 28 +- e107_core/url/news/sef_noid_url.php | 2 +- e107_core/url/news/sef_url.php | 48 +- e107_handlers/admin_log_class.php | 4 +- e107_handlers/admin_ui.php | 440 ++++++------ e107_handlers/application.php | 52 +- e107_handlers/bbcode_handler.php | 26 +- e107_handlers/bounce_handler.php | 72 +- e107_handlers/cache_handler.php | 6 +- e107_handlers/chart_class.php | 12 +- e107_handlers/cli_class.php | 2 +- e107_handlers/comment_class.php | 216 +++--- e107_handlers/core_functions.php | 12 +- e107_handlers/cron_class.php | 20 +- e107_handlers/date_handler.php | 44 +- e107_handlers/db_debug_class.php | 8 +- e107_handlers/db_table_admin_class.php | 40 +- e107_handlers/db_verify_class.php | 78 +- e107_handlers/debug_handler.php | 4 +- e107_handlers/e107_class.php | 102 +-- e107_handlers/e_customfields_class.php | 6 +- e107_handlers/e_db_pdo_class.php | 34 +- e107_handlers/e_emote_class.php | 6 +- e107_handlers/e_file_inspector.php | 6 +- e107_handlers/e_file_inspector_json.php | 4 +- e107_handlers/e_marketplace.php | 16 +- e107_handlers/e_parse_class.php | 106 +-- e107_handlers/e_pluginbuilder_class.php | 30 +- e107_handlers/e_profanity_class.php | 8 +- e107_handlers/e_ranks_class.php | 4 +- e107_handlers/e_render_class.php | 2 +- e107_handlers/e_signup_class.php | 6 +- e107_handlers/e_thumbnail_class.php | 8 +- e107_handlers/e_upgrade_class.php | 2 +- e107_handlers/error_page_class.php | 2 +- e107_handlers/event_class.php | 6 +- e107_handlers/file_class.php | 20 +- e107_handlers/form_handler.php | 678 +++++++++--------- e107_handlers/iphandler_class.php | 4 +- e107_handlers/js_manager.php | 48 +- e107_handlers/jslib_handler.php | 34 +- e107_handlers/language_class.php | 8 +- e107_handlers/library_manager.php | 4 +- e107_handlers/login.php | 12 +- e107_handlers/magpie_rss.php | 14 +- e107_handlers/mail.php | 62 +- e107_handlers/mail_manager_class.php | 8 +- e107_handlers/mail_template_class.php | 6 +- e107_handlers/mail_validation_class.php | 38 +- e107_handlers/mailout_admin_class.php | 22 +- e107_handlers/mailout_class.php | 4 +- e107_handlers/media_class.php | 18 +- e107_handlers/menu_class.php | 16 +- e107_handlers/menumanager_class.php | 254 +++---- e107_handlers/message_handler.php | 2 +- e107_handlers/model_class.php | 14 +- e107_handlers/mysql_class.php | 34 +- e107_handlers/news_class.php | 8 +- e107_handlers/notify_class.php | 8 +- e107_handlers/online_class.php | 12 +- e107_handlers/pclerror.lib.php | 2 +- e107_handlers/pcltar.lib.php | 126 ++-- e107_handlers/pcltrace.lib.php | 6 +- e107_handlers/pclzip.lib.php | 122 ++-- e107_handlers/plugin_class.php | 86 +-- e107_handlers/pop3_class.php | 10 +- e107_handlers/pop_bounce_handler.php | 10 +- e107_handlers/pref_class.php | 4 +- e107_handlers/rate_class.php | 24 +- e107_handlers/redirection_class.php | 12 +- e107_handlers/ren_help.php | 24 +- e107_handlers/resize_handler.php | 2 +- e107_handlers/search/comments_download.php | 2 +- e107_handlers/search/comments_news.php | 2 +- e107_handlers/search/comments_page.php | 2 +- e107_handlers/search/comments_user.php | 2 +- e107_handlers/search_class.php | 28 +- e107_handlers/secure_img_handler.php | 4 +- e107_handlers/session_handler.php | 20 +- e107_handlers/shortcode_handler.php | 116 +-- e107_handlers/sitelinks_class.php | 78 +- e107_handlers/traffic_class_display.php | 2 +- e107_handlers/upload_handler.php | 14 +- e107_handlers/user_extended_class.php | 32 +- e107_handlers/user_handler.php | 16 +- e107_handlers/user_model.php | 16 +- e107_handlers/user_select_class.php | 2 +- e107_handlers/userclass_class.php | 66 +- e107_handlers/validator_class.php | 24 +- .../vendor/guzzlehttp/psr7/src/Message.php | 16 +- .../guzzlehttp/psr7/src/MessageTrait.php | 10 +- .../guzzlehttp/psr7/src/ServerRequest.php | 2 +- .../vendor/guzzlehttp/psr7/src/Uri.php | 2 +- .../guzzlehttp/psr7/src/UriNormalizer.php | 4 +- .../hybridauth/src/Adapter/OAuth1.php | 4 +- .../hybridauth/src/Adapter/OAuth2.php | 2 +- .../hybridauth/hybridauth/src/Data/Parser.php | 6 +- .../hybridauth/src/HttpClient/Curl.php | 2 +- .../hybridauth/src/Provider/Apple.php | 6 +- .../hybridauth/src/Provider/DeviantArt.php | 2 +- .../hybridauth/src/Provider/Facebook.php | 8 +- .../hybridauth/src/Provider/Medium.php | 2 +- .../src/Provider/MicrosoftGraph.php | 2 +- .../hybridauth/src/Provider/Slack.php | 2 +- .../hybridauth/src/Provider/Steam.php | 2 +- .../hybridauth/src/Provider/Telegram.php | 4 +- .../hybridauth/src/Provider/Tumblr.php | 4 +- .../hybridauth/src/Provider/TwitchTV.php | 2 +- .../hybridauth/src/Storage/Session.php | 2 +- .../src/Thirdparty/OAuth/OAuthRequest.php | 12 +- .../OAuth/OAuthSignatureMethodHMACSHA1.php | 2 +- .../src/Thirdparty/OAuth/OAuthUtil.php | 10 +- .../src/Thirdparty/OpenID/LightOpenID.php | 64 +- .../src/Ifsnop/Mysqldump/Mysqldump.php | 14 +- .../Intervention/Image/AbstractDecoder.php | 2 +- .../Intervention/Image/Commands/Argument.php | 2 +- .../Image/Gd/Commands/FlipCommand.php | 2 +- .../Image/Gd/Commands/TrimCommand.php | 4 +- .../image/src/Intervention/Image/Gd/Font.php | 2 +- .../Image/Imagick/Commands/ExifCommand.php | 4 +- .../Image/Imagick/Commands/FlipCommand.php | 2 +- .../Image/Imagick/Commands/TrimCommand.php | 4 +- .../vendor/matthiasmullie/minify/src/CSS.php | 52 +- .../vendor/matthiasmullie/minify/src/JS.php | 54 +- .../matthiasmullie/minify/src/Minify.php | 4 +- .../path-converter/src/Converter.php | 2 +- .../phpmailer/phpmailer/get_oauth_token.php | 2 +- .../phpmailer/phpmailer/src/PHPMailer.php | 32 +- .../vendor/phpmailer/phpmailer/src/SMTP.php | 10 +- .../getallheaders/src/getallheaders.php | 4 +- e107_handlers/xml_class.php | 26 +- e107_images/secimg.php | 2 +- e107_plugins/_blank/admin_config.php | 16 +- e107_plugins/_blank/e_frontpage.php | 2 +- e107_plugins/_blank/e_related.php | 8 +- e107_plugins/_blank/e_search.php | 2 +- e107_plugins/alt_auth/alt_auth_adminmenu.php | 10 +- e107_plugins/alt_auth/alt_auth_conf.php | 4 +- .../alt_auth/alt_auth_login_class.php | 8 +- e107_plugins/alt_auth/e107db_auth.php | 10 +- .../alt_auth/extended_password_handler.php | 10 +- e107_plugins/alt_auth/ldap_auth.php | 12 +- e107_plugins/alt_auth/otherdb_auth.php | 6 +- e107_plugins/alt_auth/radius_auth.php | 6 +- e107_plugins/banner/admin_banner.php | 146 ++-- e107_plugins/banner/banner.php | 4 +- e107_plugins/banner/banner_menu.php | 2 +- e107_plugins/banner/e_shortcode.php | 4 +- .../blogcalendar_menu/blogcalendar_menu.php | 2 +- e107_plugins/blogcalendar_menu/functions.php | 4 +- e107_plugins/chatbox_menu/chatbox_menu.php | 4 +- .../chatbox_menu/chatbox_menu_shortcodes.php | 4 +- e107_plugins/chatbox_menu/e_list.php | 4 +- e107_plugins/chatbox_menu/e_rss.php | 22 +- e107_plugins/chatbox_menu/e_search.php | 20 +- .../comment_menu/comment_menu_shortcodes.php | 20 +- e107_plugins/comment_menu/config.php | 4 +- e107_plugins/download/download_shortcodes.php | 6 +- e107_plugins/download/e_rss.php | 2 +- .../handlers/NginxSecureLinkMd5Decorator.php | 4 +- .../download/handlers/category_class.php | 2 +- .../download/handlers/download_class.php | 64 +- e107_plugins/download/includes/admin.php | 138 ++-- e107_plugins/download/request.php | 20 +- .../download/vendor/shim_http_build_url.php | 2 +- e107_plugins/faqs/admin_config.php | 18 +- e107_plugins/faqs/controllers/e107.list.php | 2 +- e107_plugins/faqs/e_search.php | 14 +- e107_plugins/faqs/faqs.php | 16 +- e107_plugins/faqs/faqs_setup.php | 8 +- e107_plugins/faqs/faqs_shortcodes.php | 14 +- e107_plugins/featurebox/admin_config.php | 2 +- e107_plugins/featurebox/e_rss.php | 14 +- e107_plugins/featurebox/e_shortcode.php | 2 +- e107_plugins/featurebox/includes/item.php | 4 +- e107_plugins/featurebox/includes/tree.php | 2 +- e107_plugins/forum/e_event.php | 2 +- e107_plugins/forum/e_list.php | 2 +- e107_plugins/forum/e_menu.php | 4 +- e107_plugins/forum/forum.php | 4 +- e107_plugins/forum/forum_class.php | 36 +- e107_plugins/forum/forum_mod.php | 2 +- e107_plugins/forum/forum_post.php | 22 +- e107_plugins/forum/forum_setup.php | 2 +- e107_plugins/forum/forum_stats.php | 4 +- e107_plugins/forum/forum_update.php | 34 +- e107_plugins/forum/forum_uploads.php | 4 +- e107_plugins/forum/forum_viewforum.php | 16 +- e107_plugins/forum/forum_viewtopic.php | 6 +- .../forum/languages/English/English_front.php | 22 +- .../shortcodes/batch/forum_shortcodes.php | 12 +- .../shortcodes/batch/post_shortcodes.php | 18 +- .../shortcodes/batch/view_shortcodes.php | 10 +- .../shortcodes/batch/viewforum_shortcodes.php | 4 +- .../templates/forum_viewforum_template.php | 2 +- e107_plugins/gallery/admin_gallery.php | 2 +- .../shortcodes/batch/gallery_shortcodes.php | 20 +- e107_plugins/gsitemap/admin_config.php | 142 ++-- e107_plugins/hero/admin_config.php | 42 +- e107_plugins/import/admin_import.php | 414 +++++------ e107_plugins/import/import_classes.php | 22 +- e107_plugins/import/import_user_class.php | 10 +- .../import/providers/PHPNuke_import_class.php | 2 +- .../import/providers/blogger_import_class.php | 24 +- .../providers/coppermine_import_class.php | 8 +- .../import/providers/drupal_import_class.php | 2 +- .../import/providers/e107_import_class.php | 2 +- .../import/providers/html_import_class.php | 30 +- .../providers/livejournal_import_class.php | 30 +- .../import/providers/phpbb3_import_class.php | 146 ++-- .../import/providers/rss_import_class.php | 62 +- .../import/providers/smf_import_class.php | 66 +- .../providers/template_import_class.php | 6 +- .../providers/wordpress_import_class.php | 20 +- .../import/providers/xoops_import_class.php | 2 +- e107_plugins/linkwords/e_parse.php | 10 +- e107_plugins/list_new/list_admin_class.php | 8 +- e107_plugins/list_new/list_class.php | 6 +- e107_plugins/list_new/section/list_news.php | 2 +- e107_plugins/login_menu/login_menu.php | 16 +- e107_plugins/login_menu/login_menu_class.php | 14 +- .../login_menu/login_menu_shortcodes.php | 4 +- e107_plugins/news/e_gsitemap.php | 2 +- e107_plugins/news/e_related.php | 8 +- e107_plugins/news/e_rss.php | 4 +- e107_plugins/news/e_search.php | 40 +- e107_plugins/news/news.php | 28 +- e107_plugins/news/news_archive_menu.php | 18 +- e107_plugins/news/news_months_menu.php | 4 +- e107_plugins/newsfeed/admin_config.php | 10 +- e107_plugins/newsfeed/newsfeed_functions.php | 28 +- e107_plugins/newsletter/admin_config.php | 12 +- e107_plugins/newsletter/e_mailout.php | 4 +- .../newsletter/newsletter_legacy_menu.php | 6 +- e107_plugins/online/online_shortcodes.php | 2 +- e107_plugins/page/e_search.php | 12 +- e107_plugins/page/page_menu.php | 4 +- e107_plugins/pm/admin_config.php | 26 +- e107_plugins/pm/pm.php | 10 +- e107_plugins/pm/pm_class.php | 26 +- e107_plugins/pm/pm_conf.php | 4 +- e107_plugins/pm/pm_shortcodes.php | 6 +- e107_plugins/poll/poll_class.php | 100 +-- e107_plugins/poll/search/search_comments.php | 2 +- e107_plugins/rss_menu/e_meta.php | 2 +- e107_plugins/rss_menu/rss.php | 42 +- e107_plugins/rss_menu/rss_setup.php | 2 +- e107_plugins/siteinfo/e_shortcode.php | 6 +- e107_plugins/siteinfo/sitebutton_menu.php | 4 +- e107_plugins/social/admin_config.php | 10 +- e107_plugins/social/e_event.php | 12 +- e107_plugins/social/e_shortcode.php | 12 +- .../social/includes/social_login_config.php | 8 +- e107_plugins/social/social_setup.php | 2 +- e107_plugins/tagcloud/tagcloud_class.php | 12 +- e107_plugins/tagcloud/tagcloud_menu.php | 4 +- .../templates/tagcloud_menu_template.php | 4 +- e107_plugins/tinymce4/plugins/e107/dialog.php | 184 ++--- e107_plugins/tinymce4/plugins/e107/parser.php | 6 +- e107_plugins/tinymce4/tinymce4_setup.php | 18 +- e107_plugins/tinymce4/wysiwyg.php | 4 +- e107_plugins/tinymce4/wysiwyg_class.php | 18 +- e107_plugins/user/e_dashboard.php | 50 +- e107_plugins/user/usertheme_menu.php | 2 +- e107_plugins/user/usertheme_menu_config.php | 8 +- e107_tests/lib/deployers/SFTPDeployer.php | 12 +- e107_tests/lib/deployers/cPanelDeployer.php | 16 +- e107_tests/lib/preparers/E107Preparer.php | 2 +- e107_tests/tests/_bootstrap.php | 2 +- .../templates/news/news_menu_template.php | 2 +- .../tests/_data/testcore/fs_functions.php | 28 +- .../tests/_support/Helper/DelayedDb.php | 4 +- e107_tests/tests/unit/CronParserTest.php | 6 +- e107_tests/tests/unit/TreeModelTest.php | 4 +- e107_tests/tests/unit/e107EmailTest.php | 2 +- e107_tests/tests/unit/e107Test.php | 34 +- e107_tests/tests/unit/e107pluginTest.php | 6 +- .../tests/unit/e_admin_controller_uiTest.php | 4 +- e107_tests/tests/unit/e_bbcodeTest.php | 2 +- e107_tests/tests/unit/e_customfieldsTest.php | 2 +- e107_tests/tests/unit/e_db_abstractTest.php | 4 +- e107_tests/tests/unit/e_fileTest.php | 4 +- e107_tests/tests/unit/e_formTest.php | 2 +- e107_tests/tests/unit/e_jsmanagerTest.php | 4 +- .../tests/unit/e_library_managerTest.php | 2 +- e107_tests/tests/unit/e_parseTest.php | 4 +- e107_tests/tests/unit/e_pluginTest.php | 2 +- e107_tests/tests/unit/e_pluginbuilderTest.php | 4 +- e107_tests/tests/unit/e_thumbnailTest.php | 6 +- e107_themes/bootstrap3/admin_theme.php | 6 +- e107_themes/bootstrap3/theme_shortcodes.php | 4 +- e107_themes/bootstrap5/theme_shortcodes.php | 2 +- .../templates/news/news_menu_template.php | 2 +- e107_themes/voux/theme.php | 106 +-- e107_themes/voux/theme_shortcodes.php | 4 +- e107_web/js/e_ajax.php | 2 +- e107_web/js/e_jslib.php | 12 +- email.php | 12 +- fpw.php | 4 +- gsitemap.php | 10 +- install.php | 18 +- login.php | 2 +- online.php | 28 +- page.php | 68 +- print.php | 4 +- search.php | 34 +- signup.php | 42 +- submitnews.php | 4 +- unsubscribe.php | 2 +- upload.php | 12 +- userposts.php | 2 +- usersettings.php | 4 +- 383 files changed, 4800 insertions(+), 4800 deletions(-) diff --git a/class2.php b/class2.php index 5c03ba9e14..4e251e1244 100755 --- a/class2.php +++ b/class2.php @@ -135,7 +135,7 @@ { foreach ($retrieve_prefs as $key => $pref_name) { - $retrieve_prefs[$key] = preg_replace("/\W/", '', $pref_name); + $retrieve_prefs[$key] = preg_replace("/\W/", '', (string) $pref_name); } } else @@ -647,7 +647,7 @@ if(!defined('SITENAME')) // Allow override by English_custom.php or English_global.php plugin files. { - define('SITENAME', trim($tp->toHTML($pref['sitename'], '', 'USER_TITLE,er_on,defs'))); + define('SITENAME', trim((string) $tp->toHTML($pref['sitename'], '', 'USER_TITLE,er_on,defs'))); } // @@ -1195,7 +1195,7 @@ function check_email($email) return false; } - if(is_numeric(substr($email,-1))) // fix for eCaptcha accidently typed on wrong line. + if(is_numeric(substr((string) $email,-1))) // fix for eCaptcha accidently typed on wrong line. { return false; } @@ -1204,9 +1204,9 @@ function check_email($email) { return $email; } - + return false; - + // return preg_match("/^([_a-zA-Z0-9-+]+)(\.[_a-zA-Z0-9-]+)*@([a-zA-Z0-9-]+)(\.[a-zA-Z0-9-]+)*(\.[a-zA-Z]{2,6})$/" , $email) ? $email : false; } @@ -1250,14 +1250,14 @@ function check_class($var, $userclass = null, $uid = 0) return false; } - $class_array = !is_array($userclass) ? explode(',', $userclass) : $userclass; + $class_array = !is_array($userclass) ? explode(',', (string) $userclass) : $userclass; $varList = !is_array($var) ? explode(',', (string) $var) : $var; $latchedAccess = false; foreach ($varList as $v) { - $v = trim($v); + $v = trim((string) $v); $invert = false; //value to test is a userclass name (or garbage, of course), go get the id if (!is_numeric($v)) @@ -1358,7 +1358,7 @@ function getperms($arg, $ap = null, $path = null) return true; } - if ($arg === 'P' && preg_match('#(.*?)/' .e107::getFolder('plugins'). '(.*?)/(.*?)#', $path, $matches)) + if ($arg === 'P' && preg_match('#(.*?)/' .e107::getFolder('plugins'). '(.*?)/(.*?)#', (string) $path, $matches)) { $sql = e107::getDb('psql'); @@ -1876,7 +1876,7 @@ function session_set($name, $value, $expire='', $path = e_HTTP, $domain = '', $s $path = '/'; } - setcookie($name, $value, $expire, $path, $domain, $secure, true); + setcookie($name, (string) $value, $expire, $path, $domain, $secure, true); $_COOKIE[$name] = $value; } } @@ -1994,7 +1994,7 @@ function force_userupdate($currentUser) } } - if (!e107::getPref('disable_emailcheck',true) && !trim($currentUser['user_email'])) return true; + if (!e107::getPref('disable_emailcheck',true) && !trim((string) $currentUser['user_email'])) return true; if(e107::getDb()->select('user_extended_struct', 'user_extended_struct_applicable, user_extended_struct_write, user_extended_struct_name, user_extended_struct_type', 'user_extended_struct_required = 1 AND user_extended_struct_applicable != '.e_UC_NOBODY)) { @@ -2068,7 +2068,7 @@ function __construct() return; } - if ((isset($_SERVER['QUERY_STRING']) && (strpos($_SERVER['QUERY_STRING'], 'debug=') !== false)) || isset($_COOKIE['e107_debug_level']) && ((strpos($_SERVER['QUERY_STRING'], 'debug=-')) === false) ) + if ((isset($_SERVER['QUERY_STRING']) && (strpos((string) $_SERVER['QUERY_STRING'], 'debug=') !== false)) || isset($_COOKIE['e107_debug_level']) && ((strpos((string) $_SERVER['QUERY_STRING'], 'debug=-')) === false) ) { $this->debug = true; error_reporting(E_ALL); @@ -2192,7 +2192,7 @@ function render_trace($array) "; $text .= !empty($val['class']) ? $val['class']."->" : ''; $text .= !empty($val['include_filename']) ? "include: ". str_replace($this->docroot,'', $val['include_filename']) : ''; - $text .= !empty($val['function']) ? htmlentities($val['function'])."(" : ""; + $text .= !empty($val['function']) ? htmlentities((string) $val['function'])."(" : ""; $text .= !empty($val['params']) ? print_r($val['params'],true) : ''; $text .= !empty($val['function']) ? ")" : ""; $text .=" @@ -2276,7 +2276,7 @@ class e_http_header function __construct() { - if (strpos(varset($_SERVER['HTTP_ACCEPT_ENCODING']), 'gzip') !== false) + if (strpos((string) varset($_SERVER['HTTP_ACCEPT_ENCODING']), 'gzip') !== false) { $this->compression_browser_support = true; } @@ -2313,10 +2313,10 @@ function setContent($content,$search=null,$replace=null) else { $this->content = $content; - $this->length = strlen($content); + $this->length = strlen((string) $content); } - $this->etag = md5($this->content); + $this->etag = md5((string) $this->content); //print_a($this->length); @@ -2341,7 +2341,7 @@ function setHeader($header, $force=false, $response_code=null) return null; } - list($key,$val) = explode(':',$header,2); + list($key,$val) = explode(':',(string) $header,2); $this->headers[$key] = $val; header($header, $force, $response_code); } @@ -2367,7 +2367,7 @@ function debug() // needs to be disabled if PHP gzip is to work $server = array(); foreach($_SERVER as $k=>$v) { - if(strncmp($k, 'HTTP', 4) === 0) + if(strncmp((string) $k, 'HTTP', 4) === 0) { $server[$k] = $v; } @@ -2423,7 +2423,7 @@ function send() if($this->compress_output !== false) { $this->setHeader('ETag: "'.$this->etag.'-gzip"', true); - $this->content = gzencode($this->content, $this->compression_level); + $this->content = gzencode((string) $this->content, $this->compression_level); $this->length = strlen($this->content); $this->setHeader('Content-Encoding: gzip', true); $this->setHeader("Content-Length: ".$this->length, true); diff --git a/comment.php b/comment.php index f830f25cc5..6a502bcd42 100644 --- a/comment.php +++ b/comment.php @@ -43,7 +43,7 @@ // Comment Pagination if(varset($_GET['mode']) == 'list' && vartrue($_GET['id']) && vartrue($_GET['type'])) { - $clean_type = preg_replace("/[^\w\d]/","",$_GET['type']); + $clean_type = preg_replace("/[^\w\d]/","",(string) $_GET['type']); $tmp = e107::getComment()->getComments($clean_type,intval($_GET['id']),intval($_GET['from'])); echo $tmp['comments']; @@ -303,13 +303,13 @@ $plugin_redir = TRUE; $reply_location = str_replace('{NID}', $redirectFlag, $e_comment[$table]['reply_location']); } - + if ($plugin_redir) { echo "\n"; exit; } - + // No redirect found if we get here. } diff --git a/contact.php b/contact.php index c075af8f21..2931b963ff 100644 --- a/contact.php +++ b/contact.php @@ -40,7 +40,7 @@ function init() $pref = e107::pref(); $active = varset($pref['contact_visibility'], e_UC_PUBLIC); - $contactInfo = trim(SITECONTACTINFO); + $contactInfo = trim((string) SITECONTACTINFO); $pref = e107::getPref(); if(!check_class($active) && empty($contactInfo) && empty($pref['contact_info'])) @@ -106,13 +106,13 @@ private function processFormSubmit() if(!empty($contact_filter)) { - $tmp = explode("\n", $contact_filter); + $tmp = explode("\n", (string) $contact_filter); if(!empty($tmp)) { foreach($tmp as $filterItem) { - if(strpos($_POST['body'], $filterItem) !== false) + if(strpos((string) $_POST['body'], $filterItem) !== false) { $ignore = true; break; @@ -127,7 +127,7 @@ private function processFormSubmit() $sender_name = $tp->toEmail($_POST['author_name'], true, 'RAWTEXT'); $sender = check_email($_POST['email_send']); $subject = $tp->toEmail($_POST['subject'], true, 'RAWTEXT'); - $body = nl2br($tp->toEmail(strip_tags($_POST['body']), true, 'RAWTEXT')); + $body = nl2br((string) $tp->toEmail(strip_tags((string) $_POST['body']), true, 'RAWTEXT')); $email_copy = !empty($_POST['email_copy']) ? 1 : 0; @@ -144,12 +144,12 @@ private function processFormSubmit() } // Check subject line. - if(isset($_POST['subject']) && strlen(trim($subject)) < 2) + if(isset($_POST['subject']) && strlen(trim((string) $subject)) < 2) { $error .= LAN_CONTACT_13 . "\n"; } - if(!strpos(trim($sender), "@")) + if(!strpos(trim((string) $sender), "@")) { $error .= LAN_CONTACT_11 . "\n"; } @@ -231,7 +231,7 @@ private function processFormSubmit() { foreach($_POST as $k => $v) { - $scKey = strtoupper($k); + $scKey = strtoupper((string) $k); $vars[$scKey] = $tp->toEmail($v, true, 'RAWTEXT'); } } diff --git a/e107_admin/admin_log.php b/e107_admin/admin_log.php index d6530a2d0f..4146635a87 100644 --- a/e107_admin/admin_log.php +++ b/e107_admin/admin_log.php @@ -63,7 +63,7 @@ function loadEventTypes($table) continue; } $id = $val['dblog_eventcode']; - $def = strpos($val['dblog_title'], "LAN") !== false ? $id : $val['dblog_title']; + $def = strpos((string) $val['dblog_title'], "LAN") !== false ? $id : $val['dblog_title']; $eventTypes[$id] = str_replace(': [x]', '', deftrue($val['dblog_title'],$def)); } @@ -336,7 +336,7 @@ function maintenanceProcess() $action = ''; // print_a($_POST); - + if(!empty($_POST['deleteoldadmin']) && isset($_POST['rolllog_clearadmin'])) { $back_count = intval($_POST['rolllog_clearadmin']); @@ -371,8 +371,8 @@ function maintenanceProcess() */ $old_date = strtotime($back_count.' days ago'); - - + + // Actually delete back events - admin or user audit log if(($action == "backdel") && isset($_POST['backdeltype'])) { @@ -418,7 +418,7 @@ function maintenanceProcess() } } - + // Prompt to delete back events /* if(($action == "confdel") || ($action == "auditdel")) @@ -442,12 +442,12 @@ function maintenanceProcess() - + "; - + $ns->tablerender(LAN_CONFDELETE, $text); } - + */ } @@ -615,16 +615,16 @@ function dblog_title($curVal,$mode) - $val = trim($curVal); + $val = trim((string) $curVal); if(defined($val)) { $val = constant($val); } - if(strpos($val,'[x]') !== false) + if(strpos((string) $val,'[x]') !== false) { $remark = $this->getController()->getListModel()->get('dblog_remarks'); - preg_match("/\[table\]\s=>\s([\w]*)/i",$remark, $match); + preg_match("/\[table\]\s=>\s([\w]*)/i",(string) $remark, $match); if(!empty($match[1])) { @@ -632,7 +632,7 @@ function dblog_title($curVal,$mode) } else { - preg_match("/\[!br!\]TABLE: ([\w]*)/i", $remark, $m); + preg_match("/\[!br!\]TABLE: ([\w]*)/i", (string) $remark, $m); if(!empty($m[1])) { $val = $tp->lanVars($val, ''.$m[1].''); @@ -681,7 +681,7 @@ function dblog_remarks($curVal,$mode) { case 'read': // List Page - $text = preg_replace_callback("#\[!(\w+?)(=.+?)?!]#", 'log_process', $curVal); + $text = preg_replace_callback("#\[!(\w+?)(=.+?)?!]#", 'log_process', (string) $curVal); $text = $tp->toHTML($text,false,'E_BODY'); if(strpos($text,'Array')!==false || strlen($text)>300) @@ -727,9 +727,9 @@ function dblog_caller($curVal,$mode) { case 'read': // List Page $val =$curVal; - if((strpos($val, '|') !== FALSE) && (strpos($val, '@') !== FALSE)) + if((strpos((string) $val, '|') !== FALSE) && (strpos((string) $val, '@') !== FALSE)) { - list($file, $rest) = explode('|', $val); + list($file, $rest) = explode('|', (string) $val); list($routine, $rest) = explode('@', $rest); $val = $file.'
Function: '.$routine.'
Line: '.$rest; } @@ -750,7 +750,7 @@ function dblog_caller($curVal,$mode) class audit_log_ui extends e_admin_ui { - + protected $pluginTitle = ADLAN_155; protected $pluginName = 'core'; protected $table = 'audit_log'; @@ -758,7 +758,7 @@ class audit_log_ui extends e_admin_ui protected $perPage = 10; protected $listOrder = 'dblog_id DESC'; protected $batchDelete = true; - + protected $fields = array ( 'checkboxes' => array ( 'title' => '', 'type' => null, 'data' => null, 'width' => '5%', 'thclass' => 'center', 'forced' => '1', 'class' => 'center', 'toggle' => 'e-multiselect', ), 'dblog_id' => array ( 'title' => LAN_ID, 'data' => 'int', 'width' => '5%', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'left', 'thclass' => 'left', ), @@ -772,9 +772,9 @@ class audit_log_ui extends e_admin_ui 'dblog_remarks' => array ( 'title' => 'Remarks', 'type' => 'method', 'data' => 'str', 'width' => '30%', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'left', 'thclass' => 'left', ), 'options' => array ( 'title' => LAN_OPTIONS, 'type' => null, 'nolist'=>true, 'data' => null, 'width' => '10%', 'thclass' => 'center last', 'class' => 'center last', 'forced' => '1', ), ); - + protected $fieldpref = array('dblog_id', 'dblog_datestamp', 'dblog_microtime', 'dblog_eventcode', 'dblog_user_id', 'dblog_user_name', 'dblog_ip', 'dblog_title','dblog_remarks'); - + public $eventTypes = array(); // optional @@ -791,7 +791,7 @@ public function customPage() $ns = e107::getRender(); $text = 'Hello World!'; $ns->tablerender('Hello',$text); - + } */ @@ -855,7 +855,7 @@ function log_process($matches) case 'br': return '
'; case 'link': - $temp = substr($matches[2], 1); + $temp = substr((string) $matches[2], 1); return "{$temp}"; case 'test': return '----TEST----'; diff --git a/e107_admin/auth.php b/e107_admin/auth.php index b5a6132e8f..184db4276d 100644 --- a/e107_admin/auth.php +++ b/e107_admin/auth.php @@ -37,7 +37,7 @@ e107::getRedirect()->redirect(e_SELF); } -$admincss = trim($core->get('admincss')); +$admincss = trim((string) $core->get('admincss')); if(empty($admincss) || $admincss === 'style.css'|| $admincss === 'admin_dark.css' || $admincss === 'admin_light.css') { $core->update('admincss','css/modern-light.css'); @@ -50,7 +50,7 @@ { $lng = e107::getLanguage(); - $tmp = explode(".",ADMINPERMS); + $tmp = explode(".",(string) ADMINPERMS); foreach($tmp as $ln) { @@ -86,10 +86,10 @@ if(e107::getUser()->getSessionDataAs()) { $asuser = e107::getSystemUser(e107::getUser()->getSessionDataAs(), false); - + $lanVars = array ('x' => ($asuser->getId() ? $asuser->getName().' ('.$asuser->getValue('email').')' : 'unknown')) ; e107::getMessage()->addInfo(e107::getParser()->lanVars(ADLAN_164, $lanVars).' ['.LAN_LOGOUT.']'); - + } // NEW, legacy 3rd party code fix, header called inside the footer o.O if(deftrue('e_ADMIN_UI')) diff --git a/e107_admin/banlist.php b/e107_admin/banlist.php index 261d089f1b..e5f80eab31 100644 --- a/e107_admin/banlist.php +++ b/e107_admin/banlist.php @@ -594,7 +594,7 @@ protected function optionsPage() $mes->addSuccess(str_replace('[y]', $result, BANLAN_48)); } - list($ban_access_guest, $ban_access_member) = explode(',', varset($pref['ban_max_online_access'], '100,200')); + list($ban_access_guest, $ban_access_member) = explode(',', (string) varset($pref['ban_max_online_access'], '100,200')); $ban_access_member = max($ban_access_guest, $ban_access_member); @@ -720,7 +720,7 @@ function banlist_ip($curVal,$mode) //TODO if(!empty($curVal)) { - $tmp = explode(":",$curVal); + $tmp = explode(":",(string) $curVal); if(count($tmp) === 8) { diff --git a/e107_admin/banlist_export.php b/e107_admin/banlist_export.php index c9d1acc982..054cda3a9a 100644 --- a/e107_admin/banlist_export.php +++ b/e107_admin/banlist_export.php @@ -56,7 +56,7 @@ $spacer = ''; foreach($_POST['ban_types'] as $b) { - $b = trim($b); + $b = trim((string) $b); if (is_numeric($b) && in_array($b, $validBanTypes)) { $type_list .= $spacer.($b); @@ -124,7 +124,7 @@ function do_export($filename, $type_list='',$format_array=array(), $sep = ',', $ //Secure https check if (isset($_SERVER['HTTP_USER_AGENT']) && $_SERVER['HTTP_USER_AGENT']=='contype') header('Pragma: public'); - if (isset($_SERVER['HTTP_USER_AGENT']) && strpos($_SERVER['HTTP_USER_AGENT'],'MSIE')) + if (isset($_SERVER['HTTP_USER_AGENT']) && strpos((string) $_SERVER['HTTP_USER_AGENT'],'MSIE')) header('Content-Type: application/force-download'); else header('Content-Type: application/octet-stream'); diff --git a/e107_admin/boot.php b/e107_admin/boot.php index efbb0593bc..921456efa3 100644 --- a/e107_admin/boot.php +++ b/e107_admin/boot.php @@ -213,7 +213,7 @@ if(strpos(e_REQUEST_URI,$plugDir) !== false && !deftrue('e_ADMIN_UI') && !empty($_plugins) && !empty($_globalLans) && is_array($_plugins) && (count($_plugins) > 0)) { $_plugins = array_keys($_plugins); - + foreach ($_plugins as $_p) { if(defset('e_CURRENT_PLUGIN') != $_p) @@ -225,7 +225,7 @@ { continue; } - + e107::getDebug()->logTime('[boot.php: Loading LANS for '.$_p.']'); e107::loadLanFiles($_p, 'admin'); } diff --git a/e107_admin/cpage.php b/e107_admin/cpage.php index 2275855648..6145aba9af 100644 --- a/e107_admin/cpage.php +++ b/e107_admin/cpage.php @@ -181,11 +181,11 @@ class page_chapters_ui extends e_admin_ui protected $listOrder = 'Sort,chapter_order '; // protected $listOrder = ' COALESCE(NULLIF(chapter_parent,0), chapter_id), chapter_parent > 0, chapter_order '; //FIXME works with parent/child but doesn't respect parent order. protected $url = array('route'=>'page/chapter/index', 'vars' => array('id' => 'chapter_id', 'name' => 'chapter_sef'), 'name' => 'chapter_name', 'description' => ''); // 'link' only needed if profile not provided. - + protected $sortField = 'chapter_order'; protected $sortParent = 'chapter_parent'; // protected $orderStep = 10; - + protected $fields = array( 'checkboxes' => array('title'=> '', 'type' => null, 'width' =>'5%', 'forced'=> TRUE, 'thclass'=>'center', 'class'=>'center'), 'chapter_id' => array('title'=> 'LAN_ID', 'type' => 'number', 'width' =>'5%', 'forced'=> TRUE, 'readonly'=>TRUE), @@ -207,13 +207,13 @@ class page_chapters_ui extends e_admin_ui 'chapter_image' => array('title'=> 'LAN_IMAGE', 'type' => 'image', 'data' => 'str', 'width' => '100px', 'thclass' => 'center', 'class'=>'center', 'readParms'=>'thumb=140&thumb_urlraw=0&thumb_aw=140', 'writeParms'=>'', 'readonly'=>FALSE, 'batch' => FALSE, 'filter'=>FALSE), 'options' => array('title'=> 'LAN_OPTIONS', 'type' => 'method', 'width' => '10%', 'forced'=>TRUE, 'thclass' => 'center last', 'class' => 'left', 'readParms'=>'sort=1') - + ); protected $fieldpref = array('checkboxes', 'chapter_icon', 'chapter_id', 'chapter_page_count','chapter_name', 'chapter_description','chapter_template', 'chapter_visibility', 'chapter_order', 'options'); protected $books = array(); - + function init() { $this->addTitle(CUSLAN_63); @@ -234,33 +234,33 @@ function init() $sql = e107::getDb(); $sql->gen("SELECT chapter_id,chapter_name FROM #page_chapters WHERE chapter_parent =0"); $this->books[0] = CUSLAN_5; - + while($row = $sql->fetch()) { $bk = $row['chapter_id']; $this->books[$bk] = $row['chapter_name']; } - + asort($this->books); - + $this->fields['chapter_parent']['writeParms'] = $this->books; - - + + $tmp = e107::getLayouts('', 'chapter', 'front', '', true, false); $tmpl = array(); foreach($tmp as $key=>$val) { - if(substr($key,0,3) != 'nav') + if(substr((string) $key,0,3) != 'nav') { $tmpl[$key] = $val; } } - + $this->fields['chapter_template']['writeParms'] = $tmpl; // e107::getLayouts('', 'chapter', 'front', '', true, false); // e107::getLayouts('', 'page', 'books', 'front', true, false); - + } - - + + public function beforeCreate($new_data, $old_data) { if(empty($new_data['chapter_sef'])) @@ -271,9 +271,9 @@ public function beforeCreate($new_data, $old_data) { $new_data['chapter_sef'] = eHelper::secureSef($new_data['chapter_sef']); } - + $sef = e107::getParser()->toDB($new_data['chapter_sef']); - + if(e107::getDb()->count('page_chapters', '(*)', "chapter_sef='{$sef}'")) { e107::getMessage()->addError(CUSLAN_57); @@ -281,11 +281,11 @@ public function beforeCreate($new_data, $old_data) } $new_data = e107::getCustomFields()->processConfigPost('chapter_fields', $new_data); - + return $new_data; } - - + + public function beforeUpdate($new_data, $old_data, $id) { // return $this->beforeCreate($new_data); @@ -815,7 +815,7 @@ function init() $tmpl = array(); foreach($tmp as $key=>$val) { - if(substr($key,0,3) != 'nav') + if(substr((string) $key,0,3) != 'nav') { $tmpl[$key] = $val; } @@ -1084,7 +1084,7 @@ function beforeCreate($new_data, $old_data) $new_data = e107::getCustomFields()->processDataPost('page_fields',$new_data); - $new_data['menu_name'] = preg_replace('/[^\w\-*]/','-',$new_data['menu_name']); + $new_data['menu_name'] = preg_replace('/[^\w\-*]/','-',(string) $new_data['menu_name']); if(empty($new_data['page_sef'])) { diff --git a/e107_admin/cron.php b/e107_admin/cron.php index b4edc6b04c..49594afd1a 100644 --- a/e107_admin/cron.php +++ b/e107_admin/cron.php @@ -192,7 +192,7 @@ function init() if(!vartrue($_GET['action']) || $_GET['action'] == 'refresh') { - + $this->cronImport($cronDefaults); // import Core Crons (if missing) $this->cronImport(e107::getAddonConfig('e_cron')); // Import plugin Crons $this->cronImportLegacy(); // Import Legacy Cron Tab Settings @@ -438,7 +438,7 @@ function cronExecute($cron_id) } - list($class_name, $method_name) = explode("::", $class_func); + list($class_name, $method_name) = explode("::", (string) $class_func); $mes = e107::getMessage(); $taskName = $class_name; @@ -535,7 +535,7 @@ function cron_tab($curVal,$mode) if($mode == 'read') { $sep = array(); - list($min, $hour, $day, $month, $weekday) = explode(" ", $curVal); + list($min, $hour, $day, $month, $weekday) = explode(" ", (string) $curVal); $text = (isset($this->min_options[$min])) ? $this->min_options[$min] : LAN_CRON_50 ." ". $min; // Minute(s) $text .= "
"; $text .= (isset($this->hour_options[$hour])) ? $this->hour_options[$hour] : LAN_CRON_51 ." ". $hour; // Hour(s) @@ -599,7 +599,7 @@ function options($parms, $value, $id, $attributes) { $func = $this->getController()->getFieldVar('cron_function'); // - if(substr($func,0,7) === '_system') + if(substr((string) $func,0,7) === '_system') { $att['readParms'] = array('disabled'=>'disabled'); } @@ -618,7 +618,7 @@ function options($parms, $value, $id, $attributes) function editTab($curVal) { $sep = array(); - list($sep['minute'], $sep['hour'], $sep['day'], $sep['month'], $sep['weekday']) = explode(" ", $curVal); + list($sep['minute'], $sep['hour'], $sep['day'], $sep['month'], $sep['weekday']) = explode(" ", (string) $curVal); foreach ($sep as $key => $value) { diff --git a/e107_admin/db.php b/e107_admin/db.php index 197be6898b..c355818148 100644 --- a/e107_admin/db.php +++ b/e107_admin/db.php @@ -35,12 +35,12 @@ if(isset($_GET['mode'])) { - $_GET['mode'] = preg_replace('/[^\w\-]/', '', $_GET['mode']); + $_GET['mode'] = preg_replace('/[^\w\-]/', '', (string) $_GET['mode']); } if(isset($_GET['type'])) { - $_GET['type'] = preg_replace('/[^\w\-]/', '', $_GET['type']); + $_GET['type'] = preg_replace('/[^\w\-]/', '', (string) $_GET['type']); } /* @@ -479,24 +479,24 @@ private function multiSiteProcess() { $sql = e107::getDb('new'); $mes = e107::getMessage(); - + $user = $_POST['name']; $pass = $_POST['password']; $server = e107::getMySQLConfig('server'); // $_POST['server']; $database = $_POST['db']; $prefix = $_POST['prefix']; - + if($connect = $sql->connect($server,$user, $pass, true)) { $mes->addSuccess(DBLAN_74); - + if(vartrue($_POST['createdb'])) { - + if($sql->gen("CREATE DATABASE ".$database." CHARACTER SET `utf8mb4`")) { $mes->addSuccess(DBLAN_75); - + // $sql->gen("CREATE USER ".$user."@'".$server."' IDENTIFIED BY '".$pass."';"); $sql->gen("GRANT ALL ON `".$database."`.* TO ".$user."@'".$server."';"); $sql->gen("FLUSH PRIVILEGES;"); @@ -507,32 +507,32 @@ private function multiSiteProcess() return; } } - + if(!$sql->database($database)) { $mes->addError(DBLAN_76); } - + $mes->addSuccess(DBLAN_76); - + if($this->multiSiteCreateTables($sql, $prefix)) { $coreConfig = e_CORE. "xml/default_install.xml"; $ret = e107::getXml()->e107Import($coreConfig, 'add', true, false, $sql); // Add core pref values $mes->addInfo(print_a($ret,true)); } - + } else { $mes->addSuccess(DBLAN_74); } - + if($error = $sql->getLastErrorText()) { $mes->addError($error); } - + // print_a($_POST); @@ -555,7 +555,7 @@ private function multiSiteCreateTables($sql, $prefix) $mes->addError(DBLAN_77); } - preg_match_all("/create(.*?)(?:myisam|innodb);/si", $sql_data, $result ); + preg_match_all("/create(.*?)(?:myisam|innodb);/si", (string) $sql_data, $result ); $sql->gen('SET NAMES `utf8mb4`'); @@ -954,12 +954,12 @@ private function perform_utf8_convert() function getQueries($query) { - + $mes = e107::getMessage(); $sql = e107::getDb('utf8-convert'); $qry = []; - + if($sql->gen($query)) { while ($row = $sql->fetch('num')) @@ -973,8 +973,8 @@ function getQueries($query) } return $qry; - - + + /* if(!$result = mysql_query($query)) { @@ -1415,13 +1415,13 @@ private function optimizesql($mySQLdefaultdb) private function getPrefConfig($type) { - if(strpos($type,'plugin_') === 0) + if(strpos((string) $type,'plugin_') === 0) { - $config = e107::getPlugConfig(substr($type,7)); + $config = e107::getPlugConfig(substr((string) $type,7)); } - elseif(strpos($type,'theme_') === 0) + elseif(strpos((string) $type,'theme_') === 0) { - $config = e107::getThemeConfig(substr($type,6)); + $config = e107::getThemeConfig(substr((string) $type,6)); } else { @@ -1514,7 +1514,7 @@ private function pref_editor($type='core') } else { - $ptext = htmlspecialchars($val, ENT_QUOTES, 'utf-8'); + $ptext = htmlspecialchars((string) $val, ENT_QUOTES, 'utf-8'); } $ptext = $tp->textclean($ptext, 80); @@ -1577,7 +1577,7 @@ private function scan_override() { foreach($fList as $file) { - $scList[] = strtoupper(substr($file['fname'], 0, -4)); + $scList[] = strtoupper(substr((string) $file['fname'], 0, -4)); } $scList = implode(',', $scList); } @@ -1590,7 +1590,7 @@ private function scan_override() { foreach($fList as $file) { - $scList[] = substr($file['fname'], 0, -4); + $scList[] = substr((string) $file['fname'], 0, -4); } $scList = implode(',', $scList); } @@ -1815,7 +1815,7 @@ function exportXmlFile($prefs,$tables=array(),$plugPrefs=array(), $themePrefs=ar { foreach($xml->fileConvertLog as $oldfile) { - $file = basename($oldfile); + $file = basename((string) $oldfile); $newfile = $desinationFolder.$file; if($oldfile == $newfile || (copy($oldfile,$newfile))) { diff --git a/e107_admin/docs.php b/e107_admin/docs.php index 3db2ba2991..82cc60c237 100644 --- a/e107_admin/docs.php +++ b/e107_admin/docs.php @@ -120,7 +120,7 @@ public function Doc0Page() } $tmp = preg_replace('/Q\>(.*?)A>/si', "###QSTART###
" . $iconQ . "\\1
###QEND###", $tmp); - $tmp = preg_replace('/###QEND###(.*?)###QSTART###/si', "
" . $iconA . "\\1
", $tmp); + $tmp = preg_replace('/###QEND###(.*?)###QSTART###/si', "
" . $iconA . "\\1
", (string) $tmp); $tmp = str_replace(array('###QSTART###', '###QEND###'), array('', "
" . $iconA), $tmp) . "
"; $id = 'doc-' . $key; diff --git a/e107_admin/emoticon.php b/e107_admin/emoticon.php index 2fea61139d..4bc75b6ef2 100644 --- a/e107_admin/emoticon.php +++ b/e107_admin/emoticon.php @@ -62,28 +62,28 @@ // Check for pack-related buttons pressed foreach ($filtered as $key => $value) { - if (strpos($key, "subPack_") !== false) + if (strpos((string) $key, "subPack_") !== false) { $subpack = str_replace("subPack_", "", $key); $emote->emoteConf($subpack); break; } - if (strpos($key, "XMLPack_") !== false) + if (strpos((string) $key, "XMLPack_") !== false) { $subpack = str_replace("XMLPack_", "", $key); $emote->emoteXML($subpack); break; } - if (strpos($key, "defPack_") !== false) + if (strpos((string) $key, "defPack_") !== false) { e107::getConfig()->set('emotepack', str_replace("defPack_", "", $key))->save(true, true, true); e107::getLog()->add('EMOTE_01', $pref['emotepack'], E_LOG_INFORMATIVE, ''); break; } - if (strpos($key, "scanPack_") !== false) + if (strpos((string) $key, "scanPack_") !== false) { $one_pack = str_replace("scanPack_", "", $key); break; @@ -204,9 +204,9 @@ function listPacks() foreach ($emoteArray as $emote) { - if (strpos($emote['fname'], ".pak") !== false - || strpos($emote['fname'], ".xml") !== false - || strpos($emote['fname'], "phpBB") !== false) + if (strpos((string) $emote['fname'], ".pak") !== false + || strpos((string) $emote['fname'], ".xml") !== false + || strpos((string) $emote['fname'], "phpBB") !== false) { $can_scan = true; // Allow re-scan of config files } @@ -377,7 +377,7 @@ function emoteXML($packID, $strip_xtn = true) $evalue = str_replace(".", "!", $emote); if ($strip_xtn) { - $ename = substr($emote, 0, strrpos($emote, '.')); + $ename = substr((string) $emote, 0, strrpos((string) $emote, '.')); } $f_string .= "\n"; foreach (explode(' ', $tp->toForm($emotecode[$evalue])) as $v) @@ -455,13 +455,13 @@ function installCheck($do_one = false) { while ($row = $sql->fetch()) { - $pack_local[substr($row['e107_name'], 6)] = true; + $pack_local[substr((string) $row['e107_name'], 6)] = true; } } foreach ($this->packArray as $value) { - if (strpos($value, ' ') !== false) + if (strpos((string) $value, ' ') !== false) { // Highlight any directory names containing spaces - not allowed $msg = " " . EMOLAN_17 . " " . EMOLAN_18 . ": @@ -488,15 +488,15 @@ function installCheck($do_one = false) $confFile = ''; foreach ($fileArray as $k => $file) { - if (strpos($file['fname'], ".xml") !== false) + if (strpos((string) $file['fname'], ".xml") !== false) { $confFile = array('file' => $file['fname'], 'type' => "xml"); } - elseif (strpos($file['fname'], ".pak") !== false) + elseif (strpos((string) $file['fname'], ".pak") !== false) { $confFile = array('file' => $file['fname'], 'type' => "pak"); } - elseif (strpos($file['fname'], ".php") !== false) + elseif (strpos((string) $file['fname'], ".php") !== false) { $confFile = array('file' => $file['fname'], 'type' => "php"); } @@ -606,7 +606,7 @@ function installCheck($do_one = false) { // Check that the file exists if (strpos($e_file, ".") === false) { // File extension not specified - accept any file extension for match - if (strpos($emote['fname'], $e_file . ".") === 0) + if (strpos((string) $emote['fname'], $e_file . ".") === 0) { $file = str_replace(".", "!", $emote['fname']); break; diff --git a/e107_admin/eurl.php b/e107_admin/eurl.php index 7c616afa8f..d3e5001cef 100644 --- a/e107_admin/eurl.php +++ b/e107_admin/eurl.php @@ -76,7 +76,7 @@ public function init() { $cfg = e107::getConfig(); - list($plug,$key) = explode("|", $_POST['pk']); + list($plug,$key) = explode("|", (string) $_POST['pk']); if(is_string($cfg->get('e_url_alias'))) { @@ -125,7 +125,7 @@ public function init() if(isset($_POST['rebuild']) && is_array($_POST['rebuild'])) { $table = key($_POST['rebuild']); - list($primary, $input, $output) = explode("::",$_POST['rebuild'][$table]); + list($primary, $input, $output) = explode("::",(string) $_POST['rebuild'][$table]); $this->rebuild($table, $primary, $input, $output); } @@ -169,7 +169,7 @@ private function rebuild($table, $primary='', $input='',$output='') foreach($data as $row) { $sef = eHelper::title2sef($row[$input]); - + if($sql->update($table, $output ." = '".$sef."' WHERE ".$primary. " = ".intval($row[$primary]). " LIMIT 1")!==false) { $success++; @@ -178,7 +178,7 @@ private function rebuild($table, $primary='', $input='',$output='') { $failed++; } - + // echo $row[$input]." => ".$output ." = '".$sef."' WHERE ".$primary. " = ".intval($row[$primary]). " LIMIT 1
"; } @@ -314,7 +314,7 @@ protected function simplePage() // $sefurl = (!empty($alias)) ? str_replace('{alias}', $alias, $v['sef']) : $v['sef']; $pid = $plug."|".$k; - $v['regex'] = preg_replace("/^\^/",$home,$v['regex']); + $v['regex'] = preg_replace("/^\^/",$home,(string) $v['regex']); $aliasForm = $frm->renderInline('e_url_alias['.$plug.']['.$k.']', $pid, 'e_url_alias['.$plug.']['.$k.']', $alias, $alias,'text',null,array('title'=>LAN_EDIT." (Language-specific)", 'url'=>e_REQUEST_SELF)); $aliasRender = str_replace('{alias}', $aliasForm, $v['regex']); @@ -408,7 +408,7 @@ public function AliasObserver() foreach ($als as $module => $alias) { $alias = trim($alias); - $module = trim($module); + $module = trim((string) $module); if($module !== $alias) { $cindex = array_search($module, $locations); @@ -486,7 +486,7 @@ public function ConfigObserver() $config = is_array($_POST['eurl_config']) ? e107::getParser()->post_toForm($_POST['eurl_config']) : ''; $modules = eRouter::adminReadModules(); $locations = eRouter::adminBuildLocations($modules); - + $aliases = eRouter::adminSyncAliases(e107::getPref('url_aliases'), $config); if(!empty($_POST['eurl_profile'])) @@ -517,7 +517,7 @@ public function ConfigObserver() // var_dump($_POST['eurl_config']); - + eRouter::clearCache(); e107::getCache()->clearAll('content'); // clear content - it may be using old url scheme. @@ -869,7 +869,7 @@ public function moduleRows($data) } - $label = vartrue($section['label'], $index == 0 ? LAN_EURL_DEFAULT : eHelper::labelize(ltrim(strstr($location, '/'), '/'))); + $label = vartrue($section['label'], $index == 0 ? LAN_EURL_DEFAULT : eHelper::labelize(ltrim(strstr((string) $location, '/'), '/'))); // $cssClass = $checked ? 'e-showme' : 'e-hideme'; $cssClass = 'e-hideme'; // always hidden for now, some interface changes could come after pre-alpha @@ -1027,7 +1027,7 @@ public function aliasesRows($currentAliases, $modules, $lanDef, $lans) { $cfg = $obj->config->config(); if(isset($cfg['config']['noSingleEntry']) && $cfg['config']['noSingleEntry']) continue; - + if($module == 'index') { $text .= " @@ -1063,7 +1063,7 @@ public function aliasesRows($currentAliases, $modules, $lanDef, $lans) $url = e107::getUrl()->create($module, '', array('full' => 1, 'encode' => 0)); $defVal = isset($currentAliases[$lan]) && in_array($module, $currentAliases[$lan]) ? array_search($module, $currentAliases[$lan]) : $module; $section = vartrue($admin['labels'], array()); - + $text .= " @@ -1074,9 +1074,9 @@ public function aliasesRows($currentAliases, $modules, $lanDef, $lans) "; - - + + // default language $text .= "@@ -1152,7 +1152,7 @@ public function aliasesRows($currentAliases, $modules, $lanDef, $lans) "; - + /*$text .= " "; @@ -618,7 +618,7 @@ private function inspect_existing($baseDir) if ($file->isDir()) continue; $absolutePath = $file->getRealPath(); - $relativePath = preg_replace("/^" . preg_quote($absoluteBase . "/", "/") . "/", "", $absolutePath); + $relativePath = preg_replace("/^" . preg_quote($absoluteBase . "/", "/") . "/", "", (string) $absolutePath); if (empty($relativePath) || $relativePath == $absolutePath) continue; @@ -695,7 +695,7 @@ private function renderFileName($tree, $fileName, $relativePath,$rowId) if($fileName === 'error_log') { - $hash = md5($relativePath); + $hash = md5((string) $relativePath); e107::getSession()->set('fileinspector_error_log_'. $hash, $relativePath); @@ -983,7 +983,7 @@ function scan_results() if($this->opt('type') == 'tree') { $text .= " - "; } else @@ -1080,7 +1080,7 @@ function scan_results() list($icon, $title) = $this->getGlyphForValidationCode($validation); $text .= '
diff --git a/e107_admin/fileinspector.php b/e107_admin/fileinspector.php index 4a9630a5b8..c6520aa66c 100755 --- a/e107_admin/fileinspector.php +++ b/e107_admin/fileinspector.php @@ -51,7 +51,7 @@ .e { width: 9px; height: 9px } i.fa-folder-open-o, i.fa-times-circle-o { cursor:pointer } span.tree-node { cursor: pointer } - + "; e107::css('inline', $css); @@ -376,9 +376,9 @@ function __construct() $this->root_dir = $e107 -> file_path; - if(substr($this->root_dir, -1) == '/') + if(substr((string) $this->root_dir, -1) == '/') { - $this->root_dir = substr($this->root_dir, 0, -1); + $this->root_dir = substr((string) $this->root_dir, 0, -1); } if(isset($_POST['core']) && $_POST['core'] == 'integrity_fail_only') @@ -388,7 +388,7 @@ function __construct() if(MAGIC_QUOTES_GPC && vartrue($_POST['regex'])) { - $_POST['regex'] = stripslashes($_POST['regex']); + $_POST['regex'] = stripslashes((string) $_POST['regex']); } if(!empty($_POST['regex'])) @@ -541,7 +541,7 @@ public function scan_config() ".FC_LAN_18.": - ## + ##
".FR_LAN_3."root_dir))."')\"> + root_dir))."')\">
'; $text .= "$icon "; - $text .= htmlspecialchars($relativePath); + $text .= htmlspecialchars((string) $relativePath); $text .= ''; $text .= isset($this->fileSizes[$relativePath]) ? $this->parsesize($this->fileSizes[$relativePath]) : ''; $oldVersion = $this->getOldVersionOfPath($relativePath, $validation); @@ -1300,7 +1300,7 @@ public static function readScanProgress($scanId) private static function exitOnEvilScanId($scanId) { - if (!preg_match('/^[0-9A-F]+$/i', $scanId)) exit(1); + if (!preg_match('/^[0-9A-F]+$/i', (string) $scanId)) exit(1); } private static function pruneOldProgressFiles() diff --git a/e107_admin/footer.php b/e107_admin/footer.php index 96c26e6db3..67bffa7170 100644 --- a/e107_admin/footer.php +++ b/e107_admin/footer.php @@ -91,7 +91,7 @@ } } } - + // // B.2 Send footer template, stop timing, send simple page stats // @@ -101,7 +101,7 @@ $ADMIN_FOOTER = e107::getCoreTemplate('admin', 'footer', false); e107::renderLayout($ADMIN_FOOTER, ['sc'=>'admin']); } - + $eTimingStop = microtime(); global $eTimingStart; $clockTime = e107::getSingleton('e107_traffic')->TimeDelta($eTimingStart, $eTimingStop); @@ -112,7 +112,7 @@ $dbPercent = number_format($dbPercent); // DB as percent of clock $memuse = eHelper::getMemoryUsage(); // Memory at end, in B/KB/MB/GB ;) $rinfo = ''; - + if (function_exists('getrusage') && !empty($eTimingStartCPU)) { $ru = getrusage(); @@ -124,7 +124,7 @@ $cpuTot = $cpuUTime + $cpuSTime; $cpuTime = $cpuTot - $cpuStart; $cpuPct = 100.0 * $cpuTime / $rendertime; /* CPU load during known clock time */ - + // Format for display or logging (Uncomment as needed for logging) // User cpu //$cpuUTime = number_format($cpuUTime, 3); @@ -132,7 +132,7 @@ //$cpuSTime = number_format($cpuSTime, 3); // Total (User+System) //$cpuTot = number_format($cpuTot, 3); - + $cpuStart = number_format($cpuStart, 3); // Startup time (i.e. CPU used before class2.php) $cpuTime = number_format($cpuTime, 3); // CPU while we were measuring the clock (cpuTot-cpuStart) $cpuPct = number_format($cpuPct); // CPU Load (CPU/Clock) @@ -143,7 +143,7 @@ // // $logname = "/home/mysite/public_html/queryspeed.log"; // $logfp = fopen($logname, 'a+'); fwrite($logfp, "$cpuTot,$cpuPct,$cpuStart,$rendertime,$db_time\n"); fclose($logfp); - + if ($pref['displayrendertime']) { $rinfo .= CORE_LAN11; @@ -166,7 +166,7 @@ { $rinfo .= $cachestring."."; } - + if (function_exists('theme_renderinfo')) { theme_renderinfo($rinfo); @@ -179,7 +179,7 @@ echo($rinfo ? "\n\n" : ""); } } - + } // End of regular-page footer (the above NOT done for popups) // @@ -299,11 +299,11 @@ if (is_array($pref['e_footer_list'])) { // ob_start(); - + foreach($pref['e_footer_list'] as $val) { $fname = e_PLUGIN.$val."/e_footer.php"; // Do not place inside a function - BC $pref required. . - + if(is_readable($fname)) { $ret = (deftrue('e_DEBUG') || isset($_E107['debug'])) ? include_once($fname) : @include_once($fname); diff --git a/e107_admin/frontpage.php b/e107_admin/frontpage.php index 8d51897c4d..a0fcb82f6d 100644 --- a/e107_admin/frontpage.php +++ b/e107_admin/frontpage.php @@ -151,7 +151,7 @@ { // avoid endless loop. - if(varset($_POST['frontpage']) == 'other' && (trim($_POST['frontpage_other']) == 'index.php' || trim($_POST['frontpage_other']) == '{e_BASE}index.php')) + if(varset($_POST['frontpage']) == 'other' && (trim((string) $_POST['frontpage_other']) == 'index.php' || trim((string) $_POST['frontpage_other']) == '{e_BASE}index.php')) { $_POST['frontpage'] = 'wmessage'; $_POST['frontpage_other'] = ''; @@ -160,8 +160,8 @@ foreach ($_POST as $k => $v) { - $incDec = substr($k, 0, 6); - $idNum = substr($k, 6); + $incDec = substr((string) $k, 0, 6); + $idNum = substr((string) $k, 6); if ($incDec == 'fp_inc') { $mv = intval($idNum); @@ -217,7 +217,7 @@ if($_POST['frontpage'] == 'other') { - $_POST['frontpage_other'] = trim($tp->toForm($_POST['frontpage_other'])); + $_POST['frontpage_other'] = trim((string) $tp->toForm($_POST['frontpage_other'])); $frontpage_value = $_POST['frontpage_other'] ? $_POST['frontpage_other'] : 'news.php'; } else @@ -234,7 +234,7 @@ if($_POST['fp_force_page'] == 'other') { - $_POST['fp_force_page_other'] = trim($tp->toForm($_POST['fp_force_page_other'])); + $_POST['fp_force_page_other'] = trim((string) $tp->toForm($_POST['fp_force_page_other'])); $forcepage_value = $_POST['fp_force_page_other']; // A null value is allowable here } else @@ -249,7 +249,7 @@ } } - $temp = array('order' => intval($_POST['fp_order']), 'class' => $_POST['class'], 'page' => $frontpage_value, 'force' => trim($forcepage_value)); + $temp = array('order' => intval($_POST['fp_order']), 'class' => $_POST['class'], 'page' => $frontpage_value, 'force' => trim((string) $forcepage_value)); if($temp['order'] == 0) // New index to add { diff --git a/e107_admin/header.php b/e107_admin/header.php index e1566aefdd..f6b4a6e2bb 100644 --- a/e107_admin/header.php +++ b/e107_admin/header.php @@ -208,9 +208,9 @@ function loadJSAddons() // possibility to overwrite some CSS definition according to TEXTDIRECTION // especially usefull for rtl.css // see _blank theme for examples -if(defined('TEXTDIRECTION') && file_exists(THEME . '/' . strtolower(TEXTDIRECTION) . '.css')) +if(defined('TEXTDIRECTION') && file_exists(THEME . '/' . strtolower((string) TEXTDIRECTION) . '.css')) { - $e_js->themeCSS(strtolower(TEXTDIRECTION) . '.css'); + $e_js->themeCSS(strtolower((string) TEXTDIRECTION) . '.css'); } diff --git a/e107_admin/history.php b/e107_admin/history.php index 1667e0af18..761696cad1 100644 --- a/e107_admin/history.php +++ b/e107_admin/history.php @@ -54,7 +54,7 @@ class history_adminArea extends e_admin_dispatcher class admin_history_ui extends e_admin_ui { - + protected $pluginTitle = 'History'; protected $pluginName = 'myplugin'; // protected $eventName = 'myplugin-admin_history'; // remove comment to enable event triggers in admin. @@ -66,11 +66,11 @@ class admin_history_ui extends e_admin_ui protected $batchCopy = false; // protected $tabs = array('tab1'=>'Tab 1', 'tab2'=>'Tab 2'); // Use 'tab'=>'tab1' OR 'tab'=>'tab2' in the $fields below to enable. - + // protected $listQry = "SELECT * FROM `#tableName` WHERE field != '' "; // Example Custom Query. LEFT JOINS allowed. Should be without any Order or Limit. - + protected $listOrder = 'history_id DESC'; - + protected $fields = array ( 'checkboxes' => array ( 'title' => '', 'type' => null, 'data' => null, 'width' => '5%', 'thclass' => 'center', 'forced' => 'value', 'class' => 'center', 'toggle' => 'e-multiselect', 'readParms' => [], 'writeParms' => [],), // 'history_id' => array ( 'title' => LAN_ID, 'type' => 'number', 'data' => 'int', 'width' => '5%', 'help' => '', 'readParms' => [], 'writeParms' => [], 'class' => 'left', 'thclass' => 'left',), @@ -84,15 +84,15 @@ class admin_history_ui extends e_admin_ui 'options' => array ( 'title' => LAN_OPTIONS, 'type' => 'method', 'data' => null, 'width' => '10%', 'thclass' => 'center last', 'class' => 'center last', 'forced' => 'value', 'readParms' => [], 'writeParms' => [],), ); - + protected $fieldpref = array( 'history_datestamp', 'history_table', 'history_record_id','history_action', 'history_data', 'history_user_id', 'history_restored'); - + // protected $preftabs = array('General', 'Other' ); protected $prefs = array( ); - + public function init() { $this->fields['history_action']['writeParms']['optArray'] = [ @@ -134,7 +134,7 @@ private function processRestoreAction($id, $action) if ($historyRow) { $originalTable = $historyRow['history_table']; // The table where this record belongs - $originalData = json_decode($historyRow['history_data'], true); + $originalData = json_decode((string) $historyRow['history_data'], true); $pid = $historyRow['history_pid']; $recordId = $historyRow['history_record_id']; @@ -190,34 +190,34 @@ private function processRestoreAction($id, $action) // ------- Customize Create -------- - + public function beforeCreate($new_data,$old_data) { return $new_data; } - - + + // left-panel help menu area. (replaces e_help.php used in old plugins) public function renderHelp() { $caption = LAN_HELP; $text = "

This page allows you to view the history of changes made to records in the system and restore records to a previous state when needed.

- +

Features of this page:

  • View Changes: See details of updates and deletions, including who made the changes and when.
  • Revert Changes: Restore a record to its earlier version, undoing accidental or undesired modifications.
  • Audit Trail: Track all actions performed on records for accountability and transparency.
- +

Use the filters to narrow down the history logs or locate specific changes. If a record can be restored, an option will be available in the Options menu.

"; return ['caption' => $caption, 'text' => $text]; } - + /* // optional - a custom page. public function customPage() @@ -253,10 +253,10 @@ public function customPage() $text .= $frm->close(); return $text; - + } - - + + // Handle batch options as defined in admin_history_form_ui::history_data; 'handle' + action + field + 'Batch' // @important $fields['history_data']['batch'] must be true for this method to be detected. // @param $selected @@ -283,7 +283,7 @@ function handleListHistoryDataBatch($selected, $type) } - + // Handle filter options as defined in admin_history_form_ui::history_data; 'handle' + action + field + 'Filter' // @important $fields['history_data']['filter'] must be true for this method to be detected. // @param $selected @@ -292,7 +292,7 @@ function handleListHistoryDataFilter($type) { $this->listOrder = 'history_data ASC'; - + switch($type) { case 'customfilter_1': @@ -309,9 +309,9 @@ function handleListHistoryDataFilter($type) } - - - + + + */ } diff --git a/e107_admin/image.php b/e107_admin/image.php index 6fa357cd39..6cff713e7e 100644 --- a/e107_admin/image.php +++ b/e107_admin/image.php @@ -341,16 +341,16 @@ function options($parms, $value, $id) { return; } - + $owner = $this->getController()->getListModel()->get('media_cat_owner'); if(!in_array($owner,$this->restrictedOwners)) { return $this->renderValue('options',$value,null,$id); } - - - + + + // $save = ($_GET['bbcode']!='file') ? "e-dialog-save" : ""; // e-dialog-close @@ -386,8 +386,8 @@ function init() } - - + + if(!empty($_POST['multiselect']) && varset($_POST['e__execute_batch']) && (varset($_POST['etrigger_batch']) == 'options__resize_2048' )) { $type = str_replace('options__','',$_POST['etrigger_batch']); @@ -408,22 +408,22 @@ function init() $ids = implode(",", e107::getParser()->filter($_POST['multiselect'],'int')); $this->convertImagesToJpeg($ids,'all'); }*/ - + } - + function resize_method($curval) { $frm = e107::getForm(); - + $options = array( 'gd1' => 'gd1', 'gd2' => 'gd2', 'ImageMagick' => 'ImageMagick' ); - + return $frm->selectbox('resize_method',$options,$curval)."
".IMALAN_4. '
'; } - + public function rotateImages($ids,$type) { $sql = e107::getDb(); @@ -431,13 +431,13 @@ public function rotateImages($ids,$type) $mes = e107::getMessage(); ini_set('memory_limit', '150M'); ini_set('gd.jpeg_ignore_warning', 1); - + $degrees = ($type === 'rotate_cw') ? 270 : 90; - + // $mes->addDebug("Rotate Mode Set: ".$type); - + //TODO GIF and PNG rotation. - + if($sql->select('core_media', 'media_url', 'media_id IN (' .$ids.") AND media_type = 'image/jpeg' ")) { while($row = $sql->fetch()) @@ -445,9 +445,9 @@ public function rotateImages($ids,$type) $original = $tp->replaceConstants($row['media_url']); $mes->addDebug("Attempting to rotate by {$degrees} degrees: ".basename($original)); - + $source = imagecreatefromjpeg($original); - + try { $rotate = imagerotate($source, $degrees, 0); @@ -457,10 +457,10 @@ public function rotateImages($ids,$type) $mes->addError(LAN_IMA_002. ': ' .basename($original)); return null; } - + $srch = array('.jpg', '.jpeg'); $cacheFile = str_replace($srch, '',strtolower(basename($original)))."_(.*)\.cache\.bin"; - + try { imagejpeg($rotate,$original,80); @@ -498,17 +498,17 @@ public function resizeImage($oldpath,$w,$h) public function resizeImages($ids,$type) { - + $sql = e107::getDb(); $sql2 = e107::getDb('sql2'); $mes = e107::getMessage(); $tp = e107::getParser(); $fl = e107::getFile(); - + // Max size is 6 megapixel. $img_import_w = 2816; $img_import_h = 2112; - + if($sql->select('core_media', 'media_id,media_url', 'media_id IN (' .$ids.") AND media_type = 'image/jpeg' ")) { while($row = $sql->fetch()) @@ -516,10 +516,10 @@ public function resizeImages($ids,$type) $path = $tp->replaceConstants($row['media_url']); $mes->addDebug('Attempting to resize: ' .basename($path)); - + if($this->resizeImage($path,$img_import_w,$img_import_h)) { - + $info = $fl->getFileInfo($path); $mes->addSuccess(LAN_IMA_004. ': ' .basename($path)); $mes->addSuccess(print_a($info,true)); @@ -532,9 +532,9 @@ public function resizeImages($ids,$type) } } } - - - + + + } public function convertImagesToJpeg($ids,$mode=null) @@ -585,15 +585,15 @@ public function convertImagesToJpeg($ids,$mode=null) } - - + + public function resize_dimensions($curval) // ie. never manually resize another image again! { $text = ''; $pref = e107::getPref(); - + // $options = array( // "news-image" => LAN_IMA_O_001, // "news-bbcode" => LAN_IMA_O_002, @@ -609,7 +609,7 @@ public function resize_dimensions($curval) // ie. never manually resize another { foreach($pref['e_imageresize'] as $k=>$val) { - $options[$k] = ucfirst($k). ' ' .defset('LAN_IMA_O_006'); + $options[$k] = ucfirst((string) $k). ' ' .defset('LAN_IMA_O_006'); } } @@ -628,7 +628,7 @@ public function resize_dimensions($curval) // ie. never manually resize another $title = ucwords(str_replace('-', ' ',$key)); $valW = !empty($curval[$key]['w']) ? $curval[$key]['w'] : 400; $valH = !empty($curval[$key]['h']) ? $curval[$key]['h'] : 400; - + $text .= "
".$title.""; $text .= ""; $text .= ""; @@ -636,14 +636,14 @@ public function resize_dimensions($curval) // ie. never manually resize another } $text .= '
'; - + // $text .= "

Warning: This feature is experimental.
"; - + return $text; - - + + } - + function options($parms, $value, $id) { @@ -664,12 +664,12 @@ function options($parms, $value, $id) return $arr; } - + if($_GET['action'] === 'edit') { return null; } - + $tagid = vartrue($_GET['tagid']); $tagid = e107::getParser()->filter($tagid); $model = $this->getController()->getListModel(); @@ -677,12 +677,12 @@ function options($parms, $value, $id) $title = $model->get('media_name'); $id = $model->get('media_id'); - $preview = basename($path); - + $preview = basename((string) $path); + $bbcode = (vartrue($_GET['bbcode']) === 'file') ? 'file' : ''; // $save = ($_GET['bbcode']!='file') ? "e-dialog-save" : ""; // e-dialog-close - + $for = (string) $this->getController()->getQuery('for'); @@ -713,7 +713,7 @@ function options($parms, $value, $id) $att = ['query' => e_QUERY."&after=".$action]; $url = $this->media_sef('', 'read', ['url'=>1]); - $modal = (strpos($type, 'application') === false) ? 'e-modal' : ''; + $modal = (strpos((string) $type, 'application') === false) ? 'e-modal' : ''; if($action === 'grid') { @@ -737,15 +737,15 @@ function options($parms, $value, $id) } return "
".$text. '
'; - + } private function getMediaType() { - list($type,$extra) = explode('/',$this->getController()->getFieldVar('media_type')); + list($type,$extra) = explode('/',(string) $this->getController()->getFieldVar('media_type')); $category = $this->getController()->getFieldVar('media_category'); - if(strpos($category, '_icon') === 0) + if(strpos((string) $category, '_icon') === 0) { $type = 'icon'; } @@ -821,9 +821,9 @@ function media_sef($curVal, $mode, $attributes, $id=null) /* function media_category($curVal,$mode) // not really necessary since we can use 'dropdown' - but just an example of a custom function. { - + $curVal = explode(",",$curVal); - + if($mode == 'read') { return $this->getController()->getMediaCategory($curVal); @@ -843,7 +843,7 @@ function media_category($curVal,$mode) // not really necessary since we can use $text = " @@ -1038,16 +1038,16 @@ function check_all($mode='render', $lan=null) "; - + // print_a($_SESSION['lancheck'][$lan]); $plug_text = ($plug_text) ? $plug_header.$plug_text.$plug_footer : "
".LAN_OK."
"; $theme_text = ($theme_text) ? $theme_header.$theme_text.$theme_footer : "
".LAN_OK."
"; $mesStatus = ($_SESSION['lancheck'][$lan]['total']>0) ? E_MESSAGE_INFO : E_MESSAGE_SUCCESS; - + $mes->add($message, $mesStatus); - + // $ns -> tablerender(LAN_SUMMARY.": ".$lan,$message); @@ -1151,11 +1151,11 @@ function write_lanfile($lan='') { $notdef_start = ""; $notdef_end = "\n"; - $deflang = (MAGIC_QUOTES_GPC === TRUE) ? stripslashes($_POST['newlang'][$i]) : $_POST['newlang'][$i]; + $deflang = (MAGIC_QUOTES_GPC === TRUE) ? stripslashes((string) $_POST['newlang'][$i]) : $_POST['newlang'][$i]; $func = "define"; $quote = chr(34); - if (strpos($_POST['newdef'][$i],"ndef++") !== FALSE ) + if (strpos((string) $_POST['newdef'][$i],"ndef++") !== FALSE ) { $defvar = str_replace("ndef++","",$_POST['newdef'][$i]); $notdef_start = "if (!defined(".chr(34).$defvar.chr(34).")) {"; @@ -1173,12 +1173,12 @@ function write_lanfile($lan='') if($_POST['newdef'][$i] == "LC_ALL" && vartrue($_SESSION['lancheck-edit-file'])) { - $message .= $notdef_start.'setlocale('.htmlentities($defvar).','.$deflang.');
'.$notdef_end; + $message .= $notdef_start.'setlocale('.htmlentities((string) $defvar).','.$deflang.');
'.$notdef_end; $input .= $notdef_start."setlocale(".$defvar.",".$deflang.");".$notdef_end; } else { - $message .= $notdef_start.$func.'('.$quote.htmlentities($defvar).$quote.',"'.$deflang.'");
'.$notdef_end; + $message .= $notdef_start.$func.'('.$quote.htmlentities((string) $defvar).$quote.',"'.$deflang.'");
'.$notdef_end; $input .= $notdef_start.$func."(".$quote.$defvar.$quote.", ".chr(34).$deflang.chr(34).");".$notdef_end; } } @@ -1355,7 +1355,7 @@ function check_lan_errors($english,$translation,$def, $opts=array()) $error = array(); $warning = array(); - if((is_array($translation) && !array_key_exists($def,$translation) && $eng_line != "") || (trim($trans_line) == "" && $eng_line != "")) + if((is_array($translation) && !array_key_exists($def,$translation) && $eng_line != "") || (trim((string) $trans_line) == "" && $eng_line != "")) { $this->checkLog('def',1); return $def.": ".LAN_CHECK_5."
"; @@ -1366,33 +1366,33 @@ function check_lan_errors($english,$translation,$def, $opts=array()) $warning[] = "".$def. ": ".LAN_CHECK_29.""; } - if((strpos($eng_line,"[link=")!==FALSE && strpos($trans_line,"[link=")===FALSE) || (strpos($eng_line,"[b]")!==FALSE && strpos($trans_line,"[b]")===FALSE)) + if((strpos((string) $eng_line,"[link=")!==FALSE && strpos((string) $trans_line,"[link=")===FALSE) || (strpos((string) $eng_line,"[b]")!==FALSE && strpos((string) $trans_line,"[b]")===FALSE)) { $error[] = $def. ": ".LAN_CHECK_30; } - elseif((strpos($eng_line,"[")!==FALSE && strpos($trans_line,"[")===FALSE) || (strpos($eng_line,"]")!==FALSE && strpos($trans_line, "]")===FALSE)) + elseif((strpos((string) $eng_line,"[")!==FALSE && strpos((string) $trans_line,"[")===FALSE) || (strpos((string) $eng_line,"]")!==FALSE && strpos((string) $trans_line, "]")===FALSE)) { $error[] = $def. ": ".LAN_CHECK_31; } - if((strpos($eng_line,"--LINK--")!==false && strpos($trans_line,"--LINK--")===false)) + if((strpos((string) $eng_line,"--LINK--")!==false && strpos((string) $trans_line,"--LINK--")===false)) { $error[] = $def. ": Missing --LINK--"; } - if((strpos($eng_line,"e107.org")!==false && strpos($trans_line,"e107.org")===false)) + if((strpos((string) $eng_line,"e107.org")!==false && strpos((string) $trans_line,"e107.org")===false)) { $error[] = $def. ": Missing e107.org URL"; } - if((strpos($eng_line,"e107coders.org")!==FALSE && strpos($trans_line,"e107coders.org")===false)) + if((strpos((string) $eng_line,"e107coders.org")!==FALSE && strpos((string) $trans_line,"e107coders.org")===false)) { $error[] = $def. ": Missing e107coders.org URL"; } - if(strip_tags($eng_line) != $eng_line) + if(strip_tags((string) $eng_line) != $eng_line) { - $stripped = strip_tags($trans_line); + $stripped = strip_tags((string) $trans_line); if(($stripped == $trans_line)) { @@ -1497,12 +1497,12 @@ function get_comp_lan_phrases($comp_dir,$lang,$depth=0) - if(strpos($comp_dir,e_LANGUAGEDIR) !== false) + if(strpos((string) $comp_dir,e_LANGUAGEDIR) !== false) { $regexp = "#.php#"; $mode = 'core'; } - elseif(strpos($comp_dir,e_THEME) !== false) + elseif(strpos((string) $comp_dir,e_THEME) !== false) { $regexp = "#".$lang."#"; $mode = 'themes'; @@ -1769,19 +1769,19 @@ function edit_lanfiles($dir1, $dir2, $f1, $f2, $lan, $type=null) $dir1 = e_THEME.$dir1; $dir2 = e_THEME.$dir2; } - + // $ns = e107::getRender(); $sql = e107::getDb(); - + /* echo "
dir1 = $dir1"; echo "
file1 = $f1"; - + echo "
dir2 = $dir2"; echo "
file2 = $f2";*/ - - - + + + if($dir2.$f2 == e_LANGUAGEDIR.$lan."/English.php") // it's a language config file. { $f2 = $lan.".php"; @@ -1791,7 +1791,7 @@ function edit_lanfiles($dir1, $dir2, $f1, $f2, $lan, $type=null) { $root_file = $dir2.$f2; } - + if($dir2.$f2 == e_LANGUAGEDIR.$lan."/English_custom.php") // it's a language config file. { $f2 = $lan."_custom.php"; @@ -1810,7 +1810,7 @@ function edit_lanfiles($dir1, $dir2, $f1, $f2, $lan, $type=null) $keys = array_keys($trans); sort($keys); - + $text = "
@@ -1821,11 +1821,11 @@ function edit_lanfiles($dir1, $dir2, $f1, $f2, $lan, $type=null) "; - + $subkeys = array_keys($trans['orig']); foreach($subkeys as $sk) { - $rowamount = round(strlen($trans['orig'][$sk])/34)+1; + $rowamount = round(strlen((string) $trans['orig'][$sk])/34)+1; $hglt1=""; $hglt2=""; if(empty($trans['tran'][$sk]) && !empty($trans['orig'][$sk])) { @@ -1838,14 +1838,14 @@ function edit_lanfiles($dir1, $dir2, $f1, $f2, $lan, $type=null) $hglt2=""; } $text .=" - + "; $text .= ""; } - + unset($_SESSION['lancheck-edit-file']); - + //Check if directory is writable - + $text .= "
".$lan."
".$hglt1.htmlentities($sk).$hglt2."".$hglt1.htmlentities((string) $sk).$hglt2." ".htmlentities(str_replace("ndef++","",$trans['orig'][$sk])) .""; $text .= ($writable) ? "" : ""; //echo "orig --> ".$trans['orig'][$sk]."
"; - if (strpos($trans['orig'][$sk],"ndef++") !== false) + if (strpos((string) $trans['orig'][$sk],"ndef++") !== false) { //echo "+orig --> ".$trans['orig'][$sk]." <> ".strpos($trans['orig'][$sk],"ndef++")."
"; $text .= ""; @@ -1856,39 +1856,39 @@ function edit_lanfiles($dir1, $dir2, $f1, $f2, $lan, $type=null) } $text .="
"; - + if($writable) { $text .= '
'; - + if($root_file) { $_SESSION['lancheck-edit-file'] = $root_file; } - - + + } - + $text .= " - +
"; - + $text .= "

"; $text .= (!$writable) ? "
".$dir2.$f2.LAN_NOTWRITABLE : ""; // $text .= "

"; $text .= "
"; - + $capFile = str_replace("../","",$dir2.$f2); $caption = LANG_LAN_21.SEP.$lan.SEP.LAN_CHECK_2.SEP.LAN_EDIT.SEP.$capFile; @@ -1904,35 +1904,35 @@ function edit_lanfiles($dir1, $dir2, $f1, $f2, $lan, $type=null) function fill_phrases_array($data,$type) { $retloc = array(); - - if(preg_match_all('/(\/\*[\s\S]*?\*\/)/i',$data, $multiComment)) + + if(preg_match_all('/(\/\*[\s\S]*?\*\/)/i',(string) $data, $multiComment)) { $data = str_replace($multiComment[1],'',$data); // strip multi-line comments. } - - if(preg_match('/^\s*?setlocale\s*?\(\s*?([\w]+)\s*?,\s*?(.+)\s*?\)\s*?;/im',$data,$locale)) // check for setlocale(); + + if(preg_match('/^\s*?setlocale\s*?\(\s*?([\w]+)\s*?,\s*?(.+)\s*?\)\s*?;/im',(string) $data,$locale)) // check for setlocale(); { $retloc[$type][$locale[1]]= $locale[2]; } - - if(preg_match_all('/^\s*?define\s*?\(\s*?(\'|\")([\w]+)(\'|\")\s*?,\s*?(\'|\")([\s\S]*?)\s*?(\'|\")\s*?\)\s*?;/imu',$data,$matches)) + + if(preg_match_all('/^\s*?define\s*?\(\s*?(\'|\")([\w]+)(\'|\")\s*?,\s*?(\'|\")([\s\S]*?)\s*?(\'|\")\s*?\)\s*?;/imu',(string) $data,$matches)) { $def = $matches[2]; $values = $matches[5]; - + foreach($def as $k=>$d) { $retloc[$type][$d]= $values[$k]; } } - + return $retloc; - + /* echo "

Raw Data ".$type."

";
 		echo htmlentities($data);
 		echo "
"; - + */ } @@ -1951,7 +1951,7 @@ function is_utf8($str) { return TRUE; } - return (preg_match('/^./us',$str,$ar) == 1); + return (preg_match('/^./us',(string) $str,$ar) == 1); } diff --git a/e107_admin/language.php b/e107_admin/language.php index 11122ecb20..64a6007cd4 100644 --- a/e107_admin/language.php +++ b/e107_admin/language.php @@ -271,7 +271,7 @@ private function renderLanguagePacks() // if(is_readable(e_ADMIN."ver.php")) { // include(e_ADMIN."ver.php"); - list($ver, $tmp) = explode(" ", e_VERSION); + list($ver, $tmp) = explode(" ", (string) e_VERSION); } $lck = e107::getSingleton('lancheck', e_ADMIN."lancheck.php"); @@ -438,7 +438,7 @@ private function renderOnlineLanguagePacks() ".$value['date']." ".$value['version']; - if(strpos($value['tag'],'-') !==false) + if(strpos((string) $value['tag'],'-') !==false) { $text .= " ".LANG_LAN_153.""; } @@ -505,7 +505,7 @@ private function dbPageEditProcess() // ----------------- delete tables --------------------------------------------- if (isset($_POST['del_existing']) && $_POST['lang_choices'] && getperms('0')) { - $lang = strtolower($_POST['lang_choices']); + $lang = strtolower((string) $_POST['lang_choices']); $_POST['lang_choices'] = e107::getParser()->filter($_POST['lang_choices'],'w'); @@ -543,7 +543,7 @@ private function dbPageEditProcess() foreach ($tabs as $value) { - $lang = strtolower($_POST['language']); + $lang = strtolower((string) $_POST['language']); if (isset($_POST[$value])) { $copdata = ($_POST['copydata_'.$value]) ? 1 : 0; @@ -916,7 +916,7 @@ function __construct() $mes->addError(LANG_LAN_136.$disUnusedLanFile);//Couldn't overwrite } - $ns->tablerender(LANG_LAN_137.SEP.$disUnusedLanFile,$mes->render()."
".htmlentities($new)."
");//Processed + $ns->tablerender(LANG_LAN_137.SEP.$disUnusedLanFile,$mes->render()."
".htmlentities((string) $new)."
");//Processed } @@ -940,17 +940,17 @@ function run() foreach($script as $k=>$scr) { - if(strpos($scr,e_ADMIN)!==false) // CORE + if(strpos((string) $scr,e_ADMIN)!==false) // CORE { $mes->addDebug("Mode: Core Admin Calculated"); //$scriptname = str_replace("lan_","",basename($lanfile)); - $lanfile[$k] = e_LANGUAGEDIR.e_LANGUAGE."/admin/lan_".basename($scr); + $lanfile[$k] = e_LANGUAGEDIR.e_LANGUAGE."/admin/lan_".basename((string) $scr); $this->adminFile = true; } else // Root { $mes->addDebug("Mode: Search Core Root lan calculated"); - $lanfile[$k] = e_LANGUAGEDIR.e_LANGUAGE."/lan_".basename($scr); + $lanfile[$k] = e_LANGUAGEDIR.e_LANGUAGE."/lan_".basename((string) $scr); $lanfile[$k] = str_replace("lan_install", "lan_installer", $lanfile[$k]); //quick fix., //$lanfile = $this->findIncludedFiles($script,vartrue($_POST['deprecatedLansReverse'])); @@ -1034,12 +1034,12 @@ function getDefined($line,$script=false) return array('define'=>$line,'value'=>'-'); } - if(preg_match("#\"(.*?)\".*?\"(.*)\"#",$line,$match) || - preg_match("#\'(.*?)\'.*?\"(.*)\"#",$line,$match) || - preg_match("#\"(.*?)\".*?\'(.*)\'#",$line,$match) || - preg_match("#\'(.*?)\'.*?\'(.*)\'#",$line,$match) || - preg_match("#\((.*?)\,.*?\"(.*)\"#",$line,$match) || - preg_match("#\((.*?)\,.*?\'(.*)\'#",$line,$match)) + if(preg_match("#\"(.*?)\".*?\"(.*)\"#",(string) $line,$match) || + preg_match("#\'(.*?)\'.*?\"(.*)\"#",(string) $line,$match) || + preg_match("#\"(.*?)\".*?\'(.*)\'#",(string) $line,$match) || + preg_match("#\'(.*?)\'.*?\'(.*)\'#",(string) $line,$match) || + preg_match("#\((.*?)\,.*?\"(.*)\"#",(string) $line,$match) || + preg_match("#\((.*?)\,.*?\'(.*)\'#",(string) $line,$match)) { return array('define'=>$match[1],'value'=>$match[2]); @@ -1106,7 +1106,7 @@ static function form() foreach($lans as $script => $lan) { - if(in_array(basename($lan), $exclude)) + if(in_array(basename((string) $lan), $exclude)) { continue; } @@ -1121,7 +1121,7 @@ static function form() foreach($root as $script => $lan) { - if(in_array(basename($lan), $exclude)) + if(in_array(basename((string) $lan), $exclude)) { continue; } @@ -1135,7 +1135,7 @@ static function form() $text .= ""; foreach($templates as $script => $lan) { - if(in_array(basename($lan), $exclude)) + if(in_array(basename((string) $lan), $exclude)) { continue; } @@ -1148,7 +1148,7 @@ static function form() $text .= ""; foreach($shortcodes as $script => $lan) { - if(in_array(basename($lan), $exclude)) + if(in_array(basename((string) $lan), $exclude)) { continue; } @@ -1182,7 +1182,7 @@ static function form() asort($_SESSION['languageTools_lanFileList']); foreach($_SESSION['languageTools_lanFileList'] as $val) { - if(strpos($val, e_SYSTEM) !== false) + if(strpos((string) $val, e_SYSTEM) !== false) { continue; } @@ -1250,7 +1250,7 @@ function isFound($needle, $haystack) foreach($haystack as $file => $content) { $count = 1; - $lines = explode("\n",$content); + $lines = explode("\n",(string) $content); foreach($lines as $ln) { if(preg_match("/\b".$needle."\b/i",$ln, $mtch)) @@ -1290,9 +1290,9 @@ function compareit($needle,$haystack, $value='',$disabled=false, $reverse=false) // Check if a common phrases was used. foreach($ar as $def=>$common) { - similar_text($value, $common, $p); + similar_text((string) $value, (string) $common, $p); - if(strtoupper(trim($value)) == strtoupper($common)) + if(strtoupper(trim((string) $value)) == strtoupper((string) $common)) { //$text .= "
$common
"; @@ -1404,7 +1404,7 @@ function compareit($needle,$haystack, $value='',$disabled=false, $reverse=false) // return "".$needle .$disabled. ""; } - elseif($foundSimilar && $found && substr($def,0,4) == "LAN_") + elseif($foundSimilar && $found && substr((string) $def,0,4) == "LAN_") { // $color = "background-color:#E9EAF2"; $label .= " ".round($p)."% like ".$def." "; @@ -1644,12 +1644,12 @@ function findIncludedFiles($script,$reverse=false) $reverse = false; } - $dir = dirname($script); + $dir = dirname((string) $script); $dir = str_replace("/includes","",$dir); $plugin = basename($dir); - if(strpos($script,'admin')!==false || strpos($script,'includes')!==false) // Admin Language files. + if(strpos((string) $script,'admin')!==false || strpos((string) $script,'includes')!==false) // Admin Language files. { $newLangs = array( diff --git a/e107_admin/links.php b/e107_admin/links.php index 619f1f34b8..6ccfa1359a 100644 --- a/e107_admin/links.php +++ b/e107_admin/links.php @@ -585,9 +585,9 @@ function _tree_order($parent_id, $search, &$src, $level = 0, $modified = false) function bcClean($link_name) { - if(substr($link_name, 0,8) == 'submenu.') // BC Fix. + if(substr((string) $link_name, 0,8) == 'submenu.') // BC Fix. { - list($tmp,$tmp2,$link) = explode('.', $link_name, 3); + list($tmp,$tmp2,$link) = explode('.', (string) $link_name, 3); } else { @@ -789,7 +789,7 @@ function link_sefurl($curVal,$mode) foreach($config as $k=>$v) { - if($k == 'index' || (strpos($v['regex'],'(') === false)) // only provide urls without dynamic elements. + if($k == 'index' || (strpos((string) $v['regex'],'(') === false)) // only provide urls without dynamic elements. { $opts[] = $k; } @@ -809,7 +809,7 @@ function link_url($curVal,$mode) $owner = $this->getController()->getListModel()->get('link_owner'); $sef = $this->getController()->getListModel()->get('link_sefurl'); - if($curVal[0] !== '{' && substr($curVal,0,4) != 'http' && $mode == 'link_id') + if($curVal[0] !== '{' && substr((string) $curVal,0,4) != 'http' && $mode == 'link_id') { $curVal = '{e_BASE}'.$curVal; } @@ -895,7 +895,7 @@ function _parent_select_array($parent_id, $search, &$src, $strpad = '   foreach ($search[$parent_id] as $id => $title) { - $src[$id] = str_repeat($strpad, $level).($level != 0 ? '- ' : '').$title; + $src[$id] = str_repeat((string) $strpad, $level).($level != 0 ? '- ' : '').$title; $this->_parent_select_array($id, $search, $src, $strpad, $level + 1); } } diff --git a/e107_admin/mailout.php b/e107_admin/mailout.php index 5c2211f388..5607ea7f60 100644 --- a/e107_admin/mailout.php +++ b/e107_admin/mailout.php @@ -572,7 +572,7 @@ private function sendTestEmail() $mes = e107::getMessage(); $pref = e107::getPref(); - if(trim($_POST['testaddress']) == '') + if(trim((string) $_POST['testaddress']) == '') { $mes->addError(LAN_MAILOUT_19); return null; @@ -583,7 +583,7 @@ private function sendTestEmail() $pref['bulkmailer'] = $pref['mailer']; } - $add = ($pref['bulkmailer']) ? " (".strtoupper($pref['bulkmailer']).") " : ' (PHP)'; + $add = ($pref['bulkmailer']) ? " (".strtoupper((string) $pref['bulkmailer']).") " : ' (PHP)'; if($pref['bulkmailer'] == 'smtp') { @@ -591,7 +591,7 @@ private function sendTestEmail() $add .= " - ".str_replace("secure=", "", $pref['smtp_options']); } - $sendto = trim($_POST['testaddress']); + $sendto = trim((string) $_POST['testaddress']); $subjectSitename = ($_POST['testtemplate'] == 'textonly') ? SITENAME : ''; @@ -798,7 +798,7 @@ function previewPage($id='', $user=null) if(is_numeric($id)) { $mailData = e107::getDb()->retrieve('mail_content','*','mail_source_id='.intval($id)." LIMIT 1"); - + $shortcodes = array( 'USERNAME' => 'John Example', 'DISPLAYNAME' => 'John Example', @@ -813,7 +813,7 @@ function previewPage($id='', $user=null) if(!empty($user)) { $userData = e107::getDb()->retrieve('mail_recipients','*', 'mail_detail_id = '.intval($id).' AND mail_recipient_id = '.intval($user).' LIMIT 1'); - $shortcodes = e107::unserialize(stripslashes($userData['mail_target_info'])); + $shortcodes = e107::unserialize(stripslashes((string) $userData['mail_target_info'])); } if(!isset($shortcodes['MAILREF'])) @@ -821,9 +821,9 @@ function previewPage($id='', $user=null) $shortcodes['MAILREF'] = intval($_GET['id']); } - + $data = $this->mailAdmin->dbToMail($mailData); - + $eml = array( 'subject' => $data['mail_subject'], 'body' => $data['mail_body'], @@ -831,7 +831,7 @@ function previewPage($id='', $user=null) 'shortcodes' => $shortcodes, 'media' => $data['mail_media'], ); - + // return print_a($data,true); } else @@ -926,7 +926,7 @@ private function processData($new_data) $other['mail_selectors'] = $this->mailAdmin->getAllSelectors(); - $ret['mail_attach'] = trim($new_data['mail_attach']); + $ret['mail_attach'] = trim((string) $new_data['mail_attach']); $ret['mail_send_style'] = varset($new_data['mail_send_style'],'textonly'); $ret['mail_include_images'] = (isset($new_data['mail_include_images']) ? 1 : 0); $ret['mail_other'] = $other; // type is set to 'array' in $fields. @@ -1117,11 +1117,11 @@ function maintPage() { return; } - + $mes = e107::getMessage(); $ns = e107::getRender(); $frm = e107::getForm(); - + $text = "
@@ -1130,17 +1130,17 @@ function maintPage() - + "; $text .= "".LAN_MAILOUT_182." - + ".$frm->admin_button('email_dross','no-value','delete', LAN_RUN)."
".LAN_MAILOUT_252.""; $text .= "\n
"; return $text; - + // return $ns->tablerender(ADLAN_136.SEP.ADLAN_40, $text, 'maint',true); } @@ -1156,7 +1156,7 @@ function prefsPage() $frm = e107::getForm(); $mes = e107::getMessage(); $ns = e107::getRender(); - + if($pref['mail_bounce'] == 'auto' && !empty($pref['mail_bounce_email']) && !is_executable(e_HANDLER."bounce_handler.php")) { $mes->addWarning('Your bounce_handler.php file is NOT executable'); @@ -1166,7 +1166,7 @@ function prefsPage() e107::getCache()->CachePageMD5 = '_'; $lastload = e107::getCache()->retrieve('emailLastBounce',FALSE,TRUE,TRUE); $lastBounce = round((time() - $lastload) / 60); - + $lastBounceText = ($lastBounce > 1256474) ? "Never" : "".$lastBounce . " minutes ago."; $text = " @@ -1190,9 +1190,9 @@ function prefsPage() ".LAN_MAILOUT_77." "; - - $mail_enable = explode(',',vartrue($pref['mailout_enabled'],'core')); - + + $mail_enable = explode(',',(string) vartrue($pref['mailout_enabled'],'core')); + $coreCheck = (in_array('core',$mail_enable)) ? "checked='checked'" : ""; // $text .= $frm->checkbox('mail_mailer_enabled[]','core', $coreCheck, 'users'); @@ -1211,16 +1211,16 @@ function prefsPage() $text .= " - - + + ".LAN_MAILOUT_115."
"; $text .= mailoutAdminClass::mailerPrefsTable($pref, 'bulkmailer'); - - + + /* FIXME - posting SENDMAIL path triggers Mod-Security rules. // Sendmail. --------------> $senddisp = ($pref['mailer'] != 'sendmail') ? "style='display:none;'" : ''; @@ -1232,7 +1232,7 @@ function prefsPage() - + "; */ @@ -1249,7 +1249,7 @@ function prefsPage() \n - + ".LAN_MAILOUT_25." ".LAN_MAILOUT_26." ".$frm->number('mail_pause', $pref['mail_pause'])." ".LAN_MAILOUT_27." ". @@ -1257,23 +1257,23 @@ function prefsPage() ".LAN_MAILOUT_30." \n - + ".LAN_MAILOUT_156." ".$frm->number('mail_workpertick',varset($pref['mail_workpertick'],5))."".LAN_MAILOUT_157." - - + + "; - list($mail_log_option,$mail_log_email) = explode(',',varset($pref['mail_log_options'],'0,0')); - + list($mail_log_option,$mail_log_email) = explode(',',(string) varset($pref['mail_log_options'],'0,0')); + $check = ($mail_log_email == 1) ? " checked='checked'" : ""; - - + + $logOptions = array(LAN_MAILOUT_73,LAN_MAILOUT_74,LAN_MAILOUT_75,LAN_MAILOUT_119); - + $text .= " ".LAN_MAILOUT_72." @@ -1316,7 +1316,7 @@ function prefsPage() ".LAN_MAILOUT_231.""; - + // bounce divs = mail_bounce_none, mail_bounce_auto, mail_bounce_mail $autoDisp = ($pref['mail_bounce'] != 'auto') ? "style='display:none;'" : ''; $autoMail = ($pref['mail_bounce'] != 'mail') ? "style='display:none;'" : ''; @@ -1340,20 +1340,20 @@ function prefsPage() ".LAN_EMAIL."
".$frm->text('mail_bounce_email2', $pref['mail_bounce_email'], 40, 'size=xlarge'); - + if(!empty($pref['mail_bounce_email'])) { $text .= $frm->admin_button('send_bounce_test','Send Test','primary','Test'); } - + $text .= "
- + ".LAN_MAILOUT_233."".(e_ROOT).e107::getFolder('handlers')."bounce_handler.php"; - + $status = ''; - + if(!is_readable(e_HANDLER.'bounce_handler.php')) { $status = LAN_MAILOUT_161; @@ -1363,17 +1363,17 @@ function prefsPage() $status = LAN_MAILOUT_162; } - + if(!empty($status)) { $text .= "  ".$status.""; } - - - + + + $text .= "
".LAN_MAILOUT_235."
- - + + ".LAN_MAILOUT_236."".$lastBounceText.""; @@ -1392,14 +1392,14 @@ function prefsPage() "; - + $bouncePrefs = array('mail_bounce_email'=>LAN_EMAIL, 'mail_bounce_pop3'=>LAN_MAILOUT_33, 'mail_bounce_user'=>LAN_MAILOUT_34, 'mail_bounce_pass'=>LAN_PASSWORD); - + foreach($bouncePrefs as $key =>$label) { $text .= "".$label."".$frm->text($key,$pref[$key],40,'size=xlarge').""; } - + /* $text .= " ".LAN_MAILOUT_32." @@ -1408,7 +1408,7 @@ function prefsPage() ".LAN_PASSWORD." "; */ - + $text .= " ".LAN_MAILOUT_120." - +
"; @@ -497,12 +497,12 @@ function sendTest() $text .=" - - + + "; - + $emFormat = array( 'textonly' => LAN_MAILOUT_125, 'texthtml' => LAN_MAILOUT_126, @@ -512,7 +512,7 @@ function sendTest() $text .= " - + ".$frm->help(PRFLAN_163)." @@ -758,17 +758,17 @@ function sendTest() ".$frm->radio_switch('admin_helptip', varset($pref['admin_helptip']))." - + ".$e_userclass->uc_dropdown('admin_navbar_debug', $pref['admin_navbar_debug'], 'nobody,main,admin,classes,no-excludes', "tabindex='".$frm->getNext()."'")." - + - - - + + + ".pref_submit('admindisp')." @@ -814,9 +814,9 @@ function sendTest() ".$frm->text('forumdate', $pref['forumdate'], 50)." "; - - - + + + $def = strtotime('December 21, 2012 3:45pm'); $inputdate = e107::getDate()->dateFormats($def); @@ -827,9 +827,9 @@ function sendTest() ".$frm->select('inputdate',$inputdate, e107::getPref('inputdate')); - + $text .= $frm->select('inputtime',$inputtime, e107::getPref('inputtime')); - + $text .= " "; @@ -898,7 +898,7 @@ function sendTest() $text .= " - + ".$frm->select_open('allowEmailLogin', array('size'=>'xlarge')); @@ -950,7 +950,7 @@ function sendTest() - + ".$frm->help(PRFLAN_198)." @@ -984,21 +984,21 @@ function sendTest() - + - + ".pref_submit('registration')." "; - + // Key registration - - + + // Signup options ===========================. @@ -1040,7 +1040,7 @@ function sendTest() "; - + $signup_option_names = array( // "signup_option_loginname" => "Login Name", @@ -1069,8 +1069,8 @@ function sendTest() "; } - - + + $text .= " @@ -1223,16 +1223,16 @@ function sendTest() ".$frm->radio_switch('make_clickable', $pref['make_clickable'])." "; - - + + $text .= " ".$frm->help(PRFLAN_103)." - + ".$frm->radio_switch('link_replace', $pref['link_replace'])."
@@ -1243,21 +1243,21 @@ function sendTest()
Emails ".$frm->help(PRFLAN_108)."".$frm->text('email_text', $tp->post_toForm($pref['email_text']), 200, 'size=block-level&placeholder='.PRFLAN_107)."
- - + +
- + ".$frm->help(PRFLAN_146)." ".$frm->radio_switch('links_new_window', $pref['links_new_window'])." - + - - + + ".$frm->help(PRFLAN_41)." @@ -1277,8 +1277,8 @@ function sendTest() ".$frm->tags('profanity_words', $pref['profanity_words'], 250, array('maxItems'=>1000))." - - + + ".$frm->help(PRFLAN_110)." @@ -1329,8 +1329,8 @@ function sendTest() ".$frm->radio_switch('wysiwyg', $pref['wysiwyg'])." - - + + "; if(file_exists(e_PLUGIN."geshi/geshi.php")) @@ -1407,12 +1407,12 @@ function multi_radio($name, $textsVals, $currentval = '') // Secure Image/ Captcha $secureImage = array('signcode'=>PRFLAN_76, 'logcode'=>PRFLAN_81, "fpwcode"=>PRFLAN_138,'admincode'=>PRFLAN_222); - + foreach($secureImage as $key=>$label) { - + $label = str_replace($srch,$repl,$label); - + $text .= "".$frm->help(PRFLAN_223).""; if($hasGD) { @@ -1422,17 +1422,17 @@ function multi_radio($name, $textsVals, $currentval = '') { $text .= PRFLAN_133; } - + $text .= " \n"; - + } /* - + $text .= " ".PRFLAN_81.": @@ -1467,7 +1467,7 @@ function multi_radio($name, $textsVals, $currentval = '') "; * - + */ $text .= " @@ -1485,8 +1485,8 @@ function multi_radio($name, $textsVals, $currentval = '') ".$frm->radio('user_tracking', array('cookie' => PRFLAN_49, 'session' => PRFLAN_50), varset($pref['user_tracking']))." - - + + ".$frm->help(PRFLAN_263)." ".$frm->text('cookie_name', varset($pref['cookie_name']), 20)." @@ -1511,7 +1511,7 @@ function multi_radio($name, $textsVals, $currentval = '') ".$frm->select('session_save_method', [ 'db'=>'Database', 'files'=>'Files'], varset($pref['session_save_method']))." - + "; @@ -1544,9 +1544,9 @@ function multi_radio($name, $textsVals, $currentval = '') "; - + $CHAP_list = array(PRFLAN_180, PRFLAN_181, PRFLAN_182); - + $text .= " ". $frm->help(PRFLAN_183."
".PRFLAN_179)." @@ -1555,12 +1555,12 @@ function multi_radio($name, $textsVals, $currentval = '') $CHAPopt = !empty($pref['ssl_enabled']) || !empty($pref['passwordEncoding']) ? array('disabled'=>1) : null; $text .= $frm->select('password_CHAP',$CHAP_list,$pref['password_CHAP'], $CHAPopt ); //." ".$frm->select_open('password_CHAP'); - + //TODO - user tracking session name - visible only if Cookie is enabled (JS) $text .= " - + @@ -1595,14 +1595,14 @@ function multi_radio($name, $textsVals, $currentval = '') $text .= " - + ".$frm->help(PRFLAN_232)." ".$frm->number('failed_login_limit', varset($pref['failed_login_limit'],10), 3, array('max'=>10, 'min'=>0))." - + @@ -1650,14 +1650,14 @@ function multi_radio($name, $textsVals, $currentval = '') ".$frm->radio_switch('nested_comments', $pref['nested_comments'], LAN_YES, LAN_NO)." - + ".PRFLAN_90.": ".$frm->radio_switch('allowCommentEdit', $pref['allowCommentEdit'], LAN_YES, LAN_NO)." - + ".PRFLAN_166.": @@ -1669,7 +1669,7 @@ function multi_radio($name, $textsVals, $currentval = '') ".$frm->help(PRFLAN_234)." ". - + $frm->uc_select('comments_moderate', $pref['comments_moderate'],"nobody,guest,new,bots,public,member,admin,main,classes"). " @@ -1677,16 +1677,16 @@ function multi_radio($name, $textsVals, $currentval = '') ".PRFLAN_235." "; - + $comment_sort = array( "desc" => PRFLAN_236, //default 'asc' => PRFLAN_237 ); - + $text .= $frm->select('comments_sort',$comment_sort, $pref['comments_sort'], array('size'=>'xlarge'))." - + @@ -1710,37 +1710,37 @@ function multi_radio($name, $textsVals, $currentval = '') ".pref_submit('comments')." "; - + // File Uploads e107::includeLan(e_LANGUAGEDIR.e_LANGUAGE."/admin/lan_upload.php"); require_once(e_HANDLER."upload_handler.php"); - - - - - - + + + + + + $text .= "

".PRFLAN_53.defset('SEP').PRFLAN_238."

"; - - + + $upload_max_filesize = ini_get('upload_max_filesize'); $post_max_size = ini_get('post_max_size'); - + $maxINI = min($upload_max_filesize,$post_max_size); - + if($maxINI < $pref['upload_maxfilesize']) { $text .= "
"; $text .= PRFLAN_239." ".$maxINI."
"; $pref['upload_maxfilesize'] = $maxINI; } - - - - + + + + $text .= " @@ -1751,7 +1751,7 @@ function multi_radio($name, $textsVals, $currentval = '') @@ -1831,25 +1831,25 @@ function filePermRender($class) "; - + } // $text .= print_a($data,true); - - + + $text .= "
".$frm->help(UPLLAN_26)." ". - + $frm->radio_switch('upload_enabled', $pref['upload_enabled']) ."
".$fl->file_size_encode($v)."
"; */ $text .= "
".PRFLAN_241." ".str_replace("../",'',e_SYSTEM).e_READ_FILETYPES."
- - + + ".pref_submit('uploads'); - - - + + + $text .= "
"; @@ -2185,7 +2185,7 @@ function prefs_adminmenu() $var['core-prefs-signup']['text'] = PRFLAN_19; $var['core-prefs-signup']['image_src'] = 'fas-clipboard-list.glyph'; - + $var['core-prefs-comments']['text'] = PRFLAN_210; $var['core-prefs-comments']['image_src'] = 'fa-comments.glyph'; diff --git a/e107_admin/theme.php b/e107_admin/theme.php index bbde48cf50..317af7388c 100644 --- a/e107_admin/theme.php +++ b/e107_admin/theme.php @@ -44,7 +44,7 @@ e107::js('footer-inline', " $('textarea').suggest(':', { data: function(q, lookup) { - + $.getJSON('theme.php', {q : q }, function(data) { console.log(data); console.log(lookup); @@ -54,7 +54,7 @@ // we aren't returning any } - + }); @@ -64,9 +64,9 @@ e107::js('footer-inline', " $('textarea.input-custompages').suggest(':', { - + data: function() { - + var i = $.ajax({ type: 'GET', url: 'theme.php', @@ -78,7 +78,7 @@ // console.log(data); return data; }).responseText; - + try { var d = $.parseJSON(i); @@ -88,7 +88,7 @@ // Not JSON. return; } - + return d; }, filter: { @@ -203,7 +203,7 @@ function handleAjax() case 'info': if(!empty($_GET['src'])) { - $string = base64_decode($_GET['src']); + $string = base64_decode((string) $_GET['src']); parse_str($string,$p); $themeInfo = e107::getSession()->get('thememanager/online/'.intval($p['id'])); echo $themec->renderThemeInfo($themeInfo); @@ -488,7 +488,7 @@ public function OnlineObserver() $this->perPage = 500; } - + public function ChooseAjaxObserver() { $this->ChooseObserver(); @@ -648,7 +648,7 @@ public function InfoPage() if(!empty($_GET['src'])) // online mode. { - $string = base64_decode($_GET['src']); + $string = base64_decode((string) $_GET['src']); parse_str($string,$p); $themeInfo = e107::getSession()->get('thememanager/online/'.intval($p['id'])); return $this->themeObj->renderThemeInfo($themeInfo); @@ -677,7 +677,7 @@ public function DownloadPage() $frm = e107::getForm(); $mes = e107::getMessage(); - $string = base64_decode($_GET['src']); + $string = base64_decode((string) $_GET['src']); parse_str($string, $data); if(!empty($data['price'])) @@ -786,7 +786,7 @@ private function containsErrors($code) foreach($dep as $test) { - if(strpos($code, $test) !== false) + if(strpos((string) $code, $test) !== false) { e107::getMessage()->addDebug("Incompatible function ".rtrim($test,"(")." found in theme.php"); return true; @@ -879,7 +879,7 @@ private function setThemeData($force=false) if($filter = $this->getQuery('filter_options')) { - list($bla, $cat) = explode("__",$filter); + list($bla, $cat) = explode("__",(string) $filter); } $limit = 96; @@ -909,7 +909,7 @@ private function setThemeData($force=false) 'id' => $r['params']['id'], 'type' => 'theme', 'mode' => $r['params']['mode'], - 'name' => stripslashes($r['name']), + 'name' => stripslashes((string) $r['name']), 'category' => $r['category'], 'preview' => varset($r['screenshots']['image']), 'date' => $r['date'], @@ -1004,7 +1004,7 @@ function loadBatch($force=false) foreach($themeList as $k=>$v) { - if(!empty($parms['searchqry']) && stripos($v['info'],$parms['searchqry']) === false && stripos($v['folder'],$parms['searchqry']) === false && stripos($v['name'],$parms['searchqry']) === false) + if(!empty($parms['searchqry']) && stripos((string) $v['info'],(string) $parms['searchqry']) === false && stripos((string) $v['folder'],(string) $parms['searchqry']) === false && stripos((string) $v['name'],(string) $parms['searchqry']) === false) { continue; } @@ -1228,7 +1228,7 @@ private function onlineOptions($theme) return $main_icon.$info_icon.$preview_icon; } - + } @@ -1404,7 +1404,7 @@ function step2() if($this->themeSrc) // New theme copied from another { $defaults = array( - "main-name" => ucfirst($this->themeName), + "main-name" => ucfirst((string) $this->themeName), 'category-category' => vartrue($info['category']), ); } @@ -1489,7 +1489,7 @@ function step2() $text .= "
" .$frm->hidden('newtheme', $this->themeName); - $text .= $frm->hidden('xml[custompages]', trim(vartrue($leg['CUSTOMPAGES']))) + $text .= $frm->hidden('xml[custompages]', trim((string) vartrue($leg['CUSTOMPAGES']))) .$frm->admin_button('step', 3,'other',LAN_GENERATE)."
"; @@ -1601,7 +1601,7 @@ function createXml($data) if(!empty($newArray['CUSTOMPAGES'])) { - $newArray['CUSTOMPAGES'] = trim($newArray['CUSTOMPAGES']); + $newArray['CUSTOMPAGES'] = trim((string) $newArray['CUSTOMPAGES']); $LAYOUTS = "\n\n"; $LAYOUTS .= " {CUSTOMPAGES}\n"; $LAYOUTS .= " "; @@ -1685,7 +1685,7 @@ function createXml($data) function xmlInput($name, $info, $default='') { $frm = e107::getForm(); - list($cat,$type) = explode("-",$info); + list($cat,$type) = explode("-",(string) $info); $size = 30; $help = ''; @@ -1710,7 +1710,7 @@ function xmlInput($name, $info, $default='') case 'main-date': $help = TPVLAN_CONV_6; $required = true; - $default = (empty($default)) ? time() : strtotime($default); + $default = (empty($default)) ? time() : strtotime((string) $default); break; case 'main-version': diff --git a/e107_admin/ugflag.php b/e107_admin/ugflag.php index 094f9a0499..db47514f61 100644 --- a/e107_admin/ugflag.php +++ b/e107_admin/ugflag.php @@ -39,14 +39,14 @@ $pref['maintainance_text'] = $temp; $changed = TRUE; } - + $temp = intval($_POST['main_admin_only']); if(getperms('0') && $pref['main_admin_only'] != $temp) { $pref['main_admin_only'] = $temp; $changed = TRUE; } - + if($changed) { e107::getLog()->add(($pref['maintainance_flag'] == 0) ? 'MAINT_02' : 'MAINT_01', $pref['maintainance_text'], E_LOG_INFORMATIVE, ''); @@ -59,7 +59,7 @@ } $pref = e107::getConfig('core', true, true)->getPref(); - + } @@ -75,14 +75,14 @@ "; - + $elements = array( e_UC_PUBLIC => LAN_DISABLED, e_UC_MEMBER => ADLAN_110, e_UC_ADMIN => UGFLAN_8, e_UC_MAINADMIN => UGFLAN_9 ); - + $text .= " ".UGFLAN_2.": @@ -151,7 +151,7 @@ function headerjs() "; - + return $ret; } diff --git a/e107_admin/update_routines.php b/e107_admin/update_routines.php index 085f128b74..29d941b22d 100644 --- a/e107_admin/update_routines.php +++ b/e107_admin/update_routines.php @@ -87,7 +87,7 @@ $fname = e_PLUGIN.$path.'/'.$path.'_update_check.php'; // DEPRECATED - left for BC only. if (is_readable($fname)) include_once($fname); } - + $fname = e_PLUGIN.$path.'/'.$path.'_setup.php'; if (is_readable($fname)) { @@ -103,7 +103,7 @@ { $dbupdate['test_code'] = 'Test update routine'; } - + // set 'master' to true to prevent other upgrades from running before it is complete. $LAN_UPDATE_4 = deftrue('LAN_UPDATE_4',"Update from [x] to [y]"); // in case language-pack hasn't been upgraded. @@ -115,7 +115,7 @@ $dbupdate['706_to_800'] = array('master'=>true, 'title'=> e107::getParser()->lanVars($LAN_UPDATE_4, array('1.x','2.0')), 'message'=> LAN_UPDATE_29, 'hide_when_complete'=>true); $dbupdate['20x_to_latest'] = array('master'=>true, 'title'=> e107::getParser()->lanVars($LAN_UPDATE_4, array('2.x', $e107info['e107_version'])), 'message'=> null, 'hide_when_complete'=>false); - + // always run these last. @@ -398,7 +398,7 @@ function update_check() $update_needed = true; break; } - elseif(strpos($func, 'core_') !==0) // skip the pref and table check. + elseif(strpos((string) $func, 'core_') !==0) // skip the pref and table check. { $dbUpdatesPref[$func] = 1; @@ -429,7 +429,7 @@ function update_check() { $update_needed = TRUE; } - + // $e107cache->set_sys('nq_admin_updatecheck', time().','.($update_needed ? '2,' : '1,').$e107info['e107_version'], TRUE); } @@ -1254,7 +1254,7 @@ function update_706_to_800($type='') { // Check for table - might add some core plugin tables in here if ($field_info = ($sql->db_Field($t, $f, '', TRUE))) { - if (strtolower($field_info['Type']) != 'varchar(45)') + if (strtolower((string) $field_info['Type']) != 'varchar(45)') { if ($just_check) return update_needed('Update IP address field '.$f.' in table '.$t); $status = $sql->gen("ALTER TABLE `".MPREFIX.$t."` MODIFY `$f` VARCHAR(45) NOT NULL DEFAULT '';") ? E_MESSAGE_DEBUG : E_MESSAGE_ERROR; @@ -1548,7 +1548,7 @@ function update_706_to_800($type='') if ($just_check) return update_needed('Avatar paths require updating.'); foreach($avatar_images as $av) { - $apath = (strpos($av['path'], 'public/') !== false) ? e_AVATAR_UPLOAD : e_AVATAR_DEFAULT; + $apath = (strpos((string) $av['path'], 'public/') !== false) ? e_AVATAR_UPLOAD : e_AVATAR_DEFAULT; if(rename($av['path'].$av['fname'], $apath. $av['fname'])===false) { @@ -1596,7 +1596,7 @@ function update_706_to_800($type='') { $log->addDebug("core-media-cat `media_cat_nick` field removed."); } - + // $query = "INSERT INTO `".MPREFIX."core_media_cat` (`media_cat_id`, `media_cat_owner`, `media_cat_category`, `media_cat_title`, `media_cat_diz`, `media_cat_class`, `media_cat_image`, `media_cat_order`) VALUES // (0, 'gallery', 'gallery_1', 'Gallery 1', 'Visible to the public at /gallery.php', 0, '', 0); /// "; @@ -1723,7 +1723,7 @@ function update_706_to_800($type='') while($row = $sql->fetch()) { - $ext = strrchr($row['download_url'], "."); + $ext = strrchr((string) $row['download_url'], "."); $suffix = ltrim($ext,"."); if(!isset($allowed_types[$suffix])) @@ -1747,7 +1747,7 @@ function update_706_to_800($type='') // add found Public file-types. foreach($public_files as $v) { - $ext = strrchr($v['fname'], "."); + $ext = strrchr((string) $v['fname'], "."); $suffix = ltrim($ext,"."); if(!isset($allowed_types[$suffix])) { @@ -1832,7 +1832,7 @@ function update_706_to_800($type='') if (!$just_check) // Running the Upgrade Process. { - + if(!is_array($pref['sitetheme_layouts']) || !vartrue($pref['sitetheme_deflayout'])) { $th = e107::getSingleton('themeHandler'); @@ -1846,10 +1846,10 @@ function update_706_to_800($type='') $log->addDebug("Couldn't update SiteTheme prefs"); } } - + $log->toFile('upgrade_v1_to_v2'); - - + + if ($do_save) { // save_prefs(); diff --git a/e107_admin/updateadmin.php b/e107_admin/updateadmin.php index 48612de21e..14e39f9f4b 100644 --- a/e107_admin/updateadmin.php +++ b/e107_admin/updateadmin.php @@ -110,7 +110,7 @@
- ". + ". $frm->admin_button('update_settings','no-value','update',UDALAN_7)."
diff --git a/e107_admin/upload.php b/e107_admin/upload.php index 20d44121a0..96a5cecf7e 100644 --- a/e107_admin/upload.php +++ b/e107_admin/upload.php @@ -208,7 +208,7 @@ public function beforeUpdate($new_data, $old_data, $id) // Make sure the upload_category contains only integers // Make sure the owner correspondents to the category id - list($catOwner, $catID) = explode("__", $new_data['upload_category'], 2); + list($catOwner, $catID) = explode("__", (string) $new_data['upload_category'], 2); $new_data['upload_category'] = intval($catID); $new_data['upload_owner'] = $catOwner; diff --git a/e107_admin/users.php b/e107_admin/users.php index 01211ec551..7889a44160 100644 --- a/e107_admin/users.php +++ b/e107_admin/users.php @@ -262,34 +262,34 @@ public function runObservers($run_header = true) class users_admin_ui extends e_admin_ui { - + protected $pluginTitle = ADLAN_36; protected $pluginName = 'core'; protected $eventName = 'user'; protected $table = "user"; - + // protected $listQry = "SELECT SQL_CALC_FOUND_ROWS * FROM #users"; // without any Order or Limit. protected $listQry = "SELECT SQL_CALC_FOUND_ROWS u.*,ue.* from #user AS u LEFT JOIN #user_extended AS ue ON u.user_id = ue.user_extended_id "; // without any Order or Limit. - + protected $editQry = "SELECT u.*,ue.* FROM #user AS u left join #user_extended AS ue ON u.user_id = ue.user_extended_id WHERE user_id = {ID}"; - + protected $pid = "user_id"; protected $perPage = 10; protected $batchDelete = true; protected $batchExport = true; protected $listOrder = 'user_id DESC'; - + /** * Show confirm screen before (batch/single) delete * @var boolean */ public $deleteConfirmScreen = true; - + /** * @var boolean */ protected $batchCopy = false; - + /** * List (numerical array) of only disallowed for this controller actions */ @@ -303,15 +303,15 @@ class users_admin_ui extends e_admin_ui 'description' => 'user_name', 'vars'=> array('user_id' => true, 'user_name' => true) ); - + //TODO - finish 'user' type, set 'data' to all editable fields, set 'noedit' for all non-editable fields protected $fields = array( 'checkboxes' => array('title'=> '', 'type' => null, 'width' =>'50px', 'forced'=> TRUE, 'thclass'=>'center', 'class'=>'center'), - + 'user_id' => array('title' => LAN_ID, 'tab'=>0, 'type' =>'text', 'data'=>'int', 'width' => '3%','forced' => true,'thclass'=>'center', 'class'=>'center', 'readParms'=>'link=sef&target=blank'), // 'user_status' => array('title' => LAN_STATUS, 'type' => 'method', 'alias'=>'user_status', 'width' => 'auto','forced' => true, 'nosort'=>TRUE), 'user_ban' => array('title' => LAN_STATUS, 'tab'=>0, 'type' => 'method', 'width' => 'auto', 'filter'=>true, 'batch'=>true,'thclass'=>'center', 'class'=>'center'), - + 'user_name' => array('title' => LAN_USER_01, 'tab'=>0, 'type' => 'text', 'inline'=>true, 'data'=>'safestr', 'width' => 'auto','thclass' => 'left first'), // Display name 'user_loginname' => array('title' => LAN_USER_02, 'tab'=>0, 'type' => 'text', 'data'=>'safestr', 'width' => 'auto'), // User name 'user_login' => array('title' => LAN_USER_03, 'tab'=>0, 'type' => 'text', 'inline'=>true, 'data'=>'safestr', 'width' => 'auto'), // Real name (no real vetting) @@ -336,9 +336,9 @@ class users_admin_ui extends e_admin_ui 'user_pwchange' => array('title' => LAN_USER_24, 'tab'=>0, 'noedit'=>true, 'type'=>'datestamp' , 'width' => 'auto'), 'user_signature' => array('title' => LAN_USER_09, 'type' => 'textarea', 'data'=>'str', 'width' => 'auto', 'writeParms'=>array('size'=>'xxlarge')) ); - + protected $fieldpref = array('user_ban','user_name','user_loginname','user_login','user_email','user_class','user_admin'); - + protected $prefs = array( // 'anon_post' => array('title'=>PRFLAN_32, 'type'=>'boolean'), 'avatar_upload' => array('title' => USRLAN_44, 'type' => 'boolean', 'writeParms' => 'label=yesno', 'data' => 'int',), @@ -355,7 +355,7 @@ class users_admin_ui extends e_admin_ui 'signature_access' => array('title' => USRLAN_194, 'type' => 'userclass', 'writeParms' => 'classlist=member,admin,main,classes,nobody', 'data' => 'int',), 'user_new_period' => array('title' => USRLAN_190, 'type' => 'number', 'writeParms' => array('maxlength' => 3, 'post' => LANDT_04s), 'help' => USRLAN_191, 'data' => 'int',), ); - + public $extended = array(); public $extendedData = array(); @@ -365,7 +365,7 @@ function getExtended() { return $this->extendedData; } - + function ListObserver() { parent::ListObserver(); @@ -386,7 +386,7 @@ function ListObserver() function init() { - + $sql = e107::getDb(); $tp = e107::getParser(); @@ -399,7 +399,7 @@ function init() $this->resend_to_all($resetPasswords, $age, $class); } - + if($this->getAction() == 'edit') { $this->fields['user_class']['noedit'] = true; @@ -410,9 +410,9 @@ function init() - + // Extended fields - FIXME - better field types - + if($rows = $sql->retrieve('user_extended_struct', '*', "user_extended_struct_type > 0 AND user_extended_struct_text != '_system_' ORDER BY user_extended_struct_parent ASC",true)) { // TODO FIXME use the handler to build fields and field attributes @@ -431,13 +431,13 @@ function init() continue; } } - - + + $field = "user_".$row['user_extended_struct_name']; // $title = ucfirst(str_replace("user_","",$field)); $label = $tp->toHTML($row['user_extended_struct_text'],false,'defs'); $this->fields[$field] = array('__tableField'=>'ue.'.$field, 'title' => $label,'width' => 'auto', 'type'=>'method', 'readParms'=>array('ueType'=>$row['user_extended_struct_type']), 'method'=>'user_extended', 'data'=>$dataMode, 'tab'=>1, 'noedit'=>false); - + $this->extended[] = $field; $this->extendedData[$field] = $row; } @@ -454,7 +454,7 @@ function init() // $this->fields['user_signature']['writeParms']['data'] = e107::getUserClass()->uc_required_class_list("classes"); $this->fields['options'] = array('title'=> LAN_OPTIONS." ", 'type' => 'method', 'forced'=>TRUE, 'width' => '10%', 'thclass' => 'right last', 'class' => 'left'); - + if(!getperms('4|U0')) // Quick Add User Access Only. { unset($this->fields['checkboxes']); @@ -465,7 +465,7 @@ function init() } } - + if(!empty($_GET['readonly'])) { foreach($this->fields as $key=>$v) @@ -508,10 +508,10 @@ public function getAvatarList() $id = $f['fname']; $sys[$id] = $f['fname']; } - + $avs['uploaded'] = $upload; $avs['system'] = $sys; - + return $avs; } @@ -565,21 +565,21 @@ public function beforeUpdate($new_data, $old_data, $id) e107::getMessage()->addDebug("Password Hash: ".$new_data['user_password']); } - + if(!empty($new_data['perms'])) { $new_data['user_perms'] = implode(".",$new_data['perms']); } - + // Handle the Extended Fields. $this->saveExtended($new_data); - - - + + + return $new_data; } - + function saveExtended($new_data) { @@ -649,7 +649,7 @@ public function ListUnbanTrigger($userid) $sql = e107::getDb(); $tp = e107::getParser(); $sysuser = e107::getSystemUser($userid, false); - + if(!$sysuser->getId()) { e107::getMessage()->addError(USRLAN_223); @@ -661,18 +661,18 @@ public function ListUnbanTrigger($userid) $sysuser->set('user_ban', 2) ->set('user_sess', e_user_model::randomKey()) ->save(); - + $sql->delete("banlist"," banlist_ip='{$row['user_ip']}' "); $vars = array('x'=>$sysuser->getId(), 'y'=> $sysuser->getName(), 'z'=> $sysuser->getValue('email')); e107::getLog()->add('USET_06', $tp->lanVars( USRLAN_162, $vars), E_LOG_INFORMATIVE); e107::getMessage()->addSuccess("(".$sysuser->getId().".".$sysuser->getName()." - ".$sysuser->getValue('email').") ".USRLAN_9); - + // List data reload $this->getTreeModel()->loadBatch(true); } - + /** * Ban user trigger * @param int $userid @@ -685,7 +685,7 @@ public function ListBanTrigger($userid) $admin_log = e107::getLog(); $iph = e107::getIPHandler(); $tp = e107::getParser(); - + $sysuser = e107::getSystemUser($userid, false); if(!$sysuser->getId()) { @@ -693,7 +693,7 @@ public function ListBanTrigger($userid) return; } $row = $sysuser->getData(); - + if (($row['user_perms'] == "0") || ($row['user_perms'] == "0.")) { $mes->addWarning(USRLAN_7); @@ -706,7 +706,7 @@ public function ListBanTrigger($userid) e107::getLog()->add('USET_05',$tp->lanVars(USRLAN_161, $vars), E_LOG_INFORMATIVE); $mes->addSuccess("(".$userid.".".$row['user_name']." - {$row['user_email']}) ".USRLAN_8); } - if (trim($row['user_ip']) == "") + if (trim((string) $row['user_ip']) == "") { $mes->addInfo(USRLAN_135); } @@ -732,7 +732,7 @@ public function ListBanTrigger($userid) } } } - + // List data reload $this->getTreeModel()->loadBatch(true); } @@ -748,15 +748,15 @@ public function ListVerifyTrigger($userid) $userMethods = e107::getUserSession(); $mes = e107::getMessage(); $tp = e107::getParser(); - + $uid = intval($userid); if ($sysuser->getId()) { $sysuser->set('user_ban', '0') ->set('user_sess', ''); - + $row = $sysuser->getData(); - + if ($initUserclasses = $userMethods->userClassUpdate($row, 'userall')) { $row['user_class'] = $initUserclasses; @@ -779,16 +779,16 @@ public function ListVerifyTrigger($userid) e107::getLog()->add('USET_10', $tp->lanVars( USRLAN_166, $vars), E_LOG_INFORMATIVE); e107::getEvent()->trigger('userfull', $row); //BC e107::getEvent()->trigger('admin_user_activated', $row); - + $mes->addSuccess(USRLAN_86." (#".$sysuser->getId()." : ".$sysuser->getName().' - '.$sysuser->getValue('email').")"); - + $this->getTreeModel()->loadBatch(true); if ((int) e107::pref('core', 'user_reg_veri') == 2) { $message = USRLAN_114." ".$row['user_name'].",\n\n".USRLAN_122." ".SITENAME.".\n\n".USRLAN_123."\n\n"; $message .= str_replace("{SITEURL}", SITEURL, USRLAN_139); - + $options = array( 'mail_subject' => USRLAN_113.' '.SITENAME, 'mail_body' => nl2br($message), @@ -828,23 +828,23 @@ public function ListLoginasTrigger($userid) { $sysuser = e107::getSystemUser($userid); $user = e107::getUser(); - + // TODO - lan $mes->addSuccess('Successfully logged in as '.$sysuser->getName().' [logout]') ->addSuccess('Please, Leave Admin to browse the system as this user. Use "Logout" option in Administration to end front-end session'); - + $search = array('--UID--', '--NAME--', '--EMAIL--', '--ADMIN_UID--', '--ADMIN_NAME--', '--ADMIN_EMAIL--'); $replace = array($sysuser->getId(), $sysuser->getName(), $sysuser->getValue('email'), $user->getId(), $user->getName(), $user->getValue('email')); - + // TODO - lan $lan = 'Administrator --ADMIN_EMAIL-- (#--ADMIN_UID--, --ADMIN_NAME--) has logged in as the user --EMAIL-- (#--UID--, --NAME--)'; - + e107::getLog()->add('USET_100', str_replace($search, $replace, $lan), E_LOG_INFORMATIVE); - + $eventData = array('user_id' => $sysuser->getId(), 'admin_id' => $user->getId()); e107::getEvent()->trigger('loginas', $eventData); // BC e107::getEvent()->trigger('admin_user_loginas', $eventData); - + } } @@ -860,21 +860,21 @@ public function LogoutasObserver() { // TODO - lan e107::getMessage()->addSuccess('Successfully logged out from '.$sysuser->getName().' ('.$sysuser->getValue('email').') account', 'default', true); - + $search = array('--UID--', '--NAME--', '--EMAIL--', '--ADMIN_UID--', '--ADMIN_NAME--', '--ADMIN_EMAIL--'); $replace = array($sysuser->getId(), $sysuser->getName(), $sysuser->getValue('email'), $user->getId(), $user->getName(), $user->getValue('email')); - + // TODO - lan $lan = 'Administrator --ADMIN_EMAIL-- (#--ADMIN_UID--, --ADMIN_NAME--) has logged out as the user --EMAIL-- (#--UID--, --NAME--)'; - + e107::getLog()->add('USET_101', str_replace($search, $replace, $lan), E_LOG_INFORMATIVE); - + $eventData = array('user_id' => $sysuser->getId(), 'admin_id' => $user->getId()); e107::getEvent()->trigger('logoutas', $eventData); //BC e107::getEvent()->trigger('admin_user_logoutas', $eventData); $this->redirect('list', 'main', true); } - + if(!$sysuser->getId()) e107::getMessage()->addError(LAN_USER_NOT_FOUND); } @@ -949,7 +949,7 @@ public function pastepermsPage() } - + /** * Remove admin status trigger */ @@ -959,11 +959,11 @@ public function ListUnadminTrigger($userid) $sysuser = e107::getSystemUser($userid, false); $mes = e107::getMessage(); $tp = e107::getParser(); - + if(!$user->checkAdminPerms('3')) { $mes->addError(USRLAN_226, 'default', true); - + //$search = array('--UID--', '--NAME--', '--EMAIL--', '--ADMIN_UID--', '--ADMIN_NAME--', '--ADMIN_EMAIL--'); $vars = array( 'u' => $sysuser->getId(), @@ -973,7 +973,7 @@ public function ListUnadminTrigger($userid) 'y' => $user->getName(), 'z' => $user->getValue('email') ); - + e107::getLog()->add('USET_08', $tp->lanVars(USRLAN_244,$vars), E_LOG_INFORMATIVE); $this->redirect('list', 'main', true); } @@ -1009,7 +1009,7 @@ public function AdminObserver() { $this->redirect('list', 'main', true); } - + $userid = $this->getId(); $sql = e107::getDb(); $user = e107::getUser(); @@ -1017,7 +1017,7 @@ public function AdminObserver() $admin_log = e107::getLog(); $mes = e107::getMessage(); $tp = e107::getParser(); - + if(!$user->checkAdminPerms('3')) { $mes->addError(USRLAN_226, 'default', true); @@ -1033,25 +1033,25 @@ public function AdminObserver() ); // $replace = array($sysuser->getId(), $sysuser->getName(), $sysuser->getValue('email'), $user->getId(), $user->getName(), $user->getValue('email')); - + e107::getLog()->add('USET_08', $tp->lanVars( USRLAN_245,$vars), E_LOG_INFORMATIVE); - + $this->redirect('list', 'main', true); } - + if(!$sysuser->getId()) { $mes->addError(USRLAN_223, 'default', true); $this->redirect('list', 'main', true); } - - + + if($this->getPosted('update_admin')) { e107::getUserPerms()->updatePerms($userid, $_POST['perms']); $this->redirect('list', 'main', true); } - + if(!$sysuser->isAdmin()) // Security Check Only. Admin status check is added during 'updatePerms'. { // $sysuser->set('user_admin', 1)->save(); //"user","user_admin='1' WHERE user_id={$userid}" @@ -1065,9 +1065,9 @@ public function AdminObserver() $mes->addWarning($message); $mes->addWarning(e107::getParser()->toHTML(USRLAN_229,true)); } - + } - + /** * Admin manage page */ @@ -1079,16 +1079,16 @@ public function AdminPage() //$sysuser->load($request->getId(), true); $prm = e107::getUserPerms(); $frm = e107::getForm(); - + $response->appendBody($frm->open('adminperms')) ->appendBody($prm->renderPermTable('grouped', $sysuser->getValue('perms'))) ->appendBody($prm->renderCheckAllButtons()) ->appendBody($prm->renderSubmitButtons().$frm->token()) ->appendBody($frm->close()); - + $this->addTitle(str_replace(array('[x]', '[y]'), array($sysuser->getName(), $sysuser->getValue('email')), USRLAN_230)); } - + protected function checkAllowed($class_id) // check userclass change is permitted. { $e_userclass = e107::getUserClass(); @@ -1102,20 +1102,20 @@ protected function checkAllowed($class_id) // check userclass change is permitte } return true; } - + protected function manageUserclass($userid, $uclass, $mode = false) { $request = $this->getRequest(); $response = $this->getResponse(); $sysuser = e107::getSystemUser($userid, false); - + $admin_log = e107::getLog(); $e_userclass = e107::getUserClass(); $sql = e107::getDb(); $remuser = true; $mes = e107::getMessage(); - + if(!$sysuser->getId()) { $mes->addError(USRLAN_223); @@ -1125,7 +1125,7 @@ protected function manageUserclass($userid, $uclass, $mode = false) $curClass = array(); if($mode !== 'update') { - $curClass = $sysuser->getValue('class') ? explode(',', $sysuser->getValue('class')) : array(); + $curClass = $sysuser->getValue('class') ? explode(',', (string) $sysuser->getValue('class')) : array(); } foreach ($uclass as $a) @@ -1136,7 +1136,7 @@ protected function manageUserclass($userid, $uclass, $mode = false) $mes->addError(USRLAN_231); return false; } - + if($a != 0) // if 0 - then do not add. { $curClass[] = $a; @@ -1156,7 +1156,7 @@ protected function manageUserclass($userid, $uclass, $mode = false) $svar = is_array($curClass) ? implode(",", $curClass) : ""; $check = $sysuser->set('user_class', $svar)->save(); - + if($check) { $message = UCSLAN_9; @@ -1174,13 +1174,13 @@ protected function manageUserclass($userid, $uclass, $mode = false) } } if ($messaccess == '') $messaccess = UCSLAN_12."\n"; - + $message = USRLAN_256." ".$sysuser->getName().",\n\n".UCSLAN_4." ".SITENAME."\n( ".SITEURL." )\n\n".UCSLAN_5.": \n\n".$messaccess."\n".UCSLAN_10."\n".SITEADMIN; // $admin_log->addEvent(4,__FILE__."|".__FUNCTION__."@".__LINE__,"DBG","User class change",str_replace("\n","
",$message),FALSE,LOG_TO_ROLLING); - + $options['mail_subject'] = UCSLAN_2; $options['mail_body'] = nl2br($message); - + $sysuser->email('email', $options); //sendemail($send_to,$subject,$message); } @@ -1209,7 +1209,7 @@ public function UserclassUpdateclassTrigger() { $this->manageUserclass($this->getId(), $this->getPosted('userclass'), 'update'); } - + /** * Back to user list trigger (userclass page) */ @@ -1217,7 +1217,7 @@ public function UserclassBackTrigger() { $this->redirect('list', 'main', true); } - + /** * Manage userclasses page */ @@ -1229,14 +1229,14 @@ public function UserclassPage() $e_userclass = e107::getUserClass(); $userid = $this->getId(); $frm = e107::getForm(); - + $caption = UCSLAN_6." ".$sysuser->getName().' - '.$sysuser->getValue('email')." (".$sysuser->getClassList(true).")"; $this->addTitle($caption); - + $text = "
- + @@ -1265,7 +1265,7 @@ public function UserclassPage() $response->appendBody($text); } - + /** * Resend user activation email trigger */ @@ -1273,7 +1273,7 @@ public function ListResendTrigger($userid) { $this->resendActivation($userid); } - + /** * Resend user activation email helper * FIXME - better Subject/Content for the activation email when user is bounced/deactivated. @@ -1284,7 +1284,7 @@ protected function resendActivation($id, $lfile = '') $sysuser = e107::getSystemUser($id, false); $key = $sysuser->getValue('sess'); $mes = e107::getMessage(); - + if(!$sysuser->getId()) { $mes->addError(USRLAN_223); @@ -1297,7 +1297,7 @@ protected function resendActivation($id, $lfile = '') $mes->addDebug("key: ".$key." ban: ".$sysuser->getValue('ban')); return false; } - + // Check for a Language field, and if present, send the email in the user's language. // FIXME - make all system emails to be created from HTML email templates, this should fix the multi-lingual issue when sending multiple emails if ($lfile == "") @@ -1318,13 +1318,13 @@ protected function resendActivation($id, $lfile = '') require_once (e_LANGUAGEDIR.e_LANGUAGE."/lan_signup.php"); } if(!$lan) $lan = e_LANGUAGE; - + // FIXME switch to e107::getUrl()->create(), use email content templates //$return_address = (substr(SITEURL,- 1) == "/") ? SITEURL."signup.php?activate.".$sysuser->getId().".".$key : SITEURL."/signup.php?activate.".$sysuser->getId().".".$key; $return_address = SITEURL."signup.php?activate.".$sysuser->getId().".".$key; // $message = LAN_EMAIL_01." ".$sysuser->getName()."\n\n".LAN_SIGNUP_24." ".SITENAME.".\n".LAN_SIGNUP_21."\n\n"; // $message .= "".$return_address.""; - + $userInfo = array( 'user_id' => $sysuser->getId(), @@ -1347,13 +1347,13 @@ protected function resendActivation($id, $lfile = '') } $message = 'null'; - + $check = $sysuser->email('signup', array( 'mail_subject' => LAN_SIGNUP_98, 'mail_body' => nl2br($message), 'user_password' => $newPwd ), $userInfo); - + if ($check) { $vars = array('x'=> $sysuser->getId(), 'y'=>$sysuser->getName(), 'z'=> $sysuser->getValue('email')); @@ -1376,13 +1376,13 @@ public function TestObserver() $sysuser = e107::getSystemUser($this->getId(), false); $mes = e107::getMessage(); $email = $sysuser->getValue('email'); - + if(!$sysuser->getId()) { $mes->addError(USRLAN_223, 'default', true); $this->redirect('list', 'main', true); } - + $result = $this->testEmail($email); if($result) { @@ -1396,12 +1396,12 @@ public function TestObserver() } } - + public function TestCancelTrigger() { $this->redirect('list', 'main', true); } - + /** * Resend activation email page - only if tested email is valid */ @@ -1412,12 +1412,12 @@ public function TestPage() $userid = $this->getId(); $email = $sysuser->getValue('email'); $frm = e107::getForm(); - + $caption = str_replace('[x]', $email, USRLAN_119); $this->addTitle($caption); - + $text = "".LAN_BACK.""; - $text .= '
'.htmlspecialchars($this->getParam('testSucces')).'
'; + $text .= '
'.htmlspecialchars((string) $this->getParam('testSucces')).'
'; $text .= "
@@ -1439,58 +1439,58 @@ public function TestPage() */ protected function testEmail($email) { - list($adminuser,$adminhost) = explode('@',SITEADMINEMAIL, 2); - + list($adminuser,$adminhost) = explode('@',(string) SITEADMINEMAIL, 2); + $validator = new email_validation_class; $validator->localuser = $adminuser; $validator->localhost = $adminhost; $validator->timeout = 5; $validator->debug = 1; $validator->html_debug = 0; - + ob_start(); $email_status = $validator->ValidateEmailBox($email); $text = ob_get_contents(); ob_end_clean(); - + if ($email_status == 1) { return $text; } - + return false; } - + /** * Set user status to require verification - available for bounced users */ public function ListReqverifyTrigger($userid) { $sysuser = e107::getSystemUser($userid, false); - + if(!$sysuser->getId()) { e107::getMessage()->addError(USRLAN_223, 'default', true); return; } - + $sysuser->set('user_ban', 2) ->set('user_sess', e_user_model::randomKey()); - + if($sysuser->save()) { e107::getMessage()->addSuccess(USRLAN_235); - + // TODO - auto-send email or not - discuss $this->resendActivation($userid); - + //FIXME admin log - + // Reload tree $this->getTreeModel()->loadBatch(true); return; } - + e107::getMessage()->addError(USRLAN_236); } @@ -1513,21 +1513,21 @@ public function AddSubmitTrigger() $e_event = e107::getEvent(); $admin_log = e107::getLog(); $pref = e107::getPref(); - + if (!$_POST['ac'] == md5(ADMINPWCHANGE)) { exit; } - + $e107cache->clear('online_menu_member_total'); $e107cache->clear('online_menu_member_newest'); $error = false; - + if (isset ($_POST['generateloginname'])) { $_POST['loginname'] = $userMethods->generateUserLogin($pref['predefinedLoginName']); } - + $_POST['password2'] = $_POST['password1'] = $_POST['password']; // #1728 - Default value, because user will always be part of 'Members' @@ -1548,16 +1548,16 @@ public function AddSubmitTrigger() //$allData['errors']['user_name'] = ERR_FIELDS_DIFFERENT; } } - + // Do basic validation validatorClass::checkMandatory('user_name, user_loginname', $allData); - + // Check for missing fields (email done in userValidation() ) validatorClass::dbValidateArray($allData, $userMethods->userVettingInfo, 'user', 0); - + // Do basic DB-related checks $userMethods->userValidation($allData); - + // Do user-specific DB checks if (!isset($allData['errors']['user_password'])) { @@ -1569,23 +1569,23 @@ public function AddSubmitTrigger() // Restrict the scope of this unset($_POST['password2'], $_POST['password1']); - + if (count($allData['errors'])) { $temp = validatorClass::makeErrorList($allData, 'USER_ERR_','%n - %x - %t: %v', '
', $userMethods->userVettingInfo); $mes->addError($temp); $error = true; } - + // Always save some of the entered data - then we can redisplay on error $user_data = & $allData['data']; - + if($error) { $this->setParam('user_data', $user_data); return; } - + if(varset($_POST['perms'])) { $allData['data']['user_admin'] = 1; @@ -1598,7 +1598,7 @@ public function AddSubmitTrigger() $user_data['user_join'] = time(); e107::getMessage()->addDebug("Password Hash: ".$user_data['user_password']); - + if ($userMethods->needEmailPassword()) { // Save separate password encryption for use with email address @@ -1607,16 +1607,16 @@ public function AddSubmitTrigger() $user_data['user_prefs'] = e107::getArrayStorage()->serialize($user_prefs); unset($user_prefs); } - + $userMethods->userClassUpdate($allData['data'], 'userall'); - + //FIXME - (SecretR) there is a better way to fix this (missing default value, sql error in strict mode - user_realm is to be deleted from DB later) $allData['data']['user_realm'] = ''; - + // Set any initial classes $userMethods->addNonDefaulted($user_data); validatorClass::addFieldTypes($userMethods->userVettingInfo, $allData); - + $userid = $sql->insert('user', $allData); if ($userid) { @@ -1626,20 +1626,20 @@ public function AddSubmitTrigger() $sysuser->setData($allData['data']); $sysuser->setId($userid); $user_data['user_id'] = $userid; - + // Add to admin log e107::getLog()->add('USET_02',"UName: {$user_data['user_name']}; Email: {$user_data['user_email']}", E_LOG_INFORMATIVE); - + // Add to user audit trail e107::getLog()->user_audit(USER_AUDIT_ADD_ADMIN, $user_data, 0, $user_data['user_loginname']); e107::getEvent()->trigger('userfull', $user_data); e107::getEvent()->trigger('admin_user_created', $user_data); - + // send everything available for user data - bit sparse compared with user-generated signup if(isset($_POST['sendconfemail'])) { $check = false; - + // Send confirmation email to user switch ((int) $_POST['sendconfemail']) { @@ -1647,7 +1647,7 @@ public function AddSubmitTrigger() // activate, don't notify $check = -1; break; - + case 1: // activate and send password $check = $sysuser->email('quickadd', array( @@ -1656,13 +1656,13 @@ public function AddSubmitTrigger() 'activation_url' => USRLAN_246, )); break; - + case 2: // require activation and send password and activation link $sysuser->set('user_ban', 2) ->set('user_sess', e_user_model::randomKey()) ->save(); - + $check = $sysuser->email('quickadd', array( 'user_password' => $savePassword, 'mail_subject' => USRLAN_187, @@ -1680,20 +1680,20 @@ public function AddSubmitTrigger() $mes->addError(USRLAN_189); } } - + // $message = str_replace('--NAME--', htmlspecialchars($user_data['user_name'], ENT_QUOTES, CHARSET), USRLAN_174); $message = USRLAN_172; // "User account has been created with the following:" ie. keep it simple so it can easily be copied and pasted. - + // Always show Login name and password //if (isset($_POST['generateloginname'])) { $mes->addSuccess($message) - ->addSuccess(USRLAN_128.': '.htmlspecialchars($user_data['user_loginname'], ENT_QUOTES, CHARSET).''); + ->addSuccess(USRLAN_128.': '.htmlspecialchars((string) $user_data['user_loginname'], ENT_QUOTES, CHARSET).''); } - + //if (isset($_POST['generatepassword'])) { - $mes->addSuccess(LAN_PASSWORD.': '.htmlspecialchars($savePassword, ENT_QUOTES, CHARSET).''); + $mes->addSuccess(LAN_PASSWORD.': '.htmlspecialchars((string) $savePassword, ENT_QUOTES, CHARSET).''); } return; } @@ -1703,7 +1703,7 @@ public function AddSubmitTrigger() $mes->addError($sql->getLastErrorText()); } } - + /** * Quick add user page */ @@ -1715,9 +1715,9 @@ function AddPage() $e_userclass = e107::getUserClass(); $pref = e107::getPref(); $user_data = $this->getParam('user_data'); - + // $this->addTitle(LAN_USER_QUICKADD); - + $text = "
".$frm->open("core-user-adduser-form",null,null,'autocomplete=0')."
@@ -1753,7 +1753,7 @@ function AddPage()
"; - + $text .= " @@ -1763,7 +1763,7 @@ function AddPage() ".$frm->text('email', varset($user_data['user_email']), 100, array('size'=>'xlarge'))." - + - + @@ -138,7 +138,7 @@ function step1() $text .= "
".$frm->password('password', '', 128, array('size' => 'xlarge', 'class' => 'tbox e-password', 'generate' => 1, 'strength' => 1, 'autocomplete' => 'new-password'))."
".USRLAN_239." @@ -1821,8 +1821,8 @@ function AddPage() "; - - + + return $text; //$ns->tablerender(USRLAN_59,$mes->render().$text); } @@ -1846,16 +1846,16 @@ public function RanksUpdateTrigger() //Delete existing rank config e107::getDb()->delete('generic', "gen_type = 'user_rank_config'"); - + $tmp = array(); $tmp['data']['gen_type'] = 'user_rank_config'; $tmp['data']['gen_chardata'] = serialize($cfg); $tmp['_FIELD_TYPES']['gen_type'] = 'string'; $tmp['_FIELD_TYPES']['gen_chardata'] = 'escape'; - + //Add the new rank config e107::getDb()->insert('generic', $tmp); - + // save prefs $config->set('ranks_calc', $ranks_calc); $config->set('ranks_flist', $ranks_flist); @@ -1864,7 +1864,7 @@ public function RanksUpdateTrigger() //Delete existing rank data e107::getDb()->delete('generic',"gen_type = 'user_rank_data'"); - + //Add main site admin info $tmp = array(); $tmp['_FIELD_TYPES']['gen_datestamp'] = 'int'; @@ -1878,7 +1878,7 @@ public function RanksUpdateTrigger() $tmp['data']['gen_user_id'] = varset($_POST['calc_pfx']['main_admin'],0); $tmp['data']['gen_chardata'] = $_POST['calc_img']['main_admin']; e107::getDb()->insert('generic',$tmp); - + //Add site admin info unset ($tmp['data']); $tmp['data']['gen_type'] = 'user_rank_data'; @@ -1887,7 +1887,7 @@ public function RanksUpdateTrigger() $tmp['data']['gen_user_id'] = varset($_POST['calc_pfx']['admin'],0); $tmp['data']['gen_chardata'] = $_POST['calc_img']['admin']; e107::getDb()->insert('generic', $tmp); - + //Add all current site defined ranks if (isset ($_POST['field_id'])) { @@ -1902,7 +1902,7 @@ public function RanksUpdateTrigger() e107::getDb()->insert('generic', $tmp); } } - + //Add new rank, if posted if (varset($_POST['new_calc_lower'])) { @@ -1915,7 +1915,7 @@ public function RanksUpdateTrigger() $tmp['data']['gen_intdata'] = varset($_POST['new_calc_lower']); e107::getDb()->insert('generic', $tmp); } - + e107::getMessage()->addSuccess(LAN_UPDATED); //XXX maybe not needed see pull/1816 e107::getCache()->clear_sys('nomd5_user_ranks'); } @@ -1923,7 +1923,7 @@ public function RanksUpdateTrigger() function RanksDeleteTrigger($posted) { $rankId = (int) key($posted); - + e107::getCache()->clear_sys('nomd5_user_ranks'); if (e107::getDb()->delete('generic',"gen_id='{$rankId}'")) { @@ -1947,19 +1947,19 @@ function RanksPage() $ranks = e107::getRank()->getRankData(); $tmp = e107::getFile()->get_files(e_IMAGE.'ranks', '.*?\.(png|gif|jpg)'); - + // $this->addTitle(LAN_USER_RANKS); - + foreach($tmp as $k => $v) { $imageList[] = $v['fname']; } unset($tmp); natsort($imageList); - + $text = $frm->open('core-user-ranks-form'); - + $fields = array( 'type' => array('title' => USRLAN_207, 'type' => 'text', 'width' => 'auto', 'thclass' => 'left', 'class' => 'left'), 'rankName' => array('title' => USRLAN_208, 'type' => 'text', 'width' => 'auto', 'thclass' => 'left', 'class' => 'left'), @@ -1967,13 +1967,13 @@ function RanksPage() 'langPrefix' => array('title' => USRLAN_210, 'type' => 'text', 'width' => 'auto', 'thclass' => 'left', 'class' => 'left'), 'rankImage' => array('title' => USRLAN_211, 'type' => 'text', 'width' => 'auto', 'thclass' => 'left', 'class' => 'left'), ); - - + + $text .= " ". $frm->colGroup($fields, array_keys($fields)). $frm->thead($fields, array_keys($fields)); - + $info = $ranks['special'][1]; $val = $tp->toForm($info['name']); $text .= " @@ -2003,7 +2003,7 @@ function RanksPage() "; - + foreach ($ranks['data'] as $k => $r) { $pfx_checked = ($r['lan_pfx'] ? "checked='checked'" : ''); @@ -2022,9 +2022,9 @@ function RanksPage() "; } - + $text .= " - + @@ -2035,18 +2035,18 @@ function RanksPage() "; - + $text .= '
 
 
".$frm->checkbox('new_calc_pfx', 1, false)." ".$ui->RankImageDropdown($imageList, 'new_calc_img')."
'.$frm->admin_trigger('update', 'no-value', 'update', LAN_UPDATE).'
'; - + return $text; } - + // ================== OLD CODE backup =============> - + // It might be rewritten with user info option (ui trigger) // Old trigger code // if ((isset ($_POST['useraction']) && $_POST['useraction'] == "userinfo") || $_GET['userinfo']) @@ -2080,8 +2080,8 @@ function user_info($ipd) while (list($cb_id, $cb_nick, $cb_message, $cb_datestamp, $cb_blocked, $cb_ip ) = $sql->fetch()) { $datestamp = $obj->convert_date($cb_datestamp, "short"); - $post_author_id = substr($cb_nick, 0, strpos($cb_nick, ".")); - $post_author_name = substr($cb_nick, (strpos($cb_nick, ".")+1)); + $post_author_id = substr((string) $cb_nick, 0, strpos((string) $cb_nick, ".")); + $post_author_name = substr((string) $cb_nick, (strpos((string) $cb_nick, ".")+1)); $text .= $bullet." ".$post_author_name." (".USFLAN_6.": ".$post_author_id.")
@@ -2098,8 +2098,8 @@ function user_info($ipd) while (list($comment_id, $comment_item_id, $comment_author, $comment_author_email, $comment_datestamp, $comment_comment, $comment_blocked, $comment_ip) = $sql->fetch()) { $datestamp = $obj->convert_date($comment_datestamp, "short"); - $post_author_id = substr($comment_author, 0, strpos($comment_author, ".")); - $post_author_name = substr($comment_author, (strpos($comment_author, ".")+1)); + $post_author_id = substr((string) $comment_author, 0, strpos((string) $comment_author, ".")); + $post_author_name = substr((string) $comment_author, (strpos((string) $comment_author, ".")+1)); $text .= $bullet." ".$post_author_name." (".USFLAN_6.": ".$post_author_id.")
@@ -2320,7 +2320,7 @@ function check_bounces($bounce_act = 'first_check',$bounce_arr = '') // require_once ("footer.php"); // exit; // } - + global $sql,$pref; include (e_HANDLER.'pop3_class.php'); if (!trim($bounce_act)) @@ -2394,9 +2394,9 @@ function check_bounces($bounce_act = 'first_check',$bounce_arr = '') $DEL = ($pref['mail_bounce_delete']) ? true : false; $text = "
\n"; - + $identifier = deftrue('MAIL_IDENTIFIER', 'X-e107-id'); - + for ($i = 1; $i <= $tot; $i++) { $head = $obj->getHeaders($i); @@ -2666,7 +2666,7 @@ function user_ban($curval,$mode) "".LAN_BOUNCED."", "".USRLAN_56."", // Deleted ); - + if($mode == 'filter' || $mode == 'batch') { return $bo; @@ -2684,7 +2684,7 @@ function user_ban($curval,$mode) return $this->select('user_ban',$bo,$curval); } - + return vartrue($bo[$curval],' '); // ($curval == 1) ? ADMIN_TRUE_ICON : ''; } @@ -2771,13 +2771,13 @@ function user_status($curval,$mode) function options($val, $mode) // old drop-down options. { $controller = $this->getController(); - + if($controller->getMode() != 'main' || $controller->getAction() != 'list') return; $row = $controller->getListModel()->getData(); - - - + + + // extract($row); $user_id = intval($row['user_id']); @@ -2913,7 +2913,7 @@ function options($val, $mode) // old drop-down options. $opts['deldiv'] = 'divider'; $opts['deluser'] = LAN_DELETE; } - + // $foot = ""; // $foot = ""; @@ -2953,7 +2953,7 @@ function options($val, $mode) // old drop-down options. { return ''; } - + // return ($text) ? $head.$text.$foot . $btn : ""; } diff --git a/e107_admin/users_extended.php b/e107_admin/users_extended.php index 4bea8d0bd6..65884631a5 100755 --- a/e107_admin/users_extended.php +++ b/e107_admin/users_extended.php @@ -57,7 +57,7 @@ } $currVal = $current['user_extended_struct_values']; - $curVals = explode(",", varset($currVal)); + $curVals = explode(",", (string) varset($currVal)); // Ajax URL for "Table" dropdown. $ajaxGetTableSrc = e_SELF . '?mode=ajax&action=changeTable'; @@ -788,7 +788,7 @@ function show_predefined_field($var, $active) $txt .= " - + @@ -842,7 +842,7 @@ function options($parms, $value, $id, $attributes) $name = $this->getController()->getListModel()->get('user_extended_struct_name'); - if(strpos($name, 'plugin_') === 0) + if(strpos((string) $name, 'plugin_') === 0) { $attributes['readParms']['deleteClass'] = e_UC_NOBODY; } @@ -990,7 +990,7 @@ function renderStructValues($curVal) $text = "
\n"; $text .= "
\n"; - $curVals = explode(",",varset($current['user_extended_struct_values'])); + $curVals = explode(",",(string) varset($current['user_extended_struct_values'])); if(count($curVals) == 0) { $curVals[]=''; diff --git a/e107_admin/wmessage.php b/e107_admin/wmessage.php index fe580bcfad..c75ff9ef81 100644 --- a/e107_admin/wmessage.php +++ b/e107_admin/wmessage.php @@ -58,7 +58,7 @@ class wmessage_admin extends e_admin_dispatcher class generic_ui extends e_admin_ui { - + protected $pluginTitle = WMLAN_00; protected $pluginName = 'core'; protected $eventName = 'wmessage'; @@ -71,11 +71,11 @@ class generic_ui extends e_admin_ui // protected $sortField = 'somefield_order'; // protected $orderStep = 10; // protected $tabs = array('Tabl 1','Tab 2'); // Use 'tab'=>0 OR 'tab'=>1 in the $fields below to enable. - + protected $listQry = "SELECT * FROM `#generic` WHERE gen_type='wmessage' "; // Example Custom Query. LEFT JOINS allowed. Should be without any Order or Limit. - + protected $listOrder = 'gen_id DESC'; - + protected $fields = array ( 'checkboxes' => array ( 'title' => '', 'type' => null, 'data' => null, 'width' => '5%', 'thclass' => 'center', 'forced' => '1', 'class' => 'center', 'toggle' => 'e-multiselect', ), 'gen_id' => array ( 'title' => LAN_ID, 'data' => 'int', 'width' => '5%', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'left', 'thclass' => 'left', ), @@ -87,26 +87,26 @@ class generic_ui extends e_admin_ui 'gen_chardata' => array ( 'title' => LAN_MESSAGE, 'type' => 'bbarea', 'data' => 'str', 'width' => 'auto', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'center', 'thclass' => 'center', ), 'options' => array ( 'title' => LAN_OPTIONS, 'type' => null, 'data' => null, 'width' => '10%', 'thclass' => 'center last', 'class' => 'center last', 'forced' => '1', ), ); - + protected $fieldpref = array('gen_ip', 'gen_intdata'); - - + + protected $prefs = array( 'wm_enclose' => array('title'=> WMLAN_05, 'type'=>'radio', 'data' => 'int','help'=> WMLAN_06, 'writeParms'=>array('optArray'=>array(0=> LAN_DISABLED, 1=> LAN_ENABLED, 2=> WMLAN_11))), ); - + public function init() { - + } - + public function beforeCreate($new_data, $old_data) { return $new_data; } - + public function afterCreate($new_data, $old_data, $id) { // do something @@ -121,7 +121,7 @@ public function afterUpdate($new_data, $old_data, $id) { e107::getCache()->clear("wmessage"); } - + public function onCreateError($new_data, $old_data) { // do something @@ -131,8 +131,8 @@ public function onUpdateError($new_data, $old_data, $id) { // do something } - - + + /* // optional - override edit page. public function customPage() @@ -140,7 +140,7 @@ public function customPage() $ns = e107::getRender(); $text = 'Hello World!'; $ns->tablerender('Hello',$text); - + } */ diff --git a/e107_core/bbcodes/bb_block.php b/e107_core/bbcodes/bb_block.php index b33a1a00ea..e07213ce23 100644 --- a/e107_core/bbcodes/bb_block.php +++ b/e107_core/bbcodes/bb_block.php @@ -27,7 +27,7 @@ function toDB($code_text, $parm) if(!ADMIN) return $code_text; // TODO - pref // transform to class, equal sign at 0 position is not well formed parm string - if($parm && !strpos($parm, '=')) $parm = 'class='.$parm; + if($parm && !strpos((string) $parm, '=')) $parm = 'class='.$parm; $parms = eHelper::scParams($parm); $safe = array(); @@ -47,7 +47,7 @@ function toDB($code_text, $parm) function toHTML($code_text, $parm) { // transform to class, equal sign at 0 position is not well formed parm string - if($parm && !strpos($parm, '=')) $parm = 'class='.$parm; + if($parm && !strpos((string) $parm, '=')) $parm = 'class='.$parm; $parms = eHelper::scParams($parm); // add auto-generated class name and parameter class if available diff --git a/e107_core/bbcodes/bb_code.php b/e107_core/bbcodes/bb_code.php index 663bd267a8..a9f3950bc3 100644 --- a/e107_core/bbcodes/bb_code.php +++ b/e107_core/bbcodes/bb_code.php @@ -18,7 +18,7 @@ function toDB($code_text, $parm) $paramet = ($parm == 'inline') ? 'inline' : ''; // $code_text = htmlspecialchars($code_text, ENT_QUOTES, 'UTF-8'); // $code_text = str_replace('<','<r;',$code_text); - $code_text = htmlentities($code_text, ENT_QUOTES, 'utf-8'); + $code_text = htmlentities((string) $code_text, ENT_QUOTES, 'utf-8'); // $srch = array('{','}'); // $repl = array( '{', '}'); // avoid code getting parsed as templates or shortcodes. diff --git a/e107_core/bbcodes/bb_h.php b/e107_core/bbcodes/bb_h.php index f99d243cbb..75b97809b7 100644 --- a/e107_core/bbcodes/bb_h.php +++ b/e107_core/bbcodes/bb_h.php @@ -22,7 +22,7 @@ class bb_h extends e_bb_base */ function toDB($code_text, $parm) { - $code_text = trim($code_text); + $code_text = trim((string) $code_text); if(empty($code_text)) return ''; $bparms = eHelper::scDualParams($parm); @@ -57,7 +57,7 @@ function toDB($code_text, $parm) */ function toHTML($code_text, $parm) { - $code_text = trim($code_text); + $code_text = trim((string) $code_text); if(empty($code_text)) return ''; $bparms = eHelper::scDualParams($parm); diff --git a/e107_core/bbcodes/bb_img.php b/e107_core/bbcodes/bb_img.php index 2513a65190..65f61f8ea8 100644 --- a/e107_core/bbcodes/bb_img.php +++ b/e107_core/bbcodes/bb_img.php @@ -230,7 +230,7 @@ function toHTML($code_text, $parm) $code_text = str_replace($search, $replace, $code_text); $code_text = e107::getParser()->toAttribute($code_text); - $img_file = pathinfo($code_text); // 'External' file name. N.B. - might still contain a constant such as e_IMAGE + $img_file = pathinfo((string) $code_text); // 'External' file name. N.B. - might still contain a constant such as e_IMAGE $parmStr = $this->processParm($code_text, $parm, 'string'); diff --git a/e107_core/bbcodes/bb_nobr.php b/e107_core/bbcodes/bb_nobr.php index 379be32548..a7a9ce2c0f 100644 --- a/e107_core/bbcodes/bb_nobr.php +++ b/e107_core/bbcodes/bb_nobr.php @@ -30,6 +30,6 @@ function toDB($code_text, $parm) */ function toHTML($code_text, $parm) { - return str_replace(E_NL, "\n", trim($code_text)); + return str_replace(E_NL, "\n", trim((string) $code_text)); } } diff --git a/e107_core/bbcodes/bb_p.php b/e107_core/bbcodes/bb_p.php index 8b6d18e2bb..dcc89408d4 100644 --- a/e107_core/bbcodes/bb_p.php +++ b/e107_core/bbcodes/bb_p.php @@ -21,10 +21,10 @@ class bb_p extends e_bb_base */ function toDB($code_text, $parm) { - $code_text = trim($code_text); + $code_text = trim((string) $code_text); if(empty($code_text)) return ''; - if($parm && !strpos($parm, '=')) $parm = 'class='.$parm; + if($parm && !strpos((string) $parm, '=')) $parm = 'class='.$parm; $parms = eHelper::scParams($parm); $safe = array(); @@ -55,8 +55,8 @@ function toDB($code_text, $parm) */ function toHTML($code_text, $parm) { - if($parm && !strpos($parm, '=')) $parm = 'class='.$parm; - $code_text = trim($code_text); + if($parm && !strpos((string) $parm, '=')) $parm = 'class='.$parm; + $code_text = trim((string) $code_text); $parms = eHelper::scParams($parm); diff --git a/e107_core/bbcodes/bb_youtube.php b/e107_core/bbcodes/bb_youtube.php index 23d97ef225..8ab747b1bd 100644 --- a/e107_core/bbcodes/bb_youtube.php +++ b/e107_core/bbcodes/bb_youtube.php @@ -43,10 +43,10 @@ function toDB($code_text, $parm) { $bbpars = array(); $widthString = ''; - $parm = trim($parm); + $parm = trim((string) $parm); // Convert Simple URLs. - if(strpos($code_text,"youtube.com/watch?v=")!==FALSE || strpos($code_text,"youtube.com/watch#!v=")!==FALSE ) + if(strpos((string) $code_text,"youtube.com/watch?v=")!==FALSE || strpos((string) $code_text,"youtube.com/watch#!v=")!==FALSE ) { $validUrls = array("http://", "https://", "www.","youtube.com/watch?v=","youtube.com/watch#!v="); $tmp = str_replace($validUrls,'',$code_text); @@ -80,14 +80,14 @@ function toDB($code_text, $parm) $params = array(); // Accumulator for parameters from youtube code $ok = 0; - if (strpos($code_text, '<') === FALSE) + if (strpos((string) $code_text, '<') === FALSE) { // 'Properly defined' bbcode (we hope) $picRef = $code_text; } else { //libxml_use_internal_errors(TRUE); - if (FALSE === ($info = simplexml_load_string($code_text))) + if (FALSE === ($info = simplexml_load_string((string) $code_text))) { //print_a($matches); //$xmlErrs = libxml_get_errors(); @@ -113,13 +113,13 @@ function toDB($code_text, $parm) if ($ok != 0) { print_a($info); - return '[sanitised]'.$ok.'B'.htmlspecialchars($matches[0]).'B[/sanitised]'; + return '[sanitised]'.$ok.'B'.htmlspecialchars((string) $matches[0]).'B[/sanitised]'; } $target = (array)$info2['@attributes']; unset($info); $ws = varset($target['width'], 0); $hs = varset($target['height'], 0); - if (($ws == 0) || ($hs == 0) || !isset($target['src'])) return '[sanitised]A'.htmlspecialchars($matches[0]).'A[/sanitised]'; + if (($ws == 0) || ($hs == 0) || !isset($target['src'])) return '[sanitised]A'.htmlspecialchars((string) $matches[0]).'A[/sanitised]'; if (!$widthString) { $widthString = $ws.','.$hs; // Set size of window @@ -173,7 +173,7 @@ function toDB($code_text, $parm) } - $yID = preg_replace('/[^0-9a-z]/i', '', $picRef); + $yID = preg_replace('/[^0-9a-z]/i', '', (string) $picRef); //if (($yID != $picRef) || (strlen($yID) > 20)) // { // Possible hack attempt // } @@ -202,29 +202,29 @@ function toHTML($code_text, $parm) { if(empty($code_text)) return ''; - $t = explode('|', $parm, 2); + $t = explode('|', (string) $parm, 2); $dimensions = varset($t[0]); $tmp = varset($t[1]); if($tmp) { - parse_str(varset($tmp, ''), $bbparm); + parse_str((string) varset($tmp, ''), $bbparm); } - if(strpos($code_text,"&")!==FALSE && strpos($code_text,"?")===FALSE) // DEPRECATED + if(strpos((string) $code_text,"&")!==FALSE && strpos((string) $code_text,"?")===FALSE) // DEPRECATED { - $parms = explode('&', $code_text, 2); + $parms = explode('&', (string) $code_text, 2); } else { - $parms = explode('?', $code_text, 2); // CORRECT SEPARATOR + $parms = explode('?', (string) $code_text, 2); // CORRECT SEPARATOR } $code_text = $parms[0]; - parse_str(varset($parms[1], ''), $params); + parse_str((string) varset($parms[1], ''), $params); // print_a($params); @@ -317,7 +317,7 @@ function toHTML($code_text, $parm) if(isset($params['color2'])) $color[2] = $params['color2']; foreach ($color as $key => $value) { - if (ctype_xdigit($value) && strlen($value) == 6) + if (ctype_xdigit($value) && strlen((string) $value) == 6) { $url = $url.'&color'.$key.'='.$value; } diff --git a/e107_core/shortcodes/batch/admin_shortcodes.php b/e107_core/shortcodes/batch/admin_shortcodes.php index 0e93dacd35..7d10c442fa 100644 --- a/e107_core/shortcodes/batch/admin_shortcodes.php +++ b/e107_core/shortcodes/batch/admin_shortcodes.php @@ -36,7 +36,7 @@ function cronUpdateRender($parm,$cacheData) { //TODO LANVARS $text = ADLAN_122.' v'.$cacheData.'. '.ADLAN_121.''; //Install - + $mes->addInfo($text); return null; // $mes->render(); } @@ -411,7 +411,7 @@ public function sc_admin_lang($parm=null) { foreach($GLOBALS['mySQLtablelist'] as $tabs) { - $clang = strtolower($sql->mySQLlanguage); + $clang = strtolower((string) $sql->mySQLlanguage); if($clang !="" && strpos($tabs, 'lan_' .$clang)) { $aff[] = str_replace(MPREFIX. 'lan_' .$clang. '_', '',$tabs); @@ -775,7 +775,7 @@ public function sc_admin_menu($parm=null) $pref = e107::getPref(); - $curScript = basename($_SERVER['SCRIPT_FILENAME']); + $curScript = basename((string) $_SERVER['SCRIPT_FILENAME']); // Obsolete ob_start(); @@ -860,7 +860,7 @@ public function sc_admin_perm_emulation() // User Classes as bullets, sorted alphabetically, excluding PUBLIC (0), MAINADMIN (250), READONLY (251), GUEST (252), MEMBER (253), ADMIN (254), NOBODY (255) $text .= "

User Classes:
"; - $classIds = array_filter(explode(',', $emulatedUser['user_class'])); + $classIds = array_filter(explode(',', (string) $emulatedUser['user_class'])); $excludedClasses = ['0', '250', '251', '252', '253', '254', '255']; // PUBLIC, MAINADMIN, READONLY, GUEST, MEMBER, ADMIN, NOBODY $classIds = array_diff($classIds, $excludedClasses); if(!empty($classIds)) @@ -889,7 +889,7 @@ public function sc_admin_perm_emulation() $text .= "

Admin Permissions:
"; if(!empty($emulatedUser['user_perms']) && $emulatedUser['user_perms'] !== '.') { - $permKeys = array_filter(explode('.', $emulatedUser['user_perms'])); + $permKeys = array_filter(explode('.', (string) $emulatedUser['user_perms'])); $permdiz = e107::getUserPerms()->getPermList('all'); $permNames = []; foreach($permKeys as $p) @@ -1050,12 +1050,12 @@ public function sc_admin_pm($parm=null) { return; } - + $sql = e107::getDb(); $tp = e107::getParser(); - + $count = $sql->count('private_msg','(*)','WHERE pm_read = 0 AND pm_to='.USERID); - + if ($count >0) { $countDisp = ' '.$count.' ' ; @@ -1064,7 +1064,7 @@ public function sc_admin_pm($parm=null) { $countDisp = ''; } - + $inboxUrl = e_PLUGIN.'pm/admin_config.php?mode=inbox&action=list&iframe=1'; $outboxUrl = e_PLUGIN.'pm/admin_config.php?mode=outbox&action=list&iframe=1'; $composeUrl = e_PLUGIN.'pm/admin_config.php?mode=outbox&action=create&iframe=1'; @@ -1084,15 +1084,15 @@ public function sc_admin_pm($parm=null) '; - + return $text; - + // e107_plugins/pm/pm.php - - - + + + /* - + $text = '

'; diff --git a/e107_core/shortcodes/batch/bbcode_shortcodes.php b/e107_core/shortcodes/batch/bbcode_shortcodes.php index f4024b6d8d..1a1210e164 100644 --- a/e107_core/shortcodes/batch/bbcode_shortcodes.php +++ b/e107_core/shortcodes/batch/bbcode_shortcodes.php @@ -129,7 +129,7 @@ function bb_youtube($id) } else { - list($tag,$tmp) = explode("--",$this->var['tagid']); // works with $frm->bbarea to detect textarea from first half of tag. + list($tag,$tmp) = explode("--",(string) $this->var['tagid']); // works with $frm->bbarea to detect textarea from first half of tag. } if (ADMIN) @@ -178,7 +178,7 @@ function bb_glyph($id) } else { - list($tag,$tmp) = explode("--",$this->var['tagid']); // works with $frm->bbarea to detect textarea from first half of tag. + list($tag,$tmp) = explode("--",(string) $this->var['tagid']); // works with $frm->bbarea to detect textarea from first half of tag. } @@ -245,7 +245,7 @@ function bb_preimage($id) } else { - list($tag,$tmp) = explode("--",$this->var['tagid']); // works with $frm->bbarea to detect textarea from first half of tag. + list($tag,$tmp) = explode("--",(string) $this->var['tagid']); // works with $frm->bbarea to detect textarea from first half of tag. } /* @@ -275,7 +275,7 @@ function bb_prefile($id) } else { - list($tag,$tmp) = explode("--",$this->var['tagid']); // works with $frm->bbarea to detect textarea from first half of tag. + list($tag,$tmp) = explode("--",(string) $this->var['tagid']); // works with $frm->bbarea to detect textarea from first half of tag. } //$text = ""; $text = ""; @@ -397,7 +397,7 @@ function renderEmotes() $key = str_replace("!", ".", $key); // Usually '.' was replaced by '!' when saving $key = preg_replace("#_(\w{3})$#", ".\\1", $key); // '_' followed by exactly 3 chars is file extension $key = e_IMAGE_ABS."emotes/" . $pref['emotepack'] . "/" .$key; // Add in the file path - $value2 = substr($value, 0, strpos($value, " ")); + $value2 = substr((string) $value, 0, strpos((string) $value, " ")); $value = ($value2 ? $value2 : $value); $value = ($value == '&|') ? ':((' : $value; $text .= ""; diff --git a/e107_core/shortcodes/batch/comment_shortcodes.php b/e107_core/shortcodes/batch/comment_shortcodes.php index d2300a0232..5f247b0f5b 100644 --- a/e107_core/shortcodes/batch/comment_shortcodes.php +++ b/e107_core/shortcodes/batch/comment_shortcodes.php @@ -71,7 +71,7 @@ function sc_username($parm = null) else { $this->var['user_id'] = 0; - $USERNAME = preg_replace("/[0-9]+\./", '', vartrue($this->var['comment_author_name'])); + $USERNAME = preg_replace("/[0-9]+\./", '', (string) vartrue($this->var['comment_author_name'])); $USERNAME = str_replace("Anonymous", LAN_ANONYMOUS, $USERNAME); } return $USERNAME; @@ -183,7 +183,7 @@ function sc_avatar($parm = null) $this->var['user_image'] = ''; } return $this->var['user_image']; - + */ } @@ -236,12 +236,12 @@ function sc_comment_moderate($parm = null) return $text; /* $url = e_PAGE."?".e_QUERY; - + $unblock = "[".COMLAN_1."] "; $block = "[".COMLAN_2."] "; $delete = "[".LAN_DELETE."] "; $userinfo = "[".COMLAN_4."]"; - + return $unblock.$block.$delete.$userinfo; * */ } diff --git a/e107_core/shortcodes/batch/contact_shortcodes.php b/e107_core/shortcodes/batch/contact_shortcodes.php index e8583393df..9a26db77ed 100644 --- a/e107_core/shortcodes/batch/contact_shortcodes.php +++ b/e107_core/shortcodes/batch/contact_shortcodes.php @@ -219,7 +219,7 @@ function sc_contact_body($parm=null) $class = (!empty($parm['class'])) ? $parm['class'] : 'tbox '.$size.' form-control'; - $value = !empty($_POST['body']) ? stripslashes($_POST['body']) : ''; + $value = !empty($_POST['body']) ? stripslashes((string) $_POST['body']) : ''; return ""; } diff --git a/e107_core/shortcodes/batch/navigation_shortcodes.php b/e107_core/shortcodes/batch/navigation_shortcodes.php index 3451ac2f37..3f4786a978 100644 --- a/e107_core/shortcodes/batch/navigation_shortcodes.php +++ b/e107_core/shortcodes/batch/navigation_shortcodes.php @@ -88,9 +88,9 @@ function sc_nav_link_name($parm = null) return null; } - if(strpos($this->var['link_name'], 'submenu.') === 0) // BC Fix. + if(strpos((string) $this->var['link_name'], 'submenu.') === 0) // BC Fix. { - list($tmp, $tmp2, $link) = explode('.', $this->var['link_name'], 3); + list($tmp, $tmp2, $link) = explode('.', (string) $this->var['link_name'], 3); unset($tmp, $tmp2); } else @@ -134,11 +134,11 @@ function sc_nav_link_url($parm = null) return e107::url($this->var['link_owner'], $this->var['link_sefurl']); } - if(strpos($this->var['link_url'], e_HTTP) === 0) + if(strpos((string) $this->var['link_url'], e_HTTP) === 0) { - $url = "{e_BASE}" . substr($this->var['link_url'], strlen(e_HTTP)); + $url = "{e_BASE}" . substr((string) $this->var['link_url'], strlen(e_HTTP)); } - elseif($this->var['link_url'][0] !== "{" && strpos($this->var['link_url'], "://") === false) + elseif($this->var['link_url'][0] !== "{" && strpos((string) $this->var['link_url'], "://") === false) { $url = "{e_BASE}" . $this->var['link_url']; // Add e_BASE to links like: 'news.php' or 'contact.php' } @@ -181,9 +181,9 @@ function sc_nav_link_sub_oversized($parm='') function sc_nav_link_target($parm = null) { - if(strpos($this->var['link_url'], '#') !== false) + if(strpos((string) $this->var['link_url'], '#') !== false) { - list($tmp, $segment) = explode('#', $this->var['link_url'], 2); + list($tmp, $segment) = explode('#', (string) $this->var['link_url'], 2); return '#' . $segment; @@ -213,7 +213,7 @@ function sc_nav_link_open($parm = null) { case 1: $text = ' target="_blank"'; - $rel = (strpos($this->var['link_url'], 'http') !== false) ? 'noopener noreferrer' : ''; + $rel = (strpos((string) $this->var['link_url'], 'http') !== false) ? 'noopener noreferrer' : ''; break; case 4: diff --git a/e107_core/shortcodes/batch/news_shortcodes.php b/e107_core/shortcodes/batch/news_shortcodes.php index 52ec79adc0..a0d470af63 100644 --- a/e107_core/shortcodes/batch/news_shortcodes.php +++ b/e107_core/shortcodes/batch/news_shortcodes.php @@ -193,7 +193,7 @@ function sc_trackback($parm=null) if(!vartrue($pref['trackbackEnabled'])) { return ''; } $news_item = $this->news_item; $news_item['#'] = 'track'; - + return ($this->param['trackbackbeforestring'] ? $this->param['trackbackbeforestring'] : '')."news_item)."'>".$this->param['trackbackstring'].$this->news_item['tb_count'].''.($this->param['trackbackafterstring'] ? $this->param['trackbackafterstring'] : '');*/ } @@ -269,7 +269,7 @@ function sc_news_category_icon($parm=null) $parm = array('type'=>$parm); } // BC - $category_icon = !empty($this->news_item['category_icon']) ? str_replace('../', '', trim($this->news_item['category_icon'])) : ''; + $category_icon = !empty($this->news_item['category_icon']) ? str_replace('../', '', trim((string) $this->news_item['category_icon'])) : ''; if (!$category_icon) { return ''; } // We store SC path in DB now + BC @@ -566,7 +566,7 @@ private function news_carousel($parm) $tp = e107::getParser(); - $media = explode(",", $this->news_item['news_thumbnail']); + $media = explode(",", (string) $this->news_item['news_thumbnail']); $images = array(); foreach($media as $file) @@ -978,7 +978,7 @@ function sc_news_thumbnail($parm = '') //TODO Add support {NEWSTHUMBNAIL: x=y} f function sc_news_media($parm=array()) { - $media = explode(",", $this->news_item['news_thumbnail']); + $media = explode(",", (string) $this->news_item['news_thumbnail']); if(empty($parm['item'])) { @@ -1036,7 +1036,7 @@ function handleMultiple($parm,$type='image') $tp = e107::getParser(); - $media = explode(",", $this->news_item['news_thumbnail']); + $media = explode(",", (string) $this->news_item['news_thumbnail']); $list = array(); foreach($media as $file) @@ -1148,7 +1148,7 @@ function sc_newsitem_schook($parm=null) $parm = explode('|', $parm, 2); $parm[1] = 'news_id='.$this->news_item['news_id'].(varset($parm[1]) ? '&'.$parm[1] : ''); e107::setRegistry('core/news/schook_data', array('data' => $this->news_item, 'params' => $this->param)); - return e107::getParser()->parseTemplate('{'.strtoupper($parm[0]).'='.$parm[1].'}'); + return e107::getParser()->parseTemplate('{'.strtoupper((string) $parm[0]).'='.$parm[1].'}'); } public function sc_news_info($parm=null) @@ -1163,14 +1163,14 @@ public function sc_news_info($parm=null) $info .= $news_item['news_sticky'] ? '
'.LAN_NEWS_31 : ''; $info .= '
'.($news_item['news_allow_comments'] ? LAN_NEWS_13 : LAN_NEWS_12); $info .= LAN_NEWS_14.$news_item['news_start'].$news_item['news_end'].'
'; - $info .= LAN_NEWS_15.strlen($news_item['news_body']).LAN_NEWS_16.strlen($news_item['news_extended']).LAN_NEWS_17."

"; + $info .= LAN_NEWS_15.strlen((string) $news_item['news_body']).LAN_NEWS_16.strlen((string) $news_item['news_extended']).LAN_NEWS_17."

"; //return $ns->tablerender(LAN_NEWS_18, $info); return $info; } function sc_news_tags($parm=null) { - $tmp = explode(",",$this->news_item['news_meta_keywords']); + $tmp = explode(",",(string) $this->news_item['news_meta_keywords']); $words = array(); $class = (!empty($parm['class'])) ? $parm['class'] : 'news-tag'; $separator = (isset($parm['separator'])) ? $parm['separator'] : ', '; diff --git a/e107_core/shortcodes/batch/page_shortcodes.php b/e107_core/shortcodes/batch/page_shortcodes.php index f2d18ea777..881892b6de 100644 --- a/e107_core/shortcodes/batch/page_shortcodes.php +++ b/e107_core/shortcodes/batch/page_shortcodes.php @@ -76,14 +76,14 @@ function getBook($cid='') $pid = $this->var['page_chapter']; $cid = isset($this->chapterData[$pid]['chapter_parent']) ? $this->chapterData[$pid]['chapter_parent'] : 0; } - + $row = isset($this->chapterData[$cid]) ? $this->chapterData[$cid] : array(); - + if(!empty($row['chapter_id']) && $row['chapter_parent'] < 1) { return $row; } - + return false; // not a book. } @@ -150,7 +150,7 @@ function sc_cpageauthor($parm=null) } elseif(!empty($this->var['user_name'])) { - $author = preg_replace('/[^\w\pL\s]+/u', ' ', $this->var['user_name']); + $author = preg_replace('/[^\w\pL\s]+/u', ' ', (string) $this->var['user_name']); } } @@ -205,13 +205,13 @@ function cpagecomments() } } } - + //if($parm && isset($com[$parm])) return $com[$parm]; if($comflag) { return e107::getComment()->parseLayout($com['comment'],$com['comment_form'],$com['moderate']); } - + // return $com['comment'].$com['moderate'].$com['comment_form']; } @@ -274,7 +274,7 @@ function sc_cpagethumbnail($parm = '') if(empty($parms[1])) return ''; $tp = e107::getParser(); - $path = rawurldecode($parms[1]); + $path = rawurldecode((string) $parms[1]); if(substr($path, 0, 2) === 'e_') $path = str_replace($tp->getUrlConstants('raw'), $tp->getUrlConstants('sc'), $path); elseif($path[0] !== '{') $path = '{e_MEDIA}'.$path; @@ -347,7 +347,7 @@ function sc_cpagebutton($parm=null) return $url; } - if(trim($this->var['page_text']) == '' && empty($this->var['menu_button_url'])) // Hide the button when there is no page content. (avoids templates with and without buttons) + if(trim((string) $this->var['page_text']) == '' && empty($this->var['menu_button_url'])) // Hide the button when there is no page content. (avoids templates with and without buttons) { return ""; } diff --git a/e107_core/shortcodes/batch/signup_shortcodes.php b/e107_core/shortcodes/batch/signup_shortcodes.php index 612ca47f79..df93ed9d5c 100755 --- a/e107_core/shortcodes/batch/signup_shortcodes.php +++ b/e107_core/shortcodes/batch/signup_shortcodes.php @@ -131,7 +131,7 @@ private function generateXupLoginButtons($type, $size, $class) { if ($v['enabled'] == 1) { - $ic = strtolower($p); + $ic = strtolower((string) $p); switch ($ic) { diff --git a/e107_core/shortcodes/batch/user_shortcodes.php b/e107_core/shortcodes/batch/user_shortcodes.php index 2d3bbdbf24..c7f4bce56f 100644 --- a/e107_core/shortcodes/batch/user_shortcodes.php +++ b/e107_core/shortcodes/batch/user_shortcodes.php @@ -298,17 +298,17 @@ function sc_user_icon($parm='') { $boot = deftrue('BOOTSTRAP'); $tp = e107::getParser(); - + switch ($parm) { case 'email': return ($boot) ? $tp->toGlyph('fa-envelope') : $this->sc_user_email_icon(); break; - + case 'lastvisit': return ($boot) ? $tp->toGlyph('fa fa-clock-o') : ''; break; - + case 'birthday': return ($boot) ? $tp->toGlyph('fa-calendar') : $this->sc_user_birthday_icon(); break; @@ -316,11 +316,11 @@ function sc_user_icon($parm='') case 'level': return ($boot) ? $tp->toGlyph('fa-signal') : ''; break; - + case 'website': return ($boot) ? $tp->toGlyph('fa-home') : ''; break; - + case 'location': return ($boot) ? $tp->toGlyph('fa-map-marker') : ''; break; @@ -337,7 +337,7 @@ function sc_user_icon($parm='') break; } - + /* if(defined("USER_ICON")) { @@ -347,7 +347,7 @@ function sc_user_icon($parm='') { return " "; } - + return " "; */ } @@ -426,7 +426,7 @@ function sc_user_birthday_icon($parm='') function sc_user_birthday($parm='') { - if(!empty($this->var['user_birthday']) && $this->var['user_birthday'] != "0000-00-00" && preg_match("/([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})/", $this->var['user_birthday'], $regs)) + if(!empty($this->var['user_birthday']) && $this->var['user_birthday'] != "0000-00-00" && preg_match("/([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})/", (string) $this->var['user_birthday'], $regs)) { return "$regs[3].$regs[2].$regs[1]"; } @@ -588,10 +588,10 @@ function sc_user_jump_link($parm = null) if($parms[1] == 'prev') { - + $icon = (deftrue('BOOTSTRAP')) ? $tp->toGlyph('fa-chevron-left') : '<<'; return isset($userjump['prev']['id']) ? "".$icon." ".LAN_USER_40."\n" : " "; - + // return isset($userjump['prev']['id']) ? "<< ".LAN_USER_40." [ ".$userjump['prev']['name']." ]" : " "; } @@ -619,7 +619,7 @@ function sc_user_picture($parm=null) /* return $tp->parseTemplate("{USER_AVATAR=".$this->var['user_sess']."}",true); - + if ($this->var['user_sess'] && file_exists(e_MEDIA."avatars/".$this->var['user_sess'])) { //return $tp->parseTemplate("{USER_AVATAR=".$this->var['user_image']."}", true); // this one will resize. @@ -675,7 +675,7 @@ function sc_user_userclass_icon($parm = null) } // Get all userclasses that the user belongs to (comma separated) - $userclasses = explode(',', $this->var['user_class']); + $userclasses = explode(',', (string) $this->var['user_class']); //print_a($userclasses); // Loop through userclasses @@ -959,8 +959,8 @@ function sc_user_embed_userprofile($parm=null) if($parm){ //if the first char of parm is an ! mark, it means it should not render the following parms - if(strpos($parm,'!')===0){ - $tmp = explode(",", substr($parm,1) ); + if(strpos((string) $parm,'!')===0){ + $tmp = explode(",", substr((string) $parm,1) ); foreach($tmp as $not){ $not=trim($not); if(isset($key[$not])){ @@ -968,10 +968,10 @@ function sc_user_embed_userprofile($parm=null) unset($key[$not]); } } - + //else it means we render only the following parms }else{ - $tmp = explode(",", $parm ); + $tmp = explode(",", (string) $parm ); foreach($tmp as $yes){ $yes=trim($yes); if(isset($key[$yes])){ diff --git a/e107_core/shortcodes/batch/usersettings_shortcodes.php b/e107_core/shortcodes/batch/usersettings_shortcodes.php index 2ec765656f..366e1cd523 100755 --- a/e107_core/shortcodes/batch/usersettings_shortcodes.php +++ b/e107_core/shortcodes/batch/usersettings_shortcodes.php @@ -625,13 +625,13 @@ function sc_userextended_field($parm = null) $fname = str_replace("{FIELDNAME}", $fname, $REQUIRED_FIELD); } - $parms = explode("^,^", $fInfo['user_extended_struct_parms']); + $parms = explode("^,^", (string) $fInfo['user_extended_struct_parms']); $fhide = ""; if(varset($parms[3])) { - $chk = (strpos($this->var['user_hidden_fields'], "^user_" . $parm . "^") === false) ? false : true; + $chk = (strpos((string) $this->var['user_hidden_fields'], "^user_" . $parm . "^") === false) ? false : true; if(isset($_POST['updatesettings'])) { diff --git a/e107_core/shortcodes/single/custom.php b/e107_core/shortcodes/single/custom.php index 5d1f699e12..a9afab48ee 100644 --- a/e107_core/shortcodes/single/custom.php +++ b/e107_core/shortcodes/single/custom.php @@ -5,7 +5,7 @@ function custom_shortcode($parm) $tp = e107::getParser(); $e107 = e107::getInstance(); - $custom_query = !empty($parm) ? explode('+', $parm) : array(); + $custom_query = !empty($parm) ? explode('+', (string) $parm) : array(); if(empty($custom_query[0])) { diff --git a/e107_core/shortcodes/single/iconpicker.php b/e107_core/shortcodes/single/iconpicker.php index e7112dbfd4..6ac97e6c86 100644 --- a/e107_core/shortcodes/single/iconpicker.php +++ b/e107_core/shortcodes/single/iconpicker.php @@ -16,7 +16,7 @@ function iconpicker_shortcode($parm) $parms = array(); - parse_str($parm, $parms); + parse_str((string) $parm, $parms); $name = varset($parms['id']); @@ -39,7 +39,7 @@ function iconpicker_shortcode($parm) { while($row = $sql->fetch()) { - list($tmp,$tmp2,$size) = explode("_",$row['media_category']); + list($tmp,$tmp2,$size) = explode("_",(string) $row['media_category']); if($str !='' && ($size != $lastsize)) diff --git a/e107_core/shortcodes/single/imagepreview.php b/e107_core/shortcodes/single/imagepreview.php index e96d31a66a..f8323165db 100644 --- a/e107_core/shortcodes/single/imagepreview.php +++ b/e107_core/shortcodes/single/imagepreview.php @@ -8,9 +8,9 @@ function imagepreview_shortcode($parm) return null; } - list($name, $width, $height, $nothumb) = explode("|",$parm, 4); + list($name, $width, $height, $nothumb) = explode("|",(string) $parm, 4); - $name = rawurldecode(varset($name));//avoid warnings + $name = rawurldecode((string) varset($name));//avoid warnings if(varset($width)) { $width = intval($width); diff --git a/e107_core/shortcodes/single/imageselector.php b/e107_core/shortcodes/single/imageselector.php index 1b16d9cbfb..198559568e 100644 --- a/e107_core/shortcodes/single/imageselector.php +++ b/e107_core/shortcodes/single/imageselector.php @@ -13,14 +13,14 @@ function imageselector_shortcode($parm = '', $mod = '') return null; } - if (strpos($parm, "=") !== false) + if (strpos((string) $parm, "=") !== false) { // query style parms. - parse_str($parm, $parms); + parse_str((string) $parm, $parms); extract($parms); } else { // comma separated parms. - list($name, $path, $default, $width, $height, $multiple, $label, $subdirs, $filter, $fullpath, $click_target, $click_prefix, $click_postfix, $tabindex, $class) = explode(",", $parm); + list($name, $path, $default, $width, $height, $multiple, $label, $subdirs, $filter, $fullpath, $click_target, $click_prefix, $click_postfix, $tabindex, $class) = explode(",", (string) $parm); } @@ -136,7 +136,7 @@ function imageselector_shortcode($parm = '', $mod = '') $text .= "\n"; } $text .= ""; - $text .= "refresh"; + $text .= "refresh"; if(!e_AJAX_REQUEST) $text .= '
'; if ($scaction == 'select') return $text; diff --git a/e107_core/shortcodes/single/lan.php b/e107_core/shortcodes/single/lan.php index be125fcc9d..8a24bb545f 100644 --- a/e107_core/shortcodes/single/lan.php +++ b/e107_core/shortcodes/single/lan.php @@ -8,7 +8,7 @@ function lan_shortcode($parm = '') return null; } - $lan = trim($parm); + $lan = trim((string) $parm); if(defined('LAN_'.$lan)) { diff --git a/e107_core/shortcodes/single/menu.php b/e107_core/shortcodes/single/menu.php index 01c938b7b4..1707bbabb1 100644 --- a/e107_core/shortcodes/single/menu.php +++ b/e107_core/shortcodes/single/menu.php @@ -14,7 +14,7 @@ function menu_shortcode($parm, $mode='') if(is_array($parm)) //v2.x format allowing for parms. {MENU: path=y&count=x} { - list($plugin,$menu) = explode("/",$parm['path'],2); + list($plugin,$menu) = explode("/",(string) $parm['path'],2); if($menu == '') { $menu = $plugin; @@ -35,7 +35,7 @@ function menu_shortcode($parm, $mode='') } else // eg. {MENU=contact} for e107_plugins/contact/contact_menu.php OR {MENU=contact/other} for e107_plugins/contact/other_menu.php { - list($plugin,$menu) = explode("/",$path,2); + list($plugin,$menu) = explode("/",(string) $path,2); if($menu == '') { diff --git a/e107_core/shortcodes/single/nextprev.php b/e107_core/shortcodes/single/nextprev.php index b55b3a9abb..fc6d20bc1b 100644 --- a/e107_core/shortcodes/single/nextprev.php +++ b/e107_core/shortcodes/single/nextprev.php @@ -68,7 +68,7 @@ function nextprev_shortcode($parm = null) * New parameter requirements formatted as a GET string. * Template support. */ - if(is_array($parm) || strpos($parm, 'total=') !== false) + if(is_array($parm) || strpos((string) $parm, 'total=') !== false) { if(is_string($parm)) { @@ -186,7 +186,7 @@ function nextprev_shortcode($parm = null) if($total_pages <= 1) { return ''; } // urldecoded once by parse_str() - if(substr($parm['url'], 0, 7) == 'route::') + if(substr((string) $parm['url'], 0, 7) == 'route::') { // New - use URL assembling engine // Format is: route::module/controller/action::urlParams::urlOptions @@ -195,7 +195,7 @@ function nextprev_shortcode($parm = null) $urlParms = explode('::', str_replace('--AMP--', '&', $parm['url'])); $url = str_replace('--FROM--', '[FROM]', $e107->url->create($urlParms[1], $urlParms[2], varset($urlParms[3]))); } - elseif(substr($parm['url'], 0, 5) == 'url::') + elseif(substr((string) $parm['url'], 0, 5) == 'url::') { // New - use URL assembling engine // Format is: url::module/controller/action?id=xxx--AMP--name=yyy--AMP--page=--FROM--::full=1 @@ -223,7 +223,7 @@ function nextprev_shortcode($parm = null) // sprintXX(defset($e_vars->caption, $e_vars->caption), $current_page, $total_pages); // urldecoded by parse_str() - $pagetitle = explode('|', vartrue($parm['pagetitle'])); + $pagetitle = explode('|', (string) vartrue($parm['pagetitle'])); // new - bullet support $bullet = vartrue($parm['bullet'], ''); @@ -342,7 +342,7 @@ function nextprev_shortcode($parm = null) $e_vars_loop = new e_vars(); - $e_vars_loop->bullet = stripslashes($bullet); // fix magicquotes + $e_vars_loop->bullet = stripslashes((string) $bullet); // fix magicquotes $ret_items = array(); for($c = $loop_start; $c < $loop_end; $c++) { @@ -352,7 +352,7 @@ function nextprev_shortcode($parm = null) $label = defset($pagetitle[$c], $pagetitle[$c]); } $e_vars_loop->url = str_replace('[FROM]', ($perpage * ($c + $index_add)), $url); - $e_vars_loop->label = $label ? $tp->toHTML(stripslashes($label), false, 'TITLE') : $c + 1; //quick fix servers with magicquotes - stripslashes() + $e_vars_loop->label = $label ? $tp->toHTML(stripslashes((string) $label), false, 'TITLE') : $c + 1; //quick fix servers with magicquotes - stripslashes() if($c + 1 == $current_page) { @@ -417,14 +417,14 @@ function nextprev_shortcode($parm = null) */ else { - $parm_count = substr_count($parm, ','); + $parm_count = substr_count((string) $parm, ','); while($parm_count < 5) { $parm .= ','; $parm_count++; } - $p = explode(',', $parm, 6); + $p = explode(',', (string) $parm, 6); $total_items = intval($p[0]); $perpage = intval($p[1]); diff --git a/e107_core/shortcodes/single/sitelinks_alt.php b/e107_core/shortcodes/single/sitelinks_alt.php index e848bb67ec..bc4d756219 100644 --- a/e107_core/shortcodes/single/sitelinks_alt.php +++ b/e107_core/shortcodes/single/sitelinks_alt.php @@ -21,7 +21,7 @@ static function sitelinks_alt_shortcode($parm) return null; } - $params = explode('+', $parm); + $params = explode('+', (string) $parm); if (vartrue($params[0]) && ($params[0] != 'no_icons') && ($params[0] != 'default')) { @@ -60,7 +60,7 @@ static function sitelinks_alt_shortcode($parm) foreach ($linklist['head_menu'] as $lk) { - if(substr($lk['link_url'],0,3) != '{e_' && strpos($lk['link_url'], '://') === false) + if(substr((string) $lk['link_url'],0,3) != '{e_' && strpos((string) $lk['link_url'], '://') === false) { $lk['link_url'] = '{e_BASE}'.$lk['link_url']; } @@ -197,9 +197,9 @@ static function render_sub($linklist, $id, $params, $icon) { // Filter title for backwards compatibility ----> - if (substr($sub['link_name'], 0, 8) == "submenu.") + if (substr((string) $sub['link_name'], 0, 8) == "submenu.") { - $tmp = explode(".", $sub['link_name']); + $tmp = explode(".", (string) $sub['link_name']); $subname = $tmp[2]; } else diff --git a/e107_core/shortcodes/single/sublinks.php b/e107_core/shortcodes/single/sublinks.php index 788abf8b62..e8fdf8aa8a 100644 --- a/e107_core/shortcodes/single/sublinks.php +++ b/e107_core/shortcodes/single/sublinks.php @@ -10,7 +10,7 @@ function sublinks_shortcode($parm) if($parm) { - list($page, $cat) = explode(":", $parm); + list($page, $cat) = explode(":", (string) $parm); } $page = isset($page) ? $page : defset('e_PAGE'); diff --git a/e107_core/shortcodes/single/uploadfile.php b/e107_core/shortcodes/single/uploadfile.php index 9d01c22263..360b194a42 100644 --- a/e107_core/shortcodes/single/uploadfile.php +++ b/e107_core/shortcodes/single/uploadfile.php @@ -94,7 +94,7 @@ function uploadfile_shortcode($parm) } $parms = array(); - parse_str(varset($parm[1], ''), $parms); + parse_str((string) varset($parm[1], ''), $parms); $parms = array_merge(array( 'trigger' => 'uploadfiles', diff --git a/e107_core/shortcodes/single/user_avatar.php b/e107_core/shortcodes/single/user_avatar.php index 2165429ef0..20a94af2f1 100644 --- a/e107_core/shortcodes/single/user_avatar.php +++ b/e107_core/shortcodes/single/user_avatar.php @@ -38,12 +38,12 @@ function user_avatar_shortcode($parm=null) $tp = e107::getParser(); $width = $tp->thumbWidth; $height = ($tp->thumbHeight !== 0) ? $tp->thumbHeight : ""; - + if(intval($loop_uid) > 0 && trim($parm) == "") { $parm = $loop_uid; } - + if(is_numeric($parm)) { if($parm == USERID) @@ -68,24 +68,24 @@ function user_avatar_shortcode($parm=null) { $image = ""; } - + $genericImg = $tp->thumbUrl(e_IMAGE."generic/blank_avatar.jpg","w=".$width."&h=".$height,true); - + if (vartrue($image)) { - + if(strpos($image,"://")!==false) // Remove Image { $img = $image; - + //$height = e107::getPref("im_height",100); // these prefs are too limiting for local images. //$width = e107::getPref("im_width",100); } elseif(substr($image,0,8) == "-upload-") { - + $image = substr($image,8); // strip the -upload- from the beginning. if(file_exists(e_AVATAR_UPLOAD.$image)) // Local Default Image { @@ -93,7 +93,7 @@ function user_avatar_shortcode($parm=null) } else { - + $img = $genericImg; } } @@ -103,7 +103,7 @@ function user_avatar_shortcode($parm=null) } else // Image Missing. { - + $img = $genericImg; } } @@ -111,9 +111,9 @@ function user_avatar_shortcode($parm=null) { $img = $genericImg; } - + $title = (ADMIN) ? $image : ""; - + $text = ""; // return $img; return $text; diff --git a/e107_core/shortcodes/single/user_extended.php b/e107_core/shortcodes/single/user_extended.php index bab84234e7..161caa64fb 100644 --- a/e107_core/shortcodes/single/user_extended.php +++ b/e107_core/shortcodes/single/user_extended.php @@ -26,7 +26,7 @@ function user_extended_shortcode($parm) return null; } - $tmp = explode('.', $parm); + $tmp = explode('.', (string) $parm); $fieldname = trim($tmp[0]); $type = trim($tmp[1]); @@ -98,7 +98,7 @@ function user_extended_shortcode($parm) $ret_cause = 3; } - if((!ADMIN && substr($fkeyStruct, -1) == 1 && strpos($udata['user_hidden_fields'], '^user_' . $fieldname . '^') !== false && $uid != USERID)) + if((!ADMIN && substr($fkeyStruct, -1) == 1 && strpos((string) $udata['user_hidden_fields'], '^user_' . $fieldname . '^') !== false && $uid != USERID)) { $ret_cause = 4; } diff --git a/e107_core/templates/email_template.php b/e107_core/templates/email_template.php index 58f1543e2d..88e55908a2 100644 --- a/e107_core/templates/email_template.php +++ b/e107_core/templates/email_template.php @@ -170,7 +170,7 @@ .btn-sm { padding: 5px 10px; font-size: 12px; line-height: 1.5; border-radius: 3px; } - +
"; @@ -221,14 +221,14 @@ ".LAN_EMAIL_06."

- +
#e107-idemailSubjectBounce
{$var['user_extended_struct_name']}".constant(strtoupper($var['user_extended_struct_text'])."_DESC")."".constant(strtoupper((string) $var['user_extended_struct_text'])."_DESC")." ".$ue->user_extended_edit($var,'')." ".$tp->toHTML($var['type'], false, 'defs')." ".($active ? ADMIN_TRUE_ICON : " ")."
{SITEBUTTON: type=email&h=60}

{SITENAME=link}

{SITEURL}
- + "; $EMAIL_TEMPLATE['signup']['footer'] = "
@@ -241,7 +241,7 @@ // ----------------------------- - + /* * QUICK ADD USER EMAIL TEMPLATE - BODY. * This is the email that is sent when an admin creates a user account in admin. "Quick Add User" @@ -359,7 +359,7 @@ $EMAIL_TEMPLATE['example']['header'] = $EMAIL_TEMPLATE['default']['header']; // will use default header above. $EMAIL_TEMPLATE['example']['body'] = $EMAIL_TEMPLATE['default']['body']; // will use default header above. $EMAIL_TEMPLATE['example']['footer'] = "

- + {SITENAME}
diff --git a/e107_core/templates/footer_default.php b/e107_core/templates/footer_default.php index cb31bd1e85..8db92a09ca 100644 --- a/e107_core/templates/footer_default.php +++ b/e107_core/templates/footer_default.php @@ -63,7 +63,7 @@ // // B.1 Clear cache (admin-only) // - + // // B.2 Send footer template, stop timing, send simple page stats // @@ -84,7 +84,7 @@ e107::renderLayout($FOOTER, array('magicSC'=>$psc)); } - + $eTimingStop = microtime(); global $eTimingStart; $clockTime = e107::getSingleton('e107_traffic')->TimeDelta($eTimingStart, $eTimingStop); @@ -101,7 +101,7 @@ { // Collect the first batch of data to log $logLine .= "'".($now = time())."','".gmstrftime('%y-%m-%d %H:%M:%S', $now)."','".e107::getIPHandler()->getIP(FALSE)."','".e_PAGE.'?'.e_QUERY."','".$rendertime."','".$db_time."','".$queryCount."','".$memuse."','".$_SERVER['HTTP_USER_AGENT']."','{$_SERVER["REQUEST_METHOD"]}'"; } - + if (function_exists('getrusage') && !empty($eTimingStartCPU)) { $ru = getrusage(); @@ -127,7 +127,7 @@ // // $logname = "/home/mysite/public_html/queryspeed.log"; // $logfp = fopen($logname, 'a+'); fwrite($logfp, "$cpuTot,$cpuPct,$cpuStart,$rendertime,$db_time\n"); fclose($logfp); - + if ($pref['displayrendertime']) { $rinfo .= CORE_LAN11; @@ -157,18 +157,18 @@ $logname = e_LOG."logd_".date("Y-m-d", time()).".csv"; $logHeader = "Unix time,Date/Time,IP,URL,RenderTime,DbTime,Qrys,Memory-Usage,User-Agent,Request-Method"; - + $logfp = fopen($logname, 'a+'); - + if(filesize($logname) == 0 || !is_file($logname)) { fwrite($logfp, $logHeader."\n"); } - + fwrite($logfp, $logLine."\n"); fclose($logfp); } - + if (function_exists('theme_renderinfo')) { theme_renderinfo($rinfo); @@ -177,7 +177,7 @@ { echo($rinfo ? "\n\n" : ""); } - + } // End of regular-page footer (the above NOT done for popups) // @@ -322,7 +322,7 @@ foreach($pref['e_footer_list'] as $val) { $fname = e_PLUGIN.$val."/e_footer.php"; // Do not place inside a function - BC $pref required. . - + if(is_readable($fname)) { $ret = (deftrue('e_DEBUG') || isset($_E107['debug'])) ? include_once($fname) : @include_once($fname); @@ -341,7 +341,7 @@ { echo "\n\n"; } -$CSSORDER = defined('CSSORDER') && deftrue('CSSORDER') ? explode(",",CSSORDER) : array('library','other','core','plugin','theme'); // INLINE CSS in Body not supported by HTML5. . +$CSSORDER = defined('CSSORDER') && deftrue('CSSORDER') ? explode(",",(string) CSSORDER) : array('library','other','core','plugin','theme'); // INLINE CSS in Body not supported by HTML5. . foreach($CSSORDER as $val) { @@ -389,7 +389,7 @@ echo "|tyle[^>]+>.*?))#mis', $full_text, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE); + $subcon = preg_split('#((?:]+>.*?|tyle[^>]+>.*?))#mis', (string) $full_text, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE); foreach ($subcon as $sub_blk) { @@ -1859,7 +1859,7 @@ private function preformatted($str) foreach ($this->preformatted as $type) { $code = '[' . $type . ']'; - if (strpos($str, $code) === 0) + if (strpos((string) $str, $code) === 0) { return true; } @@ -2024,11 +2024,11 @@ public function toAttributes($attributes, $pure = false) foreach ($attributes as $key => $value) { - if ($value === true && (strpos($key, 'data-') !== 0)) + if ($value === true && (strpos((string) $key, 'data-') !== 0)) { $value = $key; } - if (!empty($value) || is_numeric($value) || $key === "value" || strpos($key, 'data-') === 0) + if (!empty($value) || is_numeric($value) || $key === "value" || strpos((string) $key, 'data-') === 0) { $stringifiedAttributes[] = $key . "='" . $this->toAttribute($value, $pure) . "'"; } @@ -2082,11 +2082,11 @@ public static function fromFlatArray($array, $unprepend = '') $output = []; foreach ($array as $key => $value) { - if (!empty($unprepend) && substr($key, 0, strlen($unprepend)) == $unprepend) + if (!empty($unprepend) && substr((string) $key, 0, strlen($unprepend)) == $unprepend) { - $key = substr($key, strlen($unprepend)); + $key = substr((string) $key, strlen($unprepend)); } - $parts = explode('/', $key); + $parts = explode('/', (string) $key); $nested = &$output; while (count($parts) > 1) { @@ -2460,7 +2460,7 @@ public function thumbCacheFile($path, $options = null, $log = null) 'h' => isset($options['h']) ? (string) intval($options['h']) : '', 'aw' => isset($options['aw']) ? (string) intval($options['aw']) : '', 'ah' => isset($options['ah']) ? (string) intval($options['ah']) : '', - 'c' => strtoupper(vartrue($options['c'], '0')), + 'c' => strtoupper((string) vartrue($options['c'], '0')), ); if (!empty($options['type'])) @@ -2823,16 +2823,16 @@ public function thumbUrl($url = null, $options = array(), $raw = false, $full = public function thumbUrlDecode($src) { - list($url, $qry) = array_pad(explode('?', $src), 2, null); + list($url, $qry) = array_pad(explode('?', (string) $src), 2, null); $ret = array(); - if (!empty($qry) && strpos($url, 'thumb.php') !== false) // Regular + if (!empty($qry) && strpos((string) $url, 'thumb.php') !== false) // Regular { parse_str($qry, $val); $ret = $val; } - elseif (preg_match('/media\/img\/(a)?([\d]*)x(a)?([\d]*)\/(.*)/', $url, $match)) // SEF + elseif (preg_match('/media\/img\/(a)?([\d]*)x(a)?([\d]*)\/(.*)/', (string) $url, $match)) // SEF { $wKey = $match[1] . 'w'; $hKey = $match[3] . 'h'; @@ -2843,7 +2843,7 @@ public function thumbUrlDecode($src) $hKey => $match[4] ); } - elseif (preg_match('/theme\/img\/(a)?([\d]*)x(a)?([\d]*)\/(.*)/', $url, $match)) // Theme-image SEF Urls + elseif (preg_match('/theme\/img\/(a)?([\d]*)x(a)?([\d]*)\/(.*)/', (string) $url, $match)) // Theme-image SEF Urls { $wKey = $match[1] . 'w'; $hKey = $match[3] . 'h'; @@ -3008,21 +3008,21 @@ public function thumbUrlSEF($url = '', $options = array()) if (!empty($options['x']) && !empty($options['ext'])) // base64 encoded. Build URL for: RewriteRule ^media\/img\/([-A-Za-z0-9+/]*={0,3})\.(jpg|gif|png)?$ thumb.php?id=$1 { - $ext = strtolower($options['ext']); + $ext = strtolower((string) $options['ext']); - return $base . 'media/img/' . base64_encode($options['thurl']) . '.' . str_replace('jpeg', 'jpg', $ext); + return $base . 'media/img/' . base64_encode((string) $options['thurl']) . '.' . str_replace('jpeg', 'jpg', $ext); } - elseif (strpos($url, 'e_MEDIA_IMAGE') !== false) // media images. + elseif (strpos((string) $url, 'e_MEDIA_IMAGE') !== false) // media images. { $sefPath = 'media/img/'; $clean = array('{e_MEDIA_IMAGE}', 'e_MEDIA_IMAGE/'); } - elseif (strpos($url, 'e_AVATAR') !== false) // avatars + elseif (strpos((string) $url, 'e_AVATAR') !== false) // avatars { $sefPath = 'media/avatar/'; $clean = array('{e_AVATAR}', 'e_AVATAR/'); } - elseif (strpos($url, 'e_THEME') !== false) // theme folder images. + elseif (strpos((string) $url, 'e_THEME') !== false) // theme folder images. { $sefPath = 'theme/img/'; $clean = array('{e_THEME}', 'e_THEME/'); @@ -3053,7 +3053,7 @@ public function thumbUrlSEF($url = '', $options = array()) if (!is_numeric($options['crop'])) { - $sefUrl .= strtolower($options['crop']) . intval($options['w']) . 'x' . strtolower($options['crop']) . intval($options['h']); + $sefUrl .= strtolower((string) $options['crop']) . intval($options['w']) . 'x' . strtolower((string) $options['crop']) . intval($options['h']); } else { @@ -3373,7 +3373,7 @@ public function replaceConstants($text, $mode = '', $all = false) private function doReplace($matches) { - if (defined($matches[1]) && (deftrue('ADMIN') || strpos($matches[1], 'ADMIN') === false)) + if (defined($matches[1]) && (deftrue('ADMIN') || strpos((string) $matches[1], 'ADMIN') === false)) { return constant($matches[1]); } @@ -3571,8 +3571,8 @@ public function e_highlight($text, $match) { $tags = array(); - preg_match_all('#<[^>]+>#', $text, $tags); - $text = preg_replace('#<[^>]+>#', '<|>', $text); + preg_match_all('#<[^>]+>#', (string) $text, $tags); + $text = preg_replace('#<[^>]+>#', '<|>', (string) $text); $text = preg_replace('#(\b".$match."\b)#i', '\\1', $text); foreach ($tags[0] as $tag) { @@ -3673,7 +3673,7 @@ public function obfuscate($text) { $ret = ''; - foreach (str_split($text) as $letter) + foreach (str_split((string) $text) as $letter) { switch (mt_rand(1, 3)) { @@ -4031,7 +4031,7 @@ public function getTags($html, $taglist = '*', $header = false) libxml_use_internal_errors(true); $doc->loadHTML($html); - $tg = explode(',', $taglist); + $tg = explode(',', (string) $taglist); $ret = array(); foreach ($tg as $find) @@ -4293,7 +4293,7 @@ public function toGlyph($text, $options = ' ') { foreach ($custom as $glyphConfig) { - if (strpos($text, $glyphConfig['prefix']) === 0) + if (strpos($text, (string) $glyphConfig['prefix']) === 0) { $prefix = $glyphConfig['class'] . ' '; $tag = $glyphConfig['tag']; @@ -4357,7 +4357,7 @@ public function toLabel($text, $type = null) $type = 'default'; } - $tmp = explode(',', $text); + $tmp = explode(',', (string) $text); $opt = array(); foreach ($tmp as $v) @@ -4460,14 +4460,14 @@ public function toAvatar($userData = null, $options = array()) if (!empty($image)) { - if (strpos($image, '://') !== false) // Remote Image + if (strpos((string) $image, '://') !== false) // Remote Image { $url = $image; } - elseif (strpos($image, '-upload-') === 0) + elseif (strpos((string) $image, '-upload-') === 0) { - $image = substr($image, 8); // strip the -upload- from the beginning. + $image = substr((string) $image, 8); // strip the -upload- from the beginning. if (file_exists(e_AVATAR_UPLOAD . $image)) { $file = e_AVATAR_UPLOAD . $image; @@ -4508,7 +4508,7 @@ public function toAvatar($userData = null, $options = array()) else { $content = e107::getFile()->getRemoteContent($url); - $ext = strtolower(pathinfo($url, PATHINFO_EXTENSION)); + $ext = strtolower(pathinfo((string) $url, PATHINFO_EXTENSION)); } if (!empty($content)) @@ -4760,7 +4760,7 @@ public function toImage($file, $parm = array()) elseif(!empty($parm['legacy']) && !empty($file)) // Search legacy path for image in a specific folder. No path, only file name provided. { - $legacyPath = rtrim($parm['legacy'], '/') . '/' . $file; + $legacyPath = rtrim((string) $parm['legacy'], '/') . '/' . $file; $filePath = $tp->replaceConstants($legacyPath); if (is_readable($filePath)) @@ -4984,7 +4984,7 @@ public function isUTF8($string) |\xF0[\x90-\xBF][\x80-\xBF]{2} # planes 1-3 |[\xF1-\xF3][\x80-\xBF]{3} # planes 4-15 |\xF4[\x80-\x8F][\x80-\xBF]{2} # plane 16 - )+%xs', $string); + )+%xs', (string) $string); } @@ -5108,9 +5108,9 @@ public function toVideo($file, $parm = array()) $ytpref = array(); foreach ($pref as $k => $v) // Find all Youtube Prefs. { - if (strpos($k, 'youtube_') === 0) + if (strpos((string) $k, 'youtube_') === 0) { - $key = substr($k, 8); + $key = substr((string) $k, 8); $ytpref[$key] = $v; } } @@ -5286,10 +5286,10 @@ public function parseBBTags($text, $retainTags = false) { foreach ($v as $val) { - $tag = base64_decode($val['alt']); + $tag = base64_decode((string) $val['alt']); $repl = ($retainTags == true) ? '$1' . $tag . '$2' : $tag; // $text = preg_replace('/(]*>).*(<\/x-bbcode>)/i',$repl, $text); - $text = preg_replace('/().*(<\/x-bbcode>)/i', $repl, $text); + $text = preg_replace('/().*(<\/x-bbcode>)/i', $repl, (string) $text); } } @@ -5526,7 +5526,7 @@ public function cleanHtml($html = '', $checkPref = true) // $tag = strval(basename($path)); - if (strpos($path, '/code') !== false || strpos($path, '/pre') !== false) // treat as html. + if (strpos((string) $path, '/code') !== false || strpos((string) $path, '/pre') !== false) // treat as html. { $this->pathList[] = $path; // $this->nodesToConvert[] = $node->parentNode; // $node; @@ -5535,7 +5535,7 @@ public function cleanHtml($html = '', $checkPref = true) } - $tag = preg_replace('/([a-z0-9\[\]\/]*)?\/([\w\-]*)(\[(\d)*\])?$/i', '$2', $path); + $tag = preg_replace('/([a-z0-9\[\]\/]*)?\/([\w\-]*)(\[(\d)*\])?$/i', '$2', (string) $path); if (!in_array($tag, $this->allowedTags)) { @@ -5717,7 +5717,7 @@ public function invalidAttributeValue($value) foreach ($this->badAttrValues as $v) // global list because a bad value is bad regardless of the attribute it's in. ;-) { - if (preg_match('/' . $v . '/i', $value) == true) + if (preg_match('/' . $v . '/i', (string) $value) == true) { $this->removedList['blacklist'][] = "Match found for '{$v}' in '{$value}'"; @@ -5920,7 +5920,7 @@ private function processModifiers($opts, $text, $convertNL, $parseBB, $modifiers // trigger_error('tohtml_hook is deprecated. Use e_parse.php instead.', E_USER_DEPRECATED); // NO LAN //Process the older tohtml_hook pref (deprecated) - foreach (explode(',', $this->pref['tohtml_hook']) as $hook) + foreach (explode(',', (string) $this->pref['tohtml_hook']) as $hook) { if (!is_object($this->e_hook[$hook]) && is_readable(e_PLUGIN . $hook . '/' . $hook . '.php')) { diff --git a/e107_handlers/e_pluginbuilder_class.php b/e107_handlers/e_pluginbuilder_class.php index add136960b..a9d7fc0cfc 100644 --- a/e107_handlers/e_pluginbuilder_class.php +++ b/e107_handlers/e_pluginbuilder_class.php @@ -115,7 +115,7 @@ function step1()
".$frm->open('createPlugin','get',e_SELF."?mode=create").$frm->select("newplugin",$newDir, false, 'size=xlarge').$frm->admin_button('step', 2,'other',LAN_GO)."
".$frm->checkbox('createFiles',1,1,EPL_ADLAN_255).$frm->close()."
".$info."
".EPL_ADLAN_108."
".$frm->open('checkPluginLangs','get',e_SELF."?mode=lans").$frm->select("newplugin",$lanDir, false, 'size=xlarge').$frm->admin_button('step', 2,'other',LAN_GO)."
".$frm->close()."
- +
"; $text .= $frm->close(); @@ -409,7 +409,7 @@ private function buildTemplateFile() // Template File TMPL; -$upperName = strtoupper($this->pluginName); +$upperName = strtoupper((string) $this->pluginName); $content .= " // ".$this->pluginName." Template file @@ -469,7 +469,7 @@ class plugin_".$this->pluginName."_".$this->pluginName."_shortcodes extends e_sh $content .= " /** - * {".strtoupper($key)."} + * {".strtoupper((string) $key)."} */ public function sc_".$key."(\$parm=null) { @@ -780,7 +780,7 @@ function pluginXml() function xmlInput($name, $info, $default='') { $frm = e107::getForm(); - list($cat,$type) = explode("-",$info); + list($cat,$type) = explode("-",(string) $info); $size = 30; // Textbox size. $help = ''; @@ -1239,10 +1239,10 @@ function special($name) */ function fieldType($name, $val) { - $type = strtolower($val['type']); + $type = strtolower((string) $val['type']); $frm = e107::getForm(); - if(strtolower($val['default']) == "auto_increment") + if(strtolower((string) $val['default']) == "auto_increment") { $key = $this->table."[pid]"; return "Primary Id". @@ -1357,7 +1357,7 @@ function fieldType($name, $val) // Guess Default Field Type based on name of field. function guess($data, $val=null,$mode = 'type') { - $tmp = explode("_",$data); + $tmp = explode("_",(string) $data); $name = ''; if(count($tmp) == 3) // eg Link_page_title @@ -1373,7 +1373,7 @@ function guess($data, $val=null,$mode = 'type') $name = $data; } - $ret['title'] = ucfirst($name); + $ret['title'] = ucfirst((string) $name); $ret['width'] = 'auto'; $ret['class'] = 'left'; $ret['thclass'] = 'left'; @@ -1408,7 +1408,7 @@ function guess($data, $val=null,$mode = 'type') case 'lastname': case 'company': case 'city': - $ret['title'] = ucfirst($name); + $ret['title'] = ucfirst((string) $name); $ret['type'] = 'text'; $ret['batch'] = false; $ret['filter'] = false; @@ -1481,7 +1481,7 @@ function guess($data, $val=null,$mode = 'type') case 'code': case 'zip': - $ret['title'] = ucfirst($name); + $ret['title'] = ucfirst((string) $name); $ret['type'] = 'number'; $ret['batch'] = false; $ret['filter'] = false; @@ -1491,7 +1491,7 @@ function guess($data, $val=null,$mode = 'type') case 'state': case 'country': case 'category': - $ret['title'] = ($name == 'category') ? 'LAN_CATEGORY' : ucfirst($name); + $ret['title'] = ($name == 'category') ? 'LAN_CATEGORY' : ucfirst((string) $name); $ret['type'] = 'dropdown'; $ret['batch'] = true; $ret['filter'] = true; @@ -1542,7 +1542,7 @@ function guess($data, $val=null,$mode = 'type') case 'comments': case 'address': case 'description': - $ret['title'] = ($name == 'description') ? 'LAN_DESCRIPTION' : ucfirst($name); + $ret['title'] = ($name == 'description') ? 'LAN_DESCRIPTION' : ucfirst((string) $name); $ret['type'] = ($val['type'] == 'TEXT') ? 'textarea' : 'text'; $ret['width'] = '40%'; $ret['inline'] = false; @@ -1575,7 +1575,7 @@ function fieldData($name, $val) 'mediumblob','longblob','tinytext','mediumtext','longtext','text','date'); - $type = strtolower($type); + $type = strtolower((string) $type); if(in_array($type,$strings)) { @@ -1705,7 +1705,7 @@ private function buildAdminUIBatchFilter($fields, $table, $type=null) { $text = ''; - $typeUpper = ucfirst($type); + $typeUpper = ucfirst((string) $type); $params = ($type === 'batch') ? "\$selected, \$type" : "\$type"; diff --git a/e107_handlers/e_profanity_class.php b/e107_handlers/e_profanity_class.php index 258e02c1a7..3db1d1edfb 100644 --- a/e107_handlers/e_profanity_class.php +++ b/e107_handlers/e_profanity_class.php @@ -20,7 +20,7 @@ public function __construct() return null; } - $words = explode(',', $this->pref['profanity_words']); + $words = explode(',', (string) $this->pref['profanity_words']); $word_array = array(); foreach($words as $word) { @@ -57,10 +57,10 @@ public function filterProfanities($text) if(!empty($this->pref['profanity_replace'])) { - return preg_replace("#\b" . $this->profanityList . "\b#is", $this->pref['profanity_replace'], $text); + return preg_replace("#\b" . $this->profanityList . "\b#is", (string) $this->pref['profanity_replace'], (string) $text); } - return preg_replace_callback("#\b" . $this->profanityList . "\b#is", array($this, 'replaceProfanities'), $text); + return preg_replace_callback("#\b" . $this->profanityList . "\b#is", array($this, 'replaceProfanities'), (string) $text); } /** @@ -78,6 +78,6 @@ public function replaceProfanities($matches) @result filtered text */ - return preg_replace('#a|e|i|o|u#i', '*', $matches[0]); + return preg_replace('#a|e|i|o|u#i', '*', (string) $matches[0]); } } \ No newline at end of file diff --git a/e107_handlers/e_ranks_class.php b/e107_handlers/e_ranks_class.php index 9bbfa74202..c8e98e20c5 100644 --- a/e107_handlers/e_ranks_class.php +++ b/e107_handlers/e_ranks_class.php @@ -190,9 +190,9 @@ public function getRankData() private function _getImage(&$info) { $img = $info['image']; - if($info['lan_pfx'] && strpos('_', $info['image'])) + if($info['lan_pfx'] && strpos('_', (string) $info['image'])) { - $_tmp = explode('_', $info['image'], 2); + $_tmp = explode('_', (string) $info['image'], 2); $img = e_LANGUAGE.'_'.$_tmp[1]; } return $this->imageFolder.$img; diff --git a/e107_handlers/e_render_class.php b/e107_handlers/e_render_class.php index a0547cad16..8eeea86610 100644 --- a/e107_handlers/e_render_class.php +++ b/e107_handlers/e_render_class.php @@ -168,7 +168,7 @@ function getMagicShortcodes() foreach($types as $var) { - $sc = '{---' . strtoupper($var) . '---}'; + $sc = '{---' . strtoupper((string) $var) . '---}'; $ret[$sc] = isset($val[$var]) ? (string) $val[$var] : null; } diff --git a/e107_handlers/e_signup_class.php b/e107_handlers/e_signup_class.php index 311a369aa8..3de9036a15 100644 --- a/e107_handlers/e_signup_class.php +++ b/e107_handlers/e_signup_class.php @@ -45,7 +45,7 @@ public function run($query='') { $ns = e107::getRender(); - if(strpos($query,'activate.') === 0) + if(strpos((string) $query,'activate.') === 0) { $result = $this->processActivationLink($query); @@ -165,7 +165,7 @@ private function resendEmail() $row = $sql -> fetch(); // We should have a user record here - if(trim($_POST['resend_password']) !="" && $new_email) // Need to change the email address - check password to make sure + if(trim((string) $_POST['resend_password']) !="" && $new_email) // Need to change the email address - check password to make sure { if ($userMethods->CheckPassword($_POST['resend_password'], $row['user_loginname'], $row['user_password']) === TRUE) { @@ -356,7 +356,7 @@ public function processActivationLink($queryString) $log = e107::getLog(); - $qs = explode('.', $queryString); // ie. activate.".$row['user_id'].".".$row['user_sess'] + $qs = explode('.', (string) $queryString); // ie. activate.".$row['user_id'].".".$row['user_sess'] if ($qs[0] == 'activate' && (count($qs) == 3 || count($qs) == 4) && $qs[2]) { diff --git a/e107_handlers/e_thumbnail_class.php b/e107_handlers/e_thumbnail_class.php index 0654675cb7..7e3c1bf98d 100644 --- a/e107_handlers/e_thumbnail_class.php +++ b/e107_handlers/e_thumbnail_class.php @@ -91,7 +91,7 @@ public function init($pref) $this->_upsize = ((isset($this->_request['w']) && $this->_request['w'] > 110) || (isset($this->_request['aw']) && ($this->_request['aw'] > 110))); // don't resizeUp the icon images. - $this->_forceWebP = empty($this->_request['type']) && !empty($pref['thumb_to_webp']) && (strpos( $_SERVER['HTTP_ACCEPT'], 'image/webp' ) !== false) ? true : false; + $this->_forceWebP = empty($this->_request['type']) && !empty($pref['thumb_to_webp']) && (strpos( (string) $_SERVER['HTTP_ACCEPT'], 'image/webp' ) !== false) ? true : false; // var_dump($this); // exit; return null; @@ -135,7 +135,7 @@ private function parseRequest() if(isset($_GET['id'])) // very-basic url-tampering prevention and path cloaking { - $e_QUERY = base64_decode($_GET['id']); + $e_QUERY = base64_decode((string) $_GET['id']); } $e_QUERY= str_replace('e_AVATAR', 'e_AVATAR/', $e_QUERY); // FIXME Quick and dirty fix. @@ -479,7 +479,7 @@ private function sendCachedImage($cache_filename, $thumbnfo) } // check browser cache - if (@$_SERVER['HTTP_IF_MODIFIED_SINCE'] && ($thumbnfo['lmodified'] <= strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE'])) && (isset($_SERVER['HTTP_IF_NONE_MATCH']) && trim($_SERVER['HTTP_IF_NONE_MATCH']) == $thumbnfo['md5s'])) + if (@$_SERVER['HTTP_IF_MODIFIED_SINCE'] && ($thumbnfo['lmodified'] <= strtotime((string) $_SERVER['HTTP_IF_MODIFIED_SINCE'])) && (isset($_SERVER['HTTP_IF_NONE_MATCH']) && trim($_SERVER['HTTP_IF_NONE_MATCH']) == $thumbnfo['md5s'])) { header('HTTP/1.1 304 Not Modified'); //$bench->end()->logResult('thumb.php', $_GET['src'].' - 304 not modified'); @@ -587,7 +587,7 @@ private function ctype($ftype) //'bmp' => 'image/bmp', ); - $ftype = strtolower($ftype); + $ftype = strtolower((string) $ftype); if(isset($known_types[$ftype])) { return $known_types[$ftype]; diff --git a/e107_handlers/e_upgrade_class.php b/e107_handlers/e_upgrade_class.php index b66a727838..d71877a77f 100644 --- a/e107_handlers/e_upgrade_class.php +++ b/e107_handlers/e_upgrade_class.php @@ -80,7 +80,7 @@ public function releaseCheck($mode='plugin', $cache=TRUE) $xml = e107::getXml(); $feed = $this->getOption('releaseUrl'); - if(substr($feed,-4) == ".php") + if(substr((string) $feed,-4) == ".php") { $feed .= "?folder=".$this->getOption('curFolder')."&version=".$this->getOption('curVersion'); } diff --git a/e107_handlers/error_page_class.php b/e107_handlers/error_page_class.php index bfc291bdd3..dd0c63f7cc 100644 --- a/e107_handlers/error_page_class.php +++ b/e107_handlers/error_page_class.php @@ -163,7 +163,7 @@ private function setPageUnknown() { header('HTTP/1.1 501 Not Implemented', true, 501); - $errorQuery = htmlentities($_SERVER['QUERY_STRING']); + $errorQuery = htmlentities((string) $_SERVER['QUERY_STRING']); $this->template = 'DEFAULT'; $this->title = LAN_ERROR_13 . ' (' . $errorQuery . ')'; diff --git a/e107_handlers/event_class.php b/e107_handlers/event_class.php index eedb4de593..cc405ba116 100644 --- a/e107_handlers/event_class.php +++ b/e107_handlers/event_class.php @@ -228,9 +228,9 @@ function trigger($eventname, $data=null) try { - if (strpos($method, '::') !== false) // If $method contains "::", call it statically + if (strpos((string) $method, '::') !== false) // If $method contains "::", call it statically { - [$staticClass, $staticMethod] = explode('::', $method, 2); + [$staticClass, $staticMethod] = explode('::', (string) $method, 2); $ret = $staticClass::$staticMethod($data, $eventname); } elseif(is_callable([$class, $method])) @@ -296,7 +296,7 @@ function triggerAdminEvent($type, $parms=null) global $pref; if(!is_array($parms)) { - parse_str($parms, $parms); + parse_str((string) $parms, $parms); } if(isset($pref['e_admin_events_list']) && is_array($pref['e_admin_events_list'])) { diff --git a/e107_handlers/file_class.php b/e107_handlers/file_class.php index df5a7c4d51..010f9e0961 100644 --- a/e107_handlers/file_class.php +++ b/e107_handlers/file_class.php @@ -185,7 +185,7 @@ public function cleanFileName($f, $rename = false) { $fullpath = $f['path'] . $f['fname']; - $newfile = preg_replace("/[^a-z0-9-\._]/", "-", strtolower($f['fname'])); + $newfile = preg_replace("/[^a-z0-9-\._]/", "-", strtolower((string) $f['fname'])); $newpath = $f['path'] . $newfile; if($rename == true) @@ -1179,13 +1179,13 @@ function send($file, $opts = array()) if(is_file($filename) && is_readable($filename) && connection_status() == 0) { $seek = 0; - if(strpos($_SERVER['HTTP_USER_AGENT'], "MSIE") !== false) + if(strpos((string) $_SERVER['HTTP_USER_AGENT'], "MSIE") !== false) { $file = preg_replace('/\./', '%2e', $file, substr_count($file, '.') - 1); } if(isset($_SERVER['HTTP_RANGE'])) { - $seek = intval(substr($_SERVER['HTTP_RANGE'], strlen('bytes='))); + $seek = intval(substr((string) $_SERVER['HTTP_RANGE'], strlen('bytes='))); } $bufsize = 2048; ignore_user_abort(true); @@ -1300,7 +1300,7 @@ public function getRootFolder($unarc) foreach($unarc as $d) { - $target = trim($d['stored_filename'], '/'); + $target = trim((string) $d['stored_filename'], '/'); $test = basename(str_replace(e_TEMP, "", $d['stored_filename']), '/'); @@ -1661,7 +1661,7 @@ public function isValidURL($url) // print_a($headers); - return (stripos($headers[0], "200 OK") || strpos($headers[0], "302")); + return (stripos((string) $headers[0], "200 OK") || strpos((string) $headers[0], "302")); } @@ -1966,7 +1966,7 @@ private function matchFound($file, $array) foreach($array as $term) { - if(strpos($file, $term) !== false) + if(strpos((string) $file, (string) $term) !== false) { return true; } @@ -2278,9 +2278,9 @@ public function isAllowedType($file, $targetFile = '') $remote = false; - if(strpos($targetFile, 'http') === 0) // remote file. + if(strpos((string) $targetFile, 'http') === 0) // remote file. { - $tmp = parse_url($targetFile); + $tmp = parse_url((string) $targetFile); $targetFile = $tmp['path']; $remote = true; if(!empty($tmp['host']) && ($tmp['host'] === 'localhost' || $tmp['host'] === '127.0.0.1')) @@ -2289,7 +2289,7 @@ public function isAllowedType($file, $targetFile = '') } } - $ext = pathinfo($targetFile, PATHINFO_EXTENSION); + $ext = pathinfo((string) $targetFile, PATHINFO_EXTENSION); $types = $this->getAllowedFileTypes(); @@ -2590,7 +2590,7 @@ public function getAllowedFileTypes($class = null) if(($class === null && check_class($v['name'])) || (int) $class === (int) $v['name']) { // $current_perms[$v['name']] = array('type' => $v['type'], 'maxupload' => $v['maxupload']); - $a_filetypes = explode(',', $v['type']); + $a_filetypes = explode(',', (string) $v['type']); foreach($a_filetypes as $ftype) { $ftype = strtolower(trim(str_replace('.', '', $ftype))); // File extension diff --git a/e107_handlers/form_handler.php b/e107_handlers/form_handler.php index 464f13d1dc..8a81f0eeda 100644 --- a/e107_handlers/form_handler.php +++ b/e107_handlers/form_handler.php @@ -156,7 +156,7 @@ public function open($name, $method=null, $target=null, $options=null) { $target = e_REQUEST_URI; } - + if($method == null) { $method = 'post'; @@ -168,7 +168,7 @@ public function open($name, $method=null, $target=null, $options=null) { parse_str($options, $options); } - + if(!empty($options['class'])) { $class = $options['class']; @@ -177,13 +177,13 @@ public function open($name, $method=null, $target=null, $options=null) { $class = "form-horizontal"; } - + if(isset($options['autocomplete'])) // leave as isset() { $autoComplete = $options['autocomplete'] ? 'on' : 'off'; } - + if($method === 'get' && strpos($target,'=')) { list($url, $qry) = explode('?', $target); @@ -214,14 +214,14 @@ public function open($name, $method=null, $target=null, $options=null) } return $text; } - + /** * Close a Form */ public function close() { return ''; - + } @@ -537,7 +537,7 @@ public function setRequiredString($string) $this->_required_string = $string; return $this; } - + // For Comma separated keyword tags. /** @@ -619,7 +619,7 @@ public function tabs($array, $options = array()) $text .= ''; $c++; } - + $text .= ''; $tabClass = varset($options['class'],null); @@ -629,7 +629,7 @@ public function tabs($array, $options = array()) $text .= '
'; - + $c=0; $act = $initTab; foreach($array as $key=>$tab) @@ -649,7 +649,7 @@ public function tabs($array, $options = array()) $text .= '
'.$tab['text'].'
'; $c++; } - + $text .= '
'; @@ -675,7 +675,7 @@ public function carousel($name= 'e-carousel', $array=array(), $options = null) { $indicators = ''; $controls = ''; - + $act = varset($options['default'], 0); $navigation = isset($options['navigation']) ? $options['navigation'] : true; @@ -708,7 +708,7 @@ public function carousel($name= 'e-carousel', $array=array(), $options = null) $start = ' - + attributes($att) . '>'; if($indicate && (count($array) > 1)) @@ -735,7 +735,7 @@ public function carousel($name= 'e-carousel', $array=array(), $options = null) '; @@ -836,12 +836,12 @@ public function text($name, $value = '', $maxlength = 80, $options= null) { $options['class'] = 'tbox input-text span3'; } - + elseif($maxlength < 50) { $options['class'] = 'tbox input-text span7'; } - + elseif($maxlength > 99) { $options['class'] = 'tbox input-text span7'; @@ -1082,9 +1082,9 @@ public function iconpicker($name, $default, $label='', $options = array(), $ajax /* $options['media'] = '_icon'; $options['legacyPath'] = "{e_IMAGE}icons"; - + return $this->imagepicker($name, $default, $label, $options);*/ - + } @@ -1131,7 +1131,7 @@ public function mediaUrl($category = '', $label = '', $tagid='', $extras=null) } $url .= '&iframe=1'; - + if(!empty($extras['w'])) { $url .= '&w=' . $extras['w']; @@ -1156,7 +1156,7 @@ public function mediaUrl($category = '', $label = '', $tagid='', $extras=null) { $url .= '&youtube=1'; } - + if(!empty($extras['video'])) { $url .= ($extras['video'] == 2) ? '&video=2' : '&video=1'; @@ -1216,31 +1216,31 @@ public function avatarpicker($name, $curVal='', $options=array()) { $tp = $this->tp; $pref = e107::getPref(); - + $attr = 'aw=' .$pref['im_width']. '&ah=' .$pref['im_height']; $tp->setThumbSize($pref['im_width'],$pref['im_height']); - + $blankImg = $tp->thumbUrl(e_IMAGE. 'generic/blank_avatar.jpg',$attr); $localonly = true; $idinput = $this->name2id($name); $previnput = $idinput. '-preview'; $optioni = $idinput. '-options'; - - + + $path = (strpos($curVal,'-upload-') === 0) ? '{e_AVATAR}upload/' : '{e_AVATAR}default/'; $newVal = str_replace('-upload-','',$curVal); - + $img = (strpos($curVal, '://')!==false) ? $curVal : $tp->thumbUrl($path.$newVal); - + if(!$curVal) { $img = $blankImg; } - + $parm = $options; $classlocal = (!empty($parm['class'])) ? "class='".$parm['class']." e-expandit e-tip avatar'" : " class='img-rounded rounded e-expandit e-tip avatar "; $class = (!empty($parm['class'])) ? "class='".$parm['class']." e-expandit '" : " class='img-rounded rounded btn btn-default btn-secondary button e-expandit "; - + if($localonly == true) { $text = ""; @@ -1252,26 +1252,26 @@ public function avatarpicker($name, $curVal='', $options=array()) $text .= ""; $text .= ''; } - + $avFiles = e107::getFile()->get_files(e_AVATAR_DEFAULT, '.jpg|.png|.gif|.jpeg|.JPG|.GIF|.PNG'); - + $text .= "\n'; - + // Used by usersettings.php right now. - - - - - - - + + + + + + + return $text; /* //TODO discuss and FIXME @@ -1320,7 +1320,7 @@ public function avatarpicker($name, $curVal='', $options=array()) $text .= "
".LAN_SIGNUP_25."
".LAN_SIGNUP_34."
"; } - + if (false && $pref['photo_upload'] && FILE_UPLOADS) { $text .= "
".LAN_SIGNUP_26." @@ -1581,11 +1581,11 @@ public function mediapicker($name, $default, $parms = '') dictDefaultMessage: \"".$parms['label']. '", maxFilesize: ' .(int) ini_get('upload_max_filesize').", success: function (file, response) { - + file.previewElement.classList.add('dz-success'); - + // console.log(response); - + if(response) { var decoded = jQuery.parseJSON(response); @@ -1601,14 +1601,14 @@ public function mediapicker($name, $default, $parms = '') $('#".$name_id."_prev').html(decoded.error.message); } } - + }, error: function (file, response) { file.previewElement.classList.add('dz-error'); } }); }); - + "; @@ -1634,7 +1634,7 @@ public function filepicker($name, $default, $label = '', $sc_parameters = null) $tp = $this->tp; $name_id = $this->name2id($name); unset($label); - + if(is_string($sc_parameters)) { if(strpos($sc_parameters, '=') === false) @@ -1667,24 +1667,24 @@ public function filepicker($name, $default, $label = '', $sc_parameters = null) { $ret .= ""; } - - + + $default_label = ($default) ?: LAN_CHOOSE_FILE; $label = "".basename($default_label). ''; - + $sc_parameters['mode'] = 'main'; $sc_parameters['action'] = 'dialog'; - - + + // $ret .= $this->mediaUrl($cat, $label,$name_id,"mode=dialog&action=list"); $ret .= $this->mediaUrl($cat, $label,$name_id,$sc_parameters); - - - - + + + + return $ret; - - + + } @@ -1716,15 +1716,15 @@ public function datepicker($name, $datestamp = false, $options = null) parse_str($options,$options); } - $mode = !empty($options['mode']) ? trim($options['mode']) : 'date'; // OR 'datetime' + $mode = !empty($options['mode']) ? trim((string) $options['mode']) : 'date'; // OR 'datetime' if(!empty($options['type'])) /** BC Fix. 'type' is @deprecated */ { - $mode = trim($options['type']); + $mode = trim((string) $options['type']); } - $dateFormat = !empty($options['format']) ? trim($options['format']) :e107::getPref('inputdate', '%Y-%m-%d'); - $ampm = (preg_match('/%l|%I|%p|%P/',$dateFormat)) ? 'true' : 'false'; + $dateFormat = !empty($options['format']) ? trim((string) $options['format']) :e107::getPref('inputdate', '%Y-%m-%d'); + $ampm = (preg_match('/%l|%I|%p|%P/',(string) $dateFormat)) ? 'true' : 'false'; $value = null; $hiddenValue = null; $useUnix = (isset($options['return']) && ($options['return'] === 'string')) ? 'false' : 'true'; @@ -1897,7 +1897,7 @@ public function userlist($name, $val=null, $options=array()) $cname = str_replace('_',' ', trim($cname)); foreach($users as $u) { - $uclass = explode(',',$u['user_class']); + $uclass = explode(',',(string) $u['user_class']); if(($classList == e_UC_ADMIN) || ($classList == e_UC_MEMBER) || in_array($cls,$uclass)) { @@ -2113,7 +2113,7 @@ public function rate($table, $id, $options=array()) { $table = preg_replace('/\W/', '', $table); $id = (int) $id; - + return e107::getRate()->render($table, $id, $options); } @@ -2125,9 +2125,9 @@ public function rate($table, $id, $options=array()) */ public function like($table, $id, $options=null) { - $table = preg_replace('/\W/', '', $table); + $table = preg_replace('/\W/', '', (string) $table); $id = (int) $id; - + return e107::getRate()->renderLike($table,$id,$options); } @@ -2181,25 +2181,25 @@ public function password($name, $value = '', $maxlength = 50, $options = null) { parse_str($options, $options); } - + $addon = ''; $gen = ''; - + if(!empty($options['generate'])) { $gen = ' '.LAN_GENERATE.' '; - + if(empty($options['nomask'])) { $gen .= ''.LAN_SHOW.'
'; } } - + if(!empty($options['strength'])) { $addon .= "
"; } - + $options['pattern'] = vartrue($options['pattern'],'[\S].{2,}[\S]'); $options['required'] = varset($options['required'], 1); $options['class'] = vartrue($options['class'],'e-password tbox'); @@ -2220,7 +2220,7 @@ public function password($name, $value = '', $maxlength = 50, $options = null) { $options['class'] .= ' form-control'; } - + if(!empty($options['size']) && !is_numeric($options['size'])) { $options['class'] .= ' input-' . $options['size']; @@ -2266,7 +2266,7 @@ public function pagination($url='', $total=0, $from=0, $perPage=10, $options=arr { return ''; } - + if(defined('BOOTSTRAP') && BOOTSTRAP === 4) { return 'attributes([ @@ -2321,10 +2321,10 @@ public function progressBar($name,$value,$options=array())
"; } - + $class = vartrue($options['class']); $target = $this->name2id($name); - + $striped = (vartrue($options['btn-label'])) ? ' progress-striped active' : ''; if(strpos($value,'/')!==false) @@ -2357,23 +2357,23 @@ public function progressBar($name,$value,$options=array()) $text .= $label; $text .= '
'; - + $loading = vartrue($options['loading'], defset('LAN_LOADING', 'Loading')); - + $buttonId = $target.'-start'; - - - + + + if(!empty($options['btn-label'])) { $interval = vartrue($options['interval'],1000); $text .= ''.$options['btn-label'].''; $text .= ' '.LAN_CANCEL.''; } - - + + return $text; - + } @@ -2454,7 +2454,7 @@ public function bbarea($name, $value='', $template = '', $mediaCat='_common', $s // $size = 'input-large'; $height = ''; $cols = 70; - + switch($size) { case 'tiny': @@ -2462,17 +2462,17 @@ public function bbarea($name, $value='', $template = '', $mediaCat='_common', $s $cols = 50; // $height = "style='height:250px'"; // inline required for wysiwyg break; - - + + case 'small': $rows = '7'; $height = "style='height:230px'"; // inline required for wysiwyg $size = 'input-block-level'; break; - + case 'medium': $rows = '10'; - + $height = "style='height:375px'"; // inline required for wysiwyg $size = 'input-block-level'; break; @@ -2541,7 +2541,7 @@ public function bbarea($name, $value='', $template = '', $mediaCat='_common', $s $counter = vartrue($options['counter'],false); - + $ret = "
\n"; @@ -2566,32 +2566,32 @@ public function bbarea($name, $value='', $template = '', $mediaCat='_common', $s } } } - + if (!check_class(e107::getConfig()->get('post_html', e_UC_MAINADMIN))) { $ret .= e107::getBB()->renderButtons($template,$help_tagid); } - + } else { $ret .= e107::getBB()->renderButtons($template,$help_tagid); } - + $ret .= $this->textarea($name, $value, $rows, $cols, $options, $counter); // higher thank 70 will break some layouts. - + $ret .= "
\n"; - + $_SESSION['media_category'] = $mediaCat; // used by TinyMce. - - + + return $ret; - + // Quick fix - hide TinyMCE links if not installed, dups are handled by JS handler /* - + e107::getJs()->footerInline(" if(typeof tinyMCE === 'undefined') { @@ -2599,8 +2599,8 @@ public function bbarea($name, $value='', $template = '', $mediaCat='_common', $s } "); */ - - + + } /** @@ -2650,13 +2650,13 @@ private function renderSnippet($snippet, $options, $name, $value) if(!empty($options['class'])) { - $snip['class'] = trim($options['class']); + $snip['class'] = trim((string) $options['class']); unset($options['class']); } if(!empty($options['label'])) { - $snip['label'] = trim($options['label']); + $snip['label'] = trim((string) $options['label']); unset($options['label']); } @@ -2686,9 +2686,9 @@ public function checkbox($name, $value, $checked = false, $options = array()) { if(!is_array($options)) { - if(strpos($options, '=')!==false) + if(strpos((string) $options, '=')!==false) { - parse_str($options, $options); + parse_str((string) $options, $options); } elseif(is_string($options)) { @@ -2701,9 +2701,9 @@ public function checkbox($name, $value, $checked = false, $options = array()) $labelTitle = ''; $options = $this->format_options('checkbox', $name, $options); - + $options['checked'] = $checked; //comes as separate argument just for convenience - + $text = ''; @@ -2764,9 +2764,9 @@ public function checkboxes($name, $option_array=array(), $checked=null, $options if(!is_array($checked)) { - $checked = explode(',', $checked); + $checked = explode(',', (string) $checked); } - + $text = array(); $cname = $name; @@ -2814,7 +2814,7 @@ public function checkboxes($name, $option_array=array(), $checked=null, $options } return $text; - + } @@ -2872,7 +2872,7 @@ public function uc_checkbox($name, $current_value, $uc_options, $field_options = { if(!is_array($field_options)) { - parse_str($field_options, $field_options); + parse_str((string) $field_options, $field_options); } return '
@@ -2896,11 +2896,11 @@ public function _uc_checkbox_cb($treename, $classnum, $current_value, $nest_leve if (!is_array($current_value)) { - $tmp = explode(',', $current_value); + $tmp = explode(',', (string) $current_value); } $classIndex = abs($classnum); // Handle negative class values - $classSign = (strpos($classnum, '-') === 0) ? '-' : ''; + $classSign = (strpos((string) $classnum, '-') === 0) ? '-' : ''; $style = ''; $class = $style; @@ -2946,12 +2946,12 @@ public function radio($name, $value, $checked = false, $options = null) { parse_str((string) $options, $options); } - + if(is_array($value)) { return $this->radio_multi($name, $value, $checked, $options); } - + $labelFound = vartrue($options['label']); unset($options['label']); // label attribute not valid in html5 @@ -3154,15 +3154,15 @@ public function flipswitch($name, $checked_enabled = false, $labels=null, $optio */ private function radio_multi($name, $elements, $checked, $options=array(), $help = null) { - - - + + + /* // Bootstrap Test. return' - + '; */ - - + + $text = array(); - + if(is_string($elements)) { parse_str($elements, $elements); @@ -3190,26 +3190,26 @@ private function radio_multi($name, $elements, $checked, $options=array(), $help $help = "
".$options['help']. '
'; unset($options['help']); } - + foreach ($elements as $value => $label) { $label = defset($label, $label); - + $helpLabel = (is_array($help)) ? vartrue($help[$value]) : $help; - + // Bootstrap Style Code - for use later. $options['label'] = $label; $options['help'] = $helpLabel; $text[] = $this->radio($name, $value, (string) $checked === (string) $value, $options); - + // $text[] = $this->radio($name, $value, (string) $checked === (string) $value)."".$this->label($label, $name, $value).(isset($helpLabel) ? "
".$helpLabel."
" : ''); } - + // if($multi_line === false) // { // return implode("  ", $text); // } - + // support of UI owned 'newline' parameter if(!varset($options['sep']) && vartrue($options['newline'])) { @@ -3218,7 +3218,7 @@ private function radio_multi($name, $elements, $checked, $options=array(), $help $separator = varset($options['sep'], ' '); // return print_a($text,true); return implode($separator, $text).$help; - + // return implode("\n", $text); //XXX Limiting markup. // return "
".implode("
", $text)."
"; @@ -3293,7 +3293,7 @@ public function select_open($name, $options = array()) $options = $this->format_options('select', $name, $options); - + return " @@ -3469,14 +3469,14 @@ public function search($name, $searchVal, $submitName, $filterName='', $filterAr
- - + + - + - + */ } @@ -3498,7 +3498,7 @@ public function uc_select($name, $current_value=null, $uc_options=null, $select_ var_dump($select_options);*/ - if(!empty($select_options['multiple']) && substr($name,-1) !== ']') + if(!empty($select_options['multiple']) && substr((string) $name,-1) !== ']') { $name .= '[]'; } @@ -3553,14 +3553,14 @@ public function uc_select($name, $current_value=null, $uc_options=null, $select_ public function _uc_select_cb($treename, $classnum, $current_value, $nest_level) { $classIndex = abs($classnum); // Handle negative class values - $classSign = (strpos($classnum, '-') === 0) ? '-' : ''; - + $classSign = (strpos((string) $classnum, '-') === 0) ? '-' : ''; + if($classnum == e_UC_BLANK) { return $this->option(' ', ''); } - $tmp = explode(',', $current_value); + $tmp = explode(',', (string) $current_value); if($nest_level == 0) { $prefix = ''; @@ -3879,9 +3879,9 @@ public function button($name, $value, $action = 'submit', $label = '', $options { // $options = $this->format_options('admin_button', $name, $options); $options['class'] = vartrue($options['class']); - + $align = vartrue($options['align'],'left'); - + $text = ''; - + return $text; } - - + + return $this->admin_button($name, $value, $action, $label, $options); - + } /** @@ -3929,7 +3929,7 @@ public function breadcrumb($array, $force = false) } if(!is_array($array)){ return; } - + $opt = array(); if(!empty($array['home']['icon'])) // custom home icon. @@ -3943,7 +3943,7 @@ public function breadcrumb($array, $force = false) $homeIcon = ($this->_fontawesome) ? $this->tp->toGlyph('fa-home.glyph') : $fallbackIcon; } - + $opt[] = "".$homeIcon. ''; // Add Site-Pref to disable? $text = "\n"; - + // return print_a($opt,true); - + return $text; } @@ -4307,7 +4307,7 @@ public function get_attributes($options, $name = '', $value = '') break; default: - if(strpos($option,'data-') === 0) + if(strpos((string) $option,'data-') === 0) { $ret .= $this->attributes([$option => $optval]); } @@ -4315,7 +4315,7 @@ public function get_attributes($options, $name = '', $value = '') } - + } return $ret; @@ -4343,7 +4343,7 @@ protected function _format_id($id_value, $name, $value = null, $return_attribute //format data first $name = trim($this->name2id($name), '-'); - $value = trim(preg_replace('#[^a-zA-Z0-9\-]#', '-', $value), '-'); + $value = trim((string) preg_replace('#[^a-zA-Z0-9\-]#', '-', (string) $value), '-'); //$value = trim(preg_replace('#[^a-z0-9\-]#/i','-', $value), '-'); // This should work - but didn't for me! $value = trim(str_replace('/', '-', $value), '-'); // Why? if (!$id_value && is_numeric($value)) @@ -4394,7 +4394,7 @@ protected function _format_id($id_value, $name, $value = null, $return_attribute */ public function name2id($name) { - $name = strtolower($name); + $name = strtolower((string) $name); $name = $this->tp->toASCII($name); return rtrim(str_replace(array('[]', '[', ']', '_', '/', ' ','.', '(', ')', '::', ':', '?','=',"'",','), array('-', '-', '', '-', '-', '-', '-','','','-','','-','-','',''), $name), '-'); } @@ -4416,15 +4416,15 @@ public function format_options($type, $name, $user_options=null) } $def_options = $this->_default_options($type); - + if(is_array($user_options)) { $user_options['name'] = $name; //required for some of the automated tasks - + foreach (array_keys($user_options) as $key) { - if(!isset($def_options[$key]) && strpos($key,'data-') !== 0) + if(!isset($def_options[$key]) && strpos((string) $key,'data-') !== 0) { unset($user_options[$key]); // data-xxxx exempt //remove it? } @@ -4434,7 +4434,7 @@ public function format_options($type, $name, $user_options=null) { $user_options = array('name' => $name); //required for some of the automated tasks } - + return array_merge($def_options, $user_options); } @@ -4564,17 +4564,17 @@ public function columnSelector($columnsArray, $columnsDefault = array(), $id = ' } } - + // navbar-header nav-header // navbar-header nav-header $text = ''; - + // $text .= "
"; $text .= ''; - - + + /* $text = ' '; - + // e107::js('footer-inline',"Form.focusFirstElement('{$form['id']}-form');",'prototype'); // e107::getJs()->footerInline("Form.focusFirstElement('{$form['id']}-form');"); } @@ -7901,12 +7901,12 @@ public function renderCreateFieldset($id, $fdata, $model, $tab=0) $parms = vartrue($att['formparms'], array()); if(!is_array($parms)) { - parse_str($parms, $parms); + parse_str((string) $parms, $parms); } $label = !empty($att['note']) ? '
'.deftrue($att['note'], $att['note']).'
' : ''; - $valPath = trim(vartrue($att['dataPath'], $key), '/'); + $valPath = trim((string) vartrue($att['dataPath'], $key), '/'); $keyName = $key; if(strpos($valPath, '/')) //not TRUE, cause string doesn't start with / { @@ -7917,10 +7917,10 @@ public function renderCreateFieldset($id, $fdata, $model, $tab=0) $keyName .= '['.$path.']'; } } - + if(!empty($att['writeParms']) && !is_array($att['writeParms'])) { - parse_str(varset($att['writeParms']), $writeParms); + parse_str((string) varset($att['writeParms']), $writeParms); } else { @@ -7940,10 +7940,10 @@ public function renderCreateFieldset($id, $fdata, $model, $tab=0) } } - + if($att['type'] === 'hidden') { - + if(empty($writeParms['show'])) // hidden field and not displayed. Render element after the field-set. { $hidden_fields[] = $this->renderElement($keyName, $model->getIfPosted($valPath), $att, varset($model_required[$key], array())); @@ -7997,14 +7997,14 @@ public function renderCreateFieldset($id, $fdata, $model, $tab=0) $att['writeParms'] = $writeParms; $text .= $this->renderCreateFieldRow($leftCell, $rightCell, $att); - - - + + + } } - + if(!empty($text) || !empty($hidden_fields)) { @@ -8026,9 +8026,9 @@ public function renderCreateFieldset($id, $fdata, $model, $tab=0) } - + return false; - + } @@ -8163,7 +8163,7 @@ public function renderCreateButtonsBar($fdata, $id=null) // XXX Note model and $ $text .= ' - + '; return $text; @@ -8212,7 +8212,7 @@ public function renderForm($forms, $nocontainer = false) } return $text; } - + /** * Generic renderFieldset solution, will be split to renderTable, renderCol/Row/Box etc - Still in use. */ @@ -8313,7 +8313,7 @@ public function renderFieldset($id, $fdata) '; return $text; } - + /** * Render Value Trigger - override to modify field/value/parameters * @param string $field field name @@ -8323,9 +8323,9 @@ public function renderFieldset($id, $fdata) */ public function renderValueTrigger(&$field, &$value, &$params, $id) { - + } - + /** * Render Element Trigger - override to modify field/value/parameters/validation data * @param string $field field name @@ -8336,7 +8336,7 @@ public function renderValueTrigger(&$field, &$value, &$params, $id) */ public function renderElementTrigger(&$field, &$value, &$params, &$required_data, $id) { - + } } diff --git a/e107_handlers/iphandler_class.php b/e107_handlers/iphandler_class.php index 16253f7c71..2989aa2097 100644 --- a/e107_handlers/iphandler_class.php +++ b/e107_handlers/iphandler_class.php @@ -497,7 +497,7 @@ private function checkIP($addr) foreach ($checkLists as $val) { - if (strpos($addr, $val['ip']) === 0) // See if our address begins with an entry - handles wildcards + if (strpos($addr, (string) $val['ip']) === 0) // See if our address begins with an entry - handles wildcards { // Match found if($this->debug) @@ -532,7 +532,7 @@ private function checkIP($addr) */ private function ip4Encode($ip, $wildCards = FALSE, $div = ':') { - $ipa = explode('.', $ip); + $ipa = explode('.', (string) $ip); $temp = ''; for ($s = 0; $s < 4; $s++) { diff --git a/e107_handlers/js_manager.php b/e107_handlers/js_manager.php index 557bd1166f..787c87580f 100644 --- a/e107_handlers/js_manager.php +++ b/e107_handlers/js_manager.php @@ -796,9 +796,9 @@ public function checkLibDependence($rlocation, $libs = null) foreach($this->_libraries[$this->_dependence] as $inc) { - if(strpos($inc,".css")!==false) + if(strpos((string) $inc,".css")!==false) { - if(strpos($inc,"://")!==false) // cdn + if(strpos((string) $inc,"://")!==false) // cdn { $this->addJs('other_css', $inc, 'all', $opts); @@ -825,9 +825,9 @@ public function checkLibDependence($rlocation, $libs = null) { continue; } - if(strpos($inc,".css")!==false) + if(strpos((string) $inc,".css")!==false) { - if(strpos($inc,"://")!==false) // cdn + if(strpos((string) $inc,"://")!==false) // cdn { $this->addJs('other_css', $inc, 'all', $opts); } @@ -1020,7 +1020,7 @@ protected function addJs($type, $file_path, $runtime_location = '', $opts = arra $loc = $runtime_location; } - $type = (strpos($fp,".css")!==false && $type == 'core') ? "core_css" : $type; + $type = (strpos((string) $fp,".css")!==false && $type == 'core') ? "core_css" : $type; $this->addJs($type, $fp, $loc); @@ -1266,7 +1266,7 @@ public function renderJs($mod, $zone = null, $external = true, $return = false) foreach ($lib as $path) { $erase = array_search($path, $this->_e_jslib_core); - if($erase !== false && strpos($path, 'http') === 0) + if($erase !== false && strpos((string) $path, 'http') === 0) { unset($this->_e_jslib_core[$erase]); $fw[] = $path; @@ -1459,17 +1459,17 @@ public function renderFile($file_path_array, $external = false, $label = '', $mo $lmodified = 0; foreach ($file_path_array as $path) { - if (substr($path, - 4) == '.php') + if (substr((string) $path, - 4) == '.php') { if('css' === $external) { - $path = explode($this->_sep, $path, 4); + $path = explode($this->_sep, (string) $path, 4); $media = $path[0] ? $path[0] : 'all'; // support of IE checks $pre = varset($path[2]) ? $path[2]."\n" : ''; $post = varset($path[3]) ? "\n".$path[3] : ''; $path = $path[1]; - if(strpos($path, 'http') !== 0) + if(strpos((string) $path, 'http') !== 0) { $path = $tp->replaceConstants($path, 'abs').'?external=1'; // &'.$this->getCacheId(); $path = $this->url($path); @@ -1482,9 +1482,9 @@ public function renderFile($file_path_array, $external = false, $label = '', $mo } elseif($external) //true or 'js' { - if(strpos($path, 'http') === 0 || strpos($path, '//') === 0) continue; // not allowed + if(strpos((string) $path, 'http') === 0 || strpos((string) $path, '//') === 0) continue; // not allowed - $path = explode($this->_sep, $path, 3); + $path = explode($this->_sep, (string) $path, 3); $pre = varset($path[1]); if($pre) $pre .= "\n"; $post = varset($path[2]); @@ -1508,7 +1508,7 @@ public function renderFile($file_path_array, $external = false, $label = '', $mo { // CDN fix, ignore URLs inside consolidation script, render as external scripts $isExternal = false; - if(strpos($path, 'http') === 0 || strpos($path, '//') === 0) + if(strpos((string) $path, 'http') === 0 || strpos((string) $path, '//') === 0) { if($external !== 'css') $isExternal = true; } @@ -1520,7 +1520,7 @@ public function renderFile($file_path_array, $external = false, $label = '', $mo if('css' === $external) { - $path = explode($this->_sep, $path, 4); + $path = explode($this->_sep, (string) $path, 4); @@ -1533,7 +1533,7 @@ public function renderFile($file_path_array, $external = false, $label = '', $mo $insertID =''; // issue #3390 Fix for protocol-less path - if(strpos($path, 'http') !== 0 && strpos($path, '//') !== 0) // local file. + if(strpos((string) $path, 'http') !== 0 && strpos((string) $path, '//') !== 0) // local file. { if($label === 'Theme CSS') // add an id for local theme stylesheets. @@ -1559,7 +1559,7 @@ public function renderFile($file_path_array, $external = false, $label = '', $mo continue; } - $path = explode($this->_sep, $path, 4); + $path = explode($this->_sep, (string) $path, 4); $pre = varset($path[1], ''); if($pre) $pre .= "\n"; $post = varset($path[2], ''); @@ -1661,7 +1661,7 @@ private function url($path, $cacheId = true) if(!defined('e_HTTP_STATIC')) { - if(strpos($path,'?')!==false) + if(strpos((string) $path,'?')!==false) { $path .= "&".$this->getCacheId(); } @@ -1709,7 +1709,7 @@ private function isValidUrl($url) */ private function addCache($type,$path) { - if($this->_cache_enabled != true || $this->isInAdmin() || strpos($path, '//') === 0 || strpos($path, 'wysiwyg.php')!==false ) + if($this->_cache_enabled != true || $this->isInAdmin() || strpos((string) $path, '//') === 0 || strpos((string) $path, 'wysiwyg.php')!==false ) { return false; } @@ -1765,7 +1765,7 @@ public function renderCached($type) } - echo "\n\n\n"; + echo "\n\n\n"; if($type == 'js') { @@ -1859,7 +1859,7 @@ private function getCacheFileContent($path, $type) */ private function normalizePath($path) { - $parts = preg_split(":[\\\/]:", $path); // split on known directory separators + $parts = preg_split(":[\\\/]:", (string) $path); // split on known directory separators // resolve relative paths for ($i = 0, $iMax = count($parts); $i < $iMax; $i +=1) @@ -1966,7 +1966,7 @@ function renderInline($content_array, $label = '', $type = 'js') $script = array(); foreach($content_array as $code) { - $start = substr($code,0,7); + $start = substr((string) $code,0,7); if($start == ' $location) { - $path = trim($path, '/'); + $path = trim((string) $path, '/'); if(!$path) continue; @@ -2196,7 +2196,7 @@ public function removeLibPref($mod, $array_removelib) } $core = e107::getConfig(); $plugname = ''; - if(strpos($mod, 'plugin:') === 0) + if(strpos((string) $mod, 'plugin:') === 0) { $plugname = str_replace('plugin:', '', $mod); $mod = 'plugin'; @@ -2223,7 +2223,7 @@ public function removeLibPref($mod, $array_removelib) if(!$libs) $libs = array(); foreach ($array_removelib as $path => $location) { - $path = trim($path, '/'); + $path = trim((string) $path, '/'); if(!$path) continue; unset($libs[$path]); diff --git a/e107_handlers/jslib_handler.php b/e107_handlers/jslib_handler.php index 8c946ce48e..a372863708 100644 --- a/e107_handlers/jslib_handler.php +++ b/e107_handlers/jslib_handler.php @@ -108,44 +108,44 @@ public function renderHeader($where = 'front', $return = false) function getContent() { //global $pref, $eplug_admin, $THEME_JSLIB, $THEME_CORE_JSLIB; - + ob_start(); ob_implicit_flush(0); - + $e_jsmanager = e107::getJs(); - + $lmodified = array(); $e_jsmanager->renderJs('core', null, false); $lmodified[] = $e_jsmanager->getLastModfied('core'); - + $e_jsmanager->renderJs('plugin', null, false); $lmodified[] = $e_jsmanager->getLastModfied('plugin'); - + $e_jsmanager->renderJs('theme', null, false); $lmodified[] = $e_jsmanager->getLastModfied('theme'); - + $lmodified[] = $e_jsmanager->getCacheId(); //e107::getPref('e_jslib_browser_cache', 0) - + // last modification time for loaded files $lmodified = max($lmodified); - + // send content type header('Content-type: text/javascript', true); $this->content_out($lmodified); - + // IT CAUSES GREAT TROUBLES ON SOME BROWSERS! /* if (function_exists('date_default_timezone_set')) { date_default_timezone_set('UTC'); } - + // send last modified date if(deftrue('e_NOCACHE')) header('Cache-Control: must-revalidate', true); if($lmodified) header('Last-modified: '.gmdate("D, d M Y H:i:s", $lmodified).' GMT', true); //if($lmodified) header('Last-modified: '.gmdate('r', $lmodified), true); - + // Expire header - 1 year $time = time()+ 365 * 86400; header('Expires: '.gmdate("D, d M Y H:i:s", $time).' GMT', true); @@ -200,14 +200,14 @@ function content_out($lmodified) $gzdata = "\x1f\x8b\x08\x00\x00\x00\x00\x00"; $size = strlen($contents); $crc = crc32($contents); - + $gzdata .= gzcompress($contents, 9); $gzdata = substr($gzdata, 0, -4); $gzdata .= pack("V", $crc) . pack("V", $size); - + $gsize = strlen($gzdata); $this->set_cache($gzdata, $encoding, $lmodified); - + header('Content-Length: '.$gsize); header('X-Content-size: ' . $size); print($gzdata); @@ -254,7 +254,7 @@ function set_cache($contents, $encoding = '', $lmodified = 0) function browser_enc() { //NEW - option to disable completely gzip compression - if(strpos($_SERVER['QUERY_STRING'], '_nogzip')) + if(strpos((string) $_SERVER['QUERY_STRING'], '_nogzip')) { return ''; } @@ -263,11 +263,11 @@ function browser_enc() { $encoding = ''; } - elseif (strpos($_SERVER["HTTP_ACCEPT_ENCODING"], 'x-gzip') !== false) + elseif (strpos((string) $_SERVER["HTTP_ACCEPT_ENCODING"], 'x-gzip') !== false) { $encoding = 'x-gzip'; } - elseif (strpos($_SERVER["HTTP_ACCEPT_ENCODING"], 'gzip') !== false) + elseif (strpos((string) $_SERVER["HTTP_ACCEPT_ENCODING"], 'gzip') !== false) { $encoding = 'gzip'; } diff --git a/e107_handlers/language_class.php b/e107_handlers/language_class.php index bf4c9db4b9..a5144d0204 100644 --- a/e107_handlers/language_class.php +++ b/e107_handlers/language_class.php @@ -304,7 +304,7 @@ function isValid($lang='') $lang = $pref['adminlanguage']; } - if(strlen($lang)== 2) + if(strlen((string) $lang)== 2) { $iso = $lang; $lang = $this->convert($lang); @@ -346,7 +346,7 @@ function isLangDomain($domain='') } global $pref; - $mtmp = explode("\n", $pref['multilanguage_subdomain']); + $mtmp = explode("\n", (string) $pref['multilanguage_subdomain']); foreach($mtmp as $val) { if($domain == trim($val)) @@ -359,7 +359,7 @@ function isLangDomain($domain='') { foreach($pref['multilanguage_domain'] as $lng=>$val) { - if($domain == trim($val)) + if($domain == trim((string) $val)) { return $lng; } @@ -616,7 +616,7 @@ function set($language = null) if(varset($_COOKIE['e107_language'])!=$this->detect && (defset('MULTILANG_SUBDOMAIN') != TRUE)) { - setcookie('e107_language', $this->detect, time() + 86400, e_HTTP); + setcookie('e107_language', (string) $this->detect, time() + 86400, e_HTTP); $_COOKIE['e107_language'] = $this->detect; // Used only when a user returns to the site. Not used during this session. } else // Multi-lang SubDomains should ignore cookies and remove old ones if they exist. diff --git a/e107_handlers/library_manager.php b/e107_handlers/library_manager.php index dbf724c056..14d6324aab 100755 --- a/e107_handlers/library_manager.php +++ b/e107_handlers/library_manager.php @@ -2334,7 +2334,7 @@ private function parseDependency($dependency) $p_major = '(?P\d+)'; // By setting the minor version to x, branches can be matched. $p_minor = '(?P(?:\d+|x)(?:-[A-Za-z]+\d+)?)'; - $parts = explode('(', $dependency, 2); + $parts = explode('(', (string) $dependency, 2); $value['name'] = trim($parts[0]); if(isset($parts[1])) @@ -2481,7 +2481,7 @@ public function getExcludedLibraries() if($exclude) { // Split string into array and remove whitespaces. - $excludedLibraries = array_map('trim', explode(',', $exclude)); + $excludedLibraries = array_map('trim', explode(',', (string) $exclude)); } } diff --git a/e107_handlers/login.php b/e107_handlers/login.php index 1e4e516aa4..48188aa08d 100644 --- a/e107_handlers/login.php +++ b/e107_handlers/login.php @@ -90,7 +90,7 @@ public function login($username, $userpass, $autologin, $response = '', $noredir $e_event = e107::getEvent(); $_E107 = e107::getE107(); - $username = trim($username); + $username = trim((string) $username); $userpass = trim($userpass); if(!empty($_E107['cli']) && ($username == '')) @@ -177,7 +177,7 @@ public function login($username, $userpass, $autologin, $response = '', $noredir } } - $username = preg_replace("/\sOR\s|\=|\#/", "", $username); + $username = preg_replace("/\sOR\s|\=|\#/", "", (string) $username); // Check secure image if (!$forceLogin && !empty($pref[$this->secImageType]) && extension_loaded('gd')) @@ -324,9 +324,9 @@ public function login($username, $userpass, $autologin, $response = '', $noredir { if (in_array($fk,$class_list)) { // We've found the entry of interest - if (strlen($fp)) + if (strlen((string) $fp)) { - if (strpos($fp, 'http') === FALSE) + if (strpos((string) $fp, 'http') === FALSE) { $fp = str_replace(e_HTTP, '', $fp); // This handles sites in a subdirectory properly (normally, will replace nothing) $fp = SITEURL.$fp; @@ -405,7 +405,7 @@ protected function lookupUser($username, $forceLogin) // User is in DB here $this->userData = e107::getDb()->fetch(); // Get user info - $this->userData['user_perms'] = trim($this->userData['user_perms']); + $this->userData['user_perms'] = trim((string) $this->userData['user_perms']); $this->lookEmail = ($username == $this->userData['user_email']) ? 1 : 0; // Know whether login name or email address used now return TRUE; @@ -421,7 +421,7 @@ public function getLookupQuery($username, $forceLogin, $dbAlias = '') $pref = e107::getPref(); $tp = e107::getParser(); - $username = preg_replace("/\sOR\s|\=|\#/", "", $username); + $username = preg_replace("/\sOR\s|\=|\#/", "", (string) $username); if($forceLogin === 'provider') { diff --git a/e107_handlers/magpie_rss.php b/e107_handlers/magpie_rss.php index 45c2ec3d1f..5ee5e2d221 100644 --- a/e107_handlers/magpie_rss.php +++ b/e107_handlers/magpie_rss.php @@ -124,7 +124,7 @@ function __construct ($source, $output_encoding = CHARSET, xml_set_character_data_handler( $this->parser, 'feed_cdata' ); - $status = xml_parse( $this->parser, $source ); + $status = xml_parse( $this->parser, (string) $source ); if (! $status ) { $errorcode = xml_get_error_code( $this->parser ); @@ -150,7 +150,7 @@ function __construct ($source, $output_encoding = CHARSET, * @return void */ function feed_start_element($p, $element, $attrs) { - $el = $element = strtolower($element); + $el = $element = strtolower((string) $element); $attrs = array_change_key_case($attrs, CASE_LOWER); // check for a namespace, and split if found @@ -285,7 +285,7 @@ function feed_cdata ($p, $text) { * @return void */ function feed_end_element ($p, $el) { - $el = strtolower($el); + $el = strtolower((string) $el); if ( $el == 'item' or $el == 'entry' ) { @@ -542,7 +542,7 @@ function php4_create_parser($source, $in_enc, $detect) { } if (!$in_enc) { - if (preg_match('//m', $source, $m)) { + if (preg_match('//m', (string) $source, $m)) { $in_enc = strtoupper($m[1]); $this->source_encoding = $in_enc; } @@ -562,7 +562,7 @@ function php4_create_parser($source, $in_enc, $detect) { // @see http://php.net/iconv if (function_exists('iconv')) { - $encoded_source = iconv($in_enc,'UTF-8', $source); + $encoded_source = iconv((string) $in_enc,'UTF-8', (string) $source); if ($encoded_source) { return array(xml_parser_create('UTF-8'), $encoded_source); } @@ -590,7 +590,7 @@ function php4_create_parser($source, $in_enc, $detect) { * @return false|string */ function known_encoding($enc) { - $enc = strtoupper($enc); + $enc = strtoupper((string) $enc); if ( in_array($enc, $this->_KNOWN_ENCODINGS) ) { return $enc; } @@ -645,7 +645,7 @@ function parse_w3cdtf ($date_str ) { # regex to match wc3dtf $pat = "/(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(:(\d{2}))?(?:([-+])(\d{2}):?(\d{2})|(Z))?/"; - if ( preg_match( $pat, $date_str, $match ) ) { + if ( preg_match( $pat, (string) $date_str, $match ) ) { list( $year, $month, $day, $hours, $minutes, $seconds) = array( $match[1], $match[2], $match[3], $match[4], $match[5], $match[6]); diff --git a/e107_handlers/mail.php b/e107_handlers/mail.php index 67e523f3c1..374513e100 100644 --- a/e107_handlers/mail.php +++ b/e107_handlers/mail.php @@ -236,9 +236,9 @@ public function __construct($overrides = false) } } - if(strpos($overrides['smtp_server'],':')!== false) + if(strpos((string) $overrides['smtp_server'],':')!== false) { - list($smtpServer,$smtpPort) = explode(":", $overrides['smtp_server']); + list($smtpServer,$smtpPort) = explode(":", (string) $overrides['smtp_server']); $overrides['smtp_server'] = $smtpServer; } else @@ -251,7 +251,7 @@ public function __construct($overrides = false) $this->pause_time = varset($pref['mail_pausetime'], 1); $this->allow_html = varset($pref['mail_sendstyle'],'textonly') == 'texthtml' ? true : 1; - if (vartrue($pref['mail_options'])) $this->general_opts = explode(',',$pref['mail_options'],''); + if (vartrue($pref['mail_options'])) $this->general_opts = explode(',',(string) $pref['mail_options'],''); if ($this->debug) { @@ -260,7 +260,7 @@ public function __construct($overrides = false) foreach ($this->general_opts as $k => $v) { - $v = trim($v); + $v = trim((string) $v); $this->general_opts[$k] = $v; if (strpos($v,'hostname') === 0) { @@ -270,13 +270,13 @@ public function __construct($overrides = false) } } - list($this->logEnable,$this->add_email) = explode(',',varset($pref['mail_log_options'],'0,0')); + list($this->logEnable,$this->add_email) = explode(',',(string) varset($pref['mail_log_options'],'0,0')); switch ($overrides['mailer']) { case 'smtp' : $smtp_options = array(); - $temp_opts = explode(',',varset($pref['smtp_options'],'')); + $temp_opts = explode(',',(string) varset($pref['smtp_options'],'')); if (vartrue($overrides ['smtp_pop3auth'])) $temp_opts[] = 'pop3auth'; // Legacy option - remove later if (vartrue($pref['smtp_keepalive'])) $temp_opts[] = 'keepalive'; // Legacy option - remove later foreach ($temp_opts as $k=>$v) @@ -630,22 +630,22 @@ public function makeBody($message,$want_HTML = 1, $add_HTML_header = false) // !preg_match('/<(table|div|font|br|a|img|b)/i', $message) if ($this->legacyBody && e107::getParser()->isHtml($message) != true) // Assume html if it includes one of these tags { // Otherwise assume its a plain text message which needs some conversion to render in HTML - + if($this->debug == true) { echo 'Running legacyBody mode
'; } - + $message = htmlspecialchars($message,ENT_QUOTES,$this->CharSet); $message = preg_replace('%(http|ftp|https)(://\S+)%', '\1\2', $message); - $message = preg_replace('/([[:space:]()[{}])(www.[-a-zA-Z0-9@:%_\+.~#?&\/=]+)/i', '\\1\\2', $message); - $message = preg_replace('/([_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,3})/i', '\\1', $message); + $message = preg_replace('/([[:space:]()[{}])(www.[-a-zA-Z0-9@:%_\+.~#?&\/=]+)/i', '\\1\\2', (string) $message); + $message = preg_replace('/([_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,3})/i', '\\1', (string) $message); $message = str_replace("\r\n","\n",$message); // Handle alternative newline characters $message = str_replace("\n\r","\n",$message); // Handle alternative newline characters $message = str_replace("\r","\n",$message); // Handle alternative newline characters $message = str_replace("\n", "
\n", $message); } - + $this->MsgHTML($message); // Theoretically this should do everything, including handling of inline images. @@ -664,7 +664,7 @@ public function makeBody($message,$want_HTML = 1, $add_HTML_header = false) $text = str_replace('
', "\n", $text); $text = strip_tags(str_replace('
', "\n", $text)); - + // TODO: strip bbcodes here $this->Body = $text; @@ -691,7 +691,7 @@ public function attach($attachments) foreach($attachments as $attach) { - $tempName = basename($attach); + $tempName = basename((string) $attach); if(is_readable($attach) && $tempName) // First parameter is complete path + filename; second parameter is 'name' of file to send { if($this->previewMode === true) @@ -812,11 +812,11 @@ function processShortcodes($eml) $mediaParms = array(); - if(strpos($eml['templateHTML']['body'], '{MEDIA') !==false ) + if(strpos((string) $eml['templateHTML']['body'], '{MEDIA') !==false ) { // check for media sizing. - if(preg_match_all('/\{MEDIA([\d]): w=([\d]*)\}/', $eml['templateHTML']['body'], $match)) + if(preg_match_all('/\{MEDIA([\d]): w=([\d]*)\}/', (string) $eml['templateHTML']['body'], $match)) { foreach($match[1] as $k=>$num) @@ -890,18 +890,18 @@ public function arraySet($eml) { $tp = e107::getParser(); $tmpl = null; - + // Cleanup legacy key names. ie. remove 'email_' prefix. foreach($eml as $k=>$v) { - if(substr($k,0,6) == 'email_') + if(substr((string) $k,0,6) == 'email_') { - $nkey = substr($k,6); + $nkey = substr((string) $k,6); $eml[$nkey] = $v; unset($eml[$k]); } } - + if(!empty($eml['template'])) // @see e107_core/templates/email_template.php @@ -933,11 +933,11 @@ public function arraySet($eml) $eml['shortcodes']['_WRAPPER_'] = 'email/'.$eml['template']; } $emailBody = varset($tmpl['header']). str_replace('{BODY}', $eml['body'], $tmpl['body']) . varset($tmpl['footer']); - + $eml['body'] = $tp->parseTemplate($emailBody, true, $eml['shortcodes']); - + // $eml['body'] = ($tp->toEmail($tmpl['header']). str_replace('{BODY}', $eml['body'], $tmpl['body']). $tp->toEmail($tmpl['footer'])); - + if($this->debug) { // echo "

e107Email::arraySet() - line ".__LINE__."

"; @@ -946,9 +946,9 @@ public function arraySet($eml) var_dump($this->Subject); // print_a($tmpl); } - + unset($eml['add_html_header']); // disable other headers when template is used. - + $this->Subject = $tp->parseTemplate(varset($tmpl['subject'],'{SUBJECT}'), true, varset($eml['shortcodes'],null)); if($this->debug) @@ -963,11 +963,11 @@ public function arraySet($eml) echo "

Couldn't find email template: ".print_r($eml['template'],true)."

"; } // $emailBody = $eml['body']; - + if (vartrue($eml['subject'])) $this->Subject = $tp->parseTemplate($eml['subject'], true, varset($eml['shortcodes'],null)); e107::getMessage()->addDebug("Couldn't find email template: ".$eml['template']); } - + } else { @@ -1022,7 +1022,7 @@ public function arraySet($eml) $this->Sender = $eml['bouncepath']; // Bounce path $this->save_bouncepath = $eml['bouncepath']; // Bounce path } - + if (!empty($eml['extra_header'])) { if (is_array($eml['extra_header'])) @@ -1110,10 +1110,10 @@ public function sendEmail($send_to, $to_name, $eml = array(), $bulkmail = false) } - if (($bulkmail == true) && $this->localUseVerp && $this->save_bouncepath && (strpos($this->save_bouncepath,'@') !== false)) + if (($bulkmail == true) && $this->localUseVerp && $this->save_bouncepath && (strpos((string) $this->save_bouncepath,'@') !== false)) { // Format where sender is owner@origin, target is user@domain is: owner+user=domain@origin - list($our_sender,$our_domain) = explode('@', $this->save_bouncepath,2); + list($our_sender,$our_domain) = explode('@', (string) $this->save_bouncepath,2); if ($our_sender && $our_domain) { $this->Sender = $our_sender.'+'.str_replace($send_to,'@','=').'@'.$our_domain; @@ -1268,7 +1268,7 @@ public function MsgHTML($message, $basedir = '', $advanced = false) $message = $tp->toEmail($message, false, 'rawtext'); - preg_match_all("/(src|background)=([\"\'])(.*)\\2/Ui", $message, $images); // Modified to accept single quotes as well + preg_match_all("/(src|background)=([\"\'])(.*)\\2/Ui", (string) $message, $images); // Modified to accept single quotes as well if(isset($images[3]) && ($this->previewMode === false)) { @@ -1342,7 +1342,7 @@ public function MsgHTML($message, $basedir = '', $advanced = false) try { $this->addEmbeddedImage($basedir.$directory.$filename, md5($filename), $filename, 'base64',$mimeType); - $message = preg_replace("/".$images[1][$i]."=".$delim.preg_quote($images[3][$i], '/').$delim."/Ui", $images[1][$i]."=".$delim.$cid.$delim, $message); + $message = preg_replace("/".$images[1][$i]."=".$delim.preg_quote($images[3][$i], '/').$delim."/Ui", $images[1][$i]."=".$delim.$cid.$delim, (string) $message); } catch (Exception $e) { diff --git a/e107_handlers/mail_manager_class.php b/e107_handlers/mail_manager_class.php index f36a93d59e..1542abf224 100644 --- a/e107_handlers/mail_manager_class.php +++ b/e107_handlers/mail_manager_class.php @@ -1726,7 +1726,7 @@ public function selectEmailStatus($start = 0, $count = 0, $fields = '*', $filter } if ($sortOrder) { - $sortOrder = strtoupper($sortOrder); + $sortOrder = strtoupper((string) $sortOrder); $query .= ($sortOrder == 'DESC') ? ' DESC' : ' ASC'; } if ($count) @@ -1804,7 +1804,7 @@ public function selectTargetStatus($handle, $start = 0, $count = 0, $fields = '* } if ($sortOrder) { - $sortOrder = strtoupper($sortOrder); + $sortOrder = strtoupper((string) $sortOrder); $query .= ($sortOrder == 'DESC') ? ' DESC' : ' ASC'; } if ($count) @@ -1932,14 +1932,14 @@ public function sendEmails($templateName, $emailData, $recipientData, $options = $templateName = varset($emailData['mail_send_style'], 'textonly'); // Safest default if nothing specified } - $templateName = trim($templateName); + $templateName = trim((string) $templateName); if ($templateName == '') { return false; } $this->currentMailBody = $emailData['mail_body']; // In case we send immediately - $this->currentTextBody = strip_tags($emailData['mail_body']); + $this->currentTextBody = strip_tags((string) $emailData['mail_body']); // $emailData['mail_body_templated'] = $ourTemplate->mainBodyText; // $emailData['mail_body_alt'] = $ourTemplate->altBodyText; diff --git a/e107_handlers/mail_template_class.php b/e107_handlers/mail_template_class.php index 58fd918cb2..66f77265cf 100644 --- a/e107_handlers/mail_template_class.php +++ b/e107_handlers/mail_template_class.php @@ -92,7 +92,7 @@ public function setNewTemplate($newTemplate) public function loadTemplateInfo($templateName, $extraFile = FALSE) { static $requiredFields = array ('email_overrides', 'email_header', 'email_body', 'email_footer', 'email_plainText'); - + if (is_array($this->lastTemplateData)) { if ($this->lastTemplateData['template_name'] == $templateName) @@ -106,7 +106,7 @@ public function loadTemplateInfo($templateName, $extraFile = FALSE) if (!in_array($templateName, array('textonly', 'texthtml', 'texttheme'))) { $found = 0; // Count number of field definitions we've found - + $fileList = array(THEME.'templates/email_template.php'); if ($extraFile) { @@ -151,7 +151,7 @@ public function loadTemplateInfo($templateName, $extraFile = FALSE) { foreach ($requiredFields as $k) { - $override = strtoupper($k); + $override = strtoupper((string) $k); if (!$ret[$k] && isset($$override)) { $ret[$k] = $$override; diff --git a/e107_handlers/mail_validation_class.php b/e107_handlers/mail_validation_class.php index ae31cb92f1..30e4682f26 100644 --- a/e107_handlers/mail_validation_class.php +++ b/e107_handlers/mail_validation_class.php @@ -37,20 +37,20 @@ class email_validation_class */ Function Tokenize($string, $separator="") { - if(!strcmp($separator,"")) + if(!strcmp((string) $separator,"")) { $separator=$string; $string=$this->next_token; } - for($character=0, $characterMax = strlen($separator); $character< $characterMax; $character++) + for($character=0, $characterMax = strlen((string) $separator); $character< $characterMax; $character++) { - if(GetType($position=strpos($string,$separator[$character]))=="integer") + if(GetType($position=strpos((string) $string,(string) $separator[$character]))=="integer") $found=(IsSet($found) ? min($found,$position) : $position); } if(IsSet($found)) { - $this->next_token=substr($string,$found+1); - return(substr($string,0,$found)); + $this->next_token=substr((string) $string,$found+1); + return(substr((string) $string,0,$found)); } else { @@ -116,14 +116,14 @@ class email_validation_class if(IsSet($this->preg)) { if(strlen($this->preg)) - return(preg_match($this->preg,$email)); + return(preg_match($this->preg,(string) $email)); } else { $this->preg=(function_exists("preg_match") ? "/".str_replace("/", "\\/", $this->email_regular_expression)."/" : ""); return($this->ValidateEmailAddress($email)); } - return(preg_match("/".str_replace("/", "\\/", $this->email_regular_expression)."/i", $email)/*!=0*/); + return(preg_match("/".str_replace("/", "\\/", $this->email_regular_expression)."/i", (string) $email)/*!=0*/); } /** @@ -151,8 +151,8 @@ class email_validation_class } else { - if(strcmp($ip=@gethostbyname($domain),$domain) - && (strlen($this->exclude_address)==0 + if(strcmp($ip=@gethostbyname($domain),(string) $domain) + && (strlen((string) $this->exclude_address)==0 || strcmp(@gethostbyname($this->exclude_address),$ip))) $hosts[]=$domain; } @@ -169,9 +169,9 @@ class email_validation_class while(($line=$this->GetLine($connection))) { $this->last_code=$this->Tokenize($line," -"); - if(strcmp($this->last_code,$code)) + if(strcmp((string) $this->last_code,(string) $code)) return(0); - if(!strcmp(substr($line, strlen($this->last_code), 1)," ")) + if(!strcmp(substr((string) $line, strlen((string) $this->last_code), 1)," ")) return(1); } return(-1); @@ -185,32 +185,32 @@ class email_validation_class { if(!$this->ValidateEmailHost($email,$hosts)) return(0); - if(!strcmp($localhost=$this->localhost,"") + if(!strcmp((string) $localhost=$this->localhost,"") && !strcmp($localhost=getenv("SERVER_NAME"),"") && !strcmp($localhost=getenv("HOST"),"")) $localhost="localhost"; - if(!strcmp($localuser=$this->localuser,"") + if(!strcmp((string) $localuser=$this->localuser,"") && !strcmp($localuser=getenv("USERNAME"),"") && !strcmp($localuser=getenv("USER"),"")) $localuser="root"; for($host=0, $hostMax = count($hosts); $host< $hostMax; $host++) { $domain=$hosts[$host]; - if(preg_match('/^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$/',$domain)) + if(preg_match('/^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$/',(string) $domain)) $ip=$domain; else { if($this->debug) $this->OutputDebug("Resolving host name \"".$hosts[$host]."\"..."); - if(!strcmp($ip=@gethostbyname($domain),$domain)) + if(!strcmp($ip=@gethostbyname($domain),(string) $domain)) { if($this->debug) $this->OutputDebug("Could not resolve host name \"".$hosts[$host]."\"."); continue; } } - if(strlen($this->exclude_address) - && !strcmp(@gethostbyname($this->exclude_address),$ip)) + if(strlen((string) $this->exclude_address) + && !strcmp(@gethostbyname($this->exclude_address),(string) $ip)) { if($this->debug) $this->OutputDebug("Host address of \"".$hosts[$host]."\" is the exclude address"); @@ -241,8 +241,8 @@ class email_validation_class } else { - if(strlen($this->last_code) - && !strcmp($this->last_code[0],"4")) + if(strlen((string) $this->last_code) + && !strcmp((string) $this->last_code[0],"4")) $result=-1; } if($this->debug) diff --git a/e107_handlers/mailout_admin_class.php b/e107_handlers/mailout_admin_class.php index f3c42ec7fd..8bc76ce0a3 100644 --- a/e107_handlers/mailout_admin_class.php +++ b/e107_handlers/mailout_admin_class.php @@ -338,7 +338,7 @@ public function __construct($mode = '') } if (isset($_GET['asc'])) { - $temp = strtolower(e107::getParser()->toDB($_GET['asc'])); + $temp = strtolower((string) e107::getParser()->toDB($_GET['asc'])); if (($temp == 'asc') || ($temp == 'desc')) { $this->sortOrder = $temp; @@ -571,7 +571,7 @@ public function loadMailHandlers($options = 'all') $ret = 0; $toLoad = explode(',', $options); - $active_mailers = explode(',', varset($pref['mailout_enabled'], 'user')); + $active_mailers = explode(',', (string) varset($pref['mailout_enabled'], 'user')); //if((in_array('core', $toLoad) || ($options == 'all')) && in_array('core', $active_mailers)) // { @@ -799,7 +799,7 @@ public function ret_extended_field_list($list_name, $curval = '', $add_blank = f { $value = 'ue.user_' . $fd['user_extended_struct_name']; $selected = ($value == $curval) ? " selected='selected'" : ''; - $ret .= "\n"; + $ret .= "\n"; } } $ret .= "\n"; @@ -826,7 +826,7 @@ public function parseEmailPost($newMail = true) 'mail_sender_name' => $_POST['email_from_name'], 'mail_copy_to' => $_POST['email_cc'], 'mail_bcopy_to' => $_POST['email_bcc'], - 'mail_attach' => trim($_POST['email_attachment']), + 'mail_attach' => trim((string) $_POST['email_attachment']), 'mail_send_style' => varset($_POST['email_send_style'], 'textonly'), 'mail_include_images' => (isset($_POST['email_include_images']) ? 1 : 0) ); @@ -865,23 +865,23 @@ public function checkEmailPost(&$email, $fullCheck = false) return $errList; } - if (!trim($email['mail_subject'])) + if (!trim((string) $email['mail_subject'])) { $errList[] = LAN_MAILOUT_200; } - if (!trim($email['mail_body'])) + if (!trim((string) $email['mail_body'])) { $errList[] = LAN_MAILOUT_202; } - if (!trim($email['mail_sender_name'])) + if (!trim((string) $email['mail_sender_name'])) { $errList[] = LAN_MAILOUT_203; } - if (!trim($email['mail_sender_email'])) + if (!trim((string) $email['mail_sender_email'])) { $errList[] = LAN_MAILOUT_204; } - if (strlen($email['mail_send_style']) == 0) + if (strlen((string) $email['mail_send_style']) == 0) { // Can be a template name now $errList[] = LAN_MAILOUT_205; @@ -976,7 +976,7 @@ public function showMailDetail(&$mailSource, $options = 'basic') break; case 'chars': // Show generated html as is - $text .= htmlspecialchars($val, ENT_COMPAT, 'UTF-8'); + $text .= htmlspecialchars((string) $val, ENT_COMPAT, 'UTF-8'); break; case 'contentstatus': $text .= $this->statusToText($val); @@ -2200,7 +2200,7 @@ public static function mailerPrefsTable($pref, $id = 'mailer') $mailers = array('php' => 'php', 'smtp' => 'smtp', 'sendmail' => 'sendmail'); - $smtp_opts = explode(',', varset($pref['smtp_options'], '')); + $smtp_opts = explode(',', (string) varset($pref['smtp_options'], '')); $smtpdisp = ($pref[$id] != 'smtp') ? "style='display:none;'" : ''; $text = $frm->select($id, $mailers, $pref[$id]) . " diff --git a/e107_handlers/mailout_class.php b/e107_handlers/mailout_class.php index 7d90ce2681..f9b6ab0374 100644 --- a/e107_handlers/mailout_class.php +++ b/e107_handlers/mailout_class.php @@ -154,9 +154,9 @@ public function selectInit($selectVals = FALSE) { foreach(array(':', '-', ',') as $sep) { - if (strpos($selectVals['last_visit_date'], ':')) + if (strpos((string) $selectVals['last_visit_date'], ':')) { - $tmp = explode($sep, $selectVals['last_visit_date']); + $tmp = explode($sep, (string) $selectVals['last_visit_date']); break; } } diff --git a/e107_handlers/media_class.php b/e107_handlers/media_class.php index 7568365c17..1d1eeb2073 100644 --- a/e107_handlers/media_class.php +++ b/e107_handlers/media_class.php @@ -832,7 +832,7 @@ public function mediaSelect($category='',$tagid=null,$att=null) foreach($images as $im) { - list($dbWidth,$dbHeight) = explode(" x ",$im['media_dimensions']); + list($dbWidth,$dbHeight) = explode(" x ",(string) $im['media_dimensions']); unset($dbHeight); $w = ($dbWidth > $defaultResizeWidth) ? $defaultResizeWidth : intval($dbWidth); @@ -1127,7 +1127,7 @@ function getGlyphs($type, $addPrefix = '') elseif(!empty($pattern) && !empty($path)) { $pattern = '/'.$pattern.'/'; - if(strpos($path, 'http') === 0) + if(strpos((string) $path, 'http') === 0) { $subject = e107::getFile()->getRemoteContent($path); } @@ -1142,7 +1142,7 @@ function getGlyphs($type, $addPrefix = '') } - $prefixLength = !empty($prefix) ? strlen($prefix) : 3; + $prefixLength = !empty($prefix) ? strlen((string) $prefix) : 3; if(!empty($pattern) && !empty($subject)) { @@ -1498,7 +1498,7 @@ public function checkFileExtension($path, $mime) $len = strlen($ext); - if($ext && (substr($path,- $len) != $ext)) + if($ext && (substr((string) $path,- $len) != $ext)) { return $path.$ext; } @@ -1535,7 +1535,7 @@ private function browserCarouselItemSelector($data) $style = varset($data['style']); $class = varset($data['class']); - $dataPreview = !empty($data['previewHtml']) ? base64_encode($data['previewHtml']) : ''; + $dataPreview = !empty($data['previewHtml']) ? base64_encode((string) $data['previewHtml']) : ''; return ""; @@ -1725,7 +1725,7 @@ function browserIndicators($slides, $uniqueID) */ function getThumb($id) { - $id = trim($id); + $id = trim((string) $id); $filename = 'temp/thumb-'.md5($id).".jpg"; $filepath = e_MEDIA.$filename; @@ -2137,7 +2137,7 @@ public function processAjaxUpload() // Clean the fileName for security reasons - $fileName = preg_replace('/[^\w\._]+/', '_', $fileName); + $fileName = preg_replace('/[^\w\._]+/', '_', (string) $fileName); // $array = array("jsonrpc" => "2.0", "error" => array('code'=>$_FILES['file']['error'], 'message'=>'Failed to move file'), "id" => "id", 'data'=>$_FILES ); @@ -2204,7 +2204,7 @@ public function processAjaxUpload() } // Handle non multipart uploads older WebKit versions didn't support multipart in HTML5 - if(strpos($contentType, "multipart") !== false) + if(strpos((string) $contentType, "multipart") !== false) { if(isset($_FILES['file']['tmp_name']) && is_uploaded_file($_FILES['file']['tmp_name'])) { @@ -2377,7 +2377,7 @@ public function processAjaxImport($filePath, $request = array()) if(!empty($request['rename'])) { - $newPath = $targetDir.basename($request['rename']); + $newPath = $targetDir.basename((string) $request['rename']); if(!rename($filePath, $newPath)) { return '{"jsonrpc" : "2.0", "error" : {"code": 105, "message": "Unable to rename '.$filePath.' to '.$newPath.'"}, "id" : "id"}'; diff --git a/e107_handlers/menu_class.php b/e107_handlers/menu_class.php index d6df180fd8..b705403d77 100644 --- a/e107_handlers/menu_class.php +++ b/e107_handlers/menu_class.php @@ -88,7 +88,7 @@ public function init() $converted = $this->convertMenuTable(); e107::getConfig()->set('menu_layouts', $converted)->save(); } - + $eMenuArea = $this->getData(THEME_LAYOUT); //print_a($eMenuArea); } @@ -279,10 +279,10 @@ public function updateParms($id, $parms) $model->load($id, true); $menu_path = $model->get('menu_path'); - $menu_path = rtrim($menu_path, '/'); + $menu_path = rtrim((string) $menu_path, '/'); $menu_name = $model->get('menu_name'); - $menu_name = substr($menu_name,0,-5); + $menu_name = substr((string) $menu_name,0,-5); if(!$obj = e107::getAddon($menu_path,'e_menu')) { @@ -504,7 +504,7 @@ protected function isVisible($row, $url = '') $tp = e107::getParser(); if($row['menu_pages']) { - list ($listtype, $listpages) = explode("-", $row['menu_pages'], 2); + list ($listtype, $listpages) = explode("-", (string) $row['menu_pages'], 2); $pagelist = explode("|", $listpages); // TODO - check against REQUEST_URI, see what would get broken $check_url = $url ? $url : ($_SERVER['REQUEST_URI'] ? SITEURLBASE.$_SERVER['REQUEST_URI'] : e_SELF.(e_QUERY ? "?".e_QUERY : '')); @@ -526,13 +526,13 @@ protected function isVisible($row, $url = '') if(substr($p, -1)==='!') { $p = substr($p, 0, -1); - if(substr($check_url, strlen($p)*-1) == $p) + if(substr((string) $check_url, strlen($p)*-1) == $p) { $show_menu = true; break 2; } } - elseif(strpos($check_url, $p) !== false) + elseif(strpos((string) $check_url, $p) !== false) { $show_menu = true; break 2; @@ -554,13 +554,13 @@ protected function isVisible($row, $url = '') if(substr($p, -1) === '!') { $p = substr($p, 0, -1); - if(substr($check_url, strlen($p)*-1) == $p) + if(substr((string) $check_url, strlen($p)*-1) == $p) { $show_menu = false; break 2; } } - elseif(strpos($check_url, $p) !== false) + elseif(strpos((string) $check_url, $p) !== false) { $show_menu = false; break 2; diff --git a/e107_handlers/menumanager_class.php b/e107_handlers/menumanager_class.php index f3175929dd..7fe2565883 100644 --- a/e107_handlers/menumanager_class.php +++ b/e107_handlers/menumanager_class.php @@ -271,7 +271,7 @@ function menuGrabLayout() $FOOTER = array(); foreach($LAYOUT as $key=>$template) { - $tmp = explode("{---}",$template); + $tmp = explode("{---}",(string) $template); $hd = varset($tmp[0]); $ft = varset($tmp[1]); @@ -280,7 +280,7 @@ function menuGrabLayout() } unset($hd,$ft); } - + if(($this->curLayout == 'legacyCustom' || $this->curLayout=='legacyDefault') && (isset($CUSTOMHEADER) || isset($CUSTOMFOOTER)) ) // 0.6 themes. { if($this->curLayout == 'legacyCustom') @@ -333,7 +333,7 @@ function menuGoConfig() return; } - $file = urldecode($_GET['path']).".php"; + $file = urldecode((string) $_GET['path']).".php"; $file = e107::getParser()->filter($file); $newurl = e_PLUGIN_ABS.$file."?id=".intval($_GET['id']).'&iframe=1'; @@ -365,7 +365,7 @@ function menuModify() { foreach($_POST['menuAct'] as $k => $v) { - if(trim($v)) + if(trim((string) $v)) { $value = $tp->filter($_POST['menuAct'][$k]); $this->menuId = intval($k); @@ -615,7 +615,7 @@ public function menuScanMenus() $sql->select("menus", "*", "menu_path NOT REGEXP('[0-9]+') "); while(list($menu_id, $menu_name, $menu_location, $menu_order) = $sql->fetch('num')) { - if(stripos($menustr, $menu_name) === false) + if(stripos((string) $menustr, (string) $menu_name) === false) { $sql2->delete("menus", "menu_name='$menu_name'"); $message .= MENLAN_11 . " - " . $menu_name . "
"; @@ -725,7 +725,7 @@ function menuInstanceParameters() if(file_exists(e_PLUGIN.$row['menu_path']."e_menu.php")) // v2.x new e_menu.php { - $plug = rtrim($row['menu_path'],'/'); + $plug = rtrim((string) $row['menu_path'],'/'); $obj = e107::getAddon($plug,'e_menu'); @@ -737,7 +737,7 @@ function menuInstanceParameters() } else { - $menuName = substr($row['menu_name'],0,-5); + $menuName = substr((string) $row['menu_name'],0,-5); } $menuName = varset($menuName); @@ -845,19 +845,19 @@ function menuVisibilityOptions() $frm = e107::getForm(); $tp = e107::getParser(); - + require_once(e_HANDLER."userclass_class.php"); - + if(!$sql->select("menus", "*", "menu_id=".intval($_GET['vis']))) { $this->menuAddMessage(MENLAN_48,E_MESSAGE_ERROR); return; } - + $row = $sql->fetch(); - - $listtype = substr($row['menu_pages'], 0, 1); - $menu_pages = substr($row['menu_pages'], 2); + + $listtype = substr((string) $row['menu_pages'], 0, 1); + $menu_pages = substr((string) $row['menu_pages'], 2); $menu_pages = str_replace("|", "\n", $menu_pages); $text = "
@@ -875,45 +875,45 @@ function menuVisibilityOptions()
"; $checked = ($listtype == 1) ? " checked='checked' " : ""; - + $text .= $frm->radio('listtype', 1, $checked, array('label'=>$tp->toHTML(MENLAN_26,true), 'class'=> 'e-save')); $text .= "
"; // $text .= " ".MENLAN_26."
"; $checked = ($listtype == 2) ? " checked='checked' " : ""; - + $text .= $frm->radio('listtype', 2, $checked, array('label'=> $tp->toHTML(MENLAN_27,true), 'class'=> 'e-save')); - - + + // $text .= " ".MENLAN_27."
"; - + $text .= "
- +
- +
".MENLAN_28."
"; - + $text .= $frm->hidden('mode','visibility'); $text .= $frm->hidden('menu_id',intval($_GET['vis'])); // ""; - + /* $text .= "
"; $text .= $frm->admin_button('class_submit', MENLAN_6, 'update'); - +
"; */ $text .= "
"; - - + + return $text; //$caption = MENLAN_7." ".$row['menu_name']; //$ns->tablerender($caption, $text); @@ -982,7 +982,7 @@ function menuSetCustomPages($array) { $pref = e107::getPref(); $key = key($array); - $pref['sitetheme_custompages'][$key] = array_filter(explode(" ",$array[$key])); + $pref['sitetheme_custompages'][$key] = array_filter(explode(" ",(string) $array[$key])); save_prefs(); } @@ -1127,7 +1127,7 @@ function menuSaveVisibility() // Used by Ajax if($sql->update("menus", "menu_class='".intval($_POST['menu_class'])."', menu_pages='{$pageparms}' WHERE menu_id=".intval($_POST['menu_id']))) { e107::getLog()->add('MENU_02',$_POST['menu_class'].'[!br!]'.$pageparms.'[!br!]'.$this->menuId,E_LOG_INFORMATIVE,''); - + return array('msg'=>LAN_UPDATED, 'error'=> false); //$this->menuAddMessage($message,E_MESSAGE_SUCCESS); } @@ -1253,7 +1253,7 @@ function renderOptionRow($row) else { $menuPreset = varset($menuPreset); - $row['menu_name'] = preg_replace("#_menu$#i", "", $row['menu_name']); + $row['menu_name'] = preg_replace("#_menu$#i", "", (string) $row['menu_name']); if($pnum = $this->checkMenuPreset($menuPreset,$row['menu_name'].'_menu')) { $pdeta = MENLAN_39." {$pnum}"; @@ -1262,7 +1262,7 @@ function renderOptionRow($row) if(!$this->dragDrop) { - $menuInf = (!is_numeric($row['menu_path'])) ? ' ('.substr($row['menu_path'],0,-1).')' : " ( #".$row['menu_path']." )"; + $menuInf = (!is_numeric($row['menu_path'])) ? ' ('.substr((string) $row['menu_path'],0,-1).')' : " ( #".$row['menu_path']." )"; // $menuInf = $row['menu_path']; $text .= " @@ -1301,7 +1301,7 @@ function menuRenderPage() // echo "
"; $this->parseheader($HEADER); // $layouts_str; - + $layout = ($this->curLayout); $menuPreset = $this->getMenuPreset(); @@ -1315,8 +1315,8 @@ function menuRenderPage() ...".MENLAN_37.""; $text .= ""; - - + + @@ -1337,7 +1337,7 @@ function menuRenderPage() $pluginMenu = array(); $done = array(); - + $sql->select("menus", "menu_name, menu_id, menu_pages, menu_path", "1 ORDER BY menu_name ASC"); while ($row = $sql->fetch()) { @@ -1357,7 +1357,7 @@ function menuRenderPage() { $pluginMenu[] = $row; } - + } $text .= "".MENLAN_49.""; @@ -1366,7 +1366,7 @@ function menuRenderPage() { $text .= $this->renderOptionRow($row); } - + $text .= "".MENLAN_50.""; foreach($pluginMenu as $row) { @@ -1379,7 +1379,7 @@ function menuRenderPage() $text .= "
"; foreach ($this->menu_areas as $menu_act) { - $text .= "

\n"; + $text .= "

\n"; } @@ -1401,13 +1401,13 @@ function menuRenderPage() { $text = "
"; } // $ns -> tablerender(MENLAN_22.'blabla', $text); @@ -1493,7 +1493,7 @@ function parseheader($LAYOUT, $check = FALSE) // } // Split up using the same function as the shortcode handler - $tmp = preg_split('#(\{\S[^\x02]*?\S\})#', $LAYOUT, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE); + $tmp = preg_split('#(\{\S[^\x02]*?\S\})#', (string) $LAYOUT, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE); $str = array(); for($c = 0, $cMax = count($tmp); $c < $cMax; $c++) { @@ -1582,9 +1582,9 @@ function checklayout($str) // { // echo $tp->parseTemplate("{LOGO}"); // } - if(strpos($str, "SETSTYLE") !== false) + if(strpos((string) $str, "SETSTYLE") !== false) { - $style = preg_replace("/\{SETSTYLE=(.*?)\}/si", "\\1", $str); + $style = preg_replace("/\{SETSTYLE=(.*?)\}/si", "\\1", (string) $str); $this->style = $style; $ns->setStyle($style); @@ -1608,14 +1608,14 @@ function checklayout($str) // $tp->parseTemplate("{NAVIGATION".$cust."}",true); // echo "Navigation Area"; // } - elseif(strpos($str, '{---MODAL---}') !== false) + elseif(strpos((string) $str, '{---MODAL---}') !== false) { //echo "\n \n"; echo '
'; //TODO Store in a central area - currently used in header.php, header_default.php and here. echo ' - + - + @@ -422,7 +422,7 @@ public function instructionsPage() return $text; } - + /* // optional - a custom page. public function customPage() @@ -430,11 +430,11 @@ public function customPage() $text = 'Hello World!'; $otherField = $this->getController()->getFieldVar('other_field_name'); return $text; - + } - - + + // Handle batch options as defined in gsitemap_form_ui::gsitemap_lastmod; 'handle' + action + field + 'Batch' // @important $fields['gsitemap_lastmod']['batch'] must be true for this method to be detected. // @param $selected @@ -461,7 +461,7 @@ function handleListGsitemapLastmodBatch($selected, $type) } - + // Handle batch options as defined in gsitemap_form_ui::gsitemap_freq; 'handle' + action + field + 'Batch' // @important $fields['gsitemap_freq']['batch'] must be true for this method to be detected. // @param $selected @@ -488,7 +488,7 @@ function handleListGsitemapFreqBatch($selected, $type) } - + // Handle filter options as defined in gsitemap_form_ui::gsitemap_lastmod; 'handle' + action + field + 'Filter' // @important $fields['gsitemap_lastmod']['filter'] must be true for this method to be detected. // @param $selected @@ -497,7 +497,7 @@ function handleListGsitemapLastmodFilter($type) { $this->listOrder = 'gsitemap_lastmod ASC'; - + switch($type) { case 'customfilter_1': @@ -515,7 +515,7 @@ function handleListGsitemapLastmodFilter($type) } - + // Handle filter options as defined in gsitemap_form_ui::gsitemap_freq; 'handle' + action + field + 'Filter' // @important $fields['gsitemap_freq']['filter'] must be true for this method to be detected. // @param $selected @@ -524,7 +524,7 @@ function handleListGsitemapFreqFilter($type) { $this->listOrder = 'gsitemap_freq ASC'; - + switch($type) { case 'customfilter_1': @@ -541,9 +541,9 @@ function handleListGsitemapFreqFilter($type) } - - - + + + */ function importLink() { @@ -555,7 +555,7 @@ function importLink() foreach ($_POST['importid'] as $import) { - list($name, $url, $type, $plugin, $table, $id) = explode("^", $import); + list($name, $url, $type, $plugin, $table, $id) = explode("^", (string) $import); $insert = array( 'gsitemap_id' => 0, @@ -591,24 +591,24 @@ function importLink() } } - + class gsitemap_form_ui extends e_admin_form_ui { - + // Custom Method/Function function gsitemap_priority($curVal,$mode) { - + switch($mode) { case 'read': // List Page return $curVal; break; - + case 'write': // Edit Page case 'batch': case 'filter': @@ -627,44 +627,44 @@ function gsitemap_priority($curVal,$mode) return ($mode === 'write') ? $text : $array; break; - + } - + return null; } - + // Custom Method/Function function gsitemap_freq($curVal,$mode) { - + switch($mode) { case 'read': // List Page return $curVal; break; - + case 'write': // Edit Page return $this->text('gsitemap_freq',$curVal, 255, 'size=large'); break; - + case 'filter': return array('customfilter_1' => 'Custom Filter 1', 'customfilter_2' => 'Custom Filter 2'); break; - + case 'batch': return array('custombatch_1' => 'Custom Batch 1', 'custombatch_2' => 'Custom Batch 2'); break; } - + return null; } } - - + + new gsitemap_adminArea(); require_once(e_ADMIN."auth.php"); @@ -694,7 +694,7 @@ function __construct() { $mes = e107::getMessage(); - + $this->freq_list = array ( @@ -756,15 +756,15 @@ function __construct() function showList() { - + $mes = e107::getMessage(); $sql = e107::getDb(); $ns = e107::getRender(); $tp = e107::getParser(); $frm = e107::getForm(); - + $gen = new convert; - + $count = $sql->select("gsitemap", "*", "gsitemap_id !=0 ORDER BY gsitemap_order ASC"); if (!$count) @@ -774,9 +774,9 @@ function showList() ".GSLAN_39."

" .$frm->admin_button('import',LAN_YES)." "; - + $mes->addInfo($text); - + $ns->tablerender(GSLAN_24, $mes->render()); return; } @@ -834,7 +834,7 @@ function showList() } $text .= "\n"; - + $ns->tablerender(GSLAN_24, $mes->render(). $text); } @@ -843,7 +843,7 @@ function editSme() { $sql = e107::getDb(); $tp = e107::getParser(); - + $e_idt = array_keys($_POST['edit']); if($sql->select("gsitemap", "*", "gsitemap_id='".$e_idt[0]."' ")) @@ -864,10 +864,10 @@ function doForm($editArray=FALSE) $sql = e107::getDb(); $ns = e107::getRender(); $mes = e107::getMessage(); - - + + $count = $sql->select("gsitemap", "*", "gsitemap_id !=0 ORDER BY gsitemap_id ASC"); - + $text = "
@@ -951,7 +951,7 @@ function addLink() $log = e107::getLog(); $sql = e107::getDb(); $tp = e107::getParser(); - + $gmap = array( 'gsitemap_name' => $tp->toDB($_POST['gsitemap_name']), 'gsitemap_url' => $tp->toDB($_POST['gsitemap_url']), @@ -967,11 +967,11 @@ function addLink() { // Add where statement to update query $gmap['WHERE'] = "gsitemap_id= ".intval($_POST['gsitemap_id']); - + if($sql->update("gsitemap", $gmap)) { $this->message = LAN_UPDATED; - + // Log update $log->addArray($gmap)->save('GSMAP_04'); } @@ -986,7 +986,7 @@ function addLink() { $gmap['gsitemap_img'] = vartrue($_POST['gsitemap_img']); $gmap['gsitemap_cat'] = vartrue($_POST['gsitemap_cat']); - + if($sql->insert('gsitemap', $gmap)) { $this->message = LAN_CREATED; @@ -1006,7 +1006,7 @@ function deleteSme() { $log = e107::getLog(); $sql = e107::getDb(); - + $d_idt = array_keys($_POST['delete']); if($sql->delete("gsitemap", "gsitemap_id='".$d_idt[0]."'")) @@ -1045,7 +1045,7 @@ function admin_config_adminmenu() $var['import']['text'] = GSLAN_23; $var['import']['link'] = e_SELF."?import"; $var['import']['perm'] = "0"; - + show_admin_menu(LAN_PLUGIN_GSITEMAP_NAME, $action, $var); }*/ diff --git a/e107_plugins/hero/admin_config.php b/e107_plugins/hero/admin_config.php index 7cc0ecb15c..31987362f0 100644 --- a/e107_plugins/hero/admin_config.php +++ b/e107_plugins/hero/admin_config.php @@ -57,7 +57,7 @@ class hero_adminArea extends e_admin_dispatcher class hero_ui extends e_admin_ui { - + protected $pluginTitle = 'Hero'; protected $pluginName = 'hero'; @@ -73,11 +73,11 @@ class hero_ui extends e_admin_ui // protected $treePrefix = 'somefield_title'; protected $tabs = array(LAN_GENERAL, LAN_ADVANCED); // Use 'tab'=>0 OR 'tab'=>1 in the $fields below to enable. - + // protected $listQry = "SELECT * FROM `#tableName` WHERE field != '' "; // Example Custom Query. LEFT JOINS allowed. Should be without any Order or Limit. - + protected $listOrder = 'hero_order'; - + protected $fields = array ( 'checkboxes' => array ( 'title' => '', 'type' => null, 'data' => null, 'width' => '5%', 'thclass' => 'center', 'forced' => '1', 'class' => 'center', 'toggle' => 'e-multiselect', ), 'hero_id' => array ( 'title' => LAN_ID, 'type' => null, 'data' => 'int', 'width' => '5%', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'left', 'thclass' => 'left', ), @@ -95,9 +95,9 @@ class hero_ui extends e_admin_ui 'options' => array ( 'title' => LAN_OPTIONS, 'type' => null, 'data' => null, 'width' => '10%', 'thclass' => 'center last', 'class' => 'center last', 'forced' => '1', ), ); - + protected $fieldpref = array('hero_media', 'hero_bg', 'hero_title', 'hero_description', 'hero_bullets', 'hero_button1'); - + // protected $preftabs = array('General', 'Other' ); protected $prefs = array( @@ -106,7 +106,7 @@ class hero_ui extends e_admin_ui 'slide_interval' => array('title'=>LAN_HERO_ADMIN_011, 'type'=>'dropdown', 'data'=>'int', 'writeParms'=>array('optArray'=>array())), ); - + public function init() { // Set drop-down values (if any). @@ -147,14 +147,14 @@ function EditObserver() } */ // ------- Customize Create -------- - + public function beforeCreate($new_data,$old_data) { $new_data = $this->processGlyph($new_data); return $new_data; } - + public function afterCreate($new_data, $old_data, $id) { // do something @@ -164,10 +164,10 @@ public function onCreateError($new_data, $old_data) { // do something } - - + + // ------- Customize Update -------- - + public function beforeUpdate($new_data, $old_data, $id) { $new_data = $this->processGlyph($new_data); @@ -179,7 +179,7 @@ private function processGlyph($new_data) { foreach($new_data['hero_bullets'] as $key=>$row) { - if(!empty($row['icon']) && strpos($row['icon'],".glyph")===false) + if(!empty($row['icon']) && strpos((string) $row['icon'],".glyph")===false) { $new_data['hero_bullets'][$key]['icon'] = $row['icon'].".glyph"; } @@ -194,12 +194,12 @@ public function afterUpdate($new_data, $old_data, $id) { // do something } - + public function onUpdateError($new_data, $old_data, $id) { // do something } - + // left-panel help menu area. public function renderHelp() { @@ -209,7 +209,7 @@ public function renderHelp() return array('caption'=>$caption,'text'=> $text); } - + /* // optional - a custom page. public function customPage() @@ -217,12 +217,12 @@ public function customPage() $text = 'Hello World!'; $otherField = $this->getController()->getFieldVar('other_field_name'); return $text; - + } - - - - + + + + */ } diff --git a/e107_plugins/import/admin_import.php b/e107_plugins/import/admin_import.php index 28a518ea35..89814f884e 100644 --- a/e107_plugins/import/admin_import.php +++ b/e107_plugins/import/admin_import.php @@ -73,24 +73,24 @@ class import_admin extends e_admin_dispatcher protected $adminMenuAliases = array( 'main/edit' => 'main/list' ); - + protected $menuTitle = LAN_PLUGIN_IMPORT_NAME; } class import_main_ui extends e_admin_ui { - + protected $pluginTitle = LAN_PLUGIN_IMPORT_NAME; protected $pluginName = 'import'; protected $table = false; - + protected $providers = array(); // the different types of import. protected $deleteExisting = false; // delete content from existing table during import. protected $selectedTables = array(); // User selection of what tables to import. eg. news, pages etc. protected $importClass = null; protected $checked_class_list = ''; - + // Definitions of available areas to import protected $importTables = array( 'users' => array('message' => LAN_CONVERT_25, 'classfile' => 'import_user_class.php', 'classname' => 'user_import'), @@ -111,23 +111,23 @@ class import_main_ui extends e_admin_ui // 'polls' => array('message' => LAN_CONVERT_27) ); - + // without any Order or Limit. - - + + function init() { $fl = e107::getFile(); - + $importClassList = $fl->get_files(e_PLUGIN.'import/providers', "^.+?_import_class\.php$", "standard", 1); - + foreach($importClassList as $file) { $tag = str_replace('_class.php','',$file['fname']); - + $key = str_replace("_import_class.php","",$file['fname']); if($key === 'template') @@ -136,34 +136,34 @@ function init() } include_once($file['path'].$file['fname']); // This will set up the variables - + $this->providers[$key] = $this->getMeta($tag); if(!empty($_GET['type'])) { $this->importClass = filter_var($_GET['type'])."_import"; } - + } uksort($this->providers,'strcasecmp'); - + } - - + + function help() { - + return "Some help text for admin-ui"; - + } - - - - - + + + + + function getMeta($class_name) { if(class_exists($class_name)) @@ -175,68 +175,68 @@ function getMeta($class_name) { e107::getMessage()->addDebug("Missing class: ".$class_name); } - + } - - - - + + + + // After selection - decide where to route things. function importPage() { - + // print_a($_POST); - + if(!empty($_POST['import_delete_existing_data'])) { $this->deleteExisting = varset($_POST['import_delete_existing_data'],0); } - + if(!empty($_POST['classes_select'])) { $this->checked_class_list = implode(',',$_POST['classes_select']); } - + if(!empty($_POST['createUserExtended'])) //TODO { $this->createUserExtended = true; } - + if(!empty($_POST['selectedTables'])) { $this->selectedTables = $_POST['selectedTables']; } - + if(!empty($_POST['runConversion'])) // default method. { $this->runConversion($_POST['import_source']); return; } - - - + + + $this->showImportOptions($_GET['type']); - + } - - - - - - - - - + + + + + + + + + function listPage() { $mes = e107::getMessage(); $frm = e107::getForm(); - + $tableCount = 0; // $mes->addDebug(print_a($this->providers,true)); - + $text = "
@@ -267,98 +267,98 @@ function listPage() $text .= "
"; $tableCount++; } - + $text.=" - + "; /* $text .= " - + "; - + for ($i=0; $i < $tableCount-1; $i++) { $text .= ""; } - - + + $text .= ""; */ - + foreach ($this->providers as $k=>$info) { $title = $info['title']; - - $iconFile = e_PLUGIN."import/images/".str_replace("_import","",strtolower($k)).".png"; - + + $iconFile = e_PLUGIN."import/images/".str_replace("_import","",strtolower((string) $k)).".png"; + $icon = (file_exists($iconFile)) ? "" : ""; - + $text .= "\n"; - + foreach($this->importTables as $key=>$val) { if(vartrue($val['nolist'])){ continue; } $text .= "\n"; } - + $text .= " "; } - - + + $text .= "
".$val['message']."".LAN_OPTIONS."
CSV ".ADMIN_TRUE_ICON." ".$frm->admin_button('import_type', 'csv', 'other',"Select")."
".$icon.$title."
".$info['description']."
".(in_array($key,$info['supported']) ? defset('ADMIN_TRUE_ICON') : " ").""; - + $text .= $frm->admin_button('type', $k, 'other',LAN_CONVERT_64); // $text .= $frm->admin_button('import_type', $k, 'other',"Select"); - + $text .= "
".$frm->hidden('trigger_import',1)." - +
"; - + echo $mes->render().$text; // $ns->tablerender(LAN_PLUGIN_IMPORT_NAME, $mes->render().$text); - + } - - - + + + function runConversion($import_source) { $frm = e107::getForm(); $ns = e107::getRender(); $mes = e107::getMessage(); - + $abandon = TRUE; - + switch ($import_source) { case 'csv' : - + break; - + case 'db' : if($this->dbImport() == false) { $abandon = true; } break; - + case 'rss' : if($this->rssImport() == false) { @@ -366,14 +366,14 @@ function runConversion($import_source) } break; } - - + + // if ($msg) // { // $mes->add($msg, E_MESSAGE_INFO); // $ns -> tablerender(LAN_CONVERT_30, $msg); // $msg = ''; // } - + if ($abandon) { // unset($_POST['do_conversion']); @@ -384,9 +384,9 @@ function runConversion($import_source)
"; echo $mes->render(). $text; - + // $ns -> tablerender(LAN_CONVERT_30,$mes->render(). $text); - + } } @@ -395,7 +395,7 @@ function runConversion($import_source) function renderConfig() { - + } @@ -403,18 +403,18 @@ function renderConfig() - - + + function showImportOptions($type='csv') { global $csv_names, $e_userclass; $mode = $this->importClass; - + $frm = e107::getForm(); $ns = e107::getRender(); - + $mes = e107::getMessage(); - + if (class_exists($mode)) { $mes->addDebug("Class Available: ".$mode); @@ -424,10 +424,10 @@ function showImportOptions($type='csv') return; } } - + $message = "".LAN_CONVERT_05.""; $mes->add($message, E_MESSAGE_WARNING); - + $text = "
@@ -435,9 +435,9 @@ function showImportOptions($type='csv') "; - - - + + + /* if($mode == "csv") { @@ -453,28 +453,28 @@ function showImportOptions($type='csv') $text .= "\n - + - + "; - + } else */ - + $importType = $proObj->title; - + if($proObj->sourceType == 'db' || !$proObj->sourceType) // STANDARD db Setup { $databases = $this->getDatabases(); @@ -509,10 +509,10 @@ function showImportOptions($type='csv') "; - + } - - + + if(method_exists($proObj,"config")) // Config Found in Class - render options from it. { if($ops = $proObj->config()) @@ -528,8 +528,8 @@ function showImportOptions($type='csv') } } } - - + + if($proObj->sourceType) { $text .= "\n"; @@ -538,40 +538,40 @@ function showImportOptions($type='csv') { $text .= ""; } - - - - + + + + // if($mode != 'csv') { $text .= " "; } - - + + $text .= " "; - + //TODO /* if(in_array('users',$proObj->supported)) @@ -583,7 +583,7 @@ function showImportOptions($type='csv') "; } */ - + if(varset($proObj->defaultClass) !== false) { $text .= " @@ -592,31 +592,31 @@ function showImportOptions($type='csv') $text .= $e_userclass->vetted_tree('classes_select',array($e_userclass,'checkbox'), varset($_POST['classes_select']),'main,admin,classes,matchclass, no-excludes'); $text .= ""; } - + $action = varset($proObj->action,'runConversion'); $text .= "
".LAN_CONVERT_36."
".LAN_CONVERT_17." - + ".LAN_CONVERT_18."
$importType ".LAN_CONVERT_24." "; - + $defCheck = (count($proObj->supported)==1) ? true : false; foreach ($this->importTables as $k => $v) { if(in_array($k, $proObj->supported)) // display only the options supported. { $text .= $frm->checkbox('selectedTables['.$k.']', $k, $defCheck,array('label'=>$v['message'])); - - + + //$text .= " ".$v['message']; // $text .= "
"; } } $text .= "
".LAN_CONVERT_38."".$frm->help(LAN_CONVERT_39)." ".$frm->radio_switch('import_delete_existing_data', $_POST['import_delete_existing_data'])."
".$frm->admin_button($action,LAN_CONTINUE, 'execute'). - + $frm->admin_button('back',LAN_CANCEL, 'cancel')."
"; - + // Now a little bit of JS to initialise some of the display divs etc // $temp = ''; // if(varset($import_source)) { $temp .= "disp('{$import_source}');"; } // if (varset($current_db_type)) $temp .= " flagbits('{$current_db_type}');"; // if (varset($temp)) $text .= ""; - + $this->addTitle($importType); echo $mes->render().$text; - + // $ns -> tablerender(LAN_PLUGIN_IMPORT_NAME.SEP.$importType, $mes->render().$text); - + } - - + + private function getDatabases() { $tmp = e107::getDb()->gen("SHOW DATABASES"); @@ -644,41 +644,41 @@ private function getDatabases() } - - + + function rssImport() { global $current_db_type; - + $mes = e107::getMessage(); $mes->addDebug("Loading: RSS"); - + if(!varset($_POST['runConversion'])) { $mes->addWarning("Under Construction"); } - + return $this->dbImport('xml'); - + } - - - + + + /** MAIN IMPORT AREA */ function dbImport($mode='db') { - + $mes = e107::getMessage(); $tp = e107::getParser(); - + $mes->addDebug("dbImport(): Loading: ".$this->importClass); - + if(!is_array($this->importTables)) { $mes->addError("dbImport(): No areas selected for import"); // db connect failed return false; } - + if (class_exists($this->importClass)) { $mes->addDebug("dbImport(): Converter Class Available: ".$this->importClass); @@ -689,10 +689,10 @@ function dbImport($mode='db') { $mes->addError(LAN_CONVERT_42. "[".$this->importClass."]"); $mes->addDebug("dbImport(): Class NOT Available: ".$this->importClass); - + return false; } - + if($mode == 'db') // Don't do DB check on RSS/XML { @@ -701,7 +701,7 @@ function dbImport($mode='db') $mes->addError(LAN_CONVERT_41); return false; } - + $result = $converter->database($tp->filter($_POST['dbParamDatabase']), $tp->filter($_POST['dbParamPrefix'])); // $result = $converter->database($tp->filter($_POST['dbParamDatabase']), $tp->filter($_POST['dbParamPrefix']), true); @@ -712,24 +712,24 @@ function dbImport($mode='db') return false; } } - - + + if(vartrue($converter->override)) { $mes->addDebug("dbImport(): Override Active!" ); return; } - - - + + + // Return foreach($this->selectedTables as $k => $tm) { $v = $this->importTables[$k]; - + $loopCounter = 0; $errorCounter = 0; - + if (is_readable($v['classfile'])) // Load our class for either news, pages etc. { $mes->addDebug("dbImport(): Including File: ".$v['classfile']); @@ -740,52 +740,52 @@ function dbImport($mode='db') $mes->addError(LAN_CONVERT_45.': '.$v['classfile']); // can't read class file. return false; } - + $mes->addDebug("dbImport(): Importing: ".$k); - + $exporter = new $v['classname']; // Writes the output data - + if(is_object($exporter)) { $mes->addDebug("dbImport(): Exporter Class Initiated: ".$v['classname']); - + if(is_object($exporter->helperClass)) { $mes->addDebug("dbImport(): Initiated Helper Class"); $converter->helperClass = $exporter->helperClass; } - + } else { $mes->addDebug("dbImport(): Couldn't Initiate Class: ".$v['classname']); } - - + + $result = $converter->setupQuery($k, !$this->deleteExisting); - + if ($result !== true) { $mes->addError(LAN_CONVERT_44.' '.$k); // couldn't set query break; } - - - - + + + + if($k == 'users') // Do any type-specific default setting { $mes->addDebug("dbImport(): Overriding Default for user_class: ".$this->checked_class_list); $exporter->overrideDefault('user_class', $this->checked_class_list); // break; } - + if ($this->deleteExisting == true) { $mes->addDebug("dbImport(): Emptying target table. "); $exporter->emptyTargetDB(); // Clean output DB - reasonably safe now } - + while ($row = $converter->getNext($exporter->getDefaults(),$mode)) { $loopCounter++; @@ -799,35 +799,35 @@ function dbImport($mode='db') $mes->addError($msg); // couldn't set query } } - + $converter->endQuery(); - + unset($exporter); - - + + $msg = str_replace(array('[x]','[y]', '[z]','[w]'), array($loopCounter,$loopCounter-$errorCounter,$errorCounter, $k),LAN_CONVERT_47); $mes->addSuccess($msg); // couldn't set query } - - - - - - - - - - + + + + + + + + + + return true; - + // $abandon = FALSE; } - - - - + + + + } @@ -991,7 +991,7 @@ function dbImport($mode='db') if(isset($_POST['do_conversion'])) { $abandon = TRUE; - + switch ($import_source) { case 'csv' : @@ -1002,7 +1002,7 @@ function dbImport($mode='db') { $msg = LAN_CONVERT_37.' '.$csv_options[$current_csv]; } - + if (!$msg) { $field_list = explode(',',$csv_formats[$current_csv]); @@ -1072,7 +1072,7 @@ function dbImport($mode='db') $abandon = true; } break; - + case 'rss' : if(rssImport() == false) { @@ -1107,27 +1107,27 @@ function dbImport($mode='db') function rssImport() { global $current_db_type, $db_import_blocks, $import_delete_existing_data,$db_blocks_to_import; - + $mes = e107::getMessage(); $mes->addDebug("Loading: RSS"); if(!varset($_POST['do_conversion'])) { $mes->addWarning("Under Construction"); } - + return dbImport('xml'); - + } function dbImport($mode='db') { global $current_db_type, $db_import_blocks, $import_delete_existing_data,$db_blocks_to_import; - + $mes = e107::getMessage(); - + // if (IMPORT_DEBUG) echo "Importing: {$current_db_type}
"; $mes->addDebug("Loading: ".$current_db_type); - + if (class_exists($current_db_type)) { $mes->addDebug("Class Available: ".$current_db_type); @@ -1139,7 +1139,7 @@ function dbImport($mode='db') $mes->addError(LAN_CONVERT_42. "[".$current_db_type."]"); return false; } - + if($mode == 'db') // Don't do DB check on RSS/XML { if (!isset($_POST['dbParamHost']) || !isset($_POST['dbParamUsername']) || !isset($_POST['dbParamPassword']) || !isset($_POST['dbParamDatabase'])) @@ -1147,7 +1147,7 @@ function dbImport($mode='db') $mes->addError(LAN_CONVERT_41); return false; } - + $result = $converter->db_Connect($_POST['dbParamHost'], $_POST['dbParamUsername'], $_POST['dbParamPassword'], $_POST['dbParamDatabase'], $_POST['dbParamPrefix']); if ($result !== TRUE) { @@ -1166,7 +1166,7 @@ function dbImport($mode='db') { return; } - + foreach ($db_import_blocks as $k => $v) @@ -1175,7 +1175,7 @@ function dbImport($mode='db') { $loopCounter = 0; $errorCounter = 0; - + if (is_readable($v['classfile'])) { require_once($v['classfile']); @@ -1190,30 +1190,30 @@ function dbImport($mode='db') { //if (IMPORT_DEBUG) echo "Importing: {$k}
"; $mes->addDebug("Importing: ".$k); - + $result = $converter->setupQuery($k,!$import_delete_existing_data); - + if ($result !== TRUE) { $mes->addError(LAN_CONVERT_44.' '.$k); // couldn't set query // $msg .= "Prefix = ".$converter->DBPrefix; break; } - + $exporter = new $v['classname']; // Writes the output data - + switch ($k) // Do any type-specific default setting { case 'users' : $exporter->overrideDefault('user_class',$checked_class_list); break; } - + if ($import_delete_existing_data) { $exporter->emptyTargetDB(); // Clean output DB - reasonably safe now } - + while ($row = $converter->getNext($exporter->getDefaults(),$mode)) { $loopCounter++; @@ -1227,12 +1227,12 @@ function dbImport($mode='db') $mes->addError($msg); // couldn't set query } } - + $converter->endQuery(); - + unset($exporter); - - + + $msg = str_replace(array('--LINES--','--USERS--', '--ERRORS--','--BLOCK--'), array($loopCounter,$loopCounter-$errorCounter,$errorCounter, $k),LAN_CONVERT_47); $mes->addSuccess($msg); // couldn't set query @@ -1240,13 +1240,13 @@ function dbImport($mode='db') else { $mes->addDebug("Error: _POST['import_block_{$k}'] = ".$_POST['import_block_{$k}']); // cou - + } } else { $mes->addDebug("\$db_blocks_to_import doesn't contain key: ".$k); // cou - + } } @@ -1275,13 +1275,13 @@ function csv_split(&$data,$delim=',',$enveloper='') $enclosed = false; // $fldcount=0; // $linecount=0; - for($i=0, $iMax = strlen($data); $i< $iMax; $i++) + for($i=0, $iMax = strlen((string) $data); $i< $iMax; $i++) { $c=$data[$i]; switch($c) { case $enveloper : - if($enclosed && ($i $val) { @@ -1375,7 +1375,7 @@ function disp(type) return; } } - + function flagbits(type) { var i,j; diff --git a/e107_plugins/import/import_classes.php b/e107_plugins/import/import_classes.php index a89a78a132..bb5523951a 100644 --- a/e107_plugins/import/import_classes.php +++ b/e107_plugins/import/import_classes.php @@ -293,7 +293,7 @@ private function renderTable($source) { $text .= " ".$k." - ".htmlentities($v)." + ".htmlentities((string) $v)." "; @@ -327,8 +327,8 @@ function proc_bb($value, $options = "", $maptable = null) $bbphpbb = (strpos($options,'phpbb') !== FALSE) ? TRUE : FALSE; // Strip values as phpbb $nextchar = 0; $loopcount = 0; - - while ($nextchar < strlen($value)) + + while ($nextchar < strlen((string) $value)) { $firstbit = ''; $middlebit = ''; @@ -336,11 +336,11 @@ function proc_bb($value, $options = "", $maptable = null) $loopcount++; if ($loopcount > 10) return 'Max depth exceeded'; unset($bbword); - $firstcode = strpos($value,'[',$nextchar); + $firstcode = strpos((string) $value,'[',$nextchar); if ($firstcode === FALSE) return $value; // Done if no square brackets - $firstend = strpos($value,']',$firstcode); + $firstend = strpos((string) $value,']',$firstcode); if ($firstend === FALSE) return $value; // Done if no closing bracket - $bbword = substr($value,$firstcode+1,$firstend - $firstcode - 1); // May need to process this more if parameter follows + $bbword = substr((string) $value,$firstcode+1,$firstend - $firstcode - 1); // May need to process this more if parameter follows $bbparam = ''; $temp = strpos($bbword,'='); if ($temp !== FALSE) @@ -350,8 +350,8 @@ function proc_bb($value, $options = "", $maptable = null) } if (($bbword) && ($bbword == trim($bbword))) { - $laststart = strpos($value,'[/'.$bbword,$firstend); // Find matching end - $lastend = strpos($value,']',$laststart); + $laststart = strpos((string) $value,'[/'.$bbword,$firstend); // Find matching end + $lastend = strpos((string) $value,']',$laststart); if (($laststart === FALSE) || ($lastend === FALSE)) { // No matching end character $nextchar = $firstend; // Just move scan pointer along @@ -359,9 +359,9 @@ function proc_bb($value, $options = "", $maptable = null) else { // Got a valid bbcode pair here $firstbit = ''; - if ($firstcode > 0) $firstbit = substr($value,0,$firstcode); - $middlebit = substr($value,$firstend+1,$laststart - $firstend-1); - $lastbit = substr($value,$lastend+1,strlen($value) - $lastend); + if ($firstcode > 0) $firstbit = substr((string) $value,0,$firstcode); + $middlebit = substr((string) $value,$firstend+1,$laststart - $firstend-1); + $lastbit = substr((string) $value,$lastend+1,strlen((string) $value) - $lastend); // Process bbcodes here if ($bblower) $bbword = strtolower($bbword); if ($bbphpbb && (strpos($bbword,':') !== FALSE)) $bbword = substr($bbword,0,strpos($bbword,':')); diff --git a/e107_plugins/import/import_user_class.php b/e107_plugins/import/import_user_class.php index ed783d713e..555166c286 100644 --- a/e107_plugins/import/import_user_class.php +++ b/e107_plugins/import/import_user_class.php @@ -136,7 +136,7 @@ function getDefaults() // On error, if $just_strip true, returns 'processed' name; otherwise returns FALSE function vetUserName($name, $just_strip = FALSE) { - $temp_name = trim(preg_replace('/ |\#|\=|\$/', "", strip_tags($name))); + $temp_name = trim((string) preg_replace('/ |\#|\=|\$/', "", strip_tags((string) $name))); if (($temp_name == $name) || $just_strip) return $temp_name; return FALSE; } @@ -168,7 +168,7 @@ function saveData($userRecord) { e107::getMessage()->addDebug("Removing user-field due to missing user-extended field {$k} "); } - + unset($userRecord[$k]); // And always delete from the original data record } } @@ -191,8 +191,8 @@ function saveData($userRecord) return 5; } - if (trim($userRecord['user_name']) == '') $userRecord['user_name'] = trim($userRecord['user_loginname']); - if (trim($userRecord['user_loginname']) == '') $userRecord['user_loginname'] = trim($userRecord['user_name']); + if (trim((string) $userRecord['user_name']) == '') $userRecord['user_name'] = trim((string) $userRecord['user_loginname']); + if (trim((string) $userRecord['user_loginname']) == '') $userRecord['user_loginname'] = trim((string) $userRecord['user_name']); foreach ($this->userMandatory as $k) { @@ -201,7 +201,7 @@ function saveData($userRecord) e107::getMessage()->addDebug("Failed userMandatory on {$k}"); return 3; } - + //if (strlen($userRecord[$k]) < 3) // { // e107::getMessage()->addDebug("Failed userMandatory length on {$k}"); diff --git a/e107_plugins/import/providers/PHPNuke_import_class.php b/e107_plugins/import/providers/PHPNuke_import_class.php index a09ae4d510..1cf2f9dfcf 100644 --- a/e107_plugins/import/providers/PHPNuke_import_class.php +++ b/e107_plugins/import/providers/PHPNuke_import_class.php @@ -140,7 +140,7 @@ function copyUserData(&$target, &$source) $target['user_name'] = $source['name']; $target['user_loginname'] = $source['username']; $target['user_password'] = $source['user_password']; //MD5 - $target['user_join'] = strtotime($source['user_regdate']); + $target['user_join'] = strtotime((string) $source['user_regdate']); $target['user_email'] = $source['user_email']; $target['user_hideemail'] = !$source['user_viewemail']; $target['user_image'] = $source['user_avatar']; diff --git a/e107_plugins/import/providers/blogger_import_class.php b/e107_plugins/import/providers/blogger_import_class.php index a3cf16794c..7b88e0c198 100644 --- a/e107_plugins/import/providers/blogger_import_class.php +++ b/e107_plugins/import/providers/blogger_import_class.php @@ -33,11 +33,11 @@ class blogger_import extends rss_import public $description = 'Import up to 500 items from yourblog.blogspot.com'; public $supported = array('news'); public $mprefix = false; - + public $cleanupHtml = false; public $defaultClass = false; - + /* If the first 500 posts of your blog feed are here: @@ -59,9 +59,9 @@ function init() if(vartrue($_POST['bloggerUrl'])) { - $this->feedUrl = rtrim($_POST['bloggerUrl'],"/")."/feeds/posts/default?max-results=999&alt=rss"; + $this->feedUrl = rtrim((string) $_POST['bloggerUrl'],"/")."/feeds/posts/default?max-results=999&alt=rss"; } - + if(vartrue($_POST['bloggerCleanup'])) { $this->cleanupHtml = true; @@ -75,18 +75,18 @@ function init() return; } } - - + + function config() { $var[0]['caption'] = "Blogger URL"; $var[0]['html'] = e107::getForm()->text('bloggerUrl', $_POST['bloggerUrl'],255, 'size=xxlarge'); // ""; $var[0]['help'] = "eg. http://blogname.blogspot.com"; - + $var[1]['caption'] = "Cleanup HTML in content"; $var[1]['html'] = e107::getForm()->checkbox('bloggerCleanup',1, $_POST['bloggerCleanup']); // ""; $var[1]['help'] = "Tick to enable"; - + return $var; } @@ -153,18 +153,18 @@ function process($type,$source) if(!empty($source['link'][0])) { - return str_replace(".html","", basename($source['link'][0])); + return str_replace(".html","", basename((string) $source['link'][0])); } return ""; break; - + default: return $source[$type][0]; break; } - - + + } diff --git a/e107_plugins/import/providers/coppermine_import_class.php b/e107_plugins/import/providers/coppermine_import_class.php index 747fcf9762..7d53148a32 100644 --- a/e107_plugins/import/providers/coppermine_import_class.php +++ b/e107_plugins/import/providers/coppermine_import_class.php @@ -70,9 +70,9 @@ function copyUserData(&$target, &$source) $target['user_login'] = $source['user_name']; $target['user_password'] = $source['user_password']; $target['user_email'] = $source['user_email']; - $target['user_join'] = strtotime($source['user_regdate']); - $target['user_lastvisit'] = strtotime($source['user_lastvisit']); - + $target['user_join'] = strtotime((string) $source['user_regdate']); + $target['user_lastvisit'] = strtotime((string) $source['user_lastvisit']); + switch ($source['user_group']) { case 1 : // Admin @@ -85,7 +85,7 @@ function copyUserData(&$target, &$source) $target['user_ban'] = 2; break; } - + return $target; /* Unused fields: diff --git a/e107_plugins/import/providers/drupal_import_class.php b/e107_plugins/import/providers/drupal_import_class.php index 8e15a68c6f..c7efb36b99 100644 --- a/e107_plugins/import/providers/drupal_import_class.php +++ b/e107_plugins/import/providers/drupal_import_class.php @@ -428,7 +428,7 @@ function fileCreateUrl($uri, $path) // Strip a slash from the end of URL. $base_url = rtrim($base_url, '/'); // Strip slashes from the beginning and end of path. - $base_path = trim($this->basePath, '/'); + $base_path = trim((string) $this->basePath, '/'); // Append slashes to the beginning and end of path if it's not empty. $base_path = !empty($base_path) ? '/' . $base_path . '/' : '/'; // Replace file schema with the real path. diff --git a/e107_plugins/import/providers/e107_import_class.php b/e107_plugins/import/providers/e107_import_class.php index f421262581..f9a313c35f 100644 --- a/e107_plugins/import/providers/e107_import_class.php +++ b/e107_plugins/import/providers/e107_import_class.php @@ -139,7 +139,7 @@ function copyPageData(&$target, &$source) private function checkHtml($text) { $tp = e107::getParser(); - if($tp->isHtml($text) && strpos($text,'[html]')!==0) + if($tp->isHtml($text) && strpos((string) $text,'[html]')!==0) { return "[html]".$text."[/html]"; } diff --git a/e107_plugins/import/providers/html_import_class.php b/e107_plugins/import/providers/html_import_class.php index 2b13b1962b..2a2122a000 100644 --- a/e107_plugins/import/providers/html_import_class.php +++ b/e107_plugins/import/providers/html_import_class.php @@ -37,7 +37,7 @@ class html_import extends base_import_class function init() { $this->feedUrl = vartrue($_POST['siteUrl'],false); - $this->feedUrl = rtrim($this->feedUrl,"/"); + $this->feedUrl = rtrim((string) $this->feedUrl,"/"); if(!extension_loaded("tidy")) { @@ -250,7 +250,7 @@ private function getRawHtml($file='') if($file == '') { $file = "index.html"; } // just for local file, not url. - $path = md5($this->feedUrl); + $path = md5((string) $this->feedUrl); $local_file = $path."/".$file; $this->localPath = e_TEMP.$path."/"; @@ -327,7 +327,7 @@ function copyUserData(&$target, &$source) */ function copyNewsData(&$target, &$source) { - + if(!$content = $this->process('content_encoded',$source)) { $body = $this->process('description',$source); @@ -336,14 +336,14 @@ function copyNewsData(&$target, &$source) { $body = $content; } - + $body = $this->saveImages($body,'news'); $keywords = $this->process('category',$source); - - + + if(!vartrue($source['title'][0])) { - list($title,$newbody) = explode("
",$body,2); + list($title,$newbody) = explode("
",(string) $body,2); $title = strip_tags($title); if(trim($newbody)!='') { @@ -354,14 +354,14 @@ function copyNewsData(&$target, &$source) { $title = $source['title'][0]; } - + $target['news_title'] = $title; // $target['news_sef'] = $source['post_name']; $target['news_body'] = "[html]".$body."[/html]"; // $target['news_extended'] = ''; $target['news_meta_keywords'] = implode(",",$keywords); // $target['news_meta_description'] = ''; - $target['news_datestamp'] = strtotime($source['pubDate'][0]); + $target['news_datestamp'] = strtotime((string) $source['pubDate'][0]); // $target['news_author'] = $source['post_author']; // $target['news_category'] = ''; // $target['news_allow_comments'] = ($source['comment_status']=='open') ? 1 : 0; @@ -374,11 +374,11 @@ function copyNewsData(&$target, &$source) // $target['news_thumbnail'] = ''; // $target['news_sticky'] = ''; - + return $target; // comment out to debug - + $this->renderDebug($source,$target); - + // DEBUG INFO BELOW. } @@ -439,7 +439,7 @@ function copyPageData(&$target, &$source) $target['page_text'] = "[html]".$body."[/html]"; // $target['page_metakeys'] = ''; // $target['page_metadscr'] = ''; - $target['page_datestamp'] = strtotime($source['pubDate'][0]); + $target['page_datestamp'] = strtotime((string) $source['pubDate'][0]); // $target['page_author'] = $source['post_author']; // $target['page_category'] = '', // $target['page_comment_flag'] = ($source['comment_status']=='open') ? 1 : 0; @@ -495,12 +495,12 @@ function saveImages($body,$cat='news') // echo htmlentities($body); - preg_match_all("/(((http:\/\/www)|(http:\/\/)|(www))[-a-zA-Z0-9@:%_\+.~#?&\/\/=]+)\.(jpg|jpeg|gif|png|svg)/im",$body,$matches); + preg_match_all("/(((http:\/\/www)|(http:\/\/)|(www))[-a-zA-Z0-9@:%_\+.~#?&\/\/=]+)\.(jpg|jpeg|gif|png|svg)/im",(string) $body,$matches); $fl = e107::getFile(); if(is_array($matches[0])) { - $relPath = 'images/'.md5($this->feedUrl); + $relPath = 'images/'.md5((string) $this->feedUrl); if(!is_dir(e_MEDIA.$relPath)) { diff --git a/e107_plugins/import/providers/livejournal_import_class.php b/e107_plugins/import/providers/livejournal_import_class.php index aca3335622..03d0066884 100644 --- a/e107_plugins/import/providers/livejournal_import_class.php +++ b/e107_plugins/import/providers/livejournal_import_class.php @@ -23,7 +23,7 @@ class livejournal_import extends rss_import { - + public $title = 'LiveJournal'; public $description = 'Import up to 500 items from yourblog.livejournal.com'; public $supported = array('news'); @@ -38,47 +38,47 @@ class livejournal_import extends rss_import function init() { $mes = e107::getMessage(); - + if(vartrue($_POST['siteUrl'])) { - $domain = preg_replace("/https?:\/\//i",'',$_POST['siteUrl']); + $domain = preg_replace("/https?:\/\//i",'',(string) $_POST['siteUrl']); list($site,$dom,$tld) = explode(".",$domain); - + $this->feedUrl = "http://".$site.".livejournal.com/data/rss"; } - + if(vartrue($_POST['siteCleanup'])) { $this->cleanupHtml = true; } - + $mes->addDebug("LiveJournal Feed:".$this->feedUrl); } - - + + function config() { $var[0]['caption'] = "Your LiveJournal URL"; $var[0]['html'] = ""; $var[0]['help'] = "eg. http://blogname.livejournal.com"; - + $var[1]['caption'] = "Cleanup HTML in content"; $var[1]['html'] = ""; $var[1]['help'] = "Tick to enable"; - + return $var; } function process($type,$source) { - + switch ($type) { case 'description': $body = $source[$type][0]; if($this->cleanupHtml == TRUE) { - $body = preg_replace("/font-family: [\w]*;/i","", $body); + $body = preg_replace("/font-family: [\w]*;/i","", (string) $body); $body = preg_replace('/class="[\w]*" /i',"", $body); $body = str_replace("
","
",$body); return $body; @@ -88,13 +88,13 @@ function process($type,$source) return $body; } break; - + default: return $source[$type][0]; break; } - - + + } //TODO Comment Import: diff --git a/e107_plugins/import/providers/phpbb3_import_class.php b/e107_plugins/import/providers/phpbb3_import_class.php index 5414ebd2a0..18a24a9321 100644 --- a/e107_plugins/import/providers/phpbb3_import_class.php +++ b/e107_plugins/import/providers/phpbb3_import_class.php @@ -24,34 +24,34 @@ class phpbb3_import extends base_import_class public $supported = array('users','forum','forumthread','forumpost','forumtrack'); public $mprefix = 'phpbb_'; public $sourceType = 'db'; - + var $catcount = 0; // Counts forum IDs var $id_map = array(); // Map of PHPBB forum IDs ==> E107 forum IDs - + private $forum_attachments = array(); private $forum_attachment_path = null; private $forum_moderator_class = false; var $helperClass; // forum class. - - + + function init() { - $formattach = trim($_POST['forum_attachment_path'],"/" ); + $formattach = trim((string) $_POST['forum_attachment_path'],"/" ); $this->forum_attachment_path = vartrue($formattach, false); - + if($data = e107::getDb('phpbb')->retrieve('userclass_classes','userclass_id',"userclass_name='FORUM_MODERATOR' ")) { $this->forum_moderator_class = $data; } - + } - - - + + + function config() { $frm = e107::getForm(); - + $var[0]['caption'] = "Path to phpBB3 Attachments folder (optional)"; $var[0]['html'] = $frm->text('forum_attachment_path',null,40,'size=xxlarge'); $var[0]['help'] = "Relative to the root folder of your e107 installation"; @@ -63,36 +63,36 @@ function config() function help() { return "some help text"; - + } - + // Set up a query for the specified task. // Returns TRUE on success. FALSE on error // If $blank_user is true, certain cross-referencing user info is to be zeroed function setupQuery($task, $blank_user=FALSE) { if ($this->ourDB == NULL) return FALSE; - + switch ($task) { case 'users' : $result = $this->ourDB->gen("SELECT * FROM {$this->DBPrefix}users ORDER BY user_id ASC "); if ($result === FALSE) return FALSE; break; - + case 'forum' : $result = $this->ourDB->gen("SELECT * FROM {$this->DBPrefix}forums"); if ($result === FALSE) return FALSE; break; - + case 'forumthread' : $result = $this->ourDB->gen("SELECT * FROM {$this->DBPrefix}topics"); - + if ($result === FALSE) return FALSE; break; - + case 'forumpost' : - + if($this->ourDB->gen("SELECT * FROM {$this->DBPrefix}attachments")) { while($row = $this->ourDB->fetch()) @@ -127,13 +127,13 @@ function setupQuery($task, $blank_user=FALSE) return TRUE; } - + /** * Convert salted password to e107 style (they use the same basic coding) */ function convertPassword($password) { - if ((substr($password ,0,3) == '$H$') && (strlen($password) == 34)) + if ((substr((string) $password ,0,3) == '$H$') && (strlen((string) $password) == 34)) { return substr_replace($password, '$E$',0,3); } @@ -141,39 +141,39 @@ function convertPassword($password) { return $password; } - + } - + function convertBirthday($date) { $tp = e107::getParser(); - - if(trim($date) == '') + + if(trim((string) $date) == '') { return; } - - list($d,$m,$y) = explode("-",$date); + + list($d,$m,$y) = explode("-",(string) $date); return $tp->leadingZeros($y,4)."-".$tp->leadingZeros($m,2)."-".$tp->leadingZeros($d,2); } - - + + function convertUserclass($perm='') { if($perm == '') { return; } - + $conv = array(1 => e_UC_GUEST, 4 => e_UC_MODS, 6 => e_UC_BOTS, 7 => e_UC_NEWUSER); - + if($this->forum_moderator_class !== false) { $conv[4] = $this->forum_moderator_class; $conv[5] = $this->forum_moderator_class; } - - + + return vartrue($conv[$perm]) ? $conv[$perm] : ""; /* * 1 GUESTS @@ -198,14 +198,14 @@ function convertUserBan($data) { return $data; } - + } - - + + //------------------------------------ // Internal functions below here //------------------------------------ - + /** * Copy data read from the DB into the record to be returned. @@ -241,9 +241,9 @@ function copyUserData(&$target, &$source) $target['user_realm'] = ''; $target['user_pwchange'] = $source['user_passchg']; $target['user_xup'] = ''; - + // Extended Fields. - + $target['user_plugin_forum_viewed'] = 0; $target['user_plugin_forum_posts'] = $source['user_posts']; $target['user_timezone'] = $source['user_timezone']; // source is decimal(5,2) @@ -257,15 +257,15 @@ function copyUserData(&$target, &$source) $target['user_birthday'] = $this->convertBirthday($source['user_birthday']); $target['user_occupation'] = $source['user_occ']; $target['user_interests'] = $source['user_interests']; - + return $target; - - + + } - + /** * $target - e107_forum table * $source - phpbb_forums table : https://wiki.phpbb.com/Table.phpbb_forums @@ -279,7 +279,7 @@ function copyForumData(&$target, &$source) $target['forum_sub'] = ""; $target['forum_datestamp'] = time(); $target['forum_moderators'] = ""; - + $target['forum_threads'] = $source['forum_topics']; $target['forum_replies'] = $source['forum_posts']; $target['forum_lastpost_user'] = $source['forum_last_poster_id']; @@ -290,19 +290,19 @@ function copyForumData(&$target, &$source) // $target['forum_postclass'] // $target['forum_threadclass'] // $target['forum_options'] - - + + return $target; } - + /** * $target - e107 forum_threads * $source - phpbb_topics : https://wiki.phpbb.com/Table.phpbb_topics */ function copyForumThreadData(&$target, &$source) { - + $target['thread_id'] = $source['topic_id']; $target['thread_name'] = $source['topic_title']; $target['thread_forum_id'] = $source['forum_id']; @@ -317,11 +317,11 @@ function copyForumThreadData(&$target, &$source) $target['thread_lastuser_anon'] = $source['topic_last_poster_name']; $target['thread_total_replies'] = $source['topic_replies']; // $target['thread_options'] = $source['topic_']; - + return $target; } - + /** * $target - e107_forum_post table * $source - phpbb_posts table : https://wiki.phpbb.com/Table.phpbb_posts @@ -341,8 +341,8 @@ function copyForumPostData(&$target, &$source) // $target['post_user_anon'] = $source['']; $target['post_attachments'] = $this->convertAttachment($source); // $target['post_options'] = $source['']; - - + + return $target; } @@ -360,24 +360,24 @@ function copyForumTrackData(&$target, &$source) return $target; } - - + + function convertAttachment($row) { - + if($row['post_attachment'] != 1) { return; } - + $id = $row['post_id']; - + if(isset($this->forum_attachments[$id])) { $attach = array(); - + $forum = $this->helperClass; // e107_plugins/forum/forum_class.php - + if($folder = $forum->getAttachmentPath($row['poster_id'],true)) // get Path and create Folder if needed. { e107::getMessage()->addDebug("Created Attachment Folder: ".$folder ); @@ -386,11 +386,11 @@ function convertAttachment($row) { e107::getMessage()->addError("Couldn't find/create attachment folder for user-id: ".$row['poster_id'] ); } - + foreach($this->forum_attachments[$id] as $file => $name) { - - if(preg_match('#.JPG|.jpg|.gif|.png|.PNG|.GIF|.jpeg|.JPEG$#',$name)) + + if(preg_match('#.JPG|.jpg|.gif|.png|.PNG|.GIF|.jpeg|.JPEG$#',(string) $name)) { $attach['img'][] = $file; } @@ -398,12 +398,12 @@ function convertAttachment($row) { $attach['file'][] = $file; } - + if($this->forum_attachment_path) // if path entered - then move the files. { $oldpath = e_BASE.$this->forum_attachment_path."/".$file; $newpath = $folder.$file; - + if(rename($oldpath,$newpath)) { e107::getMessage()->addDebug("Renamed file from {$oldpath} to {$newpath}" ); @@ -412,14 +412,14 @@ function convertAttachment($row) { e107::getMessage()->addError("Couldn't rename file from {$oldpath} to {$newpath}" ); } - + } - + } - + } - + return e107::serialize($attach); // set attachments } @@ -427,11 +427,11 @@ function convertAttachment($row) function convertText($text) { - $text = preg_replace('#]*)>#','$1',$text); // Smilies to text + $text = preg_replace('#]*)>#','$1',(string) $text); // Smilies to text $text = preg_replace('#\[img:([^\]]*)]([^\[]*)\[/img:([^\]]*)]#', '[img]$2[/img]', $text); // Image Bbcodes. $text = preg_replace('#([^<]*)#','[link=$1]$2[/link]',$text); // links $text = preg_replace('#([^<]*)#','[link=$1]$2[/link]',$text); // links - + $text = preg_replace('#\[attachment([^\]]*)]([^\[]*)\[/attachment:([^\]]*)]#','',$text); if(preg_match('#\[/url:([^\]]*)]#',$text, $match)) // strip bbcode hash. @@ -439,7 +439,7 @@ function convertText($text) $hash = $match[1]; $text = str_replace($hash,'',$text); } - + $text = html_entity_decode($text,ENT_NOQUOTES,'UTF-8'); $detected = mb_detect_encoding($text); // 'ISO-8859-1' @@ -468,7 +468,7 @@ function convertText($text) - + function convertForumParent(&$target, &$source) { @@ -485,7 +485,7 @@ function convertForumParent(&$target, &$source) } - + /** * $target - e107 table * $source - phpbb3 table diff --git a/e107_plugins/import/providers/rss_import_class.php b/e107_plugins/import/providers/rss_import_class.php index 4c1377c2d1..20ac5029a3 100644 --- a/e107_plugins/import/providers/rss_import_class.php +++ b/e107_plugins/import/providers/rss_import_class.php @@ -140,7 +140,7 @@ function copyUserData(&$target, &$source) function copyNewsData(&$target, &$source) { $this->foundImages = array(); - + if(!$content = $this->process('content_encoded',$source)) { $body = $this->process('description',$source); @@ -149,14 +149,14 @@ function copyNewsData(&$target, &$source) { $body = $content; } - + $body = $this->saveImages($body,'news'); $keywords = $this->process('category',$source); $sef = $this->process('sef',$source); - + if(!vartrue($source['title'][0])) { - list($title,$newbody) = explode("
",$body,2); + list($title,$newbody) = explode("
",(string) $body,2); $title = strip_tags($title); if(trim($newbody)!='') { @@ -167,14 +167,14 @@ function copyNewsData(&$target, &$source) { $title = $source['title'][0]; } - + $target['news_title'] = $title; $target['news_sef'] = $sef; $target['news_body'] = "[html]".$body."[/html]"; // $target['news_extended'] = ''; $target['news_meta_keywords'] = implode(",",$keywords); // $target['news_meta_description'] = ''; - $target['news_datestamp'] = strtotime($source['pubDate'][0]); + $target['news_datestamp'] = strtotime((string) $source['pubDate'][0]); // $target['news_author'] = $source['post_author']; // $target['news_category'] = ''; // $target['news_allow_comments'] = ($source['comment_status']=='open') ? 1 : 0; @@ -187,12 +187,12 @@ function copyNewsData(&$target, &$source) $target['news_thumbnail'] = !empty($this->foundImages[0]) ? $this->foundImages[0] : ''; // $target['news_sticky'] = ''; - - + + return $target; // comment out to debug - + // $this->renderDebug($source,$target); - + // DEBUG INFO BELOW. } @@ -252,7 +252,7 @@ function copyPageData(&$target, &$source) $target['page_text'] = "[html]".$body."[/html]"; // $target['page_metakeys'] = ''; // $target['page_metadscr'] = ''; - $target['page_datestamp'] = strtotime($source['pubDate'][0]); + $target['page_datestamp'] = strtotime((string) $source['pubDate'][0]); // $target['page_author'] = $source['post_author']; // $target['page_category'] = '', // $target['page_comment_flag'] = ($source['comment_status']=='open') ? 1 : 0; @@ -310,25 +310,25 @@ function saveImages($body,$cat='news') $result = $tp->getTags($body, 'img'); - + if($result) { - $relPath = 'images/'. substr(md5($this->feedUrl),0,10); - + $relPath = 'images/'. substr(md5((string) $this->feedUrl),0,10); + if(!is_dir(e_MEDIA.$relPath)) { mkdir(e_MEDIA.$relPath,'0755'); } - + foreach($result['img'] as $att) { - $filename = basename($att['src']); + $filename = basename((string) $att['src']); if(file_exists(e_MEDIA.$relPath."/".$filename)) { continue; } - + $fl->getRemoteFile($att['src'], $relPath."/".$filename, 'media'); if(filesize(e_MEDIA.$relPath."/".$filename) > 0) @@ -339,59 +339,59 @@ function saveImages($body,$cat='news') $replace[] = $src; } } - + } else { $mes->addDebug("No Images Found: ".print_a($result,true)); } - + if(count($search)) { $mes->addDebug("Found: ".print_a($search,true)); $mes->addDebug("Replaced: ".print_a($replace,true)); $med->import($cat,e_MEDIA.$relPath); } - + return str_replace($search,$replace,$body); - - + + /* - + // echo htmlentities($body); preg_match_all("/(((http:\/\/www)|(http:\/\/)|(www))[-a-zA-Z0-9@:%_\+.~#?&\/\/=]+)\.(jpg|jpeg|gif|png|svg)/im",$body,$matches); $fl = e107::getFile(); - + if(is_array($matches[0])) { $relPath = 'images/'. substr(md5($this->feedUrl),0,10); - + if(!is_dir(e_MEDIA.$relPath)) { mkdir(e_MEDIA.$relPath,'0755'); } - + foreach($matches[0] as $link) { $filename = basename($link); - + if(file_exists($relPath."/".$filename)) { continue; } - + $fl->getRemoteFile($link,$relPath."/".$filename, 'media'); - + $search[] = $link; $replace[] = $tp->createConstants(e_MEDIA.$relPath."/".$filename,1); } } - + if(count($search)) { $med->import($cat,e_MEDIA.$relPath); } - + return str_replace($search,$replace,$body);*/ } diff --git a/e107_plugins/import/providers/smf_import_class.php b/e107_plugins/import/providers/smf_import_class.php index ca70ea4d56..c6e4aafbc0 100644 --- a/e107_plugins/import/providers/smf_import_class.php +++ b/e107_plugins/import/providers/smf_import_class.php @@ -13,17 +13,17 @@ class smf_import extends base_import_class { - + public $title = 'SMF v2.x (Simple Machines Forum)'; public $description = 'Currently does not import membergroups or more than 1 post attachment '; public $supported = array('users','forum','forumthread','forumpost'); public $mprefix = 'smf_'; public $sourceType = 'db'; - + function init() { - + } function config() @@ -40,7 +40,7 @@ function config() return $var; } - + // Set up a query for the specified task. // Returns TRUE on success. FALSE on error function setupQuery($task, $blank_user=FALSE) @@ -50,17 +50,17 @@ function setupQuery($task, $blank_user=FALSE) e107::getMessage()->addDebug("Unable to connext"); return FALSE; } - + switch ($task) { case 'users' : - + // Set up Userclasses. if($this->ourDB && $this->ourDB->gen("SELECT * FROM {$this->DBPrefix}membergroups WHERE group_name = 'Jr. Member' ")) { e107::getMessage()->addDebug("Userclasses Found"); } - + $result = $this->ourDB->gen("SELECT * FROM {$this->DBPrefix}members WHERE `is_activated`=1"); if ($result === false) { @@ -69,8 +69,8 @@ function setupQuery($task, $blank_user=FALSE) return false; } break; - - + + case 'forum' : $qry = "SELECT f.*, m.id_member, m.poster_name, m.poster_time FROM {$this->DBPrefix}boards AS f LEFT JOIN {$this->DBPrefix}messages AS m ON f.id_last_msg = m.id_msg GROUP BY f.id_board "; @@ -82,7 +82,7 @@ function setupQuery($task, $blank_user=FALSE) return false; } break; - + case 'forumthread' : $qry = "SELECT t.*, m.poster_name, m.subject, m.poster_time, m.id_member, l.poster_name as lastpost_name, l.poster_time as lastpost_time, l.id_member as lastpost_user FROM {$this->DBPrefix}topics AS t @@ -94,7 +94,7 @@ function setupQuery($task, $blank_user=FALSE) if ($result === false) return false; break; - + case 'forumpost' : $qry = "SELECT m.*, a.filename, a.fileext, a.size FROM {$this->DBPrefix}messages AS m LEFT JOIN {$this->DBPrefix}attachments AS a ON m.id_msg = a.id_msg GROUP BY m.id_msg ORDER BY m.id_msg ASC "; @@ -107,18 +107,18 @@ function setupQuery($task, $blank_user=FALSE) //$result = $this->ourDB->gen("SELECT * FROM `{$this->DBPrefix}forums_track`"); //if ($result === FALSE) return FALSE; break; - + default : return FALSE; } - + $this->copyUserInfo = false; $this->currentTask = $task; return TRUE; } - - + + function convertUserclass($data) { if(empty($data)) @@ -153,21 +153,21 @@ function convertUserclass($data) 8 Hero Member 500 0 5#star.gif 0 0 -2 */ } - + function convertAdmin($data) { - + if($data == 1) { return 1; } - + } //------------------------------------ // Internal functions below here //------------------------------------ - + // Copy data read from the DB into the record to be returned. function copyUserData(&$target, &$source) { @@ -175,7 +175,7 @@ function copyUserData(&$target, &$source) { $target['user_id'] = 0; // $source['id_member']; } - + $target['user_name'] = $source['real_name']; $target['user_login'] = $source['member_name']; $target['user_loginname'] = $source['memberName']; @@ -201,10 +201,10 @@ function copyUserData(&$target, &$source) $target['user_birthday'] = $source['birthdate']; $target['user_admin'] = $this->convertAdmin($source['id_group']); $target['user_class'] = $this->convertUserclass($source['id_group']); - + $target['user_plugin_forum_viewed'] = 0; $target['user_plugin_forum_posts'] = $source['posts']; - + // $target['user_language'] = $source['lngfile']; // Guess to verify return $target; } @@ -217,7 +217,7 @@ function copyUserData(&$target, &$source) */ function copyForumData(&$target, &$source) { - + $target['forum_id'] = $source['id_board']; $target['forum_name'] = $source['name']; $target['forum_description'] = $source['description']; @@ -225,7 +225,7 @@ function copyForumData(&$target, &$source) $target['forum_sub'] = ($source['child_level'] > 1) ? $source['id_parent'] : 0; $target['forum_datestamp'] = time(); $target['forum_moderators'] = ""; - + $target['forum_threads'] = $source['num_topics']; $target['forum_replies'] = $source['num_posts']; $target['forum_lastpost_user'] = $source['id_member']; @@ -237,20 +237,20 @@ function copyForumData(&$target, &$source) $target['forum_threadclass'] = e_UC_MEMBER; $target['forum_options'] = e_UC_MEMBER; $target['forum_sef'] = eHelper::title2sef($source['name'],'dashl'); - + return $target; - + } - + /** * $target - e107 forum_threads * $source - smf topics. */ function copyForumThreadData(&$target, &$source) { - + $target['thread_id'] = (int) $source['id_topic']; $target['thread_name'] = $source['subject']; $target['thread_forum_id'] = (int) $source['id_board']; @@ -265,12 +265,12 @@ function copyForumThreadData(&$target, &$source) $target['thread_lastuser_anon'] = empty($source['lastpost_user']) ? $source['lastpost_name'] : null; $target['thread_total_replies'] = (int) $source['num_replies']; $target['thread_options'] = null; - + return $target; - + } - + /** * $target - e107_forum_post table * $source -smf @@ -293,7 +293,7 @@ function copyForumPostData(&$target, &$source) return $target; - + } @@ -370,7 +370,7 @@ function copyForumTrackData(&$target, &$source) * * * - + * * INSERT INTO {$db_prefix}membergroups diff --git a/e107_plugins/import/providers/template_import_class.php b/e107_plugins/import/providers/template_import_class.php index 745e1bcca1..40a96fd8c1 100644 --- a/e107_plugins/import/providers/template_import_class.php +++ b/e107_plugins/import/providers/template_import_class.php @@ -177,7 +177,7 @@ function copyUserData(&$target, &$source) $target['user_lastpost'] = $source['']; $target['user_chats'] = $source['']; $target['user_comments'] = $source['']; - + $target['user_ip'] = $source['']; $target['user_prefs'] = $source['']; $target['user_visits'] = $source['']; @@ -196,7 +196,7 @@ function copyUserData(&$target, &$source) $target['user_timezone'] = $source['']; $this->debug($source,$target); - + //return $target; } @@ -447,7 +447,7 @@ private function convertText($text) //$text = e107::getParser()->toDb($text); return $text; - $text = html_entity_decode($text,ENT_QUOTES,'UTF-8'); + $text = html_entity_decode((string) $text,ENT_QUOTES,'UTF-8'); $detected = mb_detect_encoding($text); // 'ISO-8859-1' $text = iconv($detected,'UTF-8',$text); diff --git a/e107_plugins/import/providers/wordpress_import_class.php b/e107_plugins/import/providers/wordpress_import_class.php index 2476329263..8aad15e4a2 100644 --- a/e107_plugins/import/providers/wordpress_import_class.php +++ b/e107_plugins/import/providers/wordpress_import_class.php @@ -37,10 +37,10 @@ class wordpress_import extends base_import_class function init() { - - + + $this->newsAuthor = intval($_POST['news_author']); - + // if($data = e107::getDb('phpbb')->retrieve('userclass_classes','userclass_id',"userclass_name='FORUM_MODERATOR' ")) // { // $this->forum_moderator_class = $data; @@ -169,13 +169,13 @@ function copyUserData(&$target, &$source) { $target['user_id'] = $source['ID']; } - + $target['user_name'] = $source['user_nicename']; $target['user_loginname'] = $source['user_login']; $target['user_password'] = $source['user_pass']; // needs to be salted!!!! $target['user_email'] = $source['user_email']; $target['user_hideemail'] = $source['user_hideemail']; - $target['user_join'] = strtotime($source['user_registered']); + $target['user_join'] = strtotime((string) $source['user_registered']); $target['user_admin'] = ($user_meta['administrator'] == 1) ? 1 : 0; $target['user_lastvisit'] = $source['user_lastvisit']; $target['user_login'] = $source['firstname']." ".$source['lastname']; @@ -188,7 +188,7 @@ function copyUserData(&$target, &$source) $target['user_lastpost'] = $source['user_lastpost']; $target['user_chats'] = $source['user_chats']; $target['user_comments'] = $source['user_comments']; - + $target['user_ip'] = $source['user_ip']; $target['user_prefs'] = $source['user_prefs']; $target['user_visits'] = $source['user_visits']; @@ -207,7 +207,7 @@ function copyUserData(&$target, &$source) $target['user_timezone'] = $source['user_timezone']; $this->renderDebug($source,$target); - + //return $target; } @@ -251,7 +251,7 @@ function copyNewsData(&$target, &$source) // $target['news_extended'] = ''; // $target['news_meta_keywords'] = ''; // $target['news_meta_description'] = ''; - $target['news_datestamp'] = strtotime($source['post_date']); + $target['news_datestamp'] = strtotime((string) $source['post_date']); $target['news_author'] = ($this->newsAuthor !=0) ? $this->newsAuthor : $source['post_author']; // $target['news_category'] = ''; $target['news_allow_comments'] = ($source['comment_status']=='open') ? 1 : 0; @@ -310,7 +310,7 @@ function copyPageData(&$target, &$source) $target['page_text'] = (vartrue($source['post_content'])) ? "[html]".$this->convertText($source['post_content'])."[/html]" : ""; $target['page_metakeys'] = ''; $target['page_metadscr'] = ''; - $target['page_datestamp'] = strtotime($source['post_date']); + $target['page_datestamp'] = strtotime((string) $source['post_date']); $target['page_author'] = $source['post_author']; // $target['page_category'] = '', $target['page_comment_flag'] = ($source['comment_status']=='open') ? 1 : 0; @@ -394,7 +394,7 @@ function convertText($text) //$text = e107::getParser()->toDb($text); return $text; - $text = html_entity_decode($text,ENT_QUOTES,'UTF-8'); + $text = html_entity_decode((string) $text,ENT_QUOTES,'UTF-8'); $detected = mb_detect_encoding($text); // 'ISO-8859-1' $text = iconv($detected,'UTF-8',$text); diff --git a/e107_plugins/import/providers/xoops_import_class.php b/e107_plugins/import/providers/xoops_import_class.php index 91e7a290fd..d609aa6e54 100644 --- a/e107_plugins/import/providers/xoops_import_class.php +++ b/e107_plugins/import/providers/xoops_import_class.php @@ -451,7 +451,7 @@ private function convertText($text) //$text = e107::getParser()->toDb($text); return $text; - $text = html_entity_decode($text,ENT_QUOTES,'UTF-8'); + $text = html_entity_decode((string) $text,ENT_QUOTES,'UTF-8'); $detected = mb_detect_encoding($text); // 'ISO-8859-1' $text = iconv($detected,'UTF-8',$text); diff --git a/e107_plugins/linkwords/e_parse.php b/e107_plugins/linkwords/e_parse.php index 93e38749a0..717ff3a4aa 100644 --- a/e107_plugins/linkwords/e_parse.php +++ b/e107_plugins/linkwords/e_parse.php @@ -97,7 +97,7 @@ public function setLink($arr) private function loadRow($lw, $row) { - $lw = trim($lw); + $lw = trim((string) $lw); if(empty($lw)) { @@ -143,7 +143,7 @@ public function toHTML($text,$area = 'olddefault') $cflag = false; // commented code prsent. // Shouldn't need utf-8 on next line - just looking for HTML tags - $content = preg_split('#(<.*?>)#mis', $text, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE ); + $content = preg_split('#(<.*?>)#mis', (string) $text, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE ); $range = range(1,5); @@ -289,12 +289,12 @@ function linksproc($text,$first,$limit) } // This splits the text into blocks, some of which will precisely contain a linkword - $split_line = preg_split('#\b('.$lw.')(\s|\b)#i'.$this->utfMode, $text, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE ); // *utf (selected) + $split_line = preg_split('#\b('.$lw.')(\s|\b)#i'.$this->utfMode, (string) $text, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE ); // *utf (selected) // $class = "".implode(' ',$lwClass)."' "; $class = implode(' ',$lwClass); - $hash = md5($lw); + $hash = md5((string) $lw); $this->hash = $hash; if(!isset($this->wordCount[$hash])) @@ -373,7 +373,7 @@ public function init() // Now see if disabled on specific pages $check_url = e_SELF . (defined('e_QUERY') ? "?" . e_QUERY : ''); - $this->block_list = explode("|", substr(varset($pref['lw_page_visibility']), 2)); // Knock off the 'show/hide' flag + $this->block_list = explode("|", substr((string) varset($pref['lw_page_visibility']), 2)); // Knock off the 'show/hide' flag foreach($this->block_list as $p) { diff --git a/e107_plugins/list_new/list_admin_class.php b/e107_plugins/list_new/list_admin_class.php index aebcebb848..9ddfdc6445 100644 --- a/e107_plugins/list_new/list_admin_class.php +++ b/e107_plugins/list_new/list_admin_class.php @@ -51,13 +51,13 @@ function db_update_menu() // { // if($value != LIST_ADMIN_2){ $temp[$tp->toDB($key)] = $tp->toDB($value); } // } - + e107::getPlugConfig('list_new')->reset()->setPref($_POST)->save(true); // retrieve with e107::pref('list_new'); - + return; - + /* if ($this->e107->admin_log->logArrayDiffs($temp, $list_pref, 'LISTNEW_01')) { @@ -562,7 +562,7 @@ function pref_submit() { $frm = e107::getForm(); - + $this->row['TOPIC'] = LIST_ADMIN_11; $this->row['FIELD'] = $frm->admin_button('update_menu',LIST_ADMIN_2,'update'); diff --git a/e107_plugins/list_new/list_class.php b/e107_plugins/list_new/list_class.php index fef1fdb79e..35fdf28482 100644 --- a/e107_plugins/list_new/list_class.php +++ b/e107_plugins/list_new/list_class.php @@ -104,7 +104,7 @@ function parseTemplate($template) function getListPrefs() { $listPrefs = e107::pref('list_new'); //TODO Convert from old format to new. - + //insert default preferences if (empty( $listPrefs)) { @@ -149,9 +149,9 @@ function prepareSection($mode) //get all sections to use foreach($this->list_pref as $key=>$value) { - if(substr($key,-$len) == "_{$mode}_display" && $value == "1") + if(substr((string) $key,-$len) == "_{$mode}_display" && $value == "1") { - $sections[] = substr($key,0,-$len); + $sections[] = substr((string) $key,0,-$len); } } return $sections; diff --git a/e107_plugins/list_new/section/list_news.php b/e107_plugins/list_new/section/list_news.php index 020e011201..d0a84e2825 100644 --- a/e107_plugins/list_new/section/list_news.php +++ b/e107_plugins/list_new/section/list_news.php @@ -136,6 +136,6 @@ function parse_news_title($title) $replace[4] = '\\2'; $search[5] = "/\(.*?)<\/a>/si"; $replace[5] = '\\2'; - return preg_replace($search, $replace, $title); + return preg_replace($search, $replace, (string) $title); } } diff --git a/e107_plugins/login_menu/login_menu.php b/e107_plugins/login_menu/login_menu.php index 3e143d9653..8b5d2319cc 100644 --- a/e107_plugins/login_menu/login_menu.php +++ b/e107_plugins/login_menu/login_menu.php @@ -52,7 +52,7 @@ {$bullet} ".LAN_LOGOUT.""; $ns->tablerender(LAN_LOGINMENU_9, $text, 'login_error'); } - + //Image code $use_imagecode = ($pref['logcode'] && extension_loaded('gd')); @@ -64,7 +64,7 @@ } $text = ''; - + // START LOGGED CODE if (USER == TRUE || ADMIN == TRUE) { @@ -127,16 +127,16 @@ $menu_data['new_users'] = $sql->count('user', '(user_join)', 'WHERE user_join > '.$time); $new_total += $menu_data['new_users']; } - + // ------------ Enable stats / other --------------- - + $menu_data['enable_stats'] = $menu_data || vartrue($loginPrefs['external_stats']) ? true : false; $menu_data['new_total'] = $new_total + $loginClass->get_stats_total(); $menu_data['link_bullet'] = $bullet; $menu_data['link_bullet_src'] = $bullet_src; - + // ------------ List New Link --------------- - + $menu_data['listnew_link'] = ''; if ($menu_data['new_total'] && array_key_exists('list_new', $pref['plug_installed'])) { @@ -146,14 +146,14 @@ // ------------ Pass the data & parse ------------ e107::setRegistry('login_menu_data', $menu_data); $text = $tp->parseTemplate($LOGIN_MENU_LOGGED, true, $login_menu_shortcodes); - + //menu caption if (file_exists(THEME.'images/login_menu.png')) { $caption = ''.LAN_LOGINMENU_5.' '.USERNAME; } else { $caption = LAN_LOGINMENU_5.' '.USERNAME; } - + $ns->tablerender($caption, $text, 'login'); diff --git a/e107_plugins/login_menu/login_menu_class.php b/e107_plugins/login_menu/login_menu_class.php index e61f842357..ee461cd078 100644 --- a/e107_plugins/login_menu/login_menu_class.php +++ b/e107_plugins/login_menu/login_menu_class.php @@ -86,7 +86,7 @@ function get_external_list($sort = true) { foreach ($list_arr as $item) { - $path = explode('/', trim($item['path'], '/.')); + $path = explode('/', trim((string) $item['path'], '/.')); $tmp = end($path); if(e107::isInstalled($tmp)) @@ -98,7 +98,7 @@ function get_external_list($sort = true) if($sort && $this->loginPrefs['external_links']) { - $tmp = array_flip(explode(',', $this->loginPrefs['external_links'])); + $tmp = array_flip(explode(',', (string) $this->loginPrefs['external_links'])); $cnt = count($tmp); foreach ($list as $value) { @@ -123,8 +123,8 @@ function parse_external_list($active=false, $order=true) //$lbox_admin = varsettrue($eplug_admin, false); $coreplugs = $this->get_coreplugs(); - $lprefs = vartrue($this->loginPrefs['external_links']) ? explode(',', $this->loginPrefs['external_links']) : array(); - $sprefs = vartrue($this->loginPrefs['external_stats']) ? explode(',', $this->loginPrefs['external_stats']) : array(); + $lprefs = vartrue($this->loginPrefs['external_links']) ? explode(',', (string) $this->loginPrefs['external_links']) : array(); + $sprefs = vartrue($this->loginPrefs['external_stats']) ? explode(',', (string) $this->loginPrefs['external_stats']) : array(); if($active) { @@ -232,7 +232,7 @@ function render_config_links() $lbox_infos = $this->parse_external_list(false); if(!vartrue($lbox_infos['links'])) return ''; - $enabled = vartrue($this->loginPrefs['external_links']) ? explode(',', $this->loginPrefs['external_links']) : array(); + $enabled = vartrue($this->loginPrefs['external_links']) ? explode(',', (string) $this->loginPrefs['external_links']) : array(); $num = 1; foreach ($lbox_infos['links'] as $id => $stack) { @@ -284,7 +284,7 @@ function render_config_stats() if(!$lbox_infos) return ''; - $enabled = vartrue($this->loginPrefs['external_stats']) ? explode(',', $this->loginPrefs['external_stats']) : array(); + $enabled = vartrue($this->loginPrefs['external_stats']) ? explode(',', (string) $this->loginPrefs['external_stats']) : array(); $num = 1; foreach ($lbox_infos as $id => $stack) @@ -324,7 +324,7 @@ function get_stats_total() } $ret = 0; - $lbox_active_sorted = $this->loginPrefs['external_stats'] ? explode(',', $this->loginPrefs['external_stats']) : array(); + $lbox_active_sorted = $this->loginPrefs['external_stats'] ? explode(',', (string) $this->loginPrefs['external_stats']) : array(); foreach ($lbox_active_sorted as $stackid) { diff --git a/e107_plugins/login_menu/login_menu_shortcodes.php b/e107_plugins/login_menu/login_menu_shortcodes.php index 3411509e74..91ae95ed34 100755 --- a/e107_plugins/login_menu/login_menu_shortcodes.php +++ b/e107_plugins/login_menu/login_menu_shortcodes.php @@ -340,7 +340,7 @@ function sc_lm_external_links($parm='') } $lbox_infos = $lmc->parse_external_list(true, false); - $lbox_active = $menu_pref['login_menu']['external_links'] ? explode(',', $menu_pref['login_menu']['external_links']) : array(); + $lbox_active = $menu_pref['login_menu']['external_links'] ? explode(',', (string) $menu_pref['login_menu']['external_links']) : array(); if(!vartrue($lbox_infos['links'])) { @@ -467,7 +467,7 @@ function sc_lm_plugin_stats($parm='') if(!vartrue($lbox_infos['stats'])) return ''; - $lbox_active_sorted = $menu_pref['login_menu']['external_stats'] ? explode(',', $menu_pref['login_menu']['external_stats']) : array(); + $lbox_active_sorted = $menu_pref['login_menu']['external_stats'] ? explode(',', (string) $menu_pref['login_menu']['external_stats']) : array(); $ret = array(); diff --git a/e107_plugins/news/e_gsitemap.php b/e107_plugins/news/e_gsitemap.php index 6d4ebd6015..0266f25e88 100644 --- a/e107_plugins/news/e_gsitemap.php +++ b/e107_plugins/news/e_gsitemap.php @@ -119,7 +119,7 @@ public function allPosts() 'lastmod' => !empty($row['news_modified']) ? $row['news_modified'] : (int) $row['news_datestamp'], 'freq' => 'hourly', 'priority' => 0.5, - 'image' => (strpos($imgUrl, 'http') === 0) ? $imgUrl : SITEURLBASE.$sc->sc_news_image(['item'=>1, 'type'=>'src']), + 'image' => (strpos((string) $imgUrl, 'http') === 0) ? $imgUrl : SITEURLBASE.$sc->sc_news_image(['item'=>1, 'type'=>'src']), ]; } diff --git a/e107_plugins/news/e_related.php b/e107_plugins/news/e_related.php index e8c0be355f..509af56811 100644 --- a/e107_plugins/news/e_related.php +++ b/e107_plugins/news/e_related.php @@ -23,9 +23,9 @@ function compile($tags,$parm=array()) { $sql = e107::getDb(); $items = array(); - + $tag_regexp = "'(^|,)(".str_replace(",", "|", $tags).")(,|$)'"; - + // $query = "SELECT * FROM #news WHERE news_id != ".$parm['current']." AND news_class REGEXP '".e_CLASS_REGEXP."' AND news_meta_keywords REGEXP ".$tag_regexp." ORDER BY news_datestamp DESC LIMIT ".$parm['limit']; $query = "SELECT n.*, nc.category_id, nc.category_name, nc.category_sef @@ -38,7 +38,7 @@ function compile($tags,$parm=array()) { while($row = $sql->fetch()) { - $thumbs = !empty($row['news_thumbnail']) ? explode(",",$row['news_thumbnail']) : array(); + $thumbs = !empty($row['news_thumbnail']) ? explode(",",(string) $row['news_thumbnail']) : array(); $items[] = array( 'title' => varset($row['news_title']), @@ -48,7 +48,7 @@ function compile($tags,$parm=array()) 'date' => e107::getParser()->toDate(varset($row['news_datestamp']), 'short'), ); } - + return $items; } //elseif(ADMIN) diff --git a/e107_plugins/news/e_rss.php b/e107_plugins/news/e_rss.php index 09fef8d706..bd9c21cf3f 100644 --- a/e107_plugins/news/e_rss.php +++ b/e107_plugins/news/e_rss.php @@ -142,7 +142,7 @@ function getDescription($row) if($this->showImages == true && !empty($row['news_thumbnail'])) { - $tmp = explode(",", $row['news_thumbnail']); + $tmp = explode(",", (string) $row['news_thumbnail']); foreach($tmp as $img) { @@ -166,7 +166,7 @@ function getMedia($row) return ''; } - $tmp = explode(",", $row['news_thumbnail']); + $tmp = explode(",", (string) $row['news_thumbnail']); $ret = array(); diff --git a/e107_plugins/news/e_search.php b/e107_plugins/news/e_search.php index d5f17f0bcb..e8ba63cce7 100644 --- a/e107_plugins/news/e_search.php +++ b/e107_plugins/news/e_search.php @@ -8,7 +8,7 @@ * * Chatbox e_search addon */ - + if (!defined('e107_INIT')) { exit; } @@ -17,15 +17,15 @@ class news_search extends e_search // include plugin-folder in the name. { - + function config() { $sql = e107::getDb(); - + $catList = array(); - + $catList[] = array('id' => 'all', 'title' => LAN_SEARCH_51); - + if ($sql ->select("news_category", "category_id, category_name")) { while($row = $sql->fetch()) @@ -34,14 +34,14 @@ function config() // $advanced_caption['title'][$row['category_id']] = 'News -> '.$row['category_name']; } } - - + + $matchList = array( array('id' => 0, 'title' => LAN_SEARCH_53), array('id' => 1, 'title' => LAN_SEARCH_54) ); - + $search = array( 'name' => LAN_SEARCH_98, 'table' => 'news AS n LEFT JOIN #news_category AS c ON n.news_category = c.category_id', @@ -51,10 +51,10 @@ function config() 'date'=> array('type' => 'date', 'text' => LAN_DATE_POSTED), 'match'=> array('type' => 'dropdown', 'text' => LAN_SEARCH_52, 'list'=>$matchList) ), - + 'return_fields' => array('n.news_id', 'n.news_title', 'n.news_sef', 'n.news_body', 'n.news_extended', 'n.news_allow_comments', 'n.news_datestamp', 'n.news_category', 'c.category_name'), 'search_fields' => array('n.news_title' => '1.2', 'n.news_body' => '0.6', 'n.news_extended' => '0.6', 'n.news_summary' => '1.2', 'n.news_meta_keywords'=>'1.1', 'n.news_meta_description'=>'1.1'), // fields and their weights. - + 'order' => array('news_datestamp' => 'DESC'), 'refpage' => 'news.php' ); @@ -69,18 +69,18 @@ function config() function compile($row) { $tp = e107::getParser(); - + $res = array(); - + $res['link'] = e107::getUrl()->create('news/view/item', $row);//$row['news_allow_comments'] ? "news.php?item.".$row['news_id'] : "comment.php?comment.news.".$row['news_id']; $res['pre_title'] = $tp->toHTML($row['category_name'],false,'TITLE')." | "; $res['title'] = $row['news_title']; $res['summary'] = $row['news_body'].' '.$row['news_extended']; $res['detail'] = LAN_SEARCH_3.$tp->toDate($row['news_datestamp'], "long"); $res['image'] = $row['news_thumbnail']; - + return $res; - + } @@ -92,22 +92,22 @@ function compile($row) function where($parm=null) { $tp = e107::getParser(); - + $time = time(); - + $qry = "(news_start < ".$time.") AND (news_end=0 OR news_end > ".$time.") AND news_class IN (".USERCLASS_LIST.") AND"; - + if (isset($parm['cat']) && $parm['cat'] != 'all') { $qry .= " c.category_id='".intval($parm['cat'])."' AND"; } - + if (isset($parm['time']) && is_numeric($parm['time'])) { $qry .= " n.news_datestamp ".($parm['on'] == 'new' ? '>=' : '<=')." '".(time() - $parm['time'])."' AND"; } - + return $qry; } - + } diff --git a/e107_plugins/news/news.php b/e107_plugins/news/news.php index 1604b81ddd..ccce7093f3 100644 --- a/e107_plugins/news/news.php +++ b/e107_plugins/news/news.php @@ -211,7 +211,7 @@ private function renderNewForumPosts() private function getRenderId() { - $tmp = explode('/',$this->route); + $tmp = explode('/',(string) $this->route); if(!empty($this->templateKey)) { @@ -385,13 +385,13 @@ private function setRoute() $tp = e107::getParser(); - if(vartrue($_GET['tag']) || substr($this->action,0,4) == 'tag=') + if(vartrue($_GET['tag']) || substr((string) $this->action,0,4) == 'tag=') { $this->route = 'news/list/tag'; if(!vartrue($_GET['tag'])) { - list($this->action,$word) = explode("=",$this->action,2); + list($this->action,$word) = explode("=",(string) $this->action,2); $_GET['tag'] = $word; unset($word,$tmp); } @@ -400,13 +400,13 @@ private function setRoute() $this->from = intval(varset($_GET['page'],0)); } - if(!empty($_GET['author']) || substr($this->action,0,4) == 'author=') + if(!empty($_GET['author']) || substr((string) $this->action,0,4) == 'author=') { $this->route = 'news/list/author'; if(!vartrue($_GET['author'])) { - list($action,$author) = explode("=",$this->action,2); + list($action,$author) = explode("=",(string) $this->action,2); $_GET['author'] = $author; unset($author,$tmp); } @@ -631,7 +631,7 @@ private function setNewsFrontMeta($news, $type='news') - $title = strip_tags($title); + $title = strip_tags((string) $title); $this->dayMonth = $title; @@ -725,8 +725,8 @@ private function setNewsFrontMeta($news, $type='news') // include news-thumbnail/image in meta. - always put this one first. if(!empty($news['news_thumbnail'])) { - $iurl = (substr($news['news_thumbnail'],0,3)=="{e_") ? $news['news_thumbnail'] : SITEURL.e_IMAGE."newspost_images/".$news['news_thumbnail']; - $tmp = explode(",", $iurl); + $iurl = (substr((string) $news['news_thumbnail'],0,3)=="{e_") ? $news['news_thumbnail'] : SITEURL.e_IMAGE."newspost_images/".$news['news_thumbnail']; + $tmp = explode(",", (string) $iurl); if(!empty($tmp[0]) && substr($tmp[0],-8) !== '.youtube') { @@ -756,7 +756,7 @@ private function setNewsFrontMeta($news, $type='news') foreach($youtube as $yt) { if($c == 3){ break; } - list($img,$tmp) = explode("?",$yt); + list($img,$tmp) = explode("?",(string) $yt); e107::meta('og:image',"https://img.youtube.com/vi/".$img."/0.jpg"); $c++; } @@ -773,7 +773,7 @@ private function setNewsFrontMeta($news, $type='news') if($news['news_meta_keywords'] && !defined('META_KEYWORDS')) { e107::meta('keywords',$news['news_meta_keywords']); - $tmp = explode(",",$news['news_meta_keywords']); + $tmp = explode(",",(string) $news['news_meta_keywords']); foreach($tmp as $t) { e107::meta('article:tag', trim($t)); @@ -1060,8 +1060,8 @@ private function renderListTemplate() { if(!empty($row['news_thumbnail'])) { - $iurl = (substr($row['news_thumbnail'],0,3)=="{e_") ? $row['news_thumbnail'] : SITEURL.e_IMAGE."newspost_images/".$row['news_thumbnail']; - $tmp = explode(",", $iurl); + $iurl = (substr((string) $row['news_thumbnail'],0,3)=="{e_") ? $row['news_thumbnail'] : SITEURL.e_IMAGE."newspost_images/".$row['news_thumbnail']; + $tmp = explode(",", (string) $iurl); if($tp->isImage($tmp[0])) { @@ -1179,7 +1179,7 @@ private function renderListTemplate() { e107::setRegistry('core/news/pagination', $parms); $text .= $tp->parseTemplate($template['end']); - if(strpos($template['end'], '{NEWS_PAGINATION') !== false) + if(strpos((string) $template['end'], '{NEWS_PAGINATION') !== false) { $paginationSC = true; $this->addDebug("Pagination Shortcode", 'true'); @@ -1979,7 +1979,7 @@ private function renderDefaultTemplate() e107::setRegistry('core/news/pagination', $parms); $nsc = e107::getScBatch('news')->setScVar('news_item', $newsAr[1])->setScVar('param', $param); echo $tp->parseTemplate($tmpl['end'], true, $nsc); - if(strpos($tmpl['end'], '{NEWS_PAGINATION') !== false) // BC fix. + if(strpos((string) $tmpl['end'], '{NEWS_PAGINATION') !== false) // BC fix. { $paginationSC = true; $this->addDebug("Pagination Shortcode", 'true'); diff --git a/e107_plugins/news/news_archive_menu.php b/e107_plugins/news/news_archive_menu.php index 6fbd8e460c..8de80140c0 100644 --- a/e107_plugins/news/news_archive_menu.php +++ b/e107_plugins/news/news_archive_menu.php @@ -36,7 +36,7 @@ { $text = "Missing Template. Check that your theme's news_menu_template.php file contains an 'archive' template. "; } - + foreach($arr as $year=>$val) { if($year == date('Y')) @@ -51,17 +51,17 @@ } $id = "news-archive-".$year; - + $var = array('EXPANDOPEN' => $expandOpen, 'YEAR_ID' => $id, 'YEAR_NAME' => $year, 'YEAR_DISPLAY' => $displayYear - + ); - + $text .= $tp->simpleParse($template['year_start'], $var); - + foreach($val as $month=>$items) { //$displayMonth = ($mCount === 1) ? 'display:block': 'display:none'; @@ -72,16 +72,16 @@ 'MONTH_NAME' => $monthLabels[$month], 'MONTH_COUNT'=> count($items), ); - + $text .= $tp->simpleParse($template['month_start'], $var); - + /* if(!empty($parm['badges'])) // param only (no menu-manager config. To be replaced by template. { $num = count($items); $text .= "".$num.""; } */ - + foreach($items as $row) { @@ -93,7 +93,7 @@ } $text .= $template['month_end']; } - + $text .= $template['year_end']; } diff --git a/e107_plugins/news/news_months_menu.php b/e107_plugins/news/news_months_menu.php index 66dadfd79a..557df39366 100644 --- a/e107_plugins/news/news_months_menu.php +++ b/e107_plugins/news/news_months_menu.php @@ -31,9 +31,9 @@ { function newsFormatDate($year, $month, $day = "") { $date = $year; - $date .= (strlen($month) < 2)?"0".$month: + $date .= (strlen((string) $month) < 2)?"0".$month: $month; - $date .= (strlen($day) < 2 && $day != "")?"0".$day: + $date .= (strlen((string) $day) < 2 && $day != "")?"0".$day: $day; return $date; } diff --git a/e107_plugins/newsfeed/admin_config.php b/e107_plugins/newsfeed/admin_config.php index 7cba547bb4..ab8e13fc12 100644 --- a/e107_plugins/newsfeed/admin_config.php +++ b/e107_plugins/newsfeed/admin_config.php @@ -225,7 +225,7 @@ function newsfeed_image($curVal,$mode) case 'write': // Edit Page - $tmp = explode('::',$curVal); + $tmp = explode('::',(string) $curVal); return $frm->text('newsfeed_image',$tmp[0], 255, 'size=large'); break; @@ -275,7 +275,7 @@ function newsfeed_showmain($curVal,$mode) { case 'read': // List Page $data = $this->getController()->getListModel()->get('newsfeed_image'); - list($image,$menu,$main) = explode('::',$data); + list($image,$menu,$main) = explode('::',(string) $data); return intval($main); break; @@ -283,7 +283,7 @@ function newsfeed_showmain($curVal,$mode) case 'write': // Edit Page $data = $this->getController()->getModel()->get('newsfeed_image'); - list($image,$menu,$main) = explode('::',$data); + list($image,$menu,$main) = explode('::',(string) $data); if(empty($main)) { @@ -310,14 +310,14 @@ function newsfeed_showmenu($curVal,$mode) { case 'read': // List Page $data = $this->getController()->getListModel()->get('newsfeed_image'); - list($image,$menu,$main) = explode('::',$data); + list($image,$menu,$main) = explode('::',(string) $data); return intval($menu); break; case 'write': // Edit Page $data = $this->getController()->getModel()->get('newsfeed_image'); - list($image,$menu,$main) = explode('::',$data); + list($image,$menu,$main) = explode('::',(string) $data); if(empty($menu)) { diff --git a/e107_plugins/newsfeed/newsfeed_functions.php b/e107_plugins/newsfeed/newsfeed_functions.php index f8156be5f0..f49442a533 100644 --- a/e107_plugins/newsfeed/newsfeed_functions.php +++ b/e107_plugins/newsfeed/newsfeed_functions.php @@ -96,17 +96,17 @@ function readFeedList($force=FALSE) while ($row = $sql->fetch()) { $nfID = $row['newsfeed_id']; - + if (!empty($row['newsfeed_data'])) { $this->newsList[$nfID]['newsfeed_data'] = $row['newsfeed_data']; // Pull out the actual news - might as well since we're here - + unset($row['newsfeed_data']); // Don't keep this in memory twice! } $this->newsList[$nfID]['newsfeed_timestamp'] = $row['newsfeed_timestamp']; - + $this->feedList[$nfID] = $row; // Put the rest into the feed data } $this->validFeedList = TRUE; @@ -142,7 +142,7 @@ function getFeed($feedID, $force = FALSE) $cachedData = e107::getCache()->retrieve(NEWSFEED_NEWS_CACHE_TAG.$feedID,$maxAge, true); - if(empty($this->newsList[$feedID]['newsfeed_timestamp']) || empty($cachedData) || (!empty($this->newsList[$feedID]['newsfeed_data']) && strpos($this->newsList[$feedID]['newsfeed_data'],'MagpieRSS'))) //BC Fix to update newsfeed_data from v1 to v2 spec. + if(empty($this->newsList[$feedID]['newsfeed_timestamp']) || empty($cachedData) || (!empty($this->newsList[$feedID]['newsfeed_data']) && strpos((string) $this->newsList[$feedID]['newsfeed_data'],'MagpieRSS'))) //BC Fix to update newsfeed_data from v1 to v2 spec. { $force = true; // e107::getDebug()->log("NewsFeed Force"); @@ -172,7 +172,7 @@ function getFeed($feedID, $force = FALSE) if($rawData = $xml->getRemoteFile($this->feedList[$feedID]['newsfeed_url'])) // Need to update feed { $rss = new MagpieRSS( $rawData ); - list($newsfeed_image, $newsfeed_showmenu, $newsfeed_showmain) = explode("::", $this->feedList[$feedID]['newsfeed_image']); + list($newsfeed_image, $newsfeed_showmenu, $newsfeed_showmain) = explode("::", (string) $this->feedList[$feedID]['newsfeed_image']); $temp['channel'] = $rss->channel; @@ -314,8 +314,8 @@ function newsfeedInfo($which, $where = 'main') { if (($rss = $this->getFeed($nfID))) // Call ensures that feed is updated if necessary { - list($newsfeed_image, $newsfeed_showmenu, $newsfeed_showmain) = explode("::", $feed['newsfeed_image']); - + list($newsfeed_image, $newsfeed_showmenu, $newsfeed_showmain) = explode("::", (string) $feed['newsfeed_image']); + $numtoshow = intval($where == 'main' ? $newsfeed_showmain : $newsfeed_showmenu); $numtoshow = ($numtoshow > 0 ? $numtoshow : 999); @@ -326,7 +326,7 @@ function newsfeedInfo($which, $where = 'main') $vars['FEEDDESCRIPTION'] = $feed['newsfeed_description']; $vars['FEEDIMAGE'] = $rss['newsfeed_image_link']; $vars['FEEDLANGUAGE'] = $rss['channel']['language']; - + if($rss['channel']['lastbuilddate']) { $pubbed = $rss['channel']['lastbuilddate']; @@ -359,9 +359,9 @@ function newsfeedInfo($which, $where = 'main') { $vars['LINKTOMAIN'] = ""; } - + $data = ""; - + $numtoshow = min($numtoshow, count($rss['items'])); $i = 0; while($i < $numtoshow) @@ -369,12 +369,12 @@ function newsfeedInfo($which, $where = 'main') $item = $rss['items'][$i]; - + $vars['FEEDITEMLINK'] = "".$tp -> toHTML($item['title'], FALSE)."\n"; $vars['FEEDITEMLINK'] = str_replace('&', '&', $vars['FEEDITEMLINK']); - $feeditemtext = preg_replace("#\[[a-z0-9=]+\]|\[\/[a-z]+\]|\{[A-Z_]+\}#si", "", strip_tags($item['description'])); + $feeditemtext = preg_replace("#\[[a-z0-9=]+\]|\[\/[a-z]+\]|\{[A-Z_]+\}#si", "", strip_tags((string) $item['description'])); $vars['FEEDITEMCREATOR'] = $tp -> toHTML(vartrue($item['author']), FALSE); - + if ($where == 'main') { if(!empty($NEWSFEED_COLLAPSE)) @@ -391,7 +391,7 @@ function newsfeedInfo($which, $where = 'main') { $vars['FEEDITEMLINK'] = "".$tp -> toHTML($item['title'], FALSE)."\n"; $vars['FEEDITEMLINK'] = str_replace('&', '&', $vars['FEEDITEMLINK']); - $feeditemtext = preg_replace("#\[[a-z0-9=]+\]|\[\/[a-z]+\]|\{[A-Z_]+\}#si", "", $item['description']); + $feeditemtext = preg_replace("#\[[a-z0-9=]+\]|\[\/[a-z]+\]|\{[A-Z_]+\}#si", "", (string) $item['description']); $vars['FEEDITEMTEXT'] = $tp -> toHTML($feeditemtext, FALSE)."\n"; } $data .= $tp->simpleParse( $NEWSFEED_MAIN, $vars); diff --git a/e107_plugins/newsletter/admin_config.php b/e107_plugins/newsletter/admin_config.php index 4ccb703060..6f99d5f913 100644 --- a/e107_plugins/newsletter/admin_config.php +++ b/e107_plugins/newsletter/admin_config.php @@ -86,7 +86,7 @@ public function __construct() foreach($_POST as $key => $value) { $key = $tp->toDB($key); - if(strpos($key, 'nlmailnow') === 0) + if(strpos((string) $key, 'nlmailnow') === 0) { $this->releaseIssue($key); break; @@ -154,7 +154,7 @@ function showExistingNewsletters() ".$data['newsletter_id']." ".$data['newsletter_title']." - ".((substr_count($data['newsletter_subscribers'], chr(1))!= 0)?"".substr_count($data['newsletter_subscribers'], chr(1))."":substr_count($data['newsletter_subscribers'], chr(1)))." + ".((substr_count((string) $data['newsletter_subscribers'], chr(1))!= 0)?"".substr_count((string) $data['newsletter_subscribers'], chr(1))."":substr_count((string) $data['newsletter_subscribers'], chr(1)))." ".ADMIN_EDIT_ICON." toAttribute($tp->toJSON(LAN_CONFIRMDEL." [ID: ".$data['newsletter_id']." ]")).") \"/> @@ -440,7 +440,7 @@ function releaseIssue($issue) return FALSE; } $newsletterParentInfo = $sql->fetch(); - $memberArray = explode(chr(1), $newsletterParentInfo['newsletter_subscribers']); + $memberArray = explode(chr(1), (string) $newsletterParentInfo['newsletter_subscribers']); require(e_HANDLER.'mail_manager_class.php'); $mailer = new e107MailManager; @@ -559,7 +559,7 @@ function deleteNewsletter() $mes = e107::getMessage(); $tmp = key($_POST['delete']); - if(strpos($tmp['key'], 'newsletter') === 0) + if(strpos((string) $tmp['key'], 'newsletter') === 0) { $id = intval(str_replace('newsletter_', '', $tmp['key'])); $sql->delete('newsletter', "newsletter_id='{$id}'"); @@ -643,7 +643,7 @@ function view_subscribers($p_id) if($nl_row = $nl_sql->fetch()) { - $subscribers_list = explode(chr(1), trim($nl_row['newsletter_subscribers'])); + $subscribers_list = explode(chr(1), trim((string) $nl_row['newsletter_subscribers'])); sort($subscribers_list); $subscribers_total_count = count($subscribers_list) - 1; // Get a null entry as well } @@ -716,7 +716,7 @@ function remove_subscribers($p_id, $p_key) $sql ->select('newsletter', '*', 'newsletter_id='.intval($p_id)); if($nl_row = $sql->fetch()) { - $subscribers_list = array_flip(explode(chr(1), $nl_row['newsletter_subscribers'])); + $subscribers_list = array_flip(explode(chr(1), (string) $nl_row['newsletter_subscribers'])); unset($subscribers_list[$p_key]); $new_subscriber_list = implode(chr(1), array_keys($subscribers_list)); $sql->update('newsletter', "newsletter_subscribers='{$new_subscriber_list}' WHERE newsletter_id='".$p_id."'"); diff --git a/e107_plugins/newsletter/e_mailout.php b/e107_plugins/newsletter/e_mailout.php index 2ee2f45cd1..e8c38f33a7 100644 --- a/e107_plugins/newsletter/e_mailout.php +++ b/e107_plugins/newsletter/e_mailout.php @@ -135,12 +135,12 @@ public function selectAdd() $this->selectorActive = FALSE; return FALSE; // Run out of DB records } - $this->targets = explode(chr(1), $row['newsletter_subscribers']); + $this->targets = explode(chr(1), (string) $row['newsletter_subscribers']); unset($row); } foreach ($this->targets as $k => $v) { - if ($uid = intval(trim($v))) + if ($uid = intval(trim((string) $v))) { // Got a user ID here - look them up and add their data if ($this->ourDB->select('user', 'user_name,user_email,user_lastvisit', '`user_id`='.$uid)) { diff --git a/e107_plugins/newsletter/newsletter_legacy_menu.php b/e107_plugins/newsletter/newsletter_legacy_menu.php index a65e9486f8..da793908bd 100644 --- a/e107_plugins/newsletter/newsletter_legacy_menu.php +++ b/e107_plugins/newsletter/newsletter_legacy_menu.php @@ -28,14 +28,14 @@ foreach($_POST as $key => $value) { - if(strpos($key, 'nlUnsubscribe_') === 0) + if(strpos((string) $key, 'nlUnsubscribe_') === 0) { $subid = str_replace('nlUnsubscribe_', '', $key); $newsletterArray[$subid]['newsletter_subscribers'] = str_replace(chr(1).USERID, "", $newsletterArray[$subid]['newsletter_subscribers']); $sql->update('newsletter', "newsletter_subscribers='".$newsletterArray[$subid]['newsletter_subscribers']."' WHERE newsletter_id='".intval($subid)."' "); $requery = true; } - elseif(strpos($key, 'nlSubscribe_') === 0) + elseif(strpos((string) $key, 'nlSubscribe_') === 0) { $subid = str_replace("nlSubscribe_", "", $key); $nl_subscriber_array = $newsletterArray[$subid]['newsletter_subscribers']; @@ -81,7 +81,7 @@ $tp->toHTML($nl['newsletter_text'], TRUE)."

"; - if(preg_match("#".chr(1).USERID."(".chr(1)."|$)#si", $nl['newsletter_subscribers'])) + if(preg_match("#".chr(1).USERID."(".chr(1)."|$)#si", (string) $nl['newsletter_subscribers'])) { $text .= NLLAN_48."

toAttribute($tp->toJSON(NLLAN_49)).") \" /> diff --git a/e107_plugins/online/online_shortcodes.php b/e107_plugins/online/online_shortcodes.php index 705a47699f..c38d3ba912 100644 --- a/e107_plugins/online/online_shortcodes.php +++ b/e107_plugins/online/online_shortcodes.php @@ -233,7 +233,7 @@ function sc_online_members_list_extended() $pinfo = $row['user_location']; - $online_location_page = str_replace('.php', '', substr(strrchr($pinfo, '/'), 1)); + $online_location_page = str_replace('.php', '', substr(strrchr((string) $pinfo, '/'), 1)); if ($pinfo == 'log.php' || $pinfo == 'error.php') { $pinfo = 'news.php'; diff --git a/e107_plugins/page/e_search.php b/e107_plugins/page/e_search.php index 1f97aee262..0034542ed9 100644 --- a/e107_plugins/page/e_search.php +++ b/e107_plugins/page/e_search.php @@ -130,24 +130,24 @@ function compile($row) function where($parm=array()) { $tp = e107::getParser(); - + $time = time(); $qry = " (c.chapter_visibility IN (".USERCLASS_LIST.") OR p.page_chapter = 0) AND p.page_class IN (".USERCLASS_LIST.") AND p.page_text != '' AND "; - + if(!empty($parm['cat']) && $parm['cat'] != 'all') { $qry .= " p.page_chapter='".intval($parm['cat'])."' AND"; } - + return $qry; - + /* - + if (isset($parm['time']) && is_numeric($parm['time'])) { $qry .= " n.news_datestamp ".($parm['on'] == 'new' ? '>=' : '<=')." '".(time() - $parm['time'])."' AND"; } - + return $qry; */ diff --git a/e107_plugins/page/page_menu.php b/e107_plugins/page/page_menu.php index eeb85ea3b7..5a7d97b2ff 100644 --- a/e107_plugins/page/page_menu.php +++ b/e107_plugins/page/page_menu.php @@ -24,8 +24,8 @@ { $title = $tp->toHTML($row['page_title'],false,'TITLE'); $body = $tp->toHTML($row['page_text'],true,'BODY'); - - + + $ns->tablerender($title, $body,'page-menu'); // check for $mode == 'page-menu' in tablestyle() if you need a simple 'echo' without rendering styles. } diff --git a/e107_plugins/pm/admin_config.php b/e107_plugins/pm/admin_config.php index 7756194771..966f25543e 100644 --- a/e107_plugins/pm/admin_config.php +++ b/e107_plugins/pm/admin_config.php @@ -92,7 +92,7 @@ function init() class private_msg_ui extends e_admin_ui { - + protected $pluginTitle = LAN_PLUGIN_PM_NAME; protected $pluginName = 'pm'; protected $table = 'private_msg'; @@ -100,7 +100,7 @@ class private_msg_ui extends e_admin_ui protected $perPage = 7; protected $listQry = ''; protected $listOrder = "p.pm_id DESC"; - + protected $fields = array ( 'checkboxes' => array ( 'title' => '', 'type' => null, 'data' => null, 'width' => '5%', 'thclass' => 'center', 'forced' => '1', 'class' => 'center', 'toggle' => 'e-multiselect', ), 'pm_id' => array ( 'title' => LAN_ID, 'data' => 'int', 'width' => '5%', 'help' => '', 'readParms' => array(), 'writeParms' => array(), 'class' => 'left', 'thclass' => 'left', ), 'pm_from' => array ( 'title' => LAN_PLUGIN_PM_FROM, 'type' => 'method', 'noedit'=>true, 'data' => 'int', 'filter'=>true, 'width' => '5%%', 'help' => '', 'readParms' => array(), 'writeParms' => array(), 'class' => 'left', 'thclass' => 'left', ), @@ -109,7 +109,7 @@ class private_msg_ui extends e_admin_ui 'pm_subject' => array ( 'title' => LAN_PLUGIN_PM_SUB, 'type' => 'text', 'data' => 'str', 'width' => '15%', 'help' => '', 'readParms' => array(), 'writeParms' => array('size'=>'xlarge'), 'class' => 'left', 'thclass' => 'left', ), 'pm_text' => array ( 'title' => LAN_PLUGIN_PM_MESS, 'type' => 'bbarea', 'data' => 'str', 'width' => '40%', 'help' => '', 'readParms' => 'expand=1&truncate=50', 'writeParms' => 'rows=5&size=block&cols=80', 'class' => 'left', 'thclass' => 'left', ), 'pm_read' => array ( 'title' => LAN_PLUGIN_PM_READ, 'type' => 'boolean', 'noedit'=>1, 'data' => 'int', 'batch'=>true, 'filter'=>true, 'width' => '5%', 'help' => '', 'readParms' => array(), 'writeParms' => array(), 'class' => 'center', 'thclass' => 'center', ), - + 'pm_sent_del' => array ( 'title' => LAN_PLUGIN_PM_DEL, 'type' => 'boolean', 'noedit'=>true, 'data' => 'int', 'width' => 'auto', 'help' => '', 'readParms' => array(), 'writeParms' => array(), 'class' => 'center', 'thclass' => 'center', ), 'pm_read_del' => array ( 'title' => LAN_PLUGIN_PM_DEL, 'type' => 'boolean', 'noedit'=>true, 'data' => 'int', 'width' => 'auto', 'help' => '', 'readParms' => array(), 'writeParms' => array(), 'class' => 'center', 'thclass' => 'center', ), 'pm_attachments' => array ( 'title' => LAN_PLUGIN_PM_ATTACHMENT, 'type' => 'text', 'noedit'=>true, 'data' => 'str', 'width' => 'auto', 'help' => '', 'readParms' => array(), 'writeParms' => array(), 'class' => 'center', 'thclass' => 'center', ), @@ -117,7 +117,7 @@ class private_msg_ui extends e_admin_ui 'pm_size' => array ( 'title' => LAN_PLUGIN_PM_SIZE, 'type' => 'boolean', 'noedit'=>true, 'data' => 'int', 'width' => 'auto', 'help' => '', 'readParms' => array(), 'writeParms' => array(), 'class' => 'center', 'thclass' => 'center', ), 'options' => array ( 'title' => LAN_OPTIONS, 'type' => 'method', 'data' => null, 'width' => '10%', 'thclass' => 'center last', 'class' => 'center last', 'forced' => '1', ), ); - + protected $fieldpref = array('pm_id', 'pm_from', 'pm_to', 'pm_sent', 'pm_read', 'pm_subject', 'pm_text'); protected $preftabs = array(LAN_BASIC, LAN_ADVANCED); @@ -695,7 +695,7 @@ private function doMaint($opts, $pmPrefs) { while ($row = $db2->fetch()) { - $attachList = explode(chr(0), $row['pm_attachments']); + $attachList = explode(chr(0), (string) $row['pm_attachments']); foreach ($attachList as $a) { $found = FALSE; @@ -870,7 +870,7 @@ public function init() if(!empty($_GET['subject'])) { - $this->fields['pm_subject']['writeParms']['default'] = "Re: ". base64_decode($_GET['subject']); + $this->fields['pm_subject']['writeParms']['default'] = "Re: ". base64_decode((string) $_GET['subject']); } @@ -878,7 +878,7 @@ public function init() - + } public function beforeCreate($new_data, $old_data) @@ -890,7 +890,7 @@ public function beforeCreate($new_data, $old_data) return false; } - $new_data['pm_size'] = strlen($new_data['pm_text']); + $new_data['pm_size'] = strlen((string) $new_data['pm_text']); $new_data['pm_from'] = USERID; return $new_data; } @@ -903,16 +903,16 @@ public function beforeCreate($new_data, $old_data) 'pref_name' => array('title'=> 'name', 'type' => 'text', 'data' => 'string', 'validate' => 'regex', 'rule' => '#^[\w]+$#i', 'help' => 'allowed characters are a-zA-Z and underscore') ); - - - + + + public function customPage() { $ns = e107::getRender(); $text = 'Hello World!'; $ns->tablerender('Hello',$text); - + } */ @@ -953,7 +953,7 @@ function options($parms, $value, $id, $attributes) $link .= (!empty($_GET['iframe'])) ? 'mode=inbox&iframe=1' : 'mode=outbox'; - $link .= "&action=create&to=".intval($pmData['pm_from'])."&subject=".base64_encode($pmData['pm_subject']); + $link .= "&action=create&to=".intval($pmData['pm_from'])."&subject=".base64_encode((string) $pmData['pm_subject']); diff --git a/e107_plugins/pm/pm.php b/e107_plugins/pm/pm.php index 61e7e013a8..4fa029e54b 100755 --- a/e107_plugins/pm/pm.php +++ b/e107_plugins/pm/pm.php @@ -266,7 +266,7 @@ function show_inbox($start = 0) { foreach($pmlist['messages'] as $rec) { - if(trim($rec['pm_subject']) == '') + if(trim((string) $rec['pm_subject']) == '') { $rec['pm_subject'] = '[' . LAN_PM_61 . ']'; } @@ -338,7 +338,7 @@ function show_outbox($start = 0) { foreach($pmlist['messages'] as $rec) { - if(trim($rec['pm_subject']) == '') + if(trim((string) $rec['pm_subject']) == '') { $rec['pm_subject'] = '[' . LAN_PM_61 . ']'; } @@ -611,7 +611,7 @@ function post_pm() } } - $totalsize = strlen($_POST['pm_message']); + $totalsize = strlen((string) $_POST['pm_message']); $maxsize = intval($this->pmPrefs['attach_size']) * 1024; @@ -809,11 +809,11 @@ function pm_user_lookup() } else { - if(substr($_SERVER['HTTP_REFERER'], -5) == 'inbox') + if(substr((string) $_SERVER['HTTP_REFERER'], -5) == 'inbox') { $action = 'inbox'; } - elseif(substr($_SERVER['HTTP_REFERER'], -6) == 'outbox') + elseif(substr((string) $_SERVER['HTTP_REFERER'], -6) == 'outbox') { $action = 'outbox'; } diff --git a/e107_plugins/pm/pm_class.php b/e107_plugins/pm/pm_class.php index efbbeb6a11..fcaf753aa1 100755 --- a/e107_plugins/pm/pm_class.php +++ b/e107_plugins/pm/pm_class.php @@ -60,7 +60,7 @@ function pm_mark_read($pm_id, $pm_info) else { e107::getDb()->gen("UPDATE `#private_msg` SET `pm_read` = {$now} WHERE `pm_id`=".intval($pm_id)); // TODO does this work properly? - if(strpos($pm_info['pm_option'], '+rr') !== FALSE) + if(strpos((string) $pm_info['pm_option'], '+rr') !== FALSE) { $this->pm_send_receipt($pm_info); } @@ -128,7 +128,7 @@ function add($vars) $info = array(); foreach ($vars as $k => $v) { - if (strpos($k, 'pm_') === 0) + if (strpos((string) $k, 'pm_') === 0) { $info[$k] = $v; unset($vars[$k]); @@ -153,16 +153,16 @@ function add($vars) } $attachlist = implode(chr(0), $a_list); } - $pmsize += strlen($vars['pm_message']); + $pmsize += strlen((string) $vars['pm_message']); + + $pm_subject = trim((string) $tp->toDB($vars['pm_subject'])); + $pm_message = trim((string) $tp->toDB($vars['pm_message'])); - $pm_subject = trim($tp->toDB($vars['pm_subject'])); - $pm_message = trim($tp->toDB($vars['pm_message'])); - if (!$pm_subject && !$pm_message && !$attachlist) { // Error - no subject, no message body and no uploaded files return LAN_PM_65; } - + // Most of the pm info is fixed - just need to set the 'to' user on each send $info = array( 'pm_from' => $vars['from_id'], @@ -329,7 +329,7 @@ function del($pmid, $force = FALSE) if($force == TRUE) { // Delete any attachments and remove PM from db - $attachments = explode(chr(0), $row['pm_attachments']); + $attachments = explode(chr(0), (string) $row['pm_attachments']); $aCount = array(0,0); foreach($attachments as $a) { @@ -626,7 +626,7 @@ function pm_getuid($var) else { // $var = strip_if_magic($var); - $var = str_replace("'", ''', trim($var)); // Display name uses entities for apostrophe + $var = str_replace("'", ''', trim((string) $var)); // Display name uses entities for apostrophe $where = "user_name LIKE '".$sql->escape($var, FALSE)."'"; } @@ -703,7 +703,7 @@ function canSendTo($uid) $user = e107::user($uid); - $uclass = explode(",", $user['user_class']); + $uclass = explode(",", (string) $user['user_class']); if($this->pmPrefs['send_to_class'] == 'matchclass') { @@ -806,7 +806,7 @@ function send_file($pmid, $filenum) { $pm_info = $this->pm_get($pmid); - $attachments = explode(chr(0), $pm_info['pm_attachments']); + $attachments = explode(chr(0), (string) $pm_info['pm_attachments']); if(!isset($attachments[$filenum])) { @@ -860,12 +860,12 @@ function send_file($pmid, $filenum) if (connection_status() == 0) { - if (strpos($_SERVER['HTTP_USER_AGENT'], "MSIE") !== false) { + if (strpos((string) $_SERVER['HTTP_USER_AGENT'], "MSIE") !== false) { $file = preg_replace('/\./', '%2e', $file, substr_count($file, '.') - 1); } if (isset($_SERVER['HTTP_RANGE'])) { - $seek = intval(substr($_SERVER['HTTP_RANGE'] , strlen('bytes='))); + $seek = intval(substr((string) $_SERVER['HTTP_RANGE'] , strlen('bytes='))); } $bufsize = 2048; ignore_user_abort(true); diff --git a/e107_plugins/pm/pm_conf.php b/e107_plugins/pm/pm_conf.php index 9e1bf04c67..0b6815d534 100755 --- a/e107_plugins/pm/pm_conf.php +++ b/e107_plugins/pm/pm_conf.php @@ -115,7 +115,7 @@ $temp = array(); foreach($_POST as $k => $v) { - if (strpos($k, 'pm_option-') === 0) + if (strpos((string) $k, 'pm_option-') === 0) { $k = str_replace('pm_option-','',$k); $temp[$k] = $v; @@ -751,7 +751,7 @@ function doMaint($opts, $pmPrefs) { while ($row = $db2->fetch()) { - $attachList = explode(chr(0), $row['pm_attachments']); + $attachList = explode(chr(0), (string) $row['pm_attachments']); foreach ($attachList as $a) { $found = FALSE; diff --git a/e107_plugins/pm/pm_shortcodes.php b/e107_plugins/pm/pm_shortcodes.php index c6718a516a..7d756b0801 100644 --- a/e107_plugins/pm/pm_shortcodes.php +++ b/e107_plugins/pm/pm_shortcodes.php @@ -232,7 +232,7 @@ public function sc_pm_form_subject() if(vartrue($this->var['pm_subject'])) { $value = $this->var['pm_subject']; - if(substr($value, 0, strlen(LAN_PM_58)) != LAN_PM_58) + if(substr((string) $value, 0, strlen(LAN_PM_58)) != LAN_PM_58) { $value = LAN_PM_58.$value; } @@ -255,7 +255,7 @@ public function sc_pm_form_message() if(isset($_POST['quote'])) { $t = time(); - $value = "\n\n\n\n\n\n\n[quote{$t}={$this->var['from_name']}]\n".trim($this->var['pm_text'])."[/quote{$t}]"; + $value = "\n\n\n\n\n\n\n[quote{$t}={$this->var['from_name']}]\n".trim((string) $this->var['pm_text'])."[/quote{$t}]"; } } @@ -335,7 +335,7 @@ public function sc_pm_attachments() if(!empty($this->var['pm_attachments'])) { - $attachments = explode(chr(0), $this->var['pm_attachments']); + $attachments = explode(chr(0), (string) $this->var['pm_attachments']); $i = 0; $ret = ''; foreach($attachments as $a) diff --git a/e107_plugins/poll/poll_class.php b/e107_plugins/poll/poll_class.php index b2ba45a32e..fe39754524 100644 --- a/e107_plugins/poll/poll_class.php +++ b/e107_plugins/poll/poll_class.php @@ -47,10 +47,10 @@ function remove_poll_cookies() foreach($_COOKIE as $cookie_name => $cookie_val) { // Collect poll cookies - if(strpos($cookie_name,'poll_') === 0) + if(strpos((string) $cookie_name,'poll_') === 0) { // e107::getDebug()->log("Poll: ".$cookie_name); - list($str, $int) = explode('_', $cookie_name, 2); + list($str, $int) = explode('_', (string) $cookie_name, 2); if (($str == 'poll') && is_numeric($int)) { // Yes, its poll's cookie $arr_polls_cookies[] = $int; @@ -68,7 +68,7 @@ function remove_poll_cookies() } } } - + /* function delete_poll parameter in: $existing - existing poll id to be deleted @@ -78,7 +78,7 @@ function delete_poll($existing) { global $admin_log; $sql = e107::getDb(); - + if ($sql->delete("polls", " poll_id='".intval($existing)."' ")) { if (function_exists("admin_purge_related")) @@ -103,9 +103,9 @@ function clean_poll_array function clean_poll_array($val) { - $val = trim($val); // trims the array to remove poll answers which are (seemingly) empty but which may contain spaces + $val = trim((string) $val); // trims the array to remove poll answers which are (seemingly) empty but which may contain spaces $allowed_vals = array("0"); // Allows for '0' to be a poll answer option. Possible to add more allowed values. - + return in_array($val, $allowed_vals, true) ? true : ( $val ? true : false ); } @@ -155,7 +155,7 @@ function submit_poll($mode=1) /* update poll results - bugtracker #1124 .... */ $sql->select("polls", "poll_votes", "poll_id='".$pollID."' "); $foo = $sql->fetch(); - $voteA = explode(chr(1), $foo['poll_votes']); + $voteA = explode(chr(1), (string) $foo['poll_votes']); // $poll_option = varset($poll_options, 0); $opt = count($pollOption) - count($voteA); @@ -206,7 +206,7 @@ function get_poll($query) { global $e107; $sql = e107::getDb(); - + if ($sql->gen($query)) { $pollArray = $sql->fetch(); @@ -233,7 +233,7 @@ function get_poll($query) case POLL_MODE_IP: $userid = e107::getIPHandler()->getIP(FALSE); - $voted_ids = explode('^', substr($pollArray['poll_ip'], 0, -1)); + $voted_ids = explode('^', substr((string) $pollArray['poll_ip'], 0, -1)); if (in_array($userid, $voted_ids)) { $POLLMODE = 'voted'; @@ -252,7 +252,7 @@ function get_poll($query) else { $userid = USERID; - $voted_ids = explode('^', substr($pollArray['poll_ip'], 0, -1)); + $voted_ids = explode('^', substr((string) $pollArray['poll_ip'], 0, -1)); if (in_array($userid, $voted_ids)) { $POLLMODE = 'voted'; @@ -291,7 +291,7 @@ function get_poll($query) { $votes[($_POST['votea']-1)] ++; } - $optionArray = explode(chr(1), $pollArray['poll_options']); + $optionArray = explode(chr(1), (string) $pollArray['poll_options']); $optionArray = array_slice($optionArray, 0, -1); foreach ($optionArray as $k=>$v) { @@ -347,7 +347,7 @@ function render_poll($pollArray = "", $type = "menu", $POLLMODE = "", $returnMet { $sc->pollPreview = true; } - + switch ($POLLMODE) { case 'query' : // Show poll, register any vote @@ -382,7 +382,7 @@ function render_poll($pollArray = "", $type = "menu", $POLLMODE = "", $returnMet } - + if ($type == 'preview') { @@ -400,17 +400,17 @@ function render_poll($pollArray = "", $type = "menu", $POLLMODE = "", $returnMet } else { - $optionArray = explode(chr(1), $pollArray['poll_options']); + $optionArray = explode(chr(1), (string) $pollArray['poll_options']); $optionArray = array_slice($optionArray, 0, -1); } - $voteArray = explode(chr(1), $pollArray['poll_votes']); + $voteArray = explode(chr(1), (string) $pollArray['poll_votes']); // $voteArray = array_slice($voteArray, 0, -1); } else { // Get existing results - $optionArray = explode(chr(1), $pollArray['poll_options']); + $optionArray = explode(chr(1), (string) $pollArray['poll_options']); $optionArray = array_slice($optionArray, 0, -1); - $voteArray = explode(chr(1), $pollArray['poll_votes']); + $voteArray = explode(chr(1), (string) $pollArray['poll_votes']); // $voteArray = array_slice($voteArray, 0, -1); } @@ -499,11 +499,11 @@ function render_poll($pollArray = "", $type = "menu", $POLLMODE = "", $returnMet { $sc->answerOption = $option; $text .= $tp->parseTemplate($template['form']['item'], true, $sc); - + $count ++; $sc->answerCount++; } - + $text .= $tp->parseTemplate($template['form']['end'], true, $sc); $text .= ""; @@ -538,10 +538,10 @@ function render_poll($pollArray = "", $type = "menu", $POLLMODE = "", $returnMet $count ++; $sc->answerCount++; } - + $text .= $tp->parseTemplate($template['results']['end'], true, $sc); } - + break; @@ -570,9 +570,9 @@ function render_poll($pollArray = "", $type = "menu", $POLLMODE = "", $returnMet if (!defined("POLLRENDERED")) define("POLLRENDERED", TRUE); - + $caption = (file_exists(THEME."images/poll_menu.png") ? " ".LAN_PLUGIN_POLL_NAME : LAN_PLUGIN_POLL_NAME); - + if ($type == 'preview') { $caption = LAN_CREATE.SEP.LAN_PREVIEW; // "Preview"; // TODO not sure this is used. @@ -594,7 +594,7 @@ function render_poll($pollArray = "", $type = "menu", $POLLMODE = "", $returnMet } - + function generateBar($perc) { if(deftrue('BOOTSTRAP',false)) @@ -606,7 +606,7 @@ function generateBar($perc) '.$val.'% '; - + } else { @@ -635,16 +635,16 @@ function renderPollForm($mode='admin') $tp = e107::getParser(); $frm = e107::getForm(); // echo "MODE=".$mode; - + //XXX New v2.x default for front-end. Currently used by forum-post in bootstrap mode. // TODO LAN - Needs a more generic LAN rewrite when used on another area than forum if ($mode == 'front') { - + $text = " - +
".LAN_FORUM_3029."
"; @@ -664,14 +664,14 @@ function renderPollForm($mode='admin') $text .= "
"; - + for($count = 1; $count <= $option_count; $count++) { // if ($count != 1 && $_POST['poll_option'][($count-1)] =="") // { // // break; // } - + $opt = ($count==1) ? "poll_answer" : ""; $text .= "
@@ -686,11 +686,11 @@ function renderPollForm($mode='admin')
"; - + //FIXME - get this looking good with Bootstrap CSS only. - + $opts = array(1 => LAN_YES, 0=> LAN_NO); - + // Set to IP address.. Can add a pref to Poll admin for 'default front-end storage method' if demand is there for it. $text .= "
@@ -703,38 +703,38 @@ function renderPollForm($mode='admin') "; // $text .= ""; - + return $text; - - + + /* $text .= "
".POLL_506." - + ".POLL_507."   ".POLL_508." - +
"; */ - + //XXX Should NOT be decided by USER /* $text .= "
".POLLAN_16." - + ".POLLAN_17."
".LAN_IP_ADDRESS."
".POLLAN_19."
"; */ - - + + } - - + + //TODO Hardcoded FORUM code needs to be moved somewhere. if ($mode == 'forum') // legacy code. { @@ -841,10 +841,10 @@ function renderPollForm($mode='admin') ".POLLAN_15.""; - + $uclass = (ADMIN) ? "" : "public,member,admin,classes,matchclass"; - - + + $text .= " ".r_userclass("pollUserclass", vartrue($_POST['pollUserclass']), 'off', $uclass)." @@ -870,11 +870,11 @@ function renderPollForm($mode='admin') { // $text .= " "; $text .= $frm->admin_button('preview',LAN_PREVIEW,'other'); - + if (defset('POLLACTION') === 'edit') { $text .= $frm->admin_button('submit', LAN_UPDATE, 'update')." - + "; } else @@ -888,7 +888,7 @@ function renderPollForm($mode='admin') $text .= $frm->admin_button('preview','no-value','other',LAN_PREVIEW); // $text .= " "; } - + if (defset('POLLID')) { $text .= $frm->admin_button('reset','no-value','reset',LAN_CLEAR); diff --git a/e107_plugins/poll/search/search_comments.php b/e107_plugins/poll/search/search_comments.php index 491a49b0e7..bcc929e27f 100644 --- a/e107_plugins/poll/search/search_comments.php +++ b/e107_plugins/poll/search/search_comments.php @@ -17,7 +17,7 @@ function com_search_4($row) { global $con; - $nick = preg_replace("/[0-9]+\./", "", $row['comment_author']); + $nick = preg_replace("/[0-9]+\./", "", (string) $row['comment_author']); $datestamp = $con -> convert_date($row['comment_datestamp'], "long"); $res['link'] = e_PLUGIN."poll/oldpolls.php?".$row['poll_id']; $res['pre_title'] = 'Posted in reply to poll: '; diff --git a/e107_plugins/rss_menu/e_meta.php b/e107_plugins/rss_menu/e_meta.php index 6975011968..83f870012e 100644 --- a/e107_plugins/rss_menu/e_meta.php +++ b/e107_plugins/rss_menu/e_meta.php @@ -23,7 +23,7 @@ while($row = $sql->fetch()) { - if(strpos($row['rss_url'], "*") === false) // Wildcard topic_id's should not be listed + if(strpos((string) $row['rss_url'], "*") === false) // Wildcard topic_id's should not be listed { $name = $tp->toHTML($row['rss_name'], TRUE, 'no_hook, emotes_off'); $title = htmlspecialchars(SITENAME, ENT_QUOTES, 'utf-8')." ".htmlspecialchars($name, ENT_QUOTES, 'utf-8'); diff --git a/e107_plugins/rss_menu/rss.php b/e107_plugins/rss_menu/rss.php index 0c9282954d..861c1b8b1f 100644 --- a/e107_plugins/rss_menu/rss.php +++ b/e107_plugins/rss_menu/rss.php @@ -154,11 +154,11 @@ if(!$sql->select('rss', '*', "rss_class != 2 AND rss_url='".$content_type."' ".$check_topic." AND rss_limit > 0 ")) { require_once(HEADERF); - + $repl = array("

", ""); $message = str_replace(array("[","]"), $repl, RSS_LAN_ERROR_1); e107::getRender()->tablerender('', $message); - + require_once(FOOTERF); exit; } @@ -177,7 +177,7 @@ if($rss = new rssCreate($content_type, $rss_type, $topic_id, $row)) { - $rss_title = ($rss->contentType ? $rss->contentType : ucfirst($content_type)); + $rss_title = ($rss->contentType ? $rss->contentType : ucfirst((string) $content_type)); if(defset('E107_DEBUG_LEVEL') > 0) { @@ -236,9 +236,9 @@ public function __construct($content_type, $rss_type, $topic_id, $row) { $path = e_PLUGIN.$row['rss_path'].'/e_rss.php'; } - if(strpos($row['rss_path'],'|')!==FALSE) //FIXME remove this check completely. + if(strpos((string) $row['rss_path'],'|')!==FALSE) //FIXME remove this check completely. { - $tmp = explode("|", $row['rss_path']); + $tmp = explode("|", (string) $row['rss_path']); $path = e_PLUGIN.$tmp[0]."/e_rss.php"; $this->parm = $tmp[1]; // FIXME @Deprecated - use $parm['url'] instead in data() method within e_rss.php. Parm is used in e_rss.php to define which feed you need to prepare } @@ -295,7 +295,7 @@ public function __construct($content_type, $rss_type, $topic_id, $row) } $this -> rssItems[$loop]['description'] = $value['comment_comment']; - $this -> rssItems[$loop]['author'] = substr($value['comment_author'], (strpos($value['comment_author'], ".")+1)); + $this -> rssItems[$loop]['author'] = substr((string) $value['comment_author'], (strpos((string) $value['comment_author'], ".")+1)); $loop++; } break; @@ -328,16 +328,16 @@ public function __construct($content_type, $rss_type, $topic_id, $row) if (is_readable($path)) { require_once($path); - + $className = basename(dirname($path)).'_rss'; - + // v2.x standard if($data = e107::callMethod($className,'data', array('url' => $content_type, 'id' => $this->topicid, 'limit' => $this->limit))) { $eplug_rss_data = array(0 => $data); unset($data); } - + foreach($eplug_rss_data as $key=>$rs) { foreach($rs as $k=>$row) @@ -348,7 +348,7 @@ public function __construct($content_type, $rss_type, $topic_id, $row) if($row['link']) { - if(stripos($row['link'], 'http') !== FALSE) + if(stripos((string) $row['link'], 'http') !== FALSE) { $this -> rssItems[$k]['link'] = $row['link']; } @@ -359,12 +359,12 @@ public function __construct($content_type, $rss_type, $topic_id, $row) } $this -> rssItems[$k]['description'] = $row['description']; - + if($row['enc_url']) { $this -> rssItems[$k]['enc_url'] = SITEURLBASE.e_PLUGIN_ABS.$row['enc_url'].$row['item_id']; } - + if($row['enc_leng']) { $this -> rssItems[$k]['enc_leng'] = $row['enc_leng']; @@ -380,10 +380,10 @@ public function __construct($content_type, $rss_type, $topic_id, $row) } $this -> rssItems[$k]['category_name'] = $row['category_name']; - + if($row['category_link']) { - if(stripos($row['category_link'], 'http') !== FALSE) + if(stripos((string) $row['category_link'], 'http') !== FALSE) { $this -> rssItems[$k]['category_link'] = $row['category_link']; } @@ -392,7 +392,7 @@ public function __construct($content_type, $rss_type, $topic_id, $row) $this -> rssItems[$k]['category_link'] = SITEURLBASE.e_PLUGIN_ABS.$row['category_link']; } } - + if(!empty($row['datestamp'])) { $this -> rssItems[$k]['pubdate'] = $row['datestamp']; @@ -458,7 +458,7 @@ function buildRss($rss_title) ".$tp->toRss($value['title'])." ".substr($tp->toRss($value['description']),0,150); - if($pref['rss_shownewsimage'] == 1 && strlen(trim($value['news_thumbnail'])) > 0) + if($pref['rss_shownewsimage'] == 1 && strlen(trim((string) $value['news_thumbnail'])) > 0) { $news_thumbnail = SITEURLBASE.e_IMAGE_ABS."newspost_images/".$tp->toRss($value['news_thumbnail']); echo "<a href="".$link.""><img src="".$news_thumbnail."" height="50" border="0" hspace="10" vspace="10" align="right"></a>"; @@ -475,7 +475,7 @@ function buildRss($rss_title) break; case 2: // RSS 2.0 - $sitebutton = (strpos(SITEBUTTON, "http:") !== false ? SITEBUTTON : SITEURL.str_replace("../", "", SITEBUTTON)); + $sitebutton = (strpos((string) SITEBUTTON, "http:") !== false ? SITEBUTTON : SITEURL.str_replace("../", "", SITEBUTTON)); echo " @@ -509,7 +509,7 @@ function buildRss($rss_title) echo " toRss(e107::url('rss_menu','atom', array('rss_url'=>$this->contentType, 'rss_topicid'=>$this->topicid),'full'))."\" rel=\"self\" type=\"application/rss+xml\" />\n"; - if (trim(SITEBUTTON)) + if (trim((string) SITEBUTTON)) { $path = e107::getConfig()->get('sitebutton'); $imgPath = e107::getParser()->thumbUrl($path, array(), false, true); @@ -702,7 +702,7 @@ function buildRss($rss_title) e107\n"; ///icon.jpg\n echo " - ".(strpos(SITEBUTTON, "http:") !== false ? SITEBUTTON : SITEURL.str_replace("../", "", SITEBUTTON))."\n + ".(strpos((string) SITEBUTTON, "http:") !== false ? SITEBUTTON : SITEURL.str_replace("../", "", SITEBUTTON))."\n ".$pref['siteadmin']." - ".$this->nospam($pref['siteadminemail'])."\n"; if($pref['sitedescription']){ echo " @@ -817,7 +817,7 @@ function buildTag($name='', $attributes=array()) function getmime($file) { - $ext = strtolower(str_replace(".","",strrchr(basename($file), "."))); + $ext = strtolower(str_replace(".","",strrchr(basename((string) $file), "."))); $mime["mp3"] = "audio/mpeg"; return $mime[$ext]; } @@ -833,7 +833,7 @@ function get_iso_8601_date($int_date) function nospam($text) { - $tmp = explode("@",$text); + $tmp = explode("@",(string) $text); return ($tmp[0] != "") ? $tmp[0].RSS_LAN_2 : RSS_LAN_3; } } // End class rssCreate diff --git a/e107_plugins/rss_menu/rss_setup.php b/e107_plugins/rss_menu/rss_setup.php index 5abb858280..3e442f7436 100644 --- a/e107_plugins/rss_menu/rss_setup.php +++ b/e107_plugins/rss_menu/rss_setup.php @@ -48,7 +48,7 @@ function install_post($var) /* function uninstall_options() { - + } diff --git a/e107_plugins/siteinfo/e_shortcode.php b/e107_plugins/siteinfo/e_shortcode.php index 45f039dca2..96ed594536 100644 --- a/e107_plugins/siteinfo/e_shortcode.php +++ b/e107_plugins/siteinfo/e_shortcode.php @@ -36,7 +36,7 @@ function sc_sitebutton($parm=null) } else { - $path = (strpos(SITEBUTTON, 'http:') !== false || strpos(SITEBUTTON, e_IMAGE_ABS) !== false ? SITEBUTTON : e_IMAGE.SITEBUTTON); + $path = (strpos((string) SITEBUTTON, 'http:') !== false || strpos((string) SITEBUTTON, e_IMAGE_ABS) !== false ? SITEBUTTON : e_IMAGE.SITEBUTTON); } if(varset($parm['type']) == 'url') @@ -72,7 +72,7 @@ function sc_sitedisclaimer($parm=array()) function sc_siteurl($parm='') { - if(strlen(deftrue('SITEURL')) < 3 ) //fixes CLI/cron + if(strlen((string) deftrue('SITEURL')) < 3 ) //fixes CLI/cron { return e107::getPref('siteurl'); } @@ -106,7 +106,7 @@ function sc_logo($parm = array()) { if(is_string($parm)) { - parse_str(vartrue($parm),$parm); // Optional {LOGO=file=file_name} or {LOGO=link=url} or {LOGO=file=file_name&link=url} + parse_str((string) vartrue($parm),$parm); // Optional {LOGO=file=file_name} or {LOGO=link=url} or {LOGO=file=file_name&link=url} } // Paths to image file, link are relative to site base $tp = e107::getParser(); diff --git a/e107_plugins/siteinfo/sitebutton_menu.php b/e107_plugins/siteinfo/sitebutton_menu.php index af6a7c97f9..93c56a4c31 100644 --- a/e107_plugins/siteinfo/sitebutton_menu.php +++ b/e107_plugins/siteinfo/sitebutton_menu.php @@ -17,11 +17,11 @@ if (!defined('e107_INIT')) { exit; } // echo "parm=".$parm; //FIXME - just for testing only. -if(strpos(SITEBUTTON, "://") !== false) // external url. +if(strpos((string) SITEBUTTON, "://") !== false) // external url. { $path = SITEBUTTON; } -elseif(basename(SITEBUTTON) == SITEBUTTON) // v1.x BC Fix. - no path included. +elseif(basename((string) SITEBUTTON) == SITEBUTTON) // v1.x BC Fix. - no path included. { $path = e_IMAGE_ABS.SITEBUTTON; } diff --git a/e107_plugins/social/admin_config.php b/e107_plugins/social/admin_config.php index 474adee365..7d13f89ea3 100644 --- a/e107_plugins/social/admin_config.php +++ b/e107_plugins/social/admin_config.php @@ -404,7 +404,7 @@ public function pagesPage() { $keypref = "xurl[".$k."]"; $text_label = "xurl-".$k.""; - $def = "XURL_". strtoupper($k); + $def = "XURL_". strtoupper((string) $k); $help = LAN_SOCIAL_ADMIN_13." ".$var['label']." ".LAN_SOCIAL_ADMIN_12." (".$def.")"; $opts = array('size'=>'xxlarge','placeholder'=> $var['placeholder']); @@ -628,7 +628,7 @@ private function getLabel($fieldSlash) ); - return varset($labels[$fieldSlash], ucfirst($fieldSlash)); + return varset($labels[$fieldSlash], ucfirst((string) $fieldSlash)); } /** @@ -648,7 +648,7 @@ private function generateSocialLoginForm($provider_name) $textKeys = ''; $textScope = ''; $label = !empty(self::getApiDocumentationUrlFor($provider_name)) ? "" . $pretty_provider_name . "" : $pretty_provider_name; - $radio_label = strtolower($provider_name); + $radio_label = strtolower((string) $provider_name); $text = "@@ -708,7 +708,7 @@ private function generateSocialLoginRow($provider_name, $readonly = false) $textKeys = ''; $textScope = ''; $label = !empty(self::getApiDocumentationUrlFor($provider_name)) ? "" . $pretty_provider_name . "" : $pretty_provider_name; - $radio_label = strtolower($provider_name); + $radio_label = strtolower((string) $provider_name); $text = " @@ -878,7 +878,7 @@ function loadBatch($force=false) foreach($themeList as $k=>$v) { - if(!empty($parms['searchqry']) && stripos($v['description'],$parms['searchqry']) === false && stripos($v['folder'],$parms['searchqry']) === false && stripos($v['name'],$parms['searchqry']) === false) + if(!empty($parms['searchqry']) && stripos((string) $v['description'],(string) $parms['searchqry']) === false && stripos((string) $v['folder'],(string) $parms['searchqry']) === false && stripos((string) $v['name'],(string) $parms['searchqry']) === false) { continue; } diff --git a/e107_plugins/social/e_event.php b/e107_plugins/social/e_event.php index 1fdf388d12..1fb9d69b69 100644 --- a/e107_plugins/social/e_event.php +++ b/e107_plugins/social/e_event.php @@ -19,22 +19,22 @@ class social_event */ function __construct() { - - + + } function config() { $event = array(); - + $event[] = array( 'name' => "system_meta_pre", 'function' => "addFallbackMeta", ); return $event; - + } @@ -113,13 +113,13 @@ function addFallbackMeta($meta) } elseif(!empty($pref['sitebutton'])) { - $siteButton = (strpos($pref['sitebutton'],'{e_MEDIA') !== false) ? e107::getParser()->thumbUrl($pref['sitebutton'],'w=800',false, true) : e107::getParser()->replaceConstants($pref['sitebutton'],'full'); + $siteButton = (strpos((string) $pref['sitebutton'],'{e_MEDIA') !== false) ? e107::getParser()->thumbUrl($pref['sitebutton'],'w=800',false, true) : e107::getParser()->replaceConstants($pref['sitebutton'],'full'); e107::meta('og:image',$siteButton); e107::meta('twitter:image', $siteButton); } elseif(!empty($pref['sitelogo'])) // fallback to sitelogo { - $siteLogo = (strpos($pref['sitelogo'],'{e_MEDIA') !== false) ? e107::getParser()->thumbUrl($pref['sitelogo'],'w=800',false, true) : e107::getParser()->replaceConstants($pref['sitelogo'],'full'); + $siteLogo = (strpos((string) $pref['sitelogo'],'{e_MEDIA') !== false) ? e107::getParser()->thumbUrl($pref['sitelogo'],'w=800',false, true) : e107::getParser()->replaceConstants($pref['sitelogo'],'full'); e107::meta('og:image',$siteLogo); e107::meta('twitter:image', $siteLogo); } diff --git a/e107_plugins/social/e_shortcode.php b/e107_plugins/social/e_shortcode.php index 31d3f90a04..7e7fe55698 100644 --- a/e107_plugins/social/e_shortcode.php +++ b/e107_plugins/social/e_shortcode.php @@ -105,7 +105,7 @@ function sc_xurl_icons($parm=null) if(!empty($parm['type'])) { $newList = array(); - $tmp = explode(",",$parm['type']); + $tmp = explode(",",(string) $parm['type']); foreach($tmp as $v) { if(isset($social[$v])) @@ -255,7 +255,7 @@ private function getHashtags($extraTags='') */ public function getShareUrl($type, $urlScheme, $data=array(), $options=array()) { - $data = array('u'=> rawurlencode($data['url']), 't'=> rawurlencode($data['title']), 'd' => rawurlencode($data['description']), 'm' => rawurlencode($data['media'])); + $data = array('u'=> rawurlencode((string) $data['url']), 't'=> rawurlencode((string) $data['title']), 'd' => rawurlencode((string) $data['description']), 'm' => rawurlencode((string) $data['media'])); return $this->parseShareUrlScheme($type, $urlScheme, $data, $options); } @@ -278,7 +278,7 @@ private function parseShareUrlScheme($type, $providerUrlScheme, $data=array(), $ { if(!empty($options['hashtags'])) { - $shareUrl .= "&hashtags=".rawurlencode($options['hashtags']); + $shareUrl .= "&hashtags=".rawurlencode((string) $options['hashtags']); } if(!empty($options['twitterAccount'])) @@ -329,7 +329,7 @@ function sc_socialshare($parm=array()) // Designed so that no additional JS requ } else { - $parm['providers'] = explode(",",$parm['providers']); + $parm['providers'] = explode(",",(string) $parm['providers']); } if(empty($parm['dropdown'])) @@ -348,7 +348,7 @@ function sc_socialshare($parm=array()) // Designed so that no additional JS requ $size = varset($parm['size'], 'md'); - $data = array('u'=> rawurlencode($url), 't'=> rawurlencode($title), 'd' => rawurlencode($description), 'm' => rawurlencode($media)); + $data = array('u'=> rawurlencode((string) $url), 't'=> rawurlencode((string) $title), 'd' => rawurlencode((string) $description), 'm' => rawurlencode($media)); if(!vartrue($parm['dropdown'])) { @@ -414,7 +414,7 @@ function sc_socialshare($parm=array()) // Designed so that no additional JS requ elseif(!empty($parm['type'])) { $newlist = array(); - $tmp = explode(",",$parm['type']); + $tmp = explode(",",(string) $parm['type']); foreach($tmp as $v) { if(isset($opt[$v])) diff --git a/e107_plugins/social/includes/social_login_config.php b/e107_plugins/social/includes/social_login_config.php index bd8b4aa3d2..02e1459e1f 100644 --- a/e107_plugins/social/includes/social_login_config.php +++ b/e107_plugins/social/includes/social_login_config.php @@ -151,7 +151,7 @@ public function saveConfig() public function getProviderConfig($providerName, $path = "") { if (empty($path)) $path = ""; - elseif (substr($path, 0, 1) !== "/") $path = "/$path"; + elseif (substr((string) $path, 0, 1) !== "/") $path = "/$path"; $pref = $this->config->getPref( self::SOCIAL_LOGIN_PREF . '/' . $this->normalizeProviderName($providerName) . $path @@ -257,14 +257,14 @@ public function normalizeProviderName($providerName) $normalizedProviderName = $providerName; foreach ($this->getSupportedProviders() as $providerProperCaps) { - if (mb_strtolower($providerName) == mb_strtolower($providerProperCaps)) + if (mb_strtolower((string) $providerName) == mb_strtolower($providerProperCaps)) { $normalizedProviderName = $providerProperCaps; break; } } $providerType = $this->getTypeOfProvider($normalizedProviderName); - $normalizedProviderName = preg_replace('/(OpenID|OAuth1|OAuth2)$/i', '', $normalizedProviderName); + $normalizedProviderName = preg_replace('/(OpenID|OAuth1|OAuth2)$/i', '', (string) $normalizedProviderName); if (empty($normalizedProviderName) && !empty($providerType) || $providerName == $providerType) return $providerType; elseif ($providerType) @@ -279,7 +279,7 @@ public function normalizeProviderName($providerName) */ public function denormalizeProviderName($normalizedProviderName) { - list($provider_name, $provider_type) = array_pad(explode("-", $normalizedProviderName), 2, ""); + list($provider_name, $provider_type) = array_pad(explode("-", (string) $normalizedProviderName), 2, ""); if ($provider_type != $this->getTypeOfProvider($provider_name)) $provider_name .= $provider_type; return $provider_name; } diff --git a/e107_plugins/social/social_setup.php b/e107_plugins/social/social_setup.php index 2f08e44702..40a5bd1315 100644 --- a/e107_plugins/social/social_setup.php +++ b/e107_plugins/social/social_setup.php @@ -138,7 +138,7 @@ private function upgrade_pre_rename_xup() $new_user_xup = preg_replace( '/^' . preg_quote($oldProviderName) . '_/', $newProviderName . '_', - $old_user_xup + (string) $old_user_xup ); $this->fixUserXup($db, $row['user_id'], $old_user_xup, $new_user_xup); } diff --git a/e107_plugins/tagcloud/tagcloud_class.php b/e107_plugins/tagcloud/tagcloud_class.php index 2452b39c62..0d292f5915 100644 --- a/e107_plugins/tagcloud/tagcloud_class.php +++ b/e107_plugins/tagcloud/tagcloud_class.php @@ -194,16 +194,16 @@ public function formatTag($string) if ($this->options['transformation']) { switch ($this->options['transformation']) { case 'upper': - $string = $this->options['transliterate'] ? strtoupper($string) : mb_convert_case($string, MB_CASE_UPPER, "UTF-8"); + $string = $this->options['transliterate'] ? strtoupper((string) $string) : mb_convert_case((string) $string, MB_CASE_UPPER, "UTF-8"); break; default: - $string = $this->options['transliterate'] ? strtolower($string) : mb_convert_case($string, MB_CASE_LOWER, "UTF-8"); + $string = $this->options['transliterate'] ? strtolower((string) $string) : mb_convert_case((string) $string, MB_CASE_LOWER, "UTF-8"); } } if ($this->options['trim']) { - $string = trim($string); + $string = trim((string) $string); } - return preg_replace('/[^\w ]/u', '', strip_tags($string)); + return preg_replace('/[^\w ]/u', '', strip_tags((string) $string)); } /** @@ -416,7 +416,7 @@ public function render($returnType = 'html') if (empty($this->orderBy)) { $this->shuffle(); } else { - $orderDirection = strtolower($this->orderBy['direction']) == 'desc' ? 'SORT_DESC' : 'SORT_ASC'; + $orderDirection = strtolower((string) $this->orderBy['direction']) == 'desc' ? 'SORT_DESC' : 'SORT_ASC'; $this->tagsArray = $this->order( $this->tagsArray, $this->orderBy['field'], @@ -552,7 +552,7 @@ protected function minLength() $i = 0; $_tagsArray = array(); foreach ($this->tagsArray as $key => $value) { - if (strlen($value['tag']) >= $limit) { + if (strlen((string) $value['tag']) >= $limit) { $_tagsArray[$value['tag']] = $value; } $i++; diff --git a/e107_plugins/tagcloud/tagcloud_menu.php b/e107_plugins/tagcloud/tagcloud_menu.php index 57a6650c74..14545b898d 100644 --- a/e107_plugins/tagcloud/tagcloud_menu.php +++ b/e107_plugins/tagcloud/tagcloud_menu.php @@ -73,7 +73,7 @@ public function render($parm = null) foreach ($result as $row) { - $tmp = explode(",", $row['news_meta_keywords']); + $tmp = explode(",", (string) $row['news_meta_keywords']); $c = 0; foreach ($tmp as $word) @@ -126,7 +126,7 @@ public function render($parm = null) if(!empty($parm['order'])) { - list($o1,$o2) = explode(',', $parm['order']); + list($o1,$o2) = explode(',', (string) $parm['order']); $cloud->setOrder($o1, strtoupper($o2)); } else diff --git a/e107_plugins/tagcloud/templates/tagcloud_menu_template.php b/e107_plugins/tagcloud/templates/tagcloud_menu_template.php index 735cd5320a..2d7a5eb51b 100644 --- a/e107_plugins/tagcloud/templates/tagcloud_menu_template.php +++ b/e107_plugins/tagcloud/templates/tagcloud_menu_template.php @@ -1,11 +1,11 @@ '; $TAGCLOUD_MENU_TEMPLATE['default']['item'] = "{TAG_NAME}"; $TAGCLOUD_MENU_TEMPLATE['default']['end'] = '
'; - + /* example for the same size tag $TAGCLOUD_MENU_TEMPLATE['default']['caption'] = '{TAGCLOUD_MENU_CAPTION}'; $TAGCLOUD_MENU_TEMPLATE['default']['start'] = '
'; diff --git a/e107_plugins/tinymce4/plugins/e107/dialog.php b/e107_plugins/tinymce4/plugins/e107/dialog.php index 45d690967e..7a03801a08 100644 --- a/e107_plugins/tinymce4/plugins/e107/dialog.php +++ b/e107_plugins/tinymce4/plugins/e107/dialog.php @@ -33,49 +33,49 @@ $(document).ready(function() { $('#insertButton').click(function () { - + var buttonType = $('input:radio[name=buttonType]:checked').val(); var buttonSize = $('input:radio[name=buttonSize]:checked').val(); - + var buttonText = $('#buttonText').val(); var buttonUrl = $('#buttonUrl').val(); - + var buttonClass = (buttonType != '') ? 'btn-'+buttonType : ''; - + var html = '' + buttonText + ' '; // alert(html); tinyMCEPopup.editor.execCommand('mceInsertContent', false, html); tinyMCEPopup.close(); }); - - + + $('span.label, span.badge').click(function () { var cls = $(this).attr('class'); var html = '' + $(this).text() + ' '; tinyMCEPopup.editor.execCommand('mceInsertContent', false, html); tinyMCEPopup.close(); }); - - + + $('ul.glyphicons li, #glyph-save').click(function () { - + var color = $('#glyph-color').val(); var custom = $('#glyph-custom').val(); var cls = (custom != '') ? custom : $(this).find('i').attr('class'); - + var html = ' '; - + // alert(html); tinyMCEPopup.editor.execCommand('mceInsertContent', false, html); tinyMCEPopup.close(); }); - + $('#bbcodeInsert').click(function () { s = $('#bbcodeValue').val(); s = s.trim(s); - + var html = $.ajax({ type: 'POST', url: './parser.php', @@ -93,17 +93,17 @@ tinyMCEPopup.editor.execCommand('mceInsertContent', false, html); tinyMCEPopup.close(); }); - + $('a.bbcodeSelect').click(function () { var html = $(this).html(); $('#bbcodeValue').val(html); }); - + $('#e-cancel').click(function () { - + tinyMCEPopup.close(); }); - + }); @@ -112,89 +112,89 @@ class e_bootstrap { - + private $styleClasses = array(''=>'Default', 'primary'=>"Primary", 'success'=>"Success", 'info'=>"Info", 'warning'=>"Warning",'danger'=>"Danger",'inverse'=>"Inverse"); - - - + + + function init() { $ns = e107::getRender(); - - + + if(e_QUERY == 'bbcode') { echo $this->bbcodeForm(); return; } - - - - + + + + $text = "
Warning: These will only work if you have a bootstrap-based theme installed
"; - - + + $text .= ' '; - + $text .= '
'; - + $text .= '
'.$this->buttonForm().'
'; - + $text .= '
'.$this->badgeForm().'
'; - + $text .= '
'.$this->glyphicons().'
'; - - + + $text .= '
'; echo $text; - + } - - - - - - + + + + + + function buttonForm() { $frm = e107::getForm(); - + $buttonSizes = array(''=>'Default', 'btn-mini'=>"Mini", 'btn-small'=>"Small", 'btn-large' => "Large"); - + $buttonTypes = $this->styleClasses; - + $butSelect = ""; $butSelect .= "
"; foreach($buttonTypes as $type=>$diz) { - + $label = ''; $butSelect .= $frm->radio('buttonType', $type, false, array('label'=>$label)); - + } $butSelect .= "
"; - + $butSize = "
"; - + foreach($buttonSizes as $size=>$label) { $selected = ($size == '') ? true : false; $butSize .= $frm->radio('buttonSize', $size, $selected, array('label'=>$label)); } $butSize .= "
"; - - - + + + $text = "
@@ -213,17 +213,17 @@ function buttonForm() - - + +
Button Url

".$frm->text('buttonUrl','',255,'size=xxlarge')."

". $frm->admin_button('insertButton','save','other',"Insert") ."
"; - - + + return $text; - + } @@ -231,26 +231,26 @@ function buttonForm() function badgeForm() { unset($this->styleClasses['primary']); - + foreach($this->styleClasses as $key=>$type) { $classLabel = ($key != '') ? " label-".$key : ""; $classBadge = ($key != '') ? " badge-".$key : ""; - + $text .= '
'.$type.' '; $text .= ''.$type.''; $text .= "
"; } - + return $text; - + } - - + + function bbcodeForm() { $list = e107::getPref('bbcode_list'); - + $text .= "

e107 Bbcodes

@@ -263,7 +263,7 @@ function bbcodeForm() { $text .= "".$plugin." "; - + foreach($val as $bb=>$v) { $text .= "[".$bb."][/".$bb."]"; @@ -271,22 +271,22 @@ function bbcodeForm() $text .= " "; } - + $text .= "
"; - + $frm = e107::getForm(); $text .= $frm->text('bbcodeValue','',false,'size=xlarge'); $text .= $frm->button('bbcodeInsert','go','other','Insert'); - - + + return $text; - - + + } - - - + + + function glyphicons() { $icons = array( @@ -437,39 +437,39 @@ function glyphicons() $frm = e107::getForm(); $sel = array(''=>'Dark Gray','icon-white'=>'White'); - + $text .= "
"; $text .= "
Color: ".$frm->select('glyph-color',$sel)." Custom: ".$frm->text('glyph-custom','').$frm->button('glyph-save','Go')."
"; - + $text .= "
    "; - + // $inverse = (e107::getPref('admincss') == "admin_dark.css") ? " icon-white" : ""; - + foreach($icons as $ic) { $text .= '
  • '.$ic.'
  • '; $text .= "\n"; } - + $text .= "
"; $text .= "
"; return $text; } - - - - - - - - + + + + + + + + } - + require_once(e_ADMIN."auth.php"); //e107::lan('core','admin',TRUE); diff --git a/e107_plugins/tinymce4/plugins/e107/parser.php b/e107_plugins/tinymce4/plugins/e107/parser.php index a017cccf14..e12d92b018 100644 --- a/e107_plugins/tinymce4/plugins/e107/parser.php +++ b/e107_plugins/tinymce4/plugins/e107/parser.php @@ -94,7 +94,7 @@ function __construct() if($this->gzipCompression == true) { header('Content-Encoding: gzip'); - $gzipoutput = gzencode($html,6); + $gzipoutput = gzencode((string) $html,6); header('Content-Length: '.strlen($gzipoutput)); echo $gzipoutput; } @@ -122,7 +122,7 @@ public function toHTML($content) define('BOOTSTRAP', (int) $bs); } - $content = stripslashes($content); + $content = stripslashes((string) $content); // $content = e107::getBB()->htmltoBBcode($content); //XXX This breaks inserted images from media-manager. :/ e107::getBB()->setClass($this->getMediaCategory()); @@ -176,7 +176,7 @@ function toDB($content) { e107::getBB()->setClass($this->getMediaCategory()); - $content = stripslashes($content); + $content = stripslashes((string) $content); if(check_class($this->postHtmlClass)) // Plain HTML mode. { diff --git a/e107_plugins/tinymce4/tinymce4_setup.php b/e107_plugins/tinymce4/tinymce4_setup.php index a0c5ae5eb5..63b679f24f 100644 --- a/e107_plugins/tinymce4/tinymce4_setup.php +++ b/e107_plugins/tinymce4/tinymce4_setup.php @@ -18,24 +18,24 @@ class tinymce4_setup function upgrade_required() { $list = e107::getConfig()->get('e_meta_list'); - + if(!empty($list) && in_array('tinymce4',$list)) { return true; } - + if(file_exists(e_PLUGIN."tinymce4/e_meta.php")) // Outdated file. { e107::getMessage()->addInfo("Please delete the outdated file ".e_PLUGIN."tinymce4/e_meta.php and then run the updating process."); // print_a(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS,8)); return true; } - + return false; } - - + + /* function install_pre($var) { @@ -44,12 +44,12 @@ function install_pre($var) function install_post($var) { - + } function uninstall_options() { - + } function uninstall_post($var) @@ -59,13 +59,13 @@ function uninstall_post($var) function upgrade_pre($var) { - + } function upgrade_post($var) { } - + */ } diff --git a/e107_plugins/tinymce4/wysiwyg.php b/e107_plugins/tinymce4/wysiwyg.php index c978b974bc..d757499318 100644 --- a/e107_plugins/tinymce4/wysiwyg.php +++ b/e107_plugins/tinymce4/wysiwyg.php @@ -122,7 +122,7 @@ $compression_browser_support = false; $compression_server_support = false; -if(strpos(varset($_SERVER['HTTP_ACCEPT_ENCODING']), 'gzip') !== false) +if(strpos((string) varset($_SERVER['HTTP_ACCEPT_ENCODING']), 'gzip') !== false) { $compression_browser_support = true; } @@ -161,7 +161,7 @@ header('Content-Encoding: gzip'); $minified = e107::minify($gen); - $gzipoutput = gzencode($minified,6); + $gzipoutput = gzencode((string) $minified,6); header('Content-Length: '.strlen($gzipoutput)); echo $gzipoutput; diff --git a/e107_plugins/tinymce4/wysiwyg_class.php b/e107_plugins/tinymce4/wysiwyg_class.php index 9db67129ef..59f1d898e8 100644 --- a/e107_plugins/tinymce4/wysiwyg_class.php +++ b/e107_plugins/tinymce4/wysiwyg_class.php @@ -156,7 +156,7 @@ function getExternalPlugins($data) return null; } - $tmp = explode(" ",$data); + $tmp = explode(" ",(string) $data); if(e107::pref('core','smiley_activate',false)) { @@ -181,7 +181,7 @@ function getExternalPlugins($data) function convertBoolean($string) { - if(substr($string,0,1) == '{' || substr($string,0,1) == '[' || substr($string,0,9) == 'function(') + if(substr((string) $string,0,1) == '{' || substr((string) $string,0,1) == '[' || substr((string) $string,0,9) == 'function(') { return $string; } @@ -377,7 +377,7 @@ function getConfig($config=false) {title: 'Image Right', selector: 'img', classes: 'bbcode-img-right', icon: 'alignright'} ]}, - + {title: 'Glyphs', items: [ {title: 'Size 2x', selector: 'i', classes: 'fa-2x'}, {title: 'Size 3x', selector: 'i', classes: 'fa-3x'}, @@ -427,9 +427,9 @@ function getConfig($config=false) {title: 'Hover', selector: 'table', classes: 'table-hover'}, {title: 'Striped', selector: 'table', classes: 'table-striped'}, ]}, - - + + {title: 'Animate.css Style', items: [ {title: 'bounce', selector: 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table,img', classes: 'animated bounce'}, {title: 'flash', selector: 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table,img', classes: 'animated flash'}, @@ -508,7 +508,7 @@ function getConfig($config=false) {title: 'slideOutLeft', selector: 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table,img', classes: 'animated slideOutLeft'}, {title: 'slideOutRight', selector: 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table,img', classes: 'animated slideOutRight'}, {title: 'slideOutUp', selector: 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table,img', classes: 'animated slideOutUp'}, */ - + ]}, @@ -633,9 +633,9 @@ function getConfig($config=false) $c = 0; foreach($emo as $path=>$co) { - $codes = explode(" ",$co); + $codes = explode(" ",(string) $co); $url = e_IMAGE_ABS."emotes/" . $pack . "/" . str_replace("!",".",$path); - $emotes[$i][] = array('shortcut'=>$codes, 'url'=>$url, 'title'=>ucfirst($path)); + $emotes[$i][] = array('shortcut'=>$codes, 'url'=>$url, 'title'=>ucfirst((string) $path)); if($c == 6) { @@ -714,7 +714,7 @@ function getConfig($config=false) $this->config = implode(",\n",$text); - + // ------------------------------------------------------------------------------------- diff --git a/e107_plugins/user/e_dashboard.php b/e107_plugins/user/e_dashboard.php index e6cf88e514..309e7d414b 100644 --- a/e107_plugins/user/e_dashboard.php +++ b/e107_plugins/user/e_dashboard.php @@ -116,7 +116,7 @@ private function getStats($type) $log_data = $value['log_data']; // extract($value); - $log_id = substr($log_id, 0, 4).'-'.substr($log_id, 5, 2).'-'.str_pad(substr($log_id, 8), 2, '0', STR_PAD_LEFT); + $log_id = substr((string) $log_id, 0, 4).'-'.substr((string) $log_id, 5, 2).'-'.str_pad(substr((string) $log_id, 8), 2, '0', STR_PAD_LEFT); if(is_array($log_data)) { $entries[0] = $log_data['host']; $entries[1] = $log_data['date']; @@ -127,7 +127,7 @@ private function getStats($type) } else { - $entries = explode(chr(1), $log_data); + $entries = explode(chr(1), (string) $log_data); } $dayarray[$log_id]['daytotal'] = $entries[0]; @@ -140,7 +140,7 @@ private function getStats($type) { if($entry) { - list($url, $total, $unique) = explode("|", $entry); + list($url, $total, $unique) = explode("|", (string) $entry); if(strpos($url, "/") !== false) { $urlname = preg_replace("/\.php|\?.*/", "", substr($url, (strrpos($url, "/")+1))); @@ -289,25 +289,25 @@ function registered($id=null) $cht->setProvider('google'); - + $width='100%'; $height = 380; - + $data[] = array('Day', "Registered" ); - + $amt = array(); - + // if($when == 'this') { $month_start = strtotime('first day of this month', mktime(0,0,0)); $month_end = strtotime('last day of this month', mktime(23,59,59)); } - + /* if($when == 'last') { $month_start = strtotime('first day of last month', mktime(0,0,0)); $month_end = strtotime('last day of last month', mktime(23,59,59)); }*/ - + if(!$sql->gen("SELECT user_id,user_ban,user_join FROM `#user` WHERE user_join BETWEEN ".$month_start." AND ".$month_end." AND user_ban = 0")) { return false; @@ -332,13 +332,13 @@ function registered($id=null) // print_a($monthNumber); $sum = array_sum($amt); - + // $this->title = 'Registered '.date('M Y',$month_start).' ('.$sum.')'; $this->title = UC_LAN_9.' ('.$sum.')'; - + $totalDays = date('t', $month_start); - + for ($i=1; $i < ($totalDays +1); $i++) { $diz = date('D jS', mktime(1,1,1,$monthNumber,$i, $yearNumber)); @@ -346,9 +346,9 @@ function registered($id=null) $data[] = array($diz, $val); // $dateName[$i] $ticks[] = $i; } - + // print_a($data); - + $options = array( 'chartArea' =>array('left'=>'60', 'width'=>'100%', 'top'=>'25'), 'legend' => array('position'=> 'none', 'alignment'=>'center', 'textStyle' => array('fontSize' => 14, 'color' => '#ccc')), @@ -357,29 +357,29 @@ function registered($id=null) 'colors' => array('#77acd9','#EDA0B6', '#EE8D21', '#5CB85C'), 'animation' => array('duration'=>1000, 'easing' => 'out'), 'areaOpacity' => 0.8, - + 'backgroundColor' => array('fill' => 'transparent' ) ); // $cht->setType('column'); $cht->setOptions($options); $cht->setData($data); - + // redraw to fix sizing issue. /* e107::js('footer-inline', " - - + + $('a[data-toggle=\"tab\"]').on('shown.bs.tab', function (e) { // drawLast(); drawThismonth(); }) - - + + ");*/ - - + + return "
".$cht->render($id, $width, $height)."
"; - + // return "
".$cht->render('projection', 320, 380)."
"; } @@ -446,7 +446,7 @@ function renderOnlineUsers($data=false) ".e107::getDateConvert()->convert_date($val['user_currentvisit'],'%H:%M:%S')." ".$this->renderOnlineName($val['online_user_id'])." ".e107::getIPHandler()->ipDecode($val['user_ip'])." - ".$tp->html_truncate(basename($val['user_location']),50,"...")." + ".$tp->html_truncate(basename((string) $val['user_location']),50,"...")." ".$this->browserIcon($val).""; $panelOnline .= (!empty($multilan)) ? "convert($val['user_language'])."\">".$val['user_language']."" : ""; @@ -485,7 +485,7 @@ function browserIcon($row) foreach($types as $icon=>$b) { - if(strpos($row['user_agent'], $b)!==false) + if(strpos((string) $row['user_agent'], $b)!==false) { return ""; } diff --git a/e107_plugins/user/usertheme_menu.php b/e107_plugins/user/usertheme_menu.php index edb1f8b8a6..64b12e84bf 100644 --- a/e107_plugins/user/usertheme_menu.php +++ b/e107_plugins/user/usertheme_menu.php @@ -43,7 +43,7 @@ while ($row = $sql->fetch()) { - $up = (substr($row['user_prefs'],0,5) == "array") ? e107::unserialize($row['user_prefs']) : unserialize($row['user_prefs']); + $up = (substr((string) $row['user_prefs'],0,5) == "array") ? e107::unserialize($row['user_prefs']) : unserialize($row['user_prefs']); if (isset($themecount[$up['sitetheme']])) { $themecount[$up['sitetheme']]++; } } diff --git a/e107_plugins/user/usertheme_menu_config.php b/e107_plugins/user/usertheme_menu_config.php index eb6b51d540..0f3ad04fe4 100644 --- a/e107_plugins/user/usertheme_menu_config.php +++ b/e107_plugins/user/usertheme_menu_config.php @@ -25,7 +25,7 @@ require_once(e_ADMIN."auth.php"); $frm = e107::getForm(); - + // Get the list of available themes $handle = opendir(e_THEME); while ($file = readdir($handle)) @@ -47,7 +47,7 @@ $tmp = array(); foreach($_POST as $key => $value) { - if (substr($key,0,6) == 'theme_') + if (substr((string) $key,0,6) == 'theme_') { $tmp[] = $value; } @@ -117,9 +117,9 @@ "; $mes = e107::getMessage(); - + $ns->tablerender(defset('LAN_UMENU_THEME_6'),$mes->render().$text); - + require_once(e_ADMIN."footer.php"); /* diff --git a/e107_tests/lib/deployers/SFTPDeployer.php b/e107_tests/lib/deployers/SFTPDeployer.php index e72f5597ae..ccf9f4585b 100644 --- a/e107_tests/lib/deployers/SFTPDeployer.php +++ b/e107_tests/lib/deployers/SFTPDeployer.php @@ -22,7 +22,7 @@ private function generateSshpassPrefix() if (empty($this->getFsParam('privkey_path')) && !empty($this->getFsParam('password'))) { - return 'sshpass -p '.escapeshellarg($this->getFsParam('password')).' '; + return 'sshpass -p '.escapeshellarg((string) $this->getFsParam('password')).' '; } return ''; } @@ -35,9 +35,9 @@ private function getFsParam($key) private function generateRsyncRemoteShell() { $prefix = 'ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -p '. - escapeshellarg($this->getFsParam('port')); + escapeshellarg((string) $this->getFsParam('port')); if (!empty($this->getFsParam('privkey_path'))) - return $prefix.' -i ' . escapeshellarg($this->getFsParam('privkey_path')); + return $prefix.' -i ' . escapeshellarg((string) $this->getFsParam('privkey_path')); else return $prefix; } @@ -78,7 +78,7 @@ public function unlinkAppFile($relative_path) $command = $this->generateSshpassPrefix(). $this->generateRsyncRemoteShell(). " ".escapeshellarg("{$fs_params['user']}@{$fs_params['host']}"). - " ".escapeshellarg("rm -v " . escapeshellarg(rtrim($fs_params['path'], '/')."/$relative_path")); + " ".escapeshellarg("rm -v " . escapeshellarg(rtrim((string) $fs_params['path'], '/')."/$relative_path")); $retcode = self::runCommand($command); if ($retcode === 0) { @@ -93,10 +93,10 @@ public function unlinkAppFile($relative_path) private function start_fs() { $fs_params = $this->getFsParams(); - $fs_params['path'] = rtrim($fs_params['path'], '/') . '/'; + $fs_params['path'] = rtrim((string) $fs_params['path'], '/') . '/'; $command = $this->generateSshpassPrefix() . 'rsync -e ' . - escapeshellarg($this->generateRsyncRemoteShell()) . + escapeshellarg((string) $this->generateRsyncRemoteShell()) . ' --delete -avzHXShs ' . escapeshellarg(rtrim(APP_PATH, '/') . '/') . ' ' . escapeshellarg("{$fs_params['user']}@{$fs_params['host']}:{$fs_params['path']}"); diff --git a/e107_tests/lib/deployers/cPanelDeployer.php b/e107_tests/lib/deployers/cPanelDeployer.php index 94b58dee25..22584b1448 100644 --- a/e107_tests/lib/deployers/cPanelDeployer.php +++ b/e107_tests/lib/deployers/cPanelDeployer.php @@ -105,7 +105,7 @@ private static function get_active_acceptance_tests($cPanel, $homedir) if (!is_null($acceptance_tests_apiresponse->{'data'})) { $acceptance_tests_raw = $acceptance_tests_apiresponse->{'data'}->{'content'}; - $acceptance_tests = (array) json_decode($acceptance_tests_raw, true); + $acceptance_tests = (array) json_decode((string) $acceptance_tests_raw, true); self::prune_acceptance_tests($acceptance_tests); } return $acceptance_tests; @@ -157,7 +157,7 @@ private static function prune_inactive_acceptance_test_resources($cPanel, $valid foreach ($target_files as $target_file) { $questionable_filename = $target_file->{'file'}; - if (substr($questionable_filename, 0, strlen(self::TEST_PREFIX)) === self::TEST_PREFIX && + if (substr((string) $questionable_filename, 0, strlen(self::TEST_PREFIX)) === self::TEST_PREFIX && !in_array($questionable_filename, $valid_acceptance_test_ids)) { self::println("Deleting expired test folder \"".self::TARGET_RELPATH.$questionable_filename."\"…"); @@ -172,9 +172,9 @@ private static function prune_mysql_databases($dbs, $ids, $cPanel) foreach ($dbs as $db) { $db = (array) $db; - if (substr($db['db'], 0, strlen($prefix)) !== $prefix) + if (substr((string) $db['db'], 0, strlen($prefix)) !== $prefix) continue; - $questionable_db = substr($db['db'], strlen($prefix)); + $questionable_db = substr((string) $db['db'], strlen($prefix)); if (!in_array($questionable_db, $ids)) { self::println("Deleting expired MySQL database \"".$db['db']."\"…"); @@ -189,9 +189,9 @@ private static function prune_mysql_users($users, $ids, $cPanel) foreach ($users as $user) { $user = (array) $user; - if (substr($user['user'], 0, strlen($prefix)) !== $prefix) + if (substr((string) $user['user'], 0, strlen($prefix)) !== $prefix) continue; - $questionable_user = substr($user['user'], strlen($prefix)); + $questionable_user = substr((string) $user['user'], strlen($prefix)); if (!in_array($questionable_user, $ids)) { self::println("Deleting expired MySQL user \"".$user['user']."\"…"); @@ -356,8 +356,8 @@ private static function archive_app($path, $prefix = '') foreach ($i as $file_info) { $realpath = $file_info->getRealPath(); - if (substr($realpath, 0, strlen($path)) === $path) - $relpath = substr($realpath, strlen($path)); + if (substr((string) $realpath, 0, strlen($path)) === $path) + $relpath = substr((string) $realpath, strlen($path)); if (substr($relpath, -3) === "/.." || substr($relpath, -2) === "/." || !file_exists($realpath) || diff --git a/e107_tests/lib/preparers/E107Preparer.php b/e107_tests/lib/preparers/E107Preparer.php index 5ada553f32..8110f69ded 100644 --- a/e107_tests/lib/preparers/E107Preparer.php +++ b/e107_tests/lib/preparers/E107Preparer.php @@ -31,7 +31,7 @@ protected function deleteHashDirs() private function deleteDir($dirPath) { - codecept_debug(__CLASS__ . ' is deleting '.escapeshellarg($dirPath).'…'); + codecept_debug(__CLASS__ . ' is deleting '.escapeshellarg((string) $dirPath).'…'); if(!is_dir($dirPath)) { diff --git a/e107_tests/tests/_bootstrap.php b/e107_tests/tests/_bootstrap.php index e571e7419d..51db4ad856 100644 --- a/e107_tests/tests/_bootstrap.php +++ b/e107_tests/tests/_bootstrap.php @@ -45,7 +45,7 @@ private function initialize() $params = include(PARAMS_GENERATOR); $app_path = $params['app_path'] ?: codecept_root_dir() . "/e107"; - if (substr($app_path, 0, 1) !== '/') + if (substr((string) $app_path, 0, 1) !== '/') { $app_path = codecept_root_dir() . "/$app_path"; } diff --git a/e107_tests/tests/_data/basic-light/templates/news/news_menu_template.php b/e107_tests/tests/_data/basic-light/templates/news/news_menu_template.php index 6dc8da5ccd..44bc9c105e 100644 --- a/e107_tests/tests/_data/basic-light/templates/news/news_menu_template.php +++ b/e107_tests/tests/_data/basic-light/templates/news/news_menu_template.php @@ -83,7 +83,7 @@
{NEWSTITLELINK}
\n"; - + $NEWS_MENU_TEMPLATE['other2']['end'] = ""; diff --git a/e107_tests/tests/_data/testcore/fs_functions.php b/e107_tests/tests/_data/testcore/fs_functions.php index 6b4eab39bb..32f34885b1 100644 --- a/e107_tests/tests/_data/testcore/fs_functions.php +++ b/e107_tests/tests/_data/testcore/fs_functions.php @@ -6,7 +6,7 @@ function hilite($link,$enabled=''){ if(!$enabled){ return FALSE; } $link = $tp->replaceConstants($link,TRUE); - $tmp = explode("?",$link); + $tmp = explode("?",(string) $link); $link_qry = (isset($tmp[1])) ? $tmp[1] : ""; $link_slf = (isset($tmp[0])) ? $tmp[0] : ""; $link_pge = basename($link_slf); @@ -22,7 +22,7 @@ function hilite($link,$enabled=''){ // ----------- highlight overriding - set the link matching in the page itself. if(defined("HILITE")) { - if(strpos($link,HILITE)) { + if(strpos((string) $link,(string) HILITE)) { return TRUE; } } @@ -37,11 +37,11 @@ function hilite($link,$enabled=''){ } // --------------- highlighting for plugins. ---------------- - if(stristr($link, $PLUGINS_DIRECTORY) !== FALSE && stristr($link, "custompages") === FALSE){ + if(stristr((string) $link, (string) $PLUGINS_DIRECTORY) !== FALSE && stristr((string) $link, "custompages") === FALSE){ if($link_qry) { // plugin links with queries - $subq = explode("?",$link); + $subq = explode("?",(string) $link); if(strpos(e_SELF,$subq[0]) && e_QUERY == $subq[1]){ return TRUE; }else{ @@ -60,10 +60,10 @@ function hilite($link,$enabled=''){ // --------------- highlight for news items.---------------- // eg. news.php, news.php?list.1 or news.php?cat.2 etc - if(substr(basename($link),0,8) == "news.php") + if(substr(basename((string) $link),0,8) == "news.php") { - if (strpos($link, "news.php?") !== FALSE && strpos(e_SELF,"/news.php")!==FALSE) { + if (strpos((string) $link, "news.php?") !== FALSE && strpos(e_SELF,"/news.php")!==FALSE) { $lnk = explode(".",$link_qry); // link queries. $qry = explode(".",e_QUERY); // current page queries. @@ -100,7 +100,7 @@ function hilite($link,$enabled=''){ // --------------- highlight for Custom Pages.---------------- // eg. page.php?1 - if (strpos($link, "page.php?") !== FALSE && strpos(e_SELF,"/page.php")) { + if (strpos((string) $link, "page.php?") !== FALSE && strpos(e_SELF,"/page.php")) { list($custom,$page) = explode(".",$link_qry); list($q_custom,$q_page) = explode(".",e_QUERY); if($custom == $q_custom){ @@ -111,7 +111,7 @@ function hilite($link,$enabled=''){ } // --------------- highlight default ---------------- - if(strpos($link, "?") !== FALSE){ + if(strpos((string) $link, "?") !== FALSE){ $thelink = str_replace("../", "", $link); if((strpos(e_SELF,$thelink) !== false) && (strpos(e_QUERY,$link_qry) !== false)){ @@ -122,11 +122,11 @@ function hilite($link,$enabled=''){ return true; } - if((!$link_qry && !e_QUERY) && (strpos(e_SELF,$link) !== FALSE)){ + if((!$link_qry && !e_QUERY) && (strpos(e_SELF,(string) $link) !== FALSE)){ return TRUE; } - if(($link_slf == e_SELF && !link_qry) || (e_QUERY && strpos(e_SELF."?".e_QUERY,$link)!== FALSE) ){ + if(($link_slf == e_SELF && !link_qry) || (e_QUERY && strpos(e_SELF."?".e_QUERY,(string) $link)!== FALSE) ){ return TRUE; } @@ -137,7 +137,7 @@ function hilite($link,$enabled=''){ function adnav_cat($cat_title, $cat_link, $cat_id=FALSE, $cat_open=FALSE) { global $tp; - $cat_link = (strpos($cat_link, '://') === FALSE && strpos($cat_link, 'mailto:') !== 0 ? e_HTTP.$cat_link : $cat_link); + $cat_link = (strpos((string) $cat_link, '://') === FALSE && strpos((string) $cat_link, 'mailto:') !== 0 ? e_HTTP.$cat_link : $cat_link); if ($cat_open == 4 || $cat_open == 5){ $dimen = ($cat_open == 4) ? "600,400" : "800,600"; @@ -166,8 +166,8 @@ function render_sub($linklist, $id) { foreach ($linklist['sub_'.$id] as $sub) { // Filter title for backwards compatibility ----> - if(substr($sub['link_name'],0,8) == "submenu.") { - $tmp = explode(".",$sub['link_name']); + if(substr((string) $sub['link_name'],0,8) == "submenu.") { + $tmp = explode(".",(string) $sub['link_name']); $subname = $tmp[2]; } else { $subname = $sub['link_name']; @@ -214,7 +214,7 @@ function render_sub($linklist, $id) { function adnav_main($cat_title, $cat_link, $cat_id=FALSE, $cat_open=FALSE) { global $tp; - $cat_link = (strpos($cat_link, '://') === FALSE) ? e_HTTP.$cat_link : $cat_link; + $cat_link = (strpos((string) $cat_link, '://') === FALSE) ? e_HTTP.$cat_link : $cat_link; $cat_link = $tp->replaceConstants($cat_link,TRUE); if ($cat_open == 4 || $cat_open == 5){ diff --git a/e107_tests/tests/_support/Helper/DelayedDb.php b/e107_tests/tests/_support/Helper/DelayedDb.php index 5195042d03..09284ba944 100644 --- a/e107_tests/tests/_support/Helper/DelayedDb.php +++ b/e107_tests/tests/_support/Helper/DelayedDb.php @@ -21,14 +21,14 @@ public function _delayedInitialize() public function _getDbHostname() { $matches = []; - $matched = preg_match('~host=([^;]+)~s', $this->config['dsn'], $matches); + $matched = preg_match('~host=([^;]+)~s', (string) $this->config['dsn'], $matches); return $matched ? $matches[1] : false; } public function _getDbName() { $matches = []; - $matched = preg_match('~dbname=([^;]+)~s', $this->config['dsn'], $matches); + $matched = preg_match('~dbname=([^;]+)~s', (string) $this->config['dsn'], $matches); return $matched ? $matches[1] : false; } diff --git a/e107_tests/tests/unit/CronParserTest.php b/e107_tests/tests/unit/CronParserTest.php index 256536b012..61661b70a5 100644 --- a/e107_tests/tests/unit/CronParserTest.php +++ b/e107_tests/tests/unit/CronParserTest.php @@ -77,13 +77,13 @@ public function testCalcLastRan() { $lastTimeZone = date_default_timezone_get(); date_default_timezone_set('America/Chihuahua'); - + $this->cp->calcLastRan('* * * * *'); - + $due = $this->cp->getLastDue(); $now = $this->cp->getNow(); - list($date, $time) = explode('T', $due); + list($date, $time) = explode('T', (string) $due); list($year,$month,$day) = explode('-', $date); list($hour,$minute) = explode(':', $time); diff --git a/e107_tests/tests/unit/TreeModelTest.php b/e107_tests/tests/unit/TreeModelTest.php index e4e4da4f7f..55da411d79 100644 --- a/e107_tests/tests/unit/TreeModelTest.php +++ b/e107_tests/tests/unit/TreeModelTest.php @@ -94,7 +94,7 @@ public function testPrepareSimulatedPaginationProcessesCountOnly() $method->setAccessible(true); $method->invoke($tree_model); - $this->assertEquals('ORDER BY n.news_sticky DESC, n.news_datestamp DESC', trim($tree_model->getParam('db_query'))); + $this->assertEquals('ORDER BY n.news_sticky DESC, n.news_datestamp DESC', trim((string) $tree_model->getParam('db_query'))); $this->assertEquals('4', $tree_model->getParam('db_limit_count')); $this->assertEmpty($tree_model->getParam('db_limit_offset')); } @@ -109,7 +109,7 @@ public function testPrepareSimulatedPaginationProcessesOffsetAndCount() $method->setAccessible(true); $method->invoke($tree_model); - $this->assertEquals('ORDER BY n.news_sticky DESC, n.news_datestamp DESC', trim($tree_model->getParam('db_query'))); + $this->assertEquals('ORDER BY n.news_sticky DESC, n.news_datestamp DESC', trim((string) $tree_model->getParam('db_query'))); $this->assertEquals('163', $tree_model->getParam('db_limit_count')); $this->assertEquals('79', $tree_model->getParam('db_limit_offset')); } diff --git a/e107_tests/tests/unit/e107EmailTest.php b/e107_tests/tests/unit/e107EmailTest.php index d269cd3d29..6888c75b6a 100644 --- a/e107_tests/tests/unit/e107EmailTest.php +++ b/e107_tests/tests/unit/e107EmailTest.php @@ -343,7 +343,7 @@ private function fileContainsString($filePath, $string) if (!file_exists($filePath)) return false; $handle = fopen($filePath, 'r'); while (($buffer = fgets($handle)) !== false) { - if (strpos($buffer, $string) !== false) { + if (strpos($buffer, (string) $string) !== false) { return true; } } diff --git a/e107_tests/tests/unit/e107Test.php b/e107_tests/tests/unit/e107Test.php index fe1eef9974..8715fbcc3e 100644 --- a/e107_tests/tests/unit/e107Test.php +++ b/e107_tests/tests/unit/e107Test.php @@ -99,20 +99,20 @@ public function testRenderLayout()
- + {---HEADER---} - + {---LAYOUT---} - + - + {SETSTYLE=default}
- +
{MENU=100} @@ -121,23 +121,23 @@ public function testRenderLayout() {MENU=101}
- +
{MENU=102}
- +
{MENU=103}
- +
{MENU=104}
- +
{MENU=105} @@ -148,28 +148,28 @@ public function testRenderLayout() {BOOTSTRAP_USERNAV: placement=bottom&dir=up}
- +
- +
- +
{SITEDISCLAIMER}
- +
- + {---MODAL---} {---FOOTER---} - - + + '; @@ -1644,7 +1644,7 @@ public function testPref() private function generateRows($var, $plugin) { - preg_match_all('#\{([a-z_]*)\}#', $var['sef'], $matches); + preg_match_all('#\{([a-z_]*)\}#', (string) $var['sef'], $matches); $variables = array('-one-', '-two-', '-three-'); diff --git a/e107_tests/tests/unit/e107pluginTest.php b/e107_tests/tests/unit/e107pluginTest.php index fbda95899f..494f5194b4 100644 --- a/e107_tests/tests/unit/e107pluginTest.php +++ b/e107_tests/tests/unit/e107pluginTest.php @@ -195,7 +195,7 @@ public function testXmlExtendedFields() ), ) ); - + $expected = array ( 0 => array ( 'name' => 'plugin_test_custom', @@ -213,8 +213,8 @@ public function testXmlExtendedFields() 'source' => 'plugin_test', ), ); - - + + $result = $this->ep->XmlExtendedFields('test', $extendedVars); diff --git a/e107_tests/tests/unit/e_admin_controller_uiTest.php b/e107_tests/tests/unit/e_admin_controller_uiTest.php index f733c4cd40..139c092683 100644 --- a/e107_tests/tests/unit/e_admin_controller_uiTest.php +++ b/e107_tests/tests/unit/e_admin_controller_uiTest.php @@ -60,7 +60,7 @@ public function testJoinAlias() OR e.calls_from = REPLACE(m.mem_phone_other1 , '-', '') OR e.calls_from = REPLACE(m.mem_phone_other2 , '-', '') ) - + ) LEFT JOIN `#member_calender` AS cl ON ( @@ -69,7 +69,7 @@ public function testJoinAlias() cl.cal_by_phone = REPLACE(m.mem_phone_day, '-', '') OR cl.cal_by_cell = REPLACE(m.mem_phone_cell , '-', '') ) - + ) "; $this->ui->joinAlias($qry2); diff --git a/e107_tests/tests/unit/e_bbcodeTest.php b/e107_tests/tests/unit/e_bbcodeTest.php index bc2d116f90..41cfb027b4 100644 --- a/e107_tests/tests/unit/e_bbcodeTest.php +++ b/e107_tests/tests/unit/e_bbcodeTest.php @@ -74,7 +74,7 @@ public function testHtmltoBBcode() $result = $this->bb->htmltoBbcode($text); - $expected = strip_tags($result); + $expected = strip_tags((string) $result); $this->assertSame($expected, $result); diff --git a/e107_tests/tests/unit/e_customfieldsTest.php b/e107_tests/tests/unit/e_customfieldsTest.php index 0a08fb5b27..833142e76b 100644 --- a/e107_tests/tests/unit/e_customfieldsTest.php +++ b/e107_tests/tests/unit/e_customfieldsTest.php @@ -229,7 +229,7 @@ public function testFieldValues() 19 => 'Userclass', 20 => 'Progress Bar', ); - + $expectedValues = array ( 'image' => ' '
assertTrue($check); $this->db->select('user', '*', 'user_id = 1'); @@ -971,7 +971,7 @@ public function testGetLastErrorText() $this->db->select('doesnt_exists'); $result = $this->db->getLastErrorText(); - $actual = (strpos($result,"doesn't exist")!== false ); + $actual = (strpos((string) $result,"doesn't exist")!== false ); $this->assertTrue($actual); } diff --git a/e107_tests/tests/unit/e_fileTest.php b/e107_tests/tests/unit/e_fileTest.php index c3a980bf86..1823ad44ce 100644 --- a/e107_tests/tests/unit/e_fileTest.php +++ b/e107_tests/tests/unit/e_fileTest.php @@ -476,7 +476,7 @@ public function testGetFileExtension() foreach($test as $mime=>$ext) { $actual = $this->fl->getFileExtension($mime); - + self::assertSame($ext, $actual); } } @@ -630,7 +630,7 @@ public function testUnzipGithubArchive() { foreach ($src_dest_map as $src => $dest) { - $desired_filename = preg_replace("/^".preg_quote($src, '/')."/", $dest, $desired_filename); + $desired_filename = preg_replace("/^".preg_quote($src, '/')."/", $dest, (string) $desired_filename); } self::assertContains(realpath($destination.$desired_filename), $results['success'], "Desired file $desired_filename did not appear in file system"); diff --git a/e107_tests/tests/unit/e_formTest.php b/e107_tests/tests/unit/e_formTest.php index 5f6482ac1c..43c0c878a0 100644 --- a/e107_tests/tests/unit/e_formTest.php +++ b/e107_tests/tests/unit/e_formTest.php @@ -1321,7 +1321,7 @@ public function testRenderElementDropdown() $result = str_replace(array("\n", "\r"), "", $result); $expected = ""; - + self::assertSame($expected, $result); } diff --git a/e107_tests/tests/unit/e_jsmanagerTest.php b/e107_tests/tests/unit/e_jsmanagerTest.php index a5e315586d..5aba3d0450 100644 --- a/e107_tests/tests/unit/e_jsmanagerTest.php +++ b/e107_tests/tests/unit/e_jsmanagerTest.php @@ -377,7 +377,7 @@ public function testAddLink() foreach($tests as $var) { - $result = (strpos($actual, $var['expected']) !== false); + $result = (strpos((string) $actual, $var['expected']) !== false); $this->assertTrue($result, $var['expected'] . " was not found in the rendered links. Render links result:" . $actual . "\n\n"); } @@ -431,7 +431,7 @@ public function testAddLink() foreach($staticTests as $var) { - $result = (strpos($actual, $var['expected']) !== false); + $result = (strpos((string) $actual, $var['expected']) !== false); self::assertTrue($result, $var['expected'] . " was not found in the rendered links. Render links result:" . $actual . "\n\n"); } diff --git a/e107_tests/tests/unit/e_library_managerTest.php b/e107_tests/tests/unit/e_library_managerTest.php index 40a124ede8..300fa42058 100644 --- a/e107_tests/tests/unit/e_library_managerTest.php +++ b/e107_tests/tests/unit/e_library_managerTest.php @@ -155,7 +155,7 @@ private function isValidURL($url) return false; } - if(!empty($headers[0]) && strpos($headers[0], 'OK') !== false) + if(!empty($headers[0]) && strpos((string) $headers[0], 'OK') !== false) { return true; } diff --git a/e107_tests/tests/unit/e_parseTest.php b/e107_tests/tests/unit/e_parseTest.php index b3abf93a8b..e6d00b522f 100644 --- a/e107_tests/tests/unit/e_parseTest.php +++ b/e107_tests/tests/unit/e_parseTest.php @@ -1288,7 +1288,7 @@ public function testToRss() private function isValidXML($xmlContent) { - if (trim($xmlContent) == '') + if (trim((string) $xmlContent) == '') { return false; } @@ -2707,7 +2707,7 @@ public function testToImage() foreach ($tests as $index => $var) { $result = $this->tp->toImage($var['src'], $var['parms']); - $result = preg_replace('/"([^"]*)thumb.php/', '"thumb.php', $result); + $result = preg_replace('/"([^"]*)thumb.php/', '"thumb.php', (string) $result); self::assertSame($var['expected'], $result); } diff --git a/e107_tests/tests/unit/e_pluginTest.php b/e107_tests/tests/unit/e_pluginTest.php index 3cdfd0ac27..d0a8f295d9 100644 --- a/e107_tests/tests/unit/e_pluginTest.php +++ b/e107_tests/tests/unit/e_pluginTest.php @@ -321,7 +321,7 @@ public function testGetMeta() public function testIsValidAddonMarkup() { $content = 'ep->isValidAddonMarkup($content); $this->assertTrue($result); diff --git a/e107_tests/tests/unit/e_pluginbuilderTest.php b/e107_tests/tests/unit/e_pluginbuilderTest.php index a53a83020e..7be187382c 100644 --- a/e107_tests/tests/unit/e_pluginbuilderTest.php +++ b/e107_tests/tests/unit/e_pluginbuilderTest.php @@ -6,7 +6,7 @@ class e_pluginbuilderTest extends \Codeception\Test\Unit /** @var e_pluginbuilder */ protected $pb; - + protected $posted; protected function _before() @@ -21,7 +21,7 @@ protected function _before() { $this->fail($e->getMessage()); } - + $this->posted = array ( 'xml' => array ( diff --git a/e107_tests/tests/unit/e_thumbnailTest.php b/e107_tests/tests/unit/e_thumbnailTest.php index 18470bdab8..69a6cff278 100644 --- a/e107_tests/tests/unit/e_thumbnailTest.php +++ b/e107_tests/tests/unit/e_thumbnailTest.php @@ -378,10 +378,10 @@ public function hasStringImage($image) public function compareHash($imageHash) { $sString = $this->getHasString(); - if (strlen($imageHash) == 64 && strlen($sString) == 64) { + if (strlen((string) $imageHash) == 64 && strlen((string) $sString) == 64) { $diff = 0; - $sString = str_split($sString); - $imageHash = str_split($imageHash); + $sString = str_split((string) $sString); + $imageHash = str_split((string) $imageHash); for($a = 0; $a < 64; $a++) { if ($imageHash[$a] != $sString[$a]) { $diff++; diff --git a/e107_themes/bootstrap3/admin_theme.php b/e107_themes/bootstrap3/admin_theme.php index d2a6acfcbb..81bd33eb09 100644 --- a/e107_themes/bootstrap3/admin_theme.php +++ b/e107_themes/bootstrap3/admin_theme.php @@ -94,7 +94,7 @@ public function tablestyle($caption, $text, $mode='', $data=array()) // global $style; $style = $data['setStyle']; - + // echo "Style: ".$style; echo "\n\n\n\n"; @@ -140,7 +140,7 @@ public function tablestyle($caption, $text, $mode='', $data=array()) return; } - if(trim($caption) == '') + if(trim((string) $caption) == '') { $style = 'no_caption'; } @@ -159,7 +159,7 @@ public function tablestyle($caption, $text, $mode='', $data=array()) - + switch(varset($style, 'admin_content')) { case 'flexpanel': diff --git a/e107_themes/bootstrap3/theme_shortcodes.php b/e107_themes/bootstrap3/theme_shortcodes.php index 285f76ebf7..8559de5254 100644 --- a/e107_themes/bootstrap3/theme_shortcodes.php +++ b/e107_themes/bootstrap3/theme_shortcodes.php @@ -164,10 +164,10 @@ function sc_bootstrap_usernav($parm=null) $text .= '
  • \n"; - + $NEWS_MENU_TEMPLATE['other2']['end'] = ""; diff --git a/e107_themes/voux/theme.php b/e107_themes/voux/theme.php index d755465f7f..4a8ab0f148 100644 --- a/e107_themes/voux/theme.php +++ b/e107_themes/voux/theme.php @@ -58,36 +58,36 @@ function tablestyle($caption, $text, $id='', $info=array()) { // global $style; // no longer needed. - + $style = $info['setStyle']; - + echo "\n\n"; - + $type = $style; if(empty($caption)) { $type = 'box'; } - + if($style == 'navdoc' || $style == 'none') { echo $text; return; } - + /* if($id == 'wm') // Example - If rendered from 'welcome message' { - + } - + if($id == 'featurebox') // Example - If rendered from 'featurebox' { - + } */ - - + + if($style == 'jumbotron') { echo '
    @@ -102,11 +102,11 @@ function tablestyle($caption, $text, $id='', $info=array())
    '; return; } - + if($style == 'col-md-3' || $style == 'col-md-4' || $style == 'col-md-6' || $style == 'col-md-8' || $style == 'col-md-9') { echo '
    '; - + if(!empty($caption)) { echo '

    '.$caption.'

    '; @@ -116,9 +116,9 @@ function tablestyle($caption, $text, $id='', $info=array()) '.$text.'
    '; return; - + } - + if($style == 'menu') { echo '
    '; return; - + } if($style == 'portfolio') @@ -152,11 +152,11 @@ function tablestyle($caption, $text, $id='', $info=array()) echo $text; - + return; - - - + + + } // applied before every layout. @@ -190,8 +190,8 @@ function tablestyle($caption, $text, $id='', $info=array()) - - + + '; // applied after every layout. @@ -331,9 +331,9 @@ function tablestyle($caption, $text, $id='', $info=array())
    {MENU=1} - + {---} - +
    @@ -397,14 +397,14 @@ function tablestyle($caption, $text, $id='', $info=array()) {SETSTYLE=none} {FEATUREBOX} - +
    {ALERTS} {MENU=1}
    - +
    @@ -416,7 +416,7 @@ function tablestyle($caption, $text, $id='', $info=array())
    - + {SETSTYLE=default}
    @@ -431,8 +431,8 @@ function tablestyle($caption, $text, $id='', $info=array())
    - - + +
    @@ -442,11 +442,11 @@ function tablestyle($caption, $text, $id='', $info=array())

    Display Some Work on the Home Page Portfolio


    - + {SETSTYLE=portfolio} {SETIMAGE: w=700&h=500&crop=1} {GALLERY_PORTFOLIO: placeholder=1&limit=6} - +
    @@ -462,29 +462,29 @@ function tablestyle($caption, $text, $id='', $info=array())
    - + {CMENU=feature-menu-1} - +
    - +
    - +
    - +
    - +
    - + {CMENU=feature-menu-2} - +
    - +
    - +
    @@ -492,9 +492,9 @@ function tablestyle($caption, $text, $id='', $info=array())
    - + {CMENU=feature-menu-3} - +
    @@ -517,32 +517,32 @@ function tablestyle($caption, $text, $id='', $info=array()) $LAYOUT['jumbotron_full'] = ' - + {SETSTYLE=default}
    {ALERTS} {MENU=1} {---} - +
    - - + + '; $LAYOUT['jumbotron_sidebar_right'] = ' - + {SETSTYLE=default}
    {ALERTS}
    - + {---} - +
    - +
    {SETSTYLE=default} @@ -597,9 +597,9 @@ function tablestyle($caption, $text, $id='', $info=array()) /* - - - + + + $NEWSCAT = "\n\n\n\n\n\n\n\n
    diff --git a/e107_themes/voux/theme_shortcodes.php b/e107_themes/voux/theme_shortcodes.php index 5d2f833e6b..826cf9e7f7 100644 --- a/e107_themes/voux/theme_shortcodes.php +++ b/e107_themes/voux/theme_shortcodes.php @@ -129,10 +129,10 @@ function sc_bootstrap_usernav($parm=null) $text .= '
  • ".$tp->toHTML($nfa['gsitemap_cat'],"","defs").": ".$tp->toHTML($nfa['gsitemap_name'],"","defs")."
  • \n"; } $text .= "
    "; diff --git a/install.php b/install.php index c156d8fce9..0002a6c2b4 100644 --- a/install.php +++ b/install.php @@ -265,7 +265,7 @@ function getperms($arg, $ap = '') if(isset($_POST['previous_steps'])) { - $tmp = unserialize(base64_decode($_POST['previous_steps'])); + $tmp = unserialize(base64_decode((string) $_POST['previous_steps'])); $override = (isset($tmp['paths']) && isset($tmp['paths']['hash'])) ? array('site_path'=>$tmp['paths']['hash']) : array(); unset($tmp); unset($tmpadminpass1); @@ -401,7 +401,7 @@ function __construct() $this->e107 = $e107; if(isset($_POST['previous_steps'])) { - $this->previous_steps = unserialize(base64_decode($_POST['previous_steps'])); + $this->previous_steps = unserialize(base64_decode((string) $_POST['previous_steps'])); // Save unfiltered admin password (#4004) - " are transformed into " $tmpadminpass2 = (isset($this->previous_steps['admin'])) ? $this->previous_steps['admin']['password'] : ''; @@ -597,7 +597,7 @@ private function stage_2() // $page_info = nl2br(LANINS_023); $page_info = "
    ".LANINS_141."
    "; $e_forms->start_form("versions", $_SERVER['PHP_SELF'].($_SERVER['QUERY_STRING'] === "debug" ? "?debug" : "")); - $isrequired = (($_SERVER['SERVER_ADDR'] === "127.0.0.1") || ($_SERVER['SERVER_ADDR'] === "localhost") || ($_SERVER['SERVER_ADDR'] === "::1") || preg_match('/^192\.168\.\d{1,3}\.\d{1,3}$/',$_SERVER['SERVER_ADDR'])) ? "" : "required='required'"; // Deals with IP V6, and 192.168.x.x address ranges, could be improved to validate x.x to a valid IP but for this use, I dont think its required to be that picky. + $isrequired = (($_SERVER['SERVER_ADDR'] === "127.0.0.1") || ($_SERVER['SERVER_ADDR'] === "localhost") || ($_SERVER['SERVER_ADDR'] === "::1") || preg_match('/^192\.168\.\d{1,3}\.\d{1,3}$/',(string) $_SERVER['SERVER_ADDR'])) ? "" : "required='required'"; // Deals with IP V6, and 192.168.x.x address ranges, could be improved to validate x.x to a valid IP but for this use, I dont think its required to be that picky. $output = "
    @@ -927,7 +927,7 @@ private function stage_4() $perms_pass = false; foreach ($not_writable as $file) { - $perms_errors .= (substr($file, -1) === "/" ? LANINS_010a : LANINS_010)."
    {$file}
    \n"; + $perms_errors .= (substr((string) $file, -1) === "/" ? LANINS_010a : LANINS_010)."
    {$file}
    \n"; } $perms_notes = LANINS_018; } @@ -936,7 +936,7 @@ private function stage_4() $perms_pass = true; foreach ($opt_writable as $file) { - $perms_errors .= (substr($file, -1) === "/" ? LANINS_010a : LANINS_010)."
    {$file}
    \n"; + $perms_errors .= (substr((string) $file, -1) === "/" ? LANINS_010a : LANINS_010)."
    {$file}
    \n"; } $perms_notes = LANINS_106; } @@ -1901,7 +1901,7 @@ public function import_configuration() $this->previous_steps['prefs']['replyto_email'] = $this->previous_steps['admin']['email']; // Cookie name fix, ended up with 406 error when non-latin words used - $cookiename = preg_replace('/[^a-z0-9]/i', '', trim($this->previous_steps['prefs']['sitename'])); + $cookiename = preg_replace('/[^a-z0-9]/i', '', trim((string) $this->previous_steps['prefs']['sitename'])); $this->previous_steps['prefs']['cookie_name'] = ($cookiename ? substr($cookiename, 0, 4).'_' : 'e_').'cookie'; ### URL related prefs @@ -2028,7 +2028,7 @@ function get_lan_file() { $this->previous_steps['language'] = $_POST['language']; } - + if(!isset($this->previous_steps['language'])) { $this->previous_steps['language'] = "English"; @@ -2242,7 +2242,7 @@ public function create_tables() $sql_table = preg_replace("/create table\s/si", "CREATE TABLE {$this->previous_steps['mysql']['prefix']}", $sql_table); // Drop existing tables before creating. - $tmp = explode("\n",$sql_table); + $tmp = explode("\n",(string) $sql_table); $drop_table = str_replace($srch,$repl,$tmp[0]); $this->dbqry($drop_table); @@ -2261,7 +2261,7 @@ function write_config($data) { $e107_config = 'e107_config.php'; $fp = @fopen($e107_config, 'w'); - if (!@fwrite($fp, $data)) + if (!@fwrite($fp, (string) $data)) { @fclose ($fp); return nl2br(LANINS_070); diff --git a/login.php b/login.php index 5b79dc446b..477f6dc143 100644 --- a/login.php +++ b/login.php @@ -108,7 +108,7 @@ $login_message = SITENAME; // $login_message = LAN_LOGIN_3." | ".SITENAME; - if(strpos($LOGIN_TABLE_HEADER,'LOGIN_TABLE_LOGINMESSAGE') === false && strpos($LOGIN_TABLE,'LOGIN_TABLE_LOGINMESSAGE') === false) + if(strpos((string) $LOGIN_TABLE_HEADER,'LOGIN_TABLE_LOGINMESSAGE') === false && strpos((string) $LOGIN_TABLE,'LOGIN_TABLE_LOGINMESSAGE') === false) { if(deftrue('e_IFRAME')) { diff --git a/online.php b/online.php index 14cd3d85a0..35d2d86aad 100644 --- a/online.php +++ b/online.php @@ -62,12 +62,12 @@ foreach($listuserson as $uinfo => $pinfo) { $class_check = true; - list($oid, $oname) = explode(".", $uinfo, 2); + list($oid, $oname) = explode(".", (string) $uinfo, 2); $online_location = $pinfo; - $online_location_page = substr(strrchr($online_location, "/"), 1); - if(strpos($online_location, "forum_") === false || strpos($online_location, "content.php") === false || strpos($online_location, "comment.php") === false) + $online_location_page = substr(strrchr((string) $online_location, "/"), 1); + if(strpos((string) $online_location, "forum_") === false || strpos((string) $online_location, "content.php") === false || strpos((string) $online_location, "comment.php") === false) { - $online_location_page = str_replace(".php", "", substr(strrchr($online_location, "/"), 1)); + $online_location_page = str_replace(".php", "", substr(strrchr((string) $online_location, "/"), 1)); } switch($online_location_page) @@ -180,9 +180,9 @@ $scArray = array(); - if(strpos($online_location, "content.php") !== false) + if(strpos((string) $online_location, "content.php") !== false) { - $tmp = explode(".", substr(strrchr($online_location, "php."), 2)); + $tmp = explode(".", substr(strrchr((string) $online_location, "php."), 2)); if($tmp[0] == "article") { $sql->select("content", "content_heading, content_class", "content_id='" . (int) $tmp[1] . "'"); @@ -221,9 +221,9 @@ } } - if(strpos($online_location, "comment.php") !== false) + if(strpos((string) $online_location, "comment.php") !== false) { - $tmp = explode(".php.", $online_location); + $tmp = explode(".php.", (string) $online_location); $tmp = explode(".", $tmp[1]); if($tmp[1] == "news") { @@ -253,10 +253,10 @@ } } - if(strpos($online_location, "forum") !== false) + if(strpos((string) $online_location, "forum") !== false) { - $tmp = explode(".", substr(strrchr($online_location, "php."), 2)); - if(strpos($online_location, "_viewtopic") !== false) + $tmp = explode(".", substr(strrchr((string) $online_location, "php."), 2)); + if(strpos((string) $online_location, "_viewtopic") !== false) { if($tmp[2]) { @@ -281,7 +281,7 @@ $online_location_page = ONLINE_EL13 . ": \"" . CLASSRESTRICTED . "\""; } } - elseif(strpos($online_location, "_viewforum") !== false) + elseif(strpos((string) $online_location, "_viewforum") !== false) { $sql->select("forum", "forum_name, forum_class", "forum_id=" . intval($tmp[0])); $forum = $sql->fetch(); @@ -293,7 +293,7 @@ $online_location_page = ONLINE_EL13 . ": \"" . CLASSRESTRICTED . "\""; } } - elseif(strpos($online_location, "_post") !== false) + elseif(strpos((string) $online_location, "_post") !== false) { $sql->select("forum_thread", "thread_name, thread_forum_id", "thread_forum_id=" . intval($tmp[0]) . " AND thread_parent=0"); $forum_thread = $sql->fetch(); @@ -304,7 +304,7 @@ } } - if(strpos($online_location, "admin") !== false) + if(strpos((string) $online_location, "admin") !== false) { $class_check = false; $online_location_page = ADMINAREA; diff --git a/page.php b/page.php index 247ae58854..f305d14fe7 100644 --- a/page.php +++ b/page.php @@ -533,11 +533,11 @@ function listPages($chapt=0) } else { - + $pageArray = $sql->db_getList(); $text = $tp->parseTemplate($template['start'], true, $var); // for parsing {SETIMAGE} etc. - + foreach($pageArray as $page) { /*$data = array( @@ -552,23 +552,23 @@ function listPages($chapt=0) $page['book_id'] = $page['chapter_parent']; $page['book_name'] = $this->getName($page['chapter_parent']); $page['book_sef'] = $bookSef; - + // $this->page = $page; $this->batch->setVars($page); $this->batch->breadcrumb(); // $this->batch->setVars(new e_vars($data))->setScVar('page', $this->page); - + // $url = e107::getUrl()->create('page/view', $page, 'allow=page_id,page_sef,chapter_sef,book_sef'); // $text .= "
  • ".$tp->toHTML($page['page_title'])."
  • "; $text .= e107::getParser()->parseTemplate($template['item'], true, $this->batch); } - + $text .= $tp->parseTemplate($template['end'], true, $var); - - + + // $caption = ($title !='')? $title: LAN_PAGE_11; // e107::getRender()->tablerender($caption, $text,"cpage_list"); } @@ -584,27 +584,27 @@ function listPages($chapt=0) function processViewPage() { - + if($this->checkCache()) { return; } - + $sql = e107::getDb(); - + $query = "SELECT p.*, u.user_id, u.user_name, user_login FROM #page AS p LEFT JOIN #user AS u ON p.page_author = u.user_id WHERE p.page_id=".intval($this->pageID); // REMOVED AND p.page_class IN (".USERCLASS_LIST.") - permission check is done later - - + + if(!$sql->gen($query)) { header("HTTP/1.0 404 Not Found"); // exit; /* - + $ret['title'] = LAN_PAGE_12; // ***** CHANGED $ret['sub_title'] = ''; $ret['text'] = LAN_PAGE_3; @@ -614,9 +614,9 @@ function processViewPage() $ret['err'] = TRUE; $ret['cachecontrol'] = false; */ - + // ---------- New (to replace values above) ---- - + $this->page['page_title'] = LAN_PAGE_12; // ***** CHANGED $this->page['sub_title'] = ''; $this->page['page_text'] = LAN_PAGE_3; @@ -626,9 +626,9 @@ function processViewPage() $this->page['err'] = TRUE; $this->page['cachecontrol'] = false; - + // ------------------------------------- - + $this->authorized = 'nf'; $this->template = e107::getCoreTemplate('page', 'default'); // $this->batch = e107::getScBatch('page',null,'cpage')->setVars(new e_vars($ret))->setScVar('page', array()); ///Upgraded to setVars() array. (not using '$this->page') @@ -639,10 +639,10 @@ function processViewPage() $this->batch = e107::getScBatch('page',null,'cpage')->setVars($this->page)->wrapper('page/'.$this->templateID); $this->batch->breadcrumb(); - + e107::title($this->page['page_title']); - + return; } @@ -655,7 +655,7 @@ function processViewPage() $this->templateID = vartrue($this->page['page_template'], 'default'); $this->template = e107::getCoreTemplate('page', $this->templateID, true, true); - + if(!$this->template) { // switch to default @@ -713,9 +713,9 @@ function processViewPage() $ret['err'] = FALSE; $ret['cachecontrol'] = (isset($this->page['page_password']) && !$this->page['page_password'] && $this->authorized === true); // Don't cache password protected pages */ - + // $this->batch->setVars(new e_vars($ret))->setScVar('page', $this->page); // Removed in favour of $this->var (cross-compatible with menus and other parts of e107 that use the same shortcodes) - + // ---- New --- - $this->page['page_text'] = $this->pageToRender; // $this->page['np'] = $pagenav; @@ -977,20 +977,20 @@ public function parsePage() $this->pageTitles = array(); // Notice removal - if(preg_match_all('/\[newpage.*?\]/si', $this->pageText, $pt)) + if(preg_match_all('/\[newpage.*?\]/si', (string) $this->pageText, $pt)) { - if (substr($this->pageText, 0, 6) == '[html]') + if (substr((string) $this->pageText, 0, 6) == '[html]') { // Need to strip html bbcode from wysiwyg on multi-page docs (handled automatically on single pages) - if (substr($this->pageText, -7, 7) == '[/html]') + if (substr((string) $this->pageText, -7, 7) == '[/html]') { - $this->pageText = substr($this->pageText, 6, -7); + $this->pageText = substr((string) $this->pageText, 6, -7); } else { - $this->pageText = substr($this->pageText, 6); + $this->pageText = substr((string) $this->pageText, 6); } } - $pages = preg_split("/\[newpage.*?\]/si", $this->pageText, -1, PREG_SPLIT_NO_EMPTY); + $pages = preg_split("/\[newpage.*?\]/si", (string) $this->pageText, -1, PREG_SPLIT_NO_EMPTY); $this->multipageFlag = TRUE; } else @@ -1076,14 +1076,14 @@ function pageIndex() // FIXME most probably will fail when cache enabled function pageRating($page_rating_flag) { - + if($page_rating_flag) { return "
    ".e107::getRate()->render("page", $this->pageID,array('label'=>LAN_PAGE_4))."
    "; - + } - - + + // return $rate_text; } @@ -1175,10 +1175,10 @@ function setPageCookie() { if(!$this->pageID || !vartrue($_POST['page_pw'])) return; $pref = e107::getPref(); - + $pref['pageCookieExpire'] = max($pref['pageCookieExpire'], 120); $hash = md5($_POST['page_pw'].USERID); - + cookie($this->getCookieName(), $hash, (time() + $pref['pageCookieExpire'])); //header("location:".e_SELF."?".e_QUERY); //exit; diff --git a/print.php b/print.php index f4ea24dbbe..b4f3994f53 100644 --- a/print.php +++ b/print.php @@ -56,9 +56,9 @@ $parms = varset($qs[1]); unset($qs); -if(strpos($source,'plugin:') !== false) +if(strpos((string) $source,'plugin:') !== false) { - $plugin = substr($source, 7); + $plugin = substr((string) $source, 7); if($obj = e107::getAddon($plugin, 'e_print')) { diff --git a/search.php b/search.php index 88047ad4b1..ac7ccd68a8 100644 --- a/search.php +++ b/search.php @@ -227,9 +227,9 @@ function sc_search_main_uncheckall($parm='') function sc_search_type_sel($parm='') { return e107::getForm()->radio_switch('adv', vartrue($_GET['adv']), LAN_SEARCH_30, LAN_SEARCH_29, array('class'=>'e-expandit','reverse'=>1, 'data-target'=>'search-advanced')); - - - + + + // return " ".LAN_SEARCH_29."  // ".LAN_SEARCH_30; } @@ -719,7 +719,7 @@ public function searchType() { if (isset($_SERVER['HTTP_REFERER'])) { - if (!$refpage = substr($_SERVER['HTTP_REFERER'], (strrpos($_SERVER['HTTP_REFERER'], "/")+1))) + if (!$refpage = substr((string) $_SERVER['HTTP_REFERER'], (strrpos((string) $_SERVER['HTTP_REFERER'], "/")+1))) { $refpage = "index.php"; } @@ -733,7 +733,7 @@ public function searchType() { if ($value['refpage']) { - if (strpos($refpage, $value['refpage']) !== FALSE) + if (strpos($refpage, (string) $value['refpage']) !== FALSE) { $searchtype[$key] = true; $_GET['t'] = $key; @@ -795,8 +795,8 @@ function renderResults() $query = $this->query; - $_GET['q'] = rawurlencode(varset($_GET['q'])); - $_GET['t'] = preg_replace('/[^\w\-]/i', '', varset($_GET['t'])); + $_GET['q'] = rawurlencode((string) varset($_GET['q'])); + $_GET['t'] = preg_replace('/[^\w\-]/i', '', (string) varset($_GET['t'])); $search_prefs = $this->search_prefs; $result_flag = $this->result_flag; @@ -876,8 +876,8 @@ function renderResults() $core_parms = array('r' => '', 'q' => '', 't' => '', 's' => ''); foreach ($_GET as $pparm_key => $pparm_value) { - $temp = preg_replace('/[^\w_]/i','',$pparm_key); - $temp1 = preg_replace('/[^\w_ +]/i','',$pparm_value); // Filter 'non-word' charcters in search term + $temp = preg_replace('/[^\w_]/i','',(string) $pparm_key); + $temp1 = preg_replace('/[^\w_ +]/i','',(string) $pparm_value); // Filter 'non-word' charcters in search term //if (($temp == $pparm_key) && !isset($core_parms[$pparm_key])) // { // $parms .= "&".$pparm_key."=".$temp1; //FIXME Unused @@ -916,7 +916,7 @@ function magic_search($data) if (is_array($value)) { $data[$key] = $this->magic_search($value); } else { - $data[$key] = stripslashes($value); + $data[$key] = stripslashes((string) $value); } } return $data; @@ -941,7 +941,7 @@ function searchQuery() if ($_GET['in']) { - $en_in = explode(' ', $_GET['in']); + $en_in = explode(' ', (string) $_GET['in']); foreach ($en_in as $en_in_key) { $full_query .= " +".$tp->filter($en_in_key); @@ -950,7 +950,7 @@ function searchQuery() } if ($_GET['ex']) { - $en_ex = explode(' ', $_GET['ex']); + $en_ex = explode(' ', (string) $_GET['ex']); foreach ($en_ex as $en_ex_key) { $full_query .= " -".$tp->filter($en_ex_key); @@ -964,7 +964,7 @@ function searchQuery() } if ($_GET['be']) { - $en_be = explode(' ', $_GET['be']); + $en_be = explode(' ', (string) $_GET['be']); foreach ($en_be as $en_be_key) { $full_query .= " ".$tp->filter($en_be_key)."*"; @@ -978,12 +978,12 @@ function searchQuery() $this->message = LAN_SEARCH_201; $this->result_flag = false; } - else if (strlen($full_query) == 0) + else if (strlen((string) $full_query) == 0) { $perform_search = false; $this->message = LAN_SEARCH_201; } - elseif (strlen($full_query) < ($char_count = ($this->search_prefs['mysql_sort'] ? 4 : 3))) + elseif (strlen((string) $full_query) < ($char_count = ($this->search_prefs['mysql_sort'] ? 4 : 3))) { $perform_search = false; $this->message = str_replace('[x]', $char_count, LAN_417); @@ -1015,7 +1015,7 @@ function searchQuery() - $this->query = trim($full_query); + $this->query = trim((string) $full_query); if ($this->query) { @@ -1208,7 +1208,7 @@ public function doSearch() function parsesearch($text, $match) { $tp = e107::getParser(); - $text = strip_tags($text); + $text = strip_tags((string) $text); $temp = $tp->ustristr($text, $match); $pos = $tp->ustrlen($text) - $tp->ustrlen($temp); $matchedText = $tp->usubstr($text,$pos,$tp->ustrlen($match)); diff --git a/signup.php b/signup.php index f93b571544..323a30a85c 100644 --- a/signup.php +++ b/signup.php @@ -166,7 +166,7 @@ function help(help){ if ((USER || (intval($pref['user_reg']) !== 1) || (vartrue($pref['auth_method'],'e107') != 'e107')) && !getperms('0')) { e107::redirect(); - + } @@ -195,7 +195,7 @@ function help(help){ if (isset($_POST['register']) && intval($pref['user_reg']) === 1) { e107::getCache()->clear("online_menu_totals"); - + if ($signup_imagecode) { if ($badCodeMsg = e107::getSecureImg()->invalidCode($_POST['rand_num'], $_POST['code_verify'])) // better: allows class to return the error. @@ -223,13 +223,13 @@ function help(help){ { $_POST['hideemail'] = 1; } - + if(!isset($_POST['email_confirm'])) { $_POST['email_confirm'] = $_POST['email']; } - - + + // Use LoginName for DisplayName if restricted if (!check_class($pref['displayname_class'],e_UC_PUBLIC.','.e_UC_MEMBER)) { @@ -280,7 +280,7 @@ function help(help){ { if($ipcount = $sql->select('user', '*', "user_ip='".$allData['user_ip']."' and user_ban !='2' ")) { - if($ipcount >= $pref['signup_maxip'] && trim($pref['signup_maxip']) != "") + if($ipcount >= $pref['signup_maxip'] && trim((string) $pref['signup_maxip']) != "") { $allData['errors']['user_email'] = ERR_GENERIC; $allData['errortext']['user_email'] = LAN_SIGNUP_71; @@ -326,7 +326,7 @@ function help(help){ // Determine whether we have an error $error = ((isset($allData['errors']) && count($allData['errors'])) || (isset($eufVals['errors']) && count($eufVals['errors'])) || count($extraErrors)); - + // All validated here - handle any errors if ($error) //FIXME - this ignores the errors caused by invalid image-code. { @@ -353,7 +353,7 @@ function help(help){ { message_handler('P_ALERT', implode('
    ', $temp)); } - + } } // End of data validation else @@ -366,7 +366,7 @@ function help(help){ { message_handler('P_ALERT', implode('
    ', $extraErrors)); // Workaround for image-code errors. } - + } @@ -405,7 +405,7 @@ function help(help){ { $allData['data']['user_ban'] = USER_VALIDATED; } - + // Work out data to be written to user audit trail $signup_data = array('user_name', 'user_loginname', 'user_email', 'user_ip'); // foreach (array() as $f) @@ -415,7 +415,7 @@ function help(help){ } $allData['data']['user_password'] = $userMethods->HashPassword($savePassword,$allData['data']['user_loginname']); - + if (vartrue($pref['allowEmailLogin'])) { // Need to create separate password for email login //$allData['data']['user_prefs'] = serialize(array('email_password' => $userMethods->HashPassword($savePassword, $allData['data']['user_email']))); @@ -426,13 +426,13 @@ function help(help){ $allData['data']['user_ip'] = e107::getIPHandler()->getIP(FALSE); - + if(!vartrue($allData['data']['user_name'])) { $allData['data']['user_name'] = $allData['data']['user_loginname']; $signup_data['user_name'] = $allData['data']['user_loginname']; } - + // The user_class, user_perms, user_prefs, user_realm fields don't have default value, // so we put apropriate ones, otherwise - broken DB Insert @@ -453,9 +453,9 @@ function help(help){ // Actually write data to DB validatorClass::addFieldTypes($userMethods->userVettingInfo, $allData); - + $nid = $sql->insert('user', $allData); - + if (isset($eufVals['data']) && count($eufVals['data'])) { $usere->addFieldTypes($eufVals); // Add in the data types for storage @@ -464,7 +464,7 @@ function help(help){ $sql->gen("INSERT INTO `#user_extended` (user_extended_id) values ('{$nid}')"); $sql->update('user_extended', $eufVals); } - + // if (SIGNUP_DEBUG) // { // $admin_log->addEvent(10,debug_backtrace(),"DEBUG","Signup new user",array_merge($allData['data'],$eufVals) ,FALSE,LOG_TO_ROLLING); @@ -503,7 +503,7 @@ function help(help){ $allData['data']['activation_url'] = SITEURL."signup.php?activate.".$allData['data']['user_id'].".".$allData['data']['user_sess']; // FIX missing user_name if(!vartrue($allData['data']['user_name'])) $allData['data']['user_name'] = $allData['data']['user_login']; - + // prefered way to send user emails if(getperms('0') && !empty($_POST['simulation'])) @@ -538,10 +538,10 @@ function help(help){ $eml['e107_header'] = $eml['userid']; require_once(e_HANDLER.'mail.php'); $mailer = new e107Email(); - + // FIX - sendEmail returns TRUE or error message... $check = $mailer->sendEmail($allData['data']['user_email'], $allData['data']['user_name'], $eml,FALSE);*/ - + if(true !== $check) { $error_message = LAN_SIGNUP_42; // There was a problem, the registration mail was not sent, please contact the website administrator. @@ -580,7 +580,7 @@ function help(help){ { $allData['data']['user_class'] = $init_class; $user_class_update = $sql->update("user", "user_class = '{$allData['data']['user_class']}' WHERE user_name='{$allData['data']['user_name']}' LIMIT 1"); - + if($user_class_update === FALSE) { //$admin_log->addEvent(10,debug_backtrace(),'USER','Userclass update fail',print_r($row,TRUE),FALSE,LOG_TO_ROLLING); @@ -603,7 +603,7 @@ function help(help){ $text = LAN_SIGNUP_76." ".SITENAME.", ".LAN_SIGNUP_12."

    "; $text .= str_replace(array('[',']'), array("", ""), LAN_SIGNUP_13); } - + $ns->tablerender(LAN_SIGNUP_8,$text); require_once(FOOTERF); exit; diff --git a/submitnews.php b/submitnews.php index cb9e249c65..49f59e9433 100644 --- a/submitnews.php +++ b/submitnews.php @@ -90,8 +90,8 @@ function process() exit; } - $submitnews_user = (USER ? USERNAME : trim($tp->toDB($_POST['submitnews_name']))); - $submitnews_email = (USER ? USEREMAIL : trim(check_email($tp->toDB($_POST['submitnews_email'])))); + $submitnews_user = (USER ? USERNAME : trim((string) $tp->toDB($_POST['submitnews_name']))); + $submitnews_email = (USER ? USEREMAIL : trim((string) check_email($tp->toDB($_POST['submitnews_email'])))); $submitnews_title = $tp->filter($_POST['submitnews_title']); $submitnews_item = $tp->filter($_POST['submitnews_item']); // $submitnews_item = str_replace("src="e107_images", "src="".SITEURL."e107_images", $submitnews_item); diff --git a/unsubscribe.php b/unsubscribe.php index db142b6c90..b4a0c8c39b 100644 --- a/unsubscribe.php +++ b/unsubscribe.php @@ -29,7 +29,7 @@ function __construct() return; } - $tmp = base64_decode($_GET['id']); + $tmp = base64_decode((string) $_GET['id']); parse_str($tmp,$data); diff --git a/upload.php b/upload.php index 97664b1d8b..695d61977a 100644 --- a/upload.php +++ b/upload.php @@ -28,16 +28,16 @@ class userUpload { function __construct() { - + /* e107::css('inline', " input[type=file] { - - + + } "); - + e107::js('inline', " function frmVerify() @@ -63,7 +63,7 @@ function frmVerify() return false; } } - + "); */ @@ -161,7 +161,7 @@ function processUpload() if(!empty($_POST['category'])) { - list($catOwner, $catID) = explode("__",$_POST['category'],2); + list($catOwner, $catID) = explode("__",(string) $_POST['category'],2); } else { diff --git a/userposts.php b/userposts.php index 4015548a2b..8e3c5cae13 100644 --- a/userposts.php +++ b/userposts.php @@ -175,7 +175,7 @@ $USERPOSTS_TEMPLATE = e107::getCoreTemplate('userposts'); $s_info = ''; - $_POST['f_query'] = trim(varset($_POST['f_query'])); + $_POST['f_query'] = trim((string) varset($_POST['f_query'])); if ($_POST['f_query'] !== '') { $f_query = $tp->toDB($_POST['f_query']); diff --git a/usersettings.php b/usersettings.php index ff676784e5..cbc6200415 100644 --- a/usersettings.php +++ b/usersettings.php @@ -597,7 +597,7 @@ public function init() { /* if(!empty($_POST['updated_data']) && !empty($_POST['currentpassword']) && !empty($_POST['updated_key'])) { // Got some data confirmed with password entry*/ - $new_data = base64_decode($_POST['updated_data']); + $new_data = base64_decode((string) $_POST['updated_data']); // Should only happen if someone's fooling around if ($this->getValidationKey($new_data) !== $_POST['updated_key'] || ($userMethods->hasReadonlyField($new_data) !==false)) @@ -990,7 +990,7 @@ private function compileErrors($extraErrors, $allData, $eufVals) */ private function getValidationKey($string) { - return crypt($string, e_TOKEN); + return crypt((string) $string, e_TOKEN); } From e0f5421139b3c8d00b3f7905afe2b41d440e0e63 Mon Sep 17 00:00:00 2001 From: "de Castro Sanchez, Julio Ezequiel" Date: Mon, 23 Feb 2026 21:46:02 +0100 Subject: [PATCH 2/2] chore: rerun tests