Example #1
0
function demoapp()
{
    $sharedkey = 'abrakadabra';
    $corto = join("/", array_slice(explode("/", 'http' . (nvl($_SERVER, 'HTTPS') ? 's' : '') . '://' . $_SERVER['HTTP_HOST'] . $_SERVER['SCRIPT_NAME']), 0, -1));
    $self = $corto . '/index.php';
    $corto = $corto . '/corto.php';
    if (isset($_POST['doslo'])) {
        $request = array('__t' => 'samlp:LogoutRequest', '_ID' => ID(), '_Version' => '2.0', '_IssueInstant' => gmdate('Y-m-d\\TH:i:s\\Z', time()), '_Destination' => "{$corto}/sp/Mads/SLO", 'saml:Issuer' => array('__v' => $self), 'saml:NameID' => json_decode(stripcslashes($_POST['subject']), 1), '_NotOnOrAfter' => timeStamp(10));
        $location = $request['_Destination'];
        $location .= "?SAMLRequest=" . urlencode(base64_encode(gzdeflate(json_encode($request))));
        print render('redirect', array('location' => $location, 'message' => $request));
        exit;
    }
    if (isset($_POST['doit'])) {
        $idp = empty($_POST['idp']) ? NULL : $_POST['idp'];
        if (!$idp) {
            $idp = "sp";
        }
        $request = array('_ID' => ID(), '_Version' => '2.0', '_IssueInstant' => gmdate('Y-m-d\\TH:i:s\\Z', time()), '_Destination' => "{$corto}/{$idp}/Mads", '_ForceAuthn' => !empty($_REQUEST['ForceAuthn']) ? 'true' : 'false', '_IsPassive' => !empty($_REQUEST['IsPassive']) ? 'true' : 'false', 'AssertionConsumerServiceIndex' => 0, '_AttributeConsumingServiceIndex' => 5, '_ProtocolBinding' => 'JSON-Redirect', 'saml:Issuer' => array('__v' => $self));
        if (!empty($_REQUEST['IDPList'])) {
            foreach ((array) $_REQUEST['IDPList'] as $idp) {
                $idpList[] = array('_ProviderID' => $idp);
                $request['samlp:Scoping']['samlp:IDPList']['samlp:IDPEntry'] = $idpList;
            }
        }
        $relayState = 'Dummy RelayState ...';
        #$request['samlp:Scoping']['_ProxyCount'] = 2;
        $location = $request['_Destination'];
        $location .= "?SAMLRequest=" . urlencode(base64_encode(gzdeflate(json_encode($request)))) . ($relayState ? '&RelayState=' . urlencode($relayState) : '');
        print render('redirect', array('location' => $location, 'message' => $request));
        exit;
    }
    $relayState = $rs = $message = null;
    $response = nvl($_GET, 'SAMLResponse');
    $SAMLResponse = json_decode(gzinflate(base64_decode($response)), 1);
    if (isset($_POST['RelayState']) && ($rs = $_POST['RelayState'])) {
        $rs = '&RelayState=' . $rs;
    }
    print render('demo', array('action' => $self, 'SAMLResponse' => $SAMLResponse, 'message' => "RelayState: " . nvl($_GET, 'RelayState'), 'self' => $self));
}
Example #2
0
function tenderReport()
{
    $db_a = mDataConnect();
    $blank = "             ";
    $eosQ = "select max(tdate) from dlog where register_no = " . $_SESSION["laneno"] . " and upc = 'ENDOFSHIFT'";
    $eosR = mysql_query($eosQ);
    $num_rows = mysql_num_rows($eosR);
    if ($num_rows > 0) {
        $row = mysql_fetch_row($eosR);
        $EOS = $row[0];
    } else {
        $EOS = '2007-08-01 12:00:00';
        // probably could change...
    }
    $query_ckq = "select * from cktenders where tdate > '" . $EOS . "' and register_no = " . $_SESSION["laneno"] . " order by emp_no, tdate";
    $query_ccq = "select * from cctenders where tdate > '" . $EOS . "' and register_no = " . $_SESSION["laneno"] . " order by emp_no, tdate";
    $query_dcq = "select * from dctenders where tdate > '" . $EOS . "' and register_no = " . $_SESSION["laneno"] . " order by emp_no, tdate";
    $query_miq = "select * from mitenders where tdate > '" . $EOS . "' and register_no = " . $_SESSION["laneno"] . " order by emp_no, tdate";
    $query_bp = "select * from buspasstotals where tdate > '" . $EOS . "' and register_no = " . $_SESSION["laneno"] . " order by emp_no, tdate";
    $fieldNames = "  " . substr("Time" . $blank, 0, 10) . substr("Lane" . $blank, 0, 7) . substr("Trans #" . $blank, 0, 6) . substr("Emp #" . $blank, 0, 8) . substr("Change" . $blank, 0, 10) . substr("Amount" . $blank, 0, 10) . "\n";
    $ref = centerString(trim($_SESSION["CashierNo"]) . "-" . trim($_SESSION['laneno']) . " " . trim($_SESSION["cashier"]) . " " . build_time(time())) . "\n";
    $receipt .= chr(27) . chr(33) . chr(5) . centerString("T E N D E R  R E P O R T") . "\n";
    $receipt .= $ref;
    $receipt .= centerString("------------------------------------------------------");
    $receipt .= str_repeat("\n", 2);
    $netQ = "SELECT SUM(total) AS net\r\n        from dlog\r\n        where tdate > '" . $EOS . "'\r\n        and register_no = " . $_SESSION['laneno'] . "\r\n        and trans_type IN('I','D')\r\n        and trans_subtype <> 'IC'\r\n        AND emp_no <> 9999";
    $netR = mysql_query($netQ);
    $row = mysql_fetch_row($netR);
    $receipt .= "  " . substr("NET Total: " . $blank . $blank, 0, 20);
    $receipt .= substr($blank . number_format($row[0], 2), -8) . "\n";
    $receipt .= "\n";
    $tendertotalsQ = "SELECT t.TenderName as tender_type,ROUND(-sum(d.total),2) as total,COUNT(*) as count\r\n        FROM dlog d RIGHT JOIN is4c_op.tenders t\r\n        ON d.trans_subtype = t.TenderCode\r\n        AND tdate > '" . $EOS . "'\r\n        AND register_no = " . $_SESSION['laneno'] . " \r\n        AND d.emp_no <> 9999\r\n        GROUP BY t.TenderName";
    $results_ttq = mysql_query($tendertotalsQ);
    while ($row = mysql_fetch_row($results_ttq)) {
        if (!isset($row[0])) {
            $receipt .= "NULL";
        } else {
            $receipt .= "  " . substr($row[0] . $blank . $blank, 0, 20);
        }
        if (!isset($row[1])) {
            $receipt .= "    0.00";
        } else {
            $receipt .= substr($blank . number_format($row[1], 2), -8);
        }
        if (!isset($row[2])) {
            $receipt .= "NULL";
        } else {
            if (!isset($row[1])) {
                $row[2] = 0;
            }
            $receipt .= substr($blank . $row[2], -4, 4);
        }
        $receipt .= "\n";
    }
    $receipt .= "\n";
    $cack_tot = "SELECT ROUND(SUM(total),2) AS gross\r\n        FROM dlog\r\n        WHERE tdate > '" . $EOS . "'\r\n        AND register_no = " . $_SESSION['laneno'] . "\r\n        AND trans_subtype IN ('CA','CK')";
    $results_tot = mysql_query($cack_tot);
    $row = mysql_fetch_row($results_tot);
    $receipt .= "  " . substr("CA & CK Total: " . $blank . $blank, 0, 20);
    $receipt .= substr($blank . number_format($row[0] * -1, 2), -8) . "\n";
    $card_tot = "SELECT ROUND(SUM(total),2) AS gross\r\n        FROM dlog\r\n        WHERE tdate > '" . $EOS . "'\r\n        AND register_no = " . $_SESSION['laneno'] . "\r\n        AND trans_subtype IN ('DC','CC','FS','EC')";
    $results_tot = mysql_query($card_tot);
    $row = mysql_fetch_row($results_tot);
    $receipt .= "  " . substr("DC / CC / EBT Total: " . $blank . $blank, 0, 20);
    $receipt .= substr($blank . number_format($row[0] * -1, 2), -8) . "\n";
    $hchrg_tot = "SELECT ROUND(SUM(total),2) AS gross\r\n        FROM dlog\r\n        WHERE tdate > '" . $EOS . "'\r\n        AND register_no = " . $_SESSION['laneno'] . "\r\n        AND trans_subtype = 'MI'\r\n        AND card_no <> 9999";
    $results_tot = mysql_query($hchrg_tot);
    $row = mysql_fetch_row($results_tot);
    $receipt .= "  " . substr("House Charge Total: " . $blank . $blank, 0, 20);
    $receipt .= substr($blank . number_format($row[0] * -1, 2), -8) . "\n";
    $schrg_tot = "SELECT ROUND(SUM(total),2) AS gross\r\n        FROM dlog\r\n        WHERE tdate > '" . $EOS . "'\r\n        AND register_no = " . $_SESSION['laneno'] . "\r\n        AND trans_subtype = 'MI'\r\n        AND card_no = 9999";
    $results_tot = mysql_query($schrg_tot);
    $row = mysql_fetch_row($results_tot);
    $receipt .= "  " . substr("Store Charge Total: " . $blank . $blank, 0, 20);
    $receipt .= substr($blank . number_format($row[0] * -1, 2), -8);
    $receipt .= str_repeat("\n", 5);
    // apbw/tt 3/16/05 Franking II
    $receipt .= chr(27) . chr(33) . chr(5) . centerString("C H E C K   T E N D E R S") . "\n";
    $receipt .= centerString("------------------------------------------------------");
    $result_ckq = sql_query($query_ckq, $db_a);
    $num_rows_ckq = sql_num_rows($result_ckq);
    if ($num_rows_ckq > 0) {
        $receipt .= $fieldNames;
        for ($i = 0; $i < $num_rows_ckq; $i++) {
            $row_ckq = sql_fetch_array($result_ckq);
            $timeStamp = timeStamp($row_ckq["tdate"]);
            $receipt .= "  " . substr($timeStamp . $blank, 0, 10) . substr($row_ckq["register_no"] . $blank, 0, 7) . substr($row_ckq["trans_no"] . $blank, 0, 6) . substr($row_ckq["emp_no"] . $blank, 0, 6) . substr($blank . number_format($row_ckq["changeGiven"], 2), -10) . substr($blank . number_format($row_ckq["ckTender"], 2), -10) . "\n";
        }
        $receipt .= centerString("------------------------------------------------------");
        $query_ckq = "select SUM(ckTender) from cktenders where tdate > '" . $EOS . "' and register_no = " . $_SESSION["laneno"];
        $result_ckq = sql_query($query_ckq, $db_a);
        $row_ckq = sql_fetch_array($result_ckq);
        $receipt .= substr($blank . $blank . $blank . $blank . "Total: " . number_format($row_ckq[0], 2), -56) . "\n";
    } else {
        $receipt .= "\n\n" . centerString(" * * *   N O N E   * * * ") . "\n\n" . centerString("------------------------------------------------------");
    }
    $receipt .= str_repeat("\n", 3);
    // apbw/tt 3/16/05 Franking II
    $receipt .= chr(27) . chr(33) . chr(5) . centerString("D E B I T  C A R D  T E N D E R S") . "\n";
    $receipt .= centerString("------------------------------------------------------");
    $result_dcq = sql_query($query_dcq, $db_a);
    $num_rows_dcq = sql_num_rows($result_dcq);
    if ($num_rows_dcq > 0) {
        $receipt .= $fieldNames;
        for ($i = 0; $i < $num_rows_dcq; $i++) {
            $row_dcq = sql_fetch_array($result_dcq);
            $timeStamp = timeStamp($row_dcq["tdate"]);
            $receipt .= "  " . substr($timeStamp . $blank, 0, 10) . substr($row_dcq["register_no"] . $blank, 0, 7) . substr($row_dcq["trans_no"] . $blank, 0, 6) . substr($row_dcq["emp_no"] . $blank, 0, 6) . substr($blank . number_format($row_dcq["changeGiven"], 2), -10) . substr($blank . number_format($row_dcq["dcTender"], 2), -10) . "\n";
        }
        $receipt .= centerString("------------------------------------------------------");
        $query_dcq = "select SUM(dcTender) from dctenders where tdate > '" . $EOS . "' and register_no = " . $_SESSION["laneno"];
        $result_dcq = sql_query($query_dcq, $db_a);
        $row_dcq = sql_fetch_array($result_dcq);
        $receipt .= substr($blank . $blank . $blank . $blank . "Total: " . number_format($row_dcq[0], 2), -56) . "\n";
    } else {
        $receipt .= "\n\n" . centerString(" * * *   N O N E   * * * ") . "\n\n" . centerString("------------------------------------------------------");
    }
    $receipt .= str_repeat("\n", 3);
    // apbw/tt 3/16/05 Franking II
    $receipt .= chr(27) . chr(33) . chr(5) . centerString("C R E D I T   C A R D   T E N D E R S") . "\n";
    $receipt .= centerString("------------------------------------------------------");
    $result_ccq = sql_query($query_ccq, $db_a);
    $num_rows_ccq = sql_num_rows($result_ccq);
    if ($num_rows_ccq > 0) {
        $receipt .= $fieldNames;
        for ($i = 0; $i < $num_rows_ccq; $i++) {
            $row_ccq = sql_fetch_array($result_ccq);
            $timeStamp = timeStamp($row_ccq["tdate"]);
            $receipt .= "  " . substr($timeStamp . $blank, 0, 10) . substr($row_ccq["register_no"] . $blank, 0, 7) . substr($row_ccq["trans_no"] . $blank, 0, 6) . substr($row_ccq["emp_no"] . $blank, 0, 6) . substr($blank . number_format($row_ccq["changeGiven"], 2), -10) . substr($blank . number_format($row_ccq["ccTender"], 2), -10) . "\n";
        }
        $receipt .= centerString("------------------------------------------------------");
        $query_ccq = "select SUM(ccTender) from cctenders where tdate > '" . $EOS . "' and register_no = " . $_SESSION["laneno"];
        $result_ccq = sql_query($query_ccq, $db_a);
        $row_ccq = sql_fetch_array($result_ccq);
        $receipt .= substr($blank . $blank . $blank . $blank . "Total: " . number_format($row_ccq[0], 2), -56) . "\n";
    } else {
        $receipt .= "\n\n" . centerString(" * * *   N O N E   * * * ") . "\n\n" . centerString("------------------------------------------------------");
    }
    $receipt .= str_repeat("\n", 3);
    // apbw/tt 3/16/05 Franking II
    $receipt .= centerString("H O U S E / S T O R E   C H A R G E   T E N D E R S") . "\n";
    $receipt .= centerString("------------------------------------------------------");
    $result_miq = sql_query($query_miq, $db_a);
    $num_rows_miq = sql_num_rows($result_miq);
    if ($num_rows_miq > 0) {
        $chgFieldNames = "  " . substr("Time" . $blank, 0, 10) . substr("Lane" . $blank, 0, 7) . substr("Trans #" . $blank, 0, 6) . substr("Emp #" . $blank, 0, 8) . substr("Member #" . $blank, 0, 10) . substr("Amount" . $blank, 0, 10) . "\n";
        $receipt .= $chgFieldNames;
        for ($i = 0; $i < $num_rows_miq; $i++) {
            $row_miq = sql_fetch_array($result_miq);
            $timeStamp = timeStamp($row_miq["tdate"]);
            $receipt .= "  " . substr($timeStamp . $blank, 0, 10) . substr($row_miq["register_no"] . $blank, 0, 7) . substr($row_miq["trans_no"] . $blank, 0, 6) . substr($row_miq["emp_no"] . $blank, 0, 6) . substr($row_miq["card_no"] . $blank, 0, 6) . substr($blank . number_format($row_miq["MiTender"], 2), -10) . "\n";
        }
        $receipt .= centerString("------------------------------------------------------");
        $query_miq = "select SUM(miTender) from mitenders where tdate > '" . $EOS . "' and register_no = " . $_SESSION["laneno"];
        $result_miq = sql_query($query_miq, $db_a);
        $row_miq = sql_fetch_array($result_miq);
        $receipt .= substr($blank . $blank . $blank . $blank . "Total: " . number_format($row_miq[0], 2), -56) . "\n";
    } else {
        $receipt .= "\n\n" . centerString(" * * *   N O N E   * * * ") . "\n\n" . centerString("------------------------------------------------------");
    }
    $receipt .= str_repeat("\n", 3);
    // apbw/tt 3/16/05 Franking II
    $receipt .= chr(27) . chr(33) . chr(5) . centerString("T R I - M E T  P A S S E S   S O L D") . "\n";
    $receipt .= centerString("------------------------------------------------------");
    $result_bp = sql_query($query_bp, $db_a);
    $num_rows_bp = sql_num_rows($result_bp);
    if ($num_rows_bp > 0) {
        $receipt .= $fieldNames;
        for ($i = 0; $i < $num_rows_bp; $i++) {
            $row_bp = sql_fetch_array($result_bp);
            $timeStamp = timeStamp($row_bp["tdate"]);
            $receipt .= "  " . substr($timeStamp . $blank, 0, 10) . substr($row_bp["register_no"] . $blank, 0, 7) . substr($row_bp["trans_no"] . $blank, 0, 6) . substr($row_bp["emp_no"] . $blank, 0, 6) . substr($blank . $row_bp["upc"], -10) . substr($blank . number_format($row_bp["total"], 2), -10) . "\n";
        }
        $receipt .= centerString("------------------------------------------------------");
    } else {
        $receipt .= "\n\n" . centerString(" * * *   N O N E   * * * ") . "\n\n" . centerString("------------------------------------------------------");
    }
    $receipt .= str_repeat("\n", 8);
    // apbw/tt 3/16/05 Franking II
    writeLine($receipt . chr(27) . chr(105));
    // apbw/tt 3/16/05 Franking II
    sql_close($db_a);
    $_SESSION["msgrepeat"] = 1;
    $_SESSION["strRemembered"] = "ES";
    gohome();
}
 /**
  * Sends a SLO request base on the info in the slorequest info - returns if the binding
  * is SOAP.
  *
  * @param  array $slorequestinfo
  * @return bool
  *
  */
 public function sendLogoutRequest($slorequestinfo)
 {
     $type = $slorequestinfo['type'];
     $entity = $slorequestinfo['entity'];
     $sloEndpoints = nvl($this->_metadata['md'][$entity][$type], 'SingleLogoutService');
     if (!$sloEndpoints) {
         return false;
     }
     foreach ($sloEndpoints as $endpoint) {
         $slobybinding[$endpoint['Binding']][] = $endpoint;
     }
     $bindings = array('SOAP', 'HTTP-Redirect', 'HTTP-POST', 'HTTP-Artifact');
     foreach ($bindings as $binding) {
         if ($endpoints = nvl($slobybinding, 'urn:oasis:names:tc:SAML:2.0:bindings:' . $binding)) {
             break;
         }
     }
     $endpoint = $endpoints[0];
     $request = array('__t' => 'samlp:LogoutRequest', '__' => array('destinationid' => $entity, 'ProtocolBinding' => $endpoint['Binding'], 'paramname' => 'SAMLRequest'), '_xmlns:saml' => 'urn:oasis:names:tc:SAML:2.0:assertion', '_xmlns:samlp' => 'urn:oasis:names:tc:SAML:2.0:protocol', '_ID' => $slorequestinfo['ID'], '_Version' => '2.0', '_IssueInstant' => $this->timeStamp(), '_Destination' => $endpoint['Location'], '_NotOnOrAfter' => timeStamp(5), 'saml:Issuer' => array('__v' => $this->_metadata['current']['entityID']));
     $request[$slorequestinfo['nameIDType']] = $slorequestinfo['nameID'];
     // only actually returns if soap call ...
     $soapresponse = $this->getBindingsModule()->send($request, $entity);
 }
