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 - ch€ri{Bi}²

Pages: [1]
1
hi all,

this is a version of the tag clouds  8) for 4images...
this little mod display a cloud of keyword (see here for categories), sort by quantity (the more the keyword is used in the gallery, bigger will be the font).
 :!: only real keywords : i mean no keywords from name or description
you can see a demo on my site.

first : backup your files and

STEP1 : open includes/page_header.php
and add at the very end before ?>:
Code: [Select]
$site_template->register_vars(array(
  "lang_keyword" => $lang['keywords'], //---[/[MOD] Tag Clouds]
  "show_tag_clouds" => get_tag_clouds() //---[/[MOD] Tag Clouds]
));

STEP2 : open includes/functions.php
and add at the very end before ?>:
Code: [Select]
//---[ [MOD] Tag Cloud]
function get_tag_clouds() {
global $site_db, $lang, $site_sess, $mode;
$output = "";
   
  $sql = "SELECT i.word_id, i.word_text, COUNT(c.word_id) AS quantity
  FROM ".WORDLIST_TABLE." i
LEFT JOIN ".WORDMATCH_TABLE." c ON i.word_id = c.word_id
WHERE keys_match > 0
  GROUP BY i.word_text
  ORDER BY  RAND()
LIMIT 20";

  $result = $site_db->query($sql);
  while ($row = $site_db->fetch_array($result)) {
    $tags[$row['word_text']] = $row['quantity'];
  }
 
  //uncommentnext line to sort the tag array in reverse order (+ => -)
   //arsort($tags);   
        $max_size = 250; // max font size in %
        $min_size = 50; // min font size in %
       
        // largest and smallest array values
        $max_qty = max(array_values($tags));
        $min_qty = min(array_values($tags));
       
        // find the range of values
        $spread = $max_qty - $min_qty;
        if ($spread == 0) { // we don't want to divide by zero
                $spread = 1;
        }
       
        // set the font-size increment
        $step = ($max_size - $min_size) / ($spread);
       
        // loop through the tag array
        foreach ($tags as $key => $value) {
                // calculate font-size
                // find the $value in excess of $min_qty
                // multiply by the font-size increment ($size)
                // and add the $min_size set above
                $size = round($min_size + (($value - $min_qty) * $step));
       
                $output .= '<a href="'.$site_sess->url(ROOT_PATH."search.php?search_keywords=".$key.((!empty($mode)) ? "&amp;mode=".$mode : "")).'" style="font-size:'.$size.'%;color:rgb('.mt_rand(0, 255).', '.mt_rand(0, 255).', '.mt_rand(0, 255).');font-family:Verdana, Arial, Helvetica, sans-serif;" title="'.$value.' '.$lang['tagged_with'].' '.$key.'">'.$key.'</a> ';
        }

 
  return $output;
}
//---[/[MOD] Tag Cloud]
read the comments and change some setting and styles to fit your needs  :wink:

last step , open main.php in your language dir and add at the end:
Code: [Select]
$lang['tagged_with'] = "image(s) with tag: ";

now add the 2 tags {lang_keyword} and {show_tag_clouds}  anywhere in you template.

PS: for all the users who love statistics, the cloud tag can take other parameters than mine... just found the query and change it in function.php
 :idea:  :arrow: see here to find how to do this tag cloud with categories

2
hi all,

i consulted a site which has surprised me  :o as for the beauty and the effectiveness of the CSS style sheets...
 :arrow: http://www.csszengarden.com
and as you can see, you can select another design and after this the only thing which change between the 2 pages is the external CSS stylesheet!  wow! the possibilities are amazing!

I don't know if you think like me, but it makes it possible to have a practically unique design for your site   8)

Is there someone who has already developed a CSS based template for a 4images site?

3
Discussion & Troubleshooting / small bug in ACP user management
« on: May 29, 2006, 11:57:17 AM »
hi all,

i have a small bug (v1.7.2) in ACP : when i ask to delete  a user,  it does not matter if i answer yes or no, the user is always deleted  :!:

Any idea to correct this ?
Thanks!

4
Hi,

since the upgrade v1.7.1 --> v1.7.2, it seems the conditionnal tag {ifno}...{endifno} is not working any more...
and i read the  code v1.7.2 for this tag is different from the one on this forum...

so, does someone have some information about this problem?

Thanks for your answers!

5
Mods & Plugins (Requests & Discussions) / Question about tags...
« on: March 06, 2006, 09:53:32 PM »
hi,

i saw the answer to my question in the old forum but i don't find it here for the moment...

So, how can i show the entire list of tags?

i mean, i want to display in one page all (existing) tags for a template like this:
{header}
{sitename}
{title}
{thumbnail}
{image}
...
...
{footer}

Thanks for your answers.

6
this MOD is a small calendar with:
- navigation (by day/month/year)
- automatic research of the images per day (without taking into account the category)

Demo : here
as you can note, the current day is highlighted as well as the days where the user can find images.
when one day is highlighted, by a simple click on it, the user can consult all the images of the concerned day in all categories (of course by checking the permissions).
with the arrows in bottom, the user can travel in time while choosing per day, month or year

Note : you must have installed the following MOD => [MOD] Search between specifyed date
never forget to backup the files which you will modify.

Installation Level:    Easy
Installation Time:     5 Minutes

 >> 03 files to edit from 4images root:

[change]/includes/page_header.php
[change]/includes/functions.php
[change]/templates/<yourtemplate>/search.html

