<?php /* * This file is part of the DroidPHP Web Interface. * * (c) Shushant Kumar <*****@*****.**> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ $app->get('/preference/update', function () use($app) { $request = $app['request']; $pref = new \DroidPHP\Preference($app['shared_prefs']); // string $pref->setValue('use_server_httpd', $request->get('daemon')); $pref->setValue('server_port', $request->get('port')); $pref->setValue('mysql_username', $request->get('mysql_username')); $pref->setValue('mysql_password', $request->get('mysql_password')); // boolean $pref->setValue('run_as_root', $request->get('run_as_root'), 0x1); $pref->setValue('enable_server_on_app_startup', $request->get('enable_app_startup'), 0x1); $pref->setValue('enable_server_on_boot', $request->get('enable_system_startup'), 0x1); $pref->setValue('enable_screen_on', $request->get('enable_wifiLock'), 0x1); $pref->setValue('enable_lock_wifi', $request->get('enable_screenLock'), 0x1); $rc = $pref->commit(); return json_encode(['message' => $rc ? 'Setting successfully updated' : 'Something Went Wrong']); });
<?php /* * This file is part of the DroidPHP Web Interface. * * (c) Shushant Kumar <*****@*****.**> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ $app->get('/', function () use($app) { $extensions = get_loaded_extensions(); return $app['twig']->render('index.twig', array('baseurl' => $app['baseurl'], 'extensions' => $extensions)); }); $app->get('/settings', function () use($app) { $pref = new \DroidPHP\Preference($app['shared_prefs']); $values = ['use_server_httpd' => $pref->getValue('use_server_httpd'), 'server_port' => $pref->getValue('server_port'), 'mysql_username' => $pref->getValue('mysql_username'), 'mysql_password' => $pref->getValue('mysql_password'), 'run_as_root' => $pref->getValue('run_as_root', 0x1), 'enable_server_on_app_startup' => $pref->getValue('enable_server_on_app_startup', 0x1) == 'true' ? 'checked="true"' : '', 'enable_server_on_boot' => $pref->getValue('enable_server_on_boot', 0x1) == 'true' ? 'checked="true"' : '', 'enable_screen_on' => $pref->getValue('enable_screen_on', 0x1) == 'true' ? 'checked="true"' : '', 'enable_lock_wifi' => $pref->getValue('enable_lock_wifi', 0x1) == 'true' ? 'checked="true"' : '']; return $app['twig']->render('settings.twig', array('baseurl' => $app['baseurl'], 'pref' => $values)); }); $app->get('/php_info', function () use($app) { phpinfo(); return ''; });