function viewfolder($folderid, $userid, $level, $selected = -1)
{
    $prefix = "";
    for ($i = 0; $i < $level; $i++) {
        $prefix .= "&gt;";
    }
    $fileprefix = $prefix . "&gt;";
    $folders = get_records_select('file_folders', "files_owner = ? AND parent = ?", array($userid, $folderid));
    if ($folderid == -1) {
        $body = "<option value=\"-1\" ";
        if ($selected == -1) {
            $body .= "selected = \"selected\"";
        }
        $root = __gettext("Root");
        $body .= ">{$root}</option>";
    } else {
        $current_folder = get_record('file_folders', 'files_owner', $userid, 'ident', $folderid);
        $name = stripslashes($current_folder->name);
        $ident = $current_folder->ident;
        if ($ident == $selected) {
            $selectstring = "selected=\"selected\"";
        } else {
            $selectstring = "";
        }
        $body = <<<END
            <option value="{$ident}" {$selectstring} >{$prefix} {$name} </option>
END;
    }
    if (!empty($folders)) {
        foreach ($folders as $folder) {
            $body .= viewfolder($folder->ident, $userid, $level + 1, $selected);
        }
    }
    return $body;
}
Exemple #2
0
function admin_pagesetup()
{
    global $PAGE, $CFG;
    /*
        if (isadmin()) {
            $PAGE->menu_top [] = array( 'name' => 'admin',
                                        //'html' => a_href("{$CFG->wwwroot}_admin/",
                                        //                "Administration"));
                                        'html' => "<li><a href=\"" . $CFG->wwwroot . "mod/admin/\">" . __gettext("Administration") . "</a></li>");
        }
    */
    if (defined("context") && context == "account") {
        $PAGE->menu_sub[] = array('name' => 'user:edit', 'html' => a_href("{$CFG->wwwroot}_userdetails/", __gettext("Edit user details")));
        /*$PAGE->menu_sub[] = array (
        		'name' => 'user:icon',
        		'html' => a_href("{$CFG->wwwroot}_icons/",__gettext("Your site picture")));*/
    }
    if (defined("context") && context == "admin" && isloggedin() && user_flag_get("admin", $_SESSION['userid'])) {
        $PAGE->menu_sub[] = array('name' => 'admin', 'html' => a_href(get_url(-1, 'admin::main'), __gettext("Main")));
        $PAGE->menu_sub[] = array('name' => 'admin:users:add', 'html' => a_href(get_url(-1, 'admin::users::add'), __gettext("Add users")));
        $PAGE->menu_sub[] = array('name' => 'admin:users', 'html' => a_href(get_url(-1, 'admin::users'), __gettext("Manage users")));
        $PAGE->menu_sub[] = array('name' => 'admin:users:banned', 'html' => a_href(get_url(-1, 'admin::users::banned'), __gettext("Banned users")));
        $PAGE->menu_sub[] = array('name' => 'admin:users:admin', 'html' => a_href(get_url(-1, 'admin::users::admin'), __gettext("Admin users")));
        $PAGE->menu_sub[] = array('name' => 'admin:flags', 'html' => a_href(get_url(-1, 'admin::flags'), __gettext("Manage flagged content")));
        $PAGE->menu_sub[] = array('name' => 'admin:spam', 'html' => a_href(get_url(-1, 'admin::spam'), __gettext("Spam control")));
    }
}
Exemple #3
0
function friend_pagesetup()
{
    // register links --
    global $profile_id;
    global $PAGE;
    global $CFG;
    global $metatags;
    require_once dirname(__FILE__) . "/default_template.php";
    require_once dirname(__FILE__) . "/lib/friends_config.php";
    $metatags .= "<link rel=\"stylesheet\" href=\"" . $CFG->wwwroot . "mod/friend/css.css\" type=\"text/css\" media=\"screen\" />";
    $page_owner = $profile_id;
    if (isloggedin()) {
        if (defined("context") && context == "network" && $page_owner == $_SESSION['userid']) {
            $PAGE->menu[] = array('name' => 'friends', 'html' => "<li><a href=\"{$CFG->wwwroot}{$_SESSION['username']}/friends/\" class=\"selected\" >" . __gettext("Contacts") . '</a></li>');
        } else {
            $PAGE->menu[] = array('name' => 'friends', 'html' => "<li><a href=\"{$CFG->wwwroot}{$_SESSION['username']}/friends/\" >" . __gettext("Contacts") . '</a></li>');
        }
    }
    if (defined("context") && context == "network") {
        if (user_type($page_owner) == "person" || user_type($page_owner) == "external") {
            $friends_username = user_info('username', $page_owner);
            $PAGE->menu_sub[] = array('name' => 'friend', 'html' => a_href("{$CFG->wwwroot}{$friends_username}/friends/", __gettext("My friends")));
            /*$PAGE->menu_sub[] = array( 'name' => 'friend:of',
              'html' => a_href( "{$CFG->wwwroot}{$friends_username}/friendsof/",
                                 __gettext("Friend of")));*/
            if (isloggedin() && $page_owner == $_SESSION['userid']) {
                $PAGE->menu_sub[] = array('name' => 'friend:requests', 'html' => a_href("{$CFG->wwwroot}{$friends_username}/friends/requests", __gettext("Friendship requests")));
            }
            if (FRIENDS_FOAF) {
                $PAGE->menu_sub[] = array('name' => 'friend:foaf', 'html' => a_href("{$CFG->wwwroot}{$friends_username}/foaf/", __gettext("FOAF")));
            }
        }
    }
}
Exemple #4
0
function messages_pagesetup()
{
    // register links --
    global $profile_id, $PAGE, $CFG, $metatags, $function, $USER;
    $pgowner = $profile_id;
    require_once $CFG->dirroot . "mod/messages/lib/messages_config.php";
    require_once $CFG->dirroot . "mod/messages/default_template.php";
    if (isloggedin() && user_info("user_type", $_SESSION['userid']) != "external") {
        // Add the JavaScript functions
        // Lose the trailing slash
        $url = substr($CFG->wwwroot, 0, -1);
        $metatags .= "<script language=\"javascript\" type=\"text/javascript\" src=\"{$url}/mod/messages/messages.js\"></script>";
        $metatags .= "<link rel=\"stylesheet\" href=\"" . $CFG->wwwroot . "mod/messages/css.css\" type=\"text/css\" media=\"screen\" />";
        $messages = count_records_select('messages', 'to_id=' . $USER->ident . " AND status='unread'");
        if (defined("context") && context == "messages" && $pgowner == $_SESSION['userid']) {
            $PAGE->menu[] = array('name' => 'messages', 'html' => '<li><a href="' . $CFG->wwwroot . $_SESSION['username'] . '/messages/" class="selected">' . __gettext("Messages") . " ({$messages})" . '</a></li>');
        } else {
            $PAGE->menu[] = array('name' => 'messages', 'html' => '<li><a href="' . $CFG->wwwroot . $_SESSION['username'] . '/messages/">' . __gettext("Messages") . " ({$messages})" . '</a></li>');
        }
        if (profile_permissions_check("profile") && defined("context") && context == "messages") {
            if (user_type($pgowner) == "person") {
                $PAGE->menu_sub[] = array('name' => 'messages:list', 'html' => '<a href="' . $CFG->wwwroot . $_SESSION['username'] . '/messages/">' . __gettext("View Messages") . '</a>');
                $PAGE->menu_sub[] = array('name' => 'messages:compose', 'html' => '<a href="' . $CFG->wwwroot . $_SESSION['username'] . '/messages/compose">' . __gettext("Compose") . '</a>');
                $PAGE->menu_sub[] = array('name' => 'messages:sent', 'html' => '<a href="' . $CFG->wwwroot . $_SESSION['username'] . '/messages/sent">' . __gettext("Sent Messages") . '</a>');
            }
        }
    }
}
Exemple #5
0
function elggadmin_pagesetup()
{
    // first login?
    global $CFG;
    if (user_flag_get('admin', $_SESSION['userid']) && !isset($CFG->elggadmin_installed)) {
        $CFG->elggadmin_installed = true;
        set_config('elggadmin_installed', true);
        header_redirect(get_url(null, 'elggadmin::config'), __gettext('Welcome to the Elgg configuration manager!'));
    }
    if (context() == 'admin') {
        if (!plugin_is_loaded('pages')) {
            elgg_messages_add(__gettext('Error: <code>elggadmin</code> plugin needs <code>pages</code> plugin to run'));
        } else {
            pages_submenu_add('elggadmin', __gettext('Site administration'), get_url(null, 'elggadmin::'), 10);
        }
    } elseif (context() == 'elggadmin') {
        if (!plugin_is_loaded('pages')) {
            elgg_messages_add(__gettext('Error: <code>elggadmin</code> plugin needs <code>pages</code> plugin to run'));
            header_redirect(get_url(null, 'admin::'));
        }
        // submenu options
        pages_submenu_add('elggadmin', __gettext('Configuration manager'), get_url(null, 'elggadmin::'));
        pages_submenu_add('elggadmin:theme', __gettext('Default theme editor'), get_url(null, 'elggadmin::theme'));
        pages_submenu_add('elggadmin:frontpage', __gettext('Frontpage template editor'), get_url(null, 'elggadmin::frontpage'));
        pages_submenu_add('elggadmin:logs', __gettext('Error log'), get_url(null, 'elggadmin::logs'));
        sidebar_add(50, 'sidebar-' . elggadmin_currentpage(), elggadmin_sidebar());
        // clear sidebar
        $clear_sidebar[] = 'sidebar-profile';
        $clear_sidebar[] = 'sidebar-' . elggadmin_currentpage();
        sidebar_remove($clear_sidebar, true);
        if (elggadmin_is_404()) {
            header('HTTP/1.0 404 Not Found');
        }
    }
}
function GetXMLTreeProfile($xmlloc)
{
    if (file_exists($xmlloc)) {
        $data = implode('', file($xmlloc));
    } else {
        $fp = fopen($xmlloc, 'r');
        $data = fread($fp, 100000000);
        fclose($fp);
    }
    $data = preg_replace("/<knows>.*<\\/knows>/is", "", $data);
    $parser = xml_parser_create('UTF-8');
    xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 0);
    xml_parse_into_struct($parser, $data, $vals, $index);
    xml_parser_free($parser);
    $code = xml_get_error_code($parser);
    if ($code != XML_ERROR_NONE) {
        global $messages;
        $messages[] = __gettext("XML error: ") . xml_error_string($code);
    }
    $tree = array();
    $i = 0;
    if (isset($vals[$i]['attributes'])) {
        $tree[$vals[$i]['tag']][]['ATTRIBUTES'] = $vals[$i]['attributes'];
        $index = count($tree[$vals[$i]['tag']]) - 1;
        $tree[$vals[$i]['tag']][$index] = array_merge($tree[$vals[$i]['tag']][$index], GetChildren($vals, $i));
    } else {
        $tree[$vals[$i]['tag']][] = GetChildren($vals, $i);
    }
    return $tree;
}
Exemple #7
0
function invite_pagesetup()
{
    global $PAGE;
    if (defined('context') && context == 'network' && isloggedin()) {
        if (!maxusers_limit()) {
            $PAGE->menu_sub[] = array('name' => 'invite:friend', 'html' => a_href(get_url(null, 'invite::invite'), __gettext("Invite a friend")));
        }
    }
}
Exemple #8
0
function template_pagesetup()
{
    // register links --
    global $profile_id;
    global $PAGE;
    global $CFG;
    $page_owner = $profile_id;
    if (defined("context") && context == "account" && !$CFG->disable_templatechanging && user_info("user_type", $_SESSION['userid']) != "external") {
        if ($page_owner == $_SESSION['userid'] && $page_owner != -1) {
            $PAGE->menu_sub[] = array('name' => 'template:change', 'html' => a_href("{$CFG->wwwroot}mod/template/", __gettext("Change theme")));
        }
    }
    $CFG->templates->variables_substitute['templatesroot'][] = "templates_root";
}
Exemple #9
0
function a_home_pagesetup()
{
    // register links --
    global $profile_id;
    global $PAGE;
    global $CFG;
    $page_owner = $profile_id;
    $rss_username = user_info('username', $page_owner);
    define("home", $context);
    if (isloggedin()) {
        if (defined("context") && context == "home" && $page_owner == $_SESSION['userid']) {
            $PAGE->menu[] = array('name' => 'home', 'html' => "<li><a href=\"{$CFG->wwwroot}/ \" class=\"selected\" >" . __gettext("Home") . '</a></li>');
        } else {
            $PAGE->menu[] = array('name' => 'home', 'html' => "<li><a href=\"{$CFG->wwwroot} \" >" . __gettext("Home") . '</a></li>');
        }
    }
}
Exemple #10
0
function contenttoolbar_widget_display($widget)
{
    global $CFG;
    $video_url = widget_get_data("video_url", $widget->ident);
    $video_width = widget_get_data("video_width", $widget->ident);
    $video_height = widget_get_data("video_height", $widget->ident);
    $embedpattern = "/<embed[\\w\\s\"=;:.&\\?\\/-]*>\\s*<\\/embed>/";
    $urlpattern = "/(ftp|http|https):\\/\\/(\\w+:{0,1}\\w*@)?(\\S+)(:[0-9]+)?(\\/|\\/([\\w#!:.?+=&%@!\\-\\/]))?\"/";
    preg_match($embedpattern, $video_url, $embed);
    if (empty($embed)) {
        $body = __gettext("Invalid video param edit an check that if is a valid &lt;embed> object.");
    } else {
        preg_match($urlpattern, $video_url, $url);
        $video_url = substr($url[0], 0, -1);
        $body = run("video:text:process", "{{video:{$video_url}}}");
    }
    return array('title' => "", 'content' => $body);
}
Exemple #11
0
function profile_photo_display_output_field($parameter)
{
    global $CFG, $profile_id;
    $html = '';
    if ($parameter[1] == "profile_photo") {
        if (!empty($parameter[4]) && $parameter[0] != "photo") {
            $html .= "<img class=\"profile-photo\" src=\"{$CFG->wwwroot}mod/profile_photo/img.php?id={$parameter[4]}&amp;constraint1=w&amp;size1=250\" alt=\"Profile photo\" />";
        } else {
            $pictureglyph = __gettext("Click here to upload a photo");
            $html = <<<END
</p>
<style type="text/css">
div#default-profile-icon {
    width:250px;
    height:200px;
    background:url({$CFG->wwwroot}mod/profile_photo/default.gif) no-repeat;
    position:relative;
}

div#default-profile-icon p {
    position:absolute;
    top:150px;
    right:40px;
    margin:0;
    padding:0;
    color:#fff;
}

div#default-profile-icon p a {
    text-decoration:underline;
    color:#fff;
}
</style>

