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.


Topics - Aleksey

Pages: [1]
1
This mod allows you to send emails from the 4images gallery via smtp with SSL authentication.

-----------| Changed Files |--------------------
/includes/email.php

-----------| New files |---------------------------
/includes/SendMailSmtpClass.php

-----------| Installation |-----------------------
Step 1

Download SendMailSmtpClass.php attached on this post and copy to /includes/SendMailSmtpClass.php

Step 2
Open /includes/email.php
Find:
Code: [Select]
if (!defined('ROOT_PATH')) {
  die("Security violation");
}

below insert:
Code: [Select]
require_once "SendMailSmtpClass.php"; // the plug-in class

Find:
Code: [Select]
  function send_email() {
    if ($this->use_smtp) {
      return ($this->smtp_mail($this->to, $this->subject, $this->body, $this->create_header())) ? 1 : 0;
    }
    else {
      return (mail($this->to, $this->subject, $this->body, $this->create_header())) ? 1 : 0;
    }

You can delete this function or comment on the code
Code: [Select]
/* ////////// Original function send_email //////////
    function send_email() {
    if ($this->use_smtp) {
      return ($this->smtp_mail($this->to, $this->subject, $this->body, $this->create_header())) ? 1 : 0;
    }
    else {
      return (mail($this->to, $this->subject, $this->body, $this->create_header())) ? 1 : 0;
    }
  } */

below insert:
Code: [Select]
// Mod Simple smtp ssl sending START
  function send_email() {
    global $config;
$sitename = $config['site_name'];          // the site name is taken from the gallery settings
$smtp_from = 'mygallery@gmail.com';        // sender's email and smtp login
$smtp_password = 'my_password_smtp_user';  // smtp user password
$smtp_host = 'ssl://smtp.gmail.com';       // smtp server address, do not delete the transport ssl://
$smtp_port = 465;                          // smtp port
$smtp_charset = "UTF-8";                   // encoding of email messages UTF-8 or windows-1251

$from = array( $sitename, $smtp_from);
$mailSMTP = new SendMailSmtpClass($smtp_from, $smtp_password, $smtp_host, $smtp_port, $smtp_charset);
return ($mailSMTP->send($this->to, $this->subject, $this->body, $from)) ? 1 : 0;
  }
// Mod Simple smtp ssl sending END

This is an example of settings for working with mail gmail.com
Change to your own parameters.

The "word_wrap"function also doesn't work well by default.
It inserts a break in the text of your emails in unexpected places.
To disable it find:
Code: [Select]
  var $word_wrap = 76;
Replace:
Code: [Select]
  var $word_wrap = 0;
Tested on mail servers yandex.ru, mail.ru and gmail.com, smtp.beget.com

Author SendMailSmtpClass.php - Ipatov Evgeniy admin@vk-book.ru
Article https://vk-book.ru/novaya-versiya-klassa-sendmailsmtpclass-otpravka-fajlov-cherez-smtp-s-avtorizaciej-po-protokolu-ssl-na-php/
This project on github - https://github.com/Ipatov/SendMailSmtpClass

By default, emails are sent as text, but the class supports sending in html format and even sending files.

Good luck! :)

2
By default, you can register a user's nickname with any length and characters. This is very bad, there is no filtering.

This mod is lost, but it is very important and I will post it again.
This is not my mod, I restored it from my gallery.

Description: this mod checks the nickname when registering a user for forbidden characters and the length of the nickname.
By default, this mod allows the length of nicknames from 2 to 25 characters. As well as only English and Russian letters, numbers, space. But you can change that.

This MOD works on 4images 1.8 and PHP 7.4.4

[ Changed Files ]
includes/constants.php
register.php
templates/register_form.html
lang/<your language>/main.php

[ Installation ]

First Backup your Files

Step 1
Open register.php

Find
Code: [Select]
  $captcha = (isset($HTTP_POST_VARS['captcha'])) ? un_htmlspecialchars(trim($HTTP_POST_VARS['captcha'])) : "";

  $error = 0;
below insert
Code: [Select]
//Mod UNEXPECTED CHARS START
function comprobar_username($nombre_usuario){

$long_max = MAX_USER_KEYWORD_LENGTH;
$long_min = MIN_USER_KEYWORD_LENGTH;
$sag = '';
if (strlen($nombre_usuario)<$long_min){
$sag = 2; // devuelve 2, como diciendo "error 2"
return $sag;
}
if (strlen($nombre_usuario)>$long_max){
$sag = 3; // devuelve 3, como diciendo "error 3"
return $sag;
}

$permitidos = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzЙЦУКЕЁНГШЩЗХЪФЫВАПРОЛДЖЭЯЧСМИТЬБЮйцукеёнгшщзхъфывапролджэячсмитьбю0123456789 ";

for ($i=0; $i<strlen($nombre_usuario); $i++){
if (strpos($permitidos, substr($nombre_usuario,$i,1))===false){
$sag = $sag.substr($nombre_usuario,$i,1);
}
}
if ($sag != ''){
return $sag;
}
return true;
  }
