Changeset 11889
- Timestamp:
- 08/30/07 17:15:54 (1 year ago)
- Files:
-
- trunk/midcom/midcom.core/midcom.php (modified) (2 diffs)
- trunk/midcom/midcom.core/midcom/application.php (modified) (1 diff)
- trunk/midcom/midcom.core/midcom/baseclasses/core/dbobject.php (modified) (1 diff)
- trunk/midcom/midcom.core/midcom/services/auth/sessionmgr.php (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/midcom/midcom.core/midcom.php
r11872 r11889 158 158 require('midcom/services/rcs.php'); 159 159 160 160 mgd_debug_start(); 161 161 ///////////////////////////////////// 162 162 // Instantinate the MidCOM main class … … 164 164 165 165 $_MIDCOM = new midcom_application(); 166 $GLOBALS['midcom'] =& $_MIDCOM;166 //$GLOBALS['midcom'] =& $_MIDCOM; 167 167 $_MIDCOM->initialize(); 168 168 ?> trunk/midcom/midcom.core/midcom/application.php
r11883 r11889 1322 1322 { 1323 1323 $host_name = $this->get_host_name(); 1324 $host = new midcom_db_host($_MIDGARD['host']); 1325 $host_prefix = $host->prefix; 1324 $host_prefix = $_MIDGARD['prefix']; 1326 1325 if ($host_prefix == '') 1327 1326 { trunk/midcom/midcom.core/midcom/baseclasses/core/dbobject.php
r11359 r11889 1198 1198 function _list_parameters_domain(&$object, $domain) 1199 1199 { 1200 debug_push_class($object, __FUNCTION__); 1200 $mc = new midgard_collector('midgard_parameter', 'parentguid', $object->guid); 1201 $mc->add_constraint('domain', '=', $domain); 1202 $mc->set_key_property('name'); 1203 $mc->add_value_property('value'); 1201 1204 1202 // TODO: Switch to collector 1203 $query = new midgard_query_builder('midgard_parameter'); 1204 $query->add_constraint('parentguid', '=', $object->guid); 1205 $query->add_constraint('domain', '=', $domain); 1206 1207 // Temporary workaround for missing delete support 1208 $query->add_constraint('value', '<>', ''); 1209 1210 $result = @$query->execute(); 1211 1212 if (count($result) == 0) 1213 { 1214 debug_add("Cannot retrieve the parameter {$domain} for {$object->__table__} ID {$object->id}; query execution failed, this is most probably an empty resultset.", 1215 MIDCOM_LOG_DEBUG); 1216 debug_pop(); 1217 return Array(); 1218 } 1219 $return = Array(); 1220 1221 foreach ($result as $parameter) 1222 { 1223 $return[$parameter->name] = $parameter->value; 1224 } 1225 1226 debug_pop(); 1227 return $return; 1205 $mc->execute(); 1206 1207 $results = array(); 1208 1209 $params = $mc->list_keys(); 1210 foreach ($params as $name => $param) 1211 { 1212 $results[$name] = $mc->get_subkey($name, 'value'); 1213 } 1214 1215 return $results; 1228 1216 } 1229 1217 trunk/midcom/midcom.core/midcom/services/auth/sessionmgr.php
r11359 r11889 114 114 { 115 115 debug_push_class(__CLASS__, __FUNCTION__); 116 debug_add('Failed to create a new login session:' . mgd_errstr(), MIDCOM_LOG_ERROR); 117 debug_print_r('Object was:', $session); 116 debug_add('Failed to create a new login session: ' . mgd_errstr(), MIDCOM_LOG_ERROR); 118 117 debug_pop(); 119 118 return false; … … 152 151 function load_login_session($sessionid, $user, $clientip = null) 153 152 { 154 debug_push_class(__CLASS__, __FUNCTION__);155 156 153 if ($clientip === null) 157 154 { … … 165 162 if (! $result) 166 163 { 164 debug_push_class(__CLASS__, __FUNCTION__); 167 165 debug_add('No login sessions have been found in the database or the query to the database failed.', MIDCOM_LOG_INFO); 168 debug_add('Last Midgard Error:', mgd_errstr());169 166 debug_pop(); 170 167 return false; … … 180 177 if ($session->timestamp < $timed_out) 181 178 { 179 debug_push_class(__CLASS__, __FUNCTION__); 182 180 debug_add("The session {$session->guid} (#{$session->id}) has timed out.", MIDCOM_LOG_INFO); 181 debug_pop(); 183 182 $valid = false; 184 183 } … … 189 188 && $session->clientip != $clientip) 190 189 { 190 debug_push_class(__CLASS__, __FUNCTION__); 191 191 debug_add("The session {$session->guid} (#{$session->id}) had mismatching client IP.", MIDCOM_LOG_INFO); 192 192 debug_add("Expected {$session->clientip}, got {$clientip}."); 193 debug_pop(); 193 194 $valid = false; 194 195 } … … 196 197 if (! $valid) 197 198 { 198 debug_print_r("Dropping this session:", $session);199 199 if (! $session->delete()) 200 200 { 201 debug_push_class(__CLASS__, __FUNCTION__); 201 202 debug_add("Failed to delete the invalid session {$session->guid} (#{$session->id}): " . mgd_errstr(), MIDCOM_LOG_INFO); 202 debug_p rint_r('Object was:', $session);203 debug_pop(); 203 204 } 204 205 continue; … … 211 212 if (! $session->update()) 212 213 { 214 debug_push_class(__CLASS__, __FUNCTION__); 213 215 debug_add("Failed to update the session {$session->guid} (#{$session->id}) to the current timestamp: " . mgd_errstr(), MIDCOM_LOG_INFO); 214 debug_p rint_r('Object was:', $session);216 debug_pop(); 215 217 } 216 218 … … 226 228 if (! $return) 227 229 { 228 debug_add("We could not find any valid session having the identifier {$sessionid}.", MIDCOM_LOG_INFO); 229 } 230 231 debug_pop(); 230 //debug_add("We could not find any valid session having the identifier {$sessionid}.", MIDCOM_LOG_INFO); 231 } 232 232 233 return $return; 233 234 } … … 277 278 { 278 279 debug_push_class(__CLASS__, __FUNCTION__); 279 debug_add("Failed to authenticate to the given user ername / password: " . mgd_errstr(),280 debug_add("Failed to authenticate to the given username / password: " . mgd_errstr(), 280 281 MIDCOM_LOG_ERROR); 281 282 debug_pop(); … … 320 321 debug_push_class(__CLASS__, __FUNCTION__); 321 322 debug_add("Failed to delete the invalid session {$session->guid} (#{$session->id}): " . mgd_errstr(), MIDCOM_LOG_INFO); 322 debug_print_r('Object was:', $session);323 323 debug_pop(); 324 324 } … … 354 354 debug_push_class(__CLASS__, __FUNCTION__); 355 355 debug_add("Failed to delete the delete session {$session->guid} (#{$session->id}): " . mgd_errstr(), MIDCOM_LOG_INFO); 356 debug_print_r('Object was:', $session);357 356 debug_pop(); 358 357 return false;
