Advertisement
Guest User

unzend.com_ioncube_decoder57

a guest
Aug 23rd, 2019
262
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 38.49 KB | None | 0 0
  1. <?php
  2.  
  3. ioncube decoder https://www.unzend.com
  4. define("ADMINAREA", true);
  5. require("../init.php");
  6. $aInt = new WHMCS\Admin("View Promotions");
  7. $aInt->title = $aInt->lang("promos", "title");
  8. $aInt->sidebar = "config";
  9. $aInt->icon = "autosettings";
  10. $aInt->helplink = "Promotions";
  11. if( $action == "genpromo" )
  12. {
  13.     $numbers = "0123456789";
  14.     $uppercase = "ABCDEFGHIJKLMNOPQRSTUVYWXYZ";
  15.     $str = "";
  16.     $seeds_count = strlen($numbers) - 1;
  17.     for( $i = 0; $i < 4; $i++ )
  18.     {
  19.         $str .= $numbers[rand(0, $seeds_count)];
  20.     }
  21.     $seeds_count = strlen($uppercase) - 1;
  22.     for( $i = 0; $i < 8; $i++ )
  23.     {
  24.         $str .= $uppercase[rand(0, $seeds_count)];
  25.     }
  26.     $password = "";
  27.     for( $i = 0; $i < 10; $i++ )
  28.     {
  29.         $randomnum = rand(0, strlen($str) - 1);
  30.         $password .= $str[$randomnum];
  31.         $str = substr($str, 0, $randomnum) . substr($str, $randomnum + 1);
  32.     }
  33.     echo $password;
  34.     exit();
  35. }
  36.  
  37. if( $action == "save" )
  38. {
  39.     check_token("WHMCS.admin.default");
  40.     checkPermission("Create/Edit Promotions");
  41.     $id = (int) $whmcs->get_req_var("id");
  42.     $code = trim($whmcs->get_req_var("code"));
  43.     $type = $whmcs->get_req_var("type");
  44.     $recurring = (int) $whmcs->get_req_var("recurring");
  45.     $pvalue = $whmcs->get_req_var("pvalue");
  46.     $requiresexisting = (int) $whmcs->get_req_var("requiresexisting");
  47.     $startdate = $whmcs->get_req_var("startdate");
  48.     $expirationdate = $whmcs->get_req_var("expirationdate");
  49.     $maxuses = (int) $whmcs->get_req_var("maxuses");
  50.     $lifetimepromo = (int) $whmcs->get_req_var("lifetimepromo");
  51.     $applyonce = (int) $whmcs->get_req_var("applyonce");
  52.     $newsignups = (int) $whmcs->get_req_var("newsignups");
  53.     $existingclient = (int) $whmcs->get_req_var("existingclient");
  54.     $onceperclient = (int) $whmcs->get_req_var("onceperclient");
  55.     $recurfor = (int) $whmcs->get_req_var("recurfor");
  56.     $cycles = $whmcs->get_req_var("cycles");
  57.     $appliesto = $whmcs->get_req_var("appliesto");
  58.     $requires = $whmcs->get_req_var("requires");
  59.     $upgrades = (int) $whmcs->get_req_var("upgrades");
  60.     $upgradevalue = $whmcs->get_req_var("upgradevalue");
  61.     $upgradetype = $whmcs->get_req_var("upgradetype");
  62.     $upgradediscounttype = $whmcs->get_req_var("upgradediscounttype");
  63.     $configoptionupgrades = $whmcs->get_req_var("configoptionupgrades");
  64.     $notes = $whmcs->get_req_var("notes");
  65.     $startdate = (!$startdate ? "0000-00-00" : toMySQLDate($startdate));
  66.     $expirationdate = (!$expirationdate ? "0000-00-00" : toMySQLDate($expirationdate));
  67.     $cycles = (is_array($cycles) ? implode(",", $cycles) : "");
  68.     $appliesto = (is_array($appliesto) ? implode(",", $appliesto) : "");
  69.     $requires = (is_array($requires) ? implode(",", $requires) : "");
  70.     $upgradeconfig = serialize(array( "value" => format_as_currency($upgradevalue), "type" => $upgradetype, "discounttype" => $upgradediscounttype, "configoptions" => $configoptionupgrades ));
  71.     if( $id )
  72.     {
  73.         $promotion = Illuminate\Database\Capsule\Manager::table("tblpromotions")->find($id);
  74.         if( $code != $promotion->code )
  75.         {
  76.             logAdminActivity("Promotion Modified: Code Modified: '" . $promotion->code . "' to '" . $code . "' - Promotion ID: " . $newid);
  77.         }
  78.  
  79.         $changes = array(  );
  80.         if( $type != $promotion->type )
  81.         {
  82.             $changes[] = "Type Changed: '" . $promotion->type . "' to '" . $type . "'";
  83.         }
  84.  
  85.         if( $recurring != $promotion->recurring )
  86.         {
  87.             if( $recurring )
  88.             {
  89.                 $changes[] = "Recurring Enabled";
  90.             }
  91.             else
  92.             {
  93.                 $changes[] = "Recurring Disabled";
  94.             }
  95.  
  96.         }
  97.  
  98.         if( $recurfor != $promotion->recurfor )
  99.         {
  100.             $changes[] = "Recur For Modified: '" . $promotion->recurfor . "' to '" . $recurfor . "'";
  101.         }
  102.  
  103.         if( $pvalue != $promotion->value )
  104.         {
  105.             $changes[] = "Value Modified: '" . $promotion->value . "' to '" . $pvalue . "'";
  106.         }
  107.  
  108.         if( $appliesto != $promotion->appliesto )
  109.         {
  110.             $changes[] = "Applies To Modified";
  111.         }
  112.  
  113.         if( $requires != $promotion->requires )
  114.         {
  115.             $changes[] = "Requires Modified";
  116.         }
  117.  
  118.         if( $requiresexisting != $promotion->requiresexisting )
  119.         {
  120.             if( $requiresexisting )
  121.             {
  122.                 $changes[] = "Requires Existing Product Allowed In Account Enabled";
  123.             }
  124.             else
  125.             {
  126.                 $changes[] = "Requires Existing Product Allowed In Account Disabled";
  127.             }
  128.  
  129.         }
  130.  
  131.         if( $cycles != $promotion->cycles )
  132.         {
  133.             $changes[] = "Cycles Modified";
  134.         }
  135.  
  136.         if( $startdate != $promotion->startdate )
  137.         {
  138.             $changes[] = "Start Date Modified: '" . $promotion->startdate . "' to '" . $startdate . "'";
  139.         }
  140.  
  141.         if( $expirationdate != $promotion->expirationdate )
  142.         {
  143.             $changes[] = "Expiry Date Modified: '" . $promotion->expirationdate . "' to '" . $expirationdate . "'";
  144.         }
  145.  
  146.         if( $maxuses != $promotion->maxuses )
  147.         {
  148.             $changes[] = "Max Uses Modified: '" . $promotion->maxuses . "' to '" . $maxuses . "'";
  149.         }
  150.  
  151.         if( $lifetimepromo != $promotion->lifetimepromo )
  152.         {
  153.             if( $lifetimepromo )
  154.             {
  155.                 $changes[] = "Lifetime Promotion Enabled";
  156.             }
  157.             else
  158.             {
  159.                 $changes[] = "Lifetime Promotion Disabled";
  160.             }
  161.  
  162.         }
  163.  
  164.         if( $applyonce != $promotion->applyonce )
  165.         {
  166.             if( $applyonce )
  167.             {
  168.                 $changes[] = "Apply Once Enabled";
  169.             }
  170.             else
  171.             {
  172.                 $changes[] = "Apply Once Disabled";
  173.             }
  174.  
  175.         }
  176.  
  177.         if( $newsignups != $promotion->newsignups )
  178.         {
  179.             if( $newsignups )
  180.             {
  181.                 $changes[] = "New Signups Only Enabled";
  182.             }
  183.             else
  184.             {
  185.                 $changes[] = "New Signups Only Disabled";
  186.             }
  187.  
  188.         }
  189.  
  190.         if( $onceperclient != $promotion->onceperclient )
  191.         {
  192.             if( $onceperclient )
  193.             {
  194.                 $changes[] = "Once Per Client Enabled";
  195.             }
  196.             else
  197.             {
  198.                 $changes[] = "Once Per Client Disabled";
  199.             }
  200.  
  201.         }
  202.  
  203.         if( $existingclient != $promotion->existingclient )
  204.         {
  205.             if( $existingclient )
  206.             {
  207.                 $changes[] = "Existing Client Only Enabled";
  208.             }
  209.             else
  210.             {
  211.                 $changes[] = "Existing Client Only Disabled";
  212.             }
  213.  
  214.         }
  215.  
  216.         if( $upgrades != $promotion->upgrades )
  217.         {
  218.             if( $upgrades )
  219.             {
  220.                 $changes[] = "Product Upgrade Promotion Enabled";
  221.             }
  222.             else
  223.             {
  224.                 $changes[] = "Product Upgrade Promotion Disabled";
  225.             }
  226.  
  227.         }
  228.  
  229.         if( $upgradeconfig != $promotion->upgradeconfig )
  230.         {
  231.             $changes[] = "Upgrade Promotion Configuration Modified";
  232.         }
  233.  
  234.         if( $notes != $promotion->notes )
  235.         {
  236.             $changes[] = "Admin Notes Modified";
  237.         }
  238.  
  239.         update_query("tblpromotions", array( "code" => $code, "type" => $type, "recurring" => $recurring, "value" => $pvalue, "cycles" => $cycles, "appliesto" => $appliesto, "requires" => $requires, "requiresexisting" => $requiresexisting, "startdate" => $startdate, "expirationdate" => $expirationdate, "maxuses" => $maxuses, "lifetimepromo" => $lifetimepromo, "applyonce" => $applyonce, "newsignups" => $newsignups, "existingclient" => $existingclient, "onceperclient" => $onceperclient, "recurfor" => $recurfor, "upgrades" => $upgrades, "upgradeconfig" => $upgradeconfig, "notes" => $notes ), array( "id" => $id ));
  240.         if( $changes )
  241.         {
  242.             logAdminActivity("Promotion Modified: '" . $code . "' - Changes: " . implode(". ", $changes) . " - Promotion ID: " . $id);
  243.         }
  244.  
  245.         redir("updated=true");
  246.     }
  247.     else
  248.     {
  249.         $result = select_query("tblpromotions", "COUNT(*)", array( "code" => $code ));
  250.         $data = mysql_fetch_array($result);
  251.         $duplicates = $data[0];
  252.         $newid = insert_query("tblpromotions", array( "code" => $code, "type" => $type, "recurring" => $recurring, "value" => $pvalue, "cycles" => $cycles, "appliesto" => $appliesto, "requires" => $requires, "requiresexisting" => $requiresexisting, "startdate" => $startdate, "expirationdate" => $expirationdate, "maxuses" => $maxuses, "lifetimepromo" => $lifetimepromo, "applyonce" => $applyonce, "newsignups" => $newsignups, "existingclient" => $existingclient, "onceperclient" => $onceperclient, "recurfor" => $recurfor, "upgrades" => $upgrades, "upgradeconfig" => $upgradeconfig, "notes" => $notes ));
  253.         logAdminActivity("Promotion Created: '" . $code . "' - Promotion ID: " . $newid);
  254.         if( $duplicates )
  255.         {
  256.             redir("action=manage&id=" . $newid);
  257.         }
  258.         else
  259.         {
  260.             redir("created=true");
  261.         }
  262.  
  263.     }
  264.  
  265. }
  266.  
  267. if( $action == "delete" )
  268. {
  269.     check_token("WHMCS.admin.default");
  270.     checkPermission("Delete Promotions");
  271.     $id = (int) $whmcs->get_req_var("id");
  272.     $promotion = Illuminate\Database\Capsule\Manager::table("tblpromotions")->find($id);
  273.     logAdminActivity("Promotion Deleted: '" . $promotion->code . "' - Promotion ID: " . $id);
  274.     delete_query("tblpromotions", array( "id" => $id ));
  275.     redir("deleted=true");
  276. }
  277.  
  278. $expire = (int) $whmcs->get_req_var("expire");
  279. if( $expire )
  280. {
  281.     check_token("WHMCS.admin.default");
  282.     checkPermission("Create/Edit Promotions");
  283.     update_query("tblpromotions", array( "expirationdate" => date("Y-m-d", mktime(0, 0, 0, date("m"), date("d") - 1, date("Y"))) ), array( "id" => $expire ));
  284.     $promotion = Illuminate\Database\Capsule\Manager::table("tblpromotions")->find($expire);
  285.     logAdminActivity("Promotion Expired: '" . $promotion->code . "' - Promotion ID: " . $expire);
  286.     redir("expired=true");
  287. }
  288.  
  289. ob_start();
  290. if( !$action )
  291. {
  292.     $aInt->deleteJSConfirm("doDelete", "promos", "deletesure", "?action=delete&id=");
  293.     if( $deleted )
  294.     {
  295.         infoBox($aInt->lang("global", "success"), $aInt->lang("promos", "deletesuccess"));
  296.     }
  297.  
  298.     if( $updated )
  299.     {
  300.         infoBox($aInt->lang("global", "success"), $aInt->lang("global", "changesuccess"));
  301.     }
  302.  
  303.     if( $created )
  304.     {
  305.         infoBox($aInt->lang("global", "success"), $aInt->lang("promos", "addsuccess"));
  306.     }
  307.  
  308.     if( $expired )
  309.     {
  310.         infoBox($aInt->lang("global", "success"), $aInt->lang("promos", "expiresuccess"));
  311.     }
  312.  
  313.     echo $infobox;
  314.     echo "\n<p>\n    <div class=\"pull-right btn-group\" role=\"group\">\n        <a href=\"configpromotions.php\" class=\"btn btn-default";
  315.     if( $view == "" )
  316.     {
  317.         echo " active";
  318.     }
  319.  
  320.     echo "\">";
  321.     echo $aInt->lang("promos", "activepromos");
  322.     echo "</a>\n        <a href=\"configpromotions.php?view=expired\" class=\"btn btn-default";
  323.     if( $view == "expired" )
  324.     {
  325.         echo " active";
  326.     }
  327.  
  328.     echo "\">";
  329.     echo $aInt->lang("promos", "expiredpromos");
  330.     echo "</a>\n        <a href=\"configpromotions.php?view=all\" class=\"btn btn-default";
  331.     if( $view == "all" )
  332.     {
  333.         echo " active";
  334.     }
  335.  
  336.     echo "\">";
  337.     echo $aInt->lang("promos", "allpromos");
  338.     echo "</a>\n    </div>\n    <a href=\"";
  339.     echo $whmcs->getPhpSelf();
  340.     echo "?action=manage\" class=\"btn btn-default\"><i class=\"fas fa-plus\"></i> ";
  341.     echo $aInt->lang("promos", "createpromo");
  342.     echo "</a>\n</p>\n\n";
  343.     $aInt->sortableTableInit("code", "ASC");
  344.     if( $view == "all" )
  345.     {
  346.         $where = "";
  347.     }
  348.     else
  349.     {
  350.         if( $view == "expired" )
  351.         {
  352.             $where = "(maxuses>0 AND uses>=maxuses) OR (expirationdate!='0000-00-00' AND expirationdate<'" . date("Ymd") . "')";
  353.         }
  354.         else
  355.         {
  356.             $where = "(maxuses<=0 OR uses<maxuses) AND (expirationdate='0000-00-00' OR expirationdate>='" . date("Ymd") . "')";
  357.         }
  358.  
  359.     }
  360.  
  361.     $result = select_query("tblpromotions", "COUNT(*)", $where);
  362.     $data = mysql_fetch_array($result);
  363.     $numrows = $data[0];
  364.     $result = select_query("tblpromotions", "", $where, "code", "ASC", $page * $limit . "," . $limit);
  365.     while( $data = mysql_fetch_array($result) )
  366.     {
  367.         $pid = $data["id"];
  368.         $code = $data["code"];
  369.         $type = $data["type"];
  370.         $recurring = $data["recurring"];
  371.         $value = $data["value"];
  372.         $uses = $data["uses"];
  373.         $maxuses = $data["maxuses"];
  374.         $startdate = $data["startdate"];
  375.         $expirationdate = $data["expirationdate"];
  376.         $notes = $data["notes"];
  377.         if( 0 < $maxuses && $maxuses <= $uses )
  378.         {
  379.             $uses = "<b>" . $uses;
  380.         }
  381.  
  382.         if( 0 < $maxuses )
  383.         {
  384.             $uses .= "/" . $maxuses;
  385.         }
  386.  
  387.         $recurring = ($recurring ? "<img src=\"images/icons/tick.png\" width=\"16\" height=\"16\" alt=\"Yes\" />" : "");
  388.         $startdate = ($startdate == "0000-00-00" ? "-" : fromMySQLDate($startdate));
  389.         $expirationdate = ($expirationdate == "0000-00-00" ? "-" : fromMySQLDate($expirationdate));
  390.         if( $notes )
  391.         {
  392.             $code = "<a title=\"" . $aInt->lang("fields", "notes") . ": " . $notes . "\">" . $code . "</a>";
  393.         }
  394.  
  395.         if( $type == "Percentage" )
  396.         {
  397.             $type = $aInt->lang("promos", "percentage");
  398.         }
  399.         else
  400.         {
  401.             if( $type == "Fixed Amount" )
  402.             {
  403.                 $type = $aInt->lang("promos", "fixedamount");
  404.             }
  405.             else
  406.             {
  407.                 if( $type == "Free Setup" )
  408.                 {
  409.                     $type = $aInt->lang("promos", "freesetup");
  410.                 }
  411.  
  412.             }
  413.  
  414.         }
  415.  
  416.         $tabledata[] = array( $code, $type, $value, $recurring, $uses, $startdate, $expirationdate, "<a href=\"?action=manage&duplicate=" . $pid . "\"><img src=\"images/icons/add.png\" border=\"0\" align=\"absmiddle\" /> " . $aInt->lang("promos", "duplicatepromo") . "</a>", "<a href=\"?expire=" . $pid . generate_token("link") . "\"><img src=\"images/icons/expire.png\" border=\"0\" align=\"absmiddle\" /> " . $aInt->lang("promos", "expirenow") . "</a>", "<a href=\"?action=manage&id=" . $pid . "\"><img src=\"images/edit.gif\" width=\"16\" height=\"16\" border=\"0\" alt=\"" . $aInt->lang("global", "edit") . "\"></a>", "<a href=\"#\" onClick=\"doDelete('" . $pid . "');return false\"><img src=\"images/delete.gif\" width=\"16\" height=\"16\" border=\"0\" alt=\"" . $aInt->lang("global", "delete") . "\"></a>" );
  417.     }
  418.     echo $aInt->sortableTable(array( $aInt->lang("fields", "promocode"), $aInt->lang("fields", "type"), $aInt->lang("promos", "value"), $aInt->lang("promos", "recurring"), $aInt->lang("promos", "uses"), $aInt->lang("fields", "startdate"), $aInt->lang("fields", "expirydate"), "&nbsp;", "&nbsp;", "", "" ), $tabledata);
  419. }
  420. else
  421. {
  422.     if( $action == "duplicate" )
  423.     {
  424.         checkPermission("Create/Edit Promotions");
  425.         echo "\n<p><b>";
  426.         echo $aInt->lang("promos", "duplicatepromo");
  427.         echo "</b></p>\n\n<form method=\"get\" action=\"";
  428.         echo $whmcs->getPhpSelf();
  429.         echo "\">\n<input type=\"hidden\" name=\"action\" value=\"manage\" />\n<table class=\"form\" width=\"100%\" border=\"0\" cellspacing=\"2\" cellpadding=\"3\">\n<tr><td width=\"15%\" class=\"fieldlabel\">";
  430.         echo $aInt->lang("promos", "existingpromo");
  431.         echo "</td><td class=\"fieldarea\"><select name=\"duplicate\">";
  432.         $query = "SELECT * FROM tblpromotions ORDER BY code ASC";
  433.         $result = full_query($query);
  434.         while( $data = mysql_fetch_array($result) )
  435.         {
  436.             $promoid = $data["id"];
  437.             $promoname = $data["code"];
  438.             echo "<option value=\"" . $promoid . "\">" . $promoname;
  439.         }
  440.         echo "</select></td></tr>\n</table>\n<div class=\"btn-container\">\n    <input type=\"submit\" value=\"";
  441.         echo $aInt->lang("global", "continue");
  442.         echo " &raquo;\" class=\"btn btn-primary\">\n</div>\n</form>\n\n";
  443.     }
  444.     else
  445.     {
  446.         if( $action == "manage" )
  447.         {
  448.             if( $id )
  449.             {
  450.                 $result = select_query("tblpromotions", "", array( "id" => $id ));
  451.                 $data = mysql_fetch_array($result);
  452.                 $code = $data["code"];
  453.                 $type = $data["type"];
  454.                 $recurring = $data["recurring"];
  455.                 $value = $data["value"];
  456.                 $cycles = $data["cycles"];
  457.                 $appliesto = $data["appliesto"];
  458.                 $requires = $data["requires"];
  459.                 $requiresexisting = $data["requiresexisting"];
  460.                 $startdate = $data["startdate"];
  461.                 $expirationdate = $data["expirationdate"];
  462.                 $maxuses = $data["maxuses"];
  463.                 $uses = $data["uses"];
  464.                 $lifetimepromo = $data["lifetimepromo"];
  465.                 $applyonce = $data["applyonce"];
  466.                 $newsignups = $data["newsignups"];
  467.                 $existingclient = $data["existingclient"];
  468.                 $onceperclient = $data["onceperclient"];
  469.                 $recurfor = $data["recurfor"];
  470.                 $upgrades = $data["upgrades"];
  471.                 $upgradeconfig = $data["upgradeconfig"];
  472.                 $notes = $data["notes"];
  473.                 $startdate = ($startdate == "0000-00-00" ? "" : fromMySQLDate($startdate));
  474.                 $expirationdate = ($expirationdate == "0000-00-00" ? "" : fromMySQLDate($expirationdate));
  475.                 $cycles = explode(",", $cycles);
  476.                 $appliesto = explode(",", $appliesto);
  477.                 $requires = explode(",", $requires);
  478.                 $upgradeconfig = unserialize($upgradeconfig);
  479.                 $managetitle = $aInt->lang("promos", "editpromo");
  480.                 $result = select_query("tblpromotions", "COUNT(*)", array( "code" => $code ));
  481.                 $data = mysql_fetch_array($result);
  482.                 $duplicates = $data[0];
  483.             }
  484.             else
  485.             {
  486.                 if( $duplicate )
  487.                 {
  488.                     checkPermission("Create/Edit Promotions");
  489.                     $result = select_query("tblpromotions", "", array( "id" => $duplicate ));
  490.                     $data = mysql_fetch_array($result);
  491.                     $code = "";
  492.                     $type = $data["type"];
  493.                     $recurring = $data["recurring"];
  494.                     $value = $data["value"];
  495.                     $cycles = $data["cycles"];
  496.                     $appliesto = $data["appliesto"];
  497.                     $requires = $data["requires"];
  498.                     $requiresexisting = $data["requiresexisting"];
  499.                     $startdate = $data["startdate"];
  500.                     $expirationdate = $data["expirationdate"];
  501.                     $maxuses = $data["maxuses"];
  502.                     $uses = 0;
  503.                     $lifetimepromo = $data["lifetimepromo"];
  504.                     $applyonce = $data["applyonce"];
  505.                     $newsignups = $data["newsignups"];
  506.                     $existingclient = $data["existingclient"];
  507.                     $onceperclient = $data["onceperclient"];
  508.                     $recurfor = $data["recurfor"];
  509.                     $upgrades = $data["upgrades"];
  510.                     $upgradeconfig = $data["upgradeconfig"];
  511.                     $notes = $data["notes"];
  512.                     $startdate = ($startdate == "0000-00-00" ? "" : fromMySQLDate($startdate));
  513.                     $expirationdate = ($expirationdate == "0000-00-00" ? "" : fromMySQLDate($expirationdate));
  514.                     $cycles = explode(",", $cycles);
  515.                     $appliesto = explode(",", $appliesto);
  516.                     $requires = explode(",", $requires);
  517.                     $upgradeconfig = unserialize($upgradeconfig);
  518.                     $managetitle = $aInt->lang("promos", "duplicatepromo");
  519.                 }
  520.                 else
  521.                 {
  522.                     checkPermission("Create/Edit Promotions");
  523.                     $managetitle = $aInt->lang("promos", "createpromo");
  524.                     $appliesto = array(  );
  525.                     $requires = array(  );
  526.                     $cycles = array(  );
  527.                     $value = "";
  528.                     $recurfor = "0";
  529.                     $duplicates = 0;
  530.                 }
  531.  
  532.             }
  533.  
  534.             echo "<p><b>" . $managetitle . "</b></p>";
  535.             if( 1 < $duplicates )
  536.             {
  537.                 infoBox($aInt->lang("promos", "duplicate"), $aInt->lang("promos", "duplicateinfo"));
  538.                 echo $infobox;
  539.             }
  540.  
  541.             $jscode = "function autoGenPromo() {\n    WHMCS.http.jqClient.post(\"configpromotions.php\", \"action=genpromo\", function(data) {\n        \$(\"#promocode\").val(data);\n    });\n}";
  542.             echo "\n<form method=\"post\" action=\"";
  543.             echo $whmcs->getPhpSelf();
  544.             echo "?action=save&id=";
  545.             echo $id;
  546.             echo "\">\n\n<table class=\"form\" width=\"100%\" border=\"0\" cellspacing=\"2\" cellpadding=\"3\">\n<tr><td class=\"fieldlabel\" width=\"15%\">";
  547.             echo $aInt->lang("fields", "promocode");
  548.             echo "</td><td class=\"fieldarea\"><input type=\"text\" name=\"code\" value=\"";
  549.             echo $code;
  550.             echo "\" id=\"promocode\" class=\"form-control input-250 input-inline\" /> <input type=\"button\" value=\"";
  551.             echo $aInt->lang("promos", "autogencode");
  552.             echo "\" class=\"btn btn-success btn-sm\" onclick=\"autoGenPromo()\" /></td></tr>\n<tr><td class=\"fieldlabel\">";
  553.             echo $aInt->lang("fields", "type");
  554.             echo "</td><td class=\"fieldarea\"><select name=\"type\" class=\"form-control select-inline\">\n<option value=\"Percentage\"";
  555.             if( $type == "Percentage" )
  556.             {
  557.                 echo " selected";
  558.             }
  559.  
  560.             echo ">";
  561.             echo $aInt->lang("promos", "percentage");
  562.             echo "</option>\n<option value=\"Fixed Amount\"";
  563.             if( $type == "Fixed Amount" )
  564.             {
  565.                 echo " selected";
  566.             }
  567.  
  568.             echo ">";
  569.             echo $aInt->lang("promos", "fixedamount");
  570.             echo "</option>\n<option value=\"Price Override\"";
  571.             if( $type == "Price Override" )
  572.             {
  573.                 echo " selected";
  574.             }
  575.  
  576.             echo ">";
  577.             echo $aInt->lang("promos", "priceoverride");
  578.             echo "</option>\n<option value=\"Free Setup\"";
  579.             if( $type == "Free Setup" )
  580.             {
  581.                 echo " selected";
  582.             }
  583.  
  584.             echo ">";
  585.             echo $aInt->lang("promos", "freesetup");
  586.             echo "</option>\n</select></td></tr>\n<tr>\n    <td class=\"fieldlabel\">";
  587.             echo $aInt->lang("promos", "recurring");
  588.             echo "</td>\n    <td class=\"fieldarea\">\n        <label class=\"checkbox-inline\">\n            <input type=\"checkbox\" name=\"recurring\" value=\"1\"";
  589.             if( $recurring )
  590.             {
  591.                 echo " checked";
  592.             }
  593.  
  594.             echo " onclick=\"\$('input#recurfor').prop('disabled', !\$('input#recurfor').prop('disabled'));\">\n            ";
  595.             echo $aInt->lang("promos", "recurenable");
  596.             echo "        </label>\n        <input id=\"recurfor\" type=\"text\" name=\"recurfor\" value=\"";
  597.             echo $recurfor;
  598.             echo "\" class=\"form-control input-50 input-inline\"";
  599.             echo (!$recurring ? " disabled=\"disabled\"" : "");
  600.             echo " />\n        ";
  601.             echo $aInt->lang("promos", "recurenable2");
  602.             echo "    </td>\n</tr>\n<tr><td class=\"fieldlabel\">";
  603.             echo $aInt->lang("promos", "value");
  604.             echo "</td><td class=\"fieldarea\"><input type=\"text\" name=\"pvalue\" value=\"";
  605.             echo $value;
  606.             echo "\" placeholder=\"0.00\" class=\"form-control input-150 input-inline\"></td></tr>\n<tr><td class=\"fieldlabel\">";
  607.             echo $aInt->lang("promos", "appliesto");
  608.             echo "</td><td class=\"fieldarea\"><select name=\"appliesto[]\" size=\"8\" class=\"form-control\" multiple>\n";
  609.             $products = new WHMCS\Product\Products();
  610.             $productsList = $products->getProducts();
  611.             foreach( $productsList as $data )
  612.             {
  613.                 $id = $data["id"];
  614.                 $groupname = $data["groupname"];
  615.                 $name = $data["name"];
  616.                 echo "<option value=\"" . $id . "\"";
  617.                 if( in_array($id, $appliesto) )
  618.                 {
  619.                     echo " selected";
  620.                 }
  621.  
  622.                 echo ">" . $groupname . " - " . $name . "</option>";
  623.             }
  624.             $result = select_query("tbladdons", "", "", "name", "ASC");
  625.             while( $data = mysql_fetch_array($result) )
  626.             {
  627.                 $id = $data["id"];
  628.                 $name = $data["name"];
  629.                 $description = $data["description"];
  630.                 echo "<option value=\"A" . $id . "\"";
  631.                 if( in_array("A" . $id, $appliesto) )
  632.                 {
  633.                     echo " selected";
  634.                 }
  635.  
  636.                 echo ">" . $aInt->lang("orders", "addon") . " - " . $name . "</option>";
  637.             }
  638.             $result = select_query("tbldomainpricing", "DISTINCT extension", "", "extension", "ASC");
  639.             while( $data = mysql_fetch_array($result) )
  640.             {
  641.                 $tld = $data["extension"];
  642.                 echo "<option value=\"D" . $tld . "\"";
  643.                 if( in_array("D" . $tld, $appliesto) )
  644.                 {
  645.                     echo " selected";
  646.                 }
  647.  
  648.                 echo ">" . $aInt->lang("fields", "domain") . " - " . $tld . "</option>";
  649.             }
  650.             echo "</select></td></tr>\n<tr><td class=\"fieldlabel\">";
  651.             echo $aInt->lang("promos", "requires");
  652.             echo "</td><td class=\"fieldarea\"><select name=\"requires[]\" size=\"8\" class=\"form-control\" multiple>\n";
  653.             $productsList = $products->getProducts();
  654.             foreach( $productsList as $data )
  655.             {
  656.                 $id = $data["id"];
  657.                 $groupname = $data["groupname"];
  658.                 $name = $data["name"];
  659.                 echo "<option value=\"" . $id . "\"";
  660.                 if( in_array($id, $requires) )
  661.                 {
  662.                     echo " selected";
  663.                 }
  664.  
  665.                 echo ">" . $groupname . " - " . $name . "</option>";
  666.             }
  667.             $result = select_query("tbladdons", "", "", "name", "ASC");
  668.             while( $data = mysql_fetch_array($result) )
  669.             {
  670.                 $id = $data["id"];
  671.                 $name = $data["name"];
  672.                 $description = $data["description"];
  673.                 echo "<option value=\"A" . $id . "\"";
  674.                 if( in_array("A" . $id, $requires) )
  675.                 {
  676.                     echo " selected";
  677.                 }
  678.  
  679.                 echo ">" . $aInt->lang("orders", "addon") . " - " . $name . "</option>";
  680.             }
  681.             $result = select_query("tbldomainpricing", "DISTINCT extension", "", "extension", "ASC");
  682.             while( $data = mysql_fetch_array($result) )
  683.             {
  684.                 $tld = $data["extension"];
  685.                 echo "<option value=\"D" . $tld . "\"";
  686.                 if( in_array("D" . $tld, $requires) )
  687.                 {
  688.                     echo " selected";
  689.                 }
  690.  
  691.                 echo ">" . $aInt->lang("fields", "domain") . " - " . $tld . "</option>";
  692.             }
  693.             echo "</select><br /><input type=\"checkbox\" name=\"requiresexisting\" value=\"1\"";
  694.             if( $requiresexisting )
  695.             {
  696.                 echo " checked";
  697.             }
  698.  
  699.             echo " /> ";
  700.             echo $aInt->lang("promos", "requiresexisting");
  701.             echo "</td></tr>\n<tr><td class=\"fieldlabel\">";
  702.             echo $aInt->lang("promos", "cycles");
  703.             echo "</td><td class=\"fieldarea\">\n\n<b>";
  704.             echo $aInt->lang("services", "title");
  705.             echo "</b><br />\n<label class=\"checkbox-inline\"><input type=\"checkbox\" name=\"cycles[]\" value=\"One Time\"";
  706.             if( in_array("One Time", $cycles) )
  707.             {
  708.                 echo " checked";
  709.             }
  710.  
  711.             echo " /> ";
  712.             echo $aInt->lang("billingcycles", "onetime");
  713.             echo "</label>\n<label class=\"checkbox-inline\"><input type=\"checkbox\" name=\"cycles[]\" value=\"Monthly\"";
  714.             if( in_array("Monthly", $cycles) )
  715.             {
  716.                 echo " checked";
  717.             }
  718.  
  719.             echo " /> ";
  720.             echo $aInt->lang("billingcycles", "monthly");
  721.             echo "</label>\n<label class=\"checkbox-inline\"><input type=\"checkbox\" name=\"cycles[]\" value=\"Quarterly\"";
  722.             if( in_array("Quarterly", $cycles) )
  723.             {
  724.                 echo " checked";
  725.             }
  726.  
  727.             echo " /> ";
  728.             echo $aInt->lang("billingcycles", "quarterly");
  729.             echo "</label>\n<label class=\"checkbox-inline\"><input type=\"checkbox\" name=\"cycles[]\" value=\"Semi-Annually\"";
  730.             if( in_array("Semi-Annually", $cycles) )
  731.             {
  732.                 echo " checked";
  733.             }
  734.  
  735.             echo " /> ";
  736.             echo $aInt->lang("billingcycles", "semiannually");
  737.             echo "</label>\n<label class=\"checkbox-inline\"><input type=\"checkbox\" name=\"cycles[]\" value=\"Annually\"";
  738.             if( in_array("Annually", $cycles) )
  739.             {
  740.                 echo " checked";
  741.             }
  742.  
  743.             echo " /> ";
  744.             echo $aInt->lang("billingcycles", "annually");
  745.             echo "</label>\n<label class=\"checkbox-inline\"><input type=\"checkbox\" name=\"cycles[]\" value=\"Biennially\"";
  746.             if( in_array("Biennially", $cycles) )
  747.             {
  748.                 echo " checked";
  749.             }
  750.  
  751.             echo " /> ";
  752.             echo $aInt->lang("billingcycles", "biennially");
  753.             echo "</label>\n<label class=\"checkbox-inline\"><input type=\"checkbox\" name=\"cycles[]\" value=\"Triennially\"";
  754.             if( in_array("Triennially", $cycles) )
  755.             {
  756.                 echo " checked";
  757.             }
  758.  
  759.             echo " /> ";
  760.             echo $aInt->lang("billingcycles", "triennially");
  761.             echo "</label>\n<br />\n<b>";
  762.             echo $aInt->lang("domains", "title");
  763.             echo "</b><br />\n";
  764.             for( $domainyears = 1; $domainyears <= 10; $domainyears++ )
  765.             {
  766.                 echo "<label class=\"checkbox-inline\"><input type=\"checkbox\" name=\"cycles[]\" value=\"" . $domainyears . "Years\"";
  767.                 if( in_array($domainyears . "Years", $cycles) )
  768.                 {
  769.                     echo " checked";
  770.                 }
  771.  
  772.                 echo " /> " . $domainyears . " " . ((1 < $domainyears ? $aInt->lang("domains", "years") : $aInt->lang("domains", "year"))) . "</label> ";
  773.             }
  774.             echo "\n</td></tr>\n<tr><td class=\"fieldlabel\">";
  775.             echo $aInt->lang("fields", "startdate");
  776.             echo "</td><td class=\"fieldarea\"><input type=\"text\" name=\"startdate\" value=\"";
  777.             echo $startdate;
  778.             echo "\" class=\"form-control date-picker\"> (";
  779.             echo $aInt->lang("promos", "leaveblank");
  780.             echo ")</td></tr>\n<tr><td class=\"fieldlabel\">";
  781.             echo $aInt->lang("fields", "expirydate");
  782.             echo "</td><td class=\"fieldarea\"><input type=\"text\" name=\"expirationdate\" value=\"";
  783.             echo $expirationdate;
  784.             echo "\" class=\"form-control date-picker\"> (";
  785.             echo $aInt->lang("promos", "leaveblank");
  786.             echo ")</td></tr>\n<tr><td class=\"fieldlabel\">";
  787.             echo $aInt->lang("promos", "maxuses");
  788.             echo "</td><td class=\"fieldarea\"><input type=\"text\" name=\"maxuses\" value=\"";
  789.             echo $maxuses;
  790.             echo "\" class=\"form-control input-100 input-inline\"> (";
  791.             echo $aInt->lang("promos", "unlimiteduses");
  792.             echo ")</td></tr>\n<tr><td class=\"fieldlabel\">";
  793.             echo $aInt->lang("promos", "numuses");
  794.             echo "</td><td class=\"fieldarea\"><input type=\"text\" class=\"form-control input-100\" value=\"";
  795.             echo (int) $uses;
  796.             echo "\" disabled=\"disabled\"></td></tr>\n<tr><td class=\"fieldlabel\">";
  797.             echo $aInt->lang("promos", "lifetimepromo");
  798.             echo "</td><td class=\"fieldarea\"><label class=\"checkbox-inline\"><input type=\"checkbox\" name=\"lifetimepromo\" value=\"1\"";
  799.             if( $lifetimepromo )
  800.             {
  801.                 echo " checked";
  802.             }
  803.  
  804.             echo "> ";
  805.             echo $aInt->lang("promos", "lifetimepromodesc");
  806.             echo "</label></td></tr>\n<tr><td class=\"fieldlabel\">";
  807.             echo $aInt->lang("promos", "applyonce");
  808.             echo "</td><td class=\"fieldarea\"><label class=\"checkbox-inline\"><input type=\"checkbox\" name=\"applyonce\" value=\"1\"";
  809.             if( $applyonce )
  810.             {
  811.                 echo " checked";
  812.             }
  813.  
  814.             echo "> ";
  815.             echo $aInt->lang("promos", "applyoncedesc");
  816.             echo "</label></td></tr>\n<tr><td class=\"fieldlabel\">";
  817.             echo $aInt->lang("promos", "newsignups");
  818.             echo "</td><td class=\"fieldarea\"><label class=\"checkbox-inline\"><input type=\"checkbox\" name=\"newsignups\" value=\"1\"";
  819.             if( $newsignups )
  820.             {
  821.                 echo " checked";
  822.             }
  823.  
  824.             echo "> ";
  825.             echo $aInt->lang("promos", "newsignupsdesc");
  826.             echo "</label></td></tr>\n<tr><td class=\"fieldlabel\">";
  827.             echo $aInt->lang("promos", "onceperclient");
  828.             echo "</td><td class=\"fieldarea\"><label class=\"checkbox-inline\"><input type=\"checkbox\" name=\"onceperclient\" value=\"1\"";
  829.             if( $onceperclient )
  830.             {
  831.                 echo " checked";
  832.             }
  833.  
  834.             echo "> ";
  835.             echo $aInt->lang("promos", "onceperclientdesc");
  836.             echo "</label></td></tr>\n<tr><td class=\"fieldlabel\">";
  837.             echo $aInt->lang("promos", "existingclient");
  838.             echo "</td><td class=\"fieldarea\"><label class=\"checkbox-inline\"><input type=\"checkbox\" name=\"existingclient\" value=\"1\"";
  839.             if( $existingclient )
  840.             {
  841.                 echo " checked";
  842.             }
  843.  
  844.             echo "> ";
  845.             echo $aInt->lang("promos", "existingclientdesc");
  846.             echo "</label></td></tr>\n<tr><td class=\"fieldlabel\">";
  847.             echo $aInt->lang("promos", "upgrades");
  848.             echo "</td><td class=\"fieldarea\"><label class=\"checkbox-inline\"><input type=\"checkbox\" name=\"upgrades\" value=\"1\" onclick=\"\$('#upgradeoptions').slideToggle()\"";
  849.             if( $upgrades )
  850.             {
  851.                 echo " checked";
  852.             }
  853.  
  854.             echo "> ";
  855.             echo $aInt->lang("promos", "upgradesdesc");
  856.             echo "</label>\n\n<div id=\"upgradeoptions\"";
  857.             if( !$upgrades )
  858.             {
  859.                 echo " style=\"display:none;\"";
  860.             }
  861.  
  862.             echo ">\n<table class=\"form\" width=\"100%\" border=\"0\" cellspacing=\"2\" cellpadding=\"3\">\n<tr><td colspan=\"2\" class=\"fieldarea\"><b>";
  863.             echo $aInt->lang("promos", "upgradesinstructions");
  864.             echo "</b><br />";
  865.             echo $aInt->lang("promos", "upgradesinstructionsinfo");
  866.             echo "</td></tr>\n<tr><td class=\"fieldlabel\">";
  867.             echo $aInt->lang("promos", "upgradetype");
  868.             echo "</td><td class=\"fieldarea\"><input type=\"radio\" name=\"upgradetype\" value=\"product\"";
  869.             if( $upgradeconfig["type"] == "product" )
  870.             {
  871.                 echo " checked";
  872.             }
  873.  
  874.             echo " /> ";
  875.             echo $aInt->lang("services", "title");
  876.             echo " <input type=\"radio\" name=\"upgradetype\" value=\"configoptions\"";
  877.             if( $upgradeconfig["type"] == "configoptions" )
  878.             {
  879.                 echo " checked";
  880.             }
  881.  
  882.             echo " /> ";
  883.             echo $aInt->lang("setup", "configoptions");
  884.             echo "</td></tr>\n<tr><td class=\"fieldlabel\">";
  885.             echo $aInt->lang("promos", "upgradediscount");
  886.             echo "</td><td class=\"fieldarea\"><input type=\"text\" name=\"upgradevalue\" size=\"10\" value=\"";
  887.             echo $upgradeconfig["value"];
  888.             echo "\" /> <select name=\"upgradediscounttype\">\n<option value=\"Percentage\"";
  889.             if( $upgradeconfig["discounttype"] == "Percentage" )
  890.             {
  891.                 echo " selected";
  892.             }
  893.  
  894.             echo ">";
  895.             echo $aInt->lang("promos", "percentage");
  896.             echo "</option>\n<option value=\"Fixed Amount\"";
  897.             if( $upgradeconfig["discounttype"] == "Fixed Amount" )
  898.             {
  899.                 echo " selected";
  900.             }
  901.  
  902.             echo ">";
  903.             echo $aInt->lang("promos", "fixedamount");
  904.             echo "</option>\n</select></td></tr>\n<tr><td class=\"fieldlabel\">";
  905.             echo $aInt->lang("promos", "configoptionsupgrades");
  906.             echo "</td><td class=\"fieldarea\">\n<select name=\"configoptionupgrades[]\" size=\"8\" style=\"width:90%\" multiple>\n";
  907.             $result = select_query("tblproductconfigoptions", "tblproductconfigoptions.id,name,optionname", "", "optionname", "ASC", "", "tblproductconfiggroups ON tblproductconfiggroups.id=tblproductconfigoptions.gid");
  908.             while( $data = mysql_fetch_array($result) )
  909.             {
  910.                 $configid = $data["id"];
  911.                 $groupname = $data["name"];
  912.                 $optionname = $data["optionname"];
  913.                 echo "<option value=\"" . $configid . "\"";
  914.                 if( in_array($configid, $upgradeconfig["configoptions"]) )
  915.                 {
  916.                     echo " selected";
  917.                 }
  918.  
  919.                 echo ">" . $groupname . " - " . $optionname . "</option>";
  920.             }
  921.             echo "</select><br />";
  922.             echo $aInt->lang("promos", "configoptionsupgradesdesc");
  923.             echo "</td></tr>\n</table>\n</div>\n\n</td></tr>\n<tr><td class=\"fieldlabel\">";
  924.             echo $aInt->lang("fields", "adminnotes");
  925.             echo "</td><td class=\"fieldarea\"><textarea name=\"notes\" rows=\"4\" class=\"form-control\">";
  926.             echo $notes;
  927.             echo "</textarea></td></tr>\n</table>\n\n<div class=\"btn-container\">\n    <input type=\"submit\" value=\"";
  928.             echo $aInt->lang("global", "savechanges");
  929.             echo "\" class=\"btn btn-primary\" />\n    <input type=\"button\" value=\"";
  930.             echo $aInt->lang("global", "cancelchanges");
  931.             echo "\" class=\"btn btn-default\" onclick=\"window.location='configpromotions.php'\" />\n</div>\n\n</form>\n\n";
  932.         }
  933.  
  934.     }
  935.  
  936. }
  937.  
  938. $content = ob_get_contents();
  939. ob_end_clean();
  940. $aInt->content = $content;
  941. $aInt->jscode = $jscode;
  942. $aInt->display();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement