Example #1
0
        $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();
        break;
    case "page":
        $create->setTitle("Create Page");
        $form = new AdminFrontendForm(100, "New Page", "POST", orongoURL("actions/action_Create.php?page"));
        $form->addInput("Page Title", "title", "text", "", true);
        $form->addInput("Page Content", "content", "ckeditor", "", true);
        $form->addButton("Post", true);
        $create->addObject($form);
        $create->render();
        break;
    default:
        header("Location: " . orongoURL("orongo-admin/index.php?msg=1"));
        exit;
}
Example #2
0
            $msg = l("LOGIN_MSG_INVALID_ACTIVATION_URL");
            $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();
Example #3
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();
}
Example #4
0
        if (getUser()->getRank() < RANK_WRITER) {
            header("Location: " . orongoURL("orongo-admin/index.php?msg=0"));
            exit;
        }
        $comment = null;
        $view->setTitle("Viewing Comment");
        try {
            $comment = new Comment($id);
        } catch (Exception $e) {
            if ($e->getCode() == COMMENT_NOT_EXIST) {
                header("Location: " . orongoURL("orongo-admin/manage.php?msg=0&obj=comments"));
                exit;
            } else {
                header("Location: " . orongoURL("orongo-admin/index.php?msg=2"));
                exit;
            }
        }
        $form = new AdminFrontendForm(100, l("Comment") . " (" . $comment->getID() . ")", "GET", "", false);
        $form->addInput("ID", "id", "text", $comment->getID(), false, true);
        $form->addInput("Date", "date", "text", date("Y-m-d H:i:s", $comment->getTimestamp()), false, true);
        $form->addInput("Commenter", "title", "text", $comment->getAuthorName(), false, true);
        $form->addInput("Comment", "content", "textarea", $comment->getContent(), false, true);
        $form->addButton("Delete", false, orongoURL("orongo-admin/delete.php?comment." . $id));
        $view->addObject($form);
        $view->render();
        break;
    default:
        header("Location: " . orongoURL("orongo-admin/index.php?msg=1"));
        exit;
        break;
}
Example #5
0
        $create->addObject($form);
        $create->render();
        break;
    case "page":
        if (getUser()->getRank() < RANK_WRITER) {
            header("Location: " . orongoURL("orongo-admin/index.php?msg=0"));
            exit;
        }
        $create->setTitle("Edit Page");
        try {
            $page = new Page($id);
        } catch (Exception $e) {
            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("Edit Page") . " (" . $page->getID() . ")", "POST", orongoURL("actions/action_Edit.php?page." . $page->getID()), false);
        $form->addInput("Page Title", "title", "text", $page->getTitle(), true);
        $form->addInput("Page Content", "content", "ckeditor", $page->getContent(), true);
        $form->addButton("Save", true);
        $create->addObject($form);
        $create->render();
        break;
    default:
        header("Location: " . orongoURL("orongo-admin/index.php?msg=1"));
        exit;
}
Example #6
0
            $msgtype = "warning";
            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();
Example #7
0
        $delete->addObject($form);
        $delete->render();
        break;
    case "comment":
        if (getUser()->getRank() < RANK_ADMIN) {
            header("Location: " . orongoURL("orongo-admin/index.php?msg=0"));
            exit;
        }
        $delete->setTitle("Delete Comment");
        try {
            $comment = new Comment($id);
        } catch (Exception $e) {
            if ($e->getCode() == COMMENT_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("Delete Comment") . " (" . $comment->getID() . ")", "POST", "", false);
        $form->addButton("Yes", true, orongoURL("actions/action_Delete.php?comment." . $comment->getID()));
        $form->addButton("No", false, orongoURL("orongo-admin/manage.php?comments"));
        $form->setContent(l("Sure delete comment", $comment->getAuthorName()));
        $delete->addObject($form);
        $delete->render();
        break;
    default:
        header("Location: " . orongoURL("orongo-admin/index.php?msg=1"));
        exit;
}
Example #8
0
            $xml = @simplexml_load_file($xmlFile);
            $json = @json_encode($xml);
            $info = @json_decode($json, true);
            $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);
Example #9
0
$accessKey = $info['plugin']['access_key'];
$authKey = null;
foreach (Plugin::getAuthKeys() as $pAuthKey => $pAccessKey) {
    if ($pAccessKey == $accessKey) {
        $authKey = $pAuthKey;
    }
}
if ($authKey == null) {
    $settings->addMessage(l("Plugin not found"), "error");
    $settings->render();
    exit;
}
$settings->setTitle(l("Plugin Settings") . " (" . $pluginName . ") ", false);
//That's how you hack an auth key :P
$pSettings = Plugin::getSettings($authKey);
$settingForm = new AdminFrontendForm(100, l("Plugin Settings") . " (" . $pluginName . ") ", "POST", orongoURL("actions/action_SavePluginSettings.php?xml_path=" . $_GET['xml_path']), false);
foreach ($pSettings as $settingName => $value) {
    if (!isset($info['plugin']['settings'][$settingName])) {
        continue;
    }
    $setting = $info['plugin']['settings'][$settingName];
    if ($setting['type'] == 'boolean') {
        $selected = $value ? l("Yes") : l("No");
        $settingForm->addRadios($setting['description'], $settingName, array(l("Yes") => "true", l("No") => "false"), $selected, false);
    } else {
        $settingForm->addInput($setting['description'], $settingName, "text", $value, false, false, false);
    }
}
$settingForm->addButton("Save", true);
$settings->addObject($settingForm);
$settings->render();