function smarty_function_award_phrase($params, &$smarty)
{
    global $ps, $cms;
    $award = $params['award'];
    // combined array of the award and player data
    $phrase = $cms->trans($award['phrase']);
    // if 'desc' is true then we print the award description
    if ($params['desc']) {
        $phrase = $cms->trans($award['description']);
        if (empty($phrase)) {
            $phrase = $cms->trans("No description available");
        }
    }
    // create some dynamic values for this award
    $award['value'] = $ps->award_format($award['topplrvalue'], $award['format']);
    $award['link'] = ps_table_plr_link($award['name'], $award);
    $weapon = array();
    // is this a weapon award?
    if ($award['weapon']) {
        $award['weapon']['link'] = ps_table_weapon_link($award['weapon']['name'], $award['weapon']);
        $weapon =& $award['weapon'];
    } else {
        $weapon =& $award;
    }
    $tokens = array('award' => &$award, 'player' => &$award, 'weapon' => &$weapon);
    if ($award['weapon']) {
        $tokens['weapon'] = array_merge($tokens['weapon'], $award['weapon']);
    }
    return simple_interpolate($phrase, $tokens);
}
 function load_theme($url, $skip_file = false)
 {
     $this->error(false);
     ob_start();
     $xml = file_get_contents($url);
     //, false, null, 0, 4*1024); // 5 paramater format only works in PHP5
     $err = ob_get_contents();
     if (!empty($err)) {
         // cleanup the error a little bit so it's a little easier to tell what happened
         $err = str_replace(' [function.file-get-contents]', '', strip_tags($err));
     }
     ob_end_clean();
     $this->headers = $this->parse_headers($http_response_header);
     $this->xml = array();
     $data = array();
     if ($xml !== false) {
         // make sure the content-type returned is something reasonable (and not an image, etc).
         if ($this->is_xml()) {
             $data = XML_unserialize($xml);
             if ($data and is_array($data['theme'])) {
                 $xml2 = simple_interpolate($xml, $data['theme'], true);
                 if ($xml2 != $xml) {
                     // unserialize the data once more since it had $vars in the XML
                     $data = XML_unserialize($xml2);
                 }
                 $this->xml = $data['theme'];
                 array_walk($this->xml, array(&$this, '_fix_xml_attrib'));
             } else {
                 $this->error("Invalid theme XML format loaded from {$url}", PSTHEME_ERR_XML);
             }
         } else {
             $this->error("Invalid content-type returned for XML (" . $this->headers['content-type'] . ")", PSTHEME_ERR_CONTENT);
         }
     } else {
         $this->error($err, PSTHEME_ERR_NOTFOUND);
     }
     $ok = false;
     if (!$this->error() and $this->xml) {
         $ok = $this->validate_theme($skip_file);
         if ($ok and file_exists(catfile($this->template_dir, $this->xml['name']))) {
             $this->xml['theme_exists'] = true;
         }
     }
     return $ok;
 }