function SupressPaymentReminders($vars) { /* * Prevents incorrect payment reminder emails from being * sent whilst the payment request is inflight. If the * payment fails we send the reminders. */ $email_template_name = $vars['messagename']; # Email template name being sent if ($email_template_name == 'Credit Card Payment Failed' || $email_template_name == 'Invoice Payment Reminder' || $email_template_name == 'First Invoice Overdue Notice' || $email_template_name == 'Second Invoice Overdue Notice' || $email_template_name == 'Third Invoice Overdue Notice') { $invoiceid = $vars['relid']; $result = select_query("mod_gocardless", "payment_failed", array("invoiceid" => $invoiceid)); $data = mysql_fetch_array($result); if (empty($data)) { $merge_fields = array(); $merge_fields['abortsend'] = false; } else { if ($data['payment_failed'] == 0) { $merge_fields = array(); $merge_fields['abortsend'] = true; # You can use this return to stop email sending return $merge_fields; } } } }
function ZopimLiveChatJS($vars) { $scripts = ""; $q = @mysql_query("SELECT * FROM tbladdonmodules WHERE module = 'zopimlivechat'"); while ($arr = mysql_fetch_array($q)) { $settings[$arr['setting']] = $arr['value']; } if (isset($settings['z_user'])) { $q2 = @mysql_query("SELECT * FROM mod_zopimlivechat WHERE user = '******'z_user'] . "' "); $arr2 = mysql_fetch_array($q2); $code = $arr2['key']; $table = "mod_zopimlivechat"; $fields = "user,salt,key"; $where = array("user" => $settings['z_user']); $result = select_query($table, $fields, $where); $data = mysql_fetch_array($result); $scripts = "<!--Start of Zopim Live Chat Script-->\n<script type=\"text/javascript\">\nwindow.\$zopim||(function(d,s){var z=\$zopim=function(c){z._.push(c)},\$=z.s=\nd.createElement(s),e=d.getElementsByTagName(s)[0];z.set=function(o){z.set.\n_.push(o)};z._=[];z.set._=[];\$.async=!0;\$.setAttribute('charset','utf-8');\n\$.src='//cdn.zopim.com/?" . $code . "';z.t=+new Date;\$.\ntype='text/javascript';e.parentNode.insertBefore(\$,e)})(document,'script');\n</script>\n<!--End of Zopim Live Chat Script-->"; if ($_SESSION['uid']) { $userid = $_SESSION['uid']; $result = mysql_query("SELECT firstname,lastname,email FROM tblclients WHERE id={$userid}"); $data = mysql_fetch_array($result); $firstname = $data["firstname"]; $lastname = $data["lastname"]; $email = $data["email"]; $scripts .= "<script type=\"text/javascript\">\n \$zopim(function() {\n \$zopim.livechat.setName('" . $firstname . " " . $lastname . "');\n \$zopim.livechat.setEmail('" . $email . "');\n });\n</script>\n"; } } return $scripts; }
/** * * @ WHMCS FULL DECODED & NULLED * * @ Version : 5.2.15 * @ Author : MTIMER * @ Release on : 2013-12-24 * @ Website : http://www.mtimer.cn * **/ function doUnsubscribe($email, $key) { global $whmcs; global $_LANG; $whmcs->get_hash(); if (!$email) { return $_LANG['pwresetemailrequired']; } $result = select_query("tblclients", "id,email,emailoptout", array("email" => $email)); $data = mysql_fetch_array($result); $userid = $data['id']; $email = $data['email']; $emailoptout = $data['emailoptout']; $newkey = sha1($email . $userid . $cc_encryption_hash); if ($newkey == $key) { if (!$userid) { return $_LANG['unsubscribehashinvalid']; } if ($emailoptout == 1) { return $_LANG['alreadyunsubscribed']; } update_query("tblclients", array("emailoptout" => "1"), array("id" => $userid)); sendMessage("Unsubscribe Confirmation", $userid); logActivity("Unsubscribed From Marketing Emails - User ID:" . $userid, $userid); return null; } return $_LANG['unsubscribehashinvalid']; }
public function getAvailableGateways($invoiceid = "") { $validgateways = array(); $result = full_query("SELECT DISTINCT gateway, (SELECT value FROM tblpaymentgateways g2 WHERE g1.gateway=g2.gateway AND setting='name' LIMIT 1) AS `name`, (SELECT `order` FROM tblpaymentgateways g2 WHERE g1.gateway=g2.gateway AND setting='name' LIMIT 1) AS `order` FROM `tblpaymentgateways` g1 WHERE setting='visible' AND value='on' ORDER BY `order` ASC"); while ($data = mysql_fetch_array($result)) { $validgateways[$data[0]] = $data[1]; } if ($invoiceid) { $disabledgateways = array(); $result = select_query("tblinvoiceitems", "", array("type" => "Hosting", "invoiceid" => $invoiceid)); while ($data = mysql_fetch_assoc($result)) { $relid = $data['relid']; if ($relid) { $result2 = full_query("SELECT pg.disabledgateways AS disabled FROM tblhosting h LEFT JOIN tblproducts p on h.packageid = p.id LEFT JOIN tblproductgroups pg on p.gid = pg.id where h.id = " . (int) $relid); $data2 = mysql_fetch_assoc($result2); $gateways = explode(",", $data2['disabled']); foreach ($gateways as $gateway) { if (array_key_exists($gateway, $validgateways)) { unset($validgateways[$gateway]); continue; } } } } } return $validgateways; }
/** * * @ WHMCS FULL DECODED & NULLED * * @ Version : 5.2.15 * @ Author : MTIMER * @ Release on : 2013-12-24 * @ Website : http://www.mtimer.cn * * */ function cloudmin_ConfigOptions() { global $packageconfigoption; $imagesresult = ""; if ($packageconfigoption[6]) { $result = select_query("tblservers", "", array("type" => "cloudmin", "active" => "1")); $data = mysql_fetch_array($result); $params['serverip'] = $data['ipaddress']; $params['serverhostname'] = $data['hostname']; $params['serverusername'] = $data['username']; $params['serverpassword'] = decrypt($data['password']); $params['serveraccesshash'] = $data['accesshash']; $params['serversecure'] = $data['secure']; if ($params['serverusername']) { $postfields = array(); $postfields['program'] = "list-images"; $imagesresult = cloudmin_req($params, $postfields); } } $configarray = array("Type" => array("Type" => "dropdown", "Options" => "xen,openvz,vservers,zones,real"), "Xen Host" => array("Type" => "text", "Size" => "30", "Description" => "(Optional)"), "Setup Type" => array("Type" => "dropdown", "Options" => "system,owner"), "Plan Name" => array("Type" => "text", "Size" => "20", "Description" => "")); if (is_array($imagesresult)) { $configarray['Image'] = array("Type" => "dropdown", "Options" => implode(",", $imagesresult)); } else { $configarray['Image'] = array("Type" => "text", "Size" => "30"); } $configarray["Get From Server"] = array("Type" => "yesno", "Description" => "Tick this box to load Image options from default server"); return $configarray; }
function widget_todo_list($vars) { global $_ADMINLANG; $content = '<table width="100%" bgcolor="#cccccc" cellspacing="1"> <tr bgcolor=#efefef style="text-align:center;font-weight:bold;"><td>' . $_ADMINLANG['fields']['date'] . '</td><td>' . $_ADMINLANG['fields']['title'] . '/' . $_ADMINLANG['fields']['description'] . '</td><td>' . $_ADMINLANG['fields']['duedate'] . '</td><td>' . $_ADMINLANG['fields']['status'] . '</td><td width="20"></td></tr> '; $id = ''; $result = select_query("tbltodolist", "", array("status" => array("sqltype" => "NEQ", "value" => "Completed")), "duedate", "ASC"); while ($data = mysql_fetch_array($result)) { $id = $data["id"]; $date = $data["date"]; $title = $data["title"]; $description = $data["description"]; $admin = $data["admin"]; $status = $data["status"]; $duedate = $data["duedate"]; $date = fromMySQLDate($date); $duedate = $duedate == "0000-00-00" ? '-' : fromMySQLDate($duedate); $bgcolor = $admin == $vars['adminid'] ? "#f5f5d7" : "#ffffff"; $description = strlen($description) > 50 ? substr($description, 0, 50) . '...' : $description; $content .= '<tr bgcolor="' . $bgcolor . '" style="text-align:center;"><td>' . $date . '</td><td>' . $title . ' - ' . $description . '</td><td>' . $duedate . '</td><td>' . $status . '</td><td><a href="todolist.php?action=edit&id=' . $id . '"><img src="images/edit.gif" border="0"></a></td></tr> '; } if (!$id) { $content .= '<tr bgcolor="#ffffff"><td colspan="5" align="center">' . $_ADMINLANG['global']['norecordsfound'] . '</td></tr>'; } $content .= '</table> <div align="right" style="padding-top:5px;"><a href="todolist.php">' . $_ADMINLANG['home']['manage'] . ' »</a></div>'; $title = $_ADMINLANG['todolist']['todolisttitle']; return array('title' => $title, 'content' => $content); }
function whmcs2slack_module_settings() { $fields = "module,setting,value"; $where = array("module" => "whmcs2slack"); $result = select_query('tbladdonmodules', $fields, $where); $whmcs2slack_configuration = array(); while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $whmcs2slack_configuration[$row["setting"]] = $row["value"]; } return $whmcs2slack_configuration; /* Array ( [version] => 0.1 [url] => https://hooks.slack.com/services/someslackapitoken [botname] => WHMCSbot [orders_channel] => @shalom [orders_emoji] => :question: [tickets_channel] => @shalom [tickets_emoji] => :space_invader: [payments_channel] => @shalom [payments_emoji] => :moneybag: [client_channel] => @shalom [client_emoji] => :moneybag: [access] => 4,1,10 [debug] => on ) */ }
function getActiveFraudModule() { global $CONFIG; $result = select_query("tblfraud", "fraud", array("setting" => "Enable", "value" => "on")); $data = mysql_fetch_array($result); $fraud = $data['fraud']; $orderid = $_SESSION['orderdetails']['OrderID']; if ($CONFIG['SkipFraudForExisting']) { $result = select_query("tblorders", "COUNT(*)", array("status" => "Active", "userid" => $_SESSION['uid'])); $data = mysql_fetch_array($result); if ($data[0]) { $fraudmodule = ""; logActivity("Order ID " . $orderid . " Skipped Fraud Check due to Already Active Orders"); } } $hookresponses = run_hook("RunFraudCheck", array("orderid" => $orderid, "userid" => $_SESSION['uid'])); foreach ($hookresponses as $hookresponse) { if ($hookresponse) { $fraud = ""; logActivity("Order ID " . $orderid . " Skipped Fraud Check due to Custom Hook"); continue; } } return $fraud; }
function signedinvoicedata() { $data = select_query("mod_signedinvoices", "name, value", array()); if (mysql_num_rows($data)) { while ($r = mysql_fetch_array($data)) { switch ($r['name']) { case "cert": $cert = $r['value']; break; case "key": $key = $r['value']; break; case "keypass": $keypass = decrypt($r['value']); break; case "extra": $extra = $r['value']; break; } } if (isset($cert) && isset($key)) { $status = "success"; return array('status' => 'success', 'cert' => $cert, 'key' => $key, 'keypass' => $keypass, 'extra' => $extra); } else { return array('status' => 'failure', 'message' => 'SIGNEDINVOICES: Missing private key and/or certificate!'); } } else { return array('status' => 'failure', 'message' => 'SIGNEDINVOICES: Something went wrong, the mod_signedinvoices table does not contain data!'); } }
function buildCategoriesList($level, $parentlevel, $exclude = "") { global $categorieslist; global $categories; $result = select_query("tblknowledgebasecats", "", array("parentid" => $level, "catid" => 0), "name", "ASC"); while ($data = mysql_fetch_array($result)) { $id = $data['id']; $parentid = $data['parentid']; $category = $data['name']; if ($id != $exclude) { $categorieslist .= "<option value=\"" . $id . "\""; if (in_array($id, $categories)) { $categorieslist .= " selected"; } $categorieslist .= ">"; $i = 1; while ($i <= $parentlevel) { $categorieslist .= "- "; ++$i; } $categorieslist .= "" . $category . "</option>"; } buildCategoriesList($id, $parentlevel + 1, $exclude); } }
function smarty_function_i18n($params, &$smarty) { require_once $_SERVER['DOCUMENT_ROOT'] . "/init.php"; $language = $params['lang']; $default = $params['default']; $key = md5($default); $result = select_query('tblconfiguration', '*', array('setting' => 'Language')); $res = mysql_fetch_assoc($result); $defaultlang = $res['value']; mysql_free_result($result); $result = select_query('mod_i18n_lang', '*', '1'); while ($row = mysql_fetch_assoc($result)) { $langs[$row['lang']] = $row['enabled']; } mysql_free_result($result); if ($langs[$language] == 0) { return $default; } else { $result = select_query('mod_i18n_data', '*', array('id' => $key)); if (mysql_num_rows($result) > 0) { $row = mysql_fetch_assoc($result); $translations = unserialize($row['data']); return $translations[$language]; } else { $translations[$defaultlang] = $default; foreach ($langs as $lang => $enabled) { if ($enabled == 1) { $translations[$lang] = $default; } } $newid = insert_query('mod_i18n_data', array('id' => $key, 'default' => $default, 'data' => serialize($translations), 'translated' => 0)); return $default; } } }
/** * * @ WHMCS FULL DECODED & NULLED * * @ Version : 5.2.15 * @ Author : MTIMER * @ Release on : 2013-12-24 * @ Website : http://www.mtimer.cn * * */ function widget_staffboard_overview($vars) { global $_ADMINLANG; $title = "Staff Noticeboard"; $lastviews = get_query_val("tbladdonmodules", "value", array("module" => "staffboard", "setting" => "lastviewed")); if ($lastviews) { $lastviews = unserialize($lastviews); $new = false; } else { $lastviews = array(); $new = true; } $lastviewed = $lastviews[$_SESSION['adminid']]; $lastviews[$_SESSION['adminid']] = time(); if ($new) { insert_query("tbladdonmodules", array("module" => "staffboard", "setting" => "lastviewed", "value" => serialize($lastviews))); } else { update_query("tbladdonmodules", array("value" => serialize($lastviews)), array("module" => "staffboard", "setting" => "lastviewed")); } $numchanged = get_query_val("mod_staffboard", "COUNT(id)", "date>='" . date("Y-m-d H:i:s", $lastviewed) . "'"); $content = "\n<style>\n.staffboardchanges {\n margin: 0 0 5px 0;\n padding: 8px 25px;\n font-size: 1.2em;\n text-align: center;\n}\n.staffboardnotices {\n max-height: 130px;\n overflow: auto;\n border-top: 1px solid #ccc;\n border-bottom: 1px solid #ccc;\n}\n.staffboardnotices div {\n padding: 5px 15px;\n border-bottom: 2px solid #fff;\n}\n.staffboardnotices div.pink {\n background-color: #F3CBF3;\n}\n.staffboardnotices div.yellow {\n background-color: #FFFFC1;\n}\n.staffboardnotices div.purple {\n background-color: #DCD7FE;\n}\n.staffboardnotices div.white {\n background-color: #FAFAFA;\n}\n.staffboardnotices div.pink {\n background-color: #F3CBF3;\n}\n.staffboardnotices div.blue {\n background-color: #A6E3FC;\n}\n.staffboardnotices div.green {\n background-color: #A5F88B;\n}\n</style>\n<div class=\"staffboardchanges\">There are <strong>" . $numchanged . "</strong> New or Updated Staff Notices Since your Last Visit - <a href=\"addonmodules.php?module=staffboard\">Visit Noticeboard »</a></div><div class=\"staffboardnotices\">"; $result = select_query("mod_staffboard", "", "", "date", "DESC"); while ($data = mysql_fetch_array($result)) { $content .= "<div class=\"" . $data['color'] . "\">" . fromMySQLDate($data['date'], 1) . " - " . (100 < strlen($data['note']) ? substr($data['note'], 0, 100) . "..." : $data['note']) . "</div>"; } $content .= "</div>"; return array("title" => $title, "content" => $content, "jquerycode" => $jquerycode); }
function widget_activity_log($vars) { global $_ADMINLANG; $title = $_ADMINLANG['utilities']['activitylog']; $content = ''; $patterns = $replacements = array(); $patterns[] = '/User ID: (.*?) /'; $patterns[] = '/Service ID: (.*?) /'; $patterns[] = '/Domain ID: (.*?) /'; $patterns[] = '/Invoice ID: (.*?) /'; $patterns[] = '/Order ID: (.*?) /'; $patterns[] = '/Transaction ID: (.*?) /'; $replacements[] = '<a href="clientssummary.php?userid=$1">User ID: $1</a> '; $replacements[] = '<a href="clientshosting.php?id=$1">Service ID: $1</a> '; $replacements[] = '<a href="clientsdomains.php?id=$1">Domain ID: $1</a> '; $replacements[] = '<a href="invoices.php?action=edit&id=$1">Invoice ID: $1</a> '; $replacements[] = '<a href="orders.php?action=view&id=$1">Order ID: $1</a> '; $replacements[] = '<a href="transactions.php?action=edit&id=$1">Transaction ID: $1</a> '; $result = select_query("tblactivitylog", "", "", "id", "DESC", "0,10"); while ($data = mysql_fetch_array($result)) { $description = $data["description"] . ' '; $description = whmcsHtmlspecialchars($description); $description = preg_replace($patterns, $replacements, $description); $content .= $description . '<br /><span style="font-size:11px;"> - ' . fromMySQLDate($data["date"], true) . ' - ' . $data['user'] . ' - ' . $data['ipaddr'] . '</span><br />'; } if (!$content) { $content = '<div align="center">No Activity Recorded Yet</div>'; } else { $content .= '<div align="right"><a href="systemactivitylog.php">' . $_ADMINLANG['home']['viewall'] . ' »</a></div>'; } return array('title' => $title, 'content' => $content); }
function getelement($default, $language) { $key = md5($default); $result = select_query('tblconfiguration', '*', array('setting' => 'Language')); $res = mysql_fetch_assoc($result); $defaultlang = $res['value']; mysql_free_result($result); $result = select_query('mod_i18n_lang', '*', '1'); while ($row = mysql_fetch_assoc($result)) { $langs[$row['lang']] = $row['enabled']; } mysql_free_result($result); if ($langs[$language] == 0) { return $default; } else { $result = select_query('mod_i18n_data', '*', array('id' => $key)); if (mysql_num_rows($result) > 0) { $row = mysql_fetch_assoc($result); $translations = unserialize($row['data']); return $translations[$language]; } else { $translations[$defaultlang] = $default; foreach ($langs as $lang => $enabled) { if ($enabled == 1) { $translations[$lang] = $default; } } $newid = insert_query('mod_i18n_data', array('id' => $key, 'default' => $default, 'data' => serialize($translations), 'translated' => 0)); return $default; } } }
function stop_users_vms() { logActivity("Starting to stop vms for users."); //Find all users whos credit is low $table = "tblclients"; $fields = "*"; $result = select_query($table, $fields); if ($result) { while ($data = mysql_fetch_array($result)) { $userid = $data['id']; $balanceLimit = get_balance_limit($userid); if (!$balanceLimit || !is_numeric($balanceLimit)) { $balanceLimit = 0; } logActivity("Balance limit for user " . $userid . ": " . $balanceLimit); if (getCreditForUserId($userid) + $balanceLimit < 0) { logActivity("Stopping vms for user: "******"Stopped vms for user: "******". Result:" . $res); } else { logActivity("Stoping vms failed for user: "******"Stopping vms for users ended."); }
/** * * @ WHMCS FULL DECODED & NULLED * * @ Version : 5.2.15 * @ Author : MTIMER * @ Release on : 2013-12-24 * @ Website : http://www.mtimer.cn * **/ function project_management_timesoutput($vars, $taskid) { $timesoutput = "<table width=\"95%\" bgcolor=\"#cccccc\" cellspacing=\"1\" align=\"center\" style=\"margin-top:5px;\"><tr class=\"taskholder" . $taskid . "\" bgcolor=\"#efefef\" style=\"text-align:center;font-weight:bold;\"><td align=\"center\">" . $vars['_lang']['staff'] . "</td><td>" . $vars['_lang']['starttime'] . "</td><td>" . $vars['_lang']['stoptime'] . "</td><td>" . $vars['_lang']['timespent'] . "</td><td width=\"25\"></td></tr>"; $result2 = select_query("mod_projecttimes", "*", array("taskid" => $taskid)); while ($timerdata = mysql_fetch_assoc($result2)) { $show_startresume = "false"; $timerid = $timerdata['id']; $timeradmin = mysql_fetch_assoc(select_query("tbladmins", "firstname,lastname", array("id" => $timerdata['adminid']))); $timerstart = $timerdata['start']; $timerend = $timerdata['end']; $starttime = fromMySQLDate(date("Y-m-d H:i:s", $timerstart), 1) . ":" . date("s", $timerstart); $endtimerlink = $timerdata['adminid'] == $_SESSION['adminid'] || project_management_check_masteradmin() ? "<a rel=\"" . $timerid . "\" id=\"ajaxendtimertaskid" . $taskid . "\" class=\"ajaxendtimer timerlink\">" . $vars['_lang']['endtimer'] . "</a>" : $vars['_lang']['inprogress']; $deltimerlink = $timerdata['adminid'] == $_SESSION['adminid'] || project_management_check_masteradmin() ? "<a href=\"#\" onclick=\"deleteTimer('" . $timerid . "','" . $taskid . "');return false\"><img src=\"images/delete.gif\"></a>" : ""; $endtime = $timerend ? fromMySQLDate(date("Y-m-d H:i:s", $timerend), 1) . ":" . date("s", $timerend) : $endtimerlink; $totaltime = $timerend ? project_management_sec2hms($timerend - $timerstart) : $vars['_lang']['inprogress']; $timesoutput .= "<tr bgcolor=\"#ffffff\" class=\"time taskholder" . $taskid . "\"><td>" . $timeradmin['firstname'] . " " . $timeradmin['lastname'] . "</td><td>" . $starttime . "</td><td id=\"ajaxendtimertaskholderid" . $timerid . "\">" . $endtime . "</td><td id=\"ajaxtimerstatusholderid" . $timerid . "\">" . $totaltime . "</td><td>" . $deltimerlink . "</td></tr>"; if ($timerend) { $timecount += $timerend - $timerstart; $totaltimecount += $timerend - $timerstart; $show_startresume = "true"; $invoicelinedesc .= " > " . $starttime . " - " . $endtime . " (" . $totaltime . " " . $vars['_lang']['hours'] . ")\r\n"; } } if (!$timerid) { $timesoutput .= "<tr id=\"notasktimersexist" . $taskid . "\"><td colspan=\"6\" align=\"center\" bgcolor=\"#fff\">" . $vars['_lang']['notimesrecorded'] . "</td></tr>"; } $timesoutput .= "</table>"; $GLOBALS['timerid'] = $timerid; $GLOBALS['timecount'] = $timecount; $GLOBALS['invoicelinedesc'] = $invoicelinedesc; return $timesoutput; }
function has_child($id) { //$query = "select count(*) from collections where parent_id=$id"; $query = select_query("count(*)", "collections", "parent_id={$id}"); $rs = my_mysql_query($query); $row = my_mysql_fetch_array($rs); return $row[0] > 0 ? true : false; }
function addFRbutton($vars) { $uid = $vars['userid']; $result = select_query("tblclients", "", array("id" => $uid)); $data = mysql_fetch_array($result); $lname = $data['lastname']; echo '<div style="float:right;"><form action="./addonmodules.php?module=fraudrecord&page=\'1\'" method="post"><input type="hidden" name="search_frc_text" value="' . $lname . '"><input type="submit" name="search_frc_button" value="Search FraudRecord Module" style="margin-left:10px;"/></form></div>'; }
function wr_get_lic_id_byuser($userid, $serviceid) { $data = select_query("whmcsresellerlicenses", "license_id", array("user_id" => $userid, "prod_id" => $serviceid)); if (mysql_num_rows($data)) { $r = mysql_fetch_array($data); return $r[0]; } }
function calendar_core_todoitems($vars) { $events = array(); $result = select_query("tbltodolist", "", "duedate BETWEEN '" . date("Y-m-d", $vars['start']) . "' AND '" . date("Y-m-d", $vars['end']) . "'"); while ($data = mysql_fetch_assoc($result)) { $events[] = array("id" => "td" . $data['id'], "title" => $data['title'], "start" => strtotime($data['duedate']), "allDay" => true, "editable" => true, "url" => "todolist.php?action=edit&id=" . $data['id']); } return $events; }
function sirportly_settings() { $result = select_query('tbladdonmodules', '', array('module' => 'sirportly')); $settings = array(); while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $settings[$row['setting']] = $row['value']; } return $settings; }
function FetchSupportModule() { $_tableName = "tblconfiguration"; $_fields = "value"; $_where = array("setting" => 'SupportModule'); $_result = select_query($_tableName, $_fields, $_where); $data = mysql_fetch_array($_result); return $data; }
/** * Smarty {oms_bundle_products} function plugin * * Type: function<br> * Name: oms_bundle_products<br> * Date: April 12, 2013<br> * Purpose: Provides OMS bundles with product items sum and with product items names if not defined manually. * @version 1.0 * @param array * @param Smarty * @return Integer logged in user credit amount */ function smarty_function_oms_bundle_products($params, &$smarty) { $bundleId = empty($params['bundleId']) ? null : $params['bundleId']; $groupId = empty($params['groupId']) ? null : $params['groupId']; $smarty->assign('productSum', 0); if ($bundleId && $bundleId) { //Query for bundles $table = "tblbundles"; $fields = "*"; $where = array("gid" => $groupId, "id" => $bundleId); $sort = "id"; $sortorder = "ASC"; $result = select_query($table, $fields, $where, $sort, $sortorder); if ($result) { $productIds = array(); while ($data = mysql_fetch_array($result)) { $itemdata = $data['itemdata']; //find product ids from string $ptn = "*\"pid\";[a-z]:[0-9]+:\"[0-9]+\"*"; preg_match_all($ptn, $itemdata, $matches); foreach ($matches[0] as $match) { $ptnNr = "/[0-9]+\$/"; $str = str_replace("\"", "", $match); preg_match($ptnNr, $str, $matchNr); if ($matchNr) { $productIds[$matchNr[0]]++; } else { logActivity("Error parsing itemdata to get product id."); } } } $productsNames = array(); $sum = 0; foreach ($productIds as $id => $count) { //print_r("Product with id:".$id.", count:".$count); //Query for products $sql = "SELECT DISTINCT * FROM tblproducts product JOIN tblpricing price ON product.id = price.relid WHERE price.type='product' AND product.id = '" . $id . "'"; $query = mysql_query($sql); $product = mysql_fetch_array($query); if ($product) { $sum += $product['monthly'] * $count; $productsNames[] = ($count > 1 ? $count . " x " : '') . $product['name']; } else { logActivity("Error getting product"); } } $smarty->assign('productSum', $sum); $smarty->assign('productNames', $productsNames); //print_r("<PRE>"); //print_r($productIds); //print_r("</PRE>"); } else { logActivity("Error getting bundles products"); } } }
/** * * @ WHMCS FULL DECODED & NULLED * * @ Version : 5.2.15 * @ Author : MTIMER * @ Release on : 2013-12-24 * @ Website : http://www.mtimer.cn * **/ function kbGetCatIds($catid) { global $idnumbers; $result = select_query("tblknowledgebasecats", "id", array("parentid" => $catid, "hidden" => "")); while ($data = mysql_fetch_array($result)) { $cid = $data[0]; $idnumbers[] = $cid; kbGetCatIds($cid); } }
function deletePreDefCat($catid) { $result = select_query("tblticketpredefinedcats", "", array("parentid" => $catid)); while ($data = mysql_fetch_array($result)) { $id = $data['id']; delete_query("tblticketpredefinedreplies", array("catid" => $id)); delete_query("tblticketpredefinedcats", array("id" => $id)); deletePreDefCat($id); } }
public function loadData() { $result = select_query("tblorders", "tblorders.*,tblclients.firstname,tblclients.lastname,tblclients.email,tblclients.companyname,tblclients.address1,tblclients.address2,tblclients.city,tblclients.state,tblclients.postcode,tblclients.country,tblclients.groupid,(SELECT status FROM tblinvoices WHERE id=tblorders.invoiceid) AS invoicestatus", array("tblorders.id" => $this->orderid), "", "", "", "tblclients ON tblclients.id=tblorders.userid"); $data = mysql_fetch_array($result); if (!$data['id']) { return false; } $this->data = $data; return true; }
function gateway_fees_config() { $configarray = array("name" => "Gateway Fees for WHMCS", "description" => "Add fees based on the gateway being used.", "version" => "1.0.1", "author" => "Open Source"); $result = select_query("tblpaymentgateways", "", "", "", ""); while ($data = mysql_fetch_array($result)) { $configarray['fields']["fee_1_" . $data['gateway']] = array("FriendlyName" => $data['gateway'], "Type" => "text", "Default" => "0.00", "Description" => "\$"); $configarray['fields']["fee_2_" . $data['gateway']] = array("FriendlyName" => $data['gateway'], "Type" => "text", "Default" => "0.00", "Description" => "%<br />"); } return $configarray; }
function widget_network_status_gettable() { global $_ADMINLANG; $content = '<div class="fixed-height-container"> <table class="table table-condensed"> <tr style="background-color:#efefef;font-weight:bold;text-align:center"><td>' . $_ADMINLANG['mergefields']['servername'] . '</td><td>HTTP</td><td>' . $_ADMINLANG['home']['load'] . '</td><td>' . $_ADMINLANG['home']['uptime'] . '</td><td>' . $_ADMINLANG['home']['percentuse'] . '</td></tr> '; $id = ''; $result = select_query("tblservers", "", array("disabled" => "0"), "name", "ASC"); while ($data = mysql_fetch_array($result)) { $id = $data["id"]; $name = $data['name']; $ipaddress = $data['ipaddress']; $maxaccounts = $data['maxaccounts']; $statusaddress = $data['statusaddress']; $active = $data['active']; $active = $active ? '*' : ''; $numaccounts = get_query_val("tblhosting", "COUNT(*)", "server='{$id}' AND (domainstatus='Active' OR domainstatus='Suspended')"); $percentuse = @round($numaccounts / $maxaccounts * 100, 0); $http = $serverload = $uptime = "-"; if (isset($_POST['checknetwork'])) { $http = @fsockopen($ipaddress, 80, $errno, $errstr, 5); $http = $http ? "Online" : "Offline"; if ($statusaddress) { $q = $statusaddress . "index.php"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $q); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_TIMEOUT, 5); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); $filecontents = curl_exec($ch); curl_close($ch); preg_match('/\\<load\\>(.*?)\\<\\/load\\>/', $filecontents, $serverload); preg_match('/\\<uptime\\>(.*?)\\<\\/uptime\\>/', $filecontents, $uptime); $serverload = $serverload[1]; $uptime = $uptime[1]; if (!$serverload) { $serverload = "-"; } if (!$uptime) { $uptime = "-"; } } } $content .= '<tr bgcolor="#ffffff"><td align="center">' . $name . '</td><td align="center">' . $http . '</td><td align="center">' . $serverload . '</td><td align="center">' . $uptime . '</td><td align="center">' . $percentuse . '%</td></tr>'; } if (!$id) { $content .= '<tr bgcolor="#ffffff"><td colspan="5" align="center">' . $_ADMINLANG['global']['norecordsfound'] . '</td></tr>'; } $content .= '</table> </div>'; return $content; }
/** * Handles activating and adding client addons to WebsitePanel * * @access public * @param array $params WHMCS parameters * @throws Exception */ function websitepanel_addons_AddonActivation($params) { // WHMCS server parameters & package parameters $userId = $params['userid']; $serviceId = $params['serviceid']; $addonId = $params['addonid']; $result = full_query("SELECT h.username AS username, s.ipaddress AS serverip, s.hostname AS serverhostname, s.secure AS serversecure, s.username AS serverusername, s.password AS serverpassword, p.configoption6 AS configoption6, h.id AS serviceid FROM `tblhosting` AS h, `tblservers` AS s, `tblproducts` AS p, `mod_wspaddons` AS w WHERE h.packageid = p.id AND w.whmcs_id = {$addonId} AND h.id = {$serviceId} AND h.server = s.id AND s.type = 'websitepanel'"); if (mysql_num_rows($result) > 0) { // Get the results of the query $row = mysql_fetch_assoc($result); // Start processing the users addon $username = $row['username']; $serverUsername = $row['serverusername']; $serverPassword = decrypt($row['serverpassword']); $serverPort = $row['configoption6']; $serverHost = empty($row['serverhostname']) ? $row['serverip'] : $row['serverhostname']; $serverSecure = $row['serversecure'] == 'on' ? TRUE : FALSE; try { // Create the WebsitePanel Enterprise Server Client object instance $wsp = new websitepanel_EnterpriseServer($serverUsername, $serverPassword, $serverHost, $serverPort, $serverSecure); // Get the user's details from WebsitePanel - We need the UserId $user = $wsp->getUserByUsername($username); if (empty($user)) { throw new Exception("User {$username} does not exist - Cannot allocate addon for unknown user"); } // Get the user's package details from WebsitePanel - We need the PackageId $package = $wsp->getUserPackages($user['UserId']); $packageId = $package['PackageId']; // Get the associated WebsitePanel addon id $results = select_query('mod_wspaddons', 'wsp_id,is_ipaddress', array('whmcs_id' => $addonId)); $addon = mysql_fetch_array($results); $addonPlanId = $addon['wsp_id']; $addonIsIpAddress = $addon['is_ipaddress']; // Add the Addon Plan to the customer's WebsitePanel package / hosting space $results = $wsp->addPackageAddonById($packageId, $addonPlanId); // Check the results to verify that the addon has been successfully allocated if ($results['Result'] > 0) { // If this addon is an IP address addon - attempt to randomly allocate an IP address to the customer's hosting space if ($addonIsIpAddress) { $wsp->allocatePackageIPAddresses($packageId); } // Add log entry to client log logactivity("WebsitePanel Addon - Account {$username} addon successfully completed - Addon ID: {$addonId}", $userId); } else { // Add log entry to client log throw new Exception("Unknown", $results['Result']); } } catch (Exception $e) { // Error message to log / return $errorMessage = "websitepanel_addons_AddonActivation Fault: (Code: {$e->getCode()}, Message: {$e->getMessage()}, Service ID: {$serviceId})"; // Log to WHMCS logactivity($errorMessage, $userId); } } }
function namecheap_ssl_activate() { // 1. Create configuration email template $result = select_query("tblemailtemplates", "COUNT(*)", array("name" => "SSL Certificate Configuration Required")); $data = mysql_fetch_array($result); if (!$data[0]) { full_query("INSERT INTO `tblemailtemplates` (`type` ,`name` ,`subject` ,`message` ,`fromname` ,`fromemail` ,`disabled` ,`custom` ,`language` ,`copyto` ,`plaintext` )VALUES ('product', 'SSL Certificate Configuration Required', 'SSL Certificate Configuration Required', '<p>Dear {\$client_name},</p><p>Thank you for your order for an SSL Certificate. Before you can use your certificate, it requires configuration which can be done at the URL below.</p><p>{\$ssl_configuration_link}</p><p>Instructions are provided throughout the process but if you experience any problems or have any questions, please open a ticket for assistance.</p><p>{\$signature}</p>', '', '', '', '', '', '', '0')"); } // 2.Create auxiliary module table $queryString = " CREATE TABLE IF NOT EXISTS `mod_namecheapssl` (\r\n `id` INT AUTO_INCREMENT ,\r\n `user_id` INT ,\r\n `certificate_id` INT ,\r\n `type` VARCHAR( 255 ) ,\r\n `status` VARCHAR( 255 ) ,\r\n `creation_date` VARCHAR( 10 ) ,\r\n `period` INT( 1 ) ,\r\n `expiry_date` VARCHAR( 10 ) ,\r\n `domain` VARCHAR( 255 ),\r\n `parse_csr` TEXT,\r\n `admin_email` VARCHAR( 255 ),\r\n PRIMARY KEY ( `id` )\r\n ) ENGINE = MYISAM "; mysql_query($queryString); // 2. Create auxiliary module log table mysql_query("CREATE TABLE IF NOT EXISTS `mod_namecheapssl_log` (\r\n\t`id` INT(10) NOT NULL AUTO_INCREMENT,\r\n\t`date` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',\r\n\t`action` VARCHAR(255) NOT NULL DEFAULT '',\r\n\t`description` TEXT NOT NULL,\r\n\t`user` TEXT NOT NULL,\r\n\t`userid` INT(10) NOT NULL,\r\n\t`ipaddr` TEXT NOT NULL,\r\n\tPRIMARY KEY (`id`)\r\n )\r\n COLLATE='utf8_general_ci'\r\n ENGINE=MyISAM"); // 2. Update existing auxiliary table: add reissue functionality $r = mysql_query("SHOW COLUMNS FROM `mod_namecheapssl` LIKE 'reissue'"); if (0 == mysql_num_rows($r)) { mysql_query("ALTER TABLE `mod_namecheapssl` ADD COLUMN `reissue` TINYINT(1) NULL DEFAULT '0' AFTER `admin_email`"); } // 3. Add reissue invitation letter $r = mysql_query("SELECT id FROM tblemailtemplates WHERE name='SSL Certificate Reissue Invitation'"); if (0 == mysql_num_rows($r)) { mysql_query("INSERT INTO `tblemailtemplates` (`type` ,`name` ,`subject` ,`message` ,`fromname` ,`fromemail` ,`disabled` ,`custom` ,`language` ,`copyto` ,`plaintext` )VALUES ('product', \r\n 'SSL Certificate Reissue Invitation', \r\n 'SSL Certificate Reissue Invitation',\r\n '<p>Dear {\$client_name},</p><p>A reissue request has been initiated by an administrator for the following: {\$ssl_certificate_id}. In order to reissue the certificate please go through a configuration process at the URL below.</p><p>{\$ssl_configuration_link}</p><p>Instructions are provided throughout the process but if you experience any problems or have any questions, please open a ticket for assistance.</p><p>{\$signature}</p>',\r\n '', '', '', '', '', '', '0')"); } namecheap_ssl_check_upgrades(); return array('status' => 'success', 'description' => ''); # Return Result // return array('status'=>'success','description'=>'This is an demo module only. In a real module you might instruct a user how to get started with it here...'); // return array('status'=>'error','description'=>'You can use the error status return to indicate there was a problem activating the module'); }