------ Installation ------

STEP 1:
Open /includes/page_header.php
Add at the end of the file, just before ?> :
Code: [Select]
//-------------------------------------------[ [Mod] Calendar with nav and search ]
$nav_calendar = get_calendar('', bordercolor, head2, tablehead, imagerow1, imagerow2, navbar, button_new);
// paramters => function get_calendar($date = '', $class_table, $class_nav, $class_week_days, $class_noday, $class_eachday, $class_today,$class_linkday)
$site_template->register_vars("nav_calendar", $nav_calendar);
 unset($nav_calendar);
//-------------------------------------------[/[Mod] Calendar with nav and search ]
Note : these values ( bordercolor, head2, tablehead, imagerow1, imagerow2, navbar, button_new ) are mine. it correspond to the classes (see in the file style.css into your template directory) who will be used for the calendar.
Do not hesitate to modify them to personalize the colors of your calendar.

Step 2:
Open /includes/functions.php
Add at the end of the file, just before ?> :
Code: [Select]
//-------------------------------------------[ [Mod] Calendar with nav and search ]
/***************************************************************************
                       calendrier.php  -  A calendar
                             -------------------
    begin                : June 2002
    Version : 2.1 (Jan 04)
    copyleft             : (C) 2002-2003 PHPtools4U.com - Mathieu LESNIAK
email                : support@phptools4u.com
website              : http://www.phptools4u.com/scripts/calendrier/                       
***************************************************************************/
function get_calendar($date = '', $class_table, $class_nav, $class_week_days, $class_noday, $class_eachday, $class_today,$class_linkday) {
global $site_db;
global $link_on_day, $PHP_SELF, $params;
global $HTTP_POST_VARS, $HTTP_GET_VARS;

$calendar_txt['french']['monthes']     = array('', 'Janvier', 'Février', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet',
'Août', 'Septembre', 'Octobre', 'Novembre', 'Décembre');
$calendar_txt['french']['days']     = array('Lundi', 'Mardi', 'Mercredi','Jeudi', 'Vendredi', 'Samedi', 'Dimanche');
$calendar_txt['french']['first_day']    = 0;
$calendar_txt['french']['misc']     = array('Mois précédent', 'Mois suivant','Jour précédent', 'Jour suivant', 'Année précédente', 'Année suivante');


### English version
$calendar_txt['english']['monthes']     = array('', 'January', 'February', 'March', 'April', 'May', 'June', 'July',
'August', 'September', 'October','November', 'December');
$calendar_txt['english']['days']     = array('Monday', 'Tuesday', 'Wednesday','Thursday', 'Friday', 'Saturday','Sunday');
$calendar_txt['english']['first_day']   = -1;
$calendar_txt['english']['misc']        = array('Previous month', 'Next month', 'Previous day', 'Next day', 'Next year', 'Previous year');



### Spanish version
$calendar_txt['spanish']['monthes']     = array('', 'Enero', 'Febrero', 'Marzo', 'Abril', 'Mayo', 'Junio', 'Julio',
'Agosto', 'Septiembre', 'Octubre', 'Noviembre', 'Diciembre');
$calendar_txt['spanish']['days']        = array('Lunes', 'Martes', 'Mi&eacute;rcoles', 'Jueves', 'Viernes', 'S&aacute;bado', 'Domingo');
$calendar_txt['spanish']['first_day']   = 0;
$calendar_txt['spanish']['misc']        = array('Mes anterior', 'Mes pr&oacute;ximo', 'd&iacute;a anterior', 'd&iacute;a siguiente', 'A&ntilde;o anterior', 'A&ntilde;o siguiente');

### German version
$calendar_txt['german']['monthes']     = array('', 'Januar', 'Februar', 'M&auml;rz', 'April', 'Mai', 'Juni', 'Juli',
'August', 'September', 'Oktober','November', 'Dezember');
$calendar_txt['german']['days']         = array('Montag', 'Dienstag', 'Mittwoch', 'Donnerstag','Freitag','Samstag', 'Sonntag');
$calendar_txt['german']['first_day']    = 0;
$calendar_txt['german']['misc']         = array('Vorhergehender Monat', 'Folgender Monat', 'Vorabend', 'Am n&auml;chsten Tag', 'Vorjahr', 'Folgendes Jahr');

### Default Params

$param_d['calendar_columns'] = 5; // Nb of columns
$param_d['show_day'] = 1; // Show the day bar
$param_d['show_month'] = 1; // Show the month bar
$param_d['nav_link'] = 1; // Add a nav bar below
$param_d['link_after_date'] = 0; // Enable link on days after the current day
$param_d['link_before_date'] = 1; // Enable link on days before the current day
$param_d['link_on_day'] = 'search.php?date=%%dd%%'; // Link to put on each day
$param_d['use_img'] = 1; // Use gif for nav bar on the bottom

### New params V2
$param_d['lang'] = 'french'; // change to your language : french / english / spanish / german
$param_d['day_mode'] = 0; // Set to 1 : Enable day view with hours (nothing to see)
$param_d['time_step'] = 60;
$param_d['time_start'] = '0:00';
$param_d['time_stop'] = '24:00';
$param_d['highlight'] = array();
    // Can be 'highlight' or 'text'
    $param_d['highlight_type']      = 'highlight';
    $param_d['cell_width']          = 20;
    $param_d['cell_height']         = 20;
    $param_d['short_day_name']      = 1;
    $param_d['link_on_hour']        = $PHP_SELF.'?hour=%%hh%%';

### /Params


### Getting all params
while (list($key, $val) = each($param_d)) {
if (isset($params[$key])) {
$param[$key] = $params[$key];
}
else {
$param[$key] = $param_d[$key];
}
}

$monthes_name = $calendar_txt[$param['lang']]['monthes'];
$param['calendar_columns'] = ($param['show_day']) ? 7 : $param['calendar_columns'];
   
    $date = priv_reg_glob_calendar('date');
if ($date == '') {
$timestamp = time();
}
else {
$month = substr($date, 4 ,2);
$day = substr($date, 6, 2);
$year = substr($date, 0 ,4);
$timestamp = mktime(0, 0, 0, $month, $day, $year);
}
   
   
$current_day = date("d", $timestamp);
$current_month = date('n', $timestamp);
$current_month_2 = date('m', $timestamp);
$current_year = date('Y', $timestamp);
    $first_decalage = date("w", mktime(0, 0, 0, $current_month, 1, $current_year));
### Sunday is the _LAST_ day
$first_decalage = ( $first_decalage == 0 ) ? 7 : $first_decalage;


$current_day_index = date('w', $timestamp) + $calendar_txt[$param['lang']]['first_day'] - 1;
$current_day_index = ($current_day_index == -1) ? 7 : $current_day_index;
$current_day_name = $calendar_txt[$param['lang']]['days'][$current_day_index];
$current_month_name = $monthes_name[$current_month];
$nb_days_month = date("t", $timestamp);

$current_timestamp = mktime(23,59,59,date("m"), date("d"), date("Y"));

### CSS

$output  = '<style type="text/css">'."\n";
$output .= '@import url('.TEMPLATE_PATH.'/style.css);'."\n";
$output .= '</style>'."\n";
$output .= '<table width="100%" border="0" class="'.$class_table.'" cellpadding="2" cellspacing="1">'."\n";

### Displaying the current month/year
if ($param['show_month'] == 1) {
$output .= '<tr>'."\n";
$output .= ' <td colspan="'.$param['calendar_columns'].'" align="center" class="'.$class_nav.'">'."\n";
### Insert an img at will
if ($param['use_img'] ) {
$output .= '<img src="'.get_gallery_image("mois.gif").'">&nbsp;&nbsp;';
}
if ( $param['day_mode'] == 1 ) {
$output .= ' '.$current_day_name.' '.$current_day.' '.$current_month_name.' '.$current_year."\n";
}
else {
$output .= ' '.$current_month_name.' '.$current_year."\n";
}
$output .= ' </td>'."\n";
$output .= '</tr>'."\n";

### select  all images for current month
$date_start = mktime(0,0,0,$current_month_2,1,$current_year);
$date_end = mktime(23,59,59,$current_month_2,$nb_days_month,$current_year);

$user_access = get_permission();

$sql = "SELECT image_date, cat_id
             FROM ".IMAGES_TABLE."
             WHERE image_active = 1 AND image_date >= ".$date_start." AND image_date <= ".$date_end;

  $result = $site_db->query($sql);
$date_img_month = array();

while ($row = $site_db->fetch_array($result)) {
if (check_permission("auth_viewcat", $row['cat_id'])) { // check permissions on cat_id
$new_date = date("Ymd",$row['image_date']); // convert the date
        $date_img_month[] = $new_date; // put the date in the array if permissions are OK
}
      }
      // $site_db->free_result();
}

### Building the table row with the days
if ($param['show_day'] == 1 && $param['day_mode'] == 0) {
$output .= '<tr align="center">'."\n";
$first_day = $calendar_txt[$param['lang']]['first_day'];
for ($i = $first_day; $i < 7 + $first_day; $i++) {

$index = ( $i >= 7) ? (7 + $i): $i;
$index = ($i < 0) ? (7 + $i) : $i;
   
            $day_name = ( $param['short_day_name'] == 1 ) ? substr($calendar_txt[$param['lang']]['days'][$index], 0, 1) : $calendar_txt[$param['lang']]['days'][$index];
$output .= ' <td class="'.$class_week_days.'"><b>'.$day_name.'</b></td>'."\n";
}

$output .= '</tr>'."\n";
$first_decalage = $first_decalage - $calendar_txt[$param['lang']]['first_day'];
$first_decalage = ( $first_decalage > 7 ) ? $first_decalage - 7 : $first_decalage;
}
else {
$first_decalage = 0;
}

$output .= '<tr align="center">'."\n";
$int_counter = 0;


if ( $param['day_mode'] == 1 ) {
list($hour_start, $min_start) = explode(':', $param['time_start']);
list($hour_end, $min_end) = explode(':', $param['time_stop']);
$ts_start = ( $hour_start * 60 ) + $min_start;
$ts_end = ( $hour_end * 60 ) + $min_end;
$nb_steps = ceil( ($ts_end - $ts_start) / $param['time_step'] );

for ( $i = 0; $i <= $nb_steps; $i++ ) {
            $current_ts = ($ts_start) + $i * $param['time_step'];
$current_hour = floor($current_ts / 60);
$current_min = $current_ts % 60;
$current_hour = (strlen($current_hour) < 2) ? '0'.$current_hour : $current_hour;
$current_min = (strlen($current_min) < 2) ? '0'.$current_min : $current_min;

    $highlight_current  = ( isset($param['highlight'][date('Ymd', $timestamp).$current_hour.$current_min]) );
            $css_2_use          = ( $highlight_current ) ? 'HL' : 'Days';
            $txt_2_use          = ( $highlight_current && $param['highlight_type'] == 'text') ? $param['highlight'][date('Ymd', $timestamp).$current_hour.$current_min] : '';
 
$output .= '<tr>'."\n";
            if ( $param['link_on_hour'] != '') {
                $output .= ' <td class="'.$class_noday.'" width="10%"><a href="'.str_replace('%%hh%%', date('Ymd', $timestamp).$current_hour.$current_min, $param['link_on_hour']).'">'.$current_hour.':'.$current_min.'</a></td>'."\n";
            }
            else {
                $output .= ' <td class="'.$class_noday.'" width="10%">'.$current_hour.':'.$current_min.'</td>'."\n";
            }
$output .= '    <td class="'.$class_noday.'">'.$txt_2_use.'</td> '."\n";
$output .= '</tr>'."\n";
}

}
else {
# Filling with empty cells at the begining
for ($i = 1; $i < $first_decalage; $i++) {
$output .= '<td class="'.$class_noday.'">&nbsp;</td>'."\n";
$int_counter++;
}
### Building the table
for ($i = 1; $i <= $nb_days_month; $i++) {
### Do we highlight the current day ?
$i_2 = ($i < 10) ? '0'.$i : $i;
    $highlight_current = ( isset($param['highlight'][date('Ym', $timestamp).$i_2]) );
### Row start
if ( ($i + $first_decalage) % $param['calendar_columns'] == 2 && $i != 1) {
$output .= '<tr align="center">'."\n";
$int_counter = 0;
}

$css_2_use = ( $highlight_current ) ? 'HL' : 'Days';
            $txt_2_use = ( $highlight_current && $param['highlight_type'] == 'text') ? '<br>'.$param['highlight'][date('Ym', $timestamp).$i_2] : '';
           
$current_date = $current_year.$current_month_2.$i_2 ;

            if ($i == $current_day) {

if (in_array($current_date, $date_img_month)) { //
$output .= '<td class="'.$class_today.'" align="center"><a href="'.str_replace('%%dd%%', $current_year.$current_month_2.$i_2,$param['link_on_day']).'&search_keywords=***&day_start='.$i_2.'&month_start='.$current_month_2.'&year_start='.$current_year.'&day_end='.$i_2.'&month_end='.$current_month_2.'&year_end='.$current_year.'">'.$i.'</a>'.$txt_2_use.'</td>'."\n";
} else {
$output .= '<td class="'.$class_today.'" align="center">'.$i.$txt_2_use.'</td>'."\n";
}
}
elseif ($param['link_on_day'] != '') {
$loop_timestamp = mktime(0,0,0, $current_month, $i, $current_year);

if (( ($param['link_after_date'] == 0) && ($current_timestamp < $loop_timestamp)) || (($param['link_before_date'] == 0) && ($current_timestamp >= $loop_timestamp)) ){
$output .= '<td class="'.$class_eachday.'">'.$i.$txt_2_use.'</td>'."\n";
}
else {

if (in_array($current_date, $date_img_month)) {
$output .= '<td class="'.$class_linkday.'"><a href="'.str_replace('%%dd%%', $current_year.$current_month_2.$i_2,$param['link_on_day']).'&search_keywords=***&day_start='.$i_2.'&month_start='.$current_month_2.'&year_start='.$current_year.'&day_end='.$i_2.'&month_end='.$current_month_2.'&year_end='.$current_year.'">'.$i.'</a>'.$txt_2_use.'</td>'."\n";
} else {
$output .= '<td class="'.$class_eachday.'">'.$i.$txt_2_use.'</td>'."\n";
}
}

}
else {
$output .= '<td class="'.$class_eachday.'">'.$i.'</td>'."\n";
}
$int_counter++;

### Row end
if (  ($i + $first_decalage) % ($param['calendar_columns'] ) == 1 ) {
$output .= '</tr>'."\n";
}
}
$cell_missing = $param['calendar_columns'] - $int_counter;

for ($i = 0; $i < $cell_missing; $i++) {
$output .= '<td class="'.$class_noday.'">&nbsp;</td>'."\n";
}
$output .= '</tr>'."\n";
}
### Display the nav links on the bottom of the table
if ($param['nav_link'] == 1) {

$previous_day = date("Ymd",
mktime( 12,
0,
0,
$current_month,
$current_day - 1,
$current_year
   )
);

$previous_month = date("Ymd",
mktime( 12,
0,
0,
($current_month - 1),
$current_day,
$current_year
   )
);

$previous_year = date("Ymd",
mktime( 12,
0,
0,
$current_month,
$current_day,
($current_year - 1)
   )
);


$next_day = date("Ymd",
mktime( 1,
12,
0,
$current_month,
$current_day + 1,
$current_year
   )
);
$next_month = date("Ymd",
mktime( 1,
12,
0,
$current_month + 1,
$current_day,
$current_year
   )
);

$next_year = date("Ymd",
mktime( 12,
0,
0,
$current_month,
$current_day,
($current_year + 1)
   )
);


if ($param['use_img']) {
$g = '<img src="'.get_gallery_image("g.gif").'" border="0">';
$gg = '<img src="'.get_gallery_image("gg.gif").'" border="0">';
$ggg = '<img src="'.get_gallery_image("ggg.gif").'" border="0">';
$d = '<img src="'.get_gallery_image("d.gif").'" border="0">';
$dd = '<img src="'.get_gallery_image("dd.gif").'" border="0">';
$ddd = '<img src="'.get_gallery_image("ddd.gif").'" border="0">';
}
else {
$g = '&lt;';
$gg = '&lt;&lt;';
$ggg = '&lt;&lt;&lt;';
$d = '&gt;';
$dd = '&gt;&gt;';
$ddd = '&gt;&gt;&gt;';
}
// nav link for : next day
if ( ($param['link_after_date'] == 0)
&& ($current_timestamp < mktime(0,0,0, $current_month, $current_day+1, $current_year))
) {
$next_day_link = '&nbsp;';
}
else {
$next_day_link = '<a href="search.php?date='.$next_day.'" title="'.$calendar_txt[$param['lang']]['misc'][3].'">'.$d.'</a>'."\n";
}
// nav link for : previous day
if ( ($param['link_before_date'] == 0)
&& ($current_timestamp > mktime(0,0,0, $current_month, $current_day-1, $current_year))
){
$previous_day_link = '&nbsp;';
}
else {
$previous_day_link = '<a href="search.php?date='.$previous_day.'" title="'.$calendar_txt[$param['lang']]['misc'][2].'">'.$g.'</a>'."\n";
}
// nav link for : next month
if ( ($param['link_after_date'] == 0)
&& ($current_timestamp < mktime(0,0,0, $current_month+1, $current_day, $current_year))
) {
$next_month_link = '&nbsp;';
}
else {
$next_month_link = '<a href="search.php?date='.$next_month.'" title="'.$calendar_txt[$param['lang']]['misc'][1].'">'.$dd.'</a>'."\n";
}
// nav link for : previous month
if  ( ($param['link_before_date'] == 0)
&& ($current_timestamp >= mktime(0,0,0, $current_month-1, $current_day, $current_year))
){
$previous_month_link = '&nbsp;';
}
else {
$previous_month_link = '<a href="search.php?date='.$previous_month.'" title="'.$calendar_txt[$param['lang']]['misc'][0].'">'.$gg.'</a>'."\n";
}
// nav link for : next year
if ( ($param['link_after_date'] == 0)
&& ($current_timestamp < mktime(0,0,0, $current_month, $current_day, $current_year+1))
) {
$next_year_link = '&nbsp;';
}
else {
$next_year_link = '<a href="search.php?date='.$next_year.'" title="'.$calendar_txt[$param['lang']]['misc'][5].'">'.$ddd.'</a>'."\n";
}
// nav link for : previous year
if  ( ($param['link_before_date'] == 0)
&& ($current_timestamp >= mktime(0,0,0, $current_month, $current_day, $current_year-1))
){
$previous_year_link = '&nbsp;';
}
else {
$previous_year_link = '<a href="search.php?date='.$previous_year.'" title="'.$calendar_txt[$param['lang']]['misc'][4].'">'.$ggg.'</a>'."\n";
}



$output .= '<tr>'."\n";
$output .= ' <td align="center" colspan="'.$param['calendar_columns'].'" class="'.$class_nav.'">'."\n";
$output .= ' <table width="100%" border="0" >';
$output .= ' <tr>'."\n";
$output .= ' <td width="16%" align="left" >'."\n";
$output .= $previous_year_link;
$output .= ' </td>'."\n";
$output .= ' <td width="16%" align="left" >'."\n";
$output .= $previous_month_link;
$output .= ' </td>'."\n";
$output .= ' <td width="16%" align="center" >'."\n";
$output .= $previous_day_link;
$output .= ' </td>'."\n";
$output .= ' <td width="16%" align="center" >'."\n";
$output .= $next_day_link;
$output .= ' </td>'."\n";
$output .= ' <td width="16%" align="right" >'."\n";
$output .= $next_month_link;
$output .= ' </td>'."\n";
$output .= ' <td width="16%" align="right" >'."\n";
$output .= $next_year_link;
$output .= ' </td>'."\n";
$output .= ' </tr>';
$output .= ' </table>';
$output .= ' </td>'."\n";
$output .= '</tr>'."\n";

}
$output .= '</table>'."\n";
return $output;
}

function priv_reg_glob_calendar($var) {
Global $HTTP_GET_VARS, $HTTP_POST_VARS;

if (isset($HTTP_GET_VARS[$var])) {
return $HTTP_GET_VARS[$var];
}
elseif (isset($HTTP_POST_VARS[$var])) {
return $HTTP_POST_VARS[$var];
}
else {
return '';
}
}
//-------------------------------------------[/[Mod] Calendar with nav and search ]

Note : modify the parameter $param_d['lang'] by making it correspond to your language.

STEP 3:
Open /templates/<yourtemplate>/search.html
or other file like home.html or details.html...

find this code:
Code: [Select]
{endif random_image}add after :
Code: [Select]
 
<!--   //-------------------------------------------[ [Mod] Calendar with nav and search ] -->
   <table width="150" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td class="head2" height="20" background="{template_url}/images/cat.gif"> <img src="{template_url}/images/spacer.gif" alt="" width="4" height="4" />Calendar</td>
                    </tr>
                    <tr>
                      <td class="tablebgcolor"><img src="{template_url}/images/spacer.gif" alt="" width="1" height="1" /></td>
                    </tr>
                    <tr>
                      <td align="center" class="row1">
    {nav_calendar}
                      </td>
                    </tr>
                    <tr>
                      <td class="tablebgcolor"><img src="{template_url}/images/spacer.gif" alt="" width="1" height="1" /></td>
                    </tr>
                  </table>


