Example #1
0
 public function testElggGetEntitiesFromMetadata()
 {
     global $CONFIG, $METASTRINGS_CACHE, $METASTRINGS_DEADNAME_CACHE;
     $METASTRINGS_CACHE = $METASTRINGS_DEADNAME_CACHE = array();
     $this->object->title = 'Meta Unit Test';
     $this->object->save();
     $this->create_metastring('metaUnitTest');
     $this->create_metastring('tested');
     // create_metadata returns id of metadata on success
     $this->assertTrue(create_metadata($this->object->guid, 'metaUnitTest', 'tested'));
     // check value with improper case
     $options = array('metadata_names' => 'metaUnitTest', 'metadata_values' => 'Tested', 'limit' => 10, 'metadata_case_sensitive' => TRUE);
     $this->assertFalse(elgg_get_entities_from_metadata($options));
     // compare forced case with ignored case
     $options = array('metadata_names' => 'metaUnitTest', 'metadata_values' => 'tested', 'limit' => 10, 'metadata_case_sensitive' => TRUE);
     $case_true = elgg_get_entities_from_metadata($options);
     $this->assertIsA($case_true, 'array');
     $options = array('metadata_names' => 'metaUnitTest', 'metadata_values' => 'Tested', 'limit' => 10, 'metadata_case_sensitive' => FALSE);
     $case_false = elgg_get_entities_from_metadata($options);
     $this->assertIsA($case_false, 'array');
     $this->assertIdentical($case_true, $case_false);
     // check deprecated get_entities_from_metadata() function
     $deprecated = get_entities_from_metadata('metaUnitTest', 'tested', '', '', 0, 10, 0, '', 0, FALSE, TRUE);
     $this->assertIdentical($deprecated, $case_true);
     // check entity list
     //$this->dump(list_entities_from_metadata('metaUnitTest', 'Tested', '', '', 0, 10, TRUE, TRUE, TRUE, FALSE));
     // clean up
     $this->delete_metastrings();
     $this->object->delete();
 }
function pages_draw_child($childentity, $path)
{
    $child = "\n\t\t{\n";
    $child .= "\t\t\t\"text\": \"<a href=\\\"{$childentity->getURL()}\\\">" . addslashes($childentity->title) . "</a>\"\n";
    $extras = "";
    $haschild = get_entities_from_metadata('parent_guid', $childentity->guid, '', '', 0, 9999);
    if ($haschild) {
        if (in_array($childentity->guid, $path)) {
            $extras .= "\t\t\t,\"expanded\": true";
            $extras .= "\t\t\t,\"children\": [\n";
            $childstring = "";
            foreach ($haschild as $subchild) {
                $childstringtemp = pages_draw_child($subchild, $path);
                if (!empty($childstringtemp)) {
                    if (!empty($childstring)) {
                        $childstring .= ", ";
                    }
                    $childstring .= $childstringtemp;
                }
            }
            $extras .= $childstring . "\n\t\t\t]\n";
        } else {
            $extras .= ",\t\t\t\"id\": \"{$childentity->getGUID()}\",\n\t\t\t\"hasChildren\": true\n";
        }
    }
    $child .= $extras . "\t\t}";
    return $child;
}
            					$lc++;
            					
            					} */
        }
    }
}
?>
			</div> </div> </div> </div>
	        <div class="clearfloat"></div>
	      
        </div>
		</td>
                        <td id="RightPane"  valign="top" width="22%" style="padding:20px 20px 10px 20px;height:100%;">
                            <!-- RightPane -->
<?php 
$profs = get_entities_from_metadata('issimpleuser', 'yes', 'user', '', '', 5);
?>


        <div class="index_box2">
		            <h2><?php 
echo "Latest Users";
?>
</h2>

			<div class="contentWrapper">
				<?php 
echo "<b><font color=\"gray\">There are currently " . $user_count . " registered users</font></b>";
?>
 
            </div>
 * http://radagast.biz
 *
 * Displays existing search definitions
 *
 */
$edit_msg = elgg_echo('form:edit');
$delete_msg = elgg_echo('form:delete');
$delete_confirm_msg = elgg_echo('form:search_definition_delete_confirm');
$search_page = elgg_echo('form:search_page_link');
$img_template = '<img border="0" width="16" height="16" alt="%s" title="%s" src="' . $CONFIG->wwwroot . 'mod/form/images/%s" />';
$edit_img = sprintf($img_template, $edit_msg, $edit_msg, "16-em-pencil.png");
$delete_img = sprintf($img_template, $delete_msg, $delete_msg, "16-em-cross.png");
$sd_template = <<<END
<a href="{$CONFIG->wwwroot}mod/form/manage_search_definition.php?sid=%s">{$edit_img}</a> |
<a onclick="return confirm('{$delete_confirm_msg}')" href="{$CONFIG->wwwroot}action/form/manage_search_definition?form_action=delete&sid=%s">{$delete_img}</a> |
<a href="{$CONFIG->wwwroot}mod/form/search.php?sid=%s">{$search_page}</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;%s (%s)
<br />
END;
$body = '<div class="contentWrapper">';
$form_id = get_input('form_id', 0);
$sds = get_entities_from_metadata('form_id', $form_id, 'object', 'form:search_definition');
if ($sds) {
    foreach ($sds as $sd) {
        $ident = $sd->getGUID();
        $body .= sprintf($sd_template, $ident, $ident, $ident, $sd->title, $sd->internalname);
    }
} else {
    $body .= '<p>' . elgg_echo('form:no_search_definitions') . '</p>';
}
$body .= '</div>';
print $body;
<?php

