[pLog-svn] r1351 - in plog/trunk/class: action net
oscar at devel.plogworld.net
oscar at devel.plogworld.net
Tue Mar 8 22:09:40 GMT 2005
Author: oscar
Date: 2005-03-08 22:09:40 +0000 (Tue, 08 Mar 2005)
New Revision: 1351
Modified:
plog/trunk/class/action/blogaction.class.php
plog/trunk/class/net/customrequestgenerator.class.php
plog/trunk/class/net/customurlhandler.class.php
plog/trunk/class/net/linkparser.class.php
Log:
Looks like I forgot to implement support to access blogs via the username of their owner. Just replace {blogname} next to /blog/ with {blogowner} *everywhere*. I couldn't use {username} because it's already used in places like the post_permalink_format link format and I couldn't use the same one in both places...
Modified: plog/trunk/class/action/blogaction.class.php
===================================================================
--- plog/trunk/class/action/blogaction.class.php 2005-03-08 22:06:32 UTC (rev 1350)
+++ plog/trunk/class/action/blogaction.class.php 2005-03-08 22:09:40 UTC (rev 1351)
@@ -154,10 +154,10 @@
$userInfo = $users->getUserInfoFromUsername( $userName );
// if the user exists and is valid...
if( $userInfo ) {
- $userBlogs = $users->getUsersBlogs( $userInfo->getId());
+ $userBlogs = $users->getUsersBlogs( $userInfo->getId(), BLOG_STATUS_ACTIVE );
// check if he or she belogs to any blog. If he or she does, simply
// get the first one (any better rule for this?)
- if( !empty($userBlogs)) {
+ if( !empty($userBlogs)) {
$blogId = $userBlogs[0]->getId();
}
}
Modified: plog/trunk/class/net/customrequestgenerator.class.php
===================================================================
--- plog/trunk/class/net/customrequestgenerator.class.php 2005-03-08 22:06:32 UTC (rev 1350)
+++ plog/trunk/class/net/customrequestgenerator.class.php 2005-03-08 22:09:40 UTC (rev 1351)
@@ -49,6 +49,7 @@
$categories = $post->getCategories();
$category = array_pop( $categories );
$user = $post->getUserInfo();
+ $ownerInfo = $this->_blogInfo->getOwnerInfo();
//print_r($post);
@@ -57,6 +58,7 @@
$params = Array( '{blogname}' => TextFilter::urlize($this->_blogInfo->getBlog()),
'{blogid}' => $this->_blogInfo->getId(),
+ '{blogowner}' => $ownerInfo->getUsername(),
'{year}' => $t->getYear(),
'{month}' => $t->getMonth(),
'{day}' => $day,
@@ -76,6 +78,7 @@
function getArchiveLink( $date )
{
$archiveLinkFormat = $this->_config->getValue( 'archive_link_format' );
+ $ownerInfo = $this->_blogInfo->getOwnerInfo();
// this is quite a dirty one but it works...
if( strlen($date) == 6 ) $newDate = $date."00000000";
@@ -85,6 +88,7 @@
$params = Array( "{year}" => $t->getYear(),
"{month}" => $t->getMonth(),
"{blogname}" => TextFilter::urlize($this->_blogInfo->getBlog()),
+ "{blogowner}" => $ownerInfo->getUsername(),
"{blogid}" => $this->_blogInfo->getId());
if( strlen($date) == 6 ) $params["{day}"] = "";
else $params["{day}"] = $t->getDay();
@@ -156,9 +160,11 @@
function categoryLink( $category )
{
$categoryFormat = $this->_config->getValue( "category_link_format" );
+ $ownerInfo = $this->_blogInfo->getOwnerInfo();
$params = Array( "{catid}" => $category->getId(),
"{catname}" => TextFilter::urlize($category->getName()),
"{blogid}" => $this->_blogInfo->getId(),
+ "{blogowner}" => $ownerInfo->getUsername(),
"{blogname}" => TextFilter::urlize($this->_blogInfo->getBlog()));
$result = $this->_replaceTags( $categoryFormat, $params );
@@ -179,9 +185,11 @@
function postUserLink( $user, $category = null )
{
$userPostsLink = $this->_config->getValue( "user_posts_link_format" );
+ $ownerInfo = $this->_blogInfo->getOwnerInfo();
$params = Array( "{blogid}" => $this->_blogInfo->getId(),
"{blogname}" => TextFilter::urlize($this->_blogInfo->getName()),
+ "{blogowner}" => $ownerInfo->getUsername(),
"{username}" => $user->getUsername(),
"{userid}" => $user->getId(),
"{year}" => "",
@@ -202,10 +210,14 @@
{
if( $blogInfo == null )
$blogInfo = $this->_blogInfo;
+
+ // get information about the owner
+ $ownerInfo = $blogInfo->getOwnerInfo();
$blogLinkFormat = $this->_config->getValue( "blog_link_format" );
$params = Array( "{blogid}" => $blogInfo->getId(),
- "{blogname}" => TextFilter::urlize($blogInfo->getBlog()));
+ "{blogname}" => TextFilter::urlize($blogInfo->getBlog()),
+ "{blogowner}" => $ownerInfo->getUsername());
$result = $this->getBaseUrl().$this->_replaceTags( $blogLinkFormat, $params );
return $result;
@@ -309,9 +321,11 @@
function albumLink( $album = null )
{
$albumLinkFormat = $this->_config->getValue( "album_link_format" );
+ $ownerInfo = $this->_blogInfo->getOwnerInfo();
$params = Array( "{blogid}" => $this->_blogInfo->getId(),
"{blogname}" => Textfilter::urlize($this->_blogInfo->getBlog()),
+ "{blogowner}" => $ownerInfo->getUsername(),
"{albumid}" => "",
"{albumname}" => "" );
@@ -351,9 +365,11 @@
function templatePage( $template )
{
$templateLinkFormat = $this->_config->getValue( "template_link_format" );
+ $ownerInfo = $this->_blogInfo->getOwnerInfo();
$params = Array( "{blogid}" => $this->_blogInfo->getId(),
"{blogname}" => Textfilter::urlize($this->_blogInfo->getBlog()),
+ "{blogowner}" => $ownerInfo->getUsername(),
"{templatename}" => $template );
$templatePage = $this->getBaseUrl().$this->_replaceTags( $templateLinkFormat, $params );
@@ -423,9 +439,11 @@
function _fillResourceParameters( $resource )
{
$album = $resource->getAlbum();
+ $ownerInfo = $this->_blogInfo->getOwnerInfo();
$params = Array( "{blogid}" => $this->_blogInfo->getId(),
"{blogname}" => Textfilter::urlize($this->_blogInfo->getBlog()),
+ "{blogowner}" => $ownerInfo->getUsername(),
"{resourceid}" => $resource->getId(),
"{resourcename}" => rawurlencode($resource->getFileName()),
"{albumid}" => $album->getId(),
Modified: plog/trunk/class/net/customurlhandler.class.php
===================================================================
--- plog/trunk/class/net/customurlhandler.class.php 2005-03-08 22:06:32 UTC (rev 1350)
+++ plog/trunk/class/net/customurlhandler.class.php 2005-03-08 22:09:40 UTC (rev 1351)
@@ -93,19 +93,24 @@
"username" => "userName",
"catid" => "postCategoryId",
"catname" => "postCategoryName",
- "date" => "Date" );
+ "date" => "Date",
+ "blogowner" => "blogUserName" );
+ print_r($this->_params);
}
elseif( $this->_format == "blog_link_format" ) {
$this->_includeFile = $this->_indexName;
+ print($this->_format);
$this->_params["op"] = "Default";
$this->_vars = Array( "blogid" => "blogId",
- "blogname" => "blogName" );
+ "blogname" => "blogName",
+ "blogowner" => "blogUserName" );
}
elseif( $this->_format == "category_link_format" ) {
$this->_includeFile = $this->_indexName;
$this->_params["op"] = "Default";
$this->_vars = Array( "blogid" => "blogId",
"blogname" => "blogName",
+ "blogowner" => "blogUserName",
"catid" => "postCategoryId",
"catname" => "postCategoryName" );
}
@@ -115,6 +120,7 @@
$this->_params["op"] = "Default";
$this->_vars = Array( "blogid" => "blogId",
"blogname" => "blogName",
+ "blogowner" => "blogUserName",
"date" => "Date" );
}
elseif( $this->_format == "user_posts_link_format" ) {
@@ -123,6 +129,7 @@
$this->_params["op"] = "Default";
$this->_vars = Array( "blogid" => "blogId",
"blogname" => "blogName",
+ "blogowner" => "blogUserName",
"date" => "Date",
"userid" => "userId",
"catid" => "postCategoryId",
@@ -135,6 +142,7 @@
$this->_params["date"] = $this->_params["year"].$this->_params["month"].$this->_params["day"].$this->_params["hours"].$this->_params["minutes"];
$this->_vars = Array( "blogid" => "blogId",
"blogname" => "blogName",
+ "blogowner" => "blogUserName",
"postid" => "articleId",
"postname" => "articleName",
"userid" => "userId",
@@ -148,6 +156,7 @@
$this->_params["op"] = "Template";
$this->_vars = Array( "templatename" => "show",
"blogid" => "blogId",
+ "blogowner" => "blogUserName",
"blogname" => "blogName" );
}
elseif( $this->_format == "album_link_format" ) {
@@ -156,6 +165,7 @@
$this->_vars = Array( "blogid" => "blogId",
"blogname" => "blogName",
"albumid" => "albumId",
+ "blogowner" => "blogUserName",
"albumname" => "albumName" );
}
elseif( $this->_format == "resource_link_format" ) {
@@ -163,6 +173,7 @@
$this->_params["op"] = "ViewResource";
$this->_vars = Array( "blogid" => "blogId",
"blogname" => "blogName",
+ "blogowner" => "blogUserName",
"albumid" => "albumId",
"albumname" => "albumName",
"resourceid" => "resId",
@@ -172,6 +183,7 @@
$this->_includeFile = "resserver.php";
$this->_vars = Array( "blogid" => "blogId",
"blogname" => "blogName",
+ "blogowner" => "blogUserName",
"albumid" => "albumId",
"albumname" => "albumName",
"resourceid" => "resId",
@@ -182,6 +194,7 @@
$this->_params["mode"] = "preview";
$this->_vars = Array( "blogid" => "blogId",
"blogname" => "blogName",
+ "blogowner" => "blogUserName",
"albumid" => "albumId",
"albumname" => "albumName",
"resourceid" => "resId",
@@ -193,6 +206,7 @@
$this->_params["mode"] = "medium";
$this->_vars = Array( "blogid" => "blogId",
"blogname" => "blogName",
+ "blogowner" => "blogUserName",
"albumid" => "albumId",
"albumname" => "albumName",
"resourceid" => "resId",
Modified: plog/trunk/class/net/linkparser.class.php
===================================================================
--- plog/trunk/class/net/linkparser.class.php 2005-03-08 22:06:32 UTC (rev 1350)
+++ plog/trunk/class/net/linkparser.class.php 2005-03-08 22:09:40 UTC (rev 1351)
@@ -14,6 +14,7 @@
$urlRewriteTags = array(
'{blogname}' => '([_0-9a-zA-Z-]+)?',
'{blogid}' => '([0-9]+)?',
+ '{blogowner}' => '([_0-9a-zA-Z-]+)?',
'{op}' => '([_0-9a-z-]+)?',
'{year}' => '([0-9]{4})?',
'{month}' => '([0-9]{2})?',
More information about the pLog-svn
mailing list