예제 #1
0
 function __construct($config)
 {
     parent::__construct($config);
     $this->frontend = JFactory::getApplication()->isSite();
     $mainframe = JFactory::getApplication();
     $option = 'com_contentbuilder';
     $this->_id = JRequest::getInt('id', 0);
     $this->_subject = JRequest::getCmd('subject', '');
 }
예제 #2
0
 function __construct($config)
 {
     parent::__construct($config);
     $mainframe = JFactory::getApplication();
     $option = 'com_contentbuilder';
     // Get pagination request variables
     $limit = $mainframe->getUserStateFromRequest('global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int');
     $limitstart = JRequest::getVar('limitstart', 0, '', 'int');
     // In case limit has been changed, adjust it
     $limitstart = $limit != 0 ? floor($limitstart / $limit) * $limit : 0;
     $this->setState('limit', $limit);
     $this->setState('limitstart', $limitstart);
     $filter_order = $mainframe->getUserStateFromRequest($option . 'storages_filter_order', 'filter_order', '`name`', 'cmd');
     $filter_order_Dir = $mainframe->getUserStateFromRequest($option . 'storages_filter_order_Dir', 'filter_order_Dir', 'desc', 'word');
     $this->setState('storages_filter_order', $filter_order);
     $this->setState('storages_filter_order_Dir', $filter_order_Dir);
     $filter_state = $mainframe->getUserStateFromRequest($option . 'storages_filter_state', 'filter_state', '', 'word');
     $this->setState('storages_filter_state', $filter_state);
 }
예제 #3
0
 function __construct($config)
 {
     parent::__construct();
     $mainframe = JFactory::getApplication();
     $option = 'com_contentbuilder';
     $array = JRequest::getVar('cid', 0, '', 'array');
     $this->setId((int) $array[0]);
     if (JRequest::getInt('id', 0) > 0) {
         $this->setId(JRequest::getInt('id', 0));
     }
     $limit = $mainframe->getUserStateFromRequest('global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int');
     $limitstart = JRequest::getVar('limitstart', 0, '', 'int');
     // In case limit has been changed, adjust it
     $limitstart = $limit != 0 ? floor($limitstart / $limit) * $limit : 0;
     $this->setState('limit', $limit);
     $this->setState('limitstart', $limitstart);
     $filter_order = $mainframe->getUserStateFromRequest($option . 'fields_filter_order', 'filter_order', 'ordering', 'cmd');
     $filter_order_Dir = $mainframe->getUserStateFromRequest($option . 'fields_filter_order_Dir', 'filter_order_Dir', 'asc', 'word');
     $this->setState('fields_filter_order', $filter_order);
     $this->setState('fields_filter_order_Dir', $filter_order_Dir);
     $filter_state = $mainframe->getUserStateFromRequest($option . 'fields_filter_state', 'filter_state', '', 'word');
     $this->setState('fields_filter_state', $filter_state);
 }
예제 #4
0
 function __construct($config)
 {
     parent::__construct($config);
     $this->frontend = JFactory::getApplication()->isSite();
     $mainframe = JFactory::getApplication();
     $option = 'com_contentbuilder';
     $this->setId(JRequest::getInt('id', 0));
     if (JFactory::getSession()->get($option . 'formsd_id', 0) == 0 || JFactory::getSession()->get($option . 'formsd_id', 0) == $this->_id) {
         $filter_order = $mainframe->getUserStateFromRequest($option . 'formsd_filter_order', 'filter_order', '', 'cmd');
         $filter_order_Dir = $mainframe->getUserStateFromRequest($option . 'formsd_filter_order_Dir', 'filter_order_Dir', 'desc', 'cmd');
         $filter = $mainframe->getUserStateFromRequest($option . 'formsd_filter', 'filter', '', 'string');
         $filter_state = $mainframe->getUserStateFromRequest($option . 'formsd_filter_state', 'list_state_filter', 0, 'int');
         $filter_publish = $mainframe->getUserStateFromRequest($option . 'formsd_filter_publish', 'list_publish_filter', -1, 'int');
         $filter_language = $mainframe->getUserStateFromRequest($option . 'formsd_filter_language', 'list_language_filter', '', 'cmd');
     } else {
         $mainframe->setUserState($option . 'formsd_filter_order', JRequest::getCmd('filter_order', ''));
         $mainframe->setUserState($option . 'formsd_filter_order_Dir', JRequest::getCmd('filter_order_Dir', ''));
         $mainframe->setUserState($option . 'formsd_filter', JRequest::getVar('filter', ''));
         $mainframe->setUserState($option . 'formsd_filter_state', JRequest::getInt('list_state_filter', 0));
         $mainframe->setUserState($option . 'formsd_filter_publish', JRequest::getInt('list_publish_filter', -1));
         $mainframe->setUserState($option . 'formsd_filter_language', JRequest::getCmd('list_language_filter', ''));
         $filter_order = JRequest::getCmd('filter_order', '');
         $filter_order_Dir = JRequest::getCmd('filter_order_Dir', '');
         $filter = JRequest::getVar('filter', '');
         $filter_state = JRequest::getInt('list_state_filter', 0);
         $filter_publish = JRequest::getInt('list_publish_filter', -1);
         $filter_language = JRequest::getCmd('list_language_filter', '');
     }
     $this->setState('formsd_filter_state', $filter_state);
     $this->setState('formsd_filter_publish', $filter_publish);
     $this->setState('formsd_filter_language', empty($filter_language) ? null : $filter_language);
     $this->setState('formsd_filter', $filter);
     $this->setState('formsd_filter_order', $filter_order);
     $this->setState('formsd_filter_order_Dir', $filter_order_Dir);
     $menu_filter = JRequest::getVar('cb_list_filterhidden', null);
     if ($menu_filter !== null) {
         $lines = explode("\n", $menu_filter);
         foreach ($lines as $line) {
             $keyval = explode("\t", $line);
             if (count($keyval) == 2) {
                 $keyval[1] = str_replace(array("\n", "\r"), "", $keyval[1]);
                 $keyval[1] = contentbuilder::execPhpValue($keyval[1]);
                 if ($keyval[1] != '') {
                     $this->_menu_filter[$keyval[0]] = explode('|', $keyval[1]);
                 }
             }
         }
     }
     $menu_filter_order = JRequest::getVar('cb_list_orderhidden', null);
     if ($menu_filter_order !== null) {
         $lines = explode("\n", $menu_filter_order);
         foreach ($lines as $line) {
             $keyval = explode("\t", $line);
             if (count($keyval) == 2) {
                 $keyval[1] = str_replace(array("\n", "\r"), "", $keyval[1]);
                 if ($keyval[1] != '') {
                     $this->_menu_filter_order[$keyval[0]] = intval($keyval[1]);
                 }
             }
         }
     }
     @natsort($this->_menu_filter_order);
     JFactory::getSession()->set($option . 'forms_id', $this->_id);
 }