Example #4
0
function tenderReport()
{
    $db_a = mDataConnect();
    $blank = "             ";
    $eosQ = "select max(tdate) from dlog where register_no = " . $_SESSION["laneno"] . " and upc = 'ENDOFSHIFT'";
    $eosR = mysql_query($eosQ);
    $row = mysql_fetch_row($eosR);
    $EOS = $row[0];
    //	$EOS = '2007-08-01 12:00:00';
    $query_ckq = "select * from cktenders where tdate > '" . $EOS . "' and register_no = " . $_SESSION["laneno"] . " order by emp_no, tdate";
    $query_ccq = "select * from cctenders where tdate > '" . $EOS . "' and register_no = " . $_SESSION["laneno"] . " order by emp_no, tdate";
    $query_dcq = "select * from dctenders where tdate > '" . $EOS . "' and register_no = " . $_SESSION["laneno"] . " order by emp_no, tdate";
    $query_miq = "select * from mitenders where tdate > '" . $EOS . "' and register_no = " . $_SESSION["laneno"] . " order by emp_no, tdate";
    $query_fsq = "select * from fstenders where tdate > '" . $EOS . "' and register_no = " . $_SESSION["laneno"] . " order by emp_no, tdate";
    $query_bp = "select * from buspasstotals where tdate > '" . $EOS . "' and register_no = " . $_SESSION["laneno"] . " order by emp_no, tdate";
    $fieldNames = "  " . substr("Time" . $blank, 0, 10) . substr("Lane" . $blank, 0, 7) . substr("Trans #" . $blank, 0, 6) . substr("Emp #" . $blank, 0, 8) . substr("Change" . $blank, 0, 10) . substr("Amount" . $blank, 0, 10) . "\n";
    $ref = centerString(trim($_SESSION["CashierNo"]) . "-" . trim($_SESSION['laneno']) . " " . trim($_SESSION["cashier"]) . " " . build_time(time())) . "\n";
    // ----------------------------------------------------------------------------------------------------
    $receipt .= chr(27) . chr(33) . chr(5) . centerString("T E N D E R  R E P O R T") . "\n";
    $receipt .= $ref;
    $receipt .= centerString("------------------------------------------------------");
    $receipt .= str_repeat("\n", 2);
    // --------------------------------
    // ccm-rle 10-12-2009 adding a total gross query that calculates the total gross sales
    // removed the sales tax from the gross total by removing IN (,'A') from trans_type
    $grossQ = "SELECT SUM(total) AS gross \r\n                from dlog\r\n                where tdate > '" . $EOS . "'\r\n                and register_no = " . $_SESSION['laneno'] . "\r\n                and trans_type IN('I','D')\r\n                and trans_subtype NOT IN('IC','MC')\n                and trans_status <> 'X'\r\n                and UPC <> 'DISCOUNT'\r\n                AND emp_no <> 9999";
    // ccm-rle delete this
    /*        $fp=fopen('cancel-log.txt','w');
    
            fwrite($fp,$grossQ);
            fclose($fp);
    */
    $grossR = mysql_query($grossQ);
    $row = mysql_fetch_row($grossR);
    $receipt .= "  " . substr("Gross Total: " . $blank . $blank, 0, 20);
    $receipt .= substr($blank . number_format($row[0], 2), -8) . "\n";
    $receipt .= "\n";
    // --- ccm-rle adding total discounts for tracking purposes to tenderReport
    $disc_tot = "SELECT ROUND(SUM(total),2) AS gross\r\n                FROM dlog\r\n                WHERE tdate > '" . $EOS . "'\r\n                AND register_no = " . $_SESSION['laneno'] . "               \r\n                AND upc = 'DISCOUNT'\n\t\tAND emp_no <> 9999";
    $results_tot = mysql_query($disc_tot);
    $row = mysql_fetch_row($results_tot);
    $receipt .= "  " . substr("Discount Total: " . $blank . $blank, 0, 20);
    $receipt .= substr($blank . number_format($row[0] * -1, 2), -8) . "\n";
    // ccm-rle adding up all of the items that were taxable as sales - this number won't include items that were food stamp tendered... so I'm commenting it out.
    /*
            $taxablesalesQ = "SELECT SUM(total) AS gross 
                    from dlog
                    where tdate > '" .$EOS. "'
                    and register_no = " .$_SESSION['laneno']. "
                    and trans_type IN('I','D')
                    and trans_subtype <> 'IC'
                    and tax = 1
                    and trans_status <> 'X'
                    AND emp_no <> 9999";
    
            $taxablesalesR = mysql_query($taxablesalesQ);
            $row = mysql_fetch_row($taxablesalesR);
    
            $receipt .= "  ".substr("Taxable Sales Total: ".$blank.$blank,0,20);
            $receipt .= substr($blank.number_format(($row[0]),2),-8)."\n";
            $receipt .= "\n";
    */
    // ccm-rle added total tax to tender tape as well
    $tax_tot = "SELECT ROUND(SUM(total),2) AS gross\r\n                FROM dlog\r\n                WHERE tdate > '" . $EOS . "'\r\n                AND register_no = " . $_SESSION['laneno'] . "               \n\t\tAND emp_no <> 9999\r\n                AND trans_type = 'A'";
    $results_tot = mysql_query($tax_tot);
    $row = mysql_fetch_row($results_tot);
    $receipt .= "  " . substr("Sales Tax Total: " . $blank . $blank, 0, 20);
    $receipt .= substr($blank . number_format($row[0], 2), -8) . "\n";
    // ----------------------------------------------------------------------------------------------------
    // ccm-rle 10-8-2009 added trans_status <> 'X' to below so that transactions that are cancelled are not counted in the register. This may not be the best idea. This is actually already done by dlog automatically.
    $netQ = "SELECT SUM(total) AS net\r\n\t\tfrom dlog\r\n\t\twhere tdate > '" . $EOS . "'\r\n\t\tand register_no = " . $_SESSION['laneno'] . "\r\n\t\tand trans_type IN('I','D','A')\r\n\t\tand trans_subtype NOT IN('IC','MC')\n\t\tAND emp_no <> 9999";
    $netR = mysql_query($netQ);
    $row = mysql_fetch_row($netR);
    $receipt .= "  " . substr("NET Total: " . $blank . $blank, 0, 20);
    $receipt .= substr($blank . number_format($row[0], 2), -8) . "\n";
    $receipt .= "\n";
    // ccm-rle 4-20-2010 Coupons that are tendered vs. scanned don't show up under net, but do under tender totals. So in order to balance the register we need the unscanned coupon total added up. This is a work around but should balance the reports.
    $coupontenderQ = "SELECT SUM(total) AS coupontender\n                from dlog\n                where tdate > '" . $EOS . "'\n                and register_no = " . $_SESSION['laneno'] . "\n                and trans_type IN('T')\n                and trans_subtype = 'MC'\n                AND emp_no <> 9999";
    $coupontenderR = mysql_query($coupontenderQ);
    $row = mysql_fetch_row($coupontenderR);
    $receipt .= "  " . substr("Unscanned Coupon Total: " . $blank . $blank, 0, 20);
    $receipt .= substr($blank . number_format($row[0], 2), -8) . "\n";
    $receipt .= "\n";
    // ccm-rle this is where the various tendered items are added to the receipt such as debit card and WIC, in order to remove unused tenders the database needs to be modified to remove them and also is4c needs to have the commented out as potential tender sources. For the purposes of CCM we will be removed debit cards, EBT cash, WIC, prehkeys.php is where the tenders are recognized by is4c. ignoring this for now to code in needed aspects.
    $tendertotalsQ = "SELECT t.TenderName as tender_type,ROUND(-sum(d.total),2) as total,COUNT(*) as count\r\n\t\tFROM dlog d RIGHT JOIN is4c_op.tenders t\r\n\t\tON d.trans_subtype = t.TenderCode\r\n\t\tAND tdate > '" . $EOS . "'\r\n\t\tAND register_no = " . $_SESSION['laneno'] . " \r\n\t\tAND d.emp_no <> 9999\r\n                AND trans_status <> 'X'\r\n\t\tGROUP BY t.TenderName";
    $results_ttq = mysql_query($tendertotalsQ);
    while ($row = mysql_fetch_row($results_ttq)) {
        if (!isset($row[0])) {
            $receipt .= "NULL";
        } else {
            $receipt .= "  " . substr($row[0] . $blank . $blank, 0, 20);
        }
        if (!isset($row[1])) {
            $receipt .= "    0.00";
        } else {
            $receipt .= substr($blank . number_format($row[1], 2), -8);
        }
        if (!isset($row[2])) {
            $receipt .= "NULL";
        } else {
            if (!isset($row[1])) {
                $row[2] = 0;
            }
            $receipt .= substr($blank . $row[2], -4, 4);
        }
        $receipt .= "\n";
    }
    $receipt .= "\n";
    $cack_tot = "SELECT ROUND(SUM(total),2) AS gross\r\n\t\tFROM dlog\r\n\t\tWHERE tdate > '" . $EOS . "'\r\n\t\tAND register_no = " . $_SESSION['laneno'] . "\r\n\t\tAND trans_subtype IN ('CA','CK')\n\t\tAND emp_no <> 9999";
    $results_tot = mysql_query($cack_tot);
    $row = mysql_fetch_row($results_tot);
    $receipt .= "  " . substr("CA & CK Total: " . $blank . $blank, 0, 20);
    $receipt .= substr($blank . number_format($row[0] * -1, 2), -8) . "\n";
    $card_tot = "SELECT ROUND(SUM(total),2) AS gross\r\n\t\tFROM dlog\r\n\t\tWHERE tdate > '" . $EOS . "'\r\n\t\tAND register_no = " . $_SESSION['laneno'] . "\n\t\tAND emp_no <> 9999\t\t\r\n\t\tAND trans_subtype IN ('DC','CC','FS','EC')";
    $results_tot = mysql_query($card_tot);
    $row = mysql_fetch_row($results_tot);
    $receipt .= "  " . substr("DC / CC / EBT Total: " . $blank . $blank, 0, 20);
    $receipt .= substr($blank . number_format($row[0] * -1, 2), -8) . "\n";
    $hchrg_tot = "SELECT ROUND(SUM(total),2) AS gross\r\n\t\tFROM dlog\r\n\t\tWHERE tdate > '" . $EOS . "'\r\n\t\tAND register_no = " . $_SESSION['laneno'] . "\r\n\t\tAND trans_subtype = 'MI'\n\t\tAND emp_no <> 9999\n\t\tAND card_no <> 9999";
    $results_tot = mysql_query($hchrg_tot);
    $row = mysql_fetch_row($results_tot);
    // ccm-rle commenting out the House and Storage Charge totals as they are not used by ccm
    /*
    	$receipt .= "  ".substr("House Charge Total: ".$blank.$blank,0,20);
    	$receipt .= substr($blank.number_format(($row[0] * -1),2),-8)."\n";
    	$schrg_tot = "SELECT ROUND(SUM(total),2) AS gross
    		FROM dlog
    		WHERE tdate > '" .$EOS. "'
    		AND register_no = ".$_SESSION['laneno']."
    		AND trans_subtype = 'MI'
    		AND card_no = 9999";
    	$results_tot = mysql_query($schrg_tot);
    	$row = mysql_fetch_row($results_tot);
    	$receipt .= "  ".substr("Store Charge Total: ".$blank.$blank,0,20);
    	$receipt .= substr($blank.number_format(($row[0] * -1),2),-8)."\n";
    */
    $receipt .= str_repeat("\n", 5);
    // apbw/tt 3/16/05 Franking II
    // ccm-rle adding a place here to count the number of cancelled transactions, no sales & hanging suspended
    // This adds the number of cancelled transactions for this tender report
    $cancelledtranQ = "SELECT COUNT(DISTINCT trans_no, emp_no) \r\n                from dtransactions \r\n                where datetime > '" . $EOS . "'\r\n                and register_no = " . $_SESSION['laneno'] . "\r\n                and trans_status = 'X'\r\n                AND emp_no <> 9999";
    /*        $fp=fopen('cancel-log.txt','w');
    	
    	fwrite($fp,$cancelledtranQ);
    	fclose($fp);
    */
    $cancelledtranR = mysql_query($cancelledtranQ);
    $row = mysql_fetch_row($cancelledtranR);
    $receipt .= "  " . substr("# of Cancelled Transactions: " . $blank . $blank, 0, 20);
    $receipt .= substr($blank . number_format($row[0], 2), -8) . "\n";
    $receipt .= "\n";
    /*   ccm-rle This code was used to ensure there were no suspended transactions 	
    	$suspendedtranQ = "SELECT COUNT(DISTINCT trans_no)
    		from suspendedtoday
    		where datetime > '" .$EOS. "'
                    and register_no = " .$_SESSION['laneno']. "
    		and emp_no <> 9999";
    	$suspendedtranR = mysql_query($suspendedtranQ);
    	$row = mysql_fetch_row($suspendedtranR);
    	
            $receipt .= "  ".substr("# of Suspended Transactions: ".$blank.$blank,0,20);
            $receipt .= substr($blank.number_format(($row[0]),2),-8)."\n";
    	$receipt .= "\n";
    
    */
    $tranQ = "SELECT COUNT(DISTINCT trans_no, emp_no) \r\n                from dlog\r\n                where tdate > '" . $EOS . "'\r\n                and register_no = " . $_SESSION['laneno'] . "\r\n                and trans_status <> 'X'\r\n                AND emp_no <> 9999";
    $tranR = mysql_query($tranQ);
    $row = mysql_fetch_row($tranR);
    $receipt .= "  " . substr("Total Completed  Transactions: " . $blank . $blank, 0, 20);
    $receipt .= substr($blank . number_format($row[0], 2), -8) . "\n";
    $receipt .= "\n";
    $receipt .= str_repeat("\n", 5);
    // apbw/tt 3/16/05 Franking II
    // ccm-rle Next need to write code to look up number of suspended transactions that are left hanging.
    // ----------------------------------------------------------------------------------------------------
    $receipt .= chr(27) . chr(33) . chr(5) . centerString("C H E C K   T E N D E R S") . "\n";
    $receipt .= centerString("------------------------------------------------------");
    $result_ckq = sql_query($query_ckq, $db_a);
    $num_rows_ckq = sql_num_rows($result_ckq);
    if ($num_rows_ckq > 0) {
        $receipt .= $fieldNames;
        for ($i = 0; $i < $num_rows_ckq; $i++) {
            $row_ckq = sql_fetch_array($result_ckq);
            $timeStamp = timeStamp($row_ckq["tdate"]);
            $receipt .= "  " . substr($timeStamp . $blank, 0, 10) . substr($row_ckq["register_no"] . $blank, 0, 7) . substr($row_ckq["trans_no"] . $blank, 0, 6) . substr($row_ckq["emp_no"] . $blank, 0, 6) . substr($blank . number_format($row_ckq["changeGiven"], 2), -10) . substr($blank . number_format($row_ckq["ckTender"], 2), -10) . "\n";
        }
        $receipt .= centerString("------------------------------------------------------");
        //		$query_ckq = "select * from cktendertotal where register_no = ".$_SESSION["laneno"];
        //		$result_ckq = sql_query($query_ckq, $db_a);
        //		$row_ckq = sql_fetch_array($result_ckq);
        $query_ckq = "select SUM(ckTender) from cktenders where tdate > '" . $EOS . "' and register_no = " . $_SESSION["laneno"];
        $result_ckq = sql_query($query_ckq, $db_a);
        $row_ckq = sql_fetch_array($result_ckq);
        $receipt .= substr($blank . $blank . $blank . $blank . "Total: " . number_format($row_ckq[0], 2), -56) . "\n";
    } else {
        $receipt .= "\n\n" . centerString(" * * *   N O N E   * * * ") . "\n\n" . centerString("------------------------------------------------------");
    }
    $receipt .= str_repeat("\n", 3);
    // apbw/tt 3/16/05 Franking II
    //ccm-rle commented out debit card tenders because for ccm they are combined with credit card tenders
    $receipt .= chr(27) . chr(33) . chr(5) . centerString("D E B I T  C A R D  T E N D E R S") . "\n";
    $receipt .= centerString("------------------------------------------------------");
    $result_dcq = sql_query($query_dcq, $db_a);
    $num_rows_dcq = sql_num_rows($result_dcq);
    if ($num_rows_dcq > 0) {
        $receipt .= $fieldNames;
        for ($i = 0; $i < $num_rows_dcq; $i++) {
            $row_dcq = sql_fetch_array($result_dcq);
            $timeStamp = timeStamp($row_dcq["tdate"]);
            $receipt .= "  " . substr($timeStamp . $blank, 0, 10) . substr($row_dcq["register_no"] . $blank, 0, 7) . substr($row_dcq["trans_no"] . $blank, 0, 6) . substr($row_dcq["emp_no"] . $blank, 0, 6) . substr($blank . number_format($row_dcq["changeGiven"], 2), -10) . substr($blank . number_format($row_dcq["dcTender"], 2), -10) . "\n";
        }
        $receipt .= centerString("------------------------------------------------------");
        //		$query_dcq = "select * from dctendertotal where emp_no = ".$_SESSION["CashierNo"];
        //		$result_dcq = sql_query($query_dcq, $db_a);
        //		$row_dcq = sql_fetch_array($result_dcq);
        $query_dcq = "select SUM(dcTender) from dctenders where tdate > '" . $EOS . "' and register_no = " . $_SESSION["laneno"];
        $result_dcq = sql_query($query_dcq, $db_a);
        $row_dcq = sql_fetch_array($result_dcq);
        $receipt .= substr($blank . $blank . $blank . $blank . "Total: " . number_format($row_dcq[0], 2), -56) . "\n";
    } else {
        $receipt .= "\n\n" . centerString(" * * *   N O N E   * * * ") . "\n\n" . centerString("------------------------------------------------------");
    }
    $receipt .= str_repeat("\n", 3);
    // apbw/tt 3/16/05 Franking II
    $receipt .= chr(27) . chr(33) . chr(5) . centerString("C R E D I T   C A R D   T E N D E R S") . "\n";
    $receipt .= centerString("------------------------------------------------------");
    $result_ccq = sql_query($query_ccq, $db_a);
    $num_rows_ccq = sql_num_rows($result_ccq);
    if ($num_rows_ccq > 0) {
        $receipt .= $fieldNames;
        for ($i = 0; $i < $num_rows_ccq; $i++) {
            $row_ccq = sql_fetch_array($result_ccq);
            $timeStamp = timeStamp($row_ccq["tdate"]);
            $receipt .= "  " . substr($timeStamp . $blank, 0, 10) . substr($row_ccq["register_no"] . $blank, 0, 7) . substr($row_ccq["trans_no"] . $blank, 0, 6) . substr($row_ccq["emp_no"] . $blank, 0, 6) . substr($blank . number_format($row_ccq["changeGiven"], 2), -10) . substr($blank . number_format($row_ccq["ccTender"], 2), -10) . "\n";
        }
        $receipt .= centerString("------------------------------------------------------");
        //		$query_ccq = "select * from cctendertotal where register_no = ".$_SESSION["laneno"];
        //		$result_ccq = sql_query($query_ccq, $db_a);
        //		$row_ccq = sql_fetch_array($result_ccq);
        $query_ccq = "select SUM(ccTender) from cctenders where tdate > '" . $EOS . "' and register_no = " . $_SESSION["laneno"];
        $result_ccq = sql_query($query_ccq, $db_a);
        $row_ccq = sql_fetch_array($result_ccq);
        $receipt .= substr($blank . $blank . $blank . $blank . "Total: " . number_format($row_ccq[0], 2), -56) . "\n";
    } else {
        $receipt .= "\n\n" . centerString(" * * *   N O N E   * * * ") . "\n\n" . centerString("------------------------------------------------------");
    }
    $receipt .= str_repeat("\n", 3);
    // apbw/tt 3/16/05 Franking II
    //test
    $receipt .= chr(27) . chr(33) . chr(5) . centerString("E B T  T E N D E R S") . "\n";
    $receipt .= centerString("------------------------------------------------------");
    $result_fsq = sql_query($query_fsq, $db_a);
    $num_rows_fsq = sql_num_rows($result_fsq);
    if ($num_rows_fsq > 0) {
        $receipt .= $fieldNames;
        for ($i = 0; $i < $num_rows_fsq; $i++) {
            $row_fsq = sql_fetch_array($result_fsq);
            $timeStamp = timeStamp($row_fsq["tdate"]);
            $receipt .= "  " . substr($timeStamp . $blank, 0, 10) . substr($row_fsq["register_no"] . $blank, 0, 7) . substr($row_fsq["trans_no"] . $blank, 0, 6) . substr($row_fsq["emp_no"] . $blank, 0, 6) . substr($blank . number_format($row_fsq["changeGiven"], 2), -10) . substr($blank . number_format($row_fsq["FsTender"], 2), -10) . "\n";
        }
        $receipt .= centerString("------------------------------------------------------");
        //		$query_fsq = "select * from fstendertotal where emp_no = ".$_SESSION["CashierNo"];
        //		$result_fsq = sql_query($query_fsq, $db_a);
        //		$row_fsq = sql_fetch_array($result_fsq);
        $query_fsq = "select SUM(fsTender) from fstenders where tdate > '" . $EOS . "' and register_no = " . $_SESSION["laneno"];
        $result_fsq = sql_query($query_fsq, $db_a);
        $row_fsq = sql_fetch_array($result_fsq);
        $receipt .= substr($blank . $blank . $blank . $blank . "Total: " . number_format($row_fsq[0], 2), -56) . "\n";
    } else {
        $receipt .= "\n\n" . centerString(" * * *   N O N E   * * * ") . "\n\n" . centerString("------------------------------------------------------");
    }
    $receipt .= str_repeat("\n", 3);
    // apbw/tt 3/16/05 Franking II
    //ccm-rle commented out house store charges because ccm doesn't currently use them
    /*
    	$receipt .= centerString("H O U S E / S T O R E   C H A R G E   T E N D E R S")."\n";
    	$receipt .=	centerString("------------------------------------------------------");
    
    	$result_miq = sql_query($query_miq, $db_a);
    	$num_rows_miq = sql_num_rows($result_miq);
    
    	if ($num_rows_miq > 0) {
    		
    		$chgFieldNames = "  ".substr("Time".$blank, 0, 10)
    				.substr("Lane".$blank, 0, 7)
    				.substr("Trans #".$blank, 0, 6)
    				.substr("Emp #".$blank, 0, 8)
    				.substr("Member #".$blank, 0, 10)
    				.substr("Amount".$blank, 0, 10)."\n";
    		
    		$receipt .= $chgFieldNames;
    
    		for ($i = 0; $i < $num_rows_miq; $i++) {
    			$row_miq = sql_fetch_array($result_miq);
    			$timeStamp = timeStamp($row_miq["tdate"]);
    			$receipt .= "  ".substr($timeStamp.$blank, 0, 10)
    				.substr($row_miq["register_no"].$blank, 0, 7)
    				.substr($row_miq["trans_no"].$blank, 0, 6)
    				.substr($row_miq["emp_no"].$blank, 0, 6)
    				.substr($row_miq["card_no"].$blank, 0, 6)
    				.substr($blank.number_format($row_miq["MiTender"], 2), -10)."\n";
    
    		}
    
    		$receipt.= centerString("------------------------------------------------------");
    
    //		$query_miq = "select * from mitendertotal where register_no = ".$_SESSION["laneno"];
    //		$result_miq = sql_query($query_miq, $db_a);
    //		$row_miq = sql_fetch_array($result_miq);
    
    		$query_miq = "select SUM(miTender) from mitenders where tdate > '".$EOS."' and register_no = ".$_SESSION["laneno"];
    		$result_miq = sql_query($query_miq, $db_a);
    		$row_miq = sql_fetch_array($result_miq);
    
    		$receipt .= substr($blank.$blank.$blank.$blank."Total: ".number_format($row_miq[0],2), -56)."\n";
    	}
    	else {
    		$receipt .= "\n\n".centerString(" * * *   N O N E   * * * ")."\n\n"
    			.centerString("------------------------------------------------------");
    	}
    
    	$receipt .= str_repeat("\n", 3);	// apbw/tt 3/16/05 Franking II
    */
    //--------------------------------------------------------------------
    //ccm-rle commented out TRI MET passes because CCM doesn't use them
    /*
    		$receipt .= chr(27).chr(33).chr(5).centerString("T R I - M E T  P A S S E S   S O L D")."\n";
    	$receipt .=	centerString("------------------------------------------------------");
    
    	$result_bp = sql_query($query_bp, $db_a);
    	$num_rows_bp = sql_num_rows($result_bp);
    
    	if ($num_rows_bp > 0) {
    
    		$receipt .= $fieldNames;
    
    		for ($i = 0; $i < $num_rows_bp; $i++) {
    
    			$row_bp = sql_fetch_array($result_bp);
    			$timeStamp = timeStamp($row_bp["tdate"]);
    			$receipt .= "  ".substr($timeStamp.$blank, 0, 10)
    				.substr($row_bp["register_no"].$blank, 0, 7)
    				.substr($row_bp["trans_no"].$blank, 0, 6)
    				.substr($row_bp["emp_no"].$blank, 0, 6)
    				.substr($blank.($row_bp["upc"]), -10)
    				.substr($blank.number_format($row_bp["total"], 2), -10)."\n";
    		}
    
    		$receipt.= centerString("------------------------------------------------------");
    	}
    	else {
    		$receipt .= "\n\n".centerString(" * * *   N O N E   * * * ")."\n\n"
    			.centerString("------------------------------------------------------");
    	}
    */
    $receipt .= str_repeat("\n", 8);
    // apbw/tt 3/16/05 Franking II
    // ccm-rle - this creates a txt log on the IS4C computer of every tender report for logging purposes
    $tender_date = date('Y-m-d-H-i-s');
    $tender_log_file = "/pos/logs/tenderlog_" . $tender_date . "_" . $_SESSION["laneno"] . ".txt";
    $fp = fopen($tender_log_file, 'w');
    fwrite($fp, $receipt . chr(27) . chr(105));
    fclose($fp);
    writeLine($receipt . chr(27) . chr(105));
    // apbw/tt 3/16/05 Franking II
    sql_close($db_a);
    $_SESSION["msgrepeat"] = 1;
    $_SESSION["strRemembered"] = "ES";
    gohome();
}
Example #5
0
function read_entries($User, $Level)
{
    global $msg, $db_name, $tbl_name, $fld_timestamp, $messageOrder, $messageBGColors, $boxEntries, $boxWidth, $wordLength, $timeOffset, $reservedNames, $dateFormat;
    if ($db_name) {
        $sql = "SELECT * FROM {$tbl_name} ORDER BY {$fld_timestamp} {$messageOrder} LIMIT {$boxEntries}";
        $result = mysql_query($sql);
        while ($row = mysql_fetch_row($result)) {
            $data[] = $row;
        }
    } else {
        $data = read_data();
        if (strtoupper($messageOrder) != 'ASC') {
            rsort($data);
        }
    }
    for ($i = 0; $i < count($data); $i++) {
        $id = $data[$i][0];
        $tstamp = timeStamp($data[$i][1]);
        $name = $data[$i][2] ? format($data[$i][2], $wordLength, $boxWidth - 22, true) : '???';
        $realName = $name;
        $email = strstr($data[$i][3], '@') ? $data[$i][3] : '';
        $text = format($data[$i][4], $wordLength, $boxWidth - 22, false);
        $bgcolor = $bgcolor != $messageBGColors[0] ? $messageBGColors[0] : $messageBGColors[1];
        $nameExplode = explode("-", $name);
        if (strcmp($nameExplode[0], '[Developer]') == 0) {
            $name = "<span style='font-weight:bold;color:red;font-size:15px;'>" . $name . "</span>";
            $text = "<br><span style='color:red;'>" . $text . "";
        } else {
            if (strcmp($nameExplode[0], '[3*]') == 0) {
                $name = "<span style='font-weight:bold;color:blue;font-size:15px;'>" . $name . "</span>";
                $text = "<br><span style='color:blue;'>" . $text . "";
            } else {
                if (strcmp($nameExplode[0], '[2*]') == 0) {
                    $name = "<span style='font-weight:bold;color:green;font-size:15px;'>" . $name . "</span>";
                    $text = "<br><span style='color:green;'>" . $text . "";
                } else {
                    if (strcmp($nameExplode[0], '[1*]') == 0) {
                        $name = "<span style='font-weight:bold;color:black;font-size:15px;'>" . $name . "</span>";
                        $text = "<br><span style='color:black;'>" . $text . "";
                    }
                }
            }
        }
        if ($dateFormat != 'Y-m-d' || (int) $timeOffset != 0) {
            $a = explode(' ', $tstamp);
            $d = explode('-', $a[0]);
            $t = explode(':', $a[1]);
            $ts = mktime($t[0], $t[1], $t[2], $d[1], $d[2], $d[0]);
            if ((int) $timeOffset != 0) {
                $ts += (int) $timeOffset * 3600;
            }
            if (!$dateFormat) {
                $dateFormat = 'Y-m-d';
            }
            $tstamp = date($dateFormat . ' H:i:s', $ts);
        }
        if (is_admin()) {
            $splitRName = explode("-", $realName);
            ?>
			
				<? if((strcmp(trim($splitRName['1']), trim($User)) == 0) || ($Level >= 3)) {?>
				<div class="cssShoutRaised" style="float:right;margin-right:3px;height:27px;width:22px;margin-top:3px;background-image: url('smilies/trash.gif');background-repeat: no-repeat;background-position: center;" title="<?php 
            echo $msg['delete'];
            ?>
"
				onMouseDown="this.className='cssShoutPressed'"
				onMouseUp="this.className='cssShoutRaised'"
				onMouseOut="this.className='cssShoutRaised'"
				onClick="confirmDelete(<?php 
            echo $id;
            ?>
)">
				</div>
				<a target="ShoutBox" href="edit.php?id=<? echo $id; ?>&userName=<? echo trim($splitRName['1']); ?>"><div class="cssShoutRaised" style="float:right;margin-right:3px;height:27px;width:25px;margin-top:3px;background-image: url('smilies/edit.gif');background-repeat: no-repeat;background-position: center;" title="<?php 
            echo $msg['edit'];
            ?>
"
				onMouseDown="this.className='cssShoutPressed'"
				onMouseUp="this.className='cssShoutRaised'"
				onMouseOut="this.className='cssShoutRaised'">
				</div></a>
				<? } ?>
				
<?php 
        }
        $class = in_array(strtolower($name), $reservedNames) ? 'cssShoutTextAdmin' : 'cssShoutText';
        ?>
			<div class="cssShoutTime" style="background-color:<?php 
        echo $bgcolor;
        ?>
">
			<?php 
        echo $tstamp;
        ?>
			</div>
			<div class="<?php 
        echo $class;
        ?>
" style="background-color:<?php 
        echo $bgcolor;
        ?>
">
			<?php 
        if ($email) {
            echo '<a href="mailto:' . $email . '">';
        }
        ?>
			<b><?php 
        echo $name;
        ?>
:</b><?php 
        if ($email) {
            echo '</a>';
        }
        ?>
 
				<?php 
        // The Regular Expression filter
        $reg_exUrl = "/(http|https|ftp|ftps)\\:\\/\\/[a-zA-Z0-9\\-\\.]+\\.[a-zA-Z]{2,3}(\\/\\S*)?/";
        // Check if there is a url in the text
        if (preg_match($reg_exUrl, $text, $url)) {
            // make the urls hyper links
            $text = preg_replace($reg_exUrl, '<a target="_blank" style="text-decoration: underline;color:purple;font-weight:bold;" href="' . $url[0] . '">(Website Link)</a>', $text);
        }
        $re = "/--(.*?)--/im";
        $subst = "<span style='color:darkblue;font-size:25px;'>\$1";
        $text = preg_replace($re, $subst, $text);
        $re = "/__(.*?)__/im";
        $subst = "<span style='font-style:italic;'>\$1</span>";
        $text = preg_replace($re, $subst, $text);
        $re = "/(?i:(view|check|info|link)):(.*?)(:|[ ](.*?):)/im";
        $subst = "\n\t\t\t\t<div class='alert alert-success' role='alert'>\n\t\t\t\t  <span style='font-weight:bold;'>\$2</span><br><span style='font-style:italic;'>\$3</span>\n\t\t\t\t  <a target='_parent' href='../search.php?edit=0&searchResult=\$2'><br><button class='btn btn-info' class='alert-link'>View Product</button></a>\n\t\t\t\t</div>";
        $text = preg_replace($re, $subst, $text);
        $re = "/(?i:(edit|broken|fix)):(.*?)(:|[ ](.*?):)/im";
        $subst = "\n\t\t\t\t<div class='alert alert-warning' role='alert'>\n\t\t\t\t  <span style='font-weight:bold;'>\$2</span><br><span style='font-style:italic;'>\$3</span>\n\t\t\t\t  <a target='_parent' href='../search.php?edit=1&searchResult=\$2'><br><button class='btn btn-info' class='alert-link'>Edit Product</button></a>\n\t\t\t\t</div>";
        $text = preg_replace($re, $subst, $text);
        $re = "/\\*\\*(.*?)\\*\\*/im";
        $subst = "<span style='font-weight:bold;'>\$1</span>";
        $text = preg_replace($re, $subst, $text);
        $re = "/\\@([a-zA-Z]+(\\S)?)/";
        $subst = "<span style='font-weight:bold;color:orange;font-size:18px;'>@\$1</span>";
        $text = preg_replace($re, $subst, $text);
        ?>
			<?php 
        echo "<div style='font-size:15px;padding:10px;padding-top:3px;'" . $text . "</div>";
        ?>
			
			</div>
<?php 
    }
}
Example #6
0
<?php

require '../library/Corto/cortolib.php';
error_reporting(E_ALL);
$privatekey = "-----BEGIN RSA PRIVATE KEY-----\nMIIEmwIBAAKCAQAAqy8WhGwxwupZOTt88F9BzqcgD/Hu8SukmerGhLhKMWtx46AA\nSFv8VPP4Sg46JhUYy8uuyR7urLxYCLdxw/Fqbkfg50nI2zDhZ6Lz6Pm/ktqGLNAh\nD0x0em0Wd6C9236SnHD6HJquOd8V+Lpus+5tGZ4XjanJ00g/zwubAGCd0KCufI8A\nG4Y90dDoONhD/2NLDHlldqDS3Lkel5ntsK8GQq+cP/UpDuCtXOq8PlCONO5iY+Im\neXPUqjqOHCviWlOO5l/CJQBq5KbnixJtTwzcS8SILSTlQQXN2ttgqeIq065mcWU2\nIgV/13PHA0kQXr6f+tGOL6ljgiafVct54soLAgMBAAECgf8SAdwOhgseA+Tq3lUg\nPAUCJhZ7VunZuMuR3V6Qq4oydKkAVt5wvixnC1r8/04in2mCVqTGR1i4Fv/zushe\n4lBd1XXVHq/gTt4HNt8NjOgYHKCsqiAwKcy+7CbG4sPWCRSHHGNTCvp04ADBr2rh\nxpz3aufzYP74GMuNjhz6By/StbO2stjT1yBVxBbZdgMwXCaW6sK60LJlBUF3h8pY\nDGvzuvJSakP1a7OS1dt0eR7BQZOVEFVFDrZLz45RVQyrOSRhuTaghC/rx9uSQdLx\n5EDRHC3bTahSwkOOFqgJKSHyzFGEIJY8jmJuE78bet3fcPNj7BGsStl+W5SbkECO\n/DECgYANF0HuM6IRhv7hSDW4Tx28xM9Ii018i2LFmXyW+QSOkBBs5j7IlK/fUiGh\nPlHH2255w6RNDuG752sHy5dLWKJqAxcc+N5a9EyNjEbtiaNnlcIR0gdjwLo/7VrD\nkLAHCHieMQKWBwzYjIGvJjqbpbkx2M+OvVixam221vSN/EdwnQKBgA0TnLbysli1\ndDqvxguCRdyhTpfy1VClb2sSjk1gXb8F0vEpz7CwAqERnNJIJFyctCxmpxPHtBbd\nVY7rx1635xRDvO6NzDkqP5SXHxtpqNpsvCm59E9z+imuSE9vI1QAHviUeootCPkA\nPYziKwIuCHGQstG4sHqLC3wTRfO9D0DHAn8nEUGxoGYL6NS/fsDTS0l0EeaKmTCm\nf1RGYclwxbjTvR1H4dt8wEAeOP4kN9fYmwUYXsX3MnJ6VCkXGoBqXBpYRuCzlgQB\nbRMJW5pRTHJcsJJ8nFFxYbp1DeXRvfuXAbD2aU1Ob7vmh2x/SZee6vXFzUWgt3P6\nBaVoBBnToxGRAoGACQBPB7/X9CgzcZI9CP8Lh+uhZgbJv1GheFq1iZ2j6jHgGhFl\n3YHKzYSKJlVyci2L+GRQ7dSxqmuA0XiLLC/66IAYNT12LoNecLH1v7DjgjcG7tIJ\n0gdLVBWbwNIHx3Kt3v6Vuzd0zbHUrH2ijUWSmlm4PZScJj5AEZBSvoyNS1ECgYAJ\nR5saP5aJeR2ekvtGFc7jdEt6Xkgmtz2t8Lbpa8XHVWUH2F0DiVRVgBHkYHIY1SNO\n18EB1TOsCkJWJj2sWyJZBbppBdobfjfx8/6pK2xwmKgaqzUsd0cKGY27bkXl2a42\n16+9G/Q5QlvTY6C2CLuy5TYQ+20OxqLjMxkSvdci8Q==\n-----END RSA PRIVATE KEY-----";
$entityID = 'http' . (nvl($_SERVER, 'HTTPS') ? 's' : '') . '://' . $_SERVER['HTTP_HOST'] . $_SERVER['SCRIPT_NAME'];
$request = json_decode(gzinflate(base64_decode($_GET['SAMLRequest'])), 1);
$now = timeStamp();
$soon = timeStamp(300);
$sessionEnd = timeStamp(60 * 60 * 12);
$response = array('__t' => 'samlp:Response', '__' => array('paramname' => 'SAMLResponse', 'RelayState' => !empty($request['__']['RelayState']) ? $request['__']['RelayState'] : NULL), '_xmlns:samlp' => 'urn:oasis:names:tc:SAML:2.0:protocol', '_xmlns:saml' => 'urn:oasis:names:tc:SAML:2.0:assertion', '_ID' => ID(), '_Version' => '2.0', '_IssueInstant' => $now, '_InResponseTo' => $request['_ID'], 'saml:Issuer' => array('__v' => $entityID), 'samlp:Status' => array('samlp:StatusCode' => array('_Value' => 'urn:oasis:names:tc:SAML:2.0:status:Success')));
$destinationid = $request['saml:Issuer']['__v'];
$response['__']['destinationid'] = $destinationid;
if ($acsurl = $request['_AssertionConsumerServiceURL']) {
    $response['_Destination'] = $acsurl;
    $response['__']['ProtocolBinding'] = $request['_ProtocolBinding'];
} else {
    die("No Destination in request or metadata for: {$destinationid}");
}
$response['saml:Assertion'] = array('_xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance', '_xmlns:xs' => 'http://www.w3.org/2001/XMLSchema', '_xmlns:samlp' => 'urn:oasis:names:tc:SAML:2.0:protocol', '_xmlns:saml' => 'urn:oasis:names:tc:SAML:2.0:assertion', '_ID' => ID(), '_Version' => '2.0', '_IssueInstant' => $now, 'saml:Issuer' => array('__v' => $entityID), 'ds:Signature' => '__placeholder__', 'saml:Subject' => array('saml:NameID' => array('_SPNameQualifier' => $entityID, '_Format' => 'urn:oasis:names:tc:SAML:2.0:nameid-format:transient', '__v' => ID()), 'saml:SubjectConfirmation' => array('_Method' => 'urn:oasis:names:tc:SAML:2.0:cm:bearer', 'saml:SubjectConfirmationData' => array('_NotOnOrAfter' => $soon, '_Recipient' => $request['_AssertionConsumerServiceURL'], '_InResponseTo' => $request['_ID']))), 'saml:Conditions' => array('_NotBefore' => $now, '_NotOnOrAfter' => $soon, 'saml:AudienceRestriction' => array('saml:Audience' => array('__v' => $request['saml:Issuer']['__v']))), 'saml:AuthnStatement' => array('_AuthnInstant' => $now, '_SessionNotOnOrAfter' => $sessionEnd, 'saml:SubjectLocality' => array('_Address' => $_SERVER['REMOTE_ADDR'], '_DNSName' => !empty($_SERVER['REMOTE_HOST']) ? $_SERVER['REMOTE_HOST'] : gethostbyaddr($_SERVER['REMOTE_ADDR'])), 'saml:AuthnContext' => array('saml:AuthnContextClassRef' => array('__v' => 'urn:oasis:names:tc:SAML:2.0:ac:classes:Password'))));
$attributes['uid'][] = 'abc@null';
$attributes['idp'][] = $request['saml:Issuer']['__v'];
foreach ((array) $attributes as $name => $attr) {
    $newattr = array('_Name' => $name, '_NameFormat' => 'urn:oasis:names:tc:SAML:2.0:attrname-format:basic');
    foreach ((array) $attr as $val) {
        $newattr['saml:AttributeValue'][] = array('_xsi:type' => 'xs:string', '__v' => $val);
    }
    $res[] = $newattr;
}
$response['saml:Assertion']['saml:AttributeStatement'][0]['saml:Attribute'] = $res;
$location = $response['_Destination'];
Example #7
0
    color: white;"> <i>Vuelve a jugar en tu próxima visita.</i></div></p>

		    </div>
		    <div class="modal-footer">
		      <a href="#!" class=" modal-action modal-close waves-effect waves-green btn-flat" style=" width: 100%; text-align: center;">Ver otros premios</a>
		    </div>
		  </div>

