[pLog-svn] r1997 - plog/branches/plog-1.0.1/class/net
mark at devel.plogworld.net
mark at devel.plogworld.net
Thu May 12 09:09:24 GMT 2005
Author: mark
Date: 2005-05-12 09:09:23 +0000 (Thu, 12 May 2005)
New Revision: 1997
Modified:
plog/branches/plog-1.0.1/class/net/customrequestgenerator.class.php
plog/branches/plog-1.0.1/class/net/modrewriterequestgenerator.class.php
plog/branches/plog-1.0.1/class/net/prettyrequestgenerator.class.php
plog/branches/plog-1.0.1/class/net/rawrequestgenerator.class.php
Log:
Modify the resource related resource request generator to fix the bug http://bugs.plogworld.net/view.php?id=490
Modified: plog/branches/plog-1.0.1/class/net/customrequestgenerator.class.php
===================================================================
--- plog/branches/plog-1.0.1/class/net/customrequestgenerator.class.php 2005-05-11 23:01:51 UTC (rev 1996)
+++ plog/branches/plog-1.0.1/class/net/customrequestgenerator.class.php 2005-05-12 09:09:23 UTC (rev 1997)
@@ -3,6 +3,8 @@
include_once( PLOG_CLASS_PATH."class/net/baserequestgenerator.class.php" );
include_once( PLOG_CLASS_PATH."class/config/config.class.php" );
include_once( PLOG_CLASS_PATH."class/data/textfilter.class.php" );
+ include_once( PLOG_CLASS_PATH."class/database/db.class.php" );
+ include_once( PLOG_CLASS_PATH."class/dao/blogs.class.php" );
/**
* \ingroup Net
@@ -456,10 +458,22 @@
function _fillResourceParameters( $resource )
{
$album = $resource->getAlbum();
- $ownerInfo = $this->_blogInfo->getOwnerInfo();
+ $blogId = $this->_blogInfo->getId();
+ $ownerId = $resource->getOwnerId();
+
+ if ( $blogId != $ownerId ) {
+ $blogId = $ownerId;
+ $blogs =& new Blogs();
+ $blogInfo = $blogs->getBlogInfo($blogId);
+ $blogShortName = $blogInfo->getBlog();
+ $ownerInfo = $blogInfo->getOwnerInfo();
+ } else {
+ $blogShortName = $this->_blogInfo->getBlog();
+ $ownerInfo = $this->_blogInfo->getOwnerInfo();
+ }
- $params = Array( "{blogid}" => $this->_blogInfo->getId(),
- "{blogname}" => Textfilter::urlize($this->_blogInfo->getBlog()),
+ $params = Array( "{blogid}" => $blogId,
+ "{blogname}" => Textfilter::urlize($blogShortName),
"{blogowner}" => $ownerInfo->getUsername(),
"{resourceid}" => $resource->getId(),
"{resourcename}" => rawurlencode($resource->getFileName()),
Modified: plog/branches/plog-1.0.1/class/net/modrewriterequestgenerator.class.php
===================================================================
--- plog/branches/plog-1.0.1/class/net/modrewriterequestgenerator.class.php 2005-05-11 23:01:51 UTC (rev 1996)
+++ plog/branches/plog-1.0.1/class/net/modrewriterequestgenerator.class.php 2005-05-12 09:09:23 UTC (rev 1997)
@@ -2,6 +2,8 @@
include_once( PLOG_CLASS_PATH."class/net/baserequestgenerator.class.php" );
include_once( PLOG_CLASS_PATH."class/data/stringutils.class.php" );
+ include_once( PLOG_CLASS_PATH."class/database/db.class.php" );
+ include_once( PLOG_CLASS_PATH."class/dao/blogs.class.php" );
/**
* \ingroup Net
@@ -350,7 +352,19 @@
*/
function resourceLink( $resource )
{
- $resourceLink = $this->getBaseUrl().'/'.$this->_blogInfo->getId().'_'.StringUtils::text2url( $this->_blogInfo->getBlog() ).'/resources/'.rawurlencode($resource->getFileName()).'.html';
+ $blogId = $this->_blogInfo->getId();
+ $ownerId = $resource->getOwnerId();
+
+ if ( $blogId != $ownerId ) {
+ $blogId = $ownerId;
+ $blogs =& new Blogs();
+ $blogInfo = $blogs->getBlogInfo($blogId);
+ $blogShortName = $blogInfo->getBlog();
+ } else {
+ $blogShortName = $this->_blogInfo->getBlog();
+ }
+
+ $resourceLink = $this->getBaseUrl().'/'.$blogId.'_'.StringUtils::text2url( $blogShortName ).'/resources/'.rawurlencode($resource->getFileName()).'.html';
return $resourceLink;
}
@@ -362,7 +376,9 @@
*/
function resourcePreviewLink( $resource )
{
- $this->addParameter( "blogId", $this->_blogInfo->getId());
+ $blogId = ($resource->getOwnerId() ? $resource->getOwnerId() : $this->_blogInfo->getId());
+
+ $this->addParameter( "blogId", $blogId);
$this->addParameter( "resource", rawurlencode($resource->getFileName()));
$this->addParameter( "mode", "preview" );
@@ -378,7 +394,9 @@
*/
function resourceMediumSizePreviewLink( $resource )
{
- $this->addParameter( "blogId", $this->_blogInfo->getId());
+ $blogId = ($resource->getOwnerId() ? $resource->getOwnerId() : $this->_blogInfo->getId());
+
+ $this->addParameter( "blogId", $blogId);
$this->addParameter( "resource", rawurlencode($resource->getFileName()));
$this->addParameter( "mode", "medium" );
@@ -394,8 +412,20 @@
*/
function resourceDownloadLink( $resource )
{
- $resourceLink = $this->getBaseUrl().'/'.$this->_blogInfo->getId().'_'.StringUtils::text2url( $this->_blogInfo->getBlog() ).'/get/'.rawurlencode($resource->getFileName());
+ $blogId = $this->_blogInfo->getId();
+ $ownerId = $resource->getOwnerId();
+
+ if ( $blogId != $ownerId ) {
+ $blogId = $ownerId;
+ $blogs =& new Blogs();
+ $blogInfo = $blogs->getBlogInfo($blogId);
+ $blogShortName = $blogInfo->getBlog();
+ } else {
+ $blogShortName = $this->_blogInfo->getBlog();
+ }
+ $resourceLink = $this->getBaseUrl().'/'.$blogId.'_'.StringUtils::text2url( $blogShortName ).'/get/'.rawurlencode($resource->getFileName());
+
return $resourceLink;
}
Modified: plog/branches/plog-1.0.1/class/net/prettyrequestgenerator.class.php
===================================================================
--- plog/branches/plog-1.0.1/class/net/prettyrequestgenerator.class.php 2005-05-11 23:01:51 UTC (rev 1996)
+++ plog/branches/plog-1.0.1/class/net/prettyrequestgenerator.class.php 2005-05-12 09:09:23 UTC (rev 1997)
@@ -334,7 +334,9 @@
*/
function resourceLink( $resource )
{
- return $resourceLink = $this->getBaseUrl()."/resource/".$this->_blogInfo->getId()."/".$resource->getId();
+ $blogId = ($resource->getOwnerId() ? $resource->getOwnerId() : $this->_blogInfo->getId());
+
+ return $resourceLink = $this->getBaseUrl()."/resource/".$blogId."/".$resource->getId();
}
/**
@@ -344,7 +346,9 @@
*/
function resourcePreviewLink( $resource )
{
- return $resourceLink = $this->getBaseUrl()."/resserver.php?blogId=".$this->_blogInfo->getId()."&resource=".rawurlencode($resource->getFileName())."&mode=preview";
+ $blogId = ($resource->getOwnerId() ? $resource->getOwnerId() : $this->_blogInfo->getId());
+
+ return $resourceLink = $this->getBaseUrl()."/resserver.php?blogId=".$blogId."&resource=".rawurlencode($resource->getFileName())."&mode=preview";
}
/**
@@ -354,7 +358,9 @@
*/
function resourceMediumSizePreviewLink( $resource )
{
- return $resourceLink = $this->getBaseUrl()."/resserver.php?blogId=".$this->_blogInfo->getId()."&resource=".rawurlencode($resource->getFileName())."&mode=medium";
+ $blogId = ($resource->getOwnerId() ? $resource->getOwnerId() : $this->_blogInfo->getId());
+
+ return $resourceLink = $this->getBaseUrl()."/resserver.php?blogId=".$blogId."&resource=".rawurlencode($resource->getFileName())."&mode=medium";
}
/**
@@ -364,7 +370,9 @@
*/
function resourceDownloadLink( $resource )
{
- return $resourceLink = $this->getBaseUrl()."/get/".$this->_blogInfo->getId()."/".rawurlencode($resource->getFileName());
+ $blogId = ($resource->getOwnerId() ? $resource->getOwnerId() : $this->_blogInfo->getId());
+
+ return $resourceLink = $this->getBaseUrl()."/get/".$blogId."/".rawurlencode($resource->getFileName());
}
Modified: plog/branches/plog-1.0.1/class/net/rawrequestgenerator.class.php
===================================================================
--- plog/branches/plog-1.0.1/class/net/rawrequestgenerator.class.php 2005-05-11 23:01:51 UTC (rev 1996)
+++ plog/branches/plog-1.0.1/class/net/rawrequestgenerator.class.php 2005-05-12 09:09:23 UTC (rev 1997)
@@ -390,8 +390,10 @@
*/
function resourceLink( $resource )
{
+ $blogId = ($resource->getOwnerId() ? $resource->getOwnerId() : $this->_blogInfo->getId());
+
$this->addParameter( "op", "ViewResource" );
- $this->addParameter( "blogId", $this->_blogInfo->getId());
+ $this->addParameter( "blogId", $blogId);
$this->addParameter( "resource", $resource->getFileName());
$resourceLink = $this->getIndexUrl().$this->getRequest();
@@ -406,7 +408,9 @@
*/
function resourcePreviewLink( $resource )
{
- $this->addParameter( "blogId", $this->_blogInfo->getId());
+ $blogId = ($resource->getOwnerId() ? $resource->getOwnerId() : $this->_blogInfo->getId());
+
+ $this->addParameter( "blogId", $blogId);
$this->addParameter( "resource", $resource->getFileName());
$this->addParameter( "mode", "preview" );
@@ -422,7 +426,9 @@
*/
function resourceMediumSizePreviewLink( $resource )
{
- $this->addParameter( "blogId", $this->_blogInfo->getId());
+ $blogId = ($resource->getOwnerId() ? $resource->getOwnerId() : $this->_blogInfo->getId());
+
+ $this->addParameter( "blogId", $blogId);
$this->addParameter( "resource", $resource->getFileName());
$this->addParameter( "mode", "medium" );
@@ -438,7 +444,9 @@
*/
function resourceDownloadLink( $resource )
{
- $this->addParameter( "blogId", $this->_blogInfo->getId());
+ $blogId = ($resource->getOwnerId() ? $resource->getOwnerId() : $this->_blogInfo->getId());
+
+ $this->addParameter( "blogId", $blogId);
$this->addParameter( "resource", $resource->getFileName());
$resourceLink = $this->getResourceServerUrl().$this->getRequest();
More information about the pLog-svn
mailing list