Ejemplo n.º 1
0
 function render()
 {
     $form_name = \GCore\Libs\Request::data('chronoform');
     if (!empty($form_name)) {
         $form = Libs\Form::getInstance($form_name);
         $form->render_action(\GCore\Libs\Request::data('action'), \GCore\Libs\Request::data('action_id'));
     } else {
         Libs\Form::render_action(\GCore\Libs\Request::data('action'), \GCore\Libs\Request::data('action_id'));
     }
 }
Ejemplo n.º 2
0
 function __construct($area, $joption, $extension, $setup = null, $cont_vars = array())
 {
     require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'gcloader.php';
     if (phpversion('pdo') !== false and in_array('mysql', PDO::getAvailableDrivers())) {
         //good, we use PDO
         \GCore\Libs\Base::setConfig('db_adapter', 'joomla');
     } else {
         \GCore\Libs\Base::setConfig('db_adapter', 'joomla');
     }
     \GCore\C::set('EXTENSIONS_PATHS', array(dirname(__FILE__) . DS . 'admin' . DS . 'extensions' . DS => JPATH_SITE . DS . 'administrator' . DS . 'components' . DS, dirname(__FILE__) . DS . 'extensions' . DS => JPATH_SITE . DS . 'components' . DS));
     \GCore\C::set('EXTENSIONS_URLS', array(\JFactory::getURI()->root() . 'libraries/cegcore/admin/extensions/' => \JFactory::getURI()->root() . 'administrator/components/', \JFactory::getURI()->root() . 'libraries/cegcore/extensions/' => \JFactory::getURI()->root() . 'components/'));
     \GCore\C::set('EXTENSIONS_NAMES', array('chronomigrator' => 'com_chronomigrator', 'chronoforms' => 'com_chronoforms5', 'chronoconnectivity' => 'com_chronoconnectivity5', 'chronoforums' => 'com_chronoforums', 'chronolistings' => 'com_chronolistings', 'chronocommunity' => 'com_chronocommunity', 'chronosearch' => 'com_chronosearch', 'chronocontact' => 'com_chronocontact', $extension => 'com_' . $joption));
     //GCore\Libs\Url::$root_ext = array('components', 'com_'.$joption);
     \GCore\Bootstrap::initialize('joomla', array('component' => 'com_' . $joption, 'ext' => $extension));
     $tvout = strlen(\GCore\Libs\Request::data('tvout', null)) > 0 ? \GCore\Libs\Request::data('tvout') : '';
     $controller = \GCore\Libs\Request::data('cont', '');
     $action = \GCore\Libs\Request::data('act', '');
     if (is_callable($setup)) {
         $return_vars = $setup();
         if (!empty($return_vars)) {
             $cont_vars = array_merge($cont_vars, $return_vars);
         }
     }
     if (isset($cont_vars['controller'])) {
         $controller = $cont_vars['controller'];
     }
     if (isset($cont_vars['action'])) {
         $action = $cont_vars['action'];
     }
     $cont_vars['_app_thread'] = 'gcore';
     ob_start();
     echo \GCore\Libs\AppJ::call($area, $extension, $controller, $action, $cont_vars);
     $output = ob_get_clean();
     $output = \GCore\C::fix_urls($output);
     if ($tvout == 'ajax') {
         echo $output;
         $mainframe = \JFactory::getApplication();
         $mainframe->close();
     } else {
         ob_start();
         $toolbar = \GCore\Helpers\Module::render(array('type' => 'toolbar', 'site' => 'admin', 'params' => ''));
         $messages = \GCore\Libs\AppJ::getSystemMessages();
         echo \GCore\Libs\AppJ::getHeader();
         if ($toolbar) {
             echo $toolbar;
             echo '<div style="clear:both;"></div>';
         }
         echo $messages;
         //echo \GCore\Libs\AppJ::getHeader();
         $system_output = ob_get_clean();
         $system_output = \GCore\C::fix_urls($system_output);
         echo $system_output;
         echo $output;
     }
 }
