Annonce

Écrire une réponse

Veuillez écrire votre message et l'envoyer

Cliquez dans la zone sombre de l'image pour envoyer votre message.

Retour

Résumé de la discussion (messages les plus récents en premier)

thegimly
2006-06-07 14:29:57

Salut à tous,

J'arrive pas a trouver le code a inserer dans category.php pour avoir un compteur live et total, pourriez vous m'aider, je cherche depusi plus d'une heure j'en peu plus :(
PS : j'ai déja modifié le category.tpl de mon template, ca donen ca pour le moment : http://lewebdeseb.free.fr
Merci à vous.

CyberFly
2006-01-06 14:20:49

Salut Volcom !!!

oui...oui...je sais...je sais...je suis vraiment un newbie de première...je viens juste de m'apercevoir
que j'avais effectivement pas cocher l'option....

Ben je sais pas quoi dire......si ...merci
et désolé du dérangement..
...oooops!!

volcom
2006-01-06 14:05:03

il faut activer l'historique pour avoir des données .. !

CyberFly
2006-01-06 13:54:26

Salut!

Ben en fait quand je vais dans historique il y a plein d'onglets statistique mensuel, ou aujourd'hui
mais c'est vide....il n'y a aucune entrées....

Oui, le compteur m'intéresse aussi tout comme l'intégration des membres ou visiteurs connectés dans le menu....
mais je n'arrive pas à trouver ce que je veux dands la tonne de post proposé....lol

Merci ;-)

volcom
2006-01-06 13:25:03

ce MOD a été intégré dans la version 1.5.  Par choix, nous n'avons pas intégré des fonctionnalités comme le compteur d'utilisateurs connectés. Est ce cela que tu cherches à ajouter ?

CyberFly
2006-01-06 13:03:18

Salut !


J'ai besoin d'aide SVP...voilà j'ai la dernière version 1.5.2 et je voudrais installé ce mod historique.
Or, une fois les modifs fichiers commencer je me heurte à des "FIND" introuvable comme par exemple :


dans admin/configuration.php
#-----[ FIND ]------------------------------------------
#

        'L_CONF_GALLERY_LOCKED_INFO'=>$lang['conf_gallery_locked_info'],

je trouve pas il y a bien un truc qui ressemble alors j'ai collé derrière........


#-----[ OPEN ]------------------------------------------
#

language/en_UK.iso-8859-1/admin.lang.php

#
#-----[ FIND ]------------------------------------------
#

$lang['conf_gallery_locked_info'] = 'Lock the entire gallery for maintenance. Only administrator users will be able to reach the gallery';


Là par contre j'ai rien trouvé qui puisse ressembler.....


et

#-----[ OPEN ]------------------------------------------
#

include/config.inc.php


n'existe plus si ne me trompe-je ??? c'est le défaut ou le local qu'il faut modifier.....

HELP.....HELP......HELP


Merci @ vous !!!

loicosss
2005-10-20 16:46:03

ced26 a écrit:

digimic a écrit:

e-poussin a écrit:


C'est fait: tu le paramètres dans le menu Général (dans la partie administration).

je suis dans la partie administration mais je ne vois pas cette option ??

Par contre, moi je l'ai bien ce bouton... (ca s'appelle "historiser les actions de l'administrateur")

Après avoir voulu installé cette formidable avancée technologique, j'ai rencontré deux problèmes.
Tout d'abord, comme Digimic, je n'arrive pas à avoir le bouton "historiser les actions de l'admin". Je possède plusieurs thèmes (6 en tout y compris le défault) et j'ai bien effectué la modification sur l'ensemble des fichiers configuration.tpl et stats.tpl  mais le problème persiste.

Ensuite, mon deuxième probleme est l'affichage d'un message d'erreur lors de l'affichage de l'image sélectionné. Tout va bien jusqu'à l'affichage des miniatures mais lorsque je clic dessus, l'image apparait avec en haut le message suivant

"Warning: in_array(): Wrong datatype for second argument in /var/www/free.fr/9/6/loicosss/picture.php on line 166"



Voilà une copie du bout de code incriminé, il s'agit de la différenciation entre image et vidéo:

"$picture[$i]['is_picture'] = false;
  if (in_array(get_extension($row['file']), $conf['picture_ext']))
  {
    $picture[$i]['is_picture'] = true;
  }
 
$picture[$i]['is_movie'] = false;
  if (in_array(get_extension($row['file']), $conf['movie_ext']))                 <------- c'est la ligne 166 en question
  {
    $picture[$i]['is_movie'] = true;
  }




