first commit

This commit is contained in:
2025-03-12 17:06:23 +01:00
commit 2241f7131f
13185 changed files with 1692479 additions and 0 deletions

View File

@@ -0,0 +1,167 @@
<?php
/**
* SOTESHOP/stUpdate
*
* This file is the part of stUpdate application. License: (Open License SOTE) Open License SOTE.
* Do not modify this file, system will overwrite it during upgrade.
*
* @package stUpdate
* @subpackage actions
* @copyright SOTE (www.sote.pl)
* @license http://www.sote.pl/license/open (Open License SOTE) Open License SOTE
* @version $Id: actions.class.php 11168 2011-02-21 12:44:38Z michal $
* @author Marek Jakubowicz <marek.jakubowicz@sote.pl>
*/
/**
* stInstallerWeb actions.
*
* @author Marek Jakubowicz <marek.jakubowicz@sote.pl>
*
* @package stUpdate
* @subpackage actions
*/
class stAuthActions extends sfActions
{
public function executeIndex()
{
$config = stConfig::getInstance(null, 'stLanguagePlugin');
$culture = $config->get('admin_language', null);
if (!is_null($culture)) $this->getUser()->setCulture($culture);
$config = stUpdateConfig::getInstance($this->getContext());
if($config->isEmpty())
{
try {
$db = new sfDatabaseManager();
$db->initialize();
$con = $db->getDatabase('propel')->getConnection();
$st = $con->prepareStatement("SELECT username, salt, password FROM sf_guard_user u, sf_guard_user_permission up, sf_guard_permission p WHERE u.id = up.user_id AND up.permission_id = p.id AND p.name = 'update'");
if ($st)
{
$rs = $st->executeQuery();
$users = array();
while($rs->next())
{
$row = $rs->getRow();
$users[] = $row;
}
$config->set('users', $users);
$config->save();
}
} catch (Exception $e) {
}
}
}
public function executeRegister()
{
$this->config = stUpdateConfig::getInstance($this->getContext());
$register = $this->config->load();
$this->register = $register;
}
public function executeRegisterSave()
{
if ($this->getRequest()->getMethod() == sfRequest::POST)
{
$register = $this->getRequestParameter('register', array());
$this->config = stUpdateConfig::getInstance($this->getContext());
$this->config->set('email',$register['email']);
$this->config->set('password1',$register['password1']);
$this->config->save();
$this->redirect('stAuth/summary');
}
}
public function executeSummary()
{
$this->config = stUpdateConfig::getInstance($this->getContext());
$register = $this->config->load();
$this->register = $register;
}
public function handleErrorRegisterSave()
{
$this->forward('stAuth','register');
}
public function executeLogin()
{
if ($this->getRequest()->getMethod() == sfRequest::POST)
{
$this->redirect('stInstallerWeb');
}
}
public function executeLogout()
{
$this->getUser()->setAuthenticated(false);
$this->forward('stAuth','index');
}
public function handleErrorLogin()
{
$this->forward('stAuth','index');
}
public function validateLogin()
{
$error_exists = true;
$i18n = $this->getContext()->getI18N();
$register = $this->getRequestParameter('register', array());
$config = stUpdateConfig::getInstance($this->getContext());
foreach ($config->get('users') as $user)
{
if($user['password'] == $this->passwordHash(@$register['password1'], $user['salt']) && $user['username']==@$register['email'])
{
$error_exists = false;
break;
}
}
if ($error_exists)
{
$this->getRequest()->setError('register{email}', $i18n->__('Zły login lub hasło.'));
}
$this->getUser()->setAuthenticated(!$error_exists);
return !$error_exists;
}
protected function passwordHash($password, $salt)
{
return sha1($salt.$password);
}
}

View File

@@ -0,0 +1,9 @@
---
all:
.auto_generated:
config:
last_modified: 2008/12/15 17:29:55
fields:
email:
password1:
salt:

View File

