本文整理汇总了PHP中MiscLib::pingport方法的典型用法代码示例。如果您正苦于以下问题:PHP MiscLib::pingport方法的具体用法?PHP MiscLib::pingport怎么用?PHP MiscLib::pingport使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MiscLib
的用法示例。
在下文中一共展示了MiscLib::pingport方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testMiscLib
public function testMiscLib()
{
chdir(dirname(__FILE__) . '/../../pos/is4c-nf/gui-modules/');
$rel = MiscLib::baseURL();
$this->assertEquals('../', $rel);
$this->assertEquals(1, MiscLib::nullwrap(1));
$this->assertEquals(1.5, MiscLib::nullwrap(1.5));
$this->assertEquals('test', MiscLib::nullwrap('test'));
$this->assertEquals(0, MiscLib::nullwrap(False));
$this->assertEquals(1, MiscLib::truncate2(1));
$this->assertEquals(1.99, MiscLib::truncate2(1.99));
$this->assertEquals(1.99, MiscLib::truncate2("1.99"));
$this->assertEquals(1.35, MiscLib::truncate2("1.345"));
$hostCheck = MiscLib::pingport(CoreLocal::get('localhost'), CoreLocal::get('DBMS'));
$this->assertInternalType('integer', $hostCheck);
$hostCheck = MiscLib::win32();
$this->assertInternalType('integer', $hostCheck);
$scale = MiscLib::scaleObject();
if ($scale !== 0) {
$this->assertInstanceOf('ScaleDriverWrapper', $scale);
}
}
示例2: get
/**
Prepare the tender report.
@return string The report, ready to send to printer.
*/
public static function get()
{
global $CORE_LOCAL;
/* First, check for anything still in
* . localtemptrans
* . dtransactions
* and for a proper End of Shift.
*/
$localCheck = "";
$db_a = Database::tDataConnect();
$localQ = "SELECT *\n FROM localtemptrans\n ORDER BY datetime";
$localR = $db_a->query($localQ);
$rowCount1 = 0;
$transCount1 = 0;
$endOfShiftCount1 = 0;
$lastUPC1 = "";
while ($localRow = $db_a->fetch_row($localR)) {
$rowCount1++;
$lastUPC1 = $localRow['upc'];
if ($lastUPC1 == 'ENDOFSHIFT') {
$endOfShiftCount1++;
}
if ($localRow['trans_type'] == 'A') {
$transCount1++;
}
}
$localQ = "SELECT *\n FROM dtransactions\n ORDER BY datetime";
$localR = $db_a->query($localQ);
$rowCount2 = 0;
$transCount2 = 0;
$endOfShiftCount2 = 0;
$lastUPC2 = "";
while ($localRow = $db_a->fetch_row($localR)) {
$rowCount2++;
$lastUPC2 = $localRow['upc'];
if ($lastUPC2 == 'ENDOFSHIFT') {
$endOfShiftCount2++;
}
if ($localRow['trans_type'] == 'A') {
$transCount2++;
}
}
/* Ideally, either
* . both tables are empty
* . there is one record, an upc=ENDOFSHIFT,
* in either localtemptrans or dtransactions
* and the other table is empty.
*/
if ($rowCount1 == 0 && $rowCount2 == 0) {
$localCheck .= "\n\nThe shift was ended properly, buffers empty. " . "Good!";
} elseif ($lastUPC1 == 'ENDOFSHIFT' && $rowCount1 == 1 && $rowCount2 == 0 || $lastUPC2 == 'ENDOFSHIFT' && $rowCount2 == 1 && $rowCount1 == 0) {
$localCheck .= "\n\nThe shift was ended properly, EndOfShift only. " . "Good!";
} elseif ($lastUPC1 == 'ENDOFSHIFT' && ($rowCount1 > 0 || $endOfShiftCount1 > 0)) {
$localCheck .= "\n\nThe local transaction-in-progress buffer suggests " . "the shift was ended but perhaps not properly. " . "\n Please SignOff once again and then re-run this report." . "\n If the same problem or another one is reported just use the " . "\n last or best report you have.";
} elseif ($rowCount1 > 0) {
$localCheck .= "\nThe local transaction-in-progress still contains " . "{$rowCount1} items." . "\nPlease complete or cancel the current transaction " . "and run this " . "\n report again." . "\n If the same problem or another one is reported just use the " . "\n last or best report you have.";
} elseif ($lastUPC2 == 'ENDOFSHIFT' && ($rowCount2 > 0 || $endOfShiftCount2 > 0)) {
$localCheck .= "\n\nThe local completed-transaction buffer suggests " . "the shift " . "\n was ended but perhaps not properly. " . "\n Please SignOff once again and then re-run this report." . "\n If the same problem or another one is reported just use the " . "\n last or best report you have.";
} else {
$localCheck .= "\n\nThe local completed-transaction buffer suggests " . "the shift was not " . "\n ended properly. " . "\nPlease SignOff, again if you already have, and then re-run " . "this report." . "\n If the same problem or another one is reported just use the " . "\n last or best report you have.";
}
if ($transCount2 > 0) {
$localCheck .= "\n\nThe local completed-transaction buffer contains " . "{$transCount2} transactions " . "\n that probably will not appear in this report. " . "\n Please alert the shift co-ordinator.";
}
if (MiscLib::pingport($CORE_LOCAL->get("mServer"), $CORE_LOCAL->get("mDBMS"))) {
$db_a = Database::mDataConnect();
$tTable = "dlog";
$tDate = "tdate";
$tSource = "Fannie";
$excl = "";
} else {
$db_a = Database::tDataConnect();
$tTable = "localtranstoday";
$tDate = "datetime";
$tSource = "Lane" . $CORE_LOCAL->get('laneno');
$excl = " AND d.trans_status not in ('D','X','Z') AND d.emp_no <> 9999 " . "AND d.register_no <> 99";
}
self::$db_a = $db_a;
self::$tTable = $tTable;
self::$tDate = $tDate;
self::$excl = $excl;
$shiftCutoff = date('Y-m-d 00:00:00');
self::$shiftCutoff = $shiftCutoff;
$DESIRED_TENDERS = $CORE_LOCAL->get("TRDesiredTenders");
self::$dashLine = str_repeat('-', 54);
$receipt = "";
$blank = str_repeat(' ', 13);
/* Literal spacing from left margin.
C a s h
------------------------------------------------------
Time Lane Trans # Emp # Mem # Amount
03:27 PM 1 1 62 484 -6.00
04:14 PM 1 1 63 484 -7.00
------------------------------------------------------
Count: 2 Total: -13.00
*/
//.........这里部分代码省略.........
示例3: header
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*********************************************************************************/
if (!class_exists("AutoLoader")) {
include "lib/AutoLoader.php";
}
CoreLocal::set("parse_chain", '');
CoreLocal::set("preparse_chain", '');
CoreLocal::set("postparse_chain", '');
AutoLoader::loadMap();
CoreState::initiate_session();
if (CoreLocal::get("SessionFirstRun") == "") {
CoreLocal::set("SessionFirstRun", 1);
}
CoreLocal::migrateSettings();
if (MiscLib::pingport('127.0.0.1:15674', 'not a database')) {
CoreLocal::set('MQ', true);
} else {
CoreLocal::set('MQ', false);
}
/**
Go to login screen if no one is signed in
Go to lock screen if someone is signed in
*/
if (!headers_sent()) {
$my_url = MiscLib::base_url();
if (CoreLocal::get('LoggedIn') == 0) {
header("Location: {$my_url}gui-modules/login2.php");
} else {
header("Location: {$my_url}gui-modules/login3.php");
}
示例4: elseif
echo InstallUtilities::installTextField('mDatabase', 'core_trans');
?>
</td>
</tr>
<tr>
<td colspan=2>
<div class="noteTxt">
Testing server connection:
<?php
$sql = InstallUtilities::dbTestConnect(CoreLocal::get('mServer'), CoreLocal::get('mDBMS'), CoreLocal::get('mDatabase'), CoreLocal::get('mUser'), CoreLocal::get('mPass'));
if ($sql === False) {
echo "<span class='fail'>Failed</span>";
echo '<div class="db_hints" style="margin-left:25px;width:350px;">';
if (!function_exists('socket_create')) {
echo '<i>Try enabling PHP\'s socket extension in php.ini for better diagnostics</i>';
} elseif (@MiscLib::pingport(CoreLocal::get('mServer'), CoreLocal::get('DBMS'))) {
echo '<i>Database found at ' . CoreLocal::get('mServer') . '. Verify username and password
and/or database account permissions.</i>';
} else {
echo '<i>Database does not appear to be listening for connections on ' . CoreLocal::get('mServer') . '. Verify host is correct, database is running and
firewall is allowing connections.</i>';
}
echo '</div>';
} else {
echo "<span class='success'>Succeeded</span><br />";
//echo "<textarea rows=3 cols=80>";
$sErrors = InstallUtilities::createMinServer($sql, CoreLocal::get('mDatabase'));
$sErrors = array_filter($sErrors, function ($x) {
return $x['error'] != 0;
});
if (!empty($sErrors)) {
示例5: uploadtoServer
/**
See if the remote database is available
This function calls uploadtoServer() if
the initial test works.
@return integer
- 1 server available
- 0 server down
*/
public static function testremote()
{
$intConnected = MiscLib::pingport(CoreLocal::get("mServer"), CoreLocal::get("mDBMS"));
if ($intConnected == 1) {
self::uploadtoServer();
} else {
CoreLocal::set("standalone", 1);
}
return (CoreLocal::get("standalone") + 1) % 2;
}