<div id="default-profile-icon">
<p><a href="{$CFG->wwwroot}profile/edit.php?profile_id={$profile_id}">{$pictureglyph}</a></p>
</div>
<p>
END;
        }
    }
    return $html;
}
/**
 * Deletes the specified message
 * @param int $msg Message id
 * @param int $user Current user id
 * @param boolean $sent If the message its a sent message or not
 */
function deleteMessage($msg, $user, $sent = 0)
{
    global $messages;
    if ($msg_info = get_record('messages', 'ident', $msg)) {
        if ($sent) {
            $msg_info->hidden_from = '1';
        } else {
            $msg_info->hidden_to = '1';
        }
        $msg_info->status = "read";
        update_record('messages', $msg_info);
        if ($msg_info->hidden_from && $msg_info->hidden_to) {
            delete_records('messages', 'ident', $msg);
        }
        $messages[] = __gettext("The selected message was deleted.");
    } else {
        $messages[] = __gettext("The message ID its not valid!.");
    }
    return $sent;
}
Exemple #13
0
function toolbar_searchbox($vars)
{
    global $CFG;
    $all = __gettext("all");
    $people = __gettext("People");
    $communities = __gettext("Communities");
    $tagcloud = __gettext("Tag cloud");
    $browse = __gettext("Browse");
    //$searchdefault = __gettext("Search");
    $go = __gettext("Search");
    $searchbox = <<<END

        <div id="search-header"><!-- open search-header div -->
        <form id="searchform" action="{$CFG->wwwroot}search/index.php" method="get">
            <p><input type="text" size="20" name="tag" value="{$searchdefault}" onclick="if (this.value=='{$searchdefault}') { this.value='' }" />

            <input type="submit" value={$go} />
        </form>
        </div><!-- close search-header div -->

END;
    return $searchbox;
}
/**
 * Execute a given sql command string
 *
 * Completely general function - it just runs some SQL and reports success.
 *
 * @uses $db
 * @param string $command The sql string you wish to be executed.
 * @param bool $feedback Set this argument to true if the results generated should be printed. Default is true.
 * @return string
 */
