Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - lotus69

Pages: [1]
1
Discussion & Troubleshooting / Re: How to update session var $user_info ?
« on: September 12, 2008, 05:33:18 AM »
It works if i use it in the same php script.

however I do this:

1) load page 1 (and display some value of $user_info (including 1 new value which does not come from the user_table)
2) then call of an other php (thru AJAX) which modify the $user_info (this script includes sessions.php & global.php)
3) The when I Refresh the page 1, I still got the old value of $user_info.

To get the "fresh one", I have to "force" the retreive of $user_info into a new variable with return_session_info() like:
Code: [Select]
  $sessInfo = $site_sess->return_session_info();
  $true_user_info = $sessInfo['user_info'];
or
Code: [Select]
$true_user_info = $site_sess->get_session_var('user_info');

2
Discussion & Troubleshooting / How to update session var $user_info ?
« on: September 11, 2008, 12:19:29 PM »
Hello,

I'm using 4images 1.7.3 and I would like to know how to update session variable such as $user_info ?
I'm using this
Code: [Select]
$site_sess->drop_session_var('user_info');
$site_sess->set_session_var('user_info', $my_fresh_new_user_info);
I thought it replaces the session and reload it

However, when the page is reloaded, if i print_r the $user_info, I still have the old data. I have to go to another page, then come to see the changes... I don't get it :/

Thank you for your help

Regards,
Lotus


3
Feedback & Suggestions / Re: 4images 1.7.3 - Feedback
« on: July 23, 2006, 01:21:55 AM »
yes it works, i haven't noticed that ;)
sorry

it seems that captcha works fine with FF 1.5 but with IE 6, user can bypass the captcha !!
can someone confirm that please ?

Please note that you dont have to type the code when you are logged in as admin.

4
Feedback & Suggestions / Re: 4images 1.7.3 - Feedback
« on: July 22, 2006, 05:06:09 PM »
it seems that captcha works fine with FF 1.5 but with IE 6, user can bypass the captcha !!
can someone confirm that please ?

5
for those who like me, have issue with special characters,
simply insert after $user_access = get_permission();
Code: [Select]
header("Content-type: text/css; charset=".$lang['charset']."");

$lang['charset'] must be set with "iso-8859-1" in your language main.php file

6
Feedback & Suggestions / Re: 4images 1.7.3 - Feedback
« on: July 22, 2006, 11:41:28 AM »
The captcha requires GD2 (GD1 is supported but was not fully tested), so if GD2 is not installed on your server you wont be able to use it.

thank you V@no, i've installed GD2 and now it shows the image, but it doesn't work anymore, if user enter a wrong code it success !

7
Feedback & Suggestions / Re: 4images 1.7.3 - Feedback
« on: July 21, 2006, 05:16:22 PM »
i disabled captcha because it doesn't work (image isn't generated) but i would like to use it, so have you any clue about this problem please ?

8
Feedback & Suggestions / Re: 4images 1.7.3 - Feedback
« on: July 19, 2006, 07:36:32 PM »
hello
i also have pb with captcha picture (before the upload).
the image isn't created and if i click it do nothing

if someone get an idea...

9
Hi, for those who wants to have furl like this :
www.yourdomain.com/image-image,name,id.html
www.yourdomain.com/categorie-categorie,name,id,page.html
www.yourdomain.com/recherche-name,page.html
www.yourdomain.com/nouvelles-images,1,page.html

(you can see it on my web site : www.yatahonga.com)

