示例#1
0
 $source = fn_get_cache_path(false) . 'tmp/theme_pack/';
 $destination = Registry::get('config.dir.themes_repository');
 if ($action == 'ftp_upload') {
     $ftp_access = array('hostname' => $_REQUEST['ftp_access']['ftp_hostname'], 'username' => $_REQUEST['ftp_access']['ftp_username'], 'password' => $_REQUEST['ftp_access']['ftp_password'], 'directory' => $_REQUEST['ftp_access']['ftp_directory']);
     $ftp_copy_result = fn_copy_by_ftp($source, $destination, $ftp_access);
     if ($ftp_copy_result !== true) {
         fn_set_notification('E', __('error'), $ftp_copy_result);
     }
     if (defined('AJAX_REQUEST')) {
         Tygh::$app['ajax']->assign('force_redirection', fn_url('themes.manage'));
         exit;
     } else {
         return array(CONTROLLER_STATUS_OK, 'themes.manage');
     }
 }
 $non_writable_folders = fn_check_copy_ability($source, $destination);
 if (!empty($non_writable_folders)) {
     if (!empty($_REQUEST['ftp_access'])) {
         Tygh::$app['view']->assign('ftp_access', $_REQUEST['ftp_access']);
     }
     Tygh::$app['view']->assign('non_writable', $non_writable_folders);
     if (defined('AJAX_REQUEST')) {
         Tygh::$app['view']->display('views/themes/components/correct_permissions.tpl');
         exit;
     }
 } else {
     fn_copy($source, $destination);
     fn_rm($source);
     if (defined('AJAX_REQUEST')) {
         Tygh::$app['ajax']->assign('force_redirection', fn_url('themes.manage'));
         exit;
示例#2
0
                 if (!empty($matches[1])) {
                     $addon_name = $matches[1];
                 }
             }
         }
         if (empty($addon_name)) {
             fn_set_notification('E', __('error'), __('broken_addon_pack'));
             if (defined('AJAX_REQUEST')) {
                 Tygh::$app['ajax']->assign('non_ajax_notifications', true);
                 Tygh::$app['ajax']->assign('force_redirection', fn_url('addons.manage'));
                 exit;
             } else {
                 return array(CONTROLLER_STATUS_REDIRECT, 'addons.manage');
             }
         }
         $non_writable_folders = fn_check_copy_ability($extract_path, Registry::get('config.dir.root'));
         if (!empty($non_writable_folders)) {
             Tygh::$app['view']->assign('non_writable', $non_writable_folders);
             if (defined('AJAX_REQUEST')) {
                 Tygh::$app['view']->display('views/addons/components/correct_permissions.tpl');
                 exit;
             }
         } else {
             fn_addons_move_and_install($extract_path, Registry::get('config.dir.root'));
             if (defined('AJAX_REQUEST')) {
                 Tygh::$app['ajax']->assign('force_redirection', fn_url('addons.manage'));
                 exit;
             }
         }
     }
 }