Je précise que je n'avais pas cette erreur avant!!! si quelqu'un pourrait m'éclairer sur la marche à suivre pour chacun de mes deux problèmes???
Sincèrement merci. :D

seb69
2005-10-10 08:42:10

noiry a écrit:

Code:

 // BEGIN Stats Detaillé MOD
  if (
    (!in_array($_SERVER['REMOTE_ADDR'], split(';', $conf['IPList']))) and
    ($conf['logadmin'] or (!$conf['logadmin'] and ($user['status'] != 'admin')))
    )
  {
  // END Stats Detaillé MOD

Tous les admins sont invisibles comme cela...

En effet, c'est beaucoup mieux.
Merci.
Seb

cda
2005-10-08 21:43:19

cda a écrit:

noiry a écrit:

cda a écrit:

...

A l'exécution, la page d'accueil "category" s'affiche normalement ainsi que la page "admin" générale. Mais à la sélection d' "historique" j'obtiens le message d'erreur suivant:

Parse error: parse error, unexpected T_STRING in /var/www/free.fr/2/6/chemindarles/phpwebgallery/include/template.php(193) : eval()'d code on line 16

Fais nous en copier/coller de ton fichier (mets des balises [ code] et [ /code] (sans l'espace après le '[' )  -> c'est pour l'affichage).

merci noiry de ta proposition d'aide. Je te fais une copie des 2 fichiers php.

J'ai défait puis refait et maintenant tout marche :). Sans doute un copier-coller incomplet ou pas au bon endroit. Erreur de débutant pas assez appliqué :(.
Merci en tout cas à Noiry d'avoir proposer un coup de main.
Et félicitations à e-poussin pour le super boulot.

cda
2005-10-07 11:40:19

noiry a écrit:

cda a écrit:

...

A l'exécution, la page d'accueil "category" s'affiche normalement ainsi que la page "admin" générale. Mais à la sélection d' "historique" j'obtiens le message d'erreur suivant:

Parse error: parse error, unexpected T_STRING in /var/www/free.fr/2/6/chemindarles/phpwebgallery/include/template.php(193) : eval()'d code on line 16

Une erreur similaire (avec "eval()'d code on line 39" à la place de "line 16") se produit à la sélection de chacune des 6 sections de la page "configuration".

J'arrive bien à voir d'où ça vient dans template.php et à remonter à stats.php mais comme je suis néophyte en PHP, j'ai du mal à m'y retrouver.

Fais nous en copier/coller de ton fichier (mets des balises [ code] et [ /code] (sans l'espace après le '[' )  -> c'est pour l'affichage).

merci noiry de ta proposition d'aide. Je te fais une copie des 2 fichiers php. D'abord template.php : l'eval($code) fautif semble appartenir à la function assign_var_from_handle($varname, $handle) ....

Code:

<?php
// +-----------------------------------------------------------------------+
// | PhpWebGallery - a PHP based picture gallery                           |
// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
// | Copyright (C) 2003-2005 PhpWebGallery Team - http://phpwebgallery.net |
// +-----------------------------------------------------------------------+
// | branch        : BSF (Best So Far)
// | file          : $RCSfile: template.php,v $
// | last update   : $Date: 2005/03/12 10:51:08 $
// | last modifier : $Author: plg $
// | revision      : $Revision: 1.8 $
// +-----------------------------------------------------------------------+
// | This program is free software; you can redistribute it and/or modify  |
// | it under the terms of the GNU General Public License as published by  |
// | the Free Software Foundation                                          |
// |                                                                       |
// | This program is distributed in the hope that it will be useful, but   |
// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
// | General Public License for more details.                              |
// |                                                                       |
// | You should have received a copy of the GNU General Public License     |
// | along with this program; if not, write to the Free Software           |
// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
// | USA.                                                                  |
// +-----------------------------------------------------------------------+

/**
 * Template class. By Nathan Codding of the phpBB group. The interface was
 * originally inspired by PHPLib templates, and the template file formats
 * are quite similar.
 */

class Template {

  var $classname = "Template";
  
  // variable that holds all the data we'll be substituting into
  // the compiled templates.
  // ...
  // This will end up being a multi-dimensional array like this :
  // $this->_tpldata[block.][iteration#][child.][iteration#][child2.][iteration#][variablename] == value
  // if it's a root-level variable, it'll be like this:
  // $this->_tpldata[.][0][varname] == value
  var $_tpldata = array();
  
  // Hash of filenames for each template handle.
  var $files = array();
  
  // Root template directory.
  var $root = "";

  // this will hash handle names to the compiled code for that handle.
  var $compiled_code = array();
  
  // This will hold the uncompiled code for that handle.
  var $uncompiled_code = array();

  // output
  var $output = '';
  
  /**
   * Constructor. Simply sets the root dir.
   *
   */
  function Template($root = ".")
    {
      $this->set_rootdir($root);
    }
  
  /**
   * Destroys this template object. Should be called when you're done with
   * it, in order to clear out the template data so you can load/parse a new
   * template set.
   */
  function destroy()
    {
      $this->_tpldata = array();
    }

  /**
   * Sets the template root directory for this Template object.
   */
  function set_rootdir($dir)
    {
      if (!is_dir($dir))
      {
        return false;
      }
      
      $this->root = $dir;
      return true;
    }
  
  /**
   * Sets the template filenames for handles. $filename_array should be a
   * hash of handle => filename pairs.
   */
  function set_filenames($filename_array)
    {
      if (!is_array($filename_array))
      {
        return false;
      }
      
      reset($filename_array);
      while(list($handle, $filename) = each($filename_array))
      {
        $this->files[$handle] = $this->make_filename($filename);
      }
      
      return true;
    }
  
  
  /**
   * Load the file for the handle, compile the file, and run the compiled
   * code. This will print out the results of executing the template.
   */
  function pparse($handle)
    {
      if (!$this->loadfile($handle))
      {
        die("Template->pparse(): Couldn't load template file for handle $handle");
      }
      
      // actually compile the template now.
      if (!isset($this->compiled_code[$handle]) || empty($this->compiled_code[$handle]))
      {
        // Actually compile the code now.
        $this->compiled_code[$handle] = $this->compile($this->uncompiled_code[$handle]);
      }

      // Run the compiled code.
      //echo ("<!-- ".$this->compiled_code[$handle]." -->");
      eval($this->compiled_code[$handle]);
      return true;
    }

  /**
   * fills $output template var
   */
  function parse($handle)
    {
      if (!$this->loadfile($handle))
      {
        die("Template->pparse(): Couldn't load template file for handle $handle");
      }
      
      // actually compile the template now.
      if (!isset($this->compiled_code[$handle]) || empty($this->compiled_code[$handle]))
      {
        // Actually compile the code now.
        $this->compiled_code[$handle] = $this->compile($this->uncompiled_code[$handle], true, '_str');
      }

      // Run the compiled code.
      $_str = '';
      eval($this->compiled_code[$handle]);
      $this->output.= $_str;

      return true;
    }

  /**
   * prints $output template var
   */
  function p()
    {
      echo $this->output;
    }
  
  /**
   * Inserts the uncompiled code for $handle as the value of $varname in the
   * root-level. This can be used to effectively include a template in the
   * middle of another template.
   *
   * Note that all desired assignments to the variables in $handle should be
   * done BEFORE calling this function.
   */
  function assign_var_from_handle($varname, $handle)
    {
      if (!$this->loadfile($handle))
      {
        die("Template->assign_var_from_handle(): Couldn't load template file for handle $handle");
      }
      
      // Compile it, with the "no echo statements" option on.
      $_str = "";
      $code = $this->compile($this->uncompiled_code[$handle], true, '_str');
      
      // evaluate the variable assignment.
      eval($code);
      // assign the value of the generated variable to the given varname.
      $this->assign_var($varname, $_str);
      
      return true;
    }
  
  /**
   * Block-level variable assignment. Adds a new block iteration with the
   * given variable assignments. Note that this should only be called once
   * per block iteration.
   */
  function assign_block_vars($blockname, $vararray)
    {
      if (strstr($blockname, '.'))
      {
        // Nested block.
        $blocks = explode('.', $blockname);
        $blockcount = sizeof($blocks) - 1;
        $str = '$this->_tpldata';
        for ($i = 0; $i < $blockcount; $i++)
        {
          $str .= '[\'' . $blocks[$i] . '.\']';
          eval('$lastiteration = sizeof(' . $str . ') - 1;');
          $str .= '[' . $lastiteration . ']';
        }
        // Now we add the block that we're actually assigning to.
        // We're adding a new iteration to this block with the given
        // variable assignments.
        $str .= '[\'' . $blocks[$blockcount] . '.\'][] = $vararray;';
        
        // Now we evaluate this assignment we've built up.
        eval($str);
      }
      else
      {
        // Top-level block. Add a new iteration to this block with the
        // variable assignments we were given.
        $this->_tpldata[$blockname . '.'][] = $vararray;
      }
      
      return true;
    }
  
  /**
   * Root-level variable assignment. Adds to current assignments, overriding
   * any existing variable assignment with the same name.
   */
  function assign_vars($vararray)
    {
      reset ($vararray);
      while (list($key, $val) = each($vararray))
      {
        $this->_tpldata['.'][0][$key] = $val;
      }
      
      return true;
    }
  
  /**
   * Root-level variable assignment. Adds to current assignments, overriding
   * any existing variable assignment with the same name.
   */
  function assign_var($varname, $varval)
    {
      $this->_tpldata['.'][0][$varname] = $varval;
      
      return true;
    }
  
  
  /**
   * Generates a full path+filename for the given filename, which can either
   * be an absolute name, or a name relative to the rootdir for this
   * Template object.
   */
  function make_filename($filename)
    {
      // Check if it's an absolute or relative path.
      if (substr($filename, 0, 1) != '/')
      {
        $filename = $this->root.'/'.$filename;
      }
      
      if (!file_exists($filename))
      {
        die("Template->make_filename(): Error - file $filename does not exist");
      }

      return $filename;
    }
  
  
  /**
   * If not already done, load the file for the given handle and populate
   * the uncompiled_code[] hash with its code. Do not compile.
   */
  function loadfile($handle)
    {
      // If the file for this handle is already loaded and compiled, do
      // nothing.
      if (isset($this->uncompiled_code[$handle])
          and !empty($this->uncompiled_code[$handle]))
      {
        return true;
      }
      
      // If we don't have a file assigned to this handle, die.
      if (!isset($this->files[$handle]))
      {
        die("Template->loadfile(): No file specified for handle $handle");
      }
      
      $filename = $this->files[$handle];
      
      $str = implode("", @file($filename));
      if (empty($str))
      {
        die("Template->loadfile(): File $filename for handle $handle is empty");
      }
      
      $this->uncompiled_code[$handle] = $str;
      
      return true;
    }
  
  
  
  /**
   * Compiles the given string of code, and returns the result in a string.
   *
   * If "do_not_echo" is true, the returned code will not be directly
   * executable, but can be used as part of a variable assignment for use in
   * assign_code_from_handle().
   */
  function compile($code, $do_not_echo = false, $retvar = '')
    {
      // replace \ with \\ and then ' with \'.
      $code = str_replace('\\', '\\\\', $code);
      $code = str_replace('\'', '\\\'', $code);
      
      // change template varrefs into PHP varrefs
      
      // This one will handle varrefs WITH namespaces
      $varrefs = array();
      preg_match_all('#\{(([a-z0-9\-_]+?\.)+?)([a-z0-9\-_]+?)\}#is', $code, $varrefs);
      $varcount = sizeof($varrefs[1]);
      for ($i = 0; $i < $varcount; $i++)
      {
        $namespace = $varrefs[1][$i];
        $varname = $varrefs[3][$i];
        $new = $this->generate_block_varref($namespace, $varname);
        
        $code = str_replace($varrefs[0][$i], $new, $code);
      }
      
      // This will handle the remaining root-level varrefs
      $code = preg_replace('#\{([a-z0-9\-_]*?)\}#is', '\' . ( ( isset($this->_tpldata[\'.\'][0][\'\1\']) ) ? $this->_tpldata[\'.\'][0][\'\1\'] : \'\' ) . \'', $code);
      
      // Break it up into lines.
      $code_lines = explode("\n", $code);
      
      $block_nesting_level = 0;
      $block_names = array();
      $block_names[0] = ".";
      
      // Second: prepend echo ', append ' . "\n"; to each line.
      $line_count = sizeof($code_lines);
      for ($i = 0; $i < $line_count; $i++)
      {
        $code_lines[$i] = chop($code_lines[$i]);
        if (preg_match('#<!-- BEGIN (.*?) -->#', $code_lines[$i], $m))
        {
          $n[0] = $m[0];

          $n[1] = $m[1];
          
          // Added: dougk_ff7-Keeps templates from bombing if begin is on
          // the same line as end.. I think. :)
          if ( preg_match('#<!-- END (.*?) -->#', $code_lines[$i], $n) )
          {
            $block_nesting_level++;
            $block_names[$block_nesting_level] = $m[1];
            if ($block_nesting_level < 2)
            {
              // Block is not nested.
              $code_lines[$i] = '$_' . $n[1] . '_count = ( isset($this->_tpldata[\'' . $n[1] . '.\']) ) ?  sizeof($this->_tpldata[\'' . $n[1] . '.\']) : 0;';
              $code_lines[$i] .= "\n" . 'for ($_' . $n[1] . '_i = 0; $_' . $n[1] . '_i < $_' . $n[1] . '_count; $_' . $n[1] . '_i++)';
              $code_lines[$i] .= "\n" . '{';
            }
            else
            {
              // This block is nested.
              
              // Generate a namespace string for this block.
              $namespace = implode('.', $block_names);
              // strip leading period from root level..
              $namespace = substr($namespace, 2);
              // Get a reference to the data array for this block that depends on the
              // current indices of all parent blocks.
              $varref = $this->generate_block_data_ref($namespace, false);
              // Create the for loop code to iterate over this block.
              $code_lines[$i] = '$_' . $n[1] . '_count = ( isset(' . $varref . ') ) ? sizeof(' . $varref . ') : 0;';
              $code_lines[$i] .= "\n" . 'for ($_' . $n[1] . '_i = 0; $_' . $n[1] . '_i < $_' . $n[1] . '_count; $_' . $n[1] . '_i++)';
              $code_lines[$i] .= "\n" . '{';
            }
            
            // We have the end of a block.
            unset($block_names[$block_nesting_level]);
            $block_nesting_level--;
            $code_lines[$i] .= '} // END ' . $n[1];
            $m[0] = $n[0];
            $m[1] = $n[1];
          }
          else
          {
            // We have the start of a block.
            $block_nesting_level++;
            $block_names[$block_nesting_level] = $m[1];
            if ($block_nesting_level < 2)
            {
              // Block is not nested.
              $code_lines[$i] = '$_' . $m[1] . '_count = ( isset($this->_tpldata[\'' . $m[1] . '.\']) ) ? sizeof($this->_tpldata[\'' . $m[1] . '.\']) : 0;';
              $code_lines[$i] .= "\n" . 'for ($_' . $m[1] . '_i = 0; $_' . $m[1] . '_i < $_' . $m[1] . '_count; $_' . $m[1] . '_i++)';
              $code_lines[$i] .= "\n" . '{';
            }
            else
            {
              // This block is nested.
              
              // Generate a namespace string for this block.
              $namespace = implode('.', $block_names);
              // strip leading period from root level..
              $namespace = substr($namespace, 2);
              // Get a reference to the data array for this block that
              // depends on the current indices of all parent blocks.
              $varref = $this->generate_block_data_ref($namespace, false);
              // Create the for loop code to iterate over this block.
              $code_lines[$i] = '$_' . $m[1] . '_count = ( isset(' . $varref . ') ) ? sizeof(' . $varref . ') : 0;';
              $code_lines[$i] .= "\n" . 'for ($_' . $m[1] . '_i = 0; $_' . $m[1] . '_i < $_' . $m[1] . '_count; $_' . $m[1] . '_i++)';
              $code_lines[$i] .= "\n" . '{';
            }
          }
        }
        else if (preg_match('#<!-- END (.*?) -->#', $code_lines[$i], $m))
        {
          // We have the end of a block.
          unset($block_names[$block_nesting_level]);
          $block_nesting_level--;
          $code_lines[$i] = '} // END ' . $m[1];
        }
        else
        {
          // We have an ordinary line of code.
          if (!$do_not_echo)
          {
            $code_lines[$i] = 'echo \'' . $code_lines[$i] . '\' . "\\n";';
          }
          else
          {
            $code_lines[$i] = '$' . $retvar . '.= \'' . $code_lines[$i] . '\' . "\\n";'; 
          }
        }
      }
      
      // Bring it back into a single string of lines of code.
      $code = implode("\n", $code_lines);
      return $code  ;
      
    }
  
  
  /**
   * Generates a reference to the given variable inside the given (possibly
   * nested) block namespace. This is a string of the form: '
   * . $this->_tpldata['parent'][$_parent_i]['$child1'][$_child1_i]['$child2'][$_child2_i]...['varname']
   * . ' It's ready to be inserted into an "echo" line in one of the
   * templates.  NOTE: expects a trailing "." on the namespace.
   */
  function generate_block_varref($namespace, $varname)
    {
      // Strip the trailing period.
      $namespace = substr($namespace, 0, strlen($namespace) - 1);
      
      // Get a reference to the data block for this namespace.
      $varref = $this->generate_block_data_ref($namespace, true);
      // Prepend the necessary code to stick this in an echo line.
      
      // Append the variable reference.
      $varref .= '[\'' . $varname . '\']';
      
      $varref = '\' . ( ( isset(' . $varref . ') ) ? ' . $varref . ' : \'\' ) . \'';
      
      return $varref;
      
    }
  
  
  /**
   * Generates a reference to the array of data values for the given
   * (possibly nested) block namespace. This is a string of the form:
   * $this->_tpldata['parent'][$_parent_i]['$child1'][$_child1_i]['$child2'][$_child2_i]...['$childN']
   *
   * If $include_last_iterator is true, then [$_childN_i] will be appended
   * to the form shown above.  NOTE: does not expect a trailing "." on the
   * blockname.
   */
  function generate_block_data_ref($blockname, $include_last_iterator)
    {
      // Get an array of the blocks involved.
      $blocks = explode(".", $blockname);
      $blockcount = sizeof($blocks) - 1;
      $varref = '$this->_tpldata';
      // Build up the string with everything but the last child.
      for ($i = 0; $i < $blockcount; $i++)
      {
        $varref .= '[\'' . $blocks[$i] . '.\'][$_' . $blocks[$i] . '_i]';
      }
      // Add the block reference for the last child.
      $varref .= '[\'' . $blocks[$blockcount] . '.\']';
      // Add the iterator for the last child if requried.
      if ($include_last_iterator)
      {
              $varref .= '[$_' . $blocks[$blockcount] . '_i]';
      }
      
      return $varref;
    }
  
}

?>

... la ligne 193 du parse error correspond à eval($code). Par contre je ne vois pas à quoi correspond la ligne 16 du même message. Je te fais une copie de stats.php qui fait appel à la fonction assign_var_from_handle() dans sa dernière ligne de code (si j'ai bien compris ce qui se passe)

Code:

<?php
// +-----------------------------------------------------------------------+
// | PhpWebGallery - a PHP based picture gallery                           |
// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
// | Copyright (C) 2003-2005 PhpWebGallery Team - http://phpwebgallery.net |
// +-----------------------------------------------------------------------+
// | branch        : BSF (Best So Far)
// | file          : $RCSfile: stats.php,v $
// | last update   : $Date: 2005/02/01 07:28:38 $
// | last modifier : $Author: plg $
// | revision      : $Revision: 1.22 $
// +-----------------------------------------------------------------------+
// | This program is free software; you can redistribute it and/or modify  |
// | it under the terms of the GNU General Public License as published by  |
// | the Free Software Foundation                                          |
// |                                                                       |
// | This program is distributed in the hope that it will be useful, but   |
// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
// | General Public License for more details.                              |
// |                                                                       |
// | You should have received a copy of the GNU General Public License     |
// | along with this program; if not, write to the Free Software           |
// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
// | USA.                                                                  |
// +-----------------------------------------------------------------------+
if( !defined("PHPWG_ROOT_PATH") )
{
  die ("Hacking attempt!");
}
include_once( PHPWG_ROOT_PATH.'admin/include/isadmin.inc.php' );

$url_img_global_report = PHPWG_ROOT_PATH.'admin/images/global_stats.img.php';
//----------------------------------------------------- template initialization
$template->set_filenames( array('stats'=>'admin/stats.tpl') );

$template->assign_vars(array(
  'L_MONTH'=>$lang['w_month'],
  'L_PAGES_SEEN'=>$lang['stats_pages_seen'],
  'L_VISITORS'=>$lang['visitors'],
  'L_PICTURES'=>$lang['pictures'],
  'L_STAT_TITLE'=>$lang['stats_title'],
  'L_STAT_MONTH_TITLE'=>$lang['stats_month_title'],
  'L_STAT_MONTHLY_ALT'=>$lang['stats_global_graph_title'],

// BEGIN Stats Detaillé MOD  
  'L_STAT_DATE'=>$lang['stats_date'],
  'L_STAT_LOGIN'=>$lang['stats_login'],
  'L_STAT_ADDR'=>$lang['stats_addr'],
  'L_STAT_CATEGORY'=>$lang['stats_category'],
  'L_STAT_FILE'=>$lang['stats_file'],
  'L_STAT_PICTURE'=>$lang['stats_picture'],
// END Stats Detaillé MOD
  
  'IMG_MONTHLY_REPORT'=>add_session_id($url_img_global_report)
  ));

//---------------------------------------------------------------- log  history
$query = '
SELECT DISTINCT COUNT(*) as p,
       MONTH(date) as m,
       YEAR(date) as y
  FROM '.HISTORY_TABLE.' 
  GROUP BY DATE_FORMAT(date,\'%Y-%m\') DESC
;';
$result = pwg_query( $query );
$i=0;
while ( $row = mysql_fetch_array( $result ) )
{
  $current_month = $row['y']."-";
  if ($row['m'] <10) {$current_month.='0';}
  $current_month .= $row['m'];
  // Number of pictures seen
  $query = '
SELECT COUNT(*) as p,
       FILE as f
  FROM '.HISTORY_TABLE.' 
  WHERE DATE_FORMAT(date,\'%Y-%m\') = \''.$current_month.'\'
    AND FILE = \'picture\'
  GROUP BY FILE
;';
  $pictures = mysql_fetch_array(pwg_query( $query ));
  
  // Number of different visitors
  $query = '
SELECT COUNT(*) as p, login
  FROM '.HISTORY_TABLE.' 
  WHERE DATE_FORMAT(date,\'%Y-%m\') = \''.$current_month.'\'
  GROUP BY login, IP
;';
  $user_results = pwg_query( $query );
  $nb_visitors = 0;
  $auth_users = array();
  while ( $user_array = mysql_fetch_array( $user_results ) )
  {
    if ($user_array['login'] == 'guest') 
    $nb_visitors += 1;
  else
    array_push($auth_users, $user_array['login']);
  }
  $nb_visitors +=count(array_unique($auth_users));
  $class = ($i % 2)? 'row1':'row2'; $i++;
  
  $template->assign_block_vars('month',array(
    'MONTH'=>$lang['month'][$row['m']].' '.$row['y'],
  'PAGES'=>$row['p'],
  'VISITORS'=>$nb_visitors,
  'IMAGES'=>$pictures['p'],

  // BEGIN Stats Detaillé MOD
  'URL'=>add_session_id(PHPWG_ROOT_PATH.'admin.php?page=stats&month='.$current_month),
  // END Stats Detaillé MOD
  
  'T_CLASS'=>$class
    ));
}
$nb_visitors = mysql_num_rows( $result );
$days = array();
$max_nb_visitors = 0;
$max_pages_seen = 0;

// BEGIN Stats Detaillé MOD
if (isset( $_GET['month'] ))
{
  $current_month = $_GET['month'];
  
  // Set WHERE clause (MOD Stats)
  $where = ' WHERE DATE_FORMAT(date,\'%Y-%m\') = \''.$current_month.'\'';
  
  // Set LIMIT clause (MOD Stats)
  $limit = ' LIMIT ';
  $page['start'] = 0;
  if (isset($_GET['start']) and is_numeric($_GET['start'])) $page['start'] = abs($_GET['start']);
  $limit .= $page['start'];
  $limit .= ','.$conf['nb_logs_page'];

  $query = '
  SELECT date, login, IP, category, file, picture
    FROM '.HISTORY_TABLE.
    $where.'
    ORDER BY date DESC'.
    $limit.
    ';';
  $result = pwg_query( $query );
  $i=0;
  while ( $row = mysql_fetch_array( $result ) )
  {
    $class = ($i % 2)? 'row1':'row2'; $i++;

    $template->assign_block_vars('detail',array(
    'DATE'=>$row['date'],
    'LOGIN'=>$row['login'],
    'IP'=>gethostbyaddr($row['IP']),
    'CATEGORY'=>$row['category'],
    'FILE'=>$row['file'],
    'PICTURE'=>$row['picture'],
    'T_CLASS'=>$class
    ));
  }
  
  // Get total number of logs (MOD Stats)
  $query = '
      SELECT COUNT(date) as nb_logs
       FROM '.HISTORY_TABLE.
    $where.'
      ;';
  
    $result = pwg_query($query);
    $row = mysql_fetch_array($result);
    $page['nb_logs']=$row['nb_logs'];
  
    //display nav bar (MOD Stats)
    $url = $_SERVER['PHP_SELF'].'?page=stats&month='.$_GET['month'];

    $page['navigation_bar'] =
      create_navigation_bar( $url, $page['nb_logs'],$page['start'],$conf['nb_logs_page'], 'admin' );
  $template->assign_block_vars(
      'navigation',
      array('NAV_BAR' => $page['navigation_bar'])
      );
}
// END Stats Detaillé MOD

//----------------------------------------------------------- sending html code
$template->assign_var_from_handle('ADMIN_CONTENT', 'stats');
?>

Précision absente de mon premier post, pour le cas où ça peut t'aider à cerner la source du pb: dans la page "config" qui affiche le "parse error", le menu d'administration à gauche et le titre "historique" en haut sont également également affichés.

noiry
2005-10-07 10:07:41

cda a écrit:

...

A l'exécution, la page d'accueil "category" s'affiche normalement ainsi que la page "admin" générale. Mais à la sélection d' "historique" j'obtiens le message d'erreur suivant:

Parse error: parse error, unexpected T_STRING in /var/www/free.fr/2/6/chemindarles/phpwebgallery/include/template.php(193) : eval()'d code on line 16

Une erreur similaire (avec "eval()'d code on line 39" à la place de "line 16") se produit à la sélection de chacune des 6 sections de la page "configuration".

J'arrive bien à voir d'où ça vient dans template.php et à remonter à stats.php mais comme je suis néophyte en PHP, j'ai du mal à m'y retrouver.

Fais nous en copier/coller de ton fichier (mets des balises [ code] et [ /code] (sans l'espace après le '[' )  -> c'est pour l'affichage).

cali a écrit:

t'es sur ?
je ne suis pas expert en la matiére, loin s'en faut :D
mais c'est pas plutot à la place de "username" qu'on devrait mettre son pseudo ?

Oui, c'est sur, mais il y a mieux :

Code:

 // BEGIN Stats Detaillé MOD
  if (
    (!in_array($_SERVER['REMOTE_ADDR'], split(';', $conf['IPList']))) and
    ($conf['logadmin'] or (!$conf['logadmin'] and ($user['status'] != 'admin')))
    )
  {
  // END Stats Detaillé MOD

Tous les admins sont invisibles comme cela...

cali
2005-10-07 08:26:22

seb69 a écrit:

include/functions.inc.php :

// BEGIN Stats Detaillé MOD
  if (
    (!in_array($_SERVER['REMOTE_ADDR'], split(';', $conf['IPList']))) and
    ($conf['logadmin'] or (!$conf['logadmin'] and ($user['username'] != 'admin')))
    )
  {
  // END Stats Detaillé MOD

Penser à changer 'admin' par votre nom d'utilisateur!!!!
Je ne l'avais pas fait et du coup bien qu'en ayant coché la case pour ne pas loggué l'admin, j'apparaissais toujours dans l'historique.
Belle erreur de débutant! Fini de faire simplement du copier-coller à la va vite... lire avec attention le code!

Bravo pour ce suberbe boulot

Seb

t'es sur ?
je ne suis pas expert en la matiére, loin s'en faut :D
mais c'est pas plutot à la place de "username" qu'on devrait mettre son pseudo ?

cda
2005-10-07 02:47:40

Bonjour,

Je suis un néo-PWGiste équipé de la 1.4.1. J'utilise le template clear, j'ai installé le MOD QLC et fait quelques modifs dans les CSS ainsi que d'autres pompées dans le forum et qui ne se rapportent qu'aux pages Picture et Category. Tout allait parfaitement jusque là (bravo aux développeurs et à tout ceux qui font vivre PWG!)

Très intéressé par des stats détaillées, j'ai sauté sur le MOD Stats dans la version 1.2.
J'ai fait les 2 INSERT INTO dans la base CONFIG qui se sont exécutés correctement ainsi que toutes les modifs de l'INSTALL (faits par copier-coller, vérifiées et re-vérifiées). Comme j'utilise la template clear, j'ai fait les ajouts à la fois dans default et dans clear. J'ai aussi modifié admin.lang.php dans DE et ES puisque j'utilise ces deux langues en plus de FR et EN.

A l'exécution, la page d'accueil "category" s'affiche normalement ainsi que la page "admin" générale. Mais à la sélection d' "historique" j'obtiens le message d'erreur suivant:

Parse error: parse error, unexpected T_STRING in /var/www/free.fr/2/6/chemindarles/phpwebgallery/include/template.php(193) : eval()'d code on line 16

Une erreur similaire (avec "eval()'d code on line 39" à la place de "line 16") se produit à la sélection de chacune des 6 sections de la page "configuration".

J'arrive bien à voir d'où ça vient dans template.php et à remonter à stats.php mais comme je suis néophyte en PHP, j'ai du mal à m'y retrouver.

Y a t-il une bonne âme pour m'aider à sortir de ce problème?

seb69
2005-10-05 09:25:01

include/functions.inc.php :

// BEGIN Stats Detaillé MOD
  if (
    (!in_array($_SERVER['REMOTE_ADDR'], split(';', $conf['IPList']))) and
    ($conf['logadmin'] or (!$conf['logadmin'] and ($user['username'] != 'admin')))
    )
  {
  // END Stats Detaillé MOD

Penser à changer 'admin' par votre nom d'utilisateur!!!!
Je ne l'avais pas fait et du coup bien qu'en ayant coché la case pour ne pas loggué l'admin, j'apparaissais toujours dans l'historique.
Belle erreur de débutant! Fini de faire simplement du copier-coller à la va vite... lire avec attention le code!

Bravo pour ce suberbe boulot

Seb

noiry
2005-09-24 17:52:51

le mod pour la 1.5.RC1 est là : http://forum.phpwebgallery.net/viewtopic.php?id=4559

(pour l'historique détaillé, pas le compteur live)

Pied de page des forums

Propulsé par FluxBB

github twitter newsletter Faire un don Piwigo.org © 2002-2024 · Contact