function execute_sql($command, $feedback = true)
{
    /// Completely general function - it just runs some SQL and reports success.
    global $db, $CFG;
    $olddebug = $db->debug;
    if (!$feedback) {
        $db->debug = false;
    }
    if (defined('ELGG_PERFDB')) {
        global $PERF;
        $PERF->dbqueries++;
    }
    $result = $db->Execute($command);
    $db->debug = $olddebug;
    if ($result) {
        // elggcache_purge(); // TODO - should probably be here, given function can do anything, but very inefficient
        if ($feedback && $CFG->debug > 7) {
            notify(__gettext('Success'), 'notifysuccess');
        }
        return true;
    } else {
        if ($feedback) {
            echo '<p><span class="error">' . __gettext('Error') . '</span></p>';
        }
        if (!empty($CFG->dblogerror)) {
            $debug = debug_backtrace();
            foreach ($debug as $d) {
                if (strpos($d['file'], 'datalib') === false) {
                    error_log("SQL " . $db->ErrorMsg() . " in {$d['file']} on line {$d['line']}. STATEMENT:  {$command}");
                    break;
                }
            }
        }
        return false;
    }
}
<?php

global $CFG;
$descOne = sprintf(__gettext("Access controls let you control exactly who sees everything you upload to %s, including files, blog posts and profile items."), $CFG->sitename);
$descTwo = __gettext("This screen lets you create new access controls. To get started, add a new access control by typing in its name below.");
$run_result .= <<<END

    <p>{$descOne}</p>
    <p>{$descTwo}</p>
