Ejemplo n.º 1
0
<?php

require_once "common.php";
define("APIHOST", "dev.worldpossible.org");
define("RSYNCHOST", "dev.worldpossible.org");
if (isset($_GET['getRemoteModuleList'])) {
    getRemoteModuleList();
} else {
    if (isset($_GET['getLocalModuleList'])) {
        getLocalModuleList();
    } else {
        if (isset($_GET['addModule'])) {
            addModule($_GET['addModule']);
        } else {
            if (isset($_GET['deleteModule'])) {
                deleteModule($_GET['deleteModule']);
            } else {
                if (isset($_GET['cancelTask'])) {
                    cancelTask($_GET['cancelTask']);
                } else {
                    if (isset($_GET['getTasks'])) {
                        getTasks();
                    } else {
                        if (isset($_GET['wifistat'])) {
                            wifiStatus();
                        } else {
                            if (isset($_GET['selfUpdate'])) {
                                selfUpdate();
                            } else {
                                if (isset($_GET['modUpdate'])) {
                                    addModule($_GET['modUpdate']);
Ejemplo n.º 2
0
function handleModuleManagement()
{
    global $sourceFolder;
    if (isset($_POST['btn_install'])) {
        $uploadId = processUploaded("Module");
        if ($uploadId != -1) {
            return installModule($uploadId, "Module");
        }
    } else {
        if (isset($_POST['btn_uninstall'])) {
            if (!isset($_POST['Module']) || $_POST['Module'] == "") {
                return "";
            }
            if ($_POST['Module'] == 'article') {
                displayerror("Article module can't be deleted for the home page itself is a article");
                return "";
            }
            $toDelete = escape($_POST['Module']);
            $query = "SELECT `page_id` FROM `" . MYSQL_DATABASE_PREFIX . "pages` WHERE `page_module` = '{$toDelete}' LIMIT 10";
            $result = mysql_query($query) or displayerror(mysql_error());
            if (mysql_num_rows($result) == 0 || isset($_POST['confirm'])) {
                if (deleteModule($toDelete)) {
                    displayinfo("Module " . safe_html($_POST['Module']) . " uninstalled!");
                    return "";
                } else {
                    displayerror("Module uninstallation failed!");
                    return "";
                }
            }
            if (isset($_POST['confirm'])) {
                $query = "DELETE FROM `" . MYSQL_DATABASE_PREFIX . "pages` WHERE `page_module` = '" . $toDelete . "'";
                mysql_query($query) or displayerror(mysql_error());
            }
            $pageList = "";
            while ($row = mysql_fetch_assoc($result)) {
                $pageList .= "/home" . getPagePath($row['page_id']) . "<br>";
            }
            $modulename = safe_html($_POST['Module']);
            $ret = <<<RET
<fieldset>
<legend>{$ICONS['Modules Management']['small']}Module Management</legend>
Some of the page of type {$modulename} are:<br>
{$pageList}
<div class='cms-error'>These pages will be removed and cant be recovered, If you proceed deleting the module.</div>
<form method=POST action='./+admin&subaction=module&subsubaction=uninstall'>
<input type=hidden value='{$modulename}' name='Module' />
<input type=submit value='Delete module' name='btn_uninstall' />
<input type=hidden value='confirm' name='confirm' />
</form>
</fieldset>
RET;
            return $ret;
        } else {
            if (isset($_GET['subsubaction']) && $_GET['subsubaction'] == 'finalize') {
                return finalizeInstallation(escape($_POST['id']), "Module");
            } else {
                if (isset($_GET['subsubaction']) && $_GET['subsubaction'] == 'cancel') {
                    $uploadId = escape($_POST['id']);
                    $result = mysql_fetch_assoc(mysql_query("SELECT * FROM `" . MYSQL_DATABASE_PREFIX . "tempuploads` WHERE `id` = '{$uploadId}'"));
                    if ($result != NULL) {
                        $zipFile = $result['filePath'];
                        $temp = explode(";", $result['info']);
                        $extractedPath = $temp[0];
                        $moduleActualPath = $temp[1];
                        $moduleName = $temp[2];
                    }
                    delDir($extractedPath);
                    unlink($zipFile);
                    mysql_query("DELETE FROM `" . MYSQL_DATABASE_PREFIX . "tempuploads` WHERE `id` = '{$uploadId}'") or displayerror(mysql_error());
                    return "";
                }
            }
        }
    }
}
Ejemplo n.º 3
0
     installModule();
     header('Location:?event=showModules');
     exit;
 case 'updateModule':
     include_once 'functions/updateModule.func.php';
     updateModule();
     header('Location:?event=showModules');
     exit;
 case 'uninstallModule':
     include_once 'functions/uninstallModule.func.php';
     uninstallModule();
     header('Location:?event=showModules');
     exit;
 case 'deleteModule':
     include_once 'functions/deleteModule.func.php';
     deleteModule();
     header('Location:?event=showModules');
     exit;
 case 'showStyles':
     // init database?
     include_once 'functions/initDatabase.func.php';
     if (!initDatabase()) {
         header('Location:?event=showInitDatabase');
     }
     // start StyleHandler
     global $StyleHandler;
     $StyleHandler = new ts_StyleHandler();
     $Styles = $StyleHandler->getStyles();
     $TemplateEngine->setData('html', array('title' => 'SHOWSTYLES__TITLE'));
     $TemplateEngine->activate('showStyles');
     break;