Example #1
0
 public function widgetChooserAction()
 {
     $widgets = [];
     foreach (App::$primary->config['modules'] as $module) {
         $info = Module::getInfo($module);
         if (!empty($info['widgets'])) {
             $widgets += $info['widgets'];
         }
     }
     $this->view->page(['page' => 'blank', 'data' => compact('widgets')]);
 }
Example #2
0
 public function configureAction()
 {
     $appOptions = Apps\App::get(filter_input(INPUT_GET, 'item_pk', FILTER_SANITIZE_NUMBER_INT));
     $app = new App();
     $app->name = $appOptions->name;
     $app->system = true;
     $app->staticPath = "/" . $appOptions->dir . "/static";
     $app->templatesPath = "/" . $appOptions->dir . "/static/templates";
     $app->path = INJI_PROGRAM_DIR . '/' . $appOptions->dir;
     $app->type = 'app';
     $app->installed = true;
     $app->params = [];
     $app->config = Config::app($app);
     $modules = Module::getInstalled($app, $app);
     $inputs = [];
     foreach ($modules as $module) {
         $info = Module::getInfo($module);
         if (!empty($info['configure'])) {
             $config = Config::module($module, false, $app);
             foreach ($info['configure'] as $optionName => $params) {
                 if (filter_input(INPUT_POST, $optionName)) {
                     $config[$optionName] = filter_input(INPUT_POST, $optionName);
                     Config::save('module', $config, $module, $app);
                 }
                 $input = [];
                 $input['name'] = $optionName;
                 $input['type'] = $params['type'];
                 $input['label'] = $params['label'];
                 $input['options']['value'] = !empty($config[$optionName]) ? $config[$optionName] : '';
                 $input['options']['values'] = ['' => 'Не выбрано'];
                 $input['options']['values'] += $params['model']::getList(['forSelect' => true, 'key' => $params['col']]);
                 $inputs[] = $input;
             }
         }
     }
     if (!empty($_POST)) {
         Tools::redirect('/setup');
     }
     $this->view->page(['data' => compact('inputs')]);
 }
Example #3
0
<h1>Установка модулей</h1>
<form>
    <?php 
$config = Config::app(App::$primary ? App::$primary : App::$cur);
$modules = array_flip(Module::getInstalled(App::$cur));
$systemModules = array_slice(scandir(INJI_SYSTEM_DIR . '/modules'), 2);
foreach ($systemModules as $module) {
    $info = Module::getInfo($module);
    if (!$info || isset($modules[$module])) {
        continue;
    }
    ?>
        <div class ="form-group">
            <div class="checkbox">
                <label>
                    <input type ="checkbox" name ="modules[]" value ="<?php 
    echo $module;
    ?>
" /> <?php 
    echo $info['name'];
    ?>
                </label>
            </div>
        </div>
        <?php 
}
?>
    <button class="btn btn-primary">Установить</button>
</form>
Example #4
0
 public function install($module, $params = [])
 {
     $installed = Module::getInstalled(App::$primary);
     if (in_array($module, $installed)) {
         return true;
     }
     $info = Module::getInfo($module);
     if (!empty($info['requires'])) {
         foreach ($info['requires'] as $requireModuleName) {
             $this->install($requireModuleName);
         }
     }
     $config = Config::app();
     $type = 'modules';
     $path = INJI_SYSTEM_DIR . '/modules/';
     $location = 'modules';
     $config[$location][] = $module;
     if (!empty($info['autoload'])) {
         $config['autoloadModules'][] = $module;
     }
     if (!empty($info['menu'])) {
         foreach ($info['menu'] as $appType => $items) {
             $this->addInMenu($items, $appType);
         }
     }
     Config::save('app', $config, null, App::$primary);
     if (file_exists($path . $module . '/install_script.php')) {
         $installFunction = (include $path . $module . '/install_script.php');
         $installFunction(1, $params);
     }
 }
Example #5
0
 public static function writeCode()
 {
     $args = func_get_args();
     $DBI = Instance::get('DBI');
     $DBI->connect();
     if (isset($args[1]) && !empty($args[1])) {
         $data = $args[1];
     }
     require 'global.php';
     global $_VARS;
     // Get module code
     $moduleCode = self::getCode($args[0]);
     // Set $_VARS["MODULE"] with module info
     if ($moduleCode["module_url"] != null) {
         $_VARS["MODULE"][$moduleCode["module_url"]] = Module::getInfo($moduleCode["module_url"]);
     }
     // For module pages where page will still need data after module code is written [UNTESTED]
     //if(isset($_VARS["MODULE"][$moduleCode["module_url"]]) && $_VARS["MODULE"][$moduleCode["module_url"]] != null) $originalModule = $_VARS["MODULE"][$moduleCode["module_url"]];
     // Join module and parsed values
     switch ($moduleCode["data_format_id"]) {
         case 3:
             eval('?>' . $moduleCode["code"]);
             break;
         case 2:
             echo $moduleCode["code"];
             break;
         case 4:
             echo $moduleCode["code"];
             break;
         case 1:
         default:
             echo htmlentities($moduleCode["code"]);
     }
     // For module pages where page will still need data after module code is written
     //if(isset($originalModule)) $_VARS["MODULE"][$module] = $originalModule;
 }
