1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Roadmap Version 1.8

Discussion in 'RoadMap' started by shibuya246, Dec 11, 2014.

  1. valMETNG

    valMETNG Administrator Staff Member Admin

    When a user clicks the registration confirmation link, the email confirmation page is blank - I think it should have a success message:
    upload_2015-1-25_21-5-51.png
     
  2. valMETNG

    valMETNG Administrator Staff Member Admin

    Ah, it appears it's blank because the confirmation isn't going through. It's not going through because, even after fixing this, $user->id on line 561 of plugins/user_signin/user_signin.php is empty. The function getUserBasic on line 553 is being run and returning the correct user row. However, it's not populating the $user object. getUserBasic is populating $h->users[$user_id], so I'm not sure if that's what you wanted to use here.
     
  3. valMETNG

    valMETNG Administrator Staff Member Admin

    Now I see the problem. I think you wanted getUser instead of getUserBasic on line 553:
    Code:
    $user->getUser($h, $user_id);
     
  4. shibuya246

    shibuya246 Hotaru Developer Staff Member Admin

    i think you are right. it is not being used yet, but i set it to $fromId also
     
  5. valMETNG

    valMETNG Administrator Staff Member Admin

    Additionally, I'm not sure if this is the same problem or not on line 253 of libs/UserAuth.php:
    Code:
    $user = $h->getUserBasic($loginInfo->login);
    It doesn't appear this function is used yet. But, at minimum, the $h doesn't come into the function so it won't work anyway:
    Code:
    public function externalSignIn($loginInfo, $rememberMe = false)
    Edit: Removed what I thought was an error but wasn't.
     
    Last edited: Jan 26, 2015
    shibuya246 likes this.
  6. valMETNG

    valMETNG Administrator Staff Member Admin

    I thought there was some discussion around this, but I can't find it so apologies if this is a duplicate. Function checkSession in libs/UserAuth.php is not re-getting permissions if a user is already signed-in. However, there are cases (e.g., spammer) where an admin will turn off certain permissions for a user (e.g., can_comment) or disable an account while the user is logged in. As long as the user doesn't sign out, they continue to have the permissions/role the admin removed. Although I understand it decreases performance, I think we should re-get/re-set $h->currentUser upon each page load. Otherwise, there isn't any way to stop a user from doing something who is currently logged in.
     
  7. valMETNG

    valMETNG Administrator Staff Member Admin

    For Arabic characters in emails, I think we need to add the following to doSmtpEmail in libs/EmailFunctions.php:
    Code:
    $mail->CharSet = 'UTF-8';
    It seems that specifying it in the headers isn't enough for some strange reason. When I don't include it, Arabic letters don't print properly.
     
    shibuya246 likes this.
  8. valMETNG

    valMETNG Administrator Staff Member Admin

    When a user goes to another's edit-profile screen (e.g., mysite.com/edit-profile/user/test_user_10), the error message is misaligned:
    upload_2015-1-26_19-24-47.png

    Edit: Probably not the best way to correct, but a quick-fix is to change lines 396-400 of plugins/users/users.php to:
    Code:
      if ($denied) {
      $h->messages[$h->lang["main_access_denied"]] = 'red';
           echo "<div class='col-md-9'>";
      $h->showMessages();
           echo "</div>";
           return true;
      }
     
    Last edited: Jan 27, 2015
  9. valMETNG

    valMETNG Administrator Staff Member Admin

    Font-Awesome is now on 4.3, so you might want to update line 1466 in Hotaru.php.
     
    shibuya246 likes this.
  10. valMETNG

    valMETNG Administrator Staff Member Admin

    I suggest commenting out line 198 in UserAuth.php. Otherwise, you'll get two error messages when incorrectly logging in:
    upload_2015-1-26_21-1-21.png
     
  11. shibuya246

    shibuya246 Hotaru Developer Staff Member Admin

    thanks. i need to bring all of these scripts with version numbers into init and make it easier to keep them current. and also allow the user to override them if they want
     
  12. shibuya246

    shibuya246 Hotaru Developer Staff Member Admin

    thanks. some really good changes here. Hoping I am getting them all in. I will release a new minor version update soon with everything you have noted
     
  13. shibuya246

    shibuya246 Hotaru Developer Staff Member Admin

    I will look at reverting the code for holding permissions in session to being a db call
     
  14. shibuya246

    shibuya246 Hotaru Developer Staff Member Admin

    thanks. all done
     
  15. valMETNG

    valMETNG Administrator Staff Member Admin

    Might want to also include role because an admin might change the role of a spammer from member to something.
     
  16. valMETNG

    valMETNG Administrator Staff Member Admin

    I think you said these only happen once/day, but I'd suggest removing the automatic checking for updates (or at least only do it when an admin logs in). An admin should do this manually - the visitor/user shouldn't be "penalized" from a performance perspective:
     
  17. valMETNG

    valMETNG Administrator Staff Member Admin

    I must be doing something completely wrong and would appreciate your help. From the looks of it, Hotaru is cycling multiple times, so I assume there's something obvious I'm missing here.

    I added the following code to the bottom of /libs/extensions/ezSQL/mysqli/ez_my_sqli.php:
    Code:
      public function testQueries($query)
      {
      if (!isset($_SESSION['all_queries'])) { $_SESSION['all_queries'] = array(); }
      $_SESSION['all_queries'][] = $query;
      }
    I then added the following to line 241:
    Code:
    $this->testQueries($query);
    I also added this to the bottom of Hotaru.php:
    Code:
       public function printAllTestQueries($over = 40)
       {
         $total_count = count($_SESSION['all_queries']);
         $review_char_length = 200;
    
         if ($total_count > $over)
         {
           $duplicates = array();
    
           print "<br/>queries over $over - total count: " .$total_count."<br/>";
    
           foreach ($_SESSION['all_queries'] as $review)
           {
             if (strlen($review) > $review_char_length) { $review = substr($review, 0, $review_char_length); }
    
             if (isset($duplicates[$review])) { $duplicates[$review]++; }
             else { $duplicates[$review] = 1; }
    
             print $review . "<br/>";
           }
    
           print "<br/><br/>SUMMARY (greater than 1):<br/><br/><pre>";
    
           foreach ($duplicates as $query => $count)
           { if ($count > 1) { print "<br/>query:" . $query . "<br/>count ==> $count"; } }
    
           print "</pre>";
    
           exit;
         }
       }
    All this allows me to see what queries - in total - are occurring (rather than just doing a print after each one - it's easier to look for duplicates). I added this to the bottom of content/themes/default/footer.php so I could be made aware of any page load where there were more than 40 queries (I don't look at the query count at the bottom as often as I should):
    Code:
    <?php $h->printAllTestQueries(); ?>
    But something strange happens when I do this. I selected 5 as my $over and the results are in the attached file (this is for a base install - no customizations except above). As you'll see, according to Hotaru's database query counter, there were only 12 queries. However, this is counting 77, with 18 queries running multiple times. This would suggest Hotaru is cycling somewhere. Can you see where I'm making a mistake in logic, or is Hotaru cycling and we're not seeing it?

    Edit: Fixed error in code.
     

    Attached Files:

    Last edited: Jan 27, 2015
  18. valMETNG

    valMETNG Administrator Staff Member Admin

    False alarm, and my apologies. That took me way to long to figure out. After continuing to see the duplicates go up - up - up, I realized that I wasn't unsetting the $_SESSION variable after each page load. I think I need a drink. :)
     
  19. valMETNG

    valMETNG Administrator Staff Member Admin

    It's not clear to me where this is happening but, on every page, I see the following query often, whether a user is logged in or not:
    So I assume either user_id is incorrect somewhere or we're running a query that doesn't need to be run.

    Additionally, the miscdata_value query seems to be run multiple times often enough (this is from going to a user's profile):
    As the miscdata table only has 6 total records in it, why not run a query to get everything once and store it in memory? In the above example, we hit the table 8 times.
     
  20. valMETNG

    valMETNG Administrator Staff Member Admin

    IMO, function getProfileSetting in models/mdb/Usermeta.php should go and get both rows for a user (i.e., user_profile and user_settings), store it in memory, and then return the individual values as needed. I haven't tracked down why (and it might be a problem with my code), but it seems that table is being hit more than a few times when you really could just hit it once.
     

Share This Page