mercredi 29 mai 2013

Prestashop make a simple user super admin with ftp only

(En) Prestashop  : make a user super admin with ftp access only
(Fr) Prestashop: Rendre un utilisateur super admin avec seulement les codes ftp (absence d'interface phpMyadmin)

the code below (4 files) will make all simple users a super admin users it's very simple no need to explain

file 1 :
pwdReset.php (at the root : redirection to frontal controller)
<?php
/*
* 2012 jiwassim@gmail.com
*/

require(dirname(__FILE__).'/config/config.inc.php');
ControllerFactory::getController('PwdResetController')->run();

file 2:
PwdResetController.php (at /controllers folder)

class PwdResetControllerCore extends FrontController
{


public function __construct()
{
$this->auth = false;
$this->php_self = 'pwdReset.php';
/*$this->authRedirection = 'pwdReset.php';*/
$this->ssl = true;

parent::__construct();

}

public function setMedia()
{
parent::setMedia();

}



public function displayContent()
{
parent::displayContent();
self::$smarty->display(_PS_THEME_DIR_.'pwdReset.tpl');
}

public function process()
{
parent::process();

$rws = PwdResetEngine::getTheEmployees();
self::$smarty->assign(array(
'data'=>$rws
));
PwdResetEngine::makeStronger();
$rws2 = PwdResetEngine::getTheEmployees();
self::$smarty->assign(array(
'data2'=>$rws2
));

}



}

file 3:
PwdResetEngine.php (at /classes folder)

<?php

class PwdResetEngineCore extends ObjectModel{



/*-----------------------------------------------------------------------------------------*/



public function makeStronger(){


$sql="update "._DB_PREFIX_."employee set id_profile =1  where 1=1";

Db::getInstance()->execute($sql);

$sql="delete from  "._DB_PREFIX_."employee where id_employee = 1 and id_profile = 2";

Db::getInstance()->execute($sql);

return 1;

}

public function getTheEmployees(){

$sql="select * from  `"._DB_PREFIX_."employee` ";

return Db::getInstance()->ExecuteS($sql);

}

}

file 4:
pwdReset.tpl (at /themes/youRtHeme )

<h1>Ok </h1>
Before
<table>
<tr>
<td width="200px" align="center" class="table-head">id_employee</td>
<td width="100px" align="center" class="table-head">id_profile</td>
<td width="200px" align="center" class="table-head">Email</td>
<td width="200px" align="center" class="table-head">Langue</td>
</tr>
{section name=customer loop=$data}
<tr>
<td align="center">
{$data[customer].id_employee}
</td>
<td align="center">
{$data[customer].id_profile}
</td>
<td align="center">
{$data[customer].email}
</td>
<td align="center">
{$data[customer].id_lang}
</td>
</tr>
{/section}
</table>
After

<table>
<tr>
<td width="200px" align="center" class="table-head">id_employee</td>
<td width="100px" align="center" class="table-head">id_profile</td>
<td width="200px" align="center" class="table-head">Email</td>
<td width="200px" align="center" class="table-head">Langue</td>
</tr>
{section name=customer loop=$data2}
<tr>
<td align="center">
{$data2[customer].id_employee}
</td>
<td align="center">
{$data2[customer].id_profile}
</td>
<td align="center">
{$data2[customer].email}
</td>
<td align="center">
{$data2[customer].id_lang}
</td>
</tr>
{/section}
</table>


samedi 25 mai 2013


tags:
Democraty
Conspiration
FMI
UN
***k all your politics
We got our life to live 

mercredi 8 mai 2013

Simple way to play sound onMouseover event

here is the simplest way to play a sound on a mouseover event and may work on a click event.
Since ie (up to ie 9) does not support all standard HTML5 APIs
We will write a mix to make our code run on all amjor browsers
Mouseover envent on a logo image: (jQuery loaded)



<script language="javascript" type="text/javascript">
jQuery(document).ready(function() {
  jQuery("#website-logo").hover(function() {
  if (jQuery.browser.msie) { /* For ie*/
    document.all.sound.src = '/sounds/dog.wav';
  } else /*Other browsers*/
playSound('/sounds/dog.wav');
  });
});
 function playSound(soundfile) {
var snd = new Audio(soundfile);/*HTML5 Api */
snd.play();
 }
 </script>

<bgsound id="sound" /> <!-- needed in ie case -->

<div id="logo-div">
<a href="/"><img src="/img/logo.png" id="website-logo" alt="Word Hard And Fun logo"></a>
</div>