Differences

This shows you the differences between two versions of the page.

Link to this comparison view

user_documentation:use:features:conf_locale [2013/02/19 15:14]
flop25 created
user_documentation:use:features:conf_locale [2016/07/10 09:41] (current)
plg example for password_verify function
Line 3: Line 3:
 ===== What's that? ===== ===== 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 customizations. In order to keep the essential options easily identifiable, all these additional options are not available in the graphical interface but in a file. +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 are the available additional options, but not to modify them!+ 
 +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? ===== ===== How to change it? =====
Line 14: Line 15:
     * check the default config file, by clicking on **__Display reference file: "config_default.inc.php"__** : it contains almost all the variables you can change     * 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"     * 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 use a PHP syntax:\\ +The Local Config uses a PHP syntax: 
-''$conf['NAME OF THE VARIABLE'] = VALUE_OF_THE_VARIABLE;''\\ +<code php>$conf['NAME OF THE VARIABLE'] = VALUE_OF_THE_VARIABLE;</code> 
-For example\\ + 
-''$conf['top_number'] = 15;\\ +For example 
-$conf['comment_spam_reject'] = true;\\ + 
-$conf['newcat_default_status'] = 'public';''+<code php>$conf['top_number'] = 15; 
 +$conf['comment_spam_reject'] = true; 
 +$conf['newcat_default_status'] = 'public';</code>
  
 The workflow: The workflow:
-  find the variable you need or on which you want explanations by displaying and searching (Ctrl+F) inside the reference file, "config_default.inc.php". +  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\\ +  copy the reference variable or the one given on the forum/doc, like 
-'' + 
-//// newcat_default_visible : at creation, must a category be visible or not ?\\ +<code php>$conf['newcat_default_visible'] = true;</code> 
-//// Warning : if the parent category is invisible, the category is\\ + 
-//// automatically create invisible. (invisible = locked)\\ +  * 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 
-$conf['newcat_default_visible'] = true;\\ +  change the value according to explanatory text (above each variable), like 
-'' + 
-  - past it inside the text field, where you currently see something like "File does not exist and will be created by LocalFiles Editor" if you never changed the local config +<code php>$conf['newcat_default_visible'] = false;</code> 
-  change the value according to explicative text (above each variable), like + 
-  - the text field where you currently see something like ''$conf['newcat_default_visible'] = true;'' +  click Save File 
-  click Save File +  it should display\\
-  it should display\\+
 <WRAP center round 60%> <WRAP center round 60%>
     File written successfully.     File written successfully.
     Backup file created (local/config/config.inc.bak.php)     Backup file created (local/config/config.inc.bak.php)
 </WRAP> </WRAP>
 +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:
 +
 +<code php>$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;
 +  }
 +}</code>
 +
 +
 +===== 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.1361286898.txt.gz · Last modified: 2013/02/19 15:14 by flop25
 
 
github twitter newsletter Donate Piwigo.org © 2002-2024 · Contact