function get_event_title($start = "") { global $xoopsDB, $xoopsUser, $xoopsConfig; //取得目前使用者可讀的群組 $ok_cate_arr = chk_tad_cal_cate_power('enable_group'); $all_ok_cate = implode(",", $ok_cate_arr); $and_ok_cate = empty($all_ok_cate) ? "and cate_sn='0'" : "and cate_sn in({$all_ok_cate})"; $and_ok_cate2 = empty($all_ok_cate) ? "and a.sn='0'" : "and b.cate_sn in({$all_ok_cate})"; setTimezoneByOffset($xoopsConfig['default_TZ']); $even_start = date("Y-m-d 00:00:00", $start / 1000); $even_end = date("Y-m-d 23:59:59", $start / 1000); //抓出事件 $sql = "select * from " . $xoopsDB->prefix("tad_cal_event") . " where ((`start` >= '{$even_start}' and `start` <= '{$even_end}') or (`end` > '{$even_start}' and `end` <= '{$even_end}')) {$and_ok_cate} order by `start` , `sequence`"; //die($sql); $result = $xoopsDB->query($sql) or web_error($sql); while ($all = $xoopsDB->fetchArray($result)) { //以下會產生這些變數: $sn , $title , $start , $end , $recurrence , $location , $kind , $details , $etag , $id , $sequence , $uid , $cate_sn foreach ($all as $k => $v) { ${$k} = $v; } if (!empty($recurrence)) { continue; } $title_arr[$sn] = $title; } //抓出重複事件 $sql = "select a.*,b.title,b.cate_sn from " . $xoopsDB->prefix("tad_cal_repeat") . " as a join " . $xoopsDB->prefix("tad_cal_event") . " as b on a.sn=b.sn where ((a.`start` >= '{$even_start}' and a.`start` <= '{$even_end}') or (a.`end` > '{$even_start}' and a.`end` <= '{$even_end}')) {$and_ok_cate2} order by a.`start`"; //die($sql); $result = $xoopsDB->queryF($sql) or web_error($sql); while ($all = $xoopsDB->fetchArray($result)) { //以下會產生這些變數: $sn , $title , $start , $end , $recurrence , $location , $kind , $details , $etag , $id , $sequence , $uid , $cate_sn foreach ($all as $k => $v) { ${$k} = $v; } $title_arr[$sn] = $title; } $all = "\n <ul>"; foreach ($title_arr as $sn => $title) { $all .= "<li><a href='" . XOOPS_URL . "/modules/tad_cal/event.php?sn={$sn}' style='text-decoration:none;color:#202020;'>{$title}</a></li>"; } $all .= "</ul>"; return $all; }
/** * Funcion usada para cancelar la transacción cuando no se esta seguro si se realizo o falla el servidor de Vista * @param $data información del pago * @param int $motivo Motivo por el que se esta cancelando la transaccion * Los valores esperados son: * 0: Reverso por time-out * 1: Reverso por que el chip deniega la transacción * 2: Falla en el punto de venta al concluir la transacción * * @return array|bool */ function reverse($data, $motivo = 0, $stan = false) { if ($this->login()) { if (!$stan) { $stan = $this->__getStan(); } //if(isset($this->out)){ //$this->out($stan); //} #pr("stan $stan"); setTimezoneByOffset(-6); $time = date('dmYHis', time()); //date_default_timezone_set("UTC"); $dataText = $this->__buildDataText(array('05' => $data['total'], '21' => $motivo, '64' => 'MX', '65' => '484')); #pr($dataText); $script = APP . "vendors" . DS . "smart_connector" . DS . "encrypt.exe"; #pr($data); $exec = sprintf('mono %s "00=%s" "%s" "%s" "%s" "%s"', $script, $data['number'], $this->__getLastServerKey(), $stan, $time, $this->settings['randomKey']); #pr($exec); $dataCipher = exec($exec); #pr($dataCipher); $xmlString = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\t\t\t<sbt-ws-message version=\"1.0\">\n\t\t\t <header>\n\t\t\t <Type>030800</Type>\n\t\t\t <ClientID>{$this->settings['clientID']}</ClientID>\n\t\t\t <SerialPos>{$this->settings['serialPOS']}</SerialPos>\n\t\t\t <Stan>{$stan}</Stan>\n\t\t\t <DeviceTime>{$time}</DeviceTime>\n\t\t\t </header>\n\t\t\t <message>\n\t\t\t <DataCipher><![CDATA[{$dataCipher})]]></DataCipher>\n\t\t\t <DataText><![CDATA[{$dataText}]]></DataText>\n\t\t\t </message>\n\t\t\t</sbt-ws-message>"; $this->log("[Reverse] Request: " . json_encode(array('Type' => '030800', 'ClientID' => $this->settings['clientID'], 'SerialPos' => $this->settings['serialPOS'], 'Stan' => $stan, 'DeviceTime' => $time)), "SmartConnector"); try { $process = curl_init($this->settings['hosts']); curl_setopt($process, CURLOPT_HTTPHEADER, $this->headers); curl_setopt($process, CURLOPT_HEADER, 0); curl_setopt($process, CURLOPT_TIMEOUT, 30); curl_setopt($process, CURLOPT_POST, 1); curl_setopt($process, CURLOPT_POSTFIELDS, $xmlString); curl_setopt($process, CURLOPT_RETURNTRANSFER, TRUE); $return = curl_exec($process); $xml = new Xml($return); $xmlData = $xml->toArray(); curl_close($process); #pr($xmlData); #$this->log($xmlData,"SmartConnector"); #$xmlData = array(); if (isset($xmlData['Sbt-ws-message']['Header']['Resp-Code'])) { $this->__saveLastStan($stan); $this->__saveCurrentStan($stan + 1); switch ($xmlData['Sbt-ws-message']['Header']['Resp-Code']) { case '00': $this->log("[Reverse] Response: " . json_encode($xmlData['Sbt-ws-message']['Header']) . " | " . json_encode($xmlData['Sbt-ws-message']['Message']), "SmartConnector"); return $xmlData['Sbt-ws-message']['Header']['Resp-Code']; break; default: $messageJSON = isset($xmlData['Sbt-ws-message']['Message']) ? json_encode($xmlData['Sbt-ws-message']['Message']) : ""; $this->log("[Reverse] Response Error: " . json_encode($xmlData['Sbt-ws-message']['Header']) . " | " . $messageJSON, "SmartConnector"); break; } Cache::set(array('duration' => '+1 day')); $transactions = Cache::read("reverse_transactions"); $transactions[] = array('attempts' => 1, 'data' => $data, 'time' => time(), 'last_attempt' => time(), 'motivo' => $motivo, 'working' => false, 'stan' => $stan, 'location_id' => $this->settings['location_id']); Cache::write("reverse_transactions", $transactions); setTimezoneByOffset(-7); return array('error' => true, 'message' => $xmlData['Sbt-ws-message']['Header']['Resp-Message'], 'code' => $xmlData['Sbt-ws-message']['Header']['Resp-Code']); } else { $this->log("[Reverse] Response Error: No hubo respuesta del servidor de smart", "SmartConnector"); /*if(!$nested){ $this->log("Intento reverso (2)","SmartConnector"); return $this->reverse($data,$motivo,true); }*/ Cache::set(array('duration' => '+1 day')); $transactions = Cache::read("reverse_transactions"); $transactions[] = array('attempts' => 1, 'data' => $data, 'time' => time(), 'last_attempt' => time(), 'motivo' => $motivo, 'working' => false, 'stan' => $stan, 'location_id' => $this->settings['location_id']); Cache::set(array('duration' => '+1 day')); Cache::write("reverse_transactions", $transactions); setTimezoneByOffset(-7); return array('error' => true, 'message' => "No hubo respuesta del servidor de smart", 'code' => "-1"); } } catch (Exception $e) { $this->log("[Reverse] Response Error: " . $e->getMessage(), "SmartConnector"); setTimezoneByOffset(-7); return array('error' => true, 'message' => $e->getMessage(), 'code' => "-1"); } } return true; }
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ $networkname = $_SESSION['user']; if (isset($_GET['page'])) { $page = strtolower($_GET['page']); } else { $page = "general"; } $xmlp = simplexml_load_file($dir . "data/" . $networkname . ".xml"); $fc = file_get_contents($dir . "data/" . $networkname . ".xml"); if (strlen($xmlp->management->enable_gmt_offset) > 0) { setTimezoneByOffset($xmlp->management->enable_gmt_offset); } if (!isset($page)) { die("Something strange happened..."); } else { if ($page == "general" && isset($_POST['submit'])) { // If the posted password is the same as the current one, // don't change it. This prevents robin-dash from hashing // the current hashed password into another. :) if ($_POST['networkpass'] == "") { echo ""; } else { if ($_SESSION['user'] == "test") { echo ""; } else { $fc = str_replace("<password>" . $xmlp->robindash->password . "</password>", "<password>" . md5($_POST['networkpass']) . "</password>", $fc);
GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ $networkname = $_SESSION['user']; if(isset($_GET['page'])) {$page = strtolower($_GET['page']);} else {$page = "general";} $xmlp = simplexml_load_file($dir . "data/" . $networkname . ".xml"); $fc = file_get_contents($dir . "data/" . $networkname . ".xml"); if(strlen($xmlp->management->enable_gmt_offset) > 0) {setTimezoneByOffset($xmlp->management->enable_gmt_offset);} if(!isset($page)) {die("Something strange happened...");} else if($page == "general" && isset($_POST['submit'])) { // If the posted password is the same as the current one, // don't change it. This prevents robin-dash from hashing // the current hashed password into another. :) if($_POST['networkpass'] == "") {echo "";} else if($_SESSION['user'] == "test") {echo "";} else { $fc = str_replace("<password>" . $xmlp->robindash->password . "</password>", "<password>" . md5($_POST['networkpass']) . "</password>", $fc); $_SESSION['pass'] = md5($_POST['networkpass']); }
$f = new Folder(APP . 'plugins'); $files = $f->read(); foreach ($files[0] as $file) { if (file_exists(APP . 'plugins' . DS . $file . DS . 'config' . DS . 'bootstrap.php')) { require_once APP . 'plugins' . DS . $file . DS . 'config' . DS . 'bootstrap.php'; } } function setTimezoneByOffset($offset) { $is_DST = FALSE; // observing daylight savings? $timezone_name = timezone_name_from_abbr('', $offset * 3600, $is_DST); // e.g. "America/New_York" date_default_timezone_set($timezone_name); } setTimezoneByOffset(-7); #pr(date("Y-m-d H:i:s")); /** * Funcion que devuelve un array con los valores: * os => sistema operativo * browser => navegador * version => version del navegador */ function detectBrowser() { $browser = array("IE", "OPERA", "MOZILLA", "NETSCAPE", "FIREFOX", "SAFARI", "CHROME"); $os = array("WIN", "MAC", "LINUX"); # definimos unos valores por defecto para el navegador y el sistema operativo $info['browser'] = "OTHER"; $info['os'] = "OTHER"; # buscamos el navegador con su sistema operativo