diff options
author | Felipe Figueroa <amenadiel@gmail.com> | 2018-03-15 02:02:10 +0300 |
---|---|---|
committer | Felipe Figueroa <amenadiel@gmail.com> | 2018-03-15 02:02:10 +0300 |
commit | 49270fe791619ba2d0dbf666cfa66ca80457dd44 (patch) | |
tree | 916738a0243836b5cfba76c470b083bd4e344ed1 /src/controllers/FulltextController.php | |
parent | c2a9af3868f88a47497b88b0dbd3ac4994e01670 (diff) |
add package tag to controllers
Diffstat (limited to 'src/controllers/FulltextController.php')
-rw-r--r-- | src/controllers/FulltextController.php | 177 |
1 files changed, 89 insertions, 88 deletions
diff --git a/src/controllers/FulltextController.php b/src/controllers/FulltextController.php index 205be7f7..911b6fd4 100644 --- a/src/controllers/FulltextController.php +++ b/src/controllers/FulltextController.php @@ -10,6 +10,7 @@ use PHPPgAdmin\Decorators\Decorator; /** * Base controller class. + * * @package PHPPgAdmin */ class FulltextController extends BaseController @@ -152,28 +153,28 @@ class FulltextController extends BaseController 'configuration' => [ 'title' => $lang['strftsconfig'], 'field' => Decorator::field('name'), - 'url' => "fulltext.php?action=viewconfig&{$this->misc->href}&", - 'vars' => ['ftscfg' => 'name'], + 'url' => "fulltext.php?action=viewconfig&{$this->misc->href}&", + 'vars' => ['ftscfg' => 'name'], ], - 'schema' => [ + 'schema' => [ 'title' => $lang['strschema'], 'field' => Decorator::field('schema'), ], - 'actions' => [ + 'actions' => [ 'title' => $lang['stractions'], ], - 'comment' => [ + 'comment' => [ 'title' => $lang['strcomment'], 'field' => Decorator::field('comment'), ], ]; $actions = [ - 'drop' => [ + 'drop' => [ 'content' => $lang['strdrop'], - 'attr' => [ + 'attr' => [ 'href' => [ - 'url' => 'fulltext.php', + 'url' => 'fulltext.php', 'urlvars' => [ 'action' => 'dropconfig', 'ftscfg' => Decorator::field('name'), @@ -183,9 +184,9 @@ class FulltextController extends BaseController ], 'alter' => [ 'content' => $lang['stralter'], - 'attr' => [ + 'attr' => [ 'href' => [ - 'url' => 'fulltext.php', + 'url' => 'fulltext.php', 'urlvars' => [ 'action' => 'alterconfig', 'ftscfg' => Decorator::field('name'), @@ -199,14 +200,14 @@ class FulltextController extends BaseController $navlinks = [ 'createconf' => [ - 'attr' => [ + 'attr' => [ 'href' => [ - 'url' => 'fulltext.php', + 'url' => 'fulltext.php', 'urlvars' => [ - 'action' => 'createconfig', - 'server' => $_REQUEST['server'], + 'action' => 'createconfig', + 'server' => $_REQUEST['server'], 'database' => $_REQUEST['database'], - 'schema' => $_REQUEST['schema'], + 'schema' => $_REQUEST['schema'], ], ], ], @@ -224,14 +225,14 @@ class FulltextController extends BaseController { $lang = $this->lang; - $tabs = $this->misc->getNavTabs('fulltext'); + $tabs = $this->misc->getNavTabs('fulltext'); $items = $this->adjustTabsForTree($tabs); $reqvars = $this->misc->getRequestVars('ftscfg'); $attrs = [ - 'text' => Decorator::field('title'), - 'icon' => Decorator::field('icon'), + 'text' => Decorator::field('title'), + 'icon' => Decorator::field('icon'), 'action' => Decorator::actionurl( 'fulltext.php', $reqvars, @@ -242,7 +243,7 @@ class FulltextController extends BaseController $reqvars, [ 'action' => 'subtree', - 'what' => Decorator::field('icon'), // IZ: yeah, it's ugly, but I do not want to change navigation tabs arrays + 'what' => Decorator::field('icon'), // IZ: yeah, it's ugly, but I do not want to change navigation tabs arrays ] ), ]; @@ -257,17 +258,17 @@ class FulltextController extends BaseController switch ($what) { case 'FtsCfg': - $items = $data->getFtsConfigurations(false); + $items = $data->getFtsConfigurations(false); $urlvars = ['action' => 'viewconfig', 'ftscfg' => Decorator::field('name')]; break; case 'FtsDict': - $items = $data->getFtsDictionaries(false); + $items = $data->getFtsDictionaries(false); $urlvars = ['action' => 'viewdicts']; break; case 'FtsParser': - $items = $data->getFtsParsers(false); + $items = $data->getFtsParsers(false); $urlvars = ['action' => 'viewparsers']; break; @@ -278,15 +279,15 @@ class FulltextController extends BaseController $reqvars = $this->misc->getRequestVars('ftscfg'); $attrs = [ - 'text' => Decorator::field('name'), - 'icon' => $what, + 'text' => Decorator::field('name'), + 'icon' => $what, 'toolTip' => Decorator::field('comment'), - 'action' => Decorator::actionurl( + 'action' => Decorator::actionurl( 'fulltext.php', $reqvars, $urlvars ), - 'branch' => Decorator::ifempty( + 'branch' => Decorator::ifempty( Decorator::field('branch'), '', Decorator::url( @@ -314,7 +315,7 @@ class FulltextController extends BaseController echo '<p>', sprintf($lang['strconfdropftsconfig'], $this->misc->printVal($_REQUEST['ftscfg'])), "</p>\n"; - echo '<form action="' . \SUBFOLDER . "/src/views/fulltext.php\" method=\"post\">\n"; + echo '<form action="'.\SUBFOLDER."/src/views/fulltext.php\" method=\"post\">\n"; echo "<p><input type=\"checkbox\" id=\"cascade\" name=\"cascade\" /> <label for=\"cascade\">{$lang['strcascade']}</label></p>\n"; echo "<p><input type=\"hidden\" name=\"action\" value=\"dropconfig\" />\n"; echo '<input type="hidden" name="database" value="', htmlspecialchars($_REQUEST['database']), "\" />\n"; @@ -345,7 +346,7 @@ class FulltextController extends BaseController echo '<p>', sprintf($lang['strconfdropftsdict'], $this->misc->printVal($_REQUEST['ftsdict'])), "</p>\n"; - echo '<form action="' . \SUBFOLDER . "/src/views/fulltext.php\" method=\"post\">\n"; + echo '<form action="'.\SUBFOLDER."/src/views/fulltext.php\" method=\"post\">\n"; echo "<p><input type=\"checkbox\" id=\"cascade\" name=\"cascade\" /> <label for=\"cascade\">{$lang['strcascade']}</label></p>\n"; echo "<p><input type=\"hidden\" name=\"action\" value=\"dropdict\" />\n"; echo '<input type="hidden" name="database" value="', htmlspecialchars($_REQUEST['database']), "\" />\n"; @@ -406,7 +407,7 @@ class FulltextController extends BaseController $this->printTitle($lang['strftscreateconfig'], 'pg.ftscfg.create'); $this->printMsg($msg); - echo '<form action="' . \SUBFOLDER . "/src/views/fulltext.php\" method=\"post\">\n"; + echo '<form action="'.\SUBFOLDER."/src/views/fulltext.php\" method=\"post\">\n"; echo "<table>\n"; // conf name echo "\t<tr>\n\t\t<th class=\"data left required\">{$lang['strname']}</th>\n"; @@ -417,14 +418,14 @@ class FulltextController extends BaseController echo "\t<tr>\n\t\t<th class=\"data left\">{$lang['strftstemplate']}</th>\n"; echo "\t\t<td class=\"data1\">"; - $tpls = []; + $tpls = []; $tplsel = ''; while (!$ftscfgs->EOF) { $data->fieldClean($ftscfgs->fields['schema']); $data->fieldClean($ftscfgs->fields['name']); - $tplname = $ftscfgs->fields['schema'] . '.' . $ftscfgs->fields['name']; + $tplname = $ftscfgs->fields['schema'].'.'.$ftscfgs->fields['name']; $tpls[$tplname] = serialize([ - 'name' => $ftscfgs->fields['name'], + 'name' => $ftscfgs->fields['name'], 'schema' => $ftscfgs->fields['schema'], ]); if ($_POST['formTemplate'] == $tpls[$tplname]) { @@ -439,11 +440,11 @@ class FulltextController extends BaseController echo "\t<tr>\n\t\t<th class=\"data left\">{$lang['strftsparser']}</th>\n"; echo "\t\t<td class=\"data1\">\n"; $ftsparsers_ = []; - $ftsparsel = ''; + $ftsparsel = ''; while (!$ftsparsers->EOF) { $data->fieldClean($ftsparsers->fields['schema']); $data->fieldClean($ftsparsers->fields['name']); - $parsername = $ftsparsers->fields['schema'] . '.' . $ftsparsers->fields['name']; + $parsername = $ftsparsers->fields['schema'].'.'.$ftsparsers->fields['name']; $ftsparsers_[$parsername] = serialize([ 'parser' => $ftsparsers->fields['name'], @@ -551,7 +552,7 @@ class FulltextController extends BaseController // Fetch all FTS parsers from the database $ftsparsers = $data->getFtsParsers(); - echo '<form action="' . \SUBFOLDER . "/src/views/fulltext.php\" method=\"post\">\n"; + echo '<form action="'.\SUBFOLDER."/src/views/fulltext.php\" method=\"post\">\n"; echo "<table>\n"; echo "\t<tr>\n"; @@ -584,8 +585,8 @@ class FulltextController extends BaseController */ public function doSaveAlterConfig() { - $lang = $this->lang; - $data = $this->misc->getDatabaseAccessor(); + $lang = $this->lang; + $data = $this->misc->getDatabaseAccessor(); $status = $data->updateFtsConfiguration($_POST['ftscfg'], $_POST['formComment'], $_POST['formName']); if (0 == $status) { $this->doDefault($lang['strftsconfigaltered']); @@ -612,11 +613,11 @@ class FulltextController extends BaseController $parsers = $data->getFtsParsers(false); $columns = [ - 'schema' => [ + 'schema' => [ 'title' => $lang['strschema'], 'field' => Decorator::field('schema'), ], - 'name' => [ + 'name' => [ 'title' => $lang['strname'], 'field' => Decorator::field('name'), ], @@ -651,11 +652,11 @@ class FulltextController extends BaseController $dicts = $data->getFtsDictionaries(false); $columns = [ - 'schema' => [ + 'schema' => [ 'title' => $lang['strschema'], 'field' => Decorator::field('schema'), ], - 'name' => [ + 'name' => [ 'title' => $lang['strname'], 'field' => Decorator::field('name'), ], @@ -669,13 +670,13 @@ class FulltextController extends BaseController ]; $actions = [ - 'drop' => [ + 'drop' => [ 'content' => $lang['strdrop'], - 'attr' => [ + 'attr' => [ 'href' => [ - 'url' => 'fulltext.php', + 'url' => 'fulltext.php', 'urlvars' => [ - 'action' => 'dropdict', + 'action' => 'dropdict', 'ftsdict' => Decorator::field('name'), ], ], @@ -683,11 +684,11 @@ class FulltextController extends BaseController ], 'alter' => [ 'content' => $lang['stralter'], - 'attr' => [ + 'attr' => [ 'href' => [ - 'url' => 'fulltext.php', + 'url' => 'fulltext.php', 'urlvars' => [ - 'action' => 'alterdict', + 'action' => 'alterdict', 'ftsdict' => Decorator::field('name'), ], ], @@ -699,14 +700,14 @@ class FulltextController extends BaseController $navlinks = [ 'createdict' => [ - 'attr' => [ + 'attr' => [ 'href' => [ - 'url' => 'fulltext.php', + 'url' => 'fulltext.php', 'urlvars' => [ - 'action' => 'createdict', - 'server' => $_REQUEST['server'], + 'action' => 'createdict', + 'server' => $_REQUEST['server'], 'database' => $_REQUEST['database'], - 'schema' => $_REQUEST['schema'], + 'schema' => $_REQUEST['schema'], ], ], ], @@ -738,7 +739,7 @@ class FulltextController extends BaseController $map = $data->getFtsConfigurationMap($ftscfg); $columns = [ - 'name' => [ + 'name' => [ 'title' => $lang['strftsmapping'], 'field' => Decorator::field('name'), ], @@ -746,48 +747,48 @@ class FulltextController extends BaseController 'title' => $lang['strftsdicts'], 'field' => Decorator::field('dictionaries'), ], - 'actions' => [ + 'actions' => [ 'title' => $lang['stractions'], ], - 'comment' => [ + 'comment' => [ 'title' => $lang['strcomment'], 'field' => Decorator::field('description'), ], ]; $actions = [ - 'drop' => [ + 'drop' => [ 'multiaction' => 'dropmapping', - 'content' => $lang['strdrop'], - 'attr' => [ + 'content' => $lang['strdrop'], + 'attr' => [ 'href' => [ - 'url' => 'fulltext.php', + 'url' => 'fulltext.php', 'urlvars' => [ - 'action' => 'dropmapping', + 'action' => 'dropmapping', 'mapping' => Decorator::field('name'), - 'ftscfg' => Decorator::field('cfgname'), + 'ftscfg' => Decorator::field('cfgname'), ], ], ], ], - 'alter' => [ + 'alter' => [ 'content' => $lang['stralter'], - 'attr' => [ + 'attr' => [ 'href' => [ - 'url' => 'fulltext.php', + 'url' => 'fulltext.php', 'urlvars' => [ - 'action' => 'altermapping', + 'action' => 'altermapping', 'mapping' => Decorator::field('name'), - 'ftscfg' => Decorator::field('cfgname'), + 'ftscfg' => Decorator::field('cfgname'), ], ], ], ], 'multiactions' => [ 'keycols' => ['mapping' => 'name'], - 'url' => 'fulltext.php', + 'url' => 'fulltext.php', 'default' => null, - 'vars' => ['ftscfg' => $ftscfg], + 'vars' => ['ftscfg' => $ftscfg], ], ]; @@ -795,15 +796,15 @@ class FulltextController extends BaseController $navlinks = [ 'addmapping' => [ - 'attr' => [ + 'attr' => [ 'href' => [ - 'url' => 'fulltext.php', + 'url' => 'fulltext.php', 'urlvars' => [ - 'action' => 'addmapping', - 'server' => $_REQUEST['server'], + 'action' => 'addmapping', + 'server' => $_REQUEST['server'], 'database' => $_REQUEST['database'], - 'schema' => $_REQUEST['schema'], - 'ftscfg' => $ftscfg, + 'schema' => $_REQUEST['schema'], + 'ftscfg' => $ftscfg, ], ], ], @@ -862,7 +863,7 @@ class FulltextController extends BaseController $this->printTitle($lang['strftscreatedict'], 'pg.ftsdict.create'); $this->printMsg($msg); - echo '<form action="' . \SUBFOLDER . "/src/views/fulltext.php\" method=\"post\">\n"; + echo '<form action="'.\SUBFOLDER."/src/views/fulltext.php\" method=\"post\">\n"; echo "<table>\n"; echo "\t<tr>\n\t\t<th class=\"data left required\">{$lang['strname']}</th>\n"; echo "\t\t<td class=\"data1\"><input name=\"formName\" size=\"32\" maxlength=\"{$data->_maxNameLen}\" value=\"", @@ -873,14 +874,14 @@ class FulltextController extends BaseController // Template echo "\t<tr>\n\t\t<th class=\"data left\">{$lang['strftstemplate']}</th>\n"; echo "\t\t<td class=\"data1\">"; - $tpls = []; + $tpls = []; $tplsel = ''; while (!$ftstpls->EOF) { $data->fieldClean($ftstpls->fields['schema']); $data->fieldClean($ftstpls->fields['name']); - $tplname = $ftstpls->fields['schema'] . '.' . $ftstpls->fields['name']; + $tplname = $ftstpls->fields['schema'].'.'.$ftstpls->fields['name']; $tpls[$tplname] = serialize([ - 'name' => $ftstpls->fields['name'], + 'name' => $ftstpls->fields['name'], 'schema' => $ftstpls->fields['schema'], ]); if ($_POST['formTemplate'] == $tpls[$tplname]) { @@ -1019,7 +1020,7 @@ class FulltextController extends BaseController $_POST['formName'] = $_REQUEST['ftsdict']; } - echo '<form action="' . \SUBFOLDER . "/src/views/fulltext.php\" method=\"post\">\n"; + echo '<form action="'.\SUBFOLDER."/src/views/fulltext.php\" method=\"post\">\n"; echo "<table>\n"; echo "\t<tr>\n"; @@ -1090,7 +1091,7 @@ class FulltextController extends BaseController $this->printTrail('ftscfg'); // TODO: proper breadcrumbs $this->printTitle($lang['strdrop'], 'pg.ftscfg.alter'); - echo '<form action="' . \SUBFOLDER . "/src/views/fulltext.php\" method=\"post\">\n"; + echo '<form action="'.\SUBFOLDER."/src/views/fulltext.php\" method=\"post\">\n"; // Case of multiaction drop if (isset($_REQUEST['ma'])) { @@ -1154,7 +1155,7 @@ class FulltextController extends BaseController $_POST['ftscfg'] = $_REQUEST['ftscfg']; } - echo '<form action="' . \SUBFOLDER . "/src/views/fulltext.php\" method=\"post\">\n"; + echo '<form action="'.\SUBFOLDER."/src/views/fulltext.php\" method=\"post\">\n"; echo "<table>\n"; echo "\t<tr>\n"; @@ -1163,12 +1164,12 @@ class FulltextController extends BaseController // Case of multiaction drop if (isset($_REQUEST['ma'])) { - $ma_mappings = []; + $ma_mappings = []; $ma_mappings_names = []; foreach ($_REQUEST['ma'] as $v) { $a = unserialize(htmlspecialchars_decode($v, ENT_QUOTES)); printf('<input type="hidden" name="formMapping[]" value="%s" />', htmlspecialchars($a['mapping'])); - $ma_mappings[] = $data->getFtsMappingByName($_POST['ftscfg'], $a['mapping']); + $ma_mappings[] = $data->getFtsMappingByName($_POST['ftscfg'], $a['mapping']); $ma_mappings_names[] = $a['mapping']; } echo implode(', ', $ma_mappings_names); @@ -1219,7 +1220,7 @@ class FulltextController extends BaseController $data = $this->misc->getDatabaseAccessor(); $mappingArray = (is_array($_POST['formMapping']) ? $_POST['formMapping'] : [$_POST['formMapping']]); - $status = $data->changeFtsMapping($_POST['ftscfg'], $mappingArray, 'alter', $_POST['formDictionary']); + $status = $data->changeFtsMapping($_POST['ftscfg'], $mappingArray, 'alter', $_POST['formDictionary']); if (0 == $status) { $this->doViewConfig($_POST['ftscfg'], $lang['strftsmappingaltered']); } else { @@ -1257,14 +1258,14 @@ class FulltextController extends BaseController $mappings = $data->getFtsMappings($_POST['ftscfg']); - echo '<form action="' . \SUBFOLDER . "/src/views/fulltext.php\" method=\"post\">\n"; + echo '<form action="'.\SUBFOLDER."/src/views/fulltext.php\" method=\"post\">\n"; echo "<table>\n"; echo "\t<tr>\n"; echo "\t\t<th class=\"data left required\">{$lang['strftsmapping']}</th>\n"; echo "\t\t<td class=\"data1\">"; echo "\t\t\t<select name=\"formMapping\">\n"; while (!$mappings->EOF) { - $mapping = htmlspecialchars($mappings->fields['name']); + $mapping = htmlspecialchars($mappings->fields['name']); $mapping_desc = htmlspecialchars($mappings->fields['description']); echo "\t\t\t\t<option value=\"{$mapping}\"", $mapping == $_POST['formMapping'] ? ' selected="selected"' : '', ">{$mapping}", $mapping_desc ? " - {$mapping_desc}" : '', "</option>\n"; @@ -1310,7 +1311,7 @@ class FulltextController extends BaseController $data = $this->misc->getDatabaseAccessor(); $mappingArray = (is_array($_POST['formMapping']) ? $_POST['formMapping'] : [$_POST['formMapping']]); - $status = $data->changeFtsMapping($_POST['ftscfg'], $mappingArray, 'add', $_POST['formDictionary']); + $status = $data->changeFtsMapping($_POST['ftscfg'], $mappingArray, 'add', $_POST['formDictionary']); if (0 == $status) { $this->doViewConfig($_POST['ftscfg'], $lang['strftsmappingadded']); } else { |