<!--   //-------------------------------------------[/[Mod] Calendar with nav and search ] -->

STEP 4:
Download the attached files, unzip and copy all 7 pics into /templates/<yourtemplate>/images_<yourlanguage>/
You can also choose disable images for nav in the calendar : set parameter $param_d['use_img'] to 0.

------ END of Installation ------

now launch your search page to see the result!

7
Hello,

For all those who want to stop (like me) to juggle between several templates when  installing a mod, and also for those who want to propose to their guests the possibility of choosing the colour of the site which they visit, :idea: I make a small modification which allows site administrator to keep a unique  template (...thus I do not speak about already published mods allowing the visitors to choose between templates) while modifying its colours as the visitors will want.

You can see a demo here:arrow:  Choose a color in the left below random image and see how the color of the (same) template changes.


Last Update : 05 February 2006

- use the default style.css if user stylesheet is not present

v1.1(01 Oct 2005) :
- file send_design.php deleted
- no more javascript nor redirection
- rewrite of code : closer to 4images original code

v1.0(20 Sept 2005) :
- Fisrt release


Let's go for it!

>> 03 files to edit from 4images root (3 steps):

[change]/include/page_header.php
[change]/templates/<yourtemplate>/header.html
[change]/templates/<yourtemplate>/home.html

no new file  8)

