Page 1 of 1

Popup not working on daynotes when username have an dot(.)

Posted: 2015-03-01, 15:27
by nobrell
Thanks for a great utility!
Our Company with 80 users have been using it daily since 2004 :)
My former colleague installed and modified it then, and now 15 years later I have gone through the painstaking task of "updating" it to the latest version since the code it getting very old and I fair we will get some issues down the line.
Basically I have done a new installation and only transferred the users since so much have changed and been added.
I have also translated most part of the userinterface to Swedish.

Anyway I have been able to get everything to work accept the daynote and user popup information.
This is due to the fact that we are using a dot(.) in the user name for intace mickey.mouse.
I know this is not allowed but we have it in everywhere other system and it worked in the old old version too.
Everything else works so i suspect that it is "simple" fix somewhere deep in your php code.
I have tried to solve it on my own but haven't been able to crack it, so I was hoping that you where able to help me out :)
I have done a new clean installation that I have played around with.
I have found that its the Tipsy javascript that is used for the popup in conjunction with jQuery.
I have updated jQuery to 2.1.3 but the problem remain.
There is no new version of the Tipsy script.
However I´m now convinced that the problem isn't the javascript instead it seems to fail to get the information from MySQL when there is a dot.
It works for instance with underscore (_)
I suspect that somewhere there should be backticks (`) instead of (') when calling on username
I have found 55 hits in 21 files (see below) for 'username' in the TC Pro code so I was kind of hoping that you where able to find the right one...
The old version we had wasn't using Tipsy so it worked before.

Below is a couple of other things that I have noticed when playing around and trying to solve the problem which might be helpful for you to know.
This is tested on a clean installation of 3.6.17 with the sample data.
- Popup is not showing if you have a letter as absence, for instance S for sick. It only works if its an icon. (I solved it by creating icons with the letters...)
This seems to work in the year view but not in the main month calender.
- my_tc_absences is missing the bgtransparent table in row 7 in the sample data, so there is an error when trying to change and/or save. Works fine when its added.
-There is some issues with the sorting when using other letters than A-Z, the Swedish alphabet have ÅÄÖ at the end. I know its a pain but still and issue that worked in the old version. For instance names like Pelle Jöns gest sorted as an o instead of ö. Worse is if the first letter in the last name is Å,Ä or Ö. For instance Pelle Örn is placed first at the very top when is should be last. Difficult to figure out if is php and or MySQL or the code itself that is causing these problems.

- I noticed that you have added the possible to easily change moth when you edit a user calender, it would be absolutely great to have that function in the main view
ChangeMonth_TCpro.png (1.99 KiB) Viewed 1999 times
Again thanks for a great utility and I really hope that you are able to share some light on the daynote issue that would be extremely helpful if we could get it to work again.

Code: Select all

Search "'username'" (55 hits in 21 files)
  Root\addprofile.php (1 hit)
	Line 70:    $username = trim($_POST['username']);
  Root\models\allowance_model.php (1 hit)
	Line 195:             $this->username = $row['username'];
  Root\models\daynote_model.php (4 hits)
	Line 207:             $this->username = $row['username'];
	Line 237:             while($row = $this->db->db_fetch_array($result)) $this->daynotes[$row['username']][$row['yyyymmdd']] = stripslashes($row['daynote']);
	Line 266:             while($row = $this->db->db_fetch_array($result)) $this->daynotes[$row['username']][$row['yyyymmdd']] = stripslashes($row['daynote']);
	Line 291:             $this->username = $row['username'];
  Root\editcalendar.php (2 hits)
	Line 892:                $UT->findByName($row2['username']);
	Line 1141:                $U->findByName($u['username']);
  Root\editprofile.php (2 hits)
	Line 66: if (isset($_REQUEST['username'])) $U->findByName(stripslashes($_REQUEST['username']));
	Line 66: if (isset($_REQUEST['username'])) $U->findByName(stripslashes($_REQUEST['username']));
  Root\languages\english.tcpro.php (1 hit)
	Line 728: $LANG['register_username'] = 'Username';
  Root\helpers\global_helper.php (1 hit)
	Line 1976:             'username' => $username,
  Root\groupassign.php (1 hit)
	Line 261:                $U->findByName($row['username']);
  Root\login.php (2 hits)
	Line 77:             if ( $UO->true($usr['username'],"showbirthday") ) {
	Line 78:                if($UO->true($usr['username'],"ignoreage")) {
  Root\message.php (4 hits)
	Line 132:             while ( $row = $U->db->db_fetch_array($result,MYSQL_ASSOC) ) $UA->assign($tstamp,$row['username']);
	Line 141:             while ( $row = $U->db->db_fetch_array($result,MYSQL_ASSOC) ) $UA->assign($tstamp,$row['username']);
	Line 261:                            if ( isset($user) && $user!=$row['username'] ) {
	Line 264:                               <option class="option" value="<?=$row['username']?>"><?=$showname?></option>
  Root\includes\options_showyear_inc.php (4 hits)
	Line 54:       if ($usr['username']==$luser) {
	Line 57:       else if ( !($usr['status']&$CONF['USHIDDEN']) AND $UG->shareGroups($usr['username'], $luser) ) {
	Line 74:          <option class="option" value="<?=$usr['username']?>" <?=(($selectedUser==$usr['username'])?'SELECTED':'')?>><?=$showname?></option>
	Line 74:          <option class="option" value="<?=$usr['username']?>" <?=(($selectedUser==$usr['username'])?'SELECTED':'')?>><?=$showname?></option>
  Root\includes\options_statisticsu_inc.php (2 hits)
	Line 41:       <option value="<?=$row['username']?>" <?=(($statuser==$row['username'])?'SELECTED':'')?>><?=$row['lastname']?>, <?=$row['firstname']?></option>
	Line 41:       <option value="<?=$row['username']?>" <?=(($statuser==$row['username'])?'SELECTED':'')?>><?=$row['lastname']?>, <?=$row['firstname']?></option>
  Root\helpers\showmonth_helper.php (5 hits)
	Line 613: 	            $users[$i]['user']=$row['username'];
	Line 643: 	            $users[$i]['user']=$row['username'];
	Line 678: 	            $users[$i]['user']=$row['username'];
	Line 712: 	            $users[$i]['user']=$row['username'];
	Line 753:             $users[$i]['user']=$row['username'];
  Root\showyear.php (5 hits)
	Line 108:          if ($yu['username']==$luser) {
	Line 110:             $showuser=$yu['username'];
	Line 113:          else if ( !($yu['status']&$CONF['USHIDDEN']) AND $UG->shareGroups($yu['username'], $luser) ) {
	Line 116:                $showuser=$yu['username'];
	Line 123:                $showuser=$yu['username'];
  Root\models\template_model.php (2 hits)
	Line 287:             $this->username = $row['username'];
	Line 316:             $this->username = $row['username'];
  Root\upgrade35-36.php (4 hits)
	Line 265:       $username = $row['username'];
	Line 271:       print "<li>Migrated old allowance entry '".$row['username']."|".$row['abssym']."|".$row['lastyear']."|".$row['curryear']."' into '".$username."|".$absid."|".$lastyear."|".$curryear."'</li>";
	Line 343:       $username = $row['username'];
	Line 363:       $output="<li>Migrated old template for '".$row['username']."|".$row['year']."|".$row['month']."|".$row['template']."' ===>  ".$username."|".$year."|".$month."||";
  Root\models\user_group_model.php (4 hits)
	Line 143:             $uarray[] = $row['username'];
	Line 214:          while ( $row=$this->db->db_fetch_array($result) ) $gmarray[$row['groupname']] = $row['username'];
	Line 283:             $this->username = $row['username'];
	Line 384:             $this->username = $row['username'];
  Root\models\user_model.php (2 hits)
	Line 209:             $this->username = stripslashes($row['username']);
	Line 321:          while ( $row=$this->db->db_fetch_array($result) ) $unamearray[] = $row['username'];
  Root\userlist.php (3 hits)
	Line 386:                                     if (!$UG->isMemberOfGroup($row['username'],$searchgroup)) continue;
	Line 389:                                  $U->findByName($row['username']);
	Line 560:                                  $U1->findByName($rowa['username'], TRUE);
  Root\verify.php (3 hits)
	Line 47: if (!isset ($_REQUEST['verify']) || !isset ($_REQUEST['username']) || strlen($_REQUEST['verify'])<>32 || !in_array($_REQUEST['username'],$U->getUsernames()) ) {
	Line 47: if (!isset ($_REQUEST['verify']) || !isset ($_REQUEST['username']) || strlen($_REQUEST['verify'])<>32 || !in_array($_REQUEST['username'],$U->getUsernames()) ) {
	Line 55:    $ruser = trim($_REQUEST['username']);
  Root\viewprofile.php (2 hits)
	Line 56: if ( isset($_REQUEST['username']) ) $req_username = $_REQUEST['username'];
	Line 56: if ( isset($_REQUEST['username']) ) $req_username = $_REQUEST['username'];

Re: Popup not working on daynotes when username have an dot(

Posted: 2015-03-02, 01:07
by nobrell
Is it possibly somewhere in these line something goes wrong when reading the daynotes when the username have an dot(.) ?

rad 243-271 i daynote_model.php

Code: Select all

      // ---------------------------------------------------------------------
       * Find all daynotes for all users in a given month and load them in daynotes array
       * @param string $yyyy      Year to find
       * @param string $mm        Month to find
       * @param string $days      Number of days in month (used to set end date)
       * @param string $usernames Array of usernames to find
       * @param string $region    Region to find
      function findAllByMonth($yyyy='', $mm='', $days='', $usernames, $region='default') 
         $rc = 0;
         if ($days < 10) $days = '0' + "0".strval($days);
         $startdate = $yyyy.$mm.'01';
         $enddate = $yyyy.$mm.$days;
         $query  = "SELECT * FROM `".$this->table."` ";
         $query .= "WHERE `yyyymmdd` BETWEEN '".$startdate."' AND '".$enddate."' ";
         $query .= "AND username IN('".$usernames."')";
         $query .= "AND `region` = '".$region."'";
         $result = $this->db->db_query($query);
         if ($this->db->db_numrows($result) > 0) 
            while($row = $this->db->db_fetch_array($result)) $this->daynotes[$row['username']][$row['yyyymmdd']] = stripslashes($row['daynote']);
            $rc = 1;
         $this->count = $this->db->db_numrows($result);
         return $rc;

Re: Popup not working on daynotes when username have an dot(

Posted: 2015-03-04, 17:24
by George
Hi nobrell
I regsitered the issue here: