break; case 3: $manage->addMessage(l("Plugin installed"), "success"); break; case 4: $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())); }
$object = $_GET['obj']; } switch ($_GET['msg']) { case 0: $create->addMessage(l("Object post error"), "error"); break; case 1: $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"));
if (count($query) != 2) { header("Location: " . orongoURL("orongo-admin/index.php?msg=1")); exit; } $object = trim($query[0]); $id = trim($query[1]); } $view->main(array("time" => time(), "page_template" => "dashboard", "page_title" => "Viewing")); switch ($object) { case "page": if (getUser()->getRank() < RANK_WRITER) { header("Location: " . orongoURL("orongo-admin/index.php?msg=0")); exit; } $page = null; $view->setTitle("Viewing 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("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);
$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]); $create = new AdminFrontend(); $create->main(array("time" => time(), "page_title" => "Edit", "page_template" => "dashboard")); switch ($object) { case "article": if (getUser()->getRank() < RANK_WRITER) { header("Location: " . orongoURL("orongo-admin/index.php?msg=0")); exit; } $create->setTitle("Edit Article"); 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")); exit; } else { header("Location: " . orongoURL("orongo-admin/index.php?msg=2")); exit; } } $form = new AdminFrontendForm(100, l("Edit Article") . " (" . $article->getID() . ")", "POST", orongoURL("actions/action_Edit.php?article." . $article->getID()), false); $form->addInput("Article Title", "title", "text", $article->getTitle(), true); $form->addInput("Article Content", "content", "ckeditor", $article->getContent(), true); $form->addInput("Tags", "tags", "text", $article->getTagsString());
$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]); $delete = new AdminFrontend(); $delete->main(array("time" => time(), "page_title" => "Delete", "page_template" => "dashboard")); switch ($object) { case "article": if (getUser()->getRank() < RANK_WRITER) { header("Location: " . orongoURL("orongo-admin/index.php?msg=0")); exit; } $delete->setTitle("Delete Article"); 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")); 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()));
$settings->render(); exit; } $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); } }