First, backup your files.

------ Installation ------


STEP 1: (updated on 01 oct 2005)

open page_header.php
search :
Code: [Select]
//-----------------------------------------------------
//--- Category Dropdown -------------------------------
//-----------------------------------------------------

and add before:
Code: [Select]
//-------------------------------------------[ [MOD] multi-color site]
$cookie_name = (defined("COOKIE_NAME")) ? COOKIE_NAME : "4images_";

if (isset($HTTP_POST_VARS['design'])) {
  $design = $HTTP_POST_VARS['design'];
 
  $site_sess->set_session_var("design", $design);
  $session_info['design'] = $design;

  $cookie_expire = time() + 60 * 60 * 24 * 90;
  setcookie($cookie_name.'design', serialize($design), $cookie_expire, COOKIE_PATH, COOKIE_DOMAIN, COOKIE_SECURE);
 
} else {

  $design = isset($HTTP_COOKIE_VARS[$cookie_name.'design']) ? unserialize(stripslashes($HTTP_COOKIE_VARS[$cookie_name.'design'])) : "css_blue";
  $site_sess->set_session_var("design", $design);
  $session_info['design'] = $design;
}


$multi_color="";
$list_css = array();
$dir_name = TEMPLATE_PATH;

if (is_dir($dir_name)) {
  $dir_path = opendir($dir_name);

  $ext=".css";
  $long_ext=strlen($ext);

  while ($file_name = readdir($dir_path)) {
    $long_file=strlen($file_name)-$long_ext;

    if ($file_name != "." && $file_name != ".." && (substr($file_name,$long_file,$long_ext)==$ext)) {
  $color = $file_name;
  $color = ereg_replace('.css', '', $color);
  $list_css[] = $color ;
    }
  }
}