예제 #5
0
 function __construct($config)
 {
     parent::__construct();
     $option = 'com_contentbuilder';
     $this->frontend = JFactory::getApplication()->isSite();
     // ATTTENTION: ALSO DEFINED IN DETAILS CONTROLLER!
     if ($this->frontend && JRequest::getInt('Itemid', 0)) {
         $this->_menu_item = true;
         // try menu item
         jimport('joomla.version');
         $version = new JVersion();
         if (version_compare($version->getShortVersion(), '1.6', '>=')) {
             $menu = JSite::getMenu();
             $item = $menu->getActive();
             if (is_object($item)) {
                 if ($item->params->get('record_id', null) !== null) {
                     JRequest::setVar('record_id', $item->params->get('record_id', null));
                     $this->_show_back_button = $item->params->get('show_back_button', null);
                 }
                 if ($item->params->get('cb_latest', null) !== null) {
                     $this->_latest = $item->params->get('cb_latest', null);
                     $this->_show_back_button = $item->params->get('show_back_button', null);
                 }
                 if ($item->params->get('show_page_heading', null) !== null) {
                     $this->_show_page_heading = $item->params->get('show_page_heading', null);
                 }
                 if ($item->params->get('page_title', null) !== null) {
                     $this->_page_title = $item->params->get('page_title', null);
                 }
                 if ($item->params->get('page_heading', null) !== null) {
                     $this->_page_heading = $item->params->get('page_heading', null);
                 }
             }
         } else {
             $params = JComponentHelper::getParams($option);
             if ($params->get('record_id', null)) {
                 JRequest::setVar('record_id', $params->get('record_id', null));
                 $this->_show_back_button = $params->get('show_back_button', null);
             }
             if ($params->get('cb_latest', null)) {
                 $this->_latest = $params->get('cb_latest', null);
                 $this->_show_back_button = $params->get('show_back_button', null);
             }
             if ($params->get('show_page_heading', null) !== null) {
                 $this->_show_page_heading = $params->get('show_page_heading', null);
             }
             if ($params->get('page_title', null) !== null) {
                 $this->_page_title = $params->get('page_title', null);
             }
         }
     }
     $menu_filter = JRequest::getVar('cb_list_filterhidden', null);
     if ($menu_filter !== null) {
         $lines = explode("\n", $menu_filter);
         foreach ($lines as $line) {
             $keyval = explode("\t", $line);
             if (count($keyval) == 2) {
                 $keyval[1] = str_replace(array("\n", "\r"), "", $keyval[1]);
                 $keyval[1] = contentbuilder::execPhpValue($keyval[1]);
                 if ($keyval[1] != '') {
                     $this->_menu_filter[$keyval[0]] = explode('|', $keyval[1]);
                 }
             }
         }
     }
     $menu_filter_order = JRequest::getVar('cb_list_orderhidden', null);
     if ($menu_filter_order !== null) {
         $lines = explode("\n", $menu_filter_order);
         foreach ($lines as $line) {
             $keyval = explode("\t", $line);
             if (count($keyval) == 2) {
                 $keyval[1] = str_replace(array("\n", "\r"), "", $keyval[1]);
                 if ($keyval[1] != '') {
                     $this->_menu_filter_order[$keyval[0]] = intval($keyval[1]);
                 }
             }
         }
     }
     @natsort($this->_menu_filter_order);
     $this->setIds(JRequest::getInt('id', 0), JRequest::getCmd('record_id', ''));
 }
