.
*
* Version 0.1
* Author: Octavio Benedi Sanchez
*/
// Predefined variables:
// $section contains the section folder name.
// echo "section=".$section."
";
// $plugin contains the plugin folder name.
// echo "plugin=".$plugin."
";
// $section and $plugin can be used to make a link to this plugin by just reference
// echo "This plugin"."
";
// $base_plugin contains the path that must be used as start to includes for
// plugin includes that need the local path.
// example: include_once $base_plugin.'php/my_include.php';
// echo "base_plugin=".$base_plugin."
";
// $url_plugin contains the url base that must be used to include html items
// such as images.
// example:
// echo "url_plugin=".$url_plugin."
";
// $API_core contains the path to the core API folder.
// example: include_once $API_core.'is_active.php';
// echo "API_core=".$API_core."
";
// Plugin server produced data will returned to the ajax call that made the
// request.
include_once $API_core.'complex_ajax_return_functions.php';
include_once $API_core.'list_operators.php';
include_once $API_core.'parser_wvdial.php';
include_once $API_core.'json_api.php';
include_once $API_core.'save_gprs.php';
include_once $base_plugin.'php/refresh_gprs.php';
include_once $base_plugin.'php/display_gprs_info.php';
include_once $API_core.'form_fields_check.php';
$operators_file_path=$base_plugin.'data/operators.txt';
$data=jsondecode($_POST['form_fields']);
if ($_POST['action']=='country')
{
$str=print_r($data,true);
//str_replace("\\n", "", $str);
//response_additem("return", '
'.$str.''); //response_additem("script", 'alert("'.$data['country_list'].'")'); refresh_gprs($data['country_list'],''); } elseif ($_POST['action']=='operator') { $str=print_r($data,true); //response_additem("return", '
'.$str.''); refresh_gprs($data['country_list'],$data['country_operators']); } elseif (($_POST['action']=='save')||($_POST['action']=='save_restart')) { $fields_check_types = Array ( 'phone' => Array ('ms_mandatory'), 'init1' => Array ('ms_mandatory'), 'PIN' => Array ('ms_numerical') ); if(are_form_fields_valid ($data, $fields_check_types)) { save_gprs($data); exec('sudo cp '.$base_plugin.'data/wvdial.conf /etc/wvdial.conf'); //response_additem("return", '
'.print_r($data,true).''); if ($_POST['action']=='save_restart') { exec('sudo /etc/init.d/wvdial.sh &'); } response_additem("script", 'alert("Data saved.")'); } } // Return the response to javascript response_return(); ?>