[pLog-svn] r2539 - in plog/trunk: . class/dao class/data
class/gallery/resizers class/locale class/net
class/summary/dao class/template templates/rss
jondaley at devel.plogworld.net
jondaley at devel.plogworld.net
Tue Nov 1 19:38:42 GMT 2005
Author: jondaley
Date: 2005-11-01 19:38:41 +0000 (Tue, 01 Nov 2005)
New Revision: 2539
Modified:
plog/trunk/class/dao/searchengine.class.php
plog/trunk/class/data/textfilter.class.php
plog/trunk/class/gallery/resizers/gallerygdresizer.class.php
plog/trunk/class/locale/locale.class.php
plog/trunk/class/net/modrewriterequestgenerator.class.php
plog/trunk/class/summary/dao/summarystats.class.php
plog/trunk/class/template/template.class.php
plog/trunk/rss.php
plog/trunk/templates/rss/rss10.template
plog/trunk/templates/rss/rss20.template
plog/trunk/wizard.php
Log:
merged 1.0.2 branch 2478:2538 to trunk. small steps are nicer than huge merges.
Modified: plog/trunk/class/dao/searchengine.class.php
===================================================================
--- plog/trunk/class/dao/searchengine.class.php 2005-10-31 04:54:13 UTC (rev 2538)
+++ plog/trunk/class/dao/searchengine.class.php 2005-11-01 19:38:41 UTC (rev 2539)
@@ -167,8 +167,12 @@
a.properties AS properties, t.normalized_text AS normalized_text,
t.normalized_topic AS normalized_topic, a.status AS status, a.slug AS slug,
1 AS relevance
- FROM {$prefix}articles a, {$prefix}articles_text t
- WHERE {$where_string} AND a.id = t.article_id AND a.status = $status";
+ FROM {$prefix}articles a
+ LEFT JOIN {$prefix}articles_text t ON a.id=t.article_id
+ LEFT JOIN {$prefix}blogs b ON a.blog_id=b.id
+ WHERE {$where_string} AND a.status = $status
+ AND b.show_in_summary=1 AND b.status=".BLOG_STATUS_ACTIVE;
+
if( $blogId > 0 )
$searchQuery .= " AND a.blog_id = '".Db::qstr($blogId)."'";
if( $userId > 0 )
@@ -258,10 +262,14 @@
a.properties AS properties, t.normalized_text AS normalized_text,
t.normalized_topic AS normalized_topic, a.status AS status, a.slug AS slug,
1 AS relevance
- FROM {$prefix}custom_fields_values v, {$prefix}articles a, {$prefix}articles_text t
- WHERE (v.field_value LIKE '%{$query}%') AND v.article_id = a.id AND a.status = $status
- AND t.article_id = a.id";
- if( $blogId > 0 )
+ FROM {$prefix}custom_fields_values v
+ LEFT JOIN {$prefix}articles a ON v.article_id = a.id
+ LEFT JOIN {$prefix}articles_text t ON a.id=t.article_id
+ LEFT JOIN {$prefix}blogs b ON a.blog_id=b.id
+ WHERE (v.field_value LIKE '%{$query}%') AND a.status = $status
+ AND b.show_in_summary=1 AND b.status=".BLOG_STATUS_ACTIVE;
+
+ if( $blogId > 0 )
$searchQuery .= " AND a.blog_id = '".Db::qstr($blogId)."' ";
if( $userId > 0 )
$searchQuery .= " AND a.user_id = '".Db::qstr($userId)."' ";
@@ -275,7 +283,7 @@
//print "<hr />";
return $this->_getQueryResults( $searchQuery, SEARCH_RESULT_CUSTOM_FIELD );
}
-
+
/**
* Returns an array of SearchResult objects containing information about the search, such as the
* relevance (not very relevant, though :)), and the ArticleObject
@@ -312,9 +320,12 @@
a.properties AS properties, t.normalized_text AS normalized_text,
t.normalized_topic AS normalized_topic, a.status AS status, a.slug AS slug,
1 AS relevance
- FROM {$prefix}articles_comments c, {$prefix}articles a, {$prefix}articles_text t
- WHERE {$where_string} AND c.article_id = a.id AND a.status = $status AND c.status = 0
- AND t.article_id = a.id";
+ FROM {$prefix}articles_comments c
+ LEFT JOIN {$prefix}articles a ON c.article_id = a.id
+ LEFT JOIN {$prefix}articles_text t ON a.id=t.article_id
+ LEFT JOIN {$prefix}blogs b ON a.blog_id=b.id
+ WHERE {$where_string} AND a.status = $status AND c.status = 0
+ AND b.show_in_summary=1 AND b.status=".BLOG_STATUS_ACTIVE;
if( $blogId > 0 )
$searchQuery .=" AND a.blog_id = '".Db::qstr($blogId)."' ";
if( $userId > 0 )
Modified: plog/trunk/class/data/textfilter.class.php
===================================================================
--- plog/trunk/class/data/textfilter.class.php 2005-10-31 04:54:13 UTC (rev 2538)
+++ plog/trunk/class/data/textfilter.class.php 2005-11-01 19:38:41 UTC (rev 2539)
@@ -279,12 +279,7 @@
* 1.0 First Version
*/
function balanceTags($text, $is_comment = 0)
- {
-
- if (get_settings('use_balanceTags') == 0) {
- return $text;
- }
-
+ {
$tagstack = array(); $stacksize = 0; $tagqueue = ''; $newtext = '';
# WP bug fix for comments - in case you REALLY meant to type '< !--'
@@ -293,10 +288,10 @@
$text = preg_replace('#<([0-9]{1})#', '<$1', $text);
while (preg_match("/<(\/?\w*)\s*([^>]*)>/",$text,$regex)) {
- $newtext = $newtext . $tagqueue;
+ $newtext .= $tagqueue;
$i = strpos($text,$regex[0]);
- $l = strlen($tagqueue) + strlen($regex[0]);
+ $l = strlen($regex[0]);
// clear the shifter
$tagqueue = '';
@@ -332,32 +327,46 @@
// Tag Cleaning
- // Push if not img or br or hr
- if($tag != 'br' && $tag != 'img' && $tag != 'hr') {
+ // If self-closing or '', don't do anything.
+ if((substr($regex[2],-1) == '/') || ($tag == '')) {
+ }
+ // ElseIf it's a known single-entity tag but it doesn't close itself, do so
+ elseif ($tag == 'br' || $tag == 'img' || $tag == 'hr' || $tag == 'input') {
+ $regex[2] .= '/';
+ } else { // Push the tag onto the stack
+ // If the top of the stack is the same as the tag we want to push, close previous tag
+ if (($stacksize > 0) && ($tag != 'div') && ($tagstack[$stacksize - 1] == $tag)) {
+ $tagqueue = '</' . array_pop ($tagstack) . '>';
+ $stacksize--;
+ }
$stacksize = array_push ($tagstack, $tag);
}
// Attributes
- // $attributes = $regex[2];
$attributes = $regex[2];
if($attributes) {
$attributes = ' '.$attributes;
}
$tag = '<'.$tag.$attributes.'>';
+ //If already queuing a close tag, then put this tag on, too
+ if ($tagqueue) {
+ $tagqueue .= $tag;
+ $tag = '';
+ }
}
$newtext .= substr($text,0,$i) . $tag;
$text = substr($text,$i+$l);
}
// Clear Tag Queue
- $newtext = $newtext . $tagqueue;
+ $newtext .= $tagqueue;
// Add Remaining text
$newtext .= $text;
// Empty Stack
while($x = array_pop($tagstack)) {
- $newtext = $newtext . '</' . $x . '>'; // Add remaining tags to close
+ $newtext .= '</' . $x . '>'; // Add remaining tags to close
}
// WP fix for the bug with HTML comments
Modified: plog/trunk/class/gallery/resizers/gallerygdresizer.class.php
===================================================================
--- plog/trunk/class/gallery/resizers/gallerygdresizer.class.php 2005-10-31 04:54:13 UTC (rev 2538)
+++ plog/trunk/class/gallery/resizers/gallerygdresizer.class.php 2005-11-01 19:38:41 UTC (rev 2539)
@@ -44,7 +44,7 @@
if( !$this->thumbnail( $this->_image ))
return false;
- if( ($this->img["lebar"] < $width) || ($this->img["tinggi"] < $height) ) {
+ if( ($this->img["lebar"] < $width) && ($this->img["tinggi"] < $height) ) {
$this->img["lebar_thumb"] = $this->img["lebar"];
$this->img["tinggi_thumb"] = $this->img["tinggi"];
}
Modified: plog/trunk/class/locale/locale.class.php
===================================================================
--- plog/trunk/class/locale/locale.class.php 2005-10-31 04:54:13 UTC (rev 2538)
+++ plog/trunk/class/locale/locale.class.php 2005-11-01 19:38:41 UTC (rev 2539)
@@ -700,6 +700,20 @@
return $text;
}
+
+ /**
+ * Formats a date as an RFC 822 date timestamp.
+ * @see formatDate
+ */
+ function formatDateAsRFC822( $timestamp, $blog = null )
+ {
+ $locale = $this->getLocaleCode();
+ $this->setLocale( "en_UK" );
+ $rfc822Date = $this->formatDate( $timestamp, "%a, %d %b %Y %H:%M:%S %O", $blog );
+ $this->setLocale( $locale );
+
+ return( $rfc822Date );
+ }
/**
* merges two locales
Modified: plog/trunk/class/net/modrewriterequestgenerator.class.php
===================================================================
--- plog/trunk/class/net/modrewriterequestgenerator.class.php 2005-10-31 04:54:13 UTC (rev 2538)
+++ plog/trunk/class/net/modrewriterequestgenerator.class.php 2005-11-01 19:38:41 UTC (rev 2539)
@@ -204,7 +204,7 @@
if( $blogInfo == null )
$link = $this->getBaseUrl().'/'.$this->_blogInfo->getId().'_'.StringUtils::text2url( $this->_blogInfo->getBlog() ).'/feeds/categories/'.$category->getId().'_'.StringUtils::text2url( $category->getName() ).'/';
else
- $link = $this->getBaseUrl().'/'.$blogInfo->getId().'_'.StringUtils::text2url( $bloginfo->getBlog() ).'/feeds/categories/'.$category->getId().'_'.StringUtils::text2url( $category->getName() ).'/';
+ $link = $this->getBaseUrl().'/'.$blogInfo->getId().'_'.StringUtils::text2url( $blogInfo->getBlog() ).'/feeds/categories/'.$category->getId().'_'.StringUtils::text2url( $category->getName() ).'/';
if( $profile != "" )
$link .= $profile;
Modified: plog/trunk/class/summary/dao/summarystats.class.php
===================================================================
--- plog/trunk/class/summary/dao/summarystats.class.php 2005-10-31 04:54:13 UTC (rev 2538)
+++ plog/trunk/class/summary/dao/summarystats.class.php 2005-11-01 19:38:41 UTC (rev 2539)
@@ -110,8 +110,9 @@
a.status as status,
a.num_reads as num_reads,
a.slug as slug
- FROM {$prefix}articles a
- WHERE status = ".POST_STATUS_PUBLISHED."
+ FROM {$prefix}articles a, {$prefix}blogs b
+ WHERE a.status = ".POST_STATUS_PUBLISHED."
+ AND a.blog_id = b.id AND b.status = ".BLOG_STATUS_ACTIVE."
AND a.date <= ".$this->_now." AND a.date > ".$this->_sevenDaysAgo;
$query .= " ORDER BY a.num_reads DESC ";
Modified: plog/trunk/class/template/template.class.php
===================================================================
--- plog/trunk/class/template/template.class.php 2005-10-31 04:54:13 UTC (rev 2538)
+++ plog/trunk/class/template/template.class.php 2005-11-01 19:38:41 UTC (rev 2539)
@@ -68,7 +68,7 @@
$config =& Config::getConfig();
$this->cache_dir = $config->getValue( 'temp_folder' );
- $this->_templateFile = $templateFile;
+ $this->_templateFile = $templateFile;
// enable the security settings
$this->php_handling = false;
@@ -85,6 +85,7 @@
// default folders
$this->compile_dir = $config->getValue( 'temp_folder' );
$this->template_dir = $config->getValue( 'template_folder' );
+ $this->config_dir = $config->getValue( 'template_folder' );
$this->compile_check = $config->getValue( 'template_compile_check', true );
// this helps if php is running in 'safe_mode'
$this->use_sub_dirs = false;
Modified: plog/trunk/rss.php
===================================================================
--- plog/trunk/rss.php 2005-10-31 04:54:13 UTC (rev 2538)
+++ plog/trunk/rss.php 2005-11-01 19:38:41 UTC (rev 2539)
@@ -17,6 +17,7 @@
$request =& HttpVars::getRequest();
if( isset($request["summary"])) {
$request["op"] = "rss";
+ HttpVars::setRequest( $request );
include_once( PLOG_CLASS_PATH."summary.php" );
die();
}
Modified: plog/trunk/templates/rss/rss10.template
===================================================================
--- plog/trunk/templates/rss/rss10.template 2005-10-31 04:54:13 UTC (rev 2538)
+++ plog/trunk/templates/rss/rss10.template 2005-11-01 19:38:41 UTC (rev 2539)
@@ -16,11 +16,11 @@
<dc:date>{$smarty.now|date_format:"%Y-%m-%dT%H:%M:%S"}Z</dc:date>
<admin:generatorAgent rdf:resource="http://www.plogworld.net" />
<items>
- <rdf:seq>
+ <rdf:Seq>
{foreach from=$posts item=post}
<rdf:li rdf:resource="{$url->postPermalink($post)}" />
{/foreach}
- </rdf:seq>
+ </rdf:Seq>
</items>
</channel>
{foreach from=$posts item=post}
Modified: plog/trunk/templates/rss/rss20.template
===================================================================
--- plog/trunk/templates/rss/rss20.template 2005-10-31 04:54:13 UTC (rev 2538)
+++ plog/trunk/templates/rss/rss20.template 2005-11-01 19:38:41 UTC (rev 2539)
@@ -4,12 +4,11 @@
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
>
-{$locale->setLocale("en_UK")}
<channel>
<title>{$blog->getBlog()|escape}</title>
<link>{$url->blogLink()}</link>
<description>{$blog->getAbout()|escape}</description>
- <pubDate>{$locale->formatDate($now, "%a, %d %b %Y %H:%M:%S %O")}</pubDate>
+ <pubDate>{$locale->formatDateAsRFC822($now)}</pubDate>
<generator>http://www.plogworld.net</generator>
{foreach from=$posts item=post}
<item>
@@ -26,7 +25,7 @@
<category>{$category->getName()|escape}</category>
{/foreach}
{assign var="postDate" value=$post->getDateObject()}
- <pubDate>{$locale->formatDate($postDate, "%a, %d %b %Y %H:%M:%S %O", $blog)}</pubDate>
+ <pubDate>{$locale->formatDateAsRFC822($postDate, $blog)}</pubDate>
<source url="{$url->rssLink("rss20")}">{$blog->getBlog()|escape}</source>
{foreach from=$post->getArticleResources() item=resource}
{** please uncomment the line below if you'd like to server everything but images, instead of
@@ -39,5 +38,4 @@
</item>
{/foreach}
</channel>
-</rss>
-
+</rss>
\ No newline at end of file
Modified: plog/trunk/wizard.php
===================================================================
--- plog/trunk/wizard.php 2005-10-31 04:54:13 UTC (rev 2538)
+++ plog/trunk/wizard.php 2005-11-01 19:38:41 UTC (rev 2539)
@@ -578,17 +578,16 @@
$Inserts[104] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES('default_time_offset', '0', 3);";
$Inserts[105] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES('template_cache_enabled', '1', 1);";
$Inserts[106] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES('template_http_cache_enabled', '0', 1);";
-$Inserts[107] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES('template_http_cache_enabled', '0', 1);";
-$Inserts[108] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES('template_compile_check', '1', 1);";
-$Inserts[109] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES('update_cached_article_reads', '1', 1);";
-$Inserts[110] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES('allow_php_code_in_templates', '0', 1);";
-$Inserts[111] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES('thumbnail_generator_use_smoothing_algorithm', '1', 1);";
-$Inserts[112] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES('template_cache_lifetime', '-1', 3);";
-$Inserts[113] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES('use_http_accept_language_detection', '0', 1);";
-$Inserts[114] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES('session_save_path', '', 3);";
-$Inserts[115] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES('skip_dashboard', '0', 1);";
-$Inserts[116] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES('use_captcha_auth', '0', 1);";
-$Inserts[117] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES('page_suffix_format', '/page/{page}', 3);";
+$Inserts[107] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES('template_compile_check', '1', 1);";
+$Inserts[108] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES('update_cached_article_reads', '1', 1);";
+$Inserts[109] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES('allow_php_code_in_templates', '0', 1);";
+$Inserts[110] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES('thumbnail_generator_use_smoothing_algorithm', '1', 1);";
+$Inserts[111] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES('template_cache_lifetime', '-1', 3);";
+$Inserts[112] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES('use_http_accept_language_detection', '0', 1);";
+$Inserts[113] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES('session_save_path', '', 3);";
+$Inserts[114] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES('skip_dashboard', '0', 1);";
+$Inserts[115] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES('use_captcha_auth', '0', 1);";
+$Inserts[116] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES('page_suffix_format', '/page/{page}', 3);";
/**
* Open a connection to the database
More information about the pLog-svn
mailing list