예제 #1
0
/**
* Read in & validate information
**/
function loadData(&$readerhash, &$user_ident, &$username, &$format, &$purpose, &$types, &$types_avoid, &$page)
{
    // Retrieve passed variables
    $readerhash = optional_param('key', '');
    $username = folio_clean(required_param('user'));
    $format = required_param('format');
    $purpose = required_param('purpose');
    $types = str_replace(' ', '+', required_param('types'));
    $tags = str_replace(' ', '+', required_param('tags'));
    $page = intval(optional_param('page', 1, PARAM_INT));
    // Setup & Validate Owner
    $user_ident = run('users:name_to_id', $username);
    if (!$user_ident) {
        // Nothing returned by the run command, not a valid user.
        error('Sorry, but "' . $username . '" is not a valid username in this system.');
        die;
    }
    // PURPOSE
    if (!($purpose == 'activity' || $purpose == 'subscribe')) {
        error('Invalid purpose ' . $purpose . ' passed to feeds.php');
        die;
    }
    // FORMAT
    if (!($format == 'html' || $format == 'rss')) {
        error('Invalid format ' . $format . ' passed to feeds.php');
        die;
    }
    // TYPES & TAGS
    //  Convert from a string with tag+tag-tag to an array.
    folio_feed_parselist($tags, &$tags, &$tags_avoid);
    folio_feed_parselist($types, &$types, &$types_avoid);
    // Clean all of the tags and convert arrays back to a string with commas in it delimiting the values.
    $tags = rss_getitems_where($tags);
    $tags_avoid = rss_getitems_where($tags_avoid);
    $types = rss_getitems_where($types);
    $types_avoid = rss_getitems_where($types_avoid);
    // SET CURRENT PAGE
    if ($page < 1) {
        $page = 1;
    }
}
예제 #2
0
파일: lib.php 프로젝트: pzingg/saugus_elgg
/**
* Check for a duplicate (or problemtatic) page name
*
* @param int $user_ident The user to whom the page belongs
* @param string $title The title of the page
* @param int $page_ident The id value of the page, -1 if it is a new page
* @param OUTPUT boolean True if there is a dup, false if not.
**/
function folio_duplicate_pagename($user_ident, $title, $page_ident)
{
    // Clean title just to make sure.
    global $CFG;
    $title = folio_clean($title);
    // Test to see another page exists with the same title.
    $page = recordset_to_array(get_recordset_sql('SELECT * FROM ' . $CFG->prefix . 'folio_page ' . "WHERE title = '{$title}' and newest = 1 and user_ident = {$user_ident} and page_ident <> {$page_ident}"));
    if (!!$page) {
        return true;
    } else {
        return false;
    }
}
예제 #3
0
		div.innerHTML += "<li>HTTP status: " + o.status + "</li>";
		div.innerHTML += "<li>Status code message: " + o.statusText + "</li>";
		div.innerHTML += "<li>HTTP headers: <ul>" + o.getAllResponseHeaders + "</ul></li>";
		div.innerHTML += "<li>Server response: " + o.responseText + "</li>";
		div.innerHTML += "<li>Argument object: Object ( [foo] => " + o.argument.foo +
						 " [bar] => " + o.argument.bar +" )</li>";
*/
require_once "../../../includes.php";
$comment = new StdClass();
$comment->item_ident = required_param('item_ident', 0, PARAM_INT);
$comment->item_type = folio_clean(required_param('item_type'));
$comment->item_title = folio_page_decodetitle(folio_clean(required_param('item_title')));
$comment->item_owner_ident = required_param('item_owner_ident', 0, PARAM_INT);
$comment->item_owner_name = required_param('item_owner_name');
$comment->item_owner_username = required_param('item_owner_username');
$comment->access = folio_clean(required_param('access'));
$comment->body = required_param('body');
$comment->posted = time();
$url = required_param('url');
if (isloggedin()) {
    $comment->creator_username = $_SESSION['username'];
    $comment->creator_name = $_SESSION['name'];
    $comment->creator_ident = $_SESSION['userid'];
} else {
    $comment->creator_username = '';
    $comment->creator_name = 'Anonymous';
    $comment->creator_ident = -1;
}
// Insert new record into db.
insert_record('folio_comment', $comment);
// Create RSS record
예제 #4
0
* @param array $page_ident  The identity key for the page.
* @param string $page_title The new title for the page.
* @param string $page_body The new body for the page.
* @param string $username The username for the page's owner.
* @param int $user_ident The ident key for the page's owner.
* @param string $redirect_url OUTPUT.  VIP -- used by action_redirect to move to the proper page.
**/
// Note, this is ../ insead of ../../../ because we're called by files in /_folio, and not from the folder that this
//	page is actually residing inside of.
require_once '../includes.php';
// The security ident needs to be set by page_edit_security_post before this can run.
if (!isset($security_ident)) {
    error('Page_Edit_post.php must be called after page_edit_security_post so that the former knows the security information');
}
$page = new StdClass();
$page->title = folio_clean(required_param('page_title'));
$page->body = required_param('page_body');
$page->page_ident = required_param('page_ident', PARAM_INT);
$page->security_ident = $security_ident;
$page->parentpage_ident = required_param('parentpage_ident', PARAM_INT);
$page->newest = 1;
$page->created = time();
$page->user_ident = required_param('user_ident');
$username = required_param('username');
// If the user isn't logged in, then set to -1 (anonymous)
// Otherwise, set the last updater to their logged in information.
if (isloggedin()) {
    $page->creator_ident = $_SESSION['userid'];
} else {
    $page->creator_ident = -1;
}