Skip to content

Instantly share code, notes, and snippets.

View rvalitov's full-sized avatar
:octocat:
Coding & coding

Ramil Valitov rvalitov

:octocat:
Coding & coding
View GitHub Profile
@rvalitov
rvalitov / jailkit-php-config.md
Created June 24, 2023 08:00
Configuration of jailkit for PHP and ISPConfig

Jailkit configuration

Jailkit is used to create a secure shell environment for the user. It's also used by ISPConfig to securely run user's cron jobs from command line. Default jailkit configuration may not properly support PHP. So, first jailkit needs to be installed:

$ sudo apt-get install jailkit

Then configuration file /etc/jailkit/jk_init.ini needs to be modified by addding 2 new sections - php and env:

@rvalitov
rvalitov / IMAPsync.sh
Last active April 16, 2023 22:47
IMAP emails sync example from Yandex to Titan email service
# This example shows how to transfer emails from Yandex to Titan using the following:
# - proper use of SINCE and BEFORE keywords to select only some emails
# - proper hosts, ports and SSL configuration
# - skip of empty folders (empty folders are not created on destination)
# - email reports are not saved
# - no folder size calculation (it takes too long for big mailboxes with size of 10 Gb+)
# - correct matching of Yandex folders that have Russian names such as "Отправленные", "Отправленные_0", "Удаленные", etc,
# - skip other folders like "Junk Emails", "Infected Items" or "Исходящие" folder because it's "Outbox" that is missing on Titan.
imapsync \
@rvalitov
rvalitov / export-user-data.sql
Last active April 10, 2023 10:07
Exports full user data from Prestashop, including address, phone, etc.
/* Selecting users that made at least 1 order */
SELECT * FROM (
/* Users with gender specified */
SELECT
PS_customer.id_customer AS "Customer ID",
PS_gender_lang.name AS "Gender",
PS_customer.firstname AS "First name",
PS_customer.lastname AS "Last name",
PS_customer.email AS "Email",
PS_customer.passwd AS "Password Hash",
@rvalitov
rvalitov / CBConditional.php
Created April 6, 2023 16:26
Community Builder Conditional: how to show a field only if a user looks his own profile in Joomla?
/**
* @param FieldTable|TabTable $object
* @param string $reason
* @param int $userId
* @param null|bool $js
* @param null|bool $reset
* @return bool|int
*/
private static function parseConditions( $object, $reason, $userId, &$js = null )
//Function code goes here....
@rvalitov
rvalitov / rsform-reject-joomla.php
Created June 9, 2022 09:19
RSForm PHP script to silently reject submission from spammers based on their email address
/**
* This script is used to silently reject submissions from spammers if you know their email addresses that they
* put into your contact form.
* This script checks if the user's email in the submitted form exists in your configured blacklist of email addresses.
* The comparison is done case-insensitive.
* If match is found, then such submission is rejected.
* Rejected submissions are not saved into the database of RSForm and all notification emails are not sent.
* After the rejected submission received, the user will be redirected to the same contact page
* (or another page if you configure that) with a configurable message.
* Usually such message should be a fake successfully received submission notification, so it does not look