Пример #1
0
function dumpAbbrevs($remoteFile)
{
    global $FTP;
    log_scriptLog("dumping abbreviations");
    $sources = AdminStringUtil::loadAbbreviationsIndex();
    $sectionNames = AdminStringUtil::getAbbrevSectionNames();
    $sections = array();
    foreach ($sectionNames as $name) {
        $raw_section = parse_ini_file(util_getRootPath() . "docs/abbrev/{$name}.conf", true);
        $section = array();
        foreach ($raw_section[$name] as $short => $long) {
            $abbrev_info = array('short' => $short, 'long' => $long, 'ambiguous' => false);
            if (substr($short, 0, 1) == "*") {
                $abbrev_info['short'] = substr($short, 1);
                $abbrev_info['ambiguous'] = true;
            }
            $section[] = $abbrev_info;
        }
        $sections[$name] = $section;
    }
    SmartyWrap::assign('sources', $sources);
    SmartyWrap::assign('sections', $sections);
    $xml = SmartyWrap::fetch('xml/xmldump/abbrev.tpl');
    $FTP->staticServerPutContents(gzencode($xml), $remoteFile);
}