} elseif ($mode == 'update_position') { if (preg_match("/^[a-z_]+\$/", $_REQUEST['table'])) { $table_name = $_REQUEST['table']; } else { die; } $id_name = $_REQUEST['id_name']; $ids = explode(',', $_REQUEST['ids']); $positions = explode(',', $_REQUEST['positions']); foreach ($ids as $k => $id) { db_query("UPDATE ?:{$table_name} SET position = ?i WHERE ?w", $positions[$k], array($id_name => $id)); } fn_set_notification('N', __('notice'), __('positions_updated')); exit; } elseif ($mode == 'view_changes') { Tygh::$app['view']->assign(Snapshot::changes($_REQUEST)); } elseif ($mode == 'create_snapshot') { Snapshot::create(array('theme_rel_backend' => fn_get_theme_path('[relative]', 'A'), 'themes_frontend' => fn_get_theme_path('[themes]', 'C'), 'themes_repo' => fn_get_theme_path('[repo]', 'C'))); return array(CONTROLLER_STATUS_OK, 'tools.view_changes'); } elseif ($mode == 'init_addons') { $init_addons = !empty($_REQUEST['init_addons']) ? $_REQUEST['init_addons'] : ''; if (!($init_addons == 'none' || $init_addons == 'core')) { $init_addons = ''; } Settings::instance()->updateValue('init_addons', $init_addons); fn_clear_cache(); $return_url = !empty($_REQUEST['return_url']) ? $_REQUEST['return_url'] : 'tools.view_changes'; return array(CONTROLLER_STATUS_OK, $return_url); } function fn_qm_parse_url($url) {
} elseif ($mode == 'update_position') { if (preg_match("/^[a-z_]+\$/", $_REQUEST['table'])) { $table_name = $_REQUEST['table']; } else { die; } $id_name = $_REQUEST['id_name']; $ids = explode(',', $_REQUEST['ids']); $positions = explode(',', $_REQUEST['positions']); foreach ($ids as $k => $id) { db_query("UPDATE ?:{$table_name} SET position = ?i WHERE ?w", $positions[$k], array($id_name => $id)); } fn_set_notification('N', __('notice'), __('positions_updated')); exit; } elseif ($mode == 'view_changes') { Registry::get('view')->assign(Snapshot::changes($_REQUEST)); } elseif ($mode == 'create_snapshot') { Snapshot::create(array('theme_rel_backend' => fn_get_theme_path('[relative]', 'A'), 'themes_frontend' => fn_get_theme_path('[themes]', 'C'), 'themes_repo' => fn_get_theme_path('[repo]', 'C'))); return array(CONTROLLER_STATUS_OK, 'tools.view_changes'); } elseif ($mode == 'init_addons') { $init_addons = !empty($_REQUEST['init_addons']) ? $_REQUEST['init_addons'] : ''; if (!($init_addons == 'none' || $init_addons == 'core')) { $init_addons = ''; } Settings::instance()->updateValue('init_addons', $init_addons); fn_clear_cache(); $return_url = !empty($_REQUEST['return_url']) ? $_REQUEST['return_url'] : 'tools.view_changes'; return array(CONTROLLER_STATUS_OK, $return_url); } function fn_qm_parse_url($url) {