/** * Get content */ public function getContent() { headline(t("settings.1")); $table = new Form_Table($this->getForm()); $table->addSubmit(t("saveit")); echo $table->getHtml(); }
/** * Get content */ public function getContent() { session("name"); session_unset(); if (post("login")) { v("message", t("login.1")); $user = RDR_User::login(post("username"), post("password"), post("remember")); if ($user) { if (get("redirect")) { redirect(get("redirect")); } redirect(l("RDR_Home"), 302); } } ?> <div class="center"> <img src="<?php echo url()->getByAlias("public", "img/logo-1.png"); ?> " alt=""/> </div> <?php $table = new Form_Table($this->getForm()); $table->addSubmit("Login"); echo $table->getHtml(); }
/** * Get content */ public function getContent() { $errors = $checkErrors = array(); $writeableFolders = array(CHOQ_ACTIVE_MODULE_DIRECTORY, CHOQ_ACTIVE_MODULE_DIRECTORY . "/public/static", CHOQ_ACTIVE_MODULE_DIRECTORY . "/public/img/favicons", CHOQ_ACTIVE_MODULE_DIRECTORY . "/tmp"); foreach ($writeableFolders as $folder) { if (!is_dir($folder)) { $errors[] = sprintf(t("install.folder.notexist"), $folder); break; } if (!is_writable($folder)) { $errors[] = sprintf(t("install.folder.writeable"), $folder); break; } } if (!ini_get("allow_url_fopen")) { $errors[] = sprintf(t("install.php.feature"), "allow_url_fopen"); } if (!function_exists("fsockopen")) { $errors[] = sprintf(t("install.php.feature"), "fsockopen/sockets"); } if (!function_exists("simplexml_load_file")) { $errors[] = sprintf(t("install.php.feature"), "SimpleXML"); } if (!CHOQ_DB_Mysql::isAvailable()) { $errors[] = sprintf(t("install.php.feature"), "MySQLi"); } if (post("install")) { try { $connString = "mysql://" . post("mysql-user") . ":" . post("mysql-pass") . "@" . post("mysql-host") . "/" . post("mysql-db"); CHOQ_DB::add($connString, "test"); db("test")->query("DROP TABLE IF EXISTS " . db("test")->quote("RDR_test")); db("test")->query("CREATE TABLE " . db("test")->quote("RDR_test") . " (" . db("test")->quote("id") . " INT NOT NULL)"); db("test")->query("DROP TABLE IF EXISTS " . db("test")->quote("RDR_test")); $fileData = "<?php\nif(!defined(\"CHOQ\")) die();\n/**\n * Local Configuration\n**/\n\n"; $fileData .= 'CHOQ_DB::add(\'' . $connString . '\');' . "\n"; $fileData .= 'v("hash.salt", "' . uniqid(NULL, true) . sha1(microtime() . uniqid(NULL, true)) . '");' . "\n"; $tmpfile = CHOQ_ACTIVE_MODULE_DIRECTORY . "/tmp/_RDR.local.tmp.php"; file_put_contents($tmpfile, $fileData); include $tmpfile; $generator = CHOQ_DB_Generator::create(db()); $tables = $generator->getExistingTables(); foreach ($tables as $table) { if ($table == "_choqled_metadata" || substr(strtolower($table), 0, 3) == "rdr_") { db()->query("DROP TABLE " . db()->quote($table)); } } RDR_DBUpdate::run(); $user = new RDR_User(db()); $user->username = post("admin-user"); $user->setPassword(post("admin-pass")); $user->role = RDR_User::ROLE_ADMIN; $user->store(); rename($tmpfile, CHOQ_ACTIVE_MODULE_DIRECTORY . "/_RDR.local.php"); redirect(url()->getByAlias("base")); } catch (Exception $e) { $checkErrors[] = $e->getMessage(); } } ?> <div class="center"> <img src="<?php echo url()->getByAlias("public", "img/logo-1.png"); ?> " alt=""/> </div> <?php if (!$errors) { $this->showErrors($checkErrors); $form = $this->getForm(); $formTable = new Form_Table($form); $formTable->addSubmit(t("install.finish")); echo $formTable->getHtml(); echo "<div class='center'><br/>" . t("install.warn") . "</div>"; } else { $this->showErrors($errors); } }
/** * Get content */ public function getContent() { headline(t("rss.1")); echo t("rss.2") . '<div class="spacer"></div>'; headline(t("rss.3")); $categories = user()->getCategories(); $i = 1; foreach ($categories as $category) { $feeds = $category->feeds; ?> <div class="category" style="margin-bottom: 10px;"> <div class="inner"> <div class="title" data-category="<?php echo $category->getId(); ?> " data-feed="0"> <input type="checkbox" class="cat" checked="checked"/> <b><?php echo s($category->name); ?> </b> </div> <?php if ($feeds) { foreach ($feeds as $feed) { ?> <div class="feed" data-category="<?php echo $category->getId(); ?> " data-feed="<?php echo $feed->getId(); ?> " style="margin-left: 10px; font-size: 12px;"> <input type="checkbox" class="feed" checked="checked" value="<?php echo $feed->getId(); ?> "/> <?php echo s($feed->getCustomName($category)); ?> </div> <?php } } ?> </div> </div> <?php } $table = new Form_Table($this->getForm()); $table->addButton(t("rss.9"), array("onclick" => "checkSubmit()")); echo $table->getHtml(); ?> <script type="text/javascript"> function checkSubmit(){ var formtable = $("#form-rss").parent().data("formtable"); if(formtable.validateAllFields()){ var ids = []; $("input.feed:checked").each(function(){ ids.push(this.value); }); window.open('<?php echo url()->getModifiedUri(false); ?> ?f='+ids.join(",")+"&token=<?php echo user()->getId() . "." . saltedHash("sha256", user()->getId()); ?> &title="+encodeURIComponent($("input[name='title']").val())+"&desc="+encodeURIComponent($("input[name='desc']").val())+"&max="+encodeURIComponent($("input[name='max']").val())+"&catmax="+encodeURIComponent($("input[name='catmax']").val())+"&feedmax="+encodeURIComponent($("input[name='feedmax']").val())); } } $("input.cat").on("click", function(){ $(this).parent().parent().find("input.feed").prop("checked", this.checked); }); </script> <?php }
/** * Get content */ public function getContent() { headline(t("admin.user.1")); $users = RDR_User::getByCondition(null, null, "+username"); foreach ($users as $user) { ?> <a href="<?php echo url()->getModifiedUri(array("id" => $user->getId())); ?> "><?php echo s($user->username); ?> (<?php echo t("user." . $user->role); ?> )</a><br/> <?php } ?> <div class="spacer"></div> <?php headline($this->user->getId() ? t("admin.user.3") : t("admin.user.4")); $table = new Form_Table($this->form); $table->addSubmit(t("saveit")); if ($this->user->getId()) { $table->addButton(t("admin.user.4"), array("onclick" => "window.location.href = '" . url()->getModifiedUri(false) . "'")); } echo $table->getHtml(); }