Пример #1
0
 /**
  * Send HTTP response
  *
  * Send the specific X-Sendfile HTTP headers for internal processing by the server. For Nginx and Lighttpd 1.4
  * remove the X-Sendfile header and use the specific header instead.
  *
  * If the X-Sendfile header is 1 or TRUE, the response path will be used instead of the path supplied in the
  * header. If X-Sendfile header is  0 or FALSE the header is ignored and removed.
  *
  * - Apache    : X-Sendfile
  * - Nginx     : X-Accel-Redirect
  * - Lightttpd : X-LIGHTTPD-send-file (v1.4) or X-Sendfile (v1.5)
  *
  * @param KDispatcherResponseInterface $response
  * @return boolean
  */
 public function send(KDispatcherResponseInterface $response)
 {
     if ($response->headers->has('X-Sendfile')) {
         $path = $response->headers->get('X-Sendfile');
         if ($path === true || $path === 1) {
             $path = $response->getStream()->getPath();
         }
         if (is_file($path)) {
             $server = strtolower($_SERVER['SERVER_SOFTWARE']);
             //Nginx uses X-Accel-Redirect header
             if (strpos($server, 'nginx') !== FALSE) {
                 $path = preg_replace('/' . preg_quote(Koowa::getRootPath(), '/') . '/', '', $path, 1);
                 $response->headers->set('X-Accel-Redirect', $path);
                 $response->headers->remove('X-Sendfile');
             }
             //Lighttpd 1.4 uses X-LIGHTTPD-send-file header
             if (strpos($server, 'lightttpd/1.4') !== FALSE) {
                 $response->headers->set('X-LIGHTTPD-send-file', $path);
                 $response->headers->remove('X-Sendfile');
             }
             return parent::send($response);
         } else {
             $response->headers->remove('X-Sendfile');
         }
     }
 }
Пример #2
0
 /**
  * Get path to Koowa libraries
  */
 public static function getPath()
 {
     if (!isset(self::$_path)) {
         self::$_path = dirname(__FILE__);
     }
     return self::$_path;
 }
Пример #3
0
 /**
  * Proxy for the onGetWebServices
  * 
  * Will call describe for each xmlrpc event handler and return the results to
  * the xmlrpc server.
  * 
  * @return array An array of associative arrays defining the available methods
  */
 function onGetWebServices()
 {
     $services = array();
     //Get the event dispatcher
     $dispatcher = KFactory::get('lib.koowa.event.dispatcher');
     $path = JPATH_COMPONENT . DS . 'xmlrpc';
     $dir = new DirectoryIterator($path);
     foreach ($dir as $file) {
         //Make sure we found a valid file
         if ($file->isDot() || in_array($file->getFilename(), array('.svn', 'index.html'))) {
             continue;
         }
         $filename = basename($file->getFilename(), ".php");
         //Load the event handler
         Koowa::import('admin::com.nooku.xmlrpc.' . $filename);
         //Register the event handler
         $dispatcher->register('NookuXmlrpc' . ucfirst($filename));
     }
     $results = $dispatcher->dispatch('describe', new ArrayObject());
     foreach ($results as $result) {
         foreach ($result as $key => $value) {
             $services[$key] = $value;
         }
     }
     return $services;
 }
Пример #4
0
 public function display($tpl = null)
 {
     // Request
     $month = KInput::get('month', 'get', 'digit', null, date('m'));
     $year = KInput::get('year', 'get', 'int', null, date('Y'));
     $graph = KInput::get('graph', 'get', 'cmd', null, 'translations');
     $table_name = KInput::get('table_name', 'get', KFactory::tmp('admin::com.nooku.filter.tablename'), null, '');
     $this->assign('graph', $graph);
     $this->assign('table_name', $table_name);
     $this->assign('month', $month);
     $this->assign('year', $year);
     // URI
     $uri =& JURI::getInstance(JURI::base() . 'index.php?option=com_nooku&format=openflashchart');
     $uri->setVar('table_name', $table_name);
     $uri->setVar('layout', 'bar');
     $uri->setVar('view', 'statistics.translations');
     $this->assign('translations', $uri->toString());
     $uri->setVar('year', date('Y'));
     $uri->setVar('month', date('n'));
     $uri->setVar('view', 'statistics.translators');
     $this->assign('translators', $uri->toString());
     // panes
     Koowa::import('lib.joomla.html.pane');
     $this->assignRef('panes', JPane::getInstance('tabs'));
     // Mixin a menubar object
     $this->mixin(new NookuMixinMenu($this));
     $this->displayMenubar();
     $this->displayMenutitle();
     $this->displayToolbar();
     // Display the layout
     parent::display($tpl);
 }