예제 #6
0
 function __construct($config)
 {
     parent::__construct($config);
     $mainframe = JFactory::getApplication();
     $option = 'com_contentbuilder';
     // Get pagination request variables
     $limit = $mainframe->getUserStateFromRequest('global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int');
     $limitstart = JRequest::getVar('limitstart', 0, '', 'int');
     // In case limit has been changed, adjust it
     $limitstart = $limit != 0 ? floor($limitstart / $limit) * $limit : 0;
     $this->setState('limit', $limit);
     $this->setState('limitstart', $limitstart);
     $filter_order = $mainframe->getUserStateFromRequest($option . 'forms_filter_order', 'filter_order', '`name`', 'cmd');
     $filter_order_Dir = $mainframe->getUserStateFromRequest($option . 'forms_filter_order_Dir', 'filter_order_Dir', 'desc', 'word');
     $this->setState('forms_filter_order', $filter_order);
     $this->setState('forms_filter_order_Dir', $filter_order_Dir);
     $filter_state = $mainframe->getUserStateFromRequest($option . 'forms_filter_state', 'filter_state', '', 'word');
     $this->setState('forms_filter_state', $filter_state);
     $filter_tag = $mainframe->getUserStateFromRequest($option . 'forms_filter_tag', 'filter_tag', '', 'string');
     $this->setState('forms_filter_tag', $filter_tag);
     $this->frontend = JFactory::getApplication()->isSite();
     if ($this->frontend && JRequest::getInt('Itemid', 0)) {
         $this->_menu_item = true;
         // try menu item
         jimport('joomla.version');
         $version = new JVersion();
         $forms = null;
         if (version_compare($version->getShortVersion(), '1.6', '>=')) {
             $menu = JSite::getMenu();
             $item = $menu->getActive();
             if (is_object($item)) {
                 if ($item->params->get('forms', null) !== null) {
                     $forms = $item->params->get('forms', null);
                 }
                 if ($item->params->get('cb_show_permission_column', null) !== null) {
                     $this->show_permissions = $item->params->get('cb_show_permission_column', null);
                 }
                 if ($item->params->get('cb_show_permission_new_column', null) !== null) {
                     $this->show_permissions_new = $item->params->get('cb_show_permission_new_column', null);
                 }
                 if ($item->params->get('cb_show_permission_edit_column', null) !== null) {
                     $this->show_permissions_edit = $item->params->get('cb_show_permission_edit_column', null);
                 }
                 if ($item->params->get('show_page_heading', null) !== null) {
                     $this->_show_page_heading = $item->params->get('show_page_heading', null);
                 }
                 if ($item->params->get('cb_show_introtext', null) !== null) {
                     $this->show_introtext = $item->params->get('cb_show_introtext', null);
                 }
                 if ($item->params->get('cb_show_tags', null) !== null) {
                     $this->show_tags = $item->params->get('cb_show_tags', null);
                 }
                 if ($item->params->get('cb_show_id', null) !== null) {
                     $this->show_id = $item->params->get('cb_show_id', null);
                 }
             }
         } else {
             $params = JComponentHelper::getParams('com_contentbuilder');
             if ($params->get('forms', null)) {
                 $forms = $params->get('forms', null);
             }
             if ($params->get('cb_show_permission_column', null)) {
                 $this->show_permissions = $params->get('cb_show_permission_column', null);
             }
             if ($params->get('cb_show_permission_new_column', null)) {
                 $this->show_permissions_new = $params->get('cb_show_permission_new_column', null);
             }
             if ($params->get('cb_show_permission_edit_column', null)) {
                 $this->show_permissions_edit = $params->get('cb_show_permission_edit_column', null);
             }
             if ($params->get('show_page_heading', null) !== null) {
                 $this->_show_page_heading = $params->get('show_page_heading', null);
             }
             if ($params->get('cb_show_introtext', null) !== null) {
                 $this->show_introtext = $params->get('cb_show_introtext', null);
             }
             if ($params->get('cb_show_tags', null) !== null) {
                 $this->show_tags = $params->get('cb_show_tags', null);
             }
             if ($params->get('cb_show_id', null) !== null) {
                 $this->show_id = $params->get('cb_show_id', null);
             }
         }
         if ($forms !== null) {
             if (!is_array($forms)) {
                 $forms2 = explode(',', $forms);
             } else {
                 $forms2 = $forms;
             }
             foreach ($forms2 as $form) {
                 $this->forms[] = intval($form);
             }
         }
     }
 }
예제 #7
0
 function __construct($config)
 {
     parent::__construct();
     $this->setIds(JRequest::getInt('id', 0), JRequest::getInt('element_id', ''));
 }
