Пример #1
0
 // Will be false in case no fitting data could be fetched before
 if ($appServer->appServerDetails) {
     $query2 = $sql->prepare("INSERT INTO `addons_installed` (`userid`,`addonid`,`serverid`,`servertemplate`,`paddon`,`resellerid`) VALUES (?,?,?,?,?,?)");
     $query = $sql->prepare("SELECT `addon`,`paddon` FROM `addons` WHERE `id`=? AND `resellerid`=? AND `active`='Y' LIMIT 1");
     $query->execute(array($addonID, $resellerLockupID));
     while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
         $protectedAllowed = $row['paddon'];
         $addonName = $row['addon'];
         if ($ui->st('action', 'get') == 'ad') {
             // Check if the addon is allowed for installing
             if ($appServer->appServerDetails['protectionModeStarted'] == 'N' or $appServer->appServerDetails['protectionModeStarted'] == 'Y' and $protectedAllowed == 'Y') {
                 $query2->execute(array($user_id, $addonID, $appServer->appServerDetails['app']['id'], $appServer->appServerDetails['app']['servertemplate'], $appServer->appServerDetails['protectionModeStarted'], $resellerLockupID));
                 $template_file = $sprache->addon_inst;
                 $actionstatus = 'ok';
                 // Reload addon details in order to have the newly inserted available as well
                 $appServer->getAddonDetails();
                 $appServer->addAddon($addonID);
                 // This case becomes true in case the user tries to manipulate the URL
             } else {
                 $template_file = $sprache->failed;
                 $actionstatus = 'fail';
             }
         } else {
             // This will load all details for all installed addons into the object
             $appServer->getAddonDetails();
             // Remove the selected addon
             $appServer->removeAddon($addonID);
             $template_file = $sprache->addon_del;
             $actionstatus = 'ok';
         }
     }