]> git.mxchange.org Git - mailer.git/blobdiff - inc/mysql-manager.php
Several more constants rewritten to getConfig()
[mailer.git] / inc / mysql-manager.php
index d07f48dbe551559e9b76013969417f1d0e9f7de0..95e7178b4ebe7ceff8b224bf00f3a2e73d9acba7 100644 (file)
@@ -222,7 +222,7 @@ function checkModulePermissions ($mod) {
        // Still no luck or not found?
        if (($found === false) && (!EXT_IS_ACTIVE('cache')) && ($ret != 'done'))  {
                //              ----- Legacy module -----                                               ---- Module in base folder  ----                       --- Module with extension's name ---
-               if ((isFileReadable(sprintf("%sinc/modules/%s.php", constant('PATH'), $mod))) || (isFileReadable(sprintf("%s%s.php", constant('PATH'), $mod))) || (isFileReadable(sprintf("%s%s/%s.php", constant('PATH'), $extension, $mod)))) {
+               if ((isIncludeReadable(sprintf("inc/modules/%s.php", $mod))) || (isIncludeReadable(sprintf("%s.php", $mod))) || (isIncludeReadable(sprintf("%s/%s.php", $extension, $mod)))) {
                        // Data is missing so we add it
                        if (GET_EXT_VERSION('sql_patches') >= '0.3.6') {
                                // Since 0.3.6 we have a has_menu column, this took me a half hour
@@ -338,7 +338,7 @@ function ADD_DESCR ($accessLevel, $FQFN, $return = false, $output = true) {
        // Begin the navigation line
        if ((!isset($GLOBALS['nav_depth'])) && (!$return)) {
                $GLOBALS['nav_depth'] = 0;
-               $prefix = "<div class=\"you_are_here\">{--YOU_ARE_HERE--}&nbsp;<strong><a class=\"you_are_here\" href=\"{!URL!}/modules.php?module=".getModule().$LINK_ADD."\">Home</a></strong>";
+               $prefix = "<div class=\"you_are_here\">{--YOU_ARE_HERE--}&nbsp;<strong><a class=\"you_are_here\" href=\"{?URL?}/modules.php?module=".getModule().$LINK_ADD."\">Home</a></strong>";
        } else {
                if (!$return) $GLOBALS['nav_depth']++;
                $prefix = '';
@@ -367,7 +367,7 @@ function ADD_DESCR ($accessLevel, $FQFN, $return = false, $output = true) {
                        return $ret;
                } elseif (((GET_EXT_VERSION('sql_patches') >= '0.2.3') && (getConfig('youre_here') == 'Y')) || ((IS_ADMIN()) && ($modCheck == 'admin'))) {
                        // Output HTML code
-                       $OUT = $prefix . "<strong><a class=\"you_are_here\" href=\"{!URL!}/modules.php?module=" . $modCheck . '&amp;' . $type . '=' . $search.$LINK_ADD . "\">" . $ret . "</a></strong>\n";
+                       $OUT = $prefix . "<strong><a class=\"you_are_here\" href=\"{?URL?}/modules.php?module=" . $modCheck . '&amp;' . $type . '=' . $search.$LINK_ADD . "\">" . $ret . "</a></strong>\n";
 
                        // Can we close the you-are-here navigation?
                        //* DEBUG: */ OUTPUT_HTML(__LINE__."*".$type.'/'.getWhat()."*<br />");
@@ -460,7 +460,7 @@ function ADD_MENU ($mode, $act, $wht) {
                                                }
 
                                                // Navigation link
-                                               $OUT .= "<a name=\"menu\" class=\"menu_blur\" href=\"{!URL!}/modules.php?module=".getModule()."&amp;what=".$content['sub_what']."\" target=\"_self\">";
+                                               $OUT .= "<a name=\"menu\" class=\"menu_blur\" href=\"{?URL?}/modules.php?module=".getModule()."&amp;what=".$content['sub_what']."\" target=\"_self\">";
                                        } else {
                                                $OUT .= "<em>";
                                        }
@@ -1021,7 +1021,7 @@ function getPaymentTitlePrice ($pid, $full=false) {
                } else {
                        // Return title and price
                        list($t, $p) = SQL_FETCHROW($result);
-                       $ret = $t.' / '.translateComma($p).' {!POINTS!}';
+                       $ret = $t.' / '.translateComma($p).' {?POINTS?}';
                }
        }
 
@@ -1608,16 +1608,16 @@ function activateExchange () {
                SET_SQLS(array(
                        "UPDATE `{!_MYSQL_PREFIX!}_mod_reg` SET `locked`='N', `hidden`='N', `mem_only`='Y' WHERE `module`='order' LIMIT 1",
                        "UPDATE `{!_MYSQL_PREFIX!}_member_menu` SET `visible`='Y', `locked`='N' WHERE `what`='order' OR `what`='unconfirmed' LIMIT 2",
-                       "UPDATE `{!_MYSQL_PREFIX!}_config` SET `activate_xchange`=0 WHERE `config`=0 LIMIT 1"
-                       ));
+               ));
 
-                       // Run SQLs
-                       runFilterChain('run_sqls');
+               // Run SQLs
+               runFilterChain('run_sqls');
 
-                       // Rebuild caches
-                       // @TODO Rewrite this to a filter
-                       rebuildCacheFiles('config', 'config');
-                       rebuildCacheFiles('modreg', 'modreg');
+               // Update configuration
+               updateConfiguration('activate_xchange' ,0);
+
+               // Rebuild cache
+               rebuildCacheFiles('modreg', 'modreg');
        } // END - if
 }
 
@@ -1672,7 +1672,7 @@ function generateMetaDescriptionCode ($mod, $wht) {
        // Exclude admin and member's area
        if (($mod != 'admin') && ($mod != 'login')) {
                // Construct dynamic description
-               $DESCR = '{!MAIN_TITLE!} '.trim(getConfig('title_middle')) . ' ' . ADD_DESCR('guest', 'what-'.$wht, true);
+               $DESCR = '{?MAIN_TITLE?} '.trim(getConfig('title_middle')) . ' ' . ADD_DESCR('guest', 'what-'.$wht, true);
 
                // Output it directly
                OUTPUT_HTML('<meta name="description" content="' . $DESCR . '" />');
@@ -1795,67 +1795,6 @@ function SUB_POINTS ($subject, $uid, $points) {
        } // END - if
 }
 
-// Update config entries
-function updateConfiguration ($entries, $values, $updateMode='') {
-       // Do not update config in CSS mode
-       if ((getOutputMode() == '1') || (getOutputMode() == -1)) {
-               return;
-       } // END - if
-
-       // Do we have multiple entries?
-       if (is_array($entries)) {
-               // Walk through all
-               $all = '';
-               foreach ($entries as $idx => $entry) {
-                       // Update mode set?
-                       if (!empty($updateMode)) {
-                               // Update entry
-                               // @TODO Find a way for updating configuration here
-                               $all .= sprintf("`%s`=%s%s%s,", $entry, $entry, $updateMode, (float)$values[$idx]);
-                       } else {
-                               // Check if string or number
-                               if (($values[$idx] + 0) === $values[$idx]) {
-                                       // Number detected
-                                       $all .= sprintf("`%s`=%s,", $entry, (float)$values[$idx]);
-                               } elseif ($values[$idx] == 'UNIX_TIMESTAMP()') {
-                                       // Function UNIX_TIMESTAMP() detected
-                                       $all .= sprintf("`%s`=%s,", $entry, $values[$idx]);
-                               } else {
-                                       // String detected
-                                       $all .= sprintf("`%s`='%s',", $entry, SQL_ESCAPE($values[$idx]));
-                               }
-                       }
-
-                       // Set it in config as well
-                       setConfigEntry($entry, $values[$idx]);
-               } // END - foreach
-
-               // Remove last comma
-               $entries = substr($all, 0, -1);
-       } elseif (!empty($updateMode)) {
-               // Update mode set
-               // @TODO Find a way for updating configuration here
-               $entries .= sprintf("=%s%s%s", $entries, $updateMode, (float)$values);
-       } else {
-               // Set it in config first
-               setConfigEntry($entries, $values);
-
-               // Regular entry to update
-               $entries .= sprintf("='%s'", SQL_ESCAPE($values));
-       }
-
-       // Run database update
-       //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "entries={$entries}");
-       SQL_QUERY("UPDATE `{!_MYSQL_PREFIX!}_config` SET ".$entries." WHERE `config`=0 LIMIT 1", __FUNCTION__, __LINE__);
-
-       // Get affected rows
-       $affectedRows = SQL_AFFECTEDROWS();
-       //* DEBUG: */ OUTPUT_HTML(__FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):entries={$entries},affectedRows={$affectedRows}<br />");
-
-       // Rebuild cache
-       rebuildCacheFiles('config', 'config');
-}
-
 // Prepares an SQL statement part for HTML mail and/or holiday depency
 // @TODO Can this be rewritten to a filter?
 function PREPARE_SQL_HTML_HOLIDAY ($mode) {