예제 #8
0
 function __construct($config)
 {
     parent::__construct($config);
     $version = new JVersion();
     if (version_compare($version->getShortVersion(), '3.0', '>=')) {
         $this->is15 = false;
         $this->is16 = false;
         $this->is30 = true;
     } else {
         if (version_compare($version->getShortVersion(), '1.6', '>=')) {
             $this->is15 = false;
             $this->is16 = true;
             $this->is30 = false;
         }
     }
     JRequest::setVar('cb_category_id', null);
     $this->frontend = JFactory::getApplication()->isSite();
     if ($this->frontend && JRequest::getInt('Itemid', 0)) {
         $this->_menu_item = true;
         // try menu item
         jimport('joomla.version');
         $version = new JVersion();
         if (version_compare($version->getShortVersion(), '1.6', '>=')) {
             $menu = JSite::getMenu();
             $item = $menu->getActive();
             if (is_object($item)) {
                 JRequest::setVar('cb_category_id', $item->params->get('cb_category_id', null));
                 if (JRequest::getVar('cb_controller') == 'edit') {
                     $this->_show_back_button = $item->params->get('show_back_button', null);
                 }
                 if ($item->params->get('cb_latest', null) !== null) {
                     $this->_latest = $item->params->get('cb_latest', null);
                 }
                 if ($item->params->get('show_page_heading', null) !== null) {
                     $this->_show_page_heading = $item->params->get('show_page_heading', null);
                 }
                 if ($item->params->get('page_title', null) !== null) {
                     $this->_page_title = $item->params->get('page_title', null);
                 }
                 if ($item->params->get('page_heading', null) !== null) {
                     $this->_page_heading = $item->params->get('page_heading', null);
                 }
             }
         } else {
             $params = JComponentHelper::getParams('com_contentbuilder');
             JRequest::setVar('cb_category_id', $params->get('cb_category_id', null));
             if (JRequest::getVar('cb_controller') == 'edit') {
                 $this->_show_back_button = $params->get('show_back_button', null);
             }
             if ($params->get('cb_latest', null)) {
                 $this->_latest = $params->get('cb_latest', null);
             }
             if ($params->get('show_page_heading', null) !== null) {
                 $this->_show_page_heading = $params->get('show_page_heading', null);
             }
             if ($params->get('page_title', null) !== null) {
                 $this->_page_title = $params->get('page_title', null);
             }
         }
     }
     $menu_filter = JRequest::getVar('cb_list_filterhidden', null);
     if ($menu_filter !== null) {
         $lines = explode("\n", $menu_filter);
         foreach ($lines as $line) {
             $keyval = explode("\t", $line);
             if (count($keyval) == 2) {
                 $keyval[1] = str_replace(array("\n", "\r"), "", $keyval[1]);
                 $keyval[1] = contentbuilder::execPhpValue($keyval[1]);
                 if ($keyval[1] != '') {
                     $this->_menu_filter[$keyval[0]] = explode('|', $keyval[1]);
                 }
             }
         }
     }
     $menu_filter_order = JRequest::getVar('cb_list_orderhidden', null);
     if ($menu_filter_order !== null) {
         $lines = explode("\n", $menu_filter_order);
         foreach ($lines as $line) {
             $keyval = explode("\t", $line);
             if (count($keyval) == 2) {
                 $keyval[1] = str_replace(array("\n", "\r"), "", $keyval[1]);
                 if ($keyval[1] != '') {
                     $this->_menu_filter_order[$keyval[0]] = intval($keyval[1]);
                 }
             }
         }
     }
     @natsort($this->_menu_filter_order);
     $this->setIds(JRequest::getInt('id', 0), JRequest::getCmd('record_id', ''));
     if (!$this->frontend) {
         JFactory::getLanguage()->load('com_content');
     } else {
         JFactory::getLanguage()->load('com_content', JPATH_SITE . DS . 'administrator');
         JFactory::getLanguage()->load('joomla', JPATH_SITE . DS . 'administrator');
     }
 }
