Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Loren Tedford

Pages: [1] 2 3 4
1
Technical Help / Re: Warning in ./libraries/plugin_interface.lib.php#551
« on: December 28, 2019, 06:06:38 pm »
Here is the current Error I get on export and import in phpmyadmin:
Code: [Select]
Warning in ./libraries/plugin_interface.lib.php#551
count(): Parameter must be an array or an object that implements Countable

Backtrace

./libraries/display_export.lib.php#381: PMA_pluginGetOptions(
string 'Export',
array,
)
./libraries/display_export.lib.php#883: PMA_getHtmlForExportOptionsFormat(array)
./libraries/display_export.lib.php#1099: PMA_getHtmlForExportOptions(
string 'database',
string 'ltcraftmain',
string '',
string '<div class="export_table_list_container"><input type="hidden" name="structure_or_data_forced" value="0"><table class="export_table_select"><thead><tr><th></th><th>Tables</th><th class="export_structure">Structure</th><th class="export_data">Data</th></tr><tr><td></td><td class="export_table_name all">Select all</td><td class="export_structure all"><input type="checkbox" id="table_structure_all" /></td><td class="export_data all"><input type="checkbox" id="table_data_all" /></td></tr></thead><tbody> <tr><td><input type="checkbox" name="table_select[]" value="wp_commentmeta" checked="checked" /></td><td class="export_table_name">wp_commentmeta</td><td class="export_structure"><input type="checkbox" name="table_structure[]" value="wp_commentmeta" checked="checked" /></td><td class="export_data"><input type="checkbox" name="table_data[]" value="wp_commentmeta" checked="checked" /></td></tr><tr><td><input type="checkbox" name="table_select[]" value="wp_comments" checked="checked" /></td><td class="export_table_name">wp_comments</td><td class="export_structure"><input type="checkbox" name="table_structure[]" value="wp_comments" checked="checked" /></td><td class="export_data"><input type="checkbox" name="table_data[]" value="wp_comments" checked="checked" /></td></tr><tr><td><input type="checkbox" name="table_select[]" value="wp_links" checked="checked" /></td><td class="export_table_name">wp_links</td><td class="export_structure"><input type="checkbox" name="table_structure[]" value="wp_links" checked="checked" /></td><td class="export_data"><input type="checkbox" name="table_data[]" value="wp_links" checked="checked" /></td></tr><tr><td><input type="checkbox" name="table_select[]" value="wp_options" checked="checked" /></td><td class="export_table_name">wp_options</td><td class="export_structure"><input type="checkbox" name="table_structure[]" value="wp_options" checked="checked" /></td><td class="export_data"><input type="checkbox" name="table_data[]" value="wp_options" checked="checked" /></td></tr><tr><td><input type="checkbox" name="table_select[]" value="wp_postmeta" checked="checked" /></td><td class="export_table_name">wp_postmeta</td><td class="export_structure"><input type="checkbox" name="table_structure[]" value="wp_postmeta" checked="checked" /></td><td class="export_data"><input type="checkbox" name="table_data[]" value="wp_postmeta" checked="checked" /></td></tr><tr><td><input type="checkbox" name="table_select[]" value="wp_posts" checked="checked" /></td><td class="export_table_name">wp_posts</td><td class="export_structure"><input type="checkbox" name="table_structure[]" value="wp_posts" checked="checked" /></td><td class="export_data"><input type="checkbox" name="table_data[]" value="wp_posts" checked="checked" /></td></tr><tr><td><input type="checkbox" name="table_select[]" value="wp_termmeta" checked="checked" /></td><td class="export_table_name">wp_termmeta</td><td class="export_structure"><input type="checkbox" name="table_structure[]" value="wp_termmeta" checked="checked" /></td><td class="export_data"><input type="checkbox" name="table_data[]" value="wp_termmeta" checked="checked" /></td></tr><tr><td><input type="checkbox" name="table_select[]" value="wp_terms" checked="checked" /></td><td class="export_table_name">wp_terms</td><td class="export_structure"><input type="checkbox" name="table_structure[]" value="wp_terms" checked="checked" /></td><td class="export_data"><input type="checkbox" name="table_data[]" value="wp_terms" checked="checked" /></td></tr><tr><td><input type="checkbox" name="table_select[]" value="wp_term_relationships" checked="checked" /></td><td class="export_table_name">wp_term_relationships</td><td class="export_structure"><input type="checkbox" name="table_structure[]" value="wp_term_relationships" checked="checked" /></td><td class="export_data"><input type="checkbox" name="table_data[]" value="wp_term_relationships" checked="checked" /></td></tr><tr><td><input type="checkbox" name="table_select[]" value="wp_term_taxonomy" checked="checked" /></td><td class="export_table_name">wp_term_taxonomy</td><td class="export_structure"><input type="checkbox" name="table_structure[]" value="wp_term_taxonomy" checked="checked" /></td><td class="export_data"><input type="checkbox" name="table_data[]" value="wp_term_taxonomy" checked="checked" /></td></tr><tr><td><input type="checkbox" name="table_select[]" value="wp_usermeta" checked="checked" /></td><td class="export_table_name">wp_usermeta</td><td class="export_structure"><input type="checkbox" name="table_structure[]" value="wp_usermeta" checked="checked" /></td><td class="export_data"><input type="checkbox" name="table_data[]" value="wp_usermeta" checked="checked" /></td></tr><tr><td><input type="checkbox" name="table_select[]" value="wp_users" checked="checked" /></td><td class="export_table_name">wp_users</td><td class="export_structure"><input type="checkbox" name="table_structure[]" value="wp_users" checked="checked" /></td><td class="export_data"><input type="checkbox" name="table_data[]" value="wp_users" checked="checked" /></td></tr> </tbody></table></div>',
integer 12,
array,
integer 0,
)
./db_export.php#154: PMA_getExportDisplay(
string 'database',
string 'ltcraftmain',
string '',
string '',
integer 12,
integer 0,
string '<div class="export_table_list_container"><input type="hidden" name="structure_or_data_forced" value="0"><table class="export_table_select"><thead><tr><th></th><th>Tables</th><th class="export_structure">Structure</th><th class="export_data">Data</th></tr><tr><td></td><td class="export_table_name all">Select all</td><td class="export_structure all"><input type="checkbox" id="table_structure_all" /></td><td class="export_data all"><input type="checkbox" id="table_data_all" /></td></tr></thead><tbody> <tr><td><input type="checkbox" name="table_select[]" value="wp_commentmeta" checked="checked" /></td><td class="export_table_name">wp_commentmeta</td><td class="export_structure"><input type="checkbox" name="table_structure[]" value="wp_commentmeta" checked="checked" /></td><td class="export_data"><input type="checkbox" name="table_data[]" value="wp_commentmeta" checked="checked" /></td></tr><tr><td><input type="checkbox" name="table_select[]" value="wp_comments" checked="checked" /></td><td class="export_table_name">wp_comments</td><td class="export_structure"><input type="checkbox" name="table_structure[]" value="wp_comments" checked="checked" /></td><td class="export_data"><input type="checkbox" name="table_data[]" value="wp_comments" checked="checked" /></td></tr><tr><td><input type="checkbox" name="table_select[]" value="wp_links" checked="checked" /></td><td class="export_table_name">wp_links</td><td class="export_structure"><input type="checkbox" name="table_structure[]" value="wp_links" checked="checked" /></td><td class="export_data"><input type="checkbox" name="table_data[]" value="wp_links" checked="checked" /></td></tr><tr><td><input type="checkbox" name="table_select[]" value="wp_options" checked="checked" /></td><td class="export_table_name">wp_options</td><td class="export_structure"><input type="checkbox" name="table_structure[]" value="wp_options" checked="checked" /></td><td class="export_data"><input type="checkbox" name="table_data[]" value="wp_options" checked="checked" /></td></tr><tr><td><input type="checkbox" name="table_select[]" value="wp_postmeta" checked="checked" /></td><td class="export_table_name">wp_postmeta</td><td class="export_structure"><input type="checkbox" name="table_structure[]" value="wp_postmeta" checked="checked" /></td><td class="export_data"><input type="checkbox" name="table_data[]" value="wp_postmeta" checked="checked" /></td></tr><tr><td><input type="checkbox" name="table_select[]" value="wp_posts" checked="checked" /></td><td class="export_table_name">wp_posts</td><td class="export_structure"><input type="checkbox" name="table_structure[]" value="wp_posts" checked="checked" /></td><td class="export_data"><input type="checkbox" name="table_data[]" value="wp_posts" checked="checked" /></td></tr><tr><td><input type="checkbox" name="table_select[]" value="wp_termmeta" checked="checked" /></td><td class="export_table_name">wp_termmeta</td><td class="export_structure"><input type="checkbox" name="table_structure[]" value="wp_termmeta" checked="checked" /></td><td class="export_data"><input type="checkbox" name="table_data[]" value="wp_termmeta" checked="checked" /></td></tr><tr><td><input type="checkbox" name="table_select[]" value="wp_terms" checked="checked" /></td><td class="export_table_name">wp_terms</td><td class="export_structure"><input type="checkbox" name="table_structure[]" value="wp_terms" checked="checked" /></td><td class="export_data"><input type="checkbox" name="table_data[]" value="wp_terms" checked="checked" /></td></tr><tr><td><input type="checkbox" name="table_select[]" value="wp_term_relationships" checked="checked" /></td><td class="export_table_name">wp_term_relationships</td><td class="export_structure"><input type="checkbox" name="table_structure[]" value="wp_term_relationships" checked="checked" /></td><td class="export_data"><input type="checkbox" name="table_data[]" value="wp_term_relationships" checked="checked" /></td></tr><tr><td><input type="checkbox" name="table_select[]" value="wp_term_taxonomy" checked="checked" /></td><td class="export_table_name">wp_term_taxonomy</td><td class="export_structure"><input type="checkbox" name="table_structure[]" value="wp_term_taxonomy" checked="checked" /></td><td class="export_data"><input type="checkbox" name="table_data[]" value="wp_term_taxonomy" checked="checked" /></td></tr><tr><td><input type="checkbox" name="table_select[]" value="wp_usermeta" checked="checked" /></td><td class="export_table_name">wp_usermeta</td><td class="export_structure"><input type="checkbox" name="table_structure[]" value="wp_usermeta" checked="checked" /></td><td class="export_data"><input type="checkbox" name="table_data[]" value="wp_usermeta" checked="checked" /></td></tr><tr><td><input type="checkbox" name="table_select[]" value="wp_users" checked="checked" /></td><td class="export_table_name">wp_users</td><td class="export_structure"><input type="checkbox" name="table_structure[]" value="wp_users" checked="checked" /></td><td class="export_data"><input type="checkbox" name="table_data[]" value="wp_users" checked="checked" /></td></tr> </tbody></table></div>',
)

2
Bugs / Certificate File Placement Bug with Apache failure!
« on: December 28, 2019, 05:11:27 pm »
So for adding ssl for domains using let's encrypt doesn't work correctly with apache2 and causes apache2 to fail on restart. Apparently Apache template isn't pointing in the right place and it doesn't seem to update properly when you add a domain name to the panel and then add an ssl certificate to it.

Code: [Select]
root@ehcp:/var/www/vhosts# service apache2 status
● apache2.service - The Apache HTTP Server
   Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
  Drop-In: /lib/systemd/system/apache2.service.d
           └─apache2-systemd.conf
   Active: failed (Result: exit-code) since Sun 2019-12-29 00:08:06 UTC; 2min 22s ago
  Process: 31706 ExecStop=/usr/sbin/apachectl stop (code=exited, status=1/FAILURE)
  Process: 31692 ExecReload=/usr/sbin/apachectl graceful (code=exited, status=1/FAILURE)
  Process: 32039 ExecStart=/usr/sbin/apachectl start (code=exited, status=1/FAILURE)
 Main PID: 30583 (code=exited, status=0/SUCCESS)

Dec 29 00:08:06 ehcp systemd[1]: Starting The Apache HTTP Server...
Dec 29 00:08:06 ehcp apachectl[32039]: AH00526: Syntax error on line 165 of /var/www/new/ehcp/apachehcp.conf:
Dec 29 00:08:06 ehcp apachectl[32039]: SSLCertificateFile: file '/var/www/vhosts/loren/kc9zhv.com/phptmpdir/server.crt' doe
Dec 29 00:08:06 ehcp apachectl[32039]: Action 'start' failed.
Dec 29 00:08:06 ehcp apachectl[32039]: The Apache error log may have more information.
Dec 29 00:08:06 ehcp systemd[1]: apache2.service: Control process exited, code=exited status=1
Dec 29 00:08:06 ehcp systemd[1]: apache2.service: Failed with result 'exit-code'.
Dec 29 00:08:06 ehcp systemd[1]: Failed to start The Apache HTTP Server.

The domain I added the ssl to was https://towclaim.com

Domains on this server are:
https://Lorentedford.com
https://voipham.com
https://Ltcraft.net
https://newwavesucks.com
https://kc9zhv.com
https://towclaim.com
https://ilhamradio.org

Some are using the ssl certificate some are not for some reason.

Here is a copy of the apache2 template for lorentedford.com

Code: [Select]
#____________start of lorentedford.com__paneluser:{panelusername}_reseller:{reseller}_id:{id}____________
# Comment:  {aciklama}
# template with ssl
# this file used in Easy Hosting Control Panel (ehcp), www.ehcp.net

<VirtualHost *:443>
ServerName  webmail.lorentedford.com
ServerAlias  email.lorentedford.com
ServerAlias  mail.lorentedford.com

DocumentRoot {ehcpdir}/webmail

LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%v:%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
LogFormat "%v:%p %h %l %u %t \"%{Host}i\" \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined_host
CustomLog  {homedir}/logs/access_log combined
CustomLog  /var/log/apache2/access_log_multi.log vhost_combined_host

ProxyPassMatch ^(.*\.php)$ fcgi://127.0.0.1:9001{ehcpdir}/webmail/$1
ProxyFCGISetEnvIf "true" PHP_ADMIN_VALUE "open_basedir={ehcpdir}/webmail:/tmp:/var/www/php_sessions:/usr/share:/etc/roundcube:/var/lib/roundcube:/var/log/roundcube; \n upload_tmp_dir=/tmp; \n session.save_path=/var/www/php_sessions;"

SSLEngine on
SSLCertificateFile /var/www/vhosts/loren/lorentedford.com/phptmpdir/server.crt
SSLCertificateKeyFile /var/www/vhosts/loren/lorentedford.com/phptmpdir/server.key
{ssl_cert_chain_setting_with_path}

