[pLog-svn] r7166 - in plog/trunk: . class/database class/net
mark at devel.lifetype.net
mark at devel.lifetype.net
Tue Feb 21 03:32:48 EST 2012
Author: mark
Date: 2012-02-21 03:32:48 -0500 (Tue, 21 Feb 2012)
New Revision: 7166
Added:
plog/trunk/class/database/db.class.php
Modified:
plog/trunk/class/net/baserequestgenerator.class.php
plog/trunk/wizard
Log:
Fixed current trunk to make 2.0 installer works again.
Added: plog/trunk/class/database/db.class.php
===================================================================
--- plog/trunk/class/database/db.class.php (rev 0)
+++ plog/trunk/class/database/db.class.php 2012-02-21 08:32:48 UTC (rev 7166)
@@ -0,0 +1,16 @@
+<?php
+
+
+
+ /**
+ * \ingroup Database
+ *
+ * @deprecated
+ * This class is left here for compatibility reasons, since as of Lifetype 2.0, the original Db class
+ * was renamed to LtDb in order not to clash with PEAR's Db class. Please modify your plugins and
+ * custom code to refer to the new LtDb class.
+ */
+ class Db extends LtDb
+ {
+ }
+?>
Modified: plog/trunk/class/net/baserequestgenerator.class.php
===================================================================
--- plog/trunk/class/net/baserequestgenerator.class.php 2011-12-15 16:34:32 UTC (rev 7165)
+++ plog/trunk/class/net/baserequestgenerator.class.php 2012-02-21 08:32:48 UTC (rev 7166)
@@ -1,6 +1,6 @@
<?php
- /**
+ /**
* \defgroup Net
*
* The Net package includes all the classes that are related to network functionality in one way
@@ -8,22 +8,16 @@
*
* @see Net_HTTP
*/
-
+
define( "DEFAULT_SCRIPT_NAME", "index.php" );
- /**
- * Default folder where resources are installed
- */
- define( "DEFAULT_GalleryConstants::GALLERY_RESOURCES_FOLDER", "./gallery/" );
-
-
/**
* \ingroup Net
*
* The BaseRequestGenerator class is some sort of proxy class that defines an interface that should be implemented
* by classes wishing to provide a new request generator (plus some code that can be reused by all request
* generators)
- *
+ *
* Each request generator defines its own format for its URLs, and by using request generators we can easily
* change the format of our URLs without the need to alter our templates (and therefore, without the need to hardcode
* URLs in our templates)
@@ -35,7 +29,7 @@
*
* @see RequestGenerator
*/
- class BaseRequestGenerator
+ class BaseRequestGenerator
{
var $_params;
@@ -63,22 +57,22 @@
*/
function BaseRequestGenerator( $blogInfo = null )
{
-
+
$this->_params = Array();
$this->_blogInfo = $blogInfo;
- $config =& Config::getConfig();
+ $config =& Config::getConfig();
$this->_baseUrl = $config->getValue( "base_url" );
$this->_subdomainsBaseUrl = $config->getValue( "subdomains_base_url" );
-
+
// get some information about the configuration of subdomains
$this->_subdomainsEnabled = $config->getValue( "subdomains_enabled" );
- if( $this->_subdomainsEnabled )
+ if( $this->_subdomainsEnabled )
$this->_includeBlogId = $config->getValue( "include_blog_id_in_url" );
else
$this->_includeBlogId = true;
-
+
// prepare the correct url if subdomains are enabled...
if( $this->_subdomainsEnabled && $blogInfo != null ) {
$this->_subdomainsBaseUrl = str_replace("{blogname}",
@@ -93,12 +87,12 @@
$this->_subdomainsBaseUrl);
}
$this->_scriptName = $config->getValue( "script_name", DEFAULT_SCRIPT_NAME );
-
+
// enable the xhtml mode by default, but it can be turned off
// via the setXHTML() method
$this->_xhtmlEnabled = true;
}
-
+
/**
* @return Returns true if subdomains are enabled
*/
@@ -106,7 +100,7 @@
{
return $this->_subdomainsEnabled;
}
-
+
/**
* @returns true if the blog identifier should be included in the URL. This setting is only meaningful
* when subdomains are enabled and is only used by "raw" URLs
@@ -129,7 +123,7 @@
else
return $this->_baseUrl;
}
-
+
/**
* @return Returns the name of the script to which for example forms will be submitted. Defaults to
* index.php but it can be changed via the script_name configuration parameter.
@@ -138,8 +132,8 @@
{
return $this->_scriptName;
}
-
- /**
+
+ /**
* @return Returns the URL pointing to the main index file. This URL is built by querying the current
* base URL and then appending the value of the script_name configuration setting.
*
@@ -148,19 +142,19 @@
*/
function getIndexUrl( $useSubdomains = true )
{
-
+
$url = $this->getBaseUrl( $useSubdomains )."/".$this->getScriptName();
return $url;
}
- /**
+ /**
* @return Returns the URL pointing to the admin.php file. This URL is built by querying the current
* base URL and then appending the value of the script_name configuration setting.
*
* @param useSubdomains If set to true and subdomains are enabled, it will use the base URL as specified
* in the subdomains_base_url setting instead of base_url. It defaults to 'true'.
- */
+ */
function getAdminUrl( $useSubdomains = true )
{
$url = $this->getBaseUrl( $useSubdomains )."/admin.php";
@@ -168,13 +162,13 @@
return $url;
}
- /**
+ /**
* @return Returns the URL pointing to the rss.php file. This URL is built by querying the current
* base URL and then appending the value of the script_name configuration setting.
*
* @param useSubdomains If set to true and subdomains are enabled, it will use the base URL as specified
* in the subdomains_base_url setting instead of base_url. It defaults to 'true'.
- */
+ */
function getRssUrl( $useSubdomains = false )
{
$url = $this->getBaseUrl( $useSubdomains )."/rss.php";
@@ -182,13 +176,13 @@
return $url;
}
- /**
+ /**
* @return Returns the URL pointing to the trackback.php file. This URL is built by querying the current
* base URL and then appending the value of the script_name configuration setting.
*
* @param useSubdomains If set to true and subdomains are enabled, it will use the base URL as specified
* in the subdomains_base_url setting instead of base_url. It defaults to 'true'.
- */
+ */
function getTrackbackUrl( $useSubdomains = false )
{
$url = $this->getBaseUrl( $useSubdomains )."/trackback.php";
@@ -196,13 +190,13 @@
return $url;
}
- /**
+ /**
* @return Returns the URL pointing to the resserver.php file. This URL is built by querying the current
* base URL and then appending the value of the script_name configuration setting.
*
* @param useSubdomains If set to true and subdomains are enabled, it will use the base URL as specified
* in the subdomains_base_url setting instead of base_url. It defaults to 'true'.
- */
+ */
function getResourceServerUrl( $useSubdomains = false )
{
$url = $this->getBaseUrl( $useSubdomains )."/resserver.php";
@@ -214,7 +208,7 @@
* Returns the base URL to resources
*/
function getResourcesBaseUrl()
- {
+ {
$config =& Config::getConfig();
// the default value for this setting is to use a relative path that starts with './' so we have to make sure that
// that bit is not included in the URL (it wouldn't have any harmful effect, but it'd look ugly)
@@ -222,20 +216,20 @@
// make sure that the base URL ends with a forward slash
if( $galleryFolder[strlen($galleryFolder)-1] != "/" )
$galleryFolder .= "/";
-
+
$url = $this->getBaseUrl().$galleryFolder;
-
+
return( $url );
}
- /**
+ /**
* @return Returns the URL pointing to the given parameter. This URL is built by querying the current
* base URL and then appending the value of the $res parameter
*
* @param res A valid URL path
* @param useSubdomains If set to true and subdomains are enabled, it will use the base URL as specified
* in the subdomains_base_url setting instead of base_url. It defaults to 'true'.
- */
+ */
function getUrl( $res, $useSubdomains = false )
{
$baseUrl = $this->getBaseUrl( $useSubdomains );
@@ -331,8 +325,8 @@
function categoryRssLink( $category, $profile = "", $blogInfo = null )
{
throw( new Exception( "This function must be implemented by child classes." ));
- }
-
+ }
+
/**
* Returns the url for the rss feed of user posts. All URL generators use the same
* format for this for the time being, so we'll keep the method in this base class.
@@ -348,13 +342,13 @@
{
$rssLink = $this->getRssUrl();
$rssLink .= "?blogId=".$this->_blogInfo->getId();
-
+
if( $profile != "" )
$rssLink .= "&profile=$profile";
$rssLink .= "&userId=".$userInfo->getId();
- return $rssLink;
- }
+ return $rssLink;
+ }
/**
* Returns the link of a category. Must be implemented by child classes to generate a valid URL.
@@ -422,7 +416,7 @@
function rssLink( $profile = "", $blogInfo = null )
{
throw( new Exception( "This function must be implemented by child classes." ));
- }
+ }
/**
* Returns the url to reply to a given comment. Must be implemented by child classes to generate a valid URL.
@@ -480,7 +474,7 @@
*
* @param date A String in the format yyyymm
* @return A valid archive link
- */
+ */
function getArchiveLink( $date )
{
throw( new Exception( "This function must be implemented by child classes." ));
@@ -508,17 +502,17 @@
{
throw( new Exception( "This function must be implemented by child classes." ));
}
-
+
/**
* Given an album, generates a link to its parent. Must be implemented by child classes to generate
* a valid URL.
*
* @param album The album
- */
+ */
function parentAlbumLink( $album )
{
throw( new Exception( "This function must be implemented by child classes." ));
- }
+ }
/**
* Given the name of a template file, generate the right link to it. Must be implemented by child
@@ -530,7 +524,7 @@
function templatePage( $template )
{
throw( new Exception( "This function must be implemented by child classes." ));
- }
+ }
/**
* Returns the link to a resource. Must be implemented by child classes to generate a valid URL.
@@ -549,11 +543,11 @@
*/
function resourcePreviewLink( $resource )
{
- $blogId = ($resource->getOwnerId() ? $resource->getOwnerId() : $this->_blogInfo->getId());
- $resourceLink = $this->getResourcesBaseUrl().$blogId."/previews/".rawurlencode($resource->getPreviewFileName());
+ $blogId = ($resource->getOwnerId() ? $resource->getOwnerId() : $this->_blogInfo->getId());
+ $resourceLink = $this->getResourcesBaseUrl().$blogId."/previews/".rawurlencode($resource->getPreviewFileName());
return $resourceLink;
}
-
+
/**
* Returns the link to a resource preview
*
@@ -561,7 +555,7 @@
*/
function resourceMediumSizePreviewLink( $resource )
{
- $blogId = ($resource->getOwnerId() ? $resource->getOwnerId() : $this->_blogInfo->getId());
+ $blogId = ($resource->getOwnerId() ? $resource->getOwnerId() : $this->_blogInfo->getId());
$resourceLink = $this->getResourcesBaseUrl().$blogId."/previews-med/".rawurlencode($resource->getMediumSizePreviewFileName());
return $resourceLink;
}
@@ -573,7 +567,7 @@
*/
function resourceDownloadLink( $resource )
{
- $blogId = ($resource->getOwnerId() ? $resource->getOwnerId() : $this->_blogInfo->getId());
+ $blogId = ($resource->getOwnerId() ? $resource->getOwnerId() : $this->_blogInfo->getId());
$resourceLink = $this->getResourcesBaseUrl().$blogId."/".rawurlencode($resource->getOriginalSizeFileName());
return $resourceLink;
}
@@ -585,11 +579,11 @@
*/
function rawResourcePreviewLink( $resource )
{
- $blogId = ($resource->getOwnerId() ? $resource->getOwnerId() : $this->_blogInfo->getId());
- $resourceLink = $this->getResourcesBaseUrl().$blogId."/previews/".$resource->getPreviewFileName();
+ $blogId = ($resource->getOwnerId() ? $resource->getOwnerId() : $this->_blogInfo->getId());
+ $resourceLink = $this->getResourcesBaseUrl().$blogId."/previews/".$resource->getPreviewFileName();
return $resourceLink;
}
-
+
/**
* Returns the link to a resource preview with raw file name, for TinyMCE use only
*
@@ -597,7 +591,7 @@
*/
function rawResourceMediumSizePreviewLink( $resource )
{
- $blogId = ($resource->getOwnerId() ? $resource->getOwnerId() : $this->_blogInfo->getId());
+ $blogId = ($resource->getOwnerId() ? $resource->getOwnerId() : $this->_blogInfo->getId());
$resourceLink = $this->getResourcesBaseUrl().$blogId."/previews-med/".$resource->getMediumSizePreviewFileName();
return $resourceLink;
}
@@ -609,11 +603,11 @@
*/
function rawResourceDownloadLink( $resource )
{
- $blogId = ($resource->getOwnerId() ? $resource->getOwnerId() : $this->_blogInfo->getId());
+ $blogId = ($resource->getOwnerId() ? $resource->getOwnerId() : $this->_blogInfo->getId());
$resourceLink = $this->getResourcesBaseUrl().$blogId."/".$resource->getOriginalSizeFileName();
return $resourceLink;
}
-
+
/**
* whether we should generate valid xhtml requests or not
* (used for example when sending out messages, as some email clients will
@@ -626,7 +620,7 @@
{
$this->_xhtmlEnabled = $enabled;
}
-
+
/**
* whether xhtml mode is enabled or not
*
@@ -636,7 +630,7 @@
{
return $this->_xhtmlEnabled;
}
-
+
/**
* generates a unique atom id for the entry. This is not as easy
* as it sounds, take a look http://diveintomark.org/archives/2004/05/28/howto-atom-id
@@ -646,20 +640,20 @@
*/
function getAtomUniqueId( $article )
{
-
+
$config =& Config::getConfig();
$url = new Url($config->getValue( "base_url" ));
$articleDate = $article->getDateObject();
-
+
// Timestamp::getDay() doesn't do two digits, so we'll do it here
$day = $articleDate->getDay();
- if( $day < 10 ) $day = "0".$day;
-
+ if( $day < 10 ) $day = "0".$day;
+
$date = $articleDate->getYear()."-".$articleDate->getMonth()."-".$day;
$tag = "tag:".$url->getHost().",".$date.":".$article->getId();
-
+
return $tag;
- }
+ }
/**
* get user profile picture link. It is not necessary for child classes to implement this method.
@@ -671,7 +665,7 @@
if( $blogInfo == null ) {
$blogInfo = $this->_blogInfo;
}
-
+
$ownerInfo = $blogInfo->getOwnerInfo();
$pic = $ownerInfo->getPicture();
if(!$pic){
@@ -681,8 +675,8 @@
return $this->resourceLink($pic);
}
}
-
-
+
+
/**
* generates the correct path to a file in the template folder, without having to worry
* whether the template was installed in /templates/ or in /templates/blog_X/. It is not necessary
@@ -694,19 +688,19 @@
function getTemplateFile( $file )
{
lt_include( PLOG_CLASS_PATH."class/file/file.class.php" );
-
+
// get the current template set
$blogSettings = $this->_blogInfo->getSettings();
$template = $blogSettings->getValue( "template" );
-
+
// define this couple of things
$baseUrl = $this->getBaseUrl();
$config =& Config::getConfig();
$url = "$baseUrl/".File::expandPath( $config->getValue( "template_folder" ))."/";
-
+
// is it a blog template?
$blogTemplates = $blogSettings->getValue( "blog_templates" );
-
+
if( !is_array($blogTemplates ))
$url .= "$template/$file";
else {
@@ -715,10 +709,10 @@
else
$url .= "$template/$file";
}
-
- return $url;
- }
-
+
+ return $url;
+ }
+
/**
* generates the correct path to a file in the template folder, without having to worry
* whether the template was installed in /templates/ or in /templates/blog_X/
@@ -766,7 +760,7 @@
return $url;
}
-
+
/**
* given the parameters, recalculates the current URL. This method also has support
* for paged urls
@@ -780,7 +774,7 @@
{
throw( new Exception( "This function must be implemented by child classes." ));
}
-
+
/**
* Returns the page format for this URL generator
*
@@ -788,9 +782,9 @@
*/
function getPageSuffix( $page = "" )
{
- throw( new Exception( "This function must be implemented by child classes." ));
- }
-
+ throw( new Exception( "This function must be implemented by child classes." ));
+ }
+
/**
* Links to a location map
*
Modified: plog/trunk/wizard
===================================================================
--- plog/trunk/wizard 2011-12-15 16:34:32 UTC (rev 7165)
+++ plog/trunk/wizard 2012-02-21 08:32:48 UTC (rev 7166)
@@ -33,7 +33,7 @@
lt_include( PLOG_CLASS_PATH."class/controller/controller.class.php" );
lt_include( PLOG_CLASS_PATH."class/template/templateservice.class.php" );
lt_include( PLOG_CLASS_PATH."class/action/action.class.php" );
- lt_include( PLOG_CLASS_PATH."class/database/db.class.php" );
+ lt_include( PLOG_CLASS_PATH."class/database/ltdb.class.php" );
lt_include( PLOG_CLASS_PATH."class/template/template.class.php" );
lt_include( PLOG_CLASS_PATH."class/view/view.class.php" );
lt_include( PLOG_CLASS_PATH."class/data/validator/usernamevalidator.class.php" );
@@ -365,18 +365,18 @@
{
function WizardTokenizerFunctionsAvailableValidator()
{
- $this->WizardValidator( "Checking if <b>Tokenizer</b> functions are available",
+ $this->WizardValidator( "Checking if <b>Tokenizer</b> functions are available",
"LifeType requires support for the Tokenizer to be part of your PHP installation",
true );
- }
-
+ }
+
function validate()
{
$this->_valid = function_exists( "token_get_all" );
- return( parent::validate());
- }
+ return( parent::validate());
+ }
}
-
+
class WizardSafeModeValidator extends WizardValidator
{
function WizardSafeModeValidator()
@@ -611,7 +611,7 @@
function perform()
{
WizardTools::cleanTmpFolder();
-
+
// we can detect whether plog is already installed or not and direct users to the right
// place
if( WizardTools::isNewInstallation())
@@ -942,7 +942,7 @@
$config->getValue( "db_database" ));
// create a data dictionary to give us the right sql code needed to create the tables
- $dict = NewPDbDataDictionary( $this->_db );
+ $dict = $this->_db->getDriverDataDictionary();
// create the tables
$errors = false;
@@ -1190,12 +1190,12 @@
}
// add the default friend group for user
-
+
$friendGroups = new FriendGroups();
- $friendGroup = new FriendGroup( $userId,
- "General",
+ $friendGroup = new FriendGroup( $userId,
+ "General",
"General" );
- $friendGroups->addFriendGroup( $friendGroup );
+ $friendGroups->addFriendGroup( $friendGroup );
// add the default private message boxes for user
$privateMessageBoxes = new PrivateMessageBoxes();
@@ -1351,8 +1351,6 @@
}
}
- $this->Execute("DROP TABLE ".Db::getPrefix()."tmp_users_permissions");
-
// clean the data cache to avoid problems when we're done
lt_include( PLOG_CLASS_PATH."class/cache/cachemanager.class.php" );
$cache =& CacheManager::getCache();
@@ -1507,7 +1505,7 @@
$curTable = $tablesArray[$this->page-1];
$db =& Db::getDb();
- $dict = NewPDbDataDictionary( $db );
+ $dict = $db->getDriverDataDictionary();
$errors = false;
$this->message = "Performing changes to the dabase schema, please wait (step %s of %s)<br/>";
@@ -1595,7 +1593,7 @@
}
}
}
-
+
$this->updatedRecords++;
}
More information about the pLog-svn
mailing list