Example #1
0
 function __construct($end_switch = false)
 {
     CORE::summon(__FILE__);
     if ($end_switch) {
         self::$endClass = __CLASS__ . "_BACKEND";
     } else {
         self::$endClass = __CLASS__ . "_FRONTEND";
     }
     new self::$endClass();
 }
Example #2
0
<?php 
//awesome page that runs php methods
include_once 'php/config.php';
define("PAGENAME", "Latest Posts");
include_once 'include/header.php';
//creates an object
$blog = new BLOG($conn);
//shows only one post
$blog->showOne();
include_once 'include/footer.php';
Example #3
0
/**
 * Returns one item (Nucleus version)
 */
function _getItem($itemid, $username, $password)
{
    global $manager;
    // 1. login
    $mem = new MEMBER();
    if (!$mem->login($username, $password)) {
        return _error(1, "Could not log in");
    }
    // 2. check if allowed
    if (!$manager->existsItem($itemid, 1, 1)) {
        return _error(6, "No such item ({$itemid})");
    }
    $blogid = getBlogIDFromItemID($itemid);
    if (!$mem->teamRights($blogid)) {
        return _error(3, "Not a team member");
    }
    // 3. return the item
    // Structure returned has dateCreated, userid, blogid and content
    $item =& $manager->getItem($itemid, 1, 1);
    // (also allow drafts and future items)
    $blog = new BLOG($blogid);
    if ($blog->convertBreaks()) {
        $item['body'] = removeBreaks($item['body']);
    }
    $newstruct = new xmlrpcval(array("publishDate" => new xmlrpcval(iso8601_encode($item['timestamp']), "dateTime.iso8601"), "userid" => new xmlrpcval($item['authorid'], "string"), "blogid" => new xmlrpcval($blogid, "string"), "title" => new xmlrpcval($item['title'], "string"), "body" => new xmlrpcval($item['body'], "string"), "more" => new xmlrpcval($item['more'], "string"), "draft" => new xmlrpcval($item['draft'], "boolean"), "closed" => new xmlrpcval($item['closed'], "boolean")), 'struct');
    return new xmlrpcresp($newstruct);
}
Example #4
0
<?php

include_once "php/config.php";
define("PAGENAME", "Search Results");
include_once "include/header.php";
$blog = new BLOG($conn);
//new object
$blog->search();
//searching from the class method
include_once "include/footer.php";
Example #5
0
<?php

include_once 'php/config.php';
define("PAGENAME", "Latest Posts");
include_once 'include/header.php';
//creates a new object from the class
$blog = new BLOG($conn);
//prints the header
echo '<header class="big-header">
			<h1 class="no-margin">All the latest posts</h1>
	</header>';
//calls to showBlog
$blog->showBlog();
include_once 'include/footer.php';
Example #6
0
/**
 * Returns one item (Blogger version)
 */
