$f->dispHead(); session_start(); if (isset($_POST["tumblr"])) { $_SESSION["tumblr"] = htmlspecialchars($_POST["tumblr"]); } if (isset($_GET["exit"])) { unset($_SESSION["tumblr"]); header("location: index.php"); } if (isset($_SESSION["tumblr"])) { $f->dispTumblrHead($_SESSION["tumblr"]); if (isset($_GET["p"])) { $p = htmlspecialchars($_GET["p"]); $gifAndTitle = processPage($p); } else { $gifAndTitle = processPage(); } $f->dispPosts($gifAndTitle); if (isset($p)) { $f->dispBtnPagination($p); } else { $f->dispBtnPagination(); } } else { $f->dispTumblrForm(); } $f->dispFoot(); function processPage($p = 0) { $tumblr = new Tumblr($_SESSION["tumblr"], "fuiKNFp9vQFvjLNvx4sUwti4Yb5yGutBN4Xh10LXZhhRKjWlV4"); $giflib = new GifLib();
include ROSTER_LIB . 'install.lib.php'; $installer = new Install(); $op = isset($_POST['op']) ? $_POST['op'] : ''; $id = isset($_POST['id']) ? $_POST['id'] : ''; switch ($op) { case 'deactivate': processActive($id, 0); break; case 'activate': processActive($id, 1); break; case 'process': $processed = processAddon(); break; case 'default_page': processPage(); break; case 'access': processAccess(); break; default: break; } // This is here to refresh the addon list $roster->get_addon_data(); $l_default_page = explode('|', $roster->locale->act['admin']['default_page']); $roster->tpl->assign_vars(array('S_ADDON_LIST' => false, 'L_DEFAULT_PAGE' => $l_default_page[0], 'L_DEFAULT_PAGE_HELP' => makeOverlib($l_default_page[1], $l_default_page[0], '', 0, '', ',WRAP'), 'S_DEFAULT_SELECT' => pageNames(array('name' => 'default_page')))); $addons = getAddonList(); if (!empty($addons)) { $roster->tpl->assign_vars(array('S_ADDON_LIST' => true, 'L_TIP_STATUS_ACTIVE' => makeOverlib($roster->locale->act['installer_turn_off'], $roster->locale->act['installer_activated']), 'L_TIP_STATUS_INACTIVE' => makeOverlib($roster->locale->act['installer_turn_on'], $roster->locale->act['installer_deactivated']), 'L_TIP_INSTALL_OLD' => makeOverlib($roster->locale->act['installer_replace_files'], $roster->locale->act['installer_overwrite']), 'L_TIP_INSTALL' => makeOverlib($roster->locale->act['installer_click_uninstall'], $roster->locale->act['installer_installed']), 'L_TIP_UNINSTALL' => makeOverlib($roster->locale->act['installer_click_install'], $roster->locale->act['installer_not_installed']))); foreach ($addons as $addon) {
function processPages() { $files = scandir(BUILD_DIR . '/downloaded-pages'); $pages = filter($files, function ($file) { return $file !== '.' && $file !== '..'; }); foreach ($pages as $page) { echo "Processing page: {$page}...\n"; $html = file_get_contents(BUILD_DIR . '/downloaded-pages/' . $page); $processed = processPage($html); file_put_contents(BUILD_DIR . '/pages/' . $page, $processed); } }
<?php include 'include/textile.class.php'; function processPage($page) { $textile = new Textile(); $handle = @fopen($page, "r"); if ($handle == False) { return __("<center><h1>Error:This item is not documented!</h1></center>"); } $contents = fread($handle, filesize($page)); fclose($handle); return "<div class = 'textile'>{$textile->TextileThis($contents)}</div>"; } if (isset($_GET['page'])) { echo processPage("docs/{$_GET['page']}"); }
$chapterPages++; $book->chapters[$chapterPos]->id = processPage($chapter, $chapterPos, $chapterPages); } else { $chapterPages++; processPage($chapter, $chapterPos, $chapterPages); } $totalPages++; } else { foreach ($chapter->pages as $pagePos => $page) { if (isset($page->id) && $page->id === 'newPage') { $chapterPages++; $newPageID = processPage($page, $chapterPos, $chapterPages); $book->chapters[$chapterPos]->pages[$pagePos]->id = $newPageID; } else { $chapterPages++; processPage($page, $chapterPos, $chapterPages); } $totalPages++; } $totalChapters++; $book->chapters[$chapterPos]->chapterPages = $chapterPages; } } $book->totalChapters = $totalChapters; $book->totalPages = $totalPages; $params = ['index' => 'books', 'type' => 'info_working', 'id' => $bookId, 'body' => ["doc" => ["totalChapters" => $book->totalChapters, "totalPages" => $book->totalPages, "chapters" => $book->chapters]]]; //Update working version $workingBook = $es->update($params); $newScope = $es->get(['index' => 'books', 'type' => 'info_working', 'id' => $bookId]); $newScope['_source']['id'] = $bookId; if ($bookAction === 'publish') {
foreach ($domPage->find('div[class=s-item-container] a[class=a-link-normal s-access-detail-page a-text-normal]') as $item) { $book = []; $domBook = $curl->getDom(html_entity_decode($item->attr['href'])); $book['title'] = trim(html_entity_decode($domBook->find('span[id=productTitle]', 0)->innertext)); $book['author'] = trim(html_entity_decode($domBook->find('span[class=author] a', 0)->innertext)); $book['price'] = str_replace('$', '', trim(html_entity_decode($domBook->find('span[class=a-size-medium a-color-price offer-price a-text-normal]', 0)->innertext))); foreach ($domBook->find('td[class=bucket] li') as $data) { if (strstr($data->innertext, 'ISBN-10')) { $book['isbn10'] = trim(str_replace('<b>ISBN-10:</b>', '', html_entity_decode($data->innertext))); } if (strstr($data->innertext, 'ISBN-13')) { $book['isbn13'] = str_replace('-', '', trim(str_replace('<b>ISBN-13:</b>', '', html_entity_decode($data->innertext)))); } if (strstr($data->innertext, 'Editor')) { $book['publisher'] = trim(str_replace('<b>Editor:</b>', '', html_entity_decode($data->innertext))); } } if (trim($book['isbn13']) != '') { file_put_contents("./amazon.data", json_encode($book) . "\n", FILE_APPEND); } } flush(); } $handle = fopen('./amazon.txt', 'r'); while (($lineUrl = fgets($handle)) !== false) { for ($i = 2; $i < 401; $i++) { $url = html_entity_decode(str_replace('{{pagina}}', $i, trim($lineUrl))); processPage($url); } } fclose($handle);
include 'include/db.php'; include 'include/usr.class.php'; ?> <div> <div id = "doc_title"><?php echo __("Documentation"); ?> </div> <div id = "doc_sidebar"> <div page = 'about.tex'><?php echo __("About the game"); ?> </div> <div page = 'tutorial.tex'><?php echo __("Tutorial"); ?> </div> <div page = 'stats.tex'><?php echo __("Building stats"); ?> </div> </div> <div id = "doc_body"> <?php include 'textile.php'; echo processPage('docs/about.tex'); ?> </div> </div>