</VirtualHost>

<VirtualHost *:443>
ServerName  webmail2.lorentedford.com
ServerAlias  email2.lorentedford.com
ServerAlias  mail2.lorentedford.com

DocumentRoot {ehcpdir}/webmail2

LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%v:%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
LogFormat "%v:%p %h %l %u %t \"%{Host}i\" \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined_host
CustomLog  {homedir}/logs/access_log combined
CustomLog  /var/log/apache2/access_log_multi.log vhost_combined_host

ProxyPassMatch ^(.*\.php)$ fcgi://127.0.0.1:9001{ehcpdir}/webmail2/$1
ProxyFCGISetEnvIf "true" PHP_ADMIN_VALUE "open_basedir={ehcpdir}/webmail2; \n upload_tmp_dir={ehcpdir}/webmail2/data; \n session.save_path={ehcpdir}/webmail2/data;"

SSLEngine on
SSLCertificateFile {ssl_cert_path}
SSLCertificateKeyFile {ssl_cert_key_path}
{ssl_cert_chain_setting_with_path}

</VirtualHost>

<VirtualHost *:443>
ServerName  cpanel.lorentedford.com
ServerAlias  panel.lorentedford.com
ServerAlias  ehcp.lorentedford.com
ServerAlias  cp.lorentedford.com

DocumentRoot {ehcpdir}

LogFormat "%v:%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
LogFormat "%v:%p %h %l %u %t \"%{Host}i\" \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined_host
CustomLog  /var/log/apache2/access_log_multi.log vhost_combined_host

ProxyPassMatch ^(.*\.php)$ fcgi://127.0.0.1:9001{ehcpdir}/$1
ProxyFCGISetEnvIf "true" PHP_ADMIN_VALUE "open_basedir={ehcpdir}:/usr/share/php:/usr/share/pear"

<Files  ~ "\.conf$">
Order allow,deny
Deny from all
</Files>

<Files  ~ "\.txt$">
Order allow,deny
Deny from all
</Files>

<Files  ~ "\.log$">
Order allow,deny
Deny from all
</Files>

<Files  ~ "\.sh$">
Order allow,deny
Deny from all
</Files>

SSLEngine on
SSLCertificateFile {ssl_cert_path}
SSLCertificateKeyFile {ssl_cert_key_path}
{ssl_cert_chain_setting_with_path}
</VirtualHost>

<VirtualHost *:443>

ServerName   lorentedford.com
ServerAlias  www.lorentedford.com {wildcarddomain} # this is changed to *.lorentedford.com within classapp.php
# buraya aliaslar yazilacak..
{aliases}

UseCanonicalName Off
DocumentRoot {homedir}/httpdocs
DirectoryIndex index.htm index.html index.php
       
# this combined log format is understandable by webalizer... some other formats are not recognised by webalizer.. thats why, specified here explicitly..     
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%v:%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
LogFormat "%v:%p %h %l %u %t \"%{Host}i\" \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined_host
CustomLog  {homedir}/logs/access_log combined
CustomLog  /var/log/apache2/access_log_multi.log vhost_combined_host
   
ProxyPassMatch ^(.*\.php)$ fcgi://127.0.0.1:9000{homedir}/httpdocs/$1
ProxyFCGISetEnvIf "true" PHP_ADMIN_VALUE "open_basedir={homedir}:/usr/share/php:/usr/share/pear; \n upload_tmp_dir={homedir}/phptmpdir; \n session.save_path={homedir}/phptmpdir;"

AccessFileName .htaccess
SSLEngine on
SSLCertificateFile {ssl_cert_path}
SSLCertificateKeyFile {ssl_cert_key_path}
{ssl_cert_chain_setting_with_path}

{customhttp}
{root_password_protected_dirs}
{password_protected_dirs}
{webstats_password_protection}

</VirtualHost>

#____________end of lorentedford.com__paneluser:{panelusername}_reseller:{reseller}_id:{id}____________
# end template with ssl


Here is an example of apche2 template for ilhamradio.org

Code: [Select]
#____________start of ilhamradio.org__paneluser:{panelusername}_reseller:{reseller}_id:{id}____________
# Comment:  {aciklama}
# template with ssl
# this file used in Easy Hosting Control Panel (ehcp), www.ehcp.net

<VirtualHost *:443>
ServerName  webmail.ilhamradio.org
ServerAlias  email.ilhamradio.org
ServerAlias  mail.ilhamradio.org

DocumentRoot {ehcpdir}/webmail

LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%v:%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
LogFormat "%v:%p %h %l %u %t \"%{Host}i\" \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined_host
CustomLog  {homedir}/logs/access_log combined
CustomLog  /var/log/apache2/access_log_multi.log vhost_combined_host

ProxyPassMatch ^(.*\.php)$ fcgi://127.0.0.1:9001{ehcpdir}/webmail/$1
ProxyFCGISetEnvIf "true" PHP_ADMIN_VALUE "open_basedir={ehcpdir}/webmail:/tmp:/var/www/php_sessions:/usr/share:/etc/roundcube:/var/lib/roundcube:/var/log/roundcube; \n upload_tmp_dir=/tmp; \n session.save_path=/var/www/php_sessions;"

SSLEngine on
SSLCertificateFile {ssl_cert_path}
SSLCertificateKeyFile {ssl_cert_key_path}
{ssl_cert_chain_setting_with_path}

</VirtualHost>

<VirtualHost *:443>
ServerName  webmail2.ilhamradio.org
ServerAlias  email2.ilhamradio.org
ServerAlias  mail2.ilhamradio.org

DocumentRoot {ehcpdir}/webmail2

LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%v:%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
LogFormat "%v:%p %h %l %u %t \"%{Host}i\" \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined_host
CustomLog  {homedir}/logs/access_log combined
CustomLog  /var/log/apache2/access_log_multi.log vhost_combined_host

ProxyPassMatch ^(.*\.php)$ fcgi://127.0.0.1:9001{ehcpdir}/webmail2/$1
ProxyFCGISetEnvIf "true" PHP_ADMIN_VALUE "open_basedir={ehcpdir}/webmail2; \n upload_tmp_dir={ehcpdir}/webmail2/data; \n session.save_path={ehcpdir}/webmail2/data;"

SSLEngine on
SSLCertificateFile /var/www/vhosts/loren/ilhamradio.org/phptmpdir/server.crt
SSLCertificateKeyFile /var/www/vhosts/loren/ilhamradio.org/phptmpdir/server.key
{ssl_cert_chain_setting_with_path}

</VirtualHost>

<VirtualHost *:443>
ServerName  cpanel.ilhamradio.org
ServerAlias  panel.ilhamradio.org
ServerAlias  ehcp.ilhamradio.org
ServerAlias  cp.ilhamradio.org

DocumentRoot {ehcpdir}

LogFormat "%v:%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
LogFormat "%v:%p %h %l %u %t \"%{Host}i\" \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined_host
CustomLog  /var/log/apache2/access_log_multi.log vhost_combined_host

ProxyPassMatch ^(.*\.php)$ fcgi://127.0.0.1:9001{ehcpdir}/$1
ProxyFCGISetEnvIf "true" PHP_ADMIN_VALUE "open_basedir={ehcpdir}:/usr/share/php:/usr/share/pear"

<Files  ~ "\.conf$">
Order allow,deny
Deny from all
</Files>

<Files  ~ "\.txt$">
Order allow,deny
Deny from all
</Files>

<Files  ~ "\.log$">
Order allow,deny
Deny from all
</Files>

<Files  ~ "\.sh$">
Order allow,deny
Deny from all
</Files>

SSLEngine on
SSLCertificateFile {ssl_cert_path}
SSLCertificateKeyFile {ssl_cert_key_path}
{ssl_cert_chain_setting_with_path}
</VirtualHost>

<VirtualHost *:443>

ServerName   ilhamradio.org
ServerAlias  www.ilhamradio.org {wildcarddomain} # this is changed to *.ilhamradio.org within classapp.php
# buraya aliaslar yazilacak..
{aliases}

UseCanonicalName Off
DocumentRoot {homedir}/httpdocs
DirectoryIndex index.htm index.html index.php
       
# this combined log format is understandable by webalizer... some other formats are not recognised by webalizer.. thats why, specified here explicitly..     
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%v:%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
LogFormat "%v:%p %h %l %u %t \"%{Host}i\" \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined_host
CustomLog  {homedir}/logs/access_log combined
CustomLog  /var/log/apache2/access_log_multi.log vhost_combined_host
   
ProxyPassMatch ^(.*\.php)$ fcgi://127.0.0.1:9000{homedir}/httpdocs/$1
ProxyFCGISetEnvIf "true" PHP_ADMIN_VALUE "open_basedir={homedir}:/usr/share/php:/usr/share/pear; \n upload_tmp_dir={homedir}/phptmpdir; \n session.save_path={homedir}/phptmpdir;"

AccessFileName .htaccess
SSLEngine on
SSLCertificateFile {ssl_cert_path}
SSLCertificateKeyFile {ssl_cert_key_path}
{ssl_cert_chain_setting_with_path}

{customhttp}
{root_password_protected_dirs}
{password_protected_dirs}
{webstats_password_protection}

</VirtualHost>

#____________end of ilhamradio.org__paneluser:{panelusername}_reseller:{reseller}_id:{id}____________
# end template with ssl

Here is an apache2 example we have for Ltcraft.net

Code: [Select]
#____________start of ltcraft.net__paneluser:{panelusername}_reseller:{reseller}_id:{id}____________
# Comment:  {aciklama}
# template with ssl
# this file used in Easy Hosting Control Panel (ehcp), www.ehcp.net

<VirtualHost *:443>
ServerName  webmail.ltcraft.net
ServerAlias  email.ltcraft.net
ServerAlias  mail.ltcraft.net

DocumentRoot {ehcpdir}/webmail

LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%v:%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
LogFormat "%v:%p %h %l %u %t \"%{Host}i\" \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined_host
CustomLog  {homedir}/logs/access_log combined
CustomLog  /var/log/apache2/access_log_multi.log vhost_combined_host

ProxyPassMatch ^(.*\.php)$ fcgi://127.0.0.1:9001{ehcpdir}/webmail/$1
ProxyFCGISetEnvIf "true" PHP_ADMIN_VALUE "open_basedir={ehcpdir}/webmail:/tmp:/var/www/php_sessions:/usr/share:/etc/roundcube:/var/lib/roundcube:/var/log/roundcube; \n upload_tmp_dir=/tmp; \n session.save_path=/var/www/php_sessions;"

SSLEngine on
SSLCertificateFile {ssl_cert_path}
SSLCertificateKeyFile {ssl_cert_key_path}
{ssl_cert_chain_setting_with_path}

</VirtualHost>

<VirtualHost *:443>
ServerName  webmail2.ltcraft.net
ServerAlias  email2.ltcraft.net
ServerAlias  mail2.ltcraft.net

DocumentRoot {ehcpdir}/webmail2

LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%v:%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
LogFormat "%v:%p %h %l %u %t \"%{Host}i\" \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined_host
CustomLog  {homedir}/logs/access_log combined
CustomLog  /var/log/apache2/access_log_multi.log vhost_combined_host

ProxyPassMatch ^(.*\.php)$ fcgi://127.0.0.1:9001{ehcpdir}/webmail2/$1
ProxyFCGISetEnvIf "true" PHP_ADMIN_VALUE "open_basedir={ehcpdir}/webmail2; \n upload_tmp_dir={ehcpdir}/webmail2/data; \n session.save_path={ehcpdir}/webmail2/data;"

SSLEngine on
SSLCertificateFile /var/www/vhosts/loren/ltcraft.net/phptmpdir/server.crt
SSLCertificateKeyFile /var/www/vhosts/loren/ltcraft.net/phptmpdir/server.key
{ssl_cert_chain_setting_with_path}

</VirtualHost>

<VirtualHost *:443>
ServerName  cpanel.ltcraft.net
ServerAlias  panel.ltcraft.net
ServerAlias  ehcp.ltcraft.net
ServerAlias  cp.ltcraft.net

DocumentRoot {ehcpdir}

LogFormat "%v:%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
LogFormat "%v:%p %h %l %u %t \"%{Host}i\" \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined_host
CustomLog  /var/log/apache2/access_log_multi.log vhost_combined_host

ProxyPassMatch ^(.*\.php)$ fcgi://127.0.0.1:9001{ehcpdir}/$1
ProxyFCGISetEnvIf "true" PHP_ADMIN_VALUE "open_basedir={ehcpdir}:/usr/share/php:/usr/share/pear"

<Files  ~ "\.conf$">
Order allow,deny
Deny from all
</Files>

<Files  ~ "\.txt$">
Order allow,deny
Deny from all
</Files>

<Files  ~ "\.log$">
Order allow,deny
Deny from all
</Files>

<Files  ~ "\.sh$">
Order allow,deny
Deny from all
</Files>

SSLEngine on
SSLCertificateFile {ssl_cert_path}
SSLCertificateKeyFile {ssl_cert_key_path}
{ssl_cert_chain_setting_with_path}
</VirtualHost>

<VirtualHost *:443>

ServerName   ltcraft.net
ServerAlias  www.ltcraft.net {wildcarddomain} # this is changed to *.ltcraft.net within classapp.php
# buraya aliaslar yazilacak..
{aliases}

UseCanonicalName Off
DocumentRoot {homedir}/httpdocs
DirectoryIndex index.htm index.html index.php
       
# this combined log format is understandable by webalizer... some other formats are not recognised by webalizer.. thats why, specified here explicitly..     
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%v:%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
LogFormat "%v:%p %h %l %u %t \"%{Host}i\" \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined_host
CustomLog  {homedir}/logs/access_log combined
CustomLog  /var/log/apache2/access_log_multi.log vhost_combined_host
   
ProxyPassMatch ^(.*\.php)$ fcgi://127.0.0.1:9000{homedir}/httpdocs/$1
ProxyFCGISetEnvIf "true" PHP_ADMIN_VALUE "open_basedir={homedir}:/usr/share/php:/usr/share/pear; \n upload_tmp_dir={homedir}/phptmpdir; \n session.save_path={homedir}/phptmpdir;"

AccessFileName .htaccess
SSLEngine on
SSLCertificateFile {ssl_cert_path}
SSLCertificateKeyFile {ssl_cert_key_path}
{ssl_cert_chain_setting_with_path}

