commit | author | age
|
bbc657
|
1 |
<?php |
MC |
2 |
/* |
|
3 |
Copyright (c) 2012, ISPConfig UG |
|
4 |
Contributors: web wack creations, http://www.web-wack.at |
|
5 |
All rights reserved. |
|
6 |
|
|
7 |
Redistribution and use in source and binary forms, with or without modification, |
|
8 |
are permitted provided that the following conditions are met: |
|
9 |
|
|
10 |
* Redistributions of source code must retain the above copyright notice, |
|
11 |
this list of conditions and the following disclaimer. |
|
12 |
* Redistributions in binary form must reproduce the above copyright notice, |
|
13 |
this list of conditions and the following disclaimer in the documentation |
|
14 |
and/or other materials provided with the distribution. |
|
15 |
* Neither the name of ISPConfig nor the names of its contributors |
|
16 |
may be used to endorse or promote products derived from this software without |
|
17 |
specific prior written permission. |
|
18 |
|
|
19 |
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
|
20 |
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
|
21 |
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
|
22 |
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, |
|
23 |
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
|
24 |
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
|
25 |
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
|
26 |
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
|
27 |
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, |
|
28 |
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
|
29 |
*/ |
|
30 |
|
b1a6a5
|
31 |
require_once '../../lib/config.inc.php'; |
MC |
32 |
require_once '../../lib/app.inc.php'; |
bbc657
|
33 |
//require_once('classes/class.guicontroller.php'); |
MC |
34 |
$app->load('aps_guicontroller'); |
|
35 |
|
|
36 |
// Check the module permissions |
|
37 |
$app->auth->check_module_permissions('sites'); |
|
38 |
|
|
39 |
// Load needed classes |
|
40 |
$app->uses('tpl'); |
|
41 |
$app->tpl->newTemplate("listpage.tpl.htm"); |
|
42 |
$app->tpl->setInclude('content_tpl', 'templates/aps_packagedetails_show.htm'); |
|
43 |
|
|
44 |
// Load the language file |
|
45 |
$lngfile = 'lib/lang/'.$_SESSION['s']['language'].'_aps.lng'; |
b1a6a5
|
46 |
require_once $lngfile; |
bbc657
|
47 |
$app->tpl->setVar($wb); |
MC |
48 |
|
|
49 |
$gui = new ApsGUIController($app); |
2af58c
|
50 |
$pkg_id = (isset($_GET['id'])) ? $_GET['id'] : ''; |
bbc657
|
51 |
|
MC |
52 |
// Check if a newer version is available for the current package |
|
53 |
// Note: It's intended that here is no strict ID check (see below) |
|
54 |
if(isset($pkg_id)) |
|
55 |
{ |
b1a6a5
|
56 |
$newest_pkg_id = $gui->getNewestPackageID($pkg_id); |
MC |
57 |
if($newest_pkg_id != 0) $pkg_id = $newest_pkg_id; |
bbc657
|
58 |
} |
MC |
59 |
|
|
60 |
// Make sure an integer ID is given |
|
61 |
$adminflag = ($_SESSION['s']['user']['typ'] == 'admin') ? true : false; |
|
62 |
if(!isset($pkg_id) || !$gui->isValidPackageID($pkg_id, $adminflag)) |
b1a6a5
|
63 |
$app->error($app->lng('Invalid ID')); |
bbc657
|
64 |
|
MC |
65 |
// Get package details |
|
66 |
$details = $gui->getPackageDetails($pkg_id); |
|
67 |
if(isset($details['error'])) $app->error($details['error']); |
|
68 |
|
|
69 |
// Set the active and default tab |
|
70 |
$next_tab = 'details'; |
|
71 |
if(isset($_POST['next_tab']) || isset($_GET['next_tab'])) |
|
72 |
{ |
b1a6a5
|
73 |
$tab = (isset($_POST['next_tab']) ? $_POST['next_tab'] : $_GET['next_tab']); |
MC |
74 |
switch($tab) |
|
75 |
{ |
|
76 |
case 'details': $next_tab = 'details'; break; |
|
77 |
case 'settings': $next_tab = 'settings'; break; |
|
78 |
case 'changelog': $next_tab = 'changelog'; break; |
|
79 |
case 'screenshots': $next_tab = 'screenshots'; break; |
|
80 |
default: $next_tab = 'details'; |
|
81 |
} |
bbc657
|
82 |
} |
MC |
83 |
$app->tpl->setVar('next_tab', $next_tab); |
|
84 |
|
|
85 |
// Parse the package details to the template |
|
86 |
foreach($details as $key => $value) |
|
87 |
{ |
b1a6a5
|
88 |
if(!is_array($value)) $app->tpl->setVar('pkg_'.str_replace(' ', '_', strtolower($key)), $value); |
MC |
89 |
else // Special cases |
|
90 |
{ |
|
91 |
if($key == 'Changelog') $app->tpl->setLoop('pkg_changelog', $details['Changelog']); |
|
92 |
elseif($key == 'Screenshots') $app->tpl->setLoop('pkg_screenshots', $details['Screenshots']); |
|
93 |
elseif($key == 'Requirements PHP settings') $app->tpl->setLoop('pkg_requirements_php_settings', $details['Requirements PHP settings']); |
|
94 |
} |
bbc657
|
95 |
} |
MC |
96 |
//print_r($details['Requirements PHP settings']); |
|
97 |
|
|
98 |
$app->tpl_defaults(); |
|
99 |
$app->tpl->pparse(); |
b1a6a5
|
100 |
?> |