1 |
2
|
Manuela
|
<?php
|
2 |
|
|
/**
|
3 |
|
|
*
|
4 |
|
|
* @category module
|
5 |
|
|
* @package droplet
|
6 |
|
|
* @author Ruud Eisinga (Ruud) John (PCWacht)
|
7 |
|
|
* @author WebsiteBaker Project
|
8 |
|
|
* @copyright Ryan Djurovich
|
9 |
|
|
* @copyright WebsiteBaker Org. e.V.
|
10 |
|
|
* @link http://websitebaker.org/
|
11 |
|
|
* @license http://www.gnu.org/licenses/gpl.html
|
12 |
|
|
* @platform WebsiteBaker 2.8.3
|
13 |
|
|
* @requirements PHP 5.3.6 and higher
|
14 |
|
|
* @version $Id$
|
15 |
|
|
* @filesource $HeadURL$
|
16 |
|
|
* @lastmodified $Date$
|
17 |
|
|
*
|
18 |
|
|
*/
|
19 |
|
|
function executeDropletTool()
|
20 |
|
|
{
|
21 |
|
|
/* -------------------------------------------------------- */
|
22 |
|
|
$sAddonName = basename(__DIR__);
|
23 |
|
|
/*
|
24 |
|
|
*/
|
25 |
|
|
if (is_readable(dirname(__DIR__).'/SimpleRegister.php')) {
|
26 |
|
|
require (dirname(__DIR__).'/SimpleRegister.php');
|
27 |
|
|
}
|
28 |
|
|
/*******************************************************************************************/
|
29 |
|
|
// SimpleCommandDispatcher
|
30 |
|
|
/*******************************************************************************************/
|
31 |
|
|
if (is_readable(__DIR__.'/SimpleCommandDispatcher.inc')) {
|
32 |
|
|
require (__DIR__.'/SimpleCommandDispatcher.inc');
|
33 |
|
|
}
|
34 |
|
|
|
35 |
|
|
$database = $oDb;
|
36 |
|
|
$wb = $admin = $oApp;
|
37 |
|
|
if(!function_exists('getUniqueName')) { require($sAddonPath.'/droplets.functions.php'); }
|
38 |
|
|
$ToolUrl = $oReg->AcpUrl.'admintools/tool.php?tool=droplets';
|
39 |
|
|
$ApptoolLink = $oReg->AcpUrl.'admintools/index.php';
|
40 |
|
|
// create default placeholder array for templates htt or Twig use
|
41 |
|
|
$oTrans->enableAddon('modules\\'.$sAddonName);
|
42 |
|
|
$aLang = $oTrans->getLangArray();
|
43 |
|
|
$aTplDefaults = array (
|
44 |
|
|
'ADMIN_DIRECTORY' => ADMIN_DIRECTORY,
|
45 |
|
|
'ToolUrl' => $ToolUrl,
|
46 |
|
|
'sAddonUrl' => $sAddonUrl,
|
47 |
|
|
'ApptoolLink' => $ApptoolLink,
|
48 |
|
|
'sAddonThemeUrl' => $sAddonThemeUrl,
|
49 |
|
|
'AcpUrl' => $oReg->AcpUrl,
|
50 |
|
|
'AppUrl' => $oReg->AppUrl,
|
51 |
|
|
);
|
52 |
|
|
$output = '';
|
53 |
|
|
if ( !class_exists('msgQueue', false) ) { require($oReg->AppPath.'/framework/class.msg_queue.php'); }
|
54 |
|
|
msgQueue::clear();
|
55 |
|
|
if( !$oApp->get_permission($sAddonName,'module' ) ) {
|
56 |
|
|
$oApp->print_error($oTrans->MESSAGE_ADMIN_INSUFFICIENT_PRIVELLIGES, $js_back);
|
57 |
|
|
exit();
|
58 |
|
|
}
|
59 |
|
|
$sOverviewDroplets = $oTrans->TEXT_LIST_OPTIONS.' '.$oTrans->DR_TEXT_DROPLETS;
|
60 |
|
|
// prepare to get parameters (query)) from this URL string e.g. modify_droplet?droplet_id
|
61 |
|
|
$aQuery = array('command'=>'overview');
|
62 |
|
|
$sql = '';
|
63 |
|
|
$aRequestVars = $_REQUEST;
|
64 |
|
|
$aParseUrl = ( isset($aRequestVars['command'])? parse_url ($aRequestVars['command']): $aQuery );
|
65 |
|
|
// sanitize command from compatibility file
|
66 |
|
|
$action = preg_replace(
|
67 |
|
|
'/[^a-z\/0-1_]/siu',
|
68 |
|
|
'',
|
69 |
|
|
(isset($aParseUrl['path']) ? $aParseUrl['path'] : 'overview')
|
70 |
|
|
);
|
71 |
|
|
$sCommand = $sAddonPath.'/commands/'.$action.'.php';
|
72 |
|
|
$subCommand = (isset($aRequestVars['subCommand'])?$aRequestVars['subCommand']:$action);
|
73 |
|
|
if ( isset( $aParseUrl['query']) ) { parse_str($aParseUrl['query'], $aQuery); }
|
74 |
|
|
// if( !function_exists( 'make_dir' ) ) { require($oReg->AppPath.'/framework/functions.php'); }
|
75 |
|
|
ob_start();
|
76 |
|
|
extract($aQuery, EXTR_PREFIX_SAME, "dr");
|
77 |
|
|
switch ($action):
|
78 |
|
|
case 'add_droplet':
|
79 |
|
|
case 'copy_droplet':
|
80 |
|
|
$iDropletAddId = ($oApp->checkIDKEY($droplet_id, false, ''));
|
81 |
|
|
if ( is_readable($sCommand)) { include ( $sCommand ); }
|
82 |
|
|
$sCommand = $sAddonPath.'/commands/'.'rename_droplet.php';
|
83 |
|
|
case 'rename_droplet':
|
84 |
|
|
if ( is_readable($sCommand)) { include ( $sCommand ); }
|
85 |
|
|
$sCommand = $sAddonPath.'/commands/'.'overview.php';
|
86 |
|
|
case 'modify_droplet':
|
87 |
|
|
case 'backup_droplets':
|
88 |
|
|
case 'import_droplets':
|
89 |
|
|
if (is_readable($sCommand)) { include ( $sCommand ); }
|
90 |
|
|
break;
|
91 |
|
|
case 'save_rename':
|
92 |
|
|
$droplet_id = $aRequestVars['CopyDropletId'];
|
93 |
|
|
// $droplet_id = ($oApp->checkIDKEY($droplet_id, false, ''));
|
94 |
|
|
if ( is_readable($sCommand)) { include ( $sCommand ); }
|
95 |
|
|
$sCommand = $sAddonPath.'/commands/'.'overview.php';
|
96 |
|
|
if (is_readable($sCommand)) { include ( $sCommand ); }
|
97 |
|
|
break;
|
98 |
|
|
case 'save_droplet':
|
99 |
|
|
$droplet_id = $aRequestVars['droplet_id'];
|
100 |
|
|
case 'ToggleStatus':
|
101 |
|
|
case 'delete_droplet':
|
102 |
|
|
$droplet_id = ($oApp->checkIDKEY($droplet_id, false, ''));
|
103 |
|
|
case 'restore_droplets':
|
104 |
|
|
case 'call_help':
|
105 |
|
|
case 'call_import':
|
106 |
|
|
case 'select_archiv':
|
107 |
|
|
case 'delete_archiv':
|
108 |
|
|
if ( is_readable($sCommand)) { include ( $sCommand ); }
|
109 |
|
|
default:
|
110 |
|
|
$sCommand = $sAddonPath.'/commands/'.'overview.php';
|
111 |
|
|
if (is_readable($sCommand)) { include ( $sCommand ); }
|
112 |
|
|
break;
|
113 |
|
|
endswitch;
|
114 |
|
|
$output = ob_get_clean();
|
115 |
|
|
if( ($msg = msgQueue::getSuccess()) != '')
|
116 |
|
|
{
|
117 |
|
|
$output = $oApp->print_success($msg, $ToolUrl ).$output;
|
118 |
|
|
}
|
119 |
|
|
if( ($msg = msgQueue::getError()) != '')
|
120 |
|
|
{
|
121 |
|
|
$output = $oApp->print_error($msg, $ToolUrl).$output;
|
122 |
|
|
}
|
123 |
|
|
print $output;
|
124 |
|
|
$oApp->print_footer();
|
125 |
|
|
} // end executeDropletTool
|
126 |
|
|
/* -------------------------------------------------------------------------------------------- */
|
127 |
|
|
/* */
|
128 |
|
|
/* -------------------------------------------------------------------------------------------- */
|
129 |
|
|
if ( !defined( 'WB_PATH' ) ){ require( dirname(dirname((__DIR__))).'/config.php' ); }
|
130 |
|
|
if ( !class_exists('admin', false) ) { require(WB_PATH.'/framework/class.admin.php'); }
|
131 |
|
|
$oApp = new admin('admintools', 'admintools', false);
|
132 |
|
|
$requestMethod = '_'.strtoupper($_SERVER['REQUEST_METHOD']);
|
133 |
|
|
$aRequestVars = (isset(${$requestMethod})) ? ${$requestMethod} : null;
|
134 |
|
|
executeDropletTool();
|
135 |
|
|
exit;
|
136 |
|
|
// end of file
|