<?php 
} else {
    ?>
			<div id="upper-div" style="height: 75%;">
			<div class="div-wrapper full">
				<img class="center-img success-img" src="images/success.png">
				<p class="center-align " style="z-index: 2; position: relative; bottom: 40%;"><?php 
    echo timeStamp();
    ?>
</p>
			</div>
			</div>
		    <footer style="height: 25%; padding-top: 17.5vh;">
				  <a class="waves-effect waves-light btn white black-text btn-centered teal accent-2 center-align" href="http://facebook.com/fanbotme" style="    width: 100%;"><i class="material-icons left">arrow_forward</i>CONOCE FANBOT</a>
	
		    </footer>



<?php 
}
?>
		</div>
Example #8
0
function sendLog($log_file, $msg)
{
    $ct = timeStamp();
    $flog = fopen($log_file, 'a') or die("can't open file {$log_file}");
    $str = "[" . $ct . "] " . $msg;
    fwrite($flog, $str . "\n");
    fclose($flog);
}
Example #9
0
function read_entries()
{
    global $msg, $db_name, $tbl_name, $fld_timestamp, $messageOrder, $messageBGColors, $boxEntries, $boxWidth, $wordLength, $timeOffset, $reservedNames, $dateFormat;
    if ($db_name) {
        $sql = "SELECT * FROM {$tbl_name} ORDER BY {$fld_timestamp} {$messageOrder} LIMIT {$boxEntries}";
        $result = mysql_query($sql);
        while ($row = mysql_fetch_row($result)) {
            $data[] = $row;
        }
    } else {
        $data = read_data();
        if (strtoupper($messageOrder) != 'ASC') {
            rsort($data);
        }
    }
    for ($i = 0; $i < count($data); $i++) {
        $id = $data[$i][0];
        $tstamp = timeStamp($data[$i][1]);
        $name = $data[$i][2] ? format($data[$i][2], $wordLength, $boxWidth - 22, true) : '???';
        $email = strstr($data[$i][3], '@') ? $data[$i][3] : '';
        $text = format($data[$i][4], $wordLength, $boxWidth - 22, false);
        $bgcolor = $bgcolor != $messageBGColors[0] ? $messageBGColors[0] : $messageBGColors[1];
        if ($dateFormat != 'Y-m-d' || (int) $timeOffset != 0) {
            $a = explode(' ', $tstamp);
            $d = explode('-', $a[0]);
            $t = explode(':', $a[1]);
            $ts = mktime($t[0], $t[1], $t[2], $d[1], $d[2], $d[0]);
            if ((int) $timeOffset != 0) {
                $ts += (int) $timeOffset * 3600;
            }
            if (!$dateFormat) {
                $dateFormat = 'Y-m-d';
            }
            $tstamp = date($dateFormat . ' H:i:s', $ts);
        }
        if (is_admin()) {
            ?>
				<div class="cssShoutRaised" style="float:right" title="<?php 
            echo $msg['delete'];
            ?>
"
				onMouseDown="this.className='cssShoutPressed'"
				onMouseUp="this.className='cssShoutRaised'"
				onMouseOut="this.className='cssShoutRaised'"
				onClick="confirmDelete(<?php 
            echo $id;
            ?>
)">
				<img src="delete.gif" width="10" height="10">
				</div>
<?php 
        }
        $class = in_array(strtolower($name), $reservedNames) ? 'cssShoutTextAdmin' : 'cssShoutText';
        ?>
			<div class="cssShoutTime" style="background-color:<?php 
        echo $bgcolor;
        ?>
">
			<?php 
        echo $tstamp;
        ?>
			</div>
			<div class="<?php 
        echo $class;
        ?>
" style="background-color:<?php 
        echo $bgcolor;
        ?>
">
			<?php 
        if ($email) {
            echo '<a href="mailto:' . $email . '">';
        }
        ?>
			<b><?php 
        echo $name;
        ?>
:</b><?php 
        if ($email) {
            echo '</a>';
        }
        ?>
 <?php 
        echo $text;
        ?>
			</div>
<?php 
    }
}