Ejemplo n.º 1
0
function hook_project_management_adminticketinfo($vars)
{
    global $aInt;
    global $jscode;
    global $jquerycode;
    $ticketid = $vars['ticketid'];
    $ticketdata = get_query_vals("tbltickets", "userid,title,tid", array("id" => $ticketid));
    $tid = $ticketdata['tid'];
    require ROOTDIR . "/modules/addons/project_management/project_management.php";
    $projectrows = "";
    $result = select_query("mod_project", "mod_project.*,(SELECT CONCAT(firstname,' ',lastname) FROM tbladmins WHERE id=mod_project.adminid) AS adminname", "ticketids LIKE '%" . mysql_real_escape_string($tid) . "%'");
    while ($data = mysql_fetch_array($result)) {
        $timerid = get_query_val("mod_projecttimes", "id", array("projectid" => $data['id'], "end" => "", "adminid" => $_SESSION['adminid']), "start", "DESC");
        $timetrackinglink = $timerid ? "<a href=\"#\" onclick=\"projectendtimer('" . $data['id'] . "');return false\"><img src=\"../modules/addons/project_management/images/notimes.png\" align=\"absmiddle\" border=\"0\" /> Stop Tracking Time</a>" : "<a href=\"#\" onclick=\"projectstarttimer('" . $data['id'] . "');return false\"><img src=\"../modules/addons/project_management/images/starttimer.png\" align=\"absmiddle\" border=\"0\" /> Start Tracking Time</a>";
        $projectrows .= "<tr><td><a href=\"addonmodules.php?module=project_management&m=view&projectid=" . $data['id'] . "\">" . $data['id'] . "</a></td><td><a href=\"addonmodules.php?module=project_management&m=view&projectid=" . $data['id'] . "\">" . $data['title'] . "</a> <span id=\"projecttimercontrol" . $data['id'] . "\" class=\"tickettimer\">" . $timetrackinglink . "</span></td><td>" . $data['adminname'] . "</td><td>" . fromMySQLDate($data['created']) . "</td><td>" . fromMySQLDate($data['duedate']) . "</td><td>" . fromMySQLDate($data['lastmodified']) . "</td><td>" . $data['status'] . "</td></tr>";
    }
    $code = "<link href=\"../modules/addons/project_management/css/style.css\" rel=\"stylesheet\" type=\"text/css\" />\n\n<div id=\"projectscont\" style=\"margin:0 0 10px 0;padding:5px;border:2px dashed #e0e0e0;background-color:#fff;-moz-border-radius: 6px;-webkit-border-radius: 6px;-o-border-radius: 6px;border-radius: 6px;" . ($projectrows ? "" : "display:none;") . "\">\n\n<h2 style=\"margin:0 0 5px 0;text-align:center;background-color:#f2f2f2;-moz-border-radius: 6px;-webkit-border-radius: 6px;-o-border-radius: 6px;border-radius: 6px;\">Projects</h2>\n\n<div class=\"tablebg\" style=\"padding:0 20px;\">\n<table class=\"datatable\" width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"3\" id=\"ticketprojectstbl\">\n<tr><th>Project ID</th><th>Title</th><th>Assigned To</th><th>Created</th><th>Due Date</th><th>Last Updated</th><th>Status</th></tr>\n" . $projectrows . "\n</table>\n</div>\n\n</div>\n\n";
    if (project_management_checkperm("Create New Projects")) {
        $code .= "<span style=\"float:right;padding:0 50px 15px 0;\"><a href=\"#\" onclick=\"createnewproject();return false\" class=\"create\"><img src=\"images/icons/add.png\" align=\"top\" border=\"0\" /> <b>Create New Project</b></a></span>";
    }
    $code .= "\n<script>\n\$(document).on(\"keyup\",\"#cpclientname\",function () {\n\tvar ticketuseridsearchlength = \$(\"#cpclientname\").val().length;\n\tif (ticketuseridsearchlength>2) {\n\t\$.post(\"search.php\", { ticketclientsearch: 1, value: \$(\"#cpclientname\").val() },\n\t    function(data){\n            if (data) {\n                \$(\"#cpticketclientsearchresults\").html(data.replace(\"searchselectclient(\",\"projectsearchselectclient(\"));\n                \$(\"#cpticketclientsearchresults\").slideDown(\"slow\");\n                \$(\"#cpclientsearchcancel\").fadeIn();\n            }\n        });\n\t}\n});\nfunction projectsearchselectclient(userid,name,email) {\n    \$(\"#cpclientname\").val(name);\n    \$(\"#cpuserid\").val(userid);\n    \$(\"#cpclientsearchcancel\").fadeOut();\n\t\$(\"#cpticketclientsearchresults\").slideUp(\"slow\");\n}\n\nfunction createnewproject() {\n\t\$(\"#popupcreatenew\").show();\n\t\$(\"#popupstarttimer\").hide();\n\t\$(\"#popupendtimer\").hide();\n\t\$(\"#createnewcont\").slideDown();\n}\nfunction createproject() {\n\tinputs = \$(\"#ajaxcreateprojectform\").serializeArray();\n\t\$.post(\"addonmodules.php?module=project_management&createproj=1&ajax=1\", { input : inputs },\n\t\tfunction (data) {\n\t\t\tif(data == \"0\"){\n\t\t\t\talert(\"You do not have permission to create project\");\n\t\t\t} else {\n\t\t\t\t\$(\"#createnewcont\").slideUp();\n                \$(\"#ticketprojectstbl\").append(data);\n\t\t\t\t\$(\"#projectscont\").slideDown();\n\t\t\t}\n\t\t});\n}\n\nfunction projectstarttimer(projectid) {\n    \$(\"#ajaxstarttimerformprojectid\").val(projectid);\n\t\$(\"#popupcreatenew\").hide();\n\t\$(\"#popupstarttimer\").show();\n\t\$(\"#popupendtimer\").hide();\n\t\$(\"#createnewcont\").slideDown();\n}\n\nfunction projectendtimer(projectid) {\n\t\$(\"#popupcreatenew\").hide();\n\t\$(\"#popupstarttimer\").hide();\n\t\$(\"#popupendtimer\").show();\n\t\$(\"#createnewcont\").slideDown();\n}\n\nfunction projectstarttimersubmit() {\n\t\$.post(\"addonmodules.php?module=project_management&m=view\", \"a=hookstarttimer&\"+\$(\"#ajaxstarttimerform\").serialize(),\n\t\tfunction (data) {\n\t\t\tif(data == \"0\"){\n\t\t\t\talert(\"Could not start timer.\");\n\t\t\t} else {\n\t\t\t\t\$(\"#createnewcont\").slideUp();\n                var projid = \$(\"#ajaxstarttimerformprojectid\").val();\n\t\t\t\t\$(\"#projecttimercontrol\"+projid).html(\"<a href=\"//\" onclick=\"projectendtimer('\"+projid+\"');return false\"><img src=\"../modules/addons/project_management/images/notimes.png\" align=\"absmiddle\" border=\"0\" /> Stop Tracking Time</a>\");\n\t\$(\"#activetimers\").html(data);\n\t\t\t}\n\t\t});\n}\nfunction projectendtimersubmit(projectid,timerid) {\n\t\$.post(\"addonmodules.php?module=project_management&m=view\", \"a=hookendtimer&timerid=\"+timerid+\"&ticketnum=" . $tid . "\",\n\t\tfunction (data) {\n\t\t\tif (data == \"0\") {\n\t\t\t\talert(\"Could not stop timer.\");\n\t\t\t} else {\n\t\t\t\t\$(\"#createnewcont\").slideUp();\n\t\t\t\t\$(\"#projecttimercontrol\"+projectid).html(\"<a href=\"//\" onclick=\"projectstarttimer('\"+projectid+\"');return false\"><img src=\"../modules/addons/project_management/images/starttimer.png\" align=\"absmiddle\" border=\"0\" /> Start Tracking Time</a>\");\n\t\t\$(\"#activetimers\").html(data);\n\t\t\t}\n\t\t});\n}\n\nfunction projectpopupcancel() {\n\t\$(\"#createnewcont\").slideUp();\n}\n\n</script>\n\n<div class=\"projectmanagement\">\n\n<div id=\"createnewcont\" style=\"display:none;\">\n\n<div class=\"createnewcont2\">\n\n<div class=\"createnewproject\" id=\"popupcreatenew\" style=\"display:none\">\n<div class=\"title\">Create New Project</div>\n<form id=\"ajaxcreateprojectform\">\n<div class=\"label\">Title</div>\n<input type=\"text\" name=\"title\" class=\"title\" />\n<div class=\"float\">\n<div class=\"label\">Created</div>\n<input type=\"text\" name=\"created\" class=\"datepick\" value=\"" . getTodaysDate() . "\" />\n</div>\n<div class=\"float\">\n<div class=\"label\">Due Date</div>\n<input type=\"text\" name=\"duedate\" class=\"datepick\" value=\"" . getTodaysDate() . "\" />\n</div>\n<div class=\"float\">\n<div class=\"label\">Assigned To</div>\n<select class=\"title\" name=\"adminid\">";
    $code .= "<option value=\"0\">None</option>";
    $result = select_query("tbladmins", "id,firstname,lastname", "", "firstname` ASC,`lastname", "ASC");
    while ($data = mysql_fetch_array($result)) {
        $aid = $data['id'];
        $adminfirstname = $data['firstname'];
        $adminlastname = $data['lastname'];
        $code .= "<option value=\"" . $aid . "\"";
        if ($aid == $adminid) {
            $code .= " selected";
        }
        $code .= ">" . $adminfirstname . " " . $adminlastname . "</option>";
    }
    $code .= "</select>\n</div>\n<div class=\"float\">\n<div class=\"label\">Ticket #</div>\n<input type=\"text\" name=\"ticketnum\" class=\"ticketnum\" value=\"" . $tid . "\" />\n</div>\n<div class=\"clear\"></div>\n<div class=\"float\">\n<div class=\"label\">Associated Client</div>\n<input type=\"hidden\" name=\"userid\" id=\"cpuserid\" /><input type=\"text\" id=\"cpclientname\" value=\"" . $clientname . "\" class=\"title\" onfocus=\"if(this.value=='" . addslashes($clientname) . "')this.value=''\" /> <img src=\"images/icons/delete.png\" alt=\"" . $vars['_lang']['cancel'] . "\" align=\"right\" id=\"clientsearchcancel\" height=\"16\" width=\"16\"><div id=\"cpticketclientsearchresults\" style=\"z-index:2000;\"></div>\n</div>\n<br /><br />\n<div align=\"center\"><input type=\"button\" value=\"Create\" onclick=\"createproject()\" class=\"create\" /> <input type=\"button\" value=\"Cancel\" class=\"create\" onclick=\"projectpopupcancel();return false\" /></div>\n</form>\n</div>\n\n<div class=\"createnewproject\" id=\"popupstarttimer\" style=\"display:none\">\n<div class=\"title\">Start Time Tracking</div>\n<form id=\"ajaxstarttimerform\">\n<input type=\"hidden\" id=\"ajaxstarttimerformprojectid\" name=\"projectid\">\n<input type=\"hidden\" name=\"ticketnum\" value=\"" . $tid . "\" />\n<div class=\"label\">Select Existing Task</div>\n<select class=\"title\" style=\"min-width:450px\" name=\"taskid\">";
    $code .= "<option value=\"\">Choose one...</option>";
    $result = select_query("mod_projecttasks", "mod_project.title, mod_projecttasks.id, mod_projecttasks.projectid, mod_projecttasks.task", array("mod_project.ticketids" => array("sqltype" => "LIKE", "value" => (int) $tid)), "", "", "", "mod_project ON mod_projecttasks.projectid=mod_project.id", "", "", "", "mod_project ON mod_projecttasks.projectid=mod_project.id");
    while ($data = mysql_fetch_array($result)) {
        $code .= "<option value=\"" . $data['id'] . "\"";
        $code .= ">" . $data['projectid'] . " - " . $data['title'] . " - " . $data['task'] . "</option>";
    }
    $code .= "</select><br />\n<div class=\"label\">Or Create New Task</div>\n<input type=\"text\" name=\"title\" class=\"title\" />\n<br />\n<div align=\"center\"><input type=\"button\" value=\"Start\" onclick=\"projectstarttimersubmit();return false\" class=\"create\" /> <input type=\"button\" value=\"Cancel\" class=\"create\" onclick=\"projectpopupcancel();return false\" /></div>\n</form>\n</div>\n</div>\n\n<div class=\"createnewproject\" id=\"popupendtimer\" style=\"display:none\">\n<div class=\"title\">Stop Time Tracking</div>\n<form id=\"ajaxendtimerform\">\n<input type=\"hidden\" id=\"ajaxendtimerformprojectid\" name=\"projectid\">\n<br />\n<b>Active Timers</b>:<br /><br />\n<div id=\"activetimers\">\n";
    $result = select_query("mod_projecttimes", "mod_projecttimes.id, mod_projecttimes.projectid, mod_project.title, mod_projecttimes.taskid, mod_projecttasks.task, mod_projecttimes.start", array("mod_projecttimes.adminid" => $_SESSION['adminid'], "mod_projecttimes.end" => "", "mod_project.ticketids" => array("sqltype" => "LIKE", "value" => (int) $tid)), "", "", "", "mod_projecttasks ON mod_projecttimes.taskid=mod_projecttasks.id INNER JOIN mod_project ON mod_projecttimes.projectid=mod_project.id");
    while ($data = mysql_fetch_array($result)) {
        $code .= "<div class=\"stoptimer" . $data['id'] . "\" style=\"padding-bottom:10px;\"><em>" . $data['title'] . " - Project ID " . $data['projectid'] . "</em><br />&nbsp;&raquo; " . $data['task'] . "<br />Started at " . fromMySQLDate(date("Y-m-d H:i:s", $data['start']), 1) . ":" . date("s", $data['start']) . " - <a href=\"#\" onclick=\"projectendtimersubmit('" . $data['projectid'] . "','" . $data['id'] . "');return false\"><strong>Stop Timer</strong></a></div>";
    }
    $code .= "\n</div>\n<br />\n<div align=\"center\"><input type=\"button\" value=\"Cancel\" class=\"create\" onclick=\"projectpopupcancel();return false\" /></div>\n</form>\n</div>\n\n</div>\n\n</div>\n\n";
    return $code;
}
Ejemplo n.º 2
0
function chartdata_income()
{
    global $currency;
    $currency = getCurrency();
    $chartdata = array();
    $chartdata['cols'][] = array('label' => 'Day', 'type' => 'string');
    $chartdata['cols'][] = array('label' => 'Income', 'type' => 'number');
    $chartdata['cols'][] = array('label' => 'Expenditure/Refunds', 'type' => 'number');
    for ($i = 14; $i >= 0; $i--) {
        $date = mktime(0, 0, 0, date("m"), date("d") - $i, date("Y"));
        $data = get_query_vals("tblaccounts", "SUM(amountin/rate),SUM(amountout/rate)", "date LIKE '" . date("Y-m-d", $date) . "%'");
        if (!$data[0]) {
            $data[0] = 0;
        }
        if (!$data[1]) {
            $data[1] = 0;
        }
        $chartdata['rows'][] = array('c' => array(array('v' => date("dS", $date)), array('v' => (int) $data[0], 'f' => formatCurrency($data[0])), array('v' => (int) $data[1], 'f' => formatCurrency($data[1]))));
    }
    return $chartdata;
}
Ejemplo n.º 3
0
function widget_system_overview($vars)
{
    global $whmcs, $_ADMINLANG;
    $title = $_ADMINLANG['home']['sysoverview'];
    if ($whmcs->get_req_var('getsystemoverview')) {
        $activeclients = get_query_val("tblclients", "COUNT(id)", "status='Active'");
        $totalclients = get_query_val("tblclients", "COUNT(id)", "");
        $clientsactive = $activeclients == 0 || $totalclients == 0 ? '0' : round($activeclients / $totalclients * 100, 0);
        $activeservices = get_query_val("tblhosting", "COUNT(id)", "domainstatus='Active'");
        $totalservices = get_query_val("tblhosting", "COUNT(id)", "");
        $servicesactive = $activeservices == 0 || $totalservices == 0 ? '0' : round($activeservices / $totalservices * 100, 0);
        $unpaidinvoices = get_query_val("tblinvoices", "COUNT(id)", "status='Unpaid'");
        $overdueinvoices = get_query_val("tblinvoices", "COUNT(id)", "status='Unpaid' AND duedate<'" . date("Ymd") . "'");
        $overduestatus = $overdueinvoices == 0 || $unpaidinvoices == 0 ? '0' : round($overdueinvoices / $unpaidinvoices * 100, 0);
        echo '
<table width="100%">
<tr>
    <td width="150">Clients</td>
    <td>
    <div class="percentbar">
    <div class="active" style="width:' . $clientsactive . '%">' . $clientsactive . '% Active</div>
    </div>
    </td>
    <td class="totals">' . $totalclients . '</td>
</tr>
<tr>
    <td>Services</td>
    <td>
    <div class="percentbar">
    <div class="active" style="width:' . $servicesactive . '%">' . $servicesactive . '% Active</div>
    </div>
    </td>
    <td class="totals">' . $totalservices . '</td>
</tr>
<tr>
    <td>Unpaid Invoices</td>
    <td>
    <div class="percentbar">
    <div class="overdue" style="width:' . $overduestatus . '%">' . $overduestatus . '% Overdue</div>
    </div>
    </td>
    <td class="totals">' . $unpaidinvoices . '</td>
</tr>
</table>
';
        exit;
    }
    $adminusername = get_query_val("tbladmins", "username", array("id" => $vars['adminid']));
    $lastlogin = get_query_vals("tbladminlog", "lastvisit,ipaddress", array("adminusername" => $adminusername), "lastvisit", "DESC", "1,1");
    $lastlogindate = $lastlogin[0] ? fromMySQLDate($lastlogin[0], true) : '(None Recorded)';
    $lastloginip = $lastlogin[1] ? $lastlogin[1] : '-';
    $content = '
<style>
#systemoverviewstats {
    display: none;
}
#systemoverviewstats div.percentbar {
    width: 100%;
    height: 24px;
    border: 1px solid #ccc;
    background-color: #efefef;
}
#systemoverviewstats div.percentbar div.active {
    height: 24px;
    line-height: 24px;
    background-color: #84B429;
    color: #fff;
    font-weight: bold;
    text-align: center;
    overflow: hidden;
}
#systemoverviewstats div.percentbar div.overdue {
    height: 24px;
    line-height: 24px;
    background-color: #cc0000;
    color: #fff;
    font-weight: bold;
    text-align: center;
}
#systemoverviewstats td {
    text-align: center;
    font-weight: bold;
    height: 35px;
}
.lastlogin {
    margin-bottom:5px;
    padding:3px;
    text-align: center;
}
</style>

<div id="systemoverviewstats">' . $vars['loading'] . '</div>

<div class="lastlogin">' . $_ADMINLANG['home']['lastlogin'] . ': <strong>' . $lastlogindate . '</strong> ' . $_ADMINLANG['home']['lastloginip'] . ' <strong>' . $lastloginip . '</strong></div>

';
    $statusfilter = array();
    $result = select_query("tblticketstatuses", "title", array("showawaiting" => "1"));
    while ($data = mysql_fetch_array($result)) {
        $statusfilter[] = $data[0];
    }
    $result = full_query("SELECT COUNT(*) FROM tbltickets WHERE status IN (" . db_build_in_array($statusfilter) . ")");
    $data = mysql_fetch_array($result);
    $ticketsawaitingreply = $data[0];
    $result = full_query("SELECT COUNT(*) FROM tblcancelrequests INNER JOIN tblhosting ON tblhosting.id=tblcancelrequests.relid WHERE (tblhosting.domainstatus!='Cancelled' AND tblhosting.domainstatus!='Terminated')");
    $data = mysql_fetch_array($result);
    $cancellationrequests = $data[0];
    $result = full_query("SELECT COUNT(*) FROM tbltodolist WHERE status!='Completed' AND status!='Postponed' AND duedate<='" . date("Y-m-d") . "'");
    $data = mysql_fetch_array($result);
    $todoitemsdue = $data[0];
    $result = full_query("SELECT COUNT(*) FROM tblnetworkissues WHERE status!='Scheduled' AND status!='Resolved'");
    $data = mysql_fetch_array($result);
    $opennetworkissues = $data[0];
    $jquerycode = 'jQuery.post("index.php", { getsystemoverview: 1 },
    function(data){
        jQuery("#systemoverviewstats").html(data);
        jQuery("#systemoverviewstats").slideDown();
        jQuery("#sysoverviewbanner").html("<div style=\\"margin:0 0 -5px 0;padding: 10px;background-color: #FBEEEB;border: 1px dashed #cc0000;font-weight: bold;color: #cc0000;font-size:14px;text-align: center;-moz-border-radius: 10px;-webkit-border-radius: 10px;-o-border-radius: 10px;border-radius: 10px;\\">' . $_ADMINLANG['global']['attentionitems'] . ': &nbsp; <a href=\\"supporttickets.php\\">' . $ticketsawaitingreply . ' ' . $_ADMINLANG['stats']['ticketsawaitingreply'] . '</a> &nbsp;-&nbsp; <a href=\\"cancelrequests.php\\">' . $cancellationrequests . ' ' . $_ADMINLANG['stats']['pendingcancellations'] . '</a> &nbsp;-&nbsp; <a href=\\"todolist.php\\">' . $todoitemsdue . ' ' . $_ADMINLANG['stats']['todoitemsdue'] . '</a> &nbsp;-&nbsp; <a href=\\"networkissues.php\\">' . $opennetworkissues . ' ' . $_ADMINLANG['stats']['opennetworkissues'] . '</a></div>");
});';
    return array('title' => $title, 'content' => $content, 'jquerycode' => $jquerycode);
}
Ejemplo n.º 4
0
function getTLDPriceList($tld, $display = "", $renewpricing = "", $userid = "")
{
    global $currency;
    if ($renewpricing == "renew") {
        $renewpricing = true;
    }
    $currency_id = $currency['id'];
    $result = select_query("tbldomainpricing", "id", array("extension" => $tld));
    $data = mysql_fetch_array($result);
    $id = $data['id'];
    if (!$userid && isset($_SESSION['uid'])) {
        $userid = $_SESSION['uid'];
    }
    $clientgroupid = $userid ? get_query_val("tblclients", "groupid", array("id" => $userid)) : "0";
    $checkfields = array("msetupfee", "qsetupfee", "ssetupfee", "asetupfee", "bsetupfee", "monthly", "quarterly", "semiannually", "annually", "biennially");
    if (!$renewpricing || $renewpricing === "transfer") {
        $data = get_query_vals("tblpricing", "", array("type" => "domainregister", "currency" => $currency_id, "relid" => $id, "tsetupfee" => $clientgroupid));
        if (!$data) {
            $data = get_query_vals("tblpricing", "", array("type" => "domainregister", "currency" => $currency_id, "relid" => $id, "tsetupfee" => "0"));
        }
        foreach ($checkfields as $k => $v) {
            $register[$k + 1] = $data[$v];
        }
        $data = get_query_vals("tblpricing", "", array("type" => "domaintransfer", "currency" => $currency_id, "relid" => $id, "tsetupfee" => $clientgroupid));
        if (!$data) {
            $data = get_query_vals("tblpricing", "", array("type" => "domaintransfer", "currency" => $currency_id, "relid" => $id, "tsetupfee" => "0"));
        }
        foreach ($checkfields as $k => $v) {
            $transfer[$k + 1] = $data[$v];
        }
    }
    if (!$renewpricing || $renewpricing !== "transfer") {
        $data = get_query_vals("tblpricing", "", array("type" => "domainrenew", "currency" => $currency_id, "relid" => $id, "tsetupfee" => $clientgroupid));
        if (!$data) {
            $data = get_query_vals("tblpricing", "", array("type" => "domainrenew", "currency" => $currency_id, "relid" => $id, "tsetupfee" => "0"));
        }
        foreach ($checkfields as $k => $v) {
            $renew[$k + 1] = $data[$v];
        }
    }
    $tldpricing = array();
    $years = 1;
    while ($years <= 10) {
        if ($renewpricing === "transfer") {
            if (0 < $register[$years] && 0 <= $transfer[$years]) {
                if ($display) {
                    $transfer[$years] = formatCurrency($transfer[$years]);
                }
                $tldpricing[$years]['transfer'] = $transfer[$years];
            }
        } else {
            if ($renewpricing) {
                if (0 < $renew[$years]) {
                    if ($display) {
                        $renew[$years] = formatCurrency($renew[$years]);
                    }
                    $tldpricing[$years]['renew'] = $renew[$years];
                }
            } else {
                if (0 < $register[$years]) {
                    if ($display) {
                        $register[$years] = formatCurrency($register[$years]);
                    }
                    $tldpricing[$years]['register'] = $register[$years];
                    if (0 <= $transfer[$years]) {
                        if ($display) {
                            $transfer[$years] = formatCurrency($transfer[$years]);
                        }
                        $tldpricing[$years]['transfer'] = $transfer[$years];
                    }
                    if (0 < $renew[$years]) {
                        if ($display) {
                            $renew[$years] = formatCurrency($renew[$years]);
                        }
                        $tldpricing[$years]['renew'] = $renew[$years];
                    }
                }
            }
        }
        $years += 1;
    }
    return $tldpricing;
}
Ejemplo n.º 5
0
    }
}
if ($whmcs->get_req_var("success")) {
    infoBox($aInt->lang("global", "changesuccess"), $aInt->lang("global", "changesuccessdesc"));
}
$regdate = fromMySQLDate($regdate);
$nextduedate = fromMySQLDate($nextduedate);
$overidesuspenduntil = fromMySQLDate($overidesuspenduntil);
if ($disklimit == "0") {
    $disklimit = $aInt->lang("global", "unlimited");
}
if ($bwlimit == "0") {
    $bwlimit = $aInt->lang("global", "unlimited");
}
$currency = getCurrency($userid);
$data = get_query_vals("tblcancelrequests", "id,type,reason", array("relid" => $id), "id", "DESC");
$cancelid = $data['id'];
$canceltype = $data['type'];
$autoterminatereason = $data['reason'];
$autoterminateendcycle = false;
if ($canceltype == "End of Billing Period") {
    $autoterminateendcycle = $cancelid ? true : false;
}
if (!$server) {
    $server = get_query_val("tblservers", "id", array("type" => $module, "active" => "1"));
    if ($server) {
        update_query("tblhosting", array("server" => $server), array("id" => $id));
    }
}
$jscode = "function doDeleteAddon(id) {\nif (confirm(\"" . $aInt->lang("addons", "areyousuredelete", 1) . "\")) {\nwindow.location='" . $PHP_SELF . "?userid=" . $userid . "&id=" . $id . "&action=deladdon&aid='+id+'" . generate_token("link") . "';\n}}\nfunction runModuleCommand(cmd,custom) {\n    \$(\"#mod\"+cmd).dialog(\"close\");\n\n    \$(\"#modcmdbtns\").css(\"filter\",\"alpha(opacity=20)\");\n    \$(\"#modcmdbtns\").css(\"-moz-opacity\",\"0.2\");\n    \$(\"#modcmdbtns\").css(\"-khtml-opacity\",\"0.2\");\n    \$(\"#modcmdbtns\").css(\"opacity\",\"0.2\");\n    var position = \$(\"#modcmdbtns\").position();\n\n    \$(\"#modcmdworking\").css(\"position\",\"absolute\");\n    \$(\"#modcmdworking\").css(\"top\",position.top);\n    \$(\"#modcmdworking\").css(\"left\",position.left);\n    \$(\"#modcmdworking\").css(\"padding\",\"9px 50px 0\");\n    \$(\"#modcmdworking\").fadeIn();\n\n    var reqstr = \"userid=" . $userid . "&id=" . $id . "&modop=\"+cmd+\"" . generate_token("link") . "\";\n    if (custom) reqstr += \"&ac=\"+custom;\n    else if (cmd==\"suspend\") reqstr += \"&suspreason=\"+encodeURIComponent(\$(\"#suspreason\").val())+\"&suspemail=\"+\$(\"#suspemail\").is(\":checked\");\n\n    \$.post(\"clientsservices.php\", reqstr,\n    function(data){\n        if (data.substr(0,9)==\"redirect|\") {\n            window.location = data.substr(9);\n        } else {\n            \$(\"#servicecontent\").html(data);\n        }\n    });\n\n}\n";
$aInt->jscode = $jscode;
Ejemplo n.º 6
0
    }
    if ($supportemails) {
        $supportemails = 1;
    }
    if ($affiliateemails) {
        $affiliateemails = 1;
    }
    if ($contactid == "addnew") {
        if ($password && $password != $aInt->lang("fields", "password")) {
            $array['password'] = generateClientPW($password);
        }
        $contactid = addContact($userid, $firstname, $lastname, $companyname, $email, $address1, $address2, $city, $state, $postcode, $country, $phonenumber, $password, $permissions, $generalemails, $productemails, $domainemails, $invoiceemails, $supportemails);
        logActivity("Added Contact - User ID: " . $userid . " - Contact ID: " . $contactid);
    } else {
        logActivity("Contact Modified - User ID: " . $userid . " - Contact ID: " . $contactid);
        $oldcontactdata = get_query_vals("tblcontacts", "", array("userid" => $_SESSION['uid'], "id" => $id));
        if ($permissions) {
            $permissions = implode(",", $permissions);
        }
        $table = "tblcontacts";
        $array = array("firstname" => $firstname, "lastname" => $lastname, "companyname" => $companyname, "email" => $email, "address1" => $address1, "address2" => $address2, "city" => $city, "state" => $state, "postcode" => $postcode, "country" => $country, "phonenumber" => $phonenumber, "subaccount" => $subaccount, "permissions" => $permissions, "domainemails" => $domainemails, "generalemails" => $generalemails, "invoiceemails" => $invoiceemails, "productemails" => $productemails, "supportemails" => $supportemails, "affiliateemails" => $affiliateemails);
        if ($password && $password != $aInt->lang("fields", "entertochange")) {
            $array['password'] = generateClientPW($password);
        }
        $where = array("id" => $contactid);
        update_query($table, $array, $where);
        run_hook("ContactEdit", array_merge(array("userid" => $userid, "contactid" => $contactid, "olddata" => $oldcontactdata), $array));
    }
    redir("userid=" . $userid . "&contactid=" . $contactid);
    exit;
}
Ejemplo n.º 7
0
    echo "<form method=\"post\" id=\"duplicatetldform\" action=\"" . $_SERVER['PHP_SELF'] . "\">" . generate_token("form") . "<table><tr><td>Existing TLD:</td><td><input type=\"hidden\" name=\"action\" value=\"duplicatetld\" /><select name=\"tld\">" . $tldoptions . "</select></td></tr><tr><td>New TLD:</td><td><input type=\"text\" name=\"newtld\" size=\"6\" /></td></tr></table></form>";
    exit;
}
if ($action == "duplicatetld") {
    check_token("WHMCS.admin.default");
    $newtld = trim($newtld);
    if (substr($newtld, 0, 1) != ".") {
        $newtld = "." . $newtld;
    }
    if (!$tld || !$newtld) {
        redir("errormessage=" . $aInt->lang("domains", "sourcenewtldempty"));
    }
    if (get_query_val("tbldomainpricing", "id", array("extension" => $newtld))) {
        redir("errormessage=" . str_replace("%s", $newtld, $aInt->lang("domains", "extensionalreadyexist")));
    }
    $tlddata = get_query_vals("tbldomainpricing", "id,dnsmanagement, emailforwarding, idprotection, eppcode, autoreg", array("extension" => $tld));
    $relid = $tlddata['id'];
    $newtlddata = array();
    $newtlddata['extension'] = $newtld;
    $newtlddata['dnsmanagement'] = $tlddata['dnsmanagement'];
    $newtlddata['emailforwarding'] = $tlddata['emailforwarding'];
    $newtlddata['idprotection'] = $tlddata['idprotection'];
    $newtlddata['eppcode'] = $tlddata['eppcode'];
    $newtlddata['autoreg'] = $tlddata['autoreg'];
    $newtlddata['order'] = get_query_val("tbldomainpricing", "MAX(`order`)", "") + 1;
    $newrelid = insert_query("tbldomainpricing", $newtlddata);
    $regpricingresult = select_query("tblpricing", "*", array("relid" => $relid, "type" => "domainregister"));
    while ($regpricingdata = mysql_fetch_assoc($regpricingresult)) {
        unset($regpricingdata['id']);
        $regpricingdata['relid'] = $newrelid;
        insert_query("tblpricing", $regpricingdata);
Ejemplo n.º 8
0
 **/
require "../init.php";
error_reporting(0);
if (!function_exists("getimagesize")) {
    exit("You need to recompile with the GD library included in PHP for this feature to be able to function");
}
$filename = "";
if ($tid) {
    $data = get_query_vals("tbltickets", "userid,attachment", array("id" => $tid));
    $userid = $data[0];
    $attachments = $data[1];
    $attachments = explode("|", $attachments);
    $filename = $attachments_dir . $attachments[$i];
}
if ($rid) {
    $data = get_query_vals("tblticketreplies", "tid,attachment", array("id" => $rid));
    $ticketid = $data[0];
    $attachments = $data[1];
    $attachments = explode("|", $attachments);
    $filename = $attachments_dir . $attachments[$i];
    $userid = get_query_val("tbltickets", "userid", array("id" => $ticketid));
}
if ($_SESSION['uid'] != $userid && !$_SESSION['adminid']) {
    $filename = ROOTDIR . "/images/nothumbnail.gif";
}
if (!$filename) {
    $filename = ROOTDIR . "/images/nothumbnail.gif";
}
$size = getimagesize($filename);
switch ($size['mime']) {
    case "image/jpeg":
Ejemplo n.º 9
0
 *
 * @ WHMCS FULL DECODED & NULLED
 *
 * @ Version  : 5.2.15
 * @ Author   : MTIMER
 * @ Release on : 2013-12-24
 * @ Website  : http://www.mtimer.cn
 *
 **/
if (!defined("WHMCS")) {
    exit("This file cannot be accessed directly");
}
if (!function_exists("applyCredit")) {
    require ROOTDIR . "/includes/invoicefunctions.php";
}
$data = get_query_vals("tblinvoices", "id,userid,credit,total,status", array("id" => $invoiceid));
$invoiceid = $data['id'];
if (!$invoiceid) {
    $apiresults = array("result" => "error", "message" => "Invoice ID Not Found");
    return null;
}
$userid = $data['userid'];
$credit = $data['credit'];
$total = $data['total'];
$status = $data['status'];
$amountpaid = get_query_val("tblaccounts", "SUM(amountin)-SUM(amountout)", array("invoiceid" => $invoiceid));
$balance = round($total - $amountpaid, 2);
$amount = $amount == "full" ? $balance : round($amount, 2);
$totalcredit = get_query_val("tblclients", "credit", array("id" => $userid));
if ($status != "Unpaid") {
    $apiresults = array("result" => "error", "message" => "Invoice Not in Unpaid Status");
Ejemplo n.º 10
0
 echo "\"><input type=\"text\" name=\"removecredit\" value=\"0.00\" size=\"8\"";
 if ($credit == "0.00") {
     echo " disabled";
 }
 echo "> <input type=\"submit\" value=\"";
 echo $aInt->lang("global", "go");
 echo "\" class=\"btn";
 if ($credit == "0.00") {
     echo " disabled";
 }
 echo "\"";
 if ($credit == "0.00") {
     echo " disabled";
 }
 echo "></form></td></tr>\n</table>\n</form>\n\n  </div>\n</div>\n<div id=\"tab4box\" class=\"tabbox\">\n  <div id=\"tab_content\">\n";
 $numtrans = get_query_vals("tblaccounts", "COUNT(id)", array("invoiceid" => $id, "amountin" => array("sqltype" => ">", "value" => "0")), "date` ASC,`id", "ASC");
 $notransactions = $numtrans[0] == "0" ? true : false;
 echo "<form method=\"post\" action=\"";
 echo $PHP_SELF;
 echo "\">\n<input type=\"hidden\" name=\"action\" value=\"edit\">\n<input type=\"hidden\" name=\"id\" value=\"";
 echo $id;
 echo "\">\n<input type=\"hidden\" name=\"sub\" value=\"refund\">\n\n<table class=\"form\" width=\"100%\" border=\"0\" cellspacing=\"2\" cellpadding=\"3\">\n<tr><td width=\"20%\" class=\"fieldlabel\">";
 echo $aInt->lang("invoices", "transactions");
 echo "</td><td class=\"fieldarea\">";
 echo "<s";
 echo "elect name=\"transid\">";
 $result = select_query("tblaccounts", "", array("invoiceid" => $id, "amountin" => array("sqltype" => ">", "value" => "0")), "date` ASC,`id", "ASC");
 while ($data = mysql_fetch_array($result)) {
     $trans_id = $data['id'];
     $trans_date = $data['date'];
     $trans_amountin = $data['amountin'];
Ejemplo n.º 11
0
 private function validate_client_auth()
 {
     $haship = $this->get_config("DisableSessionIPCheck") ? "" : $this->get_user_ip();
     if (defined("CLIENTAREA") && !isset($_SESSION['uid']) && isset($_COOKIE['WHMCSUser'])) {
         $cookiedata = explode(":", $_COOKIE['WHMCSUser']);
         if (is_numeric($cookiedata[0])) {
             $data = get_query_vals("tblclients", "id,password", array("id" => (int) $cookiedata[0]));
             $loginhash = sha1($data['id'] . $data['password'] . $haship . substr(sha1($this->get_hash()), 0, 20));
             $cookiehashcompare = sha1($loginhash . $this->get_hash());
             if ($cookiedata[1] == $cookiehashcompare) {
                 $_SESSION['uid'] = $data['id'];
                 $_SESSION['upw'] = $loginhash;
                 $_SESSION['tkval'] = substr(sha1(rand(1000, 9999) . time()), 0, 12);
             }
         }
     }
     if (isset($_SESSION['uid'])) {
         if (!is_numeric($_SESSION['uid'])) {
             session_unset();
             session_destroy();
         } else {
             if (!isset($_SESSION['adminid'])) {
                 $result = select_query("tblclients", "password", array("id" => $_SESSION['uid']));
                 $data = mysql_fetch_array($result);
                 $cid = "";
                 if (isset($_SESSION['cid']) && is_numeric($_SESSION['cid'])) {
                     $cid = $_SESSION['cid'];
                     $result = select_query("tblcontacts", "password", array("id" => $_SESSION['cid']));
                     $data = mysql_fetch_array($result);
                 }
                 if ($_SESSION['upw'] != sha1($_SESSION['uid'] . $cid . $data['password'] . $haship . substr(sha1($this->get_hash()), 0, 20))) {
                     session_unset();
                     session_destroy();
                 }
             }
         }
         if (isset($_SESSION['currency'])) {
             unset($_SESSION['currency']);
         }
     }
 }
Ejemplo n.º 12
0
function resellerclubssl_AdminServicesTabFields($params)
{
    $data = get_query_vals("tblsslorders", "", array("serviceid" => $params['serviceid']));
    $id = $data['id'];
    $orderid = $data['orderid'];
    $serviceid = $data['serviceid'];
    $remoteid = $data['remoteid'];
    $module = $data['module'];
    $certtype = $data['certtype'];
    $domain = $data['domain'];
    $provisiondate = $data['provisiondate'];
    $completiondate = $data['completiondate'];
    $expirydate = $data['expirydate'];
    $status = $data['status'];
    if (!$id) {
        $remoteid = "-";
        $status = "Not Yet Provisioned";
    }
    $fieldsarray = array("ResellerClub Order ID" => $remoteid, "SSL Configuration Status" => $status);
    return $fieldsarray;
}
Ejemplo n.º 13
0
$templatevars['licenseinfo'] = array("registeredname" => $licensing->getKeyData("registeredname"), "productname" => $licensing->getKeyData("productname"), "expires" => $licensing->getExpiryDate(), "currentversion" => $CONFIG['Version'], "latestversion" => $licensing->getKeyData("latestversion"));
if ($licensing->getKeyData("productname") == "15 Day Free Trial") {
    $templatevars['freetrial'] = true;
}
$templatevars['infobox'] = $infobox;
$query = "SELECT COUNT(*) FROM tblpaymentgateways WHERE setting='type' AND value='CC'";
$result = full_query($query);
$data = mysql_fetch_array($result);
if ($data[0]) {
    $templatevars['showattemptccbutton'] = true;
}
if ($CONFIG['MaintenanceMode']) {
    $templatevars['maintenancemode'] = true;
}
$jquerycode = "\$(\".homecolumn\").sortable({\n\thandle : '.widget-header',\n    connectWith: ['.homecolumn'],\n    stop: function() { saveHomeWidgets(); }\n});\n\$(\".homewidget\").find(\".widget-header\").prepend(\"<span class='ui-icon ui-icon-minusthick'></span>\");\nresHomeWidgets();\n\$(\".widget-header .ui-icon\").click(function() {\n    \$(this).toggleClass(\"ui-icon-minusthick\").toggleClass(\"ui-icon-plusthick\");\n\t\$(this).parents(\".homewidget:first\").find(\".widget-content\").toggle();\n    saveHomeWidgets();\n});\n";
$data = get_query_vals("tbladmins", "tbladmins.homewidgets,tbladminroles.widgets", array("tbladmins.id" => $_SESSION['adminid']), "", "", "", "tbladminroles ON tbladminroles.id=tbladmins.roleid");
$homewidgets = $data['homewidgets'];
$allowedwidgets = $data['widgets'];
if (!$homewidgets) {
    $homewidgets = "getting_started:true,system_overview:true,income_overview:true,client_activity:true,admin_activity:true,activity_log:true|my_notes:true,orders_overview:true,sysinfo:true,whmcs_news:true,network_status:true,todo_list:true,income_forecast:true,open_invoices:true";
}
$homewidgets = explode("|", $homewidgets);
$homewidgetscol1 = explode(",", $homewidgets[0]);
foreach ($homewidgetscol1 as $k => $v) {
    $v = explode(":", $v);
    if (!$v[0]) {
        unset($homewidgetscol1[$k]);
        continue;
    }
}
$homewidgetscol1 = implode(",", $homewidgetscol1);
Ejemplo n.º 14
0
function paypal_addon_output($vars)
{
    global $aInt;
    $modulelink = $vars['modulelink'];
    $url = "https://api-3t.paypal.com/nvp";
    $startdate = trim($_REQUEST['startdate']);
    $enddate = trim($_REQUEST['enddate']);
    $transid = trim($_REQUEST['transid']);
    $email = trim($_REQUEST['email']);
    $receiptid = trim($_REQUEST['receiptid']);
    $search = trim($_REQUEST['search']);
    if (!$startdate) {
        $startdate = fromMySQLDate(date("Y-m-d", mktime(0, 0, 0, date("m") - 1, date("d") + 1, date("Y"))));
    }
    if (!$enddate) {
        $enddate = fromMySQLDate(date("Y-m-d", mktime(0, 0, 0, date("m"), date("d") + 1, date("Y"))));
    }
    echo "<form method=\"post\" action=\"" . $modulelink . "\">\n<input type=\"hidden\" name=\"search\" value=\"true\" />\n<table class=\"form\" width=\"100%\" border=\"0\" cellspacing=\"2\" cellpadding=\"3\">\n<tr><td width=\"20%\" class=\"fieldlabel\">Transaction ID</td><td class=\"fieldarea\"><input type=\"text\" name=\"transid\" size=\"30\" value=\"" . $transid . "\" /></td></tr>\n<tr><td width=\"20%\" class=\"fieldlabel\">Start Date</td><td class=\"fieldarea\"><input type=\"text\" name=\"startdate\" class=\"datepick\" size=\"30\" value=\"" . $startdate . "\" /></td></tr>\n<tr><td width=\"20%\" class=\"fieldlabel\">End Date</td><td class=\"fieldarea\"><input type=\"text\" name=\"enddate\" class=\"datepick\" size=\"30\" value=\"" . $enddate . "\" /></td></tr>\n<tr><td width=\"20%\" class=\"fieldlabel\">Email</td><td class=\"fieldarea\"><input type=\"text\" name=\"email\" size=\"30\" value=\"" . $email . "\" /></td></tr>\n<tr><td width=\"20%\" class=\"fieldlabel\">Receipt ID</td><td class=\"fieldarea\"><input type=\"text\" name=\"receiptid\" size=\"30\" value=\"" . $receiptid . "\" /></td></tr>\n</table>\n<p align=\"center\"><input type=\"submit\" value=\"Search\" /></p>\n</form>";
    if (!$search) {
        return false;
    }
    if ($transid) {
        $postfields = $resultsarray = array();
        $postfields['USER'] = $vars['username'];
        $postfields['PWD'] = $vars['password'];
        $postfields['SIGNATURE'] = $vars['signature'];
        $postfields['METHOD'] = "GetTransactionDetails";
        $postfields['TRANSACTIONID'] = $transid;
        $postfields['VERSION'] = "3.0";
        $result = curlCall($url, $postfields);
        $resultsarray2 = explode("&", $result);
        foreach ($resultsarray2 as $line) {
            $line = explode("=", $line);
            $resultsarray[$line[0]] = urldecode($line[1]);
        }
        $errormessage = $resultsarray['L_LONGMESSAGE0'];
        $payerstatus = $resultsarray['PAYERSTATUS'];
        $countrycode = $resultsarray['COUNTRYCODE'];
        $invoiceid = $resultsarray['INVNUM'];
        $timestamp = $resultsarray['TIMESTAMP'];
        $firstname = $resultsarray['FIRSTNAME'];
        $lastname = $resultsarray['LASTNAME'];
        $email = $resultsarray['EMAIL'];
        $transactionid = $resultsarray['TRANSACTIONID'];
        $transactiontype = $resultsarray['TRANSACTIONTYPE'];
        $paymenttype = $resultsarray['PAYMENTTYPE'];
        $ordertime = $resultsarray['ORDERTIME'];
        $amount = $resultsarray['AMT'];
        $fee = $resultsarray['FEEAMT'];
        $paymentstatus = $resultsarray['PAYMENTSTATUS'];
        $description = $resultsarray['L_NAME0'];
        $currencycode = $resultsarray['L_CURRENCYCODE0'];
        $exchrate = $resultsarray['EXCHANGERATE'];
        $settleamt = $resultsarray['SETTLEAMT'];
        if ($errormessage) {
            echo "<p><b>PayPal API Error Message</b></p><p>" . $errormessage . "</p>";
            return null;
        }
        echo "<p><b>PayPal Transaction Details</b></p>\n\n<table class=\"form\" width=\"100%\" border=\"0\" cellspacing=\"2\" cellpadding=\"3\">\n<tr><td width=\"20%\" class=\"fieldlabel\">Transaction ID</td><td class=\"fieldarea\">" . $transactionid . "</td></tr>\n<tr><td class=\"fieldlabel\">Date/Time</td><td class=\"fieldarea\">" . fromMySQLDate($ordertime, true) . "</td></tr>\n<tr><td class=\"fieldlabel\">Transaction Type</td><td class=\"fieldarea\">" . $transactiontype . "</td></tr>\n<tr><td class=\"fieldlabel\">Payment Type</td><td class=\"fieldarea\">" . $paymenttype . "</td></tr>\n<tr><td class=\"fieldlabel\">Name</td><td class=\"fieldarea\">" . $firstname . " " . $lastname . "</td></tr>\n<tr><td class=\"fieldlabel\">Email</td><td class=\"fieldarea\">" . $email . "</td></tr>\n<tr><td class=\"fieldlabel\">Description</td><td class=\"fieldarea\">" . $description . "</td></tr>\n<tr><td class=\"fieldlabel\">Amount</td><td class=\"fieldarea\">" . $amount . "</td></tr>\n<tr><td class=\"fieldlabel\">PayPal Fee</td><td class=\"fieldarea\">" . $fee . "</td></tr>\n<tr><td class=\"fieldlabel\">Currency</td><td class=\"fieldarea\">" . $currencycode . "</td></tr>";
        if ($exchrate) {
            echo "\n<tr><td class=\"fieldlabel\">Exchange Rate</td><td class=\"fieldarea\">" . $exchrate . " (" . $settleamt . ")</td></tr>";
        }
        echo "\n<tr><td class=\"fieldlabel\">Payer Status</td><td class=\"fieldarea\">" . ucfirst($payerstatus) . "</td></tr>\n<tr><td class=\"fieldlabel\">PayPal Status</td><td class=\"fieldarea\">" . $paymentstatus . "</td></tr>\n</table>";
        if (!$invoiceid) {
            $invoiceid = explode("#", $description);
            $invoiceid = (int) $invoiceid[1];
        }
        $result = select_query("tblinvoices", "tblinvoices.id,tblinvoices.status,tblinvoices.userid,tblclients.firstname,tblclients.lastname", array("tblinvoices.id" => $invoiceid), "", "", "", "tblclients ON tblclients.id=tblinvoices.userid");
        $data = mysql_fetch_array($result);
        $whmcs_invoiceid = $data['id'];
        $whmcs_status = $data['status'];
        $whmcs_userid = $data['userid'];
        $whmcs_firstname = $data['firstname'];
        $whmcs_lastname = $data['lastname'];
        if (!$whmcs_invoiceid) {
            $whmcs_status = "No Matching Invoice Found";
        }
        echo "<p><b>WHMCS Invoice Lookup</b></p>\n\n<table class=\"form\" width=\"100%\" border=\"0\" cellspacing=\"2\" cellpadding=\"3\">\n<tr><td width=\"20%\" class=\"fieldlabel\">Invoice ID</td><td class=\"fieldarea\"><a href=\"invoices.php?action=edit&id=" . $whmcs_invoiceid . "\">" . $whmcs_invoiceid . "</a></td></tr>\n<tr><td class=\"fieldlabel\">Invoice Status</td><td class=\"fieldarea\">" . $whmcs_status . "</td></tr>\n<tr><td class=\"fieldlabel\">Client Name</td><td class=\"fieldarea\"><a href=\"clientssummary.php?userid=" . $whmcs_userid . "\">" . $whmcs_firstname . " " . $whmcs_lastname . "</a></td></tr>\n</table>";
        $result = select_query("tblaccounts", "", array("transid" => $transactionid));
        $data = mysql_fetch_array($result);
        $whmcstransid = $data['id'];
        $date = $data['date'];
        $invoiceid = $data['invoiceid'];
        $amountin = $data['amountin'];
        $fees = $data['fees'];
        $result = select_query("tblinvoices", "", array("id" => $invoiceid));
        $data = mysql_fetch_array($result);
        $status = $data['status'];
        if ($invoiceid) {
            $date = fromMySQLDate($date);
            $invoiceid = "<a href=\"invoices.php?action=edit&id=" . $invoiceid . "\">" . $invoiceid . "</a>";
        } else {
            $invoiceid = "No Matching Transaction Found";
        }
        echo "<p><b>WHMCS Transaction Lookup</b></p>\n\n<table class=\"form\" width=\"100%\" border=\"0\" cellspacing=\"2\" cellpadding=\"3\">\n<tr><td width=\"20%\" class=\"fieldlabel\">Date</td><td class=\"fieldarea\">" . $date . "</td></tr>\n<tr><td class=\"fieldlabel\">Invoice ID</td><td class=\"fieldarea\">" . $invoiceid . "</td></tr>\n<tr><td class=\"fieldlabel\">Amount</td><td class=\"fieldarea\">" . $amountin . "</td></tr>\n<tr><td class=\"fieldlabel\">Invoice Status</td><td class=\"fieldarea\">" . $status . "</td></tr>\n</table>";
        return null;
    }
    if ($startdate) {
        $startdate = date("c", strtotime(toMySQLDate($startdate))) . "<br>";
        $enddate = date("c", strtotime(toMySQLDate($enddate))) . "<br>";
        $postfields = $resultsarray = array();
        $postfields['USER'] = $vars['username'];
        $postfields['PWD'] = $vars['password'];
        $postfields['SIGNATURE'] = $vars['signature'];
        $postfields['METHOD'] = "TransactionSearch";
        if ($startdate) {
            $postfields['STARTDATE'] = $startdate;
        }
        if ($enddate) {
            $postfields['ENDDATE'] = $enddate;
        }
        if ($email) {
            $postfields['EMAIL'] = $email;
        }
        if ($receiptid) {
            $postfields['RECEIPTID'] = $receiptid;
        }
        $postfields['VERSION'] = "51.0";
        $result = curlCall($url, $postfields);
        $resultsarray2 = explode("&", $result);
        foreach ($resultsarray2 as $line) {
            $line = explode("=", $line);
            $resultsarray[$line[0]] = urldecode($line[1]);
        }
        if (!empty($resultsarray['L_ERRORCODE0']) && $resultsarray['L_ERRORCODE0'] != "11002") {
            echo "<p><b>PayPal API Error Message</b></p><p>" . $resultsarray['L_SEVERITYCODE0'] . " Code: " . $resultsarray['L_ERRORCODE0'] . " - " . $resultsarray['L_SHORTMESSAGE0'] . " - " . $resultsarray['L_LONGMESSAGE0'] . "</p>";
            return null;
        }
        if ($resultsarray['L_ERRORCODE0'] == "11002") {
            global $infobox;
            infoBox("Search Results Truncated", "There were more than 100 matching transactions for the selected criteria. Please make your search parameters more specific to see all results");
            echo $infobox;
        }
        $aInt->sortableTableInit("nopagination");
        $i = 0;
        while ($i < 100) {
            if ($resultsarray["L_TYPE" . $i] == "Payment" && !empty($resultsarray["L_EMAIL" . $i])) {
                $data = get_query_vals("tblaccounts", "tblclients.id AS userid, tblclients.firstname,tblclients.lastname,tblclients.companyname,tblaccounts.invoiceid,tblinvoices.total,tblinvoices.status", array("transid" => $resultsarray["L_TRANSACTIONID" . $i]), "", "", "", " tblclients ON tblclients.id = tblaccounts.userid INNER JOIN tblinvoices ON tblinvoices.id = tblaccounts.invoiceid");
                $tabledata[] = $testarray = array("clientname" => $data['invoiceid'] ? $data['companyname'] ? "<a href=\"clientssummary.php?userid=" . $data['userid'] . "\">" . $data['firstname'] . " " . $data['lastname'] . " (" . $data['companyname'] . ")</a>" : "<a href=\"clientssummary.php?userid=" . $data['userid'] . "\">" . $data['firstname'] . " " . $data['lastname'] . "</a>" : "Trans ID Not Found in WHMCS", "transid" => "<a href=\"addonmodules.php?module=paypal_addon&search=1&transid=" . $resultsarray["L_TRANSACTIONID" . $i] . "\">" . $resultsarray["L_TRANSACTIONID" . $i] . "<a/>", "datetime" => fromMySQLDate($resultsarray["L_TIMESTAMP" . $i], true), "name" => $resultsarray["L_NAME" . $i], "email" => $resultsarray["L_EMAIL" . $i], "amt" => $resultsarray["L_NETAMT" . $i], "fee" => $resultsarray["L_FEEAMT" . $i], "curcode" => $resultsarray["L_CURRENCYCODE" . $i], "status" => $resultsarray["L_STATUS" . $i], "invoiceid" => $data['invoiceid'] ? "<a href=\"invoices.php?action=edit&id=" . $data['invoiceid'] . "\">" . $data['invoiceid'] . "</a>" : "-", "invoiceamt" => $data['invoiceid'] ? $data['total'] : "-", "invoicestatus" => $data['invoiceid'] ? $data['status'] : "-");
            }
            ++$i;
        }
        echo $aInt->sortableTable(array("Client Name", "Transaction ID", "Date/Time", " Payer Name", "Payer Email", "Amount", "Fee", "Currency Code", "Transaction Status", "Invoice ID", "Invoice Amount", "Invoice Status"), $tabledata);
        return null;
    }
    global $infobox;
    infoBox("Start Date Required", "You must enter a start and end date to search between");
    echo $infobox;
}
Ejemplo n.º 15
0
 * @ WHMCS FULL DECODED & NULLED
 *
 * @ Version  : 5.2.15
 * @ Author   : MTIMER
 * @ Release on : 2013-12-24
 * @ Website  : http://www.mtimer.cn
 *
 **/
define("CLIENTAREA", true);
require "init.php";
$pagetitle = $_LANG['bannedtitle'];
$breadcrumbnav = "<a href=\"index.php\">" . $_LANG['globalsystemname'] . "</a> > <a href=\"banned.php\">" . $_LANG['bannedtitle'] . "</a>";
$pageicon = "";
initialiseClientArea($pagetitle, $pageicon, $breadcrumbnav);
$remote_ip = $whmcs->get_user_ip();
$ip = explode(".", $remote_ip);
$ip = db_escape_numarray($ip);
$remote_ip1 = $ip[0] . "." . $ip[1] . "." . $ip[2] . ".*";
$remote_ip2 = $ip[0] . "." . $ip[1] . ".*.*";
$data = get_query_vals("tblbannedips", "", "ip='" . db_escape_string($remote_ip) . "' OR ip='" . db_escape_string($remote_ip1) . "' OR ip='" . db_escape_string($remote_ip2) . "'", "id", "DESC");
$id = $data['id'];
$reason = $data['reason'];
$expires = fromMySQLDate($data['expires'], true, true);
if (!$id) {
    redir("", "index.php");
}
$smartyvalues['ip'] = htmlspecialchars($remote_ip);
$smartyvalues['reason'] = $reason;
$smartyvalues['expires'] = $expires;
$templatefile = "banned";
outputClientArea($templatefile);
Ejemplo n.º 16
0
 public function setFlagTo($adminid)
 {
     $adminid = (int) $adminid;
     $validadminids = $this->getFlaggableStaff();
     if ($adminid != 0 && !array_key_exists($adminid, $validadminids)) {
         return false;
     }
     if ($adminid == $this->getData("flag")) {
         return false;
     }
     if (0 < $adminid) {
         $data = get_query_vals("tbladmins", "id,firstname,lastname,username", array("id" => $adminid));
         if (!$data['id']) {
             return false;
         }
         $adminname = trim($data['firstname'] . " " . $data['lastname']);
         if (!$adminname) {
             $adminname = $data['username'];
         }
     } else {
         if ($adminid < 0) {
             $adminid = 0;
         }
     }
     if (!count($this->data)) {
         $this->getData();
     }
     update_query("tbltickets", array("flag" => $adminid), array("id" => $this->getData("id")));
     if (0 < $adminid) {
         $this->log("Assigned to Staff Member " . $adminname);
         if (WHMCS_Session::get("adminid") && $adminid != WHMCS_Session::get("adminid")) {
             $this->sendAdminEmail("Support Ticket Flagged", $adminid);
         }
     } else {
         $this->log("Staff Assignment Removed");
     }
     run_hook("TicketFlagged", array("ticketid" => $this->getData("id"), "adminid" => $adminid, "adminname" => $adminname));
     return true;
 }
Ejemplo n.º 17
0
     $ticketnotifications = $data['ticketnotifications'];
     $supportdepts = explode(",", $supportdepts);
     $ticketnotify = explode(",", $ticketnotifications);
     if (!$validate->hasErrors()) {
         $roleid = $data['roleid'];
         $firstname = $data['firstname'];
         $lastname = $data['lastname'];
         $email = $data['email'];
         $username = $data['username'];
         $signature = $data['signature'];
         $notes = $data['notes'];
         $template = $data['template'];
         $language = $data['language'];
         $disabled = $data['disabled'];
     }
     $numrows = get_query_vals("tbladmins", "COUNT(id)", array("roleid" => "1"));
     $onlyadmin = $numrows == "1" && $roleid == "1" ? true : false;
     $managetitle = $aInt->lang("administrators", "editadmin");
 } else {
     $supportdepts = $ticketnotify = array();
     $managetitle = $aInt->lang("administrators", "addadmin");
 }
 $language = $whmcs->validateLanguage($language, true);
 echo "<p><b>" . $managetitle . "</b></p>";
 if ($validate->hasErrors()) {
     infoBox($aInt->lang("global", "validationerror"), $validate->getHTMLErrorOutput(), "error");
     echo $infobox;
 }
 echo "\n<form method=\"post\" action=\"";
 echo $PHP_SELF;
 echo "?action=save&id=";
Ejemplo n.º 18
0
function vpsnet_GetCredentials()
{
    return get_query_vals("tblservers", "id,username,accesshash", array("type" => "vpsnet"));
}
Ejemplo n.º 19
0
 $smarty->assign("replies", $replies);
 $smarty->assign("ascreplies", $ascreplies);
 krsort($ascreplies);
 $smarty->assign("descreplies", $ascreplies);
 $ratings = array();
 $counter = 1;
 while ($counter <= 5) {
     $ratings[] = $counter;
     ++$counter;
 }
 $smarty->assign("ratings", $ratings);
 if ($_SESSION['uid']) {
     $clientname = $clientsdetails['firstname'] . " " . $clientsdetails['lastname'];
     $clientemail = $clientsdetails['email'];
     if ($_SESSION['cid']) {
         $contactdata = get_query_vals("tblcontacts", "firstname,lastname,email", array("id" => $_SESSION['cid'], "userid" => $_SESSION['uid']));
         $clientname = $contactdata['firstname'] . " " . $contactdata['lastname'];
         $clientemail = $contactdata['email'];
     }
 }
 if (!$replyname) {
     $replyname = $clientname;
 }
 if (!$replyemail) {
     $replyemail = $clientemail;
 }
 $smarty->assign("errormessage", $errormessage);
 $smarty->assign("clientname", $clientname);
 $smarty->assign("email", $clientemail);
 $smarty->assign("replyname", $replyname);
 $smarty->assign("replyemail", $replyemail);
Ejemplo n.º 20
0
    $showcancelled = $showcancelled ? "<img src=\"images/icons/tick.png\">" : "<img src=\"images/icons/disabled.png\">";
    if (4 < $statusid) {
        $delete = "<a href=\"#\" onClick=\"doDelete('" . $statusid . "');return false\"><img src=\"images/delete.gif\" width=\"16\" height=\"16\" border=\"0\" alt=\"" . $aInt->lang("global", "delete") . "\"></a>";
    } else {
        $delete = "";
    }
    $tabledata[] = array("<span style=\"font-weight:bold;color:" . $color . "\">" . $title . "</span>", $showpending, $showactive, $showcancelled, $sortorder, "<a href=\"" . $_SERVER['PHP_SELF'] . "?action=edit&id=" . $statusid . "\"><img src=\"images/edit.gif\" width=\"16\" height=\"16\" border=\"0\" alt=\"" . $aInt->lang("global", "edit") . "\"></a>", $delete);
}
echo $aInt->sortableTable(array($aInt->lang("fields", "title"), $aInt->lang("orderstatusconfig", "includeinpending"), $aInt->lang("orderstatusconfig", "includeinactive"), $aInt->lang("orderstatusconfig", "includeincancelled"), $aInt->lang("products", "sortorder"), "", ""), $tabledata);
echo "\n";
echo "<s";
echo "cript type=\"text/javascript\" src=\"../includes/jscript/jquery.miniColors.js\"></script>\n<link rel=\"stylesheet\" type=\"text/css\" href=\"../includes/jscript/css/jquery.miniColors.css\" />\n";
$jquerycode = "\$(\".colorpicker\").miniColors();";
echo "\n<h2>";
if ($action == "edit") {
    $data = get_query_vals("tblorderstatuses", "", array("id" => $id));
    extract($data);
    echo $aInt->lang("orderstatusconfig", "edit");
} else {
    $title = $showpending = $showactive = $showcancelled = "";
    $color = "#000000";
    echo $aInt->lang("orderstatusconfig", "addnew");
}
echo "</h2>\n\n<form method=\"post\" action=\"";
echo $PHP_SELF;
echo "?action=save&id=";
echo $id;
echo "\">\n<table class=\"form\" width=\"100%\" border=\"0\" cellspacing=\"2\" cellpadding=\"3\">\n<tr><td width=\"25%\" class=\"fieldlabel\">";
echo $aInt->lang("clientsummary", "filetitle");
echo "</td><td class=\"fieldarea\"><input type=\"text\" name=\"title\" size=\"30\" value=\"";
echo $title;
Ejemplo n.º 21
0
 public function formatForOutput()
 {
     global $whmcs;
     global $currency;
     $this->output = $this->data;
     $array = array("date", "duedate", "datepaid");
     foreach ($array as $v) {
         $this->output[$v] = substr($this->output[$v], 0, 10) != "0000-00-00" ? fromMySQLDate($this->output[$v], $v == "datepaid" ? "1" : "0", 1) : "";
     }
     $this->output['datecreated'] = $this->output['date'];
     $this->output['datedue'] = $this->output['duedate'];
     $currency = getCurrency($this->getData("userid"));
     $array = array("subtotal", "credit", "tax", "tax2", "total", "balance", "amountpaid");
     foreach ($array as $v) {
         $this->output[$v] = formatCurrency($this->output[$v]);
     }
     if (!function_exists("getClientsDetails")) {
         require ROOTDIR . "/includes/clientfunctions.php";
     }
     $clientsdetails = getClientsDetails($this->getData("userid"), "billing");
     $clientsdetails['country'] = $clientsdetails['countryname'];
     $this->output['clientsdetails'] = $clientsdetails;
     $customfields = array();
     $result = select_query("tblcustomfields", "tblcustomfields.id,tblcustomfields.fieldname,(SELECT value FROM tblcustomfieldsvalues WHERE tblcustomfieldsvalues.fieldid=tblcustomfields.id AND tblcustomfieldsvalues.relid=" . (int) $this->getData("userid") . ") AS value", array("type" => "client", "showinvoice" => "on"));
     while ($data = mysql_fetch_assoc($result)) {
         if ($data['value']) {
             $customfields[] = $data;
         }
     }
     $this->output['customfields'] = $customfields;
     if (0 < $this->getData("taxrate")) {
         $taxname = getTaxRate(1, $clientsdetails['state'], $clientsdetails['countrycode']);
         $this->output['taxname'] = $taxname['name'];
     } else {
         $this->output['taxrate'] = "0";
     }
     if (0 < $this->getData("taxrate2")) {
         $taxname = getTaxRate(2, $clientsdetails['state'], $clientsdetails['countrycode']);
         $this->output['taxname2'] = $taxname['name'];
     } else {
         $this->output['taxrate2'] = "0";
     }
     $this->output['statuslocale'] = $whmcs->get_lang("invoices" . strtolower($this->output['status']));
     $this->output['pagetitle'] = $whmcs->get_lang("invoicenumber") . $this->getData("invoicenum");
     $this->output['payto'] = nl2br($whmcs->get_config("InvoicePayTo"));
     $this->output['notes'] = nl2br($this->output['notes']);
     $this->output['subscrid'] = get_query_val("tblinvoiceitems", "tblhosting.subscriptionid", "tblinvoiceitems.type='Hosting' AND tblinvoiceitems.invoiceid=" . $this->getData("id") . " AND tblhosting.subscriptionid!=''", "tblhosting`.`id", "ASC", "", "tblhosting ON tblhosting.id=tblinvoiceitems.relid");
     $clienttotals = get_query_vals("tblinvoices", "SUM(credit),SUM(total)", array("userid" => $this->getData("userid"), "status" => "Unpaid"));
     $alldueinvoicespayments = get_query_val("tblaccounts", "SUM(amountin-amountout)", "invoiceid IN (SELECT id FROM tblinvoices WHERE userid=" . (int) $this->getData("userid") . " AND status='Unpaid')");
     $this->output['clienttotaldue'] = formatCurrency($clienttotals[0] + $clienttotals[1]);
     $this->output['clientpreviousbalance'] = formatCurrency($clienttotals[1] - $this->getData("total"));
     $this->output['clientbalancedue'] = formatCurrency($clienttotals[1] - $alldueinvoicespayments);
     $lastpayment = get_query_vals("tblaccounts", "(amountin-amountout),transid", array("invoiceid" => $this->getData("id")), "id", "DESC");
     $this->output['lastpaymentamount'] = formatCurrency($lastpayment[0]);
     $this->output['lastpaymenttransid'] = $lastpayment[1];
 }
Ejemplo n.º 22
0
function licensing_output($vars)
{
    global $whmcs;
    global $licensing;
    global $aInt;
    global $numrows;
    global $tabledata;
    global $orderby;
    global $order;
    global $page;
    global $limit;
    global $jscode;
    if (!LICENSINGADDONLICENSE) {
        if ($whmcs->get_req_var("refresh")) {
            $licensing->forceRemoteCheck();
            redir("module=licensing");
        }
        echo "<div class=\"gracefulexit\">\nYour WHMCS license key is not enabled to use the Licensing Addon yet.<br /><br />\nYou can find out more about it and purchase @ <a href=\"http://go.whmcs.com/94/licensing-addon\" target=\"_blank\">www.whmcs.com/addons/licensing-addon</a><br /><br />\nIf you have only recently purchased the addon, please <a href=\"addonmodules.php?module=licensing&refresh=1\">click here</a> to perform a license refresh.\n</div>";
        return false;
    }
    $modulelink = $vars['modulelink'];
    $action = isset($_REQUEST['action']) ? $_REQUEST['action'] : "";
    $id = (int) $_REQUEST['id'];
    echo "<style>\n.licensinglinksbar {\n    padding:10px 25px 10px 25px;\n    background-color:#6CAD41;\n    font-weight:bold;\n    font-size: 14px;\n    color: #5A7B2F;\n    margin: 0 0 15px 0;\n    -moz-border-radius: 5px;\n    -webkit-border-radius: 5px;\n    -o-border-radius: 5px;\n    border-radius: 5px;\n}\n.licensinglinksbar a {\n    color: #fff;\n    font-weight: normal;\n}\n</style>\n\n<div class=\"licensinglinksbar\">\n<a href=\"" . $modulelink . "\">Home</a> | <a href=\"" . $modulelink . "&action=list\">Search/Browse Licenses</a> | <a href=\"" . $modulelink . "&action=bans\">Ban Control</a> | <a href=\"" . $modulelink . "&action=log\">License Access Logs</a> | <a href=\"http://docs.whmcs.com/Licensing_Addon\" target=\"_blank\">Help</a>\n</div>\n\n";
    if (!$action) {
        echo "\n<h2>Statistics</h2>\n\n<table width=\"90%\" align=\"center\">\n<tr><td width=\"33%\">\n\n<div style=\"margin:0 25px;padding:15px;font-family:Trebuchet MS,Tahoma;text-align:center;font-size:20px;background-color:#E7F1C0;-moz-border-radius: 5px;-webkit-border-radius: 5px;-o-border-radius: 5px;border-radius: 5px;\">\nActive Licenses<br />\n";
        echo "<s";
        echo "trong>";
        echo get_query_val("mod_licensing", "COUNT(*)", "status='Reissued' OR status='Active'");
        echo "</strong>\n</div>\n\n</td><td width=\"33%\">\n\n<div style=\"margin:0 25px;padding:15px;font-family:Trebuchet MS,Tahoma;text-align:center;font-size:20px;background-color:#F2E8BF;-moz-border-radius: 5px;-webkit-border-radius: 5px;-o-border-radius: 5px;border-radius: 5px;\">\nSuspended Licenses<br />\n";
        echo "<s";
        echo "trong>";
        echo get_query_val("mod_licensing", "COUNT(*)", "status='Suspended'");
        echo "</strong>\n</div>\n\n</td><td width=\"33%\">\n\n<div style=\"margin:0 25px;padding:15px;font-family:Trebuchet MS,Tahoma;text-align:center;font-size:20px;background-color:#F2BFBF;-moz-border-radius: 5px;-webkit-border-radius: 5px;-o-border-radius: 5px;border-radius: 5px;\">\nExpired Licenses<br />\n";
        echo "<s";
        echo "trong>";
        echo get_query_val("mod_licensing", "COUNT(*)", "status='Expired'");
        echo "</strong>\n</div>\n\n</td></tr>\n</table>\n\n<table width=\"90%\" align=\"center\">\n<tr><td width=\"50%\">\n\n<div style=\"margin:0 25px;padding:15px;font-family:Trebuchet MS,Tahoma;text-align:center;font-size:20px;background-color:#efefef;-moz-border-radius: 5px;-webkit-border-radius: 5px;-o-border-radius: 5px;border-radius: 5px;\">\nTotal Licenses in Database<br />\n";
        echo "<s";
        echo "trong>";
        echo get_query_val("mod_licensing", "COUNT(*)", "");
        echo "</strong>\n</div>\n\n</td><td width=\"50%\">\n\n<div style=\"margin:0 25px;padding:15px;font-family:Trebuchet MS,Tahoma;text-align:center;font-size:20px;background-color:#efefef;-moz-border-radius: 5px;-webkit-border-radius: 5px;-o-border-radius: 5px;border-radius: 5px;\">\nAccessed within the Past 30 Days<br />\n";
        echo "<s";
        echo "trong>";
        echo get_query_val("mod_licensing", "COUNT(*)", "lastaccess>='" . date("Y-m-d", mktime(0, 0, 0, date("m"), date("d") - 30, date("Y"))) . "'");
        echo "</strong>\n</div>\n\n</td></tr>\n</table>\n\n<br />\n\n<h2>Search</h2>\n\n<form method=\"post\" action=\"";
        echo $modulelink;
        echo "&action=list\">\n\n<table class=\"form\" width=\"100%\" border=\"0\" cellspacing=\"2\" cellpadding=\"3\">\n<tr><td width=\"15%\" class=\"fieldlabel\">Product/License</td><td class=\"fieldarea\">";
        echo "<s";
        echo "elect name=\"search_pid\"><option value=\"0\">- Any -</option>";
        $result = select_query("tblproducts", "id,name", array("servertype" => "licensing"), "name", "ASC");
        while ($data = mysql_fetch_array($result)) {
            echo "<option value=\"" . $data['id'] . "\">" . $data['name'] . "</option>";
        }
        echo "</select></td></tr>\n<tr><td width=\"15%\" class=\"fieldlabel\">License Key</td><td class=\"fieldarea\"><input type=\"text\" name=\"search_licensekey\" size=\"30\" value=\"";
        echo $search_licensekey;
        echo "\" /></td></tr>\n<tr><td class=\"fieldlabel\">Domain</td><td class=\"fieldarea\"><input type=\"text\" name=\"search_domain\" size=\"30\" value=\"";
        echo $search_domain;
        echo "\" /></td></tr>\n<tr><td class=\"fieldlabel\">IP</td><td class=\"fieldarea\"><input type=\"text\" name=\"search_ip\" size=\"30\" value=\"";
        echo $search_ip;
        echo "\" /></td></tr>\n<tr><td class=\"fieldlabel\">Directory</td><td class=\"fieldarea\"><input type=\"text\" name=\"search_dir\" size=\"60\" value=\"";
        echo $search_dir;
        echo "\" /></td></tr>\n<tr><td class=\"fieldlabel\">Status</td><td class=\"fieldarea\">";
        echo "<s";
        echo "elect name=\"search_status\">\n<option value=\"\">- Any -</option>\n<option>Reissued</option>\n<option>Active</option>\n<option>Suspended</option>\n<option>Expired</option>\n</select></td></tr>\n</table>\n\n<p align=\"center\"><input type=\"submit\" value=\"Search\" class=\"button\" /></p>\n\n</form>\n\n";
        return null;
    }
    if ($action == "list") {
        echo "\n<form method=\"post\" action=\"";
        echo $modulelink;
        echo "&action=list\">\n\n<h2>Search/Browse Licenses</h2>\n\n<table class=\"form\" width=\"100%\" border=\"0\" cellspacing=\"2\" cellpadding=\"3\">\n<tr><td width=\"15%\" class=\"fieldlabel\">Product/License</td><td class=\"fieldarea\">";
        echo "<s";
        echo "elect name=\"search_pid\"><option value=\"0\">- Any -</option>";
        $result = select_query("tblproducts", "id,name", array("servertype" => "licensing"), "name", "ASC");
        while ($data = mysql_fetch_array($result)) {
            echo "<option value=\"" . $data['id'] . "\"";
            if ($_REQUEST['search_pid'] == $data['id']) {
                echo " selected";
            }
            echo ">" . $data['name'] . "</option>";
        }
        echo "</select></td></tr>\n<tr><td width=\"15%\" class=\"fieldlabel\">License Key</td><td class=\"fieldarea\"><input type=\"text\" name=\"search_licensekey\" size=\"30\" value=\"";
        echo $_REQUEST['search_licensekey'];
        echo "\" /></td></tr>\n<tr><td class=\"fieldlabel\">Domain</td><td class=\"fieldarea\"><input type=\"text\" name=\"search_domain\" size=\"30\" value=\"";
        echo $_REQUEST['search_domain'];
        echo "\" /></td></tr>\n<tr><td class=\"fieldlabel\">IP</td><td class=\"fieldarea\"><input type=\"text\" name=\"search_ip\" size=\"30\" value=\"";
        echo $_REQUEST['search_ip'];
        echo "\" /></td></tr>\n<tr><td class=\"fieldlabel\">Directory</td><td class=\"fieldarea\"><input type=\"text\" name=\"search_dir\" size=\"60\" value=\"";
        echo $_REQUEST['search_dir'];
        echo "\" /></td></tr>\n<tr><td class=\"fieldlabel\">Status</td><td class=\"fieldarea\">";
        echo "<s";
        echo "elect name=\"search_status\">\n<option value=\"\">- Any -</option>\n<option";
        if ($_REQUEST['search_status'] == "Reissued") {
            echo " selected";
        }
        echo ">Reissued</option>\n<option";
        if ($_REQUEST['search_status'] == "Active") {
            echo " selected";
        }
        echo ">Active</option>\n<option";
        if ($_REQUEST['search_status'] == "Suspended") {
            echo " selected";
        }
        echo ">Suspended</option>\n<option";
        if ($_REQUEST['search_status'] == "Expired") {
            echo " selected";
        }
        echo ">Expired</option>\n</select></td></tr>\n</table>\n\n<p align=\"center\"><input type=\"submit\" value=\"Search\" class=\"button\" /></p>\n\n</form>\n\n";
        $where = array();
        if ($_REQUEST['search_pid']) {
            $where['packageid'] = $_REQUEST['search_pid'];
        }
        if ($_REQUEST['search_licensekey']) {
            $where['licensekey'] = array("sqltype" => "LIKE", "value" => trim($_REQUEST['search_licensekey']));
        }
        if ($_REQUEST['search_domain']) {
            $where['validdomain'] = array("sqltype" => "LIKE", "value" => trim($_REQUEST['search_domain']));
        }
        if ($_REQUEST['search_ip']) {
            $where['validip'] = array("sqltype" => "LIKE", "value" => trim($_REQUEST['search_ip']));
        }
        if ($_REQUEST['search_dir']) {
            $where['validdirectory'] = array("sqltype" => "LIKE", "value" => trim($_REQUEST['search_dir']));
        }
        if ($_REQUEST['search_status']) {
            $where['status'] = $_REQUEST['search_status'];
        }
        $aInt->sortableTableInit("id", "ASC");
        if (!in_array($orderby, array("id", "licensekey", "validdomain", "validip", "lastaccess", "status"))) {
            $orderby = "id";
        }
        $result = select_query("mod_licensing", "mod_licensing.*", $where, $orderby, $order, "", "tblhosting ON tblhosting.id=mod_licensing.serviceid");
        $numrows = mysql_num_rows($result);
        if (count($where) && $numrows == 1) {
            $data = mysql_fetch_array($result);
            $id = $data['id'];
            redir("module=licensing&action=manage&id=" . $id);
        }
        $result = select_query("mod_licensing", "mod_licensing.*", $where, $orderby, $order, $page * $limit . ("," . $limit), "tblhosting ON tblhosting.id=mod_licensing.serviceid");
        while ($data = mysql_fetch_array($result)) {
            $id = $data['id'];
            $serviceid = $data['serviceid'];
            $licensekey = $data['licensekey'];
            $validdomain = $data['validdomain'];
            $validip = $data['validip'];
            $validdirectory = $data['validdirectory'];
            $status = $data['status'];
            $lastaccess = $data['lastaccess'];
            if ($lastaccess == "0000-00-00 00:00:00") {
                $lastaccess = "Never";
            } else {
                $lastaccess = fromMySQLDate($lastaccess, "time");
            }
            $validdomain = explode(",", $validdomain);
            $validip = explode(",", $validip);
            $validdirectory = explode(",", $validdirectory);
            $validdomain = $validdomain[0];
            $validip = $validip[0];
            $validdirectory = $validdirectory[0];
            $tabledata[] = array("<a href=\"clientshosting.php?id=" . $serviceid . "\" target=\"_blank\">" . $licensekey . "</a>", $validdomain, $validip, $lastaccess, $status, "<a href=\"" . $modulelink . "&action=manage&id=" . $id . "\"><img src=\"images/edit.gif\" border=\"0\"></a>");
        }
        echo $aInt->sortableTable(array(array("licensekey", "License Key"), array("validdomain", "Valid Domains"), array("validip", "Valid IPs"), array("lastaccess", "Last Access"), array("status", "Status"), ""), $tabledata);
        return null;
    }
    if ($action == "manage") {
        if ($_REQUEST['save']) {
            update_query("mod_licensing", array("validdomain" => licensing_addon_valid_input_clean($_REQUEST['validdomain']), "validip" => licensing_addon_valid_input_clean($_REQUEST['validip']), "validdirectory" => licensing_addon_valid_input_clean($_REQUEST['validdirectory']), "reissues" => $_REQUEST['reissues'], "status" => $_REQUEST['status']), array("id" => $id));
            redir("module=licensing&action=manage&id=" . $id);
        }
        $result = select_query("mod_licensing", "", array("id" => $id));
        $data = mysql_fetch_array($result);
        $id = $data['id'];
        if (!$id) {
            echo "<p>License Not Found. Please go back and try again.</p>";
            return false;
        }
        $serviceid = $data['serviceid'];
        $licensekey = $data['licensekey'];
        $validdomain = $data['validdomain'];
        $validip = $data['validip'];
        $validdirectory = $data['validdirectory'];
        $reissues = $data['reissues'];
        $status = $data['status'];
        $lastaccess = $data['lastaccess'];
        if ($lastaccess == "0000-00-00 00:00:00") {
            $lastaccess = "Never";
        } else {
            $lastaccess = fromMySQLDate($lastaccess, "time");
        }
        $data = get_query_vals("tblhosting", "tblproductgroups.name,tblproducts.name", array("tblhosting.id" => $serviceid), "", "", "", "tblproducts ON tblhosting.packageid=tblproducts.id INNER JOIN tblproductgroups ON tblproductgroups.id=tblproducts.gid");
        $productname = $data[0] . " - " . $data[1];
        echo "\n<h2>Manage License Key</h2>\n\n<form method=\"post\" action=\"";
        echo $modulelink;
        echo "&action=manage&id=";
        echo $id;
        echo "\">\n<input type=\"hidden\" name=\"save\" value=\"true\" />\n\n<table class=\"form\" width=\"100%\" border=\"0\" cellspacing=\"2\" cellpadding=\"3\">\n<tr><td class=\"fieldlabel\" width=\"20%\">Product/Service</td><td class=\"fieldarea\" height=\"24\">";
        echo $productname;
        echo "</td></tr>\n<tr><td class=\"fieldlabel\">License Key</td><td class=\"fieldarea\"><input type=\"text\" size=\"40\" value=\"";
        echo $licensekey;
        echo "\" readonly=\"true\" /> ";
        echo "<s";
        echo "pan style=\"color:#cccccc;\">(Not Editable)</span></td></tr>\n<tr><td class=\"fieldlabel\">Valid Domains</td><td class=\"fieldarea\"><textarea name=\"validdomain\" rows=2 cols=80>";
        echo $validdomain;
        echo "</textarea></td></tr>\n<tr><td class=\"fieldlabel\">Valid IPs</td><td class=\"fieldarea\"><textarea name=\"validip\" rows=2 cols=80>";
        echo $validip;
        echo "</textarea></td></tr>\n<tr><td class=\"fieldlabel\">Valid Directory</td><td class=\"fieldarea\"><textarea name=\"validdirectory\" rows=2 cols=80>";
        echo $validdirectory;
        echo "</textarea></td></tr>\n<tr><td class=\"fieldlabel\">Number of Reissues</td><td class=\"fieldarea\"><input type=\"text\" name=\"reissues\" size=\"10\" value=\"";
        echo $reissues;
        echo "\"></td></tr>\n<tr><td class=\"fieldlabel\">Status</td><td class=\"fieldarea\">";
        echo "<s";
        echo "elect name=\"status\">\n<option";
        if ($status == "Reissued") {
            echo " selected";
        }
        echo ">Reissued</option>\n<option";
        if ($status == "Active") {
            echo " selected";
        }
        echo ">Active</option>\n<option";
        if ($status == "Suspended") {
            echo " selected";
        }
        echo ">Suspended</option>\n<option";
        if ($status == "Expired") {
            echo " selected";
        }
        echo ">Expired</option>\n</select></td></tr>\n<tr><td class=\"fieldlabel\">Last Access</td><td class=\"fieldarea\" height=\"24\">";
        echo $lastaccess;
        echo "</td></tr>\n</table>\n\n<p align=\"center\"><input type=\"button\" value=\"&laquo; Back to List\" onclick=\"history.go(-1)\" /> <input type=\"submit\" value=\"Save Changes\" class=\"button\" /> <input type=\"button\" value=\"Product Details &raquo;\" onclick=\"window.location='clientshosting.php?id=";
        echo $serviceid;
        echo "'\" /></p>\n\n</form>\n\n<h2>Recent Access</h2>\n\n";
        $aInt->sortableTableInit("nopagination");
        $result = select_query("mod_licensinglog", "", array("licenseid" => $id), "id", "DESC", "0,10");
        while ($data = mysql_fetch_array($result)) {
            $domain = $data['domain'];
            $ip = $data['ip'];
            $path = $data['path'];
            $message = $data['message'];
            $datetime = $data['datetime'];
            $datetime = fromMySQLDate($datetime, true);
            $tabledata[] = array($datetime, $domain, $ip, $path, $message);
        }
        echo $aInt->sortableTable(array("Date", "Domain", "IP", "Path", "Result"), $tabledata);
        return null;
    }
    if ($action == "bans") {
        if ($_REQUEST['save']) {
            check_token();
            if (trim($_REQUEST['banvalue'])) {
                insert_query("mod_licensingbans", array("value" => trim($_REQUEST['banvalue']), "notes" => trim($_REQUEST['bannote'])));
            }
            redir("module=licensing&action=bans");
        }
        if ($_REQUEST['delete']) {
            check_token();
            delete_query("mod_licensingbans", array("id" => $_REQUEST['delete']));
            redir("module=licensing&action=bans");
        }
        $jscode = "function doDelete(id) {\n    if (confirm(\"Are you sure you want to delete this ban entry?\")) {\n        window.location='" . $modulelink . "&action=bans&delete='+id+'" . generate_token("link") . "';\n    }\n}\n";
        echo "\n<h2>Ban Control</h2>\n\n<form method=\"post\" action=\"";
        echo $modulelink;
        echo "&action=bans\">\n<input type=\"hidden\" name=\"save\" value=\"true\" />\n\n<table class=\"form\" width=\"100%\" border=\"0\" cellspacing=\"2\" cellpadding=\"3\">\n<tr><td class=\"fieldlabel\" width=\"20%\">Value</td><td class=\"fieldarea\"><input type=\"text\" name=\"banvalue\" size=\"40\" /></td></tr>\n<tr><td class=\"fieldlabel\">Reason/Notes</td><td class=\"fieldarea\"><input type=\"text\" name=\"bannote\" size=\"80\" /></td></tr>\n</table>\n\n<p ali";
        echo "gn=\"center\"><input type=\"submit\" value=\"Add Ban\" /></p>\n\n</form>\n\n";
        $aInt->sortableTableInit("nopagination");
        $result = select_query("mod_licensingbans", "", "", "value", "ASC");
        while ($data = mysql_fetch_array($result)) {
            $id = $data['id'];
            $value = $data['value'];
            $notes = $data['notes'];
            $tabledata[] = array($value, $notes, "<a href=\"#\" onClick=\"doDelete('" . $id . "');return false\"><img src=\"images/delete.gif\" width=\"16\" height=\"16\" border=\"0\" alt=\"" . $aInt->lang("global", "delete") . "\"></a>");
        }
        echo $aInt->sortableTable(array("Domain/IP", "Ban Reason/Notes", ""), $tabledata);
        return null;
    }
    if ($action == "log") {
        echo "\n<h2>License Access Logs</h2>\n\n<form method=\"post\" action=\"";
        echo $modulelink;
        echo "&action=log\">\n<p align=\"center\"><b>Search/Filter</b>\nDomain: <input type=\"text\" name=\"search_domainlog\" size=\"30\" value=\"";
        echo $_REQUEST['search_domainlog'];
        echo "\" />\nIP: <input type=\"text\" name=\"search_iplog\" size=\"15\" value=\"";
        echo $_REQUEST['search_iplog'];
        echo "\" />\nDir: <input type=\"text\" name=\"search_dirlog\" size=\"25\" value=\"";
        echo $_REQUEST['search_dirlog'];
        echo "\" />\nStatus: <input type=\"text\" name=\"search_message\" size=\"25\" value=\"";
        echo $_REQUEST['search_message'];
        echo "\" />\n<input type=\"submit\" value=\"Go\" class=\"button\" /></p>\n</form>\n\n";
        $where = array();
        if ($_REQUEST['search_domainlog']) {
            $where['domain'] = array("sqltype" => "LIKE", "value" => trim($_REQUEST['search_domainlog']));
        }
        if ($_REQUEST['search_iplog']) {
            $where['ip'] = array("sqltype" => "LIKE", "value" => trim($_REQUEST['search_iplog']));
        }
        if ($_REQUEST['search_dirlog']) {
            $where['path'] = array("sqltype" => "LIKE", "value" => trim($_REQUEST['search_dirlog']));
        }
        if ($_REQUEST['search_message']) {
            $where['message'] = array("sqltype" => "LIKE", "value" => trim($_REQUEST['search_message']));
        }
        $result = select_query("mod_licensinglog", "", $where, "id", "DESC");
        $numrows = mysql_num_rows($result);
        $result = select_query("mod_licensinglog", "", $where, "id", "DESC", $page * $limit . ("," . $limit));
        $aInt->sortableTableInit("datetime", "ASC");
        while ($data = mysql_fetch_array($result)) {
            $domain = $data['domain'];
            $ip = $data['ip'];
            $path = $data['path'];
            $message = $data['message'];
            $datetime = $data['datetime'];
            $datetime = fromMySQLDate($datetime, true);
            $tabledata2[] = array($datetime, $domain, $ip, $path, $message);
        }
        echo $aInt->sortableTable(array("Date", "Domain", "IP", "Path", "Status Message"), $tabledata2);
    }
}
Ejemplo n.º 23
0
 public function loadAdminSettings()
 {
     $data = get_query_vals("tbladmins", "id,username,firstname,lastname,email,authmodule,authdata", array("id" => $this->adminid, "disabled" => "0"));
     if (!$data['id']) {
         return false;
     }
     $this->adminmodule = $data['authmodule'];
     $this->adminsettings = unserialize($data['authdata']);
     if (!is_array($this->adminsettings)) {
         $this->adminsettings = array();
     }
     unset($data['authmodule']);
     unset($data['authdata']);
     $this->admininfo = $data;
     return true;
 }
Ejemplo n.º 24
0
function resellerclub_AdminCustomButtonArray()
{
    $buttonarray = array();
    $params = get_query_vals("tbldomains", "", array("id" => $_REQUEST['id']));
    if ($params['type'] == "Transfer" && $params['status'] == "Pending Transfer") {
        $buttonarray["Resend Transfer Approval Email"] = "resendtransferapproval";
        $buttonarray["Cancel Domain Transfer"] = "canceldomaintransfer";
    }
    return $buttonarray;
}
Ejemplo n.º 25
0
function locateSirportlyUpdateAuthor($sirportlyContactID)
{
    $result = get_query_vals('sirportly_contacts', '*', array('sirportly_id' => $sirportlyContactID), "", 'sirportly_id', 1);
    return array('contact_id' => $result['contact_id'], 'user_id' => $result['user_id']);
}
Ejemplo n.º 26
0
function bundlesGetProductPriceOverride($type, $key)
{
    global $currency;
    $proddata = $_SESSION['cart'][$type . "s"][$key];
    $prodbundleddomain = false;
    if (!isset($proddata['bnum']) && $type == "domain") {
        $domain = $proddata['domain'];
        if (is_array($_SESSION['cart']['prodbundleddomains'][$domain])) {
            $proddata['bnum'] = $_SESSION['cart']['prodbundleddomains'][$domain][0];
            $proddata['bitem'] = $_SESSION['cart']['prodbundleddomains'][$domain][1];
        }
    }
    if (!isset($proddata['bnum'])) {
        return false;
    }
    $bid = $_SESSION['cart']['bundle'][$proddata['bnum']]['bid'];
    if (!$bid) {
        return false;
    }
    $bundlewarnings = $_SESSION['cart']['bundle'][$proddata['bnum']]['warnings'];
    if ($bundlewarnings) {
        return false;
    }
    $data = get_query_vals("tblbundles", "", array("id" => $bid));
    $itemdata = $data['itemdata'];
    $itemdata = unserialize($itemdata);
    if ($type == "product" && $itemdata[$proddata['bitem']]['priceoverride']) {
        return convertCurrency($itemdata[$proddata['bitem']]['price'], 1, $currency['id']);
    }
    if ($type == "domain" && $itemdata[$proddata['bitem']]['dompriceoverride']) {
        return convertCurrency($itemdata[$proddata['bitem']]['domprice'], 1, $currency['id']);
    }
    return false;
}
Ejemplo n.º 27
0
function validateAdminTicketAccess($ticketid)
{
    $data = get_query_vals("tbltickets", "id,did,flag", array("id" => $ticketid));
    $id = $data['id'];
    $deptid = $data['did'];
    $flag = $data['flag'];
    if (!$id) {
        return "invalidid";
    }
    if (!in_array($deptid, getAdminDepartmentAssignments()) && !checkPermission("Access All Tickets Directly", true)) {
        return "deptblocked";
    }
    if ($flag && $flag != $_SESSION['adminid'] && !checkPermission("View Flagged Tickets", true) && !checkPermission("Access All Tickets Directly", true)) {
        return "flagged";
    }
    return false;
}
Ejemplo n.º 28
0
     } else {
         $where = "adminid=" . (int) $_SESSION['adminid'];
     }
 }
 $numrows = get_query_val("mod_projecttasks", "COUNT(id)", $where);
 $orderby = in_array($orderby, array("task", "created", "duedate")) ? $orderby : "";
 if (!$orderby) {
     $order = "";
 }
 $result = select_query("mod_projecttasks", "id,projectid,task,created,duedate,adminid,(SELECT CONCAT(firstname,' ',lastname) FROM tbladmins WHERE id=mod_projecttasks.adminid) AS adminuser", $where, $orderby, $order, $page * $limit . ("," . $limit));
 while ($data = mysql_fetch_array($result)) {
     extract($data);
     $daysleft = $duedate != "0000-00-00" ? project_management_daysleft($duedate, $vars) : "-";
     $created = fromMySQLDate($created);
     $duedate = $duedate != "0000-00-00" ? fromMySQLDate($duedate) : "-";
     $projectdata = get_query_vals("mod_project", "", array("id" => $projectid));
     $projectname = $projectdata['title'];
     $projectadminid = $projectdata['adminid'];
     $show_project = false;
     if (project_management_check_viewproject($projectid)) {
         $show_project = true;
     }
     $projectname = $show_project ? "<a href=\"" . str_replace("m=overview", "m=view", $modulelink) . "&projectid=" . $projectid . "\">" . $projectname . "</a>" : $projectname;
     if (!$adminuser) {
         $adminuser = "******";
     }
     $editprojecthtml = $show_project ? "<a href=\"" . str_replace("m=overview", "m=view", $modulelink) . "&projectid=" . $projectid . "\"><img src=\"images/edit.gif\" border=\"0\" /></a>" : "";
     $deleteprojecthtml = project_management_checkperm("Delete Projects") ? "<a href=\"#\" onclick=\"doDelete('" . $projectid . "');return false\"><img src=\"images/delete.gif\" border=\"0\" /></a>" : "";
     $tabledata[] = array("<div align=\"left\">" . $projectname . "</div>", "<div align=\"left\">" . $task . "</div>", $created, $duedate, $daysleft, $adminuser, $editprojecthtml, $deleteprojecthtml);
 }
 echo $aInt->sortableTable(array(array("project", $vars['_lang']['projectname']), array("task", $vars['_lang']['taskname']), array("created", $vars['_lang']['created']), array("duedate", $vars['_lang']['duedate']), array("duedate", $vars['_lang']['daysleft']), $vars['_lang']['assignedto'], "", ""), $tabledata);
Ejemplo n.º 29
0
    foreach ($DisabledGateways as $modulename) {
        $AlphaDisabled[$GatewayConfig[$modulename]['FriendlyName']['Value']] = $modulename;
    }
    ksort($AlphaDisabled);
    echo "<select name=\"gateway\">";
    foreach ($AlphaDisabled as $displayname => $modulename) {
        echo "<option value=\"" . $modulename . "\">" . $displayname . "</option>";
    }
    echo "</select> <input type=\"submit\" value=\"" . $aInt->lang("gateways", "activate") . "\">";
} else {
    echo $aInt->lang("gateways", "nodisabledgateways");
}
echo "</form></p>\n\n";
$count = 1;
$newgateways = "";
$data = get_query_vals("tblpaymentgateways", "COUNT(gateway)", array("setting" => "name"));
$numgateways = $data[0];
$result3 = select_query("tblpaymentgateways", "", array("setting" => "name"), "order", "ASC");
while ($data = mysql_fetch_array($result3)) {
    $module = $data['gateway'];
    $order = $data['order'];
    echo "\n<form method=\"post\" action=\"";
    echo $PHP_SELF;
    echo "?action=save\">\n<input type=\"hidden\" name=\"module\" value=\"";
    echo $module;
    echo "\">\n\n<p align=\"left\"><b>";
    echo $count . ". " . $GatewayConfig[$module]['FriendlyName']['Value'];
    if ($numgateways != "1") {
        echo " <a href=\"#\" onclick=\"deactivateGW('" . $module . "','" . $GatewayConfig[$module]['FriendlyName']['Value'] . "');return false\" style=\"color:#cc0000\">(" . $aInt->lang("gateways", "deactivate") . ")</a> ";
    }
    echo "</b>";
Ejemplo n.º 30
0
function doUpgrade($upgradeid)
{
    $result = select_query("tblupgrades", "", array("id" => $upgradeid));
    $data = mysql_fetch_array($result);
    $orderid = $data['orderid'];
    $type = $data['type'];
    $relid = $data['relid'];
    $originalvalue = $data['originalvalue'];
    $newvalue = $data['newvalue'];
    $upgradeamount = $data['amount'];
    $recurringchange = $data['recurringchange'];
    $result = select_query("tblorders", "promocode", array("id" => $orderid));
    $data = mysql_fetch_array($result);
    $promocode = $data['promocode'];
    if ($type == "package") {
        $newvalue = explode(",", $newvalue);
        $newpackageid = $newvalue[0];
        $newbillingcycle = $newvalue[1];
        $changevalue = "amount";
        if ($newbillingcycle == "free") {
            $newbillingcycle = "Free Account";
        } else {
            if ($newbillingcycle == "onetime") {
                $newbillingcycle = "One Time";
                $changevalue = "firstpaymentamount";
                $recurringchange = $upgradeamount;
            } else {
                if ($newbillingcycle == "monthly") {
                    $newbillingcycle = "Monthly";
                } else {
                    if ($newbillingcycle == "quarterly") {
                        $newbillingcycle = "Quarterly";
                    } else {
                        if ($newbillingcycle == "semiannually") {
                            $newbillingcycle = "Semi-Annually";
                        } else {
                            if ($newbillingcycle == "annually") {
                                $newbillingcycle = "Annually";
                            } else {
                                if ($newbillingcycle == "biennially") {
                                    $newbillingcycle = "Biennially";
                                } else {
                                    if ($newbillingcycle == "triennially") {
                                        $newbillingcycle = "Triennially";
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        $result = select_query("tblhosting", "billingcycle", array("id" => $relid));
        $data = mysql_fetch_array($result);
        $billingcycle = $data['billingcycle'];
        if ($billingcycle == "Free Account") {
            $newnextdue = getInvoicePayUntilDate(date("Y-m-d"), $newbillingcycle, true);
            update_query("tblhosting", array("nextduedate" => $newnextdue, "nextinvoicedate" => $newnextdue), array("id" => $relid));
        }
        if (!function_exists("migrateCustomFieldsBetweenProducts")) {
            require ROOTDIR . "/includes/customfieldfunctions.php";
        }
        migrateCustomFieldsBetweenProducts($relid, $newpackageid);
        update_query("tblhosting", array("packageid" => $newpackageid, "billingcycle" => $newbillingcycle, "" . $changevalue => "+=" . $recurringchange), array("id" => $relid));
        $result = full_query("SELECT tblinvoiceitems.id,tblinvoiceitems.invoiceid FROM tblinvoices INNER JOIN tblinvoiceitems ON tblinvoiceitems.invoiceid=tblinvoices.id INNER JOIN tblhosting ON tblhosting.id=tblinvoiceitems.relid WHERE tblinvoices.status='Unpaid' AND tblinvoiceitems.type='Hosting' AND tblhosting.id=" . (int) $relid . " ORDER BY tblinvoiceitems.duedate DESC");
        $data = mysql_fetch_array($result);
        $invitemid = $data['id'];
        $inviteminvoiceid = $data['invoiceid'];
        if ($invitemid) {
            update_query("tblinvoices", array("status" => "Cancelled"), array("id" => $inviteminvoiceid));
            update_query("tblinvoiceitems", array("duedate" => "0000-00-00"), array("id" => $invitemid));
            full_query("UPDATE tblhosting SET nextinvoicedate=nextduedate WHERE id=" . (int) $relid);
        }
        if (!function_exists("getCartConfigOptions")) {
            require ROOTDIR . "/includes/configoptionsfunctions.php";
        }
        $configoptions = getCartConfigOptions($newpackageid, "", $newbillingcycle);
        foreach ($configoptions as $configoption) {
            $result = select_query("tblhostingconfigoptions", "COUNT(*)", array("relid" => $relid, "configid" => $configoption['id']));
            $data = mysql_fetch_array($result);
            if (!$data[0]) {
                insert_query("tblhostingconfigoptions", array("relid" => $relid, "configid" => $configoption['id'], "optionid" => $configoption['selectedvalue']));
                continue;
            }
        }
        run_hook("AfterProductUpgrade", array("upgradeid" => $upgradeid));
    } else {
        if ($type == "configoptions") {
            $tempvalue = explode("=>", $originalvalue);
            $configid = $tempvalue[0];
            $result = select_query("tblproductconfigoptions", "", array("id" => $configid));
            $data = mysql_fetch_array($result);
            $optiontype = $data['optiontype'];
            $result = select_query("tblhostingconfigoptions", "COUNT(*)", array("relid" => $relid, "configid" => $configid));
            $data = mysql_fetch_array($result);
            if (!$data[0]) {
                insert_query("tblhostingconfigoptions", array("relid" => $relid, "configid" => $configid));
            }
            if ($optiontype == 1 || $optiontype == 2) {
                update_query("tblhostingconfigoptions", array("optionid" => $newvalue), array("relid" => $relid, "configid" => $configid));
            } else {
                if ($optiontype == 3 || $optiontype == 4) {
                    update_query("tblhostingconfigoptions", array("qty" => $newvalue), array("relid" => $relid, "configid" => $configid));
                }
            }
            update_query("tblhosting", array("amount" => "+=" . $recurringchange), array("id" => $relid));
            run_hook("AfterConfigOptionsUpgrade", array("upgradeid" => $upgradeid));
        }
    }
    if ($promocode) {
        $result = select_query("tblpromotions", "id,type,recurring,value", array("code" => $promocode));
        $data = mysql_fetch_array($result);
        $promoid = $data[0];
        $promotype = $data[1];
        $promorecurring = $data[2];
        $promovalue = $data[3];
        if ($promorecurring) {
            $recurringamount = recalcRecurringProductPrice($relid);
            if ($promotype == "Percentage") {
                $discount = $recurringamount * ($promovalue / 100);
                $recurringamount = $recurringamount - $discount;
            } else {
                $recurringamount = $recurringamount < $promovalue ? "0" : $recurringamount - $promovalue;
            }
            update_query("tblhosting", array("amount" => $recurringamount, "promoid" => $promoid), array("id" => $relid));
        } else {
            update_query("tblhosting", array("promoid" => "0"), array("id" => $relid));
        }
    } else {
        update_query("tblhosting", array("promoid" => "0"), array("id" => $relid));
    }
    if ($type == "package" || $type == "configoptions") {
        $data = get_query_vals("tblhosting", "userid,packageid", array("id" => $relid));
        $userid = $data['userid'];
        $pid = $data['packageid'];
        $result = select_query("tblproducts", "servertype,upgradeemail", array("id" => $pid));
        $data = mysql_fetch_array($result);
        $servertype = $data['servertype'];
        $upgradeemail = $data['upgradeemail'];
        if ($servertype) {
            if (!function_exists("getModuleType")) {
                require dirname(__FILE__) . "/modulefunctions.php";
            }
            $result = ServerChangePackage($relid);
            if ($result != "success") {
                logActivity("Automatic Product/Service Upgrade Failed - Service ID: " . $relid, $userid);
            } else {
                logActivity("Automatic Product/Service Upgrade Successful - Service ID: " . $relid, $userid);
                if ($upgradeemail) {
                    $result = select_query("tblemailtemplates", "name", array("id" => $upgradeemail));
                    $data = mysql_fetch_array($result);
                    $emailtplname = $data[0];
                    sendMessage($emailtplname, $relid);
                }
            }
        } else {
            insert_query("tbltodolist", array("date" => "now()", "title" => "Manual Upgrade Required", "description" => "Manual Upgrade Required for Service ID: " . $relid, "admin" => "", "status" => "Pending", "duedate" => date("Y-m-d")));
        }
    }
    update_query("tblupgrades", array("status" => "Completed"), array("id" => $upgradeid));
}