Changeset 12388
- Timestamp:
- 09/20/07 11:38:30 (1 year ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/MidCOM_2_8/midcom.core/midcom/baseclasses/database/topic.php
r4694 r12388 36 36 function get_parent_guid_uncached() 37 37 { 38 return midcom_baseclasses_database_topic:: get_parent_guid_uncached_static($this->guid);38 return midcom_baseclasses_database_topic::_get_parent_guid_uncached_static_topic($this->up); 39 39 } 40 40 41 41 /** 42 42 * Statically callable method to get parent guid when object guid is given … … 74 74 $mc_topic_keys = $mc_topic->list_keys(); 75 75 list ($key, $copy) = each ($mc_topic_keys); 76 $parent_id = $mc_topic->get_subkey($key, 'up'); 76 $parent_id = (int) $mc_topic->get_subkey($key, 'up'); 77 if ($parent_id == 0) 78 { 79 // Root-level topic 80 return null; 81 } 82 $mc_parent = midcom_baseclasses_database_topic::new_collector('id', $parent_id); 83 $mc_parent->add_value_property('guid'); 84 if (!$mc_parent->execute()) 85 { 86 // ErrorA 87 return null; 88 } 89 $mc_parent_keys = $mc_parent->list_keys(); 90 $parent_guids = array_keys($mc_parent_keys); 91 $parent_guid = $parent_guids[0]; 92 if ($parent_guid === false) 93 { 94 return null; 95 } 96 return $parent_guid; 97 } 98 99 /** 100 * Get topic guid statically 101 * 102 * used by get_parent_guid_uncached_static 103 * 104 * @param id $parent_id id of topic to get the guid for 105 */ 106 function _get_parent_guid_uncached_static_topic($parent_id) 107 { 108 if (empty($parent_id)) 109 { 110 return null; 111 } 77 112 $mc_parent = midcom_baseclasses_database_topic::new_collector('id', $parent_id); 78 113 $mc_parent->add_value_property('guid'); … … 83 118 } 84 119 $mc_parent_keys = $mc_parent->list_keys(); 85 list ($key2, $copy2) = each($mc_parent_keys);86 $parent_guid = $ mc_parent->get_subkey($key2, 'guid');120 $parent_guids = array_keys($mc_parent_keys); 121 $parent_guid = $parent_guids[0]; 87 122 if ($parent_guid === false) 88 123 { branches/MidCOM_2_8/midcom.core/midcom/services/auth.php
r6088 r12388 919 919 } 920 920 921 if ($user == 'EVERYONE') 921 if ( is_string($user) 922 && $user == 'EVERYONE') 922 923 { 923 924 $user = null;
