forked from artursudnik/webpagetest-monitor
/
editScript.php
33 lines (31 loc) · 938 Bytes
/
editScript.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
<?php
require("login/login.php");
include 'monitor.inc';
if (isset($_REQUEST['id'])){
$script_id = $_REQUEST['id'];
}
$user_id = getCurrentUserId();
if (isset($script_id)){
$folderId = getFolderIdFor($script_id,'WPTScript');
} else {
$folderId = $_REQUEST['folderId'];
}
if (!hasPermission('WPTScript',$folderId,PERMISSION_UPDATE)){
echo "Invalid Permission";exit;
}
if ( isset($script_id) ){
$q = Doctrine_Query::create()->from('WPTScript s')
->andWhere('s.Id= ?', $script_id);
$script = $q->fetchOne();
$q->free(true);
} else {
$script = new WPTScript();
}
$folderTree = getFolderTree($user_id,'WPTScript');
$shares = getFolderShares($user_id,'WPTScript');
$smarty->assign('folderTree',$folderTree);
$smarty->assign('shares',$shares);
$smarty->assign('folderId',$folderId);
$smarty->assign('script',$script);
$smarty->display('script/addScript.tpl');
?>