The Local Configuration (LocalFiles Editor)

What's that?

Piwigo has a graphical interface for the administration panel, where many options can be easily changed in only a few clicks. But Piwigo allows much more customization. In order to keep the essential options easily identifiable, all these additional options are not available in the graphical interface but in a file.

The default config file, which should be never modified, is include/config_default.inc.php : it's an essential file, and you can open it to see what the available additional options are, but not to modify them!

How to change it?

The best way is to use the plugin LocalFiles Editor, available as a default plugin in any Piwigo installation :

  • Go to [ Administration » Plugins » Manage ] and activate LocalFiles Editor : if you don't find it, click on the tab [ Other Plugins available ], and install it
  • Go to [ Administration » Plugins » LocalFiles Editor ] : the Local Config page is directly displayed, because that's the first of the five tabs of this plugin.
  • There you can
    • check the default config file, by clicking on Display reference file: “config_default.inc.php” : it contains almost all the variables you can change
    • change these variables by typing inside the text field where you currently see something like “File does not exist and will be created by LocalFiles Editor”

The Local Config uses a PHP syntax:

$conf['NAME OF THE VARIABLE'] = VALUE_OF_THE_VARIABLE;

For example

$conf['top_number'] = 15;
$conf['comment_spam_reject'] = true;
$conf['newcat_default_status'] = 'public';

The workflow:

  • find the variable you need or about which you want explanation by displaying and searching (Ctrl+F) inside the reference file, “config_default.inc.php”.
  • copy the reference variable or the one given on the forum/doc, like
$conf['newcat_default_visible'] = true;
  • paste it inside the text field, where you currently see something like “File does not exist and will be created by LocalFiles Editor” if you have never changed the local config
  • change the value according to explanatory text (above each variable), like
$conf['newcat_default_visible'] = false;
  • click Save File
  • it should display
  File written successfully.
  Backup file created (local/config/config.inc.bak.php)

You can revert your changes by restoring the backup file.

Functions

If you want to use a specific function to check password, you will have to “protect” the function definition with “function_exists”. Here is an example:

$conf['password_verify'] = 'smf_password_verify';
if (!function_exists('smf_password_verify'))
{	
  function smf_password_verify($password_clear, $password_hash, $user_id)
  {
    global $conf;
 
    if (empty($user_id))
    {
      return false;
    }
 
    $query = '
SELECT
    memberName,
    passwd
  FROM '.$conf['users_table'].'
  WHERE ID_MEMBER = '.$user_id.'
    AND is_activated=1
;';
    $result = pwg_query($query);
    while ($row = pwg_db_fetch_assoc($result))
    {
      if (sha1(strtolower($row['memberName']).$password_clear) == $password_hash)
      {
        return true;
      }
      break;
    }
 
    return false;
  }
}

Additional info

The plugin itself handle the php tags: <?php at the beginning and ?> at the end.
The file location is local/config/config.inc.php.

 
Back to top
user_documentation/use/features/conf_locale.txt · Last modified: 2016/07/10 09:41 by plg
 
 
github twitter newsletter Donate Piwigo.org © 2002-2024 · Contact