Example #6
0
function sec_about()
{
    global $lng, $credits;
    title("About OBBLM");
    HTMLOUT::dnt();
    ?>
    <br>
    <p>
        <b>OBBLM version <?php 
    echo OBBLM_VERSION;
    ?>
</b><br><br>
        Online Blood Bowl League Manager is an online game management system for Game Workshop's board game Blood Bowl.<br>
        <br>
        The authors of this program are
        <ul>
            <li> <a href="mailto:nicholas.rathmann@gmail.com">Nicholas Mossor Rathmann</a>
            <li> <a href="http://www.mercuryvps.com">William Leonard</a>
            <li> Niels Orsleff Justesen</a>
        </ul>
        With special thanks to <?php 
    $lc = array_pop($credits);
    echo implode(', ', $credits) . " and {$lc}";
    ?>
.<br><br>
        Bugs reports and suggestions are welcome.
        <br>
        OBBLM consists of valid HTML 4.01 transitional document type pages.
        <br><br>
        <img src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01 Transitional" height="31" width="88">
        <br><br>
        <b>Modules loaded:</b><br>
        <?php 
    $mods = array();
    foreach (Module::getRegistered() as $modname) {
        list($author, $date, $moduleName) = Module::getInfo($modname);
        $mods[] = "<i>{$moduleName}</i> ({$author}, {$date})";
    }
    echo implode(', ', $mods);
    ?>
    </p>

    <?php 
    title("OBBLM Hosting");
    echo 'Please visit <a href="http://www.mercuryvps.com">Mercury VPS</a> and click on the OBBLM tab to get started.';
    title("Documentation");
    echo "See the <a TARGET='_blank' href='" . DOC_URL . "'>OBBLM documentation wiki</a>";
    ?>

    <?php 
    title("Disclaimer");
    ?>
    <p>
        By installing and using this software you hereby accept and understand the following disclaimer
        <br><br>
        <b>This web site is completely unofficial and in no way endorsed by Games Workshop Limited.</b>
        <br><br>
        Bloodquest, Blood Bowl, the Blood Bowl logo, The Blood Bowl Spike Device, Chaos, the Chaos device, the Chaos logo, Games Workshop, Games Workshop logo, Nurgle, the Nurgle device, Skaven, Tomb Kings, 
        and all associated marks, names, races, race insignia, characters, vehicles, locations, units, illustrations and images from the Blood Bowl game, the Warhammer world are either ®, TM and/or © Games Workshop Ltd 2000-2006, 
        variably registered in the UK and other countries around the world. Used without permission. No challenge to their status intended. All Rights Reserved to their respective owners.
    </p>

    <?php 
    title("License");
    ?>
    <p>
        Copyright (c) Niels Orsleff Justesen and Nicholas Mossor Rathmann 2007-2011. All Rights Reserved.
        <br><br>
        OBBLM is free software; you can redistribute it and/or modify
        it under the terms of the GNU General Public License as published by
        the Free Software Foundation; either version 3 of the License, or
        (at your option) any later version.
        <br><br>
        OBBLM is distributed in the hope that it will be useful,
        but WITHOUT ANY WARRANTY; without even the implied warranty of
        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
        GNU General Public License for more details.
        <br><br>
        You should have received a copy of the GNU General Public License
        along with this program.  If not, see http://www.gnu.org/licenses/.
    </p>
    <?php 
}
 /** Does A depend on B?
  * @param Module $modA
  *	Module A
  * @param Module $modB
  *	Module B
  * @param int $loop
  *	Loop prevention (stop after 30 dependencies)
  *
  * @return bool
  */
 public function dependOn($modA, $modB, $loop = 0)
 {
     $loop++;
     if ($loop >= 30) {
         die("ModuleHandler: Dependency loop detected! Check dependencies!");
     }
     if (!$modA or !$modB) {
         return false;
     }
     // get name of B
     $nameB = $modB->getInfo('name');
     // get dependencies of A
     $deps = $modA->getInfo('dependencies');
     // A has no deps?
     if (empty($deps)) {
         return false;
     }
     // Check if B is within deps
     foreach ($deps as $index => $values) {
         if ($values['value'] == $nameB) {
             return true;
         }
     }
     // Check reverse if B is within deps of deps
     foreach ($deps as $index => $values) {
         if ($this->dependOn($this->getModule($values['value']), $modB)) {
             return true;
         }
     }
     return false;
 }
Example #8
0
require_once FRAM3W0RK_DIR . 'index.php';
Instance::$import = array('class.php');
Instance::load();
Log::$blnLog = TRUE;
// Create global array
$_VARS = array();
// Create defaults for DBI
$DBI = Instance::get('DBI');
DBI::setDefaults(array("lang" => DBI_LANG, "host" => DBI_SERVER, "user" => DBI_USER, "pass" => DBI_PASS, "database" => DBI_DB));
$DBI->connect();
// Create defaults for FTP
FTP::setDefaults(FTP_SERVER, FTP_USER, FTP_PASS);
$FTP = Instance::get('FTP');
$FTP->connect();
// Pull in CMS variables
$_VARS["WEBSITE"] = Module::getInfo('');
$_VARS["WEBSITE"] = $_VARS["WEBSITE"]["values"];
$_VARS['PHP']['version'] = phpversion();
if ($_VARS["WEBSITE"]['mode'] == "DEV") {
    $_VARS['PHP']['extensions'] = get_loaded_extensions();
}
$_VARS['PAGE']['request']['get'] = $_GET;
$_VARS['PAGE']['request']['post'] = $_POST;
$_VARS['PAGE']['request']['all'] = $_REQUEST;
// Unset rewrite variables
unset($_VARS['PAGE']['request']['get']["TYPE"]);
unset($_VARS['PAGE']['request']['post']["TYPE"]);
unset($_VARS['PAGE']['request']['both']["TYPE"]);
unset($_VARS['PAGE']['request']['get']["PATH"]);
unset($_VARS['PAGE']['request']['post']["PATH"]);
unset($_VARS['PAGE']['request']['both']["PATH"]);