コード例 #1
0
ファイル: lib.php プロジェクト: BackupTheBerlios/tulipan-svn
function friend_page_owner()
{
    $friends_name = optional_param('friends_name');
    if (!empty($friends_name)) {
        return user_info_username('ident', $friends_name);
    }
}
コード例 #2
0
 /**
  * Weblog class constructor
  *
  * <p>Will set all weblog properties, if the provided weblog id exist 
  * (which effectively will be a user id, regardless if one is dealing 
  * with a person or a community - for Elgg both are users).</p>
  * 
  * @param int $user_id The user id.
  * @param int $blog_id The weblog id.
  */
 function Weblog($user_id, $blog_id)
 {
     $this->community = false;
     // dealing with community or not
     // username/id conversions
     if (is_numeric($user_id)) {
         $this->user_id = $user_id;
     } elseif (is_string($user_id)) {
         $this->user_id = user_info_username('ident', $user_id);
     }
     if (is_numeric($blog_id)) {
         $this->ident = $blog_id;
     } elseif (is_string($blog_id)) {
         $this->ident = user_info_username('ident', $blog_id);
     }
     // Are we dealing with a person or a community?
     if (user_type($this->ident) == "person") {
         if ($result = get_record('users', 'ident', $this->user_id)) {
             $this->user_name = $result->name;
             $this->user_username = $result->username;
         }
         $posts = get_records_select('weblog_posts', "owner = ? AND weblog = ?", array($this->user_id, $this->user_id), 'posted DESC');
         $this->blog_name = $this->user_name;
         $this->blog_username = $this->user_username;
         $this->owner = $this->user_id;
     } else {
         // It's a community
         $this->community = true;
         // Get the owner
         $this->owner = user_info('owner', $this->ident);
         // Inject an SQL restriction if the user is not owner
         $sql_insert = "";
         if ($this->owner != $this->user_id) {
             $sql_insert = " and owner = {$this->user_id} ";
         }
         if ($result = get_record('users', 'ident', $this->ident)) {
             $this->blog_name = $result->name;
             $this->blog_username = $result->username;
         }
         $posts = get_records_select('weblog_posts', "weblog = {$this->ident} {$sql_insert}", null, 'posted DESC');
         $user = run('users:instance', array('user_id' => $this->user_id));
         $this->user_name = $user->getName();
         $this->user_username = $user->getUserName();
     }
     $this->posts = array();
     if (is_array($posts) && sizeof($posts) > 0) {
         foreach ($posts as $post) {
             $this->posts[] = $post->ident;
         }
     } else {
     }
 }
コード例 #3
0
ファイル: lib.php プロジェクト: BackupTheBerlios/tulipan-svn
function rpc_pagesetup()
{
    global $CFG, $metatags, $function;
    $add_meta = false;
    if (isset($_GET['weblog_name'])) {
        $user_id = user_info_username('ident', $_GET['weblog_name']);
        $add_meta = true;
    } else {
        if (isset($_GET['profile_name'])) {
            $user_id = user_info_username('ident', $_GET['profile_name']);
            $add_meta = true;
        }
    }
    if ($add_meta) {
        $metatags .= "\n<link rel=\"EditURI\" type=\"application/rsd+xml\" title=\"RSD\" href=\"" . url . "mod/rpc/rsd.php?user_id=" . $user_id . "\" />\n";
    }
}
コード例 #4
0
<?php

// Now just polls the user_info_username function
$run_result = user_info_username('ident', $parameter);
コード例 #5
0
ファイル: lib.php プロジェクト: BackupTheBerlios/tulipan-svn
function file_page_owner()
{
    $owner = null;
    $files_name = optional_param('files_name');
    if (!empty($files_name)) {
        $owner = user_info_username('ident', $files_name);
    }
    $fowner = optional_param('files_owner', $owner);
    if (!empty($fowner)) {
        $owner = $fowner;
    }
    if ($owner != null) {
        return $owner;
    }
}
コード例 #6
0
<?php

