Changeset 1324 in ExiteCMS for modules/ExiteCMS/tracsvn/php-files/modules/tracsvn/admin.php
- Timestamp:
- 02/28/08 15:19:38 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
modules/ExiteCMS/tracsvn/php-files/modules/tracsvn/admin.php
r1320 r1324 25 25 26 26 if (isset($_POST['savesettings'])) { 27 27 28 // extract and validate the input 28 29 $database = stripinput($_POST['database']); … … 31 32 $auth = stripinput($_POST['auth']); 32 33 $extensions = stripinput($_POST['extensions']); 34 $view_svn = isNum($_POST['view_svn']) ? $_POST['view_svn'] : 102; 35 $view_diff = isNum($_POST['view_diff']) ? $_POST['view_diff'] : 102; 36 $view_file = isNum($_POST['view_file']) ? $_POST['view_file'] : 102; 37 33 38 $variables['message'] = ""; 34 39 35 40 // check if the database exists and is a Trac database 36 41 if (empty($database) || !dbtable_exists("revision", $database)) { … … 65 70 } 66 71 } 72 67 73 // if no errors are found, update 68 74 if ($variables['message'] == "") { … … 72 78 $result = dbquery("UPDATE ".$db_prefix."configuration SET cfg_value = '".$auth."' WHERE cfg_name = 'tracsvn_svnauth'"); 73 79 $result = dbquery("UPDATE ".$db_prefix."configuration SET cfg_value = '".$extensions."' WHERE cfg_name = 'tracsvn_extensions'"); 80 $result = dbquery("UPDATE ".$db_prefix."configuration SET cfg_value = '".$view_svn."' WHERE cfg_name = 'tracsvn_view_svn'"); 81 $result = dbquery("UPDATE ".$db_prefix."configuration SET cfg_value = '".$view_diff."' WHERE cfg_name = 'tracsvn_view_diff'"); 82 $result = dbquery("UPDATE ".$db_prefix."configuration SET cfg_value = '".$view_file."' WHERE cfg_name = 'tracsvn_view_file'"); 74 83 redirect(FUSION_SELF.$aidlink); 75 84 } 85 86 } elseif (isset($_POST['savealias'])) { 87 88 // process the selection 89 foreach($_POST['username'] as $idx => $user_id) { 90 if ($user_id) { 91 if ($_POST['orgmap'][$idx]) { 92 // update of a previous mapping 93 $result = dbquery("UPDATE ".$db_prefix."tracsvn_alias SET tracsvn_userid = '".$user_id."' WHERE tracsvn_username = '".stripinput($_POST['tracuser'][$idx])."'"); 94 } else { 95 // new mapping 96 $result = dbquery("INSERT INTO ".$db_prefix."tracsvn_alias (tracsvn_userid, tracsvn_username) VALUES ('".$user_id."', '".stripinput($_POST['tracuser'][$idx])."')"); 97 } 98 } else { 99 // no mapping for this trac user 100 $result = dbquery("DELETE FROM ".$db_prefix."tracsvn_alias WHERE tracsvn_username = '".stripinput($_POST['tracuser'][$idx])."'"); 101 } 102 } 103 redirect(FUSION_SELF.$aidlink); 104 76 105 } else { 106 107 // populate the fields for the settings panel 77 108 $database = $settings['tracsvn_database']; 78 109 $url = $settings['tracsvn_url']; … … 80 111 $auth = $settings['tracsvn_svnauth']; 81 112 $extensions = $settings['tracsvn_extensions']; 113 $view_svn = $settings['tracsvn_view_svn']; 114 $view_diff = $settings['tracsvn_view_diff']; 115 $view_file = $settings['tracsvn_view_file']; 116 117 // get the list of user groups 118 $groups = getusergroups(); 119 $variables['usergroups'] = array(); 120 foreach ($groups as $group) { 121 $variables['usergroups'][] = $group; 122 } 123 124 // get the information for the alias panel 125 $tracusers = array(); 126 127 // if we have a valid Trac database configured... 128 if (!empty($database) && dbtable_exists("revision", $database)) { 129 // get the trac user accounts from the ticket table 130 $result = dbquery("SELECT DISTINCT owner, reporter FROM ".$settings['tracsvn_database'].".ticket"); 131 while ($data = dbarray($result)) { 132 // add it to the users array, if not already present 133 if (!in_array($data['owner'], $tracusers)) { 134 $tracusers[] = $data['owner']; 135 } 136 if (!in_array($data['reporter'], $tracusers)) { 137 $tracusers[] = $data['reporter']; 138 } 139 } 140 141 // get the trac user accounts from the revisions table 142 $result = dbquery("SELECT DISTINCT author FROM ".$settings['tracsvn_database'].".revision"); 143 while ($data = dbarray($result)) { 144 // add it to the users array, if not already present 145 if (!in_array($data['author'], $tracusers)) { 146 $tracusers[] = $data['author']; 147 } 148 } 149 150 // sort the users 151 sort($tracusers); 152 } 153 154 // get the alias mapping for this users 155 $variables['aliases'] = array(); 156 foreach($tracusers as $tracuser) { 157 $result = dbquery("SELECT t.*, u.user_name FROM ".$db_prefix."tracsvn_alias t, ".$db_prefix."users u WHERE t.tracsvn_userid = u.user_id AND tracsvn_username = '$tracuser'"); 158 if (dbrows($result)) { 159 $data = dbarray($result); 160 $variables['aliases'][] = array('tracuser' => $tracuser, 'user_id' => $data['tracsvn_userid'], 'user_name' => $data['user_name']); 161 } else { 162 $variables['aliases'][] = array('tracuser' => $tracuser, 'user_id' => 0, 'user_name' => ""); 163 } 164 } 165 166 // get the list of all users for the dropdown 167 $variables['members'] = array(); 168 $result = dbquery("SELECT user_id, user_name FROM ".$db_prefix."users WHERE user_status = '0' ORDER BY user_name"); 169 while ($data = dbarray($result)) { 170 $variables['members'][] = $data; 171 } 82 172 } 83 173 //_debug($variables, true); 84 174 // store the variables 85 175 $variables['database'] = $database; … … 88 178 $variables['auth'] = $auth; 89 179 $variables['extensions'] = $extensions; 180 $variables['view_svn'] = $view_svn; 181 $variables['view_diff'] = $view_diff; 182 $variables['view_file'] = $view_file; 90 183 91 184 // define the body panel variables
Note: See TracChangeset
for help on using the changeset viewer.
