Example #1
0
<?php

/// Copyright (c) 2004-2016, Needlworks  / Tatter Network Foundation
/// All rights reserved. Licensed under the GPL.
/// See the GNU General Public License for more details. (/documents/LICENSE, /documents/COPYRIGHT)
$IV = array('POST' => array('name' => array('directory', 'default' => null)));
require ROOT . '/library/preprocessor.php';
importlib('model.common.plugin');
requireStrictRoute();
if (empty($_POST['name'])) {
    Respond::ResultPage(1);
}
$pluginInfo = getPluginInformation(trim($_POST['name']));
$pluginScope = $pluginInfo['scope'];
if (in_array('editor', $pluginScope) && $editorCount == 1) {
    Respond::ResultPage(2);
}
if (in_array('formatter', $pluginScope) && $formatterCount == 1) {
    Respond::ResultPage(2);
}
if (deactivatePlugin($_POST['name'])) {
    Respond::ResultPage(0);
}
Respond::ResultPage(1);
Example #2
0
                                         }
                                     }
                                 }
                                 $editorMappings[$editorid] = $editorinfo;
                             }
                             unset($editor);
                             unset($editorid);
                             unset($editorinfo);
                             unset($usedFor);
                         }
                     }
                 } else {
                     $disablePlugin = true;
                 }
                 if ($disablePlugin == true) {
                     deactivatePlugin($plugin);
                 }
             }
             unset($xmls);
             unset($currentTextcubeVersion, $disablePlugin, $plugin, $query, $requiredTattertoolsVersion, $requiredTextcubeVersion);
         }
     }
     foreach ($storageList as $s) {
         $p[$s] = ${$s};
     }
     $pageCache->contents = serialize($p);
     $pageCache->update();
 }
 if (!array_key_exists('ttml', $formatterMappings)) {
     // Any formatter is used, add the ttml formatter.
     activatePlugin('FM_TTML');
Example #3
0
            exit;
        }
        if (in_array($dbname, $definedTables)) {
            Respond::ResultPage(1);
            exit;
        }
        array_push($plugintables, $dbname);
        $query = "delete from {$database['prefix']}ServiceSettings WHERE name = '{$origname}' AND value = '" . POD::escapeString($_REQUEST['name']) . "'";
        POD::execute($query);
    }
    $result = true;
    foreach ($plugintables as $dbname) {
        $query = "DROP TABLE {$dbname}";
        $result = POD::execute($query) && $result;
    }
    deactivatePlugin($pluginname);
    if ($result == false) {
        Respond::ResultPage(1);
        exit;
    }
} else {
    // type 2, table
    $dbname = $_REQUEST['name'];
    if (strncmp($dbname, $database['prefix'], strlen($database['prefix'])) != 0) {
        Respond::ResultPage(1);
        exit;
    }
    if (in_array($dbname, $definedTables)) {
        Respond::ResultPage(1);
        exit;
    }
function admin_dispatchAction($action)
{
    if ($action == 'general') {
        showInterface('admin/general.php');
    } elseif ($action == 'adminSave') {
        admin_saveSettings('admin/general.php');
    } elseif ($action == 'vendor') {
        showInterface('admin/vendor.php');
    } elseif ($action == 'vendorSave') {
        admin_saveSettings('admin/vendor.php');
    } elseif ($action == 'phpinfo') {
        disableInDemoMode('', 'admin/general.php');
        phpinfo();
        print "<h2>get_loaded_extensions()</h2>\n" . implode("<br/>\n", get_loaded_extensions()) . "\n";
        if (function_exists('apache_get_modules')) {
            print "<h2>apache_get_modules()</h2>\n" . implode("<br/>\n", apache_get_modules()) . "\n";
        }
        print "<h2>get_defined_constants()</h2>\n<xmp>" . print_r(get_defined_constants(), true) . "</xmp>\n";
        //
        $mbInfo = mb_get_info();
        ksort($mbInfo);
        print "<h2>mb_get_info()</h2>\n<xmp>" . print_r($mbInfo, true) . "</xmp>\n";
        exit;
    } elseif ($action == 'ulimit') {
        disableInDemoMode('', 'admin/general.php');
        print "<h2>Soft Resource Limits (ulimit -a -S)</h2>\n";
        list($maxCpuSeconds, $memoryLimitKbytes, $maxProcessLimit, $ulimitOutput) = getUlimitValues('soft');
        showme($ulimitOutput);
        print "<h2>Hard Resource Limits (ulimit -a -H)</h2>\n";
        list($maxCpuSeconds, $memoryLimitKbytes, $maxProcessLimit, $ulimitOutput) = getUlimitValues('soft');
        showme($ulimitOutput);
        exit;
    } elseif ($action == 'updateDate') {
        getAjaxDate();
    } elseif ($action == 'getUploadPathPreview') {
        getUploadPathPreview(@$_REQUEST['dirOrUrl'], @$_REQUEST['inputValue'], @$_REQUEST['isCustomField'], true);
    } elseif ($action == 'plugins') {
        // allow disabling plugins
        if (file_exists("{$GLOBALS['PROGRAM_DIR']}/plugins/_disable_all_plugins.txt")) {
            alert('Development Mode: Plugins are disabled.  Remove or rename /plugins/_disable_all_plugins.txt to enable.<br/>');
        } else {
        }
        showInterface('admin/plugins.php');
    } elseif ($action == 'pluginHooks') {
        showInterface('admin/pluginHooks.php');
    } elseif ($action == 'deactivatePlugin') {
        security_dieUnlessPostForm();
        security_dieUnlessInternalReferer();
        security_dieOnInvalidCsrfToken();
        disableInDemoMode('plugins', 'admin/plugins.php');
        deactivatePlugin(@$_REQUEST['file']);
        redirectBrowserToURL('?menu=admin&action=plugins', true);
        exit;
    } elseif ($action == 'activatePlugin') {
        security_dieUnlessPostForm();
        security_dieUnlessInternalReferer();
        security_dieOnInvalidCsrfToken();
        disableInDemoMode('plugins', 'admin/plugins.php');
        activatePlugin(@$_REQUEST['file']);
        redirectBrowserToURL('?menu=admin&action=plugins', true);
        exit;
    } elseif ($action == 'backup') {
        security_dieUnlessPostForm();
        security_dieUnlessInternalReferer();
        security_dieOnInvalidCsrfToken();
        disableInDemoMode('', 'admin/general.php');
        $filename = backupDatabase(null, @$_REQUEST['backupTable']);
        notice(sprintf(t('Created backup file %1$s (%2$s seconds)'), $filename, showExecuteSeconds(true)));
        showInterface('admin/general.php');
        exit;
    } elseif ($action == 'restore') {
        security_dieUnlessPostForm();
        security_dieUnlessInternalReferer();
        security_dieOnInvalidCsrfToken();
        disableInDemoMode('', 'admin/general.php');
        $filename = @$_REQUEST['file'];
        restoreDatabase(DATA_DIR . '/backups/' . $filename);
        notice("Restored backup file /data/backups/{$filename}");
        makeAllUploadRecordsRelative();
        showInterface('admin/general.php');
        exit;
    } elseif ($action == 'bgtasksLogsClear') {
        security_dieUnlessPostForm();
        security_dieUnlessInternalReferer();
        security_dieOnInvalidCsrfToken();
        disableInDemoMode('', 'admin/general.php');
        mysql_delete('_cron_log', null, 'true');
        notice(t("Background Task logs have been cleared."));
        showInterface('admin/general.php');
        exit;
    } else {
        showInterface('admin/general.php');
    }
}