[-] BO : Fix bug #PSCFV-8626 rename actual admin folder

This commit is contained in:
gRoussac
2013-04-09 17:43:15 +02:00
parent 648da86eac
commit b623f50df7
5 changed files with 145 additions and 170 deletions
@@ -28,7 +28,6 @@
var label_errors = '{l s='errors'}'; var label_errors = '{l s='errors'}';
var label_error = '{l s='error'}'; var label_error = '{l s='error'}';
</script> </script>
<div id="container"> <div id="container">
<div id="error" {if !isset($errors)}class="hide"{/if}> <div id="error" {if !isset($errors)}class="hide"{/if}>
{if isset($errors)} {if isset($errors)}
@@ -42,9 +41,7 @@
</div> </div>
<br /> <br />
{if isset($warningSslMessage)} {if isset($warningSslMessage)}
<div class="warn"> <div class="warn">{$warningSslMessage}</div>
{$warningSslMessage}
</div>
{/if} {/if}
<div id="login"> <div id="login">
<h1>{$shop_name}</h1> <h1>{$shop_name}</h1>
@@ -54,19 +51,15 @@
<label for="email">{l s='Email address:'}</label> <label for="email">{l s='Email address:'}</label>
<input type="text" id="email" name="email" class="input email_field" value="{if isset($email)}{$email|escape:'htmlall':'UTF-8'}{/if}" /> <input type="text" id="email" name="email" class="input email_field" value="{if isset($email)}{$email|escape:'htmlall':'UTF-8'}{/if}" />
</div> </div>
<div class="field"> <div class="field">
<label for="passwd">{l s='Password:'}</label> <label for="passwd">{l s='Password:'}</label>
<input id="passwd" type="password" name="passwd" class="input password_field" value="{if isset($password)}{$password}{/if}"/> <input id="passwd" type="password" name="passwd" class="input password_field" value="{if isset($password)}{$password}{/if}"/>
</div> </div>
<div class="field"> <div class="field">
<input type="submit" name="submitLogin" value="{l s='Log in'}" class="button fl margin-right-5" /> <input type="submit" name="submitLogin" value="{l s='Log in'}" class="button fl margin-right-5" />
<p class="fl no-margin hide ajax-loader"> <p class="fl no-margin hide ajax-loader">
<img src="../img/loader.gif" alt="" /> <img src="../img/loader.gif" alt="" />
</p> </p>
<p class="fr no-margin"> <p class="fr no-margin">
<a href="#" class="show-forgot-password">{l s='Lost password?'}</a> <a href="#" class="show-forgot-password">{l s='Lost password?'}</a>
</p> </p>
@@ -74,23 +67,18 @@
</div> </div>
<input type="hidden" name="redirect" id="redirect" value="{$redirect}"/> <input type="hidden" name="redirect" id="redirect" value="{$redirect}"/>
</form> </form>
<form action="#" id="forgot_password_form" method="post" class="hide"> <form action="#" id="forgot_password_form" method="post" class="hide">
<h2 class="no-margin">{l s='Forgot your password?'}</h2> <h2 class="no-margin">{l s='Forgot your password?'}</h2>
<p class="bold">{l s='In order to receive your access code by email, please enter the address you provided during the registration process.'}</p> <p class="bold">{l s='In order to receive your access code by email, please enter the address you provided during the registration process.'}</p>
<div class="field"> <div class="field">
<label>{l s='Email address:'}</label> <label>{l s='Email address:'}</label>
<input type="text" name="email_forgot" id="email_forgot" class="input email_field" /> <input type="text" name="email_forgot" id="email_forgot" class="input email_field" />
</div> </div>
<div class="field"> <div class="field">
<input type="submit" name="submit" value="{l s='Send'}" class="button fl margin-right-5" /> <input type="submit" name="submit" value="{l s='Send'}" class="button fl margin-right-5" />
<p class="fl no-margin hide ajax-loader"> <p class="fl no-margin hide ajax-loader">
<img src="../img/loader.gif" alt="" /> <img src="../img/loader.gif" alt="" />
</p> </p>
<p class="fr no-margin"> <p class="fr no-margin">
<a href="#" class="show-login-form">{l s='Back to login'}</a> <a href="#" class="show-login-form">{l s='Back to login'}</a>
</p> </p>
@@ -102,9 +90,9 @@
<p>{l s='For security reasons, you cannot connect to the Back Office until after you have:'}</p> <p>{l s='For security reasons, you cannot connect to the Back Office until after you have:'}</p>
<ul> <ul>
{if isset($wrong_install_name) && $wrong_install_name == true}<li>{l s='deleted the /install folder'}</li>{/if} {if isset($wrong_install_name) && $wrong_install_name == true}<li>{l s='deleted the /install folder'}</li>{/if}
{if isset($wrong_folder_name) && $wrong_folder_name == true}<li>{l s='renamed the /admin folder (e.g. /admin%d)' sprintf=$randomNb}</li>{/if} {if isset($wrong_folder_name) && $wrong_folder_name == true}<li>{l s='renamed the /admin folder (e.g. /%s)' sprintf=$randomNb}</li>{/if}
</ul> </ul>
{if isset($wrong_folder_name) && $wrong_folder_name == true}<p>{l s='Please then access this page by the new URL (e.g. http://www.yoursite.com/admin%d)' sprintf=$randomNb}</p>{/if} <p><a href="{$adminUrl|escape:'htmlall':'UTF-8'}">{l s='Please then access this page by the new URL (e.g. %s)' sprintf=$adminUrl}</a></p>
</div> </div>
{/if} {/if}
</div> </div>
+1 -3
View File
@@ -22,7 +22,6 @@
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA * International Registered Trademark & Property of PrestaShop SA
*} *}
<div style="clear:both;height:0;line-height:0">&nbsp;</div> <div style="clear:both;height:0;line-height:0">&nbsp;</div>
</div> </div>
<div style="clear:both;height:0;line-height:0">&nbsp;</div> <div style="clear:both;height:0;line-height:0">&nbsp;</div>
@@ -46,8 +45,7 @@
</div> </div>
</div> </div>
<div id="ajax_confirmation" style="display:none"></div> <div id="ajax_confirmation" style="display:none"></div>
{* ajaxBox allows*} {* ajaxBox allows*} <div id="ajaxBox" style="display:none"></div>
<div id="ajaxBox" style="display:none"></div>
{/if} {/if}
<div id="scrollTop"><a href="#top"></a></div> <div id="scrollTop"><a href="#top"></a></div>
</body> </body>
+5 -17
View File
@@ -82,7 +82,6 @@
<script type="text/javascript" src="{$js_uri}"></script> <script type="text/javascript" src="{$js_uri}"></script>
{/foreach} {/foreach}
{/if} {/if}
<link rel="icon" type="image/vnd.microsoft.icon" href="{$img_dir}favicon.ico" /> <link rel="icon" type="image/vnd.microsoft.icon" href="{$img_dir}favicon.ico" />
<link rel="shortcut icon" type="image/x-icon" href="{$img_dir}favicon.ico" /> <link rel="shortcut icon" type="image/x-icon" href="{$img_dir}favicon.ico" />
{if isset($displayBackOfficeHeader)} {if isset($displayBackOfficeHeader)}
@@ -100,7 +99,6 @@
<body style="{if isset($bo_color) && $bo_color}background:{$bo_color};{/if}{if isset($bo_width) && $bo_width > 0}text-align:center;{/if}"> <body style="{if isset($bo_color) && $bo_color}background:{$bo_color};{/if}{if isset($bo_width) && $bo_width > 0}text-align:center;{/if}">
{if $display_header} {if $display_header}
<div id="ajax_running"><img src="../img/admin/ajax-loader-yellow.gif" alt="" /> {l s='Loading...'}</div> <div id="ajax_running"><img src="../img/admin/ajax-loader-yellow.gif" alt="" /> {l s='Loading...'}</div>
<div id="top_container" {if $bo_width > 0}style="margin:auto;width:{$bo_width}px"{/if}> <div id="top_container" {if $bo_width > 0}style="margin:auto;width:{$bo_width}px"{/if}>
<div id="container"> <div id="container">
{* begin HEADER *} {* begin HEADER *}
@@ -148,7 +146,6 @@
</div> </div>
{/if} {/if}
</div> </div>
<div id="employee_box"> <div id="employee_box">
<div id="employee_infos"> <div id="employee_infos">
<div class="employee_name">{l s='Welcome,'} <strong>{$first_name}&nbsp;{$last_name}</strong></div> <div class="employee_name">{l s='Welcome,'} <strong>{$first_name}&nbsp;{$last_name}</strong></div>
@@ -164,7 +161,6 @@
</ul> </ul>
</div> </div>
</div> </div>
<div id="header_search"> <div id="header_search">
<form method="post" action="index.php?controller=AdminSearch&amp;token={getAdminToken tab='AdminSearch'}"> <form method="post" action="index.php?controller=AdminSearch&amp;token={getAdminToken tab='AdminSearch'}">
<input type="text" name="bo_query" id="bo_query" value="{$bo_query}" /> <input type="text" name="bo_query" id="bo_query" value="{$bo_query}" />
@@ -183,7 +179,6 @@
<input type="submit" id="bo_search_submit" class="button" value="{l s='Search'}"/> <input type="submit" id="bo_search_submit" class="button" value="{l s='Search'}"/>
</form> </form>
</div> </div>
{if count($quick_access) > 0} {if count($quick_access) > 0}
<div id="header_quick"> <div id="header_quick">
<select onchange="quickSelect(this);" id="quick_select" class="chosen no-search"> <select onchange="quickSelect(this);" id="quick_select" class="chosen no-search">
@@ -194,15 +189,11 @@
</select> </select>
</div> </div>
{/if} {/if}
{if isset($displayBackOfficeTop)} {if isset($displayBackOfficeTop)}{$displayBackOfficeTop}{/if}
{$displayBackOfficeTop}
{/if}
</div>{* end header_infos*} </div>{* end header_infos*}
<ul id="menu"> <ul id="menu">
{if !$tab} {if !$tab}
<div class="mainsubtablist" style="display:none"> <div class="mainsubtablist" style="display:none"></div>
</div>
{/if} {/if}
{foreach $tabs AS $t} {foreach $tabs AS $t}
{if $t.active} {if $t.active}
@@ -221,20 +212,17 @@
{/if} {/if}
{/foreach} {/foreach}
</ul> </ul>
{/if}
</div>{* end header*} </div>{* end header*}
{/if}
<div id="main"> <div id="main">
<div id="content"> <div id="content">
{if $display_header && $install_dir_exists} {if $display_header && $install_dir_exists}
<div style="background-color: #FFEBCC;border: 1px solid #F90;line-height: 20px;margin: 0px 0px 10px;padding: 10px 20px;"> <div style="background-color: #FFEBCC;border: 1px solid #F90;line-height: 20px;margin: 0px 0px 10px;padding: 10px 20px;">
{l s='For security reasons, you must also:'} {l s='delete the /install folder'} {l s='For security reasons, you must also:'}&nbsp;{l s='delete the /install folder'}
</div> </div>
{/if} {/if}
{if $display_header && $is_multishop && $shop_list && ($multishop_context & Shop::CONTEXT_GROUP || $multishop_context & Shop::CONTEXT_SHOP)} {if $display_header && $is_multishop && $shop_list && ($multishop_context & Shop::CONTEXT_GROUP || $multishop_context & Shop::CONTEXT_SHOP)}
<div class="multishop_toolbar"> <div class="multishop_toolbar">
<span class="text_multishop">{l s='Multistore configuration for'}</span> <span class="text_multishop">{l s='Multistore configuration for'}</span> {$shop_list}
{$shop_list}
</div> </div>
{/if} {/if}
@@ -47,7 +47,6 @@
{/if} {/if}
</div> </div>
{/if} {/if}
{if isset($informations) && count($informations) && $informations} {if isset($informations) && count($informations) && $informations}
<div class="hint clear" style="display:block;"> <div class="hint clear" style="display:block;">
<span id="see_more_infos"> <span id="see_more_infos">
@@ -60,7 +59,6 @@
</div> </div>
</div><br /> </div><br />
{/if} {/if}
{if isset($confirmations) && count($confirmations) && $confirmations} {if isset($confirmations) && count($confirmations) && $confirmations}
<div class="conf" style="display:block;"> <div class="conf" style="display:block;">
{foreach $confirmations as $conf} {foreach $confirmations as $conf}
@@ -68,7 +66,6 @@
{/foreach} {/foreach}
</div><br /> </div><br />
{/if} {/if}
{if count($warnings)} {if count($warnings)}
<div class="warn"> <div class="warn">
<span style="float:right"> <span style="float:right">
@@ -94,6 +91,5 @@
{/if} {/if}
</div> </div>
{/if} {/if}
{$page} {$page}
{include file='footer.tpl'} {include file='footer.tpl'}
+10 -5
View File
@@ -70,18 +70,23 @@ class AdminLoginControllerCore extends AdminController
if (file_exists(_PS_ADMIN_DIR_.'/../install')) if (file_exists(_PS_ADMIN_DIR_.'/../install'))
$this->context->smarty->assign('wrong_install_name', true); $this->context->smarty->assign('wrong_install_name', true);
if (file_exists(_PS_ADMIN_DIR_.'/../admin'))
if (basename(_PS_ADMIN_DIR_) == 'admin' && file_exists(_PS_ADMIN_DIR_.'/../admin/'))
{ {
$rand = sprintf('%04d', rand(0, 9999)); $rand = 'admin'.sprintf('%04d', rand(0, 9999)).'/';
if (@rename(_PS_ADMIN_DIR_.'/../admin', _PS_ADMIN_DIR_.'/../admin'.$rand)) if (@rename(_PS_ADMIN_DIR_.'/../admin/', _PS_ADMIN_DIR_.'/../'.$rand))
Tools::redirectAdmin('../admin'.$rand); Tools::redirectAdmin('../'.$rand);
else else
$this->context->smarty->assign(array( $this->context->smarty->assign(array(
'wrong_folder_name' => true 'wrong_folder_name' => true
)); ));
} }
else
$rand = basename(_PS_ADMIN_DIR_).'/';
$this->context->smarty->assign(array( $this->context->smarty->assign(array(
'randomNb' => rand(0, 9999) 'randomNb' => $rand,
'adminUrl' => Tools::getCurrentUrlProtocolPrefix().Tools::getShopDomain().__PS_BASE_URI__.$rand
)); ));
// Redirect to admin panel // Redirect to admin panel