Ejemplo n.º 1
0
 /**
  * Invoke as a functor
  *
  * @return CacheAdapter
  */
 public function __invoke()
 {
     if (!$this->cache) {
         $this->cache = clone Pi::service('cache')->storage();
         $this->cache->getOptions()->setNamespace($this->getEvent()->getRouteMatch()->getParam('module') . 'action');
     }
     return $this->cache;
 }
Ejemplo n.º 2
0
<?php

/**
 * Pi Engine (http://pialog.org)
 *
 * @link            http://code.pialog.org for the Pi Engine source repository
 * @copyright       Copyright (c) Pi Engine http://pialog.org
 * @license         http://pialog.org/license.txt New BSD License
 */
/**
 * @author Hossein Azizabadi <*****@*****.**>
 */
return array('category' => array(array('title' => _a('Admin'), 'name' => 'admin'), array('title' => _a('News module'), 'name' => 'news'), array('title' => _a('Guide module'), 'name' => 'guide'), array('title' => _a('View'), 'name' => 'view'), array('title' => _a('Social'), 'name' => 'social'), array('title' => _a('Manage'), 'name' => 'manage'), array('title' => _a('Order'), 'name' => 'order')), 'item' => array('admin_perpage' => array('category' => 'admin', 'title' => _a('Perpage'), 'description' => '', 'edit' => 'text', 'filter' => 'number_int', 'value' => 10), 'use_news_topic' => array('category' => 'news', 'title' => _a('Use news topics'), 'description' => '', 'edit' => 'checkbox', 'filter' => 'number_int', 'value' => 1), 'use_guide_category' => array('category' => 'guide', 'title' => _a('Use guide category'), 'description' => '', 'edit' => 'checkbox', 'filter' => 'number_int', 'value' => 1), 'use_guide_location' => array('category' => 'guide', 'title' => _a('Use guide location'), 'description' => '', 'edit' => 'checkbox', 'filter' => 'number_int', 'value' => 1), 'filter_location_level' => array('title' => _a('Select location level for show on filter form'), 'description' => '', 'edit' => array('type' => 'select', 'options' => array('options' => array(1 => _a('level 1'), 2 => _a('level 2'), 3 => _a('level 3'), 4 => _a('level 4'), 5 => _a('level 5')))), 'filter' => 'number_int', 'value' => 1, 'category' => 'guide'), 'view_list_type' => array('title' => _a('Event list type'), 'description' => '', 'edit' => array('type' => 'select', 'options' => array('options' => array('line' => _a('Line : each event on one line'), 'box' => _a('Box : each event as box and 3 box on one line')))), 'filter' => 'text', 'value' => 'event', 'category' => 'view'), 'view_perpage' => array('category' => 'view', 'title' => _a('Perpage'), 'description' => '', 'edit' => 'text', 'filter' => 'number_int', 'value' => 10), 'related_event' => array('category' => 'view', 'title' => _a('Show related event'), 'description' => '', 'edit' => 'checkbox', 'filter' => 'number_int', 'value' => 1), 'related_event_type' => array('title' => _a('Related event type'), 'description' => '', 'edit' => array('type' => 'select', 'options' => array('options' => array('event' => _a('By event module topics'), 'guide' => _a('By guide module categories')))), 'filter' => 'text', 'value' => 'event', 'category' => 'view'), 'image_homepage' => array('category' => 'view', 'title' => _a('Set wide image for homepage'), 'description' => '', 'edit' => 'text', 'filter' => 'string', 'value' => ''), 'price_filter' => array('category' => 'view', 'title' => _a('Price filter'), 'description' => _a('Input method : 100-200,Between 100 to 200|200-300,Between 200 to 300|'), 'edit' => 'textarea', 'filter' => 'string', 'value' => ''), 'social_sharing' => array('title' => _t('Social sharing items'), 'description' => '', 'edit' => array('type' => 'multi_checkbox', 'options' => array('options' => Pi::service('social_sharing')->getList())), 'filter' => 'array', 'category' => 'social'), 'manage_active' => array('category' => 'manage', 'title' => _a('Manage event by users'), 'description' => '', 'edit' => 'checkbox', 'filter' => 'number_int', 'value' => 1), 'manage_approval' => array('category' => 'manage', 'title' => _a('Auto approval user events'), 'description' => '', 'edit' => 'checkbox', 'filter' => 'number_int', 'value' => 1), 'order_active' => array('category' => 'order', 'title' => _a('Active order'), 'description' => _a('Manage event registration, ticket stock and activate orders'), 'edit' => 'checkbox', 'filter' => 'number_int', 'value' => 1), 'order_free' => array('category' => 'order', 'title' => _a('Show free word for free events'), 'description' => '', 'edit' => 'checkbox', 'filter' => 'number_int', 'value' => 1), 'order_discount' => array('category' => 'order', 'title' => _a('Active discount system'), 'description' => _a('Discount percent for each rule on each event'), 'edit' => 'checkbox', 'filter' => 'number_int', 'value' => 1), 'text_description_index' => array('category' => 'head_meta', 'title' => _a('Description for index page'), 'description' => '', 'edit' => 'textarea', 'filter' => 'string', 'value' => '')));
Ejemplo n.º 3
0
<?php

