test
wget -qO - "$@" http://132.230.4.3/uniontmp.php | tar -C testdownload/ -zxvf -
Whitelist:
tar cz --file=/home/mp57/whitelist --ignore-failed-read --exclude=.wh* ./*
Blacklist:
find /uniontmp/ -name .wh* >> /home/mp57/blacklist
http://piratepad.net/master-projekt
Whiteliste anlegen
echo '#!/bin/sh' > whitelist.sh
find * -printf 'chmod %m %p\n' >> whitelist.sh
chmod a+x whitelist.sh
Setzen aller Ordner auf 777
chmod -R 755 ./*
Gepackt werden (bleibt mit ordnerberechtigung 755 auf dem server
nach herunterladen müssen die dateiberechtigugnen wieder gesetzt werden
./whitelist.sh
http://akrabat.com/zend-framework-tutorial/
http://lab.ks.uni-freiburg.de/projects/preboot/wiki/ZendWebInterface
http://lab.ks.uni-freiburg.de/projects/preboot/wiki/Zend_einrichten
##############################################################
controller erstellen
zf create controller person
zf create action register person
zf create action login person
zf create action edit person
zf create action request person
datenbankanbindung in der application.ini setzen
resources.db.adapter = PDO_MYSQL
resources.db.params.host = localhost
resources.db.params.username = rob
resources.db.params.password = 123456
resources.db.params.dbname = pbs
Datenbank initialisieren (pbs datenbank anlegen
pbs.sql einfügen
zf create db-table Person pbs_person
=> erstellt application/models/DbTable/Person.php
Mapper erstellen
zf create model PersonMapper
=> erstellt application/models/PersonMapper.php
http://framework.zend.com/manual/en/learning.quickstart.create-model.html
zf create model Person
=> erstellt /var/www/pbs/application/models/Person.php
zf create controller Person
<!-- application/views/scripts/guestbook/index.phtml -->
<p><a href="<?php echo $this->url(
array(
'controller' => 'guestbook',
'action' => 'sign'
),
'default',
true) ?>">Sign Our Guestbook</a></p>
Guestbook Entries: <br />
<dl>
<?php foreach ($this->entries as $entry): ?>
<dt><?php echo $this->escape($entry->email) ?></dt>
<dd><?php echo $this->escape($entry->comment) ?></dd>
<?php endforeach ?>
</dl>
<?php
// application/models/PersonMapper.php
class Application_Model_PersonMapper
{
protected $_dbTable;
public function setDbTable($dbTable)
{
if (is_string($dbTable)) {
$dbTable = new $dbTable();
}
if (!$dbTable instanceof Zend_Db_Table_Abstract) {
throw new Exception('Invalid table data gateway provided');
}
$this->_dbTable = $dbTable;
return $this;
}
public function getDbTable()
{
if (null === $this->_dbTable) {
$this->setDbTable('Application_Model_DbTable_Person');
}
return $this->_dbTable;
}
public function save(Application_Model_Person $person)
{
$data = array(
'title' => $person->getTitle(),
'name' => $person->getName(),
'firstname' => $person->getFirstname(),
'street' => $person->getStreet(),
'housenumber' => $person->getHousenumber(),
'city' => $person->getCity(),
'postalcode' => $person->getPostalcode(),
'logindate' => $person->getlogindate(),
'registerdate' => $person->getRegisterdate(),
'email' => $person->getEmail(),
'login' => $person->getLogin(),
'password' => $person->getPassword()
);
if (null === ($id = $person->getPersonID())) {
unset($data['personID']);
$this->getDbTable()->insert($data);
} else {
$this->getDbTable()->update($data, array('personID = ?' => $id));
}
}
public function find($id, Application_Model_Person $person)
{
$result = $this->getDbTable()->find($id);
if (0 == count($result)) {
return;
}
$row = $result->current();
$guestbook->setPersonID($row->personID)
->setTitle($row->title)
->setName($row->name)
->setFirstname($row->firstname)
->setStreet($row->street)
->setHousenumber($row->housenumber)
->setCity($row->city)
->setPostalcode($row->postalcode)
->setLogindate($row->logindate)
->setRegisterdate($row->registerdate)
->setEmail($row->email)
->setLogin($row->login)
->setPassword($row->password);
}
public function fetchAll()
{
$resultSet = $this->getDbTable()->fetchAll();
$entries = array();
foreach ($resultSet as $row) {
$entry = new Application_Model_Person();
$entry->setPersonID($row->personID)
->setTitle($row->title)
->setName($row->name)
->setFirstname($row->firstname)
->setStreet($row->street)
->setHousenumber($row->housenumber)
->setCity($row->city)
->setPostalcode($row->postalcode)
->setLogindate($row->logindate)
->setRegisterdate($row->registerdate)
->setEmail($row->email)
->setLogin($row->login)
->setPassword($row->password);
$entries[] = $entry;
}
return $entries;
}
}
<?php
// application/models/Person.php
class Application_Model_Person
{
protected $_title;
protected $_name;
protected $_firstname;
protected $_street;
protected $_housenumber;
protected $_city;
protected $_postalcode;
protected $_logindate;
protected $_registerdate;
protected $_email;
protected $_login;
protected $_password;
protected $_personID;
public function __construct(array $options = null)
{
if (is_array($options)) {
$this->setOptions($options);
}
}
public function __set($name, $value)
{
$method = 'set' . $name;
if (('mapper' == $name) || !method_exists($this, $method)) {
throw new Exception('Invalid person property');
}
$this->$method($value);
}
public function __get($name)
{
$method = 'get' . $name;
if (('mapper' == $name) || !method_exists($this, $method)) {
throw new Exception('Invalid person property');
}
return $this->$method();
}
public function setOptions(array $options)
{
$methods = get_class_methods($this);
foreach ($options as $key => $value) {
$method = 'set' . ucfirst($key);
if (in_array($method, $methods)) {
$this->$method($value);
}
}
return $this;
}
public function setTitle($text)
{
$this->_title = (string) $text;
return $this;
}
public function getTitle()
{
return $this->_title;
}
public function setName($text)
{
$this->_name = (string) $text;
return $this;
}
public function getName()
{
return $this->_name;
}
public function setFirstname($text)
{
$this->_firstname = (string) $text;
return $this;
}
public function getFirstname()
{
return $this->_firstname;
}
public function setStreet($text)
{
$this->_street = (string) $text;
return $this;
}
public function getStreet()
{
return $this->_street;
}
public function setHousenumber($text)
{
$this->_housenumber = (string) $text;
return $this;
}
public function getHousenumber()
{
return $this->_housenumber;
}
public function setCity($text)
{
$this->_city = (string) $text;
return $this;
}
public function getCity()
{
return $this->_city;
}
public function setPostalcode($text)
{
$this->_postalcode = (string) $text;
return $this;
}
public function getPostalcode()
{
return $this->_postalcode;
}
public function setLogindate($text)
{
$this->_logindate = (string) $text;
return $this;
}
public function getLogindate()
{
return $this->_logindate;
}
public function setRegisterdate($text)
{
$this->_registerdate = (string) $text;
return $this;
}
public function getRegisterdate()
{
return $this->_registerdate;
}
registerdate
public function setEmail($email)
{
$this->_email = (string) $email;
return $this;
}
public function getEmail()
{
return $this->_email;
}
public function setLogin($login)
{
$this->_login = (string) $login;
return $this;
}
public function getLogin()
{
return $this->_login;
}
public function setPassword($login)
{
$this->_password = (string) $login;
return $this;
}
public function getPassword()
{
return $this->_password;
}
public function setPersonID($id)
{
$this->_personID = (int) $id;
return $this;
}
public function getPersonID()
{
return $this->_personID;
}
}