//détermination de la feuille de style et du logo
  //$mycss = $design.'.css';
  $mycss = (in_array ($design, $list_css))? $design.'.css' : 'style.css';
  $mylogo = 'logo_'.$design.'.gif';
  //$frame_cat = 'cat_'.$design.'.gif'; // chamge this to whatever you need in your template but don't forget to register it in register_vars
 

$multi_color = "\n<form name=\"colorname\" method=\"post\" action=\"".$self_url."\"><select name=\"design\" >\n";
foreach ($list_css as $key => $val) {
    $multi_color .= "<option value=\"$val\"";
    if ($val == $design) {
      $multi_color .= " selected=\"selected\"";
    }
    $multi_color .= ">".$val."</option>\n";
}
 $multi_color .= "</select>\n
 <INPUT type=\"submit\" value=\"".$lang['go']."\" class=\"button\" name=\"submit\" />
 </form>\n";

  $site_template->register_vars(array(
"mycss" => $mycss,
"mylogo" => $mylogo,
"multi_color" => $multi_color
  ));
//-------------------------------------------[/[MOD] multi-color site]

Note : don't forget change the value of css_blue to your default style without the extension.


STEP 2:

open /templates/<yourtemplate>/header.html
search and comment this line:
Code: [Select]
<link rel="stylesheet" href="{template_url}/style.css" />

replace by:
Code: [Select]
<link rel="stylesheet" href="{template_url}/{mycss}" />


STEP 3:

open /templates/<yourtemplate>/home.html
add this code above random picture :
Code: [Select]
<!-- ---[ [MOD] multi-color site] --->
                    <table width="150" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td class="head2" height="20" > <img src="{template_url}/images/spacer.gif" alt="" width="4" height="4" />Color of site</td>
                    </tr>
                    <tr>
                      <td class="tablebgcolor"><img src="{template_url}/images/spacer.gif" alt="" width="1" height="1" /></td>
                    </tr>
                    <tr>
                      <td align="center" class="row1" >
  <br>
  {multi_color}
      </td>
  </tr>
  <tr>
                      <td class="tablebgcolor" style="height:1px"><img src="{template_url}/images/spacer.gif" alt="" width="1" height="1" /></td>
                   </tr>
                  </table>
