function appman_post(&$a) { if (!local_user()) { return; } if ($_POST['url']) { $arr = array('uid' => intval($_REQUEST['uid']), 'url' => escape_tags($_REQUEST['url']), 'guid' => escape_tags($_REQUEST['guid']), 'author' => escape_tags($_REQUEST['author']), 'addr' => escape_tags($_REQUEST['addr']), 'name' => escape_tags($_REQUEST['name']), 'desc' => escape_tags($_REQUEST['desc']), 'photo' => escape_tags($_REQUEST['photo']), 'version' => escape_tags($_REQUEST['version']), 'price' => escape_tags($_REQUEST['price']), 'sig' => escape_tags($_REQUEST['sig'])); $_REQUEST['appid'] = app_install(local_user(), $arr); if (app_installed(local_user(), $arr)) { info(t('App installed.') . EOL); } return; } $papp = app_decode($_POST['papp']); if (!is_array($papp)) { notice(t('Malformed app.') . EOL); return; } if ($_POST['install']) { app_install(local_user(), $papp); if (app_installed(local_user(), $papp)) { info(t('App installed.') . EOL); } } if ($_POST['delete']) { app_destroy(local_user(), $papp); } if ($_POST['edit']) { return; } if ($_SESSION['return_url']) { goaway(z_root() . '/' . $_SESSION['return_url']); } goaway(z_root() . '/apps/personal'); }
function import_system_apps() { if (!local_channel()) { return; } // Eventually we want to look at modification dates and update system apps. $installed = get_pconfig(local_channel(), 'system', 'apps_installed'); if ($installed) { return; } $apps = get_system_apps(false); if ($apps) { foreach ($apps as $app) { $app['uid'] = local_channel(); $app['guid'] = hash('whirlpool', $app['name']); $app['system'] = 1; app_install(local_channel(), $app); } } set_pconfig(local_channel(), 'system', 'apps_installed', 1); }
echo '</td> </tr> <tr> <td>Tabela <i>tablicacms_plugins</i></td> <td>'; if (mysql_query("CREATE TABLE IF NOT EXISTS `tablicacms_apps` (`id` int(11) NOT NULL AUTO_INCREMENT,`dir` varchar(32) COLLATE utf8_polish_ci NOT NULL,PRIMARY KEY (`id`),KEY `id` (`id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_polish_ci AUTO_INCREMENT=1")) { echo 'OK'; } else { exit('Błąd'); } echo '</td> </tr> </table> <h1>Instalowanie aplikacji...</h1>'; foreach ($apps as $app) { app_install($app); } echo ' <table> <tr> <td>Tworzenie <i>config.php</i></td> <td>'; $config_content = ' <?php //Plik konfiguarcyjny wygenerowany przez instalator (' . date("Y-m-d H:i:s") . ') $host = "' . $_SESSION['install']['hostaddress'] . '"; $user = "******"; $pass = "******"; $db = "' . $_SESSION['install']['db_name'] . '"; ?>'; if (file_put_contents('config.php', trim($config_content, ' \\t'))) {