Пример #5
0
 public function getServerErrors()
 {
     $errors = array();
     if (!class_exists('mysqli')) {
         $errors[] = JText::_("We're sorry but your server isn't configured with the MySQLi database driver. Please\n\t\t    contact your host and ask them to enable MySQLi for your server.");
     }
     if (version_compare(phpversion(), '5.3', '<')) {
         $errors[] = sprintf(JText::_("EXTman requires PHP 5.3 or later. Your server is running PHP %s."), phpversion());
     }
     if (!function_exists('token_get_all')) {
         $errors[] = 'PHP tokenizer extension must be enabled by your host.';
     }
     if (version_compare(JFactory::getDBO()->getVersion(), '5.0.41', '<')) {
         $errors[] = sprintf(JText::_("EXTman requires MySQL 5.0.41 or later. Your server is running MySQL %s."), JFactory::getDBO()->getVersion());
     }
     // Check a bunch of Ohanah v2 files to see if it is installed
     if (file_exists(JPATH_ADMINISTRATOR . '/components/com_ohanah/controllers/event.php') || file_exists(JPATH_SITE . '/components/com_ohanah/dispatcher.php') || file_exists(JPATH_SITE . '/components/com_ohanah/controllers/event.php')) {
         $errors[] = sprintf("You have the Ohanah event management extension installed.\n            Ohanah works with an older version of our Nooku framework, so updating EXTman now would break your site.\n            Installation is aborting. For more information please read our detailed explanation <a target=\"_blank\" href=\"%s\">here</a>.", 'http://www.joomlatools.com/framework-known-issues');
     }
     if (class_exists('Koowa') && (!method_exists('Koowa', 'getInstance') || version_compare(Koowa::getInstance()->getVersion(), '1', '<'))) {
         $errors[] = sprintf(JText::_("Your site has an older version of our library already installed. Installation\n\t\t\t is aborting to prevent creating conflicts with other extensions."));
     }
     //Some hosts that specialize on Joomla are known to lock permissions to the libraries folder
     if (!is_writable(JPATH_LIBRARIES)) {
         $errors[] = sprintf(JText::_("The <em title=\"%s\">libraries</em> folder needs to be writable in order for\n\t\t    EXTman to install correctly."), JPATH_LIBRARIES);
     }
     if (count($errors) === 0 && $this->checkDatabaseType() === false) {
         $link = JRoute::_('index.php?option=com_config');
         $errors[] = "In order to use Joomlatools extensions, your database type in Global Configuration should be set\n\t\t\tto <strong>MySQLi</strong>. Please go to <a href=\"{$link}\">Global Configuration</a> and in the 'Server' tab\n\t\t\tchange your Database Type to <strong>MySQLi</strong>.";
     }
     return $errors;
 }