Ejemplo n.º 3
0
 function execute(&$form, $action_id)
 {
     $config = $form->actions_config[$action_id];
     $config = new \GCore\Libs\Parameter($config);
     $owner_id = $config->get('owner_id_index', '') ? \GCore\Libs\Request::data($config->get('owner_id_index', ''), null) : null;
     if (\GCore\Libs\Authorize::check_rules($config->get('access', array()), array(), $owner_id)) {
         $this->events['success'] = 1;
         return true;
     } else {
         $this->events['fail'] = 1;
         return false;
     }
 }
Ejemplo n.º 4
0
 function execute(&$form, $action_id)
 {
     $config = $form->actions_config[$action_id];
     $config = new \GCore\Libs\Parameter($config);
     if (!defined('RECAPTCHA_VERIFY_SERVER')) {
         define('RECAPTCHA_VERIFY_SERVER', $config->get('verify_server'));
     }
     $resp = $this->recaptcha_check_answer($config->get('private_key'), $_SERVER["REMOTE_ADDR"], \GCore\Libs\Request::data("recaptcha_challenge_field"), \GCore\Libs\Request::data("recaptcha_response_field"));
     if (!$resp->is_valid) {
         $form->errors['recaptcha'] = $config->get('error', "The reCAPTCHA wasn't entered correctly. Please try it again.");
         $form->debug[$action_id][self::$title][] = "( reCAPTCHA said: " . $resp->error . " )";
         $this->events['fail'] = 1;
     } else {
         $this->events['success'] = 1;
     }
 }
Ejemplo n.º 5
0
 public static function check($field = 'captcha', $key = 'gcore_captcha')
 {
     $posvar = \GCore\Libs\Request::data($field, null);
     if (!empty($posvar)) {
         $session = \GCore\Libs\Base::getSession();
         $sessionvar = $session->get($key);
         $postvar = strtolower($posvar);
         if (md5($postvar) != $sessionvar) {
             \GCore\Libs\Request::set($field, '');
             return false;
         } else {
             $session->clear($key);
             \GCore\Libs\Request::set($field, '');
             return true;
         }
     } else {
         return false;
     }
 }
Ejemplo n.º 6
0
<?php