{customhttp}
{root_password_protected_dirs}
{password_protected_dirs}
{webstats_password_protection}

</VirtualHost>

#____________end of ltcraft.net__paneluser:{panelusername}_reseller:{reseller}_id:{id}____________
# end template with ssl


Every one of the domains listed has got a let's encrypt key but doesn't show up for some reason by default correctly.

3
Also https://Ltcraft.net is in the same boat..

4
I don't think your certificates are working with Let's Encrypt just a heads up.. An example is https://lorentedford.com

5
Technical Help / Re: Warning in ./libraries/plugin_interface.lib.php#551
« on: December 28, 2019, 12:00:38 pm »
So what exactly am i suppose to edit??

cat /usr/share/phpmyadmin/libraries/sql.lib.php

Code: [Select]
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
 * set of functions for the sql executor
 *
 * @package PhpMyAdmin
 */
use PMA\libraries\DisplayResults;
use 
PMA\libraries\Message;
use 
PMA\libraries\Table;
use 
PMA\libraries\Response;

/**
 * Parses and analyzes the given SQL query.
 *
 * @param string $sql_query SQL query
 * @param string $db        DB name
 *
 * @return mixed
 */
function PMA_parseAndAnalyze($sql_query$db null)
{
    if ((
$db === null) && (!empty($GLOBALS['db']))) {
        
$db $GLOBALS['db'];
    }

    include_once 
'libraries/parse_analyze.lib.php';
    list(
$analyzed_sql_results,,) = PMA_parseAnalyze($sql_query$db);

    return 
$analyzed_sql_results;
}

/**
 * Handle remembered sorting order, only for single table query
 *
 * @param string $db                    database name
 * @param string $table                 table name
 * @param array  &$analyzed_sql_results the analyzed query results
 * @param string &$full_sql_query       SQL query
 *
 * @return void
 */
function PMA_handleSortOrder(
    
$db$table, &$analyzed_sql_results, &$full_sql_query
) {
    
$pmatable = new Table($table$db);

    if (empty(
$analyzed_sql_results['order'])) {

        
// Retrieving the name of the column we should sort after.
        
$sortCol $pmatable->getUiProp(Table::PROP_SORTED_COLUMN);
        if (empty(
$sortCol)) {
            return;
        }

        
// Remove the name of the table from the retrieved field name.
        
$sortCol str_replace(
            
PMA\libraries\Util::backquote($table) . '.',
            
'',
            
$sortCol
        
);

        
// Create the new query.
        
$full_sql_query SqlParser\Utils\Query::replaceClause(
            
$analyzed_sql_results['statement'],
            
$analyzed_sql_results['parser']->list,
            
'ORDER BY ' $sortCol
        
);

        
// TODO: Avoid reparsing the query.
        
$analyzed_sql_results SqlParser\Utils\Query::getAll($full_sql_query);
    } else {
        
// Store the remembered table into session.
        
$pmatable->setUiProp(
            
Table::PROP_SORTED_COLUMN,
            
SqlParser\Utils\Query::getClause(
                
$analyzed_sql_results['statement'],
                
$analyzed_sql_results['parser']->list,
                
'ORDER BY'
            
)
        );
    }
}

/**
 * Append limit clause to SQL query
 *
 * @param array &$analyzed_sql_results the analyzed query results
 *
 * @return string limit clause appended SQL query
 */
function PMA_getSqlWithLimitClause(&$analyzed_sql_results)
{
    return 
SqlParser\Utils\Query::replaceClause(
        
$analyzed_sql_results['statement'],
        
$analyzed_sql_results['parser']->list,
        
'LIMIT ' $_SESSION['tmpval']['pos'] . ', '
        
$_SESSION['tmpval']['max_rows']
    );
}

/**
 * Verify whether the result set has columns from just one table
 *
 * @param array $fields_meta meta fields
 *
 * @return boolean whether the result set has columns from just one table
 */
function PMA_resultSetHasJustOneTable($fields_meta)
{
    
$just_one_table true;
    
$prev_table '';
    foreach (
$fields_meta as $one_field_meta) {
        if (
$one_field_meta->table != ''
            
&& $prev_table != ''
            
&& $one_field_meta->table != $prev_table
        
) {
            
$just_one_table false;
        }
        if (
$one_field_meta->table != '') {
            
$prev_table $one_field_meta->table;
        }
    }
    return 
$just_one_table && $prev_table != '';
}

/**
 * Verify whether the result set contains all the columns
 * of at least one unique key
 *
 * @param string $db          database name
 * @param string $table       table name
 * @param array  $fields_meta meta fields
 *
 * @return boolean whether the result set contains a unique key
 */
function PMA_resultSetContainsUniqueKey($db$table$fields_meta)
{
    
$resultSetColumnNames = array();
    foreach (
$fields_meta as $oneMeta) {
        
$resultSetColumnNames[] = $oneMeta->name;
    }
    foreach (
PMA\libraries\Index::getFromTable($table$db) as $index) {
        if (
$index->isUnique()) {
            
$indexColumns $index->getColumns();
            
$numberFound 0;
            foreach (
$indexColumns as $indexColumnName => $dummy) {
                if (
in_array($indexColumnName$resultSetColumnNames)) {
                    
$numberFound++;
                }
            }
            if (
$numberFound == count($indexColumns)) {
                return 
true;
            }
        }
    }
    return 
false;
}

/**
 * Get the HTML for relational column dropdown
 * During grid edit, if we have a relational field, returns the html for the
 * dropdown
 *
 * @param string $db         current database
 * @param string $table      current table
 * @param string $column     current column
 * @param string $curr_value current selected value
 *
 * @return string $dropdown html for the dropdown
 */
function PMA_getHtmlForRelationalColumnDropdown($db$table$column$curr_value)
{
    
$foreigners PMA_getForeigners($db$table$column);

    
$foreignData PMA_getForeignData($foreigners$columnfalse'''');

    if (
$foreignData['disp_row'] == null) {
        
//Handle the case when number of values
        //is more than $cfg['ForeignKeyMaxLimit']
        
$_url_params = array(
                
'db' => $db,
                
'table' => $table,
                
'field' => $column
        
);

        
$dropdown '<span class="curr_value">'
            
htmlspecialchars($_REQUEST['curr_value'])
            . 
'</span>'
            
'<a href="browse_foreigners.php'
            
PMA_URL_getCommon($_url_params) . '"'
            
'class="ajax browse_foreign" ' '>'
            
__('Browse foreign values')
            . 
'</a>';
    } else {
        
$dropdown PMA_foreignDropdown(
            
$foreignData['disp_row'],
            
$foreignData['foreign_field'],
            
$foreignData['foreign_display'],
            
$curr_value,
            
$GLOBALS['cfg']['ForeignKeyMaxLimit']
        );
        
$dropdown '<select>' $dropdown '</select>';
    }

    return 
$dropdown;
}

/**
 * Get the HTML for the profiling table and accompanying chart if profiling is set.
 * Otherwise returns null
 *
 * @param string $url_query         url query
 * @param string $db                current database
 * @param array  $profiling_results array containing the profiling info
 *
 * @return string $profiling_table html for the profiling table and chart
 */
function PMA_getHtmlForProfilingChart($url_query$db$profiling_results)
{
    if (! empty(
$profiling_results)) {
        
$pma_token $_SESSION[' PMA_token '];
        
$url_query = isset($url_query)
            ? 
$url_query
            
PMA_URL_getCommon(array('db' => $db));

        
$profiling_table '';
        
$profiling_table .= '<fieldset><legend>' __('Profiling')
            . 
'</legend>' "\n";
        
$profiling_table .= '<div class="floatleft">';
        
$profiling_table .= '<h3>' __('Detailed profile') . '</h3>';
        
$profiling_table .= '<table id="profiletable"><thead>' "\n";
        
$profiling_table .= ' <tr>' "\n";
        
$profiling_table .= '  <th>' __('Order')
            . 
'<div class="sorticon"></div></th>' "\n";
        
$profiling_table .= '  <th>' __('State')
            . 
PMA\libraries\Util::showMySQLDocu('general-thread-states')
            . 
'<div class="sorticon"></div></th>' "\n";
        
$profiling_table .= '  <th>' __('Time')
            . 
'<div class="sorticon"></div></th>' "\n";
        
$profiling_table .= ' </tr></thead><tbody>' "\n";
        list(
$detailed_table$chart_json$profiling_stats)
            = 
PMA_analyzeAndGetTableHtmlForProfilingResults($profiling_results);
        
$profiling_table .= $detailed_table;
        
$profiling_table .= '</tbody></table>' "\n";
        
$profiling_table .= '</div>';

        
$profiling_table .= '<div class="floatleft">';
        
$profiling_table .= '<h3>' __('Summary by state') . '</h3>';
        
$profiling_table .= '<table id="profilesummarytable"><thead>' "\n";
        
$profiling_table .= ' <tr>' "\n";
        
$profiling_table .= '  <th>' __('State')
            . 
PMA\libraries\Util::showMySQLDocu('general-thread-states')
            . 
'<div class="sorticon"></div></th>' "\n";
        
$profiling_table .= '  <th>' __('Total Time')
            . 
'<div class="sorticon"></div></th>' "\n";
        
$profiling_table .= '  <th>' __('% Time')
            . 
'<div class="sorticon"></div></th>' "\n";
        
$profiling_table .= '  <th>' __('Calls')
            . 
'<div class="sorticon"></div></th>' "\n";
        
$profiling_table .= '  <th>' __('ø Time')
            . 
'<div class="sorticon"></div></th>' "\n";
        
$profiling_table .= ' </tr></thead><tbody>' "\n";
        
$profiling_table .= PMA_getTableHtmlForProfilingSummaryByState(
            
$profiling_stats
        
);
        
$profiling_table .= '</tbody></table>' "\n";

        
$profiling_table .= <<<EOT
<script type="text/javascript">
    pma_token = '
$pma_token';
    url_query = '
$url_query';
</script>
EOT;
        
$profiling_table .= "</div>";
        
$profiling_table .= "<div class='clearfloat'></div>";

        
//require_once 'libraries/chart.lib.php';
        
$profiling_table .= '<div id="profilingChartData" style="display:none;">';
        
$profiling_table .= json_encode($chart_json);
        
$profiling_table .= '</div>';
        
$profiling_table .= '<div id="profilingchart" style="display:none;">';
        
$profiling_table .= '</div>';
        
$profiling_table .= '<script type="text/javascript">';
        
$profiling_table .= "AJAX.registerOnload('sql.js', function () {";
        
$profiling_table .= 'makeProfilingChart();';
        
$profiling_table .= 'initProfilingTables();';
        
$profiling_table .= '});';
        
$profiling_table .= '</script>';
        
$profiling_table .= '</fieldset>' "\n";
    } else {
        
$profiling_table null;
    }
    return 
$profiling_table;
}

/**
 * Function to get HTML for detailed profiling results table, profiling stats, and
 * $chart_json for displaying the chart.
 *
 * @param array $profiling_results profiling results
 *
 * @return mixed
 */
function PMA_analyzeAndGetTableHtmlForProfilingResults(
    
$profiling_results
) {
    
$profiling_stats = array(
        
'total_time' => 0,
        
'states' => array(),
    );
    
$chart_json = Array();
    
$i 1;
    
$table '';
    foreach (
$profiling_results as $one_result) {
        if (isset(
$profiling_stats['states'][ucwords($one_result['Status'])])) {
            
$states $profiling_stats['states'];
            
$states[ucwords($one_result['Status'])]['total_time']
                += 
$one_result['Duration'];
            
$states[ucwords($one_result['Status'])]['calls']++;
        } else {
            
$profiling_stats['states'][ucwords($one_result['Status'])] = array(
                
'total_time' => $one_result['Duration'],
                
'calls' => 1,
            );
        }
        
$profiling_stats['total_time'] += $one_result['Duration'];

        
$table .= ' <tr>' "\n";
        
$table .= '<td>' $i++ . '</td>' "\n";
        
$table .= '<td>' ucwords($one_result['Status'])
            . 
'</td>' "\n";
        
$table .= '<td class="right">'
            
. (PMA\libraries\Util::formatNumber($one_result['Duration'], 31))
            . 
's<span style="display:none;" class="rawvalue">'
            
$one_result['Duration'] . '</span></td>' "\n";
        if (isset(
$chart_json[ucwords($one_result['Status'])])) {
            
$chart_json[ucwords($one_result['Status'])]
                += 
$one_result['Duration'];
        } else {
            
$chart_json[ucwords($one_result['Status'])]
                = 
$one_result['Duration'];
        }
    }
    return array(
$table$chart_json$profiling_stats);
}

/**
 * Function to get HTML for summary by state table
 *
 * @param array $profiling_stats profiling stats
 *
 * @return string $table html for the table
 */
function PMA_getTableHtmlForProfilingSummaryByState($profiling_stats)
{
    
$table '';
    foreach (
$profiling_stats['states'] as $name => $stats) {
        
$table .= ' <tr>' "\n";
        
$table .= '<td>' $name '</td>' "\n";
        
$table .= '<td align="right">'
            
PMA\libraries\Util::formatNumber($stats['total_time'], 31)
            . 
's<span style="display:none;" class="rawvalue">'
            
$stats['total_time'] . '</span></td>' "\n";
        
$table .= '<td align="right">'
            
PMA\libraries\Util::formatNumber(
                
100 * ($stats['total_time'] / $profiling_stats['total_time']),
                
02
            
)
        . 
'%</td>' "\n";
        
$table .= '<td align="right">' $stats['calls'] . '</td>'
            
"\n";
        
$table .= '<td align="right">'
            
PMA\libraries\Util::formatNumber(
                
$stats['total_time'] / $stats['calls'], 31
            
)
            . 
's<span style="display:none;" class="rawvalue">'
            
number_format($stats['total_time'] / $stats['calls'], 8'.''')
            . 
'</span></td>' "\n";
        
$table .= ' </tr>' "\n";
    }
    return 
$table;
}

/**
 * Get the HTML for the enum column dropdown
 * During grid edit, if we have a enum field, returns the html for the
 * dropdown
 *
 * @param string $db         current database
 * @param string $table      current table
 * @param string $column     current column
 * @param string $curr_value currently selected value
 *
 * @return string $dropdown html for the dropdown
 */