//Mod UNEXPECTED CHARS END

You can change this string and enter your allowed characters.
$permitidos = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzЙЦУКЕЁНГШЩЗХЪФЫВАПРОЛДЖЭЯЧСМИТЬБЮйцукеёнгшщзхъфывапролджэячсмитьбю0123456789 ";

Find
Code: [Select]
        $msg .= (($msg != "") ? "<br />" : "").$lang['username_exists'];
        $error = 1;
      }
below insert
Code: [Select]
//Mod UNEXPECTED CHARS START
elseif (comprobar_username($user_name) != 1)
      {
$long_car = '';
for ($i=0; $i<strlen(comprobar_username($user_name)); $i++){
$long_car = $long_car.'#';
}

$resultado_func = comprobar_username($user_name);

if(strlen($resultado_func) >= 1 and $resultado_func != 2 and $resultado_func != 3){
$msg .= (($msg != "") ? "<br />" : "").$lang['username_bad_characters'];
$msg .= ": ".$resultado_func;
}
if($resultado_func == 2){
$msg .= (($msg != "") ? "<br />" : ""). $lang['user_name_short'];
}
if($resultado_func == 3){
$msg .= (($msg != "") ? "<br />" : ""). $lang['user_name_long'];
}

$recom = strtolower($user_name);
$recom = strtr($recom, " ", "_");
$recom = strtr($recom,comprobar_username($user_name), $long_car);
for ($i=0; $i<strlen($recom); $i++){
if (strpos($recom,'#')=== false){
}else{
$recom = substr($recom, 0,strpos($recom,'#')).substr($recom, strpos($recom,'#')+1);
}
}

$recom = trim($recom);

$long_max = MAX_USER_KEYWORD_LENGTH;
$recom = substr($recom,0,$long_max);

$username_option = $lang['user_name_option'].$recom;
 
        $error = 1;
      }

//Mod UNEXPECTED CHARS END

Step 2
Open templates/register_form.html

Find
Code: [Select]
<input type="text" name="user_name" size="30" value="{user_name}" class="input" />
below insert
Code: [Select]
<br>Allowed characters: A-Z a-z А-Я а-я 0-9 space<br>Nickname length: minimum 2, maximum 25 characters.

Step 3

Open includes/constants.php
Find
Code: [Select]
?>above insert
Code: [Select]
//Mod UNEXPECTED CHARS AND LENGHT NICKNAME
define('MIN_USER_KEYWORD_LENGTH', 2);
define('MAX_USER_KEYWORD_LENGTH', 25);
(these values are the minimum and maximum length of the nickname, edit as you need.)

Step 4

Open templates/main.php
Find
Code: [Select]
?>above insert
Code: [Select]
//Mod UNEXPECTED CHARS AND LENGHT NICKNAME
$lang['user_name_short'] = "The entered nickname is too short. The minimum value is 2 characters.";
$lang['user_name_long'] = "The entered nickname is too long. The maximum value is 25 characters.";
$lang['username_bad_characters'] = "Nickname contains invalid characters";

3
Ïî àíãëèéñêè ÿ íàïèøó êîðÿâî, ïîýòîìó îïèøó ïî ðóññêè...
Ïðîáëåìà â òîì, ÷òî êîãäà ïîëüçîâàòåëü íàçûâàåò ôîòîãðàôèþ
Code: [Select]
='''''''''= (îäèíàðíûå êîâû÷êè) òî â ïðåäûäóùåì ôîòî ýòî âûçûâàåò îøèáêó.
 ìîåì ñëó÷àå ó ìåíÿ âûâîäÿòñÿ êàðòèíêè ïðåäûäóùåé è ñëåäóþùåé ôîòîãðàôèè.
Ïîýòîìó êîãäà îòêðûâàåì ôîòîãðàôèþ è â ñëåäóþùåì ôîòî ñîäåðæèòñÿ ôîòêà ñ êðèòè÷íûì äëÿ mysql íàçâàíèåì ýòî âûçûâàåò îøèáêó è îñòàíîâêó ñêðèïòà. Ñîîòâåòñòâåííî òåìïëåéò íà ýòîì òîæå ðâåòñÿ è âñå ñúåçæàåò.

Ìîæíî ëè êàê-òî çàïðåòèòü íàçûâàòü ôîòî ïëîõèìè ñèìâîëàìè?

4
Discussion & Troubleshooting / Error in 4images 1.7.2 release
« on: March 20, 2006, 02:49:24 PM »
In admin panel /  settings / Category settings    not work Cellspacing   and  Cellpadding
This error in /includes/functions.php

if use functions.php 1.7.1 all works is fine...   1.7.2 - not work...
Please fix this...
 

5
How exclude characters on register new user?
Need only A-Za-z and russian А-Яа-я
And EXCLUDE FOREVER
Code: [Select]
!@#$%^&*()-=}{]['"  :)
Please...

Pages: [1]