forked from H3Gi/tatar-wars
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlinks.php
84 lines (56 loc) · 1.58 KB
/
links.php
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
<?php
require( '.' . DIRECTORY_SEPARATOR . 'app' . DIRECTORY_SEPARATOR . 'boot.php' );
require_once( MODEL_PATH . 'links.php' );
class GPage extends SecureGamePage {
function GPage() {
parent::securegamepage();
$this->viewFile = 'links.phtml';
$this->contentCssClass = 'player';
}
function load() {
parent::load();
if (!$this->data['active_plus_account']) {
exit( 0 );
return null;
}
if ($this->isPost()) {
$this->playerLinks = array();
$i = 0;
$c = sizeof( $_POST['nr'] );
while ($i < $c) {
$name = trim( $_POST['linkname'][$i] );
$url = trim( $_POST['linkurl'][$i] );
if (( ( ( $url == '' || $name == '' ) || $_POST['nr'][$i] == '' ) || !is_numeric( $_POST['nr'][$i] ) )) {
continue;
}
$selfTarget = TRUE;
if (substr( $url, strlen( $url ) - 1 ) == '*') {
$url = substr( $url, 0, strlen( $url ) - 1 );
$selfTarget = FALSE;
}
if (isset( $this->playerLinks[$_POST['nr'][$i]] )) {
++$_POST['nr'][$i];
}
$this->playerLinks[$_POST['nr'][$i]] = array( 'linkName' => $name, 'linkHref' => $url, 'linkSelfTarget' => $selfTarget );
++$i;
}
ksort( $this->playerLinks );
$links = '';
foreach ($this->playerLinks as $link) {
if ($links != '') {
$links .= '
';
}
$links .= $link['linkName'] . '
' . $link['linkHref'] . '
' . ($link['linkSelfTarget'] ? '?' : '*');
}
$m = new LinksModel();
$m->changePlayerLinks( $this->player->playerId, $links );
$m->dispose();
}
}
}
$p = new GPage();
$p->run();
?>