function _getHostByAddr_timeout($ip, $timeout = 2, $fallback = false) { static $host_bin = null; if ($host_bin === null) { $host_bin = find_executable('host', array('/usr/bin/', '/usr/sbin/', '/bin/', '/sbin/')); if (empty($host_bin)) { $host_bin = false; } } if ($host_bin) { $err = 0; $out = array(); exec('LANG=C ' . $host_bin . ' -W ' . (int) abs($timeout) . ' ' . qsa($ip) . ' 2>>/dev/null', $out, $err); if ($err == 0) { if (preg_match('/pointer ([a-z0-9.\\-_]+)/i', implode("\n", $out), $m)) { $host = $m[1]; if (subStr($host, -1) === '.') { $host = subStr($host, 0, -1); } return $host; } } } else { if ($fallback) { $host = getHostByAddr($ip); if (empty($host) || $host == $ip) { return false; } return $host; } } return false; }
_server_error('Failed to convert file.'); } } else { $sox = '/bin/false'; } if (in_array($fmt, array('mp3'), true)) { $lame = find_executable('lame', array('/usr/local/bin/', '/usr/bin/', '/usr/local/sbin/', '/usr/sbin/')); if (!$lame) { gs_log(GS_LOG_WARNING, 'lame - command not found.'); _server_error('Failed to convert file.'); } } else { $lame = '/bin/false'; } if (in_array($fmt, array('ogg'), true)) { $oggenc = find_executable('oggenc', array('/usr/local/bin/', '/usr/bin/', '/usr/local/sbin/', '/usr/sbin/')); if (!$oggenc) { gs_log(GS_LOG_WARNING, 'oggenc - command not found.'); _server_error('Failed to convert file.'); } } else { $oggenc = '/bin/false'; } $rs = $DB->execute('SELECT `m`.`host_id`, `m`.`orig_time`, `m`.`dur`, `m`.`cidnum`, `m`.`cidname`, `m`.`listened_to`, `m`.`orig_mbox`, `h`.`host` FROM `vm_msgs` `m` LEFT JOIN `hosts` `h` ON (`h`.`id`=`m`.`host_id`) WHERE `m`.`user_id`=\'' . $user_id . '\' AND
$id3_artist = subStr(_to_id3tag_ascii($id3_artist), 0, 30); $id3_title = subStr(_to_id3tag_ascii($id3_title), 0, 30); $id3_comment = ''; /* if ($info['orig_mbox'] != $ext && $info['orig_mbox'] != '') { $id3_comment .= '<< '.$info['orig_mbox']; } */ $id3_comment = subStr(_to_id3tag_ascii($id3_comment), 0, 28); $sox = find_executable('sox', array('/usr/bin/', '/usr/local/bin/', '/usr/sbin/', '/usr/local/sbin/')); if (!$sox) { gs_log(GS_LOG_WARNING, 'sox - command not found.'); _server_error('Failed to convert file.'); } $lame = find_executable('lame', array('/usr/local/bin/', '/usr/bin/', '/usr/local/sbin/', '/usr/sbin/')); if (!$lame) { gs_log(GS_LOG_WARNING, 'lame - command not found.'); _server_error('Failed to convert file.'); } $cmd = $sox . ' -q -t al ' . qsa($origfile) . ' -r 8000 -c 1 -s -b 16 -t wav - 2>>/dev/null | ' . $lame . ' --preset fast standard -m m -a -b 32 -B 96 --quiet --ignore-tag-errors --tt ' . qsa($id3_title) . ' --ta ' . qsa($id3_artist) . ' --tl ' . qsa($id3_album) . ' --tc ' . qsa($id3_comment) . ' --tg 101 - ' . qsa($outfile) . ' 2>&1 1>>/dev/null'; # (ID3 tag genre 101 = "Speech") $err = 0; $out = array(); @exec($cmd, $out, $err); if ($err != 0) { gs_log(GS_LOG_WARNING, 'Failed to convert voicemail file to ' . $fmt . '. (' . trim(implode(' - ', $out)) . ')'); _server_error('Failed to convert file.'); } $DB->execute('UPDATE `vm_msgs` SET `listened_to`=1
function gs_pci_cards_detect() { $lspci = find_executable('lspci', array('/usr/bin/', '/usr/sbin/', '/bin/', '/sbin/')); if (!$lspci) { gs_log(GS_LOG_WARNING, 'lspci not found.'); return null; } $err = 0; $out = array(); @exec($lspci . ' -m -n -D 2>>/dev/null', $out, $err); /* $out = array( '0000:09:00.0 "Class 0200" "14e4" "164c" -r12 "1028" "01b2"', '0000:0c:00.0 "Class 0604" "11ab" "1111" "" ""', '0000:0d:08.0 "Class 0780" "d161" "0220" -r02 "0004" "0000"', '0000:0f:00.0 "Class 0604" "8086" "0329" -r09 "" ""', '0000:00:00.0 "Class 0000" "e159" "0001" "b1d9" "0003"', '0000:00:00.0 "Class 0204" "e159" "0001" "0000" "0000"', ); */ if ($err !== 0) { gs_log(GS_LOG_WARNING, 'lspci failed.'); return null; } $cards = array(); $i = 0; foreach ($out as $line) { preg_match_all('/"([^"]*)"/', $line, $m, PREG_PATTERN_ORDER); if (count($m[1]) < 5) { continue; } $c = array('class' => null, 'vendorid' => null, 'devid' => null, 'subvendorid' => null, 'subdevid' => null, 'revision' => null); $m2 = array(); if (preg_match('/\\b([0-9a-z]{4})\\b/S', $m[1][0], $m2)) { $c['class'] = $m2[1]; } $m2 = array(); if (preg_match('/\\b([0-9a-z]{4})\\b/S', $m[1][1], $m2)) { $c['vendorid'] = $m2[1]; } $m2 = array(); if (preg_match('/\\b([0-9a-z]{4})\\b/S', $m[1][2], $m2)) { $c['devid'] = $m2[1]; } $m2 = array(); if (preg_match('/\\b([0-9a-z]{4})\\b/S', $m[1][3], $m2)) { $c['subvendorid'] = $m2[1]; } $m2 = array(); if (preg_match('/\\b([0-9a-z]{4})\\b/S', $m[1][4], $m2)) { $c['subdevid'] = $m2[1]; } $m2 = array(); if (preg_match('/\\s+-r([0-9a-z]{2})\\b/S', $line, $m2)) { $c['revision'] = $m2[1]; } $c['vendor'] = ''; $c['descr'] = ''; $c['known'] = false; $c['driver'] = ''; $c['kmod'] = ''; //$c['ports' ] = 0; //$c['chans' ] = 0; switch ($c['vendorid']) { case 'd161': # Digium $c['vendor'] = 'Digium'; switch ($c['devid']) { case '0120': $c['descr'] = 'TE120p/TE121/TE122 (1-port PRI, 3rd gen., PCIe 3.3v)'; $c['driver'] = 'zaptel'; $c['kmod'] = 'wcte12xp'; break; case '0205': $c['descr'] = 'TE205p/TE207p (2-port PRI, 3rd gen.)'; $c['driver'] = 'zaptel'; $c['kmod'] = 'wct4xxp'; break; case '0210': $c['descr'] = 'TE210p/TE212p (2-port PRI, 3rd gen.)'; $c['driver'] = 'zaptel'; $c['kmod'] = 'wct4xxp'; break; case '0220': $c['descr'] = 'TE220/TE220b (2-port PRI, 3rd gen., PCIe 3.3v)'; $c['driver'] = 'zaptel'; $c['kmod'] = 'wct4xxp'; break; case '0405': $c['descr'] = 'TE405p/TE407p (4-port PRI, 3rd gen., 5.0v)'; $c['driver'] = 'zaptel'; $c['kmod'] = 'wct4xxp'; break; case '0406': $c['descr'] = 'TE406p (4-port PRI, 3rd gen., 5.0v)'; $c['driver'] = 'zaptel'; $c['kmod'] = 'wct4xxp'; break; case '0410': $c['descr'] = 'TE410p/TE412p (4-port PRI, 3rd gen., 3.3v)'; $c['driver'] = 'zaptel'; $c['kmod'] = 'wct4xxp'; break; case '0411': $c['descr'] = 'TE411p (4-port PRI, 3rd gen., 3.3v)'; $c['driver'] = 'zaptel'; $c['kmod'] = 'wct4xxp'; break; case '0420': $c['descr'] = 'TE420/TE420b (4-port PRI, 3rd gen., PCIe 3.3v)'; $c['driver'] = 'zaptel'; $c['kmod'] = 'wct4xxp'; break; case '2400': $c['descr'] = 'TDM2400 (analog)'; break; case 'b410': $c['descr'] = 'B410p (4-port BRI)'; $c['driver'] = 'misdn'; break; } break; case '1923': # Sangoma switch ($c['devid']) { case '0040': $c['descr'] = 'A200/remora (FXO/FXS analog) - unknown'; switch ($c['subvendorid']) { case 'a700': $c['descr'] = 'B700 FlexBRI (0/2/4-port BRI and 0/2-port FXS/FXO)'; $c['driver'] = 'wanpipe,zaptel'; break; } break; case '0100': $c['descr'] = 'A104 (4-port PRI) - unknown'; switch ($c['subvendorid']) { } break; case '0400': $c['descr'] = 'A104 (4-port PRI) - unknown'; switch ($c['subvendorid']) { } break; case '0300': $c['descr'] = 'A101 (1-port PRI) - unknown'; switch ($c['subvendorid']) { } break; } break; case 'e159': # Tiger Jet Network $c['vendor'] = 'Tiger Jet'; switch ($c['devid']) { case '0001': if ($c['subvendorid'] === '0059' && $c['subdevid'] === '0001') { $c['descr'] = '3XX (128k ISDN-S/T)'; } elseif ($c['subvendorid'] === '0059' && $c['subdevid'] === '0003') { $c['descr'] = '3XX (128k ISDN-U)'; } elseif ($c['subvendorid'] === '00a7' && $c['subdevid'] === '0001') { $c['descr'] = 'Teles S0 ISDN'; } elseif ($c['subvendorid'] === '8086' && $c['subdevid'] === '0003') { $c['descr'] = 'Digium X100p/X101p (analog FXO)'; } elseif ($c['subvendorid'] === 'b1d9' && $c['subdevid'] === '0003') { $c['descr'] = 'Digium TDM400p/A400p (4x analog FXO/FXS)'; } else { $c['descr'] = '3XX (modem/ISDN)'; } break; case '0002': $c['descr'] = '100APC (ISDN)'; break; } break; case '10ee': # Xilinx $c['vendor'] = 'Xilinx'; switch ($c['devid']) { case '0205': $c['descr'] = 'Digium TE205p (2-port PRI, 1st/2nd gen.)'; $c['driver'] = 'zaptel'; $c['kmod'] = 'wct4xxp'; break; case '0210': $c['descr'] = 'Digium TE210p (2-port PRI, 1st/2nd gen.)'; $c['driver'] = 'zaptel'; $c['kmod'] = 'wct4xxp'; break; case '0314': $c['descr'] = 'Digium TE405p/TE410p (4-port PRI, 1st gen.)'; $c['driver'] = 'zaptel'; $c['kmod'] = 'wct4xxp'; break; case '0405': $c['descr'] = 'Digium TE405p (4-port PRI, 2nd gen.)'; $c['driver'] = 'zaptel'; $c['kmod'] = 'wct4xxp'; break; case '0410': $c['descr'] = 'Digium TE410p (4-port PRI, 2nd gen.)'; $c['driver'] = 'zaptel'; $c['kmod'] = 'wct4xxp'; break; } break; case '1057': # Motorola $c['vendor'] = 'Motorola'; switch ($c['devid']) { case '5608': $c['descr'] = 'Digium X100p (analog FXO)'; break; } break; case '1397': # Cologne Chip Designs $c['vendor'] = 'Cologne'; switch ($c['devid']) { case '2bd0': $c['descr'] = 'HFC-S 2BDS0 (BRI)'; $c['driver'] = 'misdn'; $c['kmod'] = 'hfcmulti'; break; case '8b4d': $c['descr'] = 'HFC-4S 8B4D4S0 (BRI, 4 S/T)'; $c['driver'] = 'misdn'; $c['kmod'] = 'hfcmulti'; break; case '0b4d': $c['descr'] = 'HFC-8S 16B8D8S0 (BRI, 8 S/T)'; $c['driver'] = 'misdn'; $c['kmod'] = 'hfcmulti'; break; case '08b4': $c['descr'] = 'HFC-4S (4-port BRI)'; $c['driver'] = 'misdn'; $c['kmod'] = 'hfcmulti'; break; case '16b8': $c['descr'] = 'HFC-8S (8-port BRI)'; $c['driver'] = 'misdn'; $c['kmod'] = 'hfcmulti'; break; case '30b1': $c['descr'] = 'HFC-E1 (PRI)'; break; case 'f001': $c['descr'] = 'HFC-4GSM (GSM)'; break; } break; case 'affe': # Sirrix $c['vendor'] = 'Sirrix'; switch ($c['devid']) { case 'dead': # affe:dead :-) $c['descr'] = '4S0 (4-port BRI)'; break; case '02e1': $c['descr'] = '2E1 (2-port PRI)'; break; } break; default: if ($c['class'] === '0204') { $c['descr'] = 'unknown ISDN controller'; } elseif ($c['class'] === '0780') { $c['descr'] = 'unknown communication controller'; } } if ($c['vendor'] != '' && $c['descr'] != '') { $c['known'] = true; } $cards[] = $c; } return $cards; }
debuglog(" Image is not cached", "TOMATO", 9); $aagh = url_get_contents($url); if ($aagh['status'] == "200") { debuglog("Cached Image " . $outfile, "TOMATO", 9); file_put_contents($outfile, $aagh['contents']); } else { debuglog("Failed to download " . $url . " - status was " . $aagh['status'], "TOMATO", 7); // header('Content-type: image/svg+xml'); // readfile('newimages/compact_disc.svg'); header("HTTP/1.1 404 Not Found"); exit(0); exit(0); } } $mime = 'image/' . end($ext); $convert_path = find_executable("identify"); $o = array(); $r = exec($convert_path . "identify -verbose " . $outfile . " | grep Mime"); // debuglog("Checking MIME type : ".$r,"TOMATO"); if (preg_match('/Mime type:\\s+(.*)$/', $r, $o)) { if ($o[1]) { $mime = $o[1]; } } else { $r = exec($convert_path . "identify -verbose " . $outfile . " | grep Format"); if (preg_match('/Format:\\s+(.*?) /', $r, $o)) { if ($o[1]) { $mime = 'image/' . strtolower($o[1]); } } }
if ($mbid != "") { $searchfunctions = array('tryLocal', 'trySpotify', 'tryMusicBrainz', 'tryLastFM'); } else { $searchfunctions = array('tryLocal', 'trySpotify', 'tryLastFM', 'tryMusicBrainz'); } debuglog(" KEY : " . $fname, "GETALBUMCOVER"); debuglog(" SOURCE : " . $src, "GETALBUMCOVER"); debuglog(" UPLOAD : " . $file, "GETALBUMCOVER"); debuglog(" STREAM : " . $stream, "GETALBUMCOVER"); debuglog(" ARTIST : " . $artist, "GETALBUMCOVER"); debuglog(" ALBUM : " . $album, "GETALBUMCOVER"); debuglog(" MBID : " . $mbid, "GETALBUMCOVER"); debuglog(" PATH : " . $albumpath, "GETALBUMCOVER"); debuglog(" ALBUMURI : " . $albumuri, "GETALBUMCOVER"); // Attempt to download an image file $convert_path = find_executable("convert"); $download_file = ""; if ($file != "") { $in_collection = $stream == "" ? true : false; $download_file = get_user_file($file, $fname, $_FILES['ufile']['tmp_name']); } elseif ($src != "") { $in_collection = $stream == "" ? true : false; $download_file = download_file($src, $fname, $convert_path); } elseif ($base64data != "") { $in_collection = $stream == "" ? true : false; $download_file = save_base64_data($base64data, $fname); } else { while (count($searchfunctions) > 0 && $src == "") { $fn = array_shift($searchfunctions); $src = $fn(); if ($src != "") {
?></td> </tr> <?php */ ?> <tr> <td><?php echo __('Ausführungsrechte'); ?> :</td> <td> </td> <td <?php $user_info = @posix_getpwuid(@posix_geteuid()); $username = @$user_info['name']; unset($user_info); $expect_basename = 'expect'; $expect = find_executable($expect_basename, array('/usr/bin/', '/usr/sbin/', '/usr/local/bin/', '/usr/local/sbin/')); if (!$expect) { _test_result(sPrintF('FEHLER ("%s" nicht gefunden)', $expect_basename), 'warn'); } else { $gs_sbin_dir = '/opt/gemeinschaft/sbin/'; $sudo_check = $gs_sbin_dir . 'sudo-check'; $sudo_sudo_check = $gs_sbin_dir . 'sudo-sudo-check'; if (!file_exists($sudo_check) || !file_exists($sudo_sudo_check)) { _test_result('FEHLER (Test-Skript nicht gefunden)', 'warn'); } else { $err = 0; $out = array(); @exec($sudo_check . ' 1>>/dev/null 2>>/dev/null', $out, $err); if ($err !== 0) { _test_result(sPrintF('FEHLER (User "%s" hat nicht genügend Rechte)', $username), 'warn'); } else {
if (preg_match('/^\\s+/S', $line, $m)) { $indent = ' '; $line = subStr($line, strLen($m[0])); } else { $indent = ''; } $out .= $indent . htmlEnt($line) . "\n"; } echo '<pre>', "\n"; echo $out; echo '</pre>', "\n"; } } echo '<br />', "\n"; echo '<h3>ifconfig</h3>', "\n"; $ifconfig = find_executable('ifconfig', array('/sbin/', '/bin', '/usr/sbin/', '/usr/bin', '/usr/local/sbin/', '/usr/local/bin')); if (empty($ifconfig)) { echo 'Could not find ifconfig.', "\n"; } else { $err = 0; $out = array(); @exec('/sbin/ifconfig 2>>/dev/null', $out, $err); if ($err != 0) { echo 'Could not read ifconfig.', "\n"; } else { echo '<pre>', "\n"; foreach ($out as $line) { $line = htmlEnt($line); $line = preg_replace('/([0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3})/S', ' <b style="color:#00e;">$1</b>', $line); if (preg_match('/^([a-z0-9\\-_:.]+)(.*)/iS', $line, $m)) { echo '<b style="color:#00e;">', $m[1], '</b>', $m[2], "\n";
function check_album_image() { // This archives stuff with getRemoteImage, which will mostly come from the // last.FM importer global $album, $albumartist, $error, $download_file, $convert_path, $image; $imagekey = md5($albumartist . " " . $album); if (preg_match('#^getRemoteImage\\.php#', $image) && !file_exists('albumart/small/' . $imagekey . '.jpg')) { $u = get_base_url(); $u = preg_replace('#backends/sql#', '', $u); $convert_path = find_executable('convert'); $download_file = download_file($u . $image, $imagekey, $convert_path); if ($error !== 1) { list($image, $a) = saveImage($imagekey, true, ""); } } }
"><button type="button"><?php echo __('Abbrechen'); ?> </button></a> <button type="submit" style="color:#a00;"><?php echo __('Neustarten'); ?> </button> </form> <?php } else { $action = @$_POST['action']; if ($action === 'shutdown2' || $action === 'reboot2') { if (@$_REQUEST['confirm'] === 'yes') { $shutdown = find_executable('shutdown', array('/sbin/', '/bin/')); if (!$shutdown) { echo 'shutdown not found.', "\n"; } else { if (@file_exists('/usr/sbin/gs-pre-shutdown')) { $err = 0; $out = array(); @exec('sudo /usr/sbin/gs-pre-shutdown 2>>/dev/null', $out, $err); } if ($action === 'shutdown2') { $shutdown_args = ' -h -P now'; } else { $shutdown_args = ' -r now'; } @flush(); @ob_implicit_flush(1);