예제 #1
0
    }
    $current_path = empty($dir) ? '' : $dir . '/';
    $current_path = fn_normalize_path($current_path);
    $items = fn_te_read_dir($tpath, $root_dir);
    Tygh::$app['view']->assign('current_path', str_replace($root_dir, '', $tpath));
    Tygh::$app['view']->assign('items', $items);
    Tygh::$app['ajax']->assign('current_path', str_replace($root_dir, '', $tpath));
    Tygh::$app['ajax']->assign('files_list', Tygh::$app['view']->fetch('views/templates/components/file_list.tpl'));
    exit;
} elseif ($mode == 'delete_file') {
    $fname = fn_te_normalize_path($_REQUEST, $root_dir);
    $fn_name = @is_dir($fname) ? 'fn_rm' : 'unlink';
    $object = @is_dir($fname) ? 'directory' : 'file';
    if ($object == 'directory' && empty($_REQUEST['file_path'])) {
        // Delete theme
        fn_delete_theme(fn_basename($_REQUEST['file']));
    } elseif (!in_array(fn_strtolower(fn_get_file_ext($fname)), Registry::get('config.forbidden_file_extensions'))) {
        if (fn_te_check_path($fname) && @$fn_name($fname)) {
            fn_set_notification('N', __('notice'), __("text_{$object}_deleted", array("[{$object}]" => fn_basename($fname))));
        } else {
            fn_set_notification('E', __('error'), __("text_cannot_delete_{$object}", array("[{$object}]" => fn_basename($fname))));
        }
    } else {
        fn_set_notification('E', __('error'), __('you_have_no_permissions'));
    }
    return array(CONTROLLER_STATUS_REDIRECT, 'templates.init_view?dir=' . $_REQUEST['file_path']);
} elseif ($mode == 'rename_file') {
    $pname = fn_te_normalize_path($_REQUEST, $root_dir);
    $pname_to = dirname($pname) . '/' . fn_basename($_REQUEST['rename_to']);
    $object = @is_dir($pname) ? 'directory' : 'file';
    $ext_from = fn_get_file_ext($pname);
예제 #2
0
파일: themes.php 프로젝트: askzap/ultimate
         fn_rm($source);
         if (defined('AJAX_REQUEST')) {
             Tygh::$app['ajax']->assign('force_redirection', fn_url('themes.manage'));
             exit;
         }
     }
 }
 if ($mode == 'install') {
     if (!empty($_REQUEST['theme_name'])) {
         // Copy theme files to design/themes directory
         fn_install_theme_files($_REQUEST['theme_name'], $_REQUEST['theme_name']);
     }
     return array(CONTROLLER_STATUS_OK, 'themes.manage?selected_section=general');
 }
 if ($mode == 'delete') {
     fn_delete_theme($_REQUEST['theme_name']);
 }
 if ($mode == 'set') {
     $is_exist = Layout::instance()->getList(array('theme_name' => $_REQUEST['theme_name']));
     $company_id = Registry::get('runtime.company_id');
     if (empty($is_exist)) {
         // Create new layout
         fn_install_theme($_REQUEST['theme_name'], $company_id);
     } else {
         Settings::instance()->updateValue('theme_name', $_REQUEST['theme_name'], '', true, $company_id);
     }
     $layout = Layout::instance($company_id)->getDefault($_REQUEST['theme_name']);
     if (!empty($_REQUEST['style'])) {
         $theme = Themes::factory(fn_get_theme_path('[theme]', 'C'));
         $theme_manifest = $theme->getManifest();
         if (empty($theme_manifest['converted_to_css'])) {
예제 #3
0
    }
    $current_path = empty($dir) ? '' : $dir . '/';
    $current_path = fn_normalize_path($current_path);
    $items = fn_te_read_dir($tpath, $root_dir);
    Tygh::$app['view']->assign('current_path', str_replace($root_dir, '', $tpath));
    Tygh::$app['view']->assign('items', $items);
    Tygh::$app['ajax']->assign('current_path', str_replace($root_dir, '', $tpath));
    Tygh::$app['ajax']->assign('files_list', Tygh::$app['view']->fetch('views/templates/components/file_list.tpl'));
    exit;
} elseif ($mode == 'delete_file') {
    $fname = fn_te_normalize_path($_REQUEST, $root_dir);
    $fn_name = @is_dir($fname) ? 'fn_rm' : 'unlink';
    $object = @is_dir($fname) ? 'directory' : 'file';
    if ($object == 'directory' && empty($_REQUEST['file_path'])) {
        // Delete theme
        fn_delete_theme($_REQUEST['file']);
    } elseif (!in_array(fn_strtolower(fn_get_file_ext($fname)), Registry::get('config.forbidden_file_extensions'))) {
        if (fn_te_check_path($fname) && @$fn_name($fname)) {
            fn_set_notification('N', __('notice'), __("text_{$object}_deleted", array("[{$object}]" => fn_basename($fname))));
        } else {
            fn_set_notification('E', __('error'), __("text_cannot_delete_{$object}", array("[{$object}]" => fn_basename($fname))));
        }
    } else {
        fn_set_notification('E', __('error'), __('you_have_no_permissions'));
    }
    return array(CONTROLLER_STATUS_REDIRECT, 'templates.init_view?dir=' . $_REQUEST['file_path']);
} elseif ($mode == 'rename_file') {
    $pname = fn_te_normalize_path($_REQUEST, $root_dir);
    $pname_to = dirname($pname) . '/' . fn_basename($_REQUEST['rename_to']);
    $object = @is_dir($pname) ? 'directory' : 'file';
    $ext_from = fn_get_file_ext($pname);