예제 #9
0
 function __construct($config)
 {
     parent::__construct($config);
     $mainframe = JFactory::getApplication();
     $option = 'com_contentbuilder';
     $this->frontend = class_exists('cbFeMarker');
     if ($this->frontend) {
         JFactory::getDocument()->addStyleSheet(JURI::root(true) . '/components/com_contentbuilder/assets/css/system.css');
     }
     if (JRequest::getInt('Itemid', 0)) {
         $this->_menu_item = true;
     }
     $this->setId(JRequest::getInt('id', 0));
     // Get pagination request variables
     $limit = $mainframe->getUserStateFromRequest('global.list.limit', 'limit', JRequest::getInt('cb_list_limit', 0) > 0 ? JRequest::getInt('cb_list_limit', 0) : $mainframe->getCfg('list_limit'), 'int');
     $limitstart = JRequest::getVar('limitstart', 0, '', 'int');
     // In case limit has been changed, adjust it
     $limitstart = $limit != 0 ? floor($limitstart / $limit) * $limit : 0;
     $this->setState('limit', $limit);
     $this->setState('limitstart', $limitstart);
     if (JFactory::getSession()->get($option . 'formsd_id', 0) == 0 || JFactory::getSession()->get($option . 'formsd_id', 0) == $this->_id) {
         $filter_order = $mainframe->getUserStateFromRequest($option . 'formsd_filter_order', 'filter_order', '', 'cmd');
         $filter_order_Dir = $mainframe->getUserStateFromRequest($option . 'formsd_filter_order_Dir', 'filter_order_Dir', '', 'cmd');
         $filter = $mainframe->getUserStateFromRequest($option . 'formsd_filter', 'filter', '', 'string');
         $filter_state = $mainframe->getUserStateFromRequest($option . 'formsd_filter_state', 'list_state_filter', 0, 'int');
         $filter_publish = $mainframe->getUserStateFromRequest($option . 'formsd_filter_publish', 'list_publish_filter', -1, 'int');
         $filter_language = $mainframe->getUserStateFromRequest($option . 'formsd_filter_language', 'list_language_filter', '', 'cmd');
     } else {
         $mainframe->setUserState($option . 'formsd_filter_order', JRequest::getCmd('filter_order', ''));
         $mainframe->setUserState($option . 'formsd_filter_order_Dir', JRequest::getCmd('filter_order_Dir', ''));
         $mainframe->setUserState($option . 'formsd_filter', JRequest::getVar('filter', ''));
         $mainframe->setUserState($option . 'formsd_filter_state', JRequest::getInt('list_state_filter', 0));
         $mainframe->setUserState($option . 'formsd_filter_publish', JRequest::getInt('list_publish_filter', -1));
         $mainframe->setUserState($option . 'formsd_filter_language', JRequest::getCmd('list_language_filter', ''));
         $filter_order = JRequest::getCmd('filter_order', '');
         $filter_order_Dir = JRequest::getCmd('filter_order_Dir', '');
         $filter = JRequest::getVar('filter', '');
         $filter_state = JRequest::getInt('list_state_filter', 0);
         $filter_publish = JRequest::getInt('list_publish_filter', -1);
         $filter_language = JRequest::getCmd('list_language_filter', '');
     }
     $this->setState('formsd_filter_state', $filter_state);
     $this->setState('formsd_filter_publish', $filter_publish);
     $this->setState('formsd_filter_language', empty($filter_language) ? null : $filter_language);
     $this->setState('formsd_filter', $filter);
     $this->setState('formsd_filter_order', $filter_order);
     $this->setState('formsd_filter_order_Dir', $filter_order_Dir);
     if ($this->frontend && JRequest::getInt('Itemid', 0)) {
         // try menu item
         jimport('joomla.version');
         $version = new JVersion();
         if (version_compare($version->getShortVersion(), '1.6', '>=')) {
             $menu = JSite::getMenu();
             $item = $menu->getActive();
             if (is_object($item)) {
                 if ($item->params->get('show_page_heading', null) !== null) {
                     $this->_show_page_heading = $item->params->get('show_page_heading', null);
                 }
                 if ($item->params->get('page_title', null) !== null) {
                     $this->_page_title = $item->params->get('page_title', null);
                 }
                 if ($item->params->get('page_heading', null) !== null) {
                     $this->_page_heading = $item->params->get('page_heading', null);
                 }
                 if ($item->params->get('pageclass_sfx', null) !== null) {
                     $this->_page_class = $item->params->get('pageclass_sfx', null);
                 }
             }
         } else {
             $params = JComponentHelper::getParams($option);
             if ($params->get('show_page_heading', null) !== null) {
                 $this->_show_page_heading = $params->get('show_page_heading', null);
             }
             if ($params->get('pageclass_sfx', null) !== null) {
                 $this->_page_class = $params->get('pageclass_sfx', null);
             }
             if ($params->get('page_title', null) !== null) {
                 $this->_page_title = $params->get('page_title', null);
             }
         }
     }
     $menu_filter = JRequest::getVar('cb_list_filterhidden', null);
     if ($menu_filter !== null) {
         $lines = explode("\n", $menu_filter);
         foreach ($lines as $line) {
             $keyval = explode("\t", $line);
             if (count($keyval) == 2) {
                 $keyval[1] = str_replace(array("\n", "\r"), "", $keyval[1]);
                 $keyval[1] = contentbuilder::execPhpValue($keyval[1]);
                 if ($keyval[1] != '') {
                     $this->_menu_filter[$keyval[0]] = explode('|', $keyval[1]);
                 }
             }
         }
     }
     $menu_filter_order = JRequest::getVar('cb_list_orderhidden', null);
     if ($menu_filter_order !== null) {
         $lines = explode("\n", $menu_filter_order);
         foreach ($lines as $line) {
             $keyval = explode("\t", $line);
             if (count($keyval) == 2) {
                 $keyval[1] = str_replace(array("\n", "\r"), "", $keyval[1]);
                 if ($keyval[1] != '') {
                     $this->_menu_filter_order[$keyval[0]] = intval($keyval[1]);
                 }
             }
         }
     }
     @natsort($this->_menu_filter_order);
     JFactory::getSession()->set($option . 'formsd_id', $this->_id);
 }
