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

Pages: [1]
1
90% of the mod: V@no/Jan

A part of this mod was already published in this forum, but unfortunately it got lost after the hack.

Step 1: Create new users called for example "searchbot" and "googlebot" (or any other aditional you want...)  with password "12345"
(you may use any username or password you want, but then you will need to change the code)
The password 12345 is just for "demonstration" - please use another one for your bots and replace 12345 in the code with your new password...
If you decide not to do that, everybody can visit your page as a "bot"


Step 2: Create a new usergroup "searchbots" and set all bot-users as members of this group.

Step 3: in includes/sessions.php find:

Code: [Select]
$site_sess = new Session();
and replace it with:

Code: [Select]
// mod GoogleBot
$site_sess = new Session();
$robots = array(
"FAST-WebCrawler" => "searchbot",
"Gulliver" => "searchbot",
"AltaVista" => "searchbot",
"Alexibot" => "searchbot",
"asterias" => "searchbot",
"BackDoorBot" => "searchbot",
"Black.Hole" => "searchbot",
"BlowFish" => "searchbot",
"BotALot" => "searchbot",
"NPBot" => "searchbot",
"Pompos" => "searchbot",
"Scooter" => "searchbot",
"SiteSnagger" => "searchbot",
"Slurp" => "searchbot",
"WebmasterWorldForumBot" => "searchbot",
"zyborg" => "searchbot",
"Google" => "googlebot",
"msnbot" => "searchbot",
"ZACATEK_CZ_BOT" => "searchbot",
"EARTHCOM.info" => "searchbot",
"sherlock" => "searchbot",
"Holmes" => "searchbot",
"ia_archiver" => "searchbot",
"lwp-trivial" => "searchbot",
"appie" => "searchbot",
"Scooter" => "searchbot",
"Gigabot" => "searchbot",
"Wget" => "searchbot",
"jyxobot" => "searchbot",
"Xenu Link Sleuth" => "searchbot",
"SeznamBot" => "searchbot",
);
foreach($robots as $key => $val) {
  if(!$_SERVER['HTTP_USER_AGENT'] || preg_match("/".$key."/i", $_SERVER['HTTP_USER_AGENT'])) {
    $site_sess->login($val, "12345");
    $user_bot = 1;
    break;
  }
}

You may add or remove other bots's useragent names as you like or try to put MSIE there for a while, so you may see, how the bot will see the pages... don't forget to delete MSIE from the array aftewards, otherwise ALL your visitors will be logged in as bots ;) (well, or you could just login as a searchbot :) but if you do that and you do hide the userbox for searchbots, you have to delete the cookies, to login back again under your "real" account.)

Step 4.1: If you did not install Conditional User Group template tags yet, follow the next steps
Open includes/page_header.php and search for each
Code: [Select]
if ($user_info['user_level'] >= USER) {add the following code above
Code: [Select]
$usergroups = array();AND add the following code below
Code: [Select]
  $current_time = time();
  $sql = "SELECT group_id 
          FROM ".GROUP_MATCH_TABLE."
          WHERE user_id = ".$user_info['user_id']."
          AND groupmatch_startdate <= $current_time
          AND (groupmatch_enddate > $current_time OR groupmatch_enddate = 0)";
  $result = $site_db->query($sql);

  while ($row = $site_db->fetch_array($result)) {
    $usergroups[$row['group_id']] = true;
  }
Step 4.2 search for
Code: [Select]
//-----------------------------------------------------
//--- User Box ----------------------------------------
//-----------------------------------------------------
and add the following code above
Code: [Select]
$site_template->register_vars(array(
"is_bot" => (isset($usergroups[XXX])) ? 1 : 0
));
Where XXX has to be replaced with the number of the usergroup. (If you don't know, how to find out the number of the usergroup, look here)
and from now on you may use this tag:

{if is_bot}
 This will appear only for the searchbots...
{endif is_bot}

if you want to hide some parts or disable some functions for the searchbots, install [MOD] Adding {ifno tagname1}{tagname2}{endifno tagname1} v1.7/v1.7.1
and you will be able to disable :) thes parts by
Code: [Select]
{ifnot is_bot}
This code will not be shown to searchbots
{endifnot is_bot}

On my site bots may browse the pages, but they can't see links to: download, favorities, user-profile, private messages, logout etc.

That should be everything...
Tell me if it works for you - I did not try it out "again" on a fresh install, so I could forget something...

2
Hi,

maybe it is a simple task, but I could not figure out, how to do that...

I'd like to switch off certain parts of the site for special users or for a special usergroup.

Like: I don't want to show user_logininfo and the user information to these users - so they may not change their details and they won't see the lightbox etc. ...

Would be something like {ifnot group_id_1} {endifnot group_id_1} or something similar possible...

and on the other hand I'd like to do the absolute oposite: show members of this group certain things, which other users might not see...

Maybe that feature is already built in and I just don't know how to use it...

P.S.: yes I know I may set up usergroups for additional rights (when "private" is set), but that's not exactly what I want...

Thank you in advance!

3
Hi,

maybe somebody could give me a helping hand with these two tweaks:

1) Reserved usernames
I'd like to have some usernames reserved for further use - so nobody could open an account with these names as long as I "forbid" (or better reserve) it.
(So nobody can register as administrator / root / username / motherf***er / this site sucks etc.)
And if some user tries to register with this name, 4images would say:

