示例#1
0
<?php

/**
 * @author Jaco Ruit 
 */
require '../startOrongo.php';
startOrongo();
setCurrentPage('admin_edit');
Security::promptAuth();
if (!isset($_SERVER['QUERY_STRING'])) {
    header("Location: " . orongoURL("orongo-admin/create.php"));
    exit;
}
$query = explode(".", trim($_SERVER['QUERY_STRING']));
if (count($query) != 2) {
    header("Location: " . orongoURL("orongo-admin/index.php?msg=1"));
    exit;
}
$object = trim($query[0]);
$id = trim($query[1]);
switch ($object) {
    case "article":
        if (getUser()->getRank() < RANK_WRITER) {
            header("Location: " . orongoURL("orongo-admin/index.php?msg=0"));
            exit;
        }
        if (!isset($_POST['title']) || !isset($_POST['content']) || !isset($_POST['tags'])) {
            header("Location: " . orongoURL("orongo-admin/edit.php?article." . $id));
            exit;
        }
        try {
<?php

/**
 * @author Jaco Ruit
 */
require '../startOrongo.php';
startOrongo();
setCurrentPage('admin_orongo-settings');
Security::promptAuth();
if (getUser()->getRank() != RANK_ADMIN) {
    header("Location: " . orongoURL("orongo-admin/index.php?msg=0"));
    exit;
}
if (!isset($_POST['website_url']) || !isset($_POST['website_style']) || !isset($_POST['website_name']) || !isset($_POST['website_lang']) || !isset($_POST['show_archive'])) {
    header("Location: " . orongoURL("orongo-admin/orongo-settings.php"));
    exit;
}
if (Settings::getWebsiteURL() != $_POST['website_url'] && !empty($_POST['website_url'])) {
    Settings::setWebsiteURL($_POST['website_url']);
}
if (Settings::getWebsiteName() != $_POST['website_name'] && !empty($_POST['website_name'])) {
    Settings::setWebsiteName($_POST['website_name']);
}
if (Settings::getLanguageName() != $_POST['website_lang'] && !empty($_POST['website_lang'])) {
    Settings::setLanguageName($_POST['website_lang']);
}
if (strval(Settings::showArchive()) != $_POST['show_archive'] && !empty($_POST['show_archive'])) {
    Settings::setShowArchive($_POST['show_archive']);
}
if (getStyle()->getStyleFolder() != $_POST['website_style'] && file_exists(ROOT . "/themes/" . $_POST['website_style']) . "/info.xml") {
    try {
<?php

/**
 * @author Jaco Ruit
 */
define('HACK_PLUGINS', true);
require '../startOrongo.php';
startOrongo();
setCurrentPage('admin_plugin-settings');
Security::promptAuth();
if (getUser()->getRank() != RANK_ADMIN) {
    header("Location: " . orongoURL("orongo-admin/index.php?msg=0"));
    exit;
}
if (!isset($_GET['xml_path'])) {
    header("Location: " . orongoURL("orongo-admin/index.php?msg=1"));
    exit;
}
$xmlPath = ADMIN . '/plugins' . urldecode($_GET['xml_path']);
if (!file_exists($xmlPath)) {
    header("Location: " . orongoURL("orongo-admin/manage.php?plugins"));
    exit;
}
$installed = false;
foreach (getPlugins() as $plugin) {
    if ($plugin instanceof OrongoPluggableObject == false) {
        continue;
    }
    if ($plugin->getInfoPath() == $xmlPath) {
        $installed = true;
    }
示例#4
0
        getAllPictures();
        break;
    case 'setAsNewProfilePic':
        setAsNewProfilePic();
        break;
    case 'deletePic':
        deletePic();
        break;
    case 'fetchCurrentValues':
        fetchCurrentValues();
        break;
    case 'getCurrentUser':
        getCurrentUser();
        break;
    case 'setCurrentPage':
        setCurrentPage();
        break;
}
function setCurrentPage()
{
    $sessionObject = new sessionModule();
    $sessionObject->setPage($_POST['page']);
}
function getCurrentUser()
{
    $sessionObject = new sessionModule();
    echo $sessionObject->getUserName();
}
function fetchCurrentValues()
{
    $sessionObject = new sessionModule();
示例#5
0
/**
 *Starts Orongo! :) 
 * @param String $paramCurrentPage the current page
 */
function startOrongo($paramCurrentPage = 'anonymous')
{
    session_start();
    define("ROOT", dirname(__FILE__));
    define("LIB", ROOT . "/lib");
    define("ADMIN", ROOT . "/orongo-admin");
    define("CONFIG", ROOT . "/config.php");
    define('RANK_ADMIN', 3);
    define('RANK_WRITER', 2);
    define('RANK_USER', 1);
    define('ARTICLE_NOT_EXIST', 2100);
    define('PAGE_NOT_EXIST', 3100);
    define('USER_NOT_EXIST', 4100);
    define('COMMENT_NOT_EXIST', 5100);
    error_reporting(E_ALL);
    if (file_exists("orongo-install.php")) {
        die("If you didn't install OrongoCMS yet, proceed to the <a href='orongo-install.php'>installer</a><br/>If you installed it, please delete orongo-install.php");
    }
    if (!file_exists(CONFIG)) {
        die("config.php (" . CONFIG . ") was missing!");
    }
    require_once CONFIG;
    require LIB . '/function_load.php';
    try {
        load(LIB);
    } catch (Exception $e) {
        die($e->getMessage());
    }
    setDatabase(new Database(CONFIG));
    try {
        setLanguage(new Language(ADMIN . '/lang/' . Settings::getLanguageName()));
    } catch (Exception $e) {
        $msgbox = new MessageBox();
        $msgbox->bindException($e);
        die($msgbox->getImports() . $msgbox->toHTML());
    }
    setCurrentPage($paramCurrentPage);
    $style = null;
    try {
        $style = Settings::getStyle();
    } catch (Exception $e) {
        $msgbox = new MessageBox();
        $msgbox->bindException($e);
        die($msgbox->getImports() . $msgbox->toHTML());
    }
    setMenu(new Menu());
    setStyle($style);
    setDisplay(new Display($style->getStylePath()));
    setUser(handleSessions());
    if (defined('HACK_PLUGINS') && HACK_PLUGINS == true) {
        Plugin::hackKeys();
    }
    try {
        setPlugins(Plugin::getActivatedPlugins('orongo-admin/'));
    } catch (Exception $e) {
        $msgbox = new MessageBox();
        $msgbox->bindException($e);
        getDisplay()->addObject($msgbox);
    }
    //getLanguage()->setTempLanguage(ADMIN . '/lang/en_US');
    OrongoDefaultEventHandlers::init();
}
示例#6
0
<?php

/**
 * @author Jaco Ruit 
 */
require '../startOrongo.php';
startOrongo();
setCurrentPage('admin_create');
Security::promptAuth();
if (getUser()->getRank() < RANK_WRITER) {
    header("Location: " . orongoURL("orongo-admin/index.php?msg=0"));
    exit;
}
if (!isset($_SERVER['QUERY_STRING'])) {
    header("Location: " . orongoURL("orongo-admin/create.php"));
    exit;
}
$object = $_SERVER['QUERY_STRING'];
switch ($object) {
    case "article":
        if (!isset($_POST['title']) || !isset($_POST['content']) || !isset($_POST['tags'])) {
            header("Location: " . orongoURL("orongo-admin/create.php?article"));
            exit;
        }
        try {
            $article = Article::createArticle($_POST['title'], getUser());
            $article->setContent($_POST['content']);
        } catch (Exception $e) {
            header("Location: " . orongoURL("orongo-admin/create.php?msg=0&obj=article"));
        }
        header("Location: " . orongoURL("orongo-admin/create.php?msg=1&obj=article"));
示例#7
0
<?php

/**
 * @author Jaco Ruit 
 */
require '../startOrongo.php';
startOrongo();
setCurrentPage('admin_delete');
Security::promptAuth();
if (!isset($_SERVER['QUERY_STRING'])) {
    header("Location: " . orongoURL("orongo-admin/create.php"));
    exit;
}
$query = explode(".", trim($_SERVER['QUERY_STRING']));
if (count($query) != 2) {
    header("Location: " . orongoURL("orongo-admin/index.php?msg=1"));
    exit;
}
$object = trim($query[0]);
$id = trim($query[1]);
switch ($object) {
    case "article":
        if (getUser()->getRank() < RANK_WRITER) {
            header("Location: " . orongoURL("orongo-admin/index.php?msg=0"));
            exit;
        }
        try {
            $article = new Article($id);
        } catch (Exception $e) {
            if ($e->getCode() == ARTICLE_NOT_EXIST) {
                header("Location: " . orongoURL("orongo-admin/manage.php?msg=0&obj=articles"));