diff options
author | Felipe Figueroa <amenadiel@gmail.com> | 2018-02-15 22:10:28 +0300 |
---|---|---|
committer | Felipe Figueroa <amenadiel@gmail.com> | 2018-02-15 22:10:28 +0300 |
commit | 8c47e1b02e634855c2327c07a2770bd910072d70 (patch) | |
tree | 27f86a53d1a843aead5dd767ad2a9c9bf001d26d /src | |
parent | d255f96bc2307c5b543b316ff07507267ca1b30e (diff) |
csfixer to other folders
Diffstat (limited to 'src')
119 files changed, 3130 insertions, 2993 deletions
diff --git a/src/classes/ADOdbException.php b/src/classes/ADOdbException.php index a124d4ca..bbb8c701 100644 --- a/src/classes/ADOdbException.php +++ b/src/classes/ADOdbException.php @@ -1,20 +1,26 @@ <?php - +/* + * PHPPgAdmin v6.0.0-beta.30 + */ namespace PHPPgAdmin; /** - * @version v5.20.9 21-Dec-2016 - * @copyright (c) 2000-2013 John Lim (jlim#natsoft.com). All rights reserved. - * @copyright (c) 2014 Damien Regad, Mark Newnham and the ADOdb community - * Released under both BSD license and Lesser GPL library license. - * Whenever there is any discrepancy between the two licenses, - * the BSD license will take precedence. + * Released under both BSD license and Lesser GPL library license. Whenever + * there is any discrepancy between the two licenses, the BSD license will take + * precedence. * * Set tabs to 4 for best viewing. * * Latest version is available at http://php.weblogs.com * * Exception-handling code using PHP5 exceptions (try-catch-throw). + * + * @copyright 2000-2013 John Lim (jlim#natsoft.com). All rights reserved. + * @copyright 2014 Damien Regad, Mark Newnham and the ADOdb community + * @version v5.20.9 + * @author John Lim + * @license MIT + * @package PHPPgAdmin */ class ADOdbException extends \Exception { diff --git a/src/classes/ArrayRecordSet.php b/src/classes/ArrayRecordSet.php index f89686b9..d916a513 100644 --- a/src/classes/ArrayRecordSet.php +++ b/src/classes/ArrayRecordSet.php @@ -1,5 +1,7 @@ <?php - +/* + * PHPPgAdmin v6.0.0-beta.30 + */ namespace PHPPgAdmin; /** diff --git a/src/classes/HelperTrait.php b/src/classes/HelperTrait.php index 68bd3d0a..f00677b8 100644 --- a/src/classes/HelperTrait.php +++ b/src/classes/HelperTrait.php @@ -1,6 +1,12 @@ <?php +/* + * PHPPgAdmin v6.0.0-beta.30 + */ namespace PHPPgAdmin; +/** + * A trait with helpers methods to debug, halt the app and format text to html + */ trait HelperTrait { diff --git a/src/classes/Highlight.php b/src/classes/Highlight.php index 8ec9587f..cb9cd996 100644 --- a/src/classes/Highlight.php +++ b/src/classes/Highlight.php @@ -1,2486 +1,2486 @@ <?php - - namespace PHPPgAdmin; - -/* This software is licensed through a BSD-style License. - * http://www.opensource.org/licenses/bsd-license.php - - Copyright (c) 2003, 2004, Jacob D. Cohen - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - Neither the name of Jacob D. Cohen nor the names of his contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - */ - - class Highlight +/* + * PHPPgAdmin v6.0.0-beta.30 + */ +namespace PHPPgAdmin; + +/** + * This software is licensed through a BSD-style License. + * @see {@link http://www.opensource.org/licenses/bsd-license.php} + * Copyright (c) 2003, 2004, Jacob D. Cohen + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of Jacob D. Cohen nor the names of his contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +class Highlight +{ + const NORMAL_TEXT = 1; + const DQ_LITERAL = 2; + const DQ_ESCAPE = 3; + const SQ_LITERAL = 4; + const SQ_ESCAPE = 5; + const SLASH_BEGIN = 6; + const STAR_COMMENT = 7; + const STAR_END = 8; + const LINE_COMMENT = 9; + const HTML_ENTITY = 10; + const LC_ESCAPE = 11; + const BLOCK_COMMENT = 12; + const PAREN_BEGIN = 13; + const DASH_BEGIN = 14; + const BT_LITERAL = 15; + const BT_ESCAPE = 16; + const XML_TAG_BEGIN = 17; + const XML_TAG = 18; + const XML_PI = 19; + const SCH_NORMAL = 20; + const SCH_STRESC = 21; + const SCH_IDEXPR = 22; + const SCH_NUMLIT = 23; + const SCH_CHRLIT = 24; + const SCH_STRLIT = 25; + public $initial_state = ['Scheme' => self::SCH_NORMAL]; + public $sch = []; + public $c89 = []; + public $c99 = []; + public $cpp = []; + public $cs = []; + public $edges = []; + public $java = []; + public $mirc = []; + public $pascal = []; + public $perl = []; + public $php = []; + public $pli = []; + public $process = []; + public $process_end = []; + public $python = []; + public $ruby = []; + public $sql = []; + public $states = []; + public $vb = []; + public $xml = []; + + /* Constructor */ + + public function __construct() { - const NORMAL_TEXT = 1; - const DQ_LITERAL = 2; - const DQ_ESCAPE = 3; - const SQ_LITERAL = 4; - const SQ_ESCAPE = 5; - const SLASH_BEGIN = 6; - const STAR_COMMENT = 7; - const STAR_END = 8; - const LINE_COMMENT = 9; - const HTML_ENTITY = 10; - const LC_ESCAPE = 11; - const BLOCK_COMMENT = 12; - const PAREN_BEGIN = 13; - const DASH_BEGIN = 14; - const BT_LITERAL = 15; - const BT_ESCAPE = 16; - const XML_TAG_BEGIN = 17; - const XML_TAG = 18; - const XML_PI = 19; - const SCH_NORMAL = 20; - const SCH_STRESC = 21; - const SCH_IDEXPR = 22; - const SCH_NUMLIT = 23; - const SCH_CHRLIT = 24; - const SCH_STRLIT = 25; - public $initial_state = ['Scheme' => self::SCH_NORMAL]; - public $sch = []; - public $c89 = []; - public $c99 = []; - public $cpp = []; - public $cs = []; - public $edges = []; - public $java = []; - public $mirc = []; - public $pascal = []; - public $perl = []; - public $php = []; - public $pli = []; - public $process = []; - public $process_end = []; - public $python = []; - public $ruby = []; - public $sql = []; - public $states = []; - public $vb = []; - public $xml = []; - - /* Constructor */ - - public function __construct() - { - $keyword_replace = function ($keywords, $text, $ncs = false) { - $cm = $ncs ? 'i' : ''; - foreach ($keywords as $keyword) { - $search[] = "/(\\b$keyword\\b)/" . $cm; - $replace[] = '<span class="keyword">\\0</span>'; - } - - $search[] = "/(\\bclass\s)/"; + $keyword_replace = function ($keywords, $text, $ncs = false) { + $cm = $ncs ? 'i' : ''; + foreach ($keywords as $keyword) { + $search[] = "/(\\b$keyword\\b)/" . $cm; $replace[] = '<span class="keyword">\\0</span>'; + } - return preg_replace($search, $replace, $text); - }; - - $preproc_replace = function ($preproc, $text) { - foreach ($preproc as $proc) { - $search[] = "/(\\s*#\s*$proc\\b)/"; - $replace[] = '<span class="keyword">\\0</span>'; - } + $search[] = "/(\\bclass\s)/"; + $replace[] = '<span class="keyword">\\0</span>'; - return preg_replace($search, $replace, $text); - }; + return preg_replace($search, $replace, $text); + }; - $sch_syntax_helper = function ($text) { - return $text; - }; + $preproc_replace = function ($preproc, $text) { + foreach ($preproc as $proc) { + $search[] = "/(\\s*#\s*$proc\\b)/"; + $replace[] = '<span class="keyword">\\0</span>'; + } - $syntax_highlight_helper = function ($text, $language) use ($keyword_replace, $preproc_replace) { - $preproc = []; - $preproc['C++'] = [ + return preg_replace($search, $replace, $text); + }; + + $sch_syntax_helper = function ($text) { + return $text; + }; + + $syntax_highlight_helper = function ($text, $language) use ($keyword_replace, $preproc_replace) { + $preproc = []; + $preproc['C++'] = [ + 'if', + 'ifdef', + 'ifndef', + 'elif', + 'else', + 'endif', + 'include', + 'define', + 'undef', + 'line', + 'error', + 'pragma', + ]; + $preproc['C89'] = &$preproc['C++']; + $preproc['C'] = &$preproc['C89']; + + $keywords = [ + 'C++' => [ + 'asm', + 'auto', + 'bool', + 'break', + 'case', + 'catch', + 'char', /*class*/ + 'const', + 'const_cast', + 'continue', + 'default', + 'delete', + 'do', + 'double', + 'dynamic_cast', + 'else', + 'enum', + 'explicit', + 'export', + 'extern', + 'false', + 'float', + 'for', + 'friend', + 'goto', 'if', - 'ifdef', - 'ifndef', - 'elif', + 'inline', + 'int', + 'long', + 'mutable', + 'namespace', + 'new', + 'operator', + 'private', + 'protected', + 'public', + 'register', + 'reinterpret_cast', + 'return', + 'short', + 'signed', + 'sizeof', + 'static', + 'static_cast', + 'struct', + 'switch', + 'template', + 'this', + 'throw', + 'true', + 'try', + 'typedef', + 'typeid', + 'typename', + 'union', + 'unsigned', + 'using', + 'virtual', + 'void', + 'volatile', + 'wchar_t', + 'while', + ], + + 'C89' => [ + 'auto', + 'break', + 'case', + 'char', + 'const', + 'continue', + 'default', + 'do', + 'double', 'else', + 'enum', + 'extern', + 'float', + 'for', + 'goto', + 'if', + 'int', + 'long', + 'register', + 'return', + 'short', + 'signed', + 'sizeof', + 'static', + 'struct', + 'switch', + 'typedef', + 'union', + 'unsigned', + 'void', + 'volatile', + 'while', + ], + + 'C' => [ + 'auto', + 'break', + 'case', + 'char', + 'const', + 'continue', + 'default', + 'do', + 'double', + 'else', + 'enum', + 'extern', + 'float', + 'for', + 'goto', + 'if', + 'int', + 'long', + 'register', + 'return', + 'short', + 'signed', + 'sizeof', + 'static', + 'struct', + 'switch', + 'typedef', + 'union', + 'unsigned', + 'void', + 'volatile', + 'while', + '__restrict', + '_Bool', + ], + + 'PHP' => [ + 'and', + 'or', + 'xor', + '__FILE__', + '__LINE__', + 'array', + 'as', + 'break', + 'case', + 'cfunction', + /*class*/ + 'const', + 'continue', + 'declare', + 'default', + 'die', + 'do', + 'echo', + 'else', + 'elseif', + 'empty', + 'enddeclare', + 'endfor', + 'endforeach', 'endif', + 'endswitch', + 'endwhile', + 'eval', + 'exit', + 'extends', + 'for', + 'foreach', + 'function', + 'global', + 'if', 'include', - 'define', + 'include_once', + 'isset', + 'list', + 'new', + 'old_function', + 'print', + 'require', + 'require_once', + 'return', + 'static', + 'switch', + 'unset', + 'use', + 'var', + 'while', + '__FUNCTION__', + '__CLASS__', + ], + + 'Perl' => [ + '-A', + '-B', + '-C', + '-M', + '-O', + '-R', + '-S', + '-T', + '-W', + '-X', + '-b', + '-c', + '-d', + '-e', + '-f', + '-g', + '-k', + '-l', + '-o', + '-p', + '-r', + '-s', + '-t', + '-u', + '-w', + '-x', + '-z', + 'ARGV', + 'DATA', + 'ENV', + 'SIG', + 'STDERR', + 'STDIN', + 'STDOUT', + 'atan2', + 'bind', + 'binmode', + 'bless', + 'caller', + 'chdir', + 'chmod', + 'chomp', + 'chop', + 'chown', + 'chr', + 'chroot', + 'close', + 'closedir', + 'cmp', + 'connect', + 'continue', + 'cos', + 'crypt', + 'dbmclose', + 'dbmopen', + 'defined', + 'delete', + 'die', + 'do', + 'dump', + 'each', + 'else', + 'elsif', + 'endgrent', + 'endhostent', + 'endnetent', + 'endprotent', + 'endpwent', + 'endservent', + 'eof', + 'eq', + 'eval', + 'exec', + 'exists', + 'exit', + 'exp', + 'fcntl', + 'fileno', + 'flock', + 'for', + 'foreach', + 'fork', + 'format', + 'formline', + 'ge', + 'getc', + 'getgrent', + 'getgrid', + 'getgrnam', + 'gethostbyaddr', + 'gethostbyname', + 'gethostent', + 'getlogin', + 'getnetbyaddr', + 'getnetbyname', + 'getnetent', + 'getpeername', + 'getpgrp', + 'getppid', + 'getpriority', + 'getprotobyname', + 'getprotobynumber', + 'getprotoent', + 'getpwent', + 'getpwnam', + 'getpwuid', + 'getservbyname', + 'getservbyport', + 'getservent', + 'getsockname', + 'getsockopt', + 'glob', + 'gmtime', + 'goto', + 'grep', + /*gt*/ + 'hex', + 'if', + 'import', + 'index', + 'int', + 'ioctl', + 'join', + 'keys', + 'kill', + 'last', + 'lc', + 'lcfirst', + 'le', + 'length', + 'link', + 'listen', + 'local', + 'localtime', + 'log', + 'lstat', /*lt*/ + 'm', + 'map', + 'mkdir', + 'msgctl', + 'msgget', + 'msgrcv', + 'msgsnd', + 'my', + 'ne', + 'next', + 'no', + 'oct', + 'open', + 'opendir', + 'ord', + 'pack', + 'package', + 'pipe', + 'pop', + 'pos', + 'print', + 'printf', + 'push', + 'q', + 'qq', + 'quotemeta', + 'qw', + 'qx', + 'rand', + 'read', + 'readdir', + 'readlink', + 'recv', + 'redo', + 'ref', + 'refname', + 'require', + 'reset', + 'return', + 'reverse', + 'rewinddir', + 'rindex', + 'rmdir', + 's', + 'scalar', + 'seek', + 'seekdir', + 'select', + 'semctl', + 'semget', + 'semop', + 'send', + 'setgrent', + 'sethostent', + 'setnetent', + 'setpgrp', + 'setpriority', + 'setprotoent', + 'setpwent', + 'setservent', + 'setsockopt', + 'shift', + 'shmctl', + 'shmget', + 'shmread', + 'shmwrite', + 'shutdown', + 'sin', + 'sleep', + 'socket', + 'socketpair', + 'sort', + 'splice', + 'split', + 'sprintf', + 'sqrt', + 'srand', + 'stat', + 'study', + 'sub', + 'substr', + 'symlink', + 'syscall', + 'sysopen', + 'sysread', + 'system', + 'syswrite', + 'tell', + 'telldir', + 'tie', + 'tied', + 'time', + 'times', + 'tr', + 'truncate', + 'uc', + 'ucfirst', + 'umask', 'undef', - 'line', - 'error', - 'pragma' - ]; - $preproc['C89'] = &$preproc['C++']; - $preproc['C'] = &$preproc['C89']; - - $keywords = [ - 'C++' => [ - 'asm', - 'auto', - 'bool', - 'break', - 'case', - 'catch', - 'char', /*class*/ - 'const', - 'const_cast', - 'continue', - 'default', - 'delete', - 'do', - 'double', - 'dynamic_cast', - 'else', - 'enum', - 'explicit', - 'export', - 'extern', - 'false', - 'float', - 'for', - 'friend', - 'goto', - 'if', - 'inline', - 'int', - 'long', - 'mutable', - 'namespace', - 'new', - 'operator', - 'private', - 'protected', - 'public', - 'register', - 'reinterpret_cast', - 'return', - 'short', - 'signed', - 'sizeof', - 'static', - 'static_cast', - 'struct', - 'switch', - 'template', - 'this', - 'throw', - 'true', - 'try', - 'typedef', - 'typeid', - 'typename', - 'union', - 'unsigned', - 'using', - 'virtual', - 'void', - 'volatile', - 'wchar_t', - 'while' - ], - - 'C89' => [ - 'auto', - 'break', - 'case', - 'char', - 'const', - 'continue', - 'default', - 'do', - 'double', - 'else', - 'enum', - 'extern', - 'float', - 'for', - 'goto', - 'if', - 'int', - 'long', - 'register', - 'return', - 'short', - 'signed', - 'sizeof', - 'static', - 'struct', - 'switch', - 'typedef', - 'union', - 'unsigned', - 'void', - 'volatile', - 'while' - ], - - 'C' => [ - 'auto', - 'break', - 'case', - 'char', - 'const', - 'continue', - 'default', - 'do', - 'double', - 'else', - 'enum', - 'extern', - 'float', - 'for', - 'goto', - 'if', - 'int', - 'long', - 'register', - 'return', - 'short', - 'signed', - 'sizeof', - 'static', - 'struct', - 'switch', - 'typedef', - 'union', - 'unsigned', - 'void', - 'volatile', - 'while', - '__restrict', - '_Bool' - ], - - 'PHP' => [ - 'and', - 'or', - 'xor', - '__FILE__', - '__LINE__', - 'array', - 'as', - 'break', - 'case', - 'cfunction', - /*class*/ - 'const', - 'continue', - 'declare', - 'default', - 'die', - 'do', - 'echo', - 'else', - 'elseif', - 'empty', - 'enddeclare', - 'endfor', - 'endforeach', - 'endif', - 'endswitch', - 'endwhile', - 'eval', - 'exit', - 'extends', - 'for', - 'foreach', - 'function', - 'global', - 'if', - 'include', - 'include_once', - 'isset', - 'list', - 'new', - 'old_function', - 'print', - 'require', - 'require_once', - 'return', - 'static', - 'switch', - 'unset', - 'use', - 'var', - 'while', - '__FUNCTION__', - '__CLASS__' - ], - - 'Perl' => [ - '-A', - '-B', - '-C', - '-M', - '-O', - '-R', - '-S', - '-T', - '-W', - '-X', - '-b', - '-c', - '-d', - '-e', - '-f', - '-g', - '-k', - '-l', - '-o', - '-p', - '-r', - '-s', - '-t', - '-u', - '-w', - '-x', - '-z', - 'ARGV', - 'DATA', - 'ENV', - 'SIG', - 'STDERR', - 'STDIN', - 'STDOUT', - 'atan2', - 'bind', - 'binmode', - 'bless', - 'caller', - 'chdir', - 'chmod', - 'chomp', - 'chop', - 'chown', - 'chr', - 'chroot', - 'close', - 'closedir', - 'cmp', - 'connect', - 'continue', - 'cos', - 'crypt', - 'dbmclose', - 'dbmopen', - 'defined', - 'delete', - 'die', - 'do', - 'dump', - 'each', - 'else', - 'elsif', - 'endgrent', - 'endhostent', - 'endnetent', - 'endprotent', - 'endpwent', - 'endservent', - 'eof', - 'eq', - 'eval', - 'exec', - 'exists', - 'exit', - 'exp', - 'fcntl', - 'fileno', - 'flock', - 'for', - 'foreach', - 'fork', - 'format', - 'formline', - 'ge', - 'getc', - 'getgrent', - 'getgrid', - 'getgrnam', - 'gethostbyaddr', - 'gethostbyname', - 'gethostent', - 'getlogin', - 'getnetbyaddr', - 'getnetbyname', - 'getnetent', - 'getpeername', - 'getpgrp', - 'getppid', - 'getpriority', - 'getprotobyname', - 'getprotobynumber', - 'getprotoent', - 'getpwent', - 'getpwnam', - 'getpwuid', - 'getservbyname', - 'getservbyport', - 'getservent', - 'getsockname', - 'getsockopt', - 'glob', - 'gmtime', - 'goto', - 'grep', - /*gt*/ - 'hex', - 'if', - 'import', - 'index', - 'int', - 'ioctl', - 'join', - 'keys', - 'kill', - 'last', - 'lc', - 'lcfirst', - 'le', - 'length', - 'link', - 'listen', - 'local', - 'localtime', - 'log', - 'lstat', /*lt*/ - 'm', - 'map', - 'mkdir', - 'msgctl', - 'msgget', - 'msgrcv', - 'msgsnd', - 'my', - 'ne', - 'next', - 'no', - 'oct', - 'open', - 'opendir', - 'ord', - 'pack', - 'package', - 'pipe', - 'pop', - 'pos', - 'print', - 'printf', - 'push', - 'q', - 'qq', - 'quotemeta', - 'qw', - 'qx', - 'rand', - 'read', - 'readdir', - 'readlink', - 'recv', - 'redo', - 'ref', - 'refname', - 'require', - 'reset', - 'return', - 'reverse', - 'rewinddir', - 'rindex', - 'rmdir', - 's', - 'scalar', - 'seek', - 'seekdir', - 'select', - 'semctl', - 'semget', - 'semop', - 'send', - 'setgrent', - 'sethostent', - 'setnetent', - 'setpgrp', - 'setpriority', - 'setprotoent', - 'setpwent', - 'setservent', - 'setsockopt', - 'shift', - 'shmctl', - 'shmget', - 'shmread', - 'shmwrite', - 'shutdown', - 'sin', - 'sleep', - 'socket', - 'socketpair', - 'sort', - 'splice', - 'split', - 'sprintf', - 'sqrt', - 'srand', - 'stat', - 'study', - 'sub', - 'substr', - 'symlink', - 'syscall', - 'sysopen', - 'sysread', - 'system', - 'syswrite', - 'tell', - 'telldir', - 'tie', - 'tied', - 'time', - 'times', - 'tr', - 'truncate', - 'uc', - 'ucfirst', - 'umask', - 'undef', - 'unless', - 'unlink', - 'unpack', - 'unshift', - 'untie', - 'until', - 'use', - 'utime', - 'values', - 'vec', - 'wait', - 'waitpid', - 'wantarray', - 'warn', - 'while', - 'write', - 'y', - 'or', - 'and', - 'not' - ], - - 'Java' => [ - 'abstract', - 'boolean', - 'break', - 'byte', - 'case', - 'catch', - 'char', /*class*/ - 'const', - 'continue', - 'default', - 'do', - 'double', - 'else', - 'extends', - 'final', - 'finally', - 'float', - 'for', - 'goto', - 'if', - 'implements', - 'import', - 'instanceof', - 'int', - 'interface', - 'long', - 'native', - 'new', - 'package', - 'private', - 'protected', - 'public', - 'return', - 'short', - 'static', - 'strictfp', - 'super', - 'switch', - 'synchronized', - 'this', - 'throw', - 'throws', - 'transient', - 'try', - 'void', - 'volatile', - 'while' - ], - - 'VB' => [ - 'AddressOf', - 'Alias', - 'And', - 'Any', - 'As', - 'Binary', - 'Boolean', - 'ByRef', - 'Byte', - 'ByVal', - 'Call', - 'Case', - 'CBool', - 'CByte', - 'CCur', - 'CDate', - 'CDbl', - 'CInt', - 'CLng', - 'Close', - 'Const', - 'CSng', - 'CStr', - 'Currency', - 'CVar', - 'CVErr', - 'Date', - 'Debug', - 'Declare', - 'DefBool', - 'DefByte', - 'DefCur', - 'DefDate', - 'DefDbl', - 'DefInt', - 'DefLng', - 'DefObj', - 'DefSng', - 'DefStr', - 'DefVar', - 'Dim', - 'Do', - 'Double', - 'Each', - 'Else', - 'End', - 'Enum', - 'Eqv', - 'Erase', - 'Error', - 'Event', - 'Exit', - 'For', - 'Friend', - 'Function', - 'Get', - 'Get', - 'Global', - 'GoSub', - 'GoTo', - 'If', - 'Imp', - 'Implements', - 'In', - 'Input', - 'Integer', - 'Is', - 'LBound', - 'Len', - 'Let', - 'Lib', - 'Like', - 'Line', - 'Lock', - 'Long', - 'Loop', - 'LSet', - 'Mod', - 'Name', - 'Next', - 'Not', - 'Nothing', - 'Null', - 'Object', - 'On', - 'Open', - 'Option Base 1', - 'Option Compare Binary', - 'Option Compare Database', - 'Option Compare Text', - 'Option Explicit', - 'Option Private Module', - 'Optional', - 'Or', - 'Output', - 'ParamArray', - 'Preserve', - 'Print', - 'Private', - 'Property', - 'Public', - 'Put', - 'RaiseEvent', - 'Random', - 'Read', - 'ReDim', - 'Resume', - 'Return', - 'RSet', - 'Seek', - 'Select', - 'Set', - 'Single', - 'Spc', - 'Static', - 'Step', - 'Stop', - 'String', - 'Sub', - 'Tab', - 'Then', - 'To', - 'Type', - 'UBound', - 'Unlock', - 'Variant', - 'Wend', - 'While', - 'With', - 'WithEvents', - 'Write', - 'Xor' - ], - - 'C#' => [ - 'abstract', - 'as', - 'base', - 'bool', - 'break', - 'byte', - 'case', - 'catch', - 'char', - 'checked', - /*class*/ - 'const', - 'continue', - 'decimal', - 'default', - 'delegate', - 'do', - 'double', - 'else', - 'enum', - 'event', - 'explicit', - 'extern', - 'false', - 'finally', - 'fixed', - 'float', - 'for', - 'foreach', - 'goto', - 'if', - 'implicit', - 'in', - 'int', - 'interface', - 'internal', - 'is', - 'lock', - 'long', - 'namespace', - 'new', - 'null', - 'object', - 'operator', - 'out', - 'override', - 'params', - 'private', - 'protected', - 'public', - 'readonly', - 'ref', - 'return', - 'sbyte', - 'sealed', - 'short', - 'sizeof', - 'stackalloc', - 'static', - 'string', - 'struct', - 'switch', - 'this', - 'throw', - 'true', - 'try', - 'typeof', - 'uint', - 'ulong', - 'unchecked', - 'unsafe', - 'ushort', - 'using', - 'virtual', - 'volatile', - 'void', - 'while' - ], - - 'Ruby' => [ - 'alias', - 'and', - 'begin', - 'break', - 'case', - /*class*/ - 'def', - 'defined', - 'do', - 'else', - 'elsif', - 'end', - 'ensure', - 'false', - 'for', - 'if', - 'in', - 'module', - 'next', - 'module', - 'next', - 'nil', - 'not', - 'or', - 'redo', - 'rescue', - 'retry', - 'return', - 'self', - 'super', - 'then', - 'true', - 'undef', - 'unless', - 'until', - 'when', - 'while', - 'yield' - ], - - 'Python' => [ - 'and', - 'assert', - 'break', /*"class",*/ - 'continue', - 'def', - 'del', - 'elif', - 'else', - 'except', - 'exec', - 'finally', - 'for', - 'from', - 'global', - 'if', - 'import', - 'in', - 'is', - 'lambda', - 'not', - 'or', - 'pass', - 'print', - 'raise', - 'return', - 'try', - 'while', - 'yield' - ], - - 'Pascal' => [ - 'Absolute', - 'Abstract', - 'All', - 'And', - 'And_then', - 'Array', - 'Asm', - 'Begin', - 'Bindable', - 'Case', - /*"Class",*/ - 'Const', - 'Constructor', - 'Destructor', - 'Div', - 'Do', - 'Downto', - 'Else', - 'End', - 'Export', - 'File', - 'For', - 'Function', - 'Goto', - 'If', - 'Import', - 'Implementation', - 'Inherited', - 'In', - 'Inline', - 'Interface', - 'Is', - 'Label', - 'Mod', - 'Module', - 'Nil', - 'Not', - 'Object', - 'Of', - 'Only', - 'Operator', - 'Or', - 'Or_else', - 'Otherwise', - 'Packed', - 'Pow', - 'Procedure', - 'Program', - 'Property', - 'Protected', - 'Qualified', - 'Record', - 'Repeat', - 'Restricted', - 'Set', - 'Shl', - 'Shr', - 'Then', - 'To', - 'Type', - 'Unit', - 'Until', - 'Uses', - 'Value', - 'Var', - 'View', - 'Virtual', - 'While', - 'With', - 'Xor' - ], - - 'mIRC' => [ - ], - - 'PL/I' => [ - 'A', - 'ABS', - 'ACOS', - '%ACTIVATE', - 'ACTUALCOUNT', - 'ADD', - 'ADDR', - 'ADDREL', - 'ALIGNED', - 'ALLOCATE', - 'ALLOC', - 'ALLOCATION', - 'ALLOCN', - 'ANY', - 'ANYCONDITION', - 'APPEND', - 'AREA', - 'ASIN', - 'ATAN', - 'ATAND', - 'ATANH', - 'AUTOMATIC', - 'AUTO', - 'B', - 'B1', - 'B2', - 'B3', - 'B4', - 'BACKUP_DATE', - 'BASED', - 'BATCH', - 'BEGIN', - 'BINARY', - 'BIN', - 'BIT', - 'BLOCK_BOUNDARY_FORMAT', - 'BLOCK_IO', - 'BLOCK_SIZE', - 'BOOL', - 'BUCKET_SIZE', - 'BUILTIN', - 'BY', - 'BYTE', - 'BYTESIZE', - 'CALL', - 'CANCEL_CONTROL_O', - 'CARRIAGE_RETURN_FORMAT', - 'CEIL', - 'CHAR', - 'CHARACTER', - 'CLOSE', - 'COLLATE', - 'COLUMN', - 'CONDITION', - 'CONTIGUOUS', - 'CONTIGUOUS_BEST_TRY', - 'CONTROLLED', - 'CONVERSION', - 'COPY', - 'COS', - 'COSD', - 'COSH', - 'CREATION_DATE', - 'CURRENT_POSITION', - 'DATE', - 'DATETIME', - '%DEACTIVATE', - 'DECIMAL', - 'DEC', - '%DECLARE', - '%DCL', - 'DECLARE', - 'DCL', - 'DECODE', - 'DEFAULT_FILE_NAME', - 'DEFERRED_WRITE', - 'DEFINED', - 'DEF', - 'DELETE', - 'DESCRIPTOR', - '%DICTIONARY', - 'DIMENSION', - 'DIM', - 'DIRECT', - 'DISPLAY', - 'DIVIDE', - '%DO', - 'DO', - 'E', - 'EDIT', - '%ELSE', - 'ELSE', - 'EMPTY', - 'ENCODE', - '%END', - 'END', - 'ENDFILE', - 'ENDPAGE', - 'ENTRY', - 'ENVIRONMENT', - 'ENV', - '%ERROR', - 'ERROR', - 'EVERY', - 'EXP', - 'EXPIRATION_DATE', - 'EXTEND', - 'EXTENSION_SIZE', - 'EXTERNAL', - 'EXT', - 'F', - 'FAST_DELETE', - '%FATAL', - 'FILE', - 'FILE_ID', - 'FILE_ID_TO', - 'FILE_SIZE', - 'FINISH', - 'FIXED', - 'FIXEDOVERFLOW', - 'FOFL', - 'FIXED_CONTROL_FROM', - 'FIXED_CONTROL_SIZE', - 'FIXED_CONTROL_SIZE_TO', - 'FIXED_CONTROL_TO', - 'FIXED_LENGTH_RECORDS', - 'FLOAT', - 'FLOOR', - 'FLUSH', - 'FORMAT', - 'FREE', - 'FROM', - 'GET', - 'GLOBALDEF', - 'GLOBALREF', - '%GOTO', - 'GOTO', - 'GO', - 'TO', - 'GROUP_PROTETION', - 'HBOUND', - 'HIGH', - 'INDENT', - '%IF', - 'IF', - 'IGNORE_LINE_MARKS', - 'IN', - '%INCLUDE', - 'INDEX', - 'INDEXED', - 'INDEX_NUMBER', - '%INFORM', - 'INFORM', - 'INITIAL', - 'INIT', - 'INITIAL_FILL', - 'INPUT', - 'INT', - 'INTERNAL', - 'INTO', - 'KEY', - 'KEYED', - 'KEYFROM', - 'KEYTO', - 'LABEL', - 'LBOUND', - 'LEAVE', - 'LENGTH', - 'LIKE', - 'LINE', - 'LINENO', - 'LINESIZE', - '%LIST', - 'LIST', - 'LOCK_ON_READ', - 'LOCK_ON_WRITE', - 'LOG', - 'LOG10', - 'LOG2', - 'LOW', - 'LTRIM', - 'MAIN', - 'MANUAL_UNLOCKING', - 'MATCH_GREATER', - 'MATCH_GREATER_EQUAL', - 'MATCH_NEXT', - 'MATCH_NEXT_EQUAL', - 'MAX', - 'MAXIMUM_RECORD_NUMBER', - 'MAXIMUM_RECORD_SIZE', - 'MAXLENGTH', - 'MEMBER', - 'MIN', - 'MOD', - 'MULTIBLOCK_COUNT', - 'MULTIBUFFER_COUNT', - 'MULTIPLY', - 'NEXT_VOLUME', - '%NOLIST', - 'NOLOCK', - 'NONEXISTENT_RECORD', - 'NONRECURSIVE', - 'NONVARYING', - 'NONVAR', - 'NORESCAN', - 'NO_ECHO', - 'NO_FILTER', - 'NO_SHARE', - 'NULL', - 'OFFSET', - 'ON', - 'ONARGSLIST', - 'ONCHAR', - 'ONCODE', - 'ONFILE', - 'ONKEY', - 'ONSOURCE', - 'OPEN', - 'OPTIONAL', - 'OPTIONS', - 'OTHERWISE', - 'OTHER', - 'OUTPUT', - 'OVERFLOW', - 'OFL', - 'OWNER_GROUP', - 'OWNER_ID', - 'OWNER_MEMBER', - 'OWNER_PROTECTION', - 'P', - '%PAGE', - 'PAGE', - 'PAGENO', - 'PAGESIZE', - 'PARAMETER', - 'PARM', - 'PICTURE', - 'PIC', - 'POINTER', - 'PTR', - 'POSINT', - 'POSITION', - 'POS', - 'PRECISION', - 'PREC', - 'PRESENT', - 'PRINT', - 'PRINTER_FORMAT', - '%PROCEDURE', - '%PROC', - 'PROCEDURE', - 'PROC', - 'PROD', - 'PROMPT', - 'PURGE_TYPE_AHEAD', - 'PUT', - 'R', - 'RANK', - 'READ', - 'READONLY', - 'READ_AHEAD', - 'READ_CHECK', - 'READ_REGARDLESS', - 'RECORD', - 'RECORD_ID', - 'RECORD_ID_ACCESS', - 'RECORD_ID_TO', - 'RECURSIVE', - 'REFER', - 'REFERENCE', - 'RELEASE', - 'REPEAT', - '%REPLACE', - 'RESCAN', - 'RESIGNAL', - 'RETRIEVAL_POINTERS', - '%RETURN', - 'RETURN', - 'RETURNS', - 'REVERSE', - 'REVERT', - 'REVISION_DATE', - 'REWIND', - 'REWIND_ON_CLOSE', - 'REWIND_ON_OPEN', - 'REWRITE', - 'ROUND', - 'RTRIM', - '%SBTTL', - 'SCALARVARYING', - 'SEARCH', - 'SELECT', - 'SEQUENTIAL', - 'SEQL', - 'SET', - 'SHARED_READ', - 'SHARED_WRITE', - 'SIGN', - 'SIGNAL', - 'SIN', - 'SIND', - 'SINH', - 'SIZE', - 'SKIP', - 'SNAP', - 'SOME', - 'SPACEBLOCK', - 'SPOOL', - 'SQRT', - 'STATEMENT', - 'STATIC', - 'STOP', - 'STORAGE', - 'STREAM', - 'STRING', - 'STRINGRANGE', - 'STRG', - 'STRUCTURE', - 'SUBSCRIPTRANGE', - 'SUBRG', - 'SUBSTR', - 'SUBTRACT', - 'SUM', - 'SUPERCEDE', - 'SYSIN', - 'SYSPRINT', - 'SYSTEM', - 'SYSTEM_PROTECTION', - 'TAB', - 'TAN', - 'TAND', - 'TANH', - 'TEMPORARY', - '%THEN', - 'THEN', - 'TIME', - 'TIMEOUT_PERIOD', - '%TITLE', - 'TITLE', - 'TO', - 'TRANSLATE', - 'TRIM', - 'TRUNC', - 'TRUNCATE', - 'UNALIGNED', - 'UNAL', - 'UNDEFINED', - 'UNDF', - 'UNDERFLOW', - 'UFL', - 'UNION', - 'UNSPEC', - 'UNTIL', - 'UPDATE', - 'USER_OPEN', - 'VALID', - 'VALUE', - 'VAL', - 'VARIABLE', - 'VARIANT', - 'VARYING', - 'VAR', - 'VAXCONDITION', - 'VERIFY', - 'WAIT_FOR_RECORD', - '%WARN', - 'WARN', - 'WHEN', - 'WHILE', - 'WORLD_PROTECTION', - 'WRITE', - 'WRITE_BEHIND', - 'WRITE_CHECK', - 'X', - 'ZERODIVIDE' - ], - - 'SQL' => [ - 'abort', - 'abs', - 'absolute', - 'access', - 'action', - 'ada', - 'add', - 'admin', - 'after', - 'aggregate', - 'alias', - 'all', - 'allocate', - 'alter', - 'analyse', - 'analyze', - 'and', - 'any', - 'are', - 'array', - 'as', - 'asc', - 'asensitive', - 'assertion', - 'assignment', - 'asymmetric', - 'at', - 'atomic', - 'authorization', - 'avg', - 'backward', - 'before', - 'begin', - 'between', - 'bigint', - 'binary', - 'bit', - 'bitvar', - 'bit_length', - 'blob', - 'boolean', - 'both', - 'breadth', - 'by', - 'c', - 'cache', - 'call', - 'called', - 'cardinality', - 'cascade', - 'cascaded', - 'case', - 'cast', - 'catalog', - 'catalog_name', - 'chain', - 'char', - 'character', - 'characteristics', - 'character_length', - 'character_set_catalog', - 'character_set_name', - 'character_set_schema', - 'char_length', - 'check', - 'checked', - 'checkpoint', /* "class", */ - 'class_origin', - 'clob', - 'close', - 'cluster', - 'coalesce', - 'cobol', - 'collate', - 'collation', - 'collation_catalog', - 'collation_name', - 'collation_schema', - 'column', - 'column_name', - 'command_function', - 'command_function_code', - 'comment', - 'commit', - 'committed', - 'completion', - 'condition_number', - 'connect', - 'connection', - 'connection_name', - 'constraint', - 'constraints', - 'constraint_catalog', - 'constraint_name', - 'constraint_schema', - 'constructor', - 'contains', - 'continue', - 'conversion', - 'convert', - 'copy', - 'corresponding', - 'count', - 'create', - 'createdb', - 'createuser', - 'cross', - 'cube', - 'current', - 'current_date', - 'current_path', - 'current_role', - 'current_time', - 'current_timestamp', - 'current_user', - 'cursor', - 'cursor_name', - 'cycle', - 'data', - 'database', - 'date', - 'datetime_interval_code', - 'datetime_interval_precision', - 'day', - 'deallocate', - 'dec', - 'decimal', - 'declare', - 'default', - 'defaults', - 'deferrable', - 'deferred', - 'defined', - 'definer', - 'delete', - 'delimiter', - 'delimiters', - 'depth', - 'deref', - 'desc', - 'describe', - 'descriptor', - 'destroy', - 'destructor', - 'deterministic', - 'diagnostics', - 'dictionary', - 'disconnect', - 'dispatch', - 'distinct', - 'do', - 'domain', - 'double', - 'drop', - 'dynamic', - 'dynamic_function', - 'dynamic_function_code', - 'each', - 'else', - 'encoding', - 'encrypted', - 'end', - 'end-exec', - 'equals', - 'escape', - 'every', - 'except', - 'exception', - 'excluding', - 'exclusive', - 'exec', - 'execute', - 'existing', - 'exists', - 'explain', - 'external', - 'extract', - 'false', - 'fetch', - 'final', - 'first', - 'float', - 'for', - 'force', - 'foreign', - 'fortran', - 'forward', - 'found', - 'free', - 'freeze', - 'from', - 'full', - 'function', - 'g', - 'general', - 'generated', - 'get', - 'global', - 'go', - 'goto', - 'grant', - 'granted', - 'group', - 'grouping', - 'handler', - 'having', - 'hierarchy', - 'hold', - 'host', - 'hour', - 'identity', - 'ignore', - 'ilike', - 'immediate', - 'immutable', - 'implementation', - 'implicit', - 'in', - 'including', - 'increment', - 'index', - 'indicator', - 'infix', - 'inherits', - 'initialize', - 'initially', - 'inner', - 'inout', - 'input', - 'insensitive', - 'insert', - 'instance', - 'instantiable', - 'instead', - 'int', - 'integer', - 'intersect', - 'interval', - 'into', - 'invoker', - 'is', - 'isnull', - 'isolation', - 'iterate', - 'join', - 'k', - 'key', - 'key_member', - 'key_type', - 'lancompiler', - 'language', - 'large', - 'last', - 'lateral', - 'leading', - 'left', - 'length', - 'less', - 'level', - 'like', - 'limit', - 'listen', - 'load', - 'local', - 'localtime', - 'localtimestamp', - 'location', - 'locator', - 'lock', - 'lower', - 'm', - 'map', - 'match', - 'max', - 'maxvalue', - 'message_length', - 'message_octet_length', - 'message_text', - 'method', - 'min', - 'minute', - 'minvalue', - 'mod', - 'mode', - 'modifies', - 'modify', - 'module', - 'month', - 'more', - 'move', - 'mumps', - 'name', - 'names', - 'national', - 'natural', - 'nchar', - 'nclob', - 'new', - 'next', - 'no', - 'nocreatedb', - 'nocreateuser', - 'none', - 'not', - 'nothing', - 'notify', - 'notnull', - 'null', - 'nullable', - 'nullif', - 'number', - 'numeric', - 'object', - 'octet_length', - 'of', - 'off', - 'offset', - 'oids', - 'old', - 'on', - 'only', - 'open', - 'operation', - 'operator', - 'option', - 'options', - 'or', - 'order', - 'ordinality', - 'out', - 'outer', - 'output', - 'overlaps', - 'overlay', - 'overriding', - 'owner', - 'pad', - 'parameter', - 'parameters', - 'parameter_mode', - 'parameter_name', - 'parameter_ordinal_position', - 'parameter_specific_catalog', - 'parameter_specific_name', - 'parameter_specific_schema', - 'partial', - 'pascal', - 'password', - 'path', - 'pendant', - 'placing', - 'pli', - 'position', - 'postfix', - 'precision', - 'prefix', - 'preorder', - 'prepare', - 'preserve', - 'primary', - 'prior', - 'privileges', - 'procedural', - 'procedure', - 'public', - 'read', - 'reads', - 'real', - 'recheck', - 'recursive', - 'ref', - 'references', - 'referencing', - 'reindex', - 'relative', - 'rename', - 'repeatable', - 'replace', - 'reset', - 'restart', - 'restrict', - 'result', - 'return', - 'returned_length', - 'returned_octet_length', - 'returned_sqlstate', - 'returns', - 'revoke', - 'right', - 'role', - 'rollback', - 'rollup', - 'routine', - 'routine_catalog', - 'routine_name', - 'routine_schema', - 'row', - 'rows', - 'row_count', - 'rule', - 'savepoint', - 'scale', - 'schema', - 'schema_name', - 'scope', - 'scroll', - 'search', - 'second', - 'section', - 'security', - 'select', - 'self', - 'sensitive', - 'sequence', - 'serializable', - 'server_name', - 'session', - 'session_user', - 'set', - 'setof', - 'sets', - 'share', - 'show', - 'similar', - 'simple', - 'size', - 'smallint', - 'some', - 'source', - 'space', - 'specific', - 'specifictype', - 'specific_name', - 'sql', - 'sqlcode', - 'sqlerror', - 'sqlexception', - 'sqlstate', - 'sqlwarning', - 'stable', - 'start', - 'state', - 'statement', - 'static', - 'statistics', - 'stdin', - 'stdout', - 'storage', - 'strict', - 'structure', - 'style', - 'subclass_origin', - 'sublist', - 'substring', - 'sum', - 'symmetric', - 'sysid', - 'system', - 'system_user', - 'table', - 'table_name', - 'temp', - 'template', - 'temporary', - 'terminate', - 'text', - 'than', - 'then', - 'time', - 'timestamp', - 'timezone_hour', - 'timezone_minute', - 'to', - 'toast', - 'trailing', - 'transaction', - 'transactions_committed', - 'transactions_rolled_back', - 'transaction_active', - 'transform', - 'transforms', - 'translate', - 'translation', - 'treat', - 'trigger', - 'trigger_catalog', - 'trigger_name', - 'trigger_schema', - 'trim', - 'true', - 'truncate', - 'trusted', - 'type', - 'uncommitted', - 'under', - 'unencrypted', - 'union', - 'unique', - 'unknown', - 'unlisten', - 'unnamed', - 'unnest', - 'until', - 'update', - 'upper', - 'usage', - 'user', - 'user_defined_type_catalog', - 'user_defined_type_name', - 'user_defined_type_schema', - 'using', - 'vacuum', - 'valid', - 'validator', - 'value', - 'values', - 'varchar', - 'variable', - 'varying', - 'verbose', - 'version', - 'view', - 'volatile', - 'when', - 'whenever', - 'where', - 'with', - 'without', - 'work', - 'write', - 'year', - 'zone' - ], - - ]; - - $case_insensitive = [ - 'VB' => true, - 'Pascal' => true, - 'PL/I' => true, - 'SQL' => true, - ]; - $ncs = false; - if (array_key_exists($language, $case_insensitive)) { - $ncs = true; - } + 'unless', + 'unlink', + 'unpack', + 'unshift', + 'untie', + 'until', + 'use', + 'utime', + 'values', + 'vec', + 'wait', + 'waitpid', + 'wantarray', + 'warn', + 'while', + 'write', + 'y', + 'or', + 'and', + 'not', + ], + + 'Java' => [ + 'abstract', + 'boolean', + 'break', + 'byte', + 'case', + 'catch', + 'char', /*class*/ + 'const', + 'continue', + 'default', + 'do', + 'double', + 'else', + 'extends', + 'final', + 'finally', + 'float', + 'for', + 'goto', + 'if', + 'implements', + 'import', + 'instanceof', + 'int', + 'interface', + 'long', + 'native', + 'new', + 'package', + 'private', + 'protected', + 'public', + 'return', + 'short', + 'static', + 'strictfp', + 'super', + 'switch', + 'synchronized', + 'this', + 'throw', + 'throws', + 'transient', + 'try', + 'void', + 'volatile', + 'while', + ], + + 'VB' => [ + 'AddressOf', + 'Alias', + 'And', + 'Any', + 'As', + 'Binary', + 'Boolean', + 'ByRef', + 'Byte', + 'ByVal', + 'Call', + 'Case', + 'CBool', + 'CByte', + 'CCur', + 'CDate', + 'CDbl', + 'CInt', + 'CLng', + 'Close', + 'Const', + 'CSng', + 'CStr', + 'Currency', + 'CVar', + 'CVErr', + 'Date', + 'Debug', + 'Declare', + 'DefBool', + 'DefByte', + 'DefCur', + 'DefDate', + 'DefDbl', + 'DefInt', + 'DefLng', + 'DefObj', + 'DefSng', + 'DefStr', + 'DefVar', + 'Dim', + 'Do', + 'Double', + 'Each', + 'Else', + 'End', + 'Enum', + 'Eqv', + 'Erase', + 'Error', + 'Event', + 'Exit', + 'For', + 'Friend', + 'Function', + 'Get', + 'Get', + 'Global', + 'GoSub', + 'GoTo', + 'If', + 'Imp', + 'Implements', + 'In', + 'Input', + 'Integer', + 'Is', + 'LBound', + 'Len', + 'Let', + 'Lib', + 'Like', + 'Line', + 'Lock', + 'Long', + 'Loop', + 'LSet', + 'Mod', + 'Name', + 'Next', + 'Not', + 'Nothing', + 'Null', + 'Object', + 'On', + 'Open', + 'Option Base 1', + 'Option Compare Binary', + 'Option Compare Database', + 'Option Compare Text', + 'Option Explicit', + 'Option Private Module', + 'Optional', + 'Or', + 'Output', + 'ParamArray', + 'Preserve', + 'Print', + 'Private', + 'Property', + 'Public', + 'Put', + 'RaiseEvent', + 'Random', + 'Read', + 'ReDim', + 'Resume', + 'Return', + 'RSet', + 'Seek', + 'Select', + 'Set', + 'Single', + 'Spc', + 'Static', + 'Step', + 'Stop', + 'String', + 'Sub', + 'Tab', + 'Then', + 'To', + 'Type', + 'UBound', + 'Unlock', + 'Variant', + 'Wend', + 'While', + 'With', + 'WithEvents', + 'Write', + 'Xor', + ], + + 'C#' => [ + 'abstract', + 'as', + 'base', + 'bool', + 'break', + 'byte', + 'case', + 'catch', + 'char', + 'checked', + /*class*/ + 'const', + 'continue', + 'decimal', + 'default', + 'delegate', + 'do', + 'double', + 'else', + 'enum', + 'event', + 'explicit', + 'extern', + 'false', + 'finally', + 'fixed', + 'float', + 'for', + 'foreach', + 'goto', + 'if', + 'implicit', + 'in', + 'int', + 'interface', + 'internal', + 'is', + 'lock', + 'long', + 'namespace', + 'new', + 'null', + 'object', + 'operator', + 'out', + 'override', + 'params', + 'private', + 'protected', + 'public', + 'readonly', + 'ref', + 'return', + 'sbyte', + 'sealed', + 'short', + 'sizeof', + 'stackalloc', + 'static', + 'string', + 'struct', + 'switch', + 'this', + 'throw', + 'true', + 'try', + 'typeof', + 'uint', + 'ulong', + 'unchecked', + 'unsafe', + 'ushort', + 'using', + 'virtual', + 'volatile', + 'void', + 'while', + ], + + 'Ruby' => [ + 'alias', + 'and', + 'begin', + 'break', + 'case', + /*class*/ + 'def', + 'defined', + 'do', + 'else', + 'elsif', + 'end', + 'ensure', + 'false', + 'for', + 'if', + 'in', + 'module', + 'next', + 'module', + 'next', + 'nil', + 'not', + 'or', + 'redo', + 'rescue', + 'retry', + 'return', + 'self', + 'super', + 'then', + 'true', + 'undef', + 'unless', + 'until', + 'when', + 'while', + 'yield', + ], + + 'Python' => [ + 'and', + 'assert', + 'break', /*"class",*/ + 'continue', + 'def', + 'del', + 'elif', + 'else', + 'except', + 'exec', + 'finally', + 'for', + 'from', + 'global', + 'if', + 'import', + 'in', + 'is', + 'lambda', + 'not', + 'or', + 'pass', + 'print', + 'raise', + 'return', + 'try', + 'while', + 'yield', + ], + + 'Pascal' => [ + 'Absolute', + 'Abstract', + 'All', + 'And', + 'And_then', + 'Array', + 'Asm', + 'Begin', + 'Bindable', + 'Case', + /*"Class",*/ + 'Const', + 'Constructor', + 'Destructor', + 'Div', + 'Do', + 'Downto', + 'Else', + 'End', + 'Export', + 'File', + 'For', + 'Function', + 'Goto', + 'If', + 'Import', + 'Implementation', + 'Inherited', + 'In', + 'Inline', + 'Interface', + 'Is', + 'Label', + 'Mod', + 'Module', + 'Nil', + 'Not', + 'Object', + 'Of', + 'Only', + 'Operator', + 'Or', + 'Or_else', + 'Otherwise', + 'Packed', + 'Pow', + 'Procedure', + 'Program', + 'Property', + 'Protected', + 'Qualified', + 'Record', + 'Repeat', + 'Restricted', + 'Set', + 'Shl', + 'Shr', + 'Then', + 'To', + 'Type', + 'Unit', + 'Until', + 'Uses', + 'Value', + 'Var', + 'View', + 'Virtual', + 'While', + 'With', + 'Xor', + ], + + 'mIRC' => [ + ], + + 'PL/I' => [ + 'A', + 'ABS', + 'ACOS', + '%ACTIVATE', + 'ACTUALCOUNT', + 'ADD', + 'ADDR', + 'ADDREL', + 'ALIGNED', + 'ALLOCATE', + 'ALLOC', + 'ALLOCATION', + 'ALLOCN', + 'ANY', + 'ANYCONDITION', + 'APPEND', + 'AREA', + 'ASIN', + 'ATAN', + 'ATAND', + 'ATANH', + 'AUTOMATIC', + 'AUTO', + 'B', + 'B1', + 'B2', + 'B3', + 'B4', + 'BACKUP_DATE', + 'BASED', + 'BATCH', + 'BEGIN', + 'BINARY', + 'BIN', + 'BIT', + 'BLOCK_BOUNDARY_FORMAT', + 'BLOCK_IO', + 'BLOCK_SIZE', + 'BOOL', + 'BUCKET_SIZE', + 'BUILTIN', + 'BY', + 'BYTE', + 'BYTESIZE', + 'CALL', + 'CANCEL_CONTROL_O', + 'CARRIAGE_RETURN_FORMAT', + 'CEIL', + 'CHAR', + 'CHARACTER', + 'CLOSE', + 'COLLATE', + 'COLUMN', + 'CONDITION', + 'CONTIGUOUS', + 'CONTIGUOUS_BEST_TRY', + 'CONTROLLED', + 'CONVERSION', + 'COPY', + 'COS', + 'COSD', + 'COSH', + 'CREATION_DATE', + 'CURRENT_POSITION', + 'DATE', + 'DATETIME', + '%DEACTIVATE', + 'DECIMAL', + 'DEC', + '%DECLARE', + '%DCL', + 'DECLARE', + 'DCL', + 'DECODE', + 'DEFAULT_FILE_NAME', + 'DEFERRED_WRITE', + 'DEFINED', + 'DEF', + 'DELETE', + 'DESCRIPTOR', + '%DICTIONARY', + 'DIMENSION', + 'DIM', + 'DIRECT', + 'DISPLAY', + 'DIVIDE', + '%DO', + 'DO', + 'E', + 'EDIT', + '%ELSE', + 'ELSE', + 'EMPTY', + 'ENCODE', + '%END', + 'END', + 'ENDFILE', + 'ENDPAGE', + 'ENTRY', + 'ENVIRONMENT', + 'ENV', + '%ERROR', + 'ERROR', + 'EVERY', + 'EXP', + 'EXPIRATION_DATE', + 'EXTEND', + 'EXTENSION_SIZE', + 'EXTERNAL', + 'EXT', + 'F', + 'FAST_DELETE', + '%FATAL', + 'FILE', + 'FILE_ID', + 'FILE_ID_TO', + 'FILE_SIZE', + 'FINISH', + 'FIXED', + 'FIXEDOVERFLOW', + 'FOFL', + 'FIXED_CONTROL_FROM', + 'FIXED_CONTROL_SIZE', + 'FIXED_CONTROL_SIZE_TO', + 'FIXED_CONTROL_TO', + 'FIXED_LENGTH_RECORDS', + 'FLOAT', + 'FLOOR', + 'FLUSH', + 'FORMAT', + 'FREE', + 'FROM', + 'GET', + 'GLOBALDEF', + 'GLOBALREF', + '%GOTO', + 'GOTO', + 'GO', + 'TO', + 'GROUP_PROTETION', + 'HBOUND', + 'HIGH', + 'INDENT', + '%IF', + 'IF', + 'IGNORE_LINE_MARKS', + 'IN', + '%INCLUDE', + 'INDEX', + 'INDEXED', + 'INDEX_NUMBER', + '%INFORM', + 'INFORM', + 'INITIAL', + 'INIT', + 'INITIAL_FILL', + 'INPUT', + 'INT', + 'INTERNAL', + 'INTO', + 'KEY', + 'KEYED', + 'KEYFROM', + 'KEYTO', + 'LABEL', + 'LBOUND', + 'LEAVE', + 'LENGTH', + 'LIKE', + 'LINE', + 'LINENO', + 'LINESIZE', + '%LIST', + 'LIST', + 'LOCK_ON_READ', + 'LOCK_ON_WRITE', + 'LOG', + 'LOG10', + 'LOG2', + 'LOW', + 'LTRIM', + 'MAIN', + 'MANUAL_UNLOCKING', + 'MATCH_GREATER', + 'MATCH_GREATER_EQUAL', + 'MATCH_NEXT', + 'MATCH_NEXT_EQUAL', + 'MAX', + 'MAXIMUM_RECORD_NUMBER', + 'MAXIMUM_RECORD_SIZE', + 'MAXLENGTH', + 'MEMBER', + 'MIN', + 'MOD', + 'MULTIBLOCK_COUNT', + 'MULTIBUFFER_COUNT', + 'MULTIPLY', + 'NEXT_VOLUME', + '%NOLIST', + 'NOLOCK', + 'NONEXISTENT_RECORD', + 'NONRECURSIVE', + 'NONVARYING', + 'NONVAR', + 'NORESCAN', + 'NO_ECHO', + 'NO_FILTER', + 'NO_SHARE', + 'NULL', + 'OFFSET', + 'ON', + 'ONARGSLIST', + 'ONCHAR', + 'ONCODE', + 'ONFILE', + 'ONKEY', + 'ONSOURCE', + 'OPEN', + 'OPTIONAL', + 'OPTIONS', + 'OTHERWISE', + 'OTHER', + 'OUTPUT', + 'OVERFLOW', + 'OFL', + 'OWNER_GROUP', + 'OWNER_ID', + 'OWNER_MEMBER', + 'OWNER_PROTECTION', + 'P', + '%PAGE', + 'PAGE', + 'PAGENO', + 'PAGESIZE', + 'PARAMETER', + 'PARM', + 'PICTURE', + 'PIC', + 'POINTER', + 'PTR', + 'POSINT', + 'POSITION', + 'POS', + 'PRECISION', + 'PREC', + 'PRESENT', + 'PRINT', + 'PRINTER_FORMAT', + '%PROCEDURE', + '%PROC', + 'PROCEDURE', + 'PROC', + 'PROD', + 'PROMPT', + 'PURGE_TYPE_AHEAD', + 'PUT', + 'R', + 'RANK', + 'READ', + 'READONLY', + 'READ_AHEAD', + 'READ_CHECK', + 'READ_REGARDLESS', + 'RECORD', + 'RECORD_ID', + 'RECORD_ID_ACCESS', + 'RECORD_ID_TO', + 'RECURSIVE', + 'REFER', + 'REFERENCE', + 'RELEASE', + 'REPEAT', + '%REPLACE', + 'RESCAN', + 'RESIGNAL', + 'RETRIEVAL_POINTERS', + '%RETURN', + 'RETURN', + 'RETURNS', + 'REVERSE', + 'REVERT', + 'REVISION_DATE', + 'REWIND', + 'REWIND_ON_CLOSE', + 'REWIND_ON_OPEN', + 'REWRITE', + 'ROUND', + 'RTRIM', + '%SBTTL', + 'SCALARVARYING', + 'SEARCH', + 'SELECT', + 'SEQUENTIAL', + 'SEQL', + 'SET', + 'SHARED_READ', + 'SHARED_WRITE', + 'SIGN', + 'SIGNAL', + 'SIN', + 'SIND', + 'SINH', + 'SIZE', + 'SKIP', + 'SNAP', + 'SOME', + 'SPACEBLOCK', + 'SPOOL', + 'SQRT', + 'STATEMENT', + 'STATIC', + 'STOP', + 'STORAGE', + 'STREAM', + 'STRING', + 'STRINGRANGE', + 'STRG', + 'STRUCTURE', + 'SUBSCRIPTRANGE', + 'SUBRG', + 'SUBSTR', + 'SUBTRACT', + 'SUM', + 'SUPERCEDE', + 'SYSIN', + 'SYSPRINT', + 'SYSTEM', + 'SYSTEM_PROTECTION', + 'TAB', + 'TAN', + 'TAND', + 'TANH', + 'TEMPORARY', + '%THEN', + 'THEN', + 'TIME', + 'TIMEOUT_PERIOD', + '%TITLE', + 'TITLE', + 'TO', + 'TRANSLATE', + 'TRIM', + 'TRUNC', + 'TRUNCATE', + 'UNALIGNED', + 'UNAL', + 'UNDEFINED', + 'UNDF', + 'UNDERFLOW', + 'UFL', + 'UNION', + 'UNSPEC', + 'UNTIL', + 'UPDATE', + 'USER_OPEN', + 'VALID', + 'VALUE', + 'VAL', + 'VARIABLE', + 'VARIANT', + 'VARYING', + 'VAR', + 'VAXCONDITION', + 'VERIFY', + 'WAIT_FOR_RECORD', + '%WARN', + 'WARN', + 'WHEN', + 'WHILE', + 'WORLD_PROTECTION', + 'WRITE', + 'WRITE_BEHIND', + 'WRITE_CHECK', + 'X', + 'ZERODIVIDE', + ], + + 'SQL' => [ + 'abort', + 'abs', + 'absolute', + 'access', + 'action', + 'ada', + 'add', + 'admin', + 'after', + 'aggregate', + 'alias', + 'all', + 'allocate', + 'alter', + 'analyse', + 'analyze', + 'and', + 'any', + 'are', + 'array', + 'as', + 'asc', + 'asensitive', + 'assertion', + 'assignment', + 'asymmetric', + 'at', + 'atomic', + 'authorization', + 'avg', + 'backward', + 'before', + 'begin', + 'between', + 'bigint', + 'binary', + 'bit', + 'bitvar', + 'bit_length', + 'blob', + 'boolean', + 'both', + 'breadth', + 'by', + 'c', + 'cache', + 'call', + 'called', + 'cardinality', + 'cascade', + 'cascaded', + 'case', + 'cast', + 'catalog', + 'catalog_name', + 'chain', + 'char', + 'character', + 'characteristics', + 'character_length', + 'character_set_catalog', + 'character_set_name', + 'character_set_schema', + 'char_length', + 'check', + 'checked', + 'checkpoint', /* "class", */ + 'class_origin', + 'clob', + 'close', + 'cluster', + 'coalesce', + 'cobol', + 'collate', + 'collation', + 'collation_catalog', + 'collation_name', + 'collation_schema', + 'column', + 'column_name', + 'command_function', + 'command_function_code', + 'comment', + 'commit', + 'committed', + 'completion', + 'condition_number', + 'connect', + 'connection', + 'connection_name', + 'constraint', + 'constraints', + 'constraint_catalog', + 'constraint_name', + 'constraint_schema', + 'constructor', + 'contains', + 'continue', + 'conversion', + 'convert', + 'copy', + 'corresponding', + 'count', + 'create', + 'createdb', + 'createuser', + 'cross', + 'cube', + 'current', + 'current_date', + 'current_path', + 'current_role', + 'current_time', + 'current_timestamp', + 'current_user', + 'cursor', + 'cursor_name', + 'cycle', + 'data', + 'database', + 'date', + 'datetime_interval_code', + 'datetime_interval_precision', + 'day', + 'deallocate', + 'dec', + 'decimal', + 'declare', + 'default', + 'defaults', + 'deferrable', + 'deferred', + 'defined', + 'definer', + 'delete', + 'delimiter', + 'delimiters', + 'depth', + 'deref', + 'desc', + 'describe', + 'descriptor', + 'destroy', + 'destructor', + 'deterministic', + 'diagnostics', + 'dictionary', + 'disconnect', + 'dispatch', + 'distinct', + 'do', + 'domain', + 'double', + 'drop', + 'dynamic', + 'dynamic_function', + 'dynamic_function_code', + 'each', + 'else', + 'encoding', + 'encrypted', + 'end', + 'end-exec', + 'equals', + 'escape', + 'every', + 'except', + 'exception', + 'excluding', + 'exclusive', + 'exec', + 'execute', + 'existing', + 'exists', + 'explain', + 'external', + 'extract', + 'false', + 'fetch', + 'final', + 'first', + 'float', + 'for', + 'force', + 'foreign', + 'fortran', + 'forward', + 'found', + 'free', + 'freeze', + 'from', + 'full', + 'function', + 'g', + 'general', + 'generated', + 'get', + 'global', + 'go', + 'goto', + 'grant', + 'granted', + 'group', + 'grouping', + 'handler', + 'having', + 'hierarchy', + 'hold', + 'host', + 'hour', + 'identity', + 'ignore', + 'ilike', + 'immediate', + 'immutable', + 'implementation', + 'implicit', + 'in', + 'including', + 'increment', + 'index', + 'indicator', + 'infix', + 'inherits', + 'initialize', + 'initially', + 'inner', + 'inout', + 'input', + 'insensitive', + 'insert', + 'instance', + 'instantiable', + 'instead', + 'int', + 'integer', + 'intersect', + 'interval', + 'into', + 'invoker', + 'is', + 'isnull', + 'isolation', + 'iterate', + 'join', + 'k', + 'key', + 'key_member', + 'key_type', + 'lancompiler', + 'language', + 'large', + 'last', + 'lateral', + 'leading', + 'left', + 'length', + 'less', + 'level', + 'like', + 'limit', + 'listen', + 'load', + 'local', + 'localtime', + 'localtimestamp', + 'location', + 'locator', + 'lock', + 'lower', + 'm', + 'map', + 'match', + 'max', + 'maxvalue', + 'message_length', + 'message_octet_length', + 'message_text', + 'method', + 'min', + 'minute', + 'minvalue', + 'mod', + 'mode', + 'modifies', + 'modify', + 'module', + 'month', + 'more', + 'move', + 'mumps', + 'name', + 'names', + 'national', + 'natural', + 'nchar', + 'nclob', + 'new', + 'next', + 'no', + 'nocreatedb', + 'nocreateuser', + 'none', + 'not', + 'nothing', + 'notify', + 'notnull', + 'null', + 'nullable', + 'nullif', + 'number', + 'numeric', + 'object', + 'octet_length', + 'of', + 'off', + 'offset', + 'oids', + 'old', + 'on', + 'only', + 'open', + 'operation', + 'operator', + 'option', + 'options', + 'or', + 'order', + 'ordinality', + 'out', + 'outer', + 'output', + 'overlaps', + 'overlay', + 'overriding', + 'owner', + 'pad', + 'parameter', + 'parameters', + 'parameter_mode', + 'parameter_name', + 'parameter_ordinal_position', + 'parameter_specific_catalog', + 'parameter_specific_name', + 'parameter_specific_schema', + 'partial', + 'pascal', + 'password', + 'path', + 'pendant', + 'placing', + 'pli', + 'position', + 'postfix', + 'precision', + 'prefix', + 'preorder', + 'prepare', + 'preserve', + 'primary', + 'prior', + 'privileges', + 'procedural', + 'procedure', + 'public', + 'read', + 'reads', + 'real', + 'recheck', + 'recursive', + 'ref', + 'references', + 'referencing', + 'reindex', + 'relative', + 'rename', + 'repeatable', + 'replace', + 'reset', + 'restart', + 'restrict', + 'result', + 'return', + 'returned_length', + 'returned_octet_length', + 'returned_sqlstate', + 'returns', + 'revoke', + 'right', + 'role', + 'rollback', + 'rollup', + 'routine', + 'routine_catalog', + 'routine_name', + 'routine_schema', + 'row', + 'rows', + 'row_count', + 'rule', + 'savepoint', + 'scale', + 'schema', + 'schema_name', + 'scope', + 'scroll', + 'search', + 'second', + 'section', + 'security', + 'select', + 'self', + 'sensitive', + 'sequence', + 'serializable', + 'server_name', + 'session', + 'session_user', + 'set', + 'setof', + 'sets', + 'share', + 'show', + 'similar', + 'simple', + 'size', + 'smallint', + 'some', + 'source', + 'space', + 'specific', + 'specifictype', + 'specific_name', + 'sql', + 'sqlcode', + 'sqlerror', + 'sqlexception', + 'sqlstate', + 'sqlwarning', + 'stable', + 'start', + 'state', + 'statement', + 'static', + 'statistics', + 'stdin', + 'stdout', + 'storage', + 'strict', + 'structure', + 'style', + 'subclass_origin', + 'sublist', + 'substring', + 'sum', + 'symmetric', + 'sysid', + 'system', + 'system_user', + 'table', + 'table_name', + 'temp', + 'template', + 'temporary', + 'terminate', + 'text', + 'than', + 'then', + 'time', + 'timestamp', + 'timezone_hour', + 'timezone_minute', + 'to', + 'toast', + 'trailing', + 'transaction', + 'transactions_committed', + 'transactions_rolled_back', + 'transaction_active', + 'transform', + 'transforms', + 'translate', + 'translation', + 'treat', + 'trigger', + 'trigger_catalog', + 'trigger_name', + 'trigger_schema', + 'trim', + 'true', + 'truncate', + 'trusted', + 'type', + 'uncommitted', + 'under', + 'unencrypted', + 'union', + 'unique', + 'unknown', + 'unlisten', + 'unnamed', + 'unnest', + 'until', + 'update', + 'upper', + 'usage', + 'user', + 'user_defined_type_catalog', + 'user_defined_type_name', + 'user_defined_type_schema', + 'using', + 'vacuum', + 'valid', + 'validator', + 'value', + 'values', + 'varchar', + 'variable', + 'varying', + 'verbose', + 'version', + 'view', + 'volatile', + 'when', + 'whenever', + 'where', + 'with', + 'without', + 'work', + 'write', + 'year', + 'zone', + ], - $text = array_key_exists($language, $preproc) ? - $preproc_replace($preproc[$language], $text) : - $text; - $text = array_key_exists($language, $keywords) ? - $keyword_replace($keywords[$language], $text, $ncs) : - $text; - - return $text; - }; - - $rtrim1 = function ($span, $lang, $ch) use ($syntax_highlight_helper) { - return $syntax_highlight_helper(substr($span, 0, -1), $lang); - }; - - $rtrim1_htmlesc = function ($span, $lang, $ch) { - return htmlspecialchars(substr($span, 0, -1)); - }; - - $sch_rtrim1 = function ($span, $lang, $ch) use ($sch_syntax_helper) { - return $sch_syntax_helper(substr($span, 0, -1)); - }; - - $rtrim2 = function ($span, $lang, $ch) { - return substr($span, 0, -2); - }; - - $syn_proc = function ($span, $lang, $ch) use ($syntax_highlight_helper) { - return $syntax_highlight_helper($span, $lang); - }; - - $dash_putback = function ($span, $lang, $ch) use ($syntax_highlight_helper) { - return $syntax_highlight_helper('-' . $span, $lang); - }; - - $slash_putback = function ($span, $lang, $ch) use ($syntax_highlight_helper) { - return $syntax_highlight_helper('/' . $span, $lang); - }; - - $slash_putback_rtrim1 = function ($span, $lang, $ch) use ($rtrim1) { - return $rtrim1('/' . $span, $lang, $ch); - }; - - $lparen_putback = function ($span, $lang, $ch) use ($syntax_highlight_helper) { - return $syntax_highlight_helper('(' . $span, $lang); - }; - - $lparen_putback_rtrim1 = function ($span, $lang, $ch) use ($rtrim1) { - return $rtrim1('(' . $span, $lang, $ch); - }; - - $prepend_xml_opentag = function ($span, $lang, $ch) { - return '<span class="xml_tag"><' . $span; - }; - - $proc_void = function ($span, $lang, $ch) { - return $span; - }; - - $this->sch[self::SCH_NORMAL][0] = self::SCH_NORMAL; - $this->sch[self::SCH_NORMAL]['"'] = self::SCH_STRLIT; - $this->sch[self::SCH_NORMAL]['#'] = self::SCH_CHRLIT; - $this->sch[self::SCH_NORMAL]['0'] = self::SCH_NUMLIT; - $this->sch[self::SCH_NORMAL]['1'] = self::SCH_NUMLIT; - $this->sch[self::SCH_NORMAL]['2'] = self::SCH_NUMLIT; - $this->sch[self::SCH_NORMAL]['3'] = self::SCH_NUMLIT; - $this->sch[self::SCH_NORMAL]['4'] = self::SCH_NUMLIT; - $this->sch[self::SCH_NORMAL]['5'] = self::SCH_NUMLIT; - $this->sch[self::SCH_NORMAL]['6'] = self::SCH_NUMLIT; - $this->sch[self::SCH_NORMAL]['7'] = self::SCH_NUMLIT; - $this->sch[self::SCH_NORMAL]['8'] = self::SCH_NUMLIT; - $this->sch[self::SCH_NORMAL]['9'] = self::SCH_NUMLIT; - - $this->sch[self::SCH_STRLIT]['"'] = self::SCH_NORMAL; - $this->sch[self::SCH_STRLIT]["\n"] = self::SCH_NORMAL; - $this->sch[self::SCH_STRLIT]["\\"] = self::SCH_STRESC; - $this->sch[self::SCH_STRLIT][0] = self::SCH_STRLIT; - - $this->sch[self::SCH_CHRLIT][' '] = self::SCH_NORMAL; - $this->sch[self::SCH_CHRLIT]["\t"] = self::SCH_NORMAL; - $this->sch[self::SCH_CHRLIT]["\n"] = self::SCH_NORMAL; - $this->sch[self::SCH_CHRLIT]["\r"] = self::SCH_NORMAL; - $this->sch[self::SCH_CHRLIT][0] = self::SCH_CHRLIT; - - $this->sch[self::SCH_NUMLIT][' '] = self::SCH_NORMAL; - $this->sch[self::SCH_NUMLIT]["\t"] = self::SCH_NORMAL; - $this->sch[self::SCH_NUMLIT]["\n"] = self::SCH_NORMAL; - $this->sch[self::SCH_NUMLIT]["\r"] = self::SCH_NORMAL; - $this->sch[self::SCH_NUMLIT][0] = self::SCH_NUMLIT; - - // - // State transitions for C - // - $this->c89[self::NORMAL_TEXT]['"'] = self::DQ_LITERAL; - $this->c89[self::NORMAL_TEXT]["'"] = self::SQ_LITERAL; - $this->c89[self::NORMAL_TEXT]['/'] = self::SLASH_BEGIN; - $this->c89[self::NORMAL_TEXT][0] = self::NORMAL_TEXT; - - $this->c89[self::DQ_LITERAL]['"'] = self::NORMAL_TEXT; - $this->c89[self::DQ_LITERAL]["\n"] = self::NORMAL_TEXT; - $this->c89[self::DQ_LITERAL]["\\"] = self::DQ_ESCAPE; - $this->c89[self::DQ_LITERAL][0] = self::DQ_LITERAL; - - $this->c89[self::DQ_ESCAPE][0] = self::DQ_LITERAL; - - $this->c89[self::SQ_LITERAL]["'"] = self::NORMAL_TEXT; - $this->c89[self::SQ_LITERAL]["\n"] = self::NORMAL_TEXT; - $this->c89[self::SQ_LITERAL]["\\"] = self::SQ_ESCAPE; - $this->c89[self::SQ_LITERAL][0] = self::SQ_LITERAL; - - $this->c89[self::SQ_ESCAPE][0] = self::SQ_LITERAL; - - $this->c89[self::SLASH_BEGIN]['*'] = self::STAR_COMMENT; - $this->c89[self::SLASH_BEGIN][0] = self::NORMAL_TEXT; - - $this->c89[self::STAR_COMMENT]['*'] = self::STAR_END; - $this->c89[self::STAR_COMMENT][0] = self::STAR_COMMENT; - - $this->c89[self::STAR_END]['/'] = self::NORMAL_TEXT; - $this->c89[self::STAR_END]['*'] = self::STAR_END; - $this->c89[self::STAR_END][0] = self::STAR_COMMENT; - - // - // State transitions for C++ - // Inherit transitions from C, and add line comment support - // - $this->cpp = $this->c89; - $this->cpp[self::SLASH_BEGIN]['/'] = self::LINE_COMMENT; - $this->cpp[self::LINE_COMMENT]["\n"] = self::NORMAL_TEXT; - $this->cpp[self::LINE_COMMENT]["\\"] = self::LC_ESCAPE; - $this->cpp[self::LINE_COMMENT][0] = self::LINE_COMMENT; - - $this->cpp[self::LC_ESCAPE]["\r"] = self::LC_ESCAPE; - $this->cpp[self::LC_ESCAPE][0] = self::LINE_COMMENT; - - // - // State transitions for C99. - // C99 supports line comments like C++ - // - $this->c99 = $this->cpp; - - // State transitions for PL/I - // Kinda like C - $this->pli = $this->c89; - - // - // State transitions for PHP - // Inherit transitions from C++, and add perl-style line comment support - $this->php = $this->cpp; - $this->php[self::NORMAL_TEXT]['#'] = self::LINE_COMMENT; - $this->php[self::SQ_LITERAL]["\n"] = self::SQ_LITERAL; - $this->php[self::DQ_LITERAL]["\n"] = self::DQ_LITERAL; - - // - // State transitions for Perl - $this->perl[self::NORMAL_TEXT]['#'] = self::LINE_COMMENT; - $this->perl[self::NORMAL_TEXT]['"'] = self::DQ_LITERAL; - $this->perl[self::NORMAL_TEXT]["'"] = self::SQ_LITERAL; - $this->perl[self::NORMAL_TEXT][0] = self::NORMAL_TEXT; - - $this->perl[self::DQ_LITERAL]['"'] = self::NORMAL_TEXT; - $this->perl[self::DQ_LITERAL]["\\"] = self::DQ_ESCAPE; - $this->perl[self::DQ_LITERAL][0] = self::DQ_LITERAL; - - $this->perl[self::DQ_ESCAPE][0] = self::DQ_LITERAL; - - $this->perl[self::SQ_LITERAL]["'"] = self::NORMAL_TEXT; - $this->perl[self::SQ_LITERAL]["\\"] = self::SQ_ESCAPE; - $this->perl[self::SQ_LITERAL][0] = self::SQ_LITERAL; - - $this->perl[self::SQ_ESCAPE][0] = self::SQ_LITERAL; - - $this->perl[self::LINE_COMMENT]["\n"] = self::NORMAL_TEXT; - $this->perl[self::LINE_COMMENT][0] = self::LINE_COMMENT; - - $this->mirc[self::NORMAL_TEXT]['"'] = self::DQ_LITERAL; - $this->mirc[self::NORMAL_TEXT][';'] = self::LINE_COMMENT; - $this->mirc[self::NORMAL_TEXT][0] = self::NORMAL_TEXT; - - $this->mirc[self::DQ_LITERAL]['"'] = self::NORMAL_TEXT; - $this->mirc[self::DQ_LITERAL]["\\"] = self::DQ_ESCAPE; - $this->mirc[self::DQ_LITERAL][0] = self::DQ_LITERAL; - - $this->mirc[self::DQ_ESCAPE][0] = self::DQ_LITERAL; - - $this->mirc[self::LINE_COMMENT]["\n"] = self::NORMAL_TEXT; - $this->mirc[self::LINE_COMMENT][0] = self::LINE_COMMENT; - - $this->ruby = $this->perl; - - $this->python = $this->perl; - - $this->java = $this->cpp; - - $this->vb = $this->perl; - $this->vb[self::NORMAL_TEXT]['#'] = self::NORMAL_TEXT; - $this->vb[self::NORMAL_TEXT]["'"] = self::LINE_COMMENT; - - $this->cs = $this->java; - - $this->pascal = $this->c89; - $this->pascal[self::NORMAL_TEXT]['('] = self::PAREN_BEGIN; - $this->pascal[self::NORMAL_TEXT]['/'] = self::SLASH_BEGIN; - $this->pascal[self::NORMAL_TEXT]['{'] = self::BLOCK_COMMENT; - - $this->pascal[self::PAREN_BEGIN]['*'] = self::STAR_COMMENT; - $this->pascal[self::PAREN_BEGIN]["'"] = self::SQ_LITERAL; - $this->pascal[self::PAREN_BEGIN]['"'] = self::DQ_LITERAL; - $this->pascal[self::PAREN_BEGIN][0] = self::NORMAL_TEXT; - - $this->pascal[self::SLASH_BEGIN]["'"] = self::SQ_LITERAL; - $this->pascal[self::SLASH_BEGIN]['"'] = self::DQ_LITERAL; - $this->pascal[self::SLASH_BEGIN]['/'] = self::LINE_COMMENT; - $this->pascal[self::SLASH_BEGIN][0] = self::NORMAL_TEXT; - - $this->pascal[self::STAR_COMMENT]['*'] = self::STAR_END; - $this->pascal[self::STAR_COMMENT][0] = self::STAR_COMMENT; - - $this->pascal[self::BLOCK_COMMENT]['}'] = self::NORMAL_TEXT; - $this->pascal[self::BLOCK_COMMENT][0] = self::BLOCK_COMMENT; - - $this->pascal[self::LINE_COMMENT]["\n"] = self::NORMAL_TEXT; - $this->pascal[self::LINE_COMMENT][0] = self::LINE_COMMENT; - - $this->pascal[self::STAR_END][')'] = self::NORMAL_TEXT; - $this->pascal[self::STAR_END]['*'] = self::STAR_END; - $this->pascal[self::STAR_END][0] = self::STAR_COMMENT; - - $this->sql[self::NORMAL_TEXT]['"'] = self::DQ_LITERAL; - $this->sql[self::NORMAL_TEXT]["'"] = self::SQ_LITERAL; - $this->sql[self::NORMAL_TEXT]['`'] = self::BT_LITERAL; - $this->sql[self::NORMAL_TEXT]['-'] = self::DASH_BEGIN; - $this->sql[self::NORMAL_TEXT][0] = self::NORMAL_TEXT; - - $this->sql[self::DQ_LITERAL]['"'] = self::NORMAL_TEXT; - $this->sql[self::DQ_LITERAL]['\\'] = self::DQ_ESCAPE; - $this->sql[self::DQ_LITERAL][0] = self::DQ_LITERAL; - - $this->sql[self::SQ_LITERAL]["'"] = self::NORMAL_TEXT; - $this->sql[self::SQ_LITERAL]['\\'] = self::SQ_ESCAPE; - $this->sql[self::SQ_LITERAL][0] = self::SQ_LITERAL; - - $this->sql[self::BT_LITERAL]['`'] = self::NORMAL_TEXT; - $this->sql[self::BT_LITERAL]['\\'] = self::BT_ESCAPE; - $this->sql[self::BT_LITERAL][0] = self::BT_LITERAL; - - $this->sql[self::DQ_ESCAPE][0] = self::DQ_LITERAL; - $this->sql[self::SQ_ESCAPE][0] = self::SQ_LITERAL; - $this->sql[self::BT_ESCAPE][0] = self::BT_LITERAL; - - $this->sql[self::DASH_BEGIN]['-'] = self::LINE_COMMENT; - $this->sql[self::DASH_BEGIN][0] = self::NORMAL_TEXT; - - $this->sql[self::LINE_COMMENT]["\n"] = self::NORMAL_TEXT; - $this->sql[self::LINE_COMMENT]["\\"] = self::LC_ESCAPE; - $this->sql[self::LINE_COMMENT][0] = self::LINE_COMMENT; - - $this->sql[self::LC_ESCAPE]["\r"] = self::LC_ESCAPE; - $this->sql[self::LC_ESCAPE][0] = self::LINE_COMMENT; - - $this->xml[self::NORMAL_TEXT]['<'] = self::XML_TAG_BEGIN; - $this->xml[self::NORMAL_TEXT]['&'] = self::HTML_ENTITY; - $this->xml[self::NORMAL_TEXT][0] = self::NORMAL_TEXT; - $this->xml[self::HTML_ENTITY][';'] = self::NORMAL_TEXT; - $this->xml[self::HTML_ENTITY]['<'] = self::XML_TAG_BEGIN; - $this->xml[self::HTML_ENTITY][0] = self::HTML_ENTITY; - $this->xml[self::XML_TAG_BEGIN]['?'] = self::XML_PI; - $this->xml[self::XML_TAG_BEGIN]['!'] = self::LINE_COMMENT; - $this->xml[self::XML_TAG_BEGIN][0] = self::XML_TAG; - $this->xml[self::XML_TAG]['>'] = self::NORMAL_TEXT; - $this->xml[self::XML_TAG]['"'] = self::DQ_LITERAL; - $this->xml[self::XML_TAG]["'"] = self::SQ_LITERAL; - $this->xml[self::XML_TAG][0] = self::XML_TAG; - $this->xml[self::XML_PI]['>'] = self::NORMAL_TEXT; - $this->xml[self::XML_PI][0] = self::XML_TAG; - $this->xml[self::LINE_COMMENT]['>'] = self::NORMAL_TEXT; - $this->xml[self::LINE_COMMENT][0] = self::LINE_COMMENT; - $this->xml[self::DQ_LITERAL]['"'] = self::XML_TAG; - $this->xml[self::DQ_LITERAL]['&'] = self::DQ_ESCAPE; - $this->xml[self::DQ_LITERAL][0] = self::DQ_LITERAL; - $this->xml[self::SQ_LITERAL]["'"] = self::XML_TAG; - $this->xml[self::SQ_LITERAL]['&'] = self::SQ_ESCAPE; - $this->xml[self::SQ_LITERAL][0] = self::SQ_LITERAL; - $this->xml[self::DQ_ESCAPE][';'] = self::DQ_LITERAL; - $this->xml[self::DQ_ESCAPE][0] = self::DQ_ESCAPE; - - // - // Main state transition table - // - $this->states = [ - 'C89' => $this->c89, - 'C' => $this->c99, - 'C++' => $this->cpp, - 'PHP' => $this->php, - 'Perl' => $this->perl, - 'Java' => $this->java, - 'VB' => $this->vb, - 'C#' => $this->cs, - 'Ruby' => $this->ruby, - 'Python' => $this->python, - 'Pascal' => $this->pascal, - 'mIRC' => $this->mirc, - 'PL/I' => $this->pli, - 'SQL' => $this->sql, - 'XML' => $this->xml, - 'Scheme' => $this->sch, ]; - // - // Process functions - // - $this->process['C89'][self::NORMAL_TEXT][self::SQ_LITERAL] = $rtrim1; - $this->process['C89'][self::NORMAL_TEXT][self::DQ_LITERAL] = $rtrim1; - $this->process['C89'][self::NORMAL_TEXT][self::SLASH_BEGIN] = $rtrim1; - $this->process['C89'][self::NORMAL_TEXT][0] = $syn_proc; - - $this->process['C89'][self::SLASH_BEGIN][self::STAR_COMMENT] = $rtrim1; - $this->process['C89'][self::SLASH_BEGIN][0] = $slash_putback; - - $this->process['Scheme'][self::SCH_NORMAL][self::SCH_STRLIT] = $this; - $this->process['Scheme'][self::SCH_NORMAL][self::SCH_CHRLIT] = $this; - $this->process['Scheme'][self::SCH_NORMAL][self::SCH_NUMLIT] = $this; - - $this->process['SQL'][self::NORMAL_TEXT][self::SQ_LITERAL] = $rtrim1; - $this->process['SQL'][self::NORMAL_TEXT][self::DQ_LITERAL] = $rtrim1; - $this->process['SQL'][self::NORMAL_TEXT][self::BT_LITERAL] = $rtrim1; - $this->process['SQL'][self::NORMAL_TEXT][self::DASH_BEGIN] = $rtrim1; - $this->process['SQL'][self::NORMAL_TEXT][0] = $syn_proc; - - $this->process['SQL'][self::DASH_BEGIN][self::LINE_COMMENT] = $rtrim1; - $this->process['SQL'][self::DASH_BEGIN][0] = $dash_putback; - - $this->process['PL/I'] = $this->process['C89']; - - $this->process['C++'] = $this->process['C89']; - $this->process['C++'][self::SLASH_BEGIN][self::LINE_COMMENT] = $rtrim1; - - $this->process['C'] = $this->process['C++']; - - $this->process['PHP'] = $this->process['C++']; - $this->process['PHP'][self::NORMAL_TEXT][self::LINE_COMMENT] = $rtrim1; - - $this->process['Perl'][self::NORMAL_TEXT][self::SQ_LITERAL] = $rtrim1; - $this->process['Perl'][self::NORMAL_TEXT][self::DQ_LITERAL] = $rtrim1; - $this->process['Perl'][self::NORMAL_TEXT][self::LINE_COMMENT] = $rtrim1; - $this->process['Perl'][self::NORMAL_TEXT][0] = $syn_proc; - - $this->process['Ruby'] = $this->process['Perl']; - $this->process['Python'] = $this->process['Perl']; - - $this->process['mIRC'][self::NORMAL_TEXT][self::DQ_LITERAL] = $rtrim1; - $this->process['mIRC'][self::NORMAL_TEXT][self::LINE_COMMENT] = $rtrim1; - $this->process['mIRC'][self::NORMAL_TEXT][0] = $syn_proc; - - $this->process['VB'] = $this->process['Perl']; - - $this->process['Java'] = $this->process['C++']; - - $this->process['C#'] = $this->process['Java']; - - $this->process['Pascal'] = $this->process['C++']; - $this->process['Pascal'][self::NORMAL_TEXT][self::LINE_COMMENT] = $rtrim1; - $this->process['Pascal'][self::NORMAL_TEXT][self::BLOCK_COMMENT] = $rtrim1; - $this->process['Pascal'][self::NORMAL_TEXT][self::PAREN_BEGIN] = $rtrim1; - $this->process['Pascal'][self::SLASH_BEGIN][self::SQ_LITERAL] = $slash_putback_rtrim1; - $this->process['Pascal'][self::SLASH_BEGIN][self::DQ_LITERAL] = $slash_putback_rtrim1; - $this->process['Pascal'][self::SLASH_BEGIN][0] = $slash_putback; - $this->process['Pascal'][self::PAREN_BEGIN][self::SQ_LITERAL] = $lparen_putback_rtrim1; - $this->process['Pascal'][self::PAREN_BEGIN][self::DQ_LITERAL] = $lparen_putback_rtrim1; - $this->process['Pascal'][self::PAREN_BEGIN][self::STAR_COMMENT] = $rtrim1; - $this->process['Pascal'][self::PAREN_BEGIN][0] = $lparen_putback; - - $this->process['XML'][self::NORMAL_TEXT][self::XML_TAG_BEGIN] = $rtrim1; - $this->process['XML'][self::NORMAL_TEXT][self::HTML_ENTITY] = $rtrim1; - $this->process['XML'][self::HTML_ENTITY][self::XML_TAG_BEGIN] = $rtrim1; - $this->process['XML'][self::HTML_ENTITY][0] = $proc_void; - $this->process['XML'][self::XML_TAG_BEGIN][self::XML_TAG] = $prepend_xml_opentag; - $this->process['XML'][self::XML_TAG_BEGIN][self::XML_PI] = $rtrim1; - $this->process['XML'][self::XML_TAG_BEGIN][self::LINE_COMMENT] = $rtrim1; - $this->process['XML'][self::LINE_COMMENT][self::NORMAL_TEXT] = $rtrim1_htmlesc; - $this->process['XML'][self::XML_TAG][self::NORMAL_TEXT] = $rtrim1; - $this->process['XML'][self::XML_TAG][self::DQ_LITERAL] = $rtrim1; - $this->process['XML'][self::DQ_LITERAL][self::XML_TAG] = $rtrim1; - $this->process['XML'][self::DQ_LITERAL][self::DQ_ESCAPE] = $rtrim1; - - $this->process_end['C89'] = $syntax_highlight_helper; - $this->process_end['C++'] = $this->process_end['C89']; - $this->process_end['C'] = $this->process_end['C89']; - $this->process_end['PHP'] = $this->process_end['C89']; - $this->process_end['Perl'] = $this->process_end['C89']; - $this->process_end['Java'] = $this->process_end['C89']; - $this->process_end['VB'] = $this->process_end['C89']; - $this->process_end['C#'] = $this->process_end['C89']; - $this->process_end['Ruby'] = $this->process_end['C89']; - $this->process_end['Python'] = $this->process_end['C89']; - $this->process_end['Pascal'] = $this->process_end['C89']; - $this->process_end['mIRC'] = $this->process_end['C89']; - $this->process_end['PL/I'] = $this->process_end['C89']; - $this->process_end['SQL'] = $this->process_end['C89']; - $this->process_end['Scheme'] = $sch_syntax_helper; - - $this->edges['C89'][self::NORMAL_TEXT . ',' . self::DQ_LITERAL] = '<span class="literal">"'; - $this->edges['C89'][self::NORMAL_TEXT . ',' . self::SQ_LITERAL] = '<span class="literal">\''; - $this->edges['C89'][self::SLASH_BEGIN . ',' . self::STAR_COMMENT] = '<span class="comment">/*'; - $this->edges['C89'][self::DQ_LITERAL . ',' . self::NORMAL_TEXT] = '</span>'; - $this->edges['C89'][self::SQ_LITERAL . ',' . self::NORMAL_TEXT] = '</span>'; - $this->edges['C89'][self::STAR_END . ',' . self::NORMAL_TEXT] = '</span>'; - - $this->edges['Scheme'][self::SCH_NORMAL . ',' . self::SCH_STRLIT] = '<span class="sch_str">"'; - $this->edges['Scheme'][self::SCH_NORMAL . ',' . self::SCH_NUMLIT] = '<span class="sch_num">'; - $this->edges['Scheme'][self::SCH_NORMAL . ',' . self::SCH_CHRLIT] = '<span class="sch_chr">#'; - $this->edges['Scheme'][self::SCH_STRLIT . ',' . self::SCH_NORMAL] = '</span>'; - $this->edges['Scheme'][self::SCH_NUMLIT . ',' . self::SCH_NORMAL] = '</span>'; - $this->edges['Scheme'][self::SCH_CHRLIT . ',' . self::SCH_NORMAL] = '</span>'; - - $this->edges['SQL'][self::NORMAL_TEXT . ',' . self::DQ_LITERAL] = '<span class="literal">"'; - $this->edges['SQL'][self::NORMAL_TEXT . ',' . self::SQ_LITERAL] = '<span class="literal">\''; - $this->edges['SQL'][self::DASH_BEGIN . ',' . self::LINE_COMMENT] = '<span class="comment">--'; - $this->edges['SQL'][self::NORMAL_TEXT . ',' . self::BT_LITERAL] = '`'; - $this->edges['SQL'][self::DQ_LITERAL . ',' . self::NORMAL_TEXT] = '</span>'; - $this->edges['SQL'][self::SQ_LITERAL . ',' . self::NORMAL_TEXT] = '</span>'; - $this->edges['SQL'][self::LINE_COMMENT . ',' . self::NORMAL_TEXT] = '</span>'; - - $this->edges['PL/I'] = $this->edges['C89']; - - $this->edges['C++'] = $this->edges['C89']; - $this->edges['C++'][self::SLASH_BEGIN . ',' . self::LINE_COMMENT] = '<span class="comment">//'; - $this->edges['C++'][self::LINE_COMMENT . ',' . self::NORMAL_TEXT] = '</span>'; - - $this->edges['C'] = $this->edges['C++']; - - $this->edges['PHP'] = $this->edges['C++']; - $this->edges['PHP'][self::NORMAL_TEXT . ',' . self::LINE_COMMENT] = '<span class="comment">#'; - - $this->edges['Perl'][self::NORMAL_TEXT . ',' . self::DQ_LITERAL] = '<span class="literal">"'; - $this->edges['Perl'][self::NORMAL_TEXT . ',' . self::SQ_LITERAL] = '<span class="literal">\''; - $this->edges['Perl'][self::DQ_LITERAL . ',' . self::NORMAL_TEXT] = '</span>'; - $this->edges['Perl'][self::SQ_LITERAL . ',' . self::NORMAL_TEXT] = '</span>'; - $this->edges['Perl'][self::NORMAL_TEXT . ',' . self::LINE_COMMENT] = '<span class="comment">#'; - $this->edges['Perl'][self::LINE_COMMENT . ',' . self::NORMAL_TEXT] = '</span>'; - - $this->edges['Ruby'] = $this->edges['Perl']; - - $this->edges['Python'] = $this->edges['Perl']; - - $this->edges['mIRC'][self::NORMAL_TEXT . ',' . self::DQ_LITERAL] = '<span class="literal">"'; - $this->edges['mIRC'][self::NORMAL_TEXT . ',' . self::LINE_COMMENT] = '<span class="comment">;'; - $this->edges['mIRC'][self::DQ_LITERAL . ',' . self::NORMAL_TEXT] = '</span>'; - $this->edges['mIRC'][self::LINE_COMMENT . ',' . self::NORMAL_TEXT] = '</span>'; - - $this->edges['VB'] = $this->edges['Perl']; - $this->edges['VB'][self::NORMAL_TEXT . ',' . self::LINE_COMMENT] = '<span class="comment">\''; - - $this->edges['Java'] = $this->edges['C++']; - - $this->edges['C#'] = $this->edges['Java']; - - $this->edges['Pascal'] = $this->edges['C89']; - $this->edges['Pascal'][self::PAREN_BEGIN . ',' . self::STAR_COMMENT] = '<span class="comment">(*'; - $this->edges['Pascal'][self::PAREN_BEGIN . ',' . self::DQ_LITERAL] = '<span class="literal">"'; - $this->edges['Pascal'][self::PAREN_BEGIN . ',' . self::SQ_LITERAL] = '<span class="literal">\''; - $this->edges['Pascal'][self::SLASH_BEGIN . ',' . self::DQ_LITERAL] = '<span class="literal">"'; - $this->edges['Pascal'][self::SLASH_BEGIN . ',' . self::SQ_LITERAL] = '<span class="literal">\''; - $this->edges['Pascal'][self::SLASH_BEGIN . ',' . self::LINE_COMMENT] = '<span class="comment">//'; - $this->edges['Pascal'][self::NORMAL_TEXT . ',' . self::BLOCK_COMMENT] = '<span class="comment">{'; - $this->edges['Pascal'][self::LINE_COMMENT . ',' . self::NORMAL_TEXT] = '</span>'; - $this->edges['Pascal'][self::BLOCK_COMMENT . ',' . self::NORMAL_TEXT] = '</span>'; - - $this->edges['XML'][self::NORMAL_TEXT . ',' . self::HTML_ENTITY] = '<span class="html_entity">&'; - $this->edges['XML'][self::HTML_ENTITY . ',' . self::NORMAL_TEXT] = '</span>'; - $this->edges['XML'][self::HTML_ENTITY . ',' . self::XML_TAG_BEGIN] = '</span>'; - $this->edges['XML'][self::XML_TAG . ',' . self::NORMAL_TEXT] = '></span>'; - $this->edges['XML'][self::XML_TAG_BEGIN . ',' . self::XML_PI] = '<span class="xml_pi"><?'; - $this->edges['XML'][self::XML_TAG_BEGIN . ',' . self::LINE_COMMENT] = '<span class="comment"><!'; - $this->edges['XML'][self::LINE_COMMENT . ',' . self::NORMAL_TEXT] = '></span>'; - $this->edges['XML'][self::XML_TAG . ',' . self::DQ_LITERAL] = '<span class="literal">"'; - $this->edges['XML'][self::DQ_LITERAL . ',' . self::XML_TAG] = '"</span>'; - $this->edges['XML'][self::DQ_LITERAL . ',' . self::DQ_ESCAPE] = '<span class="html_entity">&'; - $this->edges['XML'][self::DQ_ESCAPE . ',' . self::DQ_LITERAL] = '</span>'; - $this->edges['XML'][self::XML_TAG . ',' . self::SQ_LITERAL] = '<span class="literal">\''; - $this->edges['XML'][self::SQ_LITERAL . ',' . self::XML_TAG] = '\'</span>'; - $this->edges['XML'][self::SQ_LITERAL . ',' . self::SQ_ESCAPE] = '<span class="html_entity">&'; - $this->edges['XML'][self::SQ_ESCAPE . ',' . self::SQ_LITERAL] = '</span>'; - } - - /** - * Syntax highlight function - * Does the bulk of the syntax highlighting by lexing the input - * string, then calling the helper function to highlight keywords. - * - * @param $text - * @param $language - * @return string - */ - public function syntax_highlight($text, $language) - { - if ($language == 'Plain Text') { - return $text; + $case_insensitive = [ + 'VB' => true, + 'Pascal' => true, + 'PL/I' => true, + 'SQL' => true, + ]; + $ncs = false; + if (array_key_exists($language, $case_insensitive)) { + $ncs = true; } - // - // The State Machine - // - if (array_key_exists($language, $this->initial_state)) { - $state = $this->initial_state[$language]; - } else { - $state = self::NORMAL_TEXT; - } + $text = array_key_exists($language, $preproc) ? + $preproc_replace($preproc[$language], $text) : + $text; + $text = array_key_exists($language, $keywords) ? + $keyword_replace($keywords[$language], $text, $ncs) : + $text; + + return $text; + }; + + $rtrim1 = function ($span, $lang, $ch) use ($syntax_highlight_helper) { + return $syntax_highlight_helper(substr($span, 0, -1), $lang); + }; + + $rtrim1_htmlesc = function ($span, $lang, $ch) { + return htmlspecialchars(substr($span, 0, -1)); + }; + + $sch_rtrim1 = function ($span, $lang, $ch) use ($sch_syntax_helper) { + return $sch_syntax_helper(substr($span, 0, -1)); + }; + + $rtrim2 = function ($span, $lang, $ch) { + return substr($span, 0, -2); + }; + + $syn_proc = function ($span, $lang, $ch) use ($syntax_highlight_helper) { + return $syntax_highlight_helper($span, $lang); + }; + + $dash_putback = function ($span, $lang, $ch) use ($syntax_highlight_helper) { + return $syntax_highlight_helper('-' . $span, $lang); + }; + + $slash_putback = function ($span, $lang, $ch) use ($syntax_highlight_helper) { + return $syntax_highlight_helper('/' . $span, $lang); + }; + + $slash_putback_rtrim1 = function ($span, $lang, $ch) use ($rtrim1) { + return $rtrim1('/' . $span, $lang, $ch); + }; + + $lparen_putback = function ($span, $lang, $ch) use ($syntax_highlight_helper) { + return $syntax_highlight_helper('(' . $span, $lang); + }; + + $lparen_putback_rtrim1 = function ($span, $lang, $ch) use ($rtrim1) { + return $rtrim1('(' . $span, $lang, $ch); + }; + + $prepend_xml_opentag = function ($span, $lang, $ch) { + return '<span class="xml_tag"><' . $span; + }; + + $proc_void = function ($span, $lang, $ch) { + return $span; + }; + + $this->sch[self::SCH_NORMAL][0] = self::SCH_NORMAL; + $this->sch[self::SCH_NORMAL]['"'] = self::SCH_STRLIT; + $this->sch[self::SCH_NORMAL]['#'] = self::SCH_CHRLIT; + $this->sch[self::SCH_NORMAL]['0'] = self::SCH_NUMLIT; + $this->sch[self::SCH_NORMAL]['1'] = self::SCH_NUMLIT; + $this->sch[self::SCH_NORMAL]['2'] = self::SCH_NUMLIT; + $this->sch[self::SCH_NORMAL]['3'] = self::SCH_NUMLIT; + $this->sch[self::SCH_NORMAL]['4'] = self::SCH_NUMLIT; + $this->sch[self::SCH_NORMAL]['5'] = self::SCH_NUMLIT; + $this->sch[self::SCH_NORMAL]['6'] = self::SCH_NUMLIT; + $this->sch[self::SCH_NORMAL]['7'] = self::SCH_NUMLIT; + $this->sch[self::SCH_NORMAL]['8'] = self::SCH_NUMLIT; + $this->sch[self::SCH_NORMAL]['9'] = self::SCH_NUMLIT; + + $this->sch[self::SCH_STRLIT]['"'] = self::SCH_NORMAL; + $this->sch[self::SCH_STRLIT]["\n"] = self::SCH_NORMAL; + $this->sch[self::SCH_STRLIT]['\\'] = self::SCH_STRESC; + $this->sch[self::SCH_STRLIT][0] = self::SCH_STRLIT; + + $this->sch[self::SCH_CHRLIT][' '] = self::SCH_NORMAL; + $this->sch[self::SCH_CHRLIT]["\t"] = self::SCH_NORMAL; + $this->sch[self::SCH_CHRLIT]["\n"] = self::SCH_NORMAL; + $this->sch[self::SCH_CHRLIT]["\r"] = self::SCH_NORMAL; + $this->sch[self::SCH_CHRLIT][0] = self::SCH_CHRLIT; + + $this->sch[self::SCH_NUMLIT][' '] = self::SCH_NORMAL; + $this->sch[self::SCH_NUMLIT]["\t"] = self::SCH_NORMAL; + $this->sch[self::SCH_NUMLIT]["\n"] = self::SCH_NORMAL; + $this->sch[self::SCH_NUMLIT]["\r"] = self::SCH_NORMAL; + $this->sch[self::SCH_NUMLIT][0] = self::SCH_NUMLIT; + + // + // State transitions for C + // + $this->c89[self::NORMAL_TEXT]['"'] = self::DQ_LITERAL; + $this->c89[self::NORMAL_TEXT]["'"] = self::SQ_LITERAL; + $this->c89[self::NORMAL_TEXT]['/'] = self::SLASH_BEGIN; + $this->c89[self::NORMAL_TEXT][0] = self::NORMAL_TEXT; + + $this->c89[self::DQ_LITERAL]['"'] = self::NORMAL_TEXT; + $this->c89[self::DQ_LITERAL]["\n"] = self::NORMAL_TEXT; + $this->c89[self::DQ_LITERAL]['\\'] = self::DQ_ESCAPE; + $this->c89[self::DQ_LITERAL][0] = self::DQ_LITERAL; + + $this->c89[self::DQ_ESCAPE][0] = self::DQ_LITERAL; + + $this->c89[self::SQ_LITERAL]["'"] = self::NORMAL_TEXT; + $this->c89[self::SQ_LITERAL]["\n"] = self::NORMAL_TEXT; + $this->c89[self::SQ_LITERAL]['\\'] = self::SQ_ESCAPE; + $this->c89[self::SQ_LITERAL][0] = self::SQ_LITERAL; + + $this->c89[self::SQ_ESCAPE][0] = self::SQ_LITERAL; + + $this->c89[self::SLASH_BEGIN]['*'] = self::STAR_COMMENT; + $this->c89[self::SLASH_BEGIN][0] = self::NORMAL_TEXT; + + $this->c89[self::STAR_COMMENT]['*'] = self::STAR_END; + $this->c89[self::STAR_COMMENT][0] = self::STAR_COMMENT; + + $this->c89[self::STAR_END]['/'] = self::NORMAL_TEXT; + $this->c89[self::STAR_END]['*'] = self::STAR_END; + $this->c89[self::STAR_END][0] = self::STAR_COMMENT; + + // + // State transitions for C++ + // Inherit transitions from C, and add line comment support + // + $this->cpp = $this->c89; + $this->cpp[self::SLASH_BEGIN]['/'] = self::LINE_COMMENT; + $this->cpp[self::LINE_COMMENT]["\n"] = self::NORMAL_TEXT; + $this->cpp[self::LINE_COMMENT]['\\'] = self::LC_ESCAPE; + $this->cpp[self::LINE_COMMENT][0] = self::LINE_COMMENT; + + $this->cpp[self::LC_ESCAPE]["\r"] = self::LC_ESCAPE; + $this->cpp[self::LC_ESCAPE][0] = self::LINE_COMMENT; + + // + // State transitions for C99. + // C99 supports line comments like C++ + // + $this->c99 = $this->cpp; + + // State transitions for PL/I + // Kinda like C + $this->pli = $this->c89; + + // + // State transitions for PHP + // Inherit transitions from C++, and add perl-style line comment support + $this->php = $this->cpp; + $this->php[self::NORMAL_TEXT]['#'] = self::LINE_COMMENT; + $this->php[self::SQ_LITERAL]["\n"] = self::SQ_LITERAL; + $this->php[self::DQ_LITERAL]["\n"] = self::DQ_LITERAL; + + // + // State transitions for Perl + $this->perl[self::NORMAL_TEXT]['#'] = self::LINE_COMMENT; + $this->perl[self::NORMAL_TEXT]['"'] = self::DQ_LITERAL; + $this->perl[self::NORMAL_TEXT]["'"] = self::SQ_LITERAL; + $this->perl[self::NORMAL_TEXT][0] = self::NORMAL_TEXT; + + $this->perl[self::DQ_LITERAL]['"'] = self::NORMAL_TEXT; + $this->perl[self::DQ_LITERAL]['\\'] = self::DQ_ESCAPE; + $this->perl[self::DQ_LITERAL][0] = self::DQ_LITERAL; + + $this->perl[self::DQ_ESCAPE][0] = self::DQ_LITERAL; + + $this->perl[self::SQ_LITERAL]["'"] = self::NORMAL_TEXT; + $this->perl[self::SQ_LITERAL]['\\'] = self::SQ_ESCAPE; + $this->perl[self::SQ_LITERAL][0] = self::SQ_LITERAL; + + $this->perl[self::SQ_ESCAPE][0] = self::SQ_LITERAL; + + $this->perl[self::LINE_COMMENT]["\n"] = self::NORMAL_TEXT; + $this->perl[self::LINE_COMMENT][0] = self::LINE_COMMENT; + + $this->mirc[self::NORMAL_TEXT]['"'] = self::DQ_LITERAL; + $this->mirc[self::NORMAL_TEXT][';'] = self::LINE_COMMENT; + $this->mirc[self::NORMAL_TEXT][0] = self::NORMAL_TEXT; + + $this->mirc[self::DQ_LITERAL]['"'] = self::NORMAL_TEXT; + $this->mirc[self::DQ_LITERAL]['\\'] = self::DQ_ESCAPE; + $this->mirc[self::DQ_LITERAL][0] = self::DQ_LITERAL; + + $this->mirc[self::DQ_ESCAPE][0] = self::DQ_LITERAL; + + $this->mirc[self::LINE_COMMENT]["\n"] = self::NORMAL_TEXT; + $this->mirc[self::LINE_COMMENT][0] = self::LINE_COMMENT; + + $this->ruby = $this->perl; + + $this->python = $this->perl; + + $this->java = $this->cpp; + + $this->vb = $this->perl; + $this->vb[self::NORMAL_TEXT]['#'] = self::NORMAL_TEXT; + $this->vb[self::NORMAL_TEXT]["'"] = self::LINE_COMMENT; + + $this->cs = $this->java; + + $this->pascal = $this->c89; + $this->pascal[self::NORMAL_TEXT]['('] = self::PAREN_BEGIN; + $this->pascal[self::NORMAL_TEXT]['/'] = self::SLASH_BEGIN; + $this->pascal[self::NORMAL_TEXT]['{'] = self::BLOCK_COMMENT; + + $this->pascal[self::PAREN_BEGIN]['*'] = self::STAR_COMMENT; + $this->pascal[self::PAREN_BEGIN]["'"] = self::SQ_LITERAL; + $this->pascal[self::PAREN_BEGIN]['"'] = self::DQ_LITERAL; + $this->pascal[self::PAREN_BEGIN][0] = self::NORMAL_TEXT; + + $this->pascal[self::SLASH_BEGIN]["'"] = self::SQ_LITERAL; + $this->pascal[self::SLASH_BEGIN]['"'] = self::DQ_LITERAL; + $this->pascal[self::SLASH_BEGIN]['/'] = self::LINE_COMMENT; + $this->pascal[self::SLASH_BEGIN][0] = self::NORMAL_TEXT; + + $this->pascal[self::STAR_COMMENT]['*'] = self::STAR_END; + $this->pascal[self::STAR_COMMENT][0] = self::STAR_COMMENT; + + $this->pascal[self::BLOCK_COMMENT]['}'] = self::NORMAL_TEXT; + $this->pascal[self::BLOCK_COMMENT][0] = self::BLOCK_COMMENT; + + $this->pascal[self::LINE_COMMENT]["\n"] = self::NORMAL_TEXT; + $this->pascal[self::LINE_COMMENT][0] = self::LINE_COMMENT; + + $this->pascal[self::STAR_END][')'] = self::NORMAL_TEXT; + $this->pascal[self::STAR_END]['*'] = self::STAR_END; + $this->pascal[self::STAR_END][0] = self::STAR_COMMENT; + + $this->sql[self::NORMAL_TEXT]['"'] = self::DQ_LITERAL; + $this->sql[self::NORMAL_TEXT]["'"] = self::SQ_LITERAL; + $this->sql[self::NORMAL_TEXT]['`'] = self::BT_LITERAL; + $this->sql[self::NORMAL_TEXT]['-'] = self::DASH_BEGIN; + $this->sql[self::NORMAL_TEXT][0] = self::NORMAL_TEXT; + + $this->sql[self::DQ_LITERAL]['"'] = self::NORMAL_TEXT; + $this->sql[self::DQ_LITERAL]['\\'] = self::DQ_ESCAPE; + $this->sql[self::DQ_LITERAL][0] = self::DQ_LITERAL; + + $this->sql[self::SQ_LITERAL]["'"] = self::NORMAL_TEXT; + $this->sql[self::SQ_LITERAL]['\\'] = self::SQ_ESCAPE; + $this->sql[self::SQ_LITERAL][0] = self::SQ_LITERAL; + + $this->sql[self::BT_LITERAL]['`'] = self::NORMAL_TEXT; + $this->sql[self::BT_LITERAL]['\\'] = self::BT_ESCAPE; + $this->sql[self::BT_LITERAL][0] = self::BT_LITERAL; + + $this->sql[self::DQ_ESCAPE][0] = self::DQ_LITERAL; + $this->sql[self::SQ_ESCAPE][0] = self::SQ_LITERAL; + $this->sql[self::BT_ESCAPE][0] = self::BT_LITERAL; + + $this->sql[self::DASH_BEGIN]['-'] = self::LINE_COMMENT; + $this->sql[self::DASH_BEGIN][0] = self::NORMAL_TEXT; + + $this->sql[self::LINE_COMMENT]["\n"] = self::NORMAL_TEXT; + $this->sql[self::LINE_COMMENT]['\\'] = self::LC_ESCAPE; + $this->sql[self::LINE_COMMENT][0] = self::LINE_COMMENT; + + $this->sql[self::LC_ESCAPE]["\r"] = self::LC_ESCAPE; + $this->sql[self::LC_ESCAPE][0] = self::LINE_COMMENT; + + $this->xml[self::NORMAL_TEXT]['<'] = self::XML_TAG_BEGIN; + $this->xml[self::NORMAL_TEXT]['&'] = self::HTML_ENTITY; + $this->xml[self::NORMAL_TEXT][0] = self::NORMAL_TEXT; + $this->xml[self::HTML_ENTITY][';'] = self::NORMAL_TEXT; + $this->xml[self::HTML_ENTITY]['<'] = self::XML_TAG_BEGIN; + $this->xml[self::HTML_ENTITY][0] = self::HTML_ENTITY; + $this->xml[self::XML_TAG_BEGIN]['?'] = self::XML_PI; + $this->xml[self::XML_TAG_BEGIN]['!'] = self::LINE_COMMENT; + $this->xml[self::XML_TAG_BEGIN][0] = self::XML_TAG; + $this->xml[self::XML_TAG]['>'] = self::NORMAL_TEXT; + $this->xml[self::XML_TAG]['"'] = self::DQ_LITERAL; + $this->xml[self::XML_TAG]["'"] = self::SQ_LITERAL; + $this->xml[self::XML_TAG][0] = self::XML_TAG; + $this->xml[self::XML_PI]['>'] = self::NORMAL_TEXT; + $this->xml[self::XML_PI][0] = self::XML_TAG; + $this->xml[self::LINE_COMMENT]['>'] = self::NORMAL_TEXT; + $this->xml[self::LINE_COMMENT][0] = self::LINE_COMMENT; + $this->xml[self::DQ_LITERAL]['"'] = self::XML_TAG; + $this->xml[self::DQ_LITERAL]['&'] = self::DQ_ESCAPE; + $this->xml[self::DQ_LITERAL][0] = self::DQ_LITERAL; + $this->xml[self::SQ_LITERAL]["'"] = self::XML_TAG; + $this->xml[self::SQ_LITERAL]['&'] = self::SQ_ESCAPE; + $this->xml[self::SQ_LITERAL][0] = self::SQ_LITERAL; + $this->xml[self::DQ_ESCAPE][';'] = self::DQ_LITERAL; + $this->xml[self::DQ_ESCAPE][0] = self::DQ_ESCAPE; + + // + // Main state transition table + // + $this->states = [ + 'C89' => $this->c89, + 'C' => $this->c99, + 'C++' => $this->cpp, + 'PHP' => $this->php, + 'Perl' => $this->perl, + 'Java' => $this->java, + 'VB' => $this->vb, + 'C#' => $this->cs, + 'Ruby' => $this->ruby, + 'Python' => $this->python, + 'Pascal' => $this->pascal, + 'mIRC' => $this->mirc, + 'PL/I' => $this->pli, + 'SQL' => $this->sql, + 'XML' => $this->xml, + 'Scheme' => $this->sch, + ]; + + // + // Process functions + // + $this->process['C89'][self::NORMAL_TEXT][self::SQ_LITERAL] = $rtrim1; + $this->process['C89'][self::NORMAL_TEXT][self::DQ_LITERAL] = $rtrim1; + $this->process['C89'][self::NORMAL_TEXT][self::SLASH_BEGIN] = $rtrim1; + $this->process['C89'][self::NORMAL_TEXT][0] = $syn_proc; + + $this->process['C89'][self::SLASH_BEGIN][self::STAR_COMMENT] = $rtrim1; + $this->process['C89'][self::SLASH_BEGIN][0] = $slash_putback; + + $this->process['Scheme'][self::SCH_NORMAL][self::SCH_STRLIT] = $this; + $this->process['Scheme'][self::SCH_NORMAL][self::SCH_CHRLIT] = $this; + $this->process['Scheme'][self::SCH_NORMAL][self::SCH_NUMLIT] = $this; + + $this->process['SQL'][self::NORMAL_TEXT][self::SQ_LITERAL] = $rtrim1; + $this->process['SQL'][self::NORMAL_TEXT][self::DQ_LITERAL] = $rtrim1; + $this->process['SQL'][self::NORMAL_TEXT][self::BT_LITERAL] = $rtrim1; + $this->process['SQL'][self::NORMAL_TEXT][self::DASH_BEGIN] = $rtrim1; + $this->process['SQL'][self::NORMAL_TEXT][0] = $syn_proc; + + $this->process['SQL'][self::DASH_BEGIN][self::LINE_COMMENT] = $rtrim1; + $this->process['SQL'][self::DASH_BEGIN][0] = $dash_putback; + + $this->process['PL/I'] = $this->process['C89']; + + $this->process['C++'] = $this->process['C89']; + $this->process['C++'][self::SLASH_BEGIN][self::LINE_COMMENT] = $rtrim1; + + $this->process['C'] = $this->process['C++']; + + $this->process['PHP'] = $this->process['C++']; + $this->process['PHP'][self::NORMAL_TEXT][self::LINE_COMMENT] = $rtrim1; + + $this->process['Perl'][self::NORMAL_TEXT][self::SQ_LITERAL] = $rtrim1; + $this->process['Perl'][self::NORMAL_TEXT][self::DQ_LITERAL] = $rtrim1; + $this->process['Perl'][self::NORMAL_TEXT][self::LINE_COMMENT] = $rtrim1; + $this->process['Perl'][self::NORMAL_TEXT][0] = $syn_proc; + + $this->process['Ruby'] = $this->process['Perl']; + $this->process['Python'] = $this->process['Perl']; + + $this->process['mIRC'][self::NORMAL_TEXT][self::DQ_LITERAL] = $rtrim1; + $this->process['mIRC'][self::NORMAL_TEXT][self::LINE_COMMENT] = $rtrim1; + $this->process['mIRC'][self::NORMAL_TEXT][0] = $syn_proc; + + $this->process['VB'] = $this->process['Perl']; + + $this->process['Java'] = $this->process['C++']; + + $this->process['C#'] = $this->process['Java']; + + $this->process['Pascal'] = $this->process['C++']; + $this->process['Pascal'][self::NORMAL_TEXT][self::LINE_COMMENT] = $rtrim1; + $this->process['Pascal'][self::NORMAL_TEXT][self::BLOCK_COMMENT] = $rtrim1; + $this->process['Pascal'][self::NORMAL_TEXT][self::PAREN_BEGIN] = $rtrim1; + $this->process['Pascal'][self::SLASH_BEGIN][self::SQ_LITERAL] = $slash_putback_rtrim1; + $this->process['Pascal'][self::SLASH_BEGIN][self::DQ_LITERAL] = $slash_putback_rtrim1; + $this->process['Pascal'][self::SLASH_BEGIN][0] = $slash_putback; + $this->process['Pascal'][self::PAREN_BEGIN][self::SQ_LITERAL] = $lparen_putback_rtrim1; + $this->process['Pascal'][self::PAREN_BEGIN][self::DQ_LITERAL] = $lparen_putback_rtrim1; + $this->process['Pascal'][self::PAREN_BEGIN][self::STAR_COMMENT] = $rtrim1; + $this->process['Pascal'][self::PAREN_BEGIN][0] = $lparen_putback; + + $this->process['XML'][self::NORMAL_TEXT][self::XML_TAG_BEGIN] = $rtrim1; + $this->process['XML'][self::NORMAL_TEXT][self::HTML_ENTITY] = $rtrim1; + $this->process['XML'][self::HTML_ENTITY][self::XML_TAG_BEGIN] = $rtrim1; + $this->process['XML'][self::HTML_ENTITY][0] = $proc_void; + $this->process['XML'][self::XML_TAG_BEGIN][self::XML_TAG] = $prepend_xml_opentag; + $this->process['XML'][self::XML_TAG_BEGIN][self::XML_PI] = $rtrim1; + $this->process['XML'][self::XML_TAG_BEGIN][self::LINE_COMMENT] = $rtrim1; + $this->process['XML'][self::LINE_COMMENT][self::NORMAL_TEXT] = $rtrim1_htmlesc; + $this->process['XML'][self::XML_TAG][self::NORMAL_TEXT] = $rtrim1; + $this->process['XML'][self::XML_TAG][self::DQ_LITERAL] = $rtrim1; + $this->process['XML'][self::DQ_LITERAL][self::XML_TAG] = $rtrim1; + $this->process['XML'][self::DQ_LITERAL][self::DQ_ESCAPE] = $rtrim1; + + $this->process_end['C89'] = $syntax_highlight_helper; + $this->process_end['C++'] = $this->process_end['C89']; + $this->process_end['C'] = $this->process_end['C89']; + $this->process_end['PHP'] = $this->process_end['C89']; + $this->process_end['Perl'] = $this->process_end['C89']; + $this->process_end['Java'] = $this->process_end['C89']; + $this->process_end['VB'] = $this->process_end['C89']; + $this->process_end['C#'] = $this->process_end['C89']; + $this->process_end['Ruby'] = $this->process_end['C89']; + $this->process_end['Python'] = $this->process_end['C89']; + $this->process_end['Pascal'] = $this->process_end['C89']; + $this->process_end['mIRC'] = $this->process_end['C89']; + $this->process_end['PL/I'] = $this->process_end['C89']; + $this->process_end['SQL'] = $this->process_end['C89']; + $this->process_end['Scheme'] = $sch_syntax_helper; + + $this->edges['C89'][self::NORMAL_TEXT . ',' . self::DQ_LITERAL] = '<span class="literal">"'; + $this->edges['C89'][self::NORMAL_TEXT . ',' . self::SQ_LITERAL] = '<span class="literal">\''; + $this->edges['C89'][self::SLASH_BEGIN . ',' . self::STAR_COMMENT] = '<span class="comment">/*'; + $this->edges['C89'][self::DQ_LITERAL . ',' . self::NORMAL_TEXT] = '</span>'; + $this->edges['C89'][self::SQ_LITERAL . ',' . self::NORMAL_TEXT] = '</span>'; + $this->edges['C89'][self::STAR_END . ',' . self::NORMAL_TEXT] = '</span>'; + + $this->edges['Scheme'][self::SCH_NORMAL . ',' . self::SCH_STRLIT] = '<span class="sch_str">"'; + $this->edges['Scheme'][self::SCH_NORMAL . ',' . self::SCH_NUMLIT] = '<span class="sch_num">'; + $this->edges['Scheme'][self::SCH_NORMAL . ',' . self::SCH_CHRLIT] = '<span class="sch_chr">#'; + $this->edges['Scheme'][self::SCH_STRLIT . ',' . self::SCH_NORMAL] = '</span>'; + $this->edges['Scheme'][self::SCH_NUMLIT . ',' . self::SCH_NORMAL] = '</span>'; + $this->edges['Scheme'][self::SCH_CHRLIT . ',' . self::SCH_NORMAL] = '</span>'; + + $this->edges['SQL'][self::NORMAL_TEXT . ',' . self::DQ_LITERAL] = '<span class="literal">"'; + $this->edges['SQL'][self::NORMAL_TEXT . ',' . self::SQ_LITERAL] = '<span class="literal">\''; + $this->edges['SQL'][self::DASH_BEGIN . ',' . self::LINE_COMMENT] = '<span class="comment">--'; + $this->edges['SQL'][self::NORMAL_TEXT . ',' . self::BT_LITERAL] = '`'; + $this->edges['SQL'][self::DQ_LITERAL . ',' . self::NORMAL_TEXT] = '</span>'; + $this->edges['SQL'][self::SQ_LITERAL . ',' . self::NORMAL_TEXT] = '</span>'; + $this->edges['SQL'][self::LINE_COMMENT . ',' . self::NORMAL_TEXT] = '</span>'; + + $this->edges['PL/I'] = $this->edges['C89']; + + $this->edges['C++'] = $this->edges['C89']; + $this->edges['C++'][self::SLASH_BEGIN . ',' . self::LINE_COMMENT] = '<span class="comment">//'; + $this->edges['C++'][self::LINE_COMMENT . ',' . self::NORMAL_TEXT] = '</span>'; + + $this->edges['C'] = $this->edges['C++']; + + $this->edges['PHP'] = $this->edges['C++']; + $this->edges['PHP'][self::NORMAL_TEXT . ',' . self::LINE_COMMENT] = '<span class="comment">#'; + + $this->edges['Perl'][self::NORMAL_TEXT . ',' . self::DQ_LITERAL] = '<span class="literal">"'; + $this->edges['Perl'][self::NORMAL_TEXT . ',' . self::SQ_LITERAL] = '<span class="literal">\''; + $this->edges['Perl'][self::DQ_LITERAL . ',' . self::NORMAL_TEXT] = '</span>'; + $this->edges['Perl'][self::SQ_LITERAL . ',' . self::NORMAL_TEXT] = '</span>'; + $this->edges['Perl'][self::NORMAL_TEXT . ',' . self::LINE_COMMENT] = '<span class="comment">#'; + $this->edges['Perl'][self::LINE_COMMENT . ',' . self::NORMAL_TEXT] = '</span>'; + + $this->edges['Ruby'] = $this->edges['Perl']; + + $this->edges['Python'] = $this->edges['Perl']; + + $this->edges['mIRC'][self::NORMAL_TEXT . ',' . self::DQ_LITERAL] = '<span class="literal">"'; + $this->edges['mIRC'][self::NORMAL_TEXT . ',' . self::LINE_COMMENT] = '<span class="comment">;'; + $this->edges['mIRC'][self::DQ_LITERAL . ',' . self::NORMAL_TEXT] = '</span>'; + $this->edges['mIRC'][self::LINE_COMMENT . ',' . self::NORMAL_TEXT] = '</span>'; + + $this->edges['VB'] = $this->edges['Perl']; + $this->edges['VB'][self::NORMAL_TEXT . ',' . self::LINE_COMMENT] = '<span class="comment">\''; + + $this->edges['Java'] = $this->edges['C++']; + + $this->edges['C#'] = $this->edges['Java']; + + $this->edges['Pascal'] = $this->edges['C89']; + $this->edges['Pascal'][self::PAREN_BEGIN . ',' . self::STAR_COMMENT] = '<span class="comment">(*'; + $this->edges['Pascal'][self::PAREN_BEGIN . ',' . self::DQ_LITERAL] = '<span class="literal">"'; + $this->edges['Pascal'][self::PAREN_BEGIN . ',' . self::SQ_LITERAL] = '<span class="literal">\''; + $this->edges['Pascal'][self::SLASH_BEGIN . ',' . self::DQ_LITERAL] = '<span class="literal">"'; + $this->edges['Pascal'][self::SLASH_BEGIN . ',' . self::SQ_LITERAL] = '<span class="literal">\''; + $this->edges['Pascal'][self::SLASH_BEGIN . ',' . self::LINE_COMMENT] = '<span class="comment">//'; + $this->edges['Pascal'][self::NORMAL_TEXT . ',' . self::BLOCK_COMMENT] = '<span class="comment">{'; + $this->edges['Pascal'][self::LINE_COMMENT . ',' . self::NORMAL_TEXT] = '</span>'; + $this->edges['Pascal'][self::BLOCK_COMMENT . ',' . self::NORMAL_TEXT] = '</span>'; + + $this->edges['XML'][self::NORMAL_TEXT . ',' . self::HTML_ENTITY] = '<span class="html_entity">&'; + $this->edges['XML'][self::HTML_ENTITY . ',' . self::NORMAL_TEXT] = '</span>'; + $this->edges['XML'][self::HTML_ENTITY . ',' . self::XML_TAG_BEGIN] = '</span>'; + $this->edges['XML'][self::XML_TAG . ',' . self::NORMAL_TEXT] = '></span>'; + $this->edges['XML'][self::XML_TAG_BEGIN . ',' . self::XML_PI] = '<span class="xml_pi"><?'; + $this->edges['XML'][self::XML_TAG_BEGIN . ',' . self::LINE_COMMENT] = '<span class="comment"><!'; + $this->edges['XML'][self::LINE_COMMENT . ',' . self::NORMAL_TEXT] = '></span>'; + $this->edges['XML'][self::XML_TAG . ',' . self::DQ_LITERAL] = '<span class="literal">"'; + $this->edges['XML'][self::DQ_LITERAL . ',' . self::XML_TAG] = '"</span>'; + $this->edges['XML'][self::DQ_LITERAL . ',' . self::DQ_ESCAPE] = '<span class="html_entity">&'; + $this->edges['XML'][self::DQ_ESCAPE . ',' . self::DQ_LITERAL] = '</span>'; + $this->edges['XML'][self::XML_TAG . ',' . self::SQ_LITERAL] = '<span class="literal">\''; + $this->edges['XML'][self::SQ_LITERAL . ',' . self::XML_TAG] = '\'</span>'; + $this->edges['XML'][self::SQ_LITERAL . ',' . self::SQ_ESCAPE] = '<span class="html_entity">&'; + $this->edges['XML'][self::SQ_ESCAPE . ',' . self::SQ_LITERAL] = '</span>'; + } - $output = ''; - $span = ''; - while (strlen($text) > 0) { - $ch = substr($text, 0, 1); - $text = substr($text, 1); - - $oldstate = $state; - $state = array_key_exists($ch, $this->states[$language][$state]) ? - $this->states[$language][$state][$ch] : - $this->states[$language][$state][0]; - - $span .= $ch; - - if ($oldstate != $state) { - if (array_key_exists($language, $this->process) && - array_key_exists($oldstate, $this->process[$language])) { - if (array_key_exists($state, $this->process[$language][$oldstate])) { - $pf = $this->process[$language][$oldstate][$state]; - $output .= $pf($span, $language, $ch); - } else { - $pf = $this->process[$language][$oldstate][0]; - $output .= $pf($span, $language, $ch); - } - } else { - $output .= $span; - } + /** + * Syntax highlight function + * Does the bulk of the syntax highlighting by lexing the input + * string, then calling the helper function to highlight keywords. + * + * @param $text + * @param $language + * @return string + */ + public function syntax_highlight($text, $language) + { + if ($language == 'Plain Text') { + return $text; + } - if (array_key_exists($language, $this->edges) && - array_key_exists("$oldstate,$state", $this->edges[$language])) { - $output .= $this->edges[$language]["$oldstate,$state"]; - } + // + // The State Machine + // + if (array_key_exists($language, $this->initial_state)) { + $state = $this->initial_state[$language]; + } else { + $state = self::NORMAL_TEXT; + } - $span = ''; + $output = ''; + $span = ''; + while (strlen($text) > 0) { + $ch = substr($text, 0, 1); + $text = substr($text, 1); + + $oldstate = $state; + $state = array_key_exists($ch, $this->states[$language][$state]) ? + $this->states[$language][$state][$ch] : + $this->states[$language][$state][0]; + + $span .= $ch; + + if ($oldstate != $state) { + if (array_key_exists($language, $this->process) && + array_key_exists($oldstate, $this->process[$language])) { + if (array_key_exists($state, $this->process[$language][$oldstate])) { + $pf = $this->process[$language][$oldstate][$state]; + $output .= $pf($span, $language, $ch); + } else { + $pf = $this->process[$language][$oldstate][0]; + $output .= $pf($span, $language, $ch); + } + } else { + $output .= $span; } - } - - if (array_key_exists($language, $this->process_end) && $state == self::NORMAL_TEXT) { - $output .= $this->process_end[$language]($span, $language); - } else { - $output .= $span; - } - if ($state != self::NORMAL_TEXT) { if (array_key_exists($language, $this->edges) && - array_key_exists("$state," . self::NORMAL_TEXT, $this->edges[$language])) { - $output .= $this->edges[$language]["$state," . self::NORMAL_TEXT]; + array_key_exists("$oldstate,$state", $this->edges[$language])) { + $output .= $this->edges[$language]["$oldstate,$state"]; } + + $span = ''; } + } - return $output; + if (array_key_exists($language, $this->process_end) && $state == self::NORMAL_TEXT) { + $output .= $this->process_end[$language]($span, $language); + } else { + $output .= $span; } + + if ($state != self::NORMAL_TEXT) { + if (array_key_exists($language, $this->edges) && + array_key_exists("$state," . self::NORMAL_TEXT, $this->edges[$language])) { + $output .= $this->edges[$language]["$state," . self::NORMAL_TEXT]; + } + } + + return $output; } +} diff --git a/src/classes/Misc.php b/src/classes/Misc.php index b1a58817..6f3d075c 100644 --- a/src/classes/Misc.php +++ b/src/classes/Misc.php @@ -1,5 +1,7 @@ <?php - +/* + * PHPPgAdmin v6.0.0-beta.30 + */ namespace PHPPgAdmin; use \PHPPgAdmin\Decorators\Decorator; @@ -17,23 +19,25 @@ class Misc private $_connection = null; private $_no_db_connection = false; private $_reload_browser = false; - private $app = null; - private $data = null; - private $database = null; - private $server_id = null; - public $appLangFiles = []; - public $appName = ''; - public $appVersion = ''; - public $form = ''; - public $href = ''; - public $controller_name = 'Misc'; - public $lang = []; - private $server_info = null; - private $error_msg = ''; - - private $container = null; - - /* Constructor */ + private $_data = null; + private $_database = null; + private $_server_id = null; + private $_server_info = null; + private $_error_msg = ''; + + public $appLangFiles = []; + public $appName = ''; + public $appVersion = ''; + public $form = ''; + public $href = ''; + public $controller_name = 'Misc'; + public $lang = []; + + protected $container = null; + + /** + * @param \Slim\Container $container The container + */ public function __construct(\Slim\Container $container) { $this->container = $container; @@ -67,12 +71,12 @@ class Misc } if (count($this->conf['servers']) === 1) { - $info = $this->conf['servers'][0]; - $this->server_id = $info['host'] . ':' . $info['port'] . ':' . $info['sslmode']; + $info = $this->conf['servers'][0]; + $this->_server_id = $info['host'] . ':' . $info['port'] . ':' . $info['sslmode']; } elseif (isset($_REQUEST['server'])) { - $this->server_id = $_REQUEST['server']; + $this->_server_id = $_REQUEST['server']; } elseif (isset($_SESSION['webdbLogin']) && count($_SESSION['webdbLogin']) > 0) { - $this->server_id = array_keys($_SESSION['webdbLogin'])[0]; + $this->_server_id = array_keys($_SESSION['webdbLogin'])[0]; } } @@ -87,8 +91,9 @@ class Misc /** * Adds or modifies a key in the $conf instance property of this class - * @param string $key [description] - * @param mixed $value [description] + * @param string $key name of the key to set + * @param mixed $value value of the key to set + * * @return $this */ public function setConf(string $key, $value) @@ -100,6 +105,7 @@ class Misc /** * gets the value of a config property, or the array of all config properties * @param mixed $key value of the key to be retrieved. If null, the full array is returnes + * * @return mixed the whole $conf array, the value of $conf[key] or null if said key does not exist */ public function getConf($key = null) @@ -114,13 +120,14 @@ class Misc public function getServerId() { - return $this->server_id; + return $this->_server_id; } /** * Displays link to the context help. - * @param $str - the string that the context help is related to (already escaped) - * @param $help - help section identifier + * + * @param $str the string that the context help is related to (already escaped) + * @param $help help section identifier * @param $do_print true to echo, false to return */ public function printHelp($str, $help = null, $do_print = true) @@ -143,9 +150,10 @@ class Misc } /** - * [setReloadBrowser description] + * Internally sets the reload browser property * * @param boolean $flag sets internal $_reload_browser var which will be passed to the footer methods + * * @return $this */ public function setReloadBrowser($flag) @@ -167,8 +175,9 @@ class Misc * @param $errno the native error number from the database * @param $errmsg the native error msg from the database * @param $p1 $fn specific parameter - see below - * @param $p2 - * @param $thisConnection + * @param $p2 parameter 2 + * @param $thisConnection connection + * * @throws \PHPPgAdmin\ADOdbException * @internal param $P2 $fn specific parameter - see below */ @@ -228,7 +237,8 @@ class Misc /** * sets $_no_db_connection boolean value, allows to render scripts that do not need an active session * - * @param boolean $flag [description] + * @param boolean $flag true or false to allow unconnected clients to access the view + * * @return $this */ public function setNoDBConnection($flag) @@ -244,24 +254,25 @@ class Misc /** * Sets the last error message to display afterwards instead of just dying with the error msg - * @param [string] $msg error message string + * @param string $msg error message string */ public function setErrorMsg($msg) { - $this->error_msg = $msg; + $this->_error_msg = $msg; return $this; } public function getErrorMsg() { - return $this->error_msg; + return $this->_error_msg; } /** * Creates a database accessor * - * @param string $database - * @param null $server_id + * @param string $database the name of the database + * @param mixed $server_id the id of the server + * * @return null */ public function getDatabaseAccessor($database = '', $server_id = null) @@ -269,20 +280,20 @@ class Misc $lang = $this->lang; if ($server_id !== null) { - $this->server_id = $server_id; + $this->_server_id = $server_id; } - $server_info = $this->getServerInfo($this->server_id); + $server_info = $this->getServerInfo($this->_server_id); if ($this->_no_db_connection || !isset($server_info['username'])) { return null; } - if ($this->data === null) { + if ($this->_data === null) { try { - $_connection = $this->getConnection($database, $this->server_id); + $_connection = $this->getConnection($database, $this->_server_id); } catch (\Exception $e) { - $this->setServerInfo(null, null, $this->server_id); + $this->setServerInfo(null, null, $this->_server_id); $this->setNoDBConnection(true); $this->setErrorMsg($e->getMessage()); return null; @@ -308,32 +319,32 @@ class Misc } $_type = '\PHPPgAdmin\Database\\' . $_type; - $this->setServerInfo('platform', $platform, $this->server_id); - $this->setServerInfo('pgVersion', $_connection->conn->pgVersion, $this->server_id); + $this->setServerInfo('platform', $platform, $this->_server_id); + $this->setServerInfo('pgVersion', $_connection->conn->pgVersion, $this->_server_id); // Create a database wrapper class for easy manipulation of the // connection. - $this->data = new $_type($_connection->conn, $this->conf); - $this->data->platform = $_connection->platform; - $this->data->server_info = $server_info; - $this->data->conf = $this->conf; - $this->data->lang = $this->lang; + $this->_data = new $_type($_connection->conn, $this->conf); + $this->_data->platform = $_connection->platform; + $this->_data->server_info = $server_info; + $this->_data->conf = $this->conf; + $this->_data->lang = $this->lang; - //$this->data->getHelpPages(); + //$this->_data->getHelpPages(); - //$this->prtrace('help_page has ' . count($this->data->help_page) . ' items'); + //$this->prtrace('help_page has ' . count($this->_data->help_page) . ' items'); /* we work on UTF-8 only encoding */ - $this->data->execute("SET client_encoding TO 'UTF-8'"); + $this->_data->execute("SET client_encoding TO 'UTF-8'"); - if ($this->data->hasByteaHexDefault()) { - $this->data->execute('SET bytea_output TO escape'); + if ($this->_data->hasByteaHexDefault()) { + $this->_data->execute('SET bytea_output TO escape'); } } if ($this->_no_db_connection === false && $this->getDatabase() !== null && isset($_REQUEST['schema'])) { - $status = $this->data->setSchema($_REQUEST['schema']); + $status = $this->_data->setSchema($_REQUEST['schema']); if ($status != 0) { $this->container->utils->addError($this->lang['strbadschema']); @@ -342,7 +353,7 @@ class Misc } } - return $this->data; + return $this->_data; } public function getConnection($database = '', $server_id = null) @@ -351,9 +362,9 @@ class Misc if ($this->_connection === null) { if ($server_id !== null) { - $this->server_id = $server_id; + $this->_server_id = $server_id; } - $server_info = $this->getServerInfo($this->server_id); + $server_info = $this->getServerInfo($this->_server_id); $database_to_use = $this->getDatabase($database); // Perform extra security checks if this config option is set @@ -400,7 +411,9 @@ class Misc * Validate and retrieve information on a server. * If the parameter isn't supplied then the currently * connected server is returned. + * * @param $server_id A server identifier (host:port) + * * @return An associative array of server properties */ public function getServerInfo($server_id = null) @@ -409,40 +422,40 @@ class Misc //\PC::debug(['$server_id' => $server_id]); if ($server_id !== null) { - $this->server_id = $server_id; - } elseif ($this->server_info !== null) { - return $this->server_info; + $this->_server_id = $server_id; + } elseif ($this->_server_info !== null) { + return $this->_server_info; } // Check for the server in the logged-in list - if (isset($_SESSION['webdbLogin'][$this->server_id])) { - $this->server_info = $_SESSION['webdbLogin'][$this->server_id]; - return $this->server_info; + if (isset($_SESSION['webdbLogin'][$this->_server_id])) { + $this->_server_info = $_SESSION['webdbLogin'][$this->_server_id]; + return $this->_server_info; } // Otherwise, look for it in the conf file foreach ($this->conf['servers'] as $idx => $info) { - if ($this->server_id == $info['host'] . ':' . $info['port'] . ':' . $info['sslmode']) { + if ($this->_server_id == $info['host'] . ':' . $info['port'] . ':' . $info['sslmode']) { if (isset($info['username'])) { - $this->setServerInfo(null, $info, $this->server_id); + $this->setServerInfo(null, $info, $this->_server_id); } elseif (isset($_SESSION['sharedUsername'])) { $info['username'] = $_SESSION['sharedUsername']; $info['password'] = $_SESSION['sharedPassword']; $this->setReloadBrowser(true); - $this->setServerInfo(null, $info, $this->server_id); + $this->setServerInfo(null, $info, $this->_server_id); } - $this->server_info = $info; - return $this->server_info; + $this->_server_info = $info; + return $this->_server_info; } } if ($server_id === null) { - $this->server_info = null; - return $this->server_info; + $this->_server_info = null; + return $this->_server_info; } $this->prtrace('Invalid server param'); - $this->server_info = null; + $this->_server_info = null; // Unable to find a matching server, are we being hacked? return $this->halt($this->lang['strinvalidserverparam']); } @@ -452,8 +465,7 @@ class Misc * @param $key parameter name to set, or null to replace all * params with the assoc-array in $value. * @param $value the new value, or null to unset the parameter - * @param $server_id the server identifier, or null for current - * server. + * @param $server_id the server identifier, or null for current server */ public function setServerInfo($key, $value, $server_id = null) { @@ -481,25 +493,25 @@ class Misc public function getDatabase($database = '') { - if ($this->server_id === null && !isset($_REQUEST['database'])) { + if ($this->_server_id === null && !isset($_REQUEST['database'])) { return null; } - $server_info = $this->getServerInfo($this->server_id); + $server_info = $this->getServerInfo($this->_server_id); - if ($this->server_id !== null && isset($server_info['useonlydefaultdb']) && $server_info['useonlydefaultdb'] === true) { - $this->database = $server_info['defaultdb']; + if ($this->_server_id !== null && isset($server_info['useonlydefaultdb']) && $server_info['useonlydefaultdb'] === true) { + $this->_database = $server_info['defaultdb']; } elseif ($database !== '') { - $this->database = $database; + $this->_database = $database; } elseif (isset($_REQUEST['database'])) { // Connect to the current database - $this->database = $_REQUEST['database']; + $this->_database = $_REQUEST['database']; } else { // or if one is not specified then connect to the default database. - $this->database = $server_info['defaultdb']; + $this->_database = $server_info['defaultdb']; } - return $this->database; + return $this->_database; } /** @@ -507,6 +519,7 @@ class Misc * * @param bool $recordset return as RecordSet suitable for HTMLTableController::printTable if true, otherwise just return an array. * @param mixed $group_id a group name to filter the returned servers using $this->conf[srv_groups] + * * @return array|\PHPPgAdmin\ArrayRecordSet either an array or a Recordset suitable for HTMLTableController::printTable */ public function getServersGroups($recordset = false, $group_id = false) @@ -575,6 +588,7 @@ class Misc * * @param bool $recordset return as RecordSet suitable for HTMLTableController::printTable if true, otherwise just return an array. * @param mixed $group a group name to filter the returned servers using $this->conf[srv_groups] + * * @return array|\PHPPgAdmin\ArrayRecordSet either an array or a Recordset suitable for HTMLTableController::printTable */ public function getServers($recordset = false, $group = false) @@ -636,6 +650,7 @@ class Misc * Set the current schema * * @param $schema The schema name + * * @return int 0 on success */ public function setCurrentSchema($schema) @@ -921,7 +936,7 @@ class Misc public function printVal($str, $type = null, $params = []) { $lang = $this->lang; - $data = $this->data; + $data = $this->_data; // Shortcircuit for a NULL value if (is_null($str)) { @@ -1130,7 +1145,7 @@ class Misc */ public function getNavTabs($section) { - $data = $this->data; + $data = $this->_data; $lang = $this->lang; $plugin_manager = $this->plugin_manager; @@ -1945,10 +1960,10 @@ class Misc $v['subject'] = $subject; } - if ($this->server_id !== null && $subject != 'root') { - $v['server'] = $this->server_id; - if ($this->database !== null && $subject != 'server') { - $v['database'] = $this->database; + if ($this->_server_id !== null && $subject != 'root') { + $v['server'] = $this->_server_id; + if ($this->_database !== null && $subject != 'server') { + $v['database'] = $this->_database; if (isset($_REQUEST['schema']) && $subject != 'database') { $v['schema'] = $_REQUEST['schema']; } @@ -2075,8 +2090,8 @@ class Misc $servers = $this->getServers(); $forcedserver = null; if (count($servers) === 1) { - $forcedserver = $this->server_id; - $connection_html .= '<input type="hidden" readonly="readonly" value="' . $this->server_id . '" name="server">'; + $forcedserver = $this->_server_id; + $connection_html .= '<input type="hidden" readonly="readonly" value="' . $this->_server_id . '" name="server">'; } else { $connection_html .= '<label>'; $connection_html .= $this->printHelp($lang['strserver'], 'pg.server', false); @@ -2097,8 +2112,8 @@ class Misc $connection_html .= "</td><td class=\"popup_select2\" style=\"text-align: right\">\n"; - if (count($servers) === 1 && isset($servers[$this->server_id]['useonlydefaultdb']) && $servers[$this->server_id]['useonlydefaultdb'] === true) { - $connection_html .= '<input type="hidden" name="database" value="' . htmlspecialchars($servers[$this->server_id]['defaultdb']) . "\" />\n"; + if (count($servers) === 1 && isset($servers[$this->_server_id]['useonlydefaultdb']) && $servers[$this->_server_id]['useonlydefaultdb'] === true) { + $connection_html .= '<input type="hidden" name="database" value="' . htmlspecialchars($servers[$this->_server_id]['defaultdb']) . "\" />\n"; } else { // Get the list of all databases diff --git a/src/classes/PluginManager.php b/src/classes/PluginManager.php index 127043ce..1e9caac7 100644 --- a/src/classes/PluginManager.php +++ b/src/classes/PluginManager.php @@ -1,5 +1,7 @@ <?php - +/* + * PHPPgAdmin v6.0.0-beta.30 + */ namespace PHPPgAdmin; /** diff --git a/src/controllers/AdminTrait.php b/src/controllers/AdminTrait.php index 92d2b6d3..e2dd4071 100644 --- a/src/controllers/AdminTrait.php +++ b/src/controllers/AdminTrait.php @@ -35,7 +35,7 @@ trait AdminTrait $this->printTrail('schema'); $this->printTitle($lang['strclusterindex'], 'pg.index.cluster'); - echo '<form action="' . SUBFOLDER . "/src/views/{$script}\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/{$script}\" method=\"post\">\n"; foreach ($_REQUEST['ma'] as $v) { $a = unserialize(htmlspecialchars_decode($v, ENT_QUOTES)); echo '<p>', sprintf($lang['strconfclustertable'], $this->misc->printVal($a['table'])), "</p>\n"; @@ -46,7 +46,7 @@ trait AdminTrait $this->printTrail($type); $this->printTitle($lang['strclusterindex'], 'pg.index.cluster'); - echo '<form action="' . SUBFOLDER . "/src/views/{$script}\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/{$script}\" method=\"post\">\n"; if ('table' == $type) { echo '<p>', sprintf($lang['strconfclustertable'], $this->misc->printVal($_REQUEST['object'])), "</p>\n"; @@ -126,7 +126,7 @@ trait AdminTrait $this->printTrail('schema'); $this->printTitle($lang['strreindex'], 'pg.reindex'); - echo '<form action="' . SUBFOLDER . "/src/views/{$script}\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/{$script}\" method=\"post\">\n"; foreach ($_REQUEST['ma'] as $v) { $a = unserialize(htmlspecialchars_decode($v, ENT_QUOTES)); echo '<p>', sprintf($lang['strconfreindextable'], $this->misc->printVal($a['table'])), "</p>\n"; @@ -137,7 +137,7 @@ trait AdminTrait $this->printTrail($type); $this->printTitle($lang['strreindex'], 'pg.reindex'); - echo '<form action="' . SUBFOLDER . "/src/views/{$script}\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/{$script}\" method=\"post\">\n"; if ('table' == $type) { echo '<p>', sprintf($lang['strconfreindextable'], $this->misc->printVal($_REQUEST['object'])), "</p>\n"; @@ -213,7 +213,7 @@ trait AdminTrait $this->printTrail('schema'); $this->printTitle($lang['stranalyze'], 'pg.analyze'); - echo '<form action="' . SUBFOLDER . "/src/views/{$script}\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/{$script}\" method=\"post\">\n"; foreach ($_REQUEST['ma'] as $v) { $a = unserialize(htmlspecialchars_decode($v, ENT_QUOTES)); \Kint::dump($a); @@ -225,7 +225,7 @@ trait AdminTrait $this->printTrail($type); $this->printTitle($lang['stranalyze'], 'pg.analyze'); - echo '<form action="' . SUBFOLDER . "/src/views/{$script}\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/{$script}\" method=\"post\">\n"; if ('table' == $type) { echo '<p>', sprintf($lang['strconfanalyzetable'], $this->misc->printVal($_REQUEST['object'])), "</p>\n"; @@ -295,7 +295,7 @@ trait AdminTrait $this->printTrail('schema'); $this->printTitle($lang['strvacuum'], 'pg.vacuum'); - echo '<form action="' . SUBFOLDER . "/src/views/{$script}\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/{$script}\" method=\"post\">\n"; foreach ($_REQUEST['ma'] as $v) { $a = unserialize(htmlspecialchars_decode($v, ENT_QUOTES)); echo '<p>', sprintf($lang['strconfvacuumtable'], $this->misc->printVal($a['table'])), "</p>\n"; @@ -306,7 +306,7 @@ trait AdminTrait $this->printTrail($type); $this->printTitle($lang['strvacuum'], 'pg.vacuum'); - echo '<form action="' . SUBFOLDER . "/src/views/{$script}\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/{$script}\" method=\"post\">\n"; if ('table' == $type) { echo '<p>', sprintf($lang['strconfvacuumtable'], $this->misc->printVal($_REQUEST['object'])), "</p>\n"; @@ -424,7 +424,7 @@ trait AdminTrait $old_val['autovacuum_vacuum_cost_limit'] = ''; } - echo '<form action="' . SUBFOLDER . "/src/views/{$script}\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/{$script}\" method=\"post\">\n"; echo $this->misc->form; echo "<input type=\"hidden\" name=\"action\" value=\"editautovac\" />\n"; echo '<input type="hidden" name="table" value="', htmlspecialchars($_REQUEST['table']), "\" />\n"; @@ -520,7 +520,7 @@ trait AdminTrait echo "<input type=\"submit\" name=\"yes\" value=\"{$lang['stryes']}\" />\n"; echo "</form>\n"; - echo '<form action="' . SUBFOLDER . "/src/views/{$script}\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/{$script}\" method=\"post\">\n"; echo "<input type=\"hidden\" name=\"action\" value=\"admin\" />\n"; echo '<input type="hidden" name="table" value="', htmlspecialchars($_REQUEST['table']), "\" />\n"; echo $this->misc->form; @@ -586,7 +586,7 @@ trait AdminTrait // Vacuum echo "<tr class=\"row1\">\n"; echo "<td style=\"text-align: center; vertical-align: bottom\">\n"; - echo '<form action="' . SUBFOLDER . "/src/views/{$script}\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/{$script}\" method=\"post\">\n"; echo "<p><input type=\"hidden\" name=\"action\" value=\"confirm_vacuum\" />\n"; echo $this->misc->form; @@ -600,7 +600,7 @@ trait AdminTrait // Analyze echo "<td style=\"text-align: center; vertical-align: bottom\">\n"; - echo '<form action="' . SUBFOLDER . "/src/views/{$script}\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/{$script}\" method=\"post\">\n"; echo "<p><input type=\"hidden\" name=\"action\" value=\"confirm_analyze\" />\n"; echo $this->misc->form; if ('table' == $type) { @@ -615,7 +615,7 @@ trait AdminTrait if ($data->hasRecluster()) { $disabled = ''; echo "<td style=\"text-align: center; vertical-align: bottom\">\n"; - echo '<form action="' . SUBFOLDER . "/src/views/{$script}\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/{$script}\" method=\"post\">\n"; echo $this->misc->form; if ('table' == $type) { echo '<input type="hidden" name="table" value="', htmlspecialchars($_REQUEST['object']), "\" />\n"; @@ -633,7 +633,7 @@ trait AdminTrait // Reindex echo "<td style=\"text-align: center; vertical-align: bottom\">\n"; - echo '<form action="' . SUBFOLDER . "/src/views/{$script}\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/{$script}\" method=\"post\">\n"; echo "<p><input type=\"hidden\" name=\"action\" value=\"confirm_reindex\" />\n"; echo $this->misc->form; if ('table' == $type) { @@ -673,13 +673,13 @@ trait AdminTrait 'namespace' => [ 'title' => $lang['strschema'], 'field' => Decorator::field('nspname'), - 'url' => SUBFOLDER . "/redirect/schema?{$this->misc->href}&", + 'url' => \SUBFOLDER . "/redirect/schema?{$this->misc->href}&", 'vars' => ['schema' => 'nspname'], ], 'relname' => [ 'title' => $lang['strtable'], 'field' => Decorator::field('relname'), - 'url' => SUBFOLDER . "/redirect/table?{$this->misc->href}&", + 'url' => \SUBFOLDER . "/redirect/table?{$this->misc->href}&", 'vars' => ['table' => 'relname', 'schema' => 'nspname'], ], 'autovacuum_enabled' => [ diff --git a/src/controllers/AggregatesController.php b/src/controllers/AggregatesController.php index 69e737d7..e65edc61 100644 --- a/src/controllers/AggregatesController.php +++ b/src/controllers/AggregatesController.php @@ -102,7 +102,7 @@ class AggregatesController extends BaseController 'aggrname' => [ 'title' => $lang['strname'], 'field' => Decorator::field('proname'), - 'url' => SUBFOLDER . "/redirect/aggregate?action=properties&{$this->misc->href}&", + 'url' => \SUBFOLDER . "/redirect/aggregate?action=properties&{$this->misc->href}&", 'vars' => ['aggrname' => 'proname', 'aggrtype' => 'proargtypes'], ], 'aggrtype' => [ @@ -307,7 +307,7 @@ class AggregatesController extends BaseController $this->printTitle($lang['strcreateaggregate'], 'pg.aggregate.create'); $this->printMsg($msg); - echo '<form action="' . SUBFOLDER . "/src/views/aggregates.php\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/aggregates.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=\"data\"><input name=\"name\" size=\"32\" maxlength=\"{$data->_maxNameLen}\" value=\"", @@ -394,7 +394,7 @@ class AggregatesController extends BaseController $this->printTitle($lang['stralter'], 'pg.aggregate.alter'); $this->printMsg($msg); - echo '<form action="' . SUBFOLDER . "/src/views/aggregates.php\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/aggregates.php\" method=\"post\">\n"; $aggrdata = $data->getAggregate($_REQUEST['aggrname'], $_REQUEST['aggrtype']); if ($aggrdata->recordCount() > 0) { // Output table header @@ -444,7 +444,7 @@ class AggregatesController extends BaseController echo '<p>', sprintf($lang['strconfdropaggregate'], htmlspecialchars($_REQUEST['aggrname'])), "</p>\n"; - echo '<form action="' . SUBFOLDER . "/src/views/aggregates.php\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/aggregates.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=\"drop\" />\n"; echo '<input type="hidden" name="aggrname" value="', htmlspecialchars($_REQUEST['aggrname']), "\" />\n"; diff --git a/src/controllers/AlldbController.php b/src/controllers/AlldbController.php index d9d8e037..7c22989c 100644 --- a/src/controllers/AlldbController.php +++ b/src/controllers/AlldbController.php @@ -103,7 +103,7 @@ class AlldbController extends BaseController 'database' => [ 'title' => $lang['strdatabase'], 'field' => Decorator::field('datname'), - 'url' => SUBFOLDER . "/redirect/database?{$this->misc->href}&", + 'url' => \SUBFOLDER . "/redirect/database?{$this->misc->href}&", 'vars' => ['database' => 'datname'], ], 'owner' => [ @@ -263,7 +263,7 @@ class AlldbController extends BaseController $this->printTrail('database'); $this->printTitle($lang['stralter'], 'pg.database.alter'); - echo '<form action="' . SUBFOLDER . "/src/views/alldb.php\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/alldb.php\" method=\"post\">\n"; echo "<table>\n"; echo "<tr><th class=\"data left required\">{$lang['strname']}</th>\n"; echo '<td class="data1">'; @@ -340,7 +340,7 @@ class AlldbController extends BaseController $this->printTrail('database'); $this->printTitle($lang['strdrop'], 'pg.database.drop'); - echo '<form action="' . SUBFOLDER . "/src/views/alldb.php\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/alldb.php\" method=\"post\">\n"; //If multi drop if (isset($_REQUEST['ma'])) { foreach ($_REQUEST['ma'] as $v) { @@ -432,7 +432,7 @@ class AlldbController extends BaseController $tablespaces = $data->getTablespaces(); } - echo '<form action="' . SUBFOLDER . "/src/views/alldb.php\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/alldb.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=\"", @@ -592,7 +592,7 @@ class AlldbController extends BaseController $this->printTabs('server', 'export'); $this->printMsg($msg); - echo '<form action="' . SUBFOLDER . "/src/views/dbexport.php\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/dbexport.php\" method=\"post\">\n"; echo "<table>\n"; echo "<tr><th class=\"data\">{$lang['strformat']}</th><th class=\"data\">{$lang['stroptions']}</th></tr>\n"; // Data only diff --git a/src/controllers/BaseController.php b/src/controllers/BaseController.php index 5f94ad5b..75c6387f 100644 --- a/src/controllers/BaseController.php +++ b/src/controllers/BaseController.php @@ -44,6 +44,7 @@ class BaseController /** * Constructs the base controller (common for almost all controllers) + * * @param \Slim\Container $container the $app container * @param boolean $no_db_connection [optional] if true, sets $this->misc->setNoDBConnection(true); */ diff --git a/src/controllers/ColpropertiesController.php b/src/controllers/ColpropertiesController.php index ddf4e6e8..c79ad55c 100644 --- a/src/controllers/ColpropertiesController.php +++ b/src/controllers/ColpropertiesController.php @@ -242,8 +242,8 @@ class ColpropertiesController extends BaseController $this->printTitle($lang['stralter'], 'pg.column.alter'); $this->printMsg($msg); - echo '<script src="' . SUBFOLDER . '/js/tables.js" type="text/javascript"></script>'; - echo '<form action="' . SUBFOLDER . "/src/views/colproperties.php\" method=\"post\">\n"; + echo '<script src="' . \SUBFOLDER . '/js/tables.js" type="text/javascript"></script>'; + echo '<form action="' . \SUBFOLDER . "/src/views/colproperties.php\" method=\"post\">\n"; // Output table header echo "<table>\n"; diff --git a/src/controllers/ConstraintsController.php b/src/controllers/ConstraintsController.php index b424450d..9ebba87b 100644 --- a/src/controllers/ConstraintsController.php +++ b/src/controllers/ConstraintsController.php @@ -31,7 +31,7 @@ class ConstraintsController extends BaseController $this->printHeader( $lang['strtables'] . ' - ' . $_REQUEST['table'] . ' - ' . $lang['strconstraints'], - '<script src="' . SUBFOLDER . '/js/indexes.js" type="text/javascript"></script>', + '<script src="' . \SUBFOLDER . '/js/indexes.js" type="text/javascript"></script>', true, 'header_select2.twig' ); @@ -680,7 +680,7 @@ class ConstraintsController extends BaseController $this->printTitle($lang['straddcheck'], 'pg.constraint.check'); $this->printMsg($msg); - echo '<form action="' . SUBFOLDER . "/src/views/constraints.php\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/constraints.php\" method=\"post\">\n"; echo "<table>\n"; echo "<tr><th class=\"data\">{$lang['strname']}</th>\n"; echo "<th class=\"data required\">{$lang['strdefinition']}</th></tr>\n"; @@ -737,7 +737,7 @@ class ConstraintsController extends BaseController $this->misc->printVal($_REQUEST['table']) ), "</p>\n"; - echo '<form action="' . SUBFOLDER . "/src/views/constraints.php\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/constraints.php\" method=\"post\">\n"; echo "<input type=\"hidden\" name=\"action\" value=\"drop\" />\n"; echo '<input type="hidden" name="table" value="', htmlspecialchars($_REQUEST['table']), "\" />\n"; echo '<input type="hidden" name="constraint" value="', htmlspecialchars($_REQUEST['constraint']), "\" />\n"; diff --git a/src/controllers/DatabaseController.php b/src/controllers/DatabaseController.php index 29b3246d..233d82aa 100644 --- a/src/controllers/DatabaseController.php +++ b/src/controllers/DatabaseController.php @@ -48,7 +48,7 @@ class DatabaseController extends BaseController $scripts = ''; // normal flow if ('locks' == $action || 'processes' == $action) { - $scripts .= '<script src="' . SUBFOLDER . '/js/database.js" type="text/javascript"></script>'; + $scripts .= '<script src="' . \SUBFOLDER . '/js/database.js" type="text/javascript"></script>'; $refreshTime = $conf['ajax_refresh'] * 1500; @@ -190,7 +190,7 @@ class DatabaseController extends BaseController $this->printTabs('database', 'find'); $this->printMsg($msg); - echo '<form action="' . SUBFOLDER . "/src/views/database.php\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/database.php\" method=\"post\">\n"; echo '<p><input name="term" value="', htmlspecialchars($_REQUEST['term']), "\" size=\"32\" maxlength=\"{$data->_maxNameLen}\" />\n"; // Output list of filters. This is complex due to all the 'has' and 'conf' feature possibilities @@ -328,20 +328,20 @@ class DatabaseController extends BaseController switch ($curr) { case 'SCHEMA': - echo '<li><a href="' . SUBFOLDER . "/redirect/schema?{$this->misc->href}&schema=", $this->misc->printVal($rs->fields['name']), '">', $this->_highlight($this->misc->printVal($rs->fields['name']), $_REQUEST['term']), "</a></li>\n"; + echo '<li><a href="' . \SUBFOLDER . "/redirect/schema?{$this->misc->href}&schema=", $this->misc->printVal($rs->fields['name']), '">', $this->_highlight($this->misc->printVal($rs->fields['name']), $_REQUEST['term']), "</a></li>\n"; break; case 'TABLE': echo '<li>'; echo "<a href=\"tables.php?subject=schema&{$this->misc->href}&schema=", urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['schemaname']), '</a>.'; - echo '<a href="' . SUBFOLDER . "/redirect/table?{$this->misc->href}&schema=", urlencode($rs->fields['schemaname']), '&table=', + echo '<a href="' . \SUBFOLDER . "/redirect/table?{$this->misc->href}&schema=", urlencode($rs->fields['schemaname']), '&table=', urlencode($rs->fields['name']), '">', $this->_highlight($this->misc->printVal($rs->fields['name']), $_REQUEST['term']), "</a></li>\n"; break; case 'VIEW': echo '<li>'; echo "<a href=\"views.php?subject=schema&{$this->misc->href}&schema=", urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['schemaname']), '</a>.'; - echo '<a href="' . SUBFOLDER . "/redirect/view?{$this->misc->href}&schema=", urlencode($rs->fields['schemaname']), '&view=', + echo '<a href="' . \SUBFOLDER . "/redirect/view?{$this->misc->href}&schema=", urlencode($rs->fields['schemaname']), '&view=', urlencode($rs->fields['name']), '">', $this->_highlight($this->misc->printVal($rs->fields['name']), $_REQUEST['term']), "</a></li>\n"; break; @@ -354,7 +354,7 @@ class DatabaseController extends BaseController break; case 'COLUMNTABLE': echo '<li>'; - echo '<a href="' . SUBFOLDER . "/redirect/schema?{$this->misc->href}&schema=", urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['schemaname']), '</a>.'; + echo '<a href="' . \SUBFOLDER . "/redirect/schema?{$this->misc->href}&schema=", urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['schemaname']), '</a>.'; echo "<a href=\"tblproperties.php?subject=table&{$this->misc->href}&table=", urlencode($rs->fields['relname']), '&schema=', urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['relname']), '</a>.'; echo "<a href=\"colproperties.php?{$this->misc->href}&schema=", urlencode($rs->fields['schemaname']), '&table=', urlencode($rs->fields['relname']), '&column=', urlencode($rs->fields['name']), '">', @@ -363,7 +363,7 @@ class DatabaseController extends BaseController break; case 'COLUMNVIEW': echo '<li>'; - echo '<a href="' . SUBFOLDER . "/redirect/schema?{$this->misc->href}&schema=", urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['schemaname']), '</a>.'; + echo '<a href="' . \SUBFOLDER . "/redirect/schema?{$this->misc->href}&schema=", urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['schemaname']), '</a>.'; echo "<a href=\"viewproperties.php?subject=view&{$this->misc->href}&view=", urlencode($rs->fields['relname']), '&schema=', urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['relname']), '</a>.'; echo "<a href=\"colproperties.php?{$this->misc->href}&schema=", urlencode($rs->fields['schemaname']), '&view=', urlencode($rs->fields['relname']), '&column=', urlencode($rs->fields['name']), '">', @@ -372,15 +372,15 @@ class DatabaseController extends BaseController break; case 'INDEX': echo '<li>'; - echo '<a href="' . SUBFOLDER . "/redirect/schema?{$this->misc->href}&schema=", urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['schemaname']), '</a>.'; - echo '<a href="' . SUBFOLDER . "/redirect/table?{$this->misc->href}&table=", urlencode($rs->fields['relname']), '&schema=', urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['relname']), '</a>.'; + echo '<a href="' . \SUBFOLDER . "/redirect/schema?{$this->misc->href}&schema=", urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['schemaname']), '</a>.'; + echo '<a href="' . \SUBFOLDER . "/redirect/table?{$this->misc->href}&table=", urlencode($rs->fields['relname']), '&schema=', urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['relname']), '</a>.'; echo "<a href=\"indexes.php?{$this->misc->href}&schema=", urlencode($rs->fields['schemaname']), '&table=', urlencode($rs->fields['relname']), '">', $this->_highlight($this->misc->printVal($rs->fields['name']), $_REQUEST['term']), "</a></li>\n"; break; case 'CONSTRAINTTABLE': echo '<li>'; - echo '<a href="' . SUBFOLDER . "/redirect/schema?{$this->misc->href}&schema=", urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['schemaname']), '</a>.'; - echo '<a href="' . SUBFOLDER . "/redirect/table?{$this->misc->href}&table=", urlencode($rs->fields['relname']), '&schema=', urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['relname']), '</a>.'; + echo '<a href="' . \SUBFOLDER . "/redirect/schema?{$this->misc->href}&schema=", urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['schemaname']), '</a>.'; + echo '<a href="' . \SUBFOLDER . "/redirect/table?{$this->misc->href}&table=", urlencode($rs->fields['relname']), '&schema=', urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['relname']), '</a>.'; echo "<a href=\"constraints.php?{$this->misc->href}&schema=", urlencode($rs->fields['schemaname']), '&table=', urlencode($rs->fields['relname']), '">', $this->_highlight($this->misc->printVal($rs->fields['name']), $_REQUEST['term']), "</a></li>\n"; @@ -394,24 +394,24 @@ class DatabaseController extends BaseController break; case 'TRIGGER': echo '<li>'; - echo '<a href="' . SUBFOLDER . "/redirect/schema?{$this->misc->href}&schema=", urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['schemaname']), '</a>.'; - echo '<a href="' . SUBFOLDER . "/redirect/table?{$this->misc->href}&table=", urlencode($rs->fields['relname']), '&schema=', urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['relname']), '</a>.'; + echo '<a href="' . \SUBFOLDER . "/redirect/schema?{$this->misc->href}&schema=", urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['schemaname']), '</a>.'; + echo '<a href="' . \SUBFOLDER . "/redirect/table?{$this->misc->href}&table=", urlencode($rs->fields['relname']), '&schema=', urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['relname']), '</a>.'; echo "<a href=\"triggers.php?{$this->misc->href}&schema=", urlencode($rs->fields['schemaname']), '&table=', urlencode($rs->fields['relname']), '">', $this->_highlight($this->misc->printVal($rs->fields['name']), $_REQUEST['term']), "</a></li>\n"; break; case 'RULETABLE': echo '<li>'; - echo '<a href="' . SUBFOLDER . "/redirect/schema?{$this->misc->href}&schema=", urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['schemaname']), '</a>.'; - echo '<a href="' . SUBFOLDER . "/redirect/table?{$this->misc->href}&table=", urlencode($rs->fields['relname']), '&schema=', urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['relname']), '</a>.'; + echo '<a href="' . \SUBFOLDER . "/redirect/schema?{$this->misc->href}&schema=", urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['schemaname']), '</a>.'; + echo '<a href="' . \SUBFOLDER . "/redirect/table?{$this->misc->href}&table=", urlencode($rs->fields['relname']), '&schema=', urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['relname']), '</a>.'; echo "<a href=\"rules.php?subject=table&{$this->misc->href}&schema=", urlencode($rs->fields['schemaname']), '&reltype=table&table=', urlencode($rs->fields['relname']), '">', $this->_highlight($this->misc->printVal($rs->fields['name']), $_REQUEST['term']), "</a></li>\n"; break; case 'RULEVIEW': echo '<li>'; - echo '<a href="' . SUBFOLDER . "/redirect/schema?{$this->misc->href}&schema=", urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['schemaname']), '</a>.'; - echo '<a href="' . SUBFOLDER . "/redirect/view?{$this->misc->href}&view=", urlencode($rs->fields['relname']), '&schema=', urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['relname']), '</a>.'; + echo '<a href="' . \SUBFOLDER . "/redirect/schema?{$this->misc->href}&schema=", urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['schemaname']), '</a>.'; + echo '<a href="' . \SUBFOLDER . "/redirect/view?{$this->misc->href}&view=", urlencode($rs->fields['relname']), '&schema=', urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['relname']), '</a>.'; echo "<a href=\"rules.php?subject=view&{$this->misc->href}&schema=", urlencode($rs->fields['schemaname']), '&reltype=view&view=', urlencode($rs->fields['relname']), '">', $this->_highlight($this->misc->printVal($rs->fields['name']), $_REQUEST['term']), "</a></li>\n"; @@ -465,7 +465,7 @@ class DatabaseController extends BaseController break; case 'OPCLASS': echo '<li>'; - echo '<a href="' . SUBFOLDER . "/redirect/schema?{$this->misc->href}&schema=", urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['schemaname']), '</a>.'; + echo '<a href="' . \SUBFOLDER . "/redirect/schema?{$this->misc->href}&schema=", urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['schemaname']), '</a>.'; echo "<a href=\"opclasses.php?{$this->misc->href}&schema=", urlencode($rs->fields['schemaname']), '">', $this->_highlight($this->misc->printVal($rs->fields['name']), $_REQUEST['term']), "</a></li>\n"; @@ -497,7 +497,7 @@ class DatabaseController extends BaseController $this->printTabs('database', 'export'); $this->printMsg($msg); - echo '<form action="' . SUBFOLDER . "/src/views/dbexport.php\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/dbexport.php\" method=\"post\">\n"; echo "<table>\n"; echo "<tr><th class=\"data\">{$lang['strformat']}</th><th class=\"data\" colspan=\"2\">{$lang['stroptions']}</th></tr>\n"; // Data only @@ -805,7 +805,7 @@ class DatabaseController extends BaseController $this->printTrail('database'); $this->printTabs('database', 'sql'); echo "<p>{$lang['strentersql']}</p>\n"; - echo '<form action="' . SUBFOLDER . '/src/views/sql.php" method="post" enctype="multipart/form-data" id="sqlform">' . "\n"; + echo '<form action="' . \SUBFOLDER . '/src/views/sql.php" method="post" enctype="multipart/form-data" id="sqlform">' . "\n"; echo "<p>{$lang['strsql']}<br />\n"; echo '<textarea style="width:95%;" rows="15" cols="50" name="query" id="query">', htmlspecialchars($_SESSION['sqlquery']), "</textarea></p>\n"; diff --git a/src/controllers/DataexportController.php b/src/controllers/DataexportController.php index d5ecf409..3862a7e8 100644 --- a/src/controllers/DataexportController.php +++ b/src/controllers/DataexportController.php @@ -362,7 +362,7 @@ class DataexportController extends BaseController $this->printMsg($msg); } - echo '<form action="' . SUBFOLDER . "/src/views/dataexport.php\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/dataexport.php\" method=\"post\">\n"; echo "<table>\n"; echo "<tr><th class=\"data\">{$lang['strformat']}:</th><td><select name=\"d_format\">\n"; // COPY and SQL require a table diff --git a/src/controllers/DisplayController.php b/src/controllers/DisplayController.php index b44ec635..fb1c0cf1 100644 --- a/src/controllers/DisplayController.php +++ b/src/controllers/DisplayController.php @@ -31,7 +31,7 @@ class DisplayController extends BaseController set_time_limit(0); - $scripts = '<script src="' . SUBFOLDER . '/js/display.js" type="text/javascript"></script>'; + $scripts = '<script src="' . \SUBFOLDER . '/js/display.js" type="text/javascript"></script>'; $scripts .= '<script type="text/javascript">' . "\n"; $scripts .= "var Display = {\n"; @@ -607,7 +607,7 @@ class DisplayController extends BaseController $fksprops = false; } - echo '<form action="' . SUBFOLDER . '/src/views/display.php" method="post" id="ac_form">' . "\n"; + echo '<form action="' . \SUBFOLDER . '/src/views/display.php" method="post" id="ac_form">' . "\n"; /*echo '<p>'; if (!$error) { @@ -788,7 +788,7 @@ class DisplayController extends BaseController $rs = $data->browseRow($_REQUEST['table'], $_REQUEST['key']); - echo '<form action="' . SUBFOLDER . '/src/views/display.php" method="post">' . "\n"; + echo '<form action="' . \SUBFOLDER . '/src/views/display.php" method="post">' . "\n"; echo $this->misc->form; if (1 == $rs->recordCount()) { diff --git a/src/controllers/DomainsController.php b/src/controllers/DomainsController.php index db6dc3c9..2371d25c 100644 --- a/src/controllers/DomainsController.php +++ b/src/controllers/DomainsController.php @@ -296,7 +296,7 @@ class DomainsController extends BaseController } // Display domain info - echo '<form action="' . SUBFOLDER . "/src/views/domains.php\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/domains.php\" method=\"post\">\n"; echo "<table>\n"; echo "<tr><th class=\"data left required\" style=\"width: 70px\">{$lang['strname']}</th>\n"; echo '<td class="data1">', $this->misc->printVal($domaindata->fields['domname']), "</td></tr>\n"; @@ -353,7 +353,7 @@ class DomainsController extends BaseController $this->printTitle($lang['straddcheck'], 'pg.constraint.check'); $this->printMsg($msg); - echo '<form action="' . SUBFOLDER . "/src/views/domains.php\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/domains.php\" method=\"post\">\n"; echo "<table>\n"; echo "<tr><th class=\"data\">{$lang['strname']}</th>\n"; echo "<th class=\"data required\">{$lang['strdefinition']}</th></tr>\n"; @@ -411,7 +411,7 @@ class DomainsController extends BaseController $this->misc->printVal($_REQUEST['constraint']), $this->misc->printVal($_REQUEST['domain']) ), "</p>\n"; - echo '<form action="' . SUBFOLDER . "/src/views/domains.php\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/domains.php\" method=\"post\">\n"; echo "<input type=\"hidden\" name=\"action\" value=\"drop_con\" />\n"; echo '<input type="hidden" name="domain" value="', htmlspecialchars($_REQUEST['domain']), "\" />\n"; echo '<input type="hidden" name="constraint" value="', htmlspecialchars($_REQUEST['constraint']), "\" />\n"; @@ -579,7 +579,7 @@ class DomainsController extends BaseController $this->printTitle($lang['strdrop'], 'pg.domain.drop'); echo '<p>', sprintf($lang['strconfdropdomain'], $this->misc->printVal($_REQUEST['domain'])), "</p>\n"; - echo '<form action="' . SUBFOLDER . "/src/views/domains.php\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/domains.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=\"drop\" />\n"; echo '<input type="hidden" name="domain" value="', htmlspecialchars($_REQUEST['domain']), "\" />\n"; @@ -638,7 +638,7 @@ class DomainsController extends BaseController $this->printTitle($lang['strcreatedomain'], 'pg.domain.create'); $this->printMsg($msg); - echo '<form action="' . SUBFOLDER . "/src/views/domains.php\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/domains.php\" method=\"post\">\n"; echo "<table>\n"; echo "<tr><th class=\"data left required\" style=\"width: 70px\">{$lang['strname']}</th>\n"; echo "<td class=\"data1\"><input name=\"domname\" size=\"32\" maxlength=\"{$data->_maxNameLen}\" value=\"", diff --git a/src/controllers/FulltextController.php b/src/controllers/FulltextController.php index 0b97a10d..ce45a831 100644 --- a/src/controllers/FulltextController.php +++ b/src/controllers/FulltextController.php @@ -324,7 +324,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"; @@ -357,7 +357,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"; @@ -421,7 +421,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"; @@ -569,7 +569,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"; @@ -886,7 +886,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=\"", @@ -1046,7 +1046,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"; @@ -1120,7 +1120,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'])) { @@ -1186,7 +1186,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"; @@ -1292,7 +1292,7 @@ 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"; diff --git a/src/controllers/FunctionsController.php b/src/controllers/FunctionsController.php index 375a7af2..a208a220 100644 --- a/src/controllers/FunctionsController.php +++ b/src/controllers/FunctionsController.php @@ -105,7 +105,7 @@ class FunctionsController extends BaseController 'function' => [ 'title' => $lang['strfunction'], 'field' => Decorator::field('proproto'), - 'url' => SUBFOLDER . "/redirect/function?action=properties&{$this->misc->href}&", + 'url' => \SUBFOLDER . "/redirect/function?action=properties&{$this->misc->href}&", 'vars' => ['function' => 'proproto', 'function_oid' => 'prooid'], ], 'returns' => [ @@ -428,7 +428,7 @@ class FunctionsController extends BaseController } $func_full = $fndata->fields['proname'] . '(' . $fndata->fields['proarguments'] . ')'; - echo '<form action="' . SUBFOLDER . "/src/views/functions.php\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/functions.php\" method=\"post\">\n"; echo "<table style=\"width: 90%\">\n"; echo "<tr>\n"; echo "<th class=\"data required\">{$lang['strschema']}</th>\n"; @@ -770,7 +770,7 @@ class FunctionsController extends BaseController $this->printTrail('schema'); $this->printTitle($lang['strdrop'], 'pg.function.drop'); - echo '<form action="' . SUBFOLDER . "/src/views/functions.php\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/functions.php\" method=\"post\">\n"; //If multi drop if (isset($_REQUEST['ma'])) { @@ -1009,7 +1009,7 @@ class FunctionsController extends BaseController } $szJSAddTR = "<tr id=\"parent_add_tr\" onclick=\"addArg();\" onmouseover=\"this.style.cursor='pointer'\">\n<td style=\"text-align: right\" colspan=\"6\" class=\"data3\"><table><tr><td class=\"data3\"><img src=\"{$szImgPath}/AddArguments.png\" alt=\"Add Argument\" /></td><td class=\"data3\"><span style=\"font-size: 8pt\">{$lang['strargadd']}</span></td></tr></table></td>\n</tr>\n"; - echo '<script src="' . SUBFOLDER . "/js/functions.js\" type=\"text/javascript\"></script> + echo '<script src="' . \SUBFOLDER . "/js/functions.js\" type=\"text/javascript\"></script> <script type=\"text/javascript\"> //<![CDATA[ var g_types_select = '<select name=\"formArgType[]\">{$szTypes}</select>{$szArgReturns}'; @@ -1026,7 +1026,7 @@ class FunctionsController extends BaseController //]]> </script> "; - echo '<form action="' . SUBFOLDER . "/src/views//views/functions.php\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views//views/functions.php\" method=\"post\">\n"; echo "<table><tbody id=\"args_table\">\n"; echo "<tr><th class=\"data required\">{$lang['strname']}</th>\n"; echo "<th class=\"data required\" colspan=\"2\">{$lang['strreturns']}</th>\n"; @@ -1124,12 +1124,12 @@ class FunctionsController extends BaseController $szJS = ''; - echo '<script src="' . SUBFOLDER . '/js/functions.js" type="text/javascript"></script>'; + echo '<script src="' . \SUBFOLDER . '/js/functions.js" type="text/javascript"></script>'; echo '<script type="text/javascript">' . $this->buildJSData() . '</script>'; if (!empty($_POST['formArgName'])) { $szJS = $this->buildJSRows($this->buildFunctionArguments($_POST)); } else { - $szJS = '<script type="text/javascript" src="' . SUBFOLDER . '/js/functions.js">noArgsRebuild(addArg());</script>'; + $szJS = '<script type="text/javascript" src="' . \SUBFOLDER . '/js/functions.js">noArgsRebuild(addArg());</script>'; } $cost = (isset($_POST['formCost'])) ? $_POST['formCost'] : null; diff --git a/src/controllers/GroupsController.php b/src/controllers/GroupsController.php index c6fe6eb8..1b4f918b 100644 --- a/src/controllers/GroupsController.php +++ b/src/controllers/GroupsController.php @@ -180,7 +180,7 @@ class GroupsController extends BaseController echo '<p>', sprintf($lang['strconfdropmember'], $this->misc->printVal($_REQUEST['user']), $this->misc->printVal($_REQUEST['group'])), "</p>\n"; - echo '<form action="' . SUBFOLDER . "/src/views/groups.php\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/groups.php\" method=\"post\">\n"; echo $this->misc->form; echo "<input type=\"hidden\" name=\"action\" value=\"drop_member\" />\n"; echo '<input type="hidden" name="group" value="', htmlspecialchars($_REQUEST['group']), "\" />\n"; @@ -251,7 +251,7 @@ class GroupsController extends BaseController } // Display form for adding a user to the group - echo '<form action="' . SUBFOLDER . "/src/views/groups.php\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/groups.php\" method=\"post\">\n"; echo '<select name="user">'; while (!$users->EOF) { $uname = $this->misc->printVal($users->fields['usename']); @@ -296,7 +296,7 @@ class GroupsController extends BaseController echo '<p>', sprintf($lang['strconfdropgroup'], $this->misc->printVal($_REQUEST['group'])), "</p>\n"; - echo '<form action="' . SUBFOLDER . "/src/views/groups.php\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/groups.php\" method=\"post\">\n"; echo $this->misc->form; echo "<input type=\"hidden\" name=\"action\" value=\"drop\" />\n"; echo '<input type="hidden" name="group" value="', htmlspecialchars($_REQUEST['group']), "\" />\n"; diff --git a/src/controllers/HistoryController.php b/src/controllers/HistoryController.php index 361b1987..ec56b0ab 100644 --- a/src/controllers/HistoryController.php +++ b/src/controllers/HistoryController.php @@ -73,14 +73,14 @@ class HistoryController extends BaseController $lang = $this->lang; $data = $this->misc->getDatabaseAccessor(); - $onchange = "onchange=\"location.href='" . SUBFOLDER . "/src/views/history.php?server=' + encodeURI(server.options[server.selectedIndex].value) + '&database=' + encodeURI(database.options[database.selectedIndex].value) + '&'\""; + $onchange = "onchange=\"location.href='" . \SUBFOLDER . "/src/views/history.php?server=' + encodeURI(server.options[server.selectedIndex].value) + '&database=' + encodeURI(database.options[database.selectedIndex].value) + '&'\""; $this->printHeader($lang['strhistory'], $this->scripts, true, 'header.twig'); // Bring to the front always echo "<body onload=\"window.focus();\">\n"; - echo '<form action="' . SUBFOLDER . "/src/views/history.php\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/history.php\" method=\"post\">\n"; $this->misc->printConnection($onchange); echo '</form><br />'; @@ -210,7 +210,7 @@ class HistoryController extends BaseController echo "<p>{$lang['strconfdelhistory']}</p>\n"; echo '<pre>', htmlentities($_SESSION['history'][$_REQUEST['server']][$_REQUEST['database']][$qid]['query'], ENT_QUOTES, 'UTF-8'), '</pre>'; - echo '<form action="' . SUBFOLDER . "/src/views/history.php\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/history.php\" method=\"post\">\n"; echo "<input type=\"hidden\" name=\"action\" value=\"delhistory\" />\n"; echo "<input type=\"hidden\" name=\"queryid\" value=\"${qid}\" />\n"; echo $this->misc->form; @@ -238,7 +238,7 @@ class HistoryController extends BaseController echo "<h3>{$lang['strclearhistory']}</h3>\n"; echo "<p>{$lang['strconfclearhistory']}</p>\n"; - echo '<form action="' . SUBFOLDER . "/src/views/history.php\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/history.php\" method=\"post\">\n"; echo "<input type=\"hidden\" name=\"action\" value=\"clearhistory\" />\n"; echo $this->misc->form; echo "<input type=\"submit\" name=\"yes\" value=\"{$lang['stryes']}\" />\n"; diff --git a/src/controllers/IndexesController.php b/src/controllers/IndexesController.php index 4d59573d..cc0a07e8 100644 --- a/src/controllers/IndexesController.php +++ b/src/controllers/IndexesController.php @@ -29,7 +29,7 @@ class IndexesController extends BaseController return $this->doTree(); } - $this->printHeader($lang['strindexes'], '<script src="' . SUBFOLDER . '/js/indexes.js" type="text/javascript"></script>'); + $this->printHeader($lang['strindexes'], '<script src="' . \SUBFOLDER . '/js/indexes.js" type="text/javascript"></script>'); if ('create_index' == $action || 'save_create_index' == $action) { echo '<body onload="init();">'; @@ -270,7 +270,7 @@ class IndexesController extends BaseController echo '<p>', sprintf($lang['strconfcluster'], $this->misc->printVal($_REQUEST['index'])), '</p>' . "\n"; - echo '<form action="' . SUBFOLDER . '/src/views/indexes.php" method="post">' . "\n"; + echo '<form action="' . \SUBFOLDER . '/src/views/indexes.php" method="post">' . "\n"; echo '<p><input type="checkbox" id="analyze" name="analyze"', (isset($_REQUEST['analyze']) ? ' checked="checked"' : ''), ' />'; echo "<label for=\"analyze\">{$lang['stranalyze']}</label></p>" . "\n"; echo '<input type="hidden" name="action" value="cluster_index" />' . "\n"; @@ -524,7 +524,7 @@ class IndexesController extends BaseController echo '<p>', sprintf($lang['strconfdropindex'], $this->misc->printVal($_REQUEST['index'])), '</p>' . "\n"; - echo '<form action="' . SUBFOLDER . '/src/views/indexes.php" method="post">' . "\n"; + echo '<form action="' . \SUBFOLDER . '/src/views/indexes.php" method="post">' . "\n"; echo '<input type="hidden" name="action" value="drop_index" />' . "\n"; echo '<input type="hidden" name="table" value="', htmlspecialchars($object), '" />' . "\n"; echo '<input type="hidden" name="index" value="', htmlspecialchars($_REQUEST['index']), '" />' . "\n"; diff --git a/src/controllers/LoginController.php b/src/controllers/LoginController.php index dee6dede..9b515da2 100644 --- a/src/controllers/LoginController.php +++ b/src/controllers/LoginController.php @@ -86,7 +86,7 @@ class LoginController extends BaseController $login_html .= $this->printMsg($msg, false); } - $login_html .= '<form id="login_form" method="post" name="login_form" action="' . SUBFOLDER . '/redirect/server?server=' . htmlspecialchars($server_id) . '">'; + $login_html .= '<form id="login_form" method="post" name="login_form" action="' . \SUBFOLDER . '/redirect/server?server=' . htmlspecialchars($server_id) . '">'; $md5_server = md5($server_id); // Pass request vars through form (is this a security risk???) diff --git a/src/controllers/MaterializedviewpropertiesController.php b/src/controllers/MaterializedviewpropertiesController.php index 2f79c934..2a025fe3 100644 --- a/src/controllers/MaterializedviewpropertiesController.php +++ b/src/controllers/MaterializedviewpropertiesController.php @@ -317,7 +317,7 @@ class MaterializedviewpropertiesController extends BaseController $_POST['formComment'] = $viewdata->fields['relcomment']; } - echo '<form action="' . SUBFOLDER . "/src/views/materializedviewproperties.php\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/materializedviewproperties.php\" method=\"post\">\n"; echo "<table style=\"width: 100%\">\n"; echo "\t<tr>\n\t\t<th class=\"data left required\">{$lang['strdefinition']}</th>\n"; echo "\t\t<td class=\"data1\"><textarea style=\"width: 100%;\" rows=\"20\" cols=\"50\" name=\"formDefinition\">", @@ -356,7 +356,7 @@ class MaterializedviewpropertiesController extends BaseController $this->printTabs('view', 'export'); $this->printMsg($msg); - echo '<form action="' . SUBFOLDER . "/src/views/dataexport.php\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/dataexport.php\" method=\"post\">\n"; echo "<table>\n"; echo "<tr><th class=\"data\">{$lang['strformat']}</th><th class=\"data\" colspan=\"2\">{$lang['stroptions']}</th></tr>\n"; // Data only @@ -473,7 +473,7 @@ class MaterializedviewpropertiesController extends BaseController $this->printTitle($lang['stralter'], 'pg.column.alter'); $this->printMsg($msg); - echo '<form action="' . SUBFOLDER . "/src/views/materializedviewproperties.php\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/materializedviewproperties.php\" method=\"post\">\n"; // Output view header echo "<table>\n"; @@ -581,7 +581,7 @@ class MaterializedviewpropertiesController extends BaseController $_POST['comment'] = $view->fields['relcomment']; } - echo '<form action="' . SUBFOLDER . "/src/views/materializedviewproperties.php\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/materializedviewproperties.php\" method=\"post\">\n"; echo "<table>\n"; echo "<tr><th class=\"data left required\">{$lang['strname']}</th>\n"; echo '<td class="data1">'; diff --git a/src/controllers/MaterializedviewsController.php b/src/controllers/MaterializedviewsController.php index 248d95f0..5d235734 100644 --- a/src/controllers/MaterializedviewsController.php +++ b/src/controllers/MaterializedviewsController.php @@ -127,7 +127,7 @@ class MaterializedviewsController extends BaseController 'matview' => [ 'title' => 'M ' . $lang['strview'], 'field' => Decorator::field('relname'), - 'url' => SUBFOLDER . "/redirect/matview?{$this->misc->href}&", + 'url' => \SUBFOLDER . "/redirect/matview?{$this->misc->href}&", 'vars' => ['matview' => 'relname'], ], 'owner' => [ @@ -322,7 +322,7 @@ class MaterializedviewsController extends BaseController $attrs = $data->getTableAttributes($_REQUEST['matview']); - echo '<form action="' . SUBFOLDER . '/src/views/' . $this->script . '" method="post" id="selectform">'; + echo '<form action="' . \SUBFOLDER . '/src/views/' . $this->script . '" method="post" id="selectform">'; echo "\n"; if ($attrs->recordCount() > 0) { @@ -456,7 +456,7 @@ class MaterializedviewsController extends BaseController $this->printTrail('getTrail'); $this->printTitle($lang['strdrop'], 'pg.matview.drop'); - echo '<form action="' . SUBFOLDER . "/src/views/materializedviews.php\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/materializedviews.php\" method=\"post\">\n"; //If multi drop if (isset($_REQUEST['ma'])) { @@ -578,7 +578,7 @@ class MaterializedviewsController extends BaseController } asort($arrFields); - echo '<form action="' . SUBFOLDER . "/src/views/materializedviews.php\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/materializedviews.php\" method=\"post\">\n"; echo "<table>\n"; echo "<tr><th class=\"data\">{$lang['strviewname']}</th></tr>"; echo "<tr>\n<td class=\"data1\">\n"; @@ -684,7 +684,7 @@ class MaterializedviewsController extends BaseController $this->printTitle($lang['strcreateviewwiz'], 'pg.matview.create'); $this->printMsg($msg); - echo '<form action="' . SUBFOLDER . "/src/views/materializedviews.php\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/materializedviews.php\" method=\"post\">\n"; echo "<table>\n"; echo "<tr><th class=\"data\">{$lang['strtables']}</th></tr>"; echo "<tr>\n<td class=\"data1\">\n"; @@ -738,7 +738,7 @@ class MaterializedviewsController extends BaseController $this->printTitle($lang['strcreateview'], 'pg.matview.create'); $this->printMsg($msg); - echo '<form action="' . SUBFOLDER . "/src/views/materializedviews.php\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/materializedviews.php\" method=\"post\">\n"; echo "<table style=\"width: 100%\">\n"; echo "\t<tr>\n\t\t<th class=\"data left required\">{$lang['strname']}</th>\n"; echo "\t<td class=\"data1\"><input name=\"formView\" size=\"32\" maxlength=\"{$data->_maxNameLen}\" value=\"", diff --git a/src/controllers/OperatorsController.php b/src/controllers/OperatorsController.php index be158c7d..d858652e 100644 --- a/src/controllers/OperatorsController.php +++ b/src/controllers/OperatorsController.php @@ -269,7 +269,7 @@ class OperatorsController extends BaseController echo '<p>', sprintf($lang['strconfdropoperator'], $this->misc->printVal($_REQUEST['operator'])), "</p>\n"; - echo '<form action="' . SUBFOLDER . "/src/views/operators.php\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/operators.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=\"drop\" />\n"; echo '<input type="hidden" name="operator" value="', htmlspecialchars($_REQUEST['operator']), "\" />\n"; diff --git a/src/controllers/PrivilegesController.php b/src/controllers/PrivilegesController.php index 9e92d7f4..e3edaa51 100644 --- a/src/controllers/PrivilegesController.php +++ b/src/controllers/PrivilegesController.php @@ -316,7 +316,7 @@ class PrivilegesController extends BaseController } $this->printMsg($msg); - echo '<form action="' . SUBFOLDER . "/src/views/privileges.php\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/privileges.php\" method=\"post\">\n"; echo "<table>\n"; echo "<tr><th class=\"data left\">{$lang['strusers']}</th>\n"; echo '<td class="data1"><select name="username[]" multiple="multiple" size="', min(6, $users->recordCount()), "\">\n"; diff --git a/src/controllers/RolesController.php b/src/controllers/RolesController.php index f8c81b29..73bee67b 100644 --- a/src/controllers/RolesController.php +++ b/src/controllers/RolesController.php @@ -122,7 +122,7 @@ class RolesController extends BaseController 'role' => [ 'title' => $lang['strrole'], 'field' => Decorator::field('rolname'), - 'url' => SUBFOLDER . "/redirect/role?action=properties&{$this->misc->href}&", + 'url' => \SUBFOLDER . "/redirect/role?action=properties&{$this->misc->href}&", 'vars' => ['rolename' => 'rolname'], ], 'superuser' => [ @@ -260,7 +260,7 @@ class RolesController extends BaseController $this->printTitle($lang['strcreaterole'], 'pg.role.create'); $this->printMsg($msg); - echo '<form action="' . SUBFOLDER . "/src/views/roles.php\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/roles.php\" method=\"post\">\n"; echo "<table>\n"; echo "\t<tr>\n\t\t<th class=\"data left required\" style=\"width: 130px\">{$lang['strname']}</th>\n"; echo "\t\t<td class=\"data1\"><input size=\"15\" maxlength=\"{$data->_maxNameLen}\" name=\"formRolename\" value=\"", htmlspecialchars($_POST['formRolename']), "\" /></td>\n\t</tr>\n"; @@ -443,7 +443,7 @@ class RolesController extends BaseController $_POST['formPassword'] = ''; } - echo '<form action="' . SUBFOLDER . "/src/views/roles.php\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/roles.php\" method=\"post\">\n"; echo "<table>\n"; echo "\t<tr>\n\t\t<th class=\"data left\" style=\"width: 130px\">{$lang['strname']}</th>\n"; echo "\t\t<td class=\"data1\">", ($canRename ? "<input name=\"formNewRoleName\" size=\"15\" maxlength=\"{$data->_maxNameLen}\" value=\"" . htmlspecialchars($_POST['formNewRoleName']) . '" />' : $this->misc->printVal($roledata->fields['rolname'])), "</td>\n\t</tr>\n"; @@ -629,7 +629,7 @@ class RolesController extends BaseController echo '<p>', sprintf($lang['strconfdroprole'], $this->misc->printVal($_REQUEST['rolename'])), "</p>\n"; - echo '<form action="' . SUBFOLDER . "/src/views/roles.php\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/roles.php\" method=\"post\">\n"; echo "<p><input type=\"hidden\" name=\"action\" value=\"drop\" />\n"; echo '<input type="hidden" name="rolename" value="', htmlspecialchars($_REQUEST['rolename']), "\" />\n"; echo $this->misc->form; @@ -861,7 +861,7 @@ class RolesController extends BaseController $_POST['confirm'] = ''; } - echo '<form action="' . SUBFOLDER . "/src/views/roles.php\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/roles.php\" method=\"post\">\n"; echo "<table>\n"; echo "\t<tr>\n\t\t<th class=\"data left required\">{$lang['strpassword']}</th>\n"; echo "\t\t<td><input type=\"password\" name=\"password\" size=\"32\" value=\"", diff --git a/src/controllers/RulesController.php b/src/controllers/RulesController.php index 01baf4c6..765f2e08 100644 --- a/src/controllers/RulesController.php +++ b/src/controllers/RulesController.php @@ -195,7 +195,7 @@ class RulesController extends BaseController $this->printTitle($lang['strcreaterule'], 'pg.rule.create'); $this->printMsg($msg); - echo '<form action="' . SUBFOLDER . "/src/views/rules.php\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/rules.php\" method=\"post\">\n"; echo "<table>\n"; echo "<tr><th class=\"data left required\">{$lang['strname']}</th>\n"; echo "<td class=\"data1\"><input name=\"name\" size=\"16\" maxlength=\"{$data->_maxNameLen}\" value=\"", @@ -273,7 +273,7 @@ class RulesController extends BaseController $this->misc->printVal($_REQUEST[$_REQUEST['reltype']]) ), "</p>\n"; - echo '<form action="' . SUBFOLDER . "/src/views/rules.php\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/rules.php\" method=\"post\">\n"; echo "<input type=\"hidden\" name=\"action\" value=\"drop\" />\n"; echo '<input type="hidden" name="subject" value="', htmlspecialchars($_REQUEST['reltype']), "\" />\n"; echo '<input type="hidden" name="', htmlspecialchars($_REQUEST['reltype']), diff --git a/src/controllers/SchemasController.php b/src/controllers/SchemasController.php index e98287b3..ffcfd4e9 100644 --- a/src/controllers/SchemasController.php +++ b/src/controllers/SchemasController.php @@ -108,7 +108,7 @@ class SchemasController extends BaseController 'schema' => [ 'title' => $lang['strschema'], 'field' => Decorator::field('nspname'), - 'url' => SUBFOLDER . "/redirect/schema?{$this->misc->href}&", + 'url' => \SUBFOLDER . "/redirect/schema?{$this->misc->href}&", 'vars' => ['schema' => 'nspname'], ], 'owner' => [ @@ -298,7 +298,7 @@ class SchemasController extends BaseController $this->printTitle($lang['strcreateschema'], 'pg.schema.create'); $this->printMsg($msg); - echo '<form action="' . SUBFOLDER . '/src/views/schemas.php" method="post">' . "\n"; + echo '<form action="' . \SUBFOLDER . '/src/views/schemas.php" method="post">' . "\n"; echo "<table style=\"width: 100%\">\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=\"", @@ -382,7 +382,7 @@ class SchemasController extends BaseController $_POST['owner'] = $schema->fields['ownername']; } - echo '<form action="' . SUBFOLDER . '/src/views/schemas.php" method="post">' . "\n"; + echo '<form action="' . \SUBFOLDER . '/src/views/schemas.php" method="post">' . "\n"; echo "<table>\n"; echo "\t<tr>\n"; @@ -459,7 +459,7 @@ class SchemasController extends BaseController $this->printTrail('schema'); $this->printTitle($lang['strdrop'], 'pg.schema.drop'); - echo '<form action="' . SUBFOLDER . '/src/views/schemas.php" method="post">' . "\n"; + echo '<form action="' . \SUBFOLDER . '/src/views/schemas.php" method="post">' . "\n"; //If multi drop if (isset($_REQUEST['ma'])) { foreach ($_REQUEST['ma'] as $v) { @@ -528,7 +528,7 @@ class SchemasController extends BaseController $this->printTabs('schema', 'export'); $this->printMsg($msg); - echo '<form action="' . SUBFOLDER . '/src/views/dbexport.php" method="post">' . "\n"; + echo '<form action="' . \SUBFOLDER . '/src/views/dbexport.php" method="post">' . "\n"; echo "<table>\n"; echo "<tr><th class=\"data\">{$lang['strformat']}</th><th class=\"data\" colspan=\"2\">{$lang['stroptions']}</th></tr>\n"; diff --git a/src/controllers/SequencesController.php b/src/controllers/SequencesController.php index 6d289e1f..a563c128 100644 --- a/src/controllers/SequencesController.php +++ b/src/controllers/SequencesController.php @@ -417,7 +417,7 @@ class SequencesController extends BaseController $this->printTitle($lang['strdrop'], 'pg.sequence.drop'); $this->printMsg($msg); - echo '<form action="' . SUBFOLDER . "/src/views/sequences.php\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/sequences.php\" method=\"post\">\n"; //If multi drop if (isset($_REQUEST['ma'])) { @@ -512,7 +512,7 @@ class SequencesController extends BaseController $this->printTitle($lang['strcreatesequence'], 'pg.sequence.create'); $this->printMsg($msg); - echo '<form action="' . SUBFOLDER . "/src/views/sequences.php\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/sequences.php\" method=\"post\">\n"; echo "<table>\n"; echo "<tr><th class=\"data left required\">{$lang['strname']}</th>\n"; @@ -673,7 +673,7 @@ class SequencesController extends BaseController $sequence = $data->getSequence($_REQUEST['sequence']); if (is_object($sequence) && $sequence->recordCount() > 0) { - echo '<form action="' . SUBFOLDER . "/src/views/sequences.php\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/sequences.php\" method=\"post\">\n"; echo '<table border="0">'; echo "<tr><th class=\"data left required\">{$lang['strlastvalue']}</th>\n"; echo '<td class="data1">'; @@ -811,7 +811,7 @@ class SequencesController extends BaseController $_POST['formCycledValue'] = 'on'; } - echo '<form action="' . SUBFOLDER . "/src/views/sequences.php\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/sequences.php\" method=\"post\">\n"; echo "<table>\n"; echo "<tr><th class=\"data left required\">{$lang['strname']}</th>\n"; diff --git a/src/controllers/ServersController.php b/src/controllers/ServersController.php index 08d567bf..864c3fbd 100644 --- a/src/controllers/ServersController.php +++ b/src/controllers/ServersController.php @@ -99,7 +99,7 @@ class ServersController extends BaseController 'server' => [ 'title' => $lang['strserver'], 'field' => Decorator::field('desc'), - 'url' => SUBFOLDER . '/redirect/server?', + 'url' => \SUBFOLDER . '/redirect/server?', 'vars' => ['server' => 'id'], ], 'host' => [ diff --git a/src/controllers/SqleditController.php b/src/controllers/SqleditController.php index dba1cb06..88296056 100644 --- a/src/controllers/SqleditController.php +++ b/src/controllers/SqleditController.php @@ -75,7 +75,7 @@ class SqleditController extends BaseController $default_html = $this->printTabs($this->misc->getNavTabs('popup'), 'sql', false); - $default_html .= '<form action="' . SUBFOLDER . '/src/views/sql" method="post" enctype="multipart/form-data" class="sqlform" id="sqlform" target="detail">'; + $default_html .= '<form action="' . \SUBFOLDER . '/src/views/sql" method="post" enctype="multipart/form-data" class="sqlform" id="sqlform" target="detail">'; $default_html .= "\n"; $default_html .= $this->_printConnection('sql'); @@ -149,7 +149,7 @@ class SqleditController extends BaseController // The javascript action on the select box reloads the // popup whenever the server or database is changed. // This ensures that the correct page encoding is used. - $onchange = "onchange=\"location.href='" . SUBFOLDER . '/sqledit/' . + $onchange = "onchange=\"location.href='" . \SUBFOLDER . '/sqledit/' . urlencode($action) . "?server=' + encodeURI(server.options[server.selectedIndex].value) + '&database=' + encodeURI(database.options[database.selectedIndex].value) + "; // The exact URL to reload to is different between SQL and Find mode, however. diff --git a/src/controllers/TablesController.php b/src/controllers/TablesController.php index 2b7347ed..2aa1ef17 100644 --- a/src/controllers/TablesController.php +++ b/src/controllers/TablesController.php @@ -160,7 +160,7 @@ class TablesController extends BaseController 'table' => [ 'title' => $lang['strtable'], 'field' => Decorator::field('relname'), - 'url' => SUBFOLDER . "/redirect/table?{$this->misc->href}&", + 'url' => \SUBFOLDER . "/redirect/table?{$this->misc->href}&", 'vars' => ['table' => 'relname'], ], 'owner' => [ @@ -464,7 +464,7 @@ class TablesController extends BaseController $this->printTitle($lang['strcreatetable'], 'pg.table.create'); $this->printMsg($msg); - echo '<form action="' . SUBFOLDER . '/src/views/' . $this->script . '" method="post">'; + echo '<form action="' . \SUBFOLDER . '/src/views/' . $this->script . '" method="post">'; echo "\n"; echo "<table>\n"; echo "\t<tr>\n\t\t<th class=\"data left required\">{$lang['strname']}</th>\n"; @@ -530,8 +530,8 @@ class TablesController extends BaseController $this->printTitle($lang['strcreatetable'], 'pg.table.create'); $this->printMsg($msg); - echo '<script src="' . SUBFOLDER . '/js/tables.js" type="text/javascript"></script>'; - echo '<form action="' . SUBFOLDER . "/src/views/tables.php\" method=\"post\">\n"; + echo '<script src="' . \SUBFOLDER . '/js/tables.js" type="text/javascript"></script>'; + echo '<form action="' . \SUBFOLDER . "/src/views/tables.php\" method=\"post\">\n"; // Output table header echo "<table>\n"; @@ -750,7 +750,7 @@ class TablesController extends BaseController unset($tbltmp); - echo '<form action="' . SUBFOLDER . "/src/views/tables.php\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/tables.php\" method=\"post\">\n"; echo "<table>\n\t<tr>\n\t\t<th class=\"data left required\">{$lang['strname']}</th>\n"; echo "\t\t<td class=\"data\"><input name=\"name\" size=\"32\" maxlength=\"{$data->_maxNameLen}\" value=\"", htmlspecialchars($_REQUEST['name']), "\" /></td>\n\t</tr>\n"; echo "\t<tr>\n\t\t<th class=\"data left required\">{$lang['strcreatetablelikeparent']}</th>\n"; @@ -849,7 +849,7 @@ class TablesController extends BaseController $attrs = $data->getTableAttributes($_REQUEST['table']); - echo '<form action="' . SUBFOLDER . "/src/views/tables.php\" method=\"post\" id=\"selectform\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/tables.php\" method=\"post\" id=\"selectform\">\n"; if ($attrs->recordCount() > 0) { // JavaScript for select all feature echo "<script type=\"text/javascript\">\n"; @@ -994,7 +994,7 @@ class TablesController extends BaseController $fksprops = false; } - echo '<form action="' . SUBFOLDER . "/src/views/tables.php\" method=\"post\" id=\"ac_form\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/tables.php\" method=\"post\" id=\"ac_form\">\n"; if ($attrs->recordCount() > 0) { echo "<table>\n"; @@ -1136,7 +1136,7 @@ class TablesController extends BaseController $this->printTrail('schema'); $this->printTitle($lang['strempty'], 'pg.table.empty'); - echo '<form action="' . SUBFOLDER . "/src/views/tables.php\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/tables.php\" method=\"post\">\n"; foreach ($_REQUEST['ma'] as $v) { $a = unserialize(htmlspecialchars_decode($v, ENT_QUOTES)); echo '<p>', sprintf($lang['strconfemptytable'], $this->misc->printVal($a['table'])), "</p>\n"; @@ -1149,7 +1149,7 @@ class TablesController extends BaseController echo '<p>', sprintf($lang['strconfemptytable'], $this->misc->printVal($_REQUEST['table'])), "</p>\n"; - echo '<form action="' . SUBFOLDER . "/src/views/tables.php\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/tables.php\" method=\"post\">\n"; echo '<input type="hidden" name="table" value="', htmlspecialchars($_REQUEST['table']), "\" />\n"; } // END not mutli empty @@ -1206,7 +1206,7 @@ class TablesController extends BaseController $this->printTrail('schema'); $this->printTitle($lang['strdrop'], 'pg.table.drop'); - echo '<form action="' . SUBFOLDER . "/src/views/tables.php\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/tables.php\" method=\"post\">\n"; foreach ($_REQUEST['ma'] as $v) { $a = unserialize(htmlspecialchars_decode($v, ENT_QUOTES)); echo '<p>', sprintf($lang['strconfdroptable'], $this->misc->printVal($a['table'])), "</p>\n"; @@ -1218,7 +1218,7 @@ class TablesController extends BaseController echo '<p>', sprintf($lang['strconfdroptable'], $this->misc->printVal($_REQUEST['table'])), "</p>\n"; - echo '<form action="' . SUBFOLDER . "/src/views/tables.php\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/tables.php\" method=\"post\">\n"; echo '<input type="hidden" name="table" value="', htmlspecialchars($_REQUEST['table']), "\" />\n"; } // END if multi drop diff --git a/src/controllers/TablespacesController.php b/src/controllers/TablespacesController.php index a32ceee7..152a0d4b 100644 --- a/src/controllers/TablespacesController.php +++ b/src/controllers/TablespacesController.php @@ -205,7 +205,7 @@ class TablespacesController extends BaseController $_POST['comment'] = ($data->hasSharedComments()) ? $tablespace->fields['spccomment'] : ''; } - echo '<form action="' . SUBFOLDER . "/src/views/tablespaces.php\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/tablespaces.php\" method=\"post\">\n"; echo $this->misc->form; echo "<table>\n"; echo "<tr><th class=\"data left required\">{$lang['strname']}</th>\n"; @@ -283,7 +283,7 @@ class TablespacesController extends BaseController echo '<p>', sprintf($lang['strconfdroptablespace'], $this->misc->printVal($_REQUEST['tablespace'])), "</p>\n"; - echo '<form action="' . SUBFOLDER . "/src/views/tablespaces.php\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/tablespaces.php\" method=\"post\">\n"; echo $this->misc->form; echo "<input type=\"hidden\" name=\"action\" value=\"drop\" />\n"; echo '<input type="hidden" name="tablespace" value="', htmlspecialchars($_REQUEST['tablespace']), "\" />\n"; @@ -336,7 +336,7 @@ class TablespacesController extends BaseController $this->printTitle($lang['strcreatetablespace'], 'pg.tablespace.create'); $this->printMsg($msg); - echo '<form action="' . SUBFOLDER . "/src/views/tablespaces.php\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/tablespaces.php\" method=\"post\">\n"; echo $this->misc->form; echo "<table>\n"; echo "\t<tr>\n\t\t<th class=\"data left required\">{$lang['strname']}</th>\n"; diff --git a/src/controllers/TblpropertiesController.php b/src/controllers/TblpropertiesController.php index 75da39ad..3fda8c07 100644 --- a/src/controllers/TblpropertiesController.php +++ b/src/controllers/TblpropertiesController.php @@ -539,7 +539,7 @@ class TblpropertiesController extends BaseController $_POST['tablespace'] = $table->fields['tablespace']; } - echo '<form action="' . SUBFOLDER . "/src/views/tblproperties.php\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/tblproperties.php\" method=\"post\">\n"; echo "<table>\n"; echo "<tr><th class=\"data left required\">{$lang['strname']}</th>\n"; echo '<td class="data1">'; @@ -618,7 +618,7 @@ class TblpropertiesController extends BaseController $this->printTabs('table', 'export'); $this->printMsg($msg); - echo '<form action="' . SUBFOLDER . "/src/views/dataexport.php\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/dataexport.php\" method=\"post\">\n"; echo "<table>\n"; echo "<tr><th class=\"data\">{$lang['strformat']}</th><th class=\"data\" colspan=\"2\">{$lang['stroptions']}</th></tr>\n"; // Data only @@ -681,7 +681,7 @@ class TblpropertiesController extends BaseController // Don't show upload option if max size of uploads is zero $max_size = $misc->inisizeToBytes(ini_get('upload_max_filesize')); if (is_double($max_size) && $max_size > 0) { - echo '<form action="' . SUBFOLDER . "/src/views/dataimport.php\" method=\"post\" enctype=\"multipart/form-data\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/dataimport.php\" method=\"post\" enctype=\"multipart/form-data\">\n"; echo "<table>\n"; echo "\t<tr>\n\t\t<th class=\"data left required\">{$lang['strformat']}</th>\n"; echo "\t\t<td><select name=\"format\">\n"; @@ -761,8 +761,8 @@ class TblpropertiesController extends BaseController $this->printTitle($lang['straddcolumn'], 'pg.column.add'); $this->printMsg($msg); - echo '<script src="' . SUBFOLDER . '/js/tables.js" type="text/javascript"></script>'; - echo '<form action="' . SUBFOLDER . "/src/views/tblproperties.php\" method=\"post\">\n"; + echo '<script src="' . \SUBFOLDER . '/js/tables.js" type="text/javascript"></script>'; + echo '<form action="' . \SUBFOLDER . "/src/views/tblproperties.php\" method=\"post\">\n"; // Output table header echo "<table>\n"; @@ -890,7 +890,7 @@ class TblpropertiesController extends BaseController $misc->printVal($_REQUEST['table']) ), "</p>\n"; - echo '<form action="' . SUBFOLDER . "/src/views/tblproperties.php\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/tblproperties.php\" method=\"post\">\n"; echo "<input type=\"hidden\" name=\"action\" value=\"drop\" />\n"; echo '<input type="hidden" name="table" value="', htmlspecialchars($_REQUEST['table']), "\" />\n"; echo '<input type="hidden" name="column" value="', htmlspecialchars($_REQUEST['column']), "\" />\n"; diff --git a/src/controllers/TriggersController.php b/src/controllers/TriggersController.php index 96b18946..5b8733a8 100644 --- a/src/controllers/TriggersController.php +++ b/src/controllers/TriggersController.php @@ -289,7 +289,7 @@ class TriggersController extends BaseController $_POST['name'] = $triggerdata->fields['tgname']; } - echo '<form action="' . SUBFOLDER . "/src/views/triggers.php\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/triggers.php\" method=\"post\">\n"; echo "<table>\n"; echo "<tr><th class=\"data\">{$lang['strname']}</th>\n"; echo '<td class="data1">'; @@ -329,7 +329,7 @@ class TriggersController extends BaseController $this->misc->printVal($_REQUEST['table']) ), "</p>\n"; - echo '<form action="' . SUBFOLDER . "/src/views/triggers.php\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/triggers.php\" method=\"post\">\n"; echo "<input type=\"hidden\" name=\"action\" value=\"drop\" />\n"; echo '<input type="hidden" name="table" value="', htmlspecialchars($_REQUEST['table']), "\" />\n"; echo '<input type="hidden" name="trigger" value="', htmlspecialchars($_REQUEST['trigger']), "\" />\n"; @@ -369,7 +369,7 @@ class TriggersController extends BaseController $this->misc->printVal($_REQUEST['table']) ), "</p>\n"; - echo '<form action="' . SUBFOLDER . "/src/views/triggers.php\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/triggers.php\" method=\"post\">\n"; echo "<input type=\"hidden\" name=\"action\" value=\"enable\" />\n"; echo '<input type="hidden" name="table" value="', htmlspecialchars($_REQUEST['table']), "\" />\n"; echo '<input type="hidden" name="trigger" value="', htmlspecialchars($_REQUEST['trigger']), "\" />\n"; @@ -408,7 +408,7 @@ class TriggersController extends BaseController $this->misc->printVal($_REQUEST['table']) ), "</p>\n"; - echo '<form action="' . SUBFOLDER . "/src/views/triggers.php\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/triggers.php\" method=\"post\">\n"; echo "<input type=\"hidden\" name=\"action\" value=\"disable\" />\n"; echo '<input type="hidden" name="table" value="', htmlspecialchars($_REQUEST['table']), "\" />\n"; echo '<input type="hidden" name="trigger" value="', htmlspecialchars($_REQUEST['trigger']), "\" />\n"; @@ -468,7 +468,7 @@ class TriggersController extends BaseController $sel3 = new \PHPPgAdmin\XHtml\XHtmlSelect('formFrequency'); $sel3->set_data($data->triggerFrequency); - echo '<form action="' . SUBFOLDER . "/src/views/triggers.php\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/triggers.php\" method=\"post\">\n"; echo "<table>\n"; echo "<tr>\n"; echo " <th class=\"data\">{$lang['strname']}</th>\n"; diff --git a/src/controllers/TypesController.php b/src/controllers/TypesController.php index 5e12b9c6..51e32fd1 100644 --- a/src/controllers/TypesController.php +++ b/src/controllers/TypesController.php @@ -354,7 +354,7 @@ class TypesController extends BaseController echo '<p>', sprintf($lang['strconfdroptype'], $this->misc->printVal($_REQUEST['type'])), "</p>\n"; - echo '<form action="' . SUBFOLDER . "/src/views/types.php\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/types.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=\"drop\" />\n"; echo '<input type="hidden" name="type" value="', htmlspecialchars($_REQUEST['type']), "\" />\n"; @@ -405,7 +405,7 @@ class TypesController extends BaseController $this->printTitle($lang['strcreatecomptype'], 'pg.type.create'); $this->printMsg($msg); - echo '<form action="' . SUBFOLDER . "/src/views/types.php\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/types.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=\"data\"><input name=\"name\" size=\"32\" maxlength=\"{$data->_maxNameLen}\" value=\"", @@ -450,7 +450,7 @@ class TypesController extends BaseController $this->printTitle($lang['strcreatecomptype'], 'pg.type.create'); $this->printMsg($msg); - echo '<form action="' . SUBFOLDER . "/src/views/types.php\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/types.php\" method=\"post\">\n"; // Output table header echo "<table>\n"; @@ -588,7 +588,7 @@ class TypesController extends BaseController $this->printTitle($lang['strcreateenumtype'], 'pg.type.create'); $this->printMsg($msg); - echo '<form action="' . SUBFOLDER . "/src/views/types.php\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/types.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=\"data\"><input name=\"name\" size=\"32\" maxlength=\"{$data->_maxNameLen}\" value=\"", @@ -631,7 +631,7 @@ class TypesController extends BaseController $this->printTitle($lang['strcreateenumtype'], 'pg.type.create'); $this->printMsg($msg); - echo '<form action="' . SUBFOLDER . "/src/views/types.php\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/types.php\" method=\"post\">\n"; // Output table header echo "<table>\n"; @@ -752,7 +752,7 @@ class TypesController extends BaseController $this->printTitle($lang['strcreatetype'], 'pg.type.create'); $this->printMsg($msg); - echo '<form action="' . SUBFOLDER . "/src/views/types.php\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/types.php\" method=\"post\">\n"; echo "<table>\n"; echo "<tr><th class=\"data left required\">{$lang['strname']}</th>\n"; echo "<td class=\"data1\"><input name=\"typname\" size=\"32\" maxlength=\"{$data->_maxNameLen}\" value=\"", diff --git a/src/controllers/UsersController.php b/src/controllers/UsersController.php index 6cfe66ea..187e437b 100644 --- a/src/controllers/UsersController.php +++ b/src/controllers/UsersController.php @@ -261,7 +261,7 @@ class UsersController extends BaseController $_POST['confirm'] = ''; } - echo '<form action="' . SUBFOLDER . "/src/views/users.php\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/users.php\" method=\"post\">\n"; echo "<table>\n"; echo "\t<tr>\n\t\t<th class=\"data left required\">{$lang['strpassword']}</th>\n"; echo "\t\t<td><input type=\"password\" name=\"password\" size=\"32\" value=\"", @@ -337,7 +337,7 @@ class UsersController extends BaseController $_POST['formPassword'] = ''; } - echo '<form action="' . SUBFOLDER . "/src/views/users.php\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/users.php\" method=\"post\">\n"; echo "<table>\n"; echo "\t<tr>\n\t\t<th class=\"data left\">{$lang['strusername']}</th>\n"; echo "\t\t<td class=\"data1\">", ($canRename ? "<input name=\"newname\" size=\"15\" maxlength=\"{$data->_maxNameLen}\" value=\"" . htmlspecialchars($_POST['newname']) . '" />' : $this->misc->printVal($userdata->fields['usename'])), "</td>\n\t</tr>\n"; @@ -412,7 +412,7 @@ class UsersController extends BaseController echo '<p>', sprintf($lang['strconfdropuser'], $this->misc->printVal($_REQUEST['username'])), "</p>\n"; - echo '<form action="' . SUBFOLDER . "/src/views/users.php\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/users.php\" method=\"post\">\n"; echo "<p><input type=\"hidden\" name=\"action\" value=\"drop\" />\n"; echo '<input type="hidden" name="username" value="', htmlspecialchars($_REQUEST['username']), "\" />\n"; echo $this->misc->form; @@ -460,7 +460,7 @@ class UsersController extends BaseController $this->printTitle($lang['strcreateuser'], 'pg.user.create'); $this->printMsg($msg); - echo '<form action="' . SUBFOLDER . "/src/views/users.php\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/users.php\" method=\"post\">\n"; echo "<table>\n"; echo "\t<tr>\n\t\t<th class=\"data left required\">{$lang['strusername']}</th>\n"; echo "\t\t<td class=\"data1\"><input size=\"15\" maxlength=\"{$data->_maxNameLen}\" name=\"formUsername\" value=\"", htmlspecialchars($_POST['formUsername']), "\" /></td>\n\t</tr>\n"; diff --git a/src/controllers/ViewpropertiesController.php b/src/controllers/ViewpropertiesController.php index afac462d..8b32d456 100644 --- a/src/controllers/ViewpropertiesController.php +++ b/src/controllers/ViewpropertiesController.php @@ -317,7 +317,7 @@ class ViewpropertiesController extends BaseController $_POST['formComment'] = $viewdata->fields['relcomment']; } - echo '<form action="' . SUBFOLDER . "/src/views/viewproperties.php\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/viewproperties.php\" method=\"post\">\n"; echo "<table style=\"width: 100%\">\n"; echo "\t<tr>\n\t\t<th class=\"data left required\">{$lang['strdefinition']}</th>\n"; echo "\t\t<td class=\"data1\"><textarea style=\"width: 100%;\" rows=\"20\" cols=\"50\" name=\"formDefinition\">", @@ -356,7 +356,7 @@ class ViewpropertiesController extends BaseController $this->printTabs('view', 'export'); $this->printMsg($msg); - echo '<form action="' . SUBFOLDER . "/src/views/dataexport.php\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/dataexport.php\" method=\"post\">\n"; echo "<table>\n"; echo "<tr><th class=\"data\">{$lang['strformat']}</th><th class=\"data\" colspan=\"2\">{$lang['stroptions']}</th></tr>\n"; // Data only @@ -473,7 +473,7 @@ class ViewpropertiesController extends BaseController $this->printTitle($lang['stralter'], 'pg.column.alter'); $this->printMsg($msg); - echo '<form action="' . SUBFOLDER . "/src/views/viewproperties.php\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/viewproperties.php\" method=\"post\">\n"; // Output view header echo "<table>\n"; @@ -581,7 +581,7 @@ class ViewpropertiesController extends BaseController $_POST['comment'] = $view->fields['relcomment']; } - echo '<form action="' . SUBFOLDER . "/src/views/viewproperties.php\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/viewproperties.php\" method=\"post\">\n"; echo "<table>\n"; echo "<tr><th class=\"data left required\">{$lang['strname']}</th>\n"; echo '<td class="data1">'; diff --git a/src/controllers/ViewsController.php b/src/controllers/ViewsController.php index d732793a..c44c0c1f 100644 --- a/src/controllers/ViewsController.php +++ b/src/controllers/ViewsController.php @@ -126,7 +126,7 @@ class ViewsController extends BaseController 'view' => [ 'title' => $lang['strview'], 'field' => Decorator::field('relname'), - 'url' => SUBFOLDER . "/redirect/view?{$this->misc->href}&", + 'url' => \SUBFOLDER . "/redirect/view?{$this->misc->href}&", 'vars' => ['view' => 'relname'], ], 'owner' => [ @@ -321,7 +321,7 @@ class ViewsController extends BaseController $attrs = $data->getTableAttributes($_REQUEST['view']); - echo '<form action="' . SUBFOLDER . '/src/views/' . $this->script . '" method="post" id="selectform">'; + echo '<form action="' . \SUBFOLDER . '/src/views/' . $this->script . '" method="post" id="selectform">'; echo "\n"; if ($attrs->recordCount() > 0) { @@ -455,7 +455,7 @@ class ViewsController extends BaseController $this->printTrail('view'); $this->printTitle($lang['strdrop'], 'pg.view.drop'); - echo '<form action="' . SUBFOLDER . "/src/views/views.php\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/views.php\" method=\"post\">\n"; //If multi drop if (isset($_REQUEST['ma'])) { @@ -577,7 +577,7 @@ class ViewsController extends BaseController } asort($arrFields); - echo '<form action="' . SUBFOLDER . "/src/views/views.php\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/views.php\" method=\"post\">\n"; echo "<table>\n"; echo "<tr><th class=\"data\">{$lang['strviewname']}</th></tr>"; echo "<tr>\n<td class=\"data1\">\n"; @@ -683,7 +683,7 @@ class ViewsController extends BaseController $this->printTitle($lang['strcreateviewwiz'], 'pg.view.create'); $this->printMsg($msg); - echo '<form action="' . SUBFOLDER . "/src/views/views.php\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/views.php\" method=\"post\">\n"; echo "<table>\n"; echo "<tr><th class=\"data\">{$lang['strtables']}</th></tr>"; echo "<tr>\n<td class=\"data1\">\n"; @@ -737,7 +737,7 @@ class ViewsController extends BaseController $this->printTitle($lang['strcreateview'], 'pg.view.create'); $this->printMsg($msg); - echo '<form action="' . SUBFOLDER . "/src/views/views.php\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/views.php\" method=\"post\">\n"; echo "<table style=\"width: 100%\">\n"; echo "\t<tr>\n\t\t<th class=\"data left required\">{$lang['strname']}</th>\n"; echo "\t<td class=\"data1\"><input name=\"formView\" size=\"32\" maxlength=\"{$data->_maxNameLen}\" value=\"", diff --git a/src/decorators/ActionUrlDecorator.php b/src/decorators/ActionUrlDecorator.php index 9c7e0fd1..8ea79f73 100644 --- a/src/decorators/ActionUrlDecorator.php +++ b/src/decorators/ActionUrlDecorator.php @@ -1,5 +1,9 @@ <?php +/* + * PHPPgAdmin v6.0.0-beta.30 + */ + namespace PHPPgAdmin\Decorators; class ActionUrlDecorator extends Decorator @@ -7,7 +11,7 @@ class ActionUrlDecorator extends Decorator public function __construct($base, $queryVars = null) { $this->b = $base; - if ($queryVars !== null) { + if (null !== $queryVars) { $this->q = $queryVars; } } @@ -17,7 +21,7 @@ class ActionUrlDecorator extends Decorator //$this->prtrace($fields); $url = Decorator::get_sanitized_value($this->b, $fields); - if ($url === false) { + if (false === $url) { return ''; } @@ -31,6 +35,7 @@ class ActionUrlDecorator extends Decorator $sep = '&'; } } - return SUBFOLDER . '/src/views/' . str_replace('.php', '', $url); + + return \SUBFOLDER . '/src/views/' . str_replace('.php', '', $url); } } diff --git a/src/decorators/ArrayMergeDecorator.php b/src/decorators/ArrayMergeDecorator.php index c8fc9e36..67b08179 100644 --- a/src/decorators/ArrayMergeDecorator.php +++ b/src/decorators/ArrayMergeDecorator.php @@ -1,5 +1,9 @@ <?php +/* + * PHPPgAdmin v6.0.0-beta.30 + */ + namespace PHPPgAdmin\Decorators; class ArrayMergeDecorator extends Decorator diff --git a/src/decorators/BranchUrlDecorator.php b/src/decorators/BranchUrlDecorator.php index 2cebc9e6..0105b5ca 100644 --- a/src/decorators/BranchUrlDecorator.php +++ b/src/decorators/BranchUrlDecorator.php @@ -1,16 +1,19 @@ <?php +/* + * PHPPgAdmin v6.0.0-beta.30 + */ + namespace PHPPgAdmin\Decorators; class BranchUrlDecorator extends Decorator { public function __construct($base, $queryVars = null) { - //\PC::debug($base, 'BranchUrlDecorator'); $this->b = $base; - if ($queryVars !== null) { + if (null !== $queryVars) { $this->q = $queryVars; } } @@ -19,7 +22,7 @@ class BranchUrlDecorator extends Decorator { $url = Decorator::get_sanitized_value($this->b, $fields); - if ($url === false) { + if (false === $url) { return ''; } @@ -30,8 +33,8 @@ class BranchUrlDecorator extends Decorator foreach ($queryVars as $var => $value) { $varname = Decorator::value_url($var, $fields); $varvalue = Decorator::value_url($value, $fields); - if ($varname == 'action') { - if ($varvalue == 'subtree') { + if ('action' == $varname) { + if ('subtree' == $varvalue) { $url = '/tree/' . str_replace('.php', '/subtree', $url); } else { $url = '/tree/' . str_replace('.php', '', $url); @@ -41,9 +44,10 @@ class BranchUrlDecorator extends Decorator $sep = '&'; } } - if (SUBFOLDER !== '' && (strpos($url, '/') === 0) && (strpos($url, SUBFOLDER) === false)) { - $url = str_replace('//', '/', SUBFOLDER . '/' . $url); + if (\SUBFOLDER !== '' && (0 === strpos($url, '/')) && (false === strpos($url, \SUBFOLDER))) { + $url = str_replace('//', '/', \SUBFOLDER . '/' . $url); } + return str_replace('.php', '', $url); } } diff --git a/src/decorators/CallbackDecorator.php b/src/decorators/CallbackDecorator.php index 3ad85a8b..60883b36 100644 --- a/src/decorators/CallbackDecorator.php +++ b/src/decorators/CallbackDecorator.php @@ -1,5 +1,9 @@ <?php +/* + * PHPPgAdmin v6.0.0-beta.30 + */ + namespace PHPPgAdmin\Decorators; class CallbackDecorator extends Decorator diff --git a/src/decorators/ConcatDecorator.php b/src/decorators/ConcatDecorator.php index 4bedfab0..828308b0 100644 --- a/src/decorators/ConcatDecorator.php +++ b/src/decorators/ConcatDecorator.php @@ -1,5 +1,9 @@ <?php +/* + * PHPPgAdmin v6.0.0-beta.30 + */ + namespace PHPPgAdmin\Decorators; class ConcatDecorator extends Decorator diff --git a/src/decorators/Decorator.php b/src/decorators/Decorator.php index 7a641b31..891f530c 100644 --- a/src/decorators/Decorator.php +++ b/src/decorators/Decorator.php @@ -1,4 +1,9 @@ <?php + +/* + * PHPPgAdmin v6.0.0-beta.30 + */ + namespace PHPPgAdmin\Decorators; class Decorator @@ -17,7 +22,6 @@ class Decorator public static function get_sanitized_value(&$var, &$fields, $esc = null) { - //self::statictrace($var, $fields, $esc); if (is_a($var, 'PHPPgAdmin\Decorators\Decorator')) { $val = $var->value($fields); @@ -41,6 +45,7 @@ class Decorator return urlencode($val); } } + return $val; } @@ -49,9 +54,9 @@ class Decorator $val = self::get_sanitized_value($var, $fields, 'xml'); if (!empty($val)) { return " {$attr}=\"{$val}\""; - } else { - return ''; } + + return ''; } public static function value_xml_attr_tag($attr, &$var, &$fields) @@ -59,9 +64,9 @@ class Decorator $val = self::get_sanitized_value($var, $fields, 'xml'); if (!empty($val)) { return "<{$attr}>{$val}</{$attr}>"; - } else { - return ''; } + + return ''; } public static function callback($callback, $params = null) @@ -100,6 +105,7 @@ class Decorator return new BranchUrlDecorator($base, new ArrayMergeDecorator($v)); } + return new BranchUrlDecorator($base, $vars); } @@ -114,6 +120,7 @@ class Decorator return new ActionUrlDecorator($base, new ArrayMergeDecorator($v)); } + return new ActionUrlDecorator($base, $vars); } @@ -128,6 +135,7 @@ class Decorator return new RedirectUrlDecorator($base, new ArrayMergeDecorator($v)); } + return new RedirectUrlDecorator($base, $vars); } @@ -140,8 +148,10 @@ class Decorator if (func_num_args() > 2) { $v = func_get_args(); $base = array_shift($v); + return new UrlDecorator($base, new ArrayMergeDecorator($v)); } + return new UrlDecorator($base, $vars); } diff --git a/src/decorators/FieldDecorator.php b/src/decorators/FieldDecorator.php index 7542c2d1..2fc74ac0 100644 --- a/src/decorators/FieldDecorator.php +++ b/src/decorators/FieldDecorator.php @@ -1,5 +1,9 @@ <?php +/* + * PHPPgAdmin v6.0.0-beta.30 + */ + namespace PHPPgAdmin\Decorators; class FieldDecorator extends Decorator @@ -7,7 +11,7 @@ class FieldDecorator extends Decorator public function __construct($fieldName, $default = null) { $this->f = $fieldName; - if ($default !== null) { + if (null !== $default) { $this->d = $default; } } @@ -16,10 +20,11 @@ class FieldDecorator extends Decorator { if (isset($fields[$this->f])) { return Decorator::get_sanitized_value($fields[$this->f], $fields); - } elseif (isset($this->d)) { + } + if (isset($this->d)) { return $this->d; - } else { - return null; } + + return null; } } diff --git a/src/decorators/IfEmptyDecorator.php b/src/decorators/IfEmptyDecorator.php index 56691585..d93a47c5 100644 --- a/src/decorators/IfEmptyDecorator.php +++ b/src/decorators/IfEmptyDecorator.php @@ -1,5 +1,9 @@ <?php +/* + * PHPPgAdmin v6.0.0-beta.30 + */ + namespace PHPPgAdmin\Decorators; class IfEmptyDecorator extends Decorator @@ -8,7 +12,7 @@ class IfEmptyDecorator extends Decorator { $this->v = $value; $this->e = $empty; - if ($full !== null) { + if (null !== $full) { $this->f = $full; } } @@ -18,10 +22,9 @@ class IfEmptyDecorator extends Decorator $val = Decorator::get_sanitized_value($this->v, $fields); if (empty($val)) { return Decorator::get_sanitized_value($this->e, $fields); - } else { - return isset($this->f) ? Decorator::get_sanitized_value($this->f, $fields) : $val; } return isset($this->f) ? Decorator::get_sanitized_value($this->f, $fields) : $val; + return isset($this->f) ? Decorator::get_sanitized_value($this->f, $fields) : $val; } } diff --git a/src/decorators/RedirectUrlDecorator.php b/src/decorators/RedirectUrlDecorator.php index b11de529..a5012d34 100644 --- a/src/decorators/RedirectUrlDecorator.php +++ b/src/decorators/RedirectUrlDecorator.php @@ -1,16 +1,19 @@ <?php +/* + * PHPPgAdmin v6.0.0-beta.30 + */ + namespace PHPPgAdmin\Decorators; class RedirectUrlDecorator extends Decorator { public function __construct($base, $queryVars = null) { - //\PC::debug($base, 'RedirectUrlDecorator'); $this->b = $base; - if ($queryVars !== null) { + if (null !== $queryVars) { $this->q = $queryVars; } } @@ -19,7 +22,7 @@ class RedirectUrlDecorator extends Decorator { $url = Decorator::get_sanitized_value($this->b, $fields); - if ($url === false) { + if (false === $url) { return ''; } @@ -33,7 +36,7 @@ class RedirectUrlDecorator extends Decorator foreach ($queryVars as $var => $value) { $varname = Decorator::value_url($var, $fields); $varvalue = Decorator::value_url($value, $fields); - if ($varname == 'subject') { + if ('subject' == $varname) { $url = '/' . str_replace('.php', '/' . $varvalue, $url); } else { $url .= $sep . $varname . '=' . $varvalue; @@ -42,9 +45,10 @@ class RedirectUrlDecorator extends Decorator $sep = '&'; } } - if (SUBFOLDER !== '' && (strpos($url, '/') === 0) && (strpos($url, SUBFOLDER) === false)) { - $url = str_replace('//', '/', SUBFOLDER . '/' . $url); + if (\SUBFOLDER !== '' && (0 === strpos($url, '/')) && (false === strpos($url, \SUBFOLDER))) { + $url = str_replace('//', '/', \SUBFOLDER . '/' . $url); } + return str_replace('.php', '', $url); } } diff --git a/src/decorators/ReplaceDecorator.php b/src/decorators/ReplaceDecorator.php index bf61551b..9453775b 100644 --- a/src/decorators/ReplaceDecorator.php +++ b/src/decorators/ReplaceDecorator.php @@ -1,5 +1,9 @@ <?php +/* + * PHPPgAdmin v6.0.0-beta.30 + */ + namespace PHPPgAdmin\Decorators; class ReplaceDecorator extends Decorator diff --git a/src/decorators/UrlDecorator.php b/src/decorators/UrlDecorator.php index 03b0bc7d..0f0236c6 100644 --- a/src/decorators/UrlDecorator.php +++ b/src/decorators/UrlDecorator.php @@ -1,5 +1,9 @@ <?php +/* + * PHPPgAdmin v6.0.0-beta.30 + */ + namespace PHPPgAdmin\Decorators; class UrlDecorator extends Decorator @@ -7,7 +11,7 @@ class UrlDecorator extends Decorator public function __construct($base, $queryVars = null) { $this->b = $base; - if ($queryVars !== null) { + if (null !== $queryVars) { $this->q = $queryVars; } } @@ -16,7 +20,7 @@ class UrlDecorator extends Decorator { $url = Decorator::get_sanitized_value($this->b, $fields); - if ($url === false) { + if (false === $url) { return ''; } @@ -31,8 +35,8 @@ class UrlDecorator extends Decorator } } //$this->prtrace('url before', $url); - if (SUBFOLDER !== '' && (strpos($url, '/') === 0) && (strpos($url, SUBFOLDER) === false)) { - $url = str_replace('//', '/', SUBFOLDER . '/' . $url); + if (\SUBFOLDER !== '' && (0 === strpos($url, '/')) && (false === strpos($url, \SUBFOLDER))) { + $url = str_replace('//', '/', \SUBFOLDER . '/' . $url); } //$this->prtrace('url after', $url); return $url; diff --git a/src/help/PostgresDoc74.php b/src/help/PostgresDoc74.php index ac081179..780bd70b 100644 --- a/src/help/PostgresDoc74.php +++ b/src/help/PostgresDoc74.php @@ -1,5 +1,9 @@ <?php +/* + * PHPPgAdmin v6.0.0-beta.30 + */ + namespace PHPPgAdmin\Help; /** @@ -18,9 +22,8 @@ class PostgresDoc74 $this->major_version = $major_version; $this->conf = $conf; - # TODO: Check and fix links + // TODO: Check and fix links $this->help_page = [ - 'pg.database' => 'managing-databases.html', 'pg.database.create' => ['sql-createdatabase.html', 'manage-ag-createdb.html'], 'pg.database.alter' => 'sql-alterdatabase.html', diff --git a/src/help/PostgresDoc80.php b/src/help/PostgresDoc80.php index f27af850..58779d7c 100644 --- a/src/help/PostgresDoc80.php +++ b/src/help/PostgresDoc80.php @@ -1,5 +1,9 @@ <?php +/* + * PHPPgAdmin v6.0.0-beta.30 + */ + namespace PHPPgAdmin\Help; /** diff --git a/src/help/PostgresDoc81.php b/src/help/PostgresDoc81.php index f84ede61..32d3ab07 100644 --- a/src/help/PostgresDoc81.php +++ b/src/help/PostgresDoc81.php @@ -1,5 +1,9 @@ <?php +/* + * PHPPgAdmin v6.0.0-beta.30 + */ + namespace PHPPgAdmin\Help; /** diff --git a/src/help/PostgresDoc82.php b/src/help/PostgresDoc82.php index 92a6c678..42ce02c4 100644 --- a/src/help/PostgresDoc82.php +++ b/src/help/PostgresDoc82.php @@ -1,5 +1,9 @@ <?php +/* + * PHPPgAdmin v6.0.0-beta.30 + */ + namespace PHPPgAdmin\Help; /** diff --git a/src/help/PostgresDoc83.php b/src/help/PostgresDoc83.php index b13854d3..b775c6a2 100644 --- a/src/help/PostgresDoc83.php +++ b/src/help/PostgresDoc83.php @@ -1,5 +1,9 @@ <?php +/* + * PHPPgAdmin v6.0.0-beta.30 + */ + namespace PHPPgAdmin\Help; /** diff --git a/src/help/PostgresDoc84.php b/src/help/PostgresDoc84.php index 07ce3305..4caf9955 100644 --- a/src/help/PostgresDoc84.php +++ b/src/help/PostgresDoc84.php @@ -1,5 +1,9 @@ <?php +/* + * PHPPgAdmin v6.0.0-beta.30 + */ + namespace PHPPgAdmin\Help; /** diff --git a/src/help/PostgresDoc90.php b/src/help/PostgresDoc90.php index 01ac2e3b..008d5876 100644 --- a/src/help/PostgresDoc90.php +++ b/src/help/PostgresDoc90.php @@ -1,5 +1,9 @@ <?php +/* + * PHPPgAdmin v6.0.0-beta.30 + */ + namespace PHPPgAdmin\Help; /** diff --git a/src/help/PostgresDoc91.php b/src/help/PostgresDoc91.php index a6aa6127..14df1272 100644 --- a/src/help/PostgresDoc91.php +++ b/src/help/PostgresDoc91.php @@ -1,5 +1,9 @@ <?php +/* + * PHPPgAdmin v6.0.0-beta.30 + */ + namespace PHPPgAdmin\Help; /** diff --git a/src/help/PostgresDoc92.php b/src/help/PostgresDoc92.php index f8640102..00b6e19a 100644 --- a/src/help/PostgresDoc92.php +++ b/src/help/PostgresDoc92.php @@ -1,5 +1,9 @@ <?php +/* + * PHPPgAdmin v6.0.0-beta.30 + */ + namespace PHPPgAdmin\Help; /** diff --git a/src/help/PostgresDoc93.php b/src/help/PostgresDoc93.php index 236d4edc..60b30212 100644 --- a/src/help/PostgresDoc93.php +++ b/src/help/PostgresDoc93.php @@ -1,5 +1,9 @@ <?php +/* + * PHPPgAdmin v6.0.0-beta.30 + */ + namespace PHPPgAdmin\Help; /** diff --git a/src/help/PostgresDoc94.php b/src/help/PostgresDoc94.php index 81775af1..cdea16af 100644 --- a/src/help/PostgresDoc94.php +++ b/src/help/PostgresDoc94.php @@ -1,5 +1,9 @@ <?php +/* + * PHPPgAdmin v6.0.0-beta.30 + */ + namespace PHPPgAdmin\Help; /** diff --git a/src/help/PostgresDoc95.php b/src/help/PostgresDoc95.php index 34439eed..62a1185c 100644 --- a/src/help/PostgresDoc95.php +++ b/src/help/PostgresDoc95.php @@ -1,5 +1,9 @@ <?php +/* + * PHPPgAdmin v6.0.0-beta.30 + */ + namespace PHPPgAdmin\Help; /** diff --git a/src/help/PostgresDoc96.php b/src/help/PostgresDoc96.php index 39eddcca..e54247c5 100644 --- a/src/help/PostgresDoc96.php +++ b/src/help/PostgresDoc96.php @@ -1,5 +1,9 @@ <?php +/* + * PHPPgAdmin v6.0.0-beta.30 + */ + namespace PHPPgAdmin\Help; /** diff --git a/src/views/acinsert.php b/src/views/acinsert.php index 10d993d3..6bbab913 100644 --- a/src/views/acinsert.php +++ b/src/views/acinsert.php @@ -1,5 +1,9 @@ <?php +/* + * PHPPgAdmin v6.0.0-beta.30 + */ + $do_render = false; if (!defined('BASE_PATH')) { require_once '../lib.inc.php'; diff --git a/src/views/aggregates.php b/src/views/aggregates.php index 30513c16..6857f8ba 100644 --- a/src/views/aggregates.php +++ b/src/views/aggregates.php @@ -1,9 +1,7 @@ <?php -/** - * Manage aggregates in a database - * - * $Id: aggregates.php,v 1.27 2008/01/19 13:46:15 ioguix Exp $ +/* + * PHPPgAdmin v6.0.0-beta.30 */ // Include application functions diff --git a/src/views/alldb.php b/src/views/alldb.php index ff50c195..66dafbf8 100644 --- a/src/views/alldb.php +++ b/src/views/alldb.php @@ -1,9 +1,7 @@ <?php -/** - * Manage databases within a server - * - * $Id: alldb.php,v 1.59 2007/10/17 21:40:19 ioguix Exp $ +/* + * PHPPgAdmin v6.0.0-beta.30 */ // Include application functions diff --git a/src/views/browser.php b/src/views/browser.php index 66994885..b38d251e 100644 --- a/src/views/browser.php +++ b/src/views/browser.php @@ -1,5 +1,9 @@ <?php +/* + * PHPPgAdmin v6.0.0-beta.30 + */ + $do_render = false; if (!defined('BASE_PATH')) { require_once '../lib.inc.php'; diff --git a/src/views/casts.php b/src/views/casts.php index f3fe18a9..0f7504b7 100644 --- a/src/views/casts.php +++ b/src/views/casts.php @@ -1,9 +1,7 @@ <?php -/** - * Manage casts in a database - * - * $Id: casts.php,v 1.16 2007/09/25 16:08:05 ioguix Exp $ +/* + * PHPPgAdmin v6.0.0-beta.30 */ // Include application functions diff --git a/src/views/colproperties.php b/src/views/colproperties.php index d27608e0..637ab6c2 100644 --- a/src/views/colproperties.php +++ b/src/views/colproperties.php @@ -1,9 +1,7 @@ <?php -/** - * List Columns properties in tables - * - * $Id: colproperties.php +/* + * PHPPgAdmin v6.0.0-beta.30 */ // Include application functions diff --git a/src/views/constraints.php b/src/views/constraints.php index 0cfce192..fb133feb 100644 --- a/src/views/constraints.php +++ b/src/views/constraints.php @@ -1,9 +1,7 @@ <?php -/** - * List constraints on a table - * - * $Id: constraints.php,v 1.56 2007/12/31 16:46:07 xzilla Exp $ +/* + * PHPPgAdmin v6.0.0-beta.30 */ // Include application functions diff --git a/src/views/conversions.php b/src/views/conversions.php index 0bfd20e1..eb792a94 100644 --- a/src/views/conversions.php +++ b/src/views/conversions.php @@ -1,9 +1,7 @@ <?php -/** - * Manage conversions in a database - * - * $Id: conversions.php,v 1.15 2007/08/31 18:30:10 ioguix Exp $ +/* + * PHPPgAdmin v6.0.0-beta.30 */ // Include application functions diff --git a/src/views/database.php b/src/views/database.php index 1f21d681..feae0e19 100644 --- a/src/views/database.php +++ b/src/views/database.php @@ -1,9 +1,7 @@ <?php -/** - * Manage schemas within a database - * - * $Id: database.php,v 1.104 2007/11/30 06:04:43 xzilla Exp $ +/* + * PHPPgAdmin v6.0.0-beta.30 */ // Include application functions diff --git a/src/views/dataexport.php b/src/views/dataexport.php index 7a1c7d4d..af197b5d 100644 --- a/src/views/dataexport.php +++ b/src/views/dataexport.php @@ -1,10 +1,7 @@ <?php -/** - * Does an export to the screen or as a download. This checks to - * see if they have pg_dump set up, and will use it if possible. - * - * $Id: dataexport.php,v 1.26 2007/07/12 19:26:22 xzilla Exp $ +/* + * PHPPgAdmin v6.0.0-beta.30 */ $do_render = false; diff --git a/src/views/dataimport.php b/src/views/dataimport.php index 3f88b23d..77faf639 100644 --- a/src/views/dataimport.php +++ b/src/views/dataimport.php @@ -1,9 +1,7 @@ <?php -/** - * Does an import to a particular table from a text file - * - * $Id: dataimport.php,v 1.11 2007/01/22 16:33:01 soranzo Exp $ +/* + * PHPPgAdmin v6.0.0-beta.30 */ $do_render = false; diff --git a/src/views/dbexport.php b/src/views/dbexport.php index cbe38b47..22bf6b8f 100644 --- a/src/views/dbexport.php +++ b/src/views/dbexport.php @@ -1,9 +1,7 @@ <?php -/** - * Does an export of a database, schema, or table (via pg_dump) - * to the screen or as a download. - * - * $Id: dbexport.php,v 1.22 2007/03/25 03:15:09 xzilla Exp $ + +/* + * PHPPgAdmin v6.0.0-beta.30 */ $do_render = false; diff --git a/src/views/display.php b/src/views/display.php index 900eb3c8..1547cfc8 100644 --- a/src/views/display.php +++ b/src/views/display.php @@ -1,15 +1,7 @@ <?php -/** - * Common relation browsing function that can be used for views, - * tables, reports, arbitrary queries, etc. to avoid code duplication. - * - * @param $query The SQL SELECT string to execute - * @param $count The same SQL query, but only retrieves the count of the rows (AS total) - * @param $return The return section - * @param $page The current page - * - * $Id: display.php,v 1.68 2008/04/14 12:44:27 ioguix Exp $ +/* + * PHPPgAdmin v6.0.0-beta.30 */ // Include application functions diff --git a/src/views/domains.php b/src/views/domains.php index 8dddba0e..6d3b38f1 100644 --- a/src/views/domains.php +++ b/src/views/domains.php @@ -1,9 +1,7 @@ <?php -/** - * Manage domains in a database - * - * $Id: domains.php,v 1.34 2007/09/13 13:41:01 ioguix Exp $ +/* + * PHPPgAdmin v6.0.0-beta.30 */ // Include application functions diff --git a/src/views/fulltext.php b/src/views/fulltext.php index ca77897e..fe34a999 100644 --- a/src/views/fulltext.php +++ b/src/views/fulltext.php @@ -1,9 +1,7 @@ <?php -/** - * Manage fulltext configurations, dictionaries and mappings - * - * $Id: fulltext.php,v 1.6 2008/03/17 21:35:48 ioguix Exp $ +/* + * PHPPgAdmin v6.0.0-beta.30 */ // Include application functions diff --git a/src/views/functions.php b/src/views/functions.php index fd1f760b..295d25fd 100644 --- a/src/views/functions.php +++ b/src/views/functions.php @@ -1,9 +1,7 @@ <?php -/** - * Manage functions in a database - * - * $Id: functions.php,v 1.78 2008/01/08 22:50:29 xzilla Exp $ +/* + * PHPPgAdmin v6.0.0-beta.30 */ // Include application functions diff --git a/src/views/groups.php b/src/views/groups.php index 5320a279..3193bc81 100644 --- a/src/views/groups.php +++ b/src/views/groups.php @@ -1,9 +1,7 @@ <?php -/** - * Manage groups in a database cluster - * - * $Id: groups.php,v 1.27 2007/08/31 18:30:11 ioguix Exp $ +/* + * PHPPgAdmin v6.0.0-beta.30 */ // Include application functions diff --git a/src/views/help.php b/src/views/help.php index ca1c7285..4a1527b6 100644 --- a/src/views/help.php +++ b/src/views/help.php @@ -1,9 +1,7 @@ <?php -/** - * Help page redirection/browsing. - * - * $Id: help.php,v 1.3 2006/12/31 16:21:26 soranzo Exp $ +/* + * PHPPgAdmin v6.0.0-beta.30 */ // Include application functions diff --git a/src/views/history.php b/src/views/history.php index 7c7ee788..edde4f5c 100644 --- a/src/views/history.php +++ b/src/views/history.php @@ -1,9 +1,7 @@ <?php -/** - * Alternative SQL editing window - * - * $Id: history.php,v 1.3 2008/01/10 19:37:07 xzilla Exp $ +/* + * PHPPgAdmin v6.0.0-beta.30 */ // Include application functions diff --git a/src/views/indexes.php b/src/views/indexes.php index dc2d3c6e..1c82a59f 100644 --- a/src/views/indexes.php +++ b/src/views/indexes.php @@ -1,9 +1,7 @@ <?php -/** - * List indexes on a table - * - * $Id: indexes.php,v 1.46 2008/01/08 22:50:29 xzilla Exp $ +/* + * PHPPgAdmin v6.0.0-beta.30 */ // Include application functions diff --git a/src/views/info.php b/src/views/info.php index 6a6dba6c..1f819267 100644 --- a/src/views/info.php +++ b/src/views/info.php @@ -1,9 +1,7 @@ <?php -/** - * List extra information on a table - * - * $Id: info.php,v 1.14 2007/05/28 17:30:32 ioguix Exp $ +/* + * PHPPgAdmin v6.0.0-beta.30 */ // Include application functions diff --git a/src/views/intro.php b/src/views/intro.php index 28f3cba1..3d5df900 100644 --- a/src/views/intro.php +++ b/src/views/intro.php @@ -1,5 +1,9 @@ <?php +/* + * PHPPgAdmin v6.0.0-beta.30 + */ + $do_render = false; if (!defined('BASE_PATH')) { require_once '../lib.inc.php'; diff --git a/src/views/languages.php b/src/views/languages.php index 051b71af..977cf739 100644 --- a/src/views/languages.php +++ b/src/views/languages.php @@ -1,9 +1,7 @@ <?php -/** - * Manage languages in a database - * - * $Id: languages.php,v 1.13 2007/08/31 18:30:11 ioguix Exp $ +/* + * PHPPgAdmin v6.0.0-beta.30 */ // Include application functions diff --git a/src/views/login.php b/src/views/login.php index a2097a5e..c066b9a3 100644 --- a/src/views/login.php +++ b/src/views/login.php @@ -1,9 +1,7 @@ <?php -/** - * Login screen - * - * $Id: login.php,v 1.38 2007/09/04 19:39:48 ioguix Exp $ +/* + * PHPPgAdmin v6.0.0-beta.30 */ $do_render = false; diff --git a/src/views/materializedviewproperties.php b/src/views/materializedviewproperties.php index e4a63b55..69cdaee0 100644 --- a/src/views/materializedviewproperties.php +++ b/src/views/materializedviewproperties.php @@ -1,9 +1,7 @@ <?php -/** - * List views in a database - * - * $Id: viewproperties.php,v 1.34 2007/12/11 14:17:17 ioguix Exp $ +/* + * PHPPgAdmin v6.0.0-beta.30 */ // Include application functions diff --git a/src/views/materializedviews.php b/src/views/materializedviews.php index fa6e922d..d16f2b93 100644 --- a/src/views/materializedviews.php +++ b/src/views/materializedviews.php @@ -1,9 +1,7 @@ <?php -/** - * Manage views in a database - * - * $Id: views.php,v 1.75 2007/12/15 22:57:43 ioguix Exp $ +/* + * PHPPgAdmin v6.0.0-beta.30 */ // Include application functions diff --git a/src/views/opclasses.php b/src/views/opclasses.php index 86b03278..a50e3873 100644 --- a/src/views/opclasses.php +++ b/src/views/opclasses.php @@ -1,9 +1,7 @@ <?php -/** - * Manage opclasss in a database - * - * $Id: opclasses.php,v 1.10 2007/08/31 18:30:11 ioguix Exp $ +/* + * PHPPgAdmin v6.0.0-beta.30 */ // Include application functions diff --git a/src/views/operators.php b/src/views/operators.php index 0e0de1c4..46e6611c 100644 --- a/src/views/operators.php +++ b/src/views/operators.php @@ -1,9 +1,7 @@ <?php -/** - * Manage operators in a database - * - * $Id: operators.php,v 1.29 2007/08/31 18:30:11 ioguix Exp $ +/* + * PHPPgAdmin v6.0.0-beta.30 */ // Include application functions diff --git a/src/views/privileges.php b/src/views/privileges.php index e9375f04..aace072e 100644 --- a/src/views/privileges.php +++ b/src/views/privileges.php @@ -1,9 +1,7 @@ <?php -/** - * Manage privileges in a database - * - * $Id: privileges.php,v 1.45 2007/09/13 13:41:01 ioguix Exp $ +/* + * PHPPgAdmin v6.0.0-beta.30 */ $do_render = false; diff --git a/src/views/roles.php b/src/views/roles.php index d6f42227..2838de4c 100644 --- a/src/views/roles.php +++ b/src/views/roles.php @@ -1,9 +1,7 @@ <?php -/** - * Manage roles in a database cluster - * - * $Id: roles.php,v 1.13 2008/03/21 15:32:57 xzilla Exp $ +/* + * PHPPgAdmin v6.0.0-beta.30 */ // Include application functions diff --git a/src/views/rules.php b/src/views/rules.php index d55ee4ec..03f144cf 100644 --- a/src/views/rules.php +++ b/src/views/rules.php @@ -1,9 +1,7 @@ <?php -/** - * List rules on a table OR view - * - * $Id: rules.php,v 1.33 2007/08/31 18:30:11 ioguix Exp $ +/* + * PHPPgAdmin v6.0.0-beta.30 */ // Include application functions diff --git a/src/views/schemas.php b/src/views/schemas.php index 6eee37ee..b6700a7a 100644 --- a/src/views/schemas.php +++ b/src/views/schemas.php @@ -1,9 +1,7 @@ <?php -/** - * Manage schemas in a database - * - * $Id: schemas.php,v 1.22 2007/12/15 22:57:43 ioguix Exp $ +/* + * PHPPgAdmin v6.0.0-beta.30 */ // Include application functions diff --git a/src/views/sequences.php b/src/views/sequences.php index 57045be2..d8e7a6a5 100644 --- a/src/views/sequences.php +++ b/src/views/sequences.php @@ -1,9 +1,7 @@ <?php -/** - * Manage sequences in a database - * - * $Id: sequences.php,v 1.49 2007/12/15 22:21:54 ioguix Exp $ +/* + * PHPPgAdmin v6.0.0-beta.30 */ // Include application functions diff --git a/src/views/servers.php b/src/views/servers.php index 5d53d2ac..f0ef08bd 100644 --- a/src/views/servers.php +++ b/src/views/servers.php @@ -1,9 +1,7 @@ <?php -/** - * Manage servers - * - * $Id: servers.php,v 1.12 2008/02/18 22:20:26 ioguix Exp $ +/* + * PHPPgAdmin v6.0.0-beta.30 */ $do_render = false; diff --git a/src/views/sql.php b/src/views/sql.php index c0ac3e94..f5d9e416 100644 --- a/src/views/sql.php +++ b/src/views/sql.php @@ -1,13 +1,7 @@ <?php -/** - * Process an arbitrary SQL query - tricky! The main problem is that - * unless we implement a full SQL parser, there's no way of knowing - * how many SQL statements have been strung together with semi-colons - * - * @param $_SESSION ['sqlquery'] The SQL query string to execute - * - * $Id: sql.php,v 1.43 2008/01/10 20:19:27 xzilla Exp $ +/* + * PHPPgAdmin v6.0.0-beta.30 */ // Include application functions diff --git a/src/views/sqledit.php b/src/views/sqledit.php index 701ad18c..3a5353b3 100644 --- a/src/views/sqledit.php +++ b/src/views/sqledit.php @@ -1,9 +1,7 @@ <?php -/** - * Alternative SQL editing window - * - * $Id: sqledit.php,v 1.40 2008/01/10 19:37:07 xzilla Exp $ +/* + * PHPPgAdmin v6.0.0-beta.30 */ // Include application functions diff --git a/src/views/tables.php b/src/views/tables.php index 5314349f..70f83c79 100644 --- a/src/views/tables.php +++ b/src/views/tables.php @@ -1,9 +1,7 @@ <?php -/** - * List tables in a database - * - * $Id: tables.php,v 1.112 2008/06/16 22:38:46 ioguix Exp $ +/* + * PHPPgAdmin v6.0.0-beta.30 */ $do_render = false; diff --git a/src/views/tablespaces.php b/src/views/tablespaces.php index 77d8b52f..2604ce20 100644 --- a/src/views/tablespaces.php +++ b/src/views/tablespaces.php @@ -1,9 +1,7 @@ <?php -/** - * Manage tablespaces in a database cluster - * - * $Id: tablespaces.php,v 1.16 2007/08/31 18:30:11 ioguix Exp $ +/* + * PHPPgAdmin v6.0.0-beta.30 */ // Include application functions diff --git a/src/views/tblproperties.php b/src/views/tblproperties.php index 95dd55c3..4f54c898 100644 --- a/src/views/tblproperties.php +++ b/src/views/tblproperties.php @@ -1,9 +1,7 @@ <?php -/** - * List tables in a database - * - * $Id: tblproperties.php,v 1.92 2008/01/19 13:46:15 ioguix Exp $ +/* + * PHPPgAdmin v6.0.0-beta.30 */ // Include application functions diff --git a/src/views/triggers.php b/src/views/triggers.php index 6a11924c..a11df761 100644 --- a/src/views/triggers.php +++ b/src/views/triggers.php @@ -1,9 +1,7 @@ <?php -/** - * List triggers on a table - * - * $Id: triggers.php,v 1.37 2007/09/19 14:42:12 ioguix Exp $ +/* + * PHPPgAdmin v6.0.0-beta.30 */ // Include application functions diff --git a/src/views/types.php b/src/views/types.php index f9654df2..4d751ee0 100644 --- a/src/views/types.php +++ b/src/views/types.php @@ -1,9 +1,7 @@ <?php -/** - * Manage types in a database - * - * $Id: types.php,v 1.42 2007/11/30 15:25:23 soranzo Exp $ +/* + * PHPPgAdmin v6.0.0-beta.30 */ // Include application functions diff --git a/src/views/users.php b/src/views/users.php index bf3630e3..0e94819f 100644 --- a/src/views/users.php +++ b/src/views/users.php @@ -1,9 +1,7 @@ <?php -/** - * Manage users in a database cluster - * - * $Id: users.php,v 1.40 2008/02/25 17:20:44 xzilla Exp $ +/* + * PHPPgAdmin v6.0.0-beta.30 */ // Include application functions diff --git a/src/views/viewproperties.php b/src/views/viewproperties.php index dd2cc6b3..ba0f22c5 100644 --- a/src/views/viewproperties.php +++ b/src/views/viewproperties.php @@ -1,9 +1,7 @@ <?php -/** - * List views in a database - * - * $Id: viewproperties.php,v 1.34 2007/12/11 14:17:17 ioguix Exp $ +/* + * PHPPgAdmin v6.0.0-beta.30 */ // Include application functions diff --git a/src/views/views.php b/src/views/views.php index 4dffc348..1017bedf 100644 --- a/src/views/views.php +++ b/src/views/views.php @@ -1,9 +1,7 @@ <?php -/** - * Manage views in a database - * - * $Id: views.php,v 1.75 2007/12/15 22:57:43 ioguix Exp $ +/* + * PHPPgAdmin v6.0.0-beta.30 */ // Include application functions diff --git a/src/xhtml/HTMLController.php b/src/xhtml/HTMLController.php index b65236b5..1e3396a0 100644 --- a/src/xhtml/HTMLController.php +++ b/src/xhtml/HTMLController.php @@ -1,5 +1,9 @@ <?php +/* + * PHPPgAdmin v6.0.0-beta.30 + */ + namespace PHPPgAdmin\XHtml; use \PHPPgAdmin\Decorators\Decorator; @@ -11,10 +15,10 @@ class HTMLController { use \PHPPgAdmin\HelperTrait; - private $container = null; - private $data = null; - private $database = null; - private $server_id = null; + private $container; + private $data; + private $database; + private $server_id; public $form = ''; public $href = ''; public $lang = []; @@ -22,7 +26,7 @@ class HTMLController public $controller_name = 'HTMLController'; public $controller_title = 'html'; - /* Constructor */ + // Constructor public function __construct(\Slim\Container $container, $controller_name = null) { $this->container = $container; @@ -37,7 +41,7 @@ class HTMLController $this->appThemes = $container->get('appThemes'); $this->action = $container->get('action'); - if ($controller_name !== null) { + if (null !== $controller_name) { $this->controller_name = $controller_name; } @@ -57,16 +61,17 @@ class HTMLController * 'urlvars' => Associative array of (URL variable => field name) * these are appended to the URL * @param $fields Field data from which 'urlfield' and 'vars' are obtained. + * @param null|mixed $from */ protected function getActionUrl(&$action, &$fields, $from = null) { - if ($from === null) { + if (null === $from) { $from = __METHOD__; } $url = Decorator::get_sanitized_value($action['url'], $fields); - if ($url === false) { + if (false === $url) { return ''; } @@ -76,18 +81,18 @@ class HTMLController $urlvars = []; } - /* set server, database and schema parameter if not presents */ + // set server, database and schema parameter if not presents if (isset($urlvars['subject'])) { $subject = Decorator::get_sanitized_value($urlvars['subject'], $fields); } else { $subject = ''; } - if (isset($_REQUEST['server']) and !isset($urlvars['server']) and $subject != 'root') { + if (isset($_REQUEST['server']) and !isset($urlvars['server']) and 'root' != $subject) { $urlvars['server'] = $_REQUEST['server']; - if (isset($_REQUEST['database']) and !isset($urlvars['database']) and $subject != 'server') { + if (isset($_REQUEST['database']) and !isset($urlvars['database']) and 'server' != $subject) { $urlvars['database'] = $_REQUEST['database']; - if (isset($_REQUEST['schema']) and !isset($urlvars['schema']) and $subject != 'database') { + if (isset($_REQUEST['schema']) and !isset($urlvars['schema']) and 'database' != $subject) { $urlvars['schema'] = $_REQUEST['schema']; } } @@ -122,19 +127,21 @@ class HTMLController * ); * the special attribute 'href' might be a string or an array. If href is an array it * will be generated by getActionUrl. See getActionUrl comment for array format. + * @param mixed $do_print + * @param null|mixed $from */ public function printLink($link, $do_print = true, $from = null) { if (!isset($link['fields'])) { $link['fields'] = $_REQUEST; } - if ($from === null || $from === false) { + if (null === $from || false === $from) { $from = __METHOD__; } $tag = '<a '; foreach ($link['attr'] as $attr => $value) { - if ($attr == 'href' and is_array($value)) { + if ('href' == $attr and is_array($value)) { $tag .= 'href="' . htmlentities($this->getActionUrl($value, $link['fields'], $from)) . '" '; } else { $tag .= htmlentities($attr) . '="' . Decorator::get_sanitized_value($value, $link['fields'], 'html') . '" '; @@ -169,9 +176,9 @@ class HTMLController $htmlOut = ''; if ($bMultiple) { // If multiple select combo - $htmlOut .= "<select rel=\"printCombo\" name=\"$szName\" id=\"$szName\" multiple=\"multiple\" size=\"$iSize\">" . "\n"; + $htmlOut .= "<select rel=\"printCombo\" name=\"${szName}\" id=\"${szName}\" multiple=\"multiple\" size=\"${iSize}\">" . "\n"; } else { - $htmlOut .= "<select rel=\"printCombo\" class=\"select2\" name=\"$szName\" id=\"$szName\">" . "\n"; + $htmlOut .= "<select rel=\"printCombo\" class=\"select2\" name=\"${szName}\" id=\"${szName}\">" . "\n"; } if ($bBlankEntry) { @@ -182,9 +189,9 @@ class HTMLController $curVal = htmlspecialchars($curVal); $curKey = htmlspecialchars($curKey); if ($curVal == $szDefault) { - $htmlOut .= "<option value=\"$curVal\" selected=\"selected\">$curKey</option>\n"; + $htmlOut .= "<option value=\"${curVal}\" selected=\"selected\">${curKey}</option>\n"; } else { - $htmlOut .= "<option value=\"$curVal\">$curKey</option>\n"; + $htmlOut .= "<option value=\"${curVal}\">${curKey}</option>\n"; } } $htmlOut .= "</select>\n"; diff --git a/src/xhtml/HTMLFooterController.php b/src/xhtml/HTMLFooterController.php index 06bcf090..bcf29a1c 100644 --- a/src/xhtml/HTMLFooterController.php +++ b/src/xhtml/HTMLFooterController.php @@ -1,5 +1,9 @@ <?php +/* + * PHPPgAdmin v6.0.0-beta.30 + */ + namespace PHPPgAdmin\XHtml; /** @@ -21,6 +25,7 @@ class HTMLFooterController extends HTMLController public function setReloadDropDatabase($flag) { $this->_reload_drop_database = boolval($flag); + return $this; } @@ -33,12 +38,14 @@ class HTMLFooterController extends HTMLController public function setNoBottomLink($flag) { $this->_no_bottom_link = boolval($flag); + return $this; } /** * Prints the page footer * @param $doBody True to output body tag, false to return the html + * @param mixed $template */ public function printFooter($doBody = true, $template = 'footer.twig') { diff --git a/src/xhtml/HTMLHeaderController.php b/src/xhtml/HTMLHeaderController.php index eb1fcd14..f9edf3d8 100644 --- a/src/xhtml/HTMLHeaderController.php +++ b/src/xhtml/HTMLHeaderController.php @@ -1,5 +1,9 @@ <?php +/* + * PHPPgAdmin v6.0.0-beta.30 + */ + namespace PHPPgAdmin\XHtml; /** @@ -19,6 +23,7 @@ class HTMLHeaderController extends HTMLController public function setNoOutput($flag) { $this->_no_output = boolval($flag); + return $this; } @@ -28,6 +33,7 @@ class HTMLHeaderController extends HTMLController * @param $title The title of the page * @param $script script tag * @param $do_print boolean if false, the function will return the header content + * @param mixed $template */ public function printHeader($title = '', $script = null, $do_print = true, $template = 'header.twig') { @@ -47,10 +53,10 @@ class HTMLHeaderController extends HTMLController $viewVars['applocale'] = $lang['applocale']; } - $viewVars['dir'] = (strcasecmp($lang['applangdir'], 'ltr') != 0) ? ' dir="' . htmlspecialchars($lang['applangdir']) . '"' : ''; + $viewVars['dir'] = (0 != strcasecmp($lang['applangdir'], 'ltr')) ? ' dir="' . htmlspecialchars($lang['applangdir']) . '"' : ''; $viewVars['headertemplate'] = $template; - $viewVars['title'] = ($title !== '') ? ' - ' . $title : ''; - $viewVars['appName'] = htmlspecialchars($this->appName) . (($title != '') ? htmlspecialchars(" - {$title}") : ''); + $viewVars['title'] = ('' !== $title) ? ' - ' . $title : ''; + $viewVars['appName'] = htmlspecialchars($this->appName) . (('' != $title) ? htmlspecialchars(" - {$title}") : ''); $viewVars['script'] = $script; //$this->prtrace($viewVars); @@ -99,6 +105,7 @@ class HTMLHeaderController extends HTMLController * Print out the page heading and help link * @param $title Title, already escaped * @param $help (optional) The identifier for the help link + * @param mixed $do_print */ public function printTitle($title, $help = null, $do_print = true) { diff --git a/src/xhtml/HTMLNavbarController.php b/src/xhtml/HTMLNavbarController.php index c510cf26..65bf4cc0 100644 --- a/src/xhtml/HTMLNavbarController.php +++ b/src/xhtml/HTMLNavbarController.php @@ -1,5 +1,9 @@ <?php +/* + * PHPPgAdmin v6.0.0-beta.30 + */ + namespace PHPPgAdmin\XHtml; /** @@ -13,10 +17,12 @@ class HTMLNavbarController extends HTMLController /** * Display a bread crumb trail. * @param $do_print true to echo, false to return html + * @param mixed $trail + * @param null|mixed $from */ public function printTrail($trail = [], $do_print = true, $from = null) { - if ($from === null) { + if (null === $from) { $from = __METHOD__; } $lang = $this->lang; @@ -86,10 +92,11 @@ class HTMLNavbarController extends HTMLController * Allows to give some environnement details to plugins. * and 'browse' is the place inside that code (doBrowse). * @param bool $do_print if true, print html, if false, return html + * @param mixed $from */ - public function printNavLinks($navlinks, $place, $env = [], $do_print = true, $from) + public function printNavLinks($navlinks, $place, $env, $do_print, $from) { - if ($from === null || $from === false) { + if (null === $from || false === $from) { $from = __METHOD__; } //$this->prtrace($navlinks); @@ -117,10 +124,13 @@ class HTMLNavbarController extends HTMLController * @param $tabs The name of current section (Ex: intro, server, ...), or an array with tabs (Ex: sqledit.php doFind function) * @param $activetab The name of the tab to be highlighted. * @param $print if false, return html + * @param mixed $alltabs + * @param mixed $do_print + * @param null|mixed $from */ public function printTabs($alltabs, $activetab, $do_print = true, $from = null) { - if ($from === null || $from === false) { + if (null === $from || false === $from) { $from = __METHOD__; } @@ -139,7 +149,7 @@ class HTMLNavbarController extends HTMLController $tabs = []; if (count($alltabs) > 0) { foreach ($alltabs as $tab_id => $tab) { - if (!isset($tab['hide']) || $tab['hide'] !== true) { + if (!isset($tab['hide']) || true !== $tab['hide']) { $tabs[$tab_id] = $tab; $tabs[$tab_id]['active'] = $active = ($tab_id == $activetab) ? ' active' : ''; $tabs[$tab_id]['tablink'] = str_replace(['&', '.php'], ['&', ''], htmlentities($this->getActionUrl($tab, $_REQUEST, $from))); @@ -176,6 +186,7 @@ class HTMLNavbarController extends HTMLController /** * Get the URL for the last active tab of a particular tab bar. + * @param mixed $section */ public function getLastTabURL($section) { @@ -184,23 +195,25 @@ class HTMLNavbarController extends HTMLController $tabs = $this->misc->getNavTabs($section); - if (isset($_SESSION['webdbLastTab'][$section]) && isset($tabs[$_SESSION['webdbLastTab'][$section]])) { + if (isset($_SESSION['webdbLastTab'][$section], $tabs[$_SESSION['webdbLastTab'][$section]])) { $tab = $tabs[$_SESSION['webdbLastTab'][$section]]; } else { $tab = reset($tabs); } $this->prtrace(['section' => $section, 'tabs' => $tabs, 'tab' => $tab], 'getLastTabURL'); + return isset($tab['url']) ? $tab : null; } /** * [printTopbar description] * @param bool $do_print true to print, false to return html + * @param null|mixed $from * @return string */ private function printTopbar($do_print = true, $from = null) { - if ($from === null || $from === false) { + if (null === $from || false === $from) { $from = __METHOD__; } @@ -217,17 +230,19 @@ class HTMLNavbarController extends HTMLController $topbar_html = '<div class="topbar" data-controller="' . $this->controller_name . '"><table style="width: 100%"><tr><td>'; - if ($server_info && isset($server_info['platform']) && isset($server_info['username'])) { - /* top left informations when connected */ - $topbar_html .= sprintf($lang['strtopbar'], + if ($server_info && isset($server_info['platform'], $server_info['username'])) { + // top left informations when connected + $topbar_html .= sprintf( + $lang['strtopbar'], '<span class="platform">' . htmlspecialchars($server_info['platform']) . '</span>', '<span class="host">' . htmlspecialchars((empty($server_info['host'])) ? 'localhost' : $server_info['host']) . '</span>', '<span class="port">' . htmlspecialchars($server_info['port']) . '</span>', - '<span class="username">' . htmlspecialchars($server_info['username']) . '</span>'); + '<span class="username">' . htmlspecialchars($server_info['username']) . '</span>' + ); $topbar_html .= '</td>'; - /* top right informations when connected */ + // top right informations when connected $toplinks = [ 'sql' => [ @@ -320,7 +335,7 @@ class HTMLNavbarController extends HTMLController $topbar_html .= sprintf(" $('#toplink_logout').click(function() { return confirm('%s'); - });", str_replace("'", "\'", $lang['strconfdropcred'])); + });", str_replace("'", "\\'", $lang['strconfdropcred'])); } $topbar_html .= ' @@ -361,12 +376,14 @@ class HTMLNavbarController extends HTMLController { $vars = $this->misc->getSubjectParams($subject); ksort($vars['params']); + return "{$vars['url']}?" . http_build_query($vars['params'], '', '&'); } /** * Create a bread crumb trail of the object hierarchy. * @param $object The type of object at the end of the trail. + * @param null|mixed $subject */ private function getTrail($subject = null) { @@ -387,7 +404,7 @@ class HTMLNavbarController extends HTMLController 'icon' => 'Introduction', ]; - if ($subject == 'root') { + if ('root' == $subject) { $done = true; } @@ -401,7 +418,7 @@ class HTMLNavbarController extends HTMLController 'icon' => 'Server', ]; } - if ($subject == 'server') { + if ('server' == $subject) { $done = true; } @@ -422,7 +439,7 @@ class HTMLNavbarController extends HTMLController 'icon' => 'Roles', ]; } - if ($subject == 'database' || $subject == 'role') { + if ('database' == $subject || 'role' == $subject) { $done = true; } @@ -435,7 +452,7 @@ class HTMLNavbarController extends HTMLController 'icon' => 'Schema', ]; } - if ($subject == 'schema') { + if ('schema' == $subject) { $done = true; } @@ -472,7 +489,7 @@ class HTMLNavbarController extends HTMLController 'icon' => 'Fts', ]; } - if ($subject == 'table' || $subject == 'view' || $subject == 'matview' || $subject == 'ftscfg') { + if ('table' == $subject || 'view' == $subject || 'matview' == $subject || 'ftscfg' == $subject) { $done = true; } @@ -486,6 +503,7 @@ class HTMLNavbarController extends HTMLController 'help' => 'pg.function', 'icon' => 'Function', ]; + break; case 'aggregate': $trail[$subject] = [ @@ -495,6 +513,7 @@ class HTMLNavbarController extends HTMLController 'help' => 'pg.aggregate', 'icon' => 'Aggregate', ]; + break; case 'column': $trail['column'] = [ @@ -503,19 +522,25 @@ class HTMLNavbarController extends HTMLController 'icon' => 'Column', 'url' => $this->getHREFSubject('column'), ]; + break; default: if (isset($_REQUEST[$subject])) { switch ($subject) { case 'domain':$icon = 'Domain'; + break; case 'sequence':$icon = 'Sequence'; + break; case 'type':$icon = 'Type'; + break; case 'operator':$icon = 'Operator'; + break; default:$icon = null; + break; } $trail[$subject] = [ @@ -548,10 +573,11 @@ class HTMLNavbarController extends HTMLController * @param $class An optional class or list of classes seprated by a space * WARNING: This field is NOT escaped! No user should be able to inject something here, use with care. * @param boolean $do_print true to echo, false to return + * @param null|mixed $from */ private function printLinksList($links, $class = '', $do_print = true, $from = null) { - if ($from === null || $from === false) { + if (null === $from || false === $from) { $from = __METHOD__; } $this->misc = $this->misc; diff --git a/src/xhtml/HTMLTableController.php b/src/xhtml/HTMLTableController.php index 686db12c..55034074 100644 --- a/src/xhtml/HTMLTableController.php +++ b/src/xhtml/HTMLTableController.php @@ -1,5 +1,9 @@ <?php +/* + * PHPPgAdmin v6.0.0-beta.30 + */ + namespace PHPPgAdmin\XHtml; use \PHPPgAdmin\Decorators\Decorator; @@ -75,7 +79,6 @@ class HTMLTableController extends HTMLController unset($actions['multiactions']); if ($tabledata->recordCount() > 0) { - // Remove the 'comment' column if they have been disabled if (!$this->conf['show_comments']) { unset($columns['comment']); @@ -92,7 +95,7 @@ class HTMLTableController extends HTMLController $tablehtml .= "<form id=\"multi_form\" action=\"{$this->ma['url']}\" method=\"post\" enctype=\"multipart/form-data\">\n"; if (isset($this->ma['vars'])) { foreach ($this->ma['vars'] as $k => $v) { - $tablehtml .= "<input type=\"hidden\" name=\"$k\" value=\"$v\" />"; + $tablehtml .= "<input type=\"hidden\" name=\"${k}\" value=\"${v}\" />"; } } } @@ -128,7 +131,7 @@ class HTMLTableController extends HTMLController $tablehtml .= "<td> ---> </td>\n"; $tablehtml .= "<td>\n"; $tablehtml .= "\t<select name=\"action\">\n"; - if ($this->ma['default'] == null) { + if (null == $this->ma['default']) { $tablehtml .= "\t\t<option value=\"\">--</option>\n"; } @@ -154,6 +157,7 @@ class HTMLTableController extends HTMLController $tablehtml .= "<p>{$nodata}</p>\n"; } } + return $tablehtml; } @@ -188,7 +192,6 @@ class HTMLTableController extends HTMLController } foreach ($columns as $column_id => $column) { - // Apply default values for missing parameters if (isset($column['url']) && !isset($column['vars'])) { $column['vars'] = []; @@ -198,7 +201,7 @@ class HTMLTableController extends HTMLController case 'actions': //$this->prtrace($column_id, $alt_actions); foreach ($alt_actions as $action) { - if (isset($action['disable']) && $action['disable'] === true) { + if (isset($action['disable']) && true === $action['disable']) { $tbody_html .= "<td></td>\n"; } else { //$this->prtrace($column_id, $action); @@ -208,6 +211,7 @@ class HTMLTableController extends HTMLController $tbody_html .= "</td>\n"; } } + break; case 'comment': $tbody_html .= "<td class='comment_cell'>"; @@ -216,6 +220,7 @@ class HTMLTableController extends HTMLController $tbody_html .= htmlentities($val); } $tbody_html .= '</td>'; + break; default: $tbody_html .= "<td{$this->class}>"; @@ -235,6 +240,7 @@ class HTMLTableController extends HTMLController } $tbody_html .= "</td>\n"; + break; } } @@ -245,6 +251,7 @@ class HTMLTableController extends HTMLController } $tbody_html .= '</tbody>'; + return $tbody_html; } @@ -254,7 +261,7 @@ class HTMLTableController extends HTMLController // Handle cases where no class has been passed if (isset($column['class'])) { - $this->class = $column['class'] !== '' ? " class=\"{$column['class']}\"" : ''; + $this->class = '' !== $column['class'] ? " class=\"{$column['class']}\"" : ''; } else { $this->class = ''; } @@ -281,6 +288,7 @@ class HTMLTableController extends HTMLController } $thead_html .= "</th>\n"; + break; } } @@ -295,7 +303,7 @@ class HTMLTableController extends HTMLController // Handle cases where no class has been passed if (isset($column['class'])) { - $this->class = $column['class'] !== '' ? " class=\"{$column['class']}\"" : ''; + $this->class = '' !== $column['class'] ? " class=\"{$column['class']}\"" : ''; } else { $this->class = ''; } @@ -315,6 +323,7 @@ class HTMLTableController extends HTMLController break; default: $tfoot_html .= "<td class=\"data{$this->class}\"></td>\n"; + break; } } @@ -328,6 +337,7 @@ class HTMLTableController extends HTMLController if (!$this->form) { $this->form = $this->misc->setForm(); } + return $this->form; } diff --git a/src/xhtml/TreeController.php b/src/xhtml/TreeController.php index 14735d36..852a6461 100644 --- a/src/xhtml/TreeController.php +++ b/src/xhtml/TreeController.php @@ -1,5 +1,9 @@ <?php +/* + * PHPPgAdmin v6.0.0-beta.30 + */ + namespace PHPPgAdmin\XHtml; use \PHPPgAdmin\Decorators\Decorator; @@ -11,10 +15,10 @@ class TreeController { use \PHPPgAdmin\HelperTrait; - private $container = null; - private $data = null; - private $database = null; - private $server_id = null; + private $container; + private $data; + private $database; + private $server_id; public $form = ''; public $href = ''; public $lang = []; @@ -22,7 +26,7 @@ class TreeController public $controller_name = 'TreeController'; public $controller_title = 'base'; - /* Constructor */ + // Constructor public function __construct(\Slim\Container $container, $controller_name = null) { $this->container = $container; @@ -37,7 +41,7 @@ class TreeController $this->conf = $this->misc->getConf(); $this->appThemes = $container->get('appThemes'); $this->action = $container->get('action'); - if ($controller_name !== null) { + if (null !== $controller_name) { $this->controller_name = $controller_name; } //\PC::debug($this->controller_name, 'instanced controller'); @@ -56,6 +60,7 @@ class TreeController * 'expand' - the action to return XML for the subtree * 'nodata' - message to display when node has no children * @param $section The section where the branch is linked in the tree + * @param mixed $print */ public function printTree(&$_treedata, &$attrs, $section, $print = true) { @@ -93,6 +98,7 @@ class TreeController * 'branch' - URL for child nodes (tree XML) * 'expand' - the action to return XML for the subtree * 'nodata' - message to display when node has no children + * @param mixed $print */ private function printTreeXML(&$treedata, &$attrs, $print = true) { @@ -134,8 +140,8 @@ class TreeController } $tree_xml .= "</tree>\n"; - if ($print === true) { - if ($this->container->requestobj->getAttribute('route') === null) { + if (true === $print) { + if (null === $this->container->requestobj->getAttribute('route')) { header('Content-Type: text/xml; charset=UTF-8'); header('Cache-Control: no-cache'); echo $tree_xml; @@ -155,10 +161,11 @@ class TreeController public function adjustTabsForTree(&$tabs) { foreach ($tabs as $i => $tab) { - if ((isset($tab['hide']) && $tab['hide'] === true) || (isset($tab['tree']) && $tab['tree'] === false)) { + if ((isset($tab['hide']) && true === $tab['hide']) || (isset($tab['tree']) && false === $tab['tree'])) { unset($tabs[$i]); } } + return new \PHPPgAdmin\ArrayRecordSet($tabs); } } diff --git a/src/xhtml/XHtmlButton.php b/src/xhtml/XHtmlButton.php index deb97b4a..e529dffe 100644 --- a/src/xhtml/XHtmlButton.php +++ b/src/xhtml/XHtmlButton.php @@ -1,5 +1,9 @@ <?php +/* + * PHPPgAdmin v6.0.0-beta.30 + */ + namespace PHPPgAdmin\XHtml; class XHtmlButton extends XHtmlElement diff --git a/src/xhtml/XHtmlElement.php b/src/xhtml/XHtmlElement.php index 62fef526..3015451d 100644 --- a/src/xhtml/XHtmlElement.php +++ b/src/xhtml/XHtmlElement.php @@ -1,5 +1,9 @@ <?php +/* + * PHPPgAdmin v6.0.0-beta.30 + */ + namespace PHPPgAdmin\XHtml; /** @@ -12,7 +16,7 @@ namespace PHPPgAdmin\XHtml; */ class XHtmlElement extends XHtmlSimpleElement { - public $_text = null; + public $_text; public $_htmlcode = ""; public $_siblings = []; @@ -75,10 +79,7 @@ class XHtmlElement extends XHtmlSimpleElement return $this->_htmlcode; } - /* - * Returns siblings of Element - * - */ + // Returns siblings of Element public function get_siblings() { return $this->_siblings; @@ -86,6 +87,6 @@ class XHtmlElement extends XHtmlSimpleElement public function has_siblings() { - return (count($this->_siblings) != 0); + return (0 != count($this->_siblings)); } } diff --git a/src/xhtml/XHtmlOption.php b/src/xhtml/XHtmlOption.php index 4311cbd1..815b0149 100644 --- a/src/xhtml/XHtmlOption.php +++ b/src/xhtml/XHtmlOption.php @@ -1,5 +1,9 @@ <?php +/* + * PHPPgAdmin v6.0.0-beta.30 + */ + namespace PHPPgAdmin\XHtml; class XHtmlOption extends XHtmlElement diff --git a/src/xhtml/XHtmlSelect.php b/src/xhtml/XHtmlSelect.php index 6cf42934..227bd19e 100644 --- a/src/xhtml/XHtmlSelect.php +++ b/src/xhtml/XHtmlSelect.php @@ -1,5 +1,9 @@ <?php +/* + * PHPPgAdmin v6.0.0-beta.30 + */ + namespace PHPPgAdmin\XHtml; class XHtmlSelect extends XHtmlElement @@ -25,11 +29,12 @@ class XHtmlSelect extends XHtmlElement switch (gettype($data)) { case 'string': $this->_data = explode($delim, $data); + break; case 'array': $this->_data = $data; - break; + break; default: break; } @@ -42,6 +47,7 @@ class XHtmlSelect extends XHtmlElement $this->add(new XHtmlOption($value)); } } + return parent::fetch(); } } diff --git a/src/xhtml/XHtmlSimpleElement.php b/src/xhtml/XHtmlSimpleElement.php index 39ba07fa..03d51f54 100644 --- a/src/xhtml/XHtmlSimpleElement.php +++ b/src/xhtml/XHtmlSimpleElement.php @@ -1,5 +1,9 @@ <?php +/* + * PHPPgAdmin v6.0.0-beta.30 + */ + namespace PHPPgAdmin\XHtml; /** @@ -25,6 +29,7 @@ class XHtmlSimpleElement * * @param string The element's name. Defaults to name of the * derived class + * @param null|mixed $element * */ public function __construct($element = null) |