public static function forming() { $form = new Form("POST", Page::url("/forms")); $input = new InputElement("login", "Identifiant :", "Pierre"); $form->addElement($input); $form->addElement(new ClosedElement("br")); // Balise, Name, Label, Value $input = new FormElement("select", "age", "Age :", 10); $input->addElement(new FormElement("option", "", "0-10", 0)); $input->addElement(new FormElement("option", "", "10-20", 10)); $input->addElement(new FormElement("option", "", "20-30", 20)); $input->addElement(new FormElement("option", "", "30-40", 30)); $input->addElement(new FormElement("option", "", "40-50", 40)); $form->addElement($input); $form->addElement(new ClosedElement("br")); $input = new FormElement("label", null, "Age : "); $input->addClasses("label_input_checkbox_radio"); $form->addElement($input); $input = new InputElement("mabox1", "0-10", 0, "checkbox", "mabox1"); $input->setAttribute("checked", "checked"); $form->addElement($input); $input = new InputElement("mabox2", "10-20", 10, "checkbox", "mabox2"); $input->setAttribute("checked", "checked"); $form->addElement($input); $input = new InputElement("mabox3", "20-30", 20, "checkbox", "mabox3"); $form->addElement($input); $input = new InputElement("mabox4", "30-40", 30, "checkbox", "mabox4"); $input->setAttribute("checked", "checked"); $input->setAttribute("disabled", "disabled"); $form->addElement($input); $input = new InputElement("mabox5", "40-50", 40, "checkbox", "mabox5"); $input->setAttribute("disabled", "disabled"); $form->addElement($input); $input = new FormElement("label", null, "Age : "); $input->addClasses("label_input_checkbox_radio"); $form->addElement($input); $input = new InputElement("monradio", "0-10", 0, "radio", "monradio1"); $input->setAttribute("checked", "checked"); $form->addElement($input); $input = new InputElement("monradio", "10-20", 10, "radio", "monradio2"); $form->addElement($input); $input = new InputElement("monradio", "20-30", 20, "radio", "monradio3"); $form->addElement($input); $input = new InputElement("monradio", "30-40", 30, "radio", "monradio4"); $form->addElement($input); $input = new InputElement("monradio", "40-50", 40, "radio", "monradio5"); $form->addElement($input); $input = new FormElement("textarea", "description", t("Description : "), "Test"); $input->setAttribute("row", 6); $input->setAttribute("col", 18); $input->addClasses("actualite_area_text"); $form->addElement($input); $form->addElement(new ClosedElement("br")); $input = new InputElement("monbutton", null, "Test JS", "button"); $input->setAttribute("onclick", "alert('Test JS OK');"); $form->addElement($input); $theme = new Theme(); $theme->process_form($form); $theme->process_theme(); }
/** * Returns a URL to the item with an optional section parameter * * @param Page $section Parent page to use as the class * @return string */ public function url($section = null) { if (!is_a($section, 'Page') || $section === $this->parent()) { return parent::url(); } return parent::url() . '?section=' . $section->uri(); }
public function testConstruction() { $kirby = $this->kirbyInstance(); $site = $this->siteInstance($kirby); $page = new Page($site, '1-a'); $this->assertInstanceOf('Kirby', $page->kirby()); $this->assertEquals($kirby, $page->kirby()); $this->assertInstanceOf('Site', $page->site()); $this->assertEquals($site, $page->site()); $this->assertInstanceOf('Site', $page->parent()); $this->assertEquals($site, $page->parent()); $this->assertEquals('1-a', $page->dirname()); $this->assertEquals(1, $page->depth()); $this->assertEquals($kirby->roots()->content() . DS . '1-a', $page->root()); $this->assertEquals('1', $page->num()); $this->assertEquals('a', $page->uid()); $this->assertEquals('a', $page->id()); $this->assertEquals('1-a', $page->diruri()); $this->assertEquals('/a', $page->url()); $this->assertTrue($page->isCachable()); $this->assertEquals('a', $page->slug()); $this->assertTrue($page->is($page)); $this->assertTrue($page->equals($page)); $this->assertFalse($page->isSite()); $this->assertFalse($page->isActive()); $this->assertFalse($page->isOpen()); $this->assertTrue($page->isVisible()); $this->assertFalse($page->isInvisible()); $this->assertFalse($page->isHomePage()); $this->assertFalse($page->isErrorPage()); $this->assertEquals($page->id(), (string) $page); }
public function widget_menu_system() { $theme = new Theme(); $list = array(); $list[] = Theme::linking(Page::url("/admin/modules/"), t("<i class=\"fa fa-puzzle-piece fa-fw\"></i> Modules")); $list[] = Theme::linking(Page::url("/admin/database/"), t("<i class=\"fa fa-database fa-fw\"></i> Base de données")); return t("<div class=\"widget_titre\"><i class=\"fa fa-wrench fa-fw\"></i> Système</div>") . $theme->listing($list); }
public function get_avatar() { if (!($fid = Database::getValue("SELECT fid FROM " . CONFIG_DB_PREFIX . "user_avatar WHERE uid = {$this->uid}"))) { return false; } else { return Page::url("/file/{$fid}"); } }
public function hook_timeline() { $type = "Text"; if (isset($_POST['send'])) { $result = $this->render_form_submit($type); $f = new PublicationObject(); $f->content = $result; $f->qrender = "Text"; $f->save(); } $form_publish = '<div class="actualite"> <div class="actualite_avatar_area"> <div class="actualite_avatar avatar" style="background-image:url(' . User::get_user_logged_avatar() . ')"> </div> </div> <div class="quoi_de_neuf_bloc"> <form method="POST" action="">' . $this->render_form($type) . ' <input type="submit" value="publier" name="send"/></form> <div style="position: absolute; display: none; word-wrap: break-word; white-space: pre-wrap; border-left: 0px none rgb(51, 51, 51); border-color: rgb(51, 51, 51); border-style: none; border-width: 0px; font-weight: 400; width: 510px; font-family: monospace; line-height: 14px; font-size: 12px; padding: 10px;"> </div></div> <div class="clear"></div> </div>'; $friendshipO = new FriendshipObject(); $friends = $friendshipO->loadAllFriends(User::get_user_logged_id()); $friends[] = user::get_user_logged_id(); $f = PublicationObject::loadAllByFriendship($friends); $content_publish = ""; $users = array(); $theme = new Theme(); foreach ($f as $t) { if (!isset($users[$t->author])) { $users[$t->author] = new UserObject(); $users[$t->author]->load($t->author); } $u = $users[$t->author]; $content_publish .= '<div class="actualite"> <div class="actualite_avatar_area"> <div class="actualite_avatar avatar" style="background-image:url(' . $u->get_avatar() . ')"> </div> <div class="actualite_nom">' . $theme::linking(Page::url("/profile/{$u->uid}"), $u->firstname . "<br />" . $u->lastname) . '</a></div> </div> <div class="actualite_bloc"> <div class="actualite_area"> <div class="actualite_area_text"> ' . $this->render_render($t->qrender, $t->content) . ' </div> </div> <div class="actualite_buttons"> <div class="actualite_date"><i class="fa fa-calendar fa-fw"></i> ' . date("H:i:s d/m/Y", $t->date_published) . '</div> <div class="clear"></div> </div> </div> <div class="clear"></div> </div>'; } return array($form_publish, '<div class="page_contenu_sep"></div>', $content_publish); }
public function documentation($rubrique, $sousrubrique = 'index') { $r = ""; $rubrique = str_replace(" ", "-", $rubrique); if (file_exists("modules/doc/docs/{$rubrique}/{$sousrubrique}.md")) { $file = file_get_contents("modules/doc/docs/{$rubrique}/{$sousrubrique}.md"); } else { $file = file_get_contents("modules/doc/docs/notfound.md"); } preg_match('/@title:(.*)/', $file, $matches); if (isset($matches[1])) { $file = str_replace("@title:" . $matches[1], "", $file); Theme::set_title($matches[1]); } $p = new Parsedown(); $r = $p->text($file); $theme = new Theme(); $theme->add_to_head("<link rel='stylesheet' href='" . Page::url("/modules/doc/styles/atelier-forest.dark.css") . "'/>"); $theme->add_to_head("<script src='" . Page::url("/modules/doc/highlight.pack.js") . "'></script>"); $theme->add_to_head("<script>hljs.initHighlightingOnLoad();</script>"); $theme->add_to_body("<div style='margin:15px;'>{$r}</div>"); $theme->process_theme(Theme::STRUCT_ADMIN); }
public static function page_upload_content() { $theme = new Theme(); if (isset($_FILES['file'])) { $file = new FileObject(); if ($file->uploadFile($_FILES['file'])) { Notification::statusNotify(t("Le fichier a bien été uploadé."), Notification::STATUS_SUCCESS); } else { Notification::statusNotify(t("Une erreur s'est produite lors de l'upload."), Notification::STATUS_ERROR); } } $f = new Form("POST", Page::url("/file/upload")); $f->setAttribute("enctype", "multipart/form-data"); $t = new InputElement("file", t("Fichier : "), "", "file"); $f->addElement($t); $t = new InputElement("submit-file", "", t("Charger"), "submit"); $f->addElement($t); $formulaire = $theme->forming($f); $theme->set_title("Charger un fichier"); $theme->add_to_body($formulaire); $theme->process_theme(Theme::STRUCT_ADMIN); return; }
public static function page_set_avatar() { $theme = new Theme(); if (isset($_FILES['file'])) { $file = new FileObject(); if ($id_file = $file->uploadFile($_FILES['file'])) { $u = User::get_user_logged(); $u->set_avatar($id_file); header("location: " . Page::url("/profile")); return; } else { Notification::statusNotify(t("Une erreur s'est produite lors de l'upload."), Notification::STATUS_ERROR); } } $f = new Form("POST", Page::url("/profile/settings/avatar")); $f->setAttribute("enctype", "multipart/form-data"); $t = new InputElement("file", t("Fichier : "), "", "file"); $f->addElement($t); $t = new InputElement("submit-file", "", t("Charger"), "submit"); $f->addElement($t); $formulaire = $theme->forming($f); $theme->set_title("Changer mon avatar"); $theme->add_to_body($formulaire); $theme->process_theme(Theme::STRUCT_ADMIN); return; }
/** * Function: update_page * Updates a page when the form is submitted. */ public function update_page() { if (!Visitor::current()->group->can("edit_page")) { show_403(__("Access Denied"), __("You do not have sufficient privileges to edit pages.")); } if (!isset($_POST['hash']) or $_POST['hash'] != Config::current()->secure_hashkey) { show_403(__("Access Denied"), __("Invalid security key.")); } if (empty($_POST['title']) and empty($_POST['slug'])) { error(__("Error"), __("Title and slug cannot be blank.")); } $page = new Page($_POST['id']); if ($page->no_results) { Flash::warning(__("Page not found."), "/admin/?action=manage_pages"); } $page->update($_POST['title'], $_POST['body'], null, $_POST['parent_id'], !empty($_POST['show_in_list']), $page->list_order, null, $_POST['slug']); if (!isset($_POST['ajax'])) { Flash::notice(_f("Page updated. <a href=\"%s\">View Page →</a>", array($page->url())), "/admin/?action=manage_pages"); } }
public static function uninstallWidgetPage($widgetName) { $widget = new WidgetObject(); if ($widget->load($widgetName)) { if ($widget->uninstall($widget)) { header("location: " . Page::url("/admin/view/widget/")); } else { header("location: " . Page::url("/admin/view/widget/?err=install")); } } else { header("location: " . Page::url("/admin/view/widget/?err=unknown")); } return; }
public function _remap($model) { global $admin, $ci, $page; $this->benchmark->mark('page_setup_start'); if (!defined('BLOG')) { define('BLOG', ''); } define('BASE_URL', $this->config->base_url()); $this->poster = md5(BASE_URL); $this->model = $model; $ci = $this; // $ci =& get_instance(); doesn't cut it so ... $errors = ''; do { $errors .= ob_get_clean(); } while (ob_get_level()); ob_start(); session_cache_limiter(''); // turn off automatic sending of cache headers if ($this->model == '#cache#') { $file = func_get_arg(1); $type = array_pop($file); $this->load->driver('resources'); return $this->resources->deliverer->view(implode('/', $file), $type); } $admin = array_merge(array('name' => '', 'email' => '', 'password' => '', 'folder' => ''), (array) $admin); define('ADMIN', !empty($admin['folder']) ? trim($admin['folder'], '/') . '/' : 'admin/'); $uri = $this->uri->uri_string(); $bp_admin = strpos($uri . '/', ADMIN) === 0 ? isset($admin['function']) ? $admin['function'] : true : false; if (!$bp_admin && $this->poster != $this->model) { $uri = str_replace('_', '-', $uri); } $paths = array(); foreach (explode('/', $uri) as $value) { if (($extension = strpos($value, '.')) !== false) { $value = substr($value, 0, $extension); } // remove file extensions if (!empty($value)) { $paths[] = $value; } // remove empty "folders" } $paths = array_diff($paths, array('index')); // remove any reference to 'index' $type = pathinfo($uri, PATHINFO_EXTENSION); if (!empty($type) && in_array($type, array('xml', 'txt', 'less'))) { $desired_url = $this->config->base_url(implode('/', $paths) . '.' . $type); } else { $desired_url = $this->config->site_url($paths) . strstr($_SERVER['REQUEST_URI'], '?'); } $actual_url = (is_https() ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; if ($desired_url != $actual_url) { header('Location: ' . $desired_url, true, 301); exit; } $this->load->driver('session'); $this->load->library('sitemap'); if ($html = $this->sitemap->cached()) { $this->benchmark->mark('page_setup_end'); $this->benchmark->mark('page_display_start'); } else { require_once BASE . 'Page.php'; $page = new Page(); $this->benchmark->mark('page_setup_end'); $this->benchmark->mark('page_content_start'); if ($this->model == $this->poster) { $this->delay_flashdata(); $this->log_analytics('users'); $image = base64_decode('R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7'); header('Expires: Fri, 01 Jan 1990 00:00:00 GMT'); header('Cache-Control: max-age=0, must-revalidate'); header('Content-Length: ' . strlen($image)); header('Content-Type: image/gif'); header('Pragma: no-cache'); exit($image); } elseif ($template = $this->input->post($this->poster)) { $this->delay_flashdata(); $data = array(); $file = BASE_URI . 'blog/content/post.tpl'; if (is_file($file)) { $this->load->driver('blog', array('role' => '#post#')); $this->blog->resources(BASE_URL . 'blog/content/'); $this->load->library('auth'); $vars = array('template' => $template, 'user' => $this->auth->user(), 'uri' => array('id' => $this->sitemap->uri('id'), 'type' => $this->sitemap->uri('type'), 'views' => $this->sitemap->uri('views'))); $this->blog->smarty($file, $vars); $data = $this->compile($page->post); } $data = json_encode($this->filter_links($data)); header('Content-Type: application/json'); header('Content-Length: ' . strlen($data)); exit($data); } elseif ($this->model == '#sitemap#') { $params = func_get_arg(1); $method = array_shift($params); // Either 'robots' or 'xml' $html = $this->sitemap->{$method}(array_shift($params)); } else { if ($bp_admin) { $this->load->driver('blog', array('role' => '#admin#')); if (is_callable($bp_admin)) { $html = $bp_admin(); } elseif ($route = $page->routes(array(ADMIN, ADMIN . '[blog:view]/[published|unpublished|posts|pages' . (is_admin(1) ? '|authors|categories|tags|templates|backup|restore' : null) . ':folder]?', ADMIN . '[sitemap' . (is_admin(1) ? '|setup|errors|plugins|folders|databases' : null) . ':view]', ADMIN . '[users:view]/[logout' . (is_admin(1) ? '|register|edit|list' : null) . ':action]?', ADMIN . '[themes:view]/[download|preview:action]?/[:theme]?/[bootstrap\\.less:less]?', ADMIN . '[analytics:view]/[users|pages|referrers:method]?'))) { if (!isset($route['params']['view'])) { $page->eject(ADMIN . 'blog'); } $view = $route['params']['view']; $this->load->driver('admin', array('file' => $view)); $html = $this->admin->{$view}->view($route['params']); } else { $page->eject(BASE_URL . ADMIN . 'users'); } } elseif ($folder = $page->folder(BASE_URI . 'folders/')) { $this->load->driver('blog', array('role' => '#folder#')); $html = $page->outreach($folder . 'index.php', array('folder' => array('name' => trim(str_replace(BASE_URI . 'folders', '', $folder), '/'), 'url' => str_replace(BASE_URI, BASE_URL, $folder), 'uri' => $folder))); } else { $this->load->driver('blog', array('role' => '#blog#')); if ($file = $this->blog->file($page->get('uri'))) { $html = $this->blog->pages->post($file); } elseif ($route = $page->routes(array(BLOG, BLOG . '/[atom|rss:method].xml', BLOG . '/[archives:method]/[i:year]?/[i:month]?/[i:day]?', BLOG . '/[authors|tags:method]/[:uri]?', BLOG . '/[**:method]' => 'category'))) { $method = isset($route['params']['method']) ? $route['params']['method'] : ($this->input->get('search') ? 'search' : 'index'); if ($route['target'] == 'category') { $method = 'category'; $route['params'] = array_shift($route['params']); if (!is_dir($this->blog->post . $route['params'])) { show_404($page->url()); } } $html = $this->blog->pages->{$method}($route['params']); } else { show_404($page->url()); } } } $this->benchmark->mark('page_content_end'); $this->benchmark->mark('page_display_start'); if ($page->get('type') == 'html') { $html = $this->layout($html); do { $errors .= ob_get_clean(); } while (ob_get_level()); $html = $this->filter_links($page->display($html . $errors)); } if ($this->output->get_content_type() == 'text/html') { $this->output->set_content_type($page->get('type')); } if (trim($errors) == '') { $this->sitemap->update($html); } } $this->log_analytics('hits'); if ($this->session->enable_profiler && $this->output->get_content_type() == 'text/html' && $bp_admin === false) { $this->output->enable_profiler(true); } elseif (trim($errors) == '') { $this->sitemap->may_change(); } do { $errors .= ob_get_clean(); } while (ob_get_level()); // for compression's sake $this->load->view('view', array('html' => $html)); $this->benchmark->mark('page_display_end'); }
public function action_empty_tags() { $empties = Model::factory('Hmanga')->where('tags', '##')->find_many(); foreach ($empties as $hmanga) { $p = new Page(self::$base . $hmanga->url); echo $p->url() . '<br>' . PHP_EOL; $new_info = $this->extract_from_page($p); echo $new_info['tags'] . '<br><br>' . PHP_EOL; $hmanga->tags = $new_info['tags']; $hmanga->save(); } }
public function action_update() { foreach (array('https://www.fakku.net/manga/english', 'https://www.fakku.net/doujinshi/english') as $starting_url) { $page = 1; $next = true; $to_add = array(); while ($next) { $p = new Page($starting_url . ($page > 1 ? '/page/' . $page : '')); echo $p->url() . "<br>\n"; $infos = $this->extract_from_page($p); // if (strpos($p->content(), 'base64')) {print_r($p->content());print_r($infos);exit;}//debug // if (strpos($p->content(), 'ps.googleusercontent.com')) {print_r($p->content());print_r($infos);exit;}//debug foreach ($infos as $k => $info) { if ($this->is_already_exist($info)) { unset($infos[$k]); $next = false; } } // echo '<pre>';print_r($infos);exit; $to_add = array_merge($to_add, $infos); $page++; } $to_add = array_reverse($to_add); // echo '<pre>';print_r($to_add);continue; // save foreach ($to_add as $info) { echo $info['url'] . "<br>\n"; $this->add_hmanga($info); } } }
protected function inlineImage($excerpt) { if (preg_match($this->twig_link_regex, $excerpt['text'], $matches)) { $excerpt['text'] = str_replace($matches[1], '/', $excerpt['text']); $excerpt = parent::inlineImage($excerpt); $excerpt['element']['attributes']['src'] = $matches[1]; $excerpt['extent'] = $excerpt['extent'] + strlen($matches[1]) - 1; return $excerpt; } else { $excerpt['type'] = 'image'; $excerpt = parent::inlineImage($excerpt); } // Some stuff we will need $actions = []; $media = null; // if this is an image if (isset($excerpt['element']['attributes']['src'])) { $alt = $excerpt['element']['attributes']['alt'] ?: ''; $title = $excerpt['element']['attributes']['title'] ?: ''; $class = isset($excerpt['element']['attributes']['class']) ? $excerpt['element']['attributes']['class'] : ''; //get the url and parse it $url = parse_url(htmlspecialchars_decode($excerpt['element']['attributes']['src'])); $this_host = isset($url['host']) && $url['host'] == $this->uri->host(); // if there is no host set but there is a path, the file is local if ((!isset($url['host']) || $this_host) && isset($url['path'])) { $path_parts = pathinfo($url['path']); // get the local path to page media if possible if ($path_parts['dirname'] == $this->page->url(false, false, false)) { // get the media objects for this page $media = $this->page->media(); } else { // see if this is an external page to this one $base_url = rtrim(Grav::instance()['base_url_relative'] . Grav::instance()['pages']->base(), '/'); $page_route = '/' . ltrim(str_replace($base_url, '', $path_parts['dirname']), '/'); $ext_page = $this->pages->dispatch($page_route, true); if ($ext_page) { $media = $ext_page->media(); } } // if there is a media file that matches the path referenced.. if ($media && isset($media->all()[$path_parts['basename']])) { // get the medium object $medium = $media->all()[$path_parts['basename']]; // if there is a query, then parse it and build action calls if (isset($url['query'])) { $url['query'] = htmlspecialchars_decode(urldecode($url['query'])); $actions = array_reduce(explode('&', $url['query']), function ($carry, $item) { $parts = explode('=', $item, 2); $value = isset($parts[1]) ? $parts[1] : null; $carry[] = ['method' => $parts[0], 'params' => $value]; return $carry; }, []); } // loop through actions for the image and call them foreach ($actions as $action) { $medium = call_user_func_array([$medium, $action['method']], explode(',', urldecode($action['params']))); } if (isset($url['fragment'])) { $medium->urlHash($url['fragment']); } $excerpt['element'] = $medium->parseDownElement($title, $alt, $class, true); } else { // not a current page media file, see if it needs converting to relative $excerpt['element']['attributes']['src'] = Uri::buildUrl($url); } } } return $excerpt; }
public static function decline($id_user) { $u = User::get_user_logged_id(); $a = new UserObject(); if ($u != null) { if ($a->load($id_user)) { if (!FriendshipObject::isFriend($u, $id_user) && sizeof($req = FriendshipObject::loadAllPendingRequests($id_user, $u)) > 0) { $friendship = new FriendshipObject(); $friendship->load($id_user, $u); $friendship->delete(); } header("location: " . Page::url("/profile/{$id_user}")); return; } header("location: " . Page::url("/profile")); return; } header("location: " . Page::url("/")); return; }
/** * Renders the HTML for the page or fetches it from the cache * * @param Page $page * @param boolean $headers * @return string */ public function render(Page $page, $data = array(), $headers = true) { // register the currently rendered page $this->page = $page; // send all headers for the page if ($headers) { $page->headers(); } // configure pagination urls $query = (string) $this->request()->query(); $params = (string) $this->request()->params() . r($query, '?') . $query; pagination::$defaults['url'] = $page->url() . r($params, '/') . $params; // cache the result if possible if ($this->options['cache'] and $page->isCachable()) { // try to read the cache by cid (cache id) $cacheId = md5(url::current()); // check for modified content within the content folder // and auto-expire the page cache in such a case if ($this->options['cache.autoupdate'] and $this->cache()->exists($cacheId)) { // get the creation date of the cache file $created = $this->cache()->created($cacheId); // make sure to kill the cache if the site has been modified if ($this->site->wasModifiedAfter($created)) { $this->cache()->remove($cacheId); } } // try to fetch the template from cache $template = $this->cache()->get($cacheId); // fetch fresh content if the cache is empty if (empty($template)) { $template = $this->template($page, $data); // store the result for the next round $this->cache()->set($cacheId, $template); } return $template; } // return a fresh template return $this->template($page, $data); }
public function grab_chapter_urls($start_page_url, $check_database = false) { $p = new Page($start_page_url); // check if there are more pages $p->go_line("class='pages'"); if ($p->curr_line()->exist("class='pages'")) { $m = $p->curr_line()->regex_match("/'>Page 1 \\/ (\\d+)<\\//"); $tot_pages = $m[1]; } else { $tot_pages = 1; } $chapters = array(); if (isset($_GET['limitpage'])) { $tot_pages = $_GET['limitpage']; } for ($i = 1; $i <= $tot_pages; $i++) { $p = new Page($start_page_url . ($i == 1 ? '' : 'page/' . $i . '/')); echo "Grabbing " . $p->url() . "<br/>\n"; // grab all chapter in this page $t_content = new Text($p->content()); $raw = array_unique($t_content->extract_to_array('href="', '"')); foreach ($raw as $e) { if (preg_match('/^http:\\/\\/hentaimangaonline\\.com\\/read-[^\\/]*-hentai-manga-online\\/$/', $e)) { if ($check_database) { if ($this->url_already_exist($e)) { return array_reverse(array_unique($chapters)); } } $chapters[] = $e; } } // return $chapters;//DEBUG } return array_reverse(array_unique($chapters)); }
public function discussions() { if (User::get_user_logged_id() != null) { $messages = MessagesDB::getDiscussions(User::get_user_logged_id()); $theme = new Theme(); $theme->set_title(t("Messagerie")); foreach ($messages as $m) { $user = new UserObject(); $user->load($m->conversation); $messagetype = ""; if ($m->sid == $m->conversation && $m->read == 0) { $messagetype = '<div class="messagerie_bloc_icone"><i class="fa fa-envelope fa-fw" title="Message lu"></i></div>'; } else { if ($m->sid == $m->conversation && $m->read == 1) { $messagetype = '<div class="messagerie_bloc_icone"><i class="fa fa-envelope fa-fw" title="Message lu"></i></div>'; } elseif ($m->rid == $m->conversation && $m->read == 0) { $messagetype = '<div class="messagerie_bloc_icone"><i class="fa fa-reply fa-fw" title="Réponse envoyée"></i></div>'; } else { $messagetype = '<div class="messagerie_bloc_icone"><i class="fa fa-check fa-fw" title="Réponse envoyée et lu"></i></div>'; } } $theme->add_to_body('<div class="messagerie"> <div class="messagerie_avatar_area"> <div class="messagerie_avatar avatar" style="background-image:url(' . $user->get_avatar() . ')"> </div> <div class="messagerie_nom"><a>' . $user->firstname . ' <br/>' . $user->lastname . '</a></div> </div> <div class="messagerie_bloc ' . ($m->read == 0 && $m->sid == $m->conversation ? "messagerie_bloc_new" : "") . '" onclick="window.location.href=\'' . Page::url("/messages/" . $m->conversation) . '\'"> <div class="messagerie_bloc_informations"><span>' . $user->firstname . ' ' . $user->lastname . '</span> : <div class="messagerie_bloc_informations_date"><i class="fa fa-clock-o fa-fw"></i> ' . date(t("d-m-Y à H:i"), $m->sent_on) . '</div></div> <div class="messagerie_bloc_texte"> <div class="messagerie_bloc_texte_inside">' . $m->message . '</div> </div>' . $messagetype . '</div> <div class="clear"></div> </div>'); } $theme->process_theme(Theme::STRUCT_DEFAULT); } }
public function __construct() { self::add_to_head("<script>var jn = { url:function(path){return '" . Page::url("") . "'+path}}</script>"); }
public static function uninstallModulePage($moduleName) { $modules = self::scan_all_modules(); if (isset($modules[$moduleName])) { if (self::uninstall_module($modules[$moduleName]["name"], $modules[$moduleName]["path"])) { header("location: " . Page::url("/admin/modules/")); } else { header("location: " . Page::url("/admin/modules/?err=uninstall")); } } else { header("location: " . Page::url("/admin/modules/?err=unknown")); } return; }
public function creategroup() { $forbidden = array("create"); if (isset($_POST['group_name'])) { $cname = strtolower($_POST['group_name']); if (in_array($cname, $forbidden)) { header("Location:" . Page::url("/admin/groups?err=reserved")); } $group = new GroupObject(); if ($group->load_by_label($cname)) { header("Location:" . Page::url("/admin/groups?err=exists")); } else { $group->label = $cname; $group->save(); header("Location:" . Page::url("/admin/groups")); } } header("Location:" . Page::url("/admin/groups?err=unknown")); }
" rel="stylesheet" type="text/css"> <link href="<?php echo Page::url("/themes/default/styles/font-awesome.min.css"); ?> " rel="stylesheet" type="text/css"> <!-- Scripts --> <script type="text/javascript" src="<?php echo Page::url("/themes/default/scripts/jquery-1.11.2.min.js"); ?> "></script> <script type="text/javascript" src="<?php echo Page::url("/themes/default/scripts/jquery.elastic.source.js"); ?> "></script> <script type="text/javascript" src="<?php echo Page::url("/themes/default/scripts/initTheme_default.js"); ?> "></script> <!-- Meta/Communs à l'appli --> <?php Theme::head(); ?> </head> <body> <div id="lateral_left"></div> <div id="page"> <?php Theme::showMenu(); ?> <div id="page_contenu"> <?php