} else {
    require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_languages' . DS . 'helpers' . DS . 'jsonresponse.php';
}
/**
 * Content controller class.
 */
class J2XMLControllerCategories extends JControllerAbstract
{
    function __construct($default = array())
    {
        parent::__construct();
    }
    public function display($cachable = false, $urlparams = false)
    {
        JRequest::setVar('view', 'categories');
        parent::display($cachable, $urlparams);
    }
    function send()
    {
        if (!JSession::checkToken('request')) {
            // Check for a valid token. If invalid, send a 403 with the error message.
            JError::raiseWarning(403, JText::_('JINVALID_TOKEN'));
            echo version_compare(JPlatform::RELEASE, '12', 'ge') ? new JResponseJson() : new JJsonResponse();
            return;
        }
        $cid = JRequest::getVar('cid', array(0), null, 'array');
        $sid = JRequest::getVar('w_id', null, null, 'int');
Esempio n. 2
0
 function display($tpl = null)
 {
     $app = JFactory::getApplication();
     $cid = JRequest::getVar('cid');
     $ids = explode(",", $cid);
     $params = JComponentHelper::getParams('com_j2xml');
     if (!J2XMLExporter::export(J2XMLExporter::users($ids), $params->get('debug', 0), $params->get('export_gzip', '0'))) {
         $app->redirect('index.php?option=com_users');
     }
 }
Esempio n. 3
0
 function display($tpl = null)
 {
     $app = JFactory::getApplication();
     $cid = JRequest::getVar('cid');
     $ids = explode(",", $cid);
     $params = JComponentHelper::getParams('com_j2xml');
     $options = array();
     $options['images'] = $params->get('export_images', '1');
     $options['users'] = $params->get('export_users', '1');
     $options['categories'] = 1;
     $options['contacts'] = $params->get('export_contacts', '1');
     $j2xml = new J2XMLExporter();
     $get_xml = strtolower(str_replace('J2XMLView', '', get_class($this)));
     $j2xml->{$get_xml}($ids, $xml, $options);
     $options = array();
     $options['debug'] = $params->get('debug', 0);
     $options['gzip'] = $params->get('export_gzip', '0');
     if (!$j2xml->export($xml, $options)) {
         $app->redirect('index.php?option=com_categories&extension=com_content');
     }
 }
Esempio n. 4
0
 function display($tpl = null)
 {
     $app = JFactory::getApplication();
     $cid = JRequest::getVar('cid');
     $ids = explode(",", $cid);
     $params = JComponentHelper::getParams('com_j2xml');
     $images = array();
     $xml = J2XMLExporter::categories($ids, $params->get('export_images', '1'), true, $params->get('export_users', '1'), $images);
     foreach ($images as $image) {
         $xml .= $image;
     }
     if (!J2XMLExporter::export($xml, $params->get('debug', 0), $params->get('export_gzip', '0'))) {
         $app->redirect('index.php?option=com_categories&extension=com_content');
     }
 }
Esempio n. 5
0
 static function initialize()
 {
     if (!self::$initialized) {
         $db = JFactory::getDBO();
         $db->setQuery("\r\n\t\t\t\t\tCREATE TABLE IF NOT EXISTS `#__j2xml_usergroups` (\r\n\t\t\t\t\t\t`id` int(10) unsigned NOT NULL,\r\n\t\t\t\t\t\t`parent_id` int(10) unsigned NOT NULL DEFAULT '0',\r\n\t\t\t\t\t\t`title` varchar(100) NOT NULL DEFAULT ''\r\n\t\t\t\t\t) ENGINE=InnoDB  DEFAULT CHARSET=utf8;\r\n\t\t\t\t\t")->execute();
         $db->setQuery("\r\n\t\t\t\t\tTRUNCATE TABLE\r\n\t\t\t\t\t\t`#__j2xml_usergroups`;\r\n\t\t\t\t\t")->execute();
         $db->setQuery("\r\n\t\t\t\t\tINSERT INTO\r\n\t\t\t\t\t\t`#__j2xml_usergroups`\r\n\t\t\t\t\tSELECT\r\n\t\t\t\t\t\t`id`,`parent_id`,CONCAT('[\"',REPLACE(`title`,'\"','\\\"'),'\"]')\r\n\t\t\t\t\tFROM\r\n\t\t\t\t\t\t`#__usergroups`;\r\n\t\t\t\t\t")->execute();
         do {
             $db->setQuery("\r\n\t\t\t\t\tUPDATE\r\n\t\t\t\t\t\t`#__j2xml_usergroups` j\r\n\t\t\t\t\tINNER JOIN\r\n\t\t\t\t\t\t`#__usergroups` g\r\n\t\t\t\t\tON\r\n\t\t\t\t\t\tj.parent_id = g.id\r\n\t\t\t\t\tSET\r\n\t\t\t\t\t\tj.parent_id = g.parent_id,\r\n\t\t\t\t\t\tj.title = CONCAT('[\"',REPLACE(`g`.`title`,'\"','\\\"'), '\",', SUBSTR(`j`.`title`,2));\r\n\t\t\t\t\t")->execute();
             $n = $db->setQuery("\r\n\t\t\t\t\tSELECT\r\n\t\t\t\t\t\tCOUNT(*)\r\n\t\t\t\t\tFROM\r\n\t\t\t\t\t\t`#__j2xml_usergroups`\r\n\t\t\t\t\tWHERE\r\n\t\t\t\t\t\t`parent_id` > 0;\r\n\t\t\t\t\t")->loadResult();
         } while ($n > 0);
         self::$initialized = true;
     }
 }