public function save_file_content($file_name, $content) { global $my_app; $explorerAPI = new phpos_explorerAPI(); $explorerAPI->set_window_id($my_app->get_param('win_id')); $app_data = $explorerAPI->get_cached_app_data(); $shortcut = new phpos_shortcuts(); $app_params['content'] = 1; if (false !== ($record_id = $shortcut->add($file_name, 'app', $app_data['app_id'], $app_data['app_action'], null, $app_params, 'db', $my_app->get_param('dir_id'), $content))) { $file['id'] = $record_id; return $this->get_file_info($file); } }
} $_SESSION['phpos_files_handler'][$my_app->get_param('win_id')] = array(); $_SESSION['phpos_files_handler'][$my_app->get_param('win_id')]['file_data'] = $api_file_content; $_SESSION['phpos_files_handler'][$my_app->get_param('win_id')]['file_info'] = $file_info; $monit_success = "\n\t\t\t\tjSuccess(\n\t\t\t\t\t'" . txt('file_saved') . "',\n\t\t\t\t\t{\n\t\t\t\t\t\tautoHide : true, \n\t\t\t\t\t\tclickOverlay : false,\n\t\t\t\t\t\tMinWidth : 200,\n\t\t\t\t\t\tTimeShown : 5000,\n\t\t\t\t\t\tShowTimeEffect : 1000,\n\t\t\t\t\t\tHideTimeEffect : 600,\n\t\t\t\t\t\tLongTrip :20,\n\t\t\t\t\t\tHorizontalPosition : 'right',\n\t\t\t\t\t\tVerticalPosition : 'bottom',\n\t\t\t\t\t\tShowOverlay : false\n\t\t\t\t\t}\n\t\t\t\t);"; echo "<script>" . $monit_success . " phpos.windowRefresh('" . $my_app->get_param('win_id') . "',''); " . winclose(WIN_ID) . "</script>"; } } } } /*.............................................. */ if ($my_app->get_param('api_action') == 'save_as') { if (globalconfig('demo_mode') != 1 || is_root()) { if ($my_app->get_param('api_dialog') !== null && $my_app->get_param('api_dialog_type') == 'save_as_file' && $my_app->get_param('explorer_save_as_filename') !== null) { $data = $explorerAPI->get_cached_data_to_save(); $app_data = $explorerAPI->get_cached_app_data(); $monit_success = "\n\t\t\t\t\tjSuccess(\n\t\t\t\t\t\t'" . txt('file_saved') . "',\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tautoHide : true, \n\t\t\t\t\t\t\tclickOverlay : false,\n\t\t\t\t\t\t\tMinWidth : 200,\n\t\t\t\t\t\t\tTimeShown : 5000,\n\t\t\t\t\t\t\tShowTimeEffect : 1000,\n\t\t\t\t\t\t\tHideTimeEffect : 600,\n\t\t\t\t\t\t\tLongTrip :20,\n\t\t\t\t\t\t\tHorizontalPosition : 'right',\n\t\t\t\t\t\t\tVerticalPosition : 'bottom',\n\t\t\t\t\t\t\tShowOverlay : false\n\t\t\t\t\t\t}\n\t\t\t\t\t);"; /*.............................................. */ if (is_array($app_data)) { if ($data == null) { $data = ' '; } $explorer_save_as_filename = $my_app->get_param('explorer_save_as_filename') . '.' . $my_app->get_param('api_file_ext'); if (false !== ($saved_file_info = $phposFS->save_file_content($explorer_save_as_filename, $data))) { $saved_file_info['fs'] = $my_app->get_param('fs'); $explorerAPI->clear_savedata(); $explorerAPI->set_saved_file_info($saved_file_info); $my_app->set_param('api_action', null); cache_param('api_action'); echo "<script>" . $monit_success . " phpos.windowRefresh('" . $my_app->get_param('win_id') . "',''); " . winclose(WIN_ID) . "</script>"; }