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;
162 return _elgg_services()->stickyForms->getStickyValues($form_name, $filter_result);
175 _elgg_services()->stickyForms->clearStickyValue($form_name, $variable);
212 $q = str_replace(array(
'_',
'%'), array(
'\_',
'\%'), $q);
214 $match_on =
get_input(
'match_on',
'all');
216 if (!is_array($match_on)) {
217 $match_on = array($match_on);
221 if (in_array(
'all', $match_on)) {
222 $match_on = array(
'users',
'groups');
234 foreach ($match_on as $match_type) {
235 switch ($match_type) {
240 'joins' => array(
"JOIN {$dbprefix}users_entity ue ON e.guid = ue.guid"),
243 "(ue.name LIKE '$q%' OR ue.name LIKE '% $q%' OR ue.username LIKE '$q%')" 248 if (!empty($entities)) {
249 foreach ($entities as
$entity) {
251 if (in_array(
'groups', $match_on)) {
254 $value = $entity->username;
258 'use_hover' =>
false,
260 'class' =>
'elgg-autocomplete-item',
261 'title' => $entity->name,
265 'use_hover' =>
false,
270 'name' => $entity->name,
271 'desc' => $entity->username,
272 'guid' => $entity->guid,
276 'url' => $entity->getURL(),
277 'html' =>
elgg_view(
'input/userpicker/item', array(
282 $results[$entity->name . rand(1, 100)] =
$result;
297 'joins' => array(
"JOIN {$dbprefix}groups_entity ge ON e.guid = ge.guid"),
299 "(ge.name LIKE '$q%' OR ge.name LIKE '% $q%' OR ge.description LIKE '% $q%')" 304 if (!empty($entities)) {
305 foreach ($entities as
$entity) {
307 'use_hover' =>
false,
308 'class' =>
'elgg-autocomplete-item',
309 'full_view' =>
false,
311 'title' => $entity->name,
315 'use_hover' =>
false,
320 'name' => $entity->name,
321 'desc' => strip_tags($entity->description),
322 'guid' => $entity->guid,
324 'value' => $entity->guid,
326 'url' => $entity->getURL(),
329 $results[$entity->name . rand(1, 100)] =
$result;
338 'relationship' =>
'friend',
339 'relationship_guid' =>
$user->getGUID(),
340 'joins' => array(
"JOIN {$dbprefix}users_entity ue ON e.guid = ue.guid"),
343 "(ue.name LIKE '$q%' OR ue.name LIKE '% $q%' OR ue.username LIKE '$q%')" 348 if (!empty($entities)) {
349 foreach ($entities as
$entity) {
352 'use_hover' =>
false,
354 'class' =>
'elgg-autocomplete-item',
355 'title' => $entity->name,
359 'use_hover' =>
false,
364 'name' => $entity->name,
365 'desc' => $entity->username,
366 'guid' => $entity->guid,
368 'value' => $entity->username,
370 'url' => $entity->getURL(),
371 'html' =>
elgg_view(
'input/userpicker/item', array(
376 $results[$entity->name . rand(1, 100)] =
$result;
382 header(
"HTTP/1.0 400 Bad Request",
true);
383 echo "livesearch: unknown match_on of $match_type";
390 header(
"Content-Type: application/json;charset=utf-8");
391 echo json_encode(array_values($results));
404 if (is_array($array)) {
448 if (get_magic_quotes_gpc()) {
449 $_POST = array_map(
'_elgg_stripslashes_deep', $_POST);
450 $_GET = array_map(
'_elgg_stripslashes_deep', $_GET);
451 $_COOKIE = array_map(
'_elgg_stripslashes_deep', $_COOKIE);
452 $_REQUEST = array_map(
'_elgg_stripslashes_deep', $_REQUEST);
453 if (!empty($_SERVER[
'REQUEST_URI'])) {
454 $_SERVER[
'REQUEST_URI'] = stripslashes($_SERVER[
'REQUEST_URI']);
456 if (!empty($_SERVER[
'QUERY_STRING'])) {
457 $_SERVER[
'QUERY_STRING'] = stripslashes($_SERVER[
'QUERY_STRING']);
459 if (!empty($_SERVER[
'HTTP_REFERER'])) {
460 $_SERVER[
'HTTP_REFERER'] = stripslashes($_SERVER[
'HTTP_REFERER']);
462 if (!empty($_SERVER[
'PATH_INFO'])) {
463 $_SERVER[
'PATH_INFO'] = stripslashes($_SERVER[
'PATH_INFO']);
465 if (!empty($_SERVER[
'PHP_SELF'])) {
466 $_SERVER[
'PHP_SELF'] = stripslashes($_SERVER[
'PHP_SELF']);
468 if (!empty($_SERVER[
'PATH_TRANSLATED'])) {
469 $_SERVER[
'PATH_TRANSLATED'] = stripslashes($_SERVER[
'PATH_TRANSLATED']);
475 $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.