"Sorry, this username is reserved. Please try to use another one."

It's clear, that I may create a number of accounts for all these usernames - but I would have a number of "dead" accounts with useless db-entries in that case...

2) Filtering chars
If a visitor tries to register with a username containing high ascii chars (ž ř č š ě etc.) 4 images should
 a) warn him/her, that it could cause problems on systems with different keyboard lay-outs and give the chance to change it
or
 b) give an error like "Please don't use ř ž č š ě in your password or username. Using these characters could prevent you from logging in on other computers."
or
 c) change the characters to its "non high ascii" equivalent (e.g. ř = r, š = s) and tell the user something like "Your username was changed to <username without high ascii>."



Can somebody please help me with these features?

Thanks in advance.

4
if a user (if allowed, not admin :wink:) edits the image-details or a comment and posts the changes, he'll get stuck on a page just saying "Image edited successfully" or "Comment editet successfully"...
This tiny mod brings the user automaticaly back to the image-detail after posting the data...

Part 1) Go back, after editing image details
open member.php and look for:

Code: [Select]
       add_searchwords($image_id, $search_words);
       $msg = $lang['image_edit_success'];

add below

Code: [Select]
      header("Refresh: 2; url=".$site_sess->url(ROOT_PATH."details.php?image_id=".$image_id, "&")); // refresh after edit MOD
save, but leave open, if want to implement part 2 also ;)

If 2 seconds is not enough for you, than just change that... you'd know where  :wink:


Part 2) Go back after editing comment

open ./member.php
and find
Code: [Select]
$msg = ($result) ? $lang['comment_edit_success'] : $lang['comment_edit_error'];
replace with:
Code: [Select]
// start - go automaticaly back to image after "editcomment"
    $sql = "SELECT image_id
            FROM ".COMMENTS_TABLE."
            WHERE comment_id = $comment_id";
    $id_result = $site_db->query($sql);
$row = $site_db->fetch_array($id_result);
$image_id = $row['image_id'];
// end - go automaticaly back to image after "editcomment"
    $msg = ($result) ? $lang['comment_edit_success'] : $lang['comment_edit_error'];
// start - go automaticaly back to image after "editcomment"
header("Refresh: 2; url=".$site_sess->url(ROOT_PATH."details.php?image_id=".$image_id, "&"));
// end - go automaticaly back to image after "editcomment"

Also here it is set to 2 seconds. I won't tell you where to change that, 'cause it's obvious ;)

I thought I could manage the second part without a new SQL query, but i could not... maybe someone out there could teach me a better way :D

Part 3 would be a User-editation system :) Maybe someone has this already - I mean: the user may edit his comments (if allowed from the ACP)

Have fun

5
Originally posted by / Author: Lucifix

1.) copy the file "install_profile_hits.php" from the attachment in your root and call it to. (www.yourDomain.xx/install_profile_hits.php)

2.) search in includes/db_field_definitions.php "?>" and insert above:

//############ Mod Profile Hits #################
$additional_user_fields['user_profile_hits'] = array($lang['user_profile_hits'], "text"0);


3.) search in lang/yourLanguage/main.php:

//--- Users -------------------------------------------
//-----------------------------------------------------

insert below:
(english)

$lang
['user_profile_hits'] = "Profile hits:";

(deutsch)

$lang
['user_profile_hits'] = "Profil hits:";


4.) search in member.php section ($action == "showprofile"):

    $site_template
->register_vars(array(
      
"user_id" => $user_row['user_id'],

replace:

//############ Start Profile Hits #################
if ($user_info['user_level'] != ADMIN) { 
  
$sql "UPDATE ".USERS_TABLE.
          SET user_profile_hits = user_profile_hits + 1 
          WHERE user_id = 
$user_id"
  
$site_db->query($sql); 
}
//############ End Profile Hits ##################
    
$site_template->register_vars(array(
      
"user_id" => $user_row['user_id'],
      
"user_profile_hits" => ($user_row['user_profile_hits']),//############ Mod Profile Hits ##################


5.) search in templates/yourTemplates/member_profile.html:
Code: [Select]
         <td class="row1">{user_comments}</td>
        </tr>
insert below:
Code: [Select]
<tr>
  <td class="row2"><b>{lang_user_profile_hits}</b></td>
  <td class="row2">{user_profile_hits}</td>
</tr>

I did just re-publish that mod.
You should know, that there were some "unsolved" things around it for some users, but I don't have the "second" page of that mod saved anymore, so I do not know if somebody did find the solution :(
So tell me, if it works...

have fun

6
Chit Chat / V@no and sleep
« on: April 22, 2005, 09:45:14 AM »
Keeping in track of V@no's incredible support and help to all the people here in the forum doesn't allow me to leave this question un-asked:  :)

Do you ever sleep V@no?  :D


7
Originally posted/Author: Cr@zy Sash

Eigentlich mehr ne Spielerei als ein Mod. *gg* ;)
Well not really a mod. *gg*  ;)