@@ -0,0 +1,45 @@
<?php use_helper('Validation', 'I18N') ?>
<?php use_stylesheet('/css/update/stUpdateLogin.css?version=1'); ?>
<div id="sf_guard_container" align="center">
<img src="/images/update/layout/logo_sote.jpg" alt="">
<div id="sf_frame_login_middle">
<div id="background_frame_login">
<div id="frame_login">
<?php echo form_tag('stAuth/login', array('name'=>'register')) ?>
<fieldset>
<div class="form-row" id="sf_guard_auth_username">
<div id="sf_guard_auth_username_input">
<input type="text" name="register[email]" id="register_email" value="" placeholder="Login / e-mail">
<?php echo form_error('register[email]', array('suffix'=>'', 'prefix'=>'')); ?>
</div>
</div>
<div class="form-row" id="sf_guard_auth_password">
<div id="sf_guard_auth_username_input">
<input type="password" name="register[password1]" id="register_password1" value="" placeholder="<?php echo __('Hasło') ?>">
<?php echo form_error('register[password1]', array('suffix'=>'', 'prefix'=>'')); ?>
</div>
</div>
</fieldset>
<div id="submit_login">
<?php echo submit_tag(__('Zaloguj się'));?>
<div class="clear"></div>
</div>
</form>
</div>
</div>
</div>
<div id="sf_frame_login_bottom"></div>
<div class="clear"></div>
</div>
<div class="site_address"><?php echo __('odwiedź stronę sklepu', null, 'sfGuardUser').': ' ?><a href="http://<?php echo $sf_request->getHost() ?>" target="_blank"><?php echo $sf_request->getHost() ?></a></div>

View File

@@ -0,0 +1,18 @@
<?php use_helper('Validation') ?>
<?php echo form_tag('stAuth/registerSave', array('name'=>'register')) ?>
<?php echo "Login:" ?>
<?php echo form_error('register[email]', array('suffix'=>'', 'prefix'=>'')); ?>
<?php echo input_tag('register[email]', $sf_data->get('sf_params')->get('register[email]')) ?>
<br/>
<?php echo "Hasło:" ?>
<?php echo form_error('register[password1]', array('suffix'=>'', 'prefix'=>'')); ?>
<?php echo input_password_tag('register[password1]', $sf_data->get('sf_params')->get('register[password1]')) ?>
<br/>
<?php echo "Powtórz hasło:" ?>
<?php echo form_error('register[password2]', array('suffix'=>'', 'prefix'=>'')); ?>
<?php echo input_password_tag('register[password2]', $sf_data->get('sf_params')->get('register[password2]')) ?>
<?php echo submit_tag() ?>
</form>

View File

@@ -0,0 +1,6 @@
<?php
echo "<pre>";
print_r($register);
echo "</pre>";
?>

View File

@@ -0,0 +1,15 @@
fields:
register{email}:
required:
msg: Nie podałeś adresu email.
sfEmailValidator:
email_error: Nieprawidłowy format adresu e-mail.
register{password1}:
required:
msg: Nie podałeś hasła.
sfStringValidator:
min: 6
min_error: Podane hasło jest za krótkie min. 6 znaków.

View File

@@ -0,0 +1,35 @@
fields:
register{email}:
required:
msg: Nie podałeś adresu email.
sfEmailValidator:
email_error: Nieprawidłowy format adresu e-mail.
sfStringValidator:
max: 30
max_error: Przekroczono dozwoloną liczbę znaków.
register{password1}:
required:
msg: Nie podałeś hasła.
sfStringValidator:
min: 6
min_error: Podane hasło jest za krótkie min. 6 znaków.
max: 20
max_error: Przekroczono dozwoloną długość hasła, maksimum 20 znaków.
register{password2}:
required:
msg: Nie podałeś hasła.
sfStringValidator:
min: 6
min_error: Podane hasło jest za krótkie min. 6 znaków.
max: 20
max_error: Przekroczono dozwoloną długość hasła, maksimum 20 znaków.
sfCompareValidator:
check: register[password1]
compare_error: Hasła nie są takie same.