END
;
    // Number of files
    $files = get_record_sql('SELECT COUNT(ident) AS numfiles,SUM(size) AS totalsize FROM ' . $CFG->prefix . 'files');
    $files_7days = get_record_sql('SELECT COUNT(ident) AS numfiles, SUM(size) AS totalsize FROM ' . $CFG->prefix . 'files WHERE time_uploaded > ?', array(time() - 86400 * 7));
    $run_result .= templates_draw(array('context' => 'adminTable', 'name' => "<h3>" . __gettext("File statistics") . "</h3> ", 'column1' => "<h4>" . __gettext("All-time:") . "</h4> <p>" . sprintf(__gettext("%u files (%s)"), $files->numfiles, size_readable($files->totalsize)) . "</p><h4>" . __gettext("Last 7 days:") . "</h4><p>" . sprintf(__gettext("%u files (%s)"), $files_7days->numfiles, size_readable($files_7days->totalsize)) . "</p>", 'column2' => "&nbsp;"));
    // DB size
    $totaldbsize = 0;
    if ($CFG->dbtype == 'mysql') {
        if ($dbsize = get_records_sql('SHOW TABLE STATUS')) {
            foreach ($dbsize as $atable) {
                // filter on prefix if we have it.
                if (!empty($CFG->prefix) && strpos($atable->Name, $CFG->prefix) !== 0) {
                    continue;
                }
                $totaldbsize += intval($atable->Data_length) + intval($atable->Index_length);
            }
            $run_result .= templates_draw(array('context' => 'adminTable', 'name' => "<h3>" . __gettext("Database statistics") . "</h3> ", 'column1' => "<h4>" . __gettext("Total database size:") . "</h4> <p>" . size_readable($totaldbsize) . "</p>", 'column2' => "&nbsp;"));
        }
    }
    // Users online right now
    $run_result .= "<h2>" . __gettext("Users online now") . "</h2>";
    $run_result .= "<p>" . __gettext("The following users have an active session and have performed an action within the past 10 minutes.") . "</p>";
    if ($users = get_records_select('users', "code != ? AND last_action > ?", array('', time() - 600), 'username ASC')) {
        $run_result .= templates_draw(array('context' => 'adminTable', 'name' => "<h3>" . __gettext("Username") . "</h3>", 'column1' => "<h3>" . __gettext("Full name") . "</h3>", 'column2' => "<h3>" . __gettext("Email address") . "</h3>"));
        foreach ($users as $user) {
            $run_result .= run("admin:users:panel", $user);
        }
    } else {
        $users = array();
    }
    $run_result .= "<p>" . sprintf(__gettext("%u users in total."), sizeof($users)) . "</p>";
}
Exemple #17
0
function photogallery_folder_view($folder)
{
    global $CFG, $metatags, $messages;
    require_once $CFG->dirroot . 'lib/filelib.php';
    $metatags .= file_get_contents($CFG->dirroot . "mod/photogallery/css");
    $metatags .= <<<END
        <script type="text/javascript">
            var elggWwwRoot = "{$CFG->wwwroot}";
        </script>
        <script type="text/javascript" src="{$CFG->wwwroot}mod/photogallery/lightbox/js/prototype.js"></script>
        <script type="text/javascript" src="{$CFG->wwwroot}mod/photogallery/lightbox/js/scriptaculous.js?load=effects"></script>
        <script type="text/javascript" src="{$CFG->wwwroot}mod/photogallery/lightbox/js/lightbox.js"></script>
        <link rel="stylesheet" href="{$CFG->wwwroot}mod/photogallery/lightbox/css/lightbox.css" type="text/css" media="screen" />

END;
    $file_html = "";
    $photo_html = "";
    $folder_html = "";
    // Get all the files in this folder
    if ($files = get_records_select('files', "folder = ? AND files_owner = ? ORDER BY time_uploaded desc", array($folder->ident, $folder->files_owner))) {
        foreach ($files as $file) {
            if (run("users:access_level_check", $file->access) == true) {
                $image = $CFG->wwwroot . "_files/icon.php?id=" . $file->ident . "&amp;w=200&amp;h=200";
                $filepath = $CFG->wwwroot . user_info("username", $file->files_owner) . "/files/{$folder->ident}/{$file->ident}/" . urlencode($file->originalname);
                $image = "<a href=\"{$CFG->wwwroot}_files/icon.php?id={$file->ident}&w=500&h=500\" rel=\"lightbox[folder]\"><img src=\"{$image}\" /></a>";
                $fileinfo = round($file->size / 1048576, 4) . "Mb";
                $filelinks = file_edit_links($file);
                $uploaded = sprintf(__gettext("Uploaded on %s"), strftime("%A, %d %B %Y", $file->time_uploaded));
                $keywords = display_output_field(array("", "keywords", "file", "file", $file->ident, $file->owner));
                $mimetype = mimeinfo('type', $file->originalname);
                if (empty($file->title)) {
                    $file->title = __gettext("No title");
                }
                if (substr_count($mimetype, "image") > 0) {
                    $photo_html .= <<<END

                            <div class="photogallery-photo-container">
                                <div class="photogallery-photo-image">
                                    {$image}
                                </div>
                                <div class="photogallery-photo-info">
                                    <h2 class="photogallery-photo-title"><a href="{$filepath}" >{$file->title}</a></h2>
                                    <p class="photogallery-photo-description">
                                        {$file->description}
                                    </p>
                                    <p class="photogallery-photo-keywords">
                                        {$keywords}
                                    </p>
                                    <p class="photogallery-photo-infobar">
                                        {$uploaded}<br />
                                        {$fileinfo} {$mimetype} {$filelinks}
                                    </p>
                                </div>
                            </div>

END;
                } else {
                    $file_html .= <<<END

                            <div class="photogallery-file-container">
                                <div class="photogallery-file-image">
                                    <a href="{$filepath}">{$image}</a>
                                </div>
                                <div class="photogallery-file-info">
                                    <h2 class="photogallery-file-title"><a href="{$filepath}">{$file->title}</a></h2>
                                    <p>{$file->description}</p>
                                    <p class="photogallery-file-keywords">
                                        {$keywords}
                                    </p>
                                    <p class="photogallery-file-infobar">
                                        {$uploaded}<br />
                                        {$fileinfo} {$mimetype} {$filelinks}
                                    </p>
                                </div>
                            </div>

END;
                }
            }
        }
    }
    if ($subfolders = get_records_select('file_folders', "parent = ? AND files_owner = ? ORDER BY name desc", array($folder->ident, $folder->owner))) {
        foreach ($subfolders as $subfolder) {
            $folderlinks = file_folder_edit_links($subfolder);
            $keywords = display_output_field(array("", "keywords", "folder", "folder", $subfolder->ident, $subfolder->owner));
            $filepath = $CFG->wwwroot . user_info("username", $folder->files_owner) . "/files/" . $subfolder->ident;
            $folder_html .= <<<END

                        <div class="photogallery-file-container">
                            <div class="photogallery-file-image">
                                <a href="{$filepath}"><img src="{$CFG->wwwroot}_files/folder.png" /></a>
                            </div>
                            <div class="photogallery-file-info">
                                <h2 class="photogallery-file-title"><a href="{$filepath}">{$subfolder->name}</a></h2>
                                <p class="photogallery-file-keywords">
                                    {$keywords}
                                </p>
                                <p class="photogallery-file-infobar">
                                    {$folderlinks}
                                </p>
                            </div>
                        </div>

END;
        }
    }
    if (!empty($file_html)) {
        $file_html = "<h2>" . __gettext("Non-photo files") . "</h2>" . $file_html;
    }
    if (!empty($folder_html)) {
        $folder_html = "<h2>" . __gettext("Subfolders") . "</h2>" . $folder_html;
    }
    $body = $photo_html . $file_html . $folder_html;
    if (empty($body)) {
        $body = "<p>" . __gettext("This folder is currently empty.") . "</p>";
    }
    return $body;
}
}
// Display the river, if river plugin is installed!
if (function_exists('river_save_event')) {
    $river = river_get_river($page_owner, 0, $starttime);
    $body .= "<h2>" . __gettext("Your river") . "</h2>";
    if ($river) {
        $d1 = "";
        $d2 = "";
        foreach ($river as $r) {
            $d2 = date("j-n-y", $r->ts);
            // Set second marker
            $txt = $r->string;
            $date = date("l jS F Y", $r->ts);
            $time = date("g:ia", $r->ts);
            if (strcmp($d1, $d2) != 0) {
                $body .= "<div class=\"_activity_river_entry_time\">{$date}</div>";
            }
            $body .= <<<END
\t\t\t\t<div class="_activity_river_entry">
\t\t\t\t\t<div class="_activity_river_entry_txt">{$txt}
\t\t\t\t\t<span class="_activity_river_entry_time">{$time}</span></div>
\t\t\t\t</div>
END;
            $d1 = date("j-n-y", $r->ts);
            // Now set first marker to date
        }
    } else {
        $body .= __gettext("This user hasn't done anything yet.");
    }
}
templates_page_output($title, $body);
    }
    $author = "";
    $usericon = "default.png";
    //if (!empty($post->owner)) {
    //    $post_authors[$post->owner] = $author;
    //}
    // $date = stripslashes($post->posted);
    $date = strftime("%B %d, %Y", $post->added);
    if ($date != $prevdate) {
        $run_result .= "<div class=\"feed_date\"><h2>" . $date . "</h2></div>";
    }
    $prevdate = $date;
    if (trim($date) == "") {
        $date = __gettext("unknown");
    }
    // $date = stripslashes($post->added);
    $fullname = stripslashes($post->name);
    $tagline = stripslashes($post->tagline);
    $title = stripslashes($post->title);
    $body = stripslashes($post->body);
    $controls = "";
    $controls .= "<a href=\"" . $post->siteurl . "\">[" . __gettext("View site") . "]</a><br /><br />";
    if (logged_on) {
        if (run("rss:subscribed", $post->feed)) {
            $controls .= "<a href=\"" . url . "_rss/subscriptions.php?action=unsubscribe&amp;feed=" . $post->feed . "\" onclick=\"return confirm('" . __gettext("Are you sure you want to unsubscribe from this feed?") . "')\">[" . __gettext("Unsubscribe") . "]</a>";
        } else {
            $controls .= "<a href=\"" . url . "_rss/subscriptions.php?action=subscribe&amp;feed=" . $post->feed . "\" onclick=\"return confirm('" . __gettext("Are you sure you want to subscribe to this feed?") . "')\">[" . __gettext("Subscribe") . "]</a>";
        }
    }
    $run_result .= templates_draw(array('context' => 'rsspost', 'usericon' => $usericon, 'body' => $body, 'fullname' => $fullname, 'title' => $title, 'sitelink' => $post->siteurl, 'feedlink' => url . "_rss/individual.php?feed=" . $post->feed, 'link' => $post->url, 'tagline' => $tagline, 'controls' => $controls));
}
/**
 * Return the basic HTML for a message (given its database row),
 * where the title is a heading 2 and the body is in a paragraph.
 *
 * @param string $message the message body
 * @return string HTML output
 * @todo TODO refactor, separate display and logic
 * @author Ben WerdMuller <*****@*****.**>
 */
function display_message($message)
{
    global $CFG;
    if ($message->from_id == -1) {
        $from->name = __gettext("System");
    } else {
        $from = get_record_sql("select * from " . $CFG->prefix . "users where ident = " . $message->from_id);
    }
    $title = "[" . __gettext("Message from ");
    if ($message->from_id != -1) {
        $title .= "<a href=\"" . $CFG->wwwroot . user_info("username", $message->from_id) . "/\">";
    }
    $title .= $from->name;
    if ($message->from_id != -1) {
        $title .= "</a>";
    }
    $title .= "] " . $message->title;
    $body = "<p>" . nl2br(str_replace("\t", "&nbsp;&nbsp;&nbsp;&nbsp;", activate_urls($message->body))) . "</p>";
    $body = templates_draw(array('context' => 'databox1', 'name' => $title, 'column1' => $body));
    return $body;
}
        $body .= templates_draw(array('context' => 'adminTable', 'name' => "<b>" . __gettext("Last updated") . "</b>", 'column1' => "<b>" . __gettext("Resource name") . "</b>", 'column2' => "&nbsp;"));
        foreach ($feed_subscriptions as $feed) {
            if (run("permissions:check", "profile")) {
                $name = "<input type=\"checkbox\" name=\"feedautopost[]\" value=\"" . $feed->subid . "\" ";
                $name .= "onclick=\"if (this.checked) return confirm('" . __gettext("Are you sure you want to import this content into your personal blog?\\nYou should make sure you own it or have permission from the copyright holder.") . "')\" ";
                if ($feed->autopost == "yes") {
                    $name .= " checked=\"checked\"";
                }
                $name .= " />";
            }
            $name .= "\r\n                <a href=\"" . $feed->siteurl . "\">" . stripslashes($feed->name) . "</a>\r\n                <a href=\"" . $feed->url . "\"><img src=\"{$CFG->wwwroot}mod/template/icons/rss.png\" border=\"0\" alt=\"rss\" /></a>\r\n            ";
            if (run("permissions:check", "profile")) {
                $name .= "<br />";
                $name .= __gettext("Keywords: ") . "<input type=\"text\" name=\"keywords[" . $feed->subid . "]\" value=\"" . htmlspecialchars($feed->autopost_tag) . "\" />";
            }
            $column2 = "<a href=\"" . url . "_rss/individual.php?feed=" . $feed->ident . "\">" . __gettext("View content") . "</a>";
            $body .= templates_draw(array('context' => 'adminTable', 'name' => strftime("%B %d %Y, %H:%M", $feed->last_updated), 'column1' => $name, 'column2' => $column2));
        }
        if (run("permissions:check", "profile")) {
            $body .= templates_draw(array('context' => 'adminTable', 'name' => "<input type=\"hidden\" name=\"action\" value=\"rss:subscriptions:update\" />", 'column1' => "<input type=\"submit\" value=\"" . __gettext("Update") . "\" />", 'column2' => ""));
            $body .= "</form>";
        }
    } else {
        if ($_SESSION['userid'] == $page_owner) {
            $body .= "<p>" . __gettext("You are not subscribed to any feeds.") . "</p>";
        } else {
            $body .= "<p>" . __gettext("No feeds were found.") . "</p>";
        }
    }
    $run_result .= $body;
}
\t\t<td width="25%" valign="top"><input type="checkbox" name="invite_ident" value="{$user->ident}"/></td>
\t\t<td width="35%" valign="top">{$user->username}</td>
\t\t<td width="40%" valign="top">{$user->name} {$user->lastname}</td>
\t</tr>
    </table>