/**
 * Pi Engine (http://pialog.org)
 *
 * @link            http://code.pialog.org for the Pi Engine source repository
 * @copyright       Copyright (c) Pi Engine http://pialog.org
 * @license         http://pialog.org/license.txt BSD 3-Clause License
 */
/**
 * User profile and resource specs
 *
 * @see Pi\Application\Installer\Resource\User
 * @author Taiwen Jiang <*****@*****.**>
 */
return array('quicklink' => array('message' => array('title' => _a('Messages'), 'link' => Pi::service('url')->assemble('default', array('module' => 'message')), 'icon' => 'icon-bell')));
Ejemplo n.º 4
0
}
$row = Pi::model('module')->find($module, 'name');
$installer = new ModuleInstaller();
$result = $installer->update($row);
//$details = $installer->getResult();
if ($result) {
    // Refresh caches
    Pi::service('cache')->flush();
    // Refresh assets
    $modules = Pi::registry('module')->read();
    $themes = Pi::registry('theme')->read();
    foreach (array_keys($modules) as $name) {
        $status = Pi::service('asset')->remove('module/' . $name);
        $status = Pi::service('asset')->publishModule($name);
    }
    foreach (array_keys($themes) as $name) {
        $status = Pi::service('asset')->remove('theme/' . $name);
        $status = Pi::service('asset')->publishTheme($name);
    }
    clearstatcache();
    $message = sprintf('Module %s update succeeded.', $module);
} else {
    $message = sprintf('Module %s update failed.', $module);
}
if (substr(PHP_SAPI, 0, 3) == 'cgi') {
    header('Status: 200');
} else {
    header('HTTP/1.1 200');
}
echo $message;
return;
Ejemplo n.º 5
0
 * In order to use "X-Sendfile", both "XSendFile" and "XSendFilePath"
 * must be configured correctly.
 *
 * Note: No evidence is collected for so-called better performance yet.
 */
//define('PI_HEADER_TYPE', 'SENDFILE');
/*#@-*/
// Allowed file extensions
$allowedExtension = array('css', 'js', 'gif', 'jpg', 'png');
// Disable error_reporting
//define('APPLICATION_ENV', 'production');
// Pi boot with no engine bootup: current file is located in www/script/...
$boot = dirname(dirname($_SERVER['SCRIPT_FILENAME'])) . '/boot.php';
include $boot;
// Disable debugger message
Pi::service('log')->mute();
// Fetch path from query string if path is not set,
// i.e. through a direct request
if (!empty($_SERVER['QUERY_STRING'])) {
    $path = Pi::path(ltrim($_SERVER['QUERY_STRING'], '/'));
}
if (empty($path) || !is_readable($path)) {
    if (substr(PHP_SAPI, 0, 3) == 'cgi') {
        header('Status: 404 Not Found');
    } else {
        header('HTTP/1.1 404 Not Found');
    }
    return;
}
/**
 * #@+
Ejemplo n.º 6
0
<?php

/**
 * Pi Engine (http://pialog.org)
 *
 * @link            http://code.pialog.org for the Pi Engine source repository
 * @copyright       Copyright (c) Pi Engine http://pialog.org
 * @license         http://pialog.org/license.txt New BSD License
 */
