Ejemplo n.º 1
0
function folio_control_page_edit_move($page)
{
    // Find the security information for the page.
    global $CFG;
    $url = url;
    $page_ident = intval($page->page_ident);
    $parentpage_ident = intval($page->parentpage_ident);
    // Check to see if we're on the homepage.
    if (folio_page_is_homepage($page)) {
        // Don't allow moving a homepage.
        $run_result = '<input type="hidden" name="parentpage_ident" value="' . $page->parentpage_ident . '" />';
    } elseif (!isloggedin()) {
        // Have to be logged in to move a page.
        // mark control as disabled & don't bother loading all of the pages.
        $run_result = "\t\t\t<SELECT NAME=\"parentpage_ident\" DISABLED>";
        // Get parentpage title
        $pages = recordset_to_array(get_recordset_sql('select page_ident, title from ' . $CFG->prefix . 'folio_page ' . 'WHERE newest = 1 and user_ident = ' . $page->user_ident . ' AND page_ident = ' . $page->parentpage_ident));
        // build
        if ($pages) {
            // Iterate
            foreach ($pages as $potentialpage) {
                // Selected
                $run_result .= '<OPTION VALUE=' . $potentialpage->page_ident . " SELECTED=true>" . $potentialpage->title . "\n";
            }
            $run_result .= "</SELECT><br/>\n" . "<input type='hidden' name='parentpage_ident' value='{$potentialpage->page_ident}' />\n";
        } else {
            // No pages.  Show control set to homepage & disabled.
            $run_result = "\t\t\t<SELECT NAME=\"parentpage_ident\" disabled=TRUE>" . '<OPTION VALUE="' . $page->parentpage_ident . '" SELECTED=true>Homepage' . "</SELECT><br/>\n" . "<input type='hidden' name='parentpage_ident' value='{$potentialpage->page_ident}' />\n";
        }
        $run_result = templates_draw(array('context' => 'databoxvertical', 'name' => 'Parent Page', 'contents' => $run_result));
    } else {
        // Ok conditions, build the control.
        $run_result = "\t\t\t<SELECT NAME=\"parentpage_ident\">";
        // Get all titles for active pages belonging to the current user
        $pages = recordset_to_array(get_recordset_sql('select page_ident, title from ' . $CFG->prefix . 'folio_page ' . 'WHERE newest = 1 and user_ident = ' . $page->user_ident . ' AND page_ident <> ' . $page->page_ident . ' AND parentpage_ident <> ' . $page->page_ident . ' order by title'));
        // build
        if ($pages) {
            // Iterate
            foreach ($pages as $potentialpage) {
                if ($page->parentpage_ident == $potentialpage->page_ident) {
                    // Selected
                    $run_result .= '<OPTION VALUE=' . $potentialpage->page_ident . " SELECTED=true>" . $potentialpage->title . "\n";
                } else {
                    // !Selected
                    $run_result .= '<OPTION VALUE=' . $potentialpage->page_ident . " >" . $potentialpage->title . "\n";
                }
            }
            $run_result .= "</SELECT><br/>\n";
        } else {
            // No pages.  Show control set to homepage & disabled.
            $run_result = "\t\t\t<SELECT NAME=\"parentpage_ident\" disabled=TRUE>" . '<OPTION VALUE="' . $page->parentpage_ident . '" SELECTED=true>Homepage' . "</SELECT><br/>\n";
        }
        $run_result = templates_draw(array('context' => 'databoxvertical', 'name' => 'Parent Page', 'contents' => $run_result));
    }
    return $run_result;
}
<?php

