forked from projectsend/projectsend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
templates.php
138 lines (125 loc) · 3.4 KB
/
templates.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
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
<?php
/**
* List of available client's templates
*
* @package ProjectSend
* @subpackage Design
*/
$allowed_levels = array(9);
require_once('bootstrap.php');
$page_title = __("Templates",'cftp_admin');
$active_nav = 'templates';
include_once ADMIN_TEMPLATES_DIR . DS . 'header.php';
/**
* Changing the client's template
*/
if ( isset($_GET['activate_template']) ) {
$save = $dbh->prepare( "UPDATE " . TABLE_OPTIONS . " SET value=:value WHERE name=:name" );
$save->bindValue(':value', $_GET['activate_template']);
$save->bindValue(':name', 'selected_clients_template');
$save->execute();
if ($save ){
$template_change_state = '1';
}
else {
$template_change_state = '2';
}
/** Redirect so the options are reflected immediatly */
while (ob_get_level()) ob_end_clean();
$section_redirect = 'templates';
$location = BASE_URI . 'templates.php';
if ( !empty( $template_change_state ) ) {
$location .= '?status=' . $template_change_state;
}
header("Location: $location");
die();
}
?>
<div class="col-xs-12 col-sm-12 col-lg-12">
<?php
if (isset($_GET['status'])) {
switch ($_GET['status']) {
case '1':
$msg = __('Options updated succesfuly.','cftp_admin');
echo system_message('success',$msg);
break;
case '2':
$msg = __('There was an error. Please try again.','cftp_admin');
echo system_message('danger',$msg);
break;
}
}
?>
<div class="template_selector">
<div class="row">
<?php
$templates = look_for_templates();
foreach ($templates as $template) {
?>
<div class="col-xs-12 col-sm-6 col-md-3">
<div class="template <?php if ( $template['location'] == SELECTED_CLIENTS_TEMPLATE ) { echo 'current_template'; } ?>">
<div class="col-xs-12">
<div class="images">
<?php
if ( !empty( $template['cover'] ) ) {
?>
<div class="cover">
<img src="<?php echo html_output($template['cover']); ?>" alt="<?php echo html_output($template['name']); ?>">
</div>
<?php
}
?>
<div class="screenshot">
<img src="<?php echo html_output($template['screenshot']); ?>" alt="<?php echo html_output($template['name']); ?>">
</div>
</div>
</div>
<div class="col-xs-12">
<h4>
<?php echo $template['name']; ?>
</h4>
</div>
<div class="col-xs-8">
<div class="info">
<div class="description">
<?php echo $template['description']; ?>
</div>
<h5>Author</h5>
<p>
<a href="<?php echo $template['authoruri']; ?>" target="_blank">
<?php echo $template['author']; ?>
</a><br>
<?php echo $template['authoremail']; ?>
</p>
</div>
</div>
<div class="col-xs-4">
<div class="buttons">
<?php
if ( $template['location'] == SELECTED_CLIENTS_TEMPLATE ) {
?>
<a href="#" class="btn btn-default disabled">
<?php _e('Active','cftp_admin'); ?>
</a>
<?php
}
else {
?>
<a href="templates.php?activate_template=<?php echo $template['location']; ?>" class="btn btn-primary">
<?php _e('Activate','cftp_admin'); ?>
</a>
<?php
}
?>
</div>
</div>
</div>
</div>
<?php
}
?>
</div>
</div>
</div>
<?php
include_once ADMIN_TEMPLATES_DIR . DS . 'footer.php';