| | |
| | | |
| | | $adminflag = ($_SESSION['s']['user']['typ'] == 'admin') ? true : false; |
| | | $gui = new ApsGUIController($app); |
| | | $pkg_id = (isset($_GET['id'])) ? $app->db->quote($_GET['id']) : ''; |
| | | $pkg_id = (isset($_GET['id'])) ? $_GET['id'] : ''; |
| | | |
| | | // Check if a newer version is available for the current package |
| | | // Note: It's intended that here is no strict ID check (see below) |
| | |
| | | // Get domain list |
| | | $domains = array(); |
| | | $domain_for_user = ''; |
| | | if(!$adminflag) $domain_for_user = "AND (sys_userid = '".$app->db->quote($_SESSION['s']['user']['userid'])."' |
| | | OR sys_groupid = '".$app->db->quote($_SESSION['s']['user']['userid'])."' )"; |
| | | $domains_assoc = $app->db->queryAllRecords("SELECT domain FROM web_domain WHERE document_root != '' AND (type = 'vhost' OR type = 'vhostsubdomain') AND active = 'y' ".$domain_for_user." ORDER BY domain;"); |
| | | if(!$adminflag) $domain_for_user = "AND (sys_userid = ? OR sys_groupid = ?)"; |
| | | $domains_assoc = $app->db->queryAllRecords("SELECT domain FROM web_domain WHERE document_root != '' AND (type = 'vhost' OR type = 'vhostsubdomain' OR type = 'vhostalias') AND active = 'y' ".$domain_for_user." ORDER BY domain", $_SESSION['s']['user']['userid'], $_SESSION['s']['user']['default_group']); |
| | | if(!empty($domains_assoc)) foreach($domains_assoc as $domain) $domains[] = $domain['domain']; |
| | | |
| | | // If data has been submitted, validate it |
| | |
| | | if(!empty($domains)) |
| | | { |
| | | $set = array(); |
| | | $set[] = '<select name="main_domain" id="main_domain" class="selectInput">'; |
| | | $set[] = '<select name="main_domain" id="main_domain" class="form-control" style="width:100%; height:100%; min-width:170px;">'; |
| | | foreach($domains as $domain) |
| | | { |
| | | $selected = ''; |
| | |
| | | $set[] = '<legend>'.$app->lng('package_settings_txt').'</legend>'; |
| | | foreach($settings as $setting) |
| | | { |
| | | $set[] = '<div class="ctrlHolder">'; |
| | | $set[] = '<label for="'.$setting['SettingID'].'">'.$setting['SettingName'].'</label>'; |
| | | $set[] = '<div class="form-group">'; |
| | | $set[] = '<label for="'.$setting['SettingID'].'" class="col-sm-3 control-label">'.$setting['SettingName'].'</label>'; |
| | | if($setting['SettingInputType'] == 'string' || $setting['SettingInputType'] == 'password') |
| | | { |
| | | $input_type = ($setting['SettingInputType'] == 'string') ? 'text' : 'password'; |
| | |
| | | $input_value = $result['input'][$setting['SettingID']]; |
| | | else $input_value = @$setting['SettingDefaultValue']; |
| | | |
| | | $set[] = '<input type="'.$input_type.'" class="textInput" name="'.$setting['SettingID'].'" maxlength="'.$setting['SettingMaxLength'].'" id="'.$setting['SettingID'].'" value="'.$input_value.'" /> |
| | | <p class="formHint">'.$setting['SettingDescription'].'</p>'; |
| | | $set[] = '<div class="col-sm-9"><input type="'.$input_type.'" class="form-control" name="'.$setting['SettingID'].'" maxlength="'.$setting['SettingMaxLength'].'" id="'.$setting['SettingID'].'" value="'.$input_value.'" /> |
| | | <p class="formHint">'.$setting['SettingDescription'].'</p></div>'; |
| | | } |
| | | else if($setting['SettingInputType'] == 'checkbox') |
| | | { |
| | |
| | | $checked = 'checked '; |
| | | else if($setting['SettingDefaultValue'] == '1') $checked = 'checked '; |
| | | |
| | | $set[] = '<input type="checkbox" id="'.$setting['SettingID'].'" name="'.$setting['SettingID'].'" '.$checked.'/> |
| | | <p class="formHint">'.$setting['SettingDescription'].'</p>'; |
| | | $set[] = '<div class="col-sm-9"><input type="checkbox" id="'.$setting['SettingID'].'" name="'.$setting['SettingID'].'" '.$checked.'/> |
| | | <p class="formHint">'.$setting['SettingDescription'].'</p></div>'; |
| | | } |
| | | else if($setting['SettingInputType'] == 'select') |
| | | { |
| | | $set[] = '<select size="1" class="selectInput" name="'.$setting['SettingID'].'">'; |
| | | $set[] = '<div class="col-sm-9"><select size="1" class="form-control" name="'.$setting['SettingID'].'">'; |
| | | foreach($setting['SettingChoices'] as $choice) |
| | | { |
| | | $selected = ''; |
| | |
| | | $set[] = '<option value="'.$choice['EnumID'].'" '.$selected.'>'.$choice['EnumName'].'</option>'; |
| | | } |
| | | $set[] = '</select> |
| | | <p class="formHint">'.$setting['SettingDescription'].'</p>'; |
| | | <p class="formHint">'.$setting['SettingDescription'].'</p></div>'; |
| | | } |
| | | |
| | | $set[] = '</div>'; |