global $page_owner;
global $USER;
if ($page_owner != -1) {
    if (user_type($page_owner) == "person") {
        if ($result = get_records_select('users', "owner = ? AND user_type = ? Limit 5", array($page_owner, 'community'))) {
            $body = "<ul>";
            foreach ($result as $row) {
                $row->name = run("profile:display:name", $row->ident);
                $body .= "<li><a href=\"" . url . $row->username . "/\">" . $row->name . "</a></li>";
            }
            $body .= "<li><a href=\"" . url . $USER->username . "/communities/owned" . "\">" . __gettext("All community") . "</a></li>";
            $body .= "</ul>";
            // $run_result .= $body;
            $run_result .= "<li id=\"community_owned\">";
            $run_result .= templates_draw(array('context' => 'sidebarholder', 'title' => __gettext("Owned communities"), 'body' => $body));
            $run_result .= "</li>";
        } else {
            $run_result .= "";
        }
    }
}
Ejemplo n.º 3
0
function file_folder_view($folder)
{
    global $CFG;
    /*
     *    View a specific folder
     *    (Access rights are presumed)
     */
    // Find out who's the owner
    global $page_owner;
    $owner_username = user_info('username', $page_owner);
    // If we're not in the parent folder, provide a link to return to the parent
    /*
    if ($folder->ident != -1) {
        $folder->name = stripslashes($folder->name);
    }
    */
    $body = "<h2>" . $folder->name . "</h2>";
    // Firstly, get a list of folders
    // Display folders we actually have access to
    if ($folder->idents = get_records_select('file_folders', "parent = {$folder->ident} AND (" . run("users:access_level_sql_where") . ") and files_owner = {$page_owner}")) {
        $subFolders = __gettext("Subfolders");
        // gettext variable
        $body .= <<<END

                            <h3>
                                {$subFolders}
                            </h3>

END;
        foreach ($folder->idents as $folder->ident_details) {
            if (run("users:access_level_check", $folder->ident_details->access) == true) {
                $username = $owner_username;
                $ident = (int) $folder->ident_details->ident;
                $name = get_access_description($folder->ident_details->access);
                $name .= stripslashes($folder->ident_details->name);
                $folder->identmenu = file_folder_edit_links($folder->ident_details);
                $keywords = display_output_field(array("", "keywords", "folder", "folder", $ident, $folder->ident_details->owner));
                if ($keywords) {
                    $keywords = __gettext("Keywords: ") . $keywords;
                }
                $body .= templates_draw(array('context' => 'folder', 'username' => $username, 'url' => $CFG->wwwroot . "{$username}/files/{$ident}", 'ident' => $ident, 'name' => $name, 'menu' => $folder->identmenu, 'icon' => $CFG->wwwroot . "mod/file/folder.png", 'keywords' => $keywords));
            }
        }
    }
    // Then get a list of files
    // View files we actually have access to
    if ($files = get_records_select('files', "folder = ? AND files_owner = ?", array($folder->ident, $page_owner))) {
        foreach ($files as $file) {
            if (run("users:access_level_check", $file->access) == true || $file->owner == $_SESSION['userid']) {
                $username = $owner_username;
                $ident = (int) $file->ident;
                $folder->ident = $file->folder;
                $title = get_access_description($file->access);
                $title .= stripslashes($file->title);
                $description = nl2br(stripslashes($file->description));
                $filetitle = urlencode($title);
                $originalname = stripslashes($file->originalname);
                $filemenu = round($file->size / 1048576, 4) . "MB ";
                $icon = $CFG->wwwroot . "_icon/file/" . $file->ident;
                $filepath = $CFG->wwwroot . "{$username}/files/{$folder->ident}/{$ident}/" . urlencode($originalname);
                $mimetype = mimeinfo('type', $file->originalname);
                if ($mimetype == "audio/mpeg" || $mimetype == "audio/mp3") {
                    $filemenu .= " <object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\"\n        codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0\"\n        width=\"17\" height=\"17\" >\n            <param name=\"allowScriptAccess\" value=\"sameDomain\" />\n            <param name=\"movie\" value=\"" . $CFG->wwwroot . "mod/file/mp3player/musicplayer.swf?song_url={$filepath}&amp;song_title={$filetitle}\" />\n            <param name=\"quality\" value=\"high\" />\n            <embed src=\"" . $CFG->wwwroot . "mod/file/mp3player/musicplayer.swf?song_url={$filepath}&amp;song_title={$filetitle}\"\n            quality=\"high\" bgcolor=\"#E6E6E6\" name=\"xspf_player\" allowscriptaccess=\"sameDomain\"\n            type=\"application/x-shockwave-flash\"\n            pluginspage=\"http://www.macromedia.com/go/getflashplayer\"\n            align=\"center\" height=\"17\" width=\"17\" />\n        </object>";
                }
                $filemenu = file_edit_links($file);
                $keywords = display_output_field(array("", "keywords", "file", "file", $ident, $file->owner));
                if ($keywords) {
                    $keywords = __gettext("Keywords: ") . $keywords;
                }
                $body .= templates_draw(array('context' => 'file', 'username' => $username, 'title' => $title, 'ident' => $ident, 'folder' => $folder->ident, 'description' => $description, 'originalname' => $originalname, 'url' => $filepath, 'menu' => $filemenu, 'icon' => $icon, 'keywords' => $keywords));
                $body .= display_run_displayobjectannotations($file, "file::file");
            }
        }
    }
    // Deliver an apologetic message if there aren't any files or folders
    if (empty($files) && empty($folder->idents)) {
        $body .= "<p>" . __gettext("This folder is currently empty.") . "</p>";
    }
    return $body;
}
Ejemplo n.º 4
0
/**
* Build presentation data
**/
function returnHTML($purpose, $format, $results, $resultcount, $page, $username)
{
    $url = url;
    // PURPOSE
    if ($purpose == 'activity') {
        $pagetitle = 'Recent Activity';
    } elseif ($purpose == 'subscribe') {
        $pagetitle = 'Recent Changes';
    } else {
        error('Invalid purpose ' . $purpose . ' passed to feeds.php');
        die;
    }
    switch ($format) {
        case 'html':
            $body = folio_control_htmlfeed($results, $resultcount, $page, $username);
            // Transfer into template & write.
            templates_page_setup();
            if (isloggedin()) {
                $rsskey = folio_createhash($_SESSION['userid'] . '/');
            } else {
                $rsskey = '';
            }
            $types = str_replace(' ', '+', required_param('types'));
            $body = templates_draw(array('context' => 'contentholder', 'title' => "<a href='{$url}{$username}/{$purpose}/rss/{$types}/{$rsskey}'><img border=0 src='{$url}_templates/icons/rss.png' /></a> {$username} :: {$pagetitle} ", 'body' => $body));
            return templates_page_draw(array($pagetitle, $body));
            break;
        case 'rss':
            $body = folio_control_rssfeed($results, $resultcount, $username);
            header("Pragma: public");
            header("Cache-Control: public");
            header('Expires: ' . gmdate("D, d M Y H:i:s", time() + 3600) . " GMT");
            $etag = md5($body);
            header('ETag: "' . $etag . '"');
            header("Content-Length: " . strlen($body));
            header("Content-type: text/xml; charset=utf-8");
            return $body;
            break;
        default:
            error('Invalid format passed to feeds.php');
            break;
    }
}
Ejemplo n.º 5
0
$heading2 = gettext("Heading two");
// gettext variable
$bulletList = gettext("A bullet list");
// gettext variable
$heading3 = gettext("Heading three");
// gettext variable
$numberedList = gettext("A numbered list");
// gettext variable
$body = <<<END
        
    <img src="{{url}}_templates/leaves.jpg" width="300" height="225" alt="A test image" align="right" />
    <h1>{$heading1}</h1>
    <p>Paragraph text</p>
    <h2>{$heading2}</h2>
    <ul>
        <li>{$bulletList}</li>
    </ul>
    <h3>{$heading3}</h3>
    <ol>
        <li>{$numberedList}</li>
    </ol>
        
