<?php $pages = $this->Pages_model->getPages(); $body_class = ''; if ($this->uri->rsegment(1) === 'menus') { $body_class = 'menus-page'; } echo get_doctype(); ?> <html xmlns="http://www.w3.org/1999/xhtml" lang="en"> <head> <?php echo get_metas(); ?> <?php echo get_favicon(); ?> <title><?php echo sprintf(lang('site_title'), get_title(), config_item('site_name')); ?> </title> <?php echo get_style_tags(); ?> <?php echo get_active_styles(); ?> <?php echo get_script_tags(); ?> <?php
defined('BASEPATH') or exit('No direct script access allowed'); ?> <!DOCTYPE html> <html lang="pt_BR"> <head> <!-- Title --> <title>Sistema de Administração</title> <meta content="width=device-width, initial-scale=1" name="viewport"/> <meta charset="UTF-8"> <!-- Favicon --> <link rel="shortcut icon" type="image/ico" href="<?php echo base_url('assets/images/logomarca/' . get_favicon()); ?> "/> <!-- Styles --> <link href='http://fonts.googleapis.com/css?family=Open+Sans:400,300,600' rel='stylesheet' type='text/css'> <link href="<?php echo base_url('assets/plugins/pace-master/themes/blue/pace-theme-flash.css'); ?> " rel="stylesheet"/> <link href="<?php echo base_url('assets/plugins/uniform/css/uniform.default.min.css'); ?> " rel="stylesheet"/> <link href="<?php echo base_url('assets/plugins/bootstrap/css/bootstrap.min.css');
include 'action/action.php'; if (isset($_SESSION['flash'])) { echo $_SESSION['flash']; unset($_SESSION['flash']); } ?> <div class="general_box favicon"> <p>Favicon: </p> <form enctype="multipart/form-data" action="#" method="POST"> <input type="file" name="favicon" size=35 /> <input type="submit" name="favicon_ok" value=" OK " /> </form> <div class="show_box show_favicon"> <?php if ($favicon = get_favicon($con, $options)) { ?> <img src="/images/<?php echo $favicon; ?> "> <?php } else { ?> <img src="/images/favicon.ico"> <?php } ?> </div> </div> <div class="general_box title"> <p>Tytuł witryny: </p>
function add_feed_logo() { $feed_logo = get_favicon(get_bloginfo('admin_email'), 48); echo "\n <image>\n <title>" . get_bloginfo('name') . "</title>\n <url>" . $feed_logo . "</url>\n <link>" . get_bloginfo('siteurl') . "</link>\n </image>\n"; }
/** * Refresh the specified feeds and returns an array with URLs in error * * @param $feeds should be an array of associative arrays ('id', 'url', 'post'} as values. post is a JSON array of post parameters to send with the URL. * @param $update_feeds_infos should be true to update the feed infos from values in the RSS / ATOM * @todo assert(false) */ function refresh_feeds($feeds, $check_favicons = false, $verbose = true) { global $dbh, $config; // TODO: Import tag from feeds // Download the feeds $download = curl_downloader($feeds, true, $verbose); $errors = array(); $favicons_to_check = array(); foreach ($download['status_codes'] as $url => $status_code) { // Keep the errors to return them and display them to the user if ($status_code != 200) { $errors[] = array('url' => $url, 'msg' => 'Feed page not found (http status: ' . $status_code . ')'); unset($download['results'][$url]); } elseif (!startswith($download['content_types'][$url], 'application/xml') && !startswith($download['content_types'][$url], 'text/xml') && !startswith($download['content_types'][$url], 'application/rss+xml') && !startswith($download['content_types'][$url], 'application/atom+xml')) { $errors[] = array('url' => $url, 'msg' => 'Unable to find a feed at the address ' . $url); unset($download['results'][$url]); } } $updated_feeds = $download['results']; // Put everything in a transaction to make it faster $dbh->beginTransaction(); // Delete old tags which were not user added delete_auto_added_tags(); // Query to update feeds table with latest infos in the RSS / ATOM $query_feeds = $dbh->prepare('UPDATE feeds SET title=(CASE WHEN has_user_title=1 THEN title ELSE :title END), links=:links, description=:description, ttl=(CASE WHEN has_user_ttl=1 THEN ttl ELSE :ttl END), image=:image WHERE url=:old_url'); $query_feeds->bindParam(':title', $feed_title); $query_feeds->bindParam(':links', $feed_links); $query_feeds->bindParam(':description', $feed_description); $query_feeds->bindParam(':ttl', $feed_ttl, PDO::PARAM_INT); $query_feeds->bindParam(':image', $image); $query_feeds->bindParam(':old_url', $url); // Two queries, to upsert (update OR insert) entries : update the existing entry and insert a new one if the update errorred $query_entries = $dbh->prepare('UPDATE entries SET authors=:authors, title=:title, links=:links, description=:description, content=:content, enclosures=:enclosures, comments=:comments, pubDate=:pubDate, lastUpdate=:lastUpdate WHERE guid=:guid'); $query_entries->bindParam(':authors', $authors); $query_entries->bindParam(':title', $title); $query_entries->bindParam(':links', $links); $query_entries->bindParam(':description', $description); $query_entries->bindParam(':content', $content); $query_entries->bindParam(':enclosures', $enclosures); $query_entries->bindParam(':comments', $comments); $query_entries->bindParam(':guid', $guid); $query_entries->bindParam(':pubDate', $pubDate, PDO::PARAM_INT); $query_entries->bindParam(':lastUpdate', $last_update, PDO::PARAM_INT); $query_entries_fail = $dbh->prepare('INSERT INTO entries(feed_id, authors, title, links, description, content, enclosures, comments, pubDate, lastUpdate, guid) VALUES(:feed_id, :authors, :title, :links, :description, :content, :enclosures, :comments, :pubDate, :lastUpdate, :guid)'); $query_entries_fail->bindParam(':feed_id', $feed_id); $query_entries_fail->bindParam(':authors', $authors); $query_entries_fail->bindParam(':title', $title); $query_entries_fail->bindParam(':links', $links); $query_entries_fail->bindParam(':description', $description); $query_entries_fail->bindParam(':content', $content); $query_entries_fail->bindParam(':enclosures', $enclosures); $query_entries_fail->bindParam(':comments', $comments); $query_entries_fail->bindParam(':guid', $guid); $query_entries_fail->bindParam(':pubDate', $pubDate, PDO::PARAM_INT); $query_entries_fail->bindParam(':lastUpdate', $last_update, PDO::PARAM_INT); // Query to insert tags if not already existing $query_insert_tag = $dbh->prepare('INSERT OR IGNORE INTO tags(name) VALUES(:name)'); $query_insert_tag->bindParam(':name', $tag_name); // Register the tags of the feed $query_feeds_tags = $dbh->prepare('INSERT OR IGNORE INTO tags_feeds(tag_id, feed_id, auto_added_tag) VALUES((SELECT id FROM tags WHERE name=:name), :feed_id, 1)'); $query_feeds_tags->bindParam(':name', $tag_name); $query_feeds_tags->bindParam(':feed_id', $feed_id); // Finally, query to register the tags of the entry $query_tags = $dbh->prepare('INSERT OR IGNORE INTO tags_entries(tag_id, entry_id, auto_added_tag) VALUES((SELECT id FROM tags WHERE name=:name), (SELECT id FROM entries WHERE guid=:entry_guid), 1)'); $query_tags->bindParam(':name', $tag_name); $query_tags->bindParam(':entry_guid', $guid); foreach ($updated_feeds as $url => $feed) { $array_feed_id = multiarray_search_key('url', $url, $feeds); if ($feed_id === -1) { assert(false); // TODO exit; } $feed_id = $feeds[$array_feed_id]['id']; // Parse feed $parsed = @feed2array($feed); // If an error has occurred, keep a trace of it if ($parsed === false || empty($parsed['infos']) || empty($parsed['items'])) { $errors[] = array('url' => $url, 'msg' => 'Unable to parse feed file'); continue; } // Define feed params $feed_title = isset($parsed['infos']['title']) ? $parsed['infos']['title'] : ''; $feed_links = isset($parsed['infos']['links']) ? json_encode(multiarray_filter('rel', 'self', $parsed['infos']['links'])) : ''; $feed_description = isset($parsed['infos']['description']) ? $parsed['infos']['description'] : ''; $feed_ttl = isset($parsed['infos']['ttl']) ? $parsed['infos']['ttl'] : 0; $feed_image = isset($parsed['infos']['image']) ? json_encode($parsed['infos']['image']) : ''; if ($check_favicons && empty($feed_image)) { $favicons_to_check[] = array('url' => $url); } $query_feeds->execute(); // Feeds tags if ($feeds[$array_feed_id]['import_tags_from_feed']) { if (!empty($parsed['infos']['categories'])) { foreach ($parsed['infos']['categories'] as $tag_name) { // Create tags if needed, get their id and add bind the articles to these tags $query_insert_tag->execute(); $query_feeds_tags->execute(); } } } // Insert / Update entries $items = $parsed['items']; foreach ($items as $event) { $authors = isset($event['authors']) ? json_encode($event['authors']) : ''; $title = isset($event['title']) ? $event['title'] : ''; $links = isset($event['links']) ? json_encode(multiarray_filter('rel', 'self', $event['links'])) : ''; $description = isset($event['description']) ? $event['description'] : ''; $content = isset($event['content']) ? $event['content'] : ''; $enclosures = isset($event['enclosures']) ? json_encode($event['enclosures']) : ''; if (isset($event['comments'])) { $comments = $event['comments']; } else { if (isset($event['links'])) { $tmp = multiarray_search('rel', 'replies', $event['links'], array('href' => '')); $comments = $tmp['href']; } else { $comments = ''; } } $guid = isset($event['guid']) ? $event['guid'] : ''; $pubDate = isset($event['pubDate']) ? $event['pubDate'] : ''; $last_update = isset($event['updated']) ? $event['updated'] : ''; $query_entries->execute(); if ($query_entries->rowCount() == 0) { $query_entries_fail->execute(); } if ($feeds[$array_feed_id]['import_tags_from_feed']) { if (!empty($event['categories'])) { foreach ($event['categories'] as $tag_name) { // Create tags if needed, get their id and add bind the articles to these tags $query_insert_tag->execute(); $query_tags->execute(); } } } if (!empty($event['enclosures'])) { foreach ($event['enclosures'] as $enclosure) { $tag_name = '_type_' . get_category_mime_type($enclosure['type']); if ($tag_name !== false) { $query_tags->execute(); } } } } } // Check favicons if ($check_favicons && !empty($favicons_to_check)) { $favicons = get_favicon($favicons_to_check); $favicons = $favicons['favicons']; $query_favicon = $dbh->prepare('UPDATE feeds SET image=:image WHERE url=:url'); $query_favicon->bindParam(':url', $url); $query_favicon->bindParam(':image', $image); foreach ($favicons as $url => $favicon) { if (!empty($favicon[0]['favicon_url'])) { $image = $favicon[0]['favicon_url']; $query_favicon->execute(); } } } $dbh->commit(); delete_old_entries(); return $errors; }
if (!function_exists('file_put_contents')) { function file_put_contents($filename, $data) { $fp = fopen($filename, is_file($filename) ? 'r+b' : 'wb'); if ($fp === false) { return false; } flock($fp, LOCK_EX); rewind($fp); $bytes = fwrite($fp, $data); fflush($fp); ftruncate($fp, ftell($fp)); flock($fp, LOCK_UN); fclose($fp); return $bytes; } } if (isset($_GET['clear'])) { clear_cache($_GET['clear']); exit('ok'); } $favicon = false; if (isset($_GET['url'])) { $favicon = get_favicon(rawurldecode($_GET['url'])); } if ($favicon === false) { output_image('ErrorIcon'); exit; } output_icon($favicon); exit;