/**
 * @author Hossein Azizabadi <*****@*****.**>
 */
return array('category' => array(array('title' => _a('Admin'), 'name' => 'admin'), array('title' => _a('View'), 'name' => 'view'), array('title' => _a('Social'), 'name' => 'social')), 'item' => array('admin_perpage' => array('category' => 'admin', 'title' => _a('Perpage'), 'description' => '', 'edit' => 'text', 'filter' => 'number_int', 'value' => 10), 'view_perpage' => array('category' => 'view', 'title' => _a('Perpage'), 'description' => '', 'edit' => 'text', 'filter' => 'number_int', 'value' => 10), 'social_sharing' => array('title' => _t('Social sharing items'), 'description' => '', 'edit' => array('type' => 'multi_checkbox', 'options' => array('options' => Pi::service('social_sharing')->getList())), 'filter' => 'array', 'category' => 'social'), 'text_description_index' => array('category' => 'head_meta', 'title' => _a('Description for index page'), 'description' => '', 'edit' => 'textarea', 'filter' => 'string', 'value' => '')));
Ejemplo n.º 7
0
 /**
  * Check if taxonomy available
  *
  * @return bool
  */
 public function isActive()
 {
     return Pi::service('module')->isActive($this->module);
 }
Ejemplo n.º 8
0
 /**
  * Escape a string for corresponding context
  *
  * @see \Zend\Escaper\Escaper
  * @param string $value
  * @param string $context
  *      String context, valid value: html, htmlAttr, js, url, css
  * @return string
  */
 function _escape($value, $context = 'html')
 {
     $context = $context ? ucfirst($context) : 'Html';
     $method = 'escape' . $context;
     $escaper = new Escaper(Pi::service('i18n')->getCharset());
     if (method_exists($escaper, $method)) {
         $value = $escaper->{$method}($value);
     }
     return $value;
 }
Ejemplo n.º 9
0
<?php

/**
 * Pi Engine (http://pialog.org)
 *
 * @link            http://code.pialog.org for the Pi Engine source repository
 * @copyright       Copyright (c) Pi Engine http://pialog.org
 * @license         http://pialog.org/license.txt BSD 3-Clause License
 */
return array('field' => array('sample' => array('title' => _a('Sample field'))), 'activity' => array('test-callback' => array('title' => _a('Test callback'), 'icon' => 'icon-post', 'callback' => 'Module\\Demo\\ActivityTest'), 'test-template' => array('title' => _a('Test template'), 'icon' => 'icon-post', 'template' => 'demo-activity-test', 'callback' => Pi::url(Pi::service('url')->assemble('default', array('module' => 'demo', 'controller' => 'activity', 'action' => 'get')), true))));
Ejemplo n.º 10
0
<?php

/**
 * Pi Engine (http://pialog.org)
 *
 * @link            http://code.pialog.org for the Pi Engine source repository
 * @copyright       Copyright (c) Pi Engine http://pialog.org
 * @license         http://pialog.org/license.txt BSD 3-Clause License
 */
/**
 * User profile and resource specs
 *
 * @see Pi\Application\Installer\Resource\User
 * @author Taiwen Jiang <*****@*****.**>
 */
