This all started because I printout my PayPal receipts and because of their formatting can take several sheets of paper. Often the last sheet would just have 1 word on it.
I started by manually just printing the first 2 pages, but this is time consuming so I wrote a macro just to print the first 2 pages of the PayPal receipt to the default printer so I could achieve the same thing but with 1 button click which is what I will show you how to do below.
Then I moved on and configured my printer to print 2 pages on every sheet. So instead of an average of 3 A4 pages every receipt I now just use 1. This has the added advantage that some times a receipt is 1 page and sometimes it is 2 pages so no more paper that what is absolutely needed is used.
I then also created a memo style in Outlook with the margins reduced. (Optional)
This is best solution for printing PayPal Receipts.
See Print 2 full pages on single sheet of paper with HP a printer | QuantumWarp
To get this to work there are several parts, building the macro (which is done for you), installing the macro and then creating a button in Quick Access Toolbar to run it.
' Outlook 2016/2019 PayPal Receipt Printing - Only print pages 1 and 2 Sub PayPal_Receipt_Printing() SendKeys "%" SendKeys "FPR" SendKeys "%{S}" SendKeys "1-2" SendKeys "{ENTER}" DoEvents SendKeys "{NUMLOCK}{NUMLOCK}" End Sub
The code below worked for a while but recently stopped working after a Windows update but I am leaving it here for reference because there might old versions of office this is needed for and I can see what I changed to get it to work.
' Outlook 2016/2019 PayPal Receipt Printing - Only print pages 1 and 2 Sub PayPal_Receipt_Printing() SendKeys "%FPR" SendKeys "%S" SendKeys "1-2" SendKeys "{ENTER}" DoEvents SendKeys "{NUMLOCK}{NUMLOCK}" End Sub
How I fixed this
Code explained
Remembering that this script will use your default printer, do a test print and then you are done.
The rest of this article is for reference.
The NumLock would always turn off after running the script no matter what. These are my notes on resolving this issue.
When you use SendKeys the NumLock is turned off due to a bug in Visual Basic.
I found these towards the end of my research and they pretty much the best way of fixing this issue.
Executing two or more SendKeys statements in a row results in turning off the NumLock key. This problem may also affect the CapsLock and ScrollLock keys.
If you look in the script above you can see the following code taken from SendKeys is messing with my NumLock key via VBA code in Access form - Stack Overflow
DoEvents SendKeys "{NUMLOCK}{NUMLOCK}"
This solution seems to work really well and perhaps can be expanded for Caps Lock and Scroll Lock if needed.
I spent quite a bit of time trying this but could not get it to work so I am including my notes and research here for future reference.
The code below I managed to get to sense when a key was pressed down and shows how to use the High/Low bit thing by using Hex codes
' Get Numlock status Private Const VK_NUMLOCK = &H90 Private Const VK_SCROLL = &H91 Private Const VK_CAPITAL = &H14 Private Declare PtrSafe Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Long Private Function KeyDown(ByVal vKey As Long) As Boolean KeyDown = GetAsyncKeyState(vKey) And &H8001 End Function Sub Test_Key_down() If KeyDown(vbKeyNumlock) Then MsgBox "The NumLock key is pressed down!" End Sub
Notes
I never tried this option as it looked very complicated and I do not want to learn VB.
These instructions are for CWPpro but will work for the most part with the free version of Control Web Panel. For the yearly cost of the Pro version it is worth paying the $12 and trying the full software out from the start. This will also support the project.
For reference I used:
Following these instructions will take around 5 Hours to complete and this assumes you have built your Windows 10 Pro PC.
I do not cover every aspect because I am not a professional but this should be a good baseline. But what it does cover is:
Just follow the guide through from beginning to end and everything will work. I built the guide as I figured things out.
It is easier to get these things together before you start.
You can use your own Virtual Machine server if you have one. My preference is VirtualBox because it is free but VMWare should do just fine.
Not everyone will use a RAID, but should. A few simple checks to make sure everything is correct is a good idea.
The information below is for standard RAIDs found on Desktop PCs and not ones on ZFS or anything funky like that.
These are my settings for VirtualBox but you might want to modify them slightly which will be fine.
If a setting is not mentioned or is crossed out below, leave it as default.
Using the Guided or expert mode will give the same outcome.
There is currently a bug with rebooting a VM when running in EFI mode with more than 1 CPU. See notes below.
CWP/CentOS works with each type of VirtualBox Start Up. You should look into which one suits you best.
I use Normal until everything is setup and then use Headless when it goes into production.
We now need to finish configuring the VM so it performs better with CentOS Linux.
Notes
VBoxManage startvm "{VMName}" --type headless VBoxManage startvm Debian --type headless VBoxHeadless --startvm "{VMName}" VBoxHeadless --startvm Debian
00:09:27.886256 Changing the VM state from 'RUNNING' to 'GURU_MEDITATION' 00:09:27.886303 Console: Machine state changed to 'GuruMeditation' 00:09:27.886560 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 00:09:27.886561 !! 00:09:27.886562 !! VCPU1: Guru Meditation 1155 (VINF_EM_TRIPLE_FAULT) 00:09:27.886645 !! 00:09:27.886652 !! Skipping ring-0 registers and stack, rcErr=VINF_EM_TRIPLE_FAULT 00:09:27.886660 !! 00:09:27.886660 !! {mappings, <NULL>} 00:09:27.886661 !! 00:09:27.886670 !! 00:09:27.886670 !! {hma, <NULL>} 00:09:27.886671 !! 00:09:27.886673 Hypervisor Memory Area (HMA) Layout: Base 00000000a0000000, 0x02800000 bytes 00:09:27.886678 00000000a1129000-00000000a113a000 000000000db10000 ffffdf829833e000 LOCKED alloc once (PGM_PHYS) 00:09:27.886684 00000000a111b000-00000000a1129000 000000000b690000 ffffdf829b47d000 LOCKED alloc once (VMM) 00:09:27.886690 00000000a110d000-00000000a111b000 000000000b680000 ffffdf829b46f000 LOCKED alloc once (VMM) 00:09:27.886696 00000000a030c000-00000000a110d000 0000000009d60000 ffffb4753b800000 LOCKED alloc once (PGM_PHYS) 00:09:27.886700 00000000a0279000-00000000a030c000 0000000009ac0000 ffffdf8295010000 LOCKED alloc once (PGM_POOL) 00:09:27.886706 00000000a0278000-00000000a0279000 0000000009ab0000 ffffdf8290f60000 LOCKED alloc once (CPUM_CTX) 00:09:27.886710 00000000a0038000-00000000a0278000 0000000009870000 ffffb4753b200000 LOCKED Heap 00:09:27.886715 00000000a0023000-00000000a0038000 00000000095a0000 ffffdf8290f4a000 LOCKED VMCPU 00:09:27.886720 00000000a000e000-00000000a0023000 0000000009580000 ffffdf8290f34000 LOCKED VMCPU 00:09:27.886724 00000000a0000000-00000000a000e000 0000000009570000 ffffdf8290f24000 LOCKED VM 00:09:27.886729 !! 00:09:27.886729 !! {cpumguest, verbose} 00:09:27.886731 !!
vboxmanage startvm <vm-uuid> --type emergencystop
I will install CentOS using EFI but pay attention to the reset bug
CentOS 7 (Minimal) is the recommended version of the OS to use when installing CWP. It should be also noted there is no uninstaller but you should never need one.
nmtui or nmtui edit enp0s3 (might work)
hostname server.mydomain.com
yum -y install wget
yum -y update
reboot
Notes
Now your VM has CentOS insatlled we can proceed and install CWP.
CWP installer can run more than 30 minutes because it needs to compile Apache and php from source but might be a lot quicker on modern PCs.
cd /usr/local/src wget http://centos-webpanel.com/cwp-el7-latest sh cwp-el7-latest -restart yes --phpfpm 7.4The --phpfpm 7.4 switch did not work for me.
############################# # CWP Installed # ############################# Go to CentOS WebPanel Admin GUI at http://SERVER_IP:2030/ http://13.13.13.13:2030 SSL: https://13.13.13.13:2031 --------------------- Username: root Password: ssh server root password MySQL root Password: xxxxxxxxxxxx ######################################################### CentOS Web Panel MailServer Installer ######################################################### SSL Cert name (hostname): server.mydomain.com SSL Cert file location /etc/pki/tls/ private|certs ######################################################### Visit for help: www.centos-webpanel.com Write down login details and press ENTER for server reboot! Please reboot the server! Reboot command: shutdown -r now
shutdown -r now
Notes
[ 1.926356] [drm:vmw_host_log [vmwgfx]] *ERROR* Failed to send host log messa [ 1.926494] [drm:vmw_host_log [vmwgfx]] *ERROR* Failed to send host log messa
package-cleanup --oldkernels --count=1
installonly_limit=2
Although you don't have to create an account for the Primary Domain on the server for it to work, it makes sense too unless you have a reason otherwise.
Now that CWP is installed we need to configure it
Ypu will now see some errors as shown in the picture below (or similiar)
Your Hostname is: server.mydomain.com and it resolves to IP: (ERROR: You don't have a valid hostname set!)
Notes
TYPE=Ethernet PROXY_METHOD=none BROWSER_ONLY=no BOOTPROTO=dhcp DEFROUTE=yes IPV4_FAILURE_FATAL=no IPV6INIT=no IPV6_AUTOCONF="yes" IPV6_DEFROUTE="yes" IPV6_FAILURE_FATAL="no" IPV6_ADDR_GEN_MODE="stable-privacy" NAME=enp0s3 UUID=adfa1901-1eee-4cee-b2c4-62a2bf6323f4 DEVICE=enp0s3 ONBOOT=yes IPADDR=192.168.1.11 PREFIX=24 GATEWAY=192.168.1.1 DNS1=192.168.1.1
In this section we will complete the setup of CWP now we have got rid of the errors.
Notes
For this you need a real domain (mydomain.com) and your public static Ip (13.13.13.13) from earlier.
Notes
ns1.mydomain.com resolves to ; <<>> DiG 9.11.4-P2-RedHat-9.11.4-26.P2.el7_9.5 <<>> A ns1.mydomain +short @8.8.8.8 ;; global options: +cmd ;; connection timed out; no servers could be reached ns2.mydomain.com resolves to
This is cause by one or both of these:
ns1.centos-webpanel.com resolves to 54.36.136.192 ns2.centos-webpanel.com resolves to 198.27.104.41 ns1.centos-webpanel.com 127.0.0.1 ns2.centos-webpanel.com 127.0.0.1
Now that the name servers have been changed, the Primary user account needs to be updated to reflect the change
Notes
server 14400 IN A 31.125.252.137 ns1.mydomain.com. 14400 IN A 31.125.252.137 ns2.mydomain.com. 14400 IN A 31.125.252.137
These must be changed at your ISP or IP provider. These records allow your server domain to be worked out from the IP address.
A good rDNS is better for your server reputation and will allow more successful delvery of email.
Plusnet/BT/UK ISPs: By default thier IPs from ISP are on the Spamhaus 'Policy Block List' because it should not be sending emails. So you might need to contact your ISP to have the Ip removed from the list. I did manage to remove myself from the SPAMHaus PBL list byt looking up my IP and then expanding the message at the bottom, fill in the required information and soon after I was removed for the list. This might not be the case for all ISPs.
CentOS Mostly Used Ports - Control WebPanel Wiki
Notes
Forbidden Rejected request from RFC1918 IP to public server address
The CWP server is now present on the internet.
Cgroups allow you to limit resources per user — such as CPU %, system memory, network bandwidth, or combinations of these resources. You have to create a Cgroup and then assign it in the package. This is good for preventing server abuse byt the user or a hacker. You have to create a Cgroup before it can be assigned to a package or user so we will do this before creating our packages.
Notes
Setup the following packages. These are not mandatory but are a good baseline for you to start from and make managing your server easier. If you are migrating from cPanel I think the packages might be created automatically.
Packages are found at: Packages --> Packages
You now have seperate packages for your company and client accounts.
Notes
The feature manager allows you to filter / block modules for use in the user module.
Feature Manager | Control-WebPanel Documentation
User Accounts --> Features,Themes,Languages --> Feature Manager
I think the accounts have all features available until you assign a feature set.
You can assign these features to an account or package. I will always choose to do these things by packages because it is the way I have done it in cPanel.
When you select these options you might not currently have all of the servers or things installed. Select your options as if they were so they match up when you later add the required features.
You now have seperate feature sets for your company and client accounts.
Notes
This is a very useful thing to have. It is just a simple account you can use to see what clients see.
Notes
/usr/local/cwp/php71
Job for httpd.service failed because the control process exited with error code. See "systemctl status httpd.service" and "journalctl -xe" for details.
Jun 27 11:05:04 server apachectl: SSLProtocol: Illegal protocol 'TLSv1.3'
So Apache failing to load is most likely becasue I added TLS1.3 and HTTP2 with the Mystery Data scripts and in particular the TLS1.3 protocol is not compatible with Apache. This might of only just been added or it is some other incompatiblilty.
To fix the reamin Apache issue I reran How to Enable TLS 1.3 in Apache on CWP- Control Web Panel Centos 7 Centos 8 EL7 El8 | Mystery Data
Links
This is mostly setup but for a couple of settings in the FTP manager
Notes pure-ftpd Setup Passive FTP Ports - Control WebPanel Wiki
Configuring the PHP service is good for security and performance.
disable_functions = "" --> "system,passthru,popen,exec,proc_close,proc_get_status,proc_nice,proc_open,proc_terminate,highlight_file,escapeshellcmd,define_syslog_variables,posix_uname,posix_getpwuid,apache_child_terminate,posix_kill,posix_mkfifo,posix_setpgid,posix_setsid,posix_setuid,escapeshellarg,posix_uname,ftp_exec,ftp_connect,ftp_login,ftp_get,ftp_put,ftp_nb_fput,ftp_raw,ftp_rawlist,ini_alter,ini_restore,inject_code,syslog,openlog,define_syslog_variables,apache_setenv,mysql_pconnect,eval,phpAds_XmlRpc,phpAds_remoteInfo,phpAds_xmlrpcEncode,phpAds_xmlrpcDecode,xmlrpc_entity_decode,fp,fput,shell_exec,apache_get_modulesi" expose_php = On --> Off max_execution_time = 30 --> 180 max_input_time = 60 --> 180 max_input_vars = 4000 memory_limit = 128M --> 256M post_max_size = 8M --> 64M upload_max_filesize = 2M --> 64M date.timezone = "Europe/London"
zlib.output_compression = Off error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT --> E_ALL & ~E_NOTICE ; http://php.net/track-errors ;track_errors = Off ; http://php.net/html-errors ;html_errors = On ; http://php.net/register-argc-argv register_argc_argv = Off ; http://php.net/allow-url-fopen (I have this on all the time, but should it be off by default) allow_url_fopen = On
Notes
max_execution_time = 120 max_input_time = 60 max_input_vars = 1000 memory_limit = 128M post_max_size = 64M upload_max_filesize = 64M
# # This group is read both by the client and the server # use it for options that affect everything # [client-server] # # include *.cnf from the config directory # !includedir /etc/my.cnf.d
[client] default-character-set = utf8mb4 [mysql] default-character-set = utf8mb4 [mysqld] collation-server = utf8mb4_unicode_ci init-connect = 'SET NAMES utf8mb4' character-set-server = utf8mb4
Notes
Default configuration and explanation of the settings mysqld --no-defaults --verbose --help or, on a running 10.1+ server, by executing SELECT variable_name, default_value FROM information_schema.system_variables ORDER BY variable_name
mysqld --verbose --help mysqladmin variables
Postfix and Dovecot are both required for a full email system and should already be running and this is why you are already (if configured) getting server notification emails.
/usr/local/cwpsrv/htdocs/resources/conf/dns/bind/zones/
@ 14400 IN TXT "v=spf1 +a +mx +ip4:%ip% ~all" --> @ 14400 IN TXT "v=spf1 +a +mx +ip4:%ip% -all"
/usr/local/cwpsrv/htdocs/resources/conf/dns/bind/zones/custom.tpl
Notes
; Add X-PHP-Originating-Script: that will include uid of the script followed by the filename mail.add_x_header = On
This has to be done here so all of your new accounts dont get this vestigial subdomain.
It is my opinion this is not really used by anything anymore and that is why this is optional.
/usr/local/cwpsrv/htdocs/resources/conf/dns/bind/zones/custom.tpl
cwp 14400 IN A %ip%
If you are running a network firewall such as pfSense, then do the Country Blocking in that device, so all network devices can benefit from that single ruleset but keep the lookup service enabled here to allow for IP to country lookups
Notes
Notes
/usr/local/apache/conf.d/ssl.conf
The more resources you install the more resources you use. I dont know if you need to install each one of these.
Apache Error Log (sitea) [Thu Dec 23 19:47:52.977523 2021] [proxy_fcgi:error] [pid 4659:tid 139985935795968] [client 192.168.1.1:58256] AH01071: Got error 'PHP message: PHP Fatal error: [snuffleupagus][0.0.0.0][disabled_function][drop] Aborted execution on call of the function 'ini_set', because its argument '$varname' content (display_errors) matched a rule in /home/mydomain/public_html/sitea/wp-includes/load.php on line 465' [Thu Dec 23 19:47:53.157871 2021] [proxy_fcgi:error] [pid 4659:tid 139985935795968] [client 192.168.1.1:58256] AH01071: Got error 'PHP message: PHP Fatal error: [snuffleupagus][0.0.0.0][disabled_function][drop] Aborted execution on call of the function 'ini_set', because its argument '$varname' content (display_errors) matched a rule in /home/mydomain/public_html/sitea/wp-includes/load.php on line 465', referer: https://sitea.mydomain.com/ [Thu Dec 23 19:47:54.155940 2021] [proxy_fcgi:error] [pid 4659:tid 139985935795968] [client 192.168.1.1:58256] AH01071: Got error 'PHP message: PHP Fatal error: [snuffleupagus][0.0.0.0][disabled_function][drop] Aborted execution on call of the function 'ini_set', because its argument '$varname' content (display_errors) matched a rule in /home/mydomain/public_html/sitea/wp-includes/load.php on line 465' Apache Error Log (siteb) [Thu Dec 23 19:26:46.802401 2021] [proxy_fcgi:error] [pid 1642:tid 140310124496640] [client 192.168.1.1:49326] AH01071: Got error 'PHP message: PHP Warning: [snuffleupagus][0.0.0.0][config][log] It seems that you are filtering on a parameter 'var_array' of the function 'extract', but the parameter does not exists. in /home/mydomain/public_html/siteb/wp-includes/template.php on line 762PHP message: PHP Warning: [snuffleupagus][0.0.0.0][config][log] - 0 parameter's name: 'arg' in /home/mydomain/public_html/siteb/wp-includes/template.php on line 762PHP message: PHP Warning: [snuffleupagus][0.0.0.0][config][log] - 1 parameter's name: 'extract_type' in /home/mydomain/public_html/siteb/wp-includes/template.php on line 762PHP message: PHP Warning: [snuffleupagus][0.0.0.0][config][log] - 2 parameter's name: 'prefix' in /home/mydomain/public_html/siteb/wp-includes/template.php on line 762PHP message: PHP Warning: [snuffleupagus][0.0.0.0][config][log] It seems that you are filtering on a parameter 'var_array' of the function 'extract', but the parameter does not exists. in /home/mydomain/public_html/siteb/wp-includes/template.php on line 762PHP message: PHP Warning: [snuffleupagus][0.0.0.0][config][log] - 0 parameter's name: 'arg' in /home/mydomain/public_html/siteb/wp-includes/template.php on line 762PHP message: PHP Warning: [snuffleupagus][0.0.0.0][config][log] - 1 parameter's name: 'extract_type' in /home/mydomain/public_html/siteb/wp-includes/template.php on line 762PHP message: PHP Warning: [snuffleupagus][0.0.0.0][config][log] - 2 parameter's name: 'prefix' in /home/mydomain/public_html/siteb/wp-includes/template.php on line 762PHP message: PHP Warning: [snuffleupagus][0.0.0.0][config][log] It seems that you are filtering on a parameter 'var_array' of the function 'extract', but the parameter does not exists. in /home/mydomain/public_html/siteb/wp-includes/template.php on line 762PHP message: PHP Warning: [snuffleupagus][0.0.0.0][config][log] - 0 parameter's name: 'arg' in /home/mydomain/public_html/siteb/wp-includes/template.php on line 762PHP message: PHP Warning: [snuffleupagus][0.0.0.0][config][log] - 1 parameter's name: 'extract_type' in /home/mydomain/public_html/siteb/wp-includes/template.php on line 762PHP message: PHP Warning: [snuffleupagus][0.0.0.0][config][log] - 2 parameter's name: 'prefix' in /home/mydomain/public_html/siteb/wp-includes/template.php on line 762' [Thu Dec 23 19:26:53.844567 2021] [proxy_fcgi:error] [pid 1696:tid 140310174852864] [client 192.168.1.1:49334] AH01071: Got error 'PHP message: PHP Warning: [snuffleupagus][0.0.0.0][config][log] It seems that you are filtering on a parameter 'var_array' of the function 'extract', but the parameter does not exists. in /home/mydomain/public_html/siteb/wp-includes/template.php on line 762PHP message: PHP Warning: [snuffleupagus][0.0.0.0][config][log] - 0 parameter's name: 'arg' in /home/mydomain/public_html/siteb/wp-includes/template.php on line 762PHP message: PHP Warning: [snuffleupagus][0.0.0.0][config][log] - 1 parameter's name: 'extract_type' in /home/mydomain/public_html/siteb/wp-includes/template.php on line 762PHP message: PHP Warning: [snuffleupagus][0.0.0.0][config][log] - 2 parameter's name: 'prefix' in /home/mydomain/public_html/siteb/wp-includes/template.php on line 762PHP message: PHP Warning: [snuffleupagus][0.0.0.0][config][log] It seems that you are filtering on a parameter 'var_array' of the function 'extract', but the parameter does not exists. in /home/mydomain/public_html/siteb/wp-includes/template.php on line 762PHP message: PHP Warning: [snuffleupagus][0.0.0.0][config][log] - 0 parameter's name: 'arg' in /home/mydomain/public_html/siteb/wp-includes/template.php on line 762PHP message: PHP Warning: [snuffleupagus][0.0.0.0][config][log] - 1 parameter's name: 'extract_type' in /home/mydomain/public_html/siteb/wp-includes/template.php on line 762PHP message: PHP Warning: [snuffleupagus][0.0.0.0][config][log] - 2 parameter's name: 'prefix' in /home/mydomain/public_html/siteb/wp-includes/template.php on line 762PHP message: PHP Warning: [snuffleupagus][0.0.0.0][config][log] It seems that you are filtering on a parameter 'var_array' of the function 'extract', but the parameter does not exists. in /home/mydomain/public_html/siteb/wp-includes/template.php on line 762PHP message: PHP Warning: [snuffleupagus][0.0.0.0][config][log] - 0 parameter's name: 'arg' in /home/mydomain/public_html/siteb/wp-includes/template.php on line 762PHP message: PHP Warning: [snuffleupagus][0.0.0.0][config][log] - 1 parameter's name: 'extract_type' in /home/mydomain/public_html/siteb/wp-includes/template.php on line 762PHP message: PHP Warning: [snuffleupagus][0.0.0.0][config][log] - 2 parameter's name: 'prefix' in /home/mydomain/public_html/siteb/wp-includes/template.php on line 762' [Thu Dec 23 19:27:27.416398 2021] [proxy_fcgi:error] [pid 1696:tid 140310174852864] [client 192.168.1.1:49349] AH01071: Got error 'PHP message: PHP Warning: [snuffleupagus][0.0.0.0][config][log] It seems that you are filtering on a parameter 'var_array' of the function 'extract', but the parameter does not exists. in /home/mydomain/public_html/siteb/wp-includes/template.php on line 762PHP message: PHP Warning: [snuffleupagus][0.0.0.0][config][log] - 0 parameter's name: 'arg' in /home/mydomain/public_html/siteb/wp-includes/template.php on line 762PHP message: PHP Warning: [snuffleupagus][0.0.0.0][config][log] - 1 parameter's name: 'extract_type' in /home/mydomain/public_html/siteb/wp-includes/template.php on line 762PHP message: PHP Warning: [snuffleupagus][0.0.0.0][config][log] - 2 parameter's name: 'prefix' in /home/mydomain/public_html/siteb/wp-includes/template.php on line 762PHP message: PHP Warning: [snuffleupagus][0.0.0.0][config][log] It seems that you are filtering on a parameter 'var_array' of the function 'extract', but the parameter does not exists. in /home/mydomain/public_html/siteb/wp-includes/template.php on line 762PHP message: PHP Warning: [snuffleupagus][0.0.0.0][config][log] - 0 parameter's name: 'arg' in /home/mydomain/public_html/siteb/wp-includes/template.php on line 762PHP message: PHP Warning: [snuffleupagus][0.0.0.0][config][log] - 1 parameter's name: 'extract_type' in /home/mydomain/public_html/siteb/wp-includes/template.php on line 762PHP message: PHP Warning: [snuffleupagus][0.0.0.0][config][log] - 2 parameter's name: 'prefix' in /home/mydomain/public_html/siteb/wp-includes/template.php on line 762PHP message: PHP Warning: [snuffleupagus][0.0.0.0][config][log] It seems that you are filtering on a parameter 'var_array' of the function 'extract', but the parameter does not exists. in /home/mydomain/public_html/siteb/wp-includes/template.php on line 762PHP message: PHP Warning: [snuffleupagus][0.0.0.0][config][log] - 0 parameter's name: 'arg' in /home/mydomain/public_html/siteb/wp-includes/template.php on line 762PHP message: PHP Warning: [snuffleupagus][0.0.0.0][config][log] - 1 parameter's name: 'extract_type' in /home/mydomain/public_html/siteb/wp-includes/template.php on line 762PHP message: PHP Warning: [snuffleupagus][0.0.0.0][config][log] - 2 parameter's name: 'prefix' in /home/mydomain/public_html/siteb/wp-includes/template.php on line 762' [Thu Dec 23 19:27:58.554425 2021] [proxy_fcgi:error] [pid 1696:tid 140310174852864] [client 192.168.1.1:49350] AH01071: Got error 'PHP message: PHP Warning: [snuffleupagus][0.0.0.0][config][log] It seems that you are filtering on a parameter 'var_array' of the function 'extract', but the parameter does not exists. in /home/mydomain/public_html/siteb/wp-includes/template.php on line 762PHP message: PHP Warning: [snuffleupagus][0.0.0.0][config][log]
MAILTO=root@localhost to MAILTO=root
---------------------- Start Rootkit Hunter Scan ---------------------- Warning: Checking for prerequisites [ Warning ] The file of stored file properties (rkhunter.dat) does not exist, and should be created. To do this type in 'rkhunter --propupd'. Warning: WARNING! It is the users responsibility to ensure that when the '--propupd' option is used, all the files on their system are known to be genuine, and installed from a reliable source. The rkhunter '--check' option will compare the current file properties against previously stored values, and report if any values differ. However, rkhunter cannot determine what has caused the change, that is for the user to do. Warning: The command '/usr/sbin/ifdown' has been replaced by a script: /usr/sbin/ifdown: Bourne-Again shell script, ASCII text executable Warning: The command '/usr/sbin/ifup' has been replaced by a script: /usr/sbin/ifup: Bourne-Again shell script, ASCII text executable Warning: The command '/usr/bin/egrep' has been replaced by a script: /usr/bin/egrep: POSIX shell script, ASCII text executable Warning: The command '/usr/bin/fgrep' has been replaced by a script: /usr/bin/fgrep: POSIX shell script, ASCII text executable ----------------------- End Rootkit Hunter Scan -----------------------
[root@cwpserver /]# rkhunter --propupd [ Rootkit Hunter version 1.4.6 ] File created: searched for 176 files, found 131 [root@cwpserver /]#
System checks summary ===================== File properties checks... Files checked: 131 Suspect files: 0 Rootkit checks... Rootkits checked : 492 Possible rootkits: 0 Applications checks... All checks skipped The system checks took: 3 minutes and 11 seconds All results have been written to the log file: /var/log/rkhunter/rkhunter.log No warnings were found while checking the system. [root@cwpserver /]#
sshd: 192.168.1.0/24
sshd: ALL
ftpd: 192.168.1.0/24
ftpd: ALL
/usr/local/cwpsrv/conf.d/webmail.conf
# Disabled forced ssl, uncomment if you want to force ssl #if ($host != "localhost"){ # return 301 https://$host:2096$request_uri; #}
sh /scripts/mysql_pwd_reset
grep password /root/.my.cnf
Warning: mysqli_connect(): (HY000/1045): Access denied for user 'root'@'localhost' (using password: YES) in /usr/local/cwpsrv/htdocs/resources/admin/include/functions.php on line 0 Warning: mysqli_connect(): (HY000/1045): Access denied for user 'root'@'localhost' (using password: YES) in /usr/local/cwpsrv/htdocs/admin/admin/index.php on line 0 Trying to start mysql server, please wait! Try to restart CentOS Web Panel with command: sh /scripts/restart_cwpsrv **Check your MySQL root password in: /usr/local/cwpsrv/htdocs/resources/admin/include/db_conn.php and /root/.my.cnf Warning: mysqli_error() expects exactly 1 parameter, 0 given in /usr/local/cwpsrv/htdocs/admin/admin/index.php on line 0 Could not connect:
systemctl stop mysqld systemctl set-environment MYSQLD_OPTS="--skip-grant-tables" systemctl start mysqld mysql -u root
mysql> UPDATE mysql.user SET authentication_string = PASSWORD('MyNewPassword') WHERE User = 'root' AND Host = 'localhost'; mysql> FLUSH PRIVILEGES; mysql> quit
systemctl stop mysqld systemctl unset-environment MYSQLD_OPTS systemctl start mysqld
mysql -u root -p
Notes
[root@server ~]# sh /scripts/mysql_pwd_reset Enter the new root password (at least 8 chars). Or leave it empty if you would like to generate it. Or press CTRL+C to abort and do not touch it Enter MySQL root password:
/usr/local/cwpsrv/htdocs/resources/scripts/mysql_pwd_reset
/scripts/mysql_pwd_reset
/usr/local/cwpsrv/htdocs/resources/admin/include/db_conn.php /root/.my.cnf
grep password /root/.my.cnf
This is a safety measure so if the root account gets comprimised you can still get in with this account.
adduser backupuser
passwd backupuser
Notes
cut -d: -f1 /etc/passwd
cat /etc/passwd | awk -F: '{print $1}'
getent passwd
passwd <username>
set alert root@localhost to set alert youradmin@mydomain.com
<html><body bgcolor="#FFFFFF"></body></html>
<html><body bgcolor="#FFFFFF"></body></html>
<html><body bgcolor="#FFFFFF"></body></html>
We need to configure CWP to send error notifications and unless you know where to click this can be hidden.
You've received a new %level% notification: %subject% Here are the details: %message% %url%
It should be noted that currently CWP does not manage backup retentions (i.e. it does not delete any backups so they will keep growing in number). See the notes below for solution.
Notes
This is Linux's version of scheduled tasks (for us Windows users) and there are 2 pages that currently allow you to configure them throught the GUI. They both work on the same dataset which is confusing and hopefully these pages will get merged.
Check the time they run
I would have my crons run late at night probably after my backups. You check the time fit in with how you run your server and if you ar enot sure just leave themas they are for now.
You dont want you SSL certificates to be getting updated while your backups are running. You server wont die, but why cross the streams :) when you dont have too.
Silence is Golden (optional)
I prefer to make all of the cronjobs quite, they will email me if there is an issue but generally you dont need an email saying they have been run. To fix this you add > /dev/null at the end which sends the output to a null device where it dies.
/usr/local/cwp/php71/bin/php -d max_execution_time=18000 -q /usr/local/cwpsrv/htdocs/resources/admin/include/cron_autossl_all_domains.php to /usr/local/cwp/php71/bin/php -d max_execution_time=18000 -q /usr/local/cwpsrv/htdocs/resources/admin/include/cron_autossl_all_domains.php > /dev/null
Do this for all of the cron jobs yopu want to be quiet. This will not them stop them sending emails if that is what the script does, just the notfication of them running.
Editing Default Cronjobs (in the GUI)
After setting up the server these should be the only cronjobs present. You will find that sometimes after an upgrade or installing a plugin you will get more cronjobs, sometimes duplicates and in which case you should remove the appropriate one.
Notes
CWP does not have a specific mechanisim for backing up the server settings so I will add what I find here and wil post a feature request with CWP.
Please note this section is not complete.
This is an additional step I do and is one of the reasons I like windows.
Notes
Create another VM with the exact same settings except different name, different credentials, different NAT IP and use a Dynamic Disk as you dont need performance. You can then use this for testing and playing with settings that you dont understand (like me) without harming you main server.
sh /scripts/mysql_pwd_reset
passwd <username>
- In testing, Snapshots are your friend and prevent hours of work trying to fix something you broke. On a test server I would always use these to test changes but I am not sure if they are safe on a Production/Live server.
- Dynamic disks will continue to grow over time but can easily have the space recovered by running a VirtualBox command.
- Changing passwords so they dont match the old server is to prevent you from accidentally logging in to the wrong account on the wrong server.
- You might want to turn off all the admin emails off if you are leaving the test VM on for a while
The initial configuration is completeand I wish you well. As I learn more I will update this article. Keep reading to the bottom as you might find answer to common issues.
These instructions have taken me a long time to put together and I am not a Linux professional so pleases bear that in mind when reading this. If you notice any issues or mistakes please let me know and at some point I will tidy it up.
These settings, configurations and notes have not made it into the main tutorial but are worth a read.
When setting up an email account in an app uses these settings (Based/Tested in Outlook 2019)
You should always use a secure port for your SMTP. Each port has different options it will accept
/usr/local/apache/domlogs/DOMAIN.COM.error.log
Notes
I want all of my local devices to be registered on the same local domain (mydomain.com) as my CWP server (server.mydomain.com) so I can ping and connect to devices on my network using FQDN (eg: device.mydomain.com). This can make my network administration a lot easier and I can pretend that my network is a full domain of computers on the internet. This is not the same as Microsoft Active Directory / Windows Domain but will do for me.
My Choice
Because I am running a webserver which controls DNS zones it is best to leave it doing that role. This setup will prevent duplicate entries in the mydomain.com DNS zone and the OpenWRT hosts file.
- Change the Local domain to mydomain.com
- Leave Local server as /lan/ which allows OpenWRT to poll my mydomain.com DNS zone.
- I will add my public facing servers and devices into the mydomain.com DNS zone so they can be access via a FQDN both remotely and locally.
- For devices I need to access via a FQDN locally(private) I will use the Hostnames feature in OpenWRT.
I am running OpenWRT on my router and it currently adds the configured DNS suffix (.lan) on to the end of each registered device's hostname (device.lan). Device hostnames are automatically registered with DHCP in the Active DHCP Leases and can be manually added via Static Leases. Both these lists combine to make single list of FQDN that the router uses for routing traffic.
The instructions below will change the registered hostnames to belong to .mydomain.com giving the format device.mydomain.com when registered instead of device.lan
Notes
OpenWRT has no information or interaction with devices that have static IP addresses because it simple does not know about them.
To remedy this there are 2 ways of doing this:
Hostnames (preferred)
config domain option name 'device' option ip '192.168.1.99'or
config domain option name 'device.mydomain.com' option ip '192.168.1.99'
Static Leases
Static Leases are the ability to use the DHCP system to give the same IP address to the same machine which effectively makes them statics with less configuration at the clients end and more control by the admin, however it does requires some setup work.
Some of you will be saying how does OpenWRT know which device to assign the IP too because I have not set it, well it doesn't. What I have here is just created a host entry that will allow the correct routing but the IP will never be dished out over DHCP. This is more of a hack I discovered. You can use the Static Lease as it was intended by just adding in the following further information (assuming IPv4 only) into the entry.
This option tells OpenWRT that hostnames belonging to this domain (.lan) are never forwarded and are resolved from DHCP or hosts files only. So this means unless your device is on DHCP, has a Static Lease configured or an entry in OpenWRT Hostnames then no traffic will be routed to it because OpenWRT will not do any external DNS requests and when I say external I mean outside of the router itself, it will purley use these 3 sources for lookups.
The purpose of this option is to prevent unnecessary traffic going upstream and reduce the load on your infrastructure.
These instructions will change the Local server from .lan to .mydomain.com
Notes
Do not do this on laptops etc.. if you are going to move above between sites.
As mention above OpenWRT will add DNS suffixes on to the DNS Hostnames to give a FQDN but will not change the computers actual name.
What we are going to do here is a add a Primary Domain Suffix to our Windows PC but this is also not changing the PCs name. Windows has a normal computer name (NetBIOS) that we can add a domain suffix onto it. If you want to change the computer name on your Windows PC it is just as normal (not discussed here)
I cannot think of a reason why I would want to do this on a Windows PC except so SSL/TLS certificates could be issued and then when you use Remote Desktop the computer names match. However for reference I am going to add the instructions here just incase I change my mind.
Change Linux computer name (optional)
Do not do this on laptops etc.. if you are going to move above between sites.
I am not an expert on linux but you when you sent the computers name you can either set device or device.mydomain.com and I assume that it will only send the host name in a DHCP request as Windows does above. So you again have the option to set just a hostname or a full FQDN.
One of the major benefits of this is that I can use the same FQDN to connect to my devices on my local network as I can when I am in the office at work. Great for CCTV and media servers.
Do NOT add non-public devices to DNS zone for security. Only use Static Leases.
You need to do the following for this to work:
Dec 25 11:10:05 cwpserver systemd: Unit httpd.service cannot be reloaded because it is inactive. Dec 25 11:12:20 cwpserver systemd: Unit httpd.service cannot be reloaded because it is inactive. Dec 25 11:13:23 cwpserver systemd: Starting Web server Apache... Dec 25 11:13:23 cwpserver apachectl: (20014)Internal error (specific information not available): AH00058: Error retrieving pid file logs/httpd.pid Dec 25 11:13:23 cwpserver apachectl: AH00059: Remove it before continuing if it is corrupted. Dec 25 11:13:23 cwpserver systemd: httpd.service: control process exited, code=exited status=1 Dec 25 11:13:23 cwpserver systemd: Failed to start Web server Apache. Dec 25 11:13:23 cwpserver systemd: Unit httpd.service entered failed state. Dec 25 11:13:23 cwpserver systemd: httpd.service failed.
Links
Questions
Feature Requests - CWP Suggestions (Forum)
IP:2030/admin/index.php?module=disk_details
Bugs - CWP Bug Tracking / CentOS-WebPanel Bugs (Forum, old?)
; Generated by CWP ; Zone file for test.acc $TTL 14400 @ 86400 IN SOA ns1.mydomain.com. postmaster.test.acc. ( 2021070154 ; serial, todays date+todays 3600 ; refresh, seconds 7200 ; retry, seconds 1209600 ; expire, seconds 86400 ) ; minimum, seconds @ 86400 IN NS ns1.mydomain.com. @ 86400 IN NS ns2.mydomain.com. @ IN A 13.13.13.13 localhost.test.acc. IN A 127.0.0.1 @ IN MX 0 test.acc. mail 14400 IN CNAME test.acc. smtp 14400 IN CNAME test.acc. pop 14400 IN CNAME test.acc. pop3 14400 IN CNAME test.acc. imap 14400 IN CNAME test.acc. webmail 14400 IN A 13.13.13.13 cpanel 14400 IN A 13.13.13.13 cwp 14400 IN A 13.13.13.13 www 14400 IN CNAME test.acc. ftp 14400 IN CNAME test.acc. _dmarc 14400 IN TXT "v=DMARC1; p=none" @ 14400 IN TXT "v=spf1 +a +mx +ip4:13.13.13.13 -all" default._domainkey 14400 IN TXT "v=DKIM1; k=rsa; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCviXG9SqprOjF3qvN+Xo2KpXp54Fgx6CX42wLxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
; Generated by CWP ; Zone file for test.acc $TTL 14400 test.acc. 86400 IN SOA ns1.mydomain.com. noreply.quantumwarp.com. ( 2013071600 ; serial, todays date+todays 86400 ; refresh, seconds 7200 ; retry, seconds 3600000 ; expire, seconds 86400 ) ; minimum, seconds test.acc. 86400 IN NS ns1.mydomain.com. test.acc. 86400 IN NS ns2.mydomain.com. test.acc. IN A 13.13.13.13 localhost.test.acc. IN A 127.0.0.1 test.acc. IN MX 0 test.acc. mail IN CNAME test.acc. www IN CNAME test.acc. ftp IN CNAME test.acc. ; Add additional settings below this line _dmarc 14400 IN TXT "v=DMARC1; p=none"
During my quest to understand the new Joomla Modern Router present in Joomla 3.8+ and Joomla 4.0 I found some good information and figured out the rest. These are the notes from that battle.
I will be using my reference component QWPeople which is based on com_contact from Joomla 3.9.22, my version has all of the class renamed to the latest standard so is a better place to learn from.
List of different routers available in Joomla (dont worry I will go through these later, it just makes it easier to write this document)
Notes:
option=com_qwpeople task=mytask or view=myview language=en-GB Itemid=101 view=category layout=blog id=9 lang=en
The router entry file is still present as [component]/router.php i.e. com_qwpeople/router.php
So how does this new router work. What is a class based router. Well I am not 100% but hopefully my notes will fill in the blanks that this Joomla doc creates: J3.x:Supporting SEF URLs in your component - Joomla! Documentation. Please read this Joomla Document before reading my article as it will make more sense. One other thing the component name part of the router class name should be in PascalCase and not all lowercase like it says, it does not affect operation but PascalCase follows the Joomla syntax rules.
The basic idea of the new router is to do most of the heavy lifting for the normal developer but allow for expansion when needed unlike the old router where you only had one parse() and build() and everything had to be done within this. The new router has definitely expanded on this. The router is broken down into 2 parts (as far as I am concerned)
The following instructions are utilising the RouterViews class.
Look at the following code:
// Categories route $categories = new RouterViewConfiguration('categories'); $categories->setKey('id'); $this->registerView($categories); // Category route $category = new RouterViewConfiguration('category'); $category->setKey('id')->setParent($categories, 'catid')->setNestable(); $this->registerView($category); // Contact route $contact = new RouterViewConfiguration('contact'); $contact->setKey('id')->setParent($category, 'catid'); $this->registerView($contact); // Featured route $this->registerView(new RouterViewConfiguration('featured'));
What is happening here is that you are building a route (ultimately to your content) by using Joomla component views.
We will deal with featured first because this is the simple one. featured is not a category, is not in a category and therefore is a standalone page so it is very simple to route to this all that needs to be done is have the view set to featured which has already been set by the menu item so really there is no component routing required.
Now if we look at the contact view route because this is at the bottom of the tree, if we wanted the categories or category view they we we would just start earlier up the tree and ignore the rest.
Notes:
The best bit of the new router is the ability to use rules and Joomla comes with some premade ones that perform very common tasks, so again have a look at this code:
// Router rules $this->attachRule(new MenuRules($this)); if ($params->get('sef_advanced', 0)) { // Modern routing $this->attachRule(new StandardRules($this)); $this->attachRule(new NomenuRules($this)); } else { // Legacy routing JLoader::register('QwpeopleRouterRulesLegacy', __DIR__ . '/helpers/legacyrouter.php'); $this->attachRule(new QwpeopleRouterRulesLegacy($this)); }
Joomla Inbuilt Rules
This is a very brief explanation of the Joomla premade rules which should help:
You will find all of these rules at /libraries/src/Component/Router/.
Custom Rules
Using a custom rule to allows the use of a legacy router:
Making your own custom rule
It is as simple as:
class QwpeopleRouterRulesLegacy implements RulesInterface { }
// Legacy routing JLoader::register('QwpeopleRouterRulesLegacy', __DIR__ . '/helpers/legacyrouter.php'); $this->attachRule(new QwpeopleRouterRulesLegacy($this));
Remember you can make as many rules as you want to handle different aspects of your router.
A little trick for custom rules you can use
You can just use return statement in the beginning of a function if you want this code only to work on a particular view or thing. This trick allows you to separate complex routing code into different rules if required.
public function parse(&$segments, &$vars) { // Skip this functions code if not 'categories' view if(!isset($vars['view']) || $vars['view'] !== 'categories') { return; } }
But how do the rules work
Notes
So of the keen people amongst you might of noticed the different class types that extended by the router. I will outline what they do.
This is an easy one, use your router in the RouterView mode (by extending your component router with this class) and use custom rules to add any required extra routing logic.
If you have used all of the modern class names like in QWPeople, this router should also be ready for Joomla 4.x.
I found the need to extract extensions from Joomla and these are my notes that I built up while doing that. You can also extract core extensions aswell with a little more effort with some compromises. The reasons for extraction:
It is far easier to use com_contacts for a reference extension if you are going to use one from the core. com_content is spread across Joomla becasue it is an integral part rather than a seperate component, this maybe better in joomla 4.
[joomla]/administrator/components/com_content/helpers/content.php -->function addSubmenu()
These will work for Joomla core (with some issues) and 3rd party components with no issues.
[zip]/com_content/ [zip]/com_content/admin/ [zip]/com_content/admin/language/ [zip]/com_content/admin/language/en-GB/ [zip]/com_content/media/ [zip]/com_content/site/ [zip]/com_content/site/language/ [zip]/com_content/site/language/en-GB/
# Placeholder file for database changes for version 1.0.0
[zip]/com_content/admin/content.xml
<menu link="option=com_com_content">MOD_MENU_COM_CONTENT</menu> <submenu> <menu link="option=com_content">MOD_MENU_COM_CONTENT_ARTICLE_MANAGER</menu> <menu link="option=com_categories&extension=com_content">MOD_MENU_COM_CONTENT_CATEGORY_MANAGER</menu> <menu link="option=com_content&view=featured">MOD_MENU_COM_CONTENT_FEATURED</menu> <menu link="option=com_fields&context=com_content.article">MOD_MENU_FIELDS</menu> <menu link="option=com_fields&view=groups&context=com_content.article">MOD_MENU_FIELDS_GROUP</menu> </submenu>
MOD_MENU_COM_CONTENT --> COM_CONTENT : Ignore this line as COM_CONTENT already exists MOD_MENU_COM_CONTENT_ARTICLE_MANAGER --> COM_CONTENT_ARTICLE_MANAGER MOD_MENU_COM_CONTENT_CATEGORY_MANAGER --> COM_CONTENT_CATEGORY_MANAGER MOD_MENU_COM_CONTENT_FEATURED --> COM_CONTENT_FEATURED_ARTICLES MOD_MENU_FIELDS --> COM_CONTENT_FIELDS MOD_MENU_FIELDS_GROUP --> COM_CONTENT_FIELD_GROUPSand then add the same translations as a block into the admin translations file [zip]/admin/language/en-GB/en-GB.com_content.sys.ini as show below.
;Menu (previously handled by com_admin presets) COM_CONTENT_ARTICLE_MANAGER="Articles" COM_CONTENT_CATEGORY_MANAGER="Categories" COM_CONTENT_FEATURED_ARTICLES="Featured Articles" COM_CONTENT_FIELDS="Fields" COM_CONTENT_FIELD_GROUPS="Field Groups"This is required to make the component a standalone verion of the core component.
;install/update/uninstall system COM_CONTENT_NAME="Content (Component)" ;This might not be needed COM_CONTENT_DESCRIPTION="A standalone verion of the Joomla core component, content."
<!-- Script: Install, Update, Uninstall --> <scriptfile>script.php</scriptfile>
; script.php (install/update/uninstall) COM_CONTENT_INSTALL_TEXT="The component has been installed." COM_CONTENT_UNINSTALL_TEXT="The component has been uninstalled." COM_CONTENT_UPDATE_TEXT="The component has now been updated to version %s." ; script.php - Before Actions COM_CONTENT_PREFLIGHT_DISCOVER_INSTALL_TEXT="Content preflight discover install script." COM_CONTENT_PREFLIGHT_INSTALL_TEXT="Content preflight install script." COM_CONTENT_PREFLIGHT_UNINSTALL_TEXT="Content preflight uninstall script." COM_CONTENT_PREFLIGHT_UPDATE_TEXT="Content preflight update script." ; script.php - After Actions COM_CONTENT_POSTFLIGHT_DISCOVER_INSTALL_TEXT="Content postflight discover install script." COM_CONTENT_POSTFLIGHT_INSTALL_TEXT="Content postflight install script." COM_CONTENT_POSTFLIGHT_UNINSTALL_TEXT="Content postflight uninstall script." COM_CONTENT_POSTFLIGHT_UPDATE_TEXT="Content postflight update script."
You cannot install the extension you have just made because it will break your joomla installation, so you must refector it to a new name such as com_qwhelloworld.
Make sure you have made another backup before proceededing example file name = com_content - Extracted from J3.9.21 (Native with manifest, script and translations upgraded).zip
Again these instructions will outlione how to refactor com_content to com_qwhelloworld.
I did an article Rename a Joomla plugin or create a second instance of it that might be of use.
You can also search for `content` with your favorite file search tool.
You have 2 ways of perfoming text replacing in your extension:
What i did
I did not just rename `Content -> QWHelloWorld`, because of the name of the component (com_content) there are a lot of similiar name functions using the word Content and those should not be changed.
Normally if you are doing a uniquely name extension this should not be an issue i.e. com_contact.
So I worked through the list below until I got too `Content -> QWHelloWorld`, again used the Find and replace option in Netbeans but this time I inspected every line/match that was found for issues and made notes of these, then now i performed `Content -> QWHelloWorld`so when the unwanted changed were made I could go through and correct only the errors becasue I had built up a list of changes to revert, This is how I got my corrections section.
Perform the following text renames
Now perform the following renames in the order they appear and they are case sensitive
Corrections
Now because of the name com_content which gives Content which in turn is not unique, you will find you need to do some corrections which I have outlined below. Please be aware this is not exhaustive as I might of missed stuff
Because com_content is blended into the core we need to correct a few things so the correct table is found and used. This section should only be neded for com_content but this procedure can be adapted if needed.
Consider this code:
// I think calls the table instance for the component $contentTable = JTable::getInstance('Qwhelloworld', 'JTable'); // controlling the Feature artciles which will help you work out what to change // [zip]/admin/models/article.php $table = $this->getTable('Featured', 'QwhelloworldTable'); // [zip]/admin/models/feature.php public function getTable($type = 'Featured', $prefix = 'QwhelloworldTable', $config = array())
Instructions
JTable::getInstance('Qwhelloworld', 'JTable'); --> JTable::getInstance('QwhelloworldContent', 'JTable') getTable($type = 'Qwhelloworld', --> getTable($type = 'QwhelloworldContent',
Once you have done these changed you can see if you extension works and make any corrections as required. If there any unforseen issues try an fix them or you can just start again with your backup.
Most erros casued during the installation are probably caused by the manifest or files with the wrong names.
Joomla Debug is your friend
View the extension in site and admin for different errors to those during installation but this time with Joomla Debug on and you can then go through and fix the errors. I would also recommend making notes.
This is for me really.
This is far simpler, just go to the relevant folder and zip the contents. You have now extracted your choosen extension.
Here are some example locations:
These are my notes I made while researching this subject. There are many different ways to do the same thing.
Read this article first because it explains the different methods clearly: J3.x:Adding JavaScript and CSS to the page - Joomla!
use Joomla\CMS\HTML\HTMLHelper; HTMLHelper::_('script', 'path/to/file.js'); HTMLHelper::_('stylesheet', 'path/to/file.css');
Different Methods I have found. Some might be dated but at least you know I have seen the same things.
/* Add CSS and JS to the <head> */ // Method 1 $document = JFactory::getDocument(); $document->addStyleSheet( JUri::root() . 'modules/mod_helloworld/css/helloworld.css' ); $document->addScript( JUri::root() . 'modules/mod_helloworld/js/helloworld.js' ); $document->addStyleSheet( JURI::base()."components/com_jdownloads/assets/rating/css/ajaxvote.css", 'text/css', null, array() ); $modules->doc->addStyleSheet($url . '/modules/mod_easyblogticker/assets/styles/ticker-style.css'); $doc->addStyleSheet(JURI::base().'plugins/content/maogalleryview/css/maogalleryview.css', $type = 'text/css', $media = 'screen,projection'); $doc->addScript(JURI::base().'plugins/content/maogalleryview/js/slider.mini.js', 'text/javascript'); // Method 2 JFactory::getDocument()->addStyleSheet( ltrim($mtconf->get('relative_path_to_js'),'/') . 'jquery.typeahead.css'); JFactory::getDocument()->addScript( ltrim($mtconf->get('relative_path_to_js'),'/') . 'jquery.typeahead.min.js'); // Method 3 - This allows overriding JHtml::stylesheet('mod_helloworld/css/helloworld.css', array(), true); JHtml::script('mod_helloworld/js/helloworld.js', false, true); JHtml::script('com_joomlaupdate/default.js', false, true, false); /* Misc */ // Method 1 - I found this in a template default.php and have not tested it echo JHtml::stylesheet('mod_mt_filter/mod_mt_filter.css',array(),true, false);
// Add CSS and JS to the <head> - This method allows overriding JHtml::stylesheet('mod_helloworld/css/helloworld.css', array(), true); JHtml::script('mod_helloworld/js/helloworld.js', false, true);
NB: This document is not finished so if you are reading this please bear with me. Thes instructions are what i am using/will use for quantumwarp.com
This might of been done in the past but I want to explain in clear terms on how the Joomla Update Enviroment works, the implementations I have found and then how I implemented my own Joomla Update Server so i can get on with what I really wanted to do in the first place which is to develop joomla extensions. There is some documentation but no real practical gold standard setup where someone says do this, use this software. Akeeba Release System is what a lot of people use but this is a difficult program to master. At the bottom of this page you will see a whole raft of resources which i used to put this article together so if there is something I have missed you might find help in one of those links and then let me know. These instructions will serve as template for setting up your own Joomla Update Server from scratch, How to implement this in your extensions and will be what I use here on quantumwarp.com and my extensions. I might also use this for non-joomla extensions if possible.
This article will cover topics such as:
I will now break down the update enviroment into their different constituent parts that you might need. Your installation should do all or some of these depending on your configuration. Also you might have one piece of software do all of these or a combination of softwares acting as one. A Joomla Update Server can be a combination of the following items but a lot of people just think the server just hands out the XML update streams, end users dont, they expect the file aswell
These are the tables in the clients Joomla installation, not the update server.
So far I have discovered there are several methods so far for handling commercial software updating. These are an overview as there are probably different ways of implementing these.
You can use a different update stream for commercial and free extensions but you can potential use these methods to allow the supply of both types using the same update stream. The difference is just in the request, the commercial ones have extra variables being sent.
NB: `jos_` is the fictional database prefix I am using.
In this worked example I follow how RSFirewall manages its licensing information. In particular this is an example of how the update url is manipulated upon 'update this extension' submission, this will make more sense after following this through.
<updateservers> <server type="extension" priority="1" name="RSFirewall!">https://www.rsjoomla.com/updates/com_rsfirewall/Component/com_rsfirewall.xml</server> </updateservers>
I have not entered a license key as this is optional and because I am exploring this 'Shared XML/Manipulate Update Stream' method. i.e. you get a different version dependent on the license key or lack off. The different outcomes are explored later.
<updates> <update> <name>RSFirewall! 2.12.1</name> <description></description> <element>com_rsfirewall</element> <type>component</type> <folder></folder> <version>2.12.1</version> <infourl title="RSFirewall! 2.12.1">https://www.rsjoomla.com/support/documentation/rsfirewall-user-guide/changelog.html</infourl> <downloads> <downloadurl type="full" format="">https://www.rsjoomla.com/updates/com_rsfirewall/Component/com_rsfirewall.zip</downloadurl> </downloads> <tags> <tag>stable</tag> </tags> <maintainer>RSJoomla!</maintainer> <maintainerurl>https://www.rsjoomla.com/</maintainerurl> <section>Updates</section> <targetplatform name="joomla" version=".*" /> <client>administrator</client> </update> </updates>
<?php /** * @package RSFirewall! * @copyright (C) 2015 www.rsjoomla.com * @license GPL, http://www.gnu.org/copyleft/gpl.html */ defined('_JEXEC') or die; class plgInstallerRsfirewall extends JPlugin { public function onInstallerBeforePackageDownload(&$url, &$headers) { $uri = JUri::getInstance($url); $parts = explode('/', $uri->getPath()); if ($uri->getHost() == 'www.rsjoomla.com' && in_array('com_rsfirewall', $parts)) { if (!file_exists(JPATH_ADMINISTRATOR.'/components/com_rsfirewall/helpers/config.php')) { return; } if (!file_exists(JPATH_ADMINISTRATOR.'/components/com_rsfirewall/helpers/version.php')) { return; } // Load our config require_once JPATH_ADMINISTRATOR.'/components/com_rsfirewall/helpers/config.php'; // Load our version require_once JPATH_ADMINISTRATOR.'/components/com_rsfirewall/helpers/version.php'; // Load language JFactory::getLanguage()->load('plg_installer_rsfirewall'); // Get the version $version = new RSFirewallVersion; // Get the update code $code = RSFirewallConfig::getInstance()->get('code'); // No code added if (!strlen($code)) { JFactory::getApplication()->enqueueMessage(JText::_('PLG_INSTALLER_RSFIREWALL_MISSING_UPDATE_CODE'), 'warning'); return; } // Code length is incorrect if (strlen($code) != 20) { JFactory::getApplication()->enqueueMessage(JText::_('PLG_INSTALLER_RSFIREWALL_INCORRECT_CODE'), 'warning'); return; } // Compute the update hash $uri->setVar('hash', md5($code.$version->key)); $uri->setVar('domain', JUri::getInstance()->getHost()); $uri->setVar('code', $code); $url = $uri->toString(); } } }
https://www.rsjoomla.com/updates/com_rsfirewall/Component/com_rsfirewall.zip
"https://www.rsjoomla.com/updates/com_rsfirewall/Component/com_rsfirewall.zip?hash=f0588314d3680f6c15c71c7FF394129d&domain=localhost&code=xxxxxxxxxxxxxxxxxxxx"
hash = a MD5 hash of the RSFirewall Version (local) and the license key
domain = domain that RSFirewall is installed on
code = license key
The remote server responds with various error messages in text. I do not know if this is where Joomla gets the reponse messages, styles them as errors, and them displays them at the top of the updates page, it probably is, or if it is specific to RSFirewall becasue it has installed some extra code.
Failed to download package. Download it and install manually from https://www.rsjoomla.com/updates/com_rsfirewall/Component/com_rsfirewall.zip.The text response from the RSJoomla Update Server is "The update code was not found in our database."
This extension cannot be downloaded directly; this is a commercial product and the only way to download it is either through your RSJoomla! account or automatically by Joomla! updates once you supply your license code in the extension's configuration.<br /> More info <a href='https://www.rsjoomla.com/support/documentation/general-faq/where-do-i-find-my-license-code-.html'>here</a>.
PLG_INSTALLER_RSFIREWALL_INCORRECT_CODE="Your update code appears to be incorrect. Please make sure you've copied it correctly. <strong><a href="/_QQ_"https://www.rsjoomla.com/support/documentation/general-faq/where-do-i-find-my-license-code-.html"_QQ_" target="_QQ_"_blank"_QQ_">More information</a></strong>"
PLG_INSTALLER_RSFIREWALL_INCORRECT_CODE
D:\websites\htdocs\quantumwarp.com\plugins\installer\rsfirewall\rsfirewall.php
These are articles that I have found that all relate to the Joomla Release System and will help me undertand how to implement and use it.
These are extensions that handle the XML and the actual download of the software. These systems dont have inbuilt subscription systems and the functionality varies.
Create your XML files using a component rather than doing them manually.
This is related, you need to make sure your plugins are compliant with Joomla's coding practice including using 'Tabs' which I hate.
Again these are along the same line as this article, so where better to put them to complete the circle. These Joomla extensions will notfy you of updates to your Joomla installation and it's extensions with various options. The inbuilt Joomla update notification system plugin runs every couple of hours and is the first thing I turn off. When developing multiple websites you dont want mutiple emails from multiple websites weveryday telling you the same thing. The Joomla notification plugin only notfies you of a Joomla platform update and nto the extensions.
List the basic mechanisim in my words
To Do list
My Update System
com_updateserver Notes
Update Server Options
These are my basic notes I will use for reference:
NB:
When you enable SPF either globally or on an indvidual cPanel account the default record uses a soft fail switch (~all) and this is not the best setting for prevent spam being sent from or on behalf of your server.
cPanel offers no options in WHM to change this default action, but there is a well known workaround which does seem to have official support and that is to alter the 'standard' Zone template.
If you do not know the syntax this will become a difficult thing to set up. So to make things easier below you will see the 'standard' Zone Template taken from cPanel v82.0.9 with the correct line added at the bottom for a 'Hard Fail' SPF record.
; cPanel %cpversion% ; Zone file for %domain% $TTL %ttl% @ %nsttl% IN SOA %nameserver%. %rpemail%. ( %serial% ; serial, todays date+todays 3600 ; refresh, seconds 1800 ; retry, seconds 1209600 ; expire, seconds 86400 ) ; minimum, seconds %domain%. %nsttl% IN NS %nameserver%. %domain%. %nsttl% IN NS %nameserver2%. %domain%. %nsttl% IN NS %nameserver3%. %domain%. %nsttl% IN NS %nameserver4%. %nameserverentry%. IN A %nameservera% %nameserverentry2%. IN A %nameservera2% %nameserverentry3%. IN A %nameservera3% %nameserverentry4%. IN A %nameservera4% %domain%. IN A %ip% %domain%. IN AAAA %ipv6% %domain%. IN MX 0 %domain%. mail IN CNAME %domain%. www IN CNAME %domain%. ftp IN CNAME %domain%. %domain%. %ttl% IN TXT "v=spf1 +a +mx +ip4:%ip% -all"
This will generate a SPF record as follows:
v=spf1 +a +mx +ip4:xxx.xxx.xxx.xxx -all
Other Examples
%domain%. %ttl% IN TXT "v=spf1 +a +mx +ip4:xxx.xxx.xxx.xxx +include:relaydns.com -all" %domain%. %ttl% IN TXT "v=spf1 +a +mx +ip4:xxx.xxx.xxx.xxx +include:%domain% -all" %domain%. %ttl% IN TXT "v=spf1 +a +mx +ip4:%ip% +include:%domain% -all" %domain%. %ttl% IN TXT "v=spf1 +a +mx +ip4:%ip% -all"
NB: Replace xxx.xxx.xxx.xxx with a real IPv4 IP
Notes
Once you have got your server working, like most Windows users you want to be able to login to the root file system using your favourite FTP program so to that end there are a few hoops you have to jump through first.
Allow SSH Access
Remove SSH Access
For reference this is the information I got from my support people while trying to fox this.
Your server is not IP restricted right now, with dynamic IP address we can not restrict server root access as every time your IP address changed you will need to contact us in order to allow new IP address.
Restricting server root access is completely different from server firewall, in order to restrict server root access we will need to add your static IP address for host access control, it can be done from WHM Home »Security Center »Host Access Control, here you will need to add entries like below,sshd IP_from_which_you_want_to_access_server allow
Till the time you are using dynamic IP address [and root level restriction disabled], you can keep whitelisting IP address in firewall using option Home »Plugins »ConfigServer Security & Firewall
here you will just need to enter IP address just besides the button 'Quick allow'.
These might be the firewall rules added, but I don't know how they are entered.
On my fresh cPanel server I configured the following settings to make things like cpanel.quantumwarp.com, webmail.quantumwarp.com require https, i.e. cPanel webservices access should be HTTPS enforced.
After I did this, I typed into my address bar cpanel.quantumwarp.com (note no protocol, which implies http://) I got the following error:
The page isn't redirecting properly
So I contacted my server support people and got the following reply
We have tried to set the requiressl and always_redirect_to_ssl for the cPanel proxy domain like cpanel.quantumwarp.com in cPanel configuration, after setting up it cpanel.quantumwarp.com started redirecting to https://cpanel.quantumwarp.com but after that its started showing "Too Many Redirection" error.
Also we tried to force redirect the proxy subdomains to https in apache configuration but no success.
We have now forwarded it to cPanel support team and we will update you once we receive an update from them.
And here is the response from the cPanel Team
We have received below response from cPanel support team.
=============
Thank you for your patience as I performed my investigation. The Apache headers module is not installed on your server:
-=-=-=-=-=-=-=-=-=-=-=
[19:11:24 xxxx root@88888888 ~]cPs# rpm -qa | grep mod_headers
[19:11:26 xxxx root@88888888 ~]cPs#
-=-=-=-=-=-=-=-=-=-=-=
The most common issue that occurs when the module is missing is infinite redirect loops when accessing service subdomains. However, it is likely the non-redirection issue is occurring due to the missing module.
==========
We have now installed the missing apache module and now below links are redirecting to https
Install mod_headers via EasyApache4
The only difference to default is that I have restricted cpanel web services and webdisk by disabling TLSv1_1 (as pere zeros and one)
These are the current changes I have made. The rest of the relevant cipher settings are left as default