Ejemplo n.º 1
0
 /**
  * Get content
  */
 public function getContent()
 {
     headline(t("settings.1"));
     $table = new Form_Table($this->getForm());
     $table->addSubmit(t("saveit"));
     echo $table->getHtml();
 }
Ejemplo n.º 2
0
    /**
     * 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();
    }
Ejemplo n.º 3
0
 public function _get()
 {
     //create the form
     $form = new Form_Table('tests/loading/');
     $name_el = $form->add_textbox('nickname', 'Nickname');
     $name_el->setting('value', $this->args->nickname);
     $birth_el = $form->add_textbox('birth', 'Date');
     $birth_el->setting('value', $this->args->birth);
     $penguins_el = $form->add_select('penguins', 'Penguins');
     for ($i = 0; $i < 10; $i++) {
         $penguins_el->add_item($i, "{$i} penguins");
     }
     $penguins_el->setting('selected', $this->args->penguins);
     $pies_el = $form->add_textbox('pies', 'Pies');
     $pies_el->setting('value', $this->args->pies);
     $awesome_el = $form->add_checkbox('awesome', 'Awesome?');
     $awesome_el->setting('checked', $this->args->awesome);
     //create the table
     $table = new Table_Basic();
     $caption = $table->add_caption('A Table of information');
     $header = $table->add_header();
     $header->add_cell('Question');
     $header->add_cell('Answer');
     $new_row = $table->add_row();
     $new_row->add_cell('Who Are You?');
     $new_row->add_cell($this->args->nickname);
     $new_row = $table->add_row();
     $new_row->add_cell('Your Birthday Is?');
     $new_row->add_cell($this->args->birth);
     $new_row = $table->add_row();
     $new_row->add_cell('How many Penguins do you own?');
     $new_row->add_cell($this->args->penguins);
     $new_row = $table->add_row();
     $new_row->add_cell('How many Pies did you eat?');
     $new_row->add_cell($this->args->pies);
     $new_row = $table->add_row();
     $new_row->add_cell('Is this Awesome?');
     if ($this->args->awesome) {
         $new_row->add_cell('Hell Yeah');
     } else {
         $new_row->add_cell('Not Really');
     }
     // get the views
     $page = new View('main', 'layouts', VPATH);
     $sidebar = new View('sidebar', 'layouts', VPATH);
     $content = new View('content', 'classtest', VPATH);
     $header = new View('header', 'classtest', VPATH);
     //insert data into views
     $content->set("table_html", $table->render());
     $content->set("form_html", $form->render());
     $page->set("sidebar", $sidebar->package());
     $page->set("header", $header->package());
     $page->set("content", $content->package());
     //render final view
     $page->render();
 }
Ejemplo n.º 4
0
    /**
     * 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);
        }
    }
Ejemplo n.º 5
0
    /**
     * 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 
    }
Ejemplo n.º 6
0
    /**
     * 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();
    }