diff --git a/autoblogs/autoblog.php b/autoblogs/autoblog.php index 660aafa..f499471 100644 --- a/autoblogs/autoblog.php +++ b/autoblogs/autoblog.php @@ -8,7 +8,7 @@ - Source feed MUST be valid UTF-8 - Source feed MUST contain article body - This program is public domain. COPY COPY COPY ! + This program is public domain. COPY COPY COPY! */ $vvbversion = '0.3.0'; if (!version_compare(phpversion(), '5.3.0', '>=')) @@ -121,7 +121,7 @@ function exception_handler($e) exit; } - $error = "Error happened !\n\n". + $error = "Error happened!\n\n". $e->getCode()." - ".$e->getMessage()."\n\nIn: ". $e->getFile() . ":" . $e->getLine()."\n\n"; @@ -692,163 +692,167 @@ if (!$search && !empty($_SERVER['QUERY_STRING']) && !is_numeric($_SERVER['QUERY_ } // common CSS -$css=' * { margin: 0; padding: 0; } - body { font-family:sans-serif; background-color: #efefef; padding: 1%; color: #333; } - img { max-width: 100%; height: auto; } - a { text-decoration: none; color: #000;font-weight:bold; } - .header a { text-decoration: none; color: #000;font-weight:bold; } - .header { text-align:center; padding: 30px 3%; max-width:70em;margin:0 auto; } - .article .title { margin-bottom: 1em; } - .article .title h2 a:hover { color:#403976; } - .article h4 { font-weight: normal; font-size: small; color: #666; } - .article .source a { color: #666; } - .searchForm { float:right; } - .searchForm input { } - .pagination { background-color:white;padding: 12px 10px 12px 10px;border:1px solid #aaa;max-width:70em;margin:1em auto;box-shadow:0px 5px 7px #aaa; } - .pagination b { font-size: 1.2em; color: #333; } - .pagination a { color:#000; margin: 0 0.5em; } - .pagination a:hover { color:#333; } - .footer a { color:#000; } - .footer a:hover { color:#333; } - .content ul, .content ol { margin-left: 2em; } - .content h1, .content h2, .content h3, .content h4, .content h5, .content h6, - .content ul, .content ol, .content p, .content object, .content div, .content blockquote, - .content dl, .content pre { margin-bottom: 0.8em; } - .content pre, .content blockquote { background: #ddd; border: 1px solid #999; padding: 0.2em; max-width: 100%; overflow: auto; } - .content h1 { font-size: 1.5em; } - .content h2 { font-size: 1.4em;color:#000; } - .result h3 a { color: darkblue; text-decoration: none; text-shadow: 1px 1px 1px #fff; } - #error { position: fixed; top: 0; left: 0; right: 0; padding: 1%; background: #fff; border-bottom: 2px solid red; color: darkred; } +$css='* { margin: 0; padding: 0; } + body { font-family:sans-serif; background-color: #efefef; padding: 1%; color: #333; } + img { max-width: 100%; height: auto; } + a { text-decoration: none; color: #000;font-weight:bold; } + body > header a { text-decoration: none; color: #000;font-weight:bold; } + body > header { text-align:center; padding: 30px 3%; max-width:70em;margin:0 auto; } + body > article > header { margin-bottom: 1em; } + body > article > header h2 a:hover { color:#403976; } + body > article h4 { font-weight: normal; font-size: small; color: #666; } + body > article .source a { color: #666; } + body > header > form { float:right; } + body > header > form input { } + body > nav { background-color:white;padding: 12px 10px 12px 10px;border:1px solid #aaa;max-width:70em;margin:1em auto;box-shadow:0px 5px 7px #aaa; } + body > nav strong { font-size: 1.2em; color: #333; } + body > nav a { color:#000; margin: 0 0.5em; } + body > nav a:hover { color:#333; } + body > footer a { color:#000; } + body > footer a:hover { color:#333; } + .content ul, .content ol { margin-left: 2em; } + .content h1, .content h2, .content h3, .content h4, .content h5, .content h6, + .content ul, .content ol, .content p, .content object, .content div, .content blockquote, + .content dl, .content pre { margin-bottom: 0.8em; } + .content pre, .content blockquote { background: #ddd; border: 1px solid #999; padding: 0.2em; max-width: 100%; overflow: auto; } + .content h1 { font-size: 1.5em; } + .content h2 { font-size: 1.4em;color:#000; } + .result h3 a { color: darkblue; text-decoration: none; text-shadow: 1px 1px 1px #fff; } + #error { position: fixed; top: 0; left: 0; right: 0; padding: 1%; background: #fff; border-bottom: 2px solid red; color: darkred; } '; switch($site_type) { case 'microblog': case 'twitter': - $css .= '.header h1 a { color: #333;font-size:40pt;text-shadow: #ccc 0px 5px 5px; } - .article .title h2 { width: 10em;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;font-size: 0.7em;margin: 0; color:#333; text-shadow: 1px 1px 1px #fff; } - .article .title h2 a { color:#333; text-decoration:none; } - .article { background-color:white;padding: 12px 10px 12px 10px;border:1px solid #aaa;max-width:70em;margin:0 auto;box-shadow:0px 5px 7px #aaa; } - .article .source { font-size: 0.8em; color: #666; } - .footer { margin-top:1em;text-align:center; font-size: small; color:#333; clear: both; } - .content {font-size:0.9em;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;}'; + $css .= "\n".' /* twitter/microblog style */ + body > header h1 a { color: #333;font-size:40pt;text-shadow: #ccc 0px 5px 5px; } + body > article > header h2 { width: 10em;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;font-size: 0.7em;margin: 0; color:#333; text-shadow: 1px 1px 1px #fff; } + body > article > header h2 a { color:#333; text-decoration:none; } + body > article { background-color:white;padding: 12px 10px 33px;border:1px solid #aaa;max-width:70em;margin:0 auto;box-shadow:0px 5px 7px #aaa; } + body > article .source { font-size: 0.8em; color: #666; } + body > footer { margin-top:1em;text-align:center; font-size: small; color:#333; clear: both; } + .content {font-size:0.9em;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;}'; break; case 'shaarli': - $css .= '.header h1 a { color: #333;font-size:40pt;text-shadow: #ccc 0px 5px 5px; } - .article .title h2 { margin: 0; color:#333; text-shadow: 1px 1px 1px #fff; } - .article .title h2 a { color:#000; text-decoration:none; } - .article { background-color:white;padding: 12px 10px 12px 10px;border:1px solid #aaa;max-width:70em;margin:1em auto;box-shadow:0px 5px 7px #aaa; } - .article .source { margin-top:1em;font-size: 0.8em; color: #666; } - .footer { text-align:center; font-size: small; color:#333; clear: both; }'; + $css .= "\n".' /* shaarli style */ + body > header h1 a { color: #333;font-size:40pt;text-shadow: #ccc 0px 5px 5px; } + body > article > header title h2 { margin: 0; color:#333; text-shadow: 1px 1px 1px #fff; } + body > article > header h2 a { color:#000; text-decoration:none; } + body > article { background-color:white;padding: 12px 10px 33px;border:1px solid #aaa;max-width:70em;margin:1em auto;box-shadow:0px 5px 7px #aaa; } + body > article footer.source { margin-top:1em;font-size: 0.8em; color: #666; } + body > footer { text-align:center; font-size: small; color:#333; clear: both; }'; break; case 'generic': case 'youtube': default: - $css .= '.header h1 a { color: #333;font-size:40pt;text-shadow: #ccc 0px 5px 5px;text-transform:uppercase; } - .article .title h2 { margin: 0; color:#333; text-shadow: 1px 1px 1px #fff; } - .article .title h2 a { color:#000; text-decoration:none; } - .article .source { font-size: 0.8em; color: #666; } - .article { background-color:white;padding: 12px 10px 12px 10px;border:1px solid #aaa;max-width:70em;margin:1em auto;box-shadow:0px 5px 7px #aaa; } - .footer { text-align:center; font-size: small; color:#333; clear: both; }'; + $css .= "\n".' /* youtube style */ + body > header h1 a { color: #333;font-size:40pt;text-shadow: #ccc 0px 5px 5px;text-transform:uppercase; } + body > article > header h2 { margin: 0; color:#333; text-shadow: 1px 1px 1px #fff; } + body > article > header h2 a { color:#000; text-decoration:none; } + body > article footer.source { font-size: 0.8em; color: #666; } + body > article { background-color:white;padding: 12px 10px 33px;border:1px solid #aaa;max-width:70em;margin:1em auto;box-shadow:0px 5px 7px #aaa; } + body > footer { text-align:center; font-size: small; color:#333; clear: both; }'; } // HTML HEADER -echo ' - - - +echo ' + + '.escape($config->site_title).' '; if( $vvb->mustUpdateXsaf()) { - echo ''; + echo ' '; } echo ' - - -
-

PROJET AUTOBLOG'. (strlen(HEAD_TITLE) > 0 ? ' ~ '. HEAD_TITLE : '') .'

-
-

'.escape($config->site_title).'

'; - -if (!empty($config->site_description)) - echo '

'.$config->site_description.'
⇐ retour index

'; + + +
+

PROJET AUTOBLOG'. (strlen(HEAD_TITLE) > 0 ? ' ~ '. HEAD_TITLE : '') .'

+
+

'.escape($config->site_title).'

'; + + if (!empty($config->site_description)) + echo ' +

'.$config->site_description.'

+

⇐ retour index

'; echo ' -
-
- - -
-
-
+
+ + +
+ '; if( $vvb->mustUpdateXsaf()) { echo ' -
-
-

'.__('Update').'

-
-
- '.__('Import running: '). $vvb->getXsafCounter() . __(' files remaining').'
- '.__('The page should refresh every second. If not, refresh manually.').' -
-
'; +
+
+

'.__('Update').'

+
+
+ '.__('Import running: '). $vvb->getXsafCounter() . __(' files remaining').'
+ '.__('The page should refresh every second. If not, refresh manually.').' +
+
'; } elseif ($vvb->mustUpdate()) { echo ' -
-
-

'.__('Update').'

-
-
- '.__('Updating database... Please wait.').' -
-
'; +
+
+

'.__('Update').'

+
+
+ '.__('Updating database... Please wait.').' +
+
'; } if (!empty($search)) { $results = $vvb->searchArticles($search); - $text = sprintf(__('%d results for %s'), count($results), escape($search)); + $text = sprintf(__('%d results for %s'), count($results), escape($search)); echo ' -
-
-

'.__('Search').'

- '.$text.' -
-
'; +
+
+

'.__('Search').'

+ '.$text.' +
+
'; foreach ($results as $art) { echo ' -
-

'.escape($art['title']).'

-

'.$art['content'].'

-
'; + '; } } elseif (!is_null($article)) { if (!$article) { - echo ' -
-
-

'.__('Not Found').'

- '.(!empty($uri) ? '

'.escape($vvb->getLocalURL($uri)) . '

' : '').' - '.__('Article not found.').' -
-
'; + echo ' +
+
+

'.__('Not Found').'

+ '.(!empty($uri) ? '

'.escape($vvb->getLocalURL($uri)) . '

' : '').' + '.__('Article not found.').' +
+
'; } else { - display_article($article); + display_article($article); } } else @@ -868,31 +872,31 @@ else $max = $vvb->countArticles(); if ($max > $config->articles_per_page) { - echo ''; + echo ' '; } } echo ' -'; + '; if( $vvb->mustUpdateXsaf() ) { try { @@ -910,9 +914,9 @@ if( $vvb->mustUpdateXsaf() ) { catch (VroumVroum_Feed_Exception $e) { echo ' -
- '.escape($e->getMessage()).' -
'; +
+ '.escape($e->getMessage()).' +
'; $updated = 0; } } @@ -933,34 +937,34 @@ elseif ($vvb->mustUpdate()) catch (VroumVroum_Feed_Exception $e) { echo ' -
+
'.escape($e->getMessage()).' -
'; +
'; $updated = 0; } if ($updated > 0) { echo ' - '; + '; } else { echo ' - '; + '; } } echo ' - + '; @@ -976,15 +980,14 @@ function display_article($article) { global $vvb, $config; echo ' -
-
-

'.escape($article['title']).'

- '.strftime(__('_date_format'), $article['date']).' -
-
'.escape_content($article['content']).'
-

'.__('Source:').' '.escape($article['url']).'

-
-
'; + '; } ?>