function makeWelcomeMsg($msgPack = 'default') { $useClockBase = false; $xmls=new XMLStruct(); if (!$xmls->openFile(ROOT . '/language/welcome/'.$msgPack.'.xml')) return msg::getRandomMsg('welcome'); if ($useClockBase) { $hour = date("H"); switch(true) { case (($hour >= 2) && ($hour <= 5)): $tick = 'daybreak'; break; case (($hour >= 6) && ($hour <= 11)): $tick = 'morning'; break; case (($hour >= 12) && ($hour <= 17)): $tick = 'afternoon'; case (($hour >= 18) && ($hour <= 19)): $tick = 'evening'; case (($hour >= 20) || ($hour <= 1)): $tick = 'night'; } } else { // common $tick = 'common'; } $max = $xmls->getNodeCount("/welcome/$tick/item"); $bingo = mt_rand(1, $max); return $xmls->getValue("/welcome/$tick/item[$bingo]"); }
$_feeder->add($xmlURL); } @unlink($opmlCacheDir.'/'.$tmpFilename); } } else { // URL 로부터 가져올 경우 requireComponent('LZ.PHP.HTTPRequest'); $request = new HTTPRequest; if (!$cont = $request->getPage($_POST['importURL'])) { echo '<script type="text/javascript">alert("'._t('파일을 가져올 수 없습니다.\n정확한 주소가 맞는지 확인해 주세요.').'");</script>'; exit; } $xmls = new XMLStruct(); $xmls->open($cont, true); if (!$n = $xmls->getNodeCount("/opml/body/outline")) { echo '<script type="text/javascript">alert("'._t('바른 형식의 OPML 파일이 아닙니다.').'");</script>'; exit; } echo '<script type="text/javascript">"'._t('피드를 추가하고 있습니다').'";</script>'; flush(); $_feeder = new Feed; for ($i=1; $i <= $n; $i++) { $xmlURL = $xmls->getAttribute("/opml/body/outline[$i]", "xmlUrl"); if (empty($xmlURL)) continue; $_feeder->add($xmlURL); } } ?>