Changeset 64
- Timestamp:
- 12/31/05 01:39:06 (3 years ago)
- Files:
-
- devel/.htaccess (modified) (1 diff)
- devel/units/communities/communities_edit.php (modified) (1 diff)
- devel/units/communities/communities_members.php (modified) (1 diff)
- devel/units/files/folder_edit.php (modified) (1 diff)
- devel/units/files/function_search_ecl.php (modified) (1 diff)
- devel/units/friends/friends_actions.php (modified) (1 diff)
- devel/units/friends/generate_foaf.php (modified) (2 diffs)
- devel/units/gettext/library.php (modified) (1 diff)
- devel/units/icons/function_actions.php (modified) (1 diff)
- devel/units/templates/default_template.php (modified) (2 diffs)
- devel/units/users/conf.php (modified) (1 diff)
- devel/units/xml/library.php (modified) (1 diff)
- devel/units/xml/main.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
devel/.htaccess
r60 r64 2 2 Options +FollowSymLinks 3 3 4 php_flag magic_quotes_gpc On 4 php_flag magic_quotes_gpc on 5 # Not really necessary, just to be clean 6 php_flag short_open_tag off 7 # Forgot that anyone might still have this turned on 8 php_flag register_globals off 5 9 6 10 RewriteRule ^([0-9\-]+)\.css$ _templates/css.php?template=$1 devel/units/communities/communities_edit.php
r45 r64 20 20 if (sizeof ($result) > 0) { 21 21 foreach($result as $key => $info) { 22 // $info = $info[0]; 23 if ($info->icon != -1) { 24 $icon = db_query("select filename from icons where ident = " . $info->icon . " and owner = " . $info->ident); 25 if (sizeof($icon) == 1) { 26 $icon = $icon[0]->filename; 27 } else { 28 $icon = "default.png"; 29 } 22 // $info = $info[0]; 23 if ($info->icon != -1) { 24 $icon = db_query("select filename from icons where ident = " . $info->icon . " and owner = " . $info->ident); 25 if (sizeof($icon) == 1) { 26 $icon = $icon[0]->filename; 30 27 } else { 31 28 $icon = "default.png"; 32 29 } 33 list($width, $height, $type, $attr) = getimagesize(path . "_icons/data/" . $icon); 34 if (sizeof($parameter[1]) > 4) { 35 $width = round($width / 2); 36 $height = round($height / 2); 37 } 38 $friends_username = stripslashes($info->username); 39 $friends_name = htmlentities(stripslashes($info->name)); 40 $friends_menu = run("users:infobox:menu",array($info->ident)); 41 $body .= <<< END 42 <td align="center"> 43 <p> 44 <a href="{$url}{$friends_username}/"> 45 <img src="{$url}_icons/data/{$icon}" width="{$width}" height="{$height}" alt="{$friends_name}" border="0" /></a><br /> 46 <span class="userdetails"> 47 {$friends_name} 48 {$friends_menu} 49 </span> 50 </p> 51 </td> 30 } else { 31 $icon = "default.png"; 32 } 33 list($width, $height, $type, $attr) = getimagesize(path . "_icons/data/" . $icon); 34 if (sizeof($parameter[1]) > 4) { 35 $width = round($width / 2); 36 $height = round($height / 2); 37 } 38 $friends_username = stripslashes($info->username); 39 $friends_name = htmlentities(stripslashes($info->name)); 40 $friends_menu = run("users:infobox:menu",array($info->ident)); 41 $body .= <<< END 42 <td align="center"> 43 <p> 44 <a href="{$url}{$friends_username}/"> 45 <img src="{$url}_icons/data/{$icon}" width="{$width}" height="{$height}" alt="{$friends_name}" border="0" /></a><br /> 46 <span class="userdetails"> 47 {$friends_name} 48 {$friends_menu} 49 </span> 50 </p> 51 </td> 52 52 END; 53 if ($i % 5 == 0) {54 $body .= "</tr><tr>";55 }56 $i++;53 if ($i % 5 == 0) { 54 $body .= "</tr><tr>"; 55 } 56 $i++; 57 57 } 58 58 } else { devel/units/communities/communities_members.php
r45 r64 20 20 if (sizeof ($result) > 0) { 21 21 foreach($result as $key => $info) { 22 // $info = $info[0]; 23 if ($info->icon != -1) { 24 $icon = db_query("select filename from icons where ident = " . $info->icon . " and owner = " . $info->ident); 25 if (sizeof($icon) == 1) { 26 $icon = $icon[0]->filename; 27 } else { 28 $icon = "default.png"; 29 } 22 // $info = $info[0]; 23 if ($info->icon != -1) { 24 $icon = db_query("select filename from icons where ident = " . $info->icon . " and owner = " . $info->ident); 25 if (sizeof($icon) == 1) { 26 $icon = $icon[0]->filename; 30 27 } else { 31 28 $icon = "default.png"; 32 29 } 33 list($width, $height, $type, $attr) = getimagesize(path . "_icons/data/" . $icon); 34 if (sizeof($parameter[1]) > 4) { 35 $width = round($width / 2); 36 $height = round($height / 2); 37 } 38 $friends_username = stripslashes($info->username); 39 $friends_name = htmlentities(stripslashes($info->name)); 40 $friends_menu = run("users:infobox:menu",array($info->ident)); 41 $body .= <<< END 42 <td align="center"> 43 <p> 44 <a href="{$url}{$friends_username}/"> 45 <img src="{$url}_icons/data/{$icon}" width="{$width}" height="{$height}" alt="{$friends_name}" border="0" /></a><br /> 46 <span class="userdetails"> 47 {$friends_name} 48 {$friends_menu} 49 </span> 50 </p> 51 </td> 30 } else { 31 $icon = "default.png"; 32 } 33 list($width, $height, $type, $attr) = getimagesize(path . "_icons/data/" . $icon); 34 if (sizeof($parameter[1]) > 4) { 35 $width = round($width / 2); 36 $height = round($height / 2); 37 } 38 $friends_username = stripslashes($info->username); 39 $friends_name = htmlentities(stripslashes($info->name)); 40 $friends_menu = run("users:infobox:menu",array($info->ident)); 41 $body .= <<< END 42 <td align="center"> 43 <p> 44 <a href="{$url}{$friends_username}/"> 45 <img src="{$url}_icons/data/{$icon}" width="{$width}" height="{$height}" alt="{$friends_name}" border="0" /></a><br /> 46 <span class="userdetails"> 47 {$friends_name} 48 {$friends_menu} 49 </span> 50 </p> 51 </td> 52 52 END; 53 if ($i % 5 == 0) {54 $body .= "</tr><tr>";55 }56 $i++;53 if ($i % 5 == 0) { 54 $body .= "</tr><tr>"; 55 } 56 $i++; 57 57 } 58 58 } else { devel/units/files/folder_edit.php
r45 r64 198 198 <td width="30%"><p> 199 199 <label for="new_file"> 200 $fileLabel200 $fileLabel 201 201 </label> 202 202 </p></td> devel/units/files/function_search_ecl.php
r45 r64 55 55 if (sizeof($keywords) > 0) { 56 56 foreach($keywords as $keyword) { 57 $keywordtags .= "\n <dc:subject>".htmlentities(stripslashes($keyword->tag)) . "</dc:subject>";57 $keywordtags .= "\n\t\t<dc:subject>".htmlentities(stripslashes($keyword->tag)) . "</dc:subject>"; 58 58 } 59 59 } devel/units/friends/friends_actions.php
r45 r64 17 17 db_query("insert into friends 18 18 set owner = " . $_SESSION['userid'] . ", 19 friend = $friend_id");19 friend = $friend_id"); 20 20 if (run("users:type:get", $friend_id) == "person") { 21 21 $messages[] = $friend[0]->name . gettext(" was added to your friends list."); devel/units/friends/generate_foaf.php
r45 r64 9 9 $user = $user[0]; 10 10 $url = url; 11 $adminmail = email; 11 12 $personalurl = url . $user->username . "/"; 12 13 $username = htmlentities(stripslashes($user->username)); … … 38 39 <foaf:primaryTopic rdf:nodeID="elgg{$user->ident}"/> 39 40 <admin:generatorAgent rdf:resource="{$url}"/> 40 <admin:errorReportsTo rdf:resource=" ben@elgg.net"/>41 <admin:errorReportsTo rdf:resource="{$adminmail}"/> 41 42 </foaf:PersonalProfileDocument> 42 43 <foaf:Person rdf:nodeID="elgg{$user->ident}"> devel/units/gettext/library.php
r63 r64 33 33 34 34 // If the locale isn't the default, set a new default language 35 if ($list[0] != locale) { 35 // If the first choice is the right non-country-specific language, don't bother 36 // (kludge to allow a browser to default to "en", basically) 37 if (substr($list[0], 0, 2) != substr(locale, 0, 2)) { 36 38 // Bind the 'elgg' text domain to the languages directory 37 39 $textdomainpath = bindtextdomain ('elgg', path . 'languages'); devel/units/icons/function_actions.php
r45 r64 97 97 // $messages[] = gettext("The uploaded icon file was too large. Files must have maximum dimensions of 100x100."); 98 98 require_once(path . 'units/phpthumb/phpthumb.class.php'); 99 $phpThumb = new phpThumb();100 $phpThumb->setSourceFilename($templocation);101 $phpThumb->w = 100;102 $phpThumb->h = 100;103 $phpThumb->config_output_format = 'jpeg';104 $phpThumb->config_error_die_on_error = false;105 if ($phpThumb->GenerateThumbnail()) {106 $phpThumb->RenderToFile($templocation);107 $imageattr[2] = "2";108 } else {109 $ok = false;110 $messages[] .= '#Failed: '.implode("\n", $phpThumb->debugmessages);111 }99 $phpThumb = new phpThumb(); 100 $phpThumb->setSourceFilename($templocation); 101 $phpThumb->w = 100; 102 $phpThumb->h = 100; 103 $phpThumb->config_output_format = 'jpeg'; 104 $phpThumb->config_error_die_on_error = false; 105 if ($phpThumb->GenerateThumbnail()) { 106 $phpThumb->RenderToFile($templocation); 107 $imageattr[2] = "2"; 108 } else { 109 $ok = false; 110 $messages[] .= '#Failed: '.implode("\n", $phpThumb->debugmessages); 111 } 112 112 } 113 113 } devel/units/templates/default_template.php
r45 r64 19 19 ); 20 20 21 $welcome = gettext("Welcome"); // gettext variable22 23 $template['pageshell'] = <<< END21 $welcome = gettext("Welcome"); // gettext variable 22 23 $template['pageshell'] = <<< END 24 24 25 25 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> … … 989 989 $template['menu'] = <<< END 990 990 991 {{menuitems}}991 {{menuitems}} 992 992 END; 993 993 devel/units/users/conf.php
r45 r64 1 1 <?php 2 2 3 // Session variable name4 define('user_session_name', 'elgguser');5 6 // Persistent login cookie DEFs7 define('AUTH_COOKIE', 'elggperm');8 define('AUTH_COOKIE_LENGTH', 31556926); // 1YR in seconds9 10 // Messages11 define('AUTH_MSG_OK', gettext("You have been logged on."));12 define('AUTH_MSG_BADLOGIN', gettext("Unrecognised username or password. The system could not log you on, or you may not have activated your account."));13 define('AUTH_MSG_MISSING', gettext("Either the username or password were not specified. The system could not log you on."));3 // Session variable name 4 define('user_session_name', 'elgguser'); 5 6 // Persistent login cookie DEFs 7 define('AUTH_COOKIE', 'elggperm'); 8 define('AUTH_COOKIE_LENGTH', 31556926); // 1YR in seconds 9 10 // Messages 11 define('AUTH_MSG_OK', gettext("You have been logged on.")); 12 define('AUTH_MSG_BADLOGIN', gettext("Unrecognised username or password. The system could not log you on, or you may not have activated your account.")); 13 define('AUTH_MSG_MISSING', gettext("Either the username or password were not specified. The system could not log you on.")); 14 14 15 15 ?> devel/units/xml/library.php
r45 r64 2 2 3 3 function GetChildren($vals, &$i) 4 { 5 $children = array();// Contains node data6 7 /* Node has CDATA before it's children */8 if (isset($vals[$i]['value']))9 $children['VALUE'] = $vals[$i]['value']; 10 11 /* Loop through children */12 while (++$i < count($vals))13 { 14 switch ($vals[$i]['type'])15 { 16 /* Node has CDATA after one of it's children17 (Add to cdata found before if this is the case) */18 case 'cdata':19 if (isset($children['VALUE']))20 $children['VALUE'] .= $vals[$i]['value']; 21 else22 $children['VALUE'] = $vals[$i]['value']; 23 break;24 /* At end of current branch */25 case 'complete':26 if (isset($vals[$i]['attributes'])) {27 $children[$vals[$i]['tag']][]['ATTRIBUTES'] = $vals[$i]['attributes'];28 $index = count($children[$vals[$i]['tag']])-1;4 { 5 $children = array(); // Contains node data 6 7 /* Node has CDATA before it's children */ 8 if (isset($vals[$i]['value'])) 9 $children['VALUE'] = $vals[$i]['value']; 10 11 /* Loop through children */ 12 while (++$i < count($vals)) 13 { 14 switch ($vals[$i]['type']) 15 { 16 /* Node has CDATA after one of it's children 17 (Add to cdata found before if this is the case) */ 18 case 'cdata': 19 if (isset($children['VALUE'])) 20 $children['VALUE'] .= $vals[$i]['value']; 21 else 22 $children['VALUE'] = $vals[$i]['value']; 23 break; 24 /* At end of current branch */ 25 case 'complete': 26 if (isset($vals[$i]['attributes'])) { 27 $children[$vals[$i]['tag']][]['ATTRIBUTES'] = $vals[$i]['attributes']; 28 $index = count($children[$vals[$i]['tag']]) - 1; 29 29 30 if (isset($vals[$i]['value'])) 31 $children[$vals[$i]['tag']][$index]['VALUE'] = $vals[$i]['value']; 32 else 33 $children[$vals[$i]['tag']][$index]['VALUE'] = ''; 34 } else { 35 if (isset($vals[$i]['value'])) 36 $children[$vals[$i]['tag']][]['VALUE'] = $vals[$i]['value']; 37 else 38 $children[$vals[$i]['tag']][]['VALUE'] = ''; 30 if (isset($vals[$i]['value'])) 31 $children[$vals[$i]['tag']][$index]['VALUE'] = $vals[$i]['value']; 32 else 33 $children[$vals[$i]['tag']][$index]['VALUE'] = ''; 34 } else { 35 if (isset($vals[$i]['value'])) 36 $children[$vals[$i]['tag']][]['VALUE'] = $vals[$i]['value']; 37 else 38 $children[$vals[$i]['tag']][]['VALUE'] = ''; 39 } 40 break; 41 /* Node has more children */ 42 case 'open': 43 if (isset($vals[$i]['attributes'])) { 44 $children[$vals[$i]['tag']][]['ATTRIBUTES'] = $vals[$i]['attributes']; 45 $index = count($children[$vals[$i]['tag']])-1; 46 $children[$vals[$i]['tag']][$index] = array_merge($children[$vals[$i]['tag']][$index],GetChildren($vals, $i)); 47 } else { 48 $children[$vals[$i]['tag']][] = GetChildren($vals, $i); 49 } 50 break; 51 /* End of node, return collected data */ 52 case 'close': 53 return $children; 39 54 } 40 break; 41 /* Node has more children */ 42 case 'open': 43 if (isset($vals[$i]['attributes'])) { 44 $children[$vals[$i]['tag']][]['ATTRIBUTES'] = $vals[$i]['attributes']; 45 $index = count($children[$vals[$i]['tag']])-1; 46 $children[$vals[$i]['tag']][$index] = array_merge($children[$vals[$i]['tag']][$index],GetChildren($vals, $i)); 47 } else { 48 $children[$vals[$i]['tag']][] = GetChildren($vals, $i); 49 } 50 break; 51 /* End of node, return collected data */ 52 case 'close': 53 return $children; 54 } 55 } 56 } 55 } 56 } 57 57 58 58 /* Function will attempt to open the xmlloc as a local file, on fail it will attempt to open it as a web link */ 59 59 function GetXMLTree($xmlloc) 60 60 { 61 if (file_exists($xmlloc)) 62 $data = implode('', file($xmlloc)); 63 else {64 $fp = fopen($xmlloc,'r');65 $data = fread($fp, 100000000);66 fclose($fp);67 }61 if (file_exists($xmlloc)) { 62 $data = implode('', file($xmlloc)); 63 } else { 64 $fp = fopen($xmlloc,'r'); 65 $data = fread($fp, 100000000); 66 fclose($fp); 67 } 68 68 69 $parser = xml_parser_create('ISO-8859-1');70 xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1); 71 xml_parse_into_struct($parser, $data, $vals, $index); 72 xml_parser_free($parser); 69 $parser = xml_parser_create('ISO-8859-1'); 70 xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1); 71 xml_parse_into_struct($parser, $data, $vals, $index); 72 xml_parser_free($parser); 73 73 74 $tree = array(); 75 $i = 0; 76 77 if (isset($vals[$i]['attributes'])) {78 $tree[$vals[$i]['tag']][]['ATTRIBUTES'] = $vals[$i]['attributes'];79 $index = count($tree[$vals[$i]['tag']])-1;80 $tree[$vals[$i]['tag']][$index] =array_merge($tree[$vals[$i]['tag']][$index], GetChildren($vals, $i));81 } 82 else 83 $tree[$vals[$i]['tag']][] = GetChildren($vals, $i); 84 85 return $tree; 86 } 74 $tree = array(); 75 $i = 0; 76 77 if (isset($vals[$i]['attributes'])) { 78 $tree[$vals[$i]['tag']][]['ATTRIBUTES'] = $vals[$i]['attributes']; 79 $index = count($tree[$vals[$i]['tag']])-1; 80 $tree[$vals[$i]['tag']][$index] = array_merge($tree[$vals[$i]['tag']][$index], GetChildren($vals, $i)); 81 } else { 82 $tree[$vals[$i]['tag']][] = GetChildren($vals, $i); 83 } 84 85 return $tree; 86 } 87 87 88 88 ?> devel/units/xml/main.php
r45 r64 2 2 3 3 function GetChildren($vals, &$i) 4 { 5 $children = array();// Contains node data6 7 /* Node has CDATA before it's children */8 if (isset($vals[$i]['value']))9 $children['VALUE'] = $vals[$i]['value']; 10 11 /* Loop through children */12 while (++$i < count($vals))13 { 14 switch ($vals[$i]['type'])15 { 16 /* Node has CDATA after one of it's children17 (Add to cdata found before if this is the case) */18 case 'cdata':19 if (isset($children['VALUE']))20 $children['VALUE'] .= $vals[$i]['value']; 21 else22 $children['VALUE'] = $vals[$i]['value']; 23 break;24 /* At end of current branch */25 case 'complete':26 if (isset($vals[$i]['attributes'])) {27 $children[$vals[$i]['tag']][]['ATTRIBUTES'] = $vals[$i]['attributes'];28 $index = count($children[$vals[$i]['tag']])-1;4 { 5 $children = array(); // Contains node data 6 7 /* Node has CDATA before it's children */ 8 if (isset($vals[$i]['value'])) 9 $children['VALUE'] = $vals[$i]['value']; 10 11 /* Loop through children */ 12 while (++$i < count($vals)) 13 { 14 switch ($vals[$i]['type']) 15 { 16 /* Node has CDATA after one of it's children 17 (Add to cdata found before if this is the case) */ 18 case 'cdata': 19 if (isset($children['VALUE'])) 20 $children['VALUE'] .= $vals[$i]['value']; 21 else 22 $children['VALUE'] = $vals[$i]['value']; 23 break; 24 /* At end of current branch */ 25 case 'complete': 26 if (isset($vals[$i]['attributes'])) { 27 $children[$vals[$i]['tag']][]['ATTRIBUTES'] = $vals[$i]['attributes']; 28 $index = count($children[$vals[$i]['tag']])-1; 29 29 30 if (isset($vals[$i]['value']))31 $children[$vals[$i]['tag']][$index]['VALUE'] = $vals[$i]['value']; 32 else33 $children[$vals[$i]['tag']][$index]['VALUE'] = ''; 34 } else {35 if (isset($vals[$i]['value']))36 $children[$vals[$i]['tag']][]['VALUE'] = $vals[$i]['value']; 37 else38 $children[$vals[$i]['tag']][]['VALUE'] = ''; 30 if (isset($vals[$i]['value'])) 31 $children[$vals[$i]['tag']][$index]['VALUE'] = $vals[$i]['value']; 32 else 33 $children[$vals[$i]['tag']][$index]['VALUE'] = ''; 34 } else { 35 if (isset($vals[$i]['value'])) 36 $children[$vals[$i]['tag']][]['VALUE'] = $vals[$i]['value']; 37 else 38 $children[$vals[$i]['tag']][]['VALUE'] = ''; 39 39 } 40 break; 41 /* Node has more children */42 case 'open':43 if (isset($vals[$i]['attributes'])) {44 $children[$vals[$i]['tag']][]['ATTRIBUTES'] = $vals[$i]['attributes'];45 $index = count($children[$vals[$i]['tag']])-1;46 $children[$vals[$i]['tag']][$index] = array_merge($children[$vals[$i]['tag']][$index],GetChildren($vals, $i));47 } else {48 $children[$vals[$i]['tag']][] = GetChildren($vals, $i);49 }50 break; 51 /* End of node, return collected data */52 case 'close':53 return $children; 54 }55 }40 break; 41 /* Node has more children */ 42 case 'open': 43 if (isset($vals[$i]['attributes'])) { 44 $children[$vals[$i]['tag']][]['ATTRIBUTES'] = $vals[$i]['attributes']; 45 $index = count($children[$vals[$i]['tag']])-1; 46 $children[$vals[$i]['tag']][$index] = array_merge($children[$vals[$i]['tag']][$index],GetChildren($vals, $i)); 47 } else { 48 $children[$vals[$i]['tag']][] = GetChildren($vals, $i); 49 } 50 break; 51 /* End of node, return collected data */ 52 case 'close': 53 return $children; 54 } 55 } 56 56 } 57 57 58 58 /* Function will attempt to open the xmlloc as a local file, on fail it will attempt to open it as a web link */ 59 59 function GetXMLTreeProfile($xmlloc) 60 { 61 if (file_exists($xmlloc)) 62 $data = implode('', file($xmlloc)); 63 else {64 $fp = fopen($xmlloc,'r');65 $data = fread($fp, 100000000);66 fclose($fp);67 }60 { 61 if (file_exists($xmlloc)) { 62 $data = implode('', file($xmlloc)); 63 } else { 64 $fp = fopen($xmlloc,'r'); 65 $data = fread($fp, 100000000); 66 fclose($fp); 67 } 68 68 69 $data = preg_replace("/<knows>.*<\/knows>/is","",$data);70 71 $parser = xml_parser_create('UTF-8');72 xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 0); 73 xml_parse_into_struct($parser, $data, $vals, $index); 74 xml_parser_free($parser); 75 $code = xml_get_error_code($parser);76 if ($code != XML_ERROR_NONE) {77 global $messages;78 $messages[] = gettext("XML error: ") . xml_error_string($code);79 }80 81 $tree = array(); 82 $i = 0; 83 84 if (isset($vals[$i]['attributes'])) {85 $tree[$vals[$i]['tag']][]['ATTRIBUTES'] = $vals[$i]['attributes'];86 $index = count($tree[$vals[$i]['tag']])-1;87 $tree[$vals[$i]['tag']][$index] =array_merge($tree[$vals[$i]['tag']][$index], GetChildren($vals, $i));88 } 89 else 90 $tree[$vals[$i]['tag']][] = GetChildren($vals, $i); 91 92 return $tree; 93 } 69 $data = preg_replace("/<knows>.*<\/knows>/is","",$data); 70 71 $parser = xml_parser_create('UTF-8'); 72 xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 0); 73 xml_parse_into_struct($parser, $data, $vals, $index); 74 xml_parser_free($parser); 75 $code = xml_get_error_code($parser); 76 if ($code != XML_ERROR_NONE) { 77 global $messages; 78 $messages[] = gettext("XML error: ") . xml_error_string($code); 79 } 80 81 $tree = array(); 82 $i = 0; 83 84 if (isset($vals[$i]['attributes'])) { 85 $tree[$vals[$i]['tag']][]['ATTRIBUTES'] = $vals[$i]['attributes']; 86 $index = count($tree[$vals[$i]['tag']])-1; 87 $tree[$vals[$i]['tag']][$index] = array_merge($tree[$vals[$i]['tag']][$index], GetChildren($vals, $i)); 88 } else { 89 $tree[$vals[$i]['tag']][] = GetChildren($vals, $i); 90 } 91 92 return $tree; 93 } 94 94 95 95 /* Function will attempt to open the xmlloc as a local file, on fail it will attempt to open it as a web link */ 96 96 function GetXMLTree($xmlloc) 97 { 98 if (file_exists($xmlloc))99 $data = implode('', file($xmlloc)); 100 else {101 $fp = fopen($xmlloc,'r');102 $data = fread($fp, 100000000);103 fclose($fp);104 }97 { 98 if (file_exists($xmlloc)) 99 $data = implode('', file($xmlloc)); 100 else { 101 $fp = fopen($xmlloc,'r'); 102 $data = fread($fp, 100000000); 103 fclose($fp); 104 } 105 105 106 $parser = xml_parser_create('UTF-8');107 xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 0); 108 xml_parse_into_struct($parser, $data, $vals, $index); 109 xml_parser_free($parser); 106 $parser = xml_parser_create('UTF-8'); 107 xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 0); 108 xml_parse_into_struct($parser, $data, $vals, $index); 109 xml_parser_free($parser); 110 110 111 $tree = array(); 112 $i = 0; 113 114 if (isset($vals[$i]['attributes'])) {115 $tree[$vals[$i]['tag']][]['ATTRIBUTES'] = $vals[$i]['attributes']; 111 $tree = array(); 112 $i = 0; 113 114 if (isset($vals[$i]['attributes'])) { 115 $tree[$vals[$i]['tag']][]['ATTRIBUTES'] = $vals[$i]['attributes']; 116 116 $index = count($tree[$vals[$i]['tag']])-1; 117 $tree[$vals[$i]['tag']][$index] = array_merge($tree[$vals[$i]['tag']][$index], GetChildren($vals, $i));118 }119 else120 $tree[$vals[$i]['tag']][] = GetChildren($vals, $i); 121 122 return $tree; 117 $tree[$vals[$i]['tag']][$index] = array_merge($tree[$vals[$i]['tag']][$index], GetChildren($vals, $i)); 118 } 119 else 120 $tree[$vals[$i]['tag']][] = GetChildren($vals, $i); 121 122 return $tree; 123 123 } 124 124
