Advertisement
Guest User

Untitled

a guest
Mar 16th, 2017
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.11 KB | None | 0 0
  1. <?php
  2. /**
  3. *
  4. * @ This file is created by deZender.Net
  5. * @ deZender (PHP5 Decoder for ionCube Loader)
  6. *
  7. * @ Version : 2.0.0.4
  8. * @ Author : DeZender
  9. * @ Release on : 21.10.2015
  10. * @ Official site : http://DeZender.Net
  11. *
  12. */
  13.  
  14. if (!(defined("_JEXEC")))
  15. {
  16. exit();
  17. }
  18.  
  19.  
  20. abstract class SttbillingHelper {
  21.  
  22.  
  23. private static $_arStr = null;
  24. private static $_key = null;
  25. private static $_ok = -1;
  26. public static function addSubmenu($submenu) {
  27.  
  28. JSubMenuHelper::addEntry(JText::_("COM_STTBILLING_BALANCES"), "index.php?option=com_sttbilling&amp;view=balances", $submenu == "balances");
  29. JSubMenuHelper::addEntry(JText::_("COM_STTBILLING_BALANCELOGS"), "index.php?option=com_sttbilling&amp;view=balancelogs", $submenu == "balancelogs");
  30. JSubMenuHelper::addEntry(JText::_("COM_STTBILLING_PROFILES"), "index.php?option=com_sttbilling&amp;view=profiles", $submenu == "profiles");
  31. JSubMenuHelper::addEntry(JText::_("COM_STTBILLING_RETARIFS"), "index.php?option=com_sttbilling&amp;view=retarifs", $submenu == "retarifs");
  32. JSubMenuHelper::addEntry(JText::_("COM_STTBILLING_REACTIV"), "index.php?option=com_sttbilling&task=active.formactive", $submenu == "reactiv");
  33. return;
  34. }
  35.  
  36. public static function title($txt, $icon = "generic.png") {
  37.  
  38. if (self::checkOk())
  39. {
  40. JToolBarHelper::title($txt, $icon);
  41. }
  42. else
  43. {
  44. 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);
  45. }
  46. return;
  47. }
  48.  
  49. public static function getActions() {
  50.  
  51. $user = JFactory::getUser();
  52. $result = new JObject();
  53. $assetName = "com_sttbilling";
  54. $actions = array("core.create", "core.edit", "core.delete");
  55. foreach ($actions as $action)
  56. {
  57. $result->set($action, $user->authorise($action, $assetName));
  58. continue;
  59. }
  60. return $result;
  61. }
  62.  
  63. public static function getProfileOptions($opt0 = "") {
  64.  
  65. $options = array();
  66. if ($opt0)
  67. {
  68. $options[] = array("text" => $opt0, "value" => "");
  69. }
  70. if (self::checkOk())
  71. {
  72. $a = self::_(1);
  73. $db = JFactory::$a();
  74. $q = self::_(3);
  75. $q .= " ORDER BY a.name ASC ";
  76. $db->setQuery($q);
  77. $items = $db->loadObjectList();
  78. if (count($items))
  79. {
  80. foreach ($items as $item)
  81. {
  82. $itemarr = array();
  83. $itemarr["value"] = $item->value;
  84. $itemarr["text"] = $item->text;
  85. $options[] = $itemarr;
  86. continue;
  87. }
  88. }
  89. }
  90. if (!count($options))
  91. {
  92. $options[] = array("text" => JText::_("COM_STTBILLING_NOTARIF"), "value" => "0");
  93. }
  94. return $options;
  95. }
  96.  
  97. public static function getStatusOptions($opt0 = "") {
  98.  
  99. $options = array();
  100. if ($opt0)
  101. {
  102. $options[] = array("text" => $opt0, "value" => "");
  103. }
  104. $options[] = array("text" => JText::_("COM_STTBILLING_STATUS0"), "value" => "0");
  105. $options[] = array("text" => JText::_("COM_STTBILLING_STATUS1"), "value" => "1");
  106. $options[] = array("text" => JText::_("COM_STTBILLING_STATUS2"), "value" => "2");
  107. $options[] = array("text" => JText::_("COM_STTBILLING_STATUS3"), "value" => "3");
  108. return $options;
  109. }
  110.  
  111. public static function updateBalance($userid, $sum, $item = null) {
  112.  
  113. if (!self::checkOk())
  114. {
  115. return false;
  116. }
  117. $f = 0 + str_replace(",", ".", $sum);
  118. if (!$userid)
  119. {
  120. return false;
  121. }
  122. $a = self::_(1);
  123. $db = JFactory::$a();
  124. if (!$item)
  125. {
  126. $db->setQuery("select * from #__sttbilling_balance where user_id=" . $db->quote($userid));
  127. $k = self::_(2);
  128. $bal = $db->$k();
  129. }
  130. else
  131. {
  132. $bal = $item;
  133. }
  134. if ($bal)
  135. {
  136. if ($f < 0 && $bal->summa + $f < 0)
  137. {
  138. return false;
  139. }
  140. $sql = self::_(4) . $f . ") where user_id=" . $db->quote($userid);
  141. $db->setQuery($sql);
  142. $db->execute();
  143. }
  144. else
  145. {
  146. $params = JComponentHelper::getParams("com_sttbilling");
  147. $profileid = $params->get("defprofile", 1);
  148. $db->setQuery("insert into #__sttbilling_balance (user_id, profile_id, summa, modified) values (" . $db->quote($userid) . "," . $db->quote($profileid) . "," . $db->quote($f) . ", now())");
  149. $db->execute();
  150. }
  151. self::checkEnddate($userid);
  152. return true;
  153. }
  154.  
  155. public static function putMoney($userid, $sum, $prim, $tobalance = true) {
  156.  
  157. if (!self::checkOk())
  158. {
  159. return false;
  160. }
  161. $f = 0 + str_replace(",", ".", $sum);
  162. if (!$userid)
  163. {
  164. return false;
  165. }
  166. if (!$prim)
  167. {
  168. return false;
  169. }
  170. $a = self::_(1);
  171. $db = JFactory::$a();
  172. if ($tobalance)
  173. {
  174. $db->setQuery("select * from #__sttbilling_balance where user_id=" . $db->quote($userid));
  175. $k = self::_(2);
  176. $bal = $db->$k();
  177. if ($f < 0 && $bal->summa + $f < 0)
  178. {
  179. return false;
  180. }
  181. }
  182. $q = self::_(5);
  183. $db->setQuery($q . $db->quote($userid) . "," . $db->quote($prim) . "," . $db->quote($f) . "," . "3,NOW())");
  184. $db->execute();
  185. if ($tobalance)
  186. {
  187. self::updateBalance($userid, $sum, $bal);
  188. }
  189. ...................................................................................................................
  190. ...........................................................
  191. ..............
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement