Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- *
- * @ This file is created by deZender.Net
- * @ deZender (PHP5 Decoder for ionCube Loader)
- *
- * @ Version : 2.0.0.4
- * @ Author : DeZender
- * @ Release on : 21.10.2015
- * @ Official site : http://DeZender.Net
- *
- */
- if (!(defined("_JEXEC")))
- {
- exit();
- }
- abstract class SttbillingHelper {
- private static $_arStr = null;
- private static $_key = null;
- private static $_ok = -1;
- public static function addSubmenu($submenu) {
- JSubMenuHelper::addEntry(JText::_("COM_STTBILLING_BALANCES"), "index.php?option=com_sttbilling&view=balances", $submenu == "balances");
- JSubMenuHelper::addEntry(JText::_("COM_STTBILLING_BALANCELOGS"), "index.php?option=com_sttbilling&view=balancelogs", $submenu == "balancelogs");
- JSubMenuHelper::addEntry(JText::_("COM_STTBILLING_PROFILES"), "index.php?option=com_sttbilling&view=profiles", $submenu == "profiles");
- JSubMenuHelper::addEntry(JText::_("COM_STTBILLING_RETARIFS"), "index.php?option=com_sttbilling&view=retarifs", $submenu == "retarifs");
- JSubMenuHelper::addEntry(JText::_("COM_STTBILLING_REACTIV"), "index.php?option=com_sttbilling&task=active.formactive", $submenu == "reactiv");
- return;
- }
- public static function title($txt, $icon = "generic.png") {
- if (self::checkOk())
- {
- JToolBarHelper::title($txt, $icon);
- }
- else
- {
- JToolBarHelper::title("<a href=\"" . JURI::root() . "administrator/index.php?option=com_sttbilling&task=active.formactive\" style=\"color:red;\">" . JText::_("COM_STTBILLING_ACTIVE_PLEASE") . "</a>", $icon);
- }
- return;
- }
- public static function getActions() {
- $user = JFactory::getUser();
- $result = new JObject();
- $assetName = "com_sttbilling";
- $actions = array("core.create", "core.edit", "core.delete");
- foreach ($actions as $action)
- {
- $result->set($action, $user->authorise($action, $assetName));
- continue;
- }
- return $result;
- }
- public static function getProfileOptions($opt0 = "") {
- $options = array();
- if ($opt0)
- {
- $options[] = array("text" => $opt0, "value" => "");
- }
- if (self::checkOk())
- {
- $a = self::_(1);
- $db = JFactory::$a();
- $q = self::_(3);
- $q .= " ORDER BY a.name ASC ";
- $db->setQuery($q);
- $items = $db->loadObjectList();
- if (count($items))
- {
- foreach ($items as $item)
- {
- $itemarr = array();
- $itemarr["value"] = $item->value;
- $itemarr["text"] = $item->text;
- $options[] = $itemarr;
- continue;
- }
- }
- }
- if (!count($options))
- {
- $options[] = array("text" => JText::_("COM_STTBILLING_NOTARIF"), "value" => "0");
- }
- return $options;
- }
- public static function getStatusOptions($opt0 = "") {
- $options = array();
- if ($opt0)
- {
- $options[] = array("text" => $opt0, "value" => "");
- }
- $options[] = array("text" => JText::_("COM_STTBILLING_STATUS0"), "value" => "0");
- $options[] = array("text" => JText::_("COM_STTBILLING_STATUS1"), "value" => "1");
- $options[] = array("text" => JText::_("COM_STTBILLING_STATUS2"), "value" => "2");
- $options[] = array("text" => JText::_("COM_STTBILLING_STATUS3"), "value" => "3");
- return $options;
- }
- public static function updateBalance($userid, $sum, $item = null) {
- if (!self::checkOk())
- {
- return false;
- }
- $f = 0 + str_replace(",", ".", $sum);
- if (!$userid)
- {
- return false;
- }
- $a = self::_(1);
- $db = JFactory::$a();
- if (!$item)
- {
- $db->setQuery("select * from #__sttbilling_balance where user_id=" . $db->quote($userid));
- $k = self::_(2);
- $bal = $db->$k();
- }
- else
- {
- $bal = $item;
- }
- if ($bal)
- {
- if ($f < 0 && $bal->summa + $f < 0)
- {
- return false;
- }
- $sql = self::_(4) . $f . ") where user_id=" . $db->quote($userid);
- $db->setQuery($sql);
- $db->execute();
- }
- else
- {
- $params = JComponentHelper::getParams("com_sttbilling");
- $profileid = $params->get("defprofile", 1);
- $db->setQuery("insert into #__sttbilling_balance (user_id, profile_id, summa, modified) values (" . $db->quote($userid) . "," . $db->quote($profileid) . "," . $db->quote($f) . ", now())");
- $db->execute();
- }
- self::checkEnddate($userid);
- return true;
- }
- public static function putMoney($userid, $sum, $prim, $tobalance = true) {
- if (!self::checkOk())
- {
- return false;
- }
- $f = 0 + str_replace(",", ".", $sum);
- if (!$userid)
- {
- return false;
- }
- if (!$prim)
- {
- return false;
- }
- $a = self::_(1);
- $db = JFactory::$a();
- if ($tobalance)
- {
- $db->setQuery("select * from #__sttbilling_balance where user_id=" . $db->quote($userid));
- $k = self::_(2);
- $bal = $db->$k();
- if ($f < 0 && $bal->summa + $f < 0)
- {
- return false;
- }
- }
- $q = self::_(5);
- $db->setQuery($q . $db->quote($userid) . "," . $db->quote($prim) . "," . $db->quote($f) . "," . "3,NOW())");
- $db->execute();
- if ($tobalance)
- {
- self::updateBalance($userid, $sum, $bal);
- }
- ...................................................................................................................
- ...........................................................
- ..............
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement