当前位置: 首页>>代码示例>>PHP>>正文


PHP JemHelper::retrieveIP方法代码示例

本文整理汇总了PHP中JemHelper::retrieveIP方法的典型用法代码示例。如果您正苦于以下问题:PHP JemHelper::retrieveIP方法的具体用法?PHP JemHelper::retrieveIP怎么用?PHP JemHelper::retrieveIP使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在JemHelper的用法示例。


在下文中一共展示了JemHelper::retrieveIP方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getItem

 /**
  * Method to get a single record.
  *
  * @param	integer	The id of the primary key.
  *
  * @return	mixed	Object on success, false on failure.
  */
 public function getItem($pk = null)
 {
     $jemsettings = JEMAdmin::config();
     if ($item = parent::getItem($pk)) {
         $files = JEMAttachment::getAttachments('venue' . $item->id);
         $item->attachments = $files;
     }
     $item->author_ip = $jemsettings->storeip ? JemHelper::retrieveIP() : false;
     if (empty($item->id)) {
         $item->country = $jemsettings->defaultCountry;
     }
     if (!empty($item->locimage)) {
         if (strpos($item->locimage, 'images/') !== false) {
             # the image selected contains the images path
         } else {
             # the image selected doesn't have the /images/ path
             # we're looking at the locimage so we'll append the venues folder
             $item->locimage = 'images/jem/venues/' . $item->locimage;
         }
     }
     return $item;
 }
开发者ID:JKoelman,项目名称:JEM-3,代码行数:29,代码来源:venue.php

示例2: getItem

 /**
  * Method to get venue data.
  *
  * @param integer	The id of the venue.
  * @return mixed item data object on success, false on failure.
  */
 public function getItem($itemId = null)
 {
     $jemsettings = JEMHelper::config();
     // Initialise variables.
     $itemId = (int) (!empty($itemId)) ? $itemId : $this->getState('venue.id');
     // Get a row instance.
     $table = $this->getTable();
     // Attempt to load the row.
     $return = $table->load($itemId);
     // Check for a table object error.
     if ($return === false && $table->getError()) {
         $this->setError($table->getError());
         return false;
     }
     $properties = $table->getProperties(1);
     $value = JArrayHelper::toObject($properties, 'JObject');
     // Convert attrib field to Registry.
     //$registry = new JRegistry();
     //$registry->loadString($value->attribs);
     $globalsettings = JemHelper::globalattribs();
     $globalregistry = new JRegistry();
     $globalregistry->loadString($globalsettings);
     $value->params = clone $globalregistry;
     //$value->params->merge($registry);
     // Compute selected asset permissions.
     $user = JFactory::getUser();
     $userId = $user->get('id');
     $asset = 'com_jem.venue.' . $value->id;
     // Check general edit permission first.
     if ($user->authorise('core.edit', $asset)) {
         $value->params->set('access-edit', true);
     } elseif (!empty($userId) && $user->authorise('core.edit.own', $asset)) {
         // Check for a valid user and that they are the owner.
         if ($userId == $value->created_by) {
             $value->params->set('access-edit', true);
         }
     }
     // Check edit state permission.
     if ($itemId) {
         // Existing item
         $value->params->set('access-change', $user->authorise('core.edit.state', $asset));
     } else {
         $value->params->set('access-change', $user->authorise('core.edit.state', 'com_jem'));
     }
     $value->author_ip = $jemsettings->storeip ? JemHelper::retrieveIP() : false;
     $files = JemAttachment::getAttachments('venue' . $itemId);
     $value->attachments = $files;
     if (empty($itemId)) {
         $value->country = $jemsettings->defaultCountry;
     }
     if (!empty($value->locimage)) {
         if (strpos($value->locimage, 'images/') !== false) {
             # the image selected contains the images path
         } else {
             # the image selected doesn't have the /images/ path
             # we're looking at the locimage so we'll append the venues folder
             $value->locimage = 'images/jem/venues/' . $value->locimage;
         }
     }
     return $value;
 }
开发者ID:JKoelman,项目名称:JEM-3,代码行数:67,代码来源:editvenue.php