//    ELGG profile view page
// Run includes
require_once dirname(dirname(__FILE__)) . '/includes.php';
require_once $CFG->dirroot . 'profile/profile.class.php';
// define what profile to show
$profile_name = optional_param('profile_name', '', PARAM_ALPHANUM);
if (!empty($profile_name)) {
    $profile_id = user_info_username('ident', $profile_name);
}
if (empty($profile_id)) {
    $profile_id = optional_param('profile_id', -1, PARAM_INT);
}
// and the page_owner naturally
$page_owner = $profile_id;
define("context", "profile");
templates_page_setup();
// two column version
class ElggProfile2 extends ElggProfile
{
    function view()
    {
        global $data;
        global $page_owner;
        global $CFG;
        /*$run_result = '';
                $usertype = user_type($page_owner);
        
                $icon = user_info('icon',$page_owner);
                $username = user_info('username',$page_owner);
コード例 #7
0
<?php

// Userdetails actions
global $USER, $messages, $page_owner;
$id = optional_param('id', 0, PARAM_INT);
$action = optional_param('action');
if (logged_on && !empty($action) && user_info("user_type", $id) == "community" && run("permissions:check", array("userdetails:change", $id))) {
    switch ($action) {
        case "userdetails:update":
            $community_owner = trim(optional_param('community_owner'));
            if (!empty($community_owner)) {
                if ($new_owner = user_info_username("ident", $community_owner)) {
                    if (user_info("user_type", $new_owner) != "community") {
                        if ($info = get_record('users', 'ident', $id)) {
                            $info->owner = $new_owner;
                            update_record('users', $info);
                            //$messages[] = sprintf(__gettext("Community ownership transferred to %s."),$community_owner);
                        } else {
                            $messages[] = __gettext("Could not retrieve community details.");
                        }
                    } else {
                        $messages[] = sprintf(__gettext("Could not find new owner %s. Community owner not changed."), $community_owner);
                    }
                }
            }
            $messages[] = sprintf(__gettext("Changes succesfully."));
            break;
    }
}
コード例 #8
0
<?php

global $USER;
// ELGG weblog system initialisation
// ID of profile to view / edit
global $profile_id;
$weblog_name = optional_param('weblog_name');
if (!empty($weblog_name)) {
    $profile_id = (int) user_info_username('ident', $weblog_name);
} else {
    if (isloggedin()) {
        $profile_id = optional_param('profile_id', optional_param('profileid', $USER->ident, PARAM_INT), PARAM_INT);
    } else {
        $profile_id = optional_param('profile_id', optional_param('profileid', -1, PARAM_INT), PARAM_INT);
    }
}
global $page_owner;
$page_owner = $profile_id;
global $page_userid;
$page_userid = user_info('username', $profile_id);
// Add RSS to metatags, only if we are on a user page
if (!empty($page_userid)) {
    global $metatags;
    $metatags .= "<link rel=\"alternate\" type=\"application/rss+xml\" title=\"RSS\" href=\"" . url . "{$page_userid}/weblog/rss\" />\n";
}
// Maximun items per page
define('POSTS_PER_PAGE', 10);
コード例 #9
0
<?php

global $owner;
global $page_owner;
global $profile_id;
$friends_name = optional_param('friends_name');
if (!empty($friends_name)) {
    $owner = user_info_username('ident', $friends_name);
} else {
    $owner = optional_param('owner', $page_owner, PARAM_INT);
}
if (empty($owner)) {
    $owner = -1;
}
/*if (logged_on) {
    $owner = (int) $_SESSION['userid'];
}*/
$page_owner = $owner;
$profile_id = $owner;
global $page_userid;
$page_userid = user_info('username', $page_owner);
global $metatags;
if ($owner != -1) {
    $metatags .= "<link rel=\"meta\" type=\"application/rdf+xml\" title=\"FOAF\" href=\"" . url . "{$page_userid}/foaf\" />";
}
コード例 #10
0
ファイル: lib.php プロジェクト: BackupTheBerlios/tulipan-svn
function pages_tplkw_page($vars)
{
    global $messages;
    $output = '';
    if (!isset($vars[1])) {
        $msg = "{{page}} keyword error, must provied a page name. e.g. {{page:Main}}";
        if (page_owner() == $_SESSION['userid']) {
            // show error to page owner
            $messages[] = $msg;
        }
        trigger_error($msg, E_USER_WARNING);
    } else {
        if (isset($vars[2])) {
            $page_id = $vars[2];
            $page_name = pages_build_uri($page_id);
            $username = $vars[1];
            // main site content
            if ($username == 'content') {
                $user_id = -1;
            } else {
                $user_id = (int) user_info_username('ident', $username);
            }
            if (empty($user_id)) {
                $msg = "{{page}} keyword error, invalid username: {$username}";
                if (page_owner() == $_SESSION['userid']) {
                    // show error to page owner
                    $messages[] = $msg;
                }
                trigger_error($msg, E_USER_WARNING);
            } else {
                $page_url = pages_url($page_name, 'pages::page', $user_id);
            }
        } else {
            $page_id = $vars[1];
            $page_name = pages_build_uri($page_id);
            $page_url = pages_url($page_name, 'pages::page', page_owner());
        }
        // return html link
        if (isset($page_url)) {
            $output = pages_html_a($page_url, $page_id);
        }
    }
    return $output;
}
コード例 #11
0
ファイル: lib.php プロジェクト: BackupTheBerlios/tulipan-svn
function profile_page_owner()
{
    if ($profile_name = optional_param('profile_name')) {
        if ($profile_id = user_info_username('ident', $profile_name)) {
            return $profile_id;
        }
    }
    if ($profile_id = optional_param("profile_id", 0, PARAM_INT)) {
        return $profile_id;
    }
}
コード例 #12
0
ファイル: lib.php プロジェクト: BackupTheBerlios/clavel-svn
function community_user_delete($object_type, $event, $object)
{
    global $CFG, $data, $messages;
    if (!empty($object->ident) && $object_type == "user" && $event == "delete") {
        if ($newsuser = user_info_username("info", "news")) {
        } else {
            $newsuser = -1;
        }
        if ($communities = get_records_sql("select * from {$CFG->prefix}users where owner = {$object->ident}")) {
            foreach ($communities as $community) {
                $community->owner = $newsuser;
                update_record('users', $community);
                if ($newsuser != -1) {
                    $messages[] = sprintf(__gettext("Community %s was returned to the news user."), $community->username);
                } else {
                    $messages[] = sprintf(__gettext("Community %s is now owned by -1 (nobody)."), $community->username);
                }
            }
        }
    }
    //          $members = get_records("friends","friend",$page_owner);
    return $object;
}
コード例 #13
0
ファイル: blog.php プロジェクト: BackupTheBerlios/tulipan-svn
<?php

require_once dirname(dirname(__FILE__)) . "/../includes.php";
global $page_owner, $profile_id;
run("weblogs:init");
run("profile:init");
$username = trim(optional_param('profile_name', ''));
$user_id = user_info_username("ident", $username);
if (empty($user_id)) {
    $user_id = $page_owner;
} else {
    $page_owner = $user_id;
    $profile_id = $user_id;
}
run("rss:init");
define('context', 'resources');
templates_page_setup();
$title = run("profile:display:name") . " :: " . __gettext("Publish feeds to blog");
$body = run("rss:subscriptions:publish:blog");
templates_page_output($title, $body);
コード例 #14
0
ファイル: lib.php プロジェクト: BackupTheBerlios/tulipan-svn
function blog_page_owner()
{
    $weblog_name = optional_param('weblog_name');
    if (!empty($weblog_name)) {
        return (int) user_info_username('ident', $weblog_name);
    }
}
コード例 #15
0
// Download script
// Usage: http://URL/{username}/files/{folder_id}/{file_id}/{filename}
// Run includes
require_once dirname(dirname(__FILE__)) . "/../includes.php";
// Initialise functions for user details, icon management and profile management
run("userdetails:init");
run("profile:init");
run("files:init");
// If an ID number for the file has been specified ...
$id = optional_param('id', 0, PARAM_INT);
if (!empty($id)) {
    // ... and the file exists in the database ...
    if ($file = get_record('files', 'ident', $id)) {
        // ... and the owner of the file in the URL line hasn't been spoofed ...
        $files_name = optional_param('files_name');
        $userid = user_info_username('ident', $files_name);
        if ($userid == $file->owner || $userid == $file->files_owner) {
            // ... and the current user is allowed to access it ...
            if ($file->access == 'PUBLIC' || $file->owner == $_SESSION['userid'] || run("users:access_level_check", $file->access) == true) {
                // Then output some appropriate headers and send the file data!
                // TODO: bug on ie, if using ssl force public cache control
                //       using port, $_SERVER['HTTPS'] does not work always
                if ($file->access == 'PUBLIC' || isset($_SERVER['HTTPS']) || $_SERVER['SERVER_PORT'] == 443) {
                    header("Pragma: public");
                    header("Cache-Control: public");
                } else {
                    // "Cache-Control: private" to allow a user's browser to cache the file, but not a shared proxy
                    // Also to override PHP's default "DON'T EVER CACHE THIS EVER" header
                    header("Cache-Control: private");
                }
                require_once $CFG->dirroot . 'lib/filelib.php';
コード例 #16
0
<?php

global $owner;
$files_name = optional_param('files_name');
if (!empty($files_name)) {
    $owner = user_info_username('ident', $files_name);
} else {
    $owner = optional_param('owner', optional_param('userid', 0, PARAM_INT), PARAM_INT);
}
global $owner_username;
$owner_username = user_info('username', $owner);
global $page_owner;
$fowner = optional_param('files_owner', $owner);
if (!empty($fowner)) {
    $page_owner = $fowner;
}
global $profile_id;
$profile_id = $owner;
global $folder;
$folder = optional_param('folder', 0, PARAM_INT);
$count = count_records('file_folders', 'ident', $folder, 'files_owner', $owner);
if (empty($count) || empty($folder)) {
    $folder = -1;
}