</div>
END;
            $body .= $block;
        }
        $body .= '<input type="submit" name="Invite" value="Invite"/>';
    }
}
if (!empty($invite_ident)) {
    global $messages;
    // We have an ident, process
    if ($result = get_record('friends', 'owner', $invite_ident, 'friend', $profile_id)) {
        $messages[] = __gettext("The user already is a member of this community.");
    } else {
        if ($result = get_record('friends_requests', 'owner', $profile_id, 'friend', $invite_ident)) {
            $messages[] = __gettext("The user already has been invited.");
        } else {
            $x = new stdClass();
            $x->owner = $profile_id;
            $x->friend = $invite_ident;
            insert_record('friends_requests', $x);
            $messages[] = __gettext("The user has been invited.");
        }
    }
}
$body .= '</form>';
echo templates_page_draw(array($title, templates_draw(array('context' => 'contentholder', 'title' => $title, 'body' => $body))));
                               WHERE fs.user_id = ?', array($parameter));
if ($posts = get_records_sql('SELECT fp.*,f.name,f.siteurl,f.tagline,f.url AS feedurl FROM ' . $CFG->prefix . 'feed_subscriptions fs
                              JOIN ' . $CFG->prefix . 'feed_posts fp ON fp.feed = fs.feed_id
                              JOIN ' . $CFG->prefix . 'feeds f ON f.ident = fs.feed_id 
                              WHERE fs.user_id = ? ORDER BY fp.added DESC ' . sql_paging_limit($feed_offset, 25), array($parameter))) {
    foreach ($posts as $post) {
        $run_result .= run("rss:view:post", $post);
    }
}
$profile_name = htmlspecialchars(optional_param('profile_name'), ENT_COMPAT, 'utf-8');
if ($numposts - ($feed_offset + 25) > 0) {
    $display_feed_offset = $feed_offset + 25;
    $back = __gettext("Back");
    $run_result .= <<<END
        
        <a href="{$CFG->wwwroot}{$profile_name}/newsclient/all/skip={$display_feed_offset}">&lt;&lt; {$back}</a>
        
END;
}
if ($feed_offset > 0) {
    $display_feed_offset = $feed_offset - 25;
    if ($display_feed_offset < 0) {
        $display_feed_offset = 0;
    }
    $next = __gettext("Next");
    $run_result .= <<<END
        
        <a href="{$CFG->wwwroot}{$profile_name}/newsclient/all/skip={$display_feed_offset}">{$next} &gt;&gt;</a>
        
END;
}
Exemple #24
0
<?php

//    ELGG display popular tags page
// Run includes
require_once dirname(dirname(__FILE__)) . "/includes.php";
run("search:init");
define("context", "search");
$title = __gettext("Some Tags");
templates_page_setup();
$body = run("content:tags");
$body .= run("search:tags:display");
$body = templates_draw(array('context' => 'contentholder', 'title' => $title, 'body' => $body));
echo templates_page_draw(array($title, $body));
        $validcharset = "ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnpqrstuvwxyz234567898765432";
        $newpassword = "";
        for ($i = 0; $i < 8; $i++) {
            $newpassword .= $validcharset[mt_rand(0, strlen($validcharset) - 1)];
        }
        $newpassword = strtolower($newpassword);
        $sitename = sitename;
        email_to_user($details, null, sprintf(__gettext("Your %s password"), $sitename), sprintf(__gettext("Your %s password has been reset.\n\nFor your records, your new password is:\n\n\tPassword: %s\n\nPlease consider changing your password as soon as you have logged in for security reasons.\n\nWe hope you continue to enjoy using the system.\n\nRegards,\n\nThe %s Team"), $sitename, $newpassword, $sitename));
        $newpassword = md5($newpassword);
        set_field('users', 'password', $newpassword, 'ident', $details->ident);
        delete_records('password_requests', 'owner', $details->ident);
    } else {
        $passwordDesc2 = __gettext("Your password request code appears to be invalid. Try generating a new one?");
        $run_result .= <<<END
    
    <p>
        {$passwordDesc2}
    </p>
    
END;
    }
} else {
    $passwordDesc3 = __gettext("Your password request code appears to be invalid. Try generating a new one?");
    $run_result .= <<<END
    
    <p>
        {$passwordDesc3}
    </p>
    
END;
}
Exemple #26
0
function file_folder_edit_links($folder)
{
    global $page_owner, $CFG;
    $foldermenu = "";
    if (permissions_check("files:edit", $folder->owner) || permissions_check("files:edit", $folder->files_owner)) {
        $delete = __gettext("Delete");
        // gettext variable
        $edit = __gettext("Edit");
        // gettext variable
        $foldermenu = <<<END
            [<a href="{$CFG->wwwroot}mod/file/edit_folder.php?edit_folder_id={$folder->ident}&amp;owner={$page_owner}&amp;return_type=parent">{$edit}</a>]
            [<a href="{$CFG->wwwroot}mod/file/action_redirection.php?action=delete_folder&amp;delete_folder_id={$folder->ident}">{$delete}</a>]
END;
    }
    return $foldermenu;
}
if (sizeof($parameter) >= 2) {
    if (!isset($data['profile:preload'][$parameter[1]])) {
        if (!($value = get_record('profile_data', 'name', $parameter[1], 'owner', $page_owner))) {
            $value = new StdClass();
            $value->value = null;
            $value->ident = null;
            $value->access = default_access;
        }
    } else {
        unset($value);
        $value->value = $data['profile:preload'][$parameter[1]];
        $value->access = default_access;
    }
    $name = <<<END
                    <label for="{$parameter[1]}">
                        <b>{$parameter[0]}</b>
END;
    if (isset($parameter[3])) {
        $name .= "<br /><i>" . $parameter[3] . "</i>";
    }
    $name .= <<<END
                    </label>
END;
    if (sizeof($parameter) < 3) {
        $parameter[2] = "text";
    }
    $column1 = display_input_field(array("profiledetails[" . $parameter[1] . "]", $value->value, $parameter[2], $parameter[1], $value->ident, $page_owner));
    $column2 = "<label>" . __gettext("Access Restriction:") . "<br />";
    $column2 .= run("display:access_level_select", array("profileaccess[" . $parameter[1] . "]", $value->access)) . "</label>";
    $run_result .= templates_draw(array('context' => 'databox', 'name' => $name, 'column1' => $column1, 'column2' => $column2));
}
<?php

