/** * Returns page url for particular author. * * @param string|int $id Author ID. * @param string|int|null $page Page number. * * @return string Page URL. * @since 0.1.0 */ public static function route($id, $page = null) { return parent::route('<id>', $id, $page); }
echo base64_decode($favicon); } else { if ($_GET['file'] == 'style.css') { header('Content-type: text/css'); include "inc/style.css"; } else { if ($_GET['file'] == 'script.js') { header('Content-type: text/javascript'); include "inc/script.js"; } } } exit; } $pb = new PageBuilder('FeedPage'); FeedPage::$pb = $pb; $pb->assign('base', MyTool::getUrl()); $pb->assign('version', FEED_VERSION); $pb->assign('pagetitle', 'KrISS feed'); $pb->assign('referer', $referer); $pb->assign('langs', Intl::$langList); $pb->assign('lang', Intl::$langList[Intl::$lang]); $pb->assign('query_string', $_SERVER['QUERY_STRING']); if (!is_dir(DATA_DIR)) { if (!@mkdir(DATA_DIR, 0755)) { $pb->assign('message', sprintf(Intl::msg('Can not create %s directory, check permissions'), DATA_DIR)); $pb->renderPage('message'); } @chmod(DATA_DIR, 0755); if (!is_file(DATA_DIR . '/.htaccess')) { if (!@file_put_contents(DATA_DIR . '/.htaccess', "Allow from none\nDeny from all\n")) {
public static function importOpml($kfData) { $feeds = $kfData['feeds']; $folders = $kfData['folders']; $filename = $_FILES['filetoupload']['name']; $filesize = $_FILES['filetoupload']['size']; $data = file_get_contents($_FILES['filetoupload']['tmp_name']); $overwrite = isset($_POST['overwrite']); $opml = new DOMDocument('1.0', 'UTF-8'); $importCount = 0; if ($opml->loadXML($data)) { $body = $opml->getElementsByTagName('body'); $xmlArray = Opml::getArrayFromXml($body->item(0)); $array = Opml::convertOpmlArray($xmlArray['outline']); foreach ($array as $hashUrl => $arrayInfo) { $title = ''; if (isset($arrayInfo['title'])) { $title = $arrayInfo['title']; } else { if (isset($arrayInfo['text'])) { $title = $arrayInfo['text']; } } $foldersHash = array(); if (isset($arrayInfo['folders'])) { foreach ($arrayInfo['folders'] as $folder) { $folderTitle = html_entity_decode($folder, ENT_QUOTES, 'UTF-8'); $folderHash = MyTool::smallHash($folderTitle); if (!isset($folders[$folderHash])) { $folders[$folderHash] = array('title' => $folderTitle, 'isOpen' => true); } $foldersHash[] = $folderHash; } } $timeUpdate = 'auto'; $lastUpdate = 0; $xmlUrl = ''; if (isset($arrayInfo['xmlUrl'])) { $xmlUrl = $arrayInfo['xmlUrl']; } $htmlUrl = ''; if (isset($arrayInfo['htmlUrl'])) { $htmlUrl = $arrayInfo['htmlUrl']; } $description = ''; if (isset($arrayInfo['description'])) { $description = $arrayInfo['description']; } // create new feed if (!empty($xmlUrl)) { $oldFeed = array('nbUnread' => 0, 'nbAll' => 0); if (isset($feeds[$hashUrl])) { $oldFeed['nbUnread'] = $feeds[$hashUrl]['nbUnread']; $oldFeed['nbAll'] = $feeds[$hashUrl]['nbAll']; } $currentFeed = array('title' => html_entity_decode($title, ENT_QUOTES, 'UTF-8'), 'description' => html_entity_decode($description, ENT_QUOTES, 'UTF-8'), 'htmlUrl' => html_entity_decode($htmlUrl, ENT_QUOTES, 'UTF-8'), 'xmlUrl' => html_entity_decode($xmlUrl, ENT_QUOTES, 'UTF-8'), 'nbUnread' => $oldFeed['nbUnread'], 'nbAll' => $oldFeed['nbAll'], 'foldersHash' => $foldersHash, 'timeUpdate' => $timeUpdate, 'lastUpdate' => $lastUpdate); if ($overwrite || !isset($feeds[$hashUrl])) { $feeds[$hashUrl] = $currentFeed; $importCount++; } } } FeedPage::init(array('base' => MyTool::getUrl(), 'message' => sprintf(Intl::msg('File %s (%s) was successfully processed: %d links imported'), htmlspecialchars($filename), MyTool::humanBytes($filesize), $importCount), 'button' => Intl::msg('Continue'), 'referer' => MyTool::getUrl(), 'version' => FEED_VERSION, 'pagetitle' => 'KrISS feed installation')); FeedPage::messageTpl(); $kfData['feeds'] = $feeds; $kfData['folders'] = $folders; return $kfData; } else { FeedPage::init(array('base' => MyTool::getUrl(), 'class' => 'text-success', 'message' => sprintf(Intl::msg('File %s (%s) has an unknown file format. Check encoding, try to remove accents and try again. Nothing was imported.'), htmlspecialchars($filename), MyTool::humanBytes($filesize)), 'referer' => MyTool::getUrl() . '?import', 'version' => FEED_VERSION, 'pagetitle' => 'KrISS feed installation')); FeedPage::messageTpl(); exit; } }
public static function updateTpl() { extract(FeedPage::$var); ?> <!DOCTYPE html> <html> <head> <?php FeedPage::includesTpl(); ?> </head> <body> <div class="container-fluid full-height"> <div class="row-fluid full-height"> <div class="span12 full-height"> <?php FeedPage::statusTpl(); FeedPage::navTpl(); ?> <div class="container-fluid"> <div class="row-fluid"> <div class="span6 offset3"> <ul class="unstyled"> <?php echo $kf->updateFeedsHash($feedsHash, $forceUpdate, 'html'); ?> </ul> <a class="btn ico-home" href="<?php echo $base; ?> " title="<?php echo Intl::msg('Home'); ?> "></a> <?php if (!empty($referer)) { ?> <a class="btn" href="<?php echo $referer; ?> "><?php echo Intl::msg('Go back'); ?> </a> <?php } ?> <a class="btn" href="<?php echo $query; ?> update=<?php echo $currentHash; ?> &force"><?php echo Intl::msg('Force update'); ?> </a> </div> </div> </div> </div> </div> </div> <?php if (is_file('inc/script.js')) { ?> <script type="text/javascript" src="inc/script.js?version=<?php echo $version; ?> "></script> <?php } else { ?> <script type="text/javascript" src="?file=script.js&version=<?php echo $version; ?> "></script> <?php } ?> </body> </html> <?php }
/** * initialize private instance of FeedPage class * * @param array $var list of useful variables for template */ public static function init($var) { FeedPage::$var = $var; }