$page = get_input('page');
if ($page = get_entity($page)) {
    if ($page->canEdit()) {
        // Bring all child elements forward
        $parent = $page->parent_guid;
        if ($children = get_entities_from_metadata('parent_guid', $page->getGUID())) {
            foreach ($children as $child) {
                $child->parent_guid = $parent;
            }
        }
        if ($page->delete()) {
            system_message(elgg_echo('pages:delete:success'));
            if ($parent) {
                if ($parent = get_entity($parent)) {
                    forward($parent->getURL());
                    exit;
                }
            }
            forward('pg/pages/owned/' . $_SESSION['user']->username);
            exit;
        }
    }
}
register_error(elgg_echo('pages:delete:failure'));
forward($_SERVER['HTTP_REFERER']);
function form_get_profile_config($category, $type = 'group')
{
    if ($category) {
        $profile_config = get_entities_from_metadata('category', $category, 'object', 'form:profile_config');
        if ($profile_config) {
            return $profile_config[0];
        } else {
            $profile_config = new ElggObject();
            $profile_config->subtype = 'form:profile_config';
            $profile_config->owner_guid = 0;
            $profile_config->access_id = ACCESS_PUBLIC;
            $profile_config->category = $category;
            if ($profile_config->save()) {
                return $profile_config;
            }
        }
    }
    return null;
}
//   admin_gatekeeper();
// set the title
$title = "CREATE AND DISPLAY CSV";
// start building the main column of the page
$area2 = elgg_view_title($title);
// Add the form to this section
global $CONFIG;
/*
	$area2 .="<div class=\"filerepo_download\"><p><a href=\"";
	$area2 .=$vars['url'];
	$area2 .=$ourFileName;
	$area2 .="\">";
	$area2 .=elgg_echo("file:download");
	$area2 .="</a></p></div>";	
*/
$members = get_entities_from_metadata('issimpleuser', 'no', 'user', '', '', 10000);
set_time_limit(360000);
$stats_single = "GUID|SESAME|CREATOR|AFFILIATION|TITLE|RESOURCE LANGUAGE|METADATA LANGUAGE|DATE|CITATION|EDUCATIONAL DESCRIPTION|TECHNICAL DESCRIPTION|EDUCATIONAL CONTEXT|EDUCATIONAL INSTRUCTIONS|EDUCATIONAL OBJECTIVES|ASSESSMENT METHODS|EDUCATIONAL PREREQUISITES\r\n";
$stats_ident = "GUID|COUNT|Description1|Description2|Description3|Description4|Description5|Description6|Description7|Description8|Description9|Description10 \r\n";
$stats_rights = "GUID|IPR1|IPR2 \r\n";
$stats_qual = "GUID|COUNT|VALUE1|VALUE2|VALUE3 \r\n";
$stats_auth = "GUID|COUNT|NAME1|AFFIL1|FOAF1|NAME2|AFFIL2|FOAF2|NAME3|AFFIL3|FOAF3|NAME4|AFFIL4|FOAF4|NAME5|AFFIL5|FOAF5 \r\n ";
$stats_media = "GUID|COUNT|VALUE1|VALUE2|VALUE3|VALUE4|VALUE5|VALUE6|VALUE7|VALUE8|VALUE9|VALUE10 \r\n";
$stats_outc = "GUID|COUNT|VALUE1|VALUE2|VALUE3|VALUE4|VALUE5|VALUE6|VALUE7|VALUE8|VALUE9|VALUE10 \r\n";
$stats_res = "GUID|COUNT|VALUE1|VALUE2|VALUE3|VALUE4|VALUE5|VALUE6|VALUE7|VALUE8|VALUE9|VALUE10 \r\n";
$stats_edulev = "GUID|COUNT|VALUE1|VALUE2|VALUE3|VALUE4|VALUE5|VALUE6|VALUE7|VALUE8|VALUE9|VALUE10 \r\n";
$stats_compan = "GUID|COUNT|VALUE1|VALUE2|VALUE3|VALUE4|VALUE5|VALUE6|VALUE7|VALUE8|VALUE9|VALUE10 \r\n";
$stats_key = "GUID|COUNT|VALUE1|ONTOLOGY1|VALUE2|ONTOLOGY2|VALUE3|ONTOLOGY3|VALUE4|ONTOLOGY4|VALUE5|ONTOLOGY5|VALUE6|ONTOLOGY6|VALUE7|ONTOLOGY7|VALUE8|ONTOLOGY8|VALUE9|ONTOLOGY9|VALUE10|ONTOLOGY10|VALUE11|ONTOLOGY11|VALUE12|ONTOLOGY12 \r\n";
$stats_disc = "GUID|COUNT|VALUE1|ONTOLOGY1|VALUE2|ONTOLOGY2|VALUE3|ONTOLOGY3|VALUE4|ONTOLOGY4|VALUE5|ONTOLOGY5|VALUE6|ONTOLOGY6|VALUE7|ONTOLOGY7|VALUE8|ONTOLOGY8|VALUE9|ONTOLOGY9|VALUE10|ONTOLOGY10 \r\n";
$stats_spec = "GUID|COUNT|VALUE1|ONTOLOGY1|VALUE2|ONTOLOGY2|VALUE3|ONTOLOGY3|VALUE4|ONTOLOGY4|VALUE5|ONTOLOGY5|VALUE6|ONTOLOGY6|VALUE7|ONTOLOGY7|VALUE8|ONTOLOGY8|VALUE9|ONTOLOGY9|VALUE10|ONTOLOGY10 \r\n";
$stats_par = "GUID|COUNT|PARENT1|PARENT2|PARENT3|PARENT4|PARENT5|PARENT6|PARENT7|PARENT8|PARENT9|PARENT10 \r\n";
Example #8
0
action_gatekeeper();
admin_gatekeeper();
$type = get_input("type", "profile");
if ($type == "profile" || $type == "group") {
    $added = 0;
    $defaults = array();
    $max_fields = get_entities("object", "custom_" . $type . "_field", $CONFIG->site_guid, null, null, null, true) + 1;
    if ($type == "profile") {
        // Profile defaults
        $defaults = array('description' => 'longtext', 'briefdescription' => 'text', 'location' => 'tags', 'interests' => 'tags', 'skills' => 'tags', 'contactemail' => 'email', 'phone' => 'text', 'mobile' => 'text', 'website' => 'url');
    } elseif ($type == "group") {
        // Group defaults
        $defaults = array('description' => 'longtext', 'briefdescription' => 'text', 'interests' => 'tags', 'website' => 'url');
    }
    foreach ($defaults as $metadata_name => $metadata_type) {
        $count = get_entities_from_metadata("metadata_name", $metadata_name, "object", "custom_" . $type . "_field", $CONFIG->site_guid, "", null, null, null, true);
        if ($count == 0) {
            $field = new ElggObject();
            $field->owner_guid = $CONFIG->site_guid;
            $field->container_guid = $CONFIG->site_guid;
            $field->access_id = ACCESS_PUBLIC;
            $field->subtype = "custom_" . $type . "_field";
            $field->save();
            $field->metadata_name = $metadata_name;
            $field->metadata_type = $metadata_type;
            if ($type == "profile") {
                $field->show_on_register = "no";
                $field->mandatory = "no";
                $field->user_editable = "yes";
            }
            $field->order = $max_fields;
Example #9
0
 * @package profile_manager
 * @author ColdTrick IT Solutions
 * @copyright Coldtrick IT Solutions 2009
 * @link http://www.coldtrick.com/
 */
action_gatekeeper();
admin_gatekeeper();
$guid = get_input("guid");
if (!empty($guid)) {
    $entity = get_entity($guid);
    if ($entity->getSubtype() == CUSTOM_PROFILE_FIELDS_PROFILE_TYPE_SUBTYPE) {
        if ($entity->delete()) {
            $meta_name = "custom_profile_type";
            // remove corresponding profile type metadata from userobjects
            $entities_count = get_entities_from_metadata($meta_name, $guid, "user", "", null, null, null, null, null, true);
            $entities = get_entities_from_metadata($meta_name, $guid, "user", "", null, $entities_count);
            foreach ($entities as $entity) {
                // unset currently deleted profile type for user
                unset($entity->{$meta_name});
            }
            system_message(elgg_echo("profile_manager:action:profile_types:delete:succes"));
        } else {
            register_error(elgg_echo("profile_manager:action:profile_types:delete:error:delete"));
        }
    } else {
        register_error(elgg_echo("profile_manager:action:profile_types:delete:error:type"));
    }
} else {
    register_error(elgg_echo("profile_manager:action:profile_types:delete:error:guid"));
}
forward($_SERVER["HTTP_REFERER"]);
} else {
    if ($form_view == 'mine') {
        $user_guid = $user->getGUID();
    } else {
        if ($form_view == 'friends') {
            // handles up to 5000 friends
            $friends = $user->getFriends("", 5000);
            $user_guid = array();
            if ($friends) {
                foreach ($friends as $friend) {
                    $user_guid[] = $friend->getGUID();
                }
            }
        } else {
            if ($form_view == 'all') {
                $user_guid = 0;
            }
        }
    }
    if (!is_array($user_guid) || count($user_guid) > 0) {
        $count = get_entities_from_metadata('form_id', $form_id, 'object', 'form_data', $user_guid, $limit, $offset, "", 0, true);
        $entities = get_entities_from_metadata('form_id', $form_id, 'object', 'form_data', $user_guid, $limit, $offset, "", 0, false);
    }
}
if ($entities) {
    echo '<div class="form_listing">';
    echo form_view_entity_list($entities, $form, $count, $offset, $limit, false, true);
    echo '</div>';
} else {
    echo elgg_echo('form:no_search_results');
}
function siteaccess_users($meta_name, $meta_value, $limit = 10, $offset = 0)
{
    if (isset($meta_name) && isset($meta_value)) {
        $entities = get_entities_from_metadata($meta_name, $meta_value, 'user', '', 0, $limit, $offset, '', 0);
    }
    return $entities;
}
Example #12
0
/**
 * Return a list of entities suitable for display based on the given search criteria.
 * 
 * @see elgg_view_entity_list
 * 
 * @param mixed $meta_name Metadata name to search on
 * @param mixed $meta_value The value to match, optionally
 * @param string $entity_type The type of entity to look for, eg 'site' or 'object'
 * @param string $entity_subtype The subtype of the entity
 * @param int $limit Number of entities to display per page
 * @param true|false $fullview Whether or not to display the full view (default: true)
 * @param true|false $viewtypetoggle Whether or not to allow users to toggle to the gallery view. Default: true
 * @param true|false $pagination Display pagination? Default: true
 * 
 * @return string A list of entities suitable for display
 */
function list_entities_from_metadata($meta_name, $meta_value = "", $entity_type = "", $entity_subtype = "", $owner_guid = 0, $limit = 10, $fullview = true, $viewtypetoggle = true, $pagination = true)
{
    $offset = (int) get_input('offset');
    $limit = (int) $limit;
    $count = get_entities_from_metadata($meta_name, $meta_value, $entity_type, $entity_subtype, $owner_guid, $limit, $offset, "", 0, true);
    $entities = get_entities_from_metadata($meta_name, $meta_value, $entity_type, $entity_subtype, $owner_guid, $limit, $offset, "", 0, false);
    return elgg_view_entity_list($entities, $count, $offset, $limit, $fullview, $viewtypetoggle, $pagination);
}
Example #13
0
 */
global $CONFIG;
action_gatekeeper();
admin_gatekeeper();
$n = 0;
$skipped = 0;
$max_fields = get_entities("object", CUSTOM_PROFILE_FIELDS_PROFILE_SUBTYPE, $CONFIG->site_guid, null, null, null, true) + 1;
while ($translation = get_plugin_setting("admin_defined_profile_{$n}", 'profile')) {
    $metadata_name = "admin_defined_profile_{$n}";
    $metadata_label = $translation;
    $type = get_plugin_setting("admin_defined_profile_type_{$n}", 'profile');
    if (empty($type)) {
        $type = 'text';
    }
    $metadata_type = $type;
    $count = get_entities_from_metadata("metadata_name", $metadata_name, "object", CUSTOM_PROFILE_FIELDS_PROFILE_SUBTYPE, $CONFIG->site_guid, "", null, null, null, true);
    if ($count == 0) {
        $field = new ProfileManagerCustomProfileField();
        $field->save();
        $field->metadata_name = $metadata_name;
        $field->metadata_label = $metadata_label;
        $field->metadata_type = $metadata_type;
        $field->show_on_register = "no";
        $field->mandatory = "no";
        $field->order = $max_fields;
        $field->save();
        $max_fields++;
    } else {
        $skipped++;
    }
    $n++;
Example #14
0
 * Beechat
 * 
 * @package beechat
 * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
 * @author Beechannels <*****@*****.**>
 * @copyright Beechannels 2007-2010
 * @link http://beechannels.com/
 */
header('Content-type: application/json');
gatekeeper();
error_log("beechat:get_statuses");
$usernames = get_input('beechat_roster_items_usernames');
if (!empty($usernames)) {
    $iconSize = 'small';
    $rosterItemsUsernames = explode(',', $usernames);
    $userFriendsEntities = $_SESSION['user']->getFriends('', 1000000000, 0);
    $res = array();
    foreach ($rosterItemsUsernames as $value) {
        foreach ($userFriendsEntities as $friend) {
            if (strtolower($friend->username) == strtolower($value)) {
                $status = get_entities_from_metadata("state", "current", "object", "status", $friend->get('guid'));
                $res[$value] = $status != false ? $status[0]->description : '';
                break;
            }
        }
    }
    echo json_encode($res);
} else {
    echo json_encode(null);
}
exit;
Example #15
0
/**
 * Profile Manager
 * 
 * Admin stats view
 * 
 * @package profile_manager
 * @author ColdTrick IT Solutions
 * @copyright Coldtrick IT Solutions 2009
 * @link http://www.coldtrick.com/
 */
$total_users = get_entities("user", "", null, null, null, null, true);
$profile_types_count = get_entities("object", CUSTOM_PROFILE_FIELDS_PROFILE_TYPE_SUBTYPE, null, null, null, null, true);
$profile_entities = get_entities("object", CUSTOM_PROFILE_FIELDS_PROFILE_TYPE_SUBTYPE, null, null, $profile_types_count);
$profile_listing = "";
foreach ($profile_entities as $profile_type) {
    $count = get_entities_from_metadata("custom_profile_type", $profile_type->guid, "user", "", null, null, null, null, null, true);
    $profile_listing .= "<b>" . $profile_type->metadata_name . "</b>: " . $count . "<br />";
}
?>
<div class='contentWrapper'>
	<h3 class='settings'><?php 
echo elgg_echo("profile_manager:admin_stats:title");
?>
</h3>
	
	<?php 
echo elgg_echo("profile_manager:admin_stats:total");
?>
: <?php 
echo $total_users;
?>
Example #16
0
function westorElggMan_get_entities_from_metadata($meta_name, $meta_value = "", $entity_type = "", $entity_subtype = "", $owner_guid = 0, $limit = 10, $offset = 0, $order_by = "", $site_guid = 0, $count = FALSE, $case_sensitive = TRUE)
{
    if (function_exists("elgg_get_entities_from_metadata")) {
        $options = array();
        $options['metadata_names'] = $meta_name;
        if ($meta_value) {
            $options['metadata_values'] = $meta_value;
        }
        if ($entity_type) {
            $options['types'] = $entity_type;
        }
        if ($entity_subtype) {
            $options['subtypes'] = $entity_subtype;
        }
        if ($owner_guid) {
            if (is_array($owner_guid)) {
                $options['owner_guids'] = $owner_guid;
            } else {
                $options['owner_guid'] = $owner_guid;
            }
        }
        if ($limit) {
            $options['limit'] = $limit;
        }
        if ($offset) {
            $options['offset'] = $offset;
        }
        if ($order_by) {
            $options['order_by'];
        }
        if ($site_guid) {
            $options['site_guid'];
        }
        if ($count) {
            $options['count'] = $count;
        }
        // need to be able to pass false
        $options['metadata_case_sensitive'] = $case_sensitive;
        return elgg_get_entities_from_metadata($options);
        return elgg_get_entities_from_metadata(array('metadata_name' => $meta_name, 'metadata_value' => $meta_value, 'types' => $entity_type, 'subtypes' => $entity_subtype, 'limit' => $limit, 'owner_guid' => $owner_guid));
    } else {
        return get_entities_from_metadata($meta_name, $meta_value, $entity_type, $entity_subtype, $owner_guid, $limit, $offset, $order_by, $site_guid, $count, $case_sensitive);
    }
}
Example #17
0
 * iZAP izap_videos
 *
 * @package Elgg videotizer, by iZAP Web Solutions.
 * @license GNU Public License version 3
 * @Contact iZAP Team "<*****@*****.**>"
 * @Founder Tarun Jangra "<*****@*****.**>"
 * @link http://www.izap.in/
 * 
 */
global $SESSION;
global $CONFIG;
$search = get_input('search', FALSE);
$internalname = get_input('internalname');
$offset = (int) get_input('offset', 0);
$limit = (int) 30;
if (!$search) {
    $count = get_entities('object', 'izap_videos', 0, '', null, null, true);
    $entities = get_entities('object', 'izap_videos', 0, '', $limit, $offset);
    $baseUrl = $CONFIG->wwwroot . 'pg/videos/embed/' . $_SESSION['username'] . '/?internalname=' . $internalname;
} else {
    $count = get_entities_from_metadata('tags', $search, 'object', 'izap_videos', 0, '', '', '', '', TRUE);
    $entities = get_entities_from_metadata('tags', $search, 'object', 'izap_videos', 0, $limit, $offset);
    $baseUrl = $CONFIG->wwwroot . 'pg/videos/embed/' . $_SESSION['username'] . '/?internalname=' . $internalname . '&search=' . $search;
}
$videos .= elgg_view('izap_videos/embedvideos', array('entities' => $entities, 'internalname' => $internalname, 'offset' => $offset, 'count' => $count, 'limit' => $limit, 'baseUrl' => $baseUrl));
?>
<div id="videoIcons">
  <?php 
echo $videos;
?>
</div>
Example #18
0
File: all.php Project: eokyere/elgg
    switch ($filter) {
        case "newest":
            $objects = list_entities('group', "dgroup", 0, $limit, false);
            break;
        case "pop":
            $objects = list_entities_by_relationship_count('member', 'false', 'group', 'dgroup');
            break;
        case "active":
            $objects = list_entities_from_annotations("object", "dgroupforumtopic", "dgroup_topic_post", "", 40, 0, 0, false, true);
            break;
        case 'default':
            $objects = list_entities('group', "dgroup", 0, $limit, false);
            break;
    }
}
//get a dgroup count
$dgroup_count = get_entities("group", "dgroup", 0, "", 10, 0, true, 0, null);
//DISABLE find dgroups Sx: Search by tag needs to be reconstituted or removed from the left side of the people and project lists
//$area1 = elgg_view("dgroups/find");
//menu options
$area1 .= elgg_view("dgroups/side_menu");
//featured dgroups
$featured_dgroups = get_entities_from_metadata("featured_group", "yes", "group", "dgroup", 0, 10, false, false, false);
$area1 .= elgg_view("dgroups/featured", array("featured" => $featured_dgroups));
set_context($context);
$title = sprintf(elgg_echo("dgroups:all"), page_owner_entity()->name);
$area2 = elgg_view_title($title);
$area2 .= elgg_view('dgroups/contentwrapper', array('body' => elgg_view("dgroups/dgroup_sort_menu", array("count" => $dgroup_count, "filter" => $filter)) . $objects));
$body = elgg_view_layout('sidebar_boxes', $area1, $area2);
// Finally draw the page
page_draw($title, $body);
<?php

// Upgrade to solve login issue
if ($users = get_entities_from_metadata('validated_email', '', 'user', '', 0, 9999)) {
    foreach ($users as $user) {
        set_user_validation_status($user->guid, true, 'email');
    }
}
        $simple_search_criteria .= $title . "<br />";
        if ($search_type == "meta_data_between_search_criteria") {
            $simple_search_criteria .= elgg_echo("profile_manager:members:searchform:date:from") . " ";
            $simple_search_criteria .= elgg_view("input/" . $metadata_type, array("internalname" => $search_type . "[" . $metadata_name . "][FROM]"));
            $simple_search_criteria .= " " . elgg_echo("profile_manager:members:searchform:date:to") . " ";
            $simple_search_criteria .= elgg_view("input/" . $metadata_type, array("internalname" => $search_type . "[" . $metadata_name . "][TO]"));
        } else {
            $simple_search_criteria .= elgg_view("input/" . $metadata_type, array("internalname" => $search_type . "[" . $metadata_name . "]", "options" => $options));
        }
        $simple_search_criteria .= "</td></tr>";
    }
}
$advanced_search_criteria = "";
$advanced_search_fields_count = get_entities_from_metadata("advanced_search", "yes", "object", CUSTOM_PROFILE_FIELDS_PROFILE_SUBTYPE, $CONFIG->site_guid, "", null, null, null, true);
if ($advanced_search_fields_count > 0) {
    $advanced_search_fields = get_entities_from_metadata("advanced_search", "yes", "object", CUSTOM_PROFILE_FIELDS_PROFILE_SUBTYPE, $CONFIG->site_guid, $advanced_search_fields_count);
    foreach ($advanced_search_fields as $field) {
        if ($field->admin_only != "yes" || isadminloggedin()) {
            $ordered_advanced_search_fields[$field->order] = $field;
        }
    }
    ksort($ordered_advanced_search_fields);
    foreach ($ordered_advanced_search_fields as $field) {
        $metadata_name = $field->metadata_name;
        $metadata_type = $field->metadata_type;
        if ($metadata_type == "longtext" || $metadata_type == "plaintext") {
            $metadata_type = "text";
        }
        // make title
        $title = $field->getTitle();
        // get options
function form_pagesetup()
{
    global $CONFIG;
    // Set up menu and content setting for logged in users
    if (isloggedin()) {
        form_set_menu_items();
        if (form_get_user_content_status()) {
            add_menu(elgg_echo('item:object:form_data'), $CONFIG->wwwroot . "pg/form/" . $_SESSION['user']->username);
            // add a view content option to user settings
            extend_elgg_settings_page('form/settings/usersettings', 'usersettings/user');
        }
    }
    $context = get_context();
    $form_id = get_input('form_id', get_input('id', 0));
    if (!$form_id && ($sid = get_input('sid', 0))) {
        $form_id = get_entity($sid)->form_id;
    }
    if ($form_id) {
        $form = get_entity($form_id);
        set_page_owner($form->getOwner());
    }
    $username = page_owner_entity()->username;
    if (get_context() == 'admin') {
        $admin_url = $CONFIG->wwwroot . 'mod/form/manage_all_forms.php';
        if ($username) {
            $admin_url .= '?username='******'form:manage_forms_title'), $admin_url);
    }
    if ($context == 'form:admin' && isadminloggedin()) {
        // add_submenu_item(elgg_echo('form:add_new_profile_form_link'),$CONFIG->wwwroot.'mod/form/manage_form.php?username='******'&profile=1', '4formactions');
        // add_submenu_item(elgg_echo('form:add_new_group_profile_form_link'),$CONFIG->wwwroot.'mod/form/manage_form.php?username='******'&profile=2', '4formactions');
        add_submenu_item(elgg_echo('form:manage_group_profile_categories_title'), $CONFIG->wwwroot . 'mod/form/manage_group_profile_categories.php?username='******'4formactions');
    }
    if (in_array($context, array('form', 'form:content', 'form:admin')) && isadminloggedin()) {
        // currently only admins get to manage forms
        if ($form_id) {
            add_submenu_item(elgg_echo('form:edit_page_link'), $CONFIG->wwwroot . 'mod/form/manage_form.php?id=' . $form_id, '1formactions');
            if ($context == 'form:admin') {
                add_submenu_item(elgg_echo('form:preview_link_text'), $CONFIG->wwwroot . 'mod/form/form.php?id=' . $form_id . '&preview=true', '1formactions');
                add_submenu_item(elgg_echo('form:public_link_text'), $CONFIG->wwwroot . 'mod/form/form.php?id=' . $form_id, '1formactions');
                add_submenu_item(elgg_echo('form:list_search_definitions_link'), $CONFIG->wwwroot . 'mod/form/list_search_definitions.php?form_id=' . $form_id, '1formactions');
                add_submenu_item(elgg_echo('form:add_new_search_definition_link_text'), $CONFIG->wwwroot . 'mod/form/manage_search_definition.php?form_id=' . $form_id, '1formactions');
                add_submenu_item(elgg_echo('form:manage_translations_link'), $CONFIG->wwwroot . 'mod/form/manage_form_translation.php?id=' . $form_id, '1formactions');
            }
        }
        add_submenu_item(elgg_echo('form:manage_forms_title'), $CONFIG->wwwroot . 'mod/form/manage_all_forms.php?username='******'3formactions');
        if ($context == 'form:admin') {
            add_submenu_item(elgg_echo('form:add_new_link'), $CONFIG->wwwroot . 'mod/form/manage_form.php?username='******'4formactions');
            add_submenu_item(elgg_echo('form:list_all_fields_link'), $CONFIG->wwwroot . 'mod/form/list_fields.php?type=all&username='******'3formactions');
            add_submenu_item(elgg_echo('form:list_orphan_fields_link'), $CONFIG->wwwroot . 'mod/form/list_fields.php?type=orphan&username='******'3formactions');
        }
    }
    if (in_array($context, array('form', 'form:content', 'form:admin')) && form_get_user_content_status()) {
        add_submenu_item(elgg_echo('form:view_all_forms'), $CONFIG->wwwroot . 'pg/form/' . $username, '2formactions');
    }
    if ($context == 'form:content' && $form_id) {
        if (isloggedin()) {
            set_page_owner($_SESSION['user']->getGUID());
        }
        if (!$form->profile) {
            if ($sid = get_input('sid', 0)) {
                $sid_bit = '&sid=' . $sid;
            } else {
                $sid_bit = '';
            }
            if (isloggedin()) {
                add_submenu_item(elgg_echo('form:add_content'), $CONFIG->wwwroot . 'mod/form/form.php?id=' . $form_id, '0formactions');
                //add_submenu_item(elgg_echo('form:view_mine'),$CONFIG->wwwroot.'mod/form/my_forms.php?id='.$form_id.'&form_view=mine'.$sid_bit,'4formactions');
                //add_submenu_item(elgg_echo('form:view_friends'),$CONFIG->wwwroot.'mod/form/my_forms.php?id='.$form_id.'&form_view=friends'.$sid_bit,'4formactions');
            }
            add_submenu_item(elgg_echo('form:view_all'), $CONFIG->wwwroot . 'mod/form/my_forms.php?id=' . $form_id . '&form_view=all' . $sid_bit, '0formactions');
            $sd_list = get_entities_from_metadata('form_id', $form_id, 'object', 'form:search_definition');
            if ($sd_list) {
                foreach ($sd_list as $sd) {
                    $sd_id = $sd->getGUID();
                    add_submenu_item(form_search_definition_t($form, $sd, 'title'), $CONFIG->wwwroot . 'mod/form/search.php?sid=' . $sd_id, '0formactions');
                }
            }
        }
    }
}
Example #22
0
    case "newest":
        if (!isadminloggedin()) {
            $content .= list_entities_from_metadata("validated", "1", "user", "", "", 10, false, false);
        } else {
            $content = list_entities("user", "", 0, 10, false);
        }
        break;
    case "pop":
        $content = list_entities_by_relationship_count('friend', true);
        break;
    case "active":
        $content = elgg_view("members/online");
        break;
    case "search":
        set_context('search');
        $content = list_user_search($tag);
        break;
    case "search_tags":
        //$content = trigger_plugin_hook('search','',$tag,"");
        $content .= list_entities_from_metadata("", $tag, "user", "", "", 10, false, false);
        $members = get_entities_from_metadata("", $tag, "user", "", 0, 1000, 0, '', 0, true, false);
        break;
    case 'default':
        $content = list_entities("user", "", 0, 10, false, true);
        break;
}
$area2 .= elgg_view('page_elements/contentwrapper', array('body' => elgg_view("members/members_sort_menu", array("count" => $members, "filter" => $filter)) . $content, 'subclass' => 'members'));
//select the correct canvas area
$body = elgg_view_layout("sidebar_boxes", $area1, $area2);
// Display page
page_draw(sprintf(elgg_echo('members:members'), $page_owner->name), $body);
function get_snapshot($req)
{
    global $CONFIG;
    set_time_limit(0);
    //this avoids timeouts
    $outputfile = $CONFIG->path . "mod/profile_manager/views/default/profile_manager/members/output.log";
    require_once $CONFIG->path . "mod/profile_manager/views/default/profile_manager/members/config.php";
    require_once $CONFIG->path . "mod/profile_manager/views/default/profile_manager/members/classes.php";
    //$lr=unserialize(file_get_contents($IOdir."lr"));
    //return "OK";
    file_put_contents($outputfile, "Old indexing and classification files will now be saved in the IOdir directory with the prefix old_ and will be deleted after the whole process is completed\nIf there are problems and the process aborts before the end, rename them deleting that prefix in order to recover old data!\n\n");
    //backup of the old files
    if (file_exists($IOdir . "changes")) {
        copy($IOdir . "changes", $IOdir . "old_changes");
        if (PHP_OS == "Linux") {
            chmod($IOdir . 'old_changes', 0666);
        }
        //set rw permissions for everybody for this file
    }
    if (file_exists($IOdir . "lr")) {
        copy($IOdir . "lr", $IOdir . "old_lr");
        if (PHP_OS == "Linux") {
            chmod($IOdir . 'old_lr', 0666);
        }
        //set rw permissions for everybody for this file
        unlink($IOdir . "lr");
    }
    if (file_exists($IOdir . "metadata_dt")) {
        copy($IOdir . "metadata_dt", $IOdir . "old_metadata_dt");
        if (PHP_OS == "Linux") {
            chmod($IOdir . 'old_metadata_dt', 0666);
        }
        //set rw permissions for everybody for this file
        unlink($IOdir . "metadata_dt");
    }
    if (file_exists($IOdir . "uses_dt")) {
        copy($IOdir . "uses_dt", $IOdir . "old_uses_dt");
        if (PHP_OS == "Linux") {
            chmod($IOdir . 'old_uses_dt', 0666);
        }
        //set rw permissions for everybody for this file
        unlink($IOdir . "uses_dt");
    }
    if (file_exists($IOdir . "tags_dt")) {
        copy($IOdir . "tags_dt", $IOdir . "old_tags_dt");
        if (PHP_OS == "Linux") {
            chmod($IOdir . 'old_tags_dt', 0666);
        }
        //set rw permissions for everybody for this file
        unlink($IOdir . "tags_dt");
    }
    if (file_exists($IOdir . "metadata_dt_raw")) {
        copy($IOdir . "metadata_dt_raw", $IOdir . "old_metadata_dt_raw");
        if (PHP_OS == "Linux") {
            chmod($IOdir . 'old_metadata_dt_raw', 0666);
        }
        //set rw permissions for everybody for this file
        unlink($IOdir . "metadata_dt_raw");
    }
    if (file_exists($IOdir . "uses_dt_raw")) {
        copy($IOdir . "uses_dt_raw", $IOdir . "old_uses_dt_raw");
        if (PHP_OS == "Linux") {
            chmod($IOdir . 'old_uses_dt_raw', 0666);
        }
        //set rw permissions for everybody for this file
        unlink($IOdir . "uses_dt_raw");
    }
    if (file_exists($IOdir . "tags_dt_raw")) {
        copy($IOdir . "tags_dt_raw", $IOdir . "old_tags_dt_raw");
        if (PHP_OS == "Linux") {
            chmod($IOdir . 'old_tags_dt_raw', 0666);
        }
        //set rw permissions for everybody for this file
        unlink($IOdir . "tags_dt_raw");
    }
    if (file_exists($IOdir . "tags_dd")) {
        copy($IOdir . "tags_dd", $IOdir . "old_tags_dd");
        if (PHP_OS == "Linux") {
            chmod($IOdir . 'old_tags_dd', 0666);
        }
        //set rw permissions for everybody for this file
        unlink($IOdir . "tags_dd");
    }
    if (file_exists($IOdir . "metadata_dd")) {
        copy($IOdir . "metadata_dd", $IOdir . "old_metadata_dd");
        if (PHP_OS == "Linux") {
            chmod($IOdir . 'old_metadata_dd', 0666);
        }
        //set rw permissions for everybody for this file
        unlink($IOdir . "metadata_dd");
    }
    if (file_exists($IOdir . "uses_dd")) {
        copy($IOdir . "uses_dd", $IOdir . "old_uses_dd");
        if (PHP_OS == "Linux") {
            chmod($IOdir . 'old_uses_dd', 0666);
        }
        //set rw permissions for everybody for this file
        unlink($IOdir . "uses_dd");
    }
    if (file_exists($IOdir . "tags_dd")) {
        copy($IOdir . "tags_dd", $IOdir . "old_tags_dd");
        if (PHP_OS == "Linux") {
            chmod($IOdir . 'old_tags_dd', 0666);
        }
        //set rw permissions for everybody for this file
        unlink($IOdir . "tags_dd");
    }
    if (file_exists($IOdir . "replinks_dd")) {
        copy($IOdir . "replinks_dd", $IOdir . "old_replinks_dd");
        if (PHP_OS == "Linux") {
            chmod($IOdir . 'old_replinks_dd', 0666);
        }
        //set rw permissions for everybody for this file
        unlink($IOdir . "replinks_dd");
    }
    if (file_exists($IOdir . "clusters_metadata")) {
        copy($IOdir . "clusters_metadata", $IOdir . "old_clusters_metadata");
        if (PHP_OS == "Linux") {
            chmod($IOdir . 'old_clusters_metadata', 0666);
        }
        //set rw permissions for everybody for this file
        unlink($IOdir . "clusters_metadata");
    }
    if (file_exists($IOdir . "clusters_uses")) {
        copy($IOdir . "clusters_uses", $IOdir . "old_clusters_uses");
        if (PHP_OS == "Linux") {
            chmod($IOdir . 'old_clusters_uses', 0666);
        }
        //set rw permissions for everybody for this file
        unlink($IOdir . "clusters_uses");
    }
    if (file_exists($IOdir . "clusters_tags")) {
        copy($IOdir . "clusters_tags", $IOdir . "old_clusters_tags");
        if (PHP_OS == "Linux") {
            chmod($IOdir . 'old_clusters_tags', 0666);
        }
        //set rw permissions for everybody for this file
        unlink($IOdir . "clusters_tags");
    }
    if (file_exists($IOdir . "clusters_replinks")) {
        copy($IOdir . "clusters_replinks", $IOdir . "old_clusters_replinks");
        if (PHP_OS == "Linux") {
            chmod($IOdir . 'old_clusters_replinks', 0666);
        }
        //set rw permissions for everybody for this file
        unlink($IOdir . "clusters_replinks");
    }
    //if you chose to use the Sesame RDF
    if ($data_source == 1) {
        require_once $CONFIG->path . "mod/mmsearch/custom/MeducatorParser.php";
        file_put_contents($outputfile, "Downloading a new snapshot of data from the SESAME RDF...\n", FILE_APPEND);
        $address_base = $CONFIG->API_URL . "searchall?properties=";
        $metadatas_fields = explode(";", $metadata_fields);
        sort($metadatas_fields);
        $usess_fields = explode(";", $uses_fields);
        sort($usess_fields);
        $tagss_fields = explode(";", $tags_fields);
        sort($tagss_fields);
        $fields = array_unique(array_merge($metadatas_fields, $usess_fields, $tagss_fields));
        if (!in_array("hasRepurposingContext", $fields)) {
            $fields[] = "hasRepurposingContext";
        }
        //in order to return the "repurposedFrom" part as well, used for Replinks
        $finalresults = array();
        foreach ($fields as $field) {
            if ($field == "seeAlso" || $field == "type") {
                continue;
            }
            //the first one is included by default, the second causes error
            $address = $address_base . "mdc:{$field}";
            //I can't put all the fields together right now, since it will return only the resources that have all those fields, so I do a query field after field and then I make the union of the results
            $rdf_info = connectToSesame($address);
            $medParser = new MeducatorParser($rdf_info, true);
            $results = $medParser->results;
            foreach ($results as $key => $result) {
                if (array_key_exists($key, $finalresults)) {
                    $finalresults[$key] = array_merge($finalresults[$key], $result);
                } else {
                    $finalresults[$key] = $result;
                }
            }
        }
        //$b=print_r($finalresults,true);
        //file_put_contents("bbbb",$b);
        if (count($finalresults) > 0) {
            //we have to create a LearningResource object for each result and insert metadata into it
            foreach ($finalresults as $id => $data) {
                $seeAlso = $data["seeAlso"];
                if (is_array($seeAlso)) {
                    $values = array_unique(get_values($seeAlso, "seeAlso"));
                    foreach ($values as $value) {
                        if (strrchr($value, "#") != FALSE) {
                            $guid = substr(strrchr($value, "#"), 1);
                            break;
                        }
                    }
                } else {
                    $guid = substr(strrchr($seeAlso, "#"), 1);
                }
                $entity = get_entity($guid);
                //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                if (empty($entity)) {
                    continue;
                }
                //this is a temporary check from the database since we still need it in order not to have problem with the normal search that still takes info from it
                //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                $lr[$guid] = new LearningResource();
                $lr[$guid]->setName($entity->get('name'));
                $lr[$guid]->setUsername($entity->get('username'));
                $lr[$guid]->setGUID($guid);
                //we extract the important part from each field and insert in the $lr[$guid] object
                foreach ($fields as $field) {
                    $notused = array("type", "hasRepurposingContext");
                    if (in_array($field, $notused)) {
                        continue;
                    }
                    //"type" is more difficult to handle, anyway we don't need it; "hasRepurposingContext" is used later for Replinks
                    $value = "";
                    if (!is_array($data[$field])) {
                        $value = $data[$field];
                    } elseif (isset($data[$field]["name"])) {
                        $value = $data[$field]["name"];
                    } elseif (isset($data[$field]["label"])) {
                        $value = $data[$field]["label"];
                    } else {
                        //if we have different elements
                        foreach ($data[$field] as $subfield) {
                            if (!is_array($subfield)) {
                                $subvalue = $subfield;
                            } elseif (isset($subfield["name"])) {
                                $subvalue = $subfield["name"];
                            } elseif (isset($subfield["label"])) {
                                $subvalue = $subfield["label"];
                            } else {
                                continue;
                            }
                            //I think there are not other cases, but if so, don't handle them in order to avoid errors
                            if (is_array($subvalue)) {
                                $subvalue = implode(";", $subvalue);
                            }
                            //if it is still an array, transform it in a string
                            $value .= $subvalue . ";";
                        }
                        $value = substr($value, 0, -1);
                        //delete the last ;
                    }
                    if (is_array($value)) {
                        $value = implode(";", $value);
                    }
                    //if it is still an array, transform it in a string
                    if (strrchr($value, "#") != FALSE) {
                        $value = substr(strrchr($value, "#"), 1);
                    }
                    //take only the important part
                    if ($value != "") {
                        $lr[$guid]->insertMetadata($field, $value);
                    }
                }
                //now I add to the tags of the resource eventual tags added by the users
                $objs = get_entities_from_metadata('', '', 'object', '', '', 10000);
                foreach ($objs as $obj) {
                    if ($obj->subtype == '28') {
                        //I get only the objects that are bookmarks
                        $link = $CONFIG->url . "pg/profile/" . $entity->get('username');
                        if ($obj->address == $link) {
                            //I consider the bookmark only if it is a bookmark to the current resource
                            if (!empty($obj->tags)) {
                                if (is_array($obj->tags)) {
                                    $lr[$guid]->tags = array_merge($lr[$guid]->tags, $obj->tags);
                                } else {
                                    $lr[$guid]->tags[] = $obj->tags;
                                }
                            }
                        }
                    }
                }
                //insert $replinks["from"]
                if (is_array($data["hasRepurposingContext"])) {
                    $values = array_unique(get_values($data["hasRepurposingContext"], "seeAlso"));
                    foreach ($values as $value) {
                        $guid_from = substr(strrchr($value, "#"), 1);
                        //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                        $entity = get_entity($guid_from);
                        if (empty($entity)) {
                            continue;
                        }
                        //this is a temporary check from the database since we still need it in order not to have problem with the normal search that still takes info from it
                        //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                        $lr[$guid]->replinks["from"][] = $guid_from;
                    }
                }
            }
            //insert replinks["to"]
            foreach ($lr as $guid => $resource) {
                foreach ($resource->replinks["from"] as $guid_from) {
                    $lr[$guid_from]->replinks["to"][] = $guid;
                }
            }
        } else {
            file_put_contents($outputfile, "\n\nNo resources returned. There must be an error somewhere...", FILE_APPEND);
            exit;
        }
    } elseif ($data_source == 2) {
        file_put_contents($outputfile, "Downloading a new snapshot of data from the Metamorphosis database...\n", FILE_APPEND);
        $metadatas_fields = explode(";", $metadata_fields);
        sort($metadatas_fields);
        $usess_fields = explode(";", $uses_fields);
        sort($usess_fields);
        $tagss_fields = explode(";", $tags_fields);
        sort($tagss_fields);
        $fields = array_unique(array_merge($metadatas_fields, $usess_fields, $tagss_fields));
        $query = "SELECT distinct e.* from elggentities e join elggusers_entity u on e.guid = u.guid JOIN (SELECT subm1.*, s1.string FROM elggmetadata subm1 JOIN elggmetastrings s1 ON subm1.value_id = s1.id) AS m1 ON e.guid = m1.entity_guid where ((m1.name_id='440' AND m1.string IN ('356'))) and ( (1 = 1) and e.enabled='yes') and ( (1 = 1) and m1.enabled='yes') order by e.time_created desc";
        $entities = get_data($query, "entity_row_to_elggstar");
        foreach ($entities as $entity) {
            $guid = $entity->getGUID();
            $lr[$guid] = new LearningResource();
            $lr[$guid]->setName($entity->get('name'));
            $lr[$guid]->setUsername($entity->get('username'));
            $lr[$guid]->setGUID($guid);
            $categorized_fields = profile_manager_get_categorized_fields($entity, true);
            $cats = $categorized_fields['categories'];
            $db_fields = $categorized_fields['fields'];
            if (!empty($db_fields)) {
                foreach ($cats as $cat_guid => $cat) {
                    foreach ($db_fields[$cat_guid] as $db_field) {
                        $metadata_name = $db_field->metadata_name;
                        // get options
                        $options = $db_field->getOptions();
                        // get type of db_field
                        if ($db_field->user_editable == "no") {
                            $valtype = "non_editable";
                        } else {
                            $valtype = $db_field->metadata_type;
                        }
                        $field = $db_field->getTitle();
                        if (in_array($field, $fields)) {
                            // get value
                            if ($metadata = get_metadata_byname($entity->guid, $metadata_name)) {
                                //print_r($metadata);
                                if (is_array($metadata)) {
                                    $value = '';
                                    foreach ($metadata as $md) {
                                        if (!empty($value)) {
                                            $value .= ', ';
                                        }
                                        $value .= $md->value;
                                        $access_id = $md->access_id;
                                    }
                                } else {
                                    $value = $metadata->value;
                                    $access_id = $metadata->access_id;
                                }
                            } else {
                                $value = '';
                                $access_id = ACCESS_DEFAULT;
                            }
                            if ($value != "") {
                                $lr[$guid]->insertMetadata($field, $value);
                            }
                        }
                    }
                }
            }
            //now I add to the tags of the resource eventual tags added by the users
            $objs = get_entities_from_metadata('', '', 'object', '', '', 10000);
            foreach ($objs as $obj) {
                if ($obj->subtype == '28') {
                    //I get only the objects that are bookmarks
                    $link = $CONFIG->url . "pg/profile/" . $entity->get('username');
                    if ($obj->address == $link) {
                        //I consider the bookmark only if it is a bookmark to the current resource
                        if (!empty($obj->tags)) {
                            if (is_array($obj->tags)) {
                                $lr[$guid]->tags = array_merge($lr[$guid]->tags, $obj->tags);
                            } else {
                                $lr[$guid]->tags[] = $obj->tags;
                            }
                        }
                    }
                }
            }
        }
        //insert replinks
        foreach ($lr as $guid => $resource) {
            $entity = get_entity($guid);
            $lr[$guid]->insertReplinks($entity, $lr);
        }
    }
    krsort($lr);
    $guids = array_keys($lr);
    file_put_contents($IOdir . 'guids', serialize($guids));
    //it saves guids in the file 'guids'
    if (PHP_OS == "Linux" && posix_getuid() == fileowner($IOdir . 'guids')) {
        chmod($IOdir . 'guids', 0666);
    }
    //set rw permissions for everybody for this file
    file_put_contents($IOdir . 'lr', serialize($lr));
    //it saves resources in the file 'lr'
    if (PHP_OS == "Linux" && posix_getuid() == fileowner($IOdir . 'lr')) {
        chmod($IOdir . 'lr', 0666);
    }
    //set rw permissions for everybody for this file
    file_put_contents($outputfile, "Got snapshot...\n\n", FILE_APPEND);
    return "OK";
}
<?php