/*
 * This script display the video wizard
 * 
 * Created on Apr 3, 2007
 * 
 * @uses $metatags
 * @uses $CFG
 * 
 * @author Diego Andrés Ramírez Aragón <*****@*****.**>
 * @copyright Diego Andrés Ramírez Aragón - 2007
*/
require_once dirname(dirname(__FILE__)) . "/../includes.php";
global $metatags, $CFG;
templates_page_setup();
$field = optional_param('input_field', 'new_weblog_post');
$url = substr($CFG->wwwroot, 0, -1);
$metatags .= "<script language=\"javascript\" type=\"text/javascript\" src=\"{$url}/mod/contenttoolbar/js/helpers.js\"></script>";
$metatags .= "<script language=\"javascript\" type=\"text/javascript\" src=\"{$url}/mod/contenttoolbar/js/script.js\"></script>";
$metatags .= "<script language=\"javascript\" type=\"text/javascript\" src=\"{$url}/mod/contenttoolbar/js/edit.js\"></script>";
$metatags .= "<link rel=\"stylesheet\" href=\"" . $CFG->wwwroot . "mod/contenttoolbar/wizard.css\" type=\"text/css\" media=\"screen\" />";
$explanation = __gettext("To embed videos from popular sites like Google Video and Youtube, obtain the embed HTML, paste it in the following form and configure your preferred size:");
$video_url_label = __gettext("Video embed code");
$video_size_label = __gettext("Video size");
$video_button_label = __gettext("Insert video");
$error_msg = __gettext("We had trouble understanding this code. Are you sure this is the embed HTML for your video?");
$run_result = templates_draw(array('context' => 'video_wizard', 'title' => $CFG->sitename, 'explanation' => $explanation, 'video_url_label' => $video_url_label, 'video_size_label' => $video_size_label, 'video_button_label' => $video_button_label, 'error_msg' => $error_msg, 'input_field' => $field));
echo $run_result;
            $first_column_list .= sprintf($column_list_element_template, $description, $description, $widget->ident, $name);
            $do_init .= 'new YAHOO.example.DDList("eli_' . $widget->ident . '");' . "\n";
            //$do_init .= 'YAHOO.util.DDM.getElement("eli_'.$widget->ident.'").did='.$widget->display_order.';'."\n";
            $do_init .= 'YAHOO.util.DDM.getElement("eli_' . $widget->ident . '").column=0;' . "\n";
        }
    }
    $second_column_list = '';
    if ($widgets = widget_for_user($page_owner, 'profile', 0, 1)) {
        foreach ($widgets as $widget) {
            $name = 'Unknown';
            $description = '';
            foreach ($CFG->widgets->list as $widget_class) {
                if ($widget_class['type'] == $widget->type) {
                    $name = $widget_class['name'];
                    $description = $widget_class['description'];
                    break;
                }
            }
            $second_column_list .= sprintf($column_list_element_template, $description, $description, $widget->ident, $name);
            $do_init .= 'new YAHOO.example.DDList("eli_' . $widget->ident . '");' . "\n";
            //$do_init .= 'YAHOO.util.DDM.getElement("eli_'.$widget->ident.'").did='.$widget->display_order.';'."\n";
            $do_init .= 'YAHOO.util.DDM.getElement("eli_' . $widget->ident . '").column=1;' . "\n";
        }
    }
    $title = __gettext("Manage Widgets");
    $body = sprintf($top_bit_template, $do_init) . sprintf($widget_template, $widget_list, $first_column_list, $second_column_list);
} else {
    $body = __gettext("You must be logged-in to manage your widgets");
}
// Output to the screen
templates_page_output($title, $body);
$searchline = str_replace("access", "t.access", $searchline);
if ($tags = get_records_sql('SELECT tag, count(ident) AS number 
                             FROM ' . $CFG->prefix . 'tags t
                             WHERE ' . $searchline . ' AND owner = ' . $parameter . '
                             GROUP BY tag ASC')) {
    $max = 0;
    foreach ($tags as $tag) {
        if ($tag->number > $max) {
            $max = $tag->number;
        }
    }
    $tag_count = 0;
    $run_result .= "<div id=\"tagcloud\"><p>";
    foreach ($tags as $tag) {
        if ($max > 1) {
            $size = round(log($tag->number) / log($max) * 200) + 100;
        } else {
            $size = 100;
        }
        $tag->tag = stripslashes($tag->tag);
        $run_result .= "<a href=\"" . url . "search/index.php?all=" . urlencode(htmlspecialchars($tag->tag, ENT_COMPAT, 'utf-8')) . "&amp;owner={$parameter}\" style=\"font-size: {$size}%\" title=\"" . htmlspecialchars($tag->tag, ENT_COMPAT, 'utf-8') . " (" . $tag->number . ")\">";
        $run_result .= $tag->tag . "</a>";
        if ($tag_count < sizeof($tags) - 1) {
            $run_result .= ", ";
        }
        $tag_count++;
    }
    $run_result .= "</p></div>";
} else {
    $run_result = "<p>" . __gettext("No tags found for this user.") . "</p>";
}