本文整理汇总了PHP中JEVHelper::getAid方法的典型用法代码示例。如果您正苦于以下问题:PHP JEVHelper::getAid方法的具体用法?PHP JEVHelper::getAid怎么用?PHP JEVHelper::getAid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JEVHelper
的用法示例。
在下文中一共展示了JEVHelper::getAid方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getIcalByIcsid
function getIcalByIcsid($icsid)
{
$db =& JFactory::getDBO();
$user =& JFactory::getUser();
$query = "SELECT *" . "\n FROM #__jevents_icsfile as ical" . "\n WHERE ical.ics_id = {$icsid}" . "\n AND ical.access " . (version_compare(JVERSION, '1.6.0', '>=') ? ' IN (' . JEVHelper::getAid($user) . ')' : ' <= ' . JEVHelper::getAid($user));
$db->setQuery($query);
$row = $db->loadObject();
return $row;
}
示例2: monthEvents
function monthEvents()
{
$modid = intval(JRequest::getVar('modid', 0));
$user = JFactory::getUser();
$query = "SELECT id, params" . "\n FROM #__modules AS m" . "\n WHERE m.published = 1" . "\n AND m.id = " . $modid . "\n AND m.access IN (" . JEVHelper::getAid($user, 'string') . ")" . "\n AND m.client_id != 1";
$db = JFactory::getDBO();
$db->setQuery($query);
$modules = $db->loadObjectList();
if (count($modules) <= 0) {
if (!$modid <= 0) {
return new JResponseJson(array());
}
}
$params = new JRegistry(isset($modules[0]->params) ? $modules[0]->params : null);
$reg = JFactory::getConfig();
$reg->set("jev.modparams", $params);
$this->datamodel = new JEventsDataModel();
$myItemid = $this->datamodel->setupModuleCatids($params);
$year = JRequest::getVar('jev_current_year', 0);
$month = JRequest::getVar('jev_current_month', 0);
if ($year == 0) {
$year = date("Y");
}
if ($month == 0) {
$month = date("m");
}
$data = $this->datamodel->getCalendarData($year, $month, 1, false, 0);
$events = array();
foreach ($data['dates'] as $day_index) {
foreach ($day_index['events'] as $event) {
$eventArray['date'] = $day_index['year'] . "-" . $day_index['month'] . "-" . $day_index['d0'] . " " . date("H:i", $event->getUnixStartTime());
$eventArray['title'] = $event->title();
$link = $event->viewDetailLink($day_index['year'], $day_index['month'], $day_index['d0'], false, $myItemid);
$eventArray['link'] = JRoute::_($link . $this->datamodel->getCatidsOutLink());
$events[] = $eventArray;
}
}
$result = new JResponseJson($events);
echo $result;
}
示例3: select
function select()
{
JRequest::checkToken('default') or jexit('Invalid Token');
$db = JFactory::getDBO();
$publishedOnly = true;
$id = JRequest::getInt('evid', 0);
$limit = intval(JFactory::getApplication()->getUserStateFromRequest("viewlistlimit", 'limit', 10));
$limitstart = intval(JFactory::getApplication()->getUserStateFromRequest("view{" . JEV_COM_COMPONENT . "}limitstart", 'limitstart', 0));
$user = JFactory::getUser();
$where[] = "\n ev.access " . (version_compare(JVERSION, '1.6.0', '>=') ? ' IN (' . JEVHelper::getAid($user) . ')' : ' <= ' . JEVHelper::getAid($user));
$where[] = "\n icsf.state=1 AND icsf.access " . (version_compare(JVERSION, '1.6.0', '>=') ? ' IN (' . JEVHelper::getAid($user) . ')' : ' <= ' . JEVHelper::getAid($user));
$query = "SELECT count( DISTINCT rpt.rp_id)" . "\n 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" . "\n LEFT JOIN #__jevents_rrule as rr ON rr.eventid = ev.ev_id" . "\n WHERE ev.ev_id=" . $id . "\n AND icsf.state=1" . (count($where) ? "\n AND " . implode(' AND ', $where) : '') . ($publishedOnly ? "\n AND ev.state=1" : "");
$db->setQuery($query);
$total = $db->loadResult();
if ($limit > $total) {
$limitstart = 0;
}
$query = "SELECT ev.*, rpt.*, rr.*, det.*" . "\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_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" . "\n LEFT JOIN #__jevents_rrule as rr ON rr.eventid = ev.ev_id" . "\n WHERE ev.ev_id=" . $id . "\n AND icsf.state=1" . ($publishedOnly ? "\n AND ev.state=1" : "") . (count($where) ? "\n AND " . implode(' AND ', $where) : '') . "\n GROUP BY rpt.rp_id" . "\n ORDER BY rpt.startrepeat";
if ($limit > 0) {
$query .= "\n LIMIT {$limitstart}, {$limit}";
}
$db->setQuery($query);
$icalrows = $db->loadObjectList();
$icalcount = count($icalrows);
for ($i = 0; $i < $icalcount; $i++) {
// convert rows to jIcalEvents
$icalrows[$i] = new jIcalEventRepeat($icalrows[$i]);
}
$menulist = $this->targetMenu(JRequest::getInt("Itemid"), "Itemid");
jimport('joomla.html.pagination');
$pageNav = new JPagination($total, $limitstart, $limit);
// get the view
$this->view = $this->getView("icalrepeat", "html");
// Set the layout
$this->view->setLayout('select');
$this->view->assign('menulist', $menulist);
$this->view->assign('icalrows', $icalrows);
$this->view->assign('pageNav', $pageNav);
$this->view->assign('evid', $id);
$this->view->display();
}
示例4: export
function export()
{
$params = JComponentHelper::getParams(JEV_COM_COMPONENT);
$years = JRequest::getVar('years', 'NONE');
$cats = JRequest::getVar('catids', 'NONE');
// validate the key
$icalkey = $params->get("icalkey", "secret phrase");
$outlook2003icalexport = JRequest::getInt("outlook2003", 0) && $params->get("outlook2003icalexport", 0);
if ($outlook2003icalexport) {
JRequest::setVar("icf", 1);
}
$privatecalendar = false;
$k = JRequest::getString("k", "NONE");
$pk = JRequest::getString("pk", "NONE");
$userid = JRequest::getInt("i", 0);
if ($pk != "NONE") {
if (!$userid) {
throw new Exception(JText::_('JEV_ERROR'), 403);
return false;
}
$privatecalendar = true;
$puser = JUser::getInstance($userid);
$key = md5($icalkey . $cats . $years . $puser->password . $puser->username . $puser->id);
if ($key != $pk) {
throw new Exception(JText::_('JEV_ERROR'), 403);
return false;
}
// ensure "user" can access non-public categories etc.
$this->dataModel->aid = JEVHelper::getAid($puser);
$this->dataModel->accessuser = $puser->get('id');
$registry = JRegistry::getInstance("jevents");
$registry->set("jevents.icaluser", $puser);
} else {
if ($k != "NONE") {
if ($params->get("disableicalexport", 0)) {
throw new Exception(JText::_('ALERTNOTAUTH'), 403);
return false;
}
$key = md5($icalkey . $cats . $years);
if ($key != $k) {
throw new Exception(JText::_('JEV_ERROR'), 403);
return false;
}
} else {
throw new Exception(JText::_('JEV_ERROR'), 403);
return false;
}
}
// Fix the cats
$cats = explode(',', $cats);
// hardening!
JEVHelper::forceIntegerArray($cats, false);
if ($cats != array(0)) {
JRequest::setVar("catids", implode("|", $cats));
} else {
JRequest::setVar("catids", '');
}
//Parsing variables from URL
//Year
// All years
if ($years == 0) {
$params = JComponentHelper::getParams(JEV_COM_COMPONENT);
$years = array();
for ($y = JEVHelper::getMinYear(); $y <= JEVHelper::getMaxYear(); $y++) {
if (!in_array($y, $years)) {
$years[] = $y;
}
}
JArrayHelper::toInteger($years);
} else {
if ($years != "NONE") {
$years = explode(",", JRequest::getVar('years'));
if (!is_array($years) || count($years) == 0) {
list($y, $m, $d) = JEVHelper::getYMD();
$years = array($y);
}
JArrayHelper::toInteger($years);
} else {
list($y, $m, $d) = JEVHelper::getYMD();
$years = array($y);
}
}
// Lockin hte categories from the URL
$Itemid = JRequest::getInt("Itemid", 0);
if (!$Itemid) {
JRequest::setVar("Itemid", 1);
}
$this->dataModel->setupComponentCatids();
$dispatcher = JDispatcher::getInstance();
// just incase we don't have jevents plugins registered yet
JPluginHelper::importPlugin("jevents");
//And then the real work
// Force all only the one repeat
$cfg = JEVConfig::getInstance();
$cfg->set('com_showrepeats', 0);
$icalEvents = array();
foreach ($years as $year) {
$startdate = $year . "-01-01";
$enddate = $year . "-12-31";
$rows = $this->dataModel->getRangeData($startdate, $enddate, 0, 0);
//.........这里部分代码省略.........
示例5: getContact
/**
* Returns contact details or user details as fall back
*
* @param int id key of user
* @param string attrib Requested attribute of the user object
* @return mixed row Attribute or row object
*/
public static function getContact($id, $attrib = 'Object')
{
$db = JFactory::getDBO();
static $rows = array();
if ($id <= 0) {
return null;
}
if (!isset($rows[$id])) {
$user = JFactory::getUser();
$rows[$id] = null;
$query = "SELECT ju.id, ju.name, ju.username, ju.sendEmail, ju.email, cd.name as contactname, " . ' CASE WHEN CHAR_LENGTH(cd.alias) THEN CONCAT_WS(\':\', cd.id, cd.alias) ELSE cd.id END as slug, ' . ' CASE WHEN CHAR_LENGTH(cat.alias) THEN CONCAT_WS(\':\', cat.id, cat.alias) ELSE cat.id END AS catslug ' . " \n FROM #__users AS ju" . "\n LEFT JOIN #__contact_details AS cd ON cd.user_id = ju.id " . "\n LEFT JOIN #__categories AS cat ON cat.id = cd.catid " . "\n WHERE block ='0'" . "\n AND cd.published =1 " . "\n AND cd.access " . (version_compare(JVERSION, '1.6.0', '>=') ? ' IN (' . JEVHelper::getAid($user) . ')' : ' <= ' . JEVHelper::getAid($user)) . "\n AND cat.access " . (version_compare(JVERSION, '1.6.0', '>=') ? ' IN (' . JEVHelper::getAid($user) . ')' : ' <= ' . JEVHelper::getAid($user)) . "\n AND ju.id = " . $id;
$db->setQuery($query);
$rows[$id] = $db->loadObject();
if (is_null($rows[$id])) {
// if the user has been deleted then try to suppress the warning
// this causes a problem in Joomla 2.5.1 on some servers
if (version_compare(JVERSION, '2.5', '>=')) {
$rows[$id] = JEVHelper::getUser($id);
} else {
$handlers = JError::getErrorHandling(2);
JError::setErrorHandling(2, "ignore");
$rows[$id] = JEVHelper::getUser($id);
foreach ($handlers as $handler) {
if (!is_array($handler)) {
JError::setErrorHandling(2, $handler);
}
}
if ($rows[$id]) {
$error = JError::getError(true);
}
}
}
}
if ($attrib == 'Object') {
return $rows[$id];
} elseif (isset($rows[$id]->{$attrib})) {
return $rows[$id]->{$attrib};
} else {
return null;
}
}
示例6: getCatData
function getCatData($catids, $showRepeats = true, $limit = 0, $limitstart = 0, $order = "rpt.startrepeat asc, rpt.endrepeat ASC, det.summary ASC")
{
$data = array();
$Itemid = JEVHelper::getItemid();
$db =& JFactory::getDBO();
include_once JPATH_ADMINISTRATOR . "/components/" . JEV_COM_COMPONENT . "/libraries/colorMap.php";
$cfg =& JEVConfig::getInstance();
$counter = $this->queryModel->countEventsByCat($catids);
$total = $this->queryModel->countIcalEventsByCat($catids, $showRepeats);
$counter += $total;
$data['total'] = $counter;
//$limit = $limit ? $limit : $cfg->get('com_calEventListRowsPpg');
if ($data['total'] <= $limit || $limitstart > $data['total']) {
$limitstart = 0;
}
$data['limit'] = $limit;
$data['limitstart'] = $limitstart;
$rows = $this->queryModel->listEventsByCat($catids, $limitstart, $limit);
$icalrows = $this->queryModel->listIcalEventsByCat($catids, $showRepeats, $total, $limitstart, $limit, $order);
$rows = array_merge($icalrows, $rows);
$num_events = count($rows);
if (count($catids) == 0 || count($catids) == 1 && $catids[0] == "") {
// We are using the filter instead
$tempcat = JRequest::getVar("category_fv", 0);
$catids = array();
$catids[] = $tempcat;
} else {
// Override multiple categories using the filter instead
$tempcat = JFactory::getApplication()->getUserStateFromRequest('category_fv_ses', 'category_fv', 0);
if ($tempcat > 0) {
$catids = array();
$catids[] = $tempcat;
}
}
$catdesc = "";
$catname = "";
if (count($catids) > 1) {
$catname = JText::_('JEV_EVENT_CHOOSE_CATEG');
}
if ($num_events > 0) {
if (count($catids) == 1 && $catids[0] != 0) {
$catname = $rows[0]->getCategoryName();
$catdesc = $rows[0]->getCategoryDescription();
foreach ($rows as $row) {
if ($row->getCategoryName() != $catname) {
$catname = JText::_('JEV_EVENT_CHOOSE_CATEG');
break;
}
}
} else {
$catname = "";
$catdesc = "";
}
} else {
if (count($catids) == 0) {
$catname = JText::_('JEV_EVENT_CHOOSE_CATEG');
} else {
if (count($catids) == 1 && $catids[0] != 0) {
// get the cat name from the database
$db =& JFactory::getDBO();
$user =& JFactory::getUser();
$catsql = 'SELECT c.title, c.description FROM #__categories AS c' . ' WHERE c.access ' . (version_compare(JVERSION, '1.6.0', '>=') ? ' IN (' . JEVHelper::getAid($user) . ')' : ' <= ' . JEVHelper::getAid($user)) . ' AND c.' . (JVersion::isCompatible("1.6.0") ? 'extension' : 'section') . ' = ' . $db->Quote(JEV_COM_COMPONENT) . ' AND c.id = ' . $db->Quote($catids[0]);
$db->setQuery($catsql);
$catdata = $db->loadObject();
if ($catdata) {
$catname = $catdata->title;
$catdesc = $catdata->description;
} else {
$catname = JText::_('JEV_EVENT_ALLCAT');
}
}
}
}
$data['catname'] = $catname;
$data['catdesc'] = $catdesc;
$data['catids'] = $catids;
if ($num_events > 0) {
for ($r = 0; $r < $num_events; $r++) {
$row =& $rows[$r];
if ($row->catname() == "") {
$row->catname($catname);
// for completeness of dataset
}
}
}
$data['rows'] = $rows;
return $data;
}
示例7: setup
/**
* Pseudo Constructor
*
*/
function setup(&$params, $modid)
{
$this->modid = $modid;
$user = JFactory::getUser();
$cfg = JEVConfig::getInstance();
$db = JFactory::getDBO();
$this->datamodel = new JEventsDataModel();
// component config object
$jevents_config = JEVConfig::getInstance();
$this->modparams =& $params;
$this->aid = JEVHelper::getAid($user, 'string');
// RSH modified getAid to handle different return types 10/26/10
$tmplang = JFactory::getLanguage();
// get params exclusive to module
$this->inc_ec_css = $this->modparams->get('inc_ec_css', 0);
$this->minical_showlink = $this->modparams->get('minical_showlink', 1);
$this->minical_prevyear = $this->modparams->get('minical_prevyear', 1);
$this->minical_prevmonth = $this->modparams->get('minical_prevmonth', 1);
$this->minical_actmonth = $this->modparams->get('minical_actmonth', 1);
$this->minical_actmonth = $this->modparams->get('minical_actmonth', 1);
$this->minical_actyear = $this->modparams->get('minical_actyear', 1);
$this->minical_nextmonth = $this->modparams->get('minical_nextmonth', 1);
$this->minical_nextyear = $this->modparams->get('minical_nextyear', 1);
// get params exclusive to component
$this->com_starday = intval($jevents_config->get('com_starday', 0));
// make config object (module or component) current
if (intval($this->modparams->get('modcal_useLocalParam', 0)) == 1) {
$myparam =& $this->modparams;
} else {
$myparam =& $jevents_config;
}
// get com_event config parameters for this module
$this->displayLastMonth = $myparam->get('modcal_DispLastMonth', 'NO');
$this->disp_lastMonthDays = $myparam->get('modcal_DispLastMonthDays', 0);
$this->linkCloaking = $myparam->get('modcal_LinkCloaking', 0);
$t_datenow = JEVHelper::getNow();
$this->timeWithOffset = $t_datenow->toUnix(true);
switch ($this->displayLastMonth) {
case 'YES_stop':
$this->disp_lastMonth = 1;
break;
case 'YES_stop_events':
$this->disp_lastMonth = 2;
break;
case 'ALWAYS':
$this->disp_lastMonthDays = 0;
$this->disp_lastMonth = 1;
break;
case 'ALWAYS_events':
$this->disp_lastMonthDays = 0;
$this->disp_lastMonth = 2;
break;
case 'NO':
default:
$this->disp_lastMonthDays = 0;
$this->disp_lastMonth = 0;
break;
}
$this->displayNextMonth = $myparam->get('modcal_DispNextMonth', 'NO');
$this->disp_nextMonthDays = $myparam->get('modcal_DispNextMonthDays', 0);
switch ($this->displayNextMonth) {
case 'YES_stop':
$this->disp_nextMonth = 1;
break;
case 'YES_stop_events':
$this->disp_nextMonth = 2;
break;
case 'ALWAYS':
$this->disp_nextMonthDays = 0;
$this->disp_nextMonth = 1;
break;
case 'ALWAYS_events':
$this->disp_nextMonthDays = 0;
$this->disp_nextMonth = 2;
break;
case 'NO':
default:
$this->disp_nextMonthDays = 0;
$this->disp_nextMonth = 0;
break;
}
// find appropriate Itemid and setup catids for datamodel
$this->myItemid = $this->datamodel->setupModuleCatids($this->modparams);
$this->cat = $this->datamodel->getCatidsOutLink(true);
$this->linkpref = 'index.php?option=' . JEV_COM_COMPONENT . '&Itemid=' . $this->myItemid . $this->cat . '&task=';
}
示例8: getCategoryHierarchy
protected function getCategoryHierarchy($catidList, $catidsGPList)
{
$db = JFactory::getDBO();
$aid = $this->datamodel->aid;
$user = JFactory::getUser();
// Get all the categories
$sql = "SELECT c.* FROM #__categories as c WHERE extension='" . JEV_COM_COMPONENT . "'" . " AND c.access " . (version_compare(JVERSION, '1.6.0', '>=') ? ' IN (' . JEVHelper::getAid($user) . ')' : ' <= ' . JEVHelper::getAid($user)) . "\n AND c.language in (" . $db->quote(JFactory::getLanguage()->getTag()) . ',' . $db->quote('*') . ')' . " AND c.published = 1" . "\n ORDER BY c.lft";
$db->setQuery($sql);
$catlist = $db->loadObjectList('id');
foreach ($catlist as &$cat) {
$cat->name = $cat->title;
$params = new JRegistry($cat->params);
$cat->color = $params->get("catcolour", "");
$cat->overlaps = $params->get("overlaps", 0);
}
unset($cat);
// any plugin based resitrictions
$dispatcher = JDispatcher::getInstance();
// remember NOT to reindex the list
$dispatcher->trigger('onGetAccessibleCategories', array(&$catlist, false));
// Copy the array
$clonedCatList = unserialize(serialize($catlist));
$validcats = array();
if (JString::strlen($catidsGPList) > 0) {
$validcats = array_merge($validcats, explode(",", $catidsGPList));
}
// convert to a tree
$cattree = $this->mapTree($catlist, $validcats);
// constrain tree by component or module paramaters
if (JString::strlen($catidList) > 0) {
$validcats = array();
$validcats = array_merge($validcats, explode(",", $catidList));
if (count($validcats) > 0) {
$cattree2 = $this->mapTree($clonedCatList, $validcats);
$combinedCatTree = $this->constrainTree($cattree, $cattree2);
}
}
return $cattree;
}
示例9: listEventsByKeyword
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);
//.........这里部分代码省略.........
示例10: export
function export()
{
$params = JComponentHelper::getParams(JEV_COM_COMPONENT);
if ($params->get("disableicalexport", 0)) {
JError::raiseError(403, JText::_('ALERTNOTAUTH'));
}
$years = JRequest::getVar('years', 'NONE');
$cats = JRequest::getVar('catids', 'NONE');
// validate the key
$icalkey = $params->get("icalkey", "secret phrase");
$outlook2003icalexport = JRequest::getInt("outlook2003", 0) && $params->get("outlook2003icalexport", 0);
if ($outlook2003icalexport) {
JRequest::setVar("icf", 1);
}
$privatecalendar = false;
$k = JRequest::getString("k", "NONE");
$pk = JRequest::getString("pk", "NONE");
$userid = JRequest::getInt("i", 0);
if ($pk != "NONE") {
if (!$userid) {
JError::raiseError(403, "JEV_ERROR");
}
$privatecalendar = true;
$puser = JUser::getInstance($userid);
$key = md5($icalkey . $cats . $years . $puser->password . $puser->username . $puser->id);
if ($key != $pk) {
JError::raiseError(403, "JEV_ERROR");
}
if (JVersion::isCompatible("1.6.0")) {
// ensure "user" can access non-public categories etc.
$this->dataModel->aid = JEVHelper::getAid($puser);
$this->dataModel->accessuser = $puser->get('id');
} else {
// Get an ACL object
$acl =& JFactory::getACL();
// Get the user group from the ACL
$grp = $acl->getAroGroup($puser->get('id'));
//Mark the user as logged in
$puser->set('guest', 0);
$puser->set('aid', 1);
// Fudge Authors, Editors, Publishers and Super Administrators into the special access group
if ($acl->is_group_child_of($grp->name, 'Registered') || $acl->is_group_child_of($grp->name, 'Public Backend')) {
$puser->set('aid', 2);
}
// ensure "user" can access non-public categories etc.
$this->dataModel->aid = $puser->aid;
$this->dataModel->accessuser = $puser->get('id');
}
$registry =& JRegistry::getInstance("jevents");
$registry->setValue("jevents.icaluser", $puser);
} else {
if ($k != "NONE") {
$key = md5($icalkey . $cats . $years);
if ($key != $k) {
JError::raiseError(403, "JEV_ERROR");
}
} else {
JError::raiseError(403, "JEV_ERROR");
}
}
// Fix the cats
$cats = explode(',', $cats);
// hardening!
JEVHelper::forceIntegerArray($cats, false);
if ($cats != array(0)) {
JRequest::setVar("catids", implode("|", $cats));
} else {
JRequest::setVar("catids", '');
}
//Parsing variables from URL
//Year
// All years
if ($years == 0) {
$params = JComponentHelper::getParams(JEV_COM_COMPONENT);
$years = array();
for ($y = $params->get("com_earliestyear", date('Y')); $y <= $params->get("com_latestyear", date('Y')); $y++) {
if (!in_array($y, $years)) {
$years[] = $y;
}
}
JArrayHelper::toInteger($years);
} else {
if ($years != "NONE") {
$years = explode(",", JRequest::getVar('years'));
if (!is_array($years) || count($years) == 0) {
list($y, $m, $d) = JEVHelper::getYMD();
$years = array($y);
}
JArrayHelper::toInteger($years);
} else {
list($y, $m, $d) = JEVHelper::getYMD();
$years = array($y);
}
}
// Lockin hte categories from the URL
$this->dataModel->setupComponentCatids();
$dispatcher =& JDispatcher::getInstance();
// just incase we don't have jevents plugins registered yet
JPluginHelper::importPlugin("jevents");
//And then the real work
//.........这里部分代码省略.........
示例11: findAppropriateMenuID
function findAppropriateMenuID(&$catidsOut, &$modcatids, &$catidList, $modparams, &$showall)
{
// Itemid, search for menuid with lowest access rights
$user = JFactory::getUser();
$db = JFactory::getDBO();
// Do we ignore category filters?
$ignorecatfilter = 0;
if (isset($modparams->ignorecatfilter) && $modparams->ignorecatfilter) {
$ignorecatfilter = $modparams->ignorecatfilter;
JRequest::setVar("category_fv", 0);
}
$menu = JFactory::getApplication()->getMenu();
$menuitems = $menu->getItems("component", JEV_COM_COMPONENT);
// restrict this list to those accessible by the user
if (!is_null($menuitems)) {
foreach ($menuitems as $index => $menuitem) {
if (version_compare(JVERSION, '1.6.0', '>=') ? !in_array($menuitem->access, JEVHelper::getAid($user, 'array')) : JEVHelper::getAid($user) < $menuitem->access) {
unset($menuitems[$index]);
} else {
if (array_key_exists("task", $menuitem->query) && strpos($menuitem->query['task'], 'admin') === 0) {
unset($menuitems[$index]);
}
}
}
} else {
$menuitems = array();
}
$activeMenu = $menu->getActive();
if (isset($modparams->target_itemid) && $modparams->target_itemid != '' && intval($modparams->target_itemid) > 0) {
$targetid = intval($modparams->target_itemid);
$myItemid = 0;
foreach ($menuitems as $item) {
if ($targetid == $item->id) {
$myItemid = $targetid;
break;
}
}
} else {
if ($activeMenu && $activeMenu->component == JEV_COM_COMPONENT) {
// use result by reference
$myItemid = $activeMenu->id;
} else {
if (count($menuitems) > 0) {
reset($menuitems);
$myItemid = current($menuitems);
$myItemid = $myItemid->id;
} else {
// if no menu pointing the JEvents use itemid of home page and set empty menu array
$myItemid = 1;
$menuitems = array();
}
}
}
// put the best guess first for checking category selections
if ($myItemid > 0) {
$newmenuitems = array();
foreach ($menuitems as $item) {
if ($myItemid == $item->id) {
array_unshift($newmenuitems, $item);
} else {
array_push($newmenuitems, $item);
}
}
$menuitems = $newmenuitems;
}
//Finds the first enclosing setof catids from menu item if it exists !
//
// First of all get the module paramaters
$c = 0;
$modcatids = array();
$catidList = "";
// New system
$newcats = isset($modparams->catidnew) ? $modparams->catidnew : false;
if ($newcats && is_array($newcats)) {
foreach ($newcats as $newcat) {
if (!in_array($newcat, $modcatids)) {
$modcatids[] = $newcat;
$catidList .= (JString::strlen($catidList) > 0 ? "," : "") . $newcat;
}
}
} else {
for ($c = 0; $c < 999; $c++) {
$nextCID = "catid{$c}";
// stop looking for more catids when you reach the last one!
if (!isset($modparams->{$nextCID})) {
break;
}
if ($modparams->{$nextCID} > 0 && !in_array($modparams->{$nextCID}, $modcatids)) {
$modcatids[] = $modparams->{$nextCID};
$catidList .= (JString::strlen($catidList) > 0 ? "," : "") . $modparams->{$nextCID};
}
}
}
if (count($modcatids) == 0) {
$showall = true;
}
$catidsOut = str_replace(",", "|", $catidList);
$params = JComponentHelper::getParams(JEV_COM_COMPONENT);
$separator = $params->get("catseparator", "|");
$catidsOut = str_replace("|", $separator, $catidsOut);
//.........这里部分代码省略.........
示例12: rss
function rss($tpl = null)
{
$modid = intval(JRequest::getVar('modid', 0));
if ($modid < 0) {
$modid = 0;
}
$cfg =& JEVConfig::getInstance();
$db =& JFactory::getDBO();
// setup for all required function and classes
$file = JPATH_SITE . '/components/com_jevents/mod.defines.php';
include_once $file;
// load language constants
JEVHelper::loadLanguage('modlatest');
// Check document type
$doc =& JFactory::getDocument();
if ($doc->getType() != 'feed') {
JError::raiseError('E999', 'Fatal error, document type: "' . $doc->getType() . '" not supported.');
}
if ($modid > 0) {
$user = JFactory::getUser();
$query = "SELECT id, params" . "\n FROM #__modules AS m" . "\n WHERE m.published = 1" . "\n AND m.id = " . $modid . "\n AND m.access " . (version_compare(JVERSION, '1.6.0', '>=') ? ' IN (' . JEVHelper::getAid($user, 'string') . ')' : ' <= ' . JEVHelper::getAid($user)) . "\n AND m.client_id != 1";
$db =& JFactory::getDBO();
$db->setQuery($query);
$modules = $db->loadObjectList();
if (count($modules) <= 0) {
// fake module parameter
$params = new JParameter('');
} else {
$params = new JParameter($modules[0]->params);
}
} else {
$params = JComponentHelper::getParams(JEV_COM_COMPONENT);
}
// parameter intialization
$info['link'] = str_replace('&', '&', JURI::root(true));
$info['imagelink'] = str_replace('&', '&', JURI::root());
$info['base'] = str_replace('&', '&', JURI::root());
$info['cache'] = $cfg->get('com_rss_cache', 1);
$info['cache_time'] = $cfg->get('com_rss_cache_time', 3600);
$info['count'] = $cfg->get('com_rss_count', 5);
$info['title'] = $cfg->get('com_rss_title', 'Powered by JEvents!');
$info['description'] = $cfg->get('com_rss_description', 'JEvents Syndication for Joomla');
// get rss title from module param if requested and defined
$t_title = $params->get('modlatest_rss_title', null);
if ($params->get('modlatest_useLocalParam', 0) == 1 && !empty($t_title)) {
$info['title'] = $t_title;
}
// get rss description from module param if requested and defined
$t_description = $params->get('modlatest_rss_description', null);
if ($params->get('modlatest_useLocalParam', 0) == 1 && !empty($t_description)) {
$info['description'] = $t_description;
}
$info['image_url'] = htmlspecialchars($cfg->get('com_rss_logo', JURI::root() . 'administrator/components/' . JEV_COM_COMPONENT . '/assets/images/logo.gif'));
if ($info['image_url'] == "") {
$info['image_url'] = htmlspecialchars(JURI::root() . 'administrator/components/' . JEV_COM_COMPONENT . '/assets/images/logo.gif');
}
$info['image_alt'] = $info['title'];
$info['limit_text'] = $cfg->get('com_rss_limit_text', 1);
$info['text_length'] = $cfg->get('com_rss_text_length', 20);
// include the appropraite VIEW - this should be based on config and/or URL?
$cfg =& JEVConfig::getInstance();
$theme = JEV_CommonFunctions::getJEventsViewName();
$viewclass = ucfirst($theme) . "ModLatestView";
jimport('joomla.application.module.helper');
require_once JModuleHelper::getLayoutPath('mod_jevents_latest', $theme . DS . "latest");
$jeventCalObject = new $viewclass($params, $modid);
$jeventCalObject->getLatestEventsData($info["count"]);
$this->set("eventsByRelDay", $jeventCalObject->eventsByRelDay);
$this->set("info", $info);
$this->set("modparams", $params);
$this->set("jeventCalObject", $jeventCalObject);
parent::displaytemplate($tpl);
}
示例13: select
function select()
{
JRequest::checkToken('default') or jexit('Invalid Token');
// get the view
$this->view =& $this->getView("icalevent", "html");
$this->_checkValidCategories();
$showUnpublishedICS = false;
$showUnpublishedCategories = false;
$db =& JFactory::getDBO();
$icsFile = intval(JFactory::getApplication()->getUserStateFromRequest("icsFile", "icsFile", 0));
$catid = intval(JFactory::getApplication()->getUserStateFromRequest("catidIcalEvents", 'catid', 0));
$catidtop = $catid;
$state = 1;
$limit = intval(JFactory::getApplication()->getUserStateFromRequest("viewlistlimit", 'limit', 10));
$limitstart = intval(JFactory::getApplication()->getUserStateFromRequest("view{" . JEV_COM_COMPONENT . "}limitstart", 'limitstart', 0));
$search = JFactory::getApplication()->getUserStateFromRequest("search{" . JEV_COM_COMPONENT . "}", 'search', '');
$search = $db->getEscaped(trim(strtolower($search)));
$created_by = JFactory::getApplication()->getUserStateFromRequest("createdbyIcalEvents", 'created_by', 0);
// Is this a large dataset ?
$query = "SELECT count(rpt.rp_id) from #__jevents_repetition as rpt ";
$db->setQuery($query);
$totalrepeats = $db->loadResult();
$this->_largeDataSet = 0;
$cfg =& JEVConfig::getInstance();
if ($totalrepeats > $cfg->get('largeDataSetLimit', 100000)) {
$this->_largeDataSet = 1;
}
$cfg =& JEVConfig::getInstance();
$cfg->set('largeDataSet', $this->_largeDataSet);
$where = array();
$join = array();
if ($search) {
$where[] = "LOWER(detail.summary) LIKE '%{$search}%'";
}
$user = JFactory::getUser();
// keep this incase we use filters in category lists
$catwhere = "\n ev.catid IN(" . $this->queryModel->accessibleCategoryList() . ")";
$params = JComponentHelper::getParams(JRequest::getCmd("option"));
if ($params->get("multicategory", 0)) {
$join[] = "\n #__jevents_catmap as catmap ON catmap.evid = rpt.eventid";
$join[] = "\n #__categories AS catmapcat ON catmap.catid = catmapcat.id";
$where[] = " catmapcat.access " . (version_compare(JVERSION, '1.6.0', '>=') ? ' IN (' . JEVHelper::getAid($user) . ')' : ' <= ' . JEVHelper::getAid($user));
$where[] = " catmap.catid IN(" . $this->queryModel->accessibleCategoryList() . ")";
$needsgroup = true;
$catwhere = " 1";
}
$where[] = $catwhere;
if ($catid > 0) {
if ($params->get("multicategory", 0)) {
$where[] = "catmap.catid='{$catid}'";
} else {
$where[] = "ev.catid='{$catid}'";
}
}
if ($created_by === "") {
$where[] = "ev.created_by=0";
} else {
$created_by = intval($created_by);
if ($created_by > 0) {
$where[] = "ev.created_by=" . $db->Quote($created_by);
}
}
if ($icsFile > 0) {
$join[] = " #__jevents_icsfile as icsf ON icsf.ics_id = ev.icsid";
$where[] = "\n icsf.ics_id = {$icsFile}";
if (!$showUnpublishedICS) {
$where[] = "\n icsf.state=1";
}
} else {
if (!$showUnpublishedICS) {
$join[] = " #__jevents_icsfile as icsf ON icsf.ics_id = ev.icsid";
$where[] = "\n icsf.state=1";
} else {
$icsFrom = "";
}
}
$user = JFactory::getUser();
$where[] = "\n ev.access " . (version_compare(JVERSION, '1.6.0', '>=') ? ' IN (' . JEVHelper::getAid($user) . ')' : ' <= ' . JEVHelper::getAid($user));
$where[] = "\n icsf.access " . (version_compare(JVERSION, '1.6.0', '>=') ? ' IN (' . JEVHelper::getAid($user) . ')' : ' <= ' . JEVHelper::getAid($user));
$hidepast = intval(JFactory::getApplication()->getUserStateFromRequest("hidepast", "hidepast", 1));
if ($hidepast) {
$datenow =& JevDate::getDate("-1 day");
if (!$this->_largeDataSet) {
$where[] = "\n rpt.endrepeat>'" . $datenow->toMysql() . "'";
}
}
if ($state == 1) {
$where[] = "\n ev.state=1";
} else {
if ($state == 2) {
$where[] = "\n ev.state=0";
}
}
// get the total number of records
$query = "SELECT count(distinct rpt.eventid)" . "\n FROM #__jevents_vevent AS ev " . "\n LEFT JOIN #__jevents_vevdetail as detail ON ev.detail_id=detail.evdet_id" . "\n LEFT JOIN #__jevents_rrule as rr ON rr.eventid = ev.ev_id" . "\n LEFT JOIN #__jevents_repetition as rpt ON rpt.eventid = ev.ev_id" . (count($join) ? "\n LEFT JOIN " . implode(' LEFT JOIN ', $join) : '') . (count($where) ? "\n WHERE " . implode(' AND ', $where) : '');
$db->setQuery($query);
//echo $db->_sql;
$total = $db->loadResult();
echo $db->getErrorMsg();
if ($limit > $total) {
//.........这里部分代码省略.........
示例14: viewDetailLink
function viewDetailLink($year, $month, $day, $sef = true, $Itemid = 0)
{
$Itemid = $Itemid > 0 ? $Itemid : JEVHelper::getItemid($this);
static $menuitems = false;
if (!$menuitems) {
$menu = JFactory::getApplication()->getMenu();
$menuitems = $menu->getItems("component", JEV_COM_COMPONENT);
$user = JFactory::getUser();
// restrict this list to those accessible by the user
if (!is_null($menuitems)) {
$lang = JFactory::getLanguage();
foreach ($menuitems as $index => $menuitem) {
if (!in_array($menuitem->access, JEVHelper::getAid($user, 'array'))) {
unset($menuitems[$index]);
} else {
if (array_key_exists("task", $menuitem->query) && strpos($menuitem->query['task'], 'admin') === 0) {
unset($menuitems[$index]);
} else {
if ($menuitem->language != "*" && $menuitem->language != $lang->getTag()) {
unset($menuitems[$index]);
} else {
if (!(array_key_exists("layout", $menuitem->query) && array_key_exists("view", $menuitem->query) && $menuitem->query['view'] . "." . $menuitem->query['layout'] == 'icalrepeat.detail')) {
unset($menuitems[$index]);
}
}
}
}
}
} else {
$menuitems = array();
}
}
// Is there a specific menu item for this ONE event - this overrides everything (if in the same language!)
foreach ($menuitems as $index => $menuitem) {
if (array_key_exists("layout", $menuitem->query) && array_key_exists("view", $menuitem->query) && $menuitem->query['view'] . "." . $menuitem->query['layout'] == 'icalrepeat.detail') {
if (isset($menuitem->query["evid"]) && $menuitem->query["evid"] == $this->ev_id()) {
$Itemid = $menuitem->id;
break;
}
}
}
// uid = event series unique id i.e. the actual event
$title = JApplication::stringURLSafe($this->title());
$link = "index.php?option=" . JEV_COM_COMPONENT . "&task=" . $this->detailTask() . "&evid=" . $this->rp_id() . '&Itemid=' . $Itemid . "&year={$year}&month={$month}&day={$day}&title=" . $title . "&uid=" . urlencode($this->uid());
if (JRequest::getCmd("tmpl", "") == "component" && JRequest::getCmd('task', 'selectfunction') != 'icalevent.select' && JRequest::getCmd("option", "") != "com_acymailing" && JRequest::getCmd("option", "") != "com_jnews" && JRequest::getCmd("option", "") != "com_search" && JRequest::getCmd("jevtask", "") != "crawler.listevents") {
$link .= "&tmpl=component";
}
// SEF is applied later
$link = $sef ? JRoute::_($link, true) : $link;
return $link;
}
示例15: array
// New custom fields
if (isset($this->location->customfields)) {
$customfields = $this->location->customfields;
} else {
$customfields = array();
}
$plugin = JPluginHelper::getPlugin('jevents', 'jevcustomfields');
$pluginparams = new JRegistry($plugin->params);
$templatetop = $pluginparams->get("templatetop", "<table border='0'>");
$templaterow = $pluginparams->get("templatebody", "<tr><td class='label'>{LABEL}</td><td>{VALUE}</td>");
$templatebottom = $pluginparams->get("templatebottom", "</table>");
$html = $templatetop;
$user = JFactory::getUser();
foreach ($customfields as $customfield) {
if (version_compare(JVERSION, '1.6.0', '>=')) {
if (!in_array(intval($customfield["access"]), JEVHelper::getAid($user, 'array'))) {
continue;
}
} else {
if ($user->aid < intval($customfield["access"])) {
continue;
}
}
if (!is_null($customfield["hiddenvalue"]) && trim($customfield["value"]) == $customfield["hiddenvalue"]) {
continue;
}
$outrow = str_replace("{LABEL}", $customfield["label"], $templaterow);
$outrow = str_replace("{VALUE}", nl2br($customfield["value"]), $outrow);
$html .= $outrow;
}
$html .= $templatebottom;