示例#1
0
 function update_from_post()
 {
     $ufUF = new UtilityFunctions();
     $c_elements = count($_POST['name']);
     $oa_elements = array();
     //
     // general properties
     //
     $s_oncology_title = $ufUF->s_post_var('page_type_name', false);
     if ($s_oncology_title) {
         $this->json_oncology_instance->title = $s_oncology_title;
     }
     //
     // full elements
     //
     for ($c_element = 0; $c_element < $c_elements; $c_element++) {
         $s_name = $ufUF->s_post_array_var('name', $c_element, '');
         $s_type = $ufUF->s_post_array_var('type', $c_element, '');
         $s_editable = $ufUF->s_post_array_var('editable', $c_element, "false");
         $s_position = $ufUF->s_post_array_var('position', $c_element, 0);
         $oa_element = array('name' => $s_name, 'type' => $s_type, 'editable' => $s_editable, 'position' => $s_position);
         array_push($oa_elements, $oa_element);
     }
     $this->json_oncology_instance->full_elements = $oa_elements;
     $this->datastore->_set_oncology_data($this->json_oncology_instance);
     $this->datastore->b_save_datastore('oncologies');
 }
示例#2
0
<?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();
示例#3
0
文件: items.php 项目: Divian/flot
 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
 }
示例#4
0
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':
                    # get the id, find the item, then try replacing the attributes
                    $item_id = $ufUf->s_post_var("item_id", false);
                    if ($item_id) {
                        // we have an item id, now we'll try and get the corresponding item information
                        $o_item = $flot->datastore->get_item_data($item_id);
示例#5
0
 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";
     }
 }
 public function getTimePeriodIntervalId($start_time)
 {
     $interval_id = 0;
     if ($this->getDetailInterval() == self::DETAIL_INTERVAL_DAY) {
         $interval_id = UtilityFunctions::sqlToDaysConversion(date("m/d/Y", $start_time));
     } else {
         if ($this->getDetailInterval() == self::DETAIL_INTERVAL_WEEK) {
             $interval_id = UtilityFunctions::sqlWeekConversion(date("m/d/Y", $start_time));
         } else {
             if ($this->getDetailInterval() == self::DETAIL_INTERVAL_MONTH) {
                 $interval_id = date("n", $start_time);
             }
         }
     }
     return $interval_id;
 }
示例#7
0
文件: elements.php 项目: Divian/flot
 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);
 }
示例#8
0
 function s_admin_header($s_section = "")
 {
     $s_header = "";
     $s_header .= $this->html_admin_headers_base();
     switch ($s_section) {
         case "items":
             $ufUf = new UtilityFunctions();
             $s_action = $ufUf->s_get_var_from_allowed("action", array("edit", "list"), "list");
             switch ($s_action) {
                 case "edit":
                     # ckeditor
                     $s_header .= '<script src="' . S_BASE_EXTENSION . 'flot-admin/external_integrations/ckeditor/ckeditor.js"></script>';
                     # text angular
                     $s_header .= '<script src="' . S_BASE_EXTENSION . 'flot-admin/external_integrations/text_angular/textAngular-sanitize.min.js"></script>';
                     $s_header .= '<script src="' . S_BASE_EXTENSION . 'flot-admin/external_integrations/text_angular/textAngular.min.js"></script>';
                     # general admin js
                     $s_header .= '<script src="' . S_BASE_EXTENSION . 'flot-admin/admin/js/admin_itemedit.js"></script>';
                     $s_header .= $this->html_admin_headers_pictures();
                     break;
                 case "list":
                     $s_header .= '<script src="' . S_BASE_EXTENSION . 'flot-admin/admin/js/admin_item_list.js"></script>';
                     break;
             }
             break;
         case "elements":
             $ufUf = new UtilityFunctions();
             $s_action = $ufUf->s_get_var_from_allowed("action", array("edit", "list"), "list");
             switch ($s_action) {
                 case "edit":
                     # ckeditor
                     $s_header .= '<script src="' . S_BASE_EXTENSION . 'flot-admin/external_integrations/ckeditor/ckeditor.js"></script>';
                     $s_header .= '<script src="' . S_BASE_EXTENSION . 'flot-admin/admin/js/admin_itemedit.js"></script>';
                     $s_header .= $this->html_admin_headers_pictures();
                     break;
                 case "list":
                     $s_header .= '<script src="' . S_BASE_EXTENSION . 'flot-admin/admin/js/admin_item_list.js"></script>';
                     break;
             }
             break;
         case "oncologies":
             $ufUf = new UtilityFunctions();
             $s_action = $ufUf->s_get_var_from_allowed("action", array("edit", "list"), "list");
             switch ($s_action) {
                 case "list":
                     $s_header .= '<script src="' . S_BASE_EXTENSION . 'flot-admin/admin/js/admin_item_list.js"></script>';
                     break;
                 case "edit":
                     $s_header .= '<script src="' . S_BASE_EXTENSION . 'flot-admin/admin/js/admin_oncology_edit.js"></script>';
                     break;
             }
             break;
         case "menus":
             # jquery ui, for sortables
             $s_header .= '<script src="//code.jquery.com/ui/1.10.4/jquery-ui.js"></script>';
             // admin js for menus
             $s_header .= '<script src="' . S_BASE_EXTENSION . 'flot-admin/admin/js/admin_menus.js"></script>';
             break;
         case "pictures":
             # general admin js
             $s_header .= $this->html_admin_headers_pictures();
             break;
     }
     $s_header .= '<title>flot - manage your site</title>';
     return $s_header;
 }