first : in sessions.php
find the url function and replace it by :
Code: [Select]
function good_name($nom) {

$nom = str_replace(' ', ',', $nom);
$nom = str_replace('_', ',', $nom);
$nom = str_replace('--', ',', $nom);
$nom = str_replace('---', ',', $nom);
$nom = str_replace(',,', ',', $nom);
$nom = str_replace(',,,', ',', $nom);

$nom = str_replace('&', '', $nom);
$nom = str_replace('©', '', $nom);
$nom = str_replace('~', '', $nom);
$nom = str_replace('°', '', $nom);
$nom = str_replace('+', '', $nom);
$nom = str_replace('=', '', $nom);
   
$accent = "ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûýýþÿ";
$noaccent = "aaaaaaaceeeeiiiidnoooooouuuuybsaaaaaaaceeeeiiiidnoooooouuuyyby";
$nom = strtr(trim($nom),$accent,$noaccent);

return $nom;

}




  function url($url, $amp = "&", $nom = "" ) {
    global $l, $user_info;
       
    // on enleve les caracteres spéciaux du nom
   
$nom=$this->good_name($nom); 
   
 
    $dummy_array = explode("#", $url);
    $url = $dummy_array[0];
    $url = str_replace('&', '&', $url);
   
   
   
   
    if (!defined('IN_CP')) {
      if (strstr($url, 'index.php')) {
        $url = str_replace('index.php', '', $url);
      }
     
// POUR LA PAGE SEARCH.PHP     
      elseif (strstr($url, 'search.php')) {
        if (strstr($url, 'page=')) {
          preg_match('#page=([0-9]+)&?#', $url, $matches);
          if (isset($matches[1])) {
            $split = explode('?', $url);
            $url = $split[0];
            $query = @$split[1];
            $url   = str_replace('search.php', 'recherche-images,'.$matches[1].'.html', $url);
            $query = str_replace('page='.$matches[1].'&', '', $query);
            $query = str_replace('&page='.$matches[1], '', $query);
            $query = str_replace('page='.$matches[1], '', $query);
            if (!empty($query)) {
              $url .= '?' . $query;
            }
          }
        }
        else if (strstr($url, 'search_new_images=')) {
          preg_match('#search_new_images=([0-9]+)&?#', $url, $matches);
          if (isset($matches[1])) {
            $split = explode('?', $url);
            $url = $split[0];
            $query = @$split[1];
            $url   = str_replace('search.php', 'nouvelles-images,'.$matches[1].'.html', $url);
          }
        } 
        else if (strstr($url, 'search_keywords=')) {
       
        //echo "<br>JE SUIS DS SEARCH KEYWORDS<br>";
       
          preg_match('#search_keywords=(.*)&?#', $url, $matches);
          if (isset($matches[1])) {
         
          //echo "<br>JE detecte les matchs : ".$matches[1]."<br>";
         
            $split = explode('?', $url);
            $url = $split[0];
            $query = @$split[1];
           
            //echo "<br>QUERY : ".$query[1]."<br>";
           
            $url   = str_replace('search.php', 'recherche-images,'.$matches[1].'.html', $url);
          }
        }       
        else {
          $url = str_replace('search.php', 'recherche-images.html', $url);
        }
      }

// POUR LA PAGE SEARCH_STATS.PHP     
 
      elseif (strstr($url, 'search_stats.php')) {
        $url = str_replace('search_stats.php', 'recherches-statistiques.html', $url);
      }     


// POUR LA PAGE CATEGORIE.PHP     
   
      elseif (strstr($url, 'categories.php')) {
        if (strstr($url, 'cat_id=') && strstr($url, 'page=')) {
          preg_match('#cat_id=([0-9]+)&?#', $url, $matches1);
          preg_match('#page=([0-9]+)&?#', $url, $matches2);
          if (isset($matches1[1]) && isset($matches2[1])) {
            $split = explode('?', $url);
            $url = $split[0];
            $query = @$split[1];
            $url   = str_replace('categories.php', 'categorie-'.$nom.','.$matches1[1].','.$matches2[1].'.html', $url);
            $query = str_replace('cat_id='.$matches1[1].'&', '', $query);
            $query = str_replace('&cat_id='.$matches1[1], '', $query);
            $query = str_replace('cat_id='.$matches1[1], '', $query);
            $query = str_replace('page='.$matches2[1].'&', '', $query);
            $query = str_replace('&page='.$matches2[1], '', $query);
            $query = str_replace('page='.$matches2[1], '', $query);
            if (!empty($query)) {
              $url .= '?' . $query;
            }
          }
        }
        elseif (strstr($url, 'cat_id=')) {
          preg_match('#cat_id=([0-9]+)&?#', $url, $matches);
          if (isset($matches[1])) {
            $split = explode('?', $url);
            $url = $split[0];
            $query = @$split[1];
            $url   = str_replace('categories.php', 'categorie-'.$nom.','.$matches[1].'.html', $url);
            $query = str_replace('cat_id='.$matches[1].'&', '', $query);
            $query = str_replace('&cat_id='.$matches[1], '', $query);
            $query = str_replace('cat_id='.$matches[1], '', $query);
            if (!empty($query)) {
              $url .= '?' . $query;
            }
          }
        }
       
        else {
          $url = str_replace('categories.php', 'cat.html', $url);
        }
      }
     
// POUR LA PAGE DETAILS.PHP     
       
      elseif (strstr($url, 'details.php?image_id=')) {
        if (strstr($url, 'image_id=') && strstr($url, 'mode=')) {
          preg_match('#image_id=([0-9]+)&?#', $url, $matches1);
          preg_match('#mode=([a-zA-Z0-9]+)&?#', $url, $matches2);
          if (isset($matches1[1]) && isset($matches2[1])) {
            $split = explode('?', $url);
            $url = $split[0];
            $query = @$split[1];
            $url   = str_replace('details.php','image-'.$nom.','.$matches1[1].'.'.$matches2[1].'.html', $url);
            $query = str_replace('image_id='.$matches1[1].'&', '', $query);
            $query = str_replace('&image_id='.$matches1[1], '', $query);
            $query = str_replace('image_id='.$matches1[1], '', $query);
            $query = str_replace('mode='.$matches2[1].'&', '', $query);
            $query = str_replace('&mode='.$matches2[1], '', $query);
            $query = str_replace('mode='.$matches2[1], '', $query);
            if (!empty($query)) {
              $url .= '?' . $query;
            }
          }
        }
        else {
          preg_match('#image_id=([0-9]+)&?#', $url, $matches);
          if (isset($matches[1])) {
            $split = explode('?', $url);
            $url = $split[0];
            $query = @$split[1];
            $url   = str_replace('details.php','image-'.$nom.','.$matches[1].'.html', $url);
            $query = str_replace('image_id='.$matches[1].'&', '', $query);
            $query = str_replace('&image_id='.$matches[1], '', $query);
            $query = str_replace('image_id='.$matches[1], '', $query);
            if (!empty($query)) {
              $url .= '?' . $query;
            }
          }
        }
      }
    }
    if ($this->mode == "get" && strstr($url, $this->session_id)) {
      $url .= strpos($url, '?') !== false ? '&' : '?';
      $url .= SESSION_NAME."=".$this->session_id;
    }
    if (!empty($l)) {
      $url .= strpos($url, '?') ? '&' : '?';
      $url .= "l=".$l;
    }
    $url = str_replace('&', $amp, $url);
    $url .= isset($dummy_array[1]) ? "#".$dummy_array[1] : "";
    return $url;
  }

// *************************************************************
// FIN URL REWRITING
// *************************************************************

Note that if you want others statics words, you have to change the differents str_replace for search, details and categories

STEP 2 : in functions.php

wherevever you see :
$site_sess->url(ROOT_PATH."details.php?"
AND
$site_sess->url(ROOT_PATH."categories.php?"

just add the thir agurment wich is the cat or image name of course !
ex :

in function get_thumbnail_code(), for the condition if ($showlink), i set :
$thumb = "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$image_id.((!empty($mode)) ? "&amp;mode=".$mode : ""),0,$image_name)."\" onclick=\"opendetailwindow()\" target=\"detailwindow\">".$thumb."</a>";

STEP 3 : paging.php

replace it by this :
Code: [Select]
<?php
/**************************************************************************
 *                                                                        *
 *    4images - A Web Based Image Gallery Management System               *
 *    ----------------------------------------------------------------    *
 *                                                                        *
 *             File: paging.php                                           *
 *        Copyright: (C) 2002 Jan Sorgalla                                *
 *            Email: jan@4homepages.de                                    *
 *              Web: http://www.4homepages.de                             *
 *    Scriptversion: 1.7                                                  *
 *                                                                        *
 *    Never released without support from: Nicky (http://www.nicky.net)   *
 *                                                                        *
 **************************************************************************
 *                                                                        *
 *    Dieses Script ist KEINE Freeware. Bitte lesen Sie die Lizenz-       *
 *    bedingungen (Lizenz.txt) für weitere Informationen.                 *
 *    ---------------------------------------------------------------     *
 *    This script is NOT freeware! Please read the Copyright Notice       *
 *    (Licence.txt) for further information.                              *
 *                                                                        *
 *************************************************************************/
if (!defined('ROOT_PATH')) {
  die(
"Security violation");
}

class 
Paging {
  var 
$page,$offset,$perpage,$num_rows_all,$link_args;
  var 
$first,$last,$total_pages,$config,$desc,$next,$back;

  function 
Paging($page 1$perpage 0$num_rows_all 0$link_args "") {
    global 
$lang$config;

    
$this->page $page;
    
$this->perpage $perpage;
    
$this->num_rows_all $num_rows_all;

    if (!isset(
$this->page) || !intval($this->page)) {
      
$this->page 1;
    }
    if (!
$this->num_rows_all) {
      
$this->total_pages 0;
    }
    elseif (
$this->num_rows_all <= $this->perpage) {
      
$this->total_pages 1;
    }
    elseif (
$this->num_rows_all $this->perpage == 0) {
      
$this->total_pages $this->num_rows_all $this->perpage;
    }
    else {
      
$this->total_pages ceil($this->num_rows_all $this->perpage);
    }
    if (
$this->page $this->total_pages) {
      
$this->page 1;
    }
    if (!
$this->num_rows_all) {
      
$this->first 0;
    }
    else {
      
$this->first $this->perpage $this->page $this->perpage 1;
    }
    if (!
$this->num_rows_all) {
      
$this->last 0;
    }
    elseif (
$this->page == $this->total_pages) {
      
$this->last $this->num_rows_all;
    }
    else {
      
$this->last $this->perpage $this->page;
    }

    
$this->offset $this->perpage $this->page $this->perpage;

    
$link_args ereg_replace("&page=[0-9]*"""$link_args);
    
$link_args ereg_replace("page=[0-9]*&"""$link_args);
    
$this->link_args basename($link_args);
    
$this->link_args .= preg_match("/\?/",$this->link_args) ? "&amp;" "?";

    
$this->desc $lang['paging_stats'];
    
$this->paging_next $lang['paging_next'];
    
$this->paging_back $lang['paging_previous'];
    
$this->paging_lastpage $lang['paging_lastpage'];
    
$this->paging_firstpage $lang['paging_firstpage'];
    
$this->range $config['paging_range'];
  }


// fct utile pour l'url rewriting
function good_page($url){

// on explode la chaine sur .
$url explode (".",$url);

//on ne renvoit que l'url sans le .html

return $url[0];
}




  function 
get_paging() {
    
$html "";
    if (
$this->total_pages 1) {
      
$page_back $this->page 1;
      
$page_next $this->page 1;

      if (
$page_back 0) {
        
$html .= "<a href=\"".$this->good_page($this->link_args).",1.html\" class=\"paging\">".$this->paging_firstpage."</a>&nbsp;&nbsp;";
        
$html .= "<a href=\"".$this->good_page($this->link_args).",$page_back.html\" class=\"paging\">".$this->paging_back."</a>&nbsp;&nbsp;";
      }
      for (
$page_num 1$page_num <= $this->total_pages$page_num++) {
        if (
$page_num >= ($this->page-$this->range) && $page_num <= ($this->page+$this->range)) {
          if (
$this->page == $page_num) {
            
$html .= "<b class=\"pagingon\">$page_num</b>&nbsp;&nbsp;";
          }
          else {
            
$html .= "<a href=\"".$this->good_page($this->link_args).",$page_num.html\" class=\"paging\">$page_num</a>&nbsp;&nbsp;";
          }
        }
      }
      if (
$page_next <= $this->total_pages) {
        
$html .= "<a href=\"".$this->good_page($this->link_args).",$page_next.html\" class=\"paging\">".$this->paging_next."</a>&nbsp;&nbsp;";
        
$html .= "<a href=\"".$this->good_page($this->link_args).",$this->total_pages.html\" class=\"paging\">".$this->paging_lastpage."</a>";
      }
    }
    return 
$html;
  }

  function 
get_offset() {
    return 
$this->offset;
  }

  function 
get_paging_stats() {
    global 
$site_template;
    
$search_array = array(
      
"/".$site_template->start."total_cat_images".$site_template->end."/iU",
      
"/".$site_template->start."total_pages".$site_template->end."/iU",
      
"/".$site_template->start."first_page".$site_template->end."/iU",
      
"/".$site_template->start."last_page".$site_template->end."/iU"
    
);
    
$replace_array = array(
      
$this->num_rows_all,
      
$this->total_pages,
      
$this->first,
      
$this->last
    
);
    
$this->desc preg_replace($search_array$replace_array$this->desc);
    return 
$this->desc;
  }
//end of class
?>


STEP 4 :  categories.php


in section SHOW IMAGE, juste replace

the $linkarg definition by :
$link_arg = $site_sess->url(ROOT_PATH."categories.php?".URL_CAT_ID."=".$cat_id,0,$cat_cache[$cat_id]['cat_name']);
( i just add the cat name ;) )


STEP 5 :  details.php


for next and prev image url, just add the name of the image like this :
Code: [Select]
$next_image_url = $site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$next_image_id.((!empty($mode)) ? "&amp;mode=".$mode : ""),0,$next_image_name);
Code: [Select]
$prev_image_url = $site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$prev_image_id.((!empty($mode)) ? "&amp;mode=".$mode : ""),0,$prev_image_name);