END;
$run_result .= templates_draw(array('context' => 'contentholder', 'title' => $name, 'body' => $body));
// Form elements
$name = "Data input";
$body = templates_draw(array('context' => 'databox', 'name' => gettext("Some text input"), 'column1' => display_input_field(array("blank", "", "text")), 'column2' => run("display:access_level_select", array("blank", "PUBLIC"))));
$body .= templates_draw(array('context' => 'databox1', 'name' => gettext("Some longer text input"), 'column1' => display_input_field(array("blank", "", "longtext"))));
$body .= templates_draw(array('context' => 'databoxvertical', 'name' => gettext("Further text input"), 'contents' => display_input_field(array("blank", "", "longtext")) . "<br />" . display_input_field(array("blank", "", "text")) . "<br /><input type='button' value='Button' />"));
$run_result .= templates_draw(array('context' => 'contentholder', 'title' => $name, 'body' => $body, 'submenu' => ''));
Ejemplo n.º 6
0
{$memberlist}
                            </select><br />
                            <input type="submit" value="{$removeFromGroup}" />
                            <input type="hidden" name="groupid" value="{$parameter[0]->ident}" />
                            <input type="hidden" name="action" value="group:removemember" />
                        </p></form>
                    </td>
                </tr>
            </table>
END;
$namevalue = htmlspecialchars($parameter[0]->name, ENT_COMPAT, 'utf-8');
// $accessvalue = run("display:access_level_select",array("groupaccess",$parameter[0]->access));
$saveGroup = gettext("Save this group");
// gettext variable
$deleteGroup = gettext("Delete this group");
// gettext variable
$name = <<<END
                        <form action="index.php" method="post" style="display:inline">
                            <input type="text"   name="groupname" value="{$namevalue}" />
                            <input type="hidden" name="action" value="group:edit" />
                            <input type="hidden" name="groupid" value="{$parameter[0]->ident}" />
                            <input type="submit" value={$saveGroup} />
                        </form>
                        <form action="index.php" method="post" style="display:inline">
                            <input type="hidden" name="action" value="group:delete" />
                            <input type="hidden" name="groupid" value="{$parameter[0]->ident}" />
                            <input type="submit" value={$deleteGroup} />
                        </form>