Übersicht: / Overview:


Mit diesem Mod kannst du den aktuellen Monat als Kalender anzeigen lassen. /
You may show the actual month as a calendar with this mod

Geänderte Dateien: / Changed files:


- includes/page_header.php
- lang/<deine Sprache>/main.php
- templates/<dein Template>/style.css

Neue Dateien: / New files:


- templates/<dein Template>/calendar.html

Installation

WICHTIG: Mache vorher von diesen Dateien ein Backup
IMPORTANT: Before implementing this mod - back-up your files

1.)
Öffne die Datei includes/page_header.php und füge folgenen Code ein: /
Open includes/page_header.php and add this code:

Code: [Select]
//-----------------------------------------------------
//--- Calendar ----------------------------------------
//-----------------------------------------------------
$dat = time();
$dat0 = getdate($dat);
$datj=$dat0[month]." ".$dat0[year];
if($calshow==""){$calshow=$dat0[month]." ".$dat0[year];}
$dath=$calshow;
$calshow="";
$dat5="1 ".$dath;
$dat1 = getdate(strtotime($dat5));
$dat2 = getdate(strtotime($dat5." -1 month"));
$datr=$dat2[month]." ".$dat2[year];
$dat3 = getdate(strtotime($dat5." +1 month"));
$datv=$dat3[month]." ".$dat3[year];
$erster=$dat1[wday];

if($erster!=1){
  if($erster==0){$erster=7;}
  $calendar_data = "<tr>";
  for($i=0;$i<$erster-1;$i++){$calendar_data .= "<td class=\"smalltext\">&nbsp;</td>";}
  }
for($i=1;$i<=31;$i++){
  $dat4 = getdate(strtotime($i." ".$dath));
  $heute=$dat4[wday];
  if($heute==0){$heute=7;}
  if($dat1[mon]==$dat4[mon]){
    $stil="calat";
    $dum1=$dat0[mday].".".$dat0[mon].".".$dat0[year];
    $dum2=$dat4[mday].".".$dat4[mon].".".$dat4[year];
    if($dum1==$dum2){
      if(($heute==6) || ($heute==7)){$stil="calht";}else{$stil="calht";}
      }
      else{
      if(($heute==6) || ($heute==7)){$stil="calwe";}else{$stil="smalltext";}
      }
    if ($i<=9){$k="0";}else{$k="";}
    if($heute==1){$calendar_data .= "<tr>";}
    $calendar_data .= "<td align=\"center\" class=\"".$stil."\">".$k.$i."</td>";
    if($heute==7){$calendar_data .= "</tr>";}
    $j=$heute;
    }
  }
if ($j!=7){
  for ($i=0;$i<7-$j;$i++){$calendar_data .= "<td class=\"smalltext\"></td>";}
  $calendar_data .= "</tr>";
  }
$calendar_data .= "</table></td></tr></table></td></tr></table>";

1.a) for 4images 1.7 add this code below:
Code: [Select]
$calendar = $site_template->parse_template("calendar");
$site_template->register_vars(array(
    "calendar" => $calendar,
    "calendar_data" => $calendar_data,
    "lang_calendar" => $lang['lang_calendar'],
    "lang_mo" => $lang['lang_mo'],
    "lang_di" => $lang['lang_di'],
    "lang_mi" => $lang['lang_mi'],
    "lang_do" => $lang['lang_do'],
    "lang_fr" => $lang['lang_fr'],
    "lang_sa" => $lang['lang_sa'],
    "lang_so" => $lang['lang_so']
  ));
  unset($calendar);

1.b) for 4images 1.7.1 add this code below:
Code: [Select]
$site_template->register_vars(array(
   "calendar_data" => $calendar_data,
   "lang_calendar" => $lang['lang_calendar'],
   "lang_mo" => $lang['lang_mo'],
   "lang_di" => $lang['lang_di'],
   "lang_mi" => $lang['lang_mi'],
   "lang_do" => $lang['lang_do'],
   "lang_fr" => $lang['lang_fr'],
   "lang_sa" => $lang['lang_sa'],
   "lang_so" => $lang['lang_so']
 ));
$site_template->register_vars("calendar", $site_template->parse_template("calendar"));


2.)
Öffne die lang/<deine Sprache>/main.php und füge folgendes ein: /
Open lang/<yourlanguage>/main.php and add this code:
     2a) Deutsch
Code: [Select]
//-----------------------------------------------------
//--- Calendar ---------------------------------------
//-----------------------------------------------------
$lang['lang_calendar'] = "Kalender";
$lang['lang_mo'] = "Mo";
$lang['lang_di'] = "Di";
$lang['lang_mi'] = "Mi";
$lang['lang_do'] = "Do";
$lang['lang_fr'] = "Fr";
$lang['lang_sa'] = "Sa";
$lang['lang_so'] = "So";
     2b) English
