/** * Constructor * * @param array An optional associative array of configuration settings. */ public function __construct(KConfig $config) { parent::__construct($config); $this->_state->insert('position', 'cmd')->insert('module', 'cmd')->insert('limit', 'int', 0); KLoader::load('lib.joomla.application.module.helper'); $this->_list =& JModuleHelper::_load(); $this->_total = count($this->_list); }
public function __construct(KConfig $options) { parent::__construct($options); $identifier = $options->identifier; $type = $identifier->type; $package = $identifier->package; $admin = JPATH_ADMINISTRATOR . '/components/' . $type . '_' . $package; $site = JPATH_ROOT . '/components/' . $type . '_' . $package; $media = JPATH_ROOT . '/media/' . $type . '_' . $package; $xmls = JFolder::files(JPATH_ADMINISTRATOR . '/components/' . $type . '_' . $package, '.xml$', 0, true); foreach ($xmls as $manifest) { $xml = simplexml_load_file($manifest); if (isset($xml['type'])) { break; } } if (empty($xml)) { return; } if (!$xml->deleted) { return; } KLoader::load('lib.joomla.filesystem.folder'); KLoader::load('lib.joomla.filesystem.file'); if ($xml->deleted->admin) { foreach ($xml->deleted->admin->children() as $name => $item) { if ($name == 'folder' && JFolder::exists($admin . '/' . $item)) { JFolder::delete($admin . '/' . $item); } if ($name == 'file' && JFile::exists($admin . '/' . $item)) { JFile::delete($admin . '/' . $item); } } } if ($xml->deleted->site) { if ($xml->deleted->site['removed'] && JFolder::exists($site)) { JFolder::delete($site); } foreach ($xml->deleted->site->children() as $name => $item) { if ($name == 'folder' && JFolder::exists($site . '/' . $item)) { JFolder::delete($site . '/' . $item); } if ($name == 'file' && JFile::exists($site . '/' . $item)) { JFile::delete($site . '/' . $item); } } } if ($xml->deleted->media) { foreach ($xml->deleted->media->children() as $name => $item) { if ($name == 'folder' && JFolder::exists($media . '/' . $item)) { JFolder::delete($media . '/' . $item); } if ($name == 'file' && JFile::exists($media . '/' . $item)) { JFile::delete($media . '/' . $item); } } } }
/** * Constructor * * @param array An optional associative array of configuration settings. */ public function __construct(KConfig $options) { parent::__construct($options); KLoader::load('lib.joomla.filesystem.file'); //$attr = array_diff_key($node->attributes(), array_fill_keys(array('name', 'type', 'default', 'get', 'label', 'description'), null) ); $this->_state->insert('client', 'boolean', 0)->insert('optgroup', 'string', true)->insert('incpath', 'boolean', 0)->insert('limit', 'int', 0); // $this->_list = array(); // $this->_total = count($this->_list); }
protected function _initialize(KConfig $config) { KLoader::load('com://admin/learn.library.markdown'); $config->append(array( 'priority' => KCommand::PRIORITY_HIGHEST, )); parent::_initialize($config); }
/** * Create an instance of a class based on a class identifier * * This factory will try to create an generic or default object based on the identifier information * if the actual object cannot be found using a predefined fallback sequence. * * Fallback sequence : -> Named Component Specific * -> Named Component Default * -> Default Component Specific * -> Default Component Default * -> Framework Specific * -> Framework Default * * @param mixed Identifier or Identifier object - com:[//application/]component.view.[.path].name * @param object An optional KConfig object with configuration options * @return object|false Return object on success, returns FALSE on failure */ public function instantiate($identifier, KConfig $config) { $path = KInflector::camelize(implode('_', $identifier->path)); $classname = 'Com'.ucfirst($identifier->package).$path.ucfirst($identifier->name); //Don't allow the auto-loader to load component classes if they don't exists yet if (!class_exists( $classname, false )) { //Find the file if($path = KLoader::load($identifier)) { //Don't allow the auto-loader to load component classes if they don't exists yet if (!class_exists( $classname, false )) { throw new KFactoryAdapterException("Class [$classname] not found in file [".$path."]" ); } } else { $classpath = $identifier->path; $classtype = !empty($classpath) ? array_shift($classpath) : ''; //Create the fallback path and make an exception for views $path = ($classtype != 'view') ? KInflector::camelize(implode('_', $classpath)) : ''; /* * Find the classname to fallback too and auto-load the class * * Fallback sequence : -> Named Component Specific * -> Named Component Default * -> Default Component Specific * -> Default Component Defaukt * -> Framework Specific * -> Framework Default */ if(class_exists('Com'.ucfirst($identifier->package).ucfirst($classtype).$path.ucfirst($identifier->name))) { $classname = 'Com'.ucfirst($identifier->package).ucfirst($classtype).$path.ucfirst($identifier->name); } elseif(class_exists('Com'.ucfirst($identifier->package).ucfirst($classtype).$path.'Default')) { $classname = 'Com'.ucfirst($identifier->package).ucfirst($classtype).$path.'Default'; } elseif(class_exists('ComDefault'.ucfirst($classtype).$path.ucfirst($identifier->name))) { $classname = 'ComDefault'.ucfirst($classtype).$path.ucfirst($identifier->name); } elseif(class_exists('ComDefault'.ucfirst($classtype).$path.'Default')) { $classname = 'ComDefault'.ucfirst($classtype).$path.'Default'; } elseif(class_exists( 'K'.ucfirst($classtype).$path.ucfirst($identifier->name))) { $classname = 'K'.ucfirst($classtype).$path.ucfirst($identifier->name); } elseif(class_exists('K'.ucfirst($classtype).$path.'Default')) { $classname = 'K'.ucfirst($classtype).$path.'Default'; } else { $classname = false; } } } return $classname; }
public function getStorage() { if(empty($this->_storage)) { try { KLoader::load('com://admin/learn.library.spyc.spyc'); $this->_storage = Spyc::YAMLLoadString(parent::getStorage()); } catch(KException $e) { throw new ComLearnDatabaseTableException($e->getMessage()); } } return $this->_storage; }
/** * Create an instance of a class based on a class identifier * * @param mixed Identifier or Identifier object - plg.type.plugin.[.path].name * @param object An optional KConfig object with configuration options * @return object|false Return object on success, returns FALSE on failure */ public function instantiate($identifier, KConfig $config) { $classname = false; if ($identifier->type == 'plg') { $classpath = KInflector::camelize(implode('_', $identifier->path)); $classname = 'Plg' . ucfirst($identifier->package) . $classpath . ucfirst($identifier->name); //Don't allow the auto-loader to load plugin classes if they don't exists yet if (!class_exists($classname, false)) { //Find the file if ($path = KLoader::load($identifier)) { //Don't allow the auto-loader to load plugin classes if they don't exists yet if (!class_exists($classname, false)) { throw new KFactoryAdapterException("Class [{$classname}] not found in file [" . $path . "]"); } } } } return $classname; }
/** * Create an instance of a class based on a class identifier * * This factory will try to create an generic or default object based on the identifier information * if the actual object cannot be found using a predefined fallback sequence. * * Fallback sequence : -> Named Module * -> Default Module * -> Framework Specific * -> Framework Default * * @param mixed Identifier or Identifier object - application::mod.module.[.path].name * @param object An optional KConfig object with configuration options * @return object|false Return object on success, returns FALSE on failure */ public function instantiate($identifier, KConfig $config) { $classname = false; if ($identifier->type == 'mod') { $path = KInflector::camelize(implode('_', $identifier->path)); $classname = 'Mod' . ucfirst($identifier->package) . $path . ucfirst($identifier->name); //Don't allow the auto-loader to load module classes if they don't exists yet if (!class_exists($classname, false)) { //Find the file if ($path = KLoader::load($identifier)) { //Don't allow the auto-loader to load module classes if they don't exists yet if (!class_exists($classname, false)) { throw new KFactoryAdapterException("Class [{$classname}] not found in file [" . $path . "]"); } } else { $classpath = $identifier->path; $classtype = !empty($classpath) ? array_shift($classpath) : $identifier->name; /* * Find the classname to fallback too and auto-load the class * * Fallback sequence : -> Named Module * -> Default Module * -> Framework Specific * -> Framework Default */ if (class_exists('Mod' . ucfirst($identifier->package) . ucfirst($identifier->name))) { $classname = 'Mod' . ucfirst($identifier->package) . ucfirst($identifier->name); } elseif (class_exists('ModDefault' . ucfirst($identifier->name))) { $classname = 'ModDefault' . ucfirst($identifier->name); } elseif (class_exists('K' . ucfirst($classtype) . $path . ucfirst($identifier->name))) { $classname = 'K' . ucfirst($classtype) . ucfirst($identifier->name); } elseif (class_exists('K' . ucfirst($classtype) . 'Default')) { $classname = 'K' . ucfirst($classtype) . 'Default'; } else { $classname = false; } } } } return $classname; }
* @category Ninjaboard * @copyright Copyright (C) 2007 - 2011 NinjaForge. All rights reserved. * @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> * @link http://ninjaforge.com */ /** * If koowa is unavailable * Abort the dispatcher */ if (!defined('KOOWA')) { return; } /** * If Ninjaboard is unavailable * Abort the dispatcher */ if (!KLoader::path('site::com.ninjaboard.dispatcher')) { return; } //Initialize the dispatcher just so models are mapped, and everything else Ninjaboard needs to run KLoader::load('site::com.ninjaboard.dispatcher'); ComNinjaboardDispatcher::register(); /** * Renders latest posts with the same look and feel like the regular component list * * @category Ninjaboard * @copyright Copyright (C) 2007 - 2011 NinjaForge. All rights reserved. * @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> * @link http://ninjaforge.com */ echo KFactory::tmp('site::mod.ninjaboard_posts.html', array('params' => $params, 'module' => $module, 'attribs' => $attribs))->display();
<?php /* @version 1.0.0 * @package mod_ninjaboard_menu * @author Stephanie Scmidt * @author mail admin@dwtutorials.com * @link http://www.dwtutorials.com * @copyright Copyright (C) 2009 Stephanie Scmidt - All rights reserved. */ KLoader::load('admin::com.ninja.view.module'); class ModNbmenuHtml extends ComNinjaViewModuleHtml { /** * Model identifier, points to the component model * * @var string */ protected $_model = 'admin::com.ninjaboard.model.forums'; public function __construct(array $options = array()) { parent::__construct($options); KFactory::get($this->getModel())->recurse(1); } public function display() { $model = KFactory::get($this->getModel()); $this->forums = $model->getList(); $this->total = $model->getTotal(); $this->state = $model->getState(); $this->forum = $model->getItem(); $this->i = 0;
<?php /** * @version $Id: banners.php 2644 2011-09-01 03:07:20Z johanjanssens $ * @category Nooku * @package Nooku_Server * @subpackage Banners * @copyright Copyright (C) 2011 Timble CVBA and Contributors. (http://www.timble.net). * @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> * @link http://www.nooku.org */ /** * Component Loader * * @author Cristiano Cucco <http://nooku.assembla.com/profile/cristiano.cucco> * @category Nooku * @package Nooku_Server * @subpackage Banners */ KLoader::load('com://site/banners.mappings'); echo KFactory::get('com://site/banners.dispatcher')->dispatch();
<?php defined('KOOWA') or die('Restricted access'); /** * Manipulate images using standard methods such as resize, crop, rotate, etc. * This class must be re-initialized for every image you wish to manipulate. * * $Id: image.php 1098 2011-07-07 16:57:05Z stian $ * * @package self * @author Kohana Team * @copyright (c) 2007-2008 Kohana Team * @license http://kohanaphp.com/license.html */ //@TODO this because Koowa changes camelCase classnames to plural, but not identifiers KLoader::load('admin::com.ninja.helper.image.driver'); /** * Improved image helper class, derived from Kohanas * * @author Stian Didriksen <*****@*****.**> */ class ComNinjaHelperImage extends KTemplateHelperAbstract { // Master Dimension const NONE = 1; const AUTO = 2; const HEIGHT = 3; const WIDTH = 4; // Flip Directions const HORIZONTAL = 5; const VERTICAL = 6;
<?php defined('KOOWA') or die('Restricted access'); /** * @category Ninjaboard * @copyright Copyright (C) 2007 - 2011 NinjaForge. All rights reserved. * @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> * @link http://ninjaforge.com */ KLoader::load('admin::com.ninja.view.json'); class ComNinjaboardViewMessagesJson extends ComNinjaViewJson { /** * Return the views output * * @return string The output of the view */ public function display() { $model = $this->getModel(); $template = KFactory::get('site::com.ninjaboard.view.message.html')->getTemplate(); $params = KFactory::get('admin::com.ninjaboard.model.settings')->getParams(); $me = KFactory::get('admin::com.ninjaboard.model.people')->getMe(); $data = array(); foreach ($model->getList() as $message) { $result = $message->getData(); $result['html'] = $template->loadIdentifier('site::com.ninjaboard.view.message.list', array('message' => $message, 'params' => $params, 'me' => $me))->render(true); $data[] = $result; } return json_encode($data); }
public function save() { KLoader::load('joomla.user.helper'); // Load the old row if editing an existing user. if(!$this->_new) { $old_row = KFactory::get('com://admin/users.database.table.users') ->select($this->id, KDatabase::FETCH_ROW); } $user = KFactory::get('joomla:user'); // Validate received data. if(($this->_new || isset($this->_modified['name'])) && trim($this->name) == '') { $this->setStatus(KDatabase::STATUS_FAILED); $this->setStatusMessage(JText::_('Please enter a name!')); return false; } if(($this->_new || isset($this->_modified['username'])) && trim($this->username) == '') { $this->setStatus(KDatabase::STATUS_FAILED); $this->setStatusMessage(JText::_('Please enter a username!')); return false; } if(($this->_new || isset($this->_modified['username'])) && preg_match('#[<>"\'%;()&]#i', $this->username) || strlen(utf8_decode($this->username)) < 2) { $this->setStatus(KDatabase::STATUS_FAILED); $this->setStatusMessage(JText::_('Please enter a valid username. No spaces, at least 2 characters '. 'and must contain <strong>only</strong> letters and numbers.')); return false; } if(isset($this->_modified['username'])) { $query = KFactory::get('koowa:database.query') ->where('username', '=', $this->username) ->where('id', '<>', (int) $this->id); $total = KFactory::get('com://admin/users.database.table.users') ->count($query); if($total) { $this->setStatus(KDatabase::STATUS_FAILED); $this->setStatusMessage(JText::_('This username is already in use.')); return false; } } if(($this->_new || isset($this->_modified['email'])) && (trim($this->email) == '') || !(KFactory::get('koowa:filter.email')->validate($this->email))) { $this->setStatus(KDatabase::STATUS_FAILED); $this->setStatusMessage(JText::_('Please enter a valid e-mail address.')); return false; } if(isset($this->_modified['email'])) { $query = KFactory::get('koowa:database.query') ->where('email', '=', $this->email) ->where('id', '<>', (int) $this->id); $total = KFactory::get('com://admin/users.database.table.users') ->count($query); if($total) { $this->setStatus(KDatabase::STATUS_FAILED); $this->setStatusMessage(JText::_('This e-mail address is already registered.')); return false; } } /* * If username field is an email it has to be the same with email field. * This removes the possibilitiy that a user can get locked out of her account * if someone else uses that username as the email field. */ if (KFactory::get('koowa:filter.email')->validate($this->username) === true && $this->username !== $this->email) { $this->setStatus(KDatabase::STATUS_FAILED); $this->setStatusMessage(JText::_('Your e-mail and username should match if you want to use an e-mail address as your username.')); return false; } // Don't allow users to block themselves. if(isset($this->_modified['enabled']) && !$this->_new && $user->id == $this->id && !$this->enabled) { $this->setStatus(KDatabase::STATUS_FAILED); $this->setStatusMessage(JText::_("You can't block yourself!")); return false; } // Don't allow to save a user without a group. if(($this->_new || isset($this->_modified['users_group_id'])) && !$this->users_group_id) { $this->setStatus(KDatabase::STATUS_FAILED); $this->setStatusMessage(JText::_("You can't create a user without a user group.")); return false; } // Don't allow users below super administrator to edit a super administrator. if(!$this->_new && $old_row->users_group_id == 25 && $user->gid != 25) { $this->setStatus(KDatabase::STATUS_FAILED); $this->setStatusMessage(JText::_("You can't edit a super administrator account.")); return false; } // Don't allow users below super administrator to create an administrators. if(isset($this->_modified['users_group_id']) && $this->users_group_id == 24 && !($user->gid == 25 || ($user->id == $this->id && $user->gid == 24))) { $this->setStatus(KDatabase::STATUS_FAILED); $this->setStatusMessage(JText::_("You can't create a user with this user group level. " ."Only super administrators have this ability.")); return false; } // Don't allow users below super administrator to create a super administrator. if($this->users_group_id == 25 && $user->gid != 25) { $this->setStatus(KDatabase::STATUS_FAILED); $this->setStatusMessage(JText::_("You can't create a user with this user group level. " ."Only super administrators have this ability.")); return false; } // Don't allow users to change the user level of the last active super administrator. if(isset($this->_modifid['users_group_id']) && $old_row->users_group_id != 25) { $query = KFactory::get('koowa:database.query') ->where('users_group_id', '=', 25) ->where('enabled', '=', 1); $total = KFactory::get('com://admin/users.database.table.users') ->count($query); if($total <= 1) { $this->setStatus(KDatabase::STATUS_FAILED); $this->setStatusMessage(JText::_("You can't change this user's group because ". "the user is the only active super administrator for your site.")); return false; } } // Check if passwords match. if(isset($this->_modified['password']) && $this->password != $this->password_verify) { $this->setStatus(KDatabase::STATUS_FAILED); $this->setStatusMessage(JText::_("Passwords don't match!")); return false; } // Generate a random password if empty and the record is new. if($this->_new && !$this->password) { $this->password = KFactory::get('com://admin/users.helper.password') ->getRandom(); $this->password_verify = $this->password; } if(isset($this->_modified['password']) && $this->password) { // Encrypt password. $salt = KFactory::get('com://admin/users.helper.password') ->getRandom(32); $password = KFactory::get('com://admin/users.helper.password') ->getCrypted($this->password, $salt); $this->password = $password.':'.$salt; } else { $this->password = $old_row->password; unset($this->_modified['password']); } if($this->_new) { $this->registered_on = gmdate('Y-m-d H:i:s', time()); } $query = KFactory::get('koowa:database.query') ->select('name') ->where('id', '=', $this->users_group_id); $this->group_name = KFactory::get('com://admin/users.database.table.groups') ->select($query, KDatabase::FETCH_FIELD); // Set parameters. if(isset($this->_modified['params'])) { $params = new JParameter(''); $params->bind($this->_data['params']); $this->params = $params->toString(); if(!$this->_new && $this->_data['params'] == $old_row->params->toString()) { unset($this->_modified['params']); } } // Need to reverse the value of 'enabled', because the mapped column is 'block'. if($this->_new || isset($this->_modified['enabled'])) { $this->enabled = $this->enabled ? 0 : 1; } if(!parent::save()) { return false; } // Syncronize ACL. if($this->_status == KDatabase::STATUS_CREATED) { $aro = KFactory::get('com://admin/groups.database.row.aro') ->setData(array( 'section_value' => 'users', 'value' => $this->id, 'name' => $this->name )); $aro->save(); KFactory::get('com://admin/groups.database.row.arosgroup') ->setData(array( 'group_id' => $this->users_group_id, 'aro_id' => $aro->id ))->save(); } else { if(isset($this->_modified['name']) || isset($this->_modified['users_group_id'])) { $aro = KFactory::get('com://admin/groups.database.table.aros') ->select(array('value' => $this->id), KDatabase::FETCH_ROW); if(isset($this->_modified['name'])) { $aro->name = $this->name; $aro->save(); } if(isset($this->_modified['users_group_id'])) { KFactory::get('com://admin/groups.database.table.arosgroups') ->select(array('aro_id' => $aro->id), KDatabase::FETCH_ROW) ->delete(); KFactory::get('com://admin/groups.database.table.arosgroups') ->select(null, KDatabase::FETCH_ROW) ->setData(array( 'group_id' => $this->users_group_id, 'aro_id' => $aro->id )) ->save(); } } } return true; }
<?php defined('KOOWA') or die('Restricted access'); /* * @version 1.0.2 * @package mod_ninjaboard_latest_posts * @author NinjaForge * @author email support@ninjaforge.com * @link http://ninjaforge.com * @license http://www.gnu.org/copyleft/gpl.html GNU GPL * @copyright Copyright (C) 2010 NinjaForge - All rights reserved. */ KLoader::load('admin::com.ninja.view.module.html'); KLoader::load('site::com.ninjaboard.view.posts'); //class helper class ModNinjaboard_latest_postsHtml extends ComNinjaViewModuleHtml { public function display() { $this->assign('params', KFactory::get('site::mod.ninjaboard_latest_posts.settings')->getParams()); $this->direction = @$params->get('order_by'); $this->limit = @$params->get('num_posts'); if (@$params->get('which_posts') == 1) { $this->sort = 'first_post.created_time'; } elseif (@$params->get('which_posts') == 2) { $this->sort = 'last_post.created_time'; } else { $this->sort = 'created_time'; } $model = KFactory::get($this->getModel())->limit($this->limit)->sort($this->sort())->direction($this->direction()); $this->topics = $model->getList();
<?php /** * @version $Id: stream.php 22 2010-07-25 17:29:36Z copesc $ * @package error * @copyright Copyright (C) 2009 - 2010 Nooku. All rights reserved. * @license GNU GPLv2 <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html> * @link http://www.nooku.org */ // Check if Koowa is active if (!defined('KOOWA')) { JError::raiseWarning(0, JText::_("Koowa wasn't found. Please install the Koowa plugin and enable it.")); return; } // Require the defines KLoader::load('admin::com.stream.defines'); KFactory::map('lib.koowa.template.helper.behavior', 'admin::com.stream.helper.behavior'); // Create the controller dispatcher KFactory::get('admin::com.stream.dispatcher')->dispatch(KRequest::get('get.view', 'cmd', 'targets'));
<?php /** * @version $Id: blog.php 32 2010-07-28 14:48:10Z copesc $ * @package blog * @copyright Copyright (C) 2010 Joocode. All rights reserved. * @license GNU GPLv2 <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html> * @link http://www.nooku.org */ // Check if Koowa is active if (!defined('KOOWA')) { JError::raiseWarning(0, JText::_("Koowa wasn't found. Please install the Koowa plugin and enable it.")); return; } // Require the defines KLoader::load('admin::com.blog.defines'); KFactory::map('lib.koowa.template.helper.behavior', 'admin::com.blog.helper.behavior'); // Create the controller dispatcher KFactory::get('admin::com.blog.dispatcher')->dispatch(KRequest::get('get.view', 'cmd', 'posts'));
<?php defined('KOOWA') or die('Restricted access'); /** * @package Ninjaboard * @copyright Copyright (C) 2011 NinjaForge. All rights reserved. * @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> * @link http://ninjaforge.com */ KLoader::load('admin::mod.ninjaboard_stats.html'); KFactory::get('admin::mod.ninjaboard_stats.html')->assign(array('params' => $params, 'module' => $module, 'attribs' => $attribs))->setLayout($params->get('layout', 'popular_topics'))->display();
<?php /** * @version $Id: stream.php 22 2010-07-25 17:29:36Z copesc $ * @package blog * @copyright Copyright (C) 2009 Nooku. All rights reserved. * @license GNU GPLv2 <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html> * @link http://www.nooku.org */ // Check if Koowa is active if (!defined('KOOWA')) { JError::raiseWarning(0, JText::_("Koowa wasn't found. Please install the Koowa plugin and enable it.")); return; } try { // Require the defines KLoader::load('site::com.stream.defines'); // Create the controller dispatcher KFactory::get('site::com.stream.dispatcher')->dispatch(KRequest::get('get.view', 'cmd', 'activities')); } catch (Exception $e) { //KFactory::get('site::com.error.controller.error')->manage($e); JError::raiseWarning(0, $e->getMessage() . "<br/><br/>" . nl2br($e->getTraceAsString())); }
/** * Prepares for rendering by loading classes * * @param KConfig $config object of configurations */ public function __construct(KConfig $config) { KLoader::load('lib.joomla.module.helper'); $this->renderer = KFactory::get('lib.joomla.document')->loadRenderer('module'); parent::__construct($config); }
<?php defined('KOOWA') or die('Restricted access'); /** * @package Ninja * @copyright Copyright (C) 2011 NinjaForge. All rights reserved. * @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> * @link http://ninjaforge.com */ KLoader::load('admin::com.ninja.helper.paginator'); class ComNinjaboardTemplateHelperPaginator extends ComNinjaHelperPaginator { /** * Template item override * * @var boolean */ protected $_item_override = false; /** * Template list override * * @var boolean */ protected $_list_override = false; /** * Render item pagination * * @param int Total number of items * @param int Offset for the current page * @param int Limit of items per page * @param int Number of links to show before and after the current page link
<?php defined('KOOWA') or die('Restricted access'); /** * @package Ninjaboard * @subpackage Modules * @copyright Copyright (C) 2010 NinjaForge. All rights reserved. * @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> * @link http://ninjaforge.com */ KLoader::load('site::mod.ninjaboard_jump.html'); KFactory::get('site::mod.ninjaboard_jump.html')->assign(array('params' => $params, 'module' => $module))->setLayout($params->get('layout', 'default'))->display();
<?php /** * @version $Id: blog.php 4 2010-07-11 09:59:36Z copesc $ * @package blog * @copyright Copyright (C) 2009 Nooku. All rights reserved. * @license GNU GPLv2 <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html> * @link http://www.nooku.org */ // Check if Koowa is active if (!defined('KOOWA')) { JError::raiseWarning(0, JText::_("Koowa wasn't found. Please install the Koowa plugin and enable it.")); return; } try { // Require the defines KLoader::load('site::com.blog.defines'); // Create the controller dispatcher KFactory::get('site::com.blog.dispatcher')->dispatch(KRequest::get('get.view', 'cmd', 'posts')); } catch (Exception $e) { //KFactory::get('site::com.error.controller.error')->manage($e); JError::raiseWarning(0, $e->getMessage() . "<br/><br/>" . nl2br($e->getTraceAsString())); }
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL * @copyright Copyright (C) 2010 NinjaForge - All rights reserved. */ defined('_JEXEC') or die('Restricted access'); defined('KOOWA') or die('Restricted access'); //KTemplate::loadHelper('script', KRequest::root().'/media/com_ninja/js/jquery/jquery.min.js'); //KTemplate::loadHelper('script', KRequest::root().'/media/com_ninja/js/jquery/jquery.tools.min.js'); //$document->addStyleSheet( JURI::base(true).'/modules/mod_ninjaboard_latest_posts/css/mod_ninjaboard_latest_posts.css', 'text/css' ); //$document->addScript(JURI::base(true).'/media/com_ninja/js/jquery/jquery.min.js', 'text/javascript' ); //$document->addScript(JURI::base(true).'/media/com_ninja/js/jquery/jquery.tools.min.js', 'text/javascript' ); //Load module parameters $layout = $params->get('layout', 'default'); $height = str_replace('px', '', $params->get('height', 200)); $width = str_replace('px', '', $params->get('width', 200)); $num_cols = $params->get('num_cols', 1); $num_posts = $params->get('num_posts', 1); //safety measures for bad user input //set $num_cols to at least one so we don't recieve div by zero error if ($num_cols <= 0) { $num_cols = 1; } //set $num_posts to at least one so we don't return empty results if ($num_posts <= 0) { $num_posts = 1; } //set $num_cols equal to $num_posts so we don't recieve results less than one if ($num_cols > $num_posts) { $num_cols = $num_posts; } KLoader::load('site::mod.ninjaboard_latest_posts.html'); KFactory::get('site::mod.ninjaboard_latest_posts.html', array('params' => $params, 'module' => $module, 'attribs' => $attribs))->display();
public function render($content = ' ', $title = false, array $module = array(), $attribs = array()) { /* KLoader::load('lib.joomla.application.module.helper'); $load =& JModuleHelper::_load(); $load[] = (object) array( 'id' => 50, 'title' => $title, 'module' => 'mod_custom', 'position' => 'above', 'content' => $content, 'showtitle' => 1, 'control' => '', 'params' => ' moduleclass_sfx=-slide red cache=0 ', 'user' => 0, 'name' => 'custom', //'style' => isset($module['style']) ? $module['style'] : 'rounded', 'style' => 'xhtml' ); return null; die('<pre>'.print_r($load, true).'</pre>'); //*/ /* 0 => stdClass::__set_state(array( 'id' => '50', 'title' => 'Breadcrumb', 'module' => 'mod_breadcrumbs', 'position' => 'breadcrumb', 'content' => '', 'showtitle' => '0', 'control' => '', 'params' => 'showHome=1 homeText=Home showLast=1 separator= moduleclass_sfx= cache=0 ', 'user' => 0, 'name' => 'breadcrumbs', 'style' => NULL, )), */ $tmp = $module; $module = new KObject(); $module->params = 'moduleclass_sfx=' . @$tmp['moduleclass_sfx']; $module->module = 'mod_' . $this->_identifier->package . '_' . $this->_identifier->name; $module->id = KFactory::tmp('lib.koowa.filter.int')->sanitize(uniqid()); $module->title = (string) $title; $module->style = isset($tmp['style']) ? $tmp['style'] : 'rounded'; $module->position = $this->_identifier->package . '-' . $this->_identifier->name; $module->showtitle = (bool) $title; $module->name = $this->_identifier->package . '_' . $this->_identifier->name; $module->user = 0; $module->content = $content; $module->set($tmp); if (!isset($attribs['name'])) { $attribs['name'] = $module->position; } if (!isset($attribs['style'])) { $attribs['style'] = $module->style; } if (!isset($attribs['first'])) { $attribs['first'] = null; } if (!isset($attribs['last'])) { $attribs['last'] = null; } if (($yoofix = JPATH_THEMES . DS . KFactory::get('lib.joomla.application')->getTemplate() . DS . 'lib' . DS . 'php' . DS . 'template.php') && ($isYoo = file_exists($yoofix))) { require_once $yoofix; } if ($isYoo) { $attribs['style'] = 'yoo'; } static $chrome; $mainframe = JFactory::getApplication(); $scope = $mainframe->scope; //record the scope $mainframe->scope = $module->module; //set scope to Component name // Get module parameters $params = new JParameter($module->params); // Get module path $module->module = preg_replace('/[^A-Z0-9_\\.-]/i', '', $module->module); $path = JPATH_BASE . DS . 'modules' . DS . $module->module . DS . $module->module . '.php'; // Load the module if (!$module->user && file_exists($path) && empty($module->content)) { $lang =& JFactory::getLanguage(); $lang->load($module->module); $content = ''; ob_start(); require $path; $module->content = ob_get_contents() . $content; ob_end_clean(); } // Load the module chrome functions if (!$chrome) { $chrome = array(); } KLoader::load('lib.joomla.application.module.helper'); $load =& JModuleHelper::_load(); if (!$this->_modules) { $this->_modules_backup = $this->_modules = $load; } $this->_modules[] = $module; $load = $this->_modules; require_once JPATH_BASE . DS . 'templates' . DS . 'system' . DS . 'html' . DS . 'modules.php'; $chromePath = JPATH_BASE . DS . 'templates' . DS . $mainframe->getTemplate() . DS . 'html' . DS . 'modules.php'; if (!isset($chrome[$chromePath])) { if (file_exists($chromePath)) { require_once $chromePath; } $chrome[$chromePath] = true; } //make sure a style is set if (!isset($attribs['style'])) { $attribs['style'] = 'rounded'; } //dynamically add outline style if (JRequest::getBool('tp')) { $attribs['style'] .= ' outline'; } $tpl = KFactory::get('lib.joomla.application')->getTemplate(); $yoofix = false; $warpfive = 'templates/' . $tpl . '/layouts/module.php'; if (JFile::exists(JPATH_ROOT . '/' . $warpfive)) { $tpl_dir = JPATH_ROOT . "/templates/{$tpl}"; //include warp require_once $tpl_dir . '/warp/warp.php'; $warp = Warp::getInstance(); $warp->getHelper('path')->register($tpl_dir . '/warp/systems/joomla.1.5/helpers', 'helpers'); $warp->getHelper('path')->register($tpl_dir . '/warp/systems/joomla.1.5/layouts', 'layouts'); $warp->getHelper('path')->register($tpl_dir . '/layouts', 'layouts'); $template = KFactory::tmp($this->getTemplate())->addFilters(array('alias')); $template->getFilter('alias')->append(array('$this' => '$warp_helper_template')); $data = array('warp_helper_template' => $warp->getHelper("template"), '$warp' => $warp); $module->menu = false; $yoofix = true; } foreach (explode(' ', $attribs['style']) as $style) { $chromeMethod = 'modChrome_' . $style; //Warp 5.5 fix if ($yoofix) { $module->parameter = new JParameter($module->params); $data['module'] = $module; $data['params'] = array(); //@TODO count this $count = 1; $index = 0; $data['params']['count'] = $count; $data['params']['order'] = $index + 1; $data['params']['first'] = $data['params']['order'] == 1; $data['params']['last'] = $data['params']['order'] == $count; $data['params']['suffix'] = $module->parameter->get('moduleclass_sfx', ''); $data['params']['menu'] = false; // get class suffix params $parts = preg_split('/[\\s]+/', $data['params']['suffix']); foreach ($parts as $part) { if (strpos($part, '-') !== false) { $yoostyles = explode('-', $part, 2); $data['params'][$yoostyles[0]] = $yoostyles[1]; } } $module->content = $template->loadPath($warpfive, $data)->render(true); } elseif (function_exists($chromeMethod)) { $module->style = $attribs['style']; ob_start(); $chromeMethod($module, $params, $attribs); $module->content = ob_get_contents(); ob_end_clean(); } } $mainframe->scope = $scope; //revert the scope return $module->content; }
<?php defined('KOOWA') or die('Restricted access'); /** * @category Ninjaboard * @copyright Copyright (C) 2007 - 2011 NinjaForge. All rights reserved. * @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> * @link http://ninjaforge.com */ KLoader::load('admin::com.ninja.controller.view'); /** * Ninjaboard Abstract Controller * * @package Ninjaboard */ class ComNinjaboardControllerAbstract extends ComNinjaControllerView { /** * Constructor * * @param object An optional KConfig object with configuration options */ public function __construct(KConfig $config) { if (!$config->request) { $config->request = new KConfig(); } $config->request->append(array('layout' => 'default')); parent::__construct($config); } /**
<?php /** * @version $Id: users.php 2639 2011-09-01 03:06:25Z johanjanssens $ * @category Nooku * @package Nooku_Server * @subpackage Users * @copyright Copyright (C) 2011 Timble CVBA and Contributors. (http://www.timble.net). * @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> * @link http://www.nooku.org */ /** * Component Loader * * @author Gergo Erdosi <http://nooku.assembla.com/profile/gergoerdosi> * @category Nooku * @package Nooku_Server * @subpackage Users */ KLoader::load('com://site/users.mappings'); echo KFactory::get('com://site/users.dispatcher')->dispatch();
<?php /** * @version $Id: comments.php 2 2010-07-06 18:48:01Z copesc $ * @package Jbp * @copyright Copyright (C) 2009 Nooku. All rights reserved. * @license GNU GPLv2 <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html> * @link http://www.nooku.org */ // Check if Koowa is active if (!defined('KOOWA')) { JError::raiseWarning(0, JText::_("Koowa wasn't found. Please install the Koowa plugin and enable it.")); return; } try { // Require the defines KLoader::load('site::com.comments.defines'); // Create the controller dispatcher KFactory::get('site::com.comments.dispatcher')->dispatch(KRequest::get('get.view', 'cmd', 'comments')); } catch (Exception $e) { KFactory::get('site::com.error.controller.error')->manage($e); }
<?php /** * @version $Id: thumbnail.php 870 2011-09-01 03:10:02Z johanjanssens $ * @category Nooku * @package Nooku_Server * @subpackage Files * @copyright Copyright (C) 2011 Timble CVBA and Contributors. (http://www.timble.net). * @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> * @link http://www.nooku.org */ KLoader::load('com://admin/files.helper.phpthumb.phpthumb'); /** * Thumbnail Database Row Class * * @author Ercan Ozkaya <http://nooku.assembla.com/profile/ercanozkaya> * @category Nooku * @package Nooku_Server * @subpackage Files */ class ComFilesDatabaseRowThumbnail extends KDatabaseRowDefault { public function __construct(KConfig $config) { parent::__construct($config); $this->_thumbnail_size = $config->thumbnail_size; } protected function _initialize(KConfig $config)
<?php /** * @version $Id: weblinks.php 2643 2011-09-01 03:07:12Z johanjanssens $ * @category Nooku * @package Nooku_Server * @subpackage Weblinks * @copyright Copyright (C) 2011 Timble CVBA and Contributors. (http://www.timble.net) * @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> * @link http://www.nooku.org */ /** * Component Loader * * @author Jeremy Wilken <http://nooku.assembla.com/profile/gnomeontherun> * @category Nooku * @package Nooku_Server * @subpackage Weblinks */ KLoader::load('com://site/weblinks.mappings'); echo KFactory::get('com://site/weblinks.dispatcher')->dispatch();