function _getItemBlogger($itemid, $username, $password)
{
    global $manager;
    // 1. login
    $mem = new MEMBER();
    if (!$mem->login($username, $password)) {
        return _error(1, "Could not log in");
    }
    // 2. check if allowed
    if (!$manager->existsItem($itemid, 1, 1)) {
        return _error(6, "No such item ({$itemid})");
    }
    $blogid = getBlogIDFromItemID($itemid);
    if (!$mem->teamRights($blogid)) {
        return _error(3, "Not a team member");
    }
    // 3. return the item
    // Structure returned has dateCreated, userid, blogid and content
    $item =& $manager->getItem($itemid, 1, 1);
    // (also allow drafts and future items)
    $blog = new BLOG($blogid);
    // get category
    $item['category'] = $blog->getCategoryName($item['catid']);
    // remove linebreaks if needed
    if ($blog->convertBreaks()) {
        $item['body'] = removeBreaks($item['body']);
    }
    $content = blogger_specialTags($item) . $item['body'];
    $newstruct = new xmlrpcval(array("dateCreated" => new xmlrpcval(iso8601_encode($item['timestamp']), "dateTime.iso8601"), "userid" => new xmlrpcval($item['authorid'], "string"), "blogid" => new xmlrpcval($blogid, "string"), "content" => new xmlrpcval($content, "string")), 'struct');
    return new xmlrpcresp($newstruct);
}
Example #7
0
function _setSkinPart($blogid, $username, $password, $content, $type)
{
    // 1. login
    $mem = new MEMBER();
    if (!$mem->login($username, $password)) {
        return _error(1, "Could not log in");
    }
    // 2. check if allowed
    if (!BLOG::existsID($blogid)) {
        return _error(2, "No such blog ({$blogid})");
    }
    if (!$mem->teamRights($blogid)) {
        return _error(3, "Not a team member");
    }
    // 3. update skin part
    $blog = new BLOG($blogid);
    $skin = new SKIN($blog->getDefaultSkin());
    $skin->update($type, $content);
    return new xmlrpcresp(new xmlrpcval(1, 'boolean'));
}
Example #8
0
 public function pingBloggDe()
 {
     $b = new BLOG($this->myBlogId);
     $message = new xmlrpcmsg('bloggUpdates.ping', array(new xmlrpcval($b->getName(), 'string'), new xmlrpcval($b->getURL(), 'string')));
     $c = new xmlrpc_client('/', 'xmlrpc.blogg.de', 80);
     //$c->setDebug(1);
     // 30 seconds timeout...
     $r = $c->send($message, 30);
     return $this->processPingResult($r);
 }
 function testblog($data)
 {
     global $blogid;
     $blog = new BLOG($blogid);
     if ($this->getBlogOption($blog->blogid, 'skin_restriction') == "no") {
         return TRUE;
     }
     $defaultskin = $blog->getDefaultSkin();
     $skinname = SKIN::getNameFromID($defaultskin);
     $currentSkinName = $data['skin']->getName();
     if ($currentSkinName == $skinname) {
         return TRUE;
     }
     $allowedskins = $this->getBlogOption($blog->blogid, 'allowed_skins');
     return !(strpos(',' . $allowedskins . ',', ',' . $currentSkinName . ',') === FALSE);
 }
Example #10
0
 function parse_bloglist($template, $bnametype = '', $orderby = 'number', $direction = 'asc')
 {
     BLOG::showBlogList($template, $bnametype, $orderby, $direction);
 }
