Exemple #1
0
/**
 * @package		Plupload
 * @category	modules
 * @author		Moxiecode Systems AB
 * @author		Nazar Mokrynskyi <*****@*****.**> (integration with CleverStyle CMS)
 * @copyright	Moxiecode Systems AB
 * @license		GNU GPL v2, see license.txt
 */
namespace cs\modules\Plupload;

use cs\Config, cs\DB, cs\Storage, cs\Trigger;
Trigger::instance()->register('admin/System/components/modules/uninstall/process', function ($data) {
    if ($data['name'] != 'Plupload') {
        return;
    }
    $module_data = Config::instance()->module('Plupload');
    $storage = Storage::instance()->{$module_data->storage('files')};
    $cdb = DB::instance()->{$module_data->db('files')};
    unset($module_data);
    if (!$storage || !$cdb) {
        return;
    }
    $files = $cdb->q("SELECT `source`\n\t\t\tFROM `[prefix]plupload_files`");
    while ($f = $cdb->fs($files)) {
        $storage->unlink($f);
    }
    if ($storage->is_dir('Plupload')) {
        $storage->rmdir('Plupload');
    }
});
Exemple #2
0
            }
            unset($module, $mdata, $storage_name);
            if (!empty($modules)) {
                $Page->warning($L->storage_used_by_modules . ': ' . implode(', ', $modules));
            } else {
                $a->action = "admin/System/{$rc['0']}/{$rc['1']}";
                $Page->title($L->deletion_of_storage($Config->storage[$rc[3]]['host'] . '/' . $Config->storage[$rc[3]]['connection']));
                $a->content(h::{'p.lead.cs-center'}($L->sure_to_delete . ' ' . $L->storage . ' ' . $Config->storage[$rc[3]]['host'] . '/' . $Config->storage[$rc[3]]['connection'] . '?' . h::{'input[type=hidden]'}(['name' => 'mode', 'value' => 'delete']) . h::{'input[type=hidden]'}(['name' => 'storage', 'value' => $rc[3]])) . h::{'button[type=submit]'}($L->yes));
            }
            break;
        case 'test':
            interface_off();
            $test_dialog = false;
            $a->form = false;
            $a->generate_auto = false;
            $Storage = Storage::instance();
            if (isset($rc[3])) {
                $Page->Content = h::{'p.cs-test-result'}($Storage->test([$rc[3]]) ? $L->success : $L->failed);
            } else {
                $Page->Content = h::{'p.cs-test-result'}($Storage->test($_POST['storage']) ? $L->success : $L->failed);
            }
            break;
    }
} else {
    $storage_list = [];
    $Core = Core::instance();
    $storages = $Config->storage;
    if (!empty($storages)) {
        foreach ($storages as $i => &$storage_data) {
            $storage_list[] = [[$i ? h::{'a.cs-button-compact'}(h::icon('pencil'), ['href' => "{$a->action}/edit/{$i}", 'data-title' => "{$L->edit} {$L->storage}"]) . h::{'a.cs-button-compact'}(h::icon('trash-o'), ['href' => "{$a->action}/delete/{$i}", 'data-title' => "{$L->delete} {$L->storage}"]) . h::{'a.cs-button-compact'}(h::icon('signal'), ['onMouseDown' => "cs.storage_test('{$a->action}/test/{$i}', true);", 'data-title' => $L->test_connection]) : '-', ['class' => $i ? '' : 'text-primary']], [[$i ? $storage_data['url'] : $Core->storage_url ?: url_by_source(STORAGE), $i ? $storage_data['host'] : $Core->storage_host, $i ? $storage_data['connection'] : $Core->storage_type, $i ? $storage_data['user'] : $Core->storage_user ?: '-'], ['class' => $i ? '' : 'text-primary']]];
        }