@@ -50,8 +50,7 @@ |
||
50 | 50 | if (!class_exists(Core::NAMESPACE_PLUGINS_BLOCKS . 'PluginIf')) { |
51 | 51 | try { |
52 | 52 | $compiler->getCore()->getLoader()->loadPlugin('if'); |
53 | - } |
|
54 | - catch (Exception $e) { |
|
53 | + } catch (Exception $e) { |
|
55 | 54 | throw new CompilationException($compiler, 'Tif: the if plugin is required to use Tif'); |
56 | 55 | } |
57 | 56 | } |
@@ -40,12 +40,12 @@ |
||
40 | 40 | if (is_array($value)) { |
41 | 41 | return array_reverse($value, $preserve_keys); |
42 | 42 | } elseif (($charset = $this->core->getCharset()) === 'iso-8859-1') { |
43 | - return strrev((string)$value); |
|
43 | + return strrev((string) $value); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | $strlen = mb_strlen($value); |
47 | 47 | $out = ''; |
48 | - while ($strlen --) { |
|
48 | + while ($strlen--) { |
|
49 | 49 | $out .= mb_substr($value, $strlen, 1, $charset); |
50 | 50 | } |
51 | 51 |
@@ -104,7 +104,7 @@ |
||
104 | 104 | */ |
105 | 105 | protected static function openTag($tag, $add, $whitespace) |
106 | 106 | { |
107 | - $tabs = str_pad('', self::$tabCount ++, "\t"); |
|
107 | + $tabs = str_pad('', self::$tabCount++, "\t"); |
|
108 | 108 | |
109 | 109 | if (preg_match('#^<(a|label|option|textarea|h1|h2|h3|h4|h5|h6|strong|b|em|i|abbr|acronym|cite|span|sub|sup|u|s|title)(?: [^>]*|)>#', $tag)) { |
110 | 110 | // if it's one of those tag it's inline so it does not require a leading line break |
@@ -59,13 +59,13 @@ |
||
59 | 59 | define('DWOO_PATH', ROOT_PATH . "system/packages/com.jukusoft.cms.dwoo/dwoo/lib/"); |
60 | 60 | |
61 | 61 | function dwoo_autoload ($class_name) { |
62 | - $class_name = str_replace("\\", "/", $class_name); |
|
62 | + $class_name = str_replace("\\", "/", $class_name); |
|
63 | 63 | |
64 | - if (file_exists(DWOO_PATH . $class_name . ".php")) { |
|
65 | - require(DWOO_PATH . $class_name . ".php"); |
|
66 | - } else { |
|
67 | - echo "Cannot load class '" . $class_name . "'!"; |
|
68 | - } |
|
64 | + if (file_exists(DWOO_PATH . $class_name . ".php")) { |
|
65 | + require(DWOO_PATH . $class_name . ".php"); |
|
66 | + } else { |
|
67 | + echo "Cannot load class '" . $class_name . "'!"; |
|
68 | + } |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | //register autoloader |
@@ -58,7 +58,7 @@ |
||
58 | 58 | define('ROOT_PATH', dirname(__FILE__) . "/../"); |
59 | 59 | define('DWOO_PATH', ROOT_PATH . "system/packages/com.jukusoft.cms.dwoo/dwoo/lib/"); |
60 | 60 | |
61 | -function dwoo_autoload ($class_name) { |
|
61 | +function dwoo_autoload($class_name) { |
|
62 | 62 | $class_name = str_replace("\\", "/", $class_name); |
63 | 63 | |
64 | 64 | if (file_exists(DWOO_PATH . $class_name . ".php")) { |
@@ -29,7 +29,7 @@ |
||
29 | 29 | |
30 | 30 | class DwooAutoloader { |
31 | 31 | |
32 | - public static function loadClass (string $class_name) { |
|
32 | + public static function loadClass(string $class_name) { |
|
33 | 33 | $class_name = str_replace("\\", "/", $class_name); |
34 | 34 | |
35 | 35 | if (file_exists(DWOO_PATH . $class_name . ".php")) { |
@@ -29,15 +29,15 @@ |
||
29 | 29 | |
30 | 30 | class DwooAutoloader { |
31 | 31 | |
32 | - public static function loadClass (string $class_name) { |
|
33 | - $class_name = str_replace("\\", "/", $class_name); |
|
34 | - |
|
35 | - if (file_exists(DWOO_PATH . $class_name . ".php")) { |
|
36 | - require(DWOO_PATH . $class_name . ".php"); |
|
37 | - } else { |
|
38 | - //echo "Cannot load Dwoo Template Engine class '" . $class_name . "' (search path: " . DWOO_PATH . $class_name . ".php)!"; |
|
39 | - } |
|
40 | - } |
|
32 | + public static function loadClass (string $class_name) { |
|
33 | + $class_name = str_replace("\\", "/", $class_name); |
|
34 | + |
|
35 | + if (file_exists(DWOO_PATH . $class_name . ".php")) { |
|
36 | + require(DWOO_PATH . $class_name . ".php"); |
|
37 | + } else { |
|
38 | + //echo "Cannot load Dwoo Template Engine class '" . $class_name . "' (search path: " . DWOO_PATH . $class_name . ".php)!"; |
|
39 | + } |
|
40 | + } |
|
41 | 41 | |
42 | 42 | } |
43 | 43 |
@@ -29,8 +29,8 @@ discard block |
||
29 | 29 | error_reporting(E_ALL); |
30 | 30 | |
31 | 31 | if (PHP_MAJOR_VERSION < 7) { |
32 | - echo "CMS is required PHP 7.0.0 or greater! Please install PHP 7 (current version: " . PHP_VERSION . ")."; |
|
33 | - exit; |
|
32 | + echo "CMS is required PHP 7.0.0 or greater! Please install PHP 7 (current version: " . PHP_VERSION . ")."; |
|
33 | + exit; |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | //define some constants |
@@ -925,35 +925,35 @@ discard block |
||
925 | 925 | |
926 | 926 | //get main menuID |
927 | 927 | if (!Settings::contains("main_menuID")) { |
928 | - //create menu_names if absent |
|
929 | - $main_menuID = Menu::createMenuName("Main Menu", "main_menu"); |
|
928 | + //create menu_names if absent |
|
929 | + $main_menuID = Menu::createMenuName("Main Menu", "main_menu"); |
|
930 | 930 | |
931 | - //set setting |
|
932 | - Settings::create("main_menuID", $main_menuID, "Main MenuID", "id of main menu (in menu area)", "system", "general", "DataType_MenuSelector", "", true, "none", "none", 1); |
|
931 | + //set setting |
|
932 | + Settings::create("main_menuID", $main_menuID, "Main MenuID", "id of main menu (in menu area)", "system", "general", "DataType_MenuSelector", "", true, "none", "none", 1); |
|
933 | 933 | } else { |
934 | - $main_menuID = Settings::get("main_menuID"); |
|
934 | + $main_menuID = Settings::get("main_menuID"); |
|
935 | 935 | } |
936 | 936 | |
937 | 937 | //get admin area menuID |
938 | 938 | if (!Settings::contains("admin_menuID")) { |
939 | - //create menu_names if absent |
|
940 | - $admin_menuID = Menu::createMenuName("Admin Menu", "admin_menu"); |
|
939 | + //create menu_names if absent |
|
940 | + $admin_menuID = Menu::createMenuName("Admin Menu", "admin_menu"); |
|
941 | 941 | |
942 | - //set setting |
|
943 | - Settings::create("admin_menuID", $admin_menuID, "Admin MenuID", "id of admin menu (in admin area)", "system", "general", "DataType_MenuSelector", "", true, "none", "none", 2); |
|
942 | + //set setting |
|
943 | + Settings::create("admin_menuID", $admin_menuID, "Admin MenuID", "id of admin menu (in admin area)", "system", "general", "DataType_MenuSelector", "", true, "none", "none", 2); |
|
944 | 944 | } else { |
945 | - $admin_menuID = Settings::get("admin_menuID"); |
|
945 | + $admin_menuID = Settings::get("admin_menuID"); |
|
946 | 946 | } |
947 | 947 | |
948 | 948 | //get local menuID |
949 | 949 | if (!Settings::contains("local_menuID")) { |
950 | - //create menu_names if absent |
|
951 | - $local_menuID = Menu::createMenuName("Default Local Menu", "local_menu"); |
|
950 | + //create menu_names if absent |
|
951 | + $local_menuID = Menu::createMenuName("Default Local Menu", "local_menu"); |
|
952 | 952 | |
953 | - //set setting |
|
954 | - Settings::create("local_menuID", $local_menuID, "Default Local MenuID", "id of default local menu (in menu area)", "system", "general", "DataType_MenuSelector", "", true, "none", "none", 3); |
|
953 | + //set setting |
|
954 | + Settings::create("local_menuID", $local_menuID, "Default Local MenuID", "id of default local menu (in menu area)", "system", "general", "DataType_MenuSelector", "", true, "none", "none", 3); |
|
955 | 955 | } else { |
956 | - $local_menuID = Settings::get("local_menuID"); |
|
956 | + $local_menuID = Settings::get("local_menuID"); |
|
957 | 957 | } |
958 | 958 | |
959 | 959 | //create default folders, if absent |
@@ -1098,11 +1098,11 @@ discard block |
||
1098 | 1098 | echo "<br /><br />Finished DB Upgrade!"; |
1099 | 1099 | |
1100 | 1100 | if (file_exists(ROOT_PATH . "setup/add-install.php")) { |
1101 | - echo "<br />Call add-install.php...<br />"; |
|
1101 | + echo "<br />Call add-install.php...<br />"; |
|
1102 | 1102 | |
1103 | - require(ROOT_PATH . "setup/add-install.php"); |
|
1103 | + require(ROOT_PATH . "setup/add-install.php"); |
|
1104 | 1104 | |
1105 | - echo "<br /><br />Finished additional Upgrade!"; |
|
1105 | + echo "<br /><br />Finished additional Upgrade!"; |
|
1106 | 1106 | } |
1107 | 1107 | |
1108 | 1108 | ?> |
@@ -159,10 +159,10 @@ discard block |
||
159 | 159 | $table->addVarchar("home_page", 255, true, "home"); |
160 | 160 | $table->addEnum("wildcard", array("YES", "NO"), true, "NO"); |
161 | 161 | $table->addInt("styleID", 10, true, false, "-1"); |
162 | -$table->addVarchar("redirect_url", 255, true, "none");# |
|
162 | +$table->addVarchar("redirect_url", 255, true, "none"); # |
|
163 | 163 | $table->addInt("redirect_code", 10, true, false, "301"); |
164 | 164 | $table->addVarchar("base_dir", 255, true, "/"); |
165 | -$table->addInt("force_ssl", 10, true, false, "0");//if 1 then all http urls would be rewritten to https urls |
|
165 | +$table->addInt("force_ssl", 10, true, false, "0"); //if 1 then all http urls would be rewritten to https urls |
|
166 | 166 | $table->addTimestamp("lastUpdate", true, "CURRENT_TIMESTAMP"); |
167 | 167 | $table->addInt("activated", 10, true, false, "1"); |
168 | 168 | |
@@ -416,7 +416,7 @@ discard block |
||
416 | 416 | $table->addInt("local_menu", 10, true, false, -1); |
417 | 417 | $table->addVarchar("page_type", 255, true, "HTMLPage"); |
418 | 418 | $table->addVarchar("design", 255, true, "none"); |
419 | -$table->addInt("sitemap", 10, true, false, 1);//should page be shown in sitemap? |
|
419 | +$table->addInt("sitemap", 10, true, false, 1); //should page be shown in sitemap? |
|
420 | 420 | $table->addEnum("sitemap_changefreq", array("ALWAYS", "HOURLY", "DAILY", "WEEKLY", "MONTHLY", "YEARLY", "NEVER"), true, "weekly"); |
421 | 421 | $table->addDecimal("sitemap_priority", 5, 2, true, "0.5"); |
422 | 422 | $table->addInt("published", 10, true, false, 0); |
@@ -431,7 +431,7 @@ discard block |
||
431 | 431 | $table->addInt("sidebar_right", 10, true, false, -1); |
432 | 432 | $table->addVarchar("meta_description", 600, true, ""); |
433 | 433 | $table->addVarchar("meta_keywords", 255, true, ""); |
434 | -$table->addVarchar("meta_robots", 255, true, "");//none means not set |
|
434 | +$table->addVarchar("meta_robots", 255, true, ""); //none means not set |
|
435 | 435 | $table->addVarchar("meta_canonicals", 255, true, ""); |
436 | 436 | $table->addInt("locked_by", 10, true, false, -1); |
437 | 437 | $table->addTimestamp("locked_timestamp", true, "0000-00-00 00:00:00"); |
@@ -463,10 +463,10 @@ discard block |
||
463 | 463 | //fields |
464 | 464 | $table->addVarchar("page_type", 255, true); |
465 | 465 | $table->addVarchar("title", 255, true); |
466 | -$table->addVarchar("create_permissions", 255, true, "none");//list with permissions (OR), one of this permissions is required to create pages with this page type |
|
467 | -$table->addInt("advanced", 10, true, false, 0);//flag, if page type is only shown in expert (advanced) mode |
|
466 | +$table->addVarchar("create_permissions", 255, true, "none"); //list with permissions (OR), one of this permissions is required to create pages with this page type |
|
467 | +$table->addInt("advanced", 10, true, false, 0); //flag, if page type is only shown in expert (advanced) mode |
|
468 | 468 | $table->addVarchar("owner", 255, true, "system"); |
469 | -$table->addInt("order", 10, true, false, 10);//order in admin area on page creation selection |
|
469 | +$table->addInt("order", 10, true, false, 10); //order in admin area on page creation selection |
|
470 | 470 | $table->addInt("activated", 10, true, false, 1); |
471 | 471 | |
472 | 472 | //add keys to table |
@@ -527,13 +527,13 @@ discard block |
||
527 | 527 | $table->addInt("menuID", 10, true, false); |
528 | 528 | $table->addVarchar("title", 255, true); |
529 | 529 | $table->addVarchar("url", 600, true); |
530 | -$table->addVarchar("type", 255, true, "page");//page / link / url / external_link / js_link |
|
530 | +$table->addVarchar("type", 255, true, "page"); //page / link / url / external_link / js_link |
|
531 | 531 | $table->addVarchar("icon", 255, true, "none"); |
532 | 532 | $table->addVarchar("permissions", 600, true, "all"); |
533 | 533 | $table->addInt("login_required", 10, true, false, 0); |
534 | 534 | $table->addInt("parent", 10, true, false, -1); |
535 | 535 | $table->addVarchar("unique_name", 255, false, ""); |
536 | -$table->addVarchar("extensions", 255, true, "none");//for example: private messages |
|
536 | +$table->addVarchar("extensions", 255, true, "none"); //for example: private messages |
|
537 | 537 | $table->addVarchar("owner", 255, true, "user"); |
538 | 538 | $table->addInt("order", 10, true, false, 10); |
539 | 539 | $table->addInt("activated", 10, true, false, 1); |
@@ -610,9 +610,9 @@ discard block |
||
610 | 610 | $table->addVarchar("color", 50, true, "#0066ff"); |
611 | 611 | $table->addVarchar("rank_title", 255, true, "none"); |
612 | 612 | $table->addVarchar("rank_image", 255, true, "none"); |
613 | -$table->addInt("auto_assign_regist", 10, true, false, "0");//flag, if group is automatically assigned to registered users |
|
613 | +$table->addInt("auto_assign_regist", 10, true, false, "0"); //flag, if group is automatically assigned to registered users |
|
614 | 614 | $table->addInt("system_group", 10, true, false, "0"); |
615 | -$table->addInt("show", 10, true, false, "1");//show group name on index page |
|
615 | +$table->addInt("show", 10, true, false, "1"); //show group name on index page |
|
616 | 616 | $table->addInt("activated", 10, true, false, "1"); |
617 | 617 | |
618 | 618 | //https://www.w3schools.com/colors/colors_picker.asp |
@@ -777,7 +777,7 @@ discard block |
||
777 | 777 | $table->addVarchar("description", 600, true); |
778 | 778 | $table->addVarchar("category", 255, true, "general"); |
779 | 779 | $table->addVarchar("owner", 255, true, "system"); |
780 | -$table->addInt("show", 10, true, false, 1);//flag, if permission is shown on permissions page |
|
780 | +$table->addInt("show", 10, true, false, 1); //flag, if permission is shown on permissions page |
|
781 | 781 | $table->addInt("order", 10, true, false, 100); |
782 | 782 | $table->addInt("activated", 10, true, false, 1); |
783 | 783 | |
@@ -938,11 +938,11 @@ discard block |
||
938 | 938 | $table->setCharset("utf8"); |
939 | 939 | |
940 | 940 | //fields |
941 | -$table->addVarchar("name", 255, true);//directory name of plugin |
|
942 | -$table->addVarchar("version", 255, true, "1.0.0");//installed version of plugin |
|
941 | +$table->addVarchar("name", 255, true); //directory name of plugin |
|
942 | +$table->addVarchar("version", 255, true, "1.0.0"); //installed version of plugin |
|
943 | 943 | //$table->addInt("build", 10, true, false, 1);//optional: build number of plugin |
944 | -$table->addInt("installed", 10, true, false, 1);//flag, if plugin is installed |
|
945 | -$table->addInt("activated", 10, true, false, 1);//flag, if plugin is activated |
|
944 | +$table->addInt("installed", 10, true, false, 1); //flag, if plugin is installed |
|
945 | +$table->addInt("activated", 10, true, false, 1); //flag, if plugin is activated |
|
946 | 946 | |
947 | 947 | //add keys to table |
948 | 948 | $table->addPrimaryKey("name"); |
@@ -968,7 +968,7 @@ discard block |
||
968 | 968 | $table->setCharset("utf8"); |
969 | 969 | |
970 | 970 | //fields |
971 | -$table->addVarchar("class_name", 255, true);//directory name of plugin |
|
971 | +$table->addVarchar("class_name", 255, true); //directory name of plugin |
|
972 | 972 | $table->addVarchar("path", 600, true); |
973 | 973 | |
974 | 974 | //add keys to table |
@@ -995,7 +995,7 @@ discard block |
||
995 | 995 | //fields |
996 | 996 | $table->addInt("id", 10, true, true); |
997 | 997 | $table->addVarchar("title", 255, true); |
998 | -$table->addVarchar("unique_name", 255, true, "");//unique name, so plugins or upgrade can find task easier |
|
998 | +$table->addVarchar("unique_name", 255, true, ""); //unique name, so plugins or upgrade can find task easier |
|
999 | 999 | $table->addEnum("type", array("FILE", "FUNCTION", "CLASS_STATIC_METHOD", ""), true); |
1000 | 1000 | $table->addVarchar("type_params", 255, false, "NULL"); |
1001 | 1001 | $table->addText("params", true); |
@@ -1111,7 +1111,7 @@ discard block |
||
1111 | 1111 | //fields |
1112 | 1112 | $table->addVarchar("secret_key", 255, true); |
1113 | 1113 | $table->addInt("userID", 10, true, false); |
1114 | -$table->addTimestamp("created", true, "CURRENT_TIMESTAMP", false);//to check, if secret key is valide |
|
1114 | +$table->addTimestamp("created", true, "CURRENT_TIMESTAMP", false); //to check, if secret key is valide |
|
1115 | 1115 | $table->addTimestamp("expires", true, "0000-00-00 00:00:00", false); |
1116 | 1116 | |
1117 | 1117 | //add keys to table |
@@ -1140,7 +1140,7 @@ discard block |
||
1140 | 1140 | $table->addVarchar("name", 255, true); |
1141 | 1141 | $table->addVarchar("description", 600, true, ""); |
1142 | 1142 | $table->addVarchar("class_name", 255, true); |
1143 | -$table->addInt("editable", 10, true, false, 1);//flag, if widget type is editable (this means added widgets with this type can be edited) |
|
1143 | +$table->addInt("editable", 10, true, false, 1); //flag, if widget type is editable (this means added widgets with this type can be edited) |
|
1144 | 1144 | $table->addVarchar("owner", 255, true, "system"); |
1145 | 1145 | |
1146 | 1146 | //add keys to table |
@@ -1199,7 +1199,7 @@ discard block |
||
1199 | 1199 | $table->addVarchar("title", 255, true, ""); |
1200 | 1200 | $table->addText("content", true, ""); |
1201 | 1201 | $table->addVarchar("class_name", 255, true, ""); |
1202 | -$table->addText("widget_params", true);//json encoded string, e.q. "{}" |
|
1202 | +$table->addText("widget_params", true); //json encoded string, e.q. "{}" |
|
1203 | 1203 | $table->addVarchar("css_id", 255, true, ""); |
1204 | 1204 | $table->addVarchar("css_class", 255, true, ""); |
1205 | 1205 | $table->addVarchar("before_widget", 600, true, ""); |
@@ -1256,7 +1256,7 @@ discard block |
||
1256 | 1256 | Settings::create("guest_username", "Guest", "Guest Username", "Username of not-logged-in users (default: Guest).", "system", "general", "DataType_Username"); |
1257 | 1257 | Settings::create("online_interval", 5, "Online Interval", "Interval in minues, how long a user is set as online (since last page request). IMPORTANT: This is independent from login interval!", "system", "general", "DataType_Integer"); |
1258 | 1258 | Settings::create("x_frame_options", "DENY", "X-Frame-Options header value (none = dont set header).", "values: DENY, SAMEORIGIN, ALLOW-FROM https://example.com/, none", "system", "security", "DataType_String"); |
1259 | -Settings::create("login_page","login", "Alias of Login Page (incl. directory, if necessary)", "Alias of Login Page (incl. directory, if necessary). Default: login", "system", "general", "DataType_String"); |
|
1259 | +Settings::create("login_page", "login", "Alias of Login Page (incl. directory, if necessary)", "Alias of Login Page (incl. directory, if necessary). Default: login", "system", "general", "DataType_String"); |
|
1260 | 1260 | Settings::create("logout_page", "logout", "Alias of Logout Page (incl. directory, if necessary)", "Alias of Logout Page (incl. directory, if necessary). Default: logout", "system", "general", "DataType_String"); |
1261 | 1261 | //Settings::create("base_dir", "/", "Base directory", "Base directory (if this CMS is installed in root directory, the right option is '/', but if it is installed in a sub directory, the right option is '/sub-dir/'). Default: /", "system", "general"); |
1262 | 1262 | Settings::create("css_cache_strategy", "expires_header", "CSS Browser Cache Strategy", "CSS Browser Cache Strategy, values: expires_header, etag_header, none", "system", "general", "DataType_SelectBox", array("expires_header", "etag_header", "none")); |
@@ -1461,7 +1461,7 @@ discard block |
||
1461 | 1461 | |
1462 | 1462 | echo "Create default page types if absent...<br />"; |
1463 | 1463 | |
1464 | -PageType::createPageType("HTMLPage", "HTML page", false, 1);//order 1 - so show as first page type in admin area |
|
1464 | +PageType::createPageType("HTMLPage", "HTML page", false, 1); //order 1 - so show as first page type in admin area |
|
1465 | 1465 | PageType::createPageType("Error404Page", "Error 404 page", true); |
1466 | 1466 | PageType::createPageType("Error403Page", "Error 403 page", true); |
1467 | 1467 | PageType::createPageType("IndexPage", "index page (supports extra template)", true); |
@@ -1494,7 +1494,7 @@ discard block |
||
1494 | 1494 | |
1495 | 1495 | echo "Create default permission categories...<br />"; |
1496 | 1496 | Permissions::createOrUpdateCategory("general", "General", 1); |
1497 | -Permissions::createOrUpdateCategory("users", "Users", 2);//user permissions, like "can_create_user" |
|
1497 | +Permissions::createOrUpdateCategory("users", "Users", 2); //user permissions, like "can_create_user" |
|
1498 | 1498 | Permissions::createOrUpdateCategory("groups", "Groups", 3); |
1499 | 1499 | Permissions::createOrUpdateCategory("pages", "Pages", 4); |
1500 | 1500 | Permissions::createOrUpdateCategory("media", "Media", 5); |
@@ -1513,7 +1513,7 @@ discard block |
||
1513 | 1513 | Permissions::createPermission("can_see_own_permissions", "Can see own permissions", "User can see his own permissions", "permissions", "system", 1); |
1514 | 1514 | Permissions::createPermission("can_see_permissions", "Can see permissions of other users", "Can see permissions of other users", "permissions", "system", 2); |
1515 | 1515 | Permissions::createPermission("can_edit_group_permissions", "Can edit group permissions", "Can edit group permissions (expect administrator group)", "permissions", "system", 3); |
1516 | -Permissions::createPermission("can_edit_administrator_group_permissions", "Can edit administrator group permissions", "Can edit administrator group permissions", "permissions", "system", 4);//can edit permissions of group "administrator" |
|
1516 | +Permissions::createPermission("can_edit_administrator_group_permissions", "Can edit administrator group permissions", "Can edit administrator group permissions", "permissions", "system", 4); //can edit permissions of group "administrator" |
|
1517 | 1517 | |
1518 | 1518 | //user permissions |
1519 | 1519 | Permissions::createPermission("can_see_all_users", "Can see all users", "Can see all users and see their private information like mail address, ip address and so on", "users", "system", 1); |
@@ -1604,7 +1604,7 @@ discard block |
||
1604 | 1604 | ApiMethod::addMethod("oauth", "ApiOAuth", "apiOAuth", "package_com.jukusoft.cms.api"); |
1605 | 1605 | |
1606 | 1606 | echo "Add default tasks...<br />"; |
1607 | -Task::createStaticMethodTask("Cleanup outdated oauth tokens", "ApiOAuth", "removeAllOutdatedTokens", 1440, "oauth_cleanup_tokens", "system", array(), false);//cleanup outdated oauth tokens every day |
|
1607 | +Task::createStaticMethodTask("Cleanup outdated oauth tokens", "ApiOAuth", "removeAllOutdatedTokens", 1440, "oauth_cleanup_tokens", "system", array(), false); //cleanup outdated oauth tokens every day |
|
1608 | 1608 | |
1609 | 1609 | echo "Add default widgets...<br />"; |
1610 | 1610 | WidgetType::register("TextWidget", "Text Widget", "Widget which shows text without html code.", true, "system"); |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | } |
69 | 69 | } |
70 | 70 | |
71 | - protected function mergeRow (string $token, int $value) { |
|
71 | + protected function mergeRow(string $token, int $value) { |
|
72 | 72 | if ($value < 0 || $value > 2) { |
73 | 73 | throw new IllegalArgumentException("token ('" . $token . "') value '" . $value . "' is not allowed, value has to be >= 0 and <= 2."); |
74 | 74 | } |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | } |
85 | 85 | } |
86 | 86 | |
87 | - public function hasRight (string $token) { |
|
87 | + public function hasRight(string $token) { |
|
88 | 88 | //check, if user is super admin |
89 | 89 | if (/*$this->userID == 1 || */(isset($this->permissions["super_admin"]) && $this->permissions["super_admin"] == 1) && $token !== "not_logged_in") { |
90 | 90 | //super admin has all rights |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | return isset($this->permissions[$token]) && $this->permissions[$token] == 1; |
99 | 99 | } |
100 | 100 | |
101 | - public static function ¤t () { |
|
101 | + public static function ¤t() { |
|
102 | 102 | if (self::$instance == null) { |
103 | 103 | self::$instance = new PermissionChecker(User::current()->getID()); |
104 | 104 | } |
@@ -27,84 +27,84 @@ |
||
27 | 27 | |
28 | 28 | class PermissionChecker { |
29 | 29 | |
30 | - protected $userID = -1; |
|
31 | - |
|
32 | - //list with all permissions - values: 0 (no), 1 (yes), 2 (never) |
|
33 | - protected $permissions = array(); |
|
34 | - |
|
35 | - //singleton instance |
|
36 | - protected static $instance = null; |
|
37 | - |
|
38 | - public function __construct(int $userID) { |
|
39 | - $this->userID = $userID; |
|
40 | - |
|
41 | - if (Cache::contains("permissions", "permissions_user_" . $this->userID)) { |
|
42 | - $this->permissions = Cache::get("permissions", "permissions_user_" . $this->userID); |
|
43 | - } else { |
|
44 | - //get all groups, where user is member on |
|
45 | - $groups = new Groups(); |
|
46 | - $groups->loadMyGroups($userID); |
|
47 | - $my_group_ids = $groups->listGroupIDs(); |
|
48 | - |
|
49 | - //iterate through all groups user is member on |
|
50 | - foreach ($my_group_ids as $groupID) { |
|
51 | - $group_rights = new GroupRights($groupID); |
|
52 | - |
|
53 | - //affect group rights |
|
54 | - foreach ($group_rights->listRights() as $token=>$value) { |
|
55 | - $this->mergeRow($token, $value); |
|
56 | - } |
|
57 | - } |
|
58 | - |
|
59 | - //get user rights |
|
60 | - $user_rights = new UserRights($userID); |
|
61 | - |
|
62 | - foreach ($user_rights->listRights() as $token=>$value) { |
|
63 | - $this->mergeRow($token, $value); |
|
64 | - } |
|
65 | - |
|
66 | - //cache result |
|
67 | - Cache::put("permissions", "permissions_user_" . $this->userID, $this->permissions); |
|
68 | - } |
|
69 | - } |
|
70 | - |
|
71 | - protected function mergeRow (string $token, int $value) { |
|
72 | - if ($value < 0 || $value > 2) { |
|
73 | - throw new IllegalArgumentException("token ('" . $token . "') value '" . $value . "' is not allowed, value has to be >= 0 and <= 2."); |
|
74 | - } |
|
75 | - |
|
76 | - if (!isset($this->permissions[$token])) { |
|
77 | - $this->permissions[$token] = $value; |
|
78 | - } else { |
|
79 | - $current_value = $this->permissions[$token]; |
|
80 | - |
|
81 | - if ($value > $current_value) { |
|
82 | - $this->permissions[$token] = $value; |
|
83 | - } |
|
84 | - } |
|
85 | - } |
|
86 | - |
|
87 | - public function hasRight (string $token) { |
|
88 | - //check, if user is super admin |
|
89 | - if (/*$this->userID == 1 || */(isset($this->permissions["super_admin"]) && $this->permissions["super_admin"] == 1) && $token !== "not_logged_in") { |
|
90 | - //super admin has all rights |
|
91 | - return true; |
|
92 | - } |
|
93 | - |
|
94 | - if ($token === "none" || $token === "all") { |
|
95 | - return true; |
|
96 | - } |
|
97 | - |
|
98 | - return isset($this->permissions[$token]) && $this->permissions[$token] == 1; |
|
99 | - } |
|
100 | - |
|
101 | - public static function ¤t () { |
|
102 | - if (self::$instance == null) { |
|
103 | - self::$instance = new PermissionChecker(User::current()->getID()); |
|
104 | - } |
|
105 | - |
|
106 | - return self::$instance; |
|
107 | - } |
|
30 | + protected $userID = -1; |
|
31 | + |
|
32 | + //list with all permissions - values: 0 (no), 1 (yes), 2 (never) |
|
33 | + protected $permissions = array(); |
|
34 | + |
|
35 | + //singleton instance |
|
36 | + protected static $instance = null; |
|
37 | + |
|
38 | + public function __construct(int $userID) { |
|
39 | + $this->userID = $userID; |
|
40 | + |
|
41 | + if (Cache::contains("permissions", "permissions_user_" . $this->userID)) { |
|
42 | + $this->permissions = Cache::get("permissions", "permissions_user_" . $this->userID); |
|
43 | + } else { |
|
44 | + //get all groups, where user is member on |
|
45 | + $groups = new Groups(); |
|
46 | + $groups->loadMyGroups($userID); |
|
47 | + $my_group_ids = $groups->listGroupIDs(); |
|
48 | + |
|
49 | + //iterate through all groups user is member on |
|
50 | + foreach ($my_group_ids as $groupID) { |
|
51 | + $group_rights = new GroupRights($groupID); |
|
52 | + |
|
53 | + //affect group rights |
|
54 | + foreach ($group_rights->listRights() as $token=>$value) { |
|
55 | + $this->mergeRow($token, $value); |
|
56 | + } |
|
57 | + } |
|
58 | + |
|
59 | + //get user rights |
|
60 | + $user_rights = new UserRights($userID); |
|
61 | + |
|
62 | + foreach ($user_rights->listRights() as $token=>$value) { |
|
63 | + $this->mergeRow($token, $value); |
|
64 | + } |
|
65 | + |
|
66 | + //cache result |
|
67 | + Cache::put("permissions", "permissions_user_" . $this->userID, $this->permissions); |
|
68 | + } |
|
69 | + } |
|
70 | + |
|
71 | + protected function mergeRow (string $token, int $value) { |
|
72 | + if ($value < 0 || $value > 2) { |
|
73 | + throw new IllegalArgumentException("token ('" . $token . "') value '" . $value . "' is not allowed, value has to be >= 0 and <= 2."); |
|
74 | + } |
|
75 | + |
|
76 | + if (!isset($this->permissions[$token])) { |
|
77 | + $this->permissions[$token] = $value; |
|
78 | + } else { |
|
79 | + $current_value = $this->permissions[$token]; |
|
80 | + |
|
81 | + if ($value > $current_value) { |
|
82 | + $this->permissions[$token] = $value; |
|
83 | + } |
|
84 | + } |
|
85 | + } |
|
86 | + |
|
87 | + public function hasRight (string $token) { |
|
88 | + //check, if user is super admin |
|
89 | + if (/*$this->userID == 1 || */(isset($this->permissions["super_admin"]) && $this->permissions["super_admin"] == 1) && $token !== "not_logged_in") { |
|
90 | + //super admin has all rights |
|
91 | + return true; |
|
92 | + } |
|
93 | + |
|
94 | + if ($token === "none" || $token === "all") { |
|
95 | + return true; |
|
96 | + } |
|
97 | + |
|
98 | + return isset($this->permissions[$token]) && $this->permissions[$token] == 1; |
|
99 | + } |
|
100 | + |
|
101 | + public static function ¤t () { |
|
102 | + if (self::$instance == null) { |
|
103 | + self::$instance = new PermissionChecker(User::current()->getID()); |
|
104 | + } |
|
105 | + |
|
106 | + return self::$instance; |
|
107 | + } |
|
108 | 108 | |
109 | 109 | } |
110 | 110 |
@@ -27,9 +27,9 @@ |
||
27 | 27 | |
28 | 28 | interface MailSender { |
29 | 29 | |
30 | - public function sendPlainMail ($to, string $subject, string $message, array $options = array(), string $from = "", string $reply_to = "") : bool; |
|
30 | + public function sendPlainMail ($to, string $subject, string $message, array $options = array(), string $from = "", string $reply_to = "") : bool; |
|
31 | 31 | |
32 | - public function sendHTMLMail ($to, string $subject, string $message, array $options = array(), string $from = "", string $reply_to = "") : bool; |
|
32 | + public function sendHTMLMail ($to, string $subject, string $message, array $options = array(), string $from = "", string $reply_to = "") : bool; |
|
33 | 33 | |
34 | 34 | } |
35 | 35 |
@@ -27,9 +27,9 @@ |
||
27 | 27 | |
28 | 28 | interface MailSender { |
29 | 29 | |
30 | - public function sendPlainMail ($to, string $subject, string $message, array $options = array(), string $from = "", string $reply_to = "") : bool; |
|
30 | + public function sendPlainMail($to, string $subject, string $message, array $options = array(), string $from = "", string $reply_to = "") : bool; |
|
31 | 31 | |
32 | - public function sendHTMLMail ($to, string $subject, string $message, array $options = array(), string $from = "", string $reply_to = "") : bool; |
|
32 | + public function sendHTMLMail($to, string $subject, string $message, array $options = array(), string $from = "", string $reply_to = "") : bool; |
|
33 | 33 | |
34 | 34 | } |
35 | 35 |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | return mail($to, $subject, $message, $headers); |
80 | 80 | } |
81 | 81 | |
82 | - public static function getOptions (array $options = array(), string $from = "", string $reply_to = "") : array { |
|
82 | + public static function getOptions(array $options = array(), string $from = "", string $reply_to = "") : array { |
|
83 | 83 | if (!is_null($from) && !empty($from)) { |
84 | 84 | $options['from'] = $from; |
85 | 85 | } |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | return $options; |
111 | 111 | } |
112 | 112 | |
113 | - public static function convertToArray ($to) : string { |
|
113 | + public static function convertToArray($to) : string { |
|
114 | 114 | if (is_array($to)) { |
115 | 115 | //convert array to RFC 2822 string |
116 | 116 | $to = implode(", ", $to); |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | return $to; |
120 | 120 | } |
121 | 121 | |
122 | - public static function generateHeader (array $options, string $to, bool $html_mail = false) { |
|
122 | + public static function generateHeader(array $options, string $to, bool $html_mail = false) { |
|
123 | 123 | //generate header |
124 | 124 | $headers = array(); |
125 | 125 |
@@ -27,152 +27,152 @@ |
||
27 | 27 | |
28 | 28 | class PHPMail implements MailSender { |
29 | 29 | |
30 | - public function sendPlainMail($to, string $subject, string $message, array $options = array(), string $from = "", string $reply_to = ""): bool { |
|
31 | - //http://php.net/manual/de/function.mail.php |
|
32 | - |
|
33 | - // In case any of our lines are larger than 70 characters, we should use wordwrap() |
|
34 | - $message = wordwrap($message, 70, "\r\n"); |
|
35 | - |
|
36 | - //throw event, so plugins can interact |
|
37 | - Events::throwEvent("send_plain_mail_php", array( |
|
38 | - 'to' => &$to, |
|
39 | - 'subject' => &$subject, |
|
40 | - 'message' => &$message, |
|
41 | - 'options' => &$options, |
|
42 | - 'from' => &$from, |
|
43 | - 'reply_to' => &$reply_to |
|
44 | - )); |
|
45 | - |
|
46 | - $options = self::getOptions($options, $from, $reply_to); |
|
47 | - $to = self::convertToArray($to); |
|
48 | - $headers = self::generateHeader($options, $to); |
|
49 | - |
|
50 | - //add signature at end of message |
|
51 | - $message .= MailApi::getSignature(); |
|
52 | - |
|
53 | - //send mail |
|
54 | - return mail($to, $subject, $message, $headers); |
|
55 | - } |
|
56 | - |
|
57 | - public function sendHTMLMail($to, string $subject, string $message, array $options = array(), string $from = "", string $reply_to = ""): bool { |
|
58 | - // In case any of our lines are larger than 70 characters, we should use wordwrap() |
|
59 | - $message = wordwrap($message, 70, "<br />"); |
|
60 | - |
|
61 | - //throw event, so plugins can interact |
|
62 | - Events::throwEvent("send_html_mail_php", array( |
|
63 | - 'to' => &$to, |
|
64 | - 'subject' => &$subject, |
|
65 | - 'message' => &$message, |
|
66 | - 'options' => &$options, |
|
67 | - 'from' => &$from, |
|
68 | - 'reply_to' => &$reply_to |
|
69 | - )); |
|
70 | - |
|
71 | - $options = $this->getOptions($options, $from, $reply_to); |
|
72 | - $to = self::convertToArray($to); |
|
73 | - $headers = self::generateHeader($options, $to, true); |
|
74 | - |
|
75 | - //add signature at end of message |
|
76 | - $message .= MailApi::getSignature(); |
|
77 | - |
|
78 | - //send mail |
|
79 | - return mail($to, $subject, $message, $headers); |
|
80 | - } |
|
81 | - |
|
82 | - public static function getOptions (array $options = array(), string $from = "", string $reply_to = "") : array { |
|
83 | - if (!is_null($from) && !empty($from)) { |
|
84 | - $options['from'] = $from; |
|
85 | - } |
|
86 | - |
|
87 | - if (!is_null($reply_to) && !empty($reply_to)) { |
|
88 | - $options['reply_to'] = $reply_to; |
|
89 | - } |
|
90 | - |
|
91 | - //set from address |
|
92 | - if (!isset($options['from']) || empty($options['from'])) { |
|
93 | - //get from address from settings |
|
94 | - $from_mail = Settings::get("mail_sender_address", "none"); |
|
95 | - $from_name = Settings::get("mail_sender_name", ""); |
|
96 | - |
|
97 | - if ($from_mail !== "none") { |
|
98 | - $options['from'] = (!empty($from_name) ? $from_name . " " : "") . $from_mail; |
|
99 | - } |
|
100 | - } |
|
101 | - |
|
102 | - if (!isset($options['reply_to']) || empty($options['reply_to'])) { |
|
103 | - $reply_to = Settings::get("mail_reply_to", ""); |
|
104 | - |
|
105 | - if (!empty($reply_to)) { |
|
106 | - $options['reply_to'] = $reply_to; |
|
107 | - } |
|
108 | - } |
|
109 | - |
|
110 | - return $options; |
|
111 | - } |
|
112 | - |
|
113 | - public static function convertToArray ($to) : string { |
|
114 | - if (is_array($to)) { |
|
115 | - //convert array to RFC 2822 string |
|
116 | - $to = implode(", ", $to); |
|
117 | - } |
|
118 | - |
|
119 | - return $to; |
|
120 | - } |
|
121 | - |
|
122 | - public static function generateHeader (array $options, string $to, bool $html_mail = false) { |
|
123 | - //generate header |
|
124 | - $headers = array(); |
|
125 | - |
|
126 | - if ($html_mail) { |
|
127 | - $charset = Settings::get("mail_default_charset", "urf-8"); |
|
128 | - |
|
129 | - //add mime version, content type and charset |
|
130 | - $headers[] = "MIME-Version: 1.0"; |
|
131 | - $headers[] = "Content-type: text/html; charset=" . $charset; |
|
132 | - |
|
133 | - $headers[] = "To: " . $to; |
|
134 | - } |
|
135 | - |
|
136 | - $headers[] = "Content-Transfer-Encoding: quoted-printable"; |
|
137 | - |
|
138 | - if (isset($options['from']) && !empty($options['from'])) { |
|
139 | - $headers[] = "From: " . $options['from']; |
|
140 | - } |
|
141 | - |
|
142 | - if (isset($options['reply_to']) && !empty($options['reply_to'])) { |
|
143 | - $headers[] = "Reply-To: " . $options['reply_to']; |
|
144 | - } |
|
145 | - |
|
146 | - if (isset($options['cc'])) { |
|
147 | - if (is_array($options['cc'])) { |
|
148 | - //convert array to string |
|
149 | - $options['cc'] = implode(", ", $options['cc']); |
|
150 | - } |
|
151 | - |
|
152 | - $headers[] = "Cc: " . $options['cc']; |
|
153 | - } |
|
154 | - |
|
155 | - if (isset($options['bcc'])) { |
|
156 | - if (is_array($options['bcc'])) { |
|
157 | - //convert array to string |
|
158 | - $options['bcc'] = implode(", ", $options['bcc']); |
|
159 | - } |
|
160 | - |
|
161 | - $headers[] = "Bcc: " . $options['bcc']; |
|
162 | - } |
|
163 | - |
|
164 | - //add php X-Mailer header |
|
165 | - $headers[] = "X-Mailer: PHP/" . phpversion(); |
|
166 | - |
|
167 | - if (count($headers) == 0) { |
|
168 | - $headers = null; |
|
169 | - } else { |
|
170 | - //convert array to string |
|
171 | - $headers = implode("\r\n", $headers); |
|
172 | - } |
|
30 | + public function sendPlainMail($to, string $subject, string $message, array $options = array(), string $from = "", string $reply_to = ""): bool { |
|
31 | + //http://php.net/manual/de/function.mail.php |
|
32 | + |
|
33 | + // In case any of our lines are larger than 70 characters, we should use wordwrap() |
|
34 | + $message = wordwrap($message, 70, "\r\n"); |
|
35 | + |
|
36 | + //throw event, so plugins can interact |
|
37 | + Events::throwEvent("send_plain_mail_php", array( |
|
38 | + 'to' => &$to, |
|
39 | + 'subject' => &$subject, |
|
40 | + 'message' => &$message, |
|
41 | + 'options' => &$options, |
|
42 | + 'from' => &$from, |
|
43 | + 'reply_to' => &$reply_to |
|
44 | + )); |
|
45 | + |
|
46 | + $options = self::getOptions($options, $from, $reply_to); |
|
47 | + $to = self::convertToArray($to); |
|
48 | + $headers = self::generateHeader($options, $to); |
|
49 | + |
|
50 | + //add signature at end of message |
|
51 | + $message .= MailApi::getSignature(); |
|
52 | + |
|
53 | + //send mail |
|
54 | + return mail($to, $subject, $message, $headers); |
|
55 | + } |
|
56 | + |
|
57 | + public function sendHTMLMail($to, string $subject, string $message, array $options = array(), string $from = "", string $reply_to = ""): bool { |
|
58 | + // In case any of our lines are larger than 70 characters, we should use wordwrap() |
|
59 | + $message = wordwrap($message, 70, "<br />"); |
|
60 | + |
|
61 | + //throw event, so plugins can interact |
|
62 | + Events::throwEvent("send_html_mail_php", array( |
|
63 | + 'to' => &$to, |
|
64 | + 'subject' => &$subject, |
|
65 | + 'message' => &$message, |
|
66 | + 'options' => &$options, |
|
67 | + 'from' => &$from, |
|
68 | + 'reply_to' => &$reply_to |
|
69 | + )); |
|
70 | + |
|
71 | + $options = $this->getOptions($options, $from, $reply_to); |
|
72 | + $to = self::convertToArray($to); |
|
73 | + $headers = self::generateHeader($options, $to, true); |
|
74 | + |
|
75 | + //add signature at end of message |
|
76 | + $message .= MailApi::getSignature(); |
|
77 | + |
|
78 | + //send mail |
|
79 | + return mail($to, $subject, $message, $headers); |
|
80 | + } |
|
81 | + |
|
82 | + public static function getOptions (array $options = array(), string $from = "", string $reply_to = "") : array { |
|
83 | + if (!is_null($from) && !empty($from)) { |
|
84 | + $options['from'] = $from; |
|
85 | + } |
|
86 | + |
|
87 | + if (!is_null($reply_to) && !empty($reply_to)) { |
|
88 | + $options['reply_to'] = $reply_to; |
|
89 | + } |
|
90 | + |
|
91 | + //set from address |
|
92 | + if (!isset($options['from']) || empty($options['from'])) { |
|
93 | + //get from address from settings |
|
94 | + $from_mail = Settings::get("mail_sender_address", "none"); |
|
95 | + $from_name = Settings::get("mail_sender_name", ""); |
|
96 | + |
|
97 | + if ($from_mail !== "none") { |
|
98 | + $options['from'] = (!empty($from_name) ? $from_name . " " : "") . $from_mail; |
|
99 | + } |
|
100 | + } |
|
101 | + |
|
102 | + if (!isset($options['reply_to']) || empty($options['reply_to'])) { |
|
103 | + $reply_to = Settings::get("mail_reply_to", ""); |
|
104 | + |
|
105 | + if (!empty($reply_to)) { |
|
106 | + $options['reply_to'] = $reply_to; |
|
107 | + } |
|
108 | + } |
|
109 | + |
|
110 | + return $options; |
|
111 | + } |
|
112 | + |
|
113 | + public static function convertToArray ($to) : string { |
|
114 | + if (is_array($to)) { |
|
115 | + //convert array to RFC 2822 string |
|
116 | + $to = implode(", ", $to); |
|
117 | + } |
|
118 | + |
|
119 | + return $to; |
|
120 | + } |
|
121 | + |
|
122 | + public static function generateHeader (array $options, string $to, bool $html_mail = false) { |
|
123 | + //generate header |
|
124 | + $headers = array(); |
|
125 | + |
|
126 | + if ($html_mail) { |
|
127 | + $charset = Settings::get("mail_default_charset", "urf-8"); |
|
128 | + |
|
129 | + //add mime version, content type and charset |
|
130 | + $headers[] = "MIME-Version: 1.0"; |
|
131 | + $headers[] = "Content-type: text/html; charset=" . $charset; |
|
132 | + |
|
133 | + $headers[] = "To: " . $to; |
|
134 | + } |
|
135 | + |
|
136 | + $headers[] = "Content-Transfer-Encoding: quoted-printable"; |
|
137 | + |
|
138 | + if (isset($options['from']) && !empty($options['from'])) { |
|
139 | + $headers[] = "From: " . $options['from']; |
|
140 | + } |
|
141 | + |
|
142 | + if (isset($options['reply_to']) && !empty($options['reply_to'])) { |
|
143 | + $headers[] = "Reply-To: " . $options['reply_to']; |
|
144 | + } |
|
145 | + |
|
146 | + if (isset($options['cc'])) { |
|
147 | + if (is_array($options['cc'])) { |
|
148 | + //convert array to string |
|
149 | + $options['cc'] = implode(", ", $options['cc']); |
|
150 | + } |
|
151 | + |
|
152 | + $headers[] = "Cc: " . $options['cc']; |
|
153 | + } |
|
154 | + |
|
155 | + if (isset($options['bcc'])) { |
|
156 | + if (is_array($options['bcc'])) { |
|
157 | + //convert array to string |
|
158 | + $options['bcc'] = implode(", ", $options['bcc']); |
|
159 | + } |
|
160 | + |
|
161 | + $headers[] = "Bcc: " . $options['bcc']; |
|
162 | + } |
|
163 | + |
|
164 | + //add php X-Mailer header |
|
165 | + $headers[] = "X-Mailer: PHP/" . phpversion(); |
|
166 | + |
|
167 | + if (count($headers) == 0) { |
|
168 | + $headers = null; |
|
169 | + } else { |
|
170 | + //convert array to string |
|
171 | + $headers = implode("\r\n", $headers); |
|
172 | + } |
|
173 | 173 | |
174 | - return $headers; |
|
175 | - } |
|
174 | + return $headers; |
|
175 | + } |
|
176 | 176 | |
177 | 177 | } |
178 | 178 |