Example #11
0
function _mt_getRecentPostTitles($blogid, $username, $password, $iAmount)
{
    $blogid = intval($blogid);
    $iAmount = intval($iAmount);
    // 1. login
    $mem = new MEMBER();
    if (!$mem->login($username, $password)) {
        return _error(1, "Could not log in");
    }
    // 2. check if allowed
    if (!BLOG::existsID($blogid)) {
        return _error(2, "No such blog ({$blogid})");
    }
    if (!$mem->teamRights($blogid)) {
        return _error(3, "Not a team member");
    }
    $iAmount = intval($iAmount);
    if ($iAmount < 1) {
        return _error(5, "Amount parameter must be positive");
    }
    // 3. create and return list of recent items
    // Struct returned has dateCreated, userid, postid and title
    $blog = new BLOG($blogid);
    $structarray = array();
    // the array in which the structs will be stored
    $query = "SELECT inumber, ititle as title, itime, iauthor" . ' FROM ' . sql_table('item') . " WHERE iblog={$blogid}" . " ORDER BY itime DESC" . " LIMIT {$iAmount}";
    $r = sql_query($query);
    while ($row = sql_fetch_assoc($r)) {
        $newstruct = new xmlrpcval(array("dateCreated" => new xmlrpcval(iso8601_encode(strtotime($row['itime'])), "dateTime.iso8601"), "postid" => new xmlrpcval($row['inumber'], "string"), "title" => new xmlrpcval($row['title'], "string"), "userid" => new xmlrpcval($row['iauthor'], "string")), 'struct');
        array_push($structarray, $newstruct);
    }
    return new xmlrpcresp(new xmlrpcval($structarray, "array"));
}
Example #12
0
function bm_doShowForm()
{
    global $member;
    $blogid = intRequestVar('blogid');
    $log_text = trim(requestVar('logtext'));
    $log_link = requestVar('loglink');
    $log_linktitle = requestVar('loglinktitle');
    $log_text = uniDecode($log_text, _CHARSET);
    $log_linktitle = uniDecode($log_linktitle, _CHARSET);
    if (!BLOG::existsID($blogid)) {
        bm_doError(_ERROR_NOSUCHBLOG);
    }
    if (!$member->isTeamMember($blogid)) {
        bm_doError(_ERROR_NOTONTEAM);
    }
    $logje = '';
    if ($log_text) {
        $logje .= '<blockquote><div>"' . htmlspecialchars($log_text) . '"</div></blockquote>' . "\n";
    }
    if (!$log_linktitle) {
        $log_linktitle = $log_link;
    }
    if ($log_link) {
        $logje .= '<a href="' . htmlspecialchars($log_link) . '">' . htmlspecialchars($log_linktitle) . '</a>';
    }
    $item['body'] = $logje;
    $item['title'] = htmlspecialchars($log_linktitle);
    $factory = new PAGEFACTORY($blogid);
    $factory->createAddForm('bookmarklet', $item);
}
function _mw_getPost($itemid, $username, $password)
{
    global $manager;
    // 1. login
    $mem = new MEMBER();
    if (!$mem->login($username, $password)) {
        return _error(1, "Could not log in");
    }
    // 2. check if allowed
    if (!$manager->existsItem($itemid, 1, 1)) {
        return _error(6, "No such item ({$itemid})");
    }
    $blogid = getBlogIDFromItemID($itemid);
    if (!$mem->teamRights($blogid)) {
        return _error(3, "Not a team member");
    }
    // 3. return the item
    $item =& $manager->getItem($itemid, 1, 1);
    // (also allow drafts and future items)
    $b = new BLOG($blogid);
    if ($b->convertBreaks()) {
        $item['body'] = removeBreaks($item['body']);
        $item['more'] = removeBreaks($item['more']);
    }
    $categoryname = $b->getCategoryName($item['catid']);
    $newstruct = new xmlrpcval(array("dateCreated" => new xmlrpcval(iso8601_encode($item['timestamp']), "dateTime.iso8601"), "userid" => new xmlrpcval($item['authorid'], "string"), "blogid" => new xmlrpcval($blogid, "string"), "postid" => new xmlrpcval($itemid, "string"), "description" => new xmlrpcval($item['body'], "string"), "title" => new xmlrpcval($item['title'], "string"), "categories" => new xmlrpcval(array(new xmlrpcval($categoryname, "string")), "array"), "mt_text_more" => new xmlrpcval($item['more'], "string"), "mt_allow_comments" => new xmlrpcval($item['closed'] ? 0 : 1, "int"), "mt_allow_pings" => new xmlrpcval(1, "int")), 'struct');
    //TODO: add "String link" to struct?
    //TODO: add "String permaLink" to struct?
    return new xmlrpcresp($newstruct);
}
Example #14
0
 private static function blogFetch($row = false)
 {
     self::make(CORE::$lang["blog"], CORE::$root . 'blog/');
     if ($row["parent"]) {
         # 項目
         CRUD::dataFetch("blog_cate", array('id' => $row["parent"]));
         list($cateRow) = CRUD::$data;
         self::make($cateRow["subject"], BLOG::dataLink($cateRow["id"]));
         self::make($row["subject"], BLOG::dataLink($cateRow["id"], $row));
     } else {
         # 分類
         if (!empty($row["id"])) {
             self::make($row["subject"], BLOG::dataLink($row["id"]));
         }
     }
 }
Example #15
0
 function event_PostAddItem($data)
 {
     if ($this->draft == "no" && $this->podcast == true && $this->getOption('ping') == "yes") {
         $b = new BLOG($this->myBlogId);
         if (!class_exists('xmlrpcmsg')) {
             global $DIR_LIBS;
             include $DIR_LIBS . 'xmlrpc.inc.php';
         }
         $message = new xmlrpcmsg('weblogUpdates.ping', array(new xmlrpcval($b->getName(), 'string'), new xmlrpcval($b->getURL(), 'string')));
         $c = new xmlrpc_client('/RPC2', 'audiorpc.weblogs.com', 80);
         //$c->setDebug(1);
         $r = $c->send($message, 15);
         // 15 seconds timeout...
         $m = new xmlrpc_client('/pingserver.php', 'mcierror.axisz.jp', 80);
         $r = $m->send($message, 15);
     }
 }
Example #16
0
 /**
  * Checks if a blog id exists
  */
 function existsBlogID($id)
 {
     $this->_loadClass('BLOG', 'BLOG.php');
     return BLOG::existsID($id);
 }