Code: [Select]
//-----------------------------------------------------
//--- Calendar ---------------------------------------
//-----------------------------------------------------
$lang['lang_calendar'] = "Calendar";
$lang['lang_mo'] = "Mo";
$lang['lang_di'] = "Tu";
$lang['lang_mi'] = "We";
$lang['lang_do'] = "Th";
$lang['lang_fr'] = "Fr";
$lang['lang_sa'] = "Sa";
$lang['lang_so'] = "Su";

3.)
Öffne templates/<dein Template>/style.css und füge das ein:
Open templates/<yourtemplate>/style.css and add the following:

Code: [Select]
.calht {
  color: Black;
  background-color:#FFCC00;
  font-family: verdana,arial,helvetica,sans-serif;
  font-size: xx-small;
  font-weight: bold;
}

.calwe {
  color: Red;
  font-family: verdana,arial,helvetica,sans-serif;
  font-size: xx-small;
}

4.)
Erstelle eine neue Datei templates/<dein Template>/calendar.html
Create a new file templates/<yourtemplate>/calendar.html

Code: [Select]
<table width="100%" border="0" cellspacing="0" cellpadding="1">
  <tr>
    <td class="head1">
      <table width="130" border="0" cellspacing="0" cellpadding="3">
        <tr>
          <td valign="top" class="head1">{lang_calendar}</td>
        </tr>
        <tr>
          <td valign="top" class="row2">
            <table border="0" cellpadding="0" cellspacing="0" width="100%">
              <tr>
                <td align="center" class="smalltext"><b>{lang_mo}</b></td>
                <td align="center" class="smalltext"><b>{lang_di}</b></td>
                <td align="center" class="smalltext"><b>{lang_mi}</b></td>
                <td align="center" class="smalltext"><b>{lang_do}</b></td>
                <td align="center" class="smalltext"><b>{lang_fr}</b></td>
                <td align="center" class="smalltext"><b>{lang_sa}</b></td>
                <td align="center" class="smalltext"><b>{lang_so}</b></td>
              </tr>
              {calendar_data}
             

Fertig!
Done!

Nun kannst du {calendar} überall in deinen Template nutzen.
You may now use {calendar} anywhere in your templates.

DEMO: http://crazy-pics.de.vu/
DEMO2:   ;) http://photo.overlord.cz

8
Feedback & Suggestions / Sessionid if posting a link to gallery
« on: April 01, 2005, 10:02:27 AM »
For your own security:
if you post links to your gallery, do not include the "sessionid=asdfadfagagagfadfasd" string in there.
Because if someone uses that link as long as the session is still "active" on the server, the visitor (following that link) gets "logged-in" as YOU!
If it was a session, in which you were logged-in as admin, then you could get in real trouble.  :wink:

2 Jan, V@no and Co.:

Shouldn't this be included in the MUST READ guidelines?
Just think, that it could cause big problems, if somebody missuses that...



have fun

9
If a visitor follows a direct link to a picture (like yourdomain.com/details.php?image_id=nnn for example from a search-engine, from the Favourities-Tab...) but is not authorized, 4images redirects the visitor automaticaly to the index page...

This insignificant modification tells the visitor that he's not authorized  first and after 6 seconds he's redirected to the index page...

------------------
Files changed:
------------------
./details.php
./lang/<yourlanguage>/main.php

open details.php

find:

Quote
if (!check_permission("auth_viewcat", $cat_id) || !check_permission("auth_viewimage", $cat_id) || !$image_row) {
  header("Location: ".$site_sess->url($url, "&"));
  exit;
}

replace with:
Code: [Select]
if (!$image_row) {
header("Location: " .$site_sess->url($url, "&"));
  exit;
}

if (!check_permission("auth_viewcat", $cat_id) || !check_permission("auth_viewimage", $cat_id) || !$image_row) {
header("Refresh: 6; url=".$site_sess->url($url, "&"));
if($user_info['user_level'] == GUEST) {
$error_msg = $lang['guest_not_authorized'];
}
else{ $error_msg = $lang['not_authorized'];
}
$clickstream = "<span class=\"clickstream\"><a href=\"".$site_sess->url(ROOT_PATH."index.php")."\" class=\"clickstream\">".$lang['home']."</a>".$config['category_separator'];
$clickstream .= get_category_path($cat_id, 1).$config['category_separator'];
$clickstream .= $image_id."</span>";
show_error_page($error_msg, $clickstream);
  exit;
}

save and close details.php

open ./lang/<yourlanguage>/main.php

at the end, just before ?> add this line:

Code: [Select]
$lang['guest_not_authorized'] = "You're not authorized to view this picture. <br>Try to register or log-in";
$lang['not_authorized'] = "You're not authorized to view this image.";

That's it.

Not the best way, how to do that, but the only way I'm able to and at least a solution :)

Woud be great, if somebody could help me  with a little addition to this: if a GUEST sees this error-message and logs-in directly from this error-page, he comes back to the picture (if authorized...)


[NEW]

