function update_from_post() { # update the item from post variables # we can find out what post variables to look for by checking our oncology $flot = new Flot(); $ufUF = new UtilityFunctions(); $flot->b_is_user_admin(); // set url auto to false as a default, since it will only be posted if it was checked $this->o_loaded_item_object->url_auto = "false"; $this->o_loaded_item_object->url = ""; foreach ($this->o_oncology->elements as $element) { // go through all items in oncology $s_new_value = $ufUF->s_post_var($element, false); if ($s_new_value) { $this->o_loaded_item_object->{$element} = urldecode($s_new_value); } } # update date and set author $this->o_loaded_item_object->date_modified = date("d-m-Y"); $this->o_loaded_item_object->author = $flot->s_current_user; $oa_full_elements = array(); foreach ($this->o_oncology->full_elements as $element) { $s_new_value = $ufUF->s_post_var($element->name, false); if ($s_new_value) { if ($element->editable === "true") { //$this->datastore->oa_individual_items[$this->o_loaded_item_object->id][$element->name] = urldecode($s_new_value); $oa_full_elements[$element->name] = urldecode($s_new_value); } } } $this->_set_full_item($oa_full_elements); // save full item, which we just edited directly }
<?php # log in and forward user to route admin section require_once 'flot-admin/core/base.php'; require S_BASE_PATH . 'flot-admin/core/flot.php'; $flot = new Flot(); $requirements = new FlotRequirements(); $ufUF = new UtilityFunctions(); $fuFU = new FileUtilities(); # are we handling the form submission? if ($ufUF->b_post_vars()) { // user has entered an email and password okay if (isset($_POST["email"]) && isset($_POST["password"])) { // are the requirements met? if ($requirements->b_requirements_met()) { // // set up flot // $flot->_create_start_dirs(); // add username/pass, store to datastore if ($flot->datastore->b_add_user($_POST["email"], sha1($_POST["password"]))) { // log the user in too, with the same email and password that was posted as part of their registration $flot->_handle_auth_attempt(); # at a later date, add some starter items ## web page oncology ## a few pages ## a menu // generate all pages $flot->_render_all_pages(); // delete this start.php page for security $flot->_delete_start_page();
function update_from_post() { # update the item from post variables # we can find out what post variables to look for by checking our oncology $flot = new Flot(); $ufUF = new UtilityFunctions(); $s_id = $ufUF->s_post_var("menu_id", false); if ($s_id) { $s_name = $ufUF->s_post_var("name", false); if ($s_name !== false) { $this->o_loaded_menu_object->title = urldecode($s_name); } $s_serialisation = $ufUF->s_post_var("serialisation", false); if ($s_serialisation !== false) { $this->o_loaded_menu_object->serialisation = urldecode($s_serialisation); } $this->datastore->_set_menu_data($this->o_loaded_menu_object); $this->datastore->b_save_datastore("menus"); // regenerate pages $flot->_render_all_pages(); } else { echo "no id"; } }
<?php # manage site /* this page handles both gets and sets. ideally we could check for post vars, process set request, then location change to a get however we also need to show invalid post requests? maybe we could just do that client side. */ require_once '../../flot-admin/core/base.php'; require_once '../../flot-admin/core/flot.php'; $flot = new Flot(); $admin_ui = new AdminUI(); if (!$flot->b_is_user_admin()) { # forward them to login page $flot->_page_change("/flot-admin/admin/login.php"); } $html_main_admin_content = ""; $html_main_admin_content_menu = ""; $s_body_class = ""; $s_section = ""; $ufUf = new UtilityFunctions(); if ($ufUf->b_post_vars()) { # # handle post request # $s_action = $ufUf->s_post_var_from_allowed("action", array("edit"), "edit"); $s_section = $ufUf->s_post_var_from_allowed("section", array("items", "elements", "pictures", "menus", "settings", "oncologies"), "items"); switch ($s_section) { case "items": switch ($s_action) { case 'edit':
<?php # kill session and forward somewhere? $s_b_p = str_replace($_SERVER['SCRIPT_NAME'], "", str_replace("\\", "/", $_SERVER['SCRIPT_FILENAME'])) . '/'; require_once $s_b_p . 'flot-admin/core/base.php'; require_once S_BASE_PATH . 'flot-admin/core/flot.php'; $flot = new Flot(); if ($flot->b_is_user_admin()) { # kill session $flot->_kill_session(); } $flot->_page_change("/flot-admin/admin/login.php");
<?php require_once 'core/flot.php'; # main entry point, requests redirected here from htaccess/conf # get url # look up url in urls (from datastore) # serve 404 if not found # if found, load corresponding instance and render $flot = new Flot(); $flot->create_item_from_url();
<?php # log in and forward user to route admin section require '../core/flot.php'; $flot = new Flot(); $AdminUI = new AdminUI(); # are we handling the log in form submission ? $flot->_handle_auth_attempt(); if ($flot->b_is_user_admin()) { # they're logged in so forward them to the admin page to manage the site $flot->_page_change("index.php"); } # serve them the log in form ?> <!DOCTYPE html> <html> <head> <?php echo $AdminUI->s_admin_header(); ?> </head> <body> <div class="container" style="max-width:300px;margin-top:150px;"> <!-- instruction, email, password, login/submit button --> <form role="form" method="post" name="login" action="login.php"> <div class="form-group"> <h1>login</h1> </div> <div class="form-group"> <input type="email" name="email" class="form-control" id="login_email" placeholder="email"> </div>
<?php // include core $s_b_p = str_replace($_SERVER['SCRIPT_NAME'], "", str_replace("\\", "/", $_SERVER['SCRIPT_FILENAME'])) . '/'; require $s_b_p . 'flot_flot/core/base.php'; require_once S_BASE_PATH . 'flot_flot/core/flot.php'; $flot = new Flot(); // if authorized if (!$flot->b_is_user_admin()) { # forward them to login page $flot->_page_change("/flot_flot/admin/login.php"); } else { $sfSF = new SettingsUtilities(); $fuFU = new FileUtilities(); $s_start_version = $sfSF->s_literal_flot_version(); // // do update // // download new flot $s_download_to = S_BASE_PATH . 'flot_flot' . DIRECTORY_SEPARATOR . 'temp' . DIRECTORY_SEPARATOR . 'new_flot.zip'; $s_unzip_to = S_BASE_PATH . 'flot_flot' . DIRECTORY_SEPARATOR . 'temp' . DIRECTORY_SEPARATOR . 'new_flot' . DIRECTORY_SEPARATOR . ''; echo "download to: " . $s_download_to . "<br/>"; echo "download from: " . FLOT_DOWNLOAD_URL . "<br/>"; file_put_contents($s_download_to, fopen(FLOT_DOWNLOAD_URL, 'r')); // unpack $zip = new ZipArchive(); $res = $zip->open($s_download_to); if ($res === TRUE) { $zip->extractTo($s_unzip_to); $zip->close(); echo 'unpacked flot<br/>';
function update_from_post() { $flot = new Flot(); $ufUF = new UtilityFunctions(); $flot->b_is_user_admin(); $s_new_title = $ufUF->s_post_var("title", false); $s_new_value = $ufUF->s_post_var("content_html", false); # update date and set author $this->o_loaded_element_object->title = $s_new_title; $this->o_loaded_element_object->date_modified = date("d-m-Y"); $this->o_loaded_element_object->author = $flot->s_current_user; $this->datastore->_set_element_data($this->o_loaded_element_object); $this->datastore->b_save_datastore("elements"); $this->datastore->oa_individual_elements[$this->o_loaded_element_object->id] = array(); $this->datastore->oa_individual_elements[$this->o_loaded_element_object->id]['content_html'] = $s_new_value; $this->_set_full_element($this->datastore->oa_individual_elements[$this->o_loaded_element_object->id]); // save full item, which we just edited directly $this->datastore->b_save_element($this->o_loaded_element_object->id); }