Example #1
0
 /**
  * figure out which mods are installed
  * 
  * @return array $sections array of names of folders
  */
 public static function get_sections()
 {
     if (is_array(code_bootstrap::$sections)) {
         return code_bootstrap::$sections;
     } else {
         $folder = opendir("code");
         while ($file = readdir($folder)) {
             if (is_dir("code/" . $file) && $file != ".." && $file != ".") {
                 $sections[] = $file;
             }
         }
         closedir($folder);
         code_bootstrap::$sections = $sections;
         return $sections;
     }
 }
Example #2
0
<?php

/**
 * index.php
 *
 * calls main bootstrap
 * @package code_common
 * @author josh04
 */
$time = microtime(true);
// ------------------------
require_once "code/common/code_bootstrap.php";
require_once "code/common/interfaces/basic_player.php";
include "install.lock";
$bootstrap = new code_bootstrap();
$bootstrap->bootstrap();
$newtime = microtime(true);
//print ($newtime-$time);
Example #3
0
 /**
  * edits and adds menu items
  *
  * @return string html
  */
 protected function edit()
 {
     if (isset($_POST['menu-id'])) {
         $id = $_POST['menu-id'];
         $button_text = $_POST['menu-submit'];
         // Name-value pairs
         $item = array('label' => $_POST['menu-label'], 'category' => $_POST['menu-category'], 'section' => $_POST['menu-section'], 'page' => $_POST['menu-page'], 'extra' => $_POST['menu-extra'], 'enabled' => $_POST['menu-enabled'] == "on" ? true : false, 'function' => $_POST['menu-function'] == "on" ? true : false, 'guest' => $_POST['menu-guest'] == "on" ? true : false);
         // Error check
         if (!$item['label']) {
             $edit = $this->show_menu($this->skin->error_box($this->lang->no_label));
             return $edit;
         }
         if (!$item['section']) {
             $edit = $this->show_menu($this->skin->error_box($this->lang->no_section));
             return $edit;
         }
         if (!$item['page']) {
             $edit = $this->show_menu($this->skin->error_box($this->lang->no_page));
             return $edit;
         }
         // Get me the Iron Giant!
         $this->core("menu");
         if ($id == "-1") {
             $this->menu->add_menu_entry($item['label'], $item['category'], $item['section'], $item['page'], $item['extra'], $item['function'], $item['enabled'], $item['guest']);
         } else {
             $this->menu->modify_menu_entry($id, $item['label'], $item['category'], $item['section'], $item['page'], $item['extra'], $item['function'], $item['enabled'], $item['guest']);
         }
         header("location:?section=admin&page=menu");
     }
     $id = intval($_GET['id']);
     $item_query = $this->db->execute("SELECT * FROM `menu` WHERE `id`=?", array($id));
     if ($item_query->numrows() == 1) {
         $item = $item_query->fetchrow();
         $button_text = "Save changes";
     } else {
         $item = array('id' => '-1');
         $button_text = "Add new item";
     }
     $sections = code_bootstrap::get_sections();
     foreach ($sections as $section) {
         $section = htmlentities($section, ENT_QUOTES, 'utf-8');
         // coming from folder names; folder names can be funky
         if ($item['section'] == $section) {
             $section_options .= $this->skin->section_selected($section);
         } else {
             $section_options .= $this->skin->section($section);
         }
     }
     $done = array();
     foreach ($this->pages as $section_array) {
         foreach ($section_array as $page => $useless) {
             if (in_array($page, $done)) {
                 continue;
                 // prevent duplicates
             }
             $done[] = $page;
             if ($item['page'] == $page) {
                 $page_options .= $this->skin->page_selected($page);
             } else {
                 $page_options .= $this->skin->page($page);
             }
         }
     }
     $modify = $this->skin->edit($item, $button_text, $section_options, $page_options, $message);
     return $modify;
 }