And if you would like to show error page if visitor tryed to open category page whithout permission then in categories.php find:
Code: [Select]
if (!$cat_id || !isset($cat_cache[$cat_id]) || !check_permission("auth_viewcat", $cat_id)) {
  header("Location: ".$site_sess->url(ROOT_PATH."index.php", "&"));
  exit;
}

Replace with:
Code: [Select]
if (!$cat_id || !isset($cat_cache[$cat_id])) {
header("Location: " .$site_sess->url($url, "&"));
  exit;
}

if (!check_permission("auth_viewcat", $cat_id))
{
header("Refresh: 6; url=".$site_sess->url($url, "&"));
if($user_info['user_level'] == GUEST)
{
  $error_msg = $lang['cat_guest_not_authorized'];
}
else
{
  $error_msg = $lang['cat_not_authorized'];
}
$clickstream = "<span class=\"clickstream\"><a href=\"".$site_sess->url(ROOT_PATH."index.php")."\" class=\"clickstream\">".$lang['home']."</a></span>";
show_error_page($error_msg, $clickstream);
  exit;
}

And in lang/<your language>/main.php at the end, above closing ?> insert:
Code: [Select]
$lang['cat_guest_not_authorized'] = "You're not authorized to view this category. <br>Try to register or log-in";
$lang['cat_not_authorized'] = "You're not authorized to view this category.";

10
1) Would it be possible to add in "Auto Image Resizer" the possibility to pick a category on the search form?

2) Would it be possible to show thumbnails on the search results of the resizer.php?

Why?

Well I want to have pictures of a max width/height of 1024px in some 800px and in some only 128px in some categories.
The original resizer shows me nearly ALL the pictures out of my gallery if I choose 128 and then I have to pick manually all the pictures I want resize (and without seeing a thumbnail it is VERY hard)  :cry:

Any idea? Thanks in advance! :)

11
Originally posted by / Author: V@no

----- [ Overview ] -----

This mod will alow your members upload their photo that will be displayed in their profile.


----- [ Changed Files ] -----

member.php

includes/db_field_definitions.php
lang/<yourlanguage>/main.php
lang/<yourlanguage>/admin.php
admin/settings.php
admin/users.php
templates/<yourtemplate>/member_editprofile.html
templates/<yourtemplate>/member_profile.html
[/color]

----- [ New Files ]-----

userpic_install.php


----- [ New Folder ] -----

data/userpic/



----- [ Installation ] -----

Step 1
Open member.php
Find:

Code: [Select]
     "user_homepage_button" => $user_homepage_button,
Insert above:
Code: [Select]

//User Pic
      "userpic_img" => ($config['userpic'] && $user_row['userpic']) ? ROOT_PATH."data/userpic/".$user_row['userpic'] : "",
//End User Pic


Step 1.1
Find:

Code: [Select]
 if (!$error && $user_email != $user_info['user_email'] && $user_info['user_level'] != ADMIN && $config['account_activation'] != 0) {
Insert above:
Code: [Select]
// Upload User Pic
  $userpic = $userpic_new = "";
  if (!$error && $config['userpic'])
  {
    $userpics_dir = ROOT_PATH."data/userpic/";
    if (!empty($HTTP_POST_FILES['userpic_file']['tmp_name']) && $HTTP_POST_FILES['userpic_file']['tmp_name'] != "none")
    {
      if (isset($HTTP_COOKIE_VARS['userpic_file']) || isset($HTTP_POST_VARS['userpic_file']) || isset($HTTP_GET_VARS['userpic_file'])) {
        die("Security violation");
      }
      if (!function_exists("is_uploaded_file")) {
        function is_uploaded_file($file_name) {
          if (!$tmp_file = @get_cfg_var('upload_tmp_dir')) {
            $tmp_file = tempnam('','');
            $deleted = @unlink($tmp_file);
            $tmp_file = dirname($tmp_file);
          }
          $tmp_file .= '/'.basename($file_name);
          return (ereg_replace('/+', '/', $tmp_file) == $file_name) ? 1 : 0;
        }
      
        function move_uploaded_file($file_name, $destination) {
          return (is_uploaded_file($file_name)) ? ((copy($file_name, $destination)) ? 1 : 0) : 0;
        }
      }
      $error = array();
      $extensions = array(
        "jpg",
        "jpeg",
        "gif",
        "png"
      );
      $mime_types = array();
      $mime_type_match = array();
      include_once(ROOT_PATH.'includes/upload_definitions.php');
      foreach($extensions as $val)
        $mime_types = array_merge($mime_types, $mime_type_match[$val]);
      $mime_types = array_unique($mime_types);
      $userpic_ext = strtolower(substr(strrchr($HTTP_POST_FILES['userpic_file']['name'],"."), 1));
      $userpic_mime = $HTTP_POST_FILES['userpic_file']['type'];
      if (!in_array($userpic_mime, $mime_types) || !in_array($userpic_ext, $extensions))
      {
        $error[] = $lang['invalid_file_type']. " (".$userpic_ext.", ".$HTTP_POST_FILES['userpic_file']['type'].")";
      }
      if ($HTTP_POST_FILES['userpic_file']['size'] > $config['userpic_size'] * 1024)
      {
        $error[] = $lang['invalid_file_size'];
      }
      if (empty($error))
      {
        $userpic_name = $user_info['user_id'].".".$userpic_ext;
        $userpic_file = $userpics_dir.$userpic_name;
         if (file_exists($userpic_file))
         {
            unlink($userpic_file);
        }
        if (!move_uploaded_file($HTTP_POST_FILES['userpic_file']['tmp_name'], $userpic_file))
        {
          $error[] = $lang['file_copy_error'];
        }
        else
        {
          @chmod($userpic_file, CHMOD_FILES);
        }
      }
      if (empty($error))
      {
        $userpic = $HTTP_POST_VARS['userpic'] = $userpic_new = $userpic_name;
        if ($user_info['userpic'] != $userpic_name && file_exists($userpics_dir.$user_info['userpic']))
        {
          @unlink($userpics_dir.$user_info['userpic']);
        }
        if (!function_exists(init_convert_options))
        {
          require(ROOT_PATH.'includes/image_utils.php');
        }
        $image_info = getimagesize($userpic_file);
        $convert_options = init_convert_options();
        if (($image_info[0] > $config['userpic_width'] || $image_info[1] > $config['userpic_height']))
        {
          if ($convert_options['convert_error'] || (!$convert_options['convert_error'] && !resize_image($userpic_file, 85, $config['userpic_width'], 1, $config['userpic_height'])))
          {
            if ($image_info[0] > $config['userpic_width'])
            {
              $error[] = $lang['invalid_image_width'];
            }
            if ($image_info[1] > $config['userpic_height'])
            {
              $error[] = $lang['invalid_image_height'];
            }
          }
        }
      }
      if (!empty($error))
      {
        $msg .= (($msg != "") ? "<br />" : "")."<b>".$lang['file_upload_error'].": ".$HTTP_POST_FILES['userpic_file']['name']."</b><br />";
        foreach ($error as $val) {
          $msg .= "<b>".$HTTP_POST_FILES['userpic_file']['name'].":</b> ".$val."<br />";
        }
        $HTTP_POST_VARS['userpic'] = $user_info['userpic'];
      }
    }
    else
    {
      if (isset($HTTP_POST_VARS['userpic_del']) && $HTTP_POST_VARS['userpic_del'])
      {
        @unlink($userpics_dir.$user_info['userpic']);
        $HTTP_POST_VARS['userpic'] = $userpic = "";
        $userpic_new = 1;
      }
    }
  }
// End Upload User Pic


Step 1.2
Find:
Code: [Select]
   "user_showemail_yes" => $user_showemail_yes,
Insert above:
Code: [Select]
//User Pic
    "userpic_allowed" => $config['userpic'],
    "userpic_img" => ($user_info['userpic']) ? ROOT_PATH."data/userpic/".$user_info['userpic'] : "",
    "lang_userpic_del" => $lang['userpic_del'],
    "lang_userpic_upload" => preg_replace("/".$site_template->start."userpic_max_size".$site_template->end."/siU", $config['userpic_size']."&nbsp;".$lang['kb'], preg_replace("/".$site_template->start."userpic_max_width".$site_template->end."/siU", $config['userpic_width'], preg_replace("/".$site_template->start."userpic_max_height".$site_template->end."/siU", $config['userpic_height'], $lang['userpic_upload']))),
    "userpic_max_width" => $config['userpic_width'],
    "userpic_max_height" => $config['userpic_height'],
    "userpic_max_size" => $config['userpic_size']."&nbsp;".$lang['kb'],
//End User Pic



Step 2
Open includes/db_field_definitions.php
At the end, above closing ?> insert:
Code: [Select]
$additional_user_fields['userpic'] = array($lang['userpic'], "text", 0);


Step 3
Open lang/<yourlanguage>/main.php
At the end, above closing ?> insert:

Code: [Select]
//-----------------------------------------------------
//--- User Pic ----------------------------------------
//-----------------------------------------------------
$lang['userpic'] = "Personal picture";
$lang['userpic_del'] = "Remove";
$lang['userpic_upload'] = "Maximum image size: {userpic_max_size}.<br />Image larger {userpic_max_width}x{userpic_max_height} will be resized";
$lang['file_copy_error'] = "Copy error. Please check the directory permissions.";
//--- End User Pic ------------------------------------



Step 4
Open lang/<yourlanguage>/admin.php
At the end, above closing ?> insert:
Code: [Select]
//User Pic
/*-- Setting-Group Member Personal Photo --*/
$setting_group['memberpersonalphoto']="Personal Picture";
$setting['userpic'] = "Activate";
$setting['userpic_size'] = "Max. image size in KB";
$setting['userpic_width'] = "Max. image width in pixel";
$setting['userpic_height'] = "Max. image height in pixel";
//End User Pic



Step 5
Open admin/settings.php
Find:
Code: [Select]
 show_form_footer($lang['save_changes'], "", 2);
Insert above:
Code: [Select]
//User Pic
  show_table_separator($setting_group['memberpersonalphoto'], 2, "setting_group_memberpersonalphoto");
  show_setting_row("userpic", "radio");
  show_setting_row("userpic_width");
  show_setting_row("userpic_height");
  show_setting_row("userpic_size");
//End User Pic



Step 6
Open templates/<yourtemplate>/member_editprofile.html
Find:
Code: [Select]
<form method="post" action="{url_member}">
Replace it with:
Code: [Select]
<form method="post" action="{url_member}" enctype="multipart/form-data">
or just make sure that enctype="multipart/form-data" is present inside the <form> tag.


Step 6.1
Find:
Code: [Select]
         <tr>
            <td class="row2"><b>{lang_icq}</b></td>
            <td class="row2"><input type="text" name="user_icq"  size="30" value="{user_icq}" class="input" /></td>
          </tr>

Insert below:
Code: [Select]
{if userpic_allowed}
          <tr>
            <td class="row1" valign="top"><b>{lang_userpic}</b>
              <SPAN class="smalltext">
                <br />
                <B>{lang_userpic_upload}</B>
              </SPAN>
            </td>
            <td class="row1">
              <INPUT type="file" name="userpic_file"  size="30" class="input" /><br />
              {if userpic_img}<img src="{userpic_img}"><br /><input type="checkbox" name="userpic_del" value="1">&nbsp;{lang_userpic_del}{endif userpic_img}
            </TD>
          </TR>
{endif userpic_allowed}
(ofcourse u can add it anywhere u want in this file)



Step 7 updated 28.6.2006
Open templates/<yourtemplate>/member_profile.html
Find:
Code: [Select]
       <tr>
          <td class="row2"><b>{lang_icq}</b></td>
          <td class="row2">{if user_icq}<a href="http://wwp.icq.com/scripts/search.dll?to={user_icq}">{user_icq}</a> (<b>{user_icq_status}</b>){endif user_icq}</td>
        </tr>

Replace with:
Code: [Select]
       <tr>
          <td class="row2"><b>{lang_icq}</b></td>
          <td class="row2">{if user_icq}<a href="http://www.icq.com/people/about_me.php?uin={user_icq}">{user_icq}</a> (<b>{user_icq_status}</b>){endif user_icq}</td>
        </tr>
{if userpic_img}
        <tr>
          <td class="row1" valign="top"><b>{lang_userpic}</b></td>
          <td class="row1"><img src="{userpic_img}"></td>
        </tr>
{endif userpic_img}



Step 8
Create a new folder: data/userpic/
Set CHMOD 777 (unix systems only) and make sure its writible by your webserver.



Step 9
Download this package, extract it and upload to your 4images root directory, then execute it by typing in your browser: http://<your_site_address_and_path_to_your_4images>/userpic_install.php
Follow the instructions.

Or u can update your database manualy by executing this MySQL query:
Code: [Select]
ALTER TABLE `4images_users` ADD `userpic` varchar(255) NOT NULL default '';
INSERT INTO `4images_settings` ( `setting_name` , `setting_value` ) VALUES ('userpic', '1');
INSERT INTO `4images_settings` ( `setting_name` , `setting_value` ) VALUES ('userpic_size', '500');
INSERT INTO `4images_settings` ( `setting_name` , `setting_value` ) VALUES ('userpic_width', '200');
INSERT INTO `4images_settings` ( `setting_name` , `setting_value` ) VALUES ('userpic_height', '200');



Step 10
Step 10 and 11 required if your would like display members photos on their images details page (details.php)
Open details.php
Find:
Code: [Select]
$additional_sql = "";Insert below:
Code: [Select]
if (!empty($additional_user_fields)) {
  foreach ($additional_user_fields as $key => $val) {
    $additional_sql .= ", u.".$key;
  }
}
(if this block of code is already present in details.php, then u dont need doublicate it ;))