예제 #10
0
 function __construct($config)
 {
     parent::__construct($config);
     $this->frontend = JFactory::getApplication()->isSite();
     $mainframe = JFactory::getApplication();
     $option = 'com_contentbuilder';
     $plugin = JRequest::getVar('plugin', '');
     $verification_name = JRequest::getVar('verification_name', '');
     $verification_id = JRequest::getVar('verification_id', '');
     $setup = '';
     $user_id = 0;
     if (!$verification_id) {
         $user_id = JFactory::getUser()->get('id', 0);
         $setup = JFactory::getSession()->get($plugin . $verification_name, '', 'com_contentbuilder.verify.' . $plugin . $verification_name);
     } else {
         $this->_db->setQuery("Select `setup`,`user_id` From #__contentbuilder_verifications Where `verification_hash` = " . $this->_db->Quote($verification_id));
         $setup = $this->_db->loadAssoc();
         if (is_array($setup)) {
             $user_id = $setup['user_id'];
             $setup = $setup['setup'];
         }
     }
     $out = array();
     if ($setup) {
         parse_str($setup, $out);
     }
     if (isset($out['plugin']) && $out['plugin'] && isset($out['verification_name']) && $out['verification_name'] && isset($out['verify_view']) && $out['verify_view']) {
         // alright
     } else {
         JFactory::getApplication()->redirect('index.php', 'Spoofed data or invalid verification id', 'error');
     }
     if (isset($out['plugin_options'])) {
         $options = base64_decode($out['plugin_options']);
         parse_str($options, $opts);
         $out['plugin_options'] = $opts;
         if (!count($out['plugin_options'])) {
             $out['plugin_options'] = array();
         }
     } else {
         $out['plugin_options'] = array();
     }
     $_now = JFactory::getDate();
     //$this->_db->setQuery("Select count(id) From #__contentbuilder_verifications Where Timestampdiff(Second, `start_date`, '".strtotime($_now->toMySQL())."') < 1 And ip = " . $this->_db->Quote($_SERVER['REMOTE_ADDR']));
     //$ver = $this->_db->loadResult();
     //if($ver >= 5){
     //    $this->_db->setQuery("Delete From #__contentbuilder_verifications Where `verification_date` = '0000-00-00 00:00:00' And ip = " . $this->_db->Quote($_SERVER['REMOTE_ADDR']));
     //    $this->_db->query();
     //    JError::raiseError(500, 'Penetration Denied');
     //}
     //$this->_db->setQuery("Delete From #__contentbuilder_verifications Where Timestampdiff(Second, `start_date`, '".strtotime($_now->toMySQL())."') > 86400 And `verification_date` = '0000-00-00 00:00:00'");
     //$this->_db->query();
     $rec = null;
     $redirect_view = '';
     if (isset($out['require_view']) && is_numeric($out['require_view']) && intval($out['require_view']) > 0) {
         if (JFactory::getSession()->get('cb_last_record_user_id', 0, 'com_contentbuilder')) {
             $user_id = JFactory::getSession()->get('cb_last_record_user_id', 0, 'com_contentbuilder');
             JFactory::getSession()->clear('cb_last_record_user_id', 'com_contentbuilder');
         }
         $id = intval($out['require_view']);
         $this->_db->setQuery("Select `type`, `reference_id`, `show_all_languages_fe` From #__contentbuilder_forms Where published = 1 And id = " . $id);
         $formsettings = $this->_db->loadAssoc();
         if (!is_array($formsettings)) {
             JError::raiseError(500, 'Verification Setup failed. Reason: View id ' . $out['require_view'] . ' has been requested but is not available (not existent or unpublished). Please update your content template or publish the view.');
         }
         $form = contentbuilder::getForm($formsettings['type'], $formsettings['reference_id']);
         $labels = $form->getElementLabels();
         $ids = array();
         foreach ($labels as $reference_id => $label) {
             $ids[] = $reference_id;
         }
         if (intval($user_id) == 0) {
             JFactory::getApplication()->redirect('index.php?option=com_contentbuilder&lang=' . JRequest::getCmd('lang', '') . '&return=' . base64_encode(JURI::getInstance()->toString()) . '&controller=edit&record_id=&id=' . $id . '&rand=' . rand(0, getrandmax()));
         }
         $rec = $form->getListRecords($ids, '', array(), 0, 1, '', array(), 'desc', 0, false, $user_id, 0, -1, -1, -1, -1, array(), true, null);
         if (count($rec) > 0) {
             $rec = $rec[0];
             $rec = $form->getRecord($rec->colRecord, false, -1, true);
         }
         if (!$form->getListRecordsTotal($ids)) {
             JFactory::getApplication()->redirect('index.php?option=com_contentbuilder&lang=' . JRequest::getCmd('lang', '') . '&return=' . base64_encode(JURI::getInstance()->toString()) . '&controller=edit&record_id=&id=' . $id . '&rand=' . rand(0, getrandmax()));
         }
     }
     // clearing session after possible required view to make re-visits possible
     JFactory::getSession()->clear($plugin . $verification_name, 'com_contentbuilder.verify.' . $plugin . $verification_name);
     $verification_data = '';
     if (is_array($rec) && count($rec)) {
         foreach ($rec as $value) {
             $verification_data .= urlencode(str_replace(array("\r", "\n"), '', $value->recTitle)) . "=" . urlencode(str_replace(array("\r", "\n"), '', $value->recValue)) . "&";
         }
         $verification_data = rtrim($verification_data, '&');
     }
     if (!JRequest::getBool('verify', 0) && !JRequest::getVar('token', '')) {
         jimport('joomla.version');
         $version = new JVersion();
         if (version_compare($version->getShortVersion(), '3.0', '>=')) {
             $___now = $_now->toSql();
         } else {
             $___now = $_now->toMySQL();
         }
         $verification_id = md5(uniqid(null, true) . mt_rand(0, mt_getrandmax()) . $user_id);
         $this->_db->setQuery("\n                    Insert Into #__contentbuilder_verifications\n                    (\n                    `verification_hash`,\n                    `start_date`,\n                    `verification_data`,\n                    `user_id`,\n                    `plugin`,\n                    `ip`,\n                    `setup`,\n                    `client`\n                    )\n                    Values\n                    (\n                    " . $this->_db->Quote($verification_id) . ",\n                    " . $this->_db->Quote($___now) . ",\n                    " . $this->_db->Quote('type=normal&' . $verification_data) . ",\n                    " . $user_id . ",\n                    " . $this->_db->Quote($plugin) . ",\n                    " . $this->_db->Quote($_SERVER['REMOTE_ADDR']) . ",\n                    " . $this->_db->Quote($setup) . ",\n                    " . intval($out['client']) . "\n                    )\n            ");
         $this->_db->query();
     }
     /*
     if(intval($out['client']) && !JFactory::getApplication()->isAdmin()){
        parse_str(JURI::getInstance()->getQuery(), $data1);
        $this_page = JURI::getInstance()->base() . 'administrator/index.php?'.http_build_query($data1, '', '&');
             }else{
        parse_str(JURI::getInstance()->getQuery(), $data1);
        $urlex = explode('?', JURI::getInstance()->toString());
        $this_page = $urlex[0] . '?' . http_build_query($data1, '', '&');
             }
     */
     if (intval($out['client']) && !JFactory::getApplication()->isAdmin()) {
         $this_page = JURI::getInstance()->base() . 'administrator/index.php?' . JURI::getInstance()->getQuery();
     } else {
         $this_page = JURI::getInstance()->toString();
     }
     JPluginHelper::importPlugin('contentbuilder_verify', $plugin);
     $dispatcher = JDispatcher::getInstance();
     $setup_result = $dispatcher->trigger('onSetup', array($this_page, $out));
     if (!implode('', $setup_result)) {
         if (!JRequest::getBool('verify', 0)) {
             if (JFactory::getApplication()->isAdmin()) {
                 $local = explode('/', JURI::getInstance()->base());
                 unset($local[count($local) - 1]);
                 unset($local[count($local) - 1]);
                 parse_str(JURI::getInstance()->getQuery(), $data);
                 $this_page = implode('/', $local) . '/index.php?' . http_build_query($data, '', '&') . '&verify=1&verification_id=' . $verification_id;
             } else {
                 parse_str(JURI::getInstance()->getQuery(), $data);
                 $urlex = explode('?', JURI::getInstance()->toString());
                 $this_page = $urlex[0] . '?' . http_build_query($data, '', '&') . '&verify=1&verification_id=' . $verification_id;
             }
             $forward_result = $dispatcher->trigger('onForward', array($this_page, $out));
             $forward = implode('', $forward_result);
             if ($forward) {
                 JFactory::getApplication()->redirect($forward);
             }
         } else {
             if ($verification_id) {
                 $msg = '';
                 $verify_result = $dispatcher->trigger('onVerify', array($this_page, $out));
                 if (count($verify_result)) {
                     if ($verify_result[0] === false) {
                         $msg = JText::_('COM_CONTENTBUILDER_VERIFICATION_FAILED');
                     } else {
                         if (isset($verify_result[0]['msg']) && $verify_result[0]['msg']) {
                             $msg = $verify_result[0]['msg'];
                         } else {
                             if (isset($out['verification_msg']) && $out['verification_msg']) {
                                 $msg = urldecode($out['verification_msg']);
                             } else {
                                 $msg = JText::_('COM_CONTENTBUILDER_VERIFICATION_SUCCESS');
                             }
                         }
                         if (!$out['client'] && (!isset($out['return-site']) || !$out['return-site']) || $out['client'] && (!isset($out['return-admin']) || !$out['return-admin'])) {
                             if (intval($out['client']) && !JFactory::getApplication()->isAdmin()) {
                                 $redirect_view = JURI::getInstance()->base() . 'administrator/index.php?option=com_contentbuilder&controller=list&lang=' . JRequest::getCmd('lang', '') . '&id=' . $out['verify_view'];
                             } else {
                                 $redirect_view = 'index.php?option=com_contentbuilder&controller=list&lang=' . JRequest::getCmd('lang', '') . '&id=' . $out['verify_view'];
                             }
                         }
                         $this->_db->setQuery("Select id From #__contentbuilder_users Where userid = " . $this->_db->Quote($user_id) . " And form_id = " . intval($out['verify_view']));
                         $usertableid = $this->_db->loadResult();
                         $levels = explode(',', $out['verify_levels']);
                         jimport('joomla.version');
                         $version = new JVersion();
                         if (version_compare($version->getShortVersion(), '3.0', '>=')) {
                             $___now = $_now->toSql();
                         } else {
                             $___now = $_now->toMySQL();
                         }
                         if ($usertableid) {
                             $this->_db->setQuery("Update #__contentbuilder_users\n                                Set\n                                " . (in_array('view', $levels) ? ' verified_view=1, verification_date_view=' . $this->_db->Quote($___now) . ", " : '') . "\n                                " . (in_array('new', $levels) ? ' verified_new=1, verification_date_new=' . $this->_db->Quote($___now) . ", " : '') . "\n                                " . (in_array('edit', $levels) ? ' verified_edit=1, verification_date_edit=' . $this->_db->Quote($___now) . ", " : '') . "\n                                published = 1\n                                Where id = {$usertableid}\n                                ");
                             $this->_db->query();
                         } else {
                             $this->_db->setQuery("\n                                Insert Into #__contentbuilder_users\n                                (\n                                " . (in_array('view', $levels) ? 'verified_view, verification_date_view,' : '') . "\n                                " . (in_array('new', $levels) ? 'verified_new, verification_date_new,' : '') . "\n                                " . (in_array('edit', $levels) ? 'verified_edit, verification_date_edit,' : '') . "\n                                published,\n                                userid,\n                                form_id\n                                )\n                                Values\n                                (\n                                " . (in_array('view', $levels) ? '1, ' . $this->_db->Quote($___now) . ',' : '') . "\n                                " . (in_array('new', $levels) ? '1, ' . $this->_db->Quote($___now) . ',' : '') . "\n                                " . (in_array('edit', $levels) ? '1, ' . $this->_db->Quote($___now) . ',' : '') . "\n                                1,\n                                " . $this->_db->Quote($user_id) . ",\n                                " . intval($out['verify_view']) . "\n                                )\n                                ");
                             $this->_db->query();
                         }
                         $verification_data = ($verification_data ? '&' : '') . '';
                         if (isset($verify_result[0]['data']) && is_array($verify_result[0]['data']) && count($verify_result[0]['data'])) {
                             foreach ($verify_result[0]['data'] as $key => $value) {
                                 $verification_data .= urlencode(str_replace(array("\r", "\n"), '', $key)) . "=" . urlencode(str_replace(array("\r", "\n"), '', $value)) . "&";
                             }
                             $verification_data = rtrim($verification_data, '&');
                         }
                         $this->_db->setQuery("\n                                Update #__contentbuilder_verifications\n                                Set\n                                `verification_hash` = '',\n                                `is_test` = " . (isset($verify_result[0]['is_test']) ? intval(isset($verify_result[0]['is_test'])) : 0) . ",\n                                `verification_date` = " . $this->_db->Quote($___now) . " \n                                " . ($verification_data ? ',verification_data = concat(verification_data, ' . $this->_db->Quote($verification_data) . ') ' : '') . "\n                                Where\n                                verification_hash = " . $this->_db->Quote($verification_id) . "\n                                And\n                                verification_hash <> ''\n                                And\n                                `verification_date` = '0000-00-00 00:00:00'\n                                \n                            ");
                         $this->_db->query();
                         // token check if given
                         if (JRequest::getVar('token', '')) {
                             jimport('joomla.version');
                             $version = new JVersion();
                             if (version_compare($version->getShortVersion(), '1.6', '>=')) {
                                 $this->activate(JRequest::getVar('token', ''));
                             } else {
                                 $this->activate15(JRequest::getVar('token', ''));
                             }
                         }
                         // exit if requested
                         if (count($verify_result) && isset($verify_result[0]['exit']) && $verify_result[0]['exit']) {
                             @ob_end_clean();
                             if (isset($verify_result[0]['header']) && $verify_result[0]['header']) {
                                 header($verify_result[0]['header']);
                             }
                             exit;
                         }
                     }
                 }
             } else {
                 $msg = JText::_('COM_CONTENTBUILDER_VERIFICATION_NOT_EXECUTED');
             }
             if (!$out['client']) {
                 JFactory::getApplication()->redirect($redirect_view ? $redirect_view : (!$out['client'] && isset($out['return-site']) && $out['return-site'] ? base64_decode($out['return-site']) : 'index.php'), $msg);
             } else {
                 JFactory::getApplication()->redirect($redirect_view ? $redirect_view : ($out['client'] && isset($out['return-admin']) && $out['return-admin'] ? base64_decode($out['return-admin']) : 'index.php'), $msg);
             }
         }
     } else {
         JError::raiseError(500, 'Verification Setup failed. Reason: ' . implode('', $setup_result));
     }
 }
예제 #11
0
 function __construct($config)
 {
     parent::__construct();
     $this->setIds(JRequest::getInt('joomla_userid', 0), JRequest::getInt('form_id', ''));
 }