示例3: getItem

 /**
  * Method to get event data.
  *
  * @param integer	The id of the event.
  *
  * @return mixed item data object on success, false on failure.
  */
 public function getItem($itemId = null)
 {
     $jemsettings = JemHelper::config();
     // Initialise variables.
     $itemId = (int) (!empty($itemId)) ? $itemId : $this->getState('event.id');
     // Get a row instance.
     $table = $this->getTable();
     // Attempt to load the row.
     $return = $table->load($itemId);
     // Check for a table object error.
     if ($return === false && $table->getError()) {
         $this->setError($table->getError());
         return false;
     }
     $properties = $table->getProperties(1);
     $value = JArrayHelper::toObject($properties, 'JObject');
     // Backup current recurrence values
     if ($value->id) {
         $value->recurr_bak = new stdClass();
         foreach (get_object_vars($value) as $k => $v) {
             if (strncmp('recurrence_', $k, 11) === 0) {
                 $value->recurr_bak->{$k} = $v;
             }
         }
     }
     // Convert attrib field to Registry.
     $registry = new JRegistry();
     $registry->loadString($value->attribs);
     $globalregistry = JEMHelper::globalattribs();
     $value->params = clone $globalregistry;
     $value->params->merge($registry);
     // Compute selected asset permissions.
     $user = JFactory::getUser();
     $userId = $user->get('id');
     //$asset = 'com_jem.event.' . $value->id;
     $asset = 'com_jem';
     $db = JFactory::getDbo();
     $query = $db->getQuery(true);
     $query->select(array('count(id)'));
     $query->from('#__jem_register');
     $query->where(array('event= ' . $db->quote($itemId), 'waiting= 0'));
     $db->setQuery($query);
     $res = $db->loadResult();
     $value->booked = $res;
     $files = JEMAttachment::getAttachments('event' . $itemId);
     $value->attachments = $files;
     // Check general edit permission first.
     if ($user->authorise('core.edit', $asset)) {
         $value->params->set('access-edit', true);
     } elseif (!empty($userId) && $user->authorise('core.edit.own', $asset)) {
         // Check for a valid user and that they are the owner.
         if ($userId == $value->created_by) {
             $value->params->set('access-edit', true);
         }
     }
     // Check edit state permission.
     if ($itemId) {
         // Existing item
         $value->params->set('access-change', $user->authorise('core.edit.state', $asset));
     } else {
         // New item.
         $catId = (int) $this->getState('event.catid');
         if ($catId) {
             $value->params->set('access-change', $user->authorise('core.edit.state', 'com_jem.category.' . $catId));
             $value->catid = $catId;
         } else {
             $value->params->set('access-change', $user->authorise('core.edit.state', 'com_jem'));
         }
     }
     ////////////////
     $venueQuery = $db->getQuery(true);
     $venueQuery->select(array('alias'));
     $venueQuery->from('#__jem_venues');
     $venueQuery->where(array('id= ' . $db->quote($value->locid)));
     $db->setQuery($venueQuery);
     $venueResult = $db->loadResult();
     $value->localias = $venueResult;
     ////////////////
     $value->author_ip = $jemsettings->storeip ? JemHelper::retrieveIP() : false;
     $value->articletext = $value->introtext;
     if (!empty($value->fulltext)) {
         $value->articletext .= '<hr id="system-readmore" />' . $value->fulltext;
     }
     return $value;
 }
开发者ID:abradbury,项目名称:Orienteering-Website,代码行数:92,代码来源:editevent.php

示例4: userregister

 /**
  * Saves the registration to the database
  *
  * @access public
  * @return int register id on success, else false
  *
  */
 function userregister()
 {
     $user = JFactory::getUser();
     $jemsettings = JEMHelper::config();
     $eventid = (int) $this->_registerid;
     $uid = (int) $user->get('id');
     $onwaiting = 0;
     // Must be logged in
     if ($uid < 1) {
         JError::raiseError(403, JText::_('COM_JEM_ALERTNOTAUTH'));
         return;
     }
     try {
         $event = $this->getItem($eventid);
     } catch (Exception $e) {
         $event = false;
     }
     if (empty($event)) {
         $this->setError(JText::_('COM_JEM_EVENT_ERROR_EVENT_NOT_FOUND'));
         return false;
     }
     if ($event->maxplaces > 0) {
         // check if the user should go on waiting list
         if ($event->booked >= $event->maxplaces) {
             if (!$event->waitinglist) {
                 $this->setError(JText::_('COM_JEM_ERROR_REGISTER_EVENT_IS_FULL'));
                 return false;
             }
             $onwaiting = 1;
         }
     }
     // IP
     $uip = $jemsettings->storeip ? JemHelper::retrieveIP() : false;
     $obj = new stdClass();
     $obj->event = (int) $eventid;
     $obj->waiting = $onwaiting;
     $obj->uid = (int) $uid;
     $obj->uregdate = gmdate('Y-m-d H:i:s');
     $obj->uip = $uip;
     $this->_db->insertObject('#__jem_register', $obj);
     return $this->_db->insertid();
 }
开发者ID:JKoelman,项目名称:JEM-3,代码行数:49,代码来源:event.php

示例5: getItem

	/**
	 * Method to get a single record.
	 *
	 * @param	integer	The id of the primary key.
	 *
	 * @return	mixed	Object on success, false on failure.
	 */
	public function getItem($pk = null)
	{
		$jemsettings = JEMAdmin::config();

		if ($item = parent::getItem($pk)) {
			$files = JEMAttachment::getAttachments('venue'.$item->id);
			$item->attachments = $files;
		}

		$item->author_ip = $jemsettings->storeip ? JemHelper::retrieveIP() : false;

		if (empty($item->id)) {
			$item->country = $jemsettings->defaultCountry;
		}

		return $item;
	}
开发者ID:BillVGN,项目名称:PortalPRP,代码行数:24,代码来源:venue.php

示例6: getItem


//.........这里部分代码省略.........
     //$asset = 'com_jem.event.' . $value->id;
     $asset = 'com_jem';
     $db = JFactory::getDbo();
     $query = $db->getQuery(true);
     $query->select(array('count(id)'));
     $query->from('#__jem_register');
     $query->where(array('event= ' . $db->quote($itemId), 'waiting= 0'));
     $db->setQuery($query);
     $res = $db->loadResult();
     $value->booked = $res;
     $files = JEMAttachment::getAttachments('event' . $itemId);
     $value->attachments = $files;
     ################
     ## RECURRENCE ##
     ################
     # check recurrence
     if ($value->recurrence_group) {
         # this event is part of a recurrence-group
         #
         # check for groupid & groupid_ref (recurrence_table)
         # - groupid		= $item->recurrence_group
         # - groupid_ref	= $item->recurrence_group
         # - Itemid		= $item->id
         $db = JFactory::getDbo();
         $query = $db->getQuery(true);
         $query->select(array('count(id)'));
         $query->from('#__jem_recurrence');
         $query->where(array('groupid= ' . $value->recurrence_group, 'itemid= ' . $value->id, 'groupid = groupid_ref'));
         $db->setQuery($query);
         $rec_groupset_check = $db->loadResult();
         if ($rec_groupset_check == '1') {
             $value->recurrence_groupcheck = true;
         } else {
             $value->recurrence_groupcheck = false;
         }
     } else {
         $value->recurrence_groupcheck = false;
     }
     ##############
     ## HOLIDAYS ##
     ##############
     # Retrieve dates that are holidays and enabled.
     $db = JFactory::getDbo();
     $query = $db->getQuery(true);
     $query->select('holiday');
     $query->from('#__jem_dates');
     $query->where(array('enabled = 1', 'holiday = 1'));
     $db->setQuery($query);
     $holidays = $db->loadColumn();
     if ($holidays) {
         $value->recurrence_country_holidays = true;
     } else {
         $value->recurrence_country_holidays = false;
     }
     // Check general edit permission first.
     if ($user->authorise('core.edit', $asset)) {
         $value->params->set('access-edit', true);
     } elseif (!empty($userId) && $user->authorise('core.edit.own', $asset)) {
         // Check for a valid user and that they are the owner.
         if ($userId == $value->created_by) {
             $value->params->set('access-edit', true);
         }
     }
     // Check edit state permission.
     if ($itemId) {
         // Existing item
         $value->params->set('access-change', $user->authorise('core.edit.state', $asset));
     } else {
         // New item.
         $catId = (int) $this->getState('event.catid');
         if ($catId) {
             $value->params->set('access-change', $user->authorise('core.edit.state', 'com_jem.category.' . $catId));
             $value->catid = $catId;
         } else {
             $access_change = $user->authorise('core.edit.state', 'com_jem');
             $value->params->set('access-change', $access_change);
         }
     }
     $value->author_ip = $jemsettings->storeip ? JemHelper::retrieveIP() : false;
     $value->articletext = $value->introtext;
     if (!empty($value->fulltext)) {
         $value->articletext .= '<hr id="system-readmore" />' . $value->fulltext;
     }
     if (!empty($value->datimage)) {
         if (strpos($value->datimage, 'images/') !== false) {
             # the image selected contains the images path
         } else {
             # the image selected doesn't have the /images/ path
             # we're looking at the locimage so we'll append the venues folder
             $value->datimage = 'images/jem/events/' . $value->datimage;
         }
     }
     $admin = JFactory::getUser()->authorise('core.manage', 'com_jem');
     if ($admin) {
         $value->admin = true;
     } else {
         $value->admin = false;
     }
     return $value;
 }
开发者ID:JKoelman,项目名称:JEM-3,代码行数:101,代码来源:editevent.php

示例7: getItem

 /**
  * Method to get a single record.
  *
  * @param	integer	The id of the primary key.
  *
  * @return	mixed	Object on success, false on failure.
  */
 public function getItem($pk = null)
 {
     $jemsettings = JEMAdmin::config();
     if ($item = parent::getItem($pk)) {
         // Convert the params field to an array.
         $registry = new JRegistry();
         $registry->loadString($item->attribs);
         $item->attribs = $registry->toArray();
         // Convert the metadata field to an array.
         $registry = new JRegistry();
         $registry->loadString($item->metadata);
         $item->metadata = $registry->toArray();
         $item->articletext = trim($item->fulltext) != '' ? $item->introtext . "<hr id=\"system-readmore\" />" . $item->fulltext : $item->introtext;
         $db = JFactory::getDbo();
         $query = $db->getQuery(true);
         $query->select(array('count(id)'));
         $query->from('#__jem_register');
         $query->where(array('event= ' . $db->quote($item->id), 'waiting= 0'));
         $db->setQuery($query);
         $res = $db->loadResult();
         $item->booked = $res;
         $files = JEMAttachment::getAttachments('event' . $item->id);
         $item->attachments = $files;
         ################
         ## RECURRENCE ##
         ################
         # check recurrence
         if ($item->recurrence_group) {
             # this event is part of a recurrence-group
             #
             # check for groupid & groupid_ref (recurrence_table)
             # - groupid		= $item->recurrence_group
             # - groupid_ref	= $item->recurrence_group
             # - Itemid		= $item->id
             $db = JFactory::getDbo();
             $query = $db->getQuery(true);
             $query->select(array('count(id)'));
             $query->from('#__jem_recurrence');
             $query->where(array('groupid= ' . $item->recurrence_group, 'itemid= ' . $item->id, 'groupid = groupid_ref'));
             $db->setQuery($query);
             $rec_groupset_check = $db->loadResult();
             if ($rec_groupset_check == '1') {
                 $item->recurrence_groupcheck = true;
             } else {
                 $item->recurrence_groupcheck = false;
             }
         } else {
             $item->recurrence_groupcheck = false;
         }
         ##############
         ## HOLIDAYS ##
         ##############
         # Retrieve dates that are holidays and enabled.
         $db = JFactory::getDbo();
         $query = $db->getQuery(true);
         $query->select('holiday');
         $query->from('#__jem_dates');
         $query->where(array('enabled = 1', 'holiday = 1'));
         $db->setQuery($query);
         $holidays = $db->loadColumn();
         if ($holidays) {
             $item->recurrence_country_holidays = true;
         } else {
             $item->recurrence_country_holidays = false;
         }
         $item->author_ip = $jemsettings->storeip ? JemHelper::retrieveIP() : false;
         if (empty($item->id)) {
             $item->country = $jemsettings->defaultCountry;
         }
         if (!empty($item->datimage)) {
             if (strpos($item->datimage, 'images/') !== false) {
                 # the image selected contains the images path
             } else {
                 # the image selected doesn't have the /images/ path
                 # we're looking at the locimage so we'll append the venues folder
                 $item->datimage = 'images/jem/events/' . $item->datimage;
             }
         }
         $admin = JFactory::getUser()->authorise('core.manage', 'com_jem');
         if ($admin) {
             $item->admin = true;
         } else {
             $item->admin = false;
         }
     }
     return $item;
 }
