示例#1
0
/**
 * @author Jaco Ruit
 */
require '../startOrongo.php';
startOrongo('admin_index');
Security::promptAuth();
$index = new AdminFrontend();
$index->main(array("time" => time(), "page_title" => "Dashboard", "page_template" => "dashboard"));
if (isset($_GET['msg'])) {
    switch ($_GET['msg']) {
        case 0:
            $index->addMessage(l("No Permission"), "error");
            break;
        case 1:
            $index->addMessage(l("Invalid Query Arg"), "warning");
            break;
        case 2:
            $index->addMessage(l("Internal Error"), "warning");
            break;
    }
}
$text = "<strong>Thank you for testing OrongoCMS!</strong><br/><br/>";
$text .= "<p>To check for updates go to <a href='" . orongoURL("orongo-admin/orongo-update-check.php") . "'>the update checker</a>.";
$text .= "<br/>Found bugs? Please post them <a href='" . orongoURL("orongo-admin/post-issue.php") . "'>here</a>.";
$text .= "<br/>You can find the terminal of your OrongoCMS installation <a href='" . OrongoURL("orongo-admin/terminal.php") . "'>here</a>.";
$text .= "<br/><br/>Enjoy OrongoCMS,<br/> ";
$text .= "<strong>The OrongoCMS Team</strong>";
$index->addObject(new AdminFrontendObject(100, "Info", $text, null, false));
$index->render();
示例#2
0
            $msgtype = "warning";
            break;
        case 5:
            $msg = l('LOGIN_MSG_ALREADY_ACTIVATED');
            $msgtype = "info";
            break;
        case 6:
            $msg = l('LOGIN_MSG_ACTIVATION_OK');
            $msgtype = "success";
            break;
        case 7:
            $msg = l("LOGIN_MSG_PROMPT_ACTIVATION");
            $msgtype = "warning";
            break;
        default:
            break;
    }
}
$login = new AdminFrontend();
$login->main(array("time" => time(), "page_title" => "Login", "page_template" => "ndashboard"));
$form = new AdminFrontendForm(75, "Login", "POST", orongoURL("actions/action_Login.php"));
$form->addInput("Username", "username", "text");
$form->addInput("Password", "password", "password");
$form->addButton("Login", true);
$login->addObject($form);
$login->addObject(new AdminFrontendObject(25, "", '<h4>' . l("New here") . '</h4><p>' . l("Register text", array('<a href="' . orongoURL("orongo-register.php#") . '">', '</a>')) . '</p>'));
if ($msg != null) {
    $login->addMessage($msg, $msgtype);
}
$login->render();
示例#3
0
            $manage->addMessage(l("Plugin deinstalled"), "success");
            break;
        case 5:
            $manage->addMessage(l("Plugin settings saved"), "success");
            break;
    }
}
switch ($object) {
    case "articles":
        $objs = null;
        $manage->setTitle("Manage Articles");
        try {
            $objs = orongo_query("action=fetch&object=article&max=1000000&order=article.id,desc");
        } catch (Exception $e) {
            $manage->addMessage($e, "error");
            $manage->render();
            exit;
        }
        $manager = new AdminFrontendContentManager(100, "Articles");
        $manager->createTab("Articles", array("ID", "Title", "Date", "Author", "Comments"));
        foreach ($objs as $obj) {
            if ($obj instanceof Article == false) {
                continue;
            }
            $manager->addItem("Articles", array($obj->getID(), '<a href="' . orongoURL('orongo-admin/view.php?article.' . $obj->getID()) . '">' . $obj->getTitle() . '</a>', $obj->getDate(), '<a href="' . orongoURL("orongo-admin/view.php?user." . $obj->getAuthorID()) . '">' . $obj->getAuthorName() . '</a>', $obj->getCommentCount()), orongoURL("orongo-admin/delete.php?article." . $obj->getID()), orongoURL("orongo-admin/edit.php?article." . $obj->getID()));
        }
        $manage->addObject($manager);
        $manage->render();
        break;
    case "users":
        if (getUser()->getRank() < RANK_ADMIN) {
示例#4
0
startOrongo('admin_plugin-uninstall');
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']);
$install = new AdminFrontend();
$install->main(array("time" => time(), "page_title" => "Uninstall", "page_template" => "dashboard"));
if (!file_exists($xmlPath)) {
    $install->addMessage(l("Plugin not found"), "error");
    $install->render();
    exit;
}
$installed = false;
foreach (getPlugins() as $plugin) {
    if ($plugin instanceof OrongoPluggableObject == false) {
        continue;
    }
    if ($plugin->getInfoPath() == $xmlPath) {
        $installed = true;
    }
}
if (!$installed) {
    $install->addMessage(l("Plugin not installed"), "warning");
    $install->render();
    exit;
示例#5
0
            $create->addMessage(l("Object post success"), "success");
            break;
        default:
            break;
    }
}
switch ($object) {
    case "article":
        $create->setTitle("Create Article");
        $form = new AdminFrontendForm(100, "New Article", "POST", orongoURL("actions/action_Create.php?article"));
        $form->addInput("Article Title", "title", "text", "", true);
        $form->addInput("Article Content", "content", "ckeditor", "", true);
        $form->addInput("Tags", "tags", "text", "tag1, tag2");
        $form->addButton("Post", true);
        $create->addObject($form);
        $create->render();
        break;
    case "user":
        if (getUser()->getRank() < RANK_ADMIN) {
            header("Location: " . orongoURL("orongo-admin/index.php?msg=0"));
            exit;
        }
        $create->setTitle("Create User");
        $form = new AdminFrontendForm(100, "New User", "POST", orongoURL("actions/action_Create.php?user"));
        $form->addInput("Username", "name", "text", "", true);
        $form->addInput("Password", "password", "password", "blaat123", true);
        $form->addInput("Email", "email", "email", "*****@*****.**", true);
        $form->addSelect("rank", array(l("User") => 1, l("Writer") => 2, l("Admin") => 3));
        $form->addButton("Create", true);
        $create->addObject($form);
        $create->render();
示例#6
0
startOrongo('admin_media');
Security::promptAuth();
if (getUser()->getRank() != RANK_ADMIN) {
    header("Location: " . orongoURL("orongo-admin/index.php?msg=0"));
    exit;
}
if (isset($_SERVER['QUERY_STRING'])) {
    $type = $_SERVER['QUERY_STRING'];
} else {
    $type = null;
}
$types = array("files", "images");
if ($type != null) {
    if (!in_array($type, $types)) {
        $type = null;
    }
    $type = strtoupper(substr($type, 0, 1)) . substr($type, 1);
    $pageTitle = "Gallery";
}
if ($type == null) {
    $pageTitle = "Media";
}
$media = new AdminFrontend();
$media->main(array("time" => time(), "page_title" => $pageTitle, "page_template" => "dashboard"));
$ckfinder = new CKFinder(orongoURL("lib/ckfinder/"));
if ($type != null) {
    $ckfinder->ResourceType = $type;
}
$media->addObject(new AdminFrontendObject(100, l("Media Manager") . " - " . l("Powered by") . " CKFinder", $ckfinder->CreateHTML(), null, false));
$media->render();
示例#7
0
         if ($e->getCode() == PAGE_NOT_EXIST) {
             header("Location: " . orongoURL("orongo-admin/manage.php?msg=0&obj=pages"));
             exit;
         } else {
             header("Location: " . orongoURL("orongo-admin/index.php?msg=2"));
             exit;
         }
     }
     $form = new AdminFrontendForm(100, l("Page") . ": " . $page->getTitle(), "GET", "", false);
     $form->addInput("ID", "id", "text", $page->getID(), false, true);
     $form->addInput("Page Title", "title", "text", $page->getTitle(), false, true);
     $form->addInput("Page Content", "content", "ckeditor", $page->getContent(), false, true);
     $form->addButton("Delete", false, orongoURL("orongo-admin/delete.php?page." . $id));
     $form->addButton("Edit", false, orongoURL("orongo-admin/edit.php?page." . $id));
     $view->addObject($form);
     $view->render();
     break;
 case "user":
     if ($id != getUser()->getID() && getUser()->getRank() != RANK_ADMIN) {
         header("Location: " . orongoURL("orongo-admin/index.php?msg=0"));
         exit;
     }
     $user = null;
     $view->setTitle("Viewing User");
     try {
         $user = new User($id);
     } catch (Exception $e) {
         if ($e->getCode() == USER_NOT_EXIST) {
             header("Location: " . orongoURL("orongo-admin/manage.php?msg=0&obj=users"));
             exit;
         } else {
示例#8
0
    $js = 'window.setInterval(function() {';
    $js .= 'if(getAjaxBool("' . orongoURL("ajax/isGCSet.php") . '")) window.location="' . orongoURL("orongo-admin/post-issue.php") . '"; ';
    $js .= '},2000);';
    getDisplay()->addJS($js, "document.ready");
    if (isset($_GET['error'])) {
        $postIssue->addMessage($_GET['error'], "error");
    }
    if (isset($_GET['msg'])) {
        switch ($_GET['msg']) {
            case 0:
                $postIssue->addMessage(l("Issue posted"), "success");
                break;
            default:
                break;
        }
    } else {
        $windowJS = "var login = window.open('" . IssueTracker::getAuthSubRequestUrl(orongoURL("orongo-admin/post-issue.php")) . "');";
        getDisplay()->addJS($windowJS, "document.ready");
    }
    $postIssue->render();
} else {
    $postIssue->main(array("time" => time(), "page_title" => "Post Issue", "page_template" => "dashboard"));
    $form = new AdminFrontendForm(100, "Post Issue", "POST", orongoURL("actions/action_PostIssue.php"));
    $form->addInput("Issue Author", "issue_author", "text", "", true);
    $form->addInput("Issue Title", "issue_title", "text", "", true);
    $form->addInput("Issue Description", "issue_content", "textarea", "", true);
    $form->addInput("Issue Labels", "issue_labels", "text", "");
    $form->addButton("Post", true);
    $postIssue->addObject($form);
    $postIssue->render();
}
}
$updater = new AdminFrontend();
$updater->main(array("time" => time(), "page_title" => "Update Checker", "page_template" => "dashboard"));
$isUpdateAvailable = false;
try {
    $isUpdateAvailable = OrongoUpdateChecker::isUpdateAvailable();
} catch (Exception $e) {
    $msgbox = new MessageBox(l("Error update check"));
    $msgbox->bindException($e);
    getDisplay()->addObject($msgbox);
}
if ($isUpdateAvailable) {
    $updater->addMessage(l("Update available"), "success");
    $info = null;
    try {
        $info = OrongoUpdateChecker::getLatestVersionInfo();
    } catch (Exception $e) {
        $msgbox = new MessageBox("Error occured while checking for update");
        $msgbox->bindException($e);
        getDisplay()->addObject($msgbox);
        break;
    }
    if ($info->critical) {
        $updater->addMessage(l("Critical update"), "warning");
    }
    $updater->addObject(new AdminFrontendObject(100, "How to update", l("Ready to update to", "r" . $info->latest_version) . '<br/>' . l("Visit for update information", "<a href='" . $info->update_url . "'>" . str_replace("http://", "", $info->update_url) . "</a>")));
} else {
    $updater->addMessage(l("No update"), "info");
}
$updater->render();
示例#10
0
            break;
        case 2:
            $msg = l("REG_MSG_USERNAME_TOO_SHORT");
            $msgtype = "error";
            break;
        case 3:
            $msg = l("REG_MSG_PASSWORD_TOO_SHORT");
            $msgtype = "error";
            break;
        case 4:
            $msg = l("REG_MSG_FILL_IN_USERNAME");
            $msgtype = "error";
            break;
        default:
            break;
    }
}
$register = new AdminFrontend();
$register->main(array("time" => time(), "page_title" => "Register", "page_template" => "ndashboard"));
$form = new AdminFrontendForm(100, "Register", "POST", orongoURL("actions/action_Register.php"));
$form->addInput("Username", "username", "text", "", true);
$form->addInput("Password", "password", "password", "", true);
$form->addInput("Password again", "password_again", "password", "", true);
$form->addInput("Email", "email", "email", "", true);
$form->addButton("Register", true);
$register->addObject($form);
if ($msg != null) {
    $register->addMessage($msg, $msgtype);
}
$register->render();
示例#11
0
     } catch (Exception $e) {
         if ($e->getCode() == ARTICLE_NOT_EXIST) {
             header("Location: " . orongoURL("orongo-admin/manage.php?msg=0&obj=articles"));
             exit;
         } else {
             header("Location: " . orongoURL("orongo-admin/index.php?msg=2"));
             exit;
         }
     }
     $form = new AdminFrontendForm(100, l("Delete Article") . " (" . $article->getID() . ")", "POST", "", false);
     $form->addButton("Yes", true, orongoURL("actions/action_Delete.php?article." . $article->getID()));
     $form->addButton("No", false, orongoURL("orongo-admin/manage.php?articles"));
     $form->setContent(l("Sure delete article", $article->getTitle()));
     //The AdminFrontendForm isn't a form anymore (updateHTML() wasn't called, how epic.)
     $delete->addObject($form);
     $delete->render();
     break;
 case "user":
     if (getUser()->getRank() < RANK_ADMIN) {
         header("Location: " . orongoURL("orongo-admin/index.php?msg=0"));
         exit;
     }
     $delete->setTitle("Delete User");
     try {
         $user = new User($id);
     } catch (Exception $e) {
         if ($e->getCode() == USER_NOT_EXIST) {
             header("Location: " . orongoURL("orongo-admin/manage.php?msg=0&obj=users"));
             exit;
         } else {
             header("Location: " . orongoURL("orongo-admin/index.php?msg=2"));
示例#12
0
            $styles[$info['style']['name']] = $file;
        }
    }
}
$settingForm->addSelect("website_style", $styles);
$settingForm->addSelect("website_lang", $languages);
$settingForm->addButton("Save", true);
$settings->addObject($settingForm);
$xml = @simplexml_load_file(getStyle()->getStylePath() . "info.xml");
$json = @json_encode($xml);
$info = @json_decode($json, true);
if (is_array($info['style']['settings']) && getStyle()->isUsingPHP()) {
    $styleForm = new AdminFrontendForm(100, "Style Settings", "POST", orongoURL("actions/action_SaveStyleSettings.php"));
    $styleSettings = getDatabase()->query("SELECT `setting`, `setting_value` FROM `style_data` WHERE `style_main_class` = %s", $info['style']['main_class']);
    foreach ($styleSettings as $setting) {
        if (!isset($info['style']['settings'][$setting['setting']])) {
            continue;
        }
        $settingInfo = $info['style']['settings'][$setting['setting']];
        if ($settingInfo['type'] == 'boolean') {
            $selected = $setting['setting_value'] == 'false' ? l("No") : l("Yes");
            $styleForm->addRadios($settingInfo['description'], $setting['setting'], array(l("Yes") => "true", l("No") => "false"), $selected, false);
        } else {
            $styleForm->addInput($settingInfo['description'], $setting['setting'], "text", $setting['setting_value'], false, false, false);
        }
    }
    $styleForm->addButton("Save", true);
    $settings->addObject($styleForm);
}
$settings->render();