Пример #6
0
 public function __construct($subject, $config = array())
 {
     // Turn off E_STRICT errors for now
     error_reporting(error_reporting() & ~E_STRICT);
     // Check if database type is MySQLi
     if (JFactory::getApplication()->getCfg('dbtype') != 'mysqli') {
         if (JFactory::getApplication()->getName() === 'administrator') {
             $string = version_compare(JVERSION, '1.6', '<') ? 'mysqli' : 'MySQLi';
             $link = JRoute::_('index.php?option=com_config');
             $error = 'In order to use Joomlatools framework, your database type in Global Configuration should be set to <strong>%1$s</strong>. Please go to <a href="%2$s">Global Configuration</a> and in the \'Server\' tab change your Database Type to <strong>%1$s</strong>.';
             JError::raiseWarning(0, sprintf(JText::_($error), $string, $link));
         }
         return;
     }
     // Set pcre.backtrack_limit to a larger value
     // See: https://bugs.php.net/bug.php?id=40846
     if (version_compare(PHP_VERSION, '5.3.6', '<=') && @ini_get('pcre.backtrack_limit') < 1000000) {
         @ini_set('pcre.backtrack_limit', 1000000);
     }
     //Set constants
     define('KDEBUG', JDEBUG);
     //Set path definitions
     define('JPATH_FILES', JPATH_ROOT);
     define('JPATH_IMAGES', JPATH_ROOT . DIRECTORY_SEPARATOR . 'images');
     //Set exception handler
     set_exception_handler(array($this, 'exceptionHandler'));
     // Koowa : setup
     require_once JPATH_LIBRARIES . '/koowa/koowa.php';
     Koowa::getInstance(array('cache_prefix' => md5(JFactory::getApplication()->getCfg('secret')) . '-cache-koowa', 'cache_enabled' => false));
     KLoader::addAdapter(new KLoaderAdapterModule(array('basepath' => JPATH_BASE)));
     KLoader::addAdapter(new KLoaderAdapterPlugin(array('basepath' => JPATH_ROOT)));
     KLoader::addAdapter(new KLoaderAdapterComponent(array('basepath' => JPATH_BASE)));
     KServiceIdentifier::addLocator(KService::get('koowa:service.locator.module'));
     KServiceIdentifier::addLocator(KService::get('koowa:service.locator.plugin'));
     KServiceIdentifier::addLocator(KService::get('koowa:service.locator.component'));
     KServiceIdentifier::setApplication('site', JPATH_SITE);
     KServiceIdentifier::setApplication('admin', JPATH_ADMINISTRATOR);
     KService::setAlias('koowa:database.adapter.mysqli', 'com://admin/default.database.adapter.mysqli');
     KService::setAlias('translator', 'com:default.translator');
     //Setup the request
     if (JFactory::getApplication()->getName() !== 'site') {
         KRequest::root(str_replace('/' . JFactory::getApplication()->getName(), '', KRequest::base()));
     }
     //Load the koowa plugins
     JPluginHelper::importPlugin('koowa', null, true);
     //Bugfix : Set offset accoording to user's timezone
     if (!JFactory::getUser()->guest) {
         if ($offset = JFactory::getUser()->getParam('timezone')) {
             if (version_compare(JVERSION, '3.0', '>=')) {
                 JFactory::getConfig()->set('offset', $offset);
             } else {
                 JFactory::getConfig()->setValue('config.offset', $offset);
             }
         }
     }
     // Load language files for the framework
     KService::get('com:default.translator')->loadLanguageFiles();
     parent::__construct($subject, $config);
 }
Пример #7
0
 public function onApplicationAfterDispatch(ArrayObject $args)
 {
     if (KInput::get('task', 'get', 'cmd') == 'edit') {
         $doc = KFactory::get('lib.joomla.document');
         $doc->addScript(Koowa::getUrl('js') . 'koowa.js');
         $doc->addScript(Nooku::getUrl('js') . 'ajax.metadata.menus.js');
     }
 }
Пример #8
0
 public function onApplicationAfterDispatch(ArrayObject $args)
 {
     if (in_array(KInput::get('task', array('get', 'post'), 'cmd'), array('edit', 'add'))) {
         $doc = KFactory::get('lib.joomla.document');
         $doc->addScript(Koowa::getUrl('js') . 'koowa.js');
         $doc->addScript(Nooku::getUrl('js') . 'ajax.form.js');
     }
 }
Пример #9
0
 public function getList()
 {
     if (!$this->_list) {
         $server_software = !empty($_SERVER['SERVER_SOFTWARE']) ? $_SERVER['SERVER_SOFTWARE'] : JText::_('n/a');
         $rows = array(array('setting' => JText::_('PHP Built On'), 'value' => php_uname()), array('setting' => JText::_('Database Version'), 'value' => mysqli_get_server_info($this->getService('koowa:database.adapter.mysqli')->getConnection())), array('setting' => JText::_('Database Collation'), 'value' => $this->getService('com://admin/extensions.database.table.plugins')->getSchema()->collation), array('setting' => JText::_('PHP Version'), 'value' => phpversion()), array('setting' => JText::_('Web Server'), 'value' => $server_software), array('setting' => JText::_('WebServer to PHP Interface'), 'value' => php_sapi_name()), array('setting' => JText::_('Nooku Server Version'), 'value' => Koowa::getVersion()), array('setting' => JText::_('User Agent'), 'value' => $_SERVER['HTTP_USER_AGENT'], ENT_QUOTES));
         $this->_list = $this->getService('com://admin/info.database.rowset.system')->addData($rows, false);
     }
     return $this->_list;
 }
Пример #10
0
 public function getPropertyFullpath()
 {
     $result = $this->getProperty('path');
     // Prepend with site root if it is a relative path
     if (!preg_match('#^(?:[a-z]\\:|~*/)#i', $result)) {
         $result = Koowa::getInstance()->getRootPath() . '/' . $result;
     }
     $result = rtrim(str_replace('\\', '/', $result), '\\');
     return $result;
 }
