68 $page =
$url[
'scheme'] .
"://" .
$url[
'host'];
70 if (isset(
$url[
'port']) &&
$url[
'port']) {
71 $page .=
":" .
$url[
'port'];
74 $page = trim($page,
"/");
89 return filter_var($address, FILTER_VALIDATE_EMAIL) === $address;
163 return _elgg_services()->stickyForms->getStickyValues($form_name, $filter_result);
176 _elgg_services()->stickyForms->clearStickyValue($form_name, $variable);
213 $q = str_replace(array(
'_',
'%'), array(
'\_',
'\%'), $q);
215 $match_on =
get_input(
'match_on',
'all');
217 if (!is_array($match_on)) {
218 $match_on = array($match_on);
222 if (in_array(
'all', $match_on)) {
223 $match_on = array(
'users',
'groups');
235 foreach ($match_on as $match_type) {
236 switch ($match_type) {
241 'joins' => array(
"JOIN {$dbprefix}users_entity ue ON e.guid = ue.guid"),
244 "(ue.name LIKE '$q%' OR ue.name LIKE '% $q%' OR ue.username LIKE '$q%')" 249 if (!empty($entities)) {
250 foreach ($entities as
$entity) {
252 if (in_array(
'groups', $match_on)) {
255 $value = $entity->username;
259 'use_hover' =>
false,
261 'class' =>
'elgg-autocomplete-item',
262 'title' => $entity->name,
266 'use_hover' =>
false,
271 'name' => $entity->name,
272 'desc' => $entity->username,
273 'guid' => $entity->guid,
277 'url' => $entity->getURL(),
278 'html' =>
elgg_view(
'input/userpicker/item', array(
283 $results[$entity->name . rand(1, 100)] =
$result;
298 'joins' => array(
"JOIN {$dbprefix}groups_entity ge ON e.guid = ge.guid"),
300 "(ge.name LIKE '$q%' OR ge.name LIKE '% $q%' OR ge.description LIKE '% $q%')" 305 if (!empty($entities)) {
306 foreach ($entities as
$entity) {
308 'use_hover' =>
false,
309 'class' =>
'elgg-autocomplete-item',
310 'full_view' =>
false,
312 'title' => $entity->name,
316 'use_hover' =>
false,
321 'name' => $entity->name,
322 'desc' => strip_tags($entity->description),
323 'guid' => $entity->guid,
325 'value' => $entity->guid,
327 'url' => $entity->getURL(),
330 $results[$entity->name . rand(1, 100)] =
$result;
339 'relationship' =>
'friend',
340 'relationship_guid' =>
$user->getGUID(),
341 'joins' => array(
"JOIN {$dbprefix}users_entity ue ON e.guid = ue.guid"),
344 "(ue.name LIKE '$q%' OR ue.name LIKE '% $q%' OR ue.username LIKE '$q%')" 349 if (!empty($entities)) {
350 foreach ($entities as
$entity) {
353 'use_hover' =>
false,
355 'class' =>
'elgg-autocomplete-item',
356 'title' => $entity->name,
360 'use_hover' =>
false,
365 'name' => $entity->name,
366 'desc' => $entity->username,
367 'guid' => $entity->guid,
369 'value' => $entity->username,
371 'url' => $entity->getURL(),
372 'html' =>
elgg_view(
'input/userpicker/item', array(
377 $results[$entity->name . rand(1, 100)] =
$result;
383 header(
"HTTP/1.0 400 Bad Request",
true);
384 echo "livesearch: unknown match_on of $match_type";
391 header(
"Content-Type: application/json");
392 echo json_encode(array_values($results));
405 if (is_array($array)) {
449 if (get_magic_quotes_gpc()) {
450 $_POST = array_map(
'_elgg_stripslashes_deep', $_POST);
451 $_GET = array_map(
'_elgg_stripslashes_deep', $_GET);
452 $_COOKIE = array_map(
'_elgg_stripslashes_deep', $_COOKIE);
453 $_REQUEST = array_map(
'_elgg_stripslashes_deep', $_REQUEST);
454 if (!empty($_SERVER[
'REQUEST_URI'])) {
455 $_SERVER[
'REQUEST_URI'] = stripslashes($_SERVER[
'REQUEST_URI']);
457 if (!empty($_SERVER[
'QUERY_STRING'])) {
458 $_SERVER[
'QUERY_STRING'] = stripslashes($_SERVER[
'QUERY_STRING']);
460 if (!empty($_SERVER[
'HTTP_REFERER'])) {
461 $_SERVER[
'HTTP_REFERER'] = stripslashes($_SERVER[
'HTTP_REFERER']);
463 if (!empty($_SERVER[
'PATH_INFO'])) {
464 $_SERVER[
'PATH_INFO'] = stripslashes($_SERVER[
'PATH_INFO']);
466 if (!empty($_SERVER[
'PHP_SELF'])) {
467 $_SERVER[
'PHP_SELF'] = stripslashes($_SERVER[
'PHP_SELF']);
469 if (!empty($_SERVER[
'PATH_TRANSLATED'])) {
470 $_SERVER[
'PATH_TRANSLATED'] = stripslashes($_SERVER[
'PATH_TRANSLATED']);
476 $events->registerHandler(
'init',
'system',
'_elgg_input_init');
elgg_get_config($name, $site_guid=0)
Get an Elgg configuration value.
elgg parse_url
Parse a URL into its parts.
elgg_view_list_item($item, array $vars=array())
View an item in a list.
sanitise_string($string)
Wrapper function for alternate English spelling (.
const ELGG_ENTITIES_ANY_VALUE
elgg echo
Translates a string.
elgg_get_entities(array $options=array())
Returns an array of entities with optional filtering.
elgg_trigger_plugin_hook($hook, $type, $params=null, $returnvalue=null)
elgg_register_page_handler($identifier, $function)
Registers a page handler for a particular identifier.
elgg_get_site_url($site_guid=0)
Get the URL for the current (or specified) site.
elgg_view($view, $vars=array(), $bypass=false, $ignored=false, $viewtype= '')
Return a parsed view.
elgg_is_active_plugin($plugin_id, $site_guid=null)
Returns if a plugin is active for a current site.
sanitise_int($int, $signed=true)
Sanitizes an integer for database use.
elgg_get_logged_in_user_entity()
Return the current logged in user, or null if no user is logged in.
clearfix elgg elgg elgg elgg page header
elgg_get_entities_from_relationship($options)
Return entities matching a given query joining against a relationship.
elgg_view_entity_icon(\ElggEntity $entity, $size= 'medium', $vars=array())
View the icon of an entity.