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

Pages: [1]
1
[ Introduction ]
This Mod prevents spamming from Bots in your Guestbook and Commnts,
if you allowed guests to post there.

[ Features ]
This Mod works with an security code,
which must be validated when posting.
The security code is submitted using session system and javascript,
so users which have enabled javascript (which usually most users have),
doesn't notice anything.
users that disabled javascript have to enter the security code manually.
This is an great advantage compared to the captcha solution,
where every user have to enter this code, what is very uncomfortable in my opinion.
You can choose yourself if you use this mod only for guestbook/comments or for both.

[ Notes ]
At the moment the security code is on an very low level,
and not encrypted or anything else,
but it should anyway work.
If somebody gets anyway spam, he/she should contact me,
then i will upgrade this mod.
This mod works with 1.71 & 1.72
other versions are untested.

[ Changed Files ]
for Guestbook:
 - guestbook.php
 - templates/guestbook_form.html
for comments:
 - details.php
 - templates/comment_form.html
lang/your language/main.php

[ Installation ]

First Backup your Files.
Donwload the rar archive: Link
Just log in as 4images/4images
Of course you can also create your own account (no email verification is needed, cause its an testboard).
Demo can be also seen there.

Step 1
Open lang/your language/main.php
Before ?> insert
Code: [Select]
//-----------------------------------------------------
//--- Anti Spam Mod -----------------------------------
//-----------------------------------------------------
$lang['enter_secure_code'] = "Please enter Security Code";
$lang['spamcode_error'] = "Security Code Validation failed";

or in German:
Code: [Select]
//-----------------------------------------------------
//--- Anti Spam Mod -----------------------------------
//-----------------------------------------------------
$lang['enter_secure_code'] = "Bitte Sicherheitscode vom Bild eingeben";
$lang['spamcode_error'] = "Sicherheitscode Überprüfung fehlgeschlagen";


For Guestbook Protection follow Step 2 & 3.
For Comment Protection follow Step 4 & 5.

