[geeklog-cvs] Geeklog-2.x/plugins/content config.php, NONE, 1.1 content.php, NONE, 1.1 ContentSoap.php, NONE, 1.1
Damien Hodgkin
dhodgkin at qs1489.pair.com
Wed Aug 8 16:13:56 EDT 2007
Update of /cvsroot/geeklog2/Geeklog-2.x/plugins/content
In directory qs1489.pair.com:/tmp/cvs-serv13334/plugins/content
Added Files:
config.php content.php ContentSoap.php
Log Message:
Second commit
--- NEW FILE: content.php ---
<?php
/**
* Content Plugin base class
*
* @author Damien Hodgkin <dracul01 at gmail.com>
* @copyright 05-22-2007
* @version $Id: content.php,v 1.1 2007/08/08 20:13:54 dhodgkin Exp $
* @package net.geeklog.plugin.content
*
*/
// haul in the required stuff
require_once 'PluginInterface.php';
require_once 'Plugin.php';
// content plugin base class
class GeeklogPlugin_Content extends Geeklog_Plugin implements Geeklog_PluginInterface {
static public function getPluginName() {
return 'content';
}
static public function install() {
// Geeklog_ActionManager::registerListener($pluginName, $actions);
}
static public function uninstall() {
// Geeklog_ActionManager::unregisterListener($pluginName, $actions);
}
static public function upgrade() {
}
static public function & getVersion() {
return SiteInfoFactory::GetVersionInfoFromConfig('content');
}
static public function handleAction($action, $var = '') {
if ($action == 'RENDER_BLOCK') {
$_REQUEST['cmd'] = 'showMain';
$urlArgs = array('content','showMain', $var);
self::processRequest($urlArgs);
} else {
return;
}
}
static public function processRequest($urlArgs) {
// Initialize logging
Geeklog_Log::registerLogger(Geeklog_Config::getValue('logFile','content'), 'content');
Geeklog_Log::log('Content plugin processing request', 'content');
foreach ($urlArgs as $arg) {
Geeklog_Log::log("Got argument $arg", 'content');
}
// Initialize Contoller
$pluginPath = Geeklog_Config::getValue('path_plugins') . $urlArgs[0] . '/';
//$configData = $pluginPath . 'mvcconfig.xml';
$controller = new Geeklog_MVCnPHP_Controller(Geeklog_Config::getValue('mvc_options','content'));
// Process the request
$controller->processRequest($urlArgs);
}
static public function getDependencies() {
}
static public function getSOAPServiceClasses() {
return array();
}
static public function getSOAPComplexTypes() {
return array();
}
static public function initializeDAO() {
Geeklog_DAO_DAOFactory::initializeDAO(getOption('dao_options','content'));
}
static public function initializeSOAP() {
return;
}
}
?>
--- NEW FILE: config.php ---
<?php
/* Reminder: always indent with 4 spaces (no tabs). */
/**
* Geeklog 2
*
* License details are yet to be determined.
*
*/
/**
* Geeklog 2 Content Plugin Configuration File
*
* This is the configuration file for the Content Plugin for Geeklog 2.
* @author Damien Hodgkin <dracul01 at gmail.com>
* @package net.geeklog.plugins.content
*
*/
$contentConf['version'] = '0.0.1';
$contentConf['level'] = 'Unstable';
$contentConf['release_date'] = date('2007-06-01');
$contentConf['path'] = getOption('path_plugins') . 'content/';
$contentConf['path_views'] = $contentConf['path'] . 'views/';
$contentConf['path_commands'] = $contentConf['path'] . 'commands/';
$contentConf['path_models'] = $contentConf['path'] . 'models/';
$contentConf['path_system'] = $contentConf['path'] . 'system/';
$contentConf['mvc_options'] = array('doCompileChecks'=>1,
'baseUrl'=>Geeklog_Config::getValue('site_url'),
'viewDir'=>$contentConf['path_views'],
'commandDir'=>$contentConf['path_commands'],
'configFileDirectory'=>$contentConf['path'],
'apcOptions'=>array('apc_index'=>GL2_CONTENT_MVC_CONFIG));
$contentConf['dao_options'] = array('dsn'=>'content',
'daoFile'=>'PropelDAO.php',
'daoClassName'=>'Geeklog_DAO_PropelDAO',
'namedQueryPath'=>$contentConf['path'] . 'sql',
'domainsObjectsPath'=>$contentConf['path_models'],
'databaseName'=>getOption('db_name'),
);
$contentConf['contents_per_page_admin'] = 10;
// Logging Configuration. Geeklog 2 uses PEAR::log, the following array maps directly to what
// that class expects. See http://pear.php.net/manual/en/package.logging.log.php for specifics on
// how to use PEAR::Log
$contentConf['logFile'] = getOption('path_logs') . 'content.log';
// Hack for some wierd scoping issue
return $contentConf;
?>
--- NEW FILE: ContentSoap.php ---
<?php
/**
* Geeklog 2
*
* License details are yet to be determined.
*
*/
require_once 'PluginSoapServiceBase.php';
require_once 'plugins/content/models/Gl2ContentPeer.php';
/**
* Geeklog_ContentSoap
*
* Wraps access to the content plugin for SOAP access.
* @package net.geeklog.plugin.content.soap
* @author RMT <michael.tutty at gmail.com>
* @author Damien Hodgkin <dracul01 at gmail.com>
* @copyright Geeklog 2 Development Team 2005
* @version $Id: ContentSoap.php,v 1.1 2007/08/08 20:13:54 dhodgkin Exp $
* @access public
**/
class Content_ContentSoap extends Geeklog_PluginSoapServiceBase {
/**
* Retrieves contents from the database, using any specified filter criteria.
* Requires the caller to have the CONTENT_LIST privilege.
* @param Geeklog_AuthData auth Authentication token of credentials to be validated.
* @param Gl2ContentSoap contentFilter An object to use as a filter. Any field values that are set non-blank or non-zero will be used as filter criteria.
* @return Gl2ContentSoap[] The list of content records that satisfy the criteria provided.
*/
public static function listContents($auth, $contentFilter) {
self::requirePrivilege($auth, array('CONTENT_LIST'));
$ret = Gl2ContentPeer::listByExamples($contentFilter->toPropelClass());
return self::ModelToSoap($ret);
}
/**
* Deletes the specified content(s) from the database.
* Requires the caller to have the CONTENT_DELETE privilege.
* @param Geeklog_AuthData auth Authentication token of credentials to be validated.
* @param Gl2ContentSoap[] contentArray An array of zero or more content objects to be deleted from the database.
* @return int The number of records affected by the operation.
*/
public static function deleteContents($auth, $contentArray) {
self::requirePrivilege($auth, array('CONTENT_DELETE'));
return Gl2ContentPeer::deleteContents(self::SoapToModel($contentArray));
}
/**
* Saves the specified array of contents to the database.
* Requires the caller to have the CONTENT_UPDATE and/or CONTENT_CREATE privilege, depending on the value of create.
* @param Geeklog_AuthData auth Authentication token of credentials to be validated.
* @param Gl2ContentSoap[] contentArray An array of zero or more contents to be saved.
* @param Gl2ItemAclSoap[] ACLArray An array of zero or more ACLs to be saved with each content.
* @param boolean create If TRUE, then content records that do not exist will be inserted. If FALSE, then the function will throw an exception if a specified content does not already exist in the database.
* @param boolean validate If TRUE, then each content URL will be checked before saving. If any of the URLs cannot be accessed, the entrie transaction will fail.
* @return int The number of records affected by the operation.
*/
public static function saveContents($auth, $contentArray, $ACLArray, $create, $validate) {
$session_ser = self::validateAuthData($auth);
$user =& self::getUserFromSessionSerial($session_ser);
$privArray = array('CONTENT_UPDATE');
if ($create) {
$privArray = array('CONTENT_CREATE');
}
if (!self::hasPrivilege($user, $privArray)) {
$msg = 'User is missing a required privilege for this operation.';
Geeklog_Log::log($msg, 'content', Zend_Log::LEVEL_ERROR);
throw new Exception($msg);
}
// Prepare the list of ACLs by converting the SOAP objects passed in into model objects
$aclLocal = array();
if (is_array($ACLArray)) {
foreach($ACLArray as $aclSoap) {
$aclLocal[] = $aclSoap->toPropelClass();
}
}
return Gl2ContentPeer::saveContents($user, self::SoapToModel($contentArray), $aclLocal, $create, $validate);
}
protected static function & ModelToSoap($modelArray) {
$ret = array();
if (is_array($modelArray)) {
foreach ($modelArray as $model) {
$ret[] =& Gl2ContentSoap::fromPropelClass($model);
}
}
return $ret;
}
protected static function & SoapToModel($soapArray) {
$ret = array();
if (is_array($soapArray)) {
foreach ($soapArray as $soap) {
$ret[] =& $soap->toPropelClass();
}
}
return $ret;
}
}
?>
More information about the geeklog-cvs
mailing list