/** * Controler for the Control Panel * @param array configuration */ function __construct($config = array()) { parent::__construct($config); if (!JEVHelper::isAdminUser()) { JFactory::getApplication()->redirect("index.php?option=" . JEV_COM_COMPONENT . "&task=cpanel.cpanel", "Not Authorised - must be admin"); return; } $this->registerTask('list', 'overview'); $this->registerTask('new', 'edit'); $this->registerDefaultTask("overview"); // Make sure DB is up to date $db = JFactory::getDBO(); $db->setQuery("SELECT * FROM #__jev_defaults"); $defaults = $db->loadObjectList("name"); if (!isset($defaults['icalevent.detail_body'])) { $db->setQuery("INSERT INTO #__jev_defaults set name='icalevent.detail_body',\n\t\t\t\t\t\ttitle=" . $db->Quote(JText::_("JEV_EVENT_DETAIL_PAGE")) . ",\n\t\t\t\t\t\tsubject='',\n\t\t\t\t\t\tvalue='',\n\t\t\t\t\t\tstate=0"); $db->query(); } else { $db->setQuery("UPDATE #__jev_defaults set title=" . $db->Quote(JText::_("JEV_EVENT_DETAIL_PAGE")) . " WHERE name='icalevent.detail_body'"); $db->query(); } if (!isset($defaults['icalevent.list_row'])) { $db->setQuery("INSERT INTO #__jev_defaults set name='icalevent.list_row',\n\t\t\t\t\t\ttitle=" . $db->Quote(JText::_("JEV_EVENT_LIST_ROW")) . ",\n\t\t\t\t\t\tsubject='',\n\t\t\t\t\t\tvalue='',\n\t\t\t\t\t\tstate=0"); $db->query(); } else { $db->setQuery("UPDATE #__jev_defaults set title=" . $db->Quote(JText::_("JEV_EVENT_LIST_ROW")) . " WHERE name='icalevent.list_row'"); $db->query(); } if (!isset($defaults['month.calendar_cell'])) { $db->setQuery("INSERT INTO #__jev_defaults set name='month.calendar_cell',\n\t\t\t\t\t\ttitle=" . $db->Quote(JText::_("JEV_EVENT_MONTH_CALENDAR_CELL")) . ",\n\t\t\t\t\t\tsubject='',\n\t\t\t\t\t\tvalue='',\n\t\t\t\t\t\tstate=0"); $db->query(); } else { $db->setQuery("UPDATE #__jev_defaults set title=" . $db->Quote(JText::_("JEV_EVENT_MONTH_CALENDAR_CELL")) . " WHERE name='month.calendar_cell'"); $db->query(); } if (!isset($defaults['month.calendar_tip'])) { $db->setQuery("INSERT INTO #__jev_defaults set name='month.calendar_tip',\n\t\t\t\t\t\ttitle=" . $db->Quote(JText::_("JEV_EVENT_MONTH_CALENDAR_TIP")) . ",\n\t\t\t\t\t\tsubject='',\n\t\t\t\t\t\tvalue='',\n\t\t\t\t\t\tstate=0"); $db->query(); } else { $db->setQuery("UPDATE #__jev_defaults set title=" . $db->Quote(JText::_("JEV_EVENT_MONTH_CALENDAR_TIP")) . " WHERE name='month.calendar_tip'"); $db->query(); } /* * Edit Page config must wait for plugins to be updated! if (!isset($defaults['icalevent.edit_page'])){ $db->setQuery("INSERT INTO #__jev_defaults set name='icalevent.edit_page', title=".$db->Quote(JText::_("JEV_EVENT_EDIT_PAGE")).", subject='', value='', state=0"); $db->query(); } else { $db->setQuery("UPDATE #__jev_defaults set title=".$db->Quote(JText::_("JEV_EVENT_EDIT_PAGE"))." WHERE name='icalevent.edit_page'"); $db->query(); } */ }
/** * Custom Constructor */ function __construct($default = array()) { $user = JFactory::getUser(); if (!JEVHelper::isAdminUser()) { JFactory::getApplication()->redirect("index.php?option=" . JEV_COM_COMPONENT . "&task=cpanel.cpanel", "Not Authorised - must be admin"); return; } $default['default_task'] = 'edit'; parent::__construct($default); $this->registerTask('apply', 'save'); }
/** * Configure the Linkbar. * * @param string The name of the active view. */ public static function addSubmenu($vName = "") { $task = JRequest::getCmd("task", "cpanel.cpanel"); $option = JRequest::getCmd("option", "com_categories"); if ($option == 'com_categories') { $doc = JFactory::getDocument(); if (!JevJoomlaVersion::isCompatible("3.0")) { $hide_options = '#toolbar-popup-options {' . 'display:none;' . '}'; } else { $hide_options = '#toolbar-options {' . 'display:none;' . '}'; } $doc->addStyleDeclaration($hide_options); } if ($vName == "") { $vName = $task; } // could be called from categories component JLoader::register('JEVHelper', JPATH_SITE . "/components/com_jevents/libraries/helper.php"); if (JevJoomlaVersion::isCompatible("3.0")) { JHtmlSidebar::addEntry(JText::_('CONTROL_PANEL'), 'index.php?option=com_jevents', $vName == 'cpanel.cpanel'); JHtmlSidebar::addEntry(JText::_('JEV_ADMIN_ICAL_EVENTS'), 'index.php?option=com_jevents&task=icalevent.list', $vName == 'icalevent.list'); if (JEVHelper::isAdminUser()) { JHtmlSidebar::addEntry(JText::_('JEV_ADMIN_ICAL_SUBSCRIPTIONS'), 'index.php?option=com_jevents&task=icals.list', $vName == 'icals.list'); } JHtmlSidebar::addEntry(JText::_('JEV_INSTAL_CATS'), "index.php?option=com_categories&extension=com_jevents", $vName == 'categories'); if (JEVHelper::isAdminUser()) { JHtmlSidebar::addEntry(JText::_('JEV_MANAGE_USERS'), 'index.php?option=com_jevents&task=user.list', $vName == 'user.list'); JHtmlSidebar::addEntry(JText::_('JEV_INSTAL_CONFIG'), 'index.php?option=com_jevents&task=params.edit', $vName == 'params.edit'); JHtmlSidebar::addEntry(JText::_('JEV_LAYOUT_DEFAULTS'), 'index.php?option=com_jevents&task=defaults.list', in_array($vName, array('defaults.list', 'defaults.overview'))); //Support & CSS Customs should only be for Admins really. JHtmlSidebar::addEntry(JText::_('SUPPORT_INFO'), 'index.php?option=com_jevents&task=cpanel.support', $vName == 'cpanel.support'); JHtmlSidebar::addEntry(JText::_('JEV_CUSTOM_CSS'), 'index.php?option=com_jevents&task=cpanel.custom_css', $vName == 'cpanel.custom_css'); } } else { JSubMenuHelper::addEntry(JText::_('CONTROL_PANEL'), 'index.php?option=com_jevents', $vName == 'cpanel.cpanel'); JSubMenuHelper::addEntry(JText::_('JEV_ADMIN_ICAL_EVENTS'), 'index.php?option=com_jevents&task=icalevent.list', $vName == 'icalevent.list'); if (JEVHelper::isAdminUser()) { JSubMenuHelper::addEntry(JText::_('JEV_ADMIN_ICAL_SUBSCRIPTIONS'), 'index.php?option=com_jevents&task=icals.list', $vName == 'icals.list'); } JSubMenuHelper::addEntry(JText::_('JEV_INSTAL_CATS'), "index.php?option=com_categories&extension=com_jevents", $vName == 'categories'); if (JEVHelper::isAdminUser()) { JSubMenuHelper::addEntry(JText::_('JEV_MANAGE_USERS'), 'index.php?option=com_jevents&task=user.list', $vName == 'user.list'); JSubMenuHelper::addEntry(JText::_('JEV_INSTAL_CONFIG'), 'index.php?option=com_jevents&task=params.edit', $vName == 'params.edit'); JSubMenuHelper::addEntry(JText::_('JEV_LAYOUT_DEFAULTS'), 'index.php?option=com_jevents&task=defaults.list', in_array($vName, array('defaults.list', 'defaults.overview'))); //Support & CSS customs should only be for Admins really. JSubMenuHelper::addEntry(JText::_('SUPPORT_INFO'), 'index.php?option=com_jevents&task=cpanel.support', $vName == 'cpanel.support'); JSubMenuHelper::addEntry(JText::_('JEV_CUSTOM_CSS'), 'index.php?option=com_jevents&task=cpanel.custom_css', $vName == 'cpanel.custom_css'); } } }
function listevents() { $is_event_editor = JEVHelper::isEventCreator(); $Itemid = JEVHelper::getItemid(); $user = JFactory::getUser(); if (!$is_event_editor) { $returnlink = JRoute::_('index.php?option=' . JEV_COM_COMPONENT . '&task=month.calendar&Itemid=' . $Itemid, false); $this->setRedirect($returnlink, html_entity_decode(JText::_('JEV_NOPERMISSION'))); $this->redirect(); return; } list($year, $month, $day) = JEVHelper::getYMD(); // Joomla unhelpfully switched limitstart to start when sef is enabled! includes/router.php line 390 $limitstart = intval(JRequest::getVar('start', JRequest::getVar('limitstart', 0))); $params = JComponentHelper::getParams(JEV_COM_COMPONENT); $limit = intval(JFactory::getApplication()->getUserStateFromRequest('jevlistlimit', 'limit', $params->get("com_calEventListRowsPpg", 15))); $Itemid = JEVHelper::getItemid(); $task = $this->_task; $params = JComponentHelper::getParams(JEV_COM_COMPONENT); $adminuser = $params->get("jevadmin", -1); if (JEVHelper::isAdminUser($user) || $user->id == $adminuser) { $creator_id = 'ADMIN'; } else { $creator_id = $user->id; } // get the view $document = JFactory::getDocument(); $viewType = $document->getType(); $cfg = JEVConfig::getInstance(); $theme = JEV_CommonFunctions::getJEventsViewName(); $view = "admin"; $this->addViewPath($this->_basePath . '/' . "views" . '/' . $theme); $this->view = $this->getView($view, $viewType, $theme . "View", array('base_path' => $this->_basePath, "template_path" => $this->_basePath . '/' . "views" . '/' . $theme . '/' . $view . '/' . 'tmpl', "name" => $theme . '/' . $view)); // Set the layout $this->view->setLayout('listevents'); $this->view->assign("Itemid", $Itemid); $this->view->assign("limitstart", $limitstart); $this->view->assign("limit", $limit); $this->view->assign("month", $month); $this->view->assign("day", $day); $this->view->assign("year", $year); $this->view->assign("task", $task); $this->view->assign("creator_id", $creator_id); $this->view->display(); }
public function renderVersionsForClipboard() { if (!JEVHelper::isAdminUser()) { return; } jimport("joomla.filesystem.folder"); $apps = array(); // Joomla $app = new stdClass(); $app->name = "Joomla"; $version = new JVersion(); $app->version = $version->getShortVersion(); $apps[$app->name] = $app; // TODO : Can we do this from the database??? // components (including JEvents) $xmlfiles3 = array_merge(JFolder::files(JPATH_ADMINISTRATOR . "/components", "manifest\\.xml", true, true), JFolder::files(JPATH_ADMINISTRATOR . "/components", "sh404sef\\.xml", true, true), JFolder::files(JPATH_ADMINISTRATOR . "/components", "virtuemart\\.xml", true, true), JFolder::files(JPATH_ADMINISTRATOR . "/components", "jce\\.xml", true, true), JFolder::files(JPATH_ADMINISTRATOR . "/components", "jmailalerts\\.xml", true, true), JFolder::files(JPATH_ADMINISTRATOR . "/components", "hikashop\\.xml", true, true), JFolder::files(JPATH_ADMINISTRATOR . "/components", "jev_latestevents\\.xml", true, true)); foreach ($xmlfiles3 as $manifest) { if (!($manifestdata = $this->getValidManifestFile($manifest))) { continue; } $app = new stdClass(); $app->name = $manifestdata["name"]; $app->version = $manifestdata["version"]; // is sh404sef disabled ? if (basename(dirname($manifest)) == "com_sh404sef") { if (is_callable("Sh404sefFactory::getConfig")) { $sefConfig = Sh404sefFactory::getConfig(); if (!$sefConfig->Enabled) { $app->version = $manifestdata["version"] . " (Disabled in SH404 settings)"; } } else { $app->version = $manifestdata["version"] . " (sh404sef system plugins not enabled)"; } } $name = "component_" . basename(dirname($manifest)); $apps[$name] = $app; } // modules if (JFolder::exists(JPATH_SITE . "/modules")) { $xmlfiles4 = JFolder::files(JPATH_SITE . "/modules", "\\.xml", true, true); } else { $xmlfiles4 = array(); } foreach ($xmlfiles4 as $manifest) { if (strpos($manifest, "mod_") === false) { continue; } if (!($manifestdata = $this->getValidManifestFile($manifest))) { continue; } $app = new stdClass(); $app->name = $manifestdata["name"]; $app->version = $manifestdata["version"]; $app->criticalversion = ""; $name = "module_" . str_replace(".xml", "", basename($manifest)); $apps[$name] = $app; } // club layouts $xmlfiles1 = JFolder::files(JEV_PATH . "views", "manifest\\.xml", true, true); foreach ($xmlfiles1 as $manifest) { if (realpath($manifest) != $manifest) { continue; } if (!($manifestdata = $this->getValidManifestFile($manifest))) { continue; } $app = new stdClass(); $app->name = $manifestdata["name"]; $app->version = $manifestdata["version"]; $apps["layout_" . basename(dirname($manifest))] = $app; } $xmlfiles1 = JFolder::files(JPATH_ADMINISTRATOR . "/manifests/files", "\\.xml", true, true); foreach ($xmlfiles1 as $manifest) { if (realpath($manifest) != $manifest) { continue; } if (!($manifestdata = $this->getValidManifestFile($manifest))) { continue; } $app = new stdClass(); $app->name = $manifestdata["name"]; $app->version = $manifestdata["version"]; $apps[str_replace(".xml", "", "layout_" . basename($manifest))] = $app; } // plugins if (JFolder::exists(JPATH_SITE . "/plugins")) { $xmlfiles2 = JFolder::files(JPATH_SITE . "/plugins", "\\.xml", true, true); } else { $xmlfiles2 = array(); } foreach ($xmlfiles2 as $manifest) { if (strpos($manifest, "Zend") > 0) { continue; } if (!($manifestdata = $this->getValidManifestFile($manifest))) { continue; } $app = new stdClass(); $app->name = $manifestdata["name"]; $app->version = $manifestdata["version"]; $name = str_replace(".xml", "", basename($manifest)); $group = basename(dirname(dirname($manifest))); $plugin = JPluginHelper::getPlugin($group, $name); if (!$plugin) { $app->version .= " (not enabled)"; } $name = "plugin_" . $group . "_" . $name; $apps[$name] = $app; } $output = "<textarea rows='40' cols='80' class='versionsinfo'>[code]\n"; $output .= "PHP Version : " . phpversion() . "\n"; $output .= "MySQL Version : " . JFactory::getDbo()->getVersion() . "\n"; $output .= "Server Information : " . php_uname() . "\n"; $params = JComponentHelper::getParams(JEV_COM_COMPONENT); if ($params->get("fixjquery", -1) == -1) { $output .= "*** CONFIG NOT SAVED*** \n"; } $output .= "Fix jQuery? : " . ($params->get("fixjquery", 1) ? "Yes" : "No") . "\n"; $output .= "Load JEvents Bootstrap CSS? : " . ($params->get("bootstrapcss", 1) ? "Yes" : "No") . "\n"; $output .= "Load JEvents Bootstrap JS? : " . ($params->get("bootstrapjs", 1) ? "Yes" : "No") . "\n"; if (ini_get("max_input_vars") > 0 && ini_get("max_input_vars") <= 10000) { $output .= "Max Input Vars ? : " . ini_get("max_input_vars") . "\n"; } $output .= "Club code set? : " . ($params->get("clubcode", false) ? "Yes" : "No") . " \n"; $server = new JInput($_SERVER); $useragent = $server->get('HTTP_USER_AGENT', false, "string"); $output .= $useragent ? "User Agent : " . $useragent . " \n" : ""; foreach ($apps as $appname => $app) { $output .= "{$appname} : {$app->version}\n"; } $output .= "[/code]</textarea>"; return $output; }
public static function getAid($user = null, $type = 'string') { if (is_null($user) || !$user) { $user = JFactory::getUser(); } $root = $user->get("isRoot"); if ($root) { static $rootlevels = false; if (!$rootlevels) { // Get a database object. $db = JFactory::getDBO(); // Build the base query. $query = $db->getQuery(true); $query->select('id, rules'); $query->from($query->qn('#__viewlevels')); // Set the query for execution. $db->setQuery((string) $query); $rootlevels = $db->loadColumn(); JArrayHelper::toInteger($rootlevels); } $levels = $rootlevels; } else { $levels = $user->getAuthorisedViewLevels(); if (JEVHelper::isAdminUser($user) && JFactory::getApplication()->isAdmin()) { // Make sure admin users can see public events $levels = array_merge($levels, JAccess::getAuthorisedViewLevels(0)); } } if ($type == 'string') { return implode(',', $levels); } elseif ($type == 'array') { return $levels; } elseif ($type = 'max') { return max($levels); } else { // not sure! return false; // ?? } }
public function renderVersionsForClipboard() { if (!JEVHelper::isAdminUser()) { return; } jimport("joomla.filesystem.folder"); $apps = array(); // Joomla $app = new stdClass(); $app->name = "Joomla"; $version = new JVersion(); $app->version = $version->getShortVersion(); $apps[$app->name] = $app; // components (including JEvents) $xmlfiles3 = array_merge(JFolder::files(JPATH_ADMINISTRATOR . "/components", "manifest\\.xml", true, true), JFolder::files(JPATH_ADMINISTRATOR . "/components", "sh404sef\\.xml", true, true), JFolder::files(JPATH_ADMINISTRATOR . "/components", "virtuemart\\.xml", true, true), JFolder::files(JPATH_ADMINISTRATOR . "/components", "jce\\.xml", true, true), JFolder::files(JPATH_ADMINISTRATOR . "/components", "jmailalerts\\.xml", true, true), JFolder::files(JPATH_ADMINISTRATOR . "/components", "hikashop\\.xml", true, true), JFolder::files(JPATH_ADMINISTRATOR . "/components", "jev_latestevents\\.xml", true, true)); foreach ($xmlfiles3 as $manifest) { if (!($manifestdata = $this->getValidManifestFile($manifest))) { continue; } $app = new stdClass(); $app->name = $manifestdata["name"]; $app->version = $manifestdata["version"]; // is sh404sef disabled ? if (basename(dirname($manifest)) == "com_sh404sef") { if (is_callable("Sh404sefFactory::getConfig")) { $sefConfig = Sh404sefFactory::getConfig(); if (!$sefConfig->Enabled) { $app->version = $manifestdata["version"] . " (Disabled in SH404 settings)"; } } else { $app->version = $manifestdata["version"] . " (sh404sef system plugins not enabled)"; } } $name = "component_" . basename(dirname($manifest)); $apps[$name] = $app; } // modules if (JFolder::exists(JPATH_SITE . "/modules")) { $xmlfiles4 = JFolder::files(JPATH_SITE . "/modules", "\\.xml", true, true); } else { $xmlfiles4 = array(); } foreach ($xmlfiles4 as $manifest) { if (strpos($manifest, "mod_") === false) { continue; } if (!($manifestdata = $this->getValidManifestFile($manifest))) { continue; } $app = new stdClass(); $app->name = $manifestdata["name"]; $app->version = $manifestdata["version"]; $app->criticalversion = ""; $name = "module_" . str_replace(".xml", "", basename($manifest)); $apps[$name] = $app; } // club layouts $xmlfiles1 = JFolder::files(JEV_PATH . "views", "manifest\\.xml", true, true); foreach ($xmlfiles1 as $manifest) { if (realpath($manifest) != $manifest) { continue; } if (!($manifestdata = $this->getValidManifestFile($manifest))) { continue; } $app = new stdClass(); $app->name = $manifestdata["name"]; $app->version = $manifestdata["version"]; $apps["layout_" . basename(dirname($manifest))] = $app; } $xmlfiles1 = JFolder::files(JPATH_ADMINISTRATOR . "/manifests/files", "\\.xml", true, true); foreach ($xmlfiles1 as $manifest) { if (realpath($manifest) != $manifest) { continue; } if (!($manifestdata = $this->getValidManifestFile($manifest))) { continue; } $app = new stdClass(); $app->name = $manifestdata["name"]; $app->version = $manifestdata["version"]; $apps[str_replace(".xml", "", "layout_" . basename($manifest))] = $app; } // plugins if (JFolder::exists(JPATH_SITE . "/plugins")) { $xmlfiles2 = JFolder::files(JPATH_SITE . "/plugins", "\\.xml", true, true); } else { $xmlfiles2 = array(); } foreach ($xmlfiles2 as $manifest) { if (strpos($manifest, "Zend") > 0) { continue; } if (!($manifestdata = $this->getValidManifestFile($manifest))) { continue; } $app = new stdClass(); $app->name = $manifestdata["name"]; $app->version = $manifestdata["version"]; $name = str_replace(".xml", "", basename($manifest)); $group = basename(dirname(dirname($manifest))); $plugin = JPluginHelper::getPlugin($group, $name); if (!$plugin) { $app->version .= " (not enabled)"; } $name = "plugin_" . $group . "_" . $name; $apps[$name] = $app; } $output = "<textarea rows='40' cols='80' class='versionsinfo'>[code]\n"; $output .= "PHP Version : " . phpversion() . "\n"; $output .= "MySQL Version : " . JFactory::getDbo()->getVersion() . "\n"; foreach ($apps as $appname => $app) { $output .= "{$appname} : {$app->version}\n"; } $output .= "[/code]</textarea>"; return $output; }
function renderVersionStatusReport(&$needsupdate) { if (JEVHelper::isAdminUser()) { // get RSS parsed object $options = array(); $rssUrl = 'http://www.jevents.net/versions.xml'; $cache_time = 86400; //$rssUrl = 'http://ubu.jev20j16.com/versions.xml'; //$cache_time = 1; jimport('simplepie.simplepie'); if (JVersion::isCompatible("1.6")) { $cache = JFactory::getCache('feed_parser', 'callback'); $cache->setLifeTime($cache_time); $rssDoc = new SimplePie(null, null, 0); $rssDoc->enable_cache(false); $rssDoc->set_feed_url($rssUrl); $rssDoc->force_feed(true); $rssDoc->set_item_limit(999); $results = $cache->get(array($rssDoc, 'init'), null, false, false); } else { $rssDoc = new SimplePie($rssUrl, JPATH_BASE . DS . 'cache', $cache_time); $rssDoc->force_feed(true); $rssDoc->handle_content_type(); $results = $rssDoc->init(); } if ($results == false) { return false; } else { $this->generateVersionsFile($rssDoc); $rows = array(); $items = $rssDoc->get_items(); foreach ($items as $item) { $apps = array(); if (strpos($item->get_title(), "layout_") === 0) { $layout = str_replace("layout_", "", $item->get_title()); if (JFolder::exists(JEV_PATH . "views/{$layout}")) { // club layouts $xmlfiles1 = JFolder::files(JEV_PATH . "views/{$layout}", "manifest\\.xml", true, true); if (!$xmlfiles1) { continue; } foreach ($xmlfiles1 as $manifest) { if (realpath($manifest) != $manifest) { continue; } if (!($manifestdata = $this->getValidManifestFile($manifest))) { continue; } $app = new stdClass(); $app->name = $manifestdata["name"]; $app->version = $manifestdata["version"]; $apps["layout_" . basename(dirname($manifest))] = $app; } } } else { if (strpos($item->get_title(), "module_") === 0) { $module = str_replace("module_", "", $item->get_title()); // modules if (JFolder::exists(JPATH_SITE . "/modules/{$module}")) { $xmlfiles1 = JFolder::files(JPATH_SITE . "/modules/{$module}", "\\.xml", true, true); if (!$xmlfiles1) { continue; } foreach ($xmlfiles1 as $manifest) { if (realpath($manifest) != $manifest) { continue; } if (!($manifestdata = $this->getValidManifestFile($manifest))) { continue; } $app = new stdClass(); $app->name = $manifestdata["name"]; $app->version = $manifestdata["version"]; $name = "module_" . str_replace(".xml", "", basename($manifest)); $apps[$name] = $app; } } } else { if (strpos($item->get_title(), "plugin_") === 0) { $plugin = explode("_", str_replace("plugin_", "", $item->get_title()), 2); if (count($plugin) < 2) { continue; } // plugins if (JVersion::isCompatible("1.6") && JFolder::exists(JPATH_SITE . "/plugins/" . $plugin[0] . "/" . $plugin[1]) || !JVersion::isCompatible("1.6") && JFolder::exists(JPATH_SITE . "/plugins/" . $plugin[0])) { // plugins if (JVersion::isCompatible("1.6")) { $xmlfiles1 = JFolder::files(JPATH_SITE . "/plugins/" . $plugin[0] . "/" . $plugin[1], "\\.xml", true, true); } else { $xmlfiles1 = JFolder::files(JPATH_SITE . "/plugins/" . $plugin[0], $plugin[1] . "\\.xml", true, true); } foreach ($xmlfiles1 as $manifest) { if (!($manifestdata = $this->getValidManifestFile($manifest))) { continue; } $app = new stdClass(); $app->name = $manifestdata["name"]; $app->version = $manifestdata["version"]; $name = str_replace(".xml", "", basename($manifest)); if (JVersion::isCompatible("1.6")) { $name = "plugin_" . basename(dirname(dirname($manifest))) . "_" . $name; } else { // simulate Joomla 1.7 directory structure $name = "plugin_" . basename(dirname($manifest)) . "_" . $name; } $apps[$name] = $app; } } } else { if (strpos($item->get_title(), "component_") === 0) { $component = str_replace("component_", "", $item->get_title()); if (JFolder::exists(JPATH_ADMINISTRATOR . "/components/" . $component)) { // modules $xmlfiles1 = JFolder::files(JPATH_ADMINISTRATOR . "/components/" . $component, "\\.xml", true, true); if (!$xmlfiles1) { continue; } foreach ($xmlfiles1 as $manifest) { if (!($manifestdata = $this->getValidManifestFile($manifest))) { continue; } $app = new stdClass(); $app->name = $manifestdata["name"]; $app->version = $manifestdata["version"]; $name = "component_" . basename(dirname($manifest)); $apps[$name] = $app; } } } else { continue; } } } } foreach ($apps as $appname => $app) { $iteminfo = json_decode($item->get_description()); if (version_compare($app->version, $iteminfo->version, "<")) { $link = $iteminfo->link != "" ? "<a href='" . $iteminfo->link . "' target='_blank'>" . $app->name . "</a>" : $app->name; if ($iteminfo->criticalversion != "" && version_compare($app->version, $iteminfo->criticalversion, "<")) { $rows[] = array($link, $appname, $app->version, $iteminfo->version, "<strong>" . $iteminfo->criticalversion . "</strong>"); } else { $rows[] = array($link, $appname, $app->version, $iteminfo->version, ""); } } } } if (count($rows) > 0) { $output = '<table class="versionstatuslist"><tr>'; $output .= '<th>' . JText::_("JEV_APPNAME") . '</th>'; $output .= '<th>' . JText::_("JEV_APPCODE") . '</th>'; $output .= '<th>' . JText::_("JEV_CURRENTVERSION") . '</th>'; $output .= '<th>' . JText::_("JEV_LATESTVERSION") . '</th>'; $output .= '<th>' . JText::_("JEV_CRITICALVERSION") . '</th>'; $output .= '</tr>'; $k = 0; foreach ($rows as $row) { $output .= '<tr class="row' . $k . '"><td>'; $output .= implode("</td><td>", $row); $output .= '</td></tr>'; $k = ($k + 1) % 2; } $output .= '</table'; $needsupdate = true; return $output; } } } return false; }
if (JEVHelper::isAdminUser()) { $link = "index.php?option=" . JEV_COM_COMPONENT . "&task=icals.list"; $this->_quickiconButton($link, "jevents_calendar_sml.png", JText::_('JEV_ADMIN_ICAL_SUBSCRIPTIONS'), "/administrator/components/" . JEV_COM_COMPONENT . "/assets/images/"); } $link = "index.php?option=" . JEV_COM_COMPONENT . "&task=icalevent.list"; $this->_quickiconButton($link, "jevents_event_sml.png", JText::_('JEV_ADMIN_ICAL_EVENTS'), "/administrator/components/" . JEV_COM_COMPONENT . "/assets/images/"); $link = "index.php?option=com_categories&extension=" . JEV_COM_COMPONENT; $this->_quickiconButton($link, "jevents_categories_sml.png", JText::_('JEV_INSTAL_CATS'), "/administrator/components/" . JEV_COM_COMPONENT . "/assets/images/"); if (JEVHelper::isAdminUser()) { $link = "index.php?option=" . JEV_COM_COMPONENT . "&task=user.list"; $this->_quickiconButton($link, "jevents_user_sml.png", JText::_('JEV_MANAGE_USERS'), "/administrator/components/" . JEV_COM_COMPONENT . "/assets/images/"); // new version $link = "index.php?option=" . JEV_COM_COMPONENT . "&task=params.edit"; $this->_quickiconButton($link, "jevents_config_sml.png", JText::_('JEV_INSTAL_CONFIG'), "/administrator/components/" . JEV_COM_COMPONENT . "/assets/images/"); } if (JEVHelper::isAdminUser()) { $link = "index.php?option=" . JEV_COM_COMPONENT . "&task=defaults.list"; $this->_quickiconButton($link, "jevents_layouts_sml.png", JText::_('JEV_LAYOUT_DEFAULTS'), "/administrator/components/" . JEV_COM_COMPONENT . "/assets/images/"); // Custom CSS $link = "index.php?option=" . JEV_COM_COMPONENT . "&task=cpanel.custom_css"; $this->_quickiconButton($link, "jevents_customcss_sml.png", JText::_('JEV_CUSTOM_CSS'), "/administrator/components/" . JEV_COM_COMPONENT . "/assets/images/"); // Support Info $link = "index.php?option=" . JEV_COM_COMPONENT . "&task=cpanel.support"; $this->_quickiconButton($link, "Support_icon.png", JText::_('SUPPORT_INFO'), "/administrator/components/" . JEV_COM_COMPONENT . "/assets/images/"); } ?> <div class="clear"></div> </div> <?php if ($params->get("showPanelNews", 1)) { ?>
private function changeState($field, $newstate, $successMessage) { // Check for request forgeries JRequest::checkToken() or jexit('Invalid Token'); if (!JEVHelper::isAdminUser()) { $msg = "Not Authorised"; $link = JRoute::_('index.php?option=' . JEV_COM_COMPONENT . '&task=user.list', false); $this->setRedirect($link, $msg); return; } $model = $this->getModel('user'); $user = $model->getUser(); $user->{$field} = $newstate; if ($user->store()) { $msg = $successMessage; } else { $msg = JText::_('ERROR_UPDATING_USER'); } $link = JRoute::_('index.php?option=' . JEV_COM_COMPONENT . '&task=user.list', false); $this->setRedirect($link, $msg); }
public function fixcollations() { if (!JEVHelper::isAdminUser()) { JFactory::getApplication()->redirect("index.php?option=" . JEV_COM_COMPONENT . "&task=cpanel.cpanel", "Not Authorised - must be admin"); return; } $db = JFactory::getDbo(); $db->setQuery("SHOW TABLES LIKE '" . $db->getPrefix() . "jev_%'"); $alltables = $db->loadResultArray(); // find collation for com_content $db->setQuery("SHOW FULL COLUMNS FROM #__content"); $contentdata = $db->loadObjectList('Field'); $collation = $contentdata['title']->Collation; $db->setQuery("SHOW TABLE STATUS LIKE '" . $db->getPrefix() . "jev_%'"); $tables = $db->loadObjectList('Name'); if (JRequest::getInt("ft", 0)) { foreach ($tables as $tablename => $table) { if ($table->Collation != $collation) { $db->setQuery("ALTER TABLE {$tablename} convert to character set utf8 collate {$collation}"); $db->query(); } } } $db->setQuery("SHOW TABLE STATUS LIKE '" . $db->getPrefix() . "jev_%'"); $tables = $db->loadObjectList('Name'); $fixtables = false; foreach ($tables as $tablename => $table) { if ($table->Collation != $collation) { echo "Table {$tablename} has collation " . $table->Collation . " it should probably be " . $collation . "<Br/>"; $fixtables = true; } $db->setQuery("SHOW FULL COLUMNS FROM {$tablename}"); $columndata = $db->loadObjectList('Field'); foreach ($columndata as $columnname => $columndata) { if ($columndata->Collation && $columndata->Collation != $collation) { echo "Column {$columnname} in Table {$tablename} has collation " . $columndata->Collation . " it should probably be " . $collation . "<Br/>"; } } } if ($fixtables) { echo "<hr/><br/><strong><a href='" . JURI::root() . "/administrator/index.php?option=com_jevents&task=cpanel.fixcollations&ft=1" . "'>Click here to fix these tables</a></strong>\n\t\t\t\t<h2>MAKE SURE YOU DATABASE IS BACKED UP BEFORE YOU DO THIS</h2>"; } }
/** * Configure the Linkbar. * * @param string The name of the active view. */ public static function addSubmenu($vName = "") { $task = JRequest::getCmd("task", "cpanel.cpanel"); $option = JRequest::getCmd("option", "com_categories"); if ($option == 'com_categories') { $doc = JFactory::getDocument(); if (!JevJoomlaVersion::isCompatible("3.0")) { $hide_options = '#toolbar-popup-options {' . 'display:none;' . '}'; } else { $hide_options = '#toolbar-options {' . 'display:none;' . '}'; } $doc->addStyleDeclaration($hide_options); // Category styling $style = <<<STYLE #categoryList td.center a { border:none; } STYLE; JFactory::getDbo()->setQuery("SELECT * FROM #__categories WHERE extension='com_jevents'"); $categories = JFactory::getDbo()->loadObjectList('id'); foreach ($categories as $cat) { $catparams = new JRegistry($cat->params); if ($catparams->get("catcolour")) { $style .= "tr[item-id='{$cat->id}'] a { border-left:solid 3px " . $catparams->get("catcolour") . ";padding-left:5px;}\n"; } } $doc->addStyleDeclaration($style); } if ($vName == "") { $vName = $task; } // could be called from categories component JLoader::register('JEVHelper', JPATH_SITE . "/components/com_jevents/libraries/helper.php"); if (JevJoomlaVersion::isCompatible("3.0")) { JHtmlSidebar::addEntry(JText::_('CONTROL_PANEL'), 'index.php?option=com_jevents', $vName == 'cpanel.cpanel'); JHtmlSidebar::addEntry(JText::_('JEV_ADMIN_ICAL_EVENTS'), 'index.php?option=com_jevents&task=icalevent.list', $vName == 'icalevent.list'); if (JEVHelper::isAdminUser()) { JHtmlSidebar::addEntry(JText::_('JEV_ADMIN_ICAL_SUBSCRIPTIONS'), 'index.php?option=com_jevents&task=icals.list', $vName == 'icals.list'); } JHtmlSidebar::addEntry(JText::_('JEV_INSTAL_CATS'), "index.php?option=com_categories&extension=com_jevents", $vName == 'categories'); if (JEVHelper::isAdminUser()) { JHtmlSidebar::addEntry(JText::_('JEV_MANAGE_USERS'), 'index.php?option=com_jevents&task=user.list', $vName == 'user.list'); JHtmlSidebar::addEntry(JText::_('JEV_INSTAL_CONFIG'), 'index.php?option=com_jevents&task=params.edit', $vName == 'params.edit'); JHtmlSidebar::addEntry(JText::_('JEV_LAYOUT_DEFAULTS'), 'index.php?option=com_jevents&task=defaults.list', in_array($vName, array('defaults.list', 'defaults.overview'))); //Support & CSS Customs should only be for Admins really. JHtmlSidebar::addEntry(JText::_('SUPPORT_INFO'), 'index.php?option=com_jevents&task=cpanel.support', $vName == 'cpanel.support'); JHtmlSidebar::addEntry(JText::_('JEV_CUSTOM_CSS'), 'index.php?option=com_jevents&task=cpanel.custom_css', $vName == 'cpanel.custom_css'); } } else { JSubMenuHelper::addEntry(JText::_('CONTROL_PANEL'), 'index.php?option=com_jevents', $vName == 'cpanel.cpanel'); JSubMenuHelper::addEntry(JText::_('JEV_ADMIN_ICAL_EVENTS'), 'index.php?option=com_jevents&task=icalevent.list', $vName == 'icalevent.list'); if (JEVHelper::isAdminUser()) { JSubMenuHelper::addEntry(JText::_('JEV_ADMIN_ICAL_SUBSCRIPTIONS'), 'index.php?option=com_jevents&task=icals.list', $vName == 'icals.list'); } JSubMenuHelper::addEntry(JText::_('JEV_INSTAL_CATS'), "index.php?option=com_categories&extension=com_jevents", $vName == 'categories'); if (JEVHelper::isAdminUser()) { JSubMenuHelper::addEntry(JText::_('JEV_MANAGE_USERS'), 'index.php?option=com_jevents&task=user.list', $vName == 'user.list'); JSubMenuHelper::addEntry(JText::_('JEV_INSTAL_CONFIG'), 'index.php?option=com_jevents&task=params.edit', $vName == 'params.edit'); JSubMenuHelper::addEntry(JText::_('JEV_LAYOUT_DEFAULTS'), 'index.php?option=com_jevents&task=defaults.list', in_array($vName, array('defaults.list', 'defaults.overview'))); //Support & CSS customs should only be for Admins really. JSubMenuHelper::addEntry(JText::_('SUPPORT_INFO'), 'index.php?option=com_jevents&task=cpanel.support', $vName == 'cpanel.support'); JSubMenuHelper::addEntry(JText::_('JEV_CUSTOM_CSS'), 'index.php?option=com_jevents&task=cpanel.custom_css', $vName == 'cpanel.custom_css'); } } }
/** * Drops Ical Tables * */ function droptables() { // disabled unless really needed return; $user =& JFactory::getUser(); if (!JEVHelper::isAdminUser()) { $this->setRedirect("index.php?option=" . JEV_COM_COMPONENT . "&task=cpanel.cpanel", "Not Authorised - must be super admin"); return; } $db =& JFactory::getDBO(); $sql = "DROP TABLE #__jevents_icsfile"; $db->setQuery($sql); $db->query(); $sql = "DROP TABLE #__jevents_rrule"; $db->setQuery($sql); $db->query(); $sql = "DROP TABLE #__jevents_vevdetail"; $db->setQuery($sql); $db->query(); $sql = "DROP TABLE #__jevents_vevent"; $db->setQuery($sql); $db->query(); $sql = "DROP TABLE #__jevents_repetition"; $db->setQuery($sql); $db->query(); $sql = "DROP TABLE #__jevents_exception"; $db->setQuery($sql); $db->query(); $sql = "DROP TABLE #__jevents_categories"; $db->setQuery($sql); $db->query(); $sql = "DELETE FROM #__categories where section='com_jevents'"; $db->setQuery($sql); $db->query(); $this->setMessage("Tables Dropped and recreated"); $this->dbsetup(); }
public function renderVersionsForClipboard() { if (!JEVHelper::isAdminUser()) { return; } jimport("joomla.filesystem.folder"); $apps = array(); // Joomla $app = new stdClass(); $app->name = "Joomla"; $version = new JVersion(); $app->version = $version->getShortVersion(); $apps[$app->name] = $app; // components (including JEvents $xmlfiles3 = JFolder::files(JPATH_ADMINISTRATOR . "/components", "manifest\\.xml", true, true); foreach ($xmlfiles3 as $manifest) { if (!($manifestdata = $this->getValidManifestFile($manifest))) { continue; } $app = new stdClass(); $app->name = $manifestdata["name"]; $app->version = $manifestdata["version"]; $name = "component_" . basename(dirname($manifest)); $apps[$name] = $app; } // modules if (JFolder::exists(JPATH_SITE . "/modules")) { $xmlfiles4 = JFolder::files(JPATH_SITE . "/modules", "\\.xml", true, true); } else { $xmlfiles4 = array(); } foreach ($xmlfiles4 as $manifest) { if (strpos($manifest, "mod_") === false) { continue; } if (!($manifestdata = $this->getValidManifestFile($manifest))) { continue; } $app = new stdClass(); $app->name = $manifestdata["name"]; $app->version = $manifestdata["version"]; $app->criticalversion = ""; $name = "module_" . str_replace(".xml", "", basename($manifest)); $apps[$name] = $app; } // club layouts $xmlfiles1 = JFolder::files(JEV_PATH . "views", "manifest\\.xml", true, true); foreach ($xmlfiles1 as $manifest) { if (realpath($manifest) != $manifest) { continue; } if (!($manifestdata = $this->getValidManifestFile($manifest))) { continue; } $app = new stdClass(); $app->name = $manifestdata["name"]; $app->version = $manifestdata["version"]; $apps["layout_" . basename(dirname($manifest))] = $app; } // plugins if (JFolder::exists(JPATH_SITE . "/plugins")) { $xmlfiles2 = JFolder::files(JPATH_SITE . "/plugins", "\\.xml", true, true); } else { $xmlfiles2 = array(); } foreach ($xmlfiles2 as $manifest) { if (strpos($manifest, "Zend") > 0) { continue; } if (!($manifestdata = $this->getValidManifestFile($manifest))) { continue; } $app = new stdClass(); $app->name = $manifestdata["name"]; $app->version = $manifestdata["version"]; $name = str_replace(".xml", "", basename($manifest)); if (JVersion::isCompatible("1.6")) { $group = basename(dirname(dirname($manifest))); } else { $group = basename(dirname($manifest)); } $plugin = JPluginHelper::getPlugin($group, $name); if (!$plugin) { $app->version .= " (not enabled)"; } $name = "plugin_" . $group . "_" . $name; $apps[$name] = $app; } $output = "<textarea rows='40' cols='80'>[code]\n"; foreach ($apps as $appname => $app) { $output .= "{$appname} : {$app->version}\n"; } $output .= "[/code]</textarea>"; return $output; }
function getEventData($rpid, $jevtype, $year, $month, $day, $uid = "") { $data = array(); $pop = intval(JRequest::getVar('pop', 0)); $Itemid = JEVHelper::getItemid(); $db = JFactory::getDBO(); $user = JFactory::getUser(); $cfg = JEVConfig::getInstance(); $row = $this->queryModel->listEventsById($rpid, 1, $jevtype); // include unpublished events for publishers and above // if the event is not published then make sure the user can edit or publish it or created it before allowing it to be seen! if ($row && $row->published() != 1) { if ($user->id != $row->created_by() && !JEVHelper::canEditEvent($row) && !JEVHelper::canPublishEvent($row) && !JEVHelper::isAdminUser($user)) { $row = null; } } $num_row = count($row); // No matching rows - use uid as alternative if ($num_row == 0 && JString::strlen($uid) > 0) { $rpid = $this->queryModel->findMatchingRepeat($uid, $year, $month, $day); if (isset($rpid) && $rpid > 0) { $row = $this->queryModel->listEventsById($rpid, 1, $jevtype); // include unpublished events for publishers and above if ($row && !$row->published()) { if ($user->id != $row->created_by() && !JEVHelper::canEditEvent($row) && !JEVHelper::canPublishEvent($row) && !JEVHelper::isAdminUser($user)) { $row = null; } } $num_row = count($row); } } if ($num_row) { // process the new plugins $dispatcher = JEventDispatcher::getInstance(); $dispatcher->trigger('onGetEventData', array(&$row)); $params = new JRegistry(null); $row->contactlink = JEventsHTML::getUserMailtoLink($row->id(), $row->created_by(), false, $row); $event_up = new JEventDate($row->publish_up()); $row->start_date = JEventsHTML::getDateFormat($event_up->year, $event_up->month, $event_up->day, 0); $row->start_time = JEVHelper::getTime($row->getUnixStartTime()); $event_down = new JEventDate($row->publish_down()); $row->stop_date = JEventsHTML::getDateFormat($event_down->year, $event_down->month, $event_down->day, 0); $row->stop_time = JEVHelper::getTime($row->getUnixEndTime()); $row->stop_time_midnightFix = $row->stop_time; $row->stop_date_midnightFix = $row->stop_date; if ($event_down->second == 59) { $row->stop_time_midnightFix = JEVHelper::getTime($row->getUnixEndTime() + 1); $row->stop_date_midnightFix = JEventsHTML::getDateFormat($event_down->year, $event_down->month, $event_down->day + 1, 0); } // ******************* // ** This cloaking should be done by mambot/Joomla function // ******************* // Parse http and wrap in <a> tag // trigger content plugin JPluginHelper::importPlugin('content'); $pattern = '[a-zA-Z0-9&?_.,=%\\-\\/]'; // Addresse if (!is_numeric($row->location())) { // don't convert address that already has a link tag if (strpos($row->location(), '<a href=') === false) { $row->location(preg_replace('#(http://)(' . $pattern . '*)#i', '<a href="\\1\\2">\\1\\2</a>', $row->location())); } $tmprow = new stdClass(); $tmprow->text = $row->location(); $dispatcher = JEventDispatcher::getInstance(); $dispatcher->trigger('onContentPrepare', array('com_jevents', &$tmprow, &$params, 0)); $row->location($tmprow->text); } //Contact if (strpos($row->contact_info(), '<a href=') === false) { $row->contact_info(preg_replace('#(http://)(' . $pattern . '*)#i', '<a href="\\1\\2">\\1\\2</a>', $row->contact_info())); } $tmprow = new stdClass(); $tmprow->text = $row->contact_info(); $dispatcher->trigger('onContentPrepare', array('com_jevents', &$tmprow, &$params, 0)); $row->contact_info($tmprow->text); //Extra if (strpos($row->extra_info(), '<a href=') === false) { $row->extra_info(preg_replace('#(http://)(' . $pattern . '*)#i', '<a href="\\1\\2">\\1\\2</a>', $row->extra_info())); } //$row->extra_info(eregi_replace('[^(href=|href="|href=\')](((f|ht){1}tp://)[-a-zA-Z0-9@:%_\+.~#?&//=]+)','\\1', $row->extra_info())); $tmprow = new stdClass(); $tmprow->text = $row->extra_info(); $dispatcher->trigger('onContentPrepare', array('com_jevents', &$tmprow, &$params, 0)); $row->extra_info($tmprow->text); $mask = JFactory::getApplication()->getCfg('hideAuthor') ? MASK_HIDEAUTHOR : 0; $mask |= JFactory::getApplication()->getCfg('hideCreateDate') ? MASK_HIDECREATEDATE : 0; $mask |= JFactory::getApplication()->getCfg('hideModifyDate') ? MASK_HIDEMODIFYDATE : 0; $mask |= JFactory::getApplication()->getCfg('hidePdf') ? MASK_HIDEPDF : 0; $mask |= JFactory::getApplication()->getCfg('hidePrint') ? MASK_HIDEPRINT : 0; $mask |= JFactory::getApplication()->getCfg('hideEmail') ? MASK_HIDEEMAIL : 0; //$mask |= JFactory::getApplication()->getCfg( 'vote' ) ? MASK_VOTES : 0; $mask |= JFactory::getApplication()->getCfg('vote') ? MASK_VOTES | MASK_VOTEFORM : 0; $mask |= $pop ? MASK_POPUP | MASK_IMAGES | MASK_BACKTOLIST : 0; // Do main mambot processing here // process bots //$row->text = $row->content; $params->set("image", 1); $row->text = $row->content(); $dispatcher->trigger('onContentPrepare', array('com_jevents', &$row, &$params, 0)); $row->content($row->text); $data['row'] = $row; $data['mask'] = $mask; $row->updateHits(); return $data; } else { // Do we have to be logged in to see this event? // If we set the access user for ical export (as an example) then use this user id for access checks! $user = isset($this->accessuser) ? JEVHelper::getUser($this->accessuser) : JFactory::getUser(); if ($user->id == 0) { $db = JFactory::getDBO(); $query = "SELECT ev.*" . "\n FROM #__jevents_vevent as ev " . "\n LEFT JOIN #__jevents_repetition as rpt ON rpt.eventid = ev.ev_id" . "\n WHERE rpt.rp_id = '{$rpid}'"; $db->setQuery($query); $row2 = $db->loadObject(); // need to be logged in to see this event? if ($row2 && (version_compare(JVERSION, '1.6.0', '>=') ? !in_array($row2->access, JEVHelper::getAid($user, 'array')) : JEVHelper::getAid($user) < $row2->access)) { $uri = JURI::getInstance(); $link = $uri->toString(); $comuser = version_compare(JVERSION, '1.6.0', '>=') ? "com_users" : "com_user"; $link = 'index.php?option=' . $comuser . '&view=login&return=' . base64_encode($link); $link = JRoute::_($link); JFactory::getApplication()->redirect($link, JText::_('JEV_LOGIN_TO_VIEWEVENT')); return null; } } // See if a plugin can find our missing event - maybe on another menu item JPluginHelper::importPlugin('jevents'); $dispatcher = JEventDispatcher::getInstance(); $dispatcher->trigger('onMissingEvent', array(&$row, $rpid, $jevtype, $year, $month, $day, $uid)); return null; } }
function toggleDefault($cid, $newstate) { $user =& JFactory::getUser(); if (!JEVHelper::isAdminUser($user)) { $this->setRedirect("index.php?option=" . JEV_COM_COMPONENT . "&task=cpanel.cpanel", "Not Authorised - must be super admin"); return; } $db =& JFactory::getDBO(); // set all to not default first $sql = "UPDATE #__jevents_icsfile SET isdefault=0"; $db->setQuery($sql); $db->query(); $id = $cid[0]; $sql = "UPDATE #__jevents_icsfile SET isdefault={$newstate} where ics_id='" . $id . "'"; $db->setQuery($sql); $db->query(); $this->setRedirect("index.php?option=" . JEV_COM_COMPONENT . "&task=icals.list", JText::_('JEV_ADMIN_ICALSUPDATED')); }
function listEventsByKeyword($keyword, $order, &$limit, &$limitstart, &$total, $useRegX = false) { $user = JFactory::getUser(); $adminuser = JEVHelper::isAdminUser($user); $db = JFactory::getDBO(); $rows_per_page = $limit; if (empty($limitstart) || !$limitstart) { $limitstart = 0; } $limitstring = ""; if ($rows_per_page > 0) { $limitstring = "LIMIT {$limitstart}, {$rows_per_page}"; } $where = ""; $having = ""; if (!JRequest::getInt('showpast', 0)) { $datenow =& JevDate::getDate("-12 hours"); $having = " AND rpt.endrepeat>'" . $datenow->toMysql() . "'"; } if (!$order) { $order = 'publish_up'; } $order = preg_replace("/[\t ]+/", '', $order); $orders = explode(",", $order); // this function adds #__events. to the beginning of each ordering field function app_db($strng) { return '#__events.' . $strng; } $order = implode(',', array_map('app_db', $orders)); $total = 0; // process the new plugins // get extra data and conditionality from plugins $extrawhere = array(); $extrajoin = array(); $extrafields = ""; // must have comma prefix $needsgroup = false; $filterarray = array("published"); // If there are extra filters from the module then apply them now $reg =& JFactory::getConfig(); $modparams = $reg->getValue("jev.modparams", false); if ($modparams && $modparams->getValue("extrafilters", false)) { $filterarray = array_merge($filterarray, explode(",", $modparams->getValue("extrafilters", false))); } $filters = jevFilterProcessing::getInstance($filterarray); $filters->setWhereJoin($extrawhere, $extrajoin); $needsgroup = $filters->needsGroupBy(); JPluginHelper::importPlugin('jevents'); $dispatcher =& JDispatcher::getInstance(); $dispatcher->trigger('onListIcalEvents', array(&$extrafields, &$extratables, &$extrawhere, &$extrajoin, &$needsgroup)); $catwhere = "\n WHERE ev.catid IN(" . $this->accessibleCategoryList() . ")"; $params = JComponentHelper::getParams("com_jevents"); if ($params->get("multicategory", 0)) { $extrajoin[] = "\n #__jevents_catmap as catmap ON catmap.evid = rpt.eventid"; $extrajoin[] = "\n #__categories AS catmapcat ON catmap.catid = catmapcat.id"; $extrafields .= ", GROUP_CONCAT(DISTINCT catmap.catid SEPARATOR ',') as catids"; $extrawhere[] = " catmapcat.access " . (version_compare(JVERSION, '1.6.0', '>=') ? ' IN (' . JEVHelper::getAid($user) . ')' : ' <= ' . JEVHelper::getAid($user)); $extrawhere[] = " catmap.catid IN(" . $this->accessibleCategoryList() . ")"; $needsgroup = true; $catwhere = "\n WHERE 1 "; } $extrajoin = count($extrajoin) ? " \n LEFT JOIN " . implode(" \n LEFT JOIN ", $extrajoin) : ''; $extrawhere = count($extrawhere) ? ' AND ' . implode(' AND ', $extrawhere) : ''; $extrasearchfields = array(); $dispatcher->trigger('onSearchEvents', array(&$extrasearchfields, &$extrajoin, &$needsgroup)); if (count($extrasearchfields) > 0) { $extraor = implode(" OR ", $extrasearchfields); $extraor = " OR " . $extraor; // replace the ### placeholder with the keyword $extraor = str_replace("###", $keyword, $extraor); $searchpart = $useRegX ? "(det.summary RLIKE '{$keyword}' OR det.description RLIKE '{$keyword}' OR det.extra_info RLIKE '{$keyword}' {$extraor})\n" : " (MATCH (det.summary, det.description, det.extra_info) AGAINST ('{$keyword}' IN BOOLEAN MODE) {$extraor})\n"; } else { $searchpart = $useRegX ? "(det.summary RLIKE '{$keyword}' OR det.description RLIKE '{$keyword}' OR det.extra_info RLIKE '{$keyword}')\n" : "MATCH (det.summary, det.description, det.extra_info) AGAINST ('{$keyword}' IN BOOLEAN MODE)\n"; } // Now Search Icals $query = "SELECT count( distinct det.evdet_id) FROM #__jevents_vevent as ev" . "\n LEFT JOIN #__jevents_icsfile as icsf ON icsf.ics_id=ev.icsid" . "\n LEFT JOIN #__jevents_repetition as rpt ON rpt.eventid = ev.ev_id" . "\n LEFT JOIN #__jevents_vevdetail as det ON det.evdet_id = rpt.eventdetail_id" . $extrajoin . $catwhere . "\n AND icsf.state=1 AND icsf.access " . (version_compare(JVERSION, '1.6.0', '>=') ? ' IN (' . JEVHelper::getAid($user) . ')' : ' <= ' . JEVHelper::getAid($user)) . "\n AND ev.access " . (version_compare(JVERSION, '1.6.0', '>=') ? ' IN (' . JEVHelper::getAid($user) . ')' : ' <= ' . JEVHelper::getAid($user)) . "\n AND "; $query .= $searchpart; $query .= $extrawhere; $query .= $having; $db->setQuery($query); //echo $db->explain(); $total += intval($db->loadResult()); if ($total < $limitstart) { $limitstart = 0; } $rows = array(); if ($total == 0) { return $rows; } // Now Search Icals // New version $query = "SELECT DISTINCT det.evdet_id FROM #__jevents_vevdetail as det" . "\n LEFT JOIN #__jevents_repetition as rpt ON rpt.eventdetail_id = det.evdet_id" . "\n LEFT JOIN #__jevents_vevent as ev ON ev.ev_id = rpt.eventid" . "\n LEFT JOIN #__jevents_icsfile as icsf ON icsf.ics_id=ev.icsid" . $extrajoin . $catwhere . "\n AND icsf.state=1 AND icsf.access " . (version_compare(JVERSION, '1.6.0', '>=') ? ' IN (' . JEVHelper::getAid($user) . ')' : ' <= ' . JEVHelper::getAid($user)) . "\n AND ev.access " . (version_compare(JVERSION, '1.6.0', '>=') ? ' IN (' . JEVHelper::getAid($user) . ')' : ' <= ' . JEVHelper::getAid($user)); $query .= " AND "; $query .= $searchpart; $query .= $extrawhere; $query .= $having; $query .= "\n ORDER BY rpt.startrepeat ASC "; $query .= "\n {$limitstring}"; $db->setQuery($query); if ($adminuser) { //echo $db->_sql; //echo $db->explain(); } //echo $db->explain(); $details = $db->loadResultArray(); $icalrows = array(); foreach ($details as $detid) { $query2 = "SELECT ev.*, rpt.*, det.* {$extrafields}" . "\n , YEAR(rpt.startrepeat) as yup, MONTH(rpt.startrepeat ) as mup, DAYOFMONTH(rpt.startrepeat ) as dup" . "\n , YEAR(rpt.endrepeat ) as ydn, MONTH(rpt.endrepeat ) as mdn, DAYOFMONTH(rpt.endrepeat ) as ddn" . "\n , HOUR(rpt.startrepeat) as hup, MINUTE(rpt.startrepeat ) as minup, SECOND(rpt.startrepeat ) as sup" . "\n , HOUR(rpt.endrepeat ) as hdn, MINUTE(rpt.endrepeat ) as mindn, SECOND(rpt.endrepeat ) as sdn" . "\n FROM #__jevents_vevent as ev" . "\n LEFT JOIN #__jevents_repetition as rpt ON rpt.eventid = ev.ev_id" . "\n LEFT JOIN #__jevents_vevdetail as det ON det.evdet_id = rpt.eventdetail_id" . "\n LEFT JOIN #__jevents_icsfile as icsf ON icsf.ics_id=ev.icsid" . $extrajoin . "\n WHERE rpt.eventdetail_id = {$detid}" . $extrawhere . $having . "\n ORDER BY rpt.startrepeat ASC limit 1"; $db->setQuery($query2); //echo $db->explain(); $data = $db->loadObject(); // belts and braces - some servers have a MYSQLK bug on the user of DISTINCT! if (!$data->ev_id) { continue; } $icalrows[] = $data; } $num_events = count($icalrows); for ($i = 0; $i < $num_events; $i++) { // convert rows to jevents $icalrows[$i] = new jIcalEventRepeat($icalrows[$i]); } $dispatcher =& JDispatcher::getInstance(); $dispatcher->trigger('onDisplayCustomFieldsMultiRow', array(&$icalrows)); $dispatcher->trigger('onDisplayCustomFieldsMultiRowUncached', array(&$icalrows)); return $icalrows; }
} // RSVP Pro $db = JFactory::getDbo(); $db->setQuery("SELECT enabled FROM #__extensions WHERE element = 'com_rsvppro' AND type='component' "); $is_enabled = $db->loadResult(); if ($is_enabled) { $link = "index.php?option=com_rsvppro"; JFactory::getLanguage()->load("com_rsvppro", JPATH_ADMINISTRATOR); $this->_quickiconButtonWHover($link, "cpanel/RSVPCool.png", "cpanel/RSVPHot.png", JText::_('COM_RSVPPRO'), "/administrator/components/" . JEV_COM_COMPONENT . "/assets/images/"); } // Custom Fields $db = JFactory::getDbo(); $db->setQuery("SELECT * FROM #__extensions WHERE element = 'jevcustomfields' AND type='plugin' AND folder='jevents' "); $extension = $db->loadObject(); // Stop if user is not authorised to manage JEvents if ($extension && $extension->enabled && JEVHelper::isAdminUser()) { $manifestCache = json_decode($extension->manifest_cache); if (isset($_SERVER["SERVER_ADDR"]) && $_SERVER["SERVER_ADDR"] == "192.168.1.50") { $link = "index.php?option=com_jevents&task=plugin.jev_customfields.overview"; JFactory::getLanguage()->load("plg_jevents_jevcustomfields", JPATH_ADMINISTRATOR); $this->_quickiconButtonWHover($link, "cpanel/CustomFieldsCool.png", "cpanel/CustomFieldsHot.png", JText::_('JEV_CUSTOM_FIELDS'), "/administrator/components/" . JEV_COM_COMPONENT . "/assets/images/"); } } ?> <div class="clear"></div> </div> </div> <?php if (JText::_("JEV_TRANSLATION_CREDITS") != "JEV_TRANSLATION_CREDITS" && JFactory::getLanguage()->getTag() != "en-GB") { ?> <div class="span12 center">
function toggleCatPublish($cid, $newstate) { $user =& JFactory::getUser(); if (!JEVHelper::isAdminUser($user)) { $this->setRedirect("index.php?option={$this->component}&task=cpanel.cpanel", JText::_('NOT_AUTHORISED_MUST_BE_ADMIN')); return; } foreach ($cid as $kid) { if ($kid > 0) { $cat = JTable::getInstance("category"); $cat->load($kid); $cat->published = $newstate; $cat->store(); } } $this->setRedirect("index.php?option=" . JEV_COM_COMPONENT . "&task=categories.list", JText::_('JEV_ADMIN_CATSUPDATED')); }