Step 2
Open guestbook.php
Scroll down where you can find
Code: [Select]
//-----------------------------------------------------
//--- Save Comment ------------------------------------
//-----------------------------------------------------
In this part find:
Code: [Select]
$comment_mail = un_htmlspecialchars(trim($HTTP_POST_VARS['comment_mail']));and insert below:
Code: [Select]
$prevent_code = (isset($HTTP_POST_VARS['prevent_code'])) ? intval(trim($HTTP_POST_VARS['prevent_code'])) : 0;
in this section find:
Code: [Select]
   if (!$error)  {
      if ($comment_site =="http://") {
insert above:
Code: [Select]
   /** Anti_Spam Mod **/
   if ($site_sess->get_session_var('guestbook_code')) {
      $guestbook_code = stripslashes($site_sess->get_session_var('guestbook_code'));
      $site_sess->drop_session_var('guestbook_code');
   }
   else $guestbook_code = 0;

   if (!$guestbook_code || $prevent_code != $guestbook_code)  {
      $msg .= (($msg != "") ? "<br />" : "").$lang['spamcode_error'];
      $error = 1;
    }
   /** Anti_Spam Mod **/


search for:
Code: [Select]
      $comment_user_name = (isset($HTTP_POST_VARS['comment_user_name']) && $error) ? stripslashes(htmlspecialchars(trim($HTTP_POST_VARS['comment_user_name']))) : (($user_info['user_level'] != GUEST) ? htmlspecialchars($user_info['user_name']) : "");
  $comment_site = (isset($HTTP_POST_VARS['comment_site']) && $error) ? stripslashes(htmlspecialchars(trim($HTTP_POST_VARS['comment_site']))) : "http://";

  $site_template->register_vars(array(
      "bbcode" => $bbcode,
and replace with:
Code: [Select]
  $comment_user_name = (isset($HTTP_POST_VARS['comment_user_name']) && $error) ? stripslashes(htmlspecialchars(trim($HTTP_POST_VARS['comment_user_name']))) : (($user_info['user_level'] != GUEST) ? htmlspecialchars($user_info['user_name']) : "");
  $comment_site = (isset($HTTP_POST_VARS['comment_site']) && $error) ? stripslashes(htmlspecialchars(trim($HTTP_POST_VARS['comment_site']))) : "http://";

   /** Anti_Spam Mod **/
   mt_srand((double)microtime() * 1000000);
   $prevent_code = mt_rand(10000, 99999);
   $site_sess->set_session_var('guestbook_code', addslashes($prevent_code));
   $secure_image = '';
   for ($i = 0; $i < 5; $i++) {
       $secure_image .= '<img src="'.get_gallery_image("captcha".substr($prevent_code,$i,1).".gif").'" border="0" alt="" />';
   }
   /** Anti_Spam Mod **/


  $site_template->register_vars(array(
      "lang_enter_secure_code" => $lang['enter_secure_code'],
      "secure_image" => $secure_image,
      "prevent_code" => $prevent_code,
      "bbcode" => $bbcode,

Step 3
Open templates/guestbook_form.html
search for:
Code: [Select]
                <tr>
                  <td width="90" valign="top">&nbsp;</td>
                  <td>{bbcode}</td>
                </tr>
and insert below:
Code: [Select]
                <tr>
                    <td width="90" valign="top"></td>
                    <td>
                    <noscript>
                       <table>
                         <tr>
                           <td>{secure_image} </td>
                           <td><input type="text" name="prevent_code" value="" size="5" /> </td>
                         </tr>
                         <tr><td colspan="2"><b>{lang_enter_secure_code}</b></td>
                         </tr>
                        </table>
                    </noscript>
                  <script type="text/javascript">
                  function spamcode () {
                       var spamy = {prevent_code};
                       document.getElementsByName("prevent_code")[0].value = spamy;
                  }
                  document.write('<input type="hidden" name="prevent_code" value="0" \/>');
                  </script>
                    </td>
               </tr>

search for:
Code: [Select]
<input type="submit" name="postbutton" value="{lang_post_guestbook}" class="button" />and replace with:
Code: [Select]
<input type="submit" name="postbutton" value="{lang_post_guestbook}" onclick="spamcode()" class="button" />


Step 4
open details.php
search for:
Code: [Select]
$comment_text = un_htmlspecialchars(trim($HTTP_POST_VARS['comment_text']));insert below:
Code: [Select]
$prevent_code = (isset($HTTP_POST_VARS['prevent_code'])) ? intval(trim($HTTP_POST_VARS['prevent_code'])) : 0;
search for:
Code: [Select]
    if ($user_name == "")  {
      $msg .= (($msg != "") ? "<br />" : "").$lang['name_required'];
      $error = 1;
    }
and insert below:
Code: [Select]
   /** Anti_Spam Mod **/
   if ($site_sess->get_session_var('comment_code')) {
      $comment_code = stripslashes($site_sess->get_session_var('comment_code'));
      $site_sess->drop_session_var('comment_code');
   }
   else $comment_code = 0;

   if (!$comment_code || $prevent_code != $comment_code)  {
      $msg .= (($msg != "") ? "<br />" : "").$lang['spamcode_error'];
      $error = 1;
    }
   /** Anti_Spam Mod **/

search for (in 4images v1.71):
Code: [Select]
    $comment_text = (isset($HTTP_POST_VARS['comment_text']) && $error) ? stripslashes(htmlspecialchars(trim($HTTP_POST_VARS['comment_text']))) : "";

    $site_template->register_vars(array(
      "bbcode" => $bbcode,
and replace with:
Code: [Select]
    $comment_text = (isset($HTTP_POST_VARS['comment_text']) && $error) ? stripslashes(htmlspecialchars(trim($HTTP_POST_VARS['comment_text']))) : "";


   /** Anti_Spam Mod **/
   mt_srand((double)microtime() * 1000000);
   $prevent_code = mt_rand(10000, 99999);
   $site_sess->set_session_var('comment_code', addslashes($prevent_code));
   $secure_image = '';
   for ($i = 0; $i < 5; $i++) {
       $secure_image .= '<img src="'.get_gallery_image("captcha".substr($prevent_code,$i,1).".gif").'" border="0" alt="" />';
   }
   /** Anti_Spam Mod **/

    $site_template->register_vars(array(
      "lang_enter_secure_code" => $lang['enter_secure_code'],
      "secure_image" => $secure_image,
      "prevent_code" => $prevent_code,
      "bbcode" => $bbcode,

search for (in 4images v1.72):
Code: [Select]
        $comment_text = (isset($HTTP_POST_VARS['comment_text']) && $error) ? format_text(trim(stripslashes($HTTP_POST_VARS['comment_text'])), 2) : "";

    $site_template->register_vars(array(
      "bbcode" => $bbcode,
and replace with:
Code: [Select]
    $comment_text = (isset($HTTP_POST_VARS['comment_text']) && $error) ? format_text(trim(stripslashes($HTTP_POST_VARS['comment_text'])), 2) : "";


   /** Anti_Spam Mod **/
   mt_srand((double)microtime() * 1000000);
   $prevent_code = mt_rand(10000, 99999);
   $site_sess->set_session_var('comment_code', addslashes($prevent_code));
   $secure_image = '';
   for ($i = 0; $i < 5; $i++) {
       $secure_image .= '<img src="'.get_gallery_image("captcha".substr($prevent_code,$i,1).".gif").'" border="0" alt="" />';
   }
   /** Anti_Spam Mod **/

    $site_template->register_vars(array(
      "lang_enter_secure_code" => $lang['enter_secure_code'],
      "secure_image" => $secure_image,
      "prevent_code" => $prevent_code,
      "bbcode" => $bbcode,


Step 5
open templates/comment_form.html
search for:
Code: [Select]
                  <td>{bbcode}</td>
                </tr>
and insert below:
Code: [Select]
              <tr>
                    <td>
                    <noscript>
                       <table>
                         <tr>
                           <td>{secure_image} </td>
                           <td><input type="text" name="prevent_code" value="" size="5" /> </td>
                         </tr>
                         <tr><td colspan="2"><b>{lang_enter_secure_code}</b></td>
                         </tr>
                        </table>
                    </noscript>
                  <script type="text/javascript">
                  function spamcode () {
                       var spamy = {prevent_code};
                       document.getElementsByName("prevent_code")[0].value = spamy;
                  }
                  document.write('<input type="hidden" name="prevent_code" value="0" \/>');
                  </script>
                    </td>
               </tr>

search for:
Code: [Select]
input type="submit" name="postbutton" value="{lang_post_comment}" class="button" />and replace with:
Code: [Select]
input type="submit" name="postbutton" value="{lang_post_comment}" class="button" onclick="spamcode()" />
Step 6
unpack the archive and place the images in your /templates/your templates/images/ folder.


done.

Have Phun.

Please give me feedback.

2
Mods & Plugins (Releases & Support) / [MOD] Paypal Mod (Shop Mod Lite)
« on: March 21, 2006, 10:36:38 PM »
[ Introduction ]
With this mod you are able, to set for each image a different price,
and when set, on the details site, there will be an small link to the paypal site.

[ Features ]
- Price can be set individually for each image different
- if no price is set, no link will be shown

Demo can be seen here: Demo Link

[ Changed Files ]
lang/<your language>/main.php
details.php
includes/db_field_definitions.php
templates/details.html

[ New Files ]
templates/details_paypal.html
templatesdetails_paypal_cart.html


[ Installation ]
Download the rar archive.
unpack the files.
follow the installation note.

Download here: Download Link
You can register your own account (no email verification is needed)
or login in with 4images/4images.


Step 1:
Open includes/db_field_definitions.php
add before ?>
Code: [Select]
$additional_image_fields['price'] = array($lang['image_price'], "text", 0);

Step 2:
open templates/details.html
search for
Code: [Select]
    <br />{lightbox_button}&nbsp;&nbsp;{postcard_button}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{download_button}&nbsp;&nbsp;{download_zip_button}
  </div>
  <br />
                  <table width="100%" border="0" cellspacing="0" cellpadding="1">
                    <tr>
and add below
Code: [Select]
{if price} {details_paypal} {endif price}
you can place this code everywhere you want in the details.html,
where the link should be displayed.


Step 3:
open details.php
search for:
Code: [Select]
  "prev_image_file" => $prev_image_file,
  "prev_thumb_file" => $prev_thumb_file
));
unset($next_prev_cache);
add below:
Code: [Select]
//-----------------------------------------------------
//--- Shop Mod Lite -----------------------------------
//-----------------------------------------------------

if (isset($image_row['price'])) {
        $site_template->register_vars(array(
            "email_business" => "mymail@here.com",  // enter your email adress/paypal account here
            "buyer_email" => ($user_info['user_email']) ? $user_info['user_email'] : '',
            "url_paypal" => "www.paypal.com",    // enter www.sandbox.paypal.com to test the sandbox function
        ));

  $details_paypal = $site_template->parse_template("details_paypal");
  $details_paypal .= $site_template->parse_template("details_paypal_cart");
  $site_template->register_vars("details_paypal",$details_paypal);
}


Step 4:
execute the installer.
and place all templates from the rar archive to your templates folder.

[ Notes ]
You have to edit from step 3 this line:
Code: [Select]
"email_business" => "mymail@here.com",  // enter your email adress/paypal account heredon't forget to set your email adress here.

If you want, that an other image should be displayed, just edit the template files.
In the template files (details_paypal.html/details_paypal_cart.html) edit the following lines:
Code: [Select]
             <input type="hidden" name="shipping" value="1.00">
             <input type="hidden" name="shipping2" value="0.50">
             <input type="hidden" name="handling" value="2.00">
here you can set additional costs for shipping and/or handling.

All values must be entered in following format with a dot "." as seperator for prices.
The price can be set in control panel by editing the images.

done.

Have Phun.

This is not really a shop mod, it's just to play around with it.



3

Look at the demo
Demo Link

Is anybody interested in such a mod?

It's just taking the user with a link to the paypal site,
so has not really anything with a "real" shop in common.

4
This is just a simple modification,
unworth to call it a real mod.  :mrgreen:

[ Description ]
This mod shows in details page, how many users has added this picture to their lightbox / favorites.
It uses mysql Regexpression search to find the related entries,
and will save much ressources instead of reading out every lightbox (into an array).

A Demo can be seen here: Demo Link

Download here
You can register your own account (no email verification is needed)
or login in with 4images/4images.

Have Phun.

If the Download link not available, look here:
http://www.4homepages.de/forum/index.php?topic=12182.msg127963#msg127963





5
[ Introduction ]
With this mod you have an extra site where some useful informations are provided in statistic form.

[ Features ]
Fully configurable
Depending on which mods you have installed several display options can be turned on/off

[ Changed Files ]
lang/<your language>/main.php
(for some additional infos you have to modify more files)

[ New Files ]
templates/statistics.html
templates/statistics_memberbox.html
templates/statistics_monthbox.html
statistics.php

[ Installation ]
Download the rar archive.
unpack the files.
follow the installation note.
Configuration (important!)
Open the statistics.php and edit/modify in the head of the file your settings,
depending on your installed mods.
If you get sql error messages then you have not configured the settings part probably.

A Demo can be seen here: Demo Link

Download here
You can register your own account (no email verification is needed)
or login in with 4images/4images.

Have Phun.

Update Version 1.01
Added the mode parameter,
cause for some users the displayed site is too large,
so you can split up the statistics php.
Only the for the needed infos the querys will be executed to save some ressources.
changed files:
statistics.php
statistics.html

From installation note:
you can call the statistics.php with 3 different mode parameters.
e.g. statistics.php?mode=xxx
for xxx there are 3 modes available:
all: show all options
topusers: shows only the topuser statistics
stats: shows only the main statistics



P.S.: Thanks to my Betatesters (JensF,trez,ivan,Vincent,Loda) who provided me some errors which has been fixed now.

14.03.2006 Updated the Archive: dutch language file added (thx to wallpapers)
15.03.2006 Updated statistics.php v1.01 // added mode parameter
16.03.2006 Updated statistics.php v1.01 // added config option: show admin values in top users statistics on/off

6
Mods & Plugins (Requests & Discussions) / [Beta Test] Statistic Mod
« on: February 20, 2006, 12:28:21 PM »
Just a short question to all.

I know that there are already several mods for statistic display,
but i wanted to keep an statistic site on an extra page,
with more detailed informations than the mods which are already been published.

So my question is,
if you need it to,
and the more important thing is
thats why i started this thread,
is which informations would be useful for you.
I already has a lot of informations implemented yet,
but may be some other tips would be useful, which i dont had think about.

A small screenshot is attached.
(it's just a part of the statistic site, cause it's too big to screencapture the whole site.

7
So where to start?

As i understood, 4images 1.71 uses a new session system,
and the sessions table is not needed anymore to identify users,
cause sessionids are stored in users cookie or per sessionid in url.
But unfortunatly some functions like the who is online list needs the sessionstable,
to show up, whos online and on which location.

But after reporting from some users,
that they have some problems i discovered it too.

It happens if for example:
User opens browser -> has set cookie for automatic login -> new session entry in db is made
user doing for 20 minutes nothing, but leaves his browser open
so the 4image session system deletes the users session from db (because of the timeout)
user visit the gallery again
cause he has his old sessionid stored in cookie or url the 4 images gallery now try to update in db the users session entry,
but the sessionentry is already deleted, and the is no check, if the users session entry exists.

To fix this problem i have to solutions,
both are working and are secure,
but i would like to hear from vano or the other admins,
which way is faster.

German:
Kurze Übersetzung auf deutsch.
4images nutzt soweit ich weiss, seit Version 1.71 ein neues Session System,
und deswegen ist die Verifizierung von Usern über das Sessionsystem der DB nicht mehr vonnöten.
Allerdings nutzen einige Funktionen wie z.b. die Wer ist online Liste noch diese DB Eintrge.
Da die Session IDs per Cookie oder per URL an den User gegeben werden.
Leider ist es so, dass wenn z.B.
ein User auf die Seite kommt auf die Seite -> er bekommt eine Session ID zugewiesen
User macht 20 minuten nix
4images löscht die session id aus der DB (wegen User Timeout)
User kommt wieder auf die Seite zurück ohne das Browserfenster geschlossen zu haben
4images versucht in der DB den Eintrag des Users upzudaten.
Leider ist der DB Eintrag schon gelöscht worden, und es findet auch kein Check statt,
ob der Eintrag noch vorhanden ist.

File to edit:
includes/session.php

Way 1
Find
Code: [Select]
  function update_session() {
    global $site_db;


    $sql = "UPDATE ".SESSIONS_TABLE."
            SET session_lastaction = $this->current_time, session_location = '$this->user_location'
            WHERE session_id = '$this->session_id'";
    $site_db->query($sql);

And insert below
Code: [Select]
    /** Session Update Fix **/
    $foo = $site_db->affected_rows();

    if ($foo == 0) {      // old sesssion entry is already deleted
    $sql = "INSERT INTO ".SESSIONS_TABLE."
            (session_id, session_user_id, session_lastaction, session_location, session_ip)
            VALUES
            ('$this->session_id', ".$this->user_info['user_id'].", $this->current_time, '$this->user_location', '$this->user_ip')";
    $site_db->query($sql);
    }
   
    /** Session Update Fix **/


Way 2

Search for
Code: [Select]
  function update_session() {
    global $site_db;

    $sql = "UPDATE ".SESSIONS_TABLE."
            SET session_lastaction = $this->current_time, session_location = '$this->user_location'
            WHERE session_id = '$this->session_id'";
    $site_db->query($sql);

and replace it with

Code: [Select]
  function update_session() {
    global $site_db;

      $sql = "REPLACE INTO ".SESSIONS_TABLE."
              (session_id, session_user_id, session_lastaction, session_location, session_ip)
              VALUES
              ('$this->session_id', ".$this->user_info['user_id'].", $this->current_time, '$this->user_location', '$this->user_ip')";
      $site_db->query($sql);


I think the first way would be a little bit faster,
cause the second way performs always 2 querys.

Hope that helps.

8
[ Introduction ]
With this mod you can now set the user rights per Category.
For example:
If you set categorie_view in an categorie to private,
you have to set the user rights (which user are allowed to view this category) for each user,
by searching the user, what takes some time and also is uncomfortable.
With this mod now you can set the user, which are allowed to view this category,
directly in the category editing page.

German:
Mit diesem Mod könnt ihr die User Rechte direkt per Kategorie setzen.
Bisher musste man, wenn man z.B. category view auf private gesetzt hat,
die User einzeln raussuchen, und dann bei jedem User einzeln die Erlaubnis setzen.
Mit diesem Mod könnt ihr direkt in der Kategorie Bearbeitungsseite die Rechte für die User setzen.

[ Changed Files ]
admin/categories.php
lang/<your language>/admin.php


[ Installation ]

First Backup your Files

Step 1
Open admin/categories.php

search for
Code: [Select]
  AUTH_ADMIN => $lang['userlevel_admin']
);
insert below
Code: [Select]
####################### User Rights per Cat MOD Start #######################

function update_single_usergroup($user_id, $user_name) {
    global $site_db, $user_table_fields;

    $group_name = $user_name;

    $sql = "SELECT group_id
            FROM ".GROUPS_TABLE."
            WHERE group_name = '".addslashes($group_name)."' AND group_type = ".GROUPTYPE_SINGLE;
    $row2 = $site_db->query_firstrow($sql);
    if (!$row2) {
        $sql = "INSERT INTO ".GROUPS_TABLE."
                (group_name, group_type)
                VALUES
                ('".addslashes($group_name)."', ".GROUPTYPE_SINGLE.")";
        $site_db->query($sql);
        $group_id = $site_db->get_insert_id();
  }
  else {
        $group_id = $row2['group_id'];
  }
  $sql = "SELECT group_id
          FROM ".GROUP_MATCH_TABLE."
          WHERE group_id = $group_id AND user_id = $user_id";
  if ($site_db->is_empty($sql)) {
    $sql = "INSERT INTO ".GROUP_MATCH_TABLE."
            (group_id, user_id, groupmatch_startdate, groupmatch_enddate)
            VALUES
            ($group_id, $user_id, 0, 0)";
    $site_db->query($sql);
  }
  return $group_id;
}

function show_access_select2($title = "", $type, $status) {
  global $access_array, $HTTP_POST_VARS, $site_db, $cat_id, $user_table_fields, $lang;
  if (isset($HTTP_POST_VARS[$type])) {
    $status = $HTTP_POST_VARS[$type];
  }
  echo "<tr class=\"".get_row_bg()."\" valign=\"top\">\n<td><p class=\"rowtitle\">".$title."</p></td>\n";
  echo "<td>\n<select name=\"".$type."\">\n";
  foreach ($access_array as $key => $val) {
    echo "<option value=\"".$key."\"";         //$key Nummer 0-9  Einstelloptionsmöglichkeiten
    if ($status == $key) {             // $status eingestellte Option
      echo " selected=\"selected\"";
    }
    echo ">".$val."</option>\n";      // $val = Einstelloptionsmöglichkeiten
  }
  echo "</select>";

  if ($status == AUTH_ACL)  {
     echo "<tr class=\"".get_row_bg()."\" valign=\"top\">\n<td> <div class=\"rowtitle\">".$lang['cat_user_rights']."</div> \n";
     echo $lang['cat_user_rights_users'].$title."</b></font> </td>\n";
     echo "<td>\n";
     echo "<select name=\"".$type."_rights[]\" size=5 multiple>\n";

      $sql = "SELECT ".get_user_table_field("u.", "user_id").", ".get_user_table_field("u.", "user_name").", a.cat_id, a.".$type."
              FROM ".USERS_TABLE." u
              LEFT JOIN ".GROUP_MATCH_TABLE." m ON (m.user_id = ".get_user_table_field("u.", "user_id").") AND groupmatch_startdate = '0'
              LEFT JOIN ".GROUP_ACCESS_TABLE." a ON (a.group_id = m.group_id) AND a.cat_id = ".$cat_id."
              WHERE ".get_user_table_field("u.", "user_id")." != ".GUEST."
              ORDER BY a.".$type." DESC , ".get_user_table_field("u.", "user_name")." ASC";
             
      $foo = $site_db->query($sql);
      while ($row = $site_db->fetch_array($foo)) {
            if ($row[$type] == 1) {
               //$categorie_useraccess .= ", ".$row[$user_table_fields['user_name']]." (".$row['userid'].")";   // Check Usernames
               echo "<option value=\"".$row[$user_table_fields['user_id']]."\" selected>".$row[$user_table_fields['user_name']]."</option>\n";
            }
            else echo "<option value=\"".$row[$user_table_fields['user_id']]."\">".$row[$user_table_fields['user_name']]."</option>\n";
       }
     echo "</select>";
     //echo "User: ".$categorie_useraccess;
     echo "<br>".$lang['cat_user_rights_select_tip']."</td></tr>";
   }
  echo "\n</td>\n</tr>\n";
}

####################### User Rights per Cat MOD End #######################

Search for
Code: [Select]
    $sql = "UPDATE ".CATEGORIES_TABLE."
            SET cat_name = '$cat_name', cat_description = '$cat_description', cat_parent_id = $cat_parent_id, cat_hits = $cat_hits, auth_viewcat = $auth_viewcat, auth_viewimage = $auth_viewimage, auth_download = $auth_download, auth_upload = $auth_upload, auth_directupload = $auth_directupload, auth_vote = $auth_vote, auth_sendpostcard = $auth_sendpostcard, auth_readcomment = $auth_readcomment, auth_postcomment = $auth_postcomment
            WHERE cat_id = $cat_id";
    $result = $site_db->query($sql);

insert below
Code: [Select]
####################### User Rights per Cat MOD Start #######################

  $do_user_rights = (isset($HTTP_POST_VARS['do_user_rights']) && $HTTP_POST_VARS['do_user_rights']) ? 1 : 0;
  $do_user_rights_ok = 0;
  $array_merge_list = array();

  $access_field_arrays = array(1 =>'auth_viewcat','auth_viewimage','auth_download','auth_upload','auth_directupload','auth_vote','auth_sendpostcard','auth_readcomment','auth_postcomment');
    foreach ($access_field_arrays as $key => $val) {
         if (isset ($HTTP_POST_VARS[$val."_rights"])) {
             ${$val."_rights"} = $HTTP_POST_VARS[$val."_rights"];
             $array_merge_list = array_merge ($array_merge_list,${$val."_rights"});
             $do_user_rights_ok = 1;
         }
         else {
            ${$val."_rights"} = "";
         }
    }
  $array_merge_list = array_unique ($array_merge_list);
  $array_merge_user_sql = implode (",",$array_merge_list);

  if ($do_user_rights)  {

      $sql = "DELETE FROM ".GROUP_ACCESS_TABLE."
              WHERE cat_id = $cat_id";
      $site_db->query($sql);              // Delete old entries

      if ($array_merge_user_sql) {
      $sql = "SELECT ".get_user_table_field("u.",user_id).", ".get_user_table_field("u.",user_name).", g.group_id
              FROM ".USERS_TABLE." u
              LEFT JOIN ".GROUP_MATCH_TABLE." gm ON (gm.user_id = ".get_user_table_field("u.",user_id).") AND gm.groupmatch_startdate = 0
              LEFT JOIN ".GROUPS_TABLE." g ON (g.group_id = gm.group_id)
              WHERE ".get_user_table_field("u.",user_id)." IN (".$array_merge_user_sql.")
              ORDER BY ".get_user_table_field("u.",user_id)." ASC";

      $foo = $site_db->query($sql);
      while ($row = $site_db->fetch_array($foo)) {
         $user_id = $row[$user_table_fields['user_id']];
         
          if (!$row['group_id']) {
               $row['group_id'] = update_single_usergroup($user_id, $row[$user_table_fields['user_name']]);
           }
           
         $group_id = $row['group_id'];
   
         foreach ($access_field_arrays as $key => $val) {
              ${$val."_sql"} = ((${$val."_rights"})) && (in_array ("$user_id", ${$val."_rights"}) && $$val == AUTH_ACL) ? 1 : 0;
          }
         
         if (($auth_viewcat_sql || $auth_viewimage_sql || $auth_download_sql || $auth_upload_sql || $auth_directupload_sql || $auth_vote_sql || $auth_sendpostcard_sql || $auth_readcomment_sql || $auth_postcomment_sql) && $group_id) {
                 $sql = "INSERT INTO ".GROUP_ACCESS_TABLE."
                 (group_id, cat_id, auth_viewcat, auth_viewimage, auth_download, auth_upload, auth_directupload, auth_vote, auth_sendpostcard, auth_readcomment, auth_postcomment)
                 VALUES
                 ($group_id, $cat_id, $auth_viewcat_sql, $auth_viewimage_sql, $auth_download_sql, $auth_upload_sql, $auth_directupload_sql, $auth_vote_sql, $auth_sendpostcard_sql, $auth_readcomment_sql, $auth_postcomment_sql)";
                 $site_db->query($sql);
         }
      }  // While
     }   
    }

####################### User Rights per Cat MOD End #######################


Search for
Code: [Select]
  foreach ($access_field_array as $key => $val) {
    show_access_select($lang[$key], $key, $result[$key]);
  }
and replace with
Code: [Select]
  foreach ($access_field_array as $key => $val) {
    show_access_select2($lang[$key], $key, $result[$key]);
  }

Search for
Code: [Select]
  show_form_footer($lang['save_changes'], $lang['reset'], 2, $lang['back']);and insert above
Code: [Select]
  show_radio_row($lang['save_user_rights'],  "do_user_rights", 0);   // pre setting 1-yes / 0-no

Step 2
Open lang/<your language>/admin.php
Search for
Code: [Select]
//-----------------------------------------------------
//--- Images ------------------------------------------
//-----------------------------------------------------
and insert above
(choose your preferred language)

German:
Code: [Select]
$lang['cat_user_rights'] = "Einzelrechte - User:";
$lang['save_user_rights'] = "Einstellungen speichern für Userrechte";
$lang['cat_user_rights_users'] = "Welche User dürfen: ";
$lang['cat_user_rights_select_tip'] = "(Mehrfache Markierungen sind bei vielen Browsern durch gleichzeitiges Drücken von \"Ctrl/Strg\" möglich.)";

English:
Code: [Select]
$lang['save_user_rights'] = "Save changes of User Rights";
$lang['cat_user_rights'] = "User Rights:";
$lang['cat_user_rights_users'] = "Which Users are allowed to: ";
$lang['cat_user_rights_select_tip'] = "(To select multiple user by pushing  \"Ctrl/Strg\" )";

Finished!

I've tested the mod on a fresh & clean 4images installation.

Note:
This options only appears if a category permission is set to private.

17.02 Fixed multlanguage support

9

Found a little Bug in 4images.

It's not very critical, just if you use an non-standard user table fields.
Then the user online won't be showed.

Fix:
Search this line in includes/session.php
Code: [Select]
if ($row['session_user_id'] != GUEST && (isset($row['user_id']) && $row['user_id'] != GUEST)) {
and replace it with
Code: [Select]
if ($row['session_user_id'] != GUEST && (isset($row[$user_table_fields['user_id']]) && $row[$user_table_fields['user_id']] != GUEST)) {

10
Mods & Plugins (Releases & Support) / [MOD] Birthday Mod v1.0
« on: February 10, 2006, 08:20:12 AM »
[ Introduction ]
With this Mod Users are able to input their birthday when registering or when updating their profile.
Fully configurable if
- birthday age also shown in profile next to birthday
- countdown to be shown in profile till next birthday
- if the birthday must be entered or is optional on registration/updating profile
- that todays birthdays are shown on index
- it's also possible to enter only day & month, then for year 0000 must be entered
- Birthday message can set when a user enters the site and has birthday (can be set on/off)

German:
Mit diesem Mod können User bei der Registrierung oder in ihren Einstellungen ihr Geburtstagsdatum eingeben.
Dieser Mod bietet verschiedene Einstellungsmöglichkeiten:
- einstellbar ob Alter im Profil auch angezeigt wird.
- einstellbarer Countdown bis zum nächsten Geburtstag im Profil
- einstellbar ob der Geburtstag eingegeben werden muss oder nur optional eingegeben werden kann.
- einstellbar ob die jeweilg heutigen Geburtstag auf der Indexseite erscheinen
- möglich nur Monat & Tag als Geburtstag einzugeben, dann muss für die Jahreseingabe "0000" eingegeben werden.
- wenn ein Geburtstagskind die Seite betritt kann eine Geburtstagsnachricht gesetzt werden.

Demo Link

[ Changed Files ]
includes/functions.php
includes/db_field_definitions.php
includes/session.php
register.php
index.php
member.php
templates/register_form.html
templates/member_profile.html
templates/member_editprofile.html
templates/home.html
admin/settings.php
lang/<your language>/admin.php
lang/<your language>/main.php

[ Installation ]

First Backup your Files

Step 1
Open register.php

Find
Code: [Select]
$user_icq = (isset($HTTP_POST_VARS['user_icq'])) ? ((intval(trim($HTTP_POST_VARS['user_icq']))) ? intval(trim($HTTP_POST_VARS['user_icq'])) : "") : "";
below insert
Code: [Select]
  $user_birthday_day = (isset($HTTP_POST_VARS['user_birthday_day'])) ? un_htmlspecialchars(trim($HTTP_POST_VARS['user_birthday_day'])) : "";
  $user_birthday_month = (isset($HTTP_POST_VARS['user_birthday_month'])) ? un_htmlspecialchars(trim($HTTP_POST_VARS['user_birthday_month'])) : "";
  $user_birthday_year = (isset($HTTP_POST_VARS['user_birthday_year'])) ? un_htmlspecialchars(trim($HTTP_POST_VARS['user_birthday_year'])) : "";
 

Find
Code: [Select]
if ($user_password == "") {above insert
Code: [Select]
    //Birthday Mod
    if (!$user_birthday = check_birthday($user_birthday_day,$user_birthday_month,$user_birthday_year,$config['birthday_required'])) {
      $msg .= (($msg != "") ?  "<br />" : "").$field_error = preg_replace("/".$site_template->start."field_name".$site_template->end."/siU", str_replace(":", "", $lang['birthday']), $lang['field_required']);
      $error = 1;
    }

Find
Code: [Select]
$activationkey = get_random_key(USERS_TABLE, get_user_table_field("", $user_table_fields['user_activationkey']));above insert

Code: [Select]
    // Birthday Mod
    $additional_field_sql .= ", ".get_user_table_field("", "birthday");
    $additional_value_sql .= ", '$user_birthday'";

Find
Code: [Select]
$site_template->register_vars(array(
      "user_name" => htmlspecialchars(stripslashes($user_name)),
above insert
Code: [Select]
  $birthday_day_options = "<option value=\"\">--</option>\n";
  $birthday_month_options = "<option value=\"\">--</option>\n";

  for ($i=1;$i<=31;$i++){
    $birthday_day_options .= "<option value=\"".sprintf("%02d",$i)."\"".(($i == $user_birthday_day) ? "selected" : "").">".$i."</option>\n";

  }
  for ($i=1;$i<=12;$i++){                                                                                                                        //getmonth($i)
    $birthday_month_options .= "<option value=\"".sprintf("%02d",$i)."\"".(($i == $user_birthday_month) ? "selected" : "").">".$lang['months'][sprintf("%02d",$i)]."</option>\n";
  }

Find
Code: [Select]
"user_icq" => $user_icq,below insert
Code: [Select]
      "birthday_day_options" => $birthday_day_options,
      "birthday_month_options" => $birthday_month_options,
      "user_birthday_year" => $user_birthday_year,
      "lang_day" => $lang['day'],
      "lang_month" => $lang['month'],
      "lang_year" => $lang['year'],

Step 2
Open templates/register_form.html

Find
Code: [Select]
          <tr>
            <td class="row1"><b>{lang_email}</b></td>
            <td class="row1"><input type="text" name="user_email" size="30" class="input" value="{user_email}" /></td>
          </tr>
below insert
Code: [Select]
<!--  Birthday Mod     -->
          <tr>
             <td class="row1"><b>{lang_birthday}</b></td>
             <td class="row1"><table>
                      <tr>
                          <td>{lang_day}</td>
                          <td>{lang_month}</td>
                          <td>{lang_year}</td>
                      </tr>

                      <tr>
                           <td><select name="user_birthday_day">{birthday_day_options} </select></td>
                           <td><select name="user_birthday_month">{birthday_month_options}</select></td>
                           <td><input class="input" name="user_birthday_year" value="{user_birthday_year}" maxlength="4" size="5" type="text">
                           </td>
                      </tr>

            </table></td>
           </tr>
<!--  Birthday Mod     -->

Step 3

Open includes/db_field_definitions.php

Find
Code: [Select]
?>above insert
Code: [Select]
$additional_user_fields['birthday'] = array($lang['birthday'], "text", 0);
Step 4

Open includes/session.php
Find

Code: [Select]
"user_icq" => "user_icq"above insert
Code: [Select]
"birthday" => "birthday",

Step 5

Open member.php

Find

Code: [Select]
      $user_email_button = REPLACE_EMPTY;
    }
and replace with
Code: [Select]
      $user_email_button = REPLACE_EMPTY;
    }
   
    // Birthday Mod
    $user_birthday = (isset($user_row[$user_table_fields['birthday']])) ? $user_row[$user_table_fields['birthday']] : REPLACE_EMPTY;
    if (!empty($user_birthday) && $user_birthday != REPLACE_EMPTY  && $user_row[$user_table_fields['birthday']] != "0000-00-00") {

           $birthday = explode("-",$user_row[$user_table_fields['birthday']]);
           $user_birthday = $birthday[2].".".$lang['months'][sprintf("%02d",$birthday[1])];
           $user_birthday .= ($birthday[0]!="0000") ? " ".$birthday[0]."" : "";
           
           // Show Age in Profile
           if (($config['birthday_show_profile_age'] == 1) && ($age = calc_age ($user_row[$user_table_fields['birthday']]))) {
                $user_birthday .= " ($age)";
           }
           
           // Show Birthdaycountdown in Profile
           if ($config['birthday_profile_countdown'] == 1 && $b_cdown = calc_countdown ($user_row[$user_table_fields['birthday']]))  {

                $site_template->register_vars(array(
                     "lang_birthday_cdown" => $lang['birthday_cdown'],
                     "cdown_days" => $b_cdown['days'],
                     "cdown_hours" => $b_cdown['hours'],
                     "cdown_minutes" => $b_cdown['minutes'],
                     "lang_days" => $lang['days'],
                     "lang_hours" => $lang['hours'],
                     "lang_minutes" => $lang['minutes']
                ));
           }
          // End Show Birthdaycountdown in Profile

    }
    else {
      $user_birthday = REPLACE_EMPTY;
    }
    // Birthday Mod

Find

Code: [Select]
"user_name" => (isset($user_row['user_name'])) ? htmlspecialchars($user_row['user_name']) : REPLACE_EMPTY,insert below
Code: [Select]
"user_birthday" => $user_birthday,
Find

Code: [Select]
$user_invisible = (isset($HTTP_POST_VARS['user_invisible'])) ? intval($HTTP_POST_VARS['user_invisible']) : 0;insert below
Code: [Select]
  $user_birthday_day = (isset($HTTP_POST_VARS['user_birthday_day'])) ? un_htmlspecialchars(trim($HTTP_POST_VARS['user_birthday_day'])) : "";
  $user_birthday_month = (isset($HTTP_POST_VARS['user_birthday_month'])) ? un_htmlspecialchars(trim($HTTP_POST_VARS['user_birthday_month'])) : "";
  $user_birthday_year = (isset($HTTP_POST_VARS['user_birthday_year'])) ? un_htmlspecialchars(trim($HTTP_POST_VARS['user_birthday_year'])) : "";

directly at the same place after

Code: [Select]
$error = 0;insert below
Code: [Select]
  if (!$user_birthday = check_birthday($user_birthday_day,$user_birthday_month,$user_birthday_year,$config['birthday_required'])) {
     $msg .= (($msg != "") ? "<br />" : "").$lang['birthday_error'];
     $error = 1;
  }

Find
Code: [Select]
      $table_fields = $site_db->get_table_fields(USERS_TABLE);
      foreach ($additional_user_fields as $key => $val) {
        if (isset($HTTP_POST_VARS[$key]) && isset($table_fields[$key])) {
          $additional_sql .= ", $key = '".un_htmlspecialchars(trim($HTTP_POST_VARS[$key]))."'";
        }
      }
    }
below insert
Code: [Select]
    // Birthday Mod
    $additional_sql .= ", ".get_user_table_field("", "birthday")." = '$user_birthday'";

Find
Code: [Select]
    $user_icq = $user_info['user_icq'];
  }
and replace with
Code: [Select]
    $user_icq = $user_info['user_icq'];
      $birthday = explode("-",$user_info['birthday']);
    $user_birthday_day = $birthday[2];
    $user_birthday_month = $birthday[1];
    $user_birthday_year = $birthday[0];
  }

  $birthday_day_options = "<option value=\"\">--</option>\n";
  $birthday_month_options = "<option value=\"\">--</option>\n";

  for ($i=1;$i<=31;$i++){
    $birthday_day_options .= "<option value=\"".sprintf("%02d",$i)."\"".(($i == $user_birthday_day) ? "selected" : "").">".$i."</option>\n";

  }
  for ($i=1;$i<=12;$i++){                                                                                                                        //getmonth($i)
    $birthday_month_options .= "<option value=\"".sprintf("%02d",$i)."\"".(($i == $user_birthday_month) ? "selected" : "").">".$lang['months'][sprintf("%02d",$i)]."</option>\n";
  }

Find
Code: [Select]
"user_homepage" => htmlspecialchars(stripslashes($user_homepage)),below insert
Code: [Select]
    "birthday_day_options" => $birthday_day_options,
    "birthday_month_options" => $birthday_month_options,
    "user_birthday_year" => $user_birthday_year,
    "lang_day" => $lang['day'],
    "lang_month" => $lang['month'],
    "lang_year" => $lang['year'],

Step 6

Open templates/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>
below insert
Code: [Select]
        <tr>
          <td class="row1"><b>{lang_birthday}</b></td>
          <td class="row1">{if user_birthday}{user_birthday}{endif user_birthday}</td></td>
        </tr>
        {if cdown_days}
        <tr>
          <td class="row2"><b>{lang_birthday_cdown}</b></td>
          <td class="row2">{cdown_days} {lang_days} {cdown_hours} {lang_hours} {cdown_minutes} {lang_minutes} </td></td>
        </tr>
        {endif cdown_days}


Step 7

Open templates/member_editprofile.html

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]
          <tr>
             <td class="row1"><b>{lang_birthday}</b></td>
             <td class="row1"><table>
                      <tr>
                          <td>{lang_day}</td>
                          <td>{lang_month}</td>
                          <td>{lang_year}</td>
                      </tr>

                      <tr>
                           <td><select name="user_birthday_day">{birthday_day_options}</select></td>
                           <td><select name="user_birthday_month">{birthday_month_options}</select></td>
                           <td><input class="input" name="user_birthday_year" value="{user_birthday_year}" maxlength="4" size="5" type="text"></td>
                      </tr>

            </table></td>
           </tr>

Step 8

Open includes/functions.php

Search at the bottom
Code: [Select]
?>and above insert
Code: [Select]
function check_birthday($birthday_day = "", $birthday_month = "", $birthday_year = "", $valid = 0) {
  $error = 0;
  if($birthday_day && $birthday_month && $birthday_year) {
      switch(strlen($birthday_year)) {
      case 2:
          $birthday_year = "19$birthday_year";
          break;
      case 4:
          break;
      default:
        $birthday_year = "0000";
        if ($valid) $error = 1;
        break;
      }
   $birthday = "$birthday_year-$birthday_month-$birthday_day";
   }
   else {
       $birthday = "0000-00-00";
       $error = 1;
   }
   if ($valid == 1 && ($error || (!ereg("([0-9]{4})-([0-9]{2})-([0-9]{2})", $birthday)))) return false;
   else return $birthday;
}

function calc_age ($birthday = "") {
    $user_birthday = explode("-",$birthday);
    if ($user_birthday[0]!= "0000" && $user_birthday) {
      $today = getdate (time());
      $age = ($today['year'] - $user_birthday[0]);
      if ($age > 0 )  {
      $birthday_thisyear_var = mktime(0,0,0,$user_birthday[1],$user_birthday[2],$today['year']);
      $birthday_thisyear = getdate ($birthday_thisyear_var);
      if ($birthday_thisyear['yday']>$today['yday']) $age--;
      return $age;
      }
      else return false;
    }
}

function calc_countdown ($birthday = "") {
    $user_birthday = explode("-",$birthday);
    if ($user_birthday[1] != "00" && $user_birthday[2] != "00") {
      $today = getdate (time());
      $birthday_thisyear_var = mktime(0,0,0,$user_birthday[1],$user_birthday[2],$today['year']);
      $birthday_thisyear = getdate ($birthday_thisyear_var);
      if ($birthday_thisyear['yday']<=$today['yday']) $birthday_thisyear_var = mktime(0,0,0,$user_birthday[1],$user_birthday[2],$today['year']+1);
      $difference = $birthday_thisyear_var - time();
      if ($difference < 0) $difference = 0;
      $dleft = floor($difference/60/60/24);
      $hleft = floor(($difference - $dleft*60*60*24)/60/60);
      $mleft = floor(($difference - $dleft*60*60*24 - $hleft*60*60)/60);
$return = array(
'days'=>$dleft,
'hours'=>$hleft,
'minutes'=>$mleft,
);
return $return;
    }
    else return false;
}


Step 9

Open admin/settings.php

Find the last line that is like
show_table_separator($setting_group[9], 2, "#setting_group_9");
and notice the number, and then add  1
e.g. if the highest number you can find is $setting_group[9] then the next number will be 10
You need that number to replace it for the XX in the next 2 instructions.

Find
Code: [Select]
show_form_footer($lang['save_changes'], "", 2);above insert
Code: [Select]
  //Birthday Mod
  show_table_separator($setting_group[XX], 2, "#setting_group_XX");
  show_setting_row("birthday_required", "radio");
  show_setting_row("birthday_show_profile_age", "radio");
  show_setting_row("birthday_index", "radio");
  show_setting_row("birthday_profile_countdown", "radio");
  show_setting_row("birthday_message", "radio");
  //Birthday Mod

Don't forget to replace the XX with the number mentioned above.

Step 10

Open lang/<your language>/admin.php
Find
Code: [Select]
?>insert above
Code: [Select]
/*-- Setting-Group XX --*/   // Birthday Mod
$setting_group[XX]="Birthday Config";
$setting['birthday_required'] = "Must be entered a birthday?";
$setting['birthday_show_profile_age'] = "Show also Age in Profile?";
$setting['birthday_index'] = "Show on Index Users have birthday today";
$setting['birthday_profile_countdown'] = "Show Time till next birthday in profile";
$setting['birthday_message'] = "Show Birthday Message on Index (when user has B-Day)";

or in German
Code: [Select]
/*-- Setting-Group XX --*/   // Birthday Mod
$setting_group[XX]="Geburtstags Mod Einstellung";
$setting['birthday_required'] = "Ist der Geburtstag eine Pflichtangabe?";
$setting['birthday_show_profile_age'] = "Alter im Profil anzeigen?";
$setting['birthday_index'] = "Zeige auf der Index die heutigen Geburtstage an";
$setting['birthday_profile_countdown'] = "Geburtstagscountdown im Profil";
$setting['birthday_message'] = "Geburtstagsgruss auf der Index zeigen (für User die Geb. haben)";

Don't forget to replace the XX with the number mentioned above.


Step 11

Open index.php

Find
Code: [Select]
//-----------------------------------------------------
//--- Print Out ---------------------------------------
//-----------------------------------------------------
above insert:
Code: [Select]
// Birthday Mod  Start Events
if($config['birthday_message'] == 1)  {
    $user_birthday = explode("-",$user_info[$user_table_fields['birthday']]);
    if (($user_birthday[1] == date ("m", time())) && ($user_birthday[2] == date ("d", time()))) {
         $birthday_message = $site_template->parse_template("birthday_message");
         $site_template->register_vars(array(
                      "birthday_message" => $birthday_message
              ));
    }
}
if($config['birthday_index'] == 1)  {
 $currentdate = date("m-d", time());
 
$sql = "SELECT ".get_user_table_field("", "user_id").", ".get_user_table_field("", "user_name").", ".get_user_table_field("", "birthday")."
          FROM ".USERS_TABLE."
          WHERE ".get_user_table_field("", "birthday")." LIKE '%-$currentdate'
          ORDER BY ".get_user_table_field("", "user_name");
$result = $site_db->query($sql);

$birthday_list = "";
   while($row = $site_db->fetch_array($result)) {
        $age = calc_age($row[$user_table_fields['birthday']]);
        $birthday_list .= ($birthday_list) ? ", " : "";
        $birthday_list .= "<a href=\"".$site_sess->url(ROOT_PATH."member.php?action=showprofile&user_id=".$row[$user_table_fields['user_id']])."\">".$row[$user_table_fields['user_name']]."</a> (".$age.")";
    }
 
$site_template->register_vars(array(
  "lang_events" => $lang['events'],
  "birthday_list" => $birthday_list,
  "lang_congratulate" => $lang['congratulate']
   ));
}

Step 12

Open templates/home.html

Find
Code: [Select]
{if categories}

insert above
Code: [Select]
                   {if birthday_message}{birthday_message}{endif birthday_message}


Find
Code: [Select]
  {whos_online}
  <br />
insert below
Code: [Select]
<!--  Start Events   -->
{if birthday_list}
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td >
      <table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#000000">
        <tr>
          <td valign="top" class="head1">
            <table width="100%" border="0" cellpadding="4" cellspacing="2">
              <tr>
                <td class="head1" valign="top">{lang_events}</td>
              </tr>
            </table></td>
        </tr>

        <tr>
          <td valign="top" >
              <table  width="100%" border="0" cellpadding="4" cellspacing="1" width="98%">
              <tr>
                <td width="40" class="catbgcolor"><img src="{template_url}/images/birthday_baloon.gif" alt=""></td>
                <td class="catbgcolor"><b>{lang_congratulate}</b><br>{birthday_list}</td>
              </tr>
            </table></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<br />
{endif birthday_list}
<!--  End Events   -->

Step 12

Open lang/<your language>/main.php
Find
Code: [Select]
?>insert above
Code: [Select]
//-----------------------------------------------------
//--- Birthday Mod ---------------------------------------
//-----------------------------------------------------

$lang['days'] = "day(s)";
$lang['hours'] = "hour(s)";
$lang['minutes'] = "minute(s)";
$lang['day'] = "day";
$lang['month'] = "month";
$lang['year'] = "year";
$lang['birthday'] = "Birthday:";
$lang['birthday_cdown'] = "Time till next Birthday:";
$lang['birthday_error'] = "Please enter correct birthday";
$lang['months'] = array(
"01" => "January",
"02" => "February",
"03" => "March",
"04" => "April",
"05" => "May",
"06" => "June",
"07" => "July",
"08" => "August",
"09" => "September",
"10" => "October",
"11" => "November",
"12" => "December",
);
$lang['events'] = "Actual Events:";
$lang['congratulate'] = "Congratulations to Birthday:";


or in German /Deutsch:
Code: [Select]
//-----------------------------------------------------
//--- Birthday Mod ---------------------------------------
//-----------------------------------------------------

$lang['days'] = "Tag(e)";
$lang['hours'] = "Stunde(n)";
$lang['minutes'] = "Minute(n)";
$lang['day'] = "Tag";
$lang['month'] = "Monat";
$lang['year'] = "Jahr";
$lang['birthday'] = "Geburtstag:";
$lang['birthday_cdown'] = "Zeit bis zum nchsten Geburtstag:";
$lang['birthday_error'] = "Korrektes Geburtstagsdatum eintragen";
$lang['months'] = array(
"01" => "Januar",
"02" => "Februar",
"03" => "M&auml;rz",
"04" => "April",
"05" => "Mai",
"06" => "Juni",
"07" => "Juli",
"08" => "August",
"09" => "September",
"10" => "Oktober",
"11" => "November",
"12" => "Dezember",
);
$lang['events'] = "Actual Events:";
$lang['congratulate'] = "Congratulations to Birthday:";


an dutch langauge file can be found here:
dutch translation

Step 12

Execute the install_birthday.php on your root directory and then delete it.

Step 13
the birthday_baloon.gif must be placed in your templates/<your template folder>/images

Step 14
Upload birthday_message.html in your templates/<your templates/

You can modify your Birthday Message in that template to customize it.

Finished!



For Users that using other mods like these and wont delete the old entries of their user's birthday can use the old database entries if
the entries are given in the format like xxxx-xx-xx  (year-month-day).
That means if in USERS TABLE the field for the birthday entries are saved in DATE Format can use their entries with this mod,
by making some changes.

Here the instructions:
Just replace the value "birthday" with your db field name.

In Step 3
Code: [Select]
$additional_user_fields['birthday'] Instead of birthday use your db filed name

In Step 4
Code: [Select]
"birthday" => "birthday",Instead of => "birthday"  use your db filed name

Edit the birthday_install.php
delete the line
Code: [Select]
"ALTER TABLE `".USERS_TABLE."` ADD `birthday` DATE DEFAULT '0000-00-00' NOT NULL"
Thats all.

I've tested the mod on a fresh & clean 4images installation.



Additional Options / show asterisk (Sternzeichen):
If you want that the asterisk (german: Sternzeichen) should be displayed next to birthday in profile,
follow these steps.

Open includes/functions.php
Search for
Code: [Select]
?>insert above
Code: [Select]
function sternzeichen($tag, $monat) {
    $sternzeichen = array(
        array(mktime(0, 0, 0, 1, 1, date('Y')), mktime(0, 0, 0, 1, 20, date('Y')), 1),
        array(mktime(0, 0, 0, 1, 21, date('Y')), mktime(0, 0, 0, 2, 19, date('Y')), 2),
        array(mktime(0, 0, 0, 2, 20, date('Y')), mktime(0, 0, 0, 3, 20, date('Y')), 3),
        array(mktime(0, 0, 0, 3, 21, date('Y')), mktime(0, 0, 0, 4, 20, date('Y')), 4),
        array(mktime(0, 0, 0, 4, 21, date('Y')), mktime(0, 0, 0, 5, 21, date('Y')), 5),
        array(mktime(0, 0, 0, 5, 22, date('Y')), mktime(0, 0, 0, 6, 21, date('Y')), 6),
        array(mktime(0, 0, 0, 6, 22, date('Y')), mktime(0, 0, 0, 7, 22, date('Y')), 7),
        array(mktime(0, 0, 0, 7, 23, date('Y')), mktime(0, 0, 0, 8, 23, date('Y')), 8),
        array(mktime(0, 0, 0, 8, 24, date('Y')), mktime(0, 0, 0, 9, 23, date('Y')), 9),
        array(mktime(0, 0, 0, 9, 24, date('Y')), mktime(0, 0, 0, 10, 23, date('Y')), 10),
        array(mktime(0, 0, 0, 10, 24, date('Y')), mktime(0, 0, 0, 11, 22, date('Y')), 11),
        array(mktime(0, 0, 0, 11, 23, date('Y')), mktime(0, 0, 0, 12, 21, date('Y')), 12),
        array(mktime(0, 0, 0, 12, 22, date('Y')), mktime(0, 0, 0, 12, 31, date('Y')), 1)
    );

    foreach ($sternzeichen as $value) {
        if ((mktime(0, 0, 0, intval($monat), intval($tag), date('Y')) >= $value[0]) && (mktime(0, 0, 0, $monat, $tag, date('Y')) <= $value[1])) {
            return $value[2];
        }
    }
    return false;
}

Open lang/<your language>/main.php
Search for
Code: [Select]
?>insert above
Code: [Select]
$lang['asterisk'] = "Sternzeichen";
$lang['asterisks'] = array(
  1 => "Steinbock",
       "Wassermann",
       "Fische",
       "Widder",
       "Stier",
       "Zwillinge",
       "Krebs",
       "Löwe",
       "Jungfrau",
       "Waage",
       "Skorpion",
       "Schütze",
       "Steinbock"
);

Open templates/member_profile.html
Search for
Code: [Select]
{user_birthday}
replace it with
Code: [Select]
{user_birthday} {sternzeichen}Note: you can insert {sternzeichen} anywhere you want in that template wherever it should be displayed

Open member.php
Search for
Code: [Select]
// End Show Birthdaycountdown in Profilereplace it with
Code: [Select]
          // End Show Birthdaycountdown in Profile
          $sternzeichen = sternzeichen($birthday[2], $birthday[1]);

search for
Code: [Select]
      "user_birthday" => $user_birthday,and replace it with
Code: [Select]
      "user_birthday" => $user_birthday,
      "sternzeichen" => ($sternzeichen) ? " &nbsp;&nbsp;".$lang['asterisk']." : ".$lang['asterisks'][$sternzeichen]." "  : "",

If you want, that also the asteriks images are displayes next to birthday.
Create in your templates/<your templates>/images/ folder an new folder named sternzeichen
--> templates/<your templates>/images/sternzeichen
There you should place 12 images named from 1.jpg to 12.jpg,
which are the corresponding images like the asterisk.
you can find some images attached. thx to trez for these images.
Here you can find also some from Loda



you should use following code instead
Code: [Select]
      "user_birthday" => $user_birthday,
      "sternzeichen" => ($sternzeichen) ? " &nbsp;&nbsp;".$lang['asterisk']." : ".$lang['asterisks'][$sternzeichen]." "  : "",
user following
Code: [Select]
      "sternzeichen" => ($sternzeichen) ? " &nbsp;&nbsp;".$lang['asterisk']." : ".$lang['asterisks'][$sternzeichen]." <img src=\"".TEMPLATE_PATH."/images/sternzeichen/".$sternzeichen.".jpg\" alt=\"".$lang['asterisks'][$sternzeichen]."\">"  : "",
finished!

P.S.: Maybe someone can translate the asteriks language into english.


17.02. Added additonal option

@German Users: check your language/<your language>/main.php
I did a correction above, cause "03" => "M&auml;", should be like this "03" => "M&auml;rz",
Otherwise only Mä is displayed instead of März.
Corrected above.


Installer and needed files are attached.
You can also download it from here: Link
Just log in as 4images/4images.
Of course you can also create your own account (no email verification is needed, cause its an testboard).
Demo can be also seen there.

11
Feedback & Suggestions / Two questions about the forum
« on: February 10, 2006, 07:01:27 AM »
Hi

Just two questions?
Isn't it possible when i use the search that only the topic subjects is shown in the results,
cause sometimes it's too much scrolling...

And my second question is:
Would it be possible that when a user edit his post,
that the time of the last edit stands below the post
like it's been done already when a mod edit someones post.
This would be somestimes really useful in the mod section
to see if the threadstarter modified his first post,
and build in some modifications/corrections for the mod.


12
Discussion & Troubleshooting / User Guest in 4images Users Table
« on: February 05, 2006, 07:26:00 AM »

As seen in the description.
Is the "user" Guest in the 4images users table really needed?
(I mean user_id -1)

The reason why i asking, is that i coding a mod for me,
to integrate my board/forum (wbb2) in 4 images,
and i didn't seen any reason yet, if this user is needed,
cause i want to use the board users table,
and there the userid is unsigned, so no negative values can used for userid.

By the way.
The gallery is really nice coded.
I wanted only some few modifications,
but after a while, as i made some modifications,
i could see, that its not really hard to integrate a board to gallery,
because you can modify the configs from the gallery really easy
and not necassery to modify all sites. :D
Great work.

13
Reffering to to this  Topic,
i made a litte Mod.
Now it's possible to order the Categories by Numbers in one step instead of Using Moving Up/Down each Categorie.
For Users with many Categories this might be a useful help.

Because i use 4images just a week, i hope there is no critical error in this script.

In German:
Dieses kleine Addon ermöglicht es die Kategorien nun nicht mehr nur mit nach oben und unten Pfeilen der Reihenfolge nach zu sortireren, sonderen alles auf einmal, indem man kleine DropDowns hat und sie einfach per Nummer sortiert.

Just 2 Files to edit:

lang/your language/admin.php

After
//--- Categories --------------------------------------

insert
Code: [Select]
$lang['cat_sort'] = "Kategorien sortieren";
$lang['cat_sort_success'] = "Kategorien erfolgreich sortiert";

or in english
Code: [Select]
$lang['cat_sort'] = "Sort Categories";
$lang['cat_sort_success'] = "Categories sucessfully sorted";



admin/categories.php

Above
######################
Code: [Select]
echo "<img src=\"".ROOT_PATH."admin/images/folder.gif\" alt=\"\"><b><a

href=\"".$site_sess->url(ROOT_PATH."categories.php?cat_id=".$cats['cat_id'])."\"

target=\"_blank\">".$cats['cat_name']."</a>\n</b> (ID: ".$cats['cat_id'].")&nbsp;&nbsp;&nbsp;&nbsp;";
######################
insert:
######################
Code: [Select]
    /** Cat Order By Number Mod **/
    echo "<select name=\"catorder[".$cats['cat_id']."]\">\n";
    for($i = 1; $i <= count ($category_cache[$cid]); $i++)  {    // Options erstellen
         $selected = "";
         if ($i == ($cats['cat_order']/10)) $selected = " selected";

         echo "<option value=\"".($i*10)."\"$selected>$i</option>\n";
    }
    echo " </select>&nbsp;&nbsp;\n";
    /** Cat Order By Number Mod **/
######################

---------------------------------------------------------------------------------

Above
######################
Code: [Select]
echo "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"100%\" align=\"center\"><tr><td class=\"tableborder\">\n<table cellpadding=\"3\" cellspacing=\"1\" border=\"0\" width=\"100%\">\n";######################
insert:
######################
Code: [Select]
  echo "<form action=\"".$PHP_SELF."\" name=\"sort_cat_form\"> \n";
  echo "<input type=\"hidden\" name=\"action\" value=\"sort_cat\" /> \n";
######################
---------------------------------------------------------------------------------

After:   the last one you find
Because  show_table_footer(); can be find more than one time.
( in the section of : $action == "modifycats")
######################
  show_table_footer();
######################
insert:
######################
Code: [Select]
  echo " <input type=\"submit\" value=\"".$lang['cat_sort']."\" class=\"button\" />";
  echo "</form>";
######################
---------------------------------------------------------------------------------
Above:
######################
Code: [Select]
if ($action == "modifycats") {######################
insert:
######################
Code: [Select]
if ($action == "sort_cat") {

  $catorder = (isset($HTTP_POST_VARS['catorder'])) ? $HTTP_POST_VARS['catorder'] : $HTTP_GET_VARS['catorder'];
  reset($catorder);

  while(list($key,$val)=each($catorder)) {
               $sql = "UPDATE ".CATEGORIES_TABLE."
                       SET cat_order = '$val'
                       WHERE cat_id = '$key'";
               $result = $site_db->query($sql);
  }

  //Nachfolgender Code überprüft falsch einträge
  $tmp_cat_parent_id ="";
  $sql2 = "SELECT cat_parent_id
          FROM ".CATEGORIES_TABLE."
          ORDER BY cat_parent_id ASC";
  $result2 = $site_db->query($sql2);
  while ($row2 = $site_db->fetch_array($result2)) {
    if ($tmp_cat_parent_id != $row2['cat_parent_id']) {
               update_cat_order($row2['cat_parent_id']); // hier die Update Funktion
               }
    $tmp_cat_parent_id = $row2['cat_parent_id'];
  }
 
   $msg = ($result) ? $lang['cat_sort_success'] : $lang['cat_edit_error'];
   $action = "modifycats";
}
######################

Thats all.

If a User makes a mistake and e.g. gives two categories the same number,
the script will correct this automaticlly and will also sort the following categories correct the right cat_order.

Would be nice if the pro coders here could give some comments
if the code is well enough or maybe could be optimized.


Pages: [1]