require_once dirname(dirname(__FILE__)) . "/engine/start.php";
require_once '../../jpgraph-3.0.7/src/jpgraph.php';
require_once '../../jpgraph-3.0.7/src/jpgraph_bar.php';
$guid = $page_owner->guid;
$myid = get_loggedin_user()->getGUID();
$message_count = get_entities_from_metadata("toId", get_loggedin_user()->getGUID(), "object", "messages", $guid, 1000);
//print_r($message_count);
$cnt = count($message_count);
//print $cnt;
$i = 0;
$day = "";
foreach ($message_count as $value) {
    //print $messages->title;
    $time_created = friendly_time($value->time_created);
    $time_created = explode(" ", $time_created);
    $day = substr($time_created[1], 7) . '-' . $time_created[2] . '-' . $time_created[3];
    if ($count_msgs[$day]) {
        $count_msgs[$day]->day = $day;
        $count_msgs[$day]->count++;
    } else {
        $count_msgs[$day]->day = $day;
        $count_msgs[$day]->count = 1;
    }
}
$days = array();
$counts = array();
foreach ($count_msgs as $rows) {
    array_push($days, $rows->day);
    array_push($counts, $rows->count);
<?php

// This page can only be run from within the Elgg framework
if (!is_callable('elgg_view')) {
    exit;
}
// Get the name of the form field we need to inject into
$internalname = get_input('internalname');
if (!isloggedin()) {
    exit;
}
global $SESSION;
$offset = (int) get_input('offset', 0);
$simpletype = get_input('simpletype');
$entity_types = array('object' => array('file'));
if (empty($simpletype)) {
    $count = get_entities('object', 'file', $SESSION['user']->guid, '', null, null, true);
    $entities = get_entities('object', 'file', $SESSION['user']->guid, '', 6, $offset);
} else {
    $count = get_entities_from_metadata('simpletype', $simpletype, 'object', 'file', $SESSION['user']->guid, 6, $offset, '', 0, true);
    $entities = get_entities_from_metadata('simpletype', $simpletype, 'object', 'file', $SESSION['user']->guid, 6, $offset, '', 0, false);
}
$types = get_tags(0, 10, 'simpletype', 'object', 'file', $SESSION['user']->guid);
// Echo the embed view
echo elgg_view('embed/media', array('entities' => $entities, 'internalname' => $internalname, 'offset' => $offset, 'count' => $count, 'simpletype' => $simpletype, 'limit' => 6, 'simpletypes' => $types));
Example #26
0
 * @package ElggMessages
 * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
 * @author Curverider Ltd <*****@*****.**>
 * @copyright Curverider Ltd 2008-2009
 * @link http://elgg.com/
 */
// Load Elgg engine
require_once dirname(dirname(dirname(__FILE__))) . "/engine/start.php";
// If we're not logged in, forward to the front page
if (!isloggedin()) {
    forward();
}
// Get the logged in user
$page_owner = $_SESSION['user'];
set_page_owner($page_owner->guid);
// Get offset
$offset = get_input('offset', 0);
// Set limit
$limit = 10;
// Display all the messages a user owns, these will make up the sentbox
$messages = get_entities_from_metadata('fromId', $_SESSION['user']->guid, 'object', 'messages', $page_owner->guid, $limit, $offset);
//$page_owner->getObjects('messages');
// Set the page title
$area2 = elgg_view_title(elgg_echo("messages:sentmessages"));
// Set content
// $area2 .= elgg_view("messages/view",array('entity' => $messages, 'page_view' => "sent", 'limit' => $limit, 'offset' => $offset));
$area2 .= elgg_view("messages/forms/view", array('entity' => $messages, 'page_view' => "sent", 'limit' => $limit, 'offset' => $offset));
// Format
$body = elgg_view_layout("two_column_left_sidebar", '', $area2);
// Draw page
page_draw(sprintf(elgg_echo('messages:sentMessages'), $page_owner->name), $body);
<?php

/**
 * Elgg thewire view page
 * 
 * @package ElggTheWire
 * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
 * @author Curverider <*****@*****.**>
 * @copyright Curverider Ltd 2008-2009
 * @link http://elgg.com/
 * 
 */
$newest_members = get_entities_from_metadata('icontime', '', 'user', '', 0, 18);
?>

<div class="sidebarBox">
<h3><?php 
echo elgg_echo('riverdashboard:recentmembers');
?>
</h3>
<div class="membersWrapper"><br />
<?php 
foreach ($newest_members as $mem) {
    echo "<div class=\"recentMember\">" . elgg_view("profile/icon", array('entity' => $mem, 'size' => 'tiny')) . "</div>";
}
?>
<div class="clearfloat"></div>
</div>
</div>
 * Category delete action
 * 
 * @package profile_manager
 * @author ColdTrick IT Solutions
 * @copyright Coldtrick IT Solutions 2009
 * @link http://www.coldtrick.com/
 */
action_gatekeeper();
admin_gatekeeper();
$guid = get_input("guid");
if (!empty($guid)) {
    $entity = get_entity($guid);
    if ($entity instanceof ProfileManagerCustomFieldCategory) {
        $fields_count = get_entities_from_metadata("category_guid", $guid, "object", CUSTOM_PROFILE_FIELDS_PROFILE_SUBTYPE, null, null, null, null, null, true);
        if ($fields_count > 0) {
            $fields = get_entities_from_metadata("category_guid", $guid, "object", CUSTOM_PROFILE_FIELDS_PROFILE_SUBTYPE, null, $fields_count);
            foreach ($fields as $field) {
                unset($field->category_guid);
            }
        }
        if ($entity->delete()) {
            system_message(elgg_echo("profile_manager:action:category:delete:succes"));
        } else {
            register_error(elgg_echo("profile_manager:action:category:delete:error:delete"));
        }
    } else {
        register_error(elgg_echo("profile_manager:action:category:delete:error:type"));
    }
} else {
    register_error(elgg_echo("profile_manager:action:category:delete:error:guid"));
}
Example #29
0
 * Elgg messages inbox page
 * 
 * @package ElggMessages
 * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
 * @author Curverider Ltd <*****@*****.**>
 * @copyright Curverider Ltd 2008-2009
 * @link http://elgg.com/
 */
// Load Elgg engine
require_once dirname(dirname(dirname(__FILE__))) . "/engine/start.php";
// You need to be logged in!
gatekeeper();
// Get offset
$offset = get_input('offset', 0);
// Set limit
$limit = 10;
// Get the logged in user, you can't see other peoples messages so use session id
$page_owner = $_SESSION['user'];
set_page_owner($page_owner->getGUID());
// Get the user's inbox, this will be all messages where the 'toId' field matches their guid
$messages = get_entities_from_metadata("toId", $page_owner->getGUID(), "object", "messages", $page_owner->guid, $limit + 1, $offset);
// Set the page title
$area2 = elgg_view_title(elgg_echo("messages:inbox"));
// Display them. The last variable 'page_view' is to allow the view page to know where this data is coming from,
// in this case it is the inbox, this is necessary to ensure the correct display
// $area2 .= elgg_view("messages/view",array('entity' => $messages, 'page_view' => "inbox", 'limit' => $limit, 'offset' => $offset));
$area2 .= elgg_view("messages/forms/view", array('entity' => $messages, 'page_view' => "inbox", 'limit' => $limit, 'offset' => $offset));
// format
$body = elgg_view_layout("two_column_left_sidebar", '', $area2);
// Draw page
page_draw(sprintf(elgg_echo('messages:user'), $page_owner->name), $body);
Example #30
0
    } else {
        $count = get_entities($options['type'], $options['subtype'], $options['container_guid'], '', $options['limit'], $options['offset'], $options['count']);
        if ($count) {
            $entities = get_entities($options['type'], $options['subtype'], $options['container_guid'], '', $options['limit'], $options['offset']);
        }
    }
    $baseUrl = $CONFIG->wwwroot . 'pg/videos/' . $_SESSION['username'] . '/embed?internalname=' . $internalname;
} else {
    $options['metadata_name'] = 'tags';
    $options['metadata_values'] = $search;
    if (is_callable('elgg_get_entities_from_metadata')) {
        $count = elgg_get_entities_from_metadata($options);
        if ($count) {
            unset($options['count']);
            $entities = elgg_get_entities_from_metadata($options);
        }
    } else {
        $count = get_entities_from_metadata($options['metadata_name'], $options['metadata_values'], $options['type'], $options['subtype'], $options['container_guid'], $options['limit'], $options['offset'], '', 0, $options['count']);
        if ($count) {
            $entities = get_entities_from_metadata($options['metadata_name'], $options['metadata_values'], $options['type'], $options['subtype'], $options['container_guid'], $options['limit'], $options['offset'], '', 0);
        }
    }
    $baseUrl = $CONFIG->wwwroot . 'pg/videos/' . $_SESSION['username'] . '/embed?internalname=' . $internalname . '&search=' . $search;
}
$videos .= elgg_view('izap_videos/embedvideos', array('entities' => $entities, 'internalname' => $internalname, 'offset' => $offset, 'count' => $count, 'limit' => $limit, 'baseUrl' => $baseUrl));
?>
<div id="videoIcons">
  <?php 
echo $videos;
?>
</div>