Пример #11
0
 public function __construct($subject, $config = array())
 {
     // Check if Koowa is active
     if (JFactory::getApplication()->getCfg('dbtype') != 'mysqli') {
         JError::raiseWarning(0, JText::_("Koowa plugin requires MySQLi Database Driver. Please change your database configuration settings to 'mysqli'"));
         return;
     }
     // Check for suhosin
     if (in_array('suhosin', get_loaded_extensions())) {
         //Attempt setting the whitelist value
         @ini_set('suhosin.executor.include.whitelist', 'tmpl://, file://');
         //Checking if the whitelist is ok
         if (!@ini_get('suhosin.executor.include.whitelist') || strpos(@ini_get('suhosin.executor.include.whitelist'), 'tmpl://') === false) {
             JError::raiseWarning(0, sprintf(JText::_('Your server has Suhosin loaded. Please follow <a href="%s" target="_blank">this</a> tutorial.'), 'https://nooku.assembla.com/wiki/show/nooku-framework/Known_Issues'));
             return;
         }
     }
     //Set constants
     define('KDEBUG', JDEBUG);
     define('JPATH_IMAGES', JPATH_ROOT . '/images');
     //Set exception handler
     set_exception_handler(array($this, 'exceptionHandler'));
     // Require the library loader
     JLoader::import('libraries.koowa.koowa', JPATH_ROOT);
     JLoader::import('libraries.koowa.loader.loader', JPATH_ROOT);
     //Setup the loader
     KLoader::addAdapter(new KLoaderAdapterKoowa(Koowa::getPath()));
     KLoader::addAdapter(new KLoaderAdapterJoomla(JPATH_LIBRARIES));
     KLoader::addAdapter(new KLoaderAdapterModule(JPATH_BASE));
     KLoader::addAdapter(new KLoaderAdapterPlugin(JPATH_ROOT));
     KLoader::addAdapter(new KLoaderAdapterComponent(JPATH_BASE));
     //Setup the factory
     KFactory::addAdapter(new KFactoryAdapterKoowa());
     KFactory::addAdapter(new KFactoryAdapterJoomla());
     KFactory::addAdapter(new KFactoryAdapterModule());
     KFactory::addAdapter(new KFactoryAdapterPlugin());
     KFactory::addAdapter(new KFactoryAdapterComponent());
     //Setup the identifier application paths
     KIdentifier::registerApplication('site', JPATH_SITE);
     KIdentifier::registerApplication('admin', JPATH_ADMINISTRATOR);
     //Setup the request
     KRequest::root(str_replace('/' . JFactory::getApplication()->getName(), '', KRequest::base()));
     //Set factory identifier aliasses
     KFactory::map('lib.koowa.database.adapter.mysqli', 'admin::com.default.database.adapter.mysqli');
     //Load the koowa plugins
     JPluginHelper::importPlugin('koowa', null, true, KFactory::get('lib.koowa.event.dispatcher'));
     //Bugfix : Set offset accoording to user's timezone
     if (!KFactory::get('lib.joomla.user')->guest) {
         if ($offset = KFactory::get('lib.joomla.user')->getParam('timezone')) {
             KFactory::get('lib.joomla.config')->setValue('config.offset', $offset);
         }
     }
     parent::__construct($subject, $config);
 }
Пример #12
0
 public function getTrackingInfo($extension)
 {
     $version = new JVersion();
     $server = @php_uname('s') . ' ' . @php_uname('r');
     // php_uname is disabled
     if (empty($server)) {
         $server = 'Unknown';
     }
     $info = array('Product' => $extension->name, 'Version' => $extension->version, 'Joomla' => $this->_extractVersionInfo($version->getShortVersion()), 'Koowa' => class_exists('Koowa') && method_exists('Koowa', 'getInstance') ? Koowa::getInstance()->getVersion() : 0, 'PHP' => $this->_extractVersionInfo(phpversion()), 'Database' => $this->_extractVersionInfo(JFactory::getDBO()->getVersion()), 'Web Server' => @$_SERVER['SERVER_SOFTWARE'], 'Web Server OS' => $server, 'Joomla Language' => JFactory::getLanguage()->getName());
     return $info;
 }
Пример #13
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     parent::execute($input, $output);
     $this->check($input, $output);
     require_once Util::buildTargetPath('libraries/koowa/libraries/koowa.php', $this->target_dir);
     require_once Util::buildTargetPath('configuration.php', $this->target_dir);
     \Koowa::getInstance();
     $config = new \JConfig();
     $secret = $config->secret;
     $user = $input->getArgument('username');
     $token = \KObjectManager::getInstance()->getObject('http.token')->setSubject($user)->sign($secret);
     $output->writeln($token);
 }