Step 11
Open includes/functions.php
Find:
Code: [Select]
 if (!empty($additional_image_fields)) {Insert above:
Code: [Select]
 if (!empty($additional_user_fields)) {
    $additional_field_array = array();
    foreach ($additional_user_fields as $key => $val) {
      if ($key != "userpic" || ($key == "userpic" && $config['userpic']))
      {
        $additional_field_array[$key] = (!empty($image_row[$key])) ? format_text($image_row[$key], 1) : REPLACE_EMPTY;
        $additional_field_array['lang_'.$key] = $val[0];
      }
    }
    if (!empty($additional_field_array)) {
      $site_template->register_vars($additional_field_array);
    }
  }

Now you can use {userpic} in details.html template.



Step 12
This steps 12 - 13 are required if you would like show members photos in their comments.
Open details.php
Find:
Code: [Select]
$sql = "SELECT c.comment_id, c.image_id, c.user_id, c.user_name AS comment_user_name, c.comment_headline, c.comment_text, c.comment_ip, c.comment_date".get_user_table_field(", u.", "user_level").get_user_table_field(", u.", "user_name").get_user_table_field(", u.", "user_email").get_user_table_field(", u.", "user_showemail").get_user_table_field(", u.", "user_invisible").get_user_table_field(", u.", "user_joindate").get_user_table_field(", u.", "user_lastaction").get_user_table_field(", u.", "user_comments").get_user_table_field(", u.", "user_homepage").get_user_table_field(", u.", "user_icq")."Replace it with:
Code: [Select]
 $sql = "SELECT c.comment_id, c.image_id, c.user_id, c.user_name AS comment_user_name, c.comment_headline, c.comment_text, c.comment_ip, c.comment_date".get_user_table_field(", u.", "user_level").get_user_table_field(", u.", "user_name").get_user_table_field(", u.", "user_email").get_user_table_field(", u.", "user_showemail").get_user_table_field(", u.", "user_invisible").get_user_table_field(", u.", "user_joindate").get_user_table_field(", u.", "user_lastaction").get_user_table_field(", u.", "user_comments").get_user_table_field(", u.", "user_homepage").get_user_table_field(", u.", "user_icq").", u.userpic

Step 12.1
Find:
Code: [Select]
       "comment_user_ip" => $comment_user_ip,Insert below:
Code: [Select]
       "comment_userpic" => ($config['userpic'] && $comment_row[$i]['userpic']) ? ROOT_PATH."data/userpic/".$comment_row[$i]['userpic'] : "",


Step 13
Insert in templates/<your_template>/comment_bit.html (whereever u want the member's pic to be displayed. Design is your job ;))
Code: [Select]
{if comment_userpic} <img src="{comment_userpic}">{endif comment_userpic}


Step 14
In admin/users.php find:
  $sql "SELECT ".get_user_table_field("""user_id").get_user_table_field(", ""user_name")."
          FROM "
.USERS_TABLE."
          WHERE "
.get_user_table_field("""user_id")." IN ($user_ids)";
  
$user_result $site_db->query($sql);
  
$image_ids_sql "";
  while (
$user_row $site_db->fetch_array($user_result)) {
    
$user_id $user_row[$user_table_fields['user_id']];
    
$user_name $user_row[$user_table_fields['user_name']];


Replace with:
  $sql "SELECT ".get_user_table_field("""user_id").get_user_table_field(", ""user_name").", userpic
          FROM "
.USERS_TABLE."
          WHERE "
.get_user_table_field("""user_id")." IN ($user_ids)";
  
$user_result $site_db->query($sql);
  
$image_ids_sql "";
  while (
$user_row $site_db->fetch_array($user_result)) {
    
$user_id $user_row[$user_table_fields['user_id']];
    
$user_name $user_row[$user_table_fields['user_name']];
    if (
$user_row['userpic'] && file_exists(ROOT_PATH."data/userpic/".$user_row['userpic']) && is_file(ROOT_PATH."data/userpic/".$user_row['userpic']))
    {
      
unlink(ROOT_PATH."data/userpic/".$user_row['userpic']);
    }


----- [ Addons ] -----

[/list]


----- [ Version History ] -----

1.1.3 (2011-10-23)
    - Updated step 1.1, 4 and 5

1.1.2
    - Added Step 14 that deletes user personal photos when user is deleted. (Thanks to alekinna)

1.1.1
    - Fixed some tags not being displayed in the edit profile (redo Step 1.2)

1.1
    - Added optional Steps 10 - 13

1.0
    - Original release

12
Author of modification: V@no

Always when a checkbox appears on the internet I tend to click on the description text next to the checkbox... but it doesn't change the state of the CBox 

This tiny mod allows the user to change the „auto_login“-checkbox state by clicking the text next to it… and not only by clicking the "small" CheckBox itself.

open {your_template}/user_loginform.html

find:

Code: [Select]
<td><span class="smalltext">{lang_auto_login}</span></td>
change to:

Code: [Select]
<td><span class="smalltext" onClick="if(auto_login.checked) auto_login.checked=false; else auto_login.checked=true;" style="cursor:default;">{lang_auto_login}</span></td>

13
Mods & Plugins (Requests & Discussions) / [MOD] Completely hide admins
« on: March 11, 2005, 11:23:41 PM »
Author: V@no

If you'd like to prevent the administrators from being shown in the "users online" list:

open includes/sessions.php
and replace
Code: [Select]
WHERE s.session_lastaction >= $time_out
with

Code: [Select]
WHERE s.session_lastaction >= $time_out AND u.user_level <> ".ADMIN."

14
Language Packs / [Language] Czech-Česky (formal/informal)
« on: March 11, 2005, 10:35:59 PM »
Here's the informal czech language pack I use on my gallery:
Tady je "neformální" (tykání) český jazykový balíček, který používám ve své galerii:

http://overlord.cz/download/czech.zip

Doporučuji následující úpravu:
I recomend this modification:
[Fix] Vote(s), Page(s), Image(s), User(s) & Guest(s)


Určitě si jej budete muset trochu upravit "k obrazu svému"  :wink: Ale to by nemělo být zas tak těžké  8)

můj "neformální" balíček vychází v podstatě z celkem povedeného překladu od Tomav:


Here's the formal czech language pack from Tomv:
Tady je "formální" (vykání) český jazykový balíček od uživatele Tomv:

http://www.insect.cz/4images/czech.zip

Pages: [1]