]> git.mxchange.org Git - mailer.git/blobdiff - inc/mysql-manager.php
Fix for rewritting code #3
[mailer.git] / inc / mysql-manager.php
index bf3b16b973dd738593a02176c010254269a115e7..6297f28228010ac93de374857fa4eac1cd1ad9c3 100644 (file)
@@ -296,7 +296,7 @@ function addMenuDescription ($accessLevel, $FQFN, $return = false) {
        // Init variables
        $LINK_ADD = '';
        $OUT = '';
-       $AND = '';
+       $ADD = '';
 
        // First we have to do some analysis...
        if (substr($file, 0, 7) == 'action-') {
@@ -308,39 +308,39 @@ function addMenuDescription ($accessLevel, $FQFN, $return = false) {
                $modCheck = getModuleFromFileName($file, $accessLevel);
 
                // Add what
-               $AND = " AND (`what`='' OR `what` IS NULL)";
+               $ADD = " AND (`what`='' OR `what` IS NULL)";
        } elseif (substr($file, 0, 5) == 'what-') {
-               // This is an admin what file!
+               // This is a 'what file'!
                $type = 'what';
                $search = substr($file, 5);
-               $AND = " AND `visible`='Y' AND `locked`='N'";
+               $ADD = " AND `visible`='Y' AND `locked`='N'";
 
                // Get access level from it
                $modCheck = getModuleFromFileName($file, $accessLevel);
 
                // Do we have admin? Then display all
-               if (isAdmin()) $AND = '';
+               if (isAdmin()) $ADD = '';
 
                $dummy = substr($search, 0, -4);
-               $AND .= " AND `action`='".getModeAction($accessLevel, $dummy)."'";
+               $ADD .= " AND `action`='".getModeAction($accessLevel, $dummy)."'";
        } elseif (($accessLevel == 'sponsor') || ($accessLevel == 'engine')) {
                // Sponsor / engine menu
                $type     = 'what';
                $search   = $file;
                $modCheck = getModule();
-               $AND      = '';
+               $ADD      = '';
        } else {
                // Other
                $type     = 'menu';
                $search   = $file;
                $modCheck = getModule();
-               $AND      = '';
+               $ADD      = '';
        }
 
        // Begin the navigation line
        if ((!isset($GLOBALS['nav_depth'])) && ($return === false)) {
                $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 === false) $GLOBALS['nav_depth']++;
                $prefix = '';
@@ -356,7 +356,7 @@ function addMenuDescription ($accessLevel, $FQFN, $return = false) {
 
        if (((isExtensionInstalledAndNewer('sql_patches', '0.2.3')) && (getConfig('youre_here') == 'Y')) || ((isAdmin()) && ($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 . "%}\">" . getTitleFromMenu($accessLevel, $search, $type, $ADD) . "</a></strong>\n";
 
                // Can we close the you-are-here navigation?
                //* DEBUG: */ print(__LINE__."*".$type.'/'.getWhat()."*<br />");
@@ -388,7 +388,7 @@ function addMenuDescription ($accessLevel, $FQFN, $return = false) {
 function addMenu ($mode, $action, $what) {
        // Init some variables
        $main_cnt = '0';
-       $AND = '';
+       $ADD = '';
 
        // is the menu action valid?
        if (!isMenuActionValid($mode, $action, $what, true)) {
@@ -397,11 +397,11 @@ function addMenu ($mode, $action, $what) {
 
        // Non-admin shall not see all menus
        if (!isAdmin()) {
-               $AND = " AND `visible`='Y' AND `locked`='N'";
+               $ADD = " AND `visible`='Y' AND `locked`='N'";
        } // END - if
 
        // Load SQL data and add the menu to the output stream...
-       $result_main = SQL_QUERY_ESC("SELECT `title`, `action` FROM `{?_MYSQL_PREFIX?}_%s_menu` WHERE (`what`='' OR `what` IS NULL)".$AND." ORDER BY `sort` ASC",
+       $result_main = SQL_QUERY_ESC("SELECT `title`, `action` FROM `{?_MYSQL_PREFIX?}_%s_menu` WHERE (`what`='' OR `what` IS NULL)".$ADD." ORDER BY `sort` ASC",
                array($mode), __FUNCTION__, __LINE__);
 
        //* DEBUG: */ print(__LINE__.'/'.$main_cnt.':'.getWhat()."*<br />");
@@ -418,7 +418,7 @@ function addMenu ($mode, $action, $what) {
                        $GLOBALS['rows'] .= loadTemplate($mode . '_menu_title', true, $content);
 
                        // Sub menu
-                       $result_sub = SQL_QUERY_ESC("SELECT `title` AS sub_title, `what` AS sub_what FROM `{?_MYSQL_PREFIX?}_%s_menu` WHERE `action`='%s' AND `what` != '' AND `what` IS NOT NULL ".$AND." ORDER BY `sort`",
+                       $result_sub = SQL_QUERY_ESC("SELECT `title` AS sub_title, `what` AS sub_what FROM `{?_MYSQL_PREFIX?}_%s_menu` WHERE `action`='%s' AND `what` != '' AND `what` IS NOT NULL ".$ADD." ORDER BY `sort`",
                                array($mode, $content['action']), __FUNCTION__, __LINE__);
 
                        // Get number of rows
@@ -447,7 +447,7 @@ function addMenu ($mode, $action, $what) {
                                                } // END - if
 
                                                // 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 {
                                                // Not found! - open
                                                $OUT .= "<em style=\"cursor:help\" class=\"admin_note\" title=\"{--MENU_WHAT_404--}\">";
@@ -805,8 +805,8 @@ function addMaxReceiveList ($mode, $default = '', $return = false) {
 // Checks wether the given email address is used.
 function isEmailTaken ($email) {
        // Query the database
-       $result = SQL_QUERY_ESC("SELECT `userid` FROM `{?_MYSQL_PREFIX?}_user_data` WHERE email LIKE '{PER}%s{PER}' LIMIT 1",
-               array($email), __FUNCTION__, __LINE__);
+       $result = SQL_QUERY_ESC("SELECT `userid` FROM `{?_MYSQL_PREFIX?}_user_data` WHERE `email` LIKE '{PER}%s{PER}' OR `email` LIKE '{PER}%s{PER}' LIMIT 1",
+               array($email, str_replace('.', '{DOT}', $email)), __FUNCTION__, __LINE__);
 
        // Is the email there?
        $ret = (SQL_NUMROWS($result) == 1);
@@ -1246,7 +1246,8 @@ function addPointsThroughReferalSystem ($subject, $userid, $points, $sendNotify
                                // Load email template
                                $message = loadEmailTemplate('confirm-referal', $content, bigintval($userid));
 
-                               sendEmail(getUserData('email'), THANX_REFERAL_ONE, $message);
+                               // Send email
+                               sendEmail($userid, getMessage('THANX_REFERAL_ONE_SUBJECT'), $message);
                        } elseif (($sendNotify) && (getUserData('refid') == '0') && ($locked === false) && ($add_mode == 'direct')) {
                                // Prepare content
                                $content = array(
@@ -1258,7 +1259,7 @@ function addPointsThroughReferalSystem ($subject, $userid, $points, $sendNotify
                                $message = loadEmailTemplate('add-points', $content, $userid);
 
                                // And sent it away
-                               sendEmail(getUserData('email'), getMessage('SUBJECT_DIRECT_PAYMENT'), $message);
+                               sendEmail($userid, getMessage('SUBJECT_DIRECT_PAYMENT'), $message);
                                if (!isGetRequestElementSet('mid')) loadTemplate('admin_settings_saved', false, getMessage('ADMIN_POINTS_ADDED'));
                        }