function PMA_getHtmlForEnumColumnDropdown($db$table$column$curr_value)
{
    
$values PMA_getValuesForColumn($db$table$column);
    
$dropdown '<option value="">&nbsp;</option>';
    
$dropdown .= PMA_getHtmlForOptionsList($values, array($curr_value));
    
$dropdown '<select>' $dropdown '</select>';
    return 
$dropdown;
}

/**
 * Get value of a column for a specific row (marked by $where_clause)
 *
 * @param string $db           current database
 * @param string $table        current table
 * @param string $column       current column
 * @param string $where_clause where clause to select a particular row
 *
 * @return string with value
 */
function PMA_getFullValuesForSetColumn($db$table$column$where_clause)
{
    
$result $GLOBALS['dbi']->fetchSingleRow(
        
"SELECT `$column` FROM `$db`.`$table` WHERE $where_clause"
    
);

    return 
$result[$column];
}

/**
 * Get the HTML for the set column dropdown
 * During grid edit, if we have a set field, returns the html for the
 * dropdown
 *
 * @param string $db         current database
 * @param string $table      current table
 * @param string $column     current column
 * @param string $curr_value currently selected value
 *
 * @return string $dropdown html for the set column
 */
function PMA_getHtmlForSetColumn($db$table$column$curr_value)
{
    
$values PMA_getValuesForColumn($db$table$column);
    
$dropdown '';
    
$full_values =
        isset(
$_REQUEST['get_full_values']) ? $_REQUEST['get_full_values'] : false;
    
$where_clause =
        isset(
$_REQUEST['where_clause']) ? $_REQUEST['where_clause'] : null;

    
// If the $curr_value was truncated, we should
    // fetch the correct full values from the table
    
if ($full_values && ! empty($where_clause)) {
        
$curr_value PMA_getFullValuesForSetColumn(
            
$db$table$column$where_clause
        
);
    }

    
//converts characters of $curr_value to HTML entities
    
$converted_curr_value htmlentities(
        
$curr_valueENT_COMPAT"UTF-8"
    
);

    
$selected_values explode(','$converted_curr_value);

    
$dropdown .= PMA_getHtmlForOptionsList($values$selected_values);

    
$select_size = (sizeof($values) > 10) ? 10 sizeof($values);
    
$dropdown '<select multiple="multiple" size="' $select_size '">'
        
$dropdown '</select>';

    return 
$dropdown;
}

/**
 * Get all the values for a enum column or set column in a table
 *
 * @param string $db     current database
 * @param string $table  current table
 * @param string $column current column
 *
 * @return array $values array containing the value list for the column
 */
function PMA_getValuesForColumn($db$table$column)
{
    
$field_info_query $GLOBALS['dbi']->getColumnsSql($db$table$column);

    
$field_info_result $GLOBALS['dbi']->fetchResult(
        
$field_info_query,
        
null,
        
null,
        
null,
        
PMA\libraries\DatabaseInterface::QUERY_STORE
    
);

    
$values PMA\libraries\Util::parseEnumSetValues($field_info_result[0]['Type']);

    return 
$values;
}

/**
 * Get HTML for options list
 *
 * @param array $values          set of values
 * @param array $selected_values currently selected values
 *
 * @return string $options HTML for options list
 */
function PMA_getHtmlForOptionsList($values$selected_values)
{
    
$options '';
    foreach (
$values as $value) {
        
$options .= '<option value="' $value '"';
        if (
in_array($value$selected_valuestrue)) {
            
$options .= ' selected="selected" ';
        }
        
$options .= '>' $value '</option>';
    }
    return 
$options;
}

/**
 * Function to get html for bookmark support if bookmarks are enabled. Else will
 * return null
 *
 * @param array  $displayParts   the parts to display
 * @param array  $cfgBookmark    configuration setting for bookmarking
 * @param string $sql_query      sql query
 * @param string $db             current database
 * @param string $table          current table
 * @param string $complete_query complete query
 * @param string $bkm_user       bookmarking user
 *
 * @return string $html
 */
function PMA_getHtmlForBookmark($displayParts$cfgBookmark$sql_query$db,
    
$table$complete_query$bkm_user
) {
    if (
$displayParts['bkm_form'] == '1'
        
&& (! empty($cfgBookmark) && empty($_GET['id_bookmark']))
        && ! empty(
$sql_query)
    ) {
        
$goto 'sql.php'
            
PMA_URL_getCommon(
                array(
                    
'db' => $db,
                    
'table' => $table,
                    
'sql_query' => $sql_query,
                    
'id_bookmark'=> 1,
                )
            );
        
$bkm_sql_query = isset($complete_query) ? $complete_query $sql_query;
        
$html '<form action="sql.php" method="post"'
            
' onsubmit="return ! emptyCheckTheField(this,'
            
'\'bkm_fields[bkm_label]\');"'
            
' class="bookmarkQueryForm print_ignore">';
        
$html .= PMA_URL_getHiddenInputs();
        
$html .= '<input type="hidden" name="db"'
            
' value="' htmlspecialchars($db) . '" />';
        
$html .= '<input type="hidden" name="goto" value="' $goto '" />';
        
$html .= '<input type="hidden" name="bkm_fields[bkm_database]"'
            
' value="' htmlspecialchars($db) . '" />';
        
$html .= '<input type="hidden" name="bkm_fields[bkm_user]"'
            
' value="' $bkm_user '" />';
        
$html .= '<input type="hidden" name="bkm_fields[bkm_sql_query]"'
            
' value="'
            
htmlspecialchars($bkm_sql_query)
            . 
'" />';
        
$html .= '<fieldset>';
        
$html .= '<legend>';
        
$html .= PMA\libraries\Util::getIcon(
            
'b_bookmark.png'__('Bookmark this SQL query'), true
        
);
        
$html .= '</legend>';
        
$html .= '<div class="formelement">';
        
$html .= '<label>' __('Label:');
        
$html .= '<input type="text" name="bkm_fields[bkm_label]" value="" />' .
            
'</label>';
        
$html .= '</div>';
        
$html .= '<div class="formelement">';
        
$html .= '<label>' .
            
'<input type="checkbox" name="bkm_all_users" value="true" />';
        
$html .=  __('Let every user access this bookmark') . '</label>';
        
$html .= '</div>';
        
$html .= '<div class="clearfloat"></div>';
        
$html .= '</fieldset>';
        
$html .= '<fieldset class="tblFooters">';
        
$html .= '<input type="hidden" name="store_bkm" value="1" />';
        
$html .= '<input type="submit"'
            
' value="' __('Bookmark this SQL query') . '" />';
        
$html .= '</fieldset>';
        
$html .= '</form>';

    } else {
        
$html null;
    }

    return 
$html;
}

/**
 * Function to check whether to remember the sorting order or not
 *
 * @param array $analyzed_sql_results the analyzed query and other variables set
 *                                    after analyzing the query
 *
 * @return boolean
 */
function PMA_isRememberSortingOrder($analyzed_sql_results)
{
    return 
$GLOBALS['cfg']['RememberSorting']
        && ! (
$analyzed_sql_results['is_count']
            || 
$analyzed_sql_results['is_export']
            || 
$analyzed_sql_results['is_func']
            || 
$analyzed_sql_results['is_analyse'])
        && 
$analyzed_sql_results['select_from']
        && ((empty(
$analyzed_sql_results['select_expr']))
            || (
count($analyzed_sql_results['select_expr'] == 1)
                && (
$analyzed_sql_results['select_expr'][0] == '*')))
        && 
count($analyzed_sql_results['select_tables']) == 1;
}

/**
 * Function to check whether the LIMIT clause should be appended or not
 *
 * @param array $analyzed_sql_results the analyzed query and other variables set
 *                                    after analyzing the query
 *
 * @return boolean
 */
function PMA_isAppendLimitClause($analyzed_sql_results)
{
    
// Assigning LIMIT clause to an syntactically-wrong query
    // is not needed. Also we would want to show the true query
    // and the true error message to the query executor

    
return (isset($analyzed_sql_results['parser'])
        && 
count($analyzed_sql_results['parser']->errors) === 0)
        && (
$_SESSION['tmpval']['max_rows'] != 'all')
        && ! (
$analyzed_sql_results['is_export']
        || 
$analyzed_sql_results['is_analyse'])
        && (
$analyzed_sql_results['select_from']
            || 
$analyzed_sql_results['is_subquery'])
        && empty(
$analyzed_sql_results['limit']);
}

/**
 * Function to check whether this query is for just browsing
 *
 * @param array   $analyzed_sql_results the analyzed query and other variables set
 *                                      after analyzing the query
 * @param boolean $find_real_end        whether the real end should be found
 *
 * @return boolean
 */
function PMA_isJustBrowsing($analyzed_sql_results$find_real_end)
{
    return ! 
$analyzed_sql_results['is_group']
        && ! 
$analyzed_sql_results['is_func']
        && empty(
$analyzed_sql_results['union'])
        && empty(
$analyzed_sql_results['distinct'])
        && 
$analyzed_sql_results['select_from']
        && (
count($analyzed_sql_results['select_tables']) === 1)
        && (empty(
$analyzed_sql_results['statement']->where)
            || (
count($analyzed_sql_results['statement']->where) == 1
                
&& $analyzed_sql_results['statement']->where[0]->expr ==='1'))
        && empty(
$analyzed_sql_results['group'])
        && ! isset(
$find_real_end)
        && ! 
$analyzed_sql_results['is_subquery']
        && ! 
$analyzed_sql_results['join']
        && empty(
$analyzed_sql_results['having']);
}

/**
 * Function to check whether the related transformation information should be deleted
 *
 * @param array $analyzed_sql_results the analyzed query and other variables set
 *                                    after analyzing the query
 *
 * @return boolean
 */
function PMA_isDeleteTransformationInfo($analyzed_sql_results)
{
    return !empty(
$analyzed_sql_results['querytype'])
        && ((
$analyzed_sql_results['querytype'] == 'ALTER')
            || (
$analyzed_sql_results['querytype'] == 'DROP'));
}

/**
 * Function to check whether the user has rights to drop the database
 *
 * @param array   $analyzed_sql_results  the analyzed query and other variables set
 *                                       after analyzing the query
 * @param boolean $allowUserDropDatabase whether the user is allowed to drop db
 * @param boolean $is_superuser          whether this user is a superuser
 *
 * @return boolean
 */
function PMA_hasNoRightsToDropDatabase($analyzed_sql_results,
    
$allowUserDropDatabase$is_superuser
) {
    return ! 
$allowUserDropDatabase
        
&& isset($analyzed_sql_results['drop_database'])
        && 
$analyzed_sql_results['drop_database']
        && ! 
$is_superuser;
}

/**
 * Function to set a column property
 *
 * @param Table  $pmatable      Table instance
 * @param string $request_index col_order|col_visib
 *
 * @return boolean $retval
 */
function PMA_setColumnProperty($pmatable$request_index)
{
    
$property_value explode(','$_REQUEST[$request_index]);
    switch(
$request_index) {
    case 
'col_order':
        
$property_to_set Table::PROP_COLUMN_ORDER;
        break;
    case 
'col_visib':
        
$property_to_set Table::PROP_COLUMN_VISIB;
        break;
    default:
        
$property_to_set '';
    }
    
$retval $pmatable->setUiProp(
        
$property_to_set,
        
$property_value,
        
$_REQUEST['table_create_time']
    );
    if (
gettype($retval) != 'boolean') {
        
$response PMA\libraries\Response::getInstance();
        
$response->setRequestStatus(false);
        
$response->addJSON('message'$retval->getString());
        exit;
    }

    return 
$retval;
}

/**
 * Function to check the request for setting the column order or visibility
 *
 * @param String $table the current table
 * @param String $db    the current database
 *
 * @return void
 */
function PMA_setColumnOrderOrVisibility($table$db)
{
    
$pmatable = new Table($table$db);
    
$retval false;

    
// set column order
    
if (isset($_REQUEST['col_order'])) {
        
$retval PMA_setColumnProperty($pmatable'col_order');
    }

    
// set column visibility
    
if ($retval === true && isset($_REQUEST['col_visib'])) {
        
$retval PMA_setColumnProperty($pmatable'col_visib');
    }

    
$response PMA\libraries\Response::getInstance();
    
$response->setRequestStatus($retval == true);
    exit;
}

/**
 * Function to add a bookmark
 *
 * @param String $goto goto page URL
 *
 * @return void
 */
function PMA_addBookmark($goto)
{
    
$result PMA_Bookmark_save(
        
$_POST['bkm_fields'],
        (isset(
$_POST['bkm_all_users'])
            && 
$_POST['bkm_all_users'] == 'true' true false
        
)
    );
    
$response Response::getInstance();
    if (
$response->isAjax()) {
        if (
$result) {
            
$msg Message::success(__('Bookmark %s has been created.'));
            
$msg->addParam($_POST['bkm_fields']['bkm_label']);
            
$response->addJSON('message'$msg);
        } else {
            
$msg PMA\libraries\message::error(__('Bookmark not created!'));
            
$response->setRequestStatus(false);
            
$response->addJSON('message'$msg);
        }
        exit;
    } else {
        
// go back to sql.php to redisplay query; do not use &amp; in this case:
        /**
         * @todo In which scenario does this happen?
         */
        
PMA_sendHeaderLocation(
            
'./' $goto
            
'&label=' $_POST['bkm_fields']['bkm_label']
        );
    }
}

/**
 * Function to find the real end of rows
 *
 * @param String $db    the current database
 * @param String $table the current table
 *
 * @return mixed the number of rows if "retain" param is true, otherwise true
 */
function PMA_findRealEndOfRows($db$table)
{
    
$unlim_num_rows $GLOBALS['dbi']->getTable($db$table)->countRecords(true);
    
$_SESSION['tmpval']['pos'] = PMA_getStartPosToDisplayRow($unlim_num_rows);

    return 
$unlim_num_rows;
}

/**
 * Function to get values for the relational columns
 *
 * @param String $db    the current database
 * @param String $table the current table
 *
 * @return void
 */
function PMA_getRelationalValues($db$table)
{
    
$column $_REQUEST['column'];
    if (
$_SESSION['tmpval']['relational_display'] == 'D'
        
&& isset($_REQUEST['relation_key_or_display_column'])
        && 
$_REQUEST['relation_key_or_display_column']
    ) {
        
$curr_value $_REQUEST['relation_key_or_display_column'];
    } else {
        
$curr_value $_REQUEST['curr_value'];
    }
    
$dropdown PMA_getHtmlForRelationalColumnDropdown(
        
$db$table$column$curr_value
    
);
    
$response PMA\libraries\Response::getInstance();
    
$response->addJSON('dropdown'$dropdown);
    exit;
}