/* @copyright:ChronoEngine.com @license:GPLv2 */
defined('_JEXEC') or die('Restricted access');
defined("GCORE_SITE") or die;
if (!empty($connection['Connection']['extras'][$area]['actions'][$act_name]['form_event'])) {
    $form_data = explode(':', trim($connection['Connection']['extras'][$area]['actions'][$act_name]['form_event']));
    $form_name = $form_data[0];
    $form_event = \GCore\Libs\Request::data('event', $form_data[1]);
    ob_start();
    echo \GCore\Libs\App::call('front', 'chronoforms', '', '', array('chronoform' => $form_name, 'event' => $form_event));
    $output = ob_get_clean();
    /*
    $pattern = '/<form([^>]*?)([^>]*?)>/is';
    preg_match_all($pattern, $output, $matches);
    if(!empty($matches[0][0])){
    	$form_tag = $matches[0][0];
    	$form_tag = preg_replace('/ action=("|\')(.*?)("|\')/i', ' action="'.r_('index.php?ext=chronoconnectivity&cont=lists&ccname='.$connection['Connection']['title']).'"', $form_tag);
    	$form_tag = preg_replace('/ name=("|\')(.*?)("|\')/i', ' name="admin_form"', $form_tag);
    	$form_tag = preg_replace('/ id=("|\')(.*?)("|\')/i', ' id="admin_form"', $form_tag);
    }
    $output = str_replace($matches[0][0], $form_tag, $output);
    */
    echo $output;
} else {
    $code = $connection['Connection']['extras'][$area]['actions'][$act_name]['code'];
    ob_start();
    eval('?>' . $code);
    $code = ob_get_clean();
    $code = $this->Lister->prepare($connection, $code);
    $code = $this->Lister->translate($connection, $code);
Ejemplo n.º 7
0
 public static function call($site, $extension, $controller = '', $action = '', $params = array())
 {
     if (!empty($params['_app_thread'])) {
         $thread = $params['_app_thread'];
     } else {
         $thread = 'x_core_' . rand();
     }
     $x_app = self::getInstance($site, $thread);
     $x_app->extension = $extension;
     $x_app->controller = $controller;
     $x_app->action = $action;
     $x_app->set($params);
     $x_app->dispatch(true);
     $tvout = strlen(\GCore\Libs\Request::data('tvout', null)) > 0 ? \GCore\Libs\Request::data('tvout') : '';
     if ($tvout != 'ajax' and GCORE_SITE == 'admin') {
         $doc = \GCore\Libs\Document::getInstance();
         $doc->addCssFile('joomla_fixes');
     }
     return $x_app->buffer;
 }
Ejemplo n.º 8
0
 function index()
 {
     if (!empty($this->pmodel)) {
         $session = \GCore\Libs\Base::getSession();
         $sessioned_string = trim($this->connection['Connection']['extras'][$this->area]['columns']['sessioned']);
         if (!empty($sessioned_string)) {
             $columns = explode("\n", $sessioned_string);
             $fields = array_map('trim', $columns);
             foreach ($fields as $k => $field) {
                 $value = \GCore\Libs\Request::data($field, null);
                 if (!is_null($value)) {
                     $session->set($field, $value);
                 } else {
                     \GCore\Libs\Request::set($field, $session->get($field));
                     $this->data[$field] = $session->get($field);
                 }
             }
         }
         $find_params = array();
         $conditions = eval('?>' . $this->connection['Connection']['extras']['models']['conditions'][1]);
         $this->pmodel->conditions = is_array($conditions) ? $conditions : array();
         if (!empty($this->connection['Connection']['extras']['models']['fields'][1])) {
             $find_params['fields'] = $this->_process_fields_list($this->connection['Connection']['extras']['models']['fields'][1]);
         }
         if (!empty($this->connection['Connection']['extras']['models']['order'][1])) {
             $this->pmodel->order_by = $this->_process_fields_list($this->connection['Connection']['extras']['models']['order'][1]);
         }
         if (!empty($this->connection['Connection']['extras']['models']['group'][1])) {
             //$find_params['group'] = array_map('trim', explode(',', $this->connection['Connection']['extras']['models']['group'][1]));
             $this->pmodel->group = $this->_process_fields_list($this->connection['Connection']['extras']['models']['group'][1]);
         }
         //sorting
         $this->sort_model = $this->pmodel;
         $this->_sortable();
         //filtering
         $this->filter_model = $this->pmodel;
         $_f = function ($e) {
             $cs = explode(':', $e, 2);
             return trim($cs[0]);
         };
         //filters
         $filters_fields = array();
         $filters_string = trim($this->connection['Connection']['extras'][$this->area]['columns']['filters']);
         if (!empty($filters_string)) {
             $columns = explode("\n", $filters_string);
             $filters_fields = array_map($_f, $columns);
         }
         $this->_filter($filters_fields);
         //search
         $this->search_model = $this->pmodel;
         $searchable_fields = array();
         $searchable_string = trim($this->connection['Connection']['extras'][$this->area]['columns']['searchable']);
         if (!empty($searchable_string)) {
             $columns = explode("\n", $searchable_string);
             $searchable_fields = array_map($_f, $columns);
         }
         $this->_search($searchable_fields);
         //paginating
         $this->paginate_model = $this->pmodel;
         $this->_paginate();
         //find records list
         $rows = $this->pmodel->find('all', $find_params);
         //pr($rows);
         $this->set('rows', $rows);
         $this->set('connection', $this->connection);
         $this->set('area', $this->area);
         //add the correct display helper
         $helper = $this->connection['Connection']['extras'][$this->area]['display']['block'];
         $this->helpers[] = '\\GCore\\Admin\\Extensions\\Chronoconnectivity\\Blocks\\' . \GCore\Libs\Str::camilize($helper);
         $this->set('helper', \GCore\Libs\Str::camilize($helper));
         $this->view = \GCore\C::ext_path('chronoconnectivity', 'admin') . 'views' . DS . 'lists' . DS . 'index.php';
     }
 }