Merge branch 'bug-1054' into bug-1042
authorBenny Baumann <BenBE@geshi.org>
Wed, 29 Apr 2015 22:18:16 +0000 (00:18 +0200)
committerBenny Baumann <BenBE@geshi.org>
Wed, 29 Apr 2015 22:18:16 +0000 (00:18 +0200)
1  2 
includes/general.php

diff --combined includes/general.php
@@@ -47,7 -47,8 +47,7 @@@
        if(array_key_exists('HTTP_HOST',$_SERVER) &&
                        $_SERVER['HTTP_HOST'] != $_SESSION['_config']['normalhostname'] &&
                        $_SERVER['HTTP_HOST'] != $_SESSION['_config']['securehostname'] &&
 -                      $_SERVER['HTTP_HOST'] != $_SESSION['_config']['tverify'] &&
 -                      $_SERVER['HTTP_HOST'] != "stamp.cacert.org")
 +                      $_SERVER['HTTP_HOST'] != $_SESSION['_config']['tverify'])
        {
                if(array_key_exists('HTTPS',$_SERVER) && $_SERVER['HTTPS'] == "on")
                        header("location: https://".$_SESSION['_config']['normalhostname']);
                $locked = mysql_fetch_assoc(mysql_query("select `locked` from `users` where `id`='".intval($_SESSION['profile']['id'])."'"));
                if($locked['locked'] == 0)
                {
-                       $query = "select sum(`points`) as `total` from `notary` where `to`='".intval($_SESSION['profile']['id'])."' and `deleted` = 0 group by `to`";
-                       $res = mysql_query($query);
-                       $row = mysql_fetch_assoc($res);
-                       $_SESSION['profile']['points'] = $row['total'];
+                       update_points_in_profile();
                } else {
                        $_SESSION['profile'] = "";
                        unset($_SESSION['profile']);
                if($id <= 0)
                        $id = $_SESSION['profile']['id'];
  
-               $query = "select sum(`points`) as `points` from `notary` where `to`='$id' and `deleted` = 0 group by `to`";
-               $row = mysql_fetch_assoc(mysql_query($query));
-               $points = $row['points'];
+               $points = get_received_total_points($id);
  
                $dob = date("Y-m-d", mktime(0,0,0,date("m"),date("d"),date("Y")-18));
                $query = "select * from `users` where `id`='".intval($_SESSION['profile']['id'])."' and `dob` < '$dob'";