/**
 * Function to get values for Enum or Set Columns
 *
 * @param String $db         the current database
 * @param String $table      the current table
 * @param String $columnType whether enum or set
 *
 * @return void
 */
function PMA_getEnumOrSetValues($db$table$columnType)
{
    
$column $_REQUEST['column'];
    
$curr_value $_REQUEST['curr_value'];
    
$response PMA\libraries\Response::getInstance();
    if (
$columnType == "enum") {
        
$dropdown PMA_getHtmlForEnumColumnDropdown(
            
$db$table$column$curr_value
        
);
        
$response->addJSON('dropdown'$dropdown);
    } else {
        
$select PMA_getHtmlForSetColumn(
            
$db$table$column$curr_value
        
);
        
$response->addJSON('select'$select);
    }
    exit;
}

/**
 * Function to get the default sql query for browsing page
 *
 * @param String $db    the current database
 * @param String $table the current table
 *
 * @return String $sql_query the default $sql_query for browse page
 */
function PMA_getDefaultSqlQueryForBrowse($db$table)
{
    include_once 
'libraries/bookmark.lib.php';
    
$book_sql_query PMA_Bookmark_get(
        
$db,
        
'\'' $GLOBALS['dbi']->escapeString($table) . '\'',
        
'label',
        
false,
        
true
    
);

    if (! empty(
$book_sql_query)) {
        
$GLOBALS['using_bookmark_message'] = Message::notice(
            
__('Using bookmark "%s" as default browse query.')
        );
        
$GLOBALS['using_bookmark_message']->addParam($table);
        
$GLOBALS['using_bookmark_message']->addMessage(
            
PMA\libraries\Util::showDocu('faq''faq6-22')
        );
        
$sql_query $book_sql_query;
    } else {

        
$defaultOrderByClause '';

        if (isset(
$GLOBALS['cfg']['TablePrimaryKeyOrder'])
            && (
$GLOBALS['cfg']['TablePrimaryKeyOrder'] !== 'NONE')
        ) {

            
$primaryKey     null;
            
$primary        PMA\libraries\Index::getPrimary($table$db);

            if (
$primary !== false) {

                
$primarycols    $primary->getColumns();

                foreach (
$primarycols as $col) {
                    
$primaryKey $col->getName();
                    break;
                }

                if (
$primaryKey != null) {
                    
$defaultOrderByClause ' ORDER BY '
                        
PMA\libraries\Util::backquote($table) . '.'
                        
PMA\libraries\Util::backquote($primaryKey) . ' '
                        
$GLOBALS['cfg']['TablePrimaryKeyOrder'];
                }

            }

        }

        
$sql_query 'SELECT * FROM ' PMA\libraries\Util::backquote($table)
            . 
$defaultOrderByClause;

    }
    unset(
$book_sql_query);

    return 
$sql_query;
}

/**
 * Responds an error when an error happens when executing the query
 *
 * @param boolean $is_gotofile    whether goto file or not
 * @param String  $error          error after executing the query
 * @param String  $full_sql_query full sql query
 *
 * @return void
 */
