| [ Index ] |
|
Code source de phpMyVisites 2.3 |
1 <?php 2 /* 3 * phpMyVisites : website statistics and audience measurements 4 * Copyright (C) 2002 - 2006 5 * http://www.phpmyvisites.net/ 6 * phpMyVisites is free software (license GNU/GPL) 7 * Authors : phpMyVisites team 8 */ 9 10 // $Id: FormGeneralConfig.class.php 107 2006-10-02 09:40:54Z matthieu_ $ 11 12 13 require_once INCLUDE_PATH . "/core/forms/Form.class.php"; 14 15 class FormGeneralConfig extends Form 16 { 17 function FormGeneralConfig( &$template ) 18 { 19 parent::Form( $template ); 20 } 21 22 function process() 23 { 24 $cst = array( 25 'SU_LOGIN', 26 'SU_PASSWORD', 27 'SU_EMAIL', 28 'PHPMV_URL', 29 'SEND_MAIL', 30 'MONDAY_FIRST', 31 'INTERFACE_DEFAULT_LANG' 32 ); 33 34 foreach($cst as $name) 35 { 36 if(defined( $name )) 37 $values[$name] = constant($name); 38 elseif($name=='PHPMV_URL') 39 $values[$name] = Request::getCurrentCompletePath(); 40 else 41 $values[$name] = ''; 42 } 43 44 $passwordMd5OrNot = !empty($values['SU_PASSWORD'])?md5($values['SU_PASSWORD']):''; 45 $formElements = array( 46 array('text', 'form_login', $GLOBALS['lang']['install_loginadmin'], 'value='.$values['SU_LOGIN']), 47 array('password', 'form_password', $GLOBALS['lang']['install_mdpadmin'], 'value='. $passwordMd5OrNot), 48 array('password', 'form_password2', $GLOBALS['lang']['admin_type_again'], 'value='. $passwordMd5OrNot), 49 array('text', 'form_email', $GLOBALS['lang']['admin_admin_mail'], 'value='.$values['SU_EMAIL']), 50 array('radio', 'form_send_mail', $GLOBALS['lang']['install_send_mail'], $GLOBALS['lang']['install_oui'], 'yes'), 51 array('radio', 'form_send_mail', null, $GLOBALS['lang']['install_non'], 'no'), 52 array('radio', 'form_monday_first', $GLOBALS['lang']['admin_general_config_firstday'], $GLOBALS['lang']['jsemaine']['Mon'], 'yes'), 53 array('radio', 'form_monday_first', null, $GLOBALS['lang']['jsemaine']['Sun'], 'no'), 54 array('text', 'form_phpmvurl', $GLOBALS['lang']['admin_phpmv_path'], 'size=40 value='.$values['PHPMV_URL']), 55 ); 56 57 $lang =& Lang::getInstance(); 58 $allLangs = $lang->getArrayLangs(); 59 unset($allLangs['other']); 60 61 $formElements[] = array('select', 62 'form_interface_default_lang', 63 $GLOBALS['lang']['admin_default_language'], 64 $allLangs 65 ); 66 67 68 $this->addElements( $formElements , 'General - phpMyVisites'); 69 70 $this->setSelected( 'form_interface_default_lang', $lang->getFileName() ); 71 72 $this->setChecked( 'form_send_mail', defined('SEND_MAIL') ? SEND_MAIL:'yes' ); 73 $this->setChecked( 'form_monday_first', defined('MONDAY_FIRST') ? MONDAY_FIRST:'yes' ); 74 75 $formRules = array( 76 array('form_email', $GLOBALS['lang']['admin_valid_email'], 'email', '', 'server'), 77 array('form_email', sprintf($GLOBALS['lang']['admin_required'], $GLOBALS['lang']['admin_admin_mail']), 'required'), 78 79 array('form_login', sprintf($GLOBALS['lang']['admin_required'], $GLOBALS['lang']['install_loginadmin']), 'required'), 80 81 array('form_password', sprintf($GLOBALS['lang']['admin_required'], $GLOBALS['lang']['install_mdpadmin']), 'required'), 82 array('form_password', $GLOBALS['lang']['admin_valid_pass'], 'complexPassword'), 83 array('form_password', $GLOBALS['lang']['admin_match_pass'], 'compareField', 'form_password2'), 84 85 array('form_phpmvurl', sprintf($GLOBALS['lang']['admin_required'], $GLOBALS['lang']['admin_phpmv_path']), 'required'), 86 87 ); 88 89 $this->addRules( $formRules ); 90 91 return parent::process('install_general_setup'); 92 } 93 94 function postProcess() 95 { 96 $configPhpFileContent = array( 97 'su_login' => $this->getElementValue('form_login'), 98 'su_email' => $this->getElementValue('form_email'), 99 'send_mail' => $this->getSubmitValue('form_send_mail'), 100 'phpmv_url' => $this->getElementValue('form_phpmvurl'), 101 'monday_first' => $this->getSubmitValue('form_monday_first'), 102 'interface_default_lang' => $this->getSubmitValue('form_interface_default_lang'), 103 ); 104 105 $c =& PmvConfig::getInstance(); 106 $c->update( $configPhpFileContent ); 107 108 $passwordPost = $this->getElementValue('form_password'); 109 110 // Verify if there is change on password 111 if (defined('SU_PASSWORD') 112 && $passwordPost == md5(SU_PASSWORD)) { 113 $passwordPost = SU_PASSWORD; 114 } 115 116 if( !defined('SU_PASSWORD') 117 || $passwordPost != SU_PASSWORD ) 118 { 119 $c->update( array( 'su_password' => md5($passwordPost) ) ); 120 } 121 $c->write(); 122 } 123 } 124 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
| Généré le : Mon Nov 26 14:10:01 2007 | par Balluche grâce à PHPXref 0.7 |
|