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 - Aleksey

Pages: [1] 2 3
1
Mods & Plugins (Releases & Support) / Re: [Mod] Avatar v2.01
« on: May 29, 2020, 01:29:32 AM »
This Mod ready for gallery 1.8 and php 7+, but need this changes:

New step 1.4.
Few lines below find:
Code: [Select]
  $site_template->register_vars(array(
    "user_name" => format_text(stripslashes($user_name), 2),

Replace with:
Code: [Select]
//-----------------------
//------ Avatar ---------
//-----------------------
  if ($config['avatar_use']){
   $images = "";
  $checked = ($user_avatar == "blank.gif" || $user_avatar == "") ? " selected" : "";
  $images .= "\n<option value=\"blank.gif\"$checked>none</option>\n";
  $dir = opendir(TEMPLATE_PATH."/avatars/users/");
  $contents = array();
  while ($contents[] = readdir($dir)){;}
  closedir($dir);
  natcasesort ($contents);
  foreach ($contents as $line){
   $filename = substr($line,0,(strlen($line)-strlen(strrchr($line,"."))));
   if ($filename == $user_info['user_id']) {
     $checked = (stristr($user_avatar, "users/")) ? " selected" : "";
     $images .= "\n<option value=\"users/$line\"$checked>".$lang['custom']."</option>\n";
   }
  }
   $dir = opendir(TEMPLATE_PATH."/avatars/");
   $contents = array();
   while ($contents[] = readdir($dir)){;}
   closedir($dir);
   natcasesort ($contents);
   $checked = "";
   foreach ($contents as $line){
      $filename = substr($line,0,(strlen($line)-strlen(strrchr($line,"."))));
      $extension = substr(strrchr($line,"."), 1);
      $checked = "";
      if ($line == $user_avatar) { $checked = " selected"; }
      if (strcasecmp($extension,"gif")==0 || strcasecmp($extension,"jpg")==0 || strcasecmp($extension,"jpeg")==0 || strcasecmp($extension,"png")==0 ){
         if ($line != "blank.gif") {
        $filename = str_replace("_", " ", $filename);
        $images .= "<option value=\"$line\"$checked>$filename</option>\n";
       }
      }
   }
  }
//----------------------
//----- End Avatar -----
//----------------------

  $site_template->register_vars(array(
   "lang_avatar" => $lang['avatar'],
   "lang_avatar_file" => $lang['avatar_file'],
   "lang_avatar_dim" => $lang['avatar_max_dim']." ".$config['avatar_width']."x".$config['avatar_height'].$lang['px'],
   "lang_avatar_select" => $lang['avatar_select'],
   "user_avatar_images" => $images,
   "user_avatar_current" => ($config['avatar_use']) ? "<img src=\"".TEMPLATE_PATH."/avatars/".(($user_avatar == "") ? "blank.gif" : $user_avatar)."\" name=\"icons\" border=\"0\" alt=\"\">" : "",
   "lang_or" => $lang['or'],
   "user_avatar_file" => $config['avatar_user_custom'],
    "user_name" => format_text(stripslashes($user_name), 2),

New step 3.6.
Find:
Code: [Select]
    //Thumbnails
    $this->accepted_extensions['thumb'] = array(

Insert above:
Code: [Select]
//Avatar
    $this->accepted_mime_types['avatar'] = array(
      "image/jpeg",
      "image/pjpeg",
      "image/gif",
      "image/x-png"
    );
    $this->accepted_extensions['avatar'] = array(
      "jpg",
      "jpeg",
      "gif",
      "png"
    );

Enjoy!  :)

2
I fixed this MOD, and now it works for gallery 1.8 and php 7+

After install, you need to make these changes:

New correct Step 6

Open /includes/functions.php
Find:
Code: [Select]
function format_text
just comment entire function by doing this:
Add before that line:
Code: [Select]
/*
and at the end of the function find (in default 4images ver:1.8 it would be):
Code: [Select]
  $text = str_replace("\\'", "'", $text);

  return $text;
}

add after that closing bracket } add this:
Code: [Select]
*/
After Step 6.2

Open /includes/functions.php
Find:
Code: [Select]
     $text = preg_replace("/\[php\](.*?)\[\/php\]/esi", "phphighlite('\\1')", $text);
      $text = preg_replace("/\[code\](.*?)\[\/code\]/esi", "bb_code('\\1')", $text);
Replace with:
Code: [Select]
     $text = preg_replace_callback("/\[php\](.*?)\[\/php\]/si", "phphighlite", $text);
      $text = preg_replace_callback("/\[code\](.*?)\[\/code\]/si", "bb_code", $text);

Find:
Code: [Select]
    $text = preg_replace("/\[thumb=([0-9]+)(,([0-9]+)?)?(,([a-zA-Z]+))?\]/esi","thumb('\\1','\\3','\\5')",$text);
Replace with:
Code: [Select]
    $text = preg_replace_callback("/\[thumb=([0-9]+)(,([0-9]+)?)?(,([a-zA-Z]+))?\]/si","thumb",$text);

After Step 7

Open /includes/page_header.php
Find:
Code: [Select]
      if (ereg("pm.php", $self_url) && $action == "inbox") {Replace with:
Code: [Select]
      if (preg_match("/pm.php/", $self_url) && $action == "inbox") {
Find:
Code: [Select]
      }elseif (!ereg("pm.php", $self_url) || (ereg("pm.php", $self_url) && ($action == "sentbox" || $action == "outbox"))){
Replace with:
Code: [Select]
      }elseif (!preg_match("/pm.php/", $self_url) || (preg_match("/pm.php/", $self_url) && ($action == "sentbox" || $action == "outbox"))){

After Step 18

Open logout.php
Find:
Code: [Select]
if (!preg_match("/index\.php/", $url) && !preg_match("/lightbox\.php/", $url) && !preg_match("/login\.php/", $url) && !preg_match("/register\.php/", $url) && !preg_match("/member\.php/", $url)) {Replace with:
Code: [Select]
if (!preg_match("/index\.php/", $url) && !preg_match("/lightbox\.php/", $url) && !preg_match("/login\.php/", $url) && !preg_match("/register\.php/", $url) && !preg_match("/member\.php/", $url) && !preg_match("/pm\.php/", $url)) {
Download the new files attached to this message: pm.php and /includes/paging.php is archived and unarchived in your gallery.

Enjoy! :D

3
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! :)

4
Mods & Plugins (Releases & Support) / Re: [MOD] Birthday Mod v1.0
« on: May 09, 2020, 12:55:04 PM »
Improving the [MOD] Birthday Mod v1.0

If the user doesn't want to show the year of birth, they no longer need to enter the year 0000.
Just leave this field empty and the system will automatically enter the year 0000.

Open includes/functions.php

find:
Code: [Select]
function check_birthday($birthday_day = "", $birthday_month = "", $birthday_year = "", $valid = 0) {
  $error = 0;

below insert:
Code: [Select]
  if (empty($birthday_year)) {
  $birthday_year = "0000";
  }

The user must not enter a date of birth more than 100 years old.
The user must not enter a date of birth greater than the current year.
The check must take into account 0000 when the user hides their year of birth.

find:
Code: [Select]
   else {
       $birthday = "0000-00-00";
       $error = 1;
   }

below insert:
Code: [Select]
//check if age is bigger than 100 or bigger current year
$today = getdate (time());
if ($birthday_year == "0000") { }
elseif (($today['year'] > (intval($birthday_year)+100)) || (intval($birthday_year) > $today['year'])) return false;

By default, if the user enters the last two digits of the year, the function automatically inserts the year 19XX at the beginning.
This is wrong because there are people born in 2001.

find:
Code: [Select]
      case 2:
          $birthday_year = "19$birthday_year";
          break;

and replace:
Code: [Select]
\\      case 2:
\\          $birthday_year = "19$birthday_year";
\\          break;

Or delete it is not the correct solution.

You can make it intuitive for the user that the year can be left empty.

Open lang/<your language>/main.php
Find
Code: [Select]
$lang['year'] = "year";Replace:
Code: [Select]
$lang['year'] = "year (optional)";
This will be displayed when registering and editing the user (control panel)

5
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";

6
Mods & Plugins (Releases & Support) / Re: [MOD] Birthday Mod v1.0
« on: May 06, 2020, 12:13:33 PM »
Fixes for the [MOD] Birthday Mod v1.0 to work in gallery 1.8 on php 7

Open includes/functions.php
find:
Code: [Select]
if ($valid == 1 && ($error || (!ereg("([0-9]{4})-([0-9]{2})-([0-9]{2})", $birthday)))) return false;and replace with:
Code: [Select]
if ($valid == 1 && ($error || (!preg_match("/([0-9]{4})-([0-9]{2})-([0-9]{2})/", $birthday)))) return false;
The (ereg) function was removed from php 7, and we use (preg_match) instead.

7
Congraculations!  :)
I modify this installer for 1.7.4 version...  Use it..
Need fresh 4images database!

8
after insert sql dump, see table prefix  4images_pm correct?

If all correct, then attentively compare all steps modify code gallery. 
All works is fine on version 1.7.4

Good luck!

9
ok...  use phpMyadmin and this sql

Code: [Select]
-- phpMyAdmin SQL Dump
-- version 2.6.1-rc2
-- http://www.phpmyadmin.net

CREATE TABLE `4images_pm` (
  `pm_id` mediumint(10) unsigned NOT NULL auto_increment,
  `pm_type` tinyint(2) NOT NULL default '0',
  `pm_to` mediumint(8) NOT NULL default '0',
  `pm_from` mediumint(8) NOT NULL default '0',
  `pm_subject` varchar(255) NOT NULL default '',
  `pm_text` text,
  `pm_date` int(11) NOT NULL default '0',
  `pm_date_rcvd` int(11) NOT NULL default '0',
  `pm_ip` varchar(20) NOT NULL default '0',
  `pm_html` tinyint(1) NOT NULL default '0',
  `pm_bbcode` tinyint(1) NOT NULL default '0',
  `pm_smiles` tinyint(1) NOT NULL default '0',
  KEY `pm_id` (`pm_id`,`pm_to`,`pm_from`)
) ENGINE=MyISAM AUTO_INCREMENT=1 ;
       

10
or use PhpMyAdmin and create this:

Code: [Select]
CREATE TABLE - PM_TABLE
pm_id mediumint(10) unsigned NOT NULL auto_increment
pm_type tinyint(2) NOT NULL default '0'
pm_to mediumint(8) NOT NULL default '0'
pm_from mediumint(8) NOT NULL default '0'
pm_subject varchar(255) NOT NULL default ''
pm_text text
pm_date int(11) NOT NULL default '0'
pm_date_rcvd int(11) NOT NULL default '0'
pm_ip varchar(20) NOT NULL default '0'
pm_html tinyint(1) NOT NULL default '0'
pm_bbcode tinyint(1) NOT NULL default '0'
pm_smiles tinyint(1) NOT NULL default '0', KEY `pm_id` (`pm_id`,`pm_to`,`pm_from`)) TYPE=MyISAM"

add in USERS_TABLE
user_pm_inbox int(11) NOT NULL default '0'
user_pm_sentbox int(11) NOT NULL default '0'
user_pm_email tinyint(1) NOT NULL default '1'
user_pm_popup tinyint(1) NOT NULL default '0'

insert in SETTINGS_TABLE
setting_name      setting_value
pm                           1
pm_inbox                 30
pm_sentbox             10
pm_html                   0
pm_bbcode               1
pm_img                     1

all simple...  use phpmyadmin

11
Your problem in installer. Need good programmer for rewrite code installer compatible with mysql 5.x
Maybe....

But likely use mysql 4.x and no problem..
sorry i cant help you

12
so... your version php and mysql?

i use this installer on php5 and mysql 4.1.x
all works fine...

13
if you have error in 1.7.4 Undefined variable: pm_xxxx

Quote
Notice: Undefined variable: pm_popup_header in /home/myke/public_html/includes/page_header.php on line 177

Notice: Undefined variable: pm_inbox in /home/myke/public_html/includes/page_header.php on line 179

Notice: Undefined variable: pm_outbox in /home/myke/public_html/includes/page_header.php on line 180

Notice: Undefined variable: pm_sentbox in /home/myke/public_html/includes/page_header.php on line 181

Notice: Undefined variable: pm_new_count in /home/myke/public_html/includes/page_header.php on line 182

Edit file includes/page_header.php
find:
Code: [Select]
//-----------------------------------------------------
//--- pm ---------------------------------------------
//-----------------------------------------------------
$inbox = "";
$outbox = "";
$sentbox = "";
$newpm = "";
$pm_popup_script = "";
$pm_popup_head = "";
$pm = "";

and replace this
Code: [Select]
//-----------------------------------------------------
//--- pm ---------------------------------------------
//-----------------------------------------------------
$inbox = "";
$outbox = "";
$sentbox = "";
$newpm = "";
$pm_popup_script = "";
$pm_popup_header = "";
$pm = "";
$pm_inbox = "";
$pm_outbox = "";
$pm_sentbox = "";
$pm_new_count = "";

14
This mod works fine in 1.7.4 version
but fix this code!

with follow problems
-spam words not with name separate **** in admin control panel
-view not correct <a href= in user control panel and others

find in includes/functions.php

Code: [Select]
    }
     $text = str_replace("[hr]", "<hr>", $text);
  }
  $text = replace_url($text);
  if ($word_wrap && $text != "") {
    $text = preg_replace("/([^\n\r ?&\.\/<>\"\\-]{".$word_wrap."})/i", " \\1\n", $text);
  }
  $text = str_replace("\n", "<br />", $text);
  $text = str_replace("\\'", "'", $text);
  $text = str_replace("\\\"", "&quot;", $text);
  return replace_badwords(stripslashes($text));
}

and replace

Code: [Select]
    }
    $text = str_replace("[hr]", "<hr>", $text);
}
  if ($html !== 2) {
      $text = nl2br(trim($text));
      $text = replace_url($text);
}
  if ($word_wrap && $text != "") {
      $text = preg_replace("/([^\n\r ?&\.\/<>\"\\-]{".$word_wrap."})/i", " \\1\n", $text);
      $text = replace_badwords($text); 
}
  $text = str_replace("\n", "<br />", $text);
  $text = str_replace("\\'", "'", $text);
  $text = str_replace("\\\"", "&quot;", $text);

  return $text;
}

15
in /includes/page_header.php

Code: [Select]
//-----------------------------------------------------
//--- pm ---------------------------------------------
//-----------------------------------------------------
$inbox = "";
$outbox = "";
$sentbox = "";
$newpm = "";
$pm_popup_script = "";
$pm_popup_head = "";
$pm = "";

maybe correct 
Code: [Select]
$pm_popup_header = "";      :?:

Pages: [1] 2 3