return array('field' => array('identity' => array('type' => 'account', 'name' => 'identity', 'title' => _a('Username'), 'edit' => array('validators' => array(array('name' => 'Module\\User\\Validator\\Username'))), 'is_edit' => false), 'credential' => array('type' => 'account', 'name' => 'credential', 'title' => _a('Password'), 'edit' => array('element' => 'password', 'validators' => array(array('name' => 'Module\\User\\Validator\\Password'))), 'is_display' => false, 'is_search' => false), 'email' => array('type' => 'account', 'name' => 'email', 'title' => _a('Email'), 'edit' => array('element' => 'email', 'validators' => array(array('name' => 'EmailAddress', 'options' => array('useMxCheck' => false, 'useDeepMxCheck' => false, 'useDomainCheck' => false)), array('name' => 'Module\\User\\Validator\\UserEmail'))), 'is_edit' => false), 'name' => array('type' => 'account', 'name' => 'name', 'title' => _a('Display name'), 'edit' => array('validators' => array(array('name' => 'Module\\User\\Validator\\Name'))), 'is_edit' => false), 'gender' => array('type' => 'account', 'name' => 'gender', 'title' => _a('Gender'), 'edit' => array('element' => 'Module\\User\\Form\\Element\\Gender'), 'filter' => 'Gender'), 'birthdate' => array('type' => 'account', 'name' => 'birthdate', 'title' => _a('Birthdate'), 'edit' => array('element' => 'date_select', 'options' => array('create_empty_option' => true, 'year_attributes' => array('class' => 'input-small'), 'month_attributes' => array('class' => 'input-small'), 'day_attributes' => array('class' => 'input-small')), 'filters' => array(array('name' => 'Pi\\Filter\\DateSelect')), 'validators' => array(array('name' => 'Pi\\Validator\\DateSelect'))), 'filter' => 'Module\\User\\Filter\\Birthdate'), 'avatar' => array('type' => 'account', 'name' => 'avatar', 'title' => _a('Avatar'), 'is_edit' => false, 'is_display' => false, 'is_search' => false), 'active' => array('type' => 'account', 'name' => 'active', 'title' => _a('Active'), 'filter' => 'YesNo', 'is_edit' => false, 'is_display' => false), 'time_created' => array('type' => 'account', 'name' => 'time_created', 'title' => _a('Register time'), 'filter' => array('Int', 'DateTimeFormatter'), 'is_edit' => false, 'is_display' => false), 'time_activated' => array('type' => 'account', 'name' => 'time_activated', 'title' => _a('Activation time'), 'filter' => 'DateTimeFormatter', 'is_edit' => false, 'is_display' => false), 'time_disabled' => array('type' => 'account', 'name' => 'time_disabled', 'title' => _a('Disabled time'), 'filter' => 'DateTimeFormatter', 'is_edit' => false, 'is_display' => false, 'is_search' => false), 'time_deleted' => array('type' => 'account', 'name' => 'time_deleted', 'title' => _a('Deleted time'), 'filter' => 'DateTimeFormatter', 'is_edit' => false, 'is_display' => false, 'is_search' => false), 'level' => array('name' => 'level', 'title' => _a('Level'), 'is_display' => false, 'is_edit' => false, 'is_search' => true), 'last_modified' => array('name' => 'last_modified', 'title' => _a('Last modified'), 'is_display' => false, 'is_edit' => false, 'is_search' => true), 'homepage' => array('name' => 'homepage', 'title' => _a('Personal website'), 'edit' => array('element' => 'url')), 'bio' => array('name' => 'bio', 'title' => _a('Short bio'), 'edit' => array('element' => 'textarea')), 'signature' => array('name' => 'signature', 'title' => _a('Signature'), 'edit' => array('element' => 'textarea')), 'ip_register' => array('name' => 'ip_register', 'title' => _a('Register IP'), 'is_edit' => false, 'is_display' => false, 'is_search' => false), 'social' => array('name' => 'social', 'title' => _a('Social tools'), 'handler' => 'Module\\User\\Field\\Social', 'field' => array('title' => array('title' => _a('Tool name')), 'identifier' => array('title' => _a('ID or URL'))))), 'timeline' => array('operation' => array('title' => _a('User action'), 'icon' => 'icon-user')), 'activity' => array(), 'quicklink' => array('logout' => array('title' => _a('Logout'), 'link' => Pi::service('authentication')->getUrl('logout'), 'icon' => 'icon-off')));
Ejemplo n.º 11
0
 /**
  * Displays a debug message during conditional debug
  *
  * @param mixed $data a variable or an object
  * @return void
  */
 function dc($data = '')
 {
     $output = Debug::conditional($data, 2);
     if (null !== $output) {
         Pi::service('log')->debug($output);
     }
 }