diff --git a/codepot/src/codepot/controllers/site.php b/codepot/src/codepot/controllers/site.php index 8d56ee7f..c1e162f9 100644 --- a/codepot/src/codepot/controllers/site.php +++ b/codepot/src/codepot/controllers/site.php @@ -493,15 +493,20 @@ class Site extends Controller $this->load->view ($this->VIEW_LOG, $data); } +/* function userlog ($userid = '', $offset = 0) { + if ($userid != '') + $dec_userid = $this->converter->HexToAscii($userid); + else $dec_userid = $userid; + $login = $this->login->getUser (); $this->load->library ('pagination'); $this->load->model ('LogModel', 'logs'); $this->load->model ('SiteModel', 'sites'); - $site = $this->sites->get ($this->config->config['language']); + $site = $this->sites->get ($this->config->config['language']); if ($site === FALSE) { $data['login'] = $login; @@ -511,7 +516,7 @@ class Site extends Controller } if ($site === NULL && CODEPOT_DEFAULT_SITE_LANGUAGE != '') { - $site = $this->sites->get (CODEPOT_DEFAULT_SITE_LANGUAGE); + $site = $this->sites->get (CODEPOT_DEFAULT_SITE_LANGUAGE); if ($site === FALSE) { $data['login'] = $login; @@ -527,7 +532,7 @@ class Site extends Controller $this->logs->purge (); } - $num_log_entries = $this->logs->getNumEntries ('', $userid); + $num_log_entries = $this->logs->getNumEntries ('', $dec_userid); if ($num_log_entries === FALSE) { $data['login'] = $login; @@ -536,14 +541,14 @@ class Site extends Controller return; } - $pagecfg['base_url'] = site_url() . "/site/userlog/$userid/"; + $pagecfg['base_url'] = site_url() . "/site/userlog/{$userid}/"; $pagecfg['total_rows'] = $num_log_entries; $pagecfg['per_page'] = CODEPOT_MAX_LOGS_PER_PAGE; $pagecfg['uri_segment'] = 4; $pagecfg['first_link'] = $this->lang->line('First'); $pagecfg['last_link'] = $this->lang->line('Last'); - $log_entries = $this->logs->getEntries ($offset, $pagecfg['per_page'], '', $userid); + $log_entries = $this->logs->getEntries ($offset, $pagecfg['per_page'], '', $dec_userid); if ($log_entries === FALSE) { $data['login'] = $login; @@ -561,6 +566,7 @@ class Site extends Controller $this->load->view ($this->VIEW_LOG, $data); } +*/ function wiki ($xlink = '') { diff --git a/codepot/src/codepot/controllers/user.php b/codepot/src/codepot/controllers/user.php index ff3e2255..7f44c13a 100644 --- a/codepot/src/codepot/controllers/user.php +++ b/codepot/src/codepot/controllers/user.php @@ -37,6 +37,7 @@ class User extends Controller } if ($userid == '') $userid = $login['id']; + else $userid = $this->converter->HexToAscii ($userid); if ($userid == '') { redirect ('site/home'); @@ -63,6 +64,7 @@ class User extends Controller { $data['login'] = $login; $data['projects'] = $projects; + $data['target_userid'] = $userid; $data['issues'] = $issues; $data['issue_type_array'] = $this->issuehelper->_get_type_array($this->lang); $data['issue_status_array'] = $this->issuehelper->_get_status_array($this->lang); @@ -71,48 +73,18 @@ class User extends Controller } } - function issue () + function log ($userid = '', $offset = 0) { $login = $this->login->getUser (); - if (CODEPOT_SIGNIN_COMPULSORY && $login['id'] == '') - redirect ('main/signin'); - - if ($login['id'] == '') + if (CODEPOT_SIGNIN_COMPULSORY && $login['id'] == '') { - redirect ('site/home'); + redirect ('main/signin'); return; } - $this->load->library ('IssueHelper', 'issuehelper'); - $this->lang->load ('issue', CODEPOT_LANG); - - $this->load->model ('ProjectModel', 'projects'); - $this->load->model ('IssueModel', 'issues'); - - $issues = $this->issues->getMyIssues ( - $login['id'], $this->issuehelper->_get_open_status_array($this->lang)); - if ($issues === FALSE) - { - $data['login'] = $login; - $data['message'] = 'DATABASE ERROR'; - $this->load->view ($this->VIEW_ERROR, $data); - } - else - { - $data['login'] = $login; - $data['issues'] = $issues; - $data['issue_type_array'] = $this->issuehelper->_get_type_array($this->lang); - $data['issue_status_array'] = $this->issuehelper->_get_status_array($this->lang); - $data['issue_priority_array'] = $this->issuehelper->_get_priority_array($this->lang); - $this->load->view ($this->VIEW_ISSUE, $data); - } - } - - function log ($offset = 0) - { - $login = $this->login->getUser (); - - if ($login['id'] == '') + if ($userid == '') $userid = $login['id']; + else $userid = $this->converter->HexToAscii ($userid); + if ($userid == '') { redirect ('site/home'); return; @@ -121,9 +93,10 @@ class User extends Controller $this->load->model ('ProjectModel', 'projects'); $user = new stdClass(); - $user->id = $login['id']; + $user->id = $userid; + $user->xid = $this->converter->AsciiToHex($userid); - $myprojs = $this->projects->getMyProjects ($login['id']); + $myprojs = $this->projects->getMyProjects ($user->id); if ($myprojs === FALSE) { $data['login'] = $login; @@ -145,7 +118,7 @@ class User extends Controller for ($i = 0; $i < $numprojs; $i++) $projids[$i] = $myprojs[$i]->id; - $num_log_entries = $this->logs->getNumEntries ($projids); + $num_log_entries = $this->logs->getNumEntries ($projids, $userid); if ($num_log_entries === FALSE) { $data['login'] = $login; @@ -155,14 +128,14 @@ class User extends Controller return; } - $pagecfg['base_url'] = site_url() . "/user/log/"; + $pagecfg['base_url'] = site_url() . "/user/log/{$user->xid}/"; $pagecfg['total_rows'] = $num_log_entries; $pagecfg['per_page'] = CODEPOT_MAX_LOGS_PER_PAGE; - $pagecfg['uri_segment'] = 3; + $pagecfg['uri_segment'] = 4; $pagecfg['first_link'] = $this->lang->line('First'); $pagecfg['last_link'] = $this->lang->line('Last'); - - $log_entries = $this->logs->getEntries ($offset, $pagecfg['per_page'], $projids); + + $log_entries = $this->logs->getEntries ($offset, $pagecfg['per_page'], $projids, $userid); if ($log_entries === FALSE) { $data['login'] = $login; @@ -290,7 +263,6 @@ class User extends Controller function icon ($userid = '') { - // TODO: ETag, If-None-Match??? $userid_len = strlen($userid); if ($userid_len > 0) { diff --git a/codepot/src/codepot/models/ldaploginmodel.php b/codepot/src/codepot/models/ldaploginmodel.php index 12e848c1..ad99f6b1 100644 --- a/codepot/src/codepot/models/ldaploginmodel.php +++ b/codepot/src/codepot/models/ldaploginmodel.php @@ -240,11 +240,10 @@ class LdapLoginModel extends LoginModel } $email = ''; - if (CODEPOT_LDAP_MAIL_ATTRIBUTE_NAME != '') { - $filter = '(' . CODEPOT_LDAP_MAIL_ATTRIBUTE_NAME . '=*)'; - $r = @ldap_search ($ldap, $f_userid, $filter, array(CODEPOT_LDAP_MAIL_ATTRIBUTE_NAME)); + $filter = '(objectClass=*)'; + $r = @ldap_read ($ldap, $f_userid, $filter, array(CODEPOT_LDAP_MAIL_ATTRIBUTE_NAME)); if ($r !== FALSE) { $e = @ldap_get_entries($ldap, $r); diff --git a/codepot/src/codepot/models/logmodel.php b/codepot/src/codepot/models/logmodel.php index 7995e9cd..cc57dfff 100644 --- a/codepot/src/codepot/models/logmodel.php +++ b/codepot/src/codepot/models/logmodel.php @@ -66,7 +66,6 @@ class LogModel extends Model $commits = array (); foreach ($result as $row) { - /* $row->project must be equal to $repo */ $commits[$count]['createdon'] = $row->createdon; $commits[$count]['type'] = $row->type; diff --git a/codepot/src/codepot/views/Makefile.am b/codepot/src/codepot/views/Makefile.am index 2edfde34..ee5bcdff 100644 --- a/codepot/src/codepot/views/Makefile.am +++ b/codepot/src/codepot/views/Makefile.am @@ -30,7 +30,6 @@ www_DATA = \ site_show.php \ taskbar.php \ user_home.php \ - user_issue.php \ user_settings.php \ wiki_edit.php \ wiki_editx.php \ diff --git a/codepot/src/codepot/views/Makefile.in b/codepot/src/codepot/views/Makefile.in index 275fc6dc..43ee5023 100644 --- a/codepot/src/codepot/views/Makefile.in +++ b/codepot/src/codepot/views/Makefile.in @@ -175,7 +175,6 @@ www_DATA = \ site_show.php \ taskbar.php \ user_home.php \ - user_issue.php \ user_settings.php \ wiki_edit.php \ wiki_editx.php \ diff --git a/codepot/src/codepot/views/log.php b/codepot/src/codepot/views/log.php index ba899c54..b1bdc533 100644 --- a/codepot/src/codepot/views/log.php +++ b/codepot/src/codepot/views/log.php @@ -66,6 +66,7 @@ $(function () { if (isset($project)) { $pagetype = 'project'; + $pageobjname = 'project'; $pageid = ''; $pageobj = $project; $banner = NULL; @@ -75,6 +76,7 @@ else if (isset($site)) if ($login['sysadmin?']) { $pagetype = 'site'; + $pageobjname = 'site'; $pageid = 'log'; $pageobj = $site; $banner = NULL; @@ -82,6 +84,7 @@ else if (isset($site)) else { $pagetype = ''; + $pageobjname = ''; $pageid = ''; $pageobj = NULL; $banner = $site->name; @@ -90,31 +93,35 @@ else if (isset($site)) else if (isset($user)) { $pagetype = 'user'; + $pageobjname = 'user'; $pageid = ''; $pageobj = $user; $banner = NULL; + + if ($user->id != $login['id']) $pagetype = 'user-other'; } else { $pagetype = ''; + $pageobjname = ''; $pageid = ''; $pageobj = NULL; $banner = NULL; } $this->load->view ( - 'projectbar', - array ( + 'projectbar', + array ( 'banner' => $banner, 'page' => array ( 'type' => $pagetype, 'id' => $pageid, - $pagetype => $pageobj + $pageobjname => $pageobj ), - 'ctxmenuitems' => array () - ) + 'ctxmenuitems' => array () + ) ); ?> @@ -205,6 +212,8 @@ $this->load->view ( print ''; print ''; + + $xauthor = $this->converter->AsciiToHex ($code['author']); if ($log['action'] == 'revpropchange') { $fmt = $this->lang->line ('MSG_LOG_REVPROP_CHANGE_BY'); @@ -212,7 +221,7 @@ $this->load->view ( printf ( htmlspecialchars ($fmt), htmlspecialchars ($code['propname']), - anchor ("/site/userlog/{$code['author']}", htmlspecialchars ($code['author']))); + anchor ("/user/log/{$xauthor}", htmlspecialchars ($code['author']))); //$code['action'] } else @@ -223,7 +232,7 @@ $this->load->view ( //print htmlspecialchars (sprintf($fmt, $code['author'])); printf ( htmlspecialchars ($fmt), - anchor ("/site/userlog/{$code['author']}", htmlspecialchars ($code['author']))); + anchor ("/user/log/{$xauthor}", htmlspecialchars ($code['author']))); } print ''; @@ -278,7 +287,8 @@ $this->load->view ( $fmt = $this->lang->line ( 'MSG_LOG_'.strtoupper($log['action']).'_BY'); - printf ($fmt, anchor ("/site/userlog/{$log['userid']}", htmlspecialchars($log['userid']))); + $xuserid = $this->converter->AsciiToHex($log['userid']); + printf ($fmt, anchor ("/user/log/{$xuserid}", htmlspecialchars($log['userid']))); print ''; } diff --git a/codepot/src/codepot/views/project_home.php b/codepot/src/codepot/views/project_home.php index 26eaa381..951a06de 100644 --- a/codepot/src/codepot/views/project_home.php +++ b/codepot/src/codepot/views/project_home.php @@ -176,7 +176,12 @@ $this->load->view ( print "
  • {$icon_src}{$m}
  • "; */ $user_icon_url = codepot_merge_path (site_url(), '/user/icon/' . $this->converter->AsciiToHex($m)); - print "
  • {$m}
  • "; + //print "
  • {$m}
  • "; + $user_home_url = "/user/home/" . $this->converter->AsciiToHex($m); + print "
  • "; + print anchor ($user_home_url, "{$m}"); + print "
  • "; + } ?> diff --git a/codepot/src/codepot/views/projectbar.php b/codepot/src/codepot/views/projectbar.php index 7942a823..16757272 100644 --- a/codepot/src/codepot/views/projectbar.php +++ b/codepot/src/codepot/views/projectbar.php @@ -37,9 +37,9 @@ function show_projectbar ($con, $banner, $page, $ctxmenuitems) $site = $page[$type]; print htmlspecialchars($site->name); } - else if ($type == 'user') + else if ($type == 'user' || $type == 'user-other') { - $user = $page[$type]; + $user = $page['user']; print htmlspecialchars($user->id); } else print htmlspecialchars(CODEPOT_DEFAULT_SITE_NAME); @@ -123,8 +123,8 @@ function show_projectbar ($con, $banner, $page, $ctxmenuitems) else if ($type == 'user') { $menuitems = array ( - array ("user/home", $con->lang->line('Overview')), - array ("user/log", $con->lang->line('Log')), + array ("user/home/{$user->xid}", $con->lang->line('Overview')), + array ("user/log/{$user->xid}", $con->lang->line('Log')), array ("user/settings", $con->lang->line('Settings')) ); @@ -137,6 +137,22 @@ function show_projectbar ($con, $banner, $page, $ctxmenuitems) print anchor ($menulink, $item[1], $extra); } } + else if ($type == 'user-other') + { + $menuitems = array ( + array ("user/home/{$user->xid}", $con->lang->line('Overview')), + array ("user/log/{$user->xid}", $con->lang->line('Log')) + ); + + foreach ($menuitems as $item) + { + $menuid = substr ($item[0], strpos($item[0], '/') + 1); + $extra = ($menuid == $id)? 'class="selected button"': 'class="button"'; + $menulink = $item[0]; + + print anchor ($menulink, $item[1], $extra); + } + } else print ' '; print ''; diff --git a/codepot/src/codepot/views/site_home.php b/codepot/src/codepot/views/site_home.php index d25d372f..2ecc809d 100644 --- a/codepot/src/codepot/views/site_home.php +++ b/codepot/src/codepot/views/site_home.php @@ -392,23 +392,25 @@ $this->load->view ( print ''; print ''; + $xauthor = $this->converter->AsciiToHex($x['author']); + if ($log['action'] == 'revpropchange') { $fmt = $this->lang->line ('MSG_LOG_REVPROP_CHANGE_BY'); //print htmlspecialchars (sprintf($fmt, $x['propname'], $x['author'])); + printf ( htmlspecialchars ($fmt), htmlspecialchars ($x['propname']), - anchor ("/site/userlog/{$x['author']}", htmlspecialchars ($x['author']))); + anchor ("/user/log/{$xauthor}", htmlspecialchars ($x['author']))); } else { $fmt = $this->lang->line ( 'MSG_LOG_'.strtoupper($log['action']).'_BY'); - //print htmlspecialchars (sprintf($fmt, $x['author'])); printf ( htmlspecialchars ($fmt), - anchor ("/site/userlog/{$x['author']}", htmlspecialchars ($x['author']))); + anchor ("/user/log/{$xauthor}", htmlspecialchars ($x['author']))); } print ''; @@ -474,10 +476,10 @@ $this->load->view ( print ''; $fmt = $this->lang->line ( 'MSG_LOG_'.strtoupper($log['action']).'_BY'); - //print htmlspecialchars (sprintf($fmt, $log['userid'])); + $xuserid = $this->converter->AsciiToHex ($log['userid']); printf ( htmlspecialchars ($fmt), - anchor ("/site/userlog/{$log['userid']}", htmlspecialchars ($log['userid']))); + anchor ("/user/log/{$xuserid}", htmlspecialchars ($log['userid']))); print ''; print ''; diff --git a/codepot/src/codepot/views/user_home.php b/codepot/src/codepot/views/user_home.php index a33b01a0..a1ae12c8 100644 --- a/codepot/src/codepot/views/user_home.php +++ b/codepot/src/codepot/views/user_home.php @@ -41,7 +41,17 @@ $(function () { id = $login['id']; +if ($target_userid == $login['id']) +{ + $user->id = $login['id']; + $projectbar_type = 'user'; +} +else +{ + $user->id = $target_userid; + $projectbar_type = 'user-other'; +} +$user->xid = $this->converter->AsciiTohex($user->id); $this->load->view ( 'projectbar', @@ -49,7 +59,7 @@ $this->load->view ( 'banner' => NULL, 'page' => array ( - 'type' => 'user', + 'type' => $projectbar_type, 'id' => 'issues', 'user' => $user, ), diff --git a/codepot/src/codepot/views/user_issue.php b/codepot/src/codepot/views/user_issue.php deleted file mode 100644 index 3018b277..00000000 --- a/codepot/src/codepot/views/user_issue.php +++ /dev/null @@ -1,133 +0,0 @@ - - -projectid, $issues_by_projects)) - $issues_by_projects[$issue->projectid] = array(); - - $arr = &$issues_by_projects[$issue->projectid]; - array_push ($arr, $issue); - - $unique_projects = array_keys ($issues_by_projects); -} -?> - - - - - - - - - - - - - - - -<?php print htmlspecialchars($login['id'])?> - - - - -
    - - - -load->view ('taskbar'); ?> - - - -id = $login['id']; - -$this->load->view ( - 'projectbar', - array ( - 'banner' => NULL, - - 'page' => array ( - 'type' => 'user', - 'id' => 'issues', - 'user' => $user, - ), - - 'ctxmenuitems' => array () - ) -); -?> - - - -
    - -
    - -
    - - ', $i); - $issues = &$issues_by_projects[$unique_projects[$i]]; - - printf ('
    %s
    ', htmlspecialchars($unique_projects[$i])); - print '
      '; - foreach ($issues as $issue) - { - $pro = $issue->projectid; - $xid = $this->converter->AsciiToHex ((string)$issue->id); - - $anc = anchor ("issue/show/{$issue->projectid}/{$xid}", '#' . htmlspecialchars($issue->id)); - - $status = htmlspecialchars( - array_key_exists($issue->status, $issue_status_array)? - $issue_status_array[$issue->status]: $issue->status); - $type = htmlspecialchars( - array_key_exists($issue->type, $issue_type_array)? - $issue_type_array[$issue->type]: $issue->type); - - $sum = htmlspecialchars ($issue->summary); - print "
    • {$pro} {$anc} {$type} {$status} - {$sum}
    • "; - } - print '
    '; - print '
    '; - } - ?> - -
    - -
    - -
    - - - - - - - -load->view ('footer'); ?> - - - - - - - - diff --git a/codepot/src/codepot/views/user_settings.php b/codepot/src/codepot/views/user_settings.php index dc7e7a07..880bee4b 100644 --- a/codepot/src/codepot/views/user_settings.php +++ b/codepot/src/codepot/views/user_settings.php @@ -29,6 +29,7 @@ id = $login['id']; +$user->xid = $this->converter->AsciiToHex($user->id); $this->load->view ( 'projectbar',