开发者ID:JKoelman,项目名称:JEM-3,代码行数:94,代码来源:event.php

示例8: getItem

	/**
	 * Method to get a single record.
	 *
	 * @param	integer	The id of the primary key.
	 *
	 * @return	mixed	Object on success, false on failure.
	 */
	public function getItem($pk = null)
	{
		$jemsettings = JEMAdmin::config();

		if ($item = parent::getItem($pk)){
			// Convert the params field to an array.
			$registry = new JRegistry;
			$registry->loadString($item->attribs);
			$item->attribs = $registry->toArray();

			// Convert the metadata field to an array.
			$registry = new JRegistry;
			$registry->loadString($item->metadata);
			$item->metadata = $registry->toArray();

			$item->articletext = trim($item->fulltext) != '' ? $item->introtext . "<hr id=\"system-readmore\" />" . $item->fulltext : $item->introtext;

			$db = JFactory::getDbo();

			$query = $db->getQuery(true);
			$query->select(array('count(id)'));
			$query->from('#__jem_register');
			$query->where(array('event= '.$db->quote($item->id), 'waiting= 0'));

			$db->setQuery($query);
			$res = $db->loadResult();
			$item->booked = $res;

			$files = JEMAttachment::getAttachments('event'.$item->id);
			$item->attachments = $files;

			if ($item->id){
				// Store current recurrence values
				$item->recurr_bak = new stdClass;
				foreach (get_object_vars($item) as $k => $v) {
					if (strncmp('recurrence_', $k, 11) === 0) {
						$item->recurr_bak->$k = $v;
					}
				}

				$item->recurrence_type 			= '';
				$item->recurrence_number 		= '';
				$item->recurrence_byday 		= '';
				$item->recurrence_counter 		= '';
				$item->recurrence_first_id 		= '';
				$item->recurrence_limit 		= '';
				$item->recurrence_limit_date	= '';
			}

			$item->author_ip = $jemsettings->storeip ? JemHelper::retrieveIP() : false;

			if (empty($item->id)){
				$item->country = $jemsettings->defaultCountry;
			}
		}

		return $item;
	}
开发者ID:BillVGN,项目名称:PortalPRP,代码行数:65,代码来源:event.php

示例9: getItem

	/**
	 * Method to get venue data.
	 *
	 * @param integer	The id of the venue.
	 * @return mixed item data object on success, false on failure.
	 */
	public function getItem($itemId = null)
	{
		$jemsettings = JEMHelper::config();

		// Initialise variables.
		$itemId = (int) (!empty($itemId)) ? $itemId : $this->getState('venue.id');

		// Get a row instance.
		$table = $this->getTable();

		// Attempt to load the row.
		$return = $table->load($itemId);

		// Check for a table object error.
		if ($return === false && $table->getError()) {
			$this->setError($table->getError());
			return false;
		}

		$properties = $table->getProperties(1);
		$value = JArrayHelper::toObject($properties, 'JObject');

		// Convert attrib field to Registry.
		//$registry = new JRegistry();
		//$registry->loadString($value->attribs);

		$globalregistry = JemHelper::globalattribs();

		$value->params = clone $globalregistry;
		//$value->params->merge($registry);

		// Compute selected asset permissions.
		$user = JemFactory::getUser();

		// Check edit permission.
		$value->params->set('access-edit', $user->can('edit', 'venue', $value->id, $value->created_by));

		// Check edit state permission.
		$value->params->set('access-change', $user->can('publish', 'venue', $value->id, $value->created_by));

		$value->author_ip = $jemsettings->storeip ? JemHelper::retrieveIP() : false;

		$files = JemAttachment::getAttachments('venue' . $itemId);
		$value->attachments = $files;

		if (empty($itemId)) {
			$value->country = $jemsettings->defaultCountry;
		}

		return $value;
	}
开发者ID:BillVGN,项目名称:PortalPRP,代码行数:57,代码来源:editvenue.php


注:本文中的JemHelper::retrieveIP方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。