Пример #14
0
 /**
  * Get a list of tablename => links
  *
  * @return array
  */
 public function getLinks()
 {
     if (!isset($this->_links)) {
         // Load all editlinks files
         Koowa::import('lib.joomla.filesystem.folder');
         $filter = '\\.php$';
         $path = JPATH_COMPONENT . DS . 'configs';
         foreach (JFolder::files($path . DS . 'core', $filter, false, true) as $file) {
             include $file;
         }
         foreach (JFolder::files($path . DS . 'user', $filter, false, true) as $file) {
             include $file;
         }
     }
     return $this->_links;
 }
Пример #15
0
 /**
  * Constructor
  *
  * Prevent creating instances of this class by making the contructor private
  *
  * @param  array  An optional array with configuration options.
  */
 private final function __construct($config = array())
 {
     //store the path
     $this->_path = dirname(__FILE__);
     //instantiate koowa
     Koowa::getInstance(array('cache_prefix' => $config['cache_prefix'], 'cache_enabled' => $config['cache_enabled']));
     //if caching is not enabled then reset the apc cache to
     //to prevent corrupt identifier
     if (!$config['cache_enabled']) {
         clean_apc_with_prefix($config['cache_prefix']);
     }
     require_once dirname(__FILE__) . '/loader/adapter/anahita.php';
     KLoader::addAdapter(new AnLoaderAdapterAnahita(array('basepath' => dirname(__FILE__))));
     KLoader::addAdapter(new AnLoaderAdapterDefault(array('basepath' => JPATH_LIBRARIES . '/default')));
     AnServiceClass::getInstance();
     KServiceIdentifier::addLocator(new AnServiceLocatorAnahita());
     KServiceIdentifier::addLocator(new AnServiceLocatorRepository());
     //register an empty path for the application
     //a workaround to remove the applicaiton path from an identifier
     KServiceIdentifier::setApplication('', '');
     //create a central event dispatcher
     KService::set('anahita:event.dispatcher', KService::get('koowa:event.dispatcher'));
 }
 public function getServerErrors()
 {
     $errors = array();
     if (extension_loaded('suhosin')) {
         $prev = @ini_get('suhosin.executor.include.whitelist');
         $attempt = 'tmpl://' . ($prev ? ', ' . $prev : '');
         //Attempt setting the whitelist value
         @ini_set('suhosin.executor.include.whitelist', $attempt);
         //Checking if the whitelist is ok
         if (!@ini_get('suhosin.executor.include.whitelist') || strpos(@ini_get('suhosin.executor.include.whitelist'), 'tmpl://') === false) {
             $errors[] = sprintf(JText::_('The install failed because your server has Suhosin loaded, but it\'s not configured correctly. Please follow <a href="%s" target="_blank">this</a> tutorial before you reinstall.'), 'http://www.joomlatools.com/framework-known-issues');
         }
     }
     if (!class_exists('mysqli')) {
         $errors[] = JText::_("We're sorry but your server isn't configured with the MySQLi database driver. Please contact your host and ask them to enable MySQLi for your server.");
     }
     if (version_compare(phpversion(), '5.2', '<')) {
         $errors[] = sprintf(JText::_("EXTman requires PHP 5.2 or later. Your server is running PHP %s."), phpversion());
     }
     if (version_compare(JFactory::getDBO()->getVersion(), '5.0.41', '<')) {
         $errors[] = sprintf(JText::_("EXTman requires MySQL 5.0.41 or later. Your server is running MySQL %s."), JFactory::getDBO()->getVersion());
     }
     if (class_exists('Koowa') && (!method_exists('Koowa', 'getInstance') || version_compare(Koowa::getInstance()->getVersion(), '12', '<'))) {
         $errors[] = sprintf(JText::_("Your site has an older version of our library already installed. Installation is aborting to prevent creating conflicts with other extensions."));
     }
     //Some hosts that specialize on Joomla are known to lock permissions to the libraries folder
     if (!is_writable(JPATH_LIBRARIES)) {
         $errors[] = sprintf(JText::_("The <em title=\"%s\">libraries</em> folder needs to be writable in order for EXTman to install correctly."), JPATH_LIBRARIES);
     }
     if (count($errors) === 0 && $this->checkDatabaseType() === false) {
         $string = $this->getVersion() === '1.5' ? 'mysqli' : 'MySQLi';
         $link = JRoute::_('index.php?option=com_config');
         $errors[] = "In order to use Joomlatools extensions, your database type in Global Configuration should be set to <strong>{$string}</strong>. Please go to <a href=\"{$link}\">Global Configuration</a> and in the 'Server' tab change your Database Type to <strong>{$string}</strong>.";
     }
     return $errors;
 }
