PageRenderTime 53ms CodeModel.GetById 27ms RepoModel.GetById 1ms app.codeStats 0ms

/class/conf.php

https://gitlab.com/m.mirsamie/arad_hotel
PHP | 220 lines | 184 code | 0 blank | 36 comment | 35 complexity | 46513e6d42c113c75e7318b15f9b23bb MD5 | raw file
  1. <?php
  2. class conf
  3. {
  4. public $host = "localhost";
  5. public $db = "arad";
  6. public $user = "root";
  7. public $pass = "3068145";
  8. public $date_off = "0:00";
  9. // public $title = "سامانه رزرواسیون هتل بهار";
  10. public $room_select = TRUE;
  11. public $enableTafzili = FALSE;
  12. public $decStartGaant = '5';
  13. public $addEndGaant = '5';
  14. public $limitDate = '12/29';
  15. public $db_eliminator = '-';
  16. public $mellat_wsdl='https://pgws.bpm.bankmellat.ir/pgwchannel/services/pgw?wsdl';
  17. public $mellat_namespace='http://interfaces.core.sw.bps.com/';
  18. public $mellat_terminalId='847703';
  19. public $mellat_userName='gcom';
  20. public $mellat_userPassword='gcom1338';
  21. public $mellat_callBackUrl='http://bahar.gcom.ir/main/purchase.php';
  22. public $mellat_payPage = 'https://pgw.bpm.bankmellat.ir/pgwchannel/startpay.mellat';
  23. public $limit_sanad_time = '38';
  24. public $upYear = 1393;
  25. public $vorood = TRUE;
  26. public $anbar = TRUE;
  27. public $sms = TRUE;
  28. public $login = 'mmcomp';
  29. public $password = 'tammar';
  30. public $from = '30007546000296';
  31. public $wsdl = 'http://www.payam-resan.com/APISend.aspx?';
  32. public $limitDatelimit_sanad_time = '9000';
  33. //public $limitDatelimit_sanad_time = 100000000000000;
  34. /*public $sms = TRUE;
  35. public $login = 'smssaaed';
  36. public $password = '159753';
  37. public $from = '30001825000145';
  38. public $wsdl = 'http://sms-ir.ir/webservice/?wsdl';
  39. /* public $start_vorood = '1390/12/01';
  40. public $ws_user = 'mehrdad';
  41. public $ws_pass = '31048145';
  42. public $reserve_timeout = 10;
  43. public $limit_sanad_time = '38';//مهلت ویرایش سند پس از روز سند به ساعت منفی یک یعنی نامحدود
  44. public $daftar_send_date = "2012-04-10 23:59:59";
  45. public $min_saghf_kharid = 1;
  46. public $ajans_saghf_mande = TRUE;
  47. public $zamaiem = TRUE;
  48. public $vacher_mablagh = TRUE;
  49. public $room_vaziat = TRUE;
  50. public $limit_daftar = 1;
  51. public $limit_ajans = 10;
  52. public $limit_hotel = 1;
  53. public $limit_kol_user = 10;
  54. public $limit_ajans_user = 1;
  55. public $limit_paziresh_day = 1;
  56. public $hesab_auto = TRUE;
  57. public $cost_control = TRUE;
  58. public $front_office_enabled = FALSE;
  59. */
  60. public function __get($key)
  61. {
  62. $out = '';
  63. if(property_exists(__CLASS__,$key))
  64. $out = $this->$key;
  65. else
  66. {
  67. mysql_class::ex_sql("select `value` from `conf` where `key` = '$key'",$q);
  68. if($r = mysql_fetch_array($q))
  69. $out = $r['value'];
  70. if($out == 'TRUE')
  71. $out = TRUE;
  72. else if($out == 'FALSE')
  73. $out = FALSE;
  74. }
  75. return($out);
  76. }
  77. public function __set($key,$value)
  78. {
  79. if($value===TRUE)
  80. $value = 'TRUE';
  81. if($value===FALSE)
  82. $value = 'FALSE';
  83. if(property_exists(__CLASS__,$key))
  84. $this->key = $value;
  85. else
  86. {
  87. mysql_class::ex_sql("select `value` from `conf` where `key` = '$key'",$q);
  88. if($r = mysql_fetch_array($q))
  89. mysql_class::ex_sqlx("update `conf` set `value` = '$value' where `key` = '$key'");
  90. else
  91. mysql_class::ex_sqlx("insert into `conf` (`key`,`value`) values ('$key','$value')");
  92. }
  93. }
  94. public function checkWsdl($ws_user,$ws_pass)
  95. {
  96. session_unset();
  97. $out = FALSE;
  98. $moshtari_id_main = -1;
  99. $q = NULL;
  100. $db = $this->db;
  101. $sql = "select `id` from `moshtari`";
  102. $conn = mysql_connect($this->host,$this->user,$this->pass);
  103. if(!($conn==FALSE)){
  104. if(!(mysql_select_db($db,$conn)==FALSE)){
  105. mysql_query("SET NAMES 'utf8'");
  106. $q = mysql_query($sql,$conn);
  107. mysql_close($conn);
  108. }
  109. }
  110. while($r = mysql_fetch_array($q))
  111. {
  112. $moshtari_id_tmp = (int)$r['id'];
  113. $qq = NULL;
  114. $db = $this->db.$this->db_eliminator.$moshtari_id_tmp;
  115. $sql = "select `id` from `conf` where `key` = 'ws_user' and MD5(`value`) = '$ws_user'";
  116. $conn = mysql_connect($this->host,$this->user,$this->pass);
  117. if(!($conn==FALSE)){
  118. if(!(mysql_select_db($db,$conn)==FALSE)){
  119. mysql_query("SET NAMES 'utf8'");
  120. $qq = mysql_query($sql,$conn);
  121. mysql_close($conn);
  122. }
  123. }
  124. if($qq != NULL)
  125. if($rr = mysql_fetch_array($qq))
  126. {
  127. $qqq = NULL;
  128. $sql = "select `id` from `conf` where `key` = 'ws_pass' and MD5(`value`) = '$ws_pass'";
  129. $conn = mysql_connect($this->host,$this->user,$this->pass);
  130. if(!($conn==FALSE)){
  131. if(!(mysql_select_db($db,$conn)==FALSE)){
  132. mysql_query("SET NAMES 'utf8'");
  133. $qqq = mysql_query($sql,$conn);
  134. mysql_close($conn);
  135. }
  136. }
  137. if($qqq != NULL)
  138. if($rrr = mysql_fetch_array($qqq))
  139. {
  140. $moshtari_id_main = $moshtari_id_tmp;
  141. $out = TRUE;
  142. }
  143. }
  144. }
  145. if($moshtari_id_main > 0)
  146. conf::setMoshtari($moshtari_id_main);
  147. return($out);
  148. }
  149. public function hesab($indx)
  150. {
  151. $h = array("group_id"=>null,"kol_id"=>"کل","moeen_id"=>"معین","tafzili_id"=>null,"tafzili2_id"=>null,"tafzilishenavar_id"=>null,"tafzilishenavar2_id"=>null);
  152. return($h[$indx]);
  153. }
  154. public function hesabKol()
  155. {
  156. $h = array("group_id"=>null,"kol_id"=>"کل","moeen_id"=>"معین","tafzili_id"=>null,"tafzili2_id"=>null,"tafzilishenavar_id"=>null,"tafzilishenavar2_id"=>null);
  157. return($h);
  158. }
  159. public function setMoshtari($moshtari_id)
  160. {
  161. $out = FALSE;
  162. $matn_sharj = 0;
  163. $moshtari_id = (int)$moshtari_id;
  164. $moshtari = new moshtari_class($moshtari_id);
  165. $today = date("Y-m-d");
  166. $aztarikh = $moshtari->aztarikh;
  167. //echo $aztarikh;
  168. $t_pardakhti = $moshtari->tedadpardakhti;
  169. $mablagh = $moshtari->mablagh;
  170. $aztarikh = explode(' ',$aztarikh);
  171. $aztarikh = $aztarikh[0];
  172. $diff = strtotime($today) - strtotime($aztarikh);
  173. $years = floor($diff / (365*60*60*24));
  174. $months = floor(($diff - $years * 365*60*60*24) / (30*60*60*24));
  175. $modat_gharardad = $months;
  176. //echo $modat_gharardad;
  177. // $sharj_mablagh = $modat_gharardad * $mablagh;
  178. // $tedad_pardakht = $sharj_mablagh / $mablagh;
  179. $bedehi = ($modat_gharardad - $t_pardakhti)+1;
  180. if ($bedehi > 0)
  181. $matn_sharj =(int) $bedehi * $mablagh;
  182. else
  183. $matn_sharj = 0;
  184. //echo $matn_sharj;
  185. // $modat_gharardad = 1;
  186. // $bedehi = ($modat_gharardad - $t_pardakhti)+1;
  187. // $matn_sharj = $bedehi * $mablagh;
  188. if($moshtari->id>0 || $moshtari_id == -1)
  189. $out = TRUE;
  190. if($out)
  191. {
  192. $_SESSION['moshtari_id'] = $moshtari_id;
  193. $_SESSION['matn_sharj'] =(int) $matn_sharj;
  194. $_SESSION['bedehi'] = $bedehi;
  195. }
  196. else if($moshtari_id == -1)
  197. {
  198. $_SESSION['moshtari_id'] = '';
  199. $_SESSION['matn_sharj'] = '';
  200. $_SESSION['bedehi'] = '';
  201. }
  202. return($out);
  203. }
  204. public function getMoshtari()
  205. {
  206. $out = '';
  207. if(isset($_SESSION['moshtari_id']) && (int)$_SESSION['moshtari_id'] > 0)
  208. $out = (int)$_SESSION['moshtari_id'];
  209. return($out);
  210. }
  211. public function limitChange()
  212. {
  213. $out = '';
  214. mysql_class::ex_sql("select * from `conf` where `id`='40'",$q);
  215. if($r=mysql_fetch_array($q))
  216. $out = $r['value'];
  217. return($out);
  218. }
  219. }
  220. ?>