本文整理汇总了PHP中JEVHelper::isAdminUser方法的典型用法代码示例。如果您正苦于以下问题:PHP JEVHelper::isAdminUser方法的具体用法?PHP JEVHelper::isAdminUser怎么用?PHP JEVHelper::isAdminUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JEVHelper
的用法示例。
在下文中一共展示了JEVHelper::isAdminUser方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* 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();
}
*/
}
示例2: __construct
/**
* 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');
}
示例3: addSubmenu
/**
* 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');
}
}
}
示例4: listevents
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();
}
示例5: renderVersionsForClipboard
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"];
//.........这里部分代码省略.........
示例6: getAid
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;
// ??
}
}
示例7: renderVersionsForClipboard
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));
//.........这里部分代码省略.........
示例8: renderVersionStatusReport
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")) {
//.........这里部分代码省略.........
示例9:
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)) {
?>
示例10: changeState
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);
}
示例11: fixcollations
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>";
}
}
示例12: addSubmenu
/**
* 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');
}
}
}
示例13: droptables
/**
* 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();
}
示例14: renderVersionsForClipboard
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;
}
示例15: getEventData
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));
//.........这里部分代码省略.........