END;
$body .= templates_draw(array('context' => 'databoxvertical', 'name' => $name, 'contents' => $column1 . $column2));
$run_result .= $body;
Ejemplo n.º 7
0
        if (run("permissions:check", "profile")) {
            $body .= "<form action=\"\" method=\"post\" >";
        }
        $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) {
            $name = "<a href=\"" . $feed->siteurl . "\">" . stripslashes($feed->name) . "</a>";
            $column2 = "<a href=\"" . url . "_rss/individual.php?feed=" . $feed->ident . "\">" . gettext("View content") . "</a>";
            if (run("permissions:check", "profile")) {
                $column2 .= " | <a href=\"" . url . "_rss/subscriptions.php?action=unsubscribe&amp;feed=" . $feed->ident . "\" onclick=\"return confirm('" . gettext("Are you sure you want to unsubscribe from this feed?") . "')\">" . gettext("Unsubscribe") . "</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>";
        }
    }
    if (run("permissions:check", "profile")) {
        $body .= "<p>" . gettext("To subscribe to a new feed, enter its address below:") . "</p>";
        $body .= "<form action=\"\" method=\"post\">";
        $body .= templates_draw(array('context' => 'adminTable', 'name' => "&nbsp;", 'column1' => "<input type=\"text\" name=\"url\" value=\"http://\" style=\"width: 100%\" />", 'column2' => "<input type=\"submit\" value=\"" . gettext("Subscribe") . "\" />"));
        $body .= "<input type=\"hidden\" name=\"action\" value=\"subscribe-new\" /></form>";
    }
    $run_result .= $body;
}
Ejemplo n.º 8
0
                                    WHERE wc.posted > ? AND wl.owner = ?
                                    ORDER BY wc.posted DESC', array($starttime, $page_owner))) {
    foreach ($activities as $activity) {
        $commentbody = stripslashes($activity->body);
        $commentbody .= "<br /><br /><a href=\"" . url . $activity->username . "/weblog/" . $activity->weblogpost . ".html\">" . __gettext("Read more") . "</a>";
        $activity->postedname = stripslashes($activity->postedname);
        $activity->weblogname = stripslashes($activity->weblogname);
        if ($activity->weblog == $USER->ident) {
            $activity->weblogname = __gettext("your blog");
        }
        if ($activity->owner == $USER->ident) {
            $commentposter = sprintf(__gettext("<b>You</b> commented on weblog post '%s' in %s:"), stripslashes($activity->weblogtitle), $activity->weblogname);
        } else {
            $commentposter = sprintf(__gettext("<b>%s</b> commented on weblog post '%s' in %s:"), $activity->postedname, stripslashes($activity->weblogtitle), $activity->weblogname);
        }
        $body .= templates_draw(array('context' => 'databox1', 'name' => $commentposter, 'column1' => $commentbody));
    }
} else {
    $body .= "<p>" . __gettext("No activity during this time period.") . "</p>";
}
// 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;
    $community_owner = user_info('owner', $community_id);
    $result = run('community:members:data', array($community_id));
    $i = 1;
    if (!empty($result)) {
        foreach ($result as $key => $info) {
            $link = $CFG->wwwroot . $info->username . "/";
            $friends_name = user_name($info->ident);
            $info->icon = run("icons:get", $info->ident);
            $friends_icon = user_icon_html($info->ident, COMMUNITY_ICON_SIZE);
            // $friends_menu = run("users:infobox:menu",array($info->ident));
            $functions = array();
            if ($community_owner != $info->ident && $community_owner == $_SESSION['userid']) {
                $msg = "onclick=\"return confirm('" . __gettext("Are you sure you want to separate this user from the community?") . "')\"";
                $functions[] = "<a href=\"" . $CFG->wwwroot . $community_name . "/community/separate/" . $info->ident . "\" {$msg}>" . __gettext("Separate") . "</a>";
            } else {
                if ($community_owner == $info->ident) {
                    $functions[] = "<b>(" . __gettext("Owner") . ")</b>";
                }
            }
            $functions = implode("\n", array_map(create_function('$entry', "return \"<li>\$entry</li>\";"), $functions));
            $members .= templates_draw(array('context' => 'community_member', 'name' => $friends_name, 'icon' => $friends_icon, 'link' => $link, 'functions' => $functions));
            if ($i % COMMUNITY_MEMBERS_PER_ROW == 0) {
                $members .= "</tr><tr>";
            }
            $i++;
        }
    } else {
        $members .= "<td><p>" . __gettext("This community doesn't currently have any members.") . "</p></td>";
    }
    $run_result = templates_draw(array('context' => 'community_members', 'members' => $members));
}
Ejemplo n.º 10
0
            $column1 = "";
        }
        if (empty($current_template[$element['id']])) {
            $current_template[$element['id']] = $template[$element['id']];
        }
        $column2 = display_input_field(array("template[" . $element['id'] . "]", $current_template[$element['id']], "longtext"));
        /*        
                $run_result .= templates_draw(array(
                                        'context' => 'databox',
                                        'name' => $name,
                                        'column2' => $column1,
                                        'column1' => $column2
                                    )
                                    );
        */
        $run_result .= templates_draw(array('context' => 'databoxvertical', 'name' => $name, 'contents' => $column1 . "<br />" . $column2));
    }
}
if ($editable) {
    $save = __gettext("Save");
    // gettext variable
    $run_result .= <<<END
    
        <p align="center">
            <input type="hidden" name="action" value="templates:save" />
            <input type="hidden" name="save_template_id" value="{$template_id}" />
            <input type="submit" value="{$save}" />
        </p>    
    
END;
} else {
    $subdir = str_replace($_SERVER['SERVER_NAME'], "", substr($basedomain, strpos($basedomain, "://") + 3, strlen($basedomain) - 3));
    $passthru = $basedomain . str_replace($subdir, "", $_SERVER['REQUEST_URI']);
    $body .= templates_draw(array('template' => -1, 'context' => 'sidebarholder', 'submenu' => '', 'body' => '
            <table>
                <tr>
                    <td align="right"><p>
                        <label>' . __gettext("Username") . '&nbsp;<input type="text" name="username" id="username" style="size: 200px" /></label><br />
                        <label>' . __gettext("Password") . '&nbsp;<input type="password" name="password" id="password" style="size: 200px" />
                        </label>
                        <input type="hidden" name="passthru_url" value="' . $passthru . '" />
                        </p>
                    </td>
                </tr>
                <tr>
                    <td align="right"><p>
                        <input type="hidden" name="action" value="log_on" />
                        <label>' . '<input type="submit" name="submit" value="' . __gettext("Login") . '" /></label><br /><br />
                        <label><input type="checkbox" name="remember" />
                                ' . __gettext("Remember Login") . '</label><br />
                        <small>
                            ' . $reg_link . '
                            <a href="' . url . 'mod/invite/forgotten_password.php">' . __gettext("Forgotten password") . '</a>
                        </small></p>
                    </td>
                </tr>

            </table>

'));
    $body .= "</form></li>";
    $run_result .= $body;
<?php

/*
 * Created on Dec 1, 2007
 *
 * @author Diego Andrés Ramírez Aragón <*****@*****.**>
 * @copyright Corporación Somos más - 2007
 */
global $page_owner, $USER, $CFG;
if (isset($parameter)) {
    $selected = $page_owner;
    $field_label = __gettext("Assign to:");
    $options = array();
    $options[$USER->ident] = __gettext("Own");
    if ($communities = get_records_select('users', 'owner = ? AND user_type = ?', array($USER->ident, 'community'))) {
        foreach ($communities as $community) {
            $options[$community->ident] = __gettext("Community") . ": " . $community->name;
        }
    }
    if ($communities = get_records_sql("SELECT u.* FROM " . $CFG->prefix . "friends f\n\t\t                                    JOIN " . $CFG->prefix . 'users u ON u.ident = f.friend 
		                                    WHERE u.user_type = ? AND u.owner <> ? AND f.owner = ?', array('community', $USER->ident, $USER->ident))) {
        foreach ($communities as $community) {
            $options[$community->ident] = __gettext("Community") . ": " . $community->name;
        }
    }
    if ($selected == $USER->ident && count($options) > 1) {
        $run_result .= templates_draw(array('context' => 'databoxvertical', 'name' => $field_label, 'contents' => display_input_field(array('assign_to', $selected, 'select_associative', null, null, null, $options))));
    }
}
Ejemplo n.º 13
0
<?php

//	ELGG manage owned users page
global $CFG;
// 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("friends:init");
run("ownedusers:init");
define("context", "network");
templates_page_setup();
// Whose owned users are we looking at?
global $page_owner;
// You must be logged on to view this!
//	protect(1);
$title = run("profile:display:name") . " :: " . gettext($CFG->owned_users_caption);
echo templates_page_draw(array($title, templates_draw(array('context' => 'contentholder', 'title' => $title, 'body' => run("ownedusers:owned", array($page_owner))))));
Ejemplo n.º 14
0
function pages_sidebar()
{
    global $CFG, $page_owner;
    $owner = page_owner();
    $menu_elements = pages_get_mainmenu($owner);
    if ($owner > 0) {
        if ($_SESSION['userid'] == $owner) {
            $title = __gettext('Your Content');
        } else {
            //$title = sprintf(__gettext("%s's pages"), htmlspecialchars(user_name($owner), ENT_COMPAT, 'utf-8'));
            $title = __gettext("Content");
        }
    } else {
        $title = $CFG->sitename;
    }
    $body = templates_draw(array('context' => 'sidebarholder', 'title' => $title, 'body' => pages_html_menu($menu_elements)));
    return $body;
}
Ejemplo n.º 15
0
/**
 * @param $wall List of objects.
 */
function commentwall_display_footer($owner, $limit = 3, $offset = 0)
{
    global $CFG;
    $html = "";
    $count = get_record_sql("SELECT count(ident) as ident from {$CFG->prefix}commentwall where wallowner={$owner} order by posted desc");
    $count = $count->ident;
    $qs = $_SERVER['REDIRECT_URL'];
    if ($qs == "") {
        $qs = $_SERVER['PHP_SELF'];
    }
    // See if we need to display a next button
    $nextbutton = "";
    if ($count - $offset > $limit) {
        $nextbutton = "<a href=\"{$qs}?owner={$owner}&offset=" . ($offset + $limit) . "\">" . __gettext("Back") . "</a>";
    }
    // See if we need to display a prev button
    $prevbutton = "";
    if (floor($offset / $limit) > 0) {
        $prevbutton = "<a href=\"{$qs}?owner={$owner}&offset=" . ($offset - $limit) . "\">" . __gettext("Forward") . "</a>";
    }
    return templates_draw(array('context' => 'commentwallfooter', 'nextbutton' => $nextbutton, 'prevbutton' => $prevbutton));
}
$code = trim(optional_param('passwordcode'));
if (!empty($code)) {
    if ($details = get_record_sql('SELECT pr.ident AS passcodeid,u.* FROM ' . $CFG->prefix . 'password_requests pr
                                   JOIN ' . $CFG->prefix . "users u ON u.ident = pr.owner\r\n                                   WHERE pr.code = ? AND u.user_type = ?", array($code, 'person'))) {
        $createpassword = sprintf(__gettext("Please, enter a new Password:"******"" method="post">
\t
END;
        $run_result .= templates_draw(array('context' => 'databoxvertical', 'name' => __gettext("New Password"), 'contents' => display_input_field(array("join_password1", "", "password"))));
        $run_result .= templates_draw(array('context' => 'databoxvertical', 'name' => __gettext("Confirm your new Password"), 'contents' => display_input_field(array("join_password2", "", "password"))));
        $id = $details->ident;
        $email = $details->email;
        $buttonValue = __gettext("Create");
        $run_result .= <<<END
\t\t\t<p align="center">
                <input type="hidden" name="action" value="invite_create_password" />
\t\t\t\t<input type="hidden" name="id" value={$id} />
\t\t\t\t<input type="hidden" name="email" value={$email} />
                <input type="submit" value={$buttonValue} />
            </p>\t\t\t
    </form>
END;
        /*$validcharset = "ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnpqrstuvwxyz234567898765432";
          $newpassword = "";
          for ($i = 0; $i < 8; $i++) {
    }
    $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));
}
Ejemplo n.º 18
0
<?php

// Run includes
require_once dirname(dirname(__FILE__)) . "/includes.php";
templates_page_setup();
// Draw page
echo templates_page_draw(array(sprintf(gettext("%s Terms &amp; Conditions"), sitename), templates_draw(array('body' => run("content:terms"), 'name' => sprintf(gettext("%s Terms &amp; Conditions"), sitename), 'context' => 'contentholder'))));
Ejemplo n.º 19
0
<?php

// Add multiple users
if (logged_on && run("users:flags:get", array("admin", $_SESSION['userid']))) {
    global $admin_users_add;
    if (!isset($admin_users_add)) {
        $admin_users_add = array("", "", "", "", "", "", "", "", "", "", "", "");
    } else {
        for ($i = 0; $i < 12; $i++) {
            if (!isset($admin_users_add[$i])) {
                $admin_users_add[$i] = "";
            }
        }
    }
    $run_result .= "<p>" . gettext("You can create up to 12 users below; passwords will be autogenerated and emailed to the account owners. You must include all fields, but you may leave rows blank.") . "</p>";
    $run_result .= "<form action=\"\" method=\"post\">";
    $name = "<h3>" . gettext("Username") . "</h3>";
    $column1 = "<h3>" . gettext("Full name") . "</h3>";
    $column2 = "<h3>" . gettext("Email address") . "</h3>";
    for ($i = 0; $i < 12; $i++) {
        $tab = ($i + 1) * 3;
        $name .= "<input type=\"text\" name=\"new_username[{$i}]\" value=\"\" tabindex=\"" . $tab . "\" value=\"" . htmlspecialchars($admin_users_add[$i]->username, ENT_COMPAT, 'utf-8') . "\" /><br />";
        $column1 .= "<input type=\"text\" name=\"new_name[{$i}]\" value=\"\" tabindex=\"" . ($tab + 1) . "\" value=\"" . htmlspecialchars($admin_users_add[$i]->name, ENT_COMPAT, 'utf-8') . "\" /><br />";
        $column2 .= "<input type=\"text\" name=\"new_email[{$i}]\" value=\"\" tabindex=\"" . ($tab + 2) . "\" value=\"" . htmlspecialchars($admin_users_add[$i]->email, ENT_COMPAT, 'utf-8') . "\" /><br />";
    }
    $name .= "<input type=\"hidden\" name=\"action\" value=\"admin:users:add\" />";
    $column1 .= "<br /><input type=\"submit\" value=\"" . gettext("Add users") . "\" tabindex=\"39\" />";
    $run_result .= templates_draw(array('context' => 'adminTable', 'name' => $name, 'column1' => $column1, 'column2' => $column2));
    $run_result .= "</form>";
}
Ejemplo n.º 20
0
            }
        }
    }
    $run_result .= "<form action=\"" . url . "_userdetails/\" method=\"get\">";
    $run_result .= templates_draw(array('context' => 'adminTable', 'name' => "<h4>" . __gettext("Enter username") . "</h4>", 'column1' => "<input type=\"text\" name=\"profile_name\" value=\"\" /><input type=\"hidden\" name=\"context\" value=\"admin\" />", 'column2' => "<input type=\"submit\" value=\"" . __gettext("Edit user") . "\" />"));
    $run_result .= "</form>";
    $maxusers = count_records('users', 'user_type', $current_type);
    if ($users = get_records('users', 'user_type', $current_type, 'name ASC', '*', $offset, 50)) {
        if ($maxusers > $offset + 50) {
            $next = "<a href=\"" . get_url_query(null, 'admin::users', "user_type={$current_type}&offset=" . ($offset + 50)) . "\">" . __gettext("Next") . "</a>";
        } else {
            $next = "";
        }
        $prevoffset = $offset - 50;
        if ($prevoffset < 0) {
            $prevoffset = 0;
        }
        if ($prevoffset != $offset) {
            $prev = "<a href=\"" . get_url(null, 'admin::users', "user_type={$current_type}&offset=" . $prevoffset) . "\">" . __gettext("Previous") . "</a>";
        } else {
            $prev = "";
        }
        $nav = templates_draw(array('context' => 'adminTable', 'name' => __gettext('Total users') . ":&nbsp;" . $maxusers, 'column1' => $prev . "&nbsp;" . $next, 'column2' => "&nbsp;"));
        $run_result .= $nav;
        $run_result .= templates_draw(array('context' => 'adminTable', 'name' => "<h3>" . __gettext("First Name") . "</h3>", 'column1' => "<h3>" . __gettext("Last Name") . "</h3>", 'column3' => "<h3>" . __gettext("Username") . "</h3>", 'column2' => "<h3>" . __gettext("Extra info") . "</h3>"));
        foreach ($users as $user) {
            $run_result .= run("admin:users:panel", $user);
        }
        $run_result .= $nav;
    }
}
Ejemplo n.º 21
0
<?php

//    ELGG manage files page
// 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");
define("context", "files");
templates_page_setup();
// Whose files are we looking at?
global $page_owner;
$title = run("profile:display:name") . " :: " . gettext("Edit File");
$body = run("content:files:edit");
$body .= run("files:edit");
echo templates_page_draw(array($title, templates_draw(array('context' => 'contentholder', 'title' => $title, 'body' => $body))));
Ejemplo n.º 22
0
<?php

// Run includes
require_once dirname(dirname(__FILE__)) . "/includes.php";
templates_page_setup();
// Draw page
echo templates_page_draw(array(sprintf(gettext("About %s"), sitename), templates_draw(array('body' => run("content:about"), 'name' => sprintf(gettext("About %s"), sitename), 'context' => 'contentholder'))));
Ejemplo n.º 23
0
<?php

global $USER;
global $CFG;
global $page_owner;
$profile_id = $page_owner;
if ($page_owner != -1 && $page_owner != $USER->ident) {
    $posts = count_records_select('files', "files_owner = {$profile_id} AND (" . run("users:access_level_sql_where", $profile_id) . ")");
    if ($USER->ident == $profile_id) {
        $title = gettext("Your Files");
    } else {
        $title = gettext("Files");
    }
    if ($posts == 1) {
        $filesstring = $posts . " file";
    } else {
        $filesstring = $posts . " files";
    }
    $weblog_username = run("users:id_to_name", $profile_id);
    $fileStorage = gettext("File Storage");
    // gettext variable
    $body = <<<END
        <ul>
            <li><a href="{$CFG->wwwroot}{$weblog_username}/files/">{$fileStorage}</a> ({$filesstring})</li>
            <li>(<a href="{$CFG->wwwroot}{$weblog_username}/files/rss/">RSS</a>)</li>
        </ul>
END;
    $run_result .= "<li id=\"sidebar_files\">";
    $run_result .= templates_draw(array('context' => 'sidebarholder', 'title' => $title, 'body' => $body));
    $run_result .= "</li>";
}
Ejemplo n.º 24
0
<?php

//    ELGG content flagging admin panel page
// Run includes
require_once dirname(dirname(__FILE__)) . "/includes.php";
// Initialise functions for user details, icon management and profile management
run("admin:init");
define("context", "admin");
templates_page_setup();
// You must be logged on to view this!
echo templates_page_draw(array(gettext("Manage users"), templates_draw(array('context' => 'contentholder', 'title' => gettext("Manage users"), 'body' => run("admin:users")))));
Ejemplo n.º 25
0
    // 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>";
}
<?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;
Ejemplo n.º 27
0
<?php

require_once dirname(dirname(__FILE__)) . "/includes.php";
run("weblogs:init");
run("profile:init");
run("rss:init");
define('context', 'resources');
global $page_owner;
templates_page_setup();
$title = run("profile:display:name") . " :: " . gettext("Feeds");
run("rss:update:all", $page_owner);
$body = run("rss:view", $page_owner);
$body = templates_draw(array('context' => 'contentholder', 'title' => $title, 'body' => $body));
echo templates_page_draw(array($title, $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;
}
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));
}
Ejemplo n.º 30
0
/**
 * 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;
}