<?php function includeIfExists($file) { if (file_exists($file)) { return include $file; } } if (!($loader = includeIfExists(__DIR__ . "/../vendor/autoload.php")) && !($loader = includeIfExists(__DIR__ . "/../../../autoload.php"))) { die("You must set up the project dependencies, run the following commands:" . PHP_EOL . "curl -s http://getcomposer.org/installer | php" . PHP_EOL . "php composer.phar install" . PHP_EOL); } function humanReadable($addressLine, $result, $iso) { echo "AddressLine: " . str_replace("\n", '\\n', $addressLine) . PHP_EOL; echo "Result: " . print_r($result, true) . PHP_EOL; //markdown table output //echo '| '.$iso.' | '.str_replace("\n", '<br>', $addressLine).' | '.str_replace("\n", '<br>', print_r($result, true)).' | '.PHP_EOL; } $examples = array(array("PL", "KORNELA UJEJSKIEGO 12 M7\n30-102 KRAKÓW"), array("PL", "AL. 29 LISTOPADA 155C\n31-406 KRAKów"), array("PL", "AL. JERZEGO WASZYNGTONA 45/51\n04-008 WARSZAWA"), array("GB", "C/O BMW UK GROUPTAX FR-3-UK SUMMIT ONE SUMMIT AVENUE\nFARNBOROUGH\nGU14 0FB"), array("GB", "28-29 THE BROADWAY EALING\nLONDON\nW5 2NP"), array("GB", "28-29 THE BROADWAY\nEALING\nLONDON\n\nW5 2NP"), array("GB", "10 THE GRANGEWAY\nGRANGE PARK\nLONDON\nN21 2HA"), array("GB", "254 BANNERDALE ROAD\nSHEFFIELD\nS11 9FE"), array("PT", "R FIGUEIRAS N 616 MAIA\n4475-011\nMAIA"), array("LU", "40, RUE ANTOINE MEYER L-2153 LUXEMBOURG"), array("NL", " EEKHORSTWEG 00031 A 7942KC MEPPEL "), array("BE", "EZELSTRAAT 69 1 8000 BRUGGE"), array("IT", "P.ZA FERRAVILLA N. 2 20092 CINISELLO BALSAMO MI "), array("BG", "ул. Самуиловско шосе №1А обл.СЛИВЕН, гр.СЛИВЕН 8800"), array("AT", "Herrengasse 44\n7471 Rechnitz"), array("NO", "Setesdalsveien 76\n4617 KRISTIANSAND S"), array("PL", "Not valid pattern"), array("XX", "Not valid isocode")); use Ankalagon\ViesAddressFormatter\ViesFormatter; foreach ($examples as $example) { $result = ViesFormatter::recognize($example[0], $example[1]); echo humanReadable($example[1], $result, $example[0]); }
echo "<td id='mne_sel'>"; echo "<input type=\"checkbox\" name=\"sel_mne[]\" value=\"$row[name]\" id='$row[name]'"; echo "</td>"; echo "<td id='mne'>"; if (strlen($row['name']) < 26) { echo "$row[name]"; } else { if (strlen($row['name']) > 39) { echo "<span style=\"font-size: xx-small\">$row[name]</span>"; } else { echo "<span style=\"font-size: x-small\">$row[name]</span>"; } } echo "</td>"; echo "<td id='seen'>"; echo humanReadable($row['seen']) . " times\n"; echo "</td>"; echo "<td id='lastseen'>"; echo getRelativeTime($row['lastseen']) . "\n"; echo "</td>"; echo "</tr>"; $i++; } echo "</tbody>"; echo "</table>"; } else { echo "<b><u>No Mnemonics</u></b><br>"; echo "Either wait for caches to update, or restart your syslog daemon.\n<br>"; } ?>
$addActions[] = $addAction; } else { $addActions[] = $delAction; $l_params['mi_itemid'] = $image['menu_item']['imaging_uuid']; } if ($_GET['target_uuid'] == $image['mastered_on_target_uuid']) { $editActions[] = $editAction; } else { $editActions[] = $emptyAction; } $list_params[] = $l_params; # TODO no label in image! $a_label[] = sprintf("%s%s", '<img src="modules/imaging/graph/images/imaging-action.png" style="vertical-align: middle" /> ', $name); $a_desc[] = $image['desc']; $a_date[] = _toDate($image['creation_date']); $a_size[] = humanReadable($image['size']); $a_inbootmenu[] = isset($image['menu_item']) ? True : False; $a_fromprofile[] = $image['read_only'] ? True : False; $a_info[] = sprintf("Plop: %s", $image['fk_status']); $l_im[] = array($image['imaging_uuid'], $_GET['target_uuid'], $type); } if (!$actions) { if (count($l_im) != 0) { $ret = xmlrpc_areImagesUsed($l_im); foreach ($images as $image) { if ($ret[$image['imaging_uuid']]) { $a_destroy[] = $showImAction; } else { $a_destroy[] = $destroyAction; } }
function humanReadable($val, $thousands = 0) { if ($val >= 1000) { $val = humanReadable($val / 1000, ++$thousands); } else { $unit = array('', 'K', 'M', 'T', 'P', 'E', 'Z', 'Y'); $val = round($val, 2) . $unit[$thousands]; } return $val; }
$showImAction = new ActionPopupItem(_T("Show target using that image", "imaging"), "showtarget", "showtarget", "image", "base", "computers"); foreach ($masters as $master) { $l_params = array(); $l_params = $params; $l_params["itemid"] = $master['imaging_uuid']; $l_params["itemlabel"] = urlencode($master['name']); if (!$master['menu_item']) { $addActions[] = $addAction; } else { $addActions[] = $delAction; } $list_params[] = $l_params; $a_label[] = sprintf("%s%s", '<img src="modules/imaging/graph/images/imaging-action.png" style="vertical-align: middle" /> ', $master['name']); $a_desc[] = $master['desc']; $a_date[] = _toDate($master['creation_date']); $a_size[] = humanReadable($master['size']); $a_is_in_menu[] = $master['menu_item'] ? True : False; $l_im[] = array($master['imaging_uuid'], null, null); } if (count($l_im) != 0) { $ret = xmlrpc_areImagesUsed($l_im); foreach ($masters as $image) { if ($ret[$image['imaging_uuid']]) { $a_destroy[] = $showImAction; } else { $a_destroy[] = $destroyAction; } } } // show images list $l = new OptimizedListInfos($a_label, _T("Label", "imaging"));
<div id="msgbox_br" class="jGrowl bottom-right"></div> <div id="msgbox_bl" class="jGrowl bottom-left"></div> <div id="msgbox_tc" class="jGrowl center"></div> <?php switch ($err) { case "license": echo '<div id="message_box">Your license file is either expired or invalid</div>'; break; case "hosts": echo "<div id=\"message_box\">The ".humanReadable($v)." host limit for your license has been exceeded<br /> <a href=\"http://www.logzilla.pro/licensing\">Click here to upgrade</a> </div>"; break; case "mpd": echo "<div id=\"message_box\">The ".humanReadable($v)." message limit for your license has been exceeded<br /> <a href=\"http://www.logzilla.pro/licensing\">Click here to upgrade</a> </div>"; break; case "noauth": echo "<div id=\"message_box\">Your license does not allow for auth types other than \"local\" or \"none\"<br /> <a href=\"http://www.logzilla.pro/packs/ldap\">Click here to upgrade</a> </div>"; break; case "nocharts": echo "<div id=\"message_box\">Your license does not allow for ad-hoc charts<br /> <a href=\"http://www.logzilla.pro/packs/charts\">Click here to upgrade for only $49.00</a> </div>"; break; case "noalerts": echo "<div id=\"message_box\">Your license does not allow for email alerts<br />