Najpierw tworzymy nową opcje konfiguracyjną. Potem w General Settings będziemy mogli to włączać i wyłączać.
ACP > TOOLS & SETTINGS >> Add New General Setting
Setting title? - ACP_HTTPS
Setting Description? - Kiedy włączone łączy z ACP przez https
Setting Group? - General Configuration
Setting Type? - Yes/No Radio Buttons
Setting Key? - acp_https
Setting Default Value? - 1
End setting group? - No
Add this option into the settings cache? - Yes
Pobierz i otwórz plik admin/index.php
Znajdź:
//===========================================================================
// Get cache...
//===========================================================================
$ipsclass->init_cache_setup();
$ipsclass->init_load_cache( array('rss_export', 'bbcode', 'badwords', 'emoticons', 'settings', 'group_cache', 'systemvars', 'skin_id_cache', 'forum_cache', 'moderators', 'stats') );
Dodaj niżej:
//===========================================================================
// Czy https?
//===========================================================================
$conf = $ipsclass->DB->simple_exec_query( array( 'select' => '*', 'from' => 'conf_settings', 'where' => "conf_key='ACP_HTTPS'" ) );
if($conf['conf_value'] == 1 || ($conf['conf_value'] == "" && $conf['conf_default'] == 1))
define("acp_https", true);
else
define("acp_https", false);
Zapisz i wyślij.
Pobierz i otwórz plik sources/ipsclass.php
Znajdź:
} // end class
Dodaj powyżej:
function acp_https(){
if(defined("acp_https") && acp_https)
return true;
else
return false;
}
function z_www_na_bez(){
if(preg_match("/^www/", $_SERVER['SERVER_NAME']))
return preg_replace("/^www./","",$_SERVER['SERVER_NAME']);
else
return "www.{$_SERVER['SERVER_NAME']}";
}
Zapisz i wyślij.
Pobierz i otwórz plik sources/lib/admin_functions.php
Znajdź (w dwóch miejscach ):
print $html;
Dodaj wyżej:
/**************************************/
/*security ACP by wilczek */
/**************************************/
if($this->ipsclass->acp_https() && defined( 'IN_ACP' )){
$html = preg_replace("/([^(value=\")])http:\/\/{$_SERVER['SERVER_NAME']}/","$1https://{$_SERVER['SERVER_NAME']}",$html);
$html = preg_replace("/([^(value=\")])http:\/\/".$this->ipsclass->z_www_na_bez()."/","$1https://".$this->ipsclass->z_www_na_bez(),$html);
}
Znajdź:
print $this->ipsclass->html;
Dodaj wyżej:
/**************************************/
/*security ACP by wilczek */
/**************************************/
if($this->ipsclass->acp_https() && defined( 'IN_ACP' )){
$this->ipsclass->html = preg_replace("/([^(value=\")])http:\/\/{$_SERVER['SERVER_NAME']}/","$1https://{$_SERVER['SERVER_NAME']}",$this->ipsclass->html);
$this->ipsclass->html = preg_replace("/([^(value=\")])http:\/\/".$this->ipsclass->z_www_na_bez()."/","$1https://".$this->ipsclass->z_www_na_bez(),$this->ipsclass->html);
}
Zapisz i wyślij.
Pobierz i otwórz plik sources/action_admin/login.php
Znajdź:
print $this->ipsclass->html;
Dodaj wyżej:
/**************************************/
/*security ACP by wilczek */
/**************************************/
if($this->ipsclass->acp_https() && defined( 'IN_ACP' )){
$this->ipsclass->html = preg_replace("/([^(value=\")])http:\/\/{$_SERVER['SERVER_NAME']}/","$1https://{$_SERVER['SERVER_NAME']}",$this->ipsclass->html);
$this->ipsclass->html = preg_replace("/([^(value=\")])http:\/\/".$this->ipsclass->z_www_na_bez()."/","$1https://".$this->ipsclass->z_www_na_bez(),$this->ipsclass->html);
}
Pobierz i otwórz plik sources/action_admin/remote_template.php
Znajdź:
print $html;
Dodaj wyżej:
/**************************************/
/*security ACP by wilczek */
/**************************************/
if($this->ipsclass->acp_https() && defined( 'IN_ACP' )){
$html = preg_replace("/([^(value=\")])http:\/\/{$_SERVER['SERVER_NAME']}/","$1https://{$_SERVER['SERVER_NAME']}",$html);
$html = preg_replace("/([^(value=\")])http:\/\/".$this->ipsclass->z_www_na_bez()."/","$1https://".$this->ipsclass->z_www_na_bez(),$html);
}