Marius Burkard
2016-07-10 e1ceb050e19c7574bca146a8da7047ee4ff456b5
interface/web/sites/aps_install_package.php
@@ -62,7 +62,7 @@
$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)
@@ -85,9 +85,8 @@
// 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']['default_group'])."' )";
$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
@@ -130,7 +129,7 @@
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 = '';
@@ -154,8 +153,8 @@
   $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';
@@ -166,8 +165,8 @@
            $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')
         {
@@ -178,12 +177,12 @@
               $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 = '';
@@ -198,7 +197,7 @@
                  $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>';