<!-- ---[/[MOD] multi-color site] --->

------ END of Installation ------

Now you can try to copy any stylesheets ( 8) from other templates but don't forget to rename each stylesheet) in your unique template directory and let your guest choose a new color in your home page. their choice is recorded in a cookie. so if they keep it, they keep the color.

Note : to make it work correctly, your background images must be in the stylesheets (i mean : no hard-coded background pics  :wink:).

Greetings.

8
After this mod, I wonder if it is possible to go farther:
 :?: Is it possible to allow the vote of the users from the thumbnails?

This would be translated by a dropdown list and a button of vote directly in thumbs 8) (for example below the lightbox button).

Any help will largely be appreciated.


9
Discussion & Troubleshooting / [SOLVED] How to make this tag work ???
« on: August 04, 2005, 10:18:39 PM »
Hi,
my problem is simple but ..... :twisted:
i can't make the tag is_admin working in my templates.

i have tried :
Code: [Select]
{if is_admin}
bla bla bla (HTML CODE here)
{endif is_admin}

not working

i also tried :
Code: [Select]
<?php
if ($is_admin)
{
?>

bla bla bla (HTML CODE here)
<?php
}
?>
Still not working !!!

So I looked for this tag in all the files (1.7.1) to have an example of use but it is used nowhere. :?

Can someone please help me?

Regards.


10
Hi,

I wish to stimulate the participation of the members of my site, because at the moment, they simply download images or send ecards. Those which leave an appreciation or a vote are very few.  :(

Is there a mod/hack to force the user to vote (or to comment) an image before authorizing him to download or to send an ecard?
basicly, buttons for download or send ecard are inactive as long as the user did not vote or did not comment on the image... 
That must not be too much complicated to set up... :roll:

Is there anybody who has already thought of it?

Regards.

11
Tested with 4images1.7
this mod allows users to send the complete ecard thanks to an email in HTML language .
the sender can choose between those notifications :
    1) text notification (classic way => default choice)
    2) whole ecard by html mail
    3) both methods (1 & 2 => 2 mails sent)

never forget to backup the files which you will modify.

 >> 04 files to edit from 4images root:

[change]/postcards.php
[change]/templates/<yourtemplate>/postcard_create.html
[change]/templates/<yourtemplate>/postcard_preview.html
[change]/lang/<yourlanguage>/main.php

 >> 01 new file to create from 4images root:

[new]/include/html_mime_mail.php


------ Installation ------

STEP 1:
Open postcards.php
1.1:
Find:
Code: [Select]
$recipient_email = un_htmlspecialchars(trim($HTTP_POST_VARS['recipient_email'])); Add after:
Code: [Select]
$email_format = $HTTP_POST_VARS['email_format'];
1.2:
Find:
Code: [Select]
include(ROOT_PATH.'includes/email.php');
    $site_email = new Email();
    $site_email->set_to(stripslashes($recipient_email));
    $site_email->set_from(stripslashes($sender_email), stripslashes($sender_name));
    $site_email->set_subject($lang['send_postcard_emailsubject']);
    $site_email->register_vars(array(
      "sender_name" => stripslashes($sender_name),
      "sender_email" => stripslashes($sender_email),
      "recipient_name" => stripslashes($recipient_name),
      "postcard_url" => stripslashes($postcard_url),
      "postcard_send_date" => format_date($config['date_format']." ".$config['time_format'], $current_time),
      "site_name" => $config['site_name']
    ));
    $site_email->set_body("postcard_message", $config['language_dir']);
    $site_email->send_email();