function PMA_handleQueryExecuteError($is_gotofile$error$full_sql_query)
{
    if (
$is_gotofile) {
        
$message PMA\libraries\Message::rawError($error);
        
$response PMA\libraries\Response::getInstance();
        
$response->setRequestStatus(false);
        
$response->addJSON('message'$message);
    } else {
        
PMA\libraries\Util::mysqlDie($error$full_sql_query'''');
    }
    exit;
}

/**
 * Function to store the query as a bookmark
 *
 * @param String  $db                     the current database
 * @param String  $bkm_user               the bookmarking user
 * @param String  $sql_query_for_bookmark the query to be stored in bookmark
 * @param String  $bkm_label              bookmark label
 * @param boolean $bkm_replace            whether to replace existing bookmarks
 *
 * @return void
 */
function PMA_storeTheQueryAsBookmark($db$bkm_user$sql_query_for_bookmark,
    
$bkm_label$bkm_replace
) {
    include_once 
'libraries/bookmark.lib.php';
    
$bfields = array(
                 
'bkm_database' => $db,
                 
'bkm_user'  => $bkm_user,
                 
'bkm_sql_query' => $sql_query_for_bookmark,
                 
'bkm_label' => $bkm_label
    
);

    
// Should we replace bookmark?
    
if (isset($bkm_replace)) {
        
$bookmarks PMA_Bookmark_getList($db);
        foreach (
$bookmarks as $key => $val) {
            if (
$val['label'] == $bkm_label) {
                
PMA_Bookmark_delete($key);
            }
        }
    }

    
PMA_Bookmark_save($bfields, isset($_POST['bkm_all_users']));

}

/**
 * Executes the SQL query and measures its execution time
 *
 * @param String $full_sql_query the full sql query
 *
 * @return array ($result, $querytime)
 */
function PMA_executeQueryAndMeasureTime($full_sql_query)
{
    
// close session in case the query takes too long
    
session_write_close();

    
// Measure query time.
    
$querytime_before array_sum(explode(' 'microtime()));

    
$result = @$GLOBALS['dbi']->tryQuery(
        
$full_sql_querynullPMA\libraries\DatabaseInterface::QUERY_STORE
    
);
    
$querytime_after array_sum(explode(' 'microtime()));

    
// reopen session
    
session_start();

    return array(
$result$querytime_after $querytime_before);
}

/**
 * Function to get the affected or changed number of rows after executing a query
 *
 * @param boolean $is_affected whether the query affected a table
 * @param mixed   $result      results of executing the query
 *
 * @return int    $num_rows    number of rows affected or changed
 */
function PMA_getNumberOfRowsAffectedOrChanged($is_affected$result)
{
    if (! 
$is_affected) {
        
$num_rows = ($result) ? @$GLOBALS['dbi']->numRows($result) : 0;
    } else {
        
$num_rows = @$GLOBALS['dbi']->affectedRows();
    }

    return 
$num_rows;
}

/**
 * Checks if the current database has changed
 * This could happen if the user sends a query like "USE `database`;"
 *
 * @param String $db the database in the query
 *
 * @return int $reload whether to reload the navigation(1) or not(0)
 */
function PMA_hasCurrentDbChanged($db)
{
    if (
mb_strlen($db)) {
        
$current_db $GLOBALS['dbi']->fetchValue('SELECT DATABASE()');
        
// $current_db is false, except when a USE statement was sent
        
return ($current_db != false) && ($db !== $current_db);
    }

    return 
false;
}

/**
 * If a table, database or column gets dropped, clean comments.
 *
 * @param String $db     current database
 * @param String $table  current table
 * @param String $column current column
 * @param bool   $purge  whether purge set or not
 *
 * @return array $extra_data
 */
function PMA_cleanupRelations($db$table$column$purge)
{
    include_once 
'libraries/relation_cleanup.lib.php';

    if (! empty(
$purge) && mb_strlen($db)) {
        if (
mb_strlen($table)) {
            if (isset(
$column) && mb_strlen($column)) {
                
PMA_relationsCleanupColumn($db$table$column);
            } else {
                
PMA_relationsCleanupTable($db$table);
            }
        } else {
            
PMA_relationsCleanupDatabase($db);
        }
    }
}

/**
 * Function to count the total number of rows for the same 'SELECT' query without
 * the 'LIMIT' clause that may have been programatically added
 *
 * @param int    $num_rows             number of rows affected/changed by the query
 * @param bool   $justBrowsing         whether just browsing or not
 * @param string $db                   the current database
 * @param string $table                the current table
 * @param array  $analyzed_sql_results the analyzed query and other variables set
 *                                     after analyzing the query
 *
 * @return int $unlim_num_rows unlimited number of rows
 */
function PMA_countQueryResults(
    
$num_rows$justBrowsing$db$table$analyzed_sql_results
) {

    
/* Shortcut for not analyzed/empty query */
    
if (empty($analyzed_sql_results)) {
        return 
0;
    }

    if (!
PMA_isAppendLimitClause($analyzed_sql_results)) {
        
// if we did not append a limit, set this to get a correct
        // "Showing rows..." message
        // $_SESSION['tmpval']['max_rows'] = 'all';
        
$unlim_num_rows $num_rows;
    } elseif (
$analyzed_sql_results['querytype'] == 'SELECT'
        
|| $analyzed_sql_results['is_subquery']
    ) {
        
//    c o u n t    q u e r y

        // If we are "just browsing", there is only one table (and no join),
        // and no WHERE clause (or just 'WHERE 1 '),
        // we do a quick count (which uses MaxExactCount) because
        // SQL_CALC_FOUND_ROWS is not quick on large InnoDB tables

        // However, do not count again if we did it previously
        // due to $find_real_end == true
        
if ($justBrowsing) {
            
// Get row count (is approximate for InnoDB)
            
$unlim_num_rows $GLOBALS['dbi']->getTable($db$table)->countRecords();
            
/**
             * @todo Can we know at this point that this is InnoDB,
             *       (in this case there would be no need for getting
             *       an exact count)?
             */
            
if ($unlim_num_rows $GLOBALS['cfg']['MaxExactCount']) {
                
// Get the exact count if approximate count
                // is less than MaxExactCount
                /**
                 * @todo In countRecords(), MaxExactCount is also verified,
                 *       so can we avoid checking it twice?
                 */
                
$unlim_num_rows $GLOBALS['dbi']->getTable($db$table)
                    ->
countRecords(true);
            }

        } else {

            
// The SQL_CALC_FOUND_ROWS option of the SELECT statement is used.

            // For UNION statements, only a SQL_CALC_FOUND_ROWS is required
            // after the first SELECT.

            
$count_query SqlParser\Utils\Query::replaceClause(
                
$analyzed_sql_results['statement'],
                
$analyzed_sql_results['parser']->list,
                
'SELECT SQL_CALC_FOUND_ROWS',
                
null,
                
true
            
);

            
// Another LIMIT clause is added to avoid long delays.
            // A complete result will be returned anyway, but the LIMIT would
            // stop the query as soon as the result that is required has been
            // computed.

            
if (empty($analyzed_sql_results['union'])) {
                
$count_query .= ' LIMIT 1';
            }

            
// Running the count query.
            
$GLOBALS['dbi']->tryQuery($count_query);

            
$unlim_num_rows $GLOBALS['dbi']->fetchValue('SELECT FOUND_ROWS()');
        } 
// end else "just browsing"
    
} else {// not $is_select
        
$unlim_num_rows 0;
    }

    return 
$unlim_num_rows;
}

/**
 * Function to handle all aspects relating to executing the query
 *
 * @param array   $analyzed_sql_results   analyzed sql results
 * @param String  $full_sql_query         full sql query
 * @param boolean $is_gotofile            whether to go to a file
 * @param String  $db                     current database
 * @param String  $table                  current table
 * @param boolean $find_real_end          whether to find the real end
 * @param String  $sql_query_for_bookmark sql query to be stored as bookmark
 * @param array   $extra_data             extra data
 *
 * @return mixed
 */
function PMA_executeTheQuery($analyzed_sql_results$full_sql_query$is_gotofile,
    
$db$table$find_real_end$sql_query_for_bookmark$extra_data
) {
    
$response PMA\libraries\Response::getInstance();
    
$response->getHeader()->getMenu()->setTable($table);

    
// Only if we ask to see the php code
    
if (isset($GLOBALS['show_as_php'])) {
        
$result null;
        
$num_rows 0;
        
$unlim_num_rows 0;
    } else { 
// If we don't ask to see the php code
        
if (isset($_SESSION['profiling'])
            && 
PMA\libraries\Util::profilingSupported()
        ) {
            
$GLOBALS['dbi']->query('SET PROFILING=1;');
        }

        list(
            
$result,
            
$GLOBALS['querytime']
        ) = 
PMA_executeQueryAndMeasureTime($full_sql_query);

        
// Displays an error message if required and stop parsing the script
        
$error $GLOBALS['dbi']->getError();
        if (
$error && $GLOBALS['cfg']['IgnoreMultiSubmitErrors']) {
            
$extra_data['error'] = $error;
        } elseif (
$error) {
            
PMA_handleQueryExecuteError($is_gotofile$error$full_sql_query);
        }

        
// If there are no errors and bookmarklabel was given,
        // store the query as a bookmark
        
if (! empty($_POST['bkm_label']) && ! empty($sql_query_for_bookmark)) {
            
$cfgBookmark PMA_Bookmark_getParams();
            
PMA_storeTheQueryAsBookmark(
                
$db$cfgBookmark['user'],
                
$sql_query_for_bookmark$_POST['bkm_label'],
                isset(
$_POST['bkm_replace']) ? $_POST['bkm_replace'] : null
            
);
        } 
// end store bookmarks

        // Gets the number of rows affected/returned
        // (This must be done immediately after the query because
        // mysql_affected_rows() reports about the last query done)
        
$num_rows PMA_getNumberOfRowsAffectedOrChanged(
            
$analyzed_sql_results['is_affected'], $result
        
);

        
// Grabs the profiling results
        
if (isset($_SESSION['profiling'])
            && 
PMA\libraries\Util::profilingSupported()
        ) {
            
$profiling_results $GLOBALS['dbi']->fetchResult('SHOW PROFILE;');
        }

        
$justBrowsing PMA_isJustBrowsing(
            
$analyzed_sql_results, isset($find_real_end) ? $find_real_end null
        
);

        
$unlim_num_rows PMA_countQueryResults(
            
$num_rows$justBrowsing$db$table$analyzed_sql_results
        
);

        
PMA_cleanupRelations(
            isset(
$db) ? $db '',
            isset(
$table) ? $table '',
            isset(
$_REQUEST['dropped_column']) ? $_REQUEST['dropped_column'] : null,
            isset(
$_REQUEST['purge']) ? $_REQUEST['purge'] : null
        
);

        if (isset(
$_REQUEST['dropped_column'])
            && 
mb_strlen($db)
            && 
mb_strlen($table)
        ) {
            
// to refresh the list of indexes (Ajax mode)
            
$extra_data['indexes_list'] = PMA\libraries\Index::getHtmlForIndexes(
                
$table,
                
$db
            
);
        }
    }

    return array(
$result$num_rows$unlim_num_rows,
        isset(
$profiling_results) ? $profiling_results null$extra_data
    
);
}
/**
 * Delete related tranformation information
 *
 * @param String $db                   current database
 * @param String $table                current table
 * @param array  $analyzed_sql_results analyzed sql results
 *
 * @return void
 */
function PMA_deleteTransformationInfo($db$table$analyzed_sql_results)
{
    include_once 
'libraries/transformations.lib.php';
    
$statement $analyzed_sql_results['statement'];
    if (
$statement instanceof SqlParser\Statements\AlterStatement) {
        if (!empty(
$statement->altered[0])
            && 
$statement->altered[0]->options->has('DROP')
        ) {
            if (!empty(
$statement->altered[0]->field->column)) {
                
PMA_clearTransformations(
                    
$db,
                    
$table,
                    
$statement->altered[0]->field->column
                
);
            }
        }
    } elseif (
$statement instanceof SqlParser\Statements\DropStatement) {
        
PMA_clearTransformations($db$table);
    }
}

/**
 * Function to get the message for the no rows returned case
 *
 * @param string $message_to_show      message to show
 * @param array  $analyzed_sql_results analyzed sql results
 * @param int    $num_rows             number of rows
 *
 * @return string $message
 */
function PMA_getMessageForNoRowsReturned($message_to_show,
    
$analyzed_sql_results$num_rows
) {
    if (
$analyzed_sql_results['querytype'] == 'DELETE"') {
        
$message Message::getMessageForDeletedRows($num_rows);
    } elseif (
$analyzed_sql_results['is_insert']) {
        if (
$analyzed_sql_results['querytype'] == 'REPLACE') {
            
// For REPLACE we get DELETED + INSERTED row count,
            // so we have to call it affected
            
$message Message::getMessageForAffectedRows($num_rows);
        } else {
            
$message Message::getMessageForInsertedRows($num_rows);
        }
        
$insert_id $GLOBALS['dbi']->insertId();
        if (
$insert_id != 0) {
            
// insert_id is id of FIRST record inserted in one insert,
            // so if we inserted multiple rows, we had to increment this
            
$message->addMessage('[br]');
            
// need to use a temporary because the Message class
            // currently supports adding parameters only to the first
            // message
            
$_inserted Message::notice(__('Inserted row id: %1$d'));
            
$_inserted->addParam($insert_id $num_rows 1);
            
$message->addMessage($_inserted);
        }
    } elseif (
$analyzed_sql_results['is_affected']) {
        
$message Message::getMessageForAffectedRows($num_rows);

        
// Ok, here is an explanation for the !$is_select.
        // The form generated by sql_query_form.lib.php
        // and db_sql.php has many submit buttons
        // on the same form, and some confusion arises from the
        // fact that $message_to_show is sent for every case.
        // The $message_to_show containing a success message and sent with
        // the form should not have priority over errors
    
} elseif (! empty($message_to_show)
        && 
$analyzed_sql_results['querytype'] != 'SELECT'
    
) {
        
$message Message::rawSuccess(htmlspecialchars($message_to_show));
    } elseif (! empty(
$GLOBALS['show_as_php'])) {
        
$message Message::success(__('Showing as PHP code'));
    } elseif (isset(
$GLOBALS['show_as_php'])) {
        
/* User disable showing as PHP, query is only displayed */
        
$message Message::notice(__('Showing SQL query'));
    } else {
        
$message Message::success(
            
__('MySQL returned an empty result set (i.e. zero rows).')
        );
    }

    if (isset(
$GLOBALS['querytime'])) {
        
$_querytime Message::notice(
            
'(' __('Query took %01.4f seconds.') . ')'
        
);
        
$_querytime->addParam($GLOBALS['querytime']);
        
$message->addMessage($_querytime);
    }

    
// In case of ROLLBACK, notify the user.
    
if (isset($_REQUEST['rollback_query'])) {
        
$message->addMessage(__('[ROLLBACK occurred.]'));
    }

    return 
$message;
}

/**
 * Function to respond back when the query returns zero rows
 * This method is called
 * 1-> When browsing an empty table
 * 2-> When executing a query on a non empty table which returns zero results
 * 3-> When executing a query on an empty table
 * 4-> When executing an INSERT, UPDATE, DELETE query from the SQL tab
 * 5-> When deleting a row from BROWSE tab
 * 6-> When searching using the SEARCH tab which returns zero results
 * 7-> When changing the structure of the table except change operation
 *
 * @param array          $analyzed_sql_results analyzed sql results
 * @param string         $db                   current database
 * @param string         $table                current table
 * @param string         $message_to_show      message to show
 * @param int            $num_rows             number of rows
 * @param DisplayResults $displayResultsObject DisplayResult instance
 * @param array          $extra_data           extra data
 * @param string         $pmaThemeImage        uri of the theme image
 * @param object         $result               executed query results
 * @param string         $sql_query            sql query
 * @param string         $complete_query       complete sql query
 *
 * @return string html
 */
function PMA_getQueryResponseForNoResultsReturned($analyzed_sql_results$db,
    
$table$message_to_show$num_rows$displayResultsObject$extra_data,
    
$pmaThemeImage$result$sql_query$complete_query
) {
    if (
PMA_isDeleteTransformationInfo($analyzed_sql_results)) {
        
PMA_deleteTransformationInfo($db$table$analyzed_sql_results);
    }

    if (isset(
$extra_data['error'])) {
        
$message PMA\libraries\Message::rawError($extra_data['error']);
    } else {
        
$message PMA_getMessageForNoRowsReturned(
            isset(
$message_to_show) ? $message_to_show null,
            
$analyzed_sql_results$num_rows
        
);
    }

    
$html_output '';
    
$html_message PMA\libraries\Util::getMessage(
        
$message$GLOBALS['sql_query'], 'success'
    
);
    
$html_output .= $html_message;
    if (!isset(
$GLOBALS['show_as_php'])) {

        if (! empty(
$GLOBALS['reload'])) {
            
$extra_data['reload'] = 1;
            
$extra_data['db'] = $GLOBALS['db'];
        }

        
// For ajax requests add message and sql_query as JSON
        
if (empty($_REQUEST['ajax_page_request'])) {
            
$extra_data['message'] = $message;
            if (
$GLOBALS['cfg']['ShowSQL']) {
                
$extra_data['sql_query'] = $html_message;
            }
        }

        
$response PMA\libraries\Response::getInstance();
        
$response->addJSON(isset($extra_data) ? $extra_data : array());

        if (!empty(
$analyzed_sql_results['is_select']) &&
                !isset(
$extra_data['error'])) {
            
$url_query = isset($url_query) ? $url_query null;

            
$displayParts = array(
                
'edit_lnk' => null,
                
'del_lnk' => null,
                
'sort_lnk' => '1',
                
'nav_bar'  => '0',
                
'bkm_form' => '1',
                
'text_btn' => '1',
                
'pview_lnk' => '1'
            
);

            
$html_output .= PMA_getHtmlForSqlQueryResultsTable(
                
$displayResultsObject,
                
$pmaThemeImage$url_query$displayParts,
                
false0$num_rowstrue$result,
                
$analyzed_sql_resultstrue
            
);

            
$html_output .= $displayResultsObject->getCreateViewQueryResultOp(
                
$analyzed_sql_results
            
);

            
$cfgBookmark PMA_Bookmark_getParams();
            if (
$cfgBookmark) {
                
$html_output .= PMA_getHtmlForBookmark(
                    
$displayParts,
                    
$cfgBookmark,
                    
$sql_query$db$table,
                    isset(
$complete_query) ? $complete_query $sql_query,
                    
$cfgBookmark['user']
                );
            }
        }
    }

    return 
$html_output;
}

/**
 * Function to send response for ajax grid edit
 *
 * @param object $result result of the executed query
 *
 * @return void
 */
function PMA_sendResponseForGridEdit($result)
{
    
$row $GLOBALS['dbi']->fetchRow($result);
    
$field_flags $GLOBALS['dbi']->fieldFlags($result0);
    if (
stristr($field_flagsPMA\libraries\DisplayResults::BINARY_FIELD)) {
        
$row[0] = bin2hex($row[0]);
    }
    
$response PMA\libraries\Response::getInstance();
    
$response->addJSON('value'$row[0]);
    exit;
}

/**
 * Function to get html for the sql query results div
 *
 * @param string  $previous_update_query_html html for the previously executed query
 * @param string  $profiling_chart_html       html for profiling
 * @param Message $missing_unique_column_msg  message for the missing unique column
 * @param Message $bookmark_created_msg       message for bookmark creation
 * @param string  $table_html                 html for the table for displaying sql
 *                                            results
 * @param string  $indexes_problems_html      html for displaying errors in indexes
 * @param string  $bookmark_support_html      html for displaying bookmark form
 *
 * @return string $html_output
 */
function PMA_getHtmlForSqlQueryResults($previous_update_query_html,
    
$profiling_chart_html$missing_unique_column_msg$bookmark_created_msg,
    
$table_html$indexes_problems_html$bookmark_support_html
) {
    
//begin the sqlqueryresults div here. container div
    
$html_output '<div class="sqlqueryresults ajax">';
    
$html_output .= isset($previous_update_query_html)
        ? 
$previous_update_query_html '';
    
$html_output .= isset($profiling_chart_html) ? $profiling_chart_html '';
    
$html_output .= isset($missing_unique_column_msg)
        ? 
$missing_unique_column_msg->getDisplay() : '';
    
$html_output .= isset($bookmark_created_msg)
        ? 
$bookmark_created_msg->getDisplay() : '';
    
$html_output .= $table_html;
    
$html_output .= isset($indexes_problems_html) ? $indexes_problems_html '';
    
$html_output .= isset($bookmark_support_html) ? $bookmark_support_html '';
    
$html_output .= '</div>'// end sqlqueryresults div

    
return $html_output;
}

/**
 * Returns a message for successful creation of a bookmark or null if a bookmark
 * was not created
 *
 * @return Message $bookmark_created_msg
 */
function PMA_getBookmarkCreatedMessage()
{
    if (isset(
$_GET['label'])) {
        
$bookmark_created_msg Message::success(
            
__('Bookmark %s has been created.')
        );
        
$bookmark_created_msg->addParam($_GET['label']);
    } else {
        
$bookmark_created_msg null;
    }

    return 
$bookmark_created_msg;
}

/**
 * Function to get html for the sql query results table
 *
 * @param DisplayResults $displayResultsObject instance of DisplayResult
 * @param string         $pmaThemeImage        theme image uri
 * @param string         $url_query            url query
 * @param array          $displayParts         the parts to display
 * @param bool           $editable             whether the result table is
 *                                             editable or not
 * @param int            $unlim_num_rows       unlimited number of rows
 * @param int            $num_rows             number of rows
 * @param bool           $showtable            whether to show table or not
 * @param object         $result               result of the executed query
 * @param array          $analyzed_sql_results analyzed sql results
 * @param bool           $is_limited_display   Show only limited operations or not
 *
 * @return String
 */
function PMA_getHtmlForSqlQueryResultsTable($displayResultsObject,
    
$pmaThemeImage$url_query$displayParts,
    
$editable$unlim_num_rows$num_rows$showtable$result,
    
$analyzed_sql_results$is_limited_display false
) {
    
$printview = isset($_REQUEST['printview']) ? $_REQUEST['printview'] : null;
    
$table_html '';
    
$browse_dist = ! empty($_REQUEST['is_browse_distinct']);

    if (
$analyzed_sql_results['is_procedure']) {

        do {
            if (! isset(
$result)) {
                
$result $GLOBALS['dbi']->storeResult();
            }
            
$num_rows $GLOBALS['dbi']->numRows($result);

            if (
$result !== false && $num_rows 0) {

                
$fields_meta $GLOBALS['dbi']->getFieldsMeta($result);
                
$fields_cnt  count($fields_meta);

                
$displayResultsObject->setProperties(
                    
$num_rows,
                    
$fields_meta,
                    
$analyzed_sql_results['is_count'],
                    
$analyzed_sql_results['is_export'],
                    
$analyzed_sql_results['is_func'],
                    
$analyzed_sql_results['is_analyse'],
                    
$num_rows,
                    
$fields_cnt,
                    
$GLOBALS['querytime'],
                    
$pmaThemeImage,
                    
$GLOBALS['text_dir'],
                    
$analyzed_sql_results['is_maint'],
                    
$analyzed_sql_results['is_explain'],
                    
$analyzed_sql_results['is_show'],
                    
$showtable,
                    
$printview,
                    
$url_query,
                    
$editable,
                    
$browse_dist
                
);

                
$displayParts = array(
                    
'edit_lnk' => $displayResultsObject::NO_EDIT_OR_DELETE,
                    
'del_lnk' => $displayResultsObject::NO_EDIT_OR_DELETE,
                    
'sort_lnk' => '1',
                    
'nav_bar'  => '1',
                    
'bkm_form' => '1',
                    
'text_btn' => '1',
                    
'pview_lnk' => '1'
                
);

                
$table_html .= $displayResultsObject->getTable(
                    
$result,
                    
$displayParts,
                    
$analyzed_sql_results,
                    
$is_limited_display
                
);
            }

            
$GLOBALS['dbi']->freeResult($result);
            unset(
$result);

        } while (
$GLOBALS['dbi']->moreResults() && $GLOBALS['dbi']->nextResult());

    } else {
        if (isset(
$result) && $result) {
            
$fields_meta $GLOBALS['dbi']->getFieldsMeta($result);
            
$fields_cnt  count($fields_meta);
        }
        
$_SESSION['is_multi_query'] = false;
        
$displayResultsObject->setProperties(
            
$unlim_num_rows,
            
$fields_meta,
            
$analyzed_sql_results['is_count'],
            
$analyzed_sql_results['is_export'],
            
$analyzed_sql_results['is_func'],
            
$analyzed_sql_results['is_analyse'],
            
$num_rows,
            
$fields_cnt$GLOBALS['querytime'],
            
$pmaThemeImage$GLOBALS['text_dir'],
            
$analyzed_sql_results['is_maint'],
            
$analyzed_sql_results['is_explain'],
            
$analyzed_sql_results['is_show'],
            
$showtable,
            
$printview,
            
$url_query,
            
$editable,
            
$browse_dist
        
);

        
$table_html .= $displayResultsObject->getTable(
            
$result,
            
$displayParts,
            
$analyzed_sql_results,
            
$is_limited_display
        
);
        
$GLOBALS['dbi']->freeResult($result);
    }

    return 
$table_html;
}

/**
 * Function to get html for the previous query if there is such. If not will return
 * null
 *
 * @param string $disp_query   display query
 * @param bool   $showSql      whether to show sql
 * @param array  $sql_data     sql data
 * @param string $disp_message display message
 *
 * @return string $previous_update_query_html
 */
function PMA_getHtmlForPreviousUpdateQuery($disp_query$showSql$sql_data,
    
$disp_message
) {
    
// previous update query (from tbl_replace)
    
if (isset($disp_query) && ($showSql == true) && empty($sql_data)) {
        
$previous_update_query_html PMA\libraries\Util::getMessage(
            
$disp_message$disp_query'success'
        
);
    } else {
        
$previous_update_query_html null;
    }

    return 
$previous_update_query_html;
}

/**
 * To get the message if a column index is missing. If not will return null
 *
 * @param string  $table      current table
 * @param string  $db         current database
 * @param boolean $editable   whether the results table can be editable or not
 * @param boolean $has_unique whether there is a unique key
 *
 * @return Message $message
 */
function PMA_getMessageIfMissingColumnIndex($table$db$editable$has_unique)
{
    if (!empty(
$table) && ($GLOBALS['dbi']->isSystemSchema($db) || !$editable)) {
        
$missing_unique_column_msg Message::notice(
            
sprintf(
                
__(
                    
'Current selection does not contain a unique column.'
                    
' Grid edit, checkbox, Edit, Copy and Delete features'
                    
' are not available. %s'
                
),
                
PMA\libraries\Util::showDocu(
                    
'config',
                    
'cfg_RowActionLinksWithoutUnique'
                
)
            )
        );
    } elseif (! empty(
$table) && ! $has_unique) {
        
$missing_unique_column_msg Message::notice(
            
sprintf(
                
__(
                    
'Current selection does not contain a unique column.'
                    
' Grid edit, Edit, Copy and Delete features may result in'
                    
' undesired behavior. %s'
                
),
                
PMA\libraries\Util::showDocu(
                    
'config',
                    
'cfg_RowActionLinksWithoutUnique'
                
)
            )
        );
    } else {
        
$missing_unique_column_msg null;
    }

    return 
$missing_unique_column_msg;
}

/**
 * Function to get html to display problems in indexes
 *
 * @param string     $query_type     query type
 * @param array|null $selectedTables array of table names selected from the
 *                                   database structure page, for an action
 *                                   like check table, optimize table,
 *                                   analyze table or repair table
 * @param string     $db             current database
 *
 * @return string
 */
function PMA_getHtmlForIndexesProblems($query_type$selectedTables$db)
{
    
// BEGIN INDEX CHECK See if indexes should be checked.
    
if (isset($query_type)
        && 
$query_type == 'check_tbl'
        
&& isset($selectedTables)
        && 
is_array($selectedTables)
    ) {
        
$indexes_problems_html '';
        foreach (
$selectedTables as $tbl_name) {
            
$check PMA\libraries\Index::findDuplicates($tbl_name$db);
            if (! empty(
$check)) {
                
$indexes_problems_html .= sprintf(
                    
__('Problems with indexes of table `%s`'), $tbl_name
                
);
                
$indexes_problems_html .= $check;
            }
        }
    } else {
        
$indexes_problems_html null;
    }

    return 
$indexes_problems_html;
}

/**
 * Function to display results when the executed query returns non empty results
 *
 * @param object         $result               executed query results
 * @param array          $analyzed_sql_results analysed sql results
 * @param string         $db                   current database
 * @param string         $table                current table
 * @param string         $message              message to show
 * @param array          $sql_data             sql data
 * @param DisplayResults $displayResultsObject Instance of DisplayResults
 * @param string         $pmaThemeImage        uri of the theme image
 * @param int            $unlim_num_rows       unlimited number of rows
 * @param int            $num_rows             number of rows
 * @param string         $disp_query           display query
 * @param string         $disp_message         display message
 * @param array          $profiling_results    profiling results
 * @param string         $query_type           query type
 * @param array|null     $selectedTables       array of table names selected
 *                                             from the database structure page, for
 *                                             an action like check table,
 *                                             optimize table, analyze table or
 *                                             repair table
 * @param string         $sql_query            sql query
 * @param string         $complete_query       complete sql query
 *
 * @return string html
 */
function PMA_getQueryResponseForResultsReturned($result$analyzed_sql_results,
    
$db$table$message$sql_data$displayResultsObject$pmaThemeImage,
    
$unlim_num_rows$num_rows$disp_query$disp_message$profiling_results,
    
$query_type$selectedTables$sql_query$complete_query
) {
    
// If we are retrieving the full value of a truncated field or the original
    // value of a transformed field, show it here
    
if (isset($_REQUEST['grid_edit']) && $_REQUEST['grid_edit'] == true) {
        
PMA_sendResponseForGridEdit($result);
        
// script has exited at this point
    
}

    
// Gets the list of fields properties
    
if (isset($result) && $result) {
        
$fields_meta $GLOBALS['dbi']->getFieldsMeta($result);
    }

    
// Should be initialized these parameters before parsing
    
$showtable = isset($showtable) ? $showtable null;
    
$url_query = isset($url_query) ? $url_query null;

    
$response PMA\libraries\Response::getInstance();
    
$header   $response->getHeader();
    
$scripts  $header->getScripts();

    
$just_one_table PMA_resultSetHasJustOneTable($fields_meta);

    
// hide edit and delete links:
    // - for information_schema
    // - if the result set does not contain all the columns of a unique key
    //   (unless this is an updatable view)
    // - if the SELECT query contains a join or a subquery

    
$updatableView false;

    
$statement $analyzed_sql_results['statement'];
    if (
$statement instanceof SqlParser\Statements\SelectStatement) {
        if (!empty(
$statement->expr)) {
            if (
$statement->expr[0]->expr === '*') {
                
$_table = new Table($table$db);
                
$updatableView $_table->isUpdatableView();
            }
        }

        if (
$analyzed_sql_results['join']
            || 
$analyzed_sql_results['is_subquery']
            || 
count($analyzed_sql_results['select_tables']) !== 1
        
) {
            
$just_one_table false;
        }
    }

    
$has_unique PMA_resultSetContainsUniqueKey(
        
$db$table$fields_meta
    
);

    
$editable = ($has_unique
        
|| $GLOBALS['cfg']['RowActionLinksWithoutUnique']
        || 
$updatableView)
        && 
$just_one_table;

    
$displayParts = array(
        
'edit_lnk' => $displayResultsObject::UPDATE_ROW,
        
'del_lnk' => $displayResultsObject::DELETE_ROW,
        
'sort_lnk' => '1',
        
'nav_bar'  => '1',
        
'bkm_form' => '1',
        
'text_btn' => '0',
        
'pview_lnk' => '1'
    
);

    if (
$GLOBALS['dbi']->isSystemSchema($db) || !$editable) {
        
$displayParts = array(
            
'edit_lnk' => $displayResultsObject::NO_EDIT_OR_DELETE,
            
'del_lnk' => $displayResultsObject::NO_EDIT_OR_DELETE,
            
'sort_lnk' => '1',
            
'nav_bar'  => '1',
            
'bkm_form' => '1',
            
'text_btn' => '1',
            
'pview_lnk' => '1'
        
);

    }
    if (isset(
$_REQUEST['printview']) && $_REQUEST['printview'] == '1') {
        
$displayParts = array(
            
'edit_lnk' => $displayResultsObject::NO_EDIT_OR_DELETE,
            
'del_lnk' => $displayResultsObject::NO_EDIT_OR_DELETE,
            
'sort_lnk' => '0',
            
'nav_bar'  => '0',
            
'bkm_form' => '0',
            
'text_btn' => '0',
            
'pview_lnk' => '0'
        
);
    }

    if (isset(
$_REQUEST['table_maintenance'])) {
        
$scripts->addFile('makegrid.js');
        
$scripts->addFile('sql.js');
        
$table_maintenance_html '';
        if (isset(
$message)) {
            
$message Message::success($message);
            
$table_maintenance_html PMA\libraries\Util::getMessage(
                
$message$GLOBALS['sql_query'], 'success'
            
);
        }
        
$table_maintenance_html .= PMA_getHtmlForSqlQueryResultsTable(
            
$displayResultsObject,
            
$pmaThemeImage$url_query$displayParts,
            
false$unlim_num_rows$num_rows$showtable$result,
            
$analyzed_sql_results
        
);
        if (empty(
$sql_data) || ($sql_data['valid_queries'] = 1)) {
            
$response->addHTML($table_maintenance_html);
            exit();
        }
    }

    if (!isset(
$_REQUEST['printview']) || $_REQUEST['printview'] != '1') {
        
$scripts->addFile('makegrid.js');
        
$scripts->addFile('sql.js');
        unset(
$GLOBALS['message']);
        
//we don't need to buffer the output in getMessage here.
        //set a global variable and check against it in the function
        
$GLOBALS['buffer_message'] = false;
    }

    
$previous_update_query_html PMA_getHtmlForPreviousUpdateQuery(
        isset(
$disp_query) ? $disp_query null,
        
$GLOBALS['cfg']['ShowSQL'], isset($sql_data) ? $sql_data null,
        isset(
$disp_message) ? $disp_message null
    
);

    
$profiling_chart_html PMA_getHtmlForProfilingChart(
        
$url_query$db, isset($profiling_results) ? $profiling_results :array()
    );

    
$missing_unique_column_msg PMA_getMessageIfMissingColumnIndex(
        
$table$db$editable$has_unique
    
);

    
$bookmark_created_msg PMA_getBookmarkCreatedMessage();

    
$table_html PMA_getHtmlForSqlQueryResultsTable(
        
$displayResultsObject,
        
$pmaThemeImage$url_query$displayParts,
        
$editable$unlim_num_rows$num_rows$showtable$result,
        
$analyzed_sql_results
    
);

    
$indexes_problems_html PMA_getHtmlForIndexesProblems(
        isset(
$query_type) ? $query_type null,
        isset(
$selectedTables) ? $selectedTables null$db
    
);

    
$cfgBookmark PMA_Bookmark_getParams();
    if (
$cfgBookmark) {
        
$bookmark_support_html PMA_getHtmlForBookmark(
            
$displayParts,
            
$cfgBookmark,
            
$sql_query$db$table,
            isset(
$complete_query) ? $complete_query $sql_query,
            
$cfgBookmark['user']
        );
    } else {
        
$bookmark_support_html '';
    }

    
$html_output = isset($table_maintenance_html) ? $table_maintenance_html '';

    
$html_output .= PMA_getHtmlForSqlQueryResults(
        
$previous_update_query_html$profiling_chart_html,
        
$missing_unique_column_msg$bookmark_created_msg,
        
$table_html$indexes_problems_html$bookmark_support_html
    
);

    return 
$html_output;
}

/**
 * Function to execute the query and send the response
 *
 * @param array      $analyzed_sql_results   analysed sql results
 * @param bool       $is_gotofile            whether goto file or not
 * @param string     $db                     current database
 * @param string     $table                  current table
 * @param bool|null  $find_real_end          whether to find real end or not
 * @param string     $sql_query_for_bookmark the sql query to be stored as bookmark
 * @param array|null $extra_data             extra data
 * @param string     $message_to_show        message to show
 * @param string     $message                message
 * @param array|null $sql_data               sql data
 * @param string     $goto                   goto page url
 * @param string     $pmaThemeImage          uri of the PMA theme image
 * @param string     $disp_query             display query
 * @param string     $disp_message           display message
 * @param string     $query_type             query type
 * @param string     $sql_query              sql query
 * @param array|null $selectedTables         array of table names selected from the
 *                                           database structure page, for an action
 *                                           like check table, optimize table,
 *                                           analyze table or repair table
 * @param string     $complete_query         complete query
 *
 * @return void
 */
function PMA_executeQueryAndSendQueryResponse($analyzed_sql_results,
    
$is_gotofile$db$table$find_real_end$sql_query_for_bookmark,
    
$extra_data$message_to_show$message$sql_data$goto$pmaThemeImage,
    
$disp_query$disp_message$query_type$sql_query$selectedTables,
    
$complete_query
) {
    if (
$analyzed_sql_results == null) {
        
// Parse and analyze the query
        
include_once 'libraries/parse_analyze.lib.php';
        list(
            
$analyzed_sql_results,
            
$db,
            
$table_from_sql
        
) = PMA_parseAnalyze($sql_query$db);
        
// @todo: possibly refactor
        
extract($analyzed_sql_results);

        if (
$table != $table_from_sql && !empty($table_from_sql)) {
            
$table $table_from_sql;
        }
    }

    
$html_output PMA_executeQueryAndGetQueryResponse(
        
$analyzed_sql_results// analyzed_sql_results
        
$is_gotofile// is_gotofile
        
$db// db
        
$table// table
        
$find_real_end// find_real_end
        
$sql_query_for_bookmark// sql_query_for_bookmark
        
$extra_data// extra_data
        
$message_to_show// message_to_show
        
$message// message
        
$sql_data// sql_data
        
$goto// goto
        
$pmaThemeImage// pmaThemeImage
        
$disp_query// disp_query
        
$disp_message// disp_message
        
$query_type// query_type
        
$sql_query// sql_query
        
$selectedTables// selectedTables
        
$complete_query // complete_query
    
);

    
$response PMA\libraries\Response::getInstance();
    
$response->addHTML($html_output);
}

/**
 * Function to execute the query and send the response
 *
 * @param array      $analyzed_sql_results   analysed sql results
 * @param bool       $is_gotofile            whether goto file or not
 * @param string     $db                     current database
 * @param string     $table                  current table
 * @param bool|null  $find_real_end          whether to find real end or not
 * @param string     $sql_query_for_bookmark the sql query to be stored as bookmark
 * @param array|null $extra_data             extra data
 * @param string     $message_to_show        message to show
 * @param string     $message                message
 * @param array|null $sql_data               sql data
 * @param string     $goto                   goto page url
 * @param string     $pmaThemeImage          uri of the PMA theme image
 * @param string     $disp_query             display query
 * @param string     $disp_message           display message
 * @param string     $query_type             query type
 * @param string     $sql_query              sql query
 * @param array|null $selectedTables         array of table names selected from the
 *                                           database structure page, for an action
 *                                           like check table, optimize table,
 *                                           analyze table or repair table
 * @param string     $complete_query         complete query
 *
 * @return string html
 */
function PMA_executeQueryAndGetQueryResponse($analyzed_sql_results,
    
$is_gotofile$db$table$find_real_end$sql_query_for_bookmark,
    
$extra_data$message_to_show$message$sql_data$goto$pmaThemeImage,
    
$disp_query$disp_message$query_type$sql_query$selectedTables,
    
$complete_query
) {
    
// Handle disable/enable foreign key checks
    
$default_fk_check PMA\libraries\Util::handleDisableFKCheckInit();

    
// Handle remembered sorting order, only for single table query.
    // Handling is not required when it's a union query
    // (the parser never sets the 'union' key to 0).
    // Handling is also not required if we came from the "Sort by key"
    // drop-down.
    
if (! empty($analyzed_sql_results)
        && 
PMA_isRememberSortingOrder($analyzed_sql_results)
        && empty(
$analyzed_sql_results['union'])
        && ! isset(
$_REQUEST['sort_by_key'])
    ) {
        if (! isset(
$_SESSION['sql_from_query_box'])) {
            
PMA_handleSortOrder($db$table$analyzed_sql_results$sql_query);
        } else {
            unset(
$_SESSION['sql_from_query_box']);
        }

    }

    
$displayResultsObject = new PMA\libraries\DisplayResults(
        
$GLOBALS['db'], $GLOBALS['table'], $goto$sql_query
    
);
    
$displayResultsObject->setConfigParamsForDisplayTable();

    
// assign default full_sql_query
    
$full_sql_query $sql_query;

    
// Do append a "LIMIT" clause?
    
if (PMA_isAppendLimitClause($analyzed_sql_results)) {
        
$full_sql_query PMA_getSqlWithLimitClause($analyzed_sql_results);
    }

    
$GLOBALS['reload'] = PMA_hasCurrentDbChanged($db);
    
$GLOBALS['dbi']->selectDb($db);

    
// Execute the query
    
list($result$num_rows$unlim_num_rows$profiling_results$extra_data)
        = 
PMA_executeTheQuery(
            
$analyzed_sql_results,
            
$full_sql_query,
            
$is_gotofile,
            
$db,
            
$table,
            isset(
$find_real_end) ? $find_real_end null,
            isset(
$sql_query_for_bookmark) ? $sql_query_for_bookmark null,
            isset(
$extra_data) ? $extra_data null
        
);

    
// No rows returned -> move back to the calling page
    
if ((== $num_rows && == $unlim_num_rows)
        || 
$analyzed_sql_results['is_affected']
    ) {
        
$html_output PMA_getQueryResponseForNoResultsReturned(
            
$analyzed_sql_results$db$table,
            isset(
$message_to_show) ? $message_to_show null,
            
$num_rows$displayResultsObject$extra_data,
            
$pmaThemeImage, isset($result) ? $result null,
            
$sql_query, isset($complete_query) ? $complete_query null
        
);
    } else {
        
// At least one row is returned -> displays a table with results
        
$html_output PMA_getQueryResponseForResultsReturned(
            isset(
$result) ? $result null,
            
$analyzed_sql_results,
            
$db,
            
$table,
            isset(
$message) ? $message null,
            isset(
$sql_data) ? $sql_data null,
            
$displayResultsObject,
            
$pmaThemeImage,
            
$unlim_num_rows,
            
$num_rows,
            isset(
$disp_query) ? $disp_query null,
            isset(
$disp_message) ? $disp_message null,
            
$profiling_results,
            isset(
$query_type) ? $query_type null,
            isset(
$selectedTables) ? $selectedTables null,
            
$sql_query,
            isset(
$complete_query) ? $complete_query null
        
);
    }

    
// Handle disable/enable foreign key checks
    
PMA\libraries\Util::handleDisableFKCheckCleanup($default_fk_check);

    return 
$html_output;
}

/**
 * Function to define pos to display a row
 *
 * @param Int $number_of_line Number of the line to display
 * @param Int $max_rows       Number of rows by page
 *
 * @return Int Start position to display the line
 */
function PMA_getStartPosToDisplayRow($number_of_line$max_rows null)
{
    if (
null === $max_rows) {
        
$max_rows $_SESSION['tmpval']['max_rows'];
    }

    return @((
ceil($number_of_line $max_rows) - 1) * $max_rows);
}

/**
 * Function to calculate new pos if pos is higher than number of rows
 * of displayed table
 *
 * @param String   $db    Database name
 * @param String   $table Table name
 * @param Int|null $pos   Initial position
 *
 * @return Int Number of pos to display last page
 */
function PMA_calculatePosForLastPage($db$table$pos)
{
    if (
null === $pos) {
        
$pos $_SESSION['tmpval']['pos'];
    }

    
$_table = new Table($table$db);
    
$unlim_num_rows $_table->countRecords(true);
    
//If position is higher than number of rows
    
if ($unlim_num_rows <= $pos && != $pos) {
        
$pos PMA_getStartPosToDisplayRow($unlim_num_rows);
    }

    return 
$pos;
}

6
Technical Help / Re: Major email problem cant send or receive
« on: December 28, 2019, 09:36:46 am »
In options the only thing i can think of that might fix things is these links..

http://myserver.com/ehcp/index.php?op=dofixmailconfiguration

7
So I have a Private key and a full chain key but there are three places to enter a key.. Where do I place the keys and how does this work?



I don't see a SSL Certificate where would that be?

8
Technical Help / Warning in ./libraries/plugin_interface.lib.php#551
« on: December 08, 2019, 04:46:44 pm »

Any ideas on this error?


Code: [Select]
Warning in ./libraries/plugin_interface.lib.php#551
count(): Parameter must be an array or an object that implements Countable

Backtrace

./libraries/display_import.lib.php#371: PMA_pluginGetOptions(
string 'Import',
array,
)
./libraries/display_import.lib.php#456: PMA_getHtmlForImportOptionsFormat(array)
./libraries/display_import.lib.php#691: PMA_getHtmlForImport(
string '5ded8ad4ac5f6',
string 'server',
string '',
string '',
integer 52428800,
array,
NULL,
NULL,
string '',
)
./server_import.php#34: PMA_getImportDisplay(
string 'server',
string '',
string '',
integer 52428800,
)

9
So this is a fresh installation on Ubuntu Server 18.04 Lts
Here is my installation script: https://gist.github.com/lorentedford/7361dc675c651ce976e502db7dc4c519

Here is what i used for FDQN: lorentedford.com


Every thing appears to have installed correctly but... I get this error after creating my first domain and adding an email address to the account.

Any thoughts on this?

Also here is a portion of mail.err
Code: [Select]
Dec  7 11:06:34 webserver postfix/sendmail[9125]: fatal: file /etc/postfix/main.cf: parameter mydomain: b                                                          ad parameter value: 10.10.10.1
Dec  7 11:07:48 webserver postfix/sendmail[11220]: fatal: file /etc/postfix/main.cf: parameter mydomain:                                                           bad parameter value: 10.10.10.1
Dec  7 11:10:32 webserver postmulti[17473]: fatal: file /etc/postfix/main.cf: parameter mydomain: bad par                                                          ameter value: 10.10.10.1
Dec  7 11:11:17 webserver postmulti[19556]: fatal: file /etc/postfix/main.cf: parameter mydomain: bad par                                                          ameter value: 10.10.10.1
Dec  7 12:18:05 webserver postfix/sendmail[19867]: fatal: file /etc/postfix/main.cf: parameter mydomain:                                                           bad parameter value: 10.10.10.1
Dec  7 18:59:09 webserver postfix/sendmail[22180]: fatal: file /etc/postfix/main.cf: parameter mydomain:                                                           bad parameter value: 10.10.10.1
Dec  7 18:59:49 webserver postfix/sendmail[22693]: fatal: file /etc/postfix/main.cf: parameter mydomain:                                                           bad parameter value: 10.10.10.1
Dec  7 19:00:01 webserver postfix/sendmail[22894]: fatal: file /etc/postfix/main.cf: parameter mydomain:                                                           bad parameter value: 10.10.10.1
Dec  7 19:24:01 webserver postfix/proxymap[25945]: error: unsupported dictionary type: mysql
Dec  7 19:24:01 webserver postfix/proxymap[25945]: error: unsupported dictionary type: mysql
Dec  7 19:24:01 webserver postfix/proxymap[25945]: error: unsupported dictionary type: mysql
Dec  7 19:24:01 webserver postfix/proxymap[25945]: error: unsupported dictionary type: mysql
Dec  7 19:46:37 webserver postfix/proxymap[25945]: error: unsupported dictionary type: mysql
Dec  7 19:46:37 webserver postfix/smtpd[27311]: error: open database /var/lib/pop-before-smtp/hosts.db: N                                                          o such file or directory
Dec  7 19:46:37 webserver postfix/smtpd[27313]: error: open database /var/lib/pop-before-smtp/hosts.db: N                                                          o such file or directory

Here is what is in main.cf
Code: [Select]
root@webserver:/var/log# cat /etc/postfix/main.cf
# See /usr/share/postfix/main.cf.dist for a commented, more complete version


# Debian specific:  Specifying a file name will cause the first
# line of that file to be used as the name.  The Debian default
# is /etc/mailname.
#myorigin = /etc/mailname

smtpd_banner = $myhostname ESMTP $mail_name powered by Easy Hosting Control Panel (ehcp) on Ubuntu, www.ehcp.net
biff = no

# appending .domain is the MUA's job.
append_dot_mydomain = no

# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h

readme_directory = no

# See http://www.postfix.org/COMPATIBILITY_README.html -- default to 2 on
# fresh installs.
compatibility_level = 2

# TLS parameters
smtpd_tls_cert_file = /etc/postfix/smtpd.cert
smtpd_tls_key_file = /etc/postfix/smtpd.key
smtpd_use_tls = yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache

# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.

smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
myhostname = webserver
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
mydestination = localhost, 157.185.79.38
relayhost =
mynetworks = 127.0.0.0/8, 192.168.0.0/16, 172.16.0.0/16, 10.0.0.0/8,  157.185.79.0/24
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
inet_protocols = ipv4
virtual_alias_domains =
virtual_alias_maps = proxy:mysql:/etc/postfix/mysql-virtual_forwardings.cf, proxy:mysql:/etc/postfix/mysql-virtual_email2email.cf
transport_maps = proxy:mysql:/etc/postfix/mysql-virtual_transports.cf
virtual_mailbox_domains = proxy:mysql:/etc/postfix/mysql-virtual_domains.cf
virtual_mailbox_maps = proxy:mysql:/etc/postfix/mysql-virtual_mailboxes.cf
virtual_mailbox_base = /home/vmail
virtual_uid_maps = static:5000
virtual_gid_maps = static:5000
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
broken_sasl_auth_clients = yes
smtpd_recipient_restrictions = permit_mynetworks,permit_sasl_authenticated,check_client_access hash:/var/lib/pop-before-smtp/hosts,reject_unauth_destination
smtp_use_tls = yes
smtpd_tls_auth_only = no
smtpd_tls_CAfile = /etc/postfix/cacert.pem
smtpd_tls_loglevel = 1
smtpd_tls_received_header = yes
smtpd_tls_session_cache_timeout = 3600s
tls_random_source = dev:/dev/urandom
virtual_create_maildirsize = yes
virtual_mailbox_extended = yes
virtual_maildir_extended = yes
virtual_mailbox_limit_maps = proxy:mysql:/etc/postfix/mysql-virtual_mailbox_limit_maps.cf
virtual_mailbox_limit_override = yes
virtual_maildir_limit_message = "The user you are trying to reach is over quota."
virtual_overquota_bounce = yes
debug_peer_list =
sender_canonical_maps =
debug_peer_level = 1
proxy_read_maps = $local_recipient_maps $mydestination $virtual_alias_maps $virtual_alias_domains $virtual_mailbox_maps $virtual_mailbox_domains $relay_recipient_maps $canonical_maps $sender_canonical_maps $recipient_canonical_maps $relocated_maps $mynetworks $virtual_mailbox_limit_maps $transport_maps
content_filter = smtp-amavis:[127.0.0.1]:10024
root@webserver:/var/log#

The servers internal ip is 10.10.10.4 the external ip of the server is 157.185.79.38 but we have a pf sense router in between this. We use the pf sense for our local dns server its 10.10.10.1 on this network.


Update Sun Dec  8 19:48:38 UTC 2019

If you choose to setup manually instead of the unattended installation option. Everything works fine.. I didn't know this till after several hundred re-installations.  So make sure you choose N for no when it asks for that question also for you FDQN make sure you put the fully qualified domain not example lorentedford.com a proper fully qualified domain would be example: ehcp.lorentedford.com



10
My /etc/apt/sources.list contains the following for Ubuntu 18.04:

Code: [Select]
deb http://archive.ubuntu.com/ubuntu bionic main restricted
deb http://archive.ubuntu.com/ubuntu bionic-updates main restricted
deb http://archive.ubuntu.com/ubuntu bionic universe
deb http://archive.ubuntu.com/ubuntu bionic-updates universe
deb http://archive.ubuntu.com/ubuntu bionic multiverse
deb http://archive.ubuntu.com/ubuntu bionic-updates multiverse
deb http://archive.ubuntu.com/ubuntu bionic-backports main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu bionic-security main restricted
deb http://archive.ubuntu.com/ubuntu bionic-security universe
deb http://archive.ubuntu.com/ubuntu bionic-security multiverse

 Ok I am having issues installing on ubuntu 18.04 lts and i think this might have been my reason some of these weren't listed in my sources.list.. I am  formatting and reinstalling with this being done..

11
Technical Help / Re: DKIM & SPF statement in DNS
« on: November 28, 2019, 01:27:10 pm »
This here is an example of what i have but don't take my word for it might research around a bit.. Again so sorry about the delay in response I am have been so slammed with other projects that have been broken this month including a gaming server that was down for about a week with over 300 messages concerning it and one of my admins that I thought i trusted enough to manage the game server..

Its just been one of those months...

Best Wishes I will try and check back regularly on this through out the day..

12
Technical Help / Re: DKIM & SPF statement in DNS
« on: November 28, 2019, 01:19:33 pm »
Sorry I just got this.. This month has been awfully busy for me plus i too am rearranging my servers did you ever figure this out?

13
General / Re: Moving to GitHub!
« on: November 09, 2019, 11:20:39 am »
Yes thank you Github is much better in my opinion

14
To be honest Debian 9 and 10 has been a trash fire lately.. Most of the projects I work with have been having issues with Debian 9.. I am not sure why though I use to use Debian over Ubuntu regularly..

Pages: [1] 2 3 4