STEP 6 : search_form.html (template) and header.html (template too...)

for the form, add this : onsubmit="return form_url(this.search_keywords.value); "
(its a redirection function in order to get the name of the query

then add in your header this javascript function:
Code: [Select]
function form_url(keywords) {

// on remplace les espaces

ok_key = keywords.replace(/ /, ",");

location.href="http://www.YOURDOMAIN.com/recherche-images,"+ok_key+",1.html";
return false;
}
Note that if you change the statics words in STEP 1, you have to change it in this function

STEP 7 : change your htaccess...
here is mine :
Code: [Select]
RewriteEngine on



# REWRITE DES PAGES DETAILS

RewriteRule ^/image-(.*),([0-9]+)\.html$ /details.php?image_id=$2 [L]


# CATEGORIES

RewriteRule ^/categorie-(.*),([0-9]+),([0-9]+)\.html$ /categories.php?cat_id=$2&page=$3 [L]
RewriteRule ^/categorie-(.*),([0-9]+)\.html$ /categories.php?cat_id=$2 [L]



# SEARCH

RewriteRule ^/recherche-images\.html$ /search.php  [L]
RewriteRule ^/recherche-images,(.*),([0-9]+)\.html$ /search.php?show_result=1&search_keywords=$1&page=$2  [L]
RewriteRule ^/recherche-images,(.*)\.html$ /search.php?show_result=1&search_keywords=$1  [L]

RewriteRule ^recherches-statistiques\.html$ /search_stats.php  [L]
RewriteRule ^recherches-statistiques,([0-9]+)\.html$ /search_stats.php?page=$1  [L]



RewriteRule ^/nouvelles-images,1\.html$ /search.php?search_new_images=1  [L]
RewriteRule ^/nouvelles-images,1,([0-9]+)\.html$ /search.php?search_new_images=1&page=$1  [L]


And that's all ! (its quite easy, don't be afraid...)
the main function is function url in sessions.php, its here you have to pay attention for the name of your rewriting
and in all other page, you just have to add the name of categorie, image, search or whatever when you call the function url()
If you understand, you can do it for lighbox.php, member.php, postcard.php etc....

Best regards !
cyril

ps : i hope you understand how i code this and i apologize for my bad english

10
Thanks V@no :)

Maweryk : i haven't code yet, but it's the same thing.
i'll post a reply as soon as i finish

use it like this:
Code: [Select]
function url($url, $amp = "&amp;", $name = "" ) {this way the third argument is an optional ;)

11
Hi, i would like to add the image name in the URL like this : www.mydomain.com/img,IMAGE-NAME,id.html

i can do it if i add an argument in the url function like this
Code: [Select]
function url($url, $amp = "&amp;", $name ) {
...
$url   = str_replace('details.php', 'img,'.$name.','.$matches[1].'.html', $url);

}


then in details.php, i put this code for previous image link :
Code: [Select]
$prev_image_url = $site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$prev_image_id.((!empty($mode)) ? "&amp;mode=".$mode : ""),0,$prev_image_name);

but, honnestly, its very boring to change every "$site_sess->url()" to add the third argument, so does anyone have an idea please ?
i would like to do the same for categories and search

thanks for help


Pages: [1]