<?php

/**
 * @version     $Id:openflashchart.php 137 2007-11-20 18:32:09Z mjaz $
 * @category	Koowa
 * @package     Koowa_Chart
 * @subpackage  OpenFlashChart
 * @copyright   Copyright (C) 2007 - 2009 Joomlatools. All rights reserved.
 * @license     GNU GPLv2 <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>
 * @link     	http://www.koowa.org
 */
Koowa::import('lib.koowa.chart.renderer.open-flash-chart.open-flash-chart');
/**
 * Chart Data class with Open Flash Chart
 *
 * @author		Mathias Verraes <*****@*****.**>
 * @category	Koowa
 * @package     Koowa_Chart
 * @subpackage  OpenFlashChart
 * @uses KObject
 */
class KChartOpenflashchart extends KObject
{
    /**
     * The Openflashchart data
     *
     * @var object Graph
     */
    protected $_data;
    public function __construct()
    {
Пример #18
0
<?php

/**
 * @version     $Id$
 * @package     Koowa_Tests
 * @copyright   Copyright (C) 2007 - 2008 Joomlatools. All rights reserved.
 * @license     GNU GPLv2 <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>
 * @link        http://www.koowa.org
 */
?>

Koowa Unit Test Version:    0.1
Koowa Version:              <?php 
echo Koowa::getVersion() . PHP_EOL;
?>
Joomla! Version:            <?php 
echo JVERSION . PHP_EOL;
?>

Пример #19
0
<?php

// Require the defines
Koowa::import('admin::com.duuka.defines');
Koowa::import('admin::com.duuka.loader');
// Create the component dispatcher
$dispatcher = KFactory::get('admin::com.duuka.dispatcher');
$dispatcher->dispatch(array('default_view' => 'items'));
Пример #20
0
<?php

// Require the defines
Koowa::import('admin::com.immotoa.defines');
Koowa::import('admin::com.immotoa.loader');
// Create the component dispatcher
$dispatcher = KFactory::get('admin::com.immotoa.dispatcher');
$dispatcher->dispatch(array('default_view' => 'properties'));
Пример #21
0
 function getInfo()
 {
     $db =& JFactory::getDBO();
     $version = new JVersion();
     $info = array('dm' => _DM_VERSION, 'j' => $version->getShortVersion(), 'k' => class_exists('Koowa') && method_exists('Koowa', 'getVersion') ? Koowa::getVersion() : 0, 'php' => phpversion(), 'db' => $db->getVersion());
     return http_build_query($info);
 }
Пример #22
0
/**
 * @version		$Id: nooku.php 923 2009-03-03 17:54:50Z johan $
 * @category    Nooku
 * @package     Nooku_Site
 * @copyright	Copyright (C) 2007 - 2009 Joomlatools. All rights reserved.
 * @license		GNU GPLv2 <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>
 * @link     	http://www.nooku.org
 */
// no direct access
defined('_JEXEC') or die('Restricted access');
// 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;
}
// Check if Nooku is active
if (!defined('NOOKU')) {
    JError::raiseWarning(0, JText::_("The Nooku plugin isn't enabled."));
    return;
}
// Require the defines
Koowa::import('site::com.nooku.defines');
Koowa::import('site::com.nooku.loader');
// Options for the dispatcher
$options = array('default_view' => 'translate');
// Map views to dispatchers
$map = array('translate' => 'admin::com.nooku.dispatcher', 'translate.source' => 'admin::com.nooku.dispatcher', 'redirect' => 'site::com.nooku.dispatcher', 'default' => 'site::com.nooku.dispatcher');
// Create the component dispatcher
$view = KInput::get('view', 'get', 'cmd');
$name = array_key_exists($view, $map) ? $map[$view] : $map['default'];
KFactory::get($name)->dispatch($options);
Пример #23
0
<?php

// Require the defines
Koowa::import('admin::com.picman.defines');
Koowa::import('admin::com.picman.loader');
// Create the component dispatcher
$dispatcher = KFactory::get('admin::com.picman.dispatcher');
$dispatcher->dispatch(array('default_view' => 'imageslist'));
Пример #24
0
 /**
  * Removes Joomla root from a filename replacing them with the plain text equivalents.
  *
  * Useful for debugging when you want to display a shorter path.
  *
  * @param   array   $config An optional array with configuration options
  * @return  string  Html
  */
 public function path($config = array())
 {
     $config = new KObjectConfigJson($config);
     $config->append(array('file' => '', 'line' => '', 'root' => Koowa::getInstance()->getRootPath(), 'editor' => $this->_editor));
     $html = $config->file;
     if (strpos($config->file, $config->root) === 0) {
         $html = '...' . DIRECTORY_SEPARATOR . trim(substr($config->file, strlen($config->root)), DIRECTORY_SEPARATOR);
     }
     if ($config->editor && isset($this->_editors[$config->editor])) {
         $editor = $this->_editors[$config->editor];
         foreach ($this->_getSharedPaths() as $guest => $host) {
             if (substr($config->file, 0, strlen($guest)) == $guest) {
                 $config->file = str_replace($guest, $host, $config->file);
             }
         }
         if (is_callable($editor)) {
             $editor = call_user_func($editor, $config->file, $config->line);
         }
         $editor = str_replace("%line", $config->line, $editor);
         $editor = str_replace("%file", $config->file, $editor);
         $html = '<a href="' . $editor . '" title="' . $html . '">' . $html . '</a>';
     }
     return $html;
 }
Пример #25
0
 */
require_once Koowa::getPath() . '/exception/interface.php';
require_once Koowa::getPath() . '/exception/exception.php';
/**
 * Indentifier Classes
 */
require_once Koowa::getPath() . '/identifier/interface.php';
require_once Koowa::getPath() . '/identifier/identifier.php';
require_once Koowa::getPath() . '/identifier/exception.php';
/**
 * Loader Classes
 */
require_once Koowa::getPath() . '/loader/adapter/interface.php';
require_once Koowa::getPath() . '/loader/adapter/exception.php';
require_once Koowa::getPath() . '/loader/adapter/abstract.php';
require_once Koowa::getPath() . '/loader/adapter/koowa.php';
//Instantiate the loader singleton
KLoader::instantiate();
/**
 * KLoader class
 *
 * @author      Johan Janssens <*****@*****.**>
 * @category    Koowa
 * @package     Koowa_Loader
 * @static
 */
class KLoader
{
    /**
     * The file container
     *
Пример #26
0
 public static function order($row_id)
 {
     //Load koowa javascript
     KViewHelper::_('script', 'koowa.js', Koowa::getURL('js'));
     $up = Koowa::getURL('images') . '/arrow_up.png';
     $down = Koowa::getURL('images') . '/arrow_down.png';
     $result = '<a href="javascript:KGridOrder(' . $row_id . ', -1)" >' . '<img src="' . $up . '" border="0" alt="' . JText::_('Move up') . '" />' . '</a>' . '<a href="javascript:KGridOrder(' . $row_id . ', 1)" >' . '<img src="' . $down . '" border="0" alt="' . JText::_('Move down') . '" />' . '</a>';
     return $result;
 }
Пример #27
0
 * @package     Nooku_Plugins
 * @subpackage  System
 * @copyright	Copyright (C) 2007 - 2009 Joomlatools. All rights reserved.
 * @license		http://www.gnu.org/copyleft/gpl.html GNU/GPLv2
 * @link     	http://www.nooku.org
 */
// Check if Koowa is active
if (!defined('KOOWA')) {
    return;
}
// Require the library loader
Koowa::import('admin::com.nooku.defines');
//import the dbo decorator
Koowa::import('admin::com.nooku.proxies.database');
Koowa::import('admin::com.nooku.proxies.language');
Koowa::import('com.nooku.proxies.application');
/**
 * Nooku System plugin
 *
 * @author		Johan Janssens <*****@*****.**>
 * @category   	Nooku
 * @package     Nooku_Plugins
 * @subpackage  System
 */
class plgSystemNooku extends JPlugin
{
    public function __construct($subject, $config = array())
    {
        $db =& JFactory::getDBO();
        if (!$db instanceof KDatabase) {
            return;
Пример #28
0
<?php

/**
 * @version		$Id: poll.php 970 2009-04-12 16:05:22Z johan $
 * @category    Nooku
 * @package     Nooku_Administrator
 * @subpackage  Events
 * @copyright	Copyright (C) 2007 - 2009 Joomlatools. All rights reserved.
 * @license		GNU GPLv2 <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>
 * @link     	http://www.nooku.org
 */
Koowa::import('admin::com.nooku.events.default');
/**
 * Poll Event Handler
 *
 * @author		Johan Janssens <*****@*****.**>
 * @category    Nooku
 * @package     Nooku_Administrator
 * @subpackage  Events
 */
class NookuEventPoll extends NookuEventDefault
{
    public function __construct()
    {
        parent::__construct();
        $this->_table = 'polls';
    }
}
Пример #29
0
<?php

/**
 * @version     $Id: line.php 663 2009-03-03 18:34:43Z johan $
 * @category	Koowa
 * @package     Koowa_Chart
 * @subpackage  Sparkline
 * @copyright   Copyright (C) 2007 - 2009 Joomlatools. All rights reserved.
 * @license     GNU GPLv2 <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>
 * @link        http://www.koowa.org
 */
Koowa::import('lib.koowa.chart.renderer.sparkline.Sparkline_Line');
/**
 * Sparkline Line
 *
 * @author      Mathias Verraes <*****@*****.**>
 * @category	Koowa
 * @package     Koowa_Chart
 * @subpackage  Sparkline
 */
class KChartSparklineLine extends KChartSparkline
{
    /**
     * Get an instance of a SparklineLine object, always creating it
     *
     * @param	array	Configuration array
     * @return	object	KChartSparklineBar proxy object
     */
    public static function getInstance($config = array())
    {
        if (!isset($config['catch_errors'])) {
Пример #30
0
 /**
  * Class constructore
  *
  * @access protected
  * @param	array	$options Associative array of options
  */
 public function __construct(array $options = array())
 {
     parent::__construct($options);
     if (isset($options['margin-header'])) {
         $this->_margin_header = $options['margin-header'];
     }
     if (isset($options['margin-footer'])) {
         $this->_margin_footer = $options['margin-footer'];
     }
     if (isset($options['margin-top'])) {
         $this->_margin_top = $options['margin-top'];
     }
     if (isset($options['margin-bottom'])) {
         $this->_margin_bottom = $options['margin-bottom'];
     }
     if (isset($options['margin-left'])) {
         $this->_margin_left = $options['margin-left'];
     }
     if (isset($options['margin-right'])) {
         $this->_margin_right = $options['margin-right'];
     }
     if (isset($options['image-scale'])) {
         $this->_image_scale = $options['image-scale'];
     }
     // Set the mime encoding
     $this->setMimeEncoding('application/pdf');
     /*
      * Setup external configuration options
      */
     define('K_TCPDF_EXTERNAL_CONFIG', true);
     /*
      * Path options
      */
     // Installation path
     define("K_PATH_MAIN", JPATH_LIBRARIES . DS . "tcpdf");
     // URL path
     define("K_PATH_URL", JPATH_BASE);
     // Fonts path
     define("K_PATH_FONTS", JPATH_SITE . DS . 'language' . DS . "pdf_fonts" . DS);
     // Cache directory path
     define("K_PATH_CACHE", K_PATH_MAIN . DS . "cache");
     // Cache URL path
     define("K_PATH_URL_CACHE", K_PATH_URL . DS . "cache");
     // Images path
     define("K_PATH_IMAGES", K_PATH_MAIN . DS . "images");
     // Blank image path
     define("K_BLANK_IMAGE", K_PATH_IMAGES . DS . "_blank.png");
     /*
      * Format options
      */
     // Cell height ratio
     define("K_CELL_HEIGHT_RATIO", 1.25);
     // Magnification scale for titles
     define("K_TITLE_MAGNIFICATION", 1.3);
     // Reduction scale for small font
     define("K_SMALL_RATIO", 2 / 3);
     // Magnication scale for head
     define("HEAD_MAGNIFICATION", 1.1);
     /*
      * Create the pdf document
      */
     Koowa::loadFile('lib.tcpdf.tcpdf');
     // Default settings are a portrait layout with an A4 configuration using millimeters as units
     $this->_engine = new TCPDF();
     //set margins
     $this->_engine->SetMargins($this->_margin_left, $this->_margin_top, $this->_margin_right);
     //set auto page breaks
     $this->_engine->SetAutoPageBreak(TRUE, $this->_margin_bottom);
     $this->_engine->SetHeaderMargin($this->_margin_header);
     $this->_engine->SetFooterMargin($this->_margin_footer);
     $this->_engine->setImageScale($this->_image_scale);
 }