Replace with:
Code: [Select]

 if ($email_format == 'html' || $email_format == 'txthtml') {
 // email html
 
    include(ROOT_PATH.'includes/html_mime_mail.php');

  $html_to_send .= "<center>
   <table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" align=\"center\">
      <tr>
        <td>
          <table border=\"0\" cellspacing=\"0\" cellpadding=\"1\">
            <tr>
              <td bgcolor=\"".$border_color."\">
                <table border=\"0\" cellspacing=\"0\" cellpadding=\"10\" bgcolor=\"".$bg_color."\">
                  <tr>
                      <td valign=\"top\"><div><img src=\"".MEDIA_PATH."/".$cat_id."/".$image_row['image_media_file']."\" border=\"0\" /></div></td>
                    <td valign=\"top\" width=\"200\" height=\"250\">
                      <div align=\"right\"><img src=\"".TEMPLATE_PATH."/images/stamp.gif\" border=\"0\" /></div>
                      <br /><br />
                      <b><font face=\"".$font_face."\" color=\"".$font_color."\" size=\"4\">".$headline."</font></b>
  <br /><br />
                      <font face=\"".$font_face."\" color=\"".$font_color."\" size=\"2\">".$message."</font>
  <br /><br />
                      <font face=\"".$font_face."\" color=\"".$font_color."\" size=\"2\">".$sender_name."</font><br />
  <a href=\"mailto:".$sender_email."\"><font face=\"".$font_face."\" color=\"".$font_color."\" size=\"2\">".$sender_email."</font></a>
                    </td>
                  </tr>
                </table>
              </td>
            </tr>
          </table>
           <br />
        </td>
      </tr>
    </table>
     
         <b><font face=\"".$font_face."\" color=\"".$font_color."\" size=\"2\">See your eCard <a href=\"".$postcard_url."\">here</a>.</font><br />
         ".$config['site_name']."</center>";
 
  $mel = new html_mime_mail(102400, "iso-8859-1");
 
  $fp      = fopen(MEDIA_PATH."/".$cat_id."/".$image_row['image_media_file'], "r");
  $bin_img = fread($fp, filesize(MEDIA_PATH."/".$cat_id."/".$image_row['image_media_file']));
  fclose($fp);
  $mel->add_img($bin_img, MEDIA_PATH."/".$cat_id."/".$image_row['image_media_file'], "image/jpeg");
 
  $fp      = fopen(TEMPLATE_PATH."/images/stamp.gif", "r");
  $bin_img = fread($fp, filesize(TEMPLATE_PATH."/images/stamp.gif"));
  fclose($fp);
  $mel->add_img($bin_img, TEMPLATE_PATH."/images/stamp.gif", "image/gif");

  $mel->add_body($html_to_send);

  $mel->build_mail("base64", 5);

  $mel->send($sender_name, $sender_email, $recipient_name, $recipient_email, "eCard for you !");

  //echo $mel->get_rfc822($sender_name, $sender_email, $recipient_name, $recipient_email, "test ecard");

  } // end if

  if ($email_format == 'txt' || $email_format == 'txthtml') {
    include(ROOT_PATH.'includes/email.php');
    $site_email = new Email();
    $site_email->set_to(stripslashes($recipient_email));
    $site_email->set_from(stripslashes($sender_email), stripslashes($sender_name));
    $site_email->set_subject($lang['send_postcard_emailsubject']);
    $site_email->register_vars(array(
      "sender_name" => stripslashes($sender_name),
      "sender_email" => stripslashes($sender_email),
      "recipient_name" => stripslashes($recipient_name),
      "postcard_url" => stripslashes($postcard_url),
      "postcard_send_date" => format_date($config['date_format']." ".$config['time_format'], $current_time),
      "site_name" => $config['site_name']
    ));
    $site_email->set_body("postcard_message", $config['language_dir']);
    $site_email->send_email();
  } // end if
now, you can modify the code in $html_to_send .= to customize the final email.

1.3:
Find:
Code: [Select]

    $main_template = "postcard_preview";
    $image = get_media_code($image_row['image_media_file'], $image_id, $cat_id, $image_row['image_name'], $mode, 1);
    $thumbnail = get_thumbnail_code($image_row['image_media_file'], $image_row['image_thumb_file'], $image_id, $cat_id, $image_row['image_name'], $mode);
    $site_template->register_vars(array(
Add right after:
Code: [Select]

         "lang_postcard_email_format" => $lang['postcard_email_format'],
         "postcard_email_format" => ($HTTP_POST_VARS['email_format'] == 'txt') ? 'text' : (($HTTP_POST_VARS['email_format'] == 'html') ? 'HTML' : 'text & HTML'), 
         "email_format" => $HTTP_POST_VARS['email_format'],

1.4:
Find:
Code: [Select]

if ($action == "createcard") {
  if (!$sendprocess) {
    $bg_color = "";
    $border_color = "";
    $font_color = "";
    $font_face = "";
    $sender_name = ($user_info['user_level'] != GUEST) ? $user_info['user_name'] : "";
    $sender_email = ($user_info['user_level'] != GUEST) ? $user_info['user_email'] : "";
    $recipient_name = "";
    $recipient_email = "";
    $headline = "";
    $message = "";
  }
  $image = get_media_code($image_row['image_media_file'], $image_id, $cat_id, $image_row['image_name'], $mode, 1);
  $thumbnail = get_thumbnail_code($image_row['image_media_file'], $image_row['image_thumb_file'], $image_id, $cat_id, $image_row['image_name'], $mode);
  $site_template->register_vars(array(
Add right after:
Code: [Select]

      "lang_postcard_email_format" => $lang['postcard_email_format']."?",

Step 2:
Open /lang/<yourlanguage>/main.php
Add at the end of the file, just before ?> :
Code: [Select]
$lang['postcard_email_format'] = "Type of notification";
Step 3:
Open /templates/<yourtemplate>/postcard_create.html
Add this:
Code: [Select]

                            <tr>
                              <td class="row2" valign="top"><b>{lang_postcard_email_format}</b></td>
                              <td class="row2" valign="top">
                                <table border=0 cellspacing=3 cellpadding=1>
                                  <tr>
                                    <td>
                                      <input name="email_format" type="radio" value="txt" checked />
                                    </td>
                                    <td><font face="arial">Text</font></td>
                                    <td>
                                      <input name="email_format" type="radio" value="html" />
                                    </td>
                                    <td><font face="verdana">HTML</font></td>
                                    <td>
                                      <input name="email_format" type="radio" value="txthtml" />
                                    </td>
                                    <td><font face="arial">text & HTML</font></td>
                                  </tr>
                                </table>
                              </td>
                            </tr>

Step 4:
Open /templates/<yourtemplate>/postcard_preview.html
Add this:
Code: [Select]

<B>{lang_postcard_email_format}:</B> {postcard_email_format}
and this:
Code: [Select]

    <INPUT type="hidden" name="email_format" value="{email_format}" />

Step 5:
Download attched file, unzip it and copy it in 4images/includes/ directory.

------ END of Installation ------
 it should work !!! :wink:

Pages: [1]