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

    Is that this problem? I just saw this when clicking on People - Browse:
    upload_2014-12-18_16-15-46.png
     
  2. valMETNG

    valMETNG Administrator Staff Member Admin

    At lines 77 and 154 of libs/extensions/RSSWriterClass/rsswriter.php, I included this in my build so that author gets the proper RSS creator tag:
    Code:
    if ($key == 'author') { $out .= "<dc:creator>$val</dc:creator>\n"; }
    else { $out .= "<$key>$val</$key>\n"; }
     
  3. valMETNG

    valMETNG Administrator Staff Member Admin

    As you're using the CDN, it doesn't matter, but it appears in/libs/frameworks/bootstrap that you have v2.3.2.
     
    shibuya246 likes this.
  4. valMETNG

    valMETNG Administrator Staff Member Admin

    On line 81 in libs/Debug.php, should there be a closing </span>?
    Code:
    if ($h->currentUser->loggedIn) {echo "<span id='loggedIn' class='loggedIn_true'/>"; } else {"<span id='loggedIn' class='loggedIn_false'/>";}
     
    shibuya246 likes this.
  5. valMETNG

    valMETNG Administrator Staff Member Admin

    On line 69 of libs/EmailFunctions.php, I don't remember when the situation came up that generated an error (maybe when one user sent another user a message without a subject?), but I changed it to this:
    Code:
    if ($this->subject) { $this->subject = '=?UTF-8?B?'.base64_encode($this->subject).'?='; }
     
    shibuya246 likes this.
  6. shibuya246

    shibuya246 Hotaru Developer Staff Member Admin

    Yes, fixed that one
     
  7. shibuya246

    shibuya246 Hotaru Developer Staff Member Admin

    thanks. fixed now
     
  8. shibuya246

    shibuya246 Hotaru Developer Staff Member Admin

    great idea. have added it in now
     
  9. shibuya246

    shibuya246 Hotaru Developer Staff Member Admin

    added in now
     
  10. shibuya246

    shibuya246 Hotaru Developer Staff Member Admin

    this was to provide a modal box that could be called from any plugin or by core, rather than having multiple modals it would be the default modal that could be called and populated. not used yet i think
     
  11. valMETNG

    valMETNG Administrator Staff Member Admin

    On line 275 of libs/UserBase.php, I notice that you're updating user_username. However, it appears you've removed the ability for users to update their usernames on the account page (which I agree is a good idea and had removed it from my code). As I'm not familiar enough with all the changed functions in 1.7, is there some other place that a user or admin can update username?
     
  12. valMETNG

    valMETNG Administrator Staff Member Admin

    For lines 542 and 601 of libs/UserBase.php, I'd suggest the following replacement:
    Code:
    $body .= '<a href="' . $url . '">' . $url . '</a>.';
     
    Last edited: Dec 19, 2014
    shibuya246 likes this.
  13. valMETNG

    valMETNG Administrator Staff Member Admin

    So I haven't yet learned to use namespaces, and I don't yet understand the Models. However, am I interpreting this correctly:
    1. When you want to return a single item in one variable, you use 'pluck' (e.g., $model = self::where('user_id', $id)->pluck('user_username') returns user_username WHERE user_id = $id)?
    2. When you want to return an array, you use 'get' (e.g., $model = self::where('plugin_enabled', 1)->orderBy('plugin_name')->get(['plugin_name', 'plugin_folder', 'plugin_type']) returns all plugin_name, plugin_folder, and plugin_type of all rows WHERE plugin_enabled = 1)?
    3. The models defined in the /models directory must match the SQL statements in the /models/mdb directory?
    Is the benefit of all this to be able to use re-use the same SQL statements with different data?
     
  14. valMETNG

    valMETNG Administrator Staff Member Admin

    Let me use a more definitive example. In libs/UserInfo.php, you have this:
    Code:
       public function getUserNameFromId($h, $id = 0)
       {
      //$username = \Hotaru\Models\User::getUserNameFromId($id);
      $username = \Hotaru\Models2\User::getUserNameFromId($h, $id);
       
         if ($username) { return $username; } else { return false; }
       }
    In models/User.php, you have this:
    Code:
      public static function getUserNameFromId($id)
      {
      $model = self::where('user_id', $id)->pluck('user_username');
      return $model;
      }
    In models/mdb/User.php, you have this:
    Code:
      public static function getUserNameFromId($h, $id)
      {
      $sql = "SELECT user_username FROM " . TABLE_USERS . " WHERE user_id = %d LIMIT 1";
       $model = $h->db->get_var($h->db->prepare($sql, $id));
     
      return $model;
      }
    In my build, I've added a user_deleted_date to the users table (which gets populated when they delete their account). So I have this, which returns a username of "[deleted]" if they deleted their account:
    Code:
       public function getUserNameFromId($h, $id = 0)
       {
         // store in memory to limit database hits
         if (!isset($h->vars['username_cache'][$id]))
         {
           $sql = "SELECT user_username, user_deleted_date FROM " . TABLE_USERS . " WHERE user_id = %d LIMIT 1";
           $h->vars['username_cache'][$id] = $h->db->get_row($h->db->prepare($sql, $id));
         }
    
         if ($h->vars['username_cache'][$id] && $h->vars['username_cache'][$id]->user_deleted_date == '0000-00-00 00:00:00') { return $h->vars['username_cache'][$id]->user_username; }
         elseif ($h->vars['username_cache'][$id] && $h->vars['username_cache'][$id]->user_deleted_date != '0000-00-00 00:00:00') { return '[deleted]'; }
         else { return false; }
       }
    So I assume I have to change models/User.php to:
    Code:
      public static function getUserNameFromId($id)
      {
      $model = self::where('user_id', $id)->get('user_username', 'user_deleted_date');
      return $model;
      }
    and models/mdb/User.php to:
    Code:
      public static function getUserNameFromId($h, $id)
      {
      $sql = "SELECT user_username, user_deleted_date FROM " . TABLE_USERS . " WHERE user_id = %d LIMIT 1";
       $model = $h->db->get_row($h->db->prepare($sql, $id));
     
      return $model;
      }
    Additionally, I assume that if I was expecting multiple rows, models/User.php would look something like:
    Code:
      public static function getUserNameFromId($id)
      {
      $model = self::where('user_id', $id)->get(array('user_username', 'user_deleted_date'));
      return $model;
      }
    and models/mdb/User.php would look something like:
    Code:
      public static function getUserNameFromId($h, $id)
      {
      $sql = "SELECT user_username, user_deleted_date FROM " . TABLE_USERS . " WHERE user_id = %d LIMIT 1";
       $model = $h->db->get_results($h->db->prepare($sql, $id));
     
      return $model;
      }
    Is that all correct?
     
  15. valMETNG

    valMETNG Administrator Staff Member Admin

    On line 132 of libs/UserInfo.php, I suggest using UPPER because this has the potential to return incorrect results otherwise:
    Code:
    if ($db->get_var($db->prepare("SELECT user_id FROM " . TABLE_USERS . " WHERE UPPER(user_username) = UPPER(%s)  LIMIT 1", $username))) {
    I also suggest doing the same with email on line 139.
     
    Last edited: Dec 19, 2014
    shibuya246 likes this.
  16. valMETNG

    valMETNG Administrator Staff Member Admin

    Shouldn't line 9 of error.php reference the CDN?
    Code:
    <link href="/libs/frameworks/bootstrap3/css/bootstrap.min.css" rel="stylesheet">
     
    shibuya246 likes this.
  17. valMETNG

    valMETNG Administrator Staff Member Admin

    I have to say: going through this code and seeing all of your comments to yourself continues to make me smile. I have these all over my code as well. :)
     
  18. valMETNG

    valMETNG Administrator Staff Member Admin

    Shouldn't the function userExists in libs/UserInfo.php get $h instead of $db, if only for consistency?
     
  19. valMETNG

    valMETNG Administrator Staff Member Admin

    In function doIncludes in Hotaru.php, there are references to various CDN versions (e.g., Bootstrap 3.3.1, Jquery 2.1.1, Summernote 0.5.2, Knockout 3.2.0). You know how often they update these versions and, when they do, it's going to require manually updating the hard-coded values/URLs. Something to consider for future versions is to have a place in admin settings where you can change those on-the-fly (instead of hard-coding the values).

    Additionally, there are admins (myself included) who use CKeditor instead of Summernote. So, for those of us who do, we need to comment out those lines (otherwise, we're loading additional Javascript that we'll never use). So something else to consider putting in admin settings to turn off.
     
  20. valMETNG

    valMETNG Administrator Staff Member Admin

    I'm curious: what functionality are you using Knockout for?
     

Share This Page