Differences

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

Link to this comparison view

user_documentation:use:features:conf_locale [2013/03/07 14:03]
plg Page moved from pwg24:use:features:conf_locale to user_documentation:use:features:conf_locale
user_documentation:use:features:conf_locale [2016/07/10 09:41] (current)
plg example for password_verify function
Line 4: Line 4:
  
 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. 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! 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!
  
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 uses 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 about which you want explanation 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 ?\\ + 
-%%//%% Warning : if the parent category is invisible, the category is\\ +<code php>$conf['newcat_default_visible'] = true;</code> 
-%%//%% automatically create invisible. (invisible = locked)\\ +
-$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   * 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 explanotory text (above each variable), like ''$conf['newcat_default_visible'] = false;''+  * change the value according to explanatory text (above each variable), like 
 + 
 +<code php>$conf['newcat_default_visible'] = false;</code> 
   * click Save File   * click Save File
   * it should display\\   * it should display\\
Line 37: Line 42:
     Backup file created (local/config/config.inc.bak.php)     Backup file created (local/config/config.inc.bak.php)
 </WRAP> </WRAP>
-You can revert you changes by restoring the backup file\\+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 ===== ===== Additional info =====
 
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