Changeset 64

Show
Ignore:
Timestamp:
12/31/05 01:39:06 (3 years ago)
Author:
sven
Message:

use configured admin email in FOAF
another i18n kludge
more whitespace cleaning

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • devel/.htaccess

    r60 r64  
    22Options +FollowSymLinks 
    33 
    4 php_flag magic_quotes_gpc On 
     4php_flag magic_quotes_gpc on 
     5# Not really necessary, just to be clean 
     6php_flag short_open_tag off 
     7# Forgot that anyone might still have this turned on 
     8php_flag register_globals off 
    59 
    610RewriteRule ^([0-9\-]+)\.css$ _templates/css.php?template=$1 
  • devel/units/communities/communities_edit.php

    r45 r64  
    2020                if (sizeof ($result) > 0) { 
    2121                        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; 
    3027                                        } else { 
    3128                                                $icon = "default.png"; 
    3229                                        } 
    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> 
    5252END; 
    53                                        if ($i % 5 == 0) { 
    54                                                $body .= "</tr><tr>"; 
    55                                        
    56                                        $i++; 
     53                                if ($i % 5 == 0) { 
     54                                        $body .= "</tr><tr>"; 
     55                               
     56                                $i++; 
    5757                        } 
    5858                } else { 
  • devel/units/communities/communities_members.php

    r45 r64  
    2020                if (sizeof ($result) > 0) { 
    2121                        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; 
    3027                                        } else { 
    3128                                                $icon = "default.png"; 
    3229                                        } 
    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> 
    5252END; 
    53                                        if ($i % 5 == 0) { 
    54                                                $body .= "</tr><tr>"; 
    55                                        
    56                                        $i++; 
     53                                if ($i % 5 == 0) { 
     54                                        $body .= "</tr><tr>"; 
     55                               
     56                                $i++; 
    5757                        } 
    5858                } else { 
  • devel/units/files/folder_edit.php

    r45 r64  
    198198                                <td width="30%"><p> 
    199199                                        <label for="new_file"> 
    200                                                $fileLabel 
     200                                               $fileLabel 
    201201                                        </label> 
    202202                                </p></td> 
  • devel/units/files/function_search_ecl.php

    r45 r64  
    5555                                                        if (sizeof($keywords) > 0) { 
    5656                                                                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>"; 
    5858                                                                } 
    5959                                                        } 
  • devel/units/friends/friends_actions.php

    r45 r64  
    1717                                                                                                        db_query("insert into friends  
    1818                                                                                                                                set owner =     " . $_SESSION['userid'] . ", 
    19                                                                                                                                     friend =  $friend_id"); 
     19                                                                                                                                       friend =       $friend_id"); 
    2020                                                                                                        if (run("users:type:get", $friend_id) == "person") { 
    2121                                                                                                                $messages[] = $friend[0]->name . gettext(" was added to your friends list."); 
  • devel/units/friends/generate_foaf.php

    r45 r64  
    99                $user = $user[0]; 
    1010                $url = url; 
     11                $adminmail = email; 
    1112                $personalurl = url . $user->username . "/"; 
    1213                $username = htmlentities(stripslashes($user->username)); 
     
    3839                <foaf:primaryTopic rdf:nodeID="elgg{$user->ident}"/> 
    3940                <admin:generatorAgent rdf:resource="{$url}"/> 
    40                 <admin:errorReportsTo rdf:resource="ben@elgg.net"/> 
     41                <admin:errorReportsTo rdf:resource="{$adminmail}"/> 
    4142        </foaf:PersonalProfileDocument> 
    4243        <foaf:Person rdf:nodeID="elgg{$user->ident}"> 
  • devel/units/gettext/library.php

    r63 r64  
    3333                         
    3434                        // 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)) { 
    3638                                // Bind the 'elgg' text domain to the languages directory 
    3739                                $textdomainpath = bindtextdomain ('elgg', path . 'languages'); 
  • devel/units/icons/function_actions.php

    r45 r64  
    9797                                                // $messages[] = gettext("The uploaded icon file was too large. Files must have maximum dimensions of 100x100."); 
    9898                                                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                                              } 
    112112                                        } 
    113113                                } 
  • devel/units/templates/default_template.php

    r45 r64  
    1919                                                                        ); 
    2020         
    21        $welcome = gettext("Welcome"); // gettext variable 
    22         
    23        $template['pageshell'] = <<< END 
     21       $welcome = gettext("Welcome"); // gettext variable 
     22         
     23       $template['pageshell'] = <<< END 
    2424         
    2525<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
     
    989989        $template['menu'] = <<< END 
    990990         
    991       {{menuitems}} 
     991               {{menuitems}} 
    992992END; 
    993993 
  • devel/units/users/conf.php

    r45 r64  
    11<?php 
    22 
    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.")); 
     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.")); 
    1414 
    1515?> 
  • devel/units/xml/library.php

    r45 r64  
    22 
    33function GetChildren($vals, &$i)  
    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; 
     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; 
    2929 
    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; 
    3954                } 
    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
    5757 
    5858/* Function will attempt to open the xmlloc as a local file, on fail it will attempt to open it as a web link */ 
    5959function GetXMLTree($xmlloc)  
    6060{  
    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       
    6868 
    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); 
    7373 
    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} 
    8787 
    8888?> 
  • devel/units/xml/main.php

    r45 r64  
    22 
    33function GetChildren($vals, &$i)  
    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; 
     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; 
    2929 
    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'] = ''; 
    3939                } 
    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       }  
    5656}  
    5757 
    5858/* Function will attempt to open the xmlloc as a local file, on fail it will attempt to open it as a web link */ 
    5959function 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       
    6868 
    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} 
    9494 
    9595/* Function will attempt to open the xmlloc as a local file, on fail it will attempt to open it as a web link */ 
    9696function 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       
    105105 
    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); 
    110110 
    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']; 
    116116        $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   else 
    120     $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; 
    123123}  
    124124