summaryrefslogtreecommitdiffstats
path: root/notes-1.txt
blob: d3e0f6df0ab37a17ef220a19c219d967c0dad9ea (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
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;
    }
}