Пример #1
0
 /**
  * Sets our option value and encodes it if required.
  *
  * @param  mixed  $value
  * @return mixed
  */
 public function setChecksumAttribute($value)
 {
     if (!is_binary($value)) {
         $value = hex2bin($value);
     }
     $this->attributes['checksum'] = binary_sql($value);
 }
Пример #2
0
 public function __construct($cidr = null, $end = null)
 {
     if ($cidr === null || $cidr === "") {
         return parent::__construct(Request::ip());
     }
     // Passing a static, return it.
     if ($cidr instanceof static) {
         // If no end, return $cidr.
         if ($end === null) {
             return parent::__construct($cidr->getStart(), $cidr->getEnd());
         }
         // If end is a static, we are creating a range with two exising IPs.
         if ($end instanceof static) {
             $end = $end->getEnd();
         }
         // If $end is binary, return it to base64.
         if (is_binary($end)) {
             $end = inet_ntop($end);
         }
         return parent::__construct($cidr->getStart(), $end);
     } else {
         if (is_binary($cidr)) {
             try {
                 $start = inet_ntop($cidr);
             } catch (\Exception $e) {
                 Log::warning("App\\Support\\IP::__construct trying to make IP from \$cidr binary value \"{$cidr}\" 0x" . bin2hex($cidr) . ", but it's not a real IP!");
                 if (!env('APP_DEBUG', false)) {
                     $start = "127.0.0.1";
                 } else {
                     throw $e;
                 }
             }
         } else {
             try {
                 $start = inet_ntop($cidr);
             } catch (\Exception $e) {
                 $start = $cidr;
             }
         }
     }
     // Passing a static, return it.
     if ($end instanceof static) {
         return parent::__construct($start, $end->getEnd());
     } else {
         if (is_binary($end)) {
             try {
                 $end = inet_ntop($end);
             } catch (\Exception $e) {
                 Log::warning("App\\Support\\IP::__construct trying to make IP from \$end binary value \"{$cidr}\" 0x" . bin2hex($end) . ", but it's not a real IP!");
                 if (!env('APP_DEBUG', false)) {
                     $end = "127.0.0.1";
                 } else {
                     throw $e;
                 }
             }
         }
     }
     return parent::__construct($start, $end);
 }
function directory_to_array($directory, $ignores = NULL, $only_binary_files = false)
{
    if (!$ignores) {
        $ignores = array('.', '..');
    }
    $array_items = array();
    $handle = @opendir($directory);
    if (!$handle) {
        return array();
    }
    $file = readdir($handle);
    $dirs = array();
    while ($file !== false) {
        if (in_array($file, $ignores)) {
            $file = readdir($handle);
            continue;
        }
        $filepath = realpath($directory . "/" . $file);
        $dir = array_pop(explode("/", $directory));
        if (!is_readable($filepath)) {
            $file = readdir($handle);
            continue;
        }
        if (is_dir($filepath)) {
            array_push($dirs, $filepath);
        } else {
            if ($only_binary_files && !is_binary($filepath)) {
                $file = readdir($handle);
                continue;
            }
            $relative_path = $dir != '' ? $dir . "/" : '';
            $array_items[] = preg_replace("/\\/\\//si", "/", $relative_path . $file);
        }
        $file = readdir($handle);
    }
    sort($array_items);
    sort($dirs);
    foreach ($dirs as $filepath) {
        $files = directory_to_array($filepath, $ignores, $only_binary_files);
        if ($dir != '') {
            array_walk($files, 'add_prefix', $dir);
        }
        $array_items = array_merge($array_items, $files);
    }
    closedir($handle);
    return $array_items;
}
Пример #4
0
 /**
  * Stores author_ip as an instance of the support class.
  *
  * @param  \App\Support\IP|string|null  $value  The IP to store.
  * @return \App\Support\IP|null
  */
 public function setAuthorIpAttribute($value)
 {
     if (!is_null($value) && !is_binary($value)) {
         $value = new IP($value);
     }
     return $this->attributes['author_ip'] = $value;
 }
Пример #5
0
 function updatePackage($dstpkg, $dir = "new")
 {
     $work = XOOPS_UPLOAD_PATH . "/update/work/{$dir}";
     $pname = $this->getVar('pname');
     foreach ($this->checkUpdates($dstpkg) as $path => $method) {
         $file = "{$work}/" . $this->getRealPath($path, false);
         if ($method == 'skip') {
             continue;
         }
         if (!mkdir_p(dirname($file))) {
             die("can't mkdir with {$file}");
         }
         switch ($method) {
             case 'new':
             case 'replace':
                 file_put_contents($file, $dstpkg->getFile($path));
                 break;
             case 'patch':
                 $tag = '/\\$(Id|Date|Author|Revision):?[^\\$]*\\$/';
                 $rep = array('$\\1$', '');
                 if (is_binary($path)) {
                     break;
                 }
                 $diff = $this->dbDiff($path);
                 $text = $dstpkg->getFile($path);
                 if (preg_match($tag, $diff)) {
                     $text = preg_replace($tag, '$\\1$', $text);
                 }
                 file_put_contents($file, $text);
                 $fp = popen("patch -l '{$file}'", "w");
                 // line delimiter follow newer file.
                 $regeol = '/(\\r\\n|\\n|\\r)/';
                 // dos, unix, mac
                 if (preg_match($regeol, $text, $d)) {
                     $eol = $d[0];
                     if (preg_match($regeol, $diff, $d) && $d[0] !== $eol) {
                         $diff = str_replace($d[0], $eol, $diff);
                     }
                 }
                 fwrite($fp, $diff);
                 pclose($fp);
                 if (file_exists("{$file}.orig")) {
                     unlink("{$file}.orig");
                 }
                 if (file_exists("{$file}.rej")) {
                     echo "<div>patch failed: {$pname} - {$path}</div>";
                 }
                 break;
             default:
                 echo "<div>{$method}: {$file}<div>\n";
         }
     }
     // force checking again
     $this->unchecked();
     return true;
 }
 /**
  * Check if the file is binary.
  *
  * @param string $sFile
  * @return boolean
  */
 public function isBinary($sFile)
 {
     if (file_exists($sFile)) {
         if (!is_file($sFile)) {
             return 0;
         }
         if (preg_match('/^(.*?)\\.(gif|jpg|jpeg|png|ico|mp3|mp4|mov|avi|flv|mpg|mpeg|wmv|ogg|ogv|webm|pdf|ttf|eot|woff|svg|swf)$/i', $sFile)) {
             return 1;
         }
         $rHandle = fopen($sFile, 'r');
         $sContents = fread($rHandle, 512);
         // Get 512 bytes of the file.
         fclose($rHandle);
         clearstatcache();
         if (!function_exists('is_binary')) {
             // PHP 6
             return is_binary($sContents);
         }
         return 0 or substr_count($sContents, "^ -~", "^\r\n") / 512 > 0.3 or substr_count($sContents, "") > 0;
     }
     return 0;
 }
 public function bindParams($sql, $args = array())
 {
     if (strpos($sql, ":") !== false) {
         preg_match_all("/(\\:[s|d|f|b])+[0-9]+/s", $sql, $matches);
         if (is_array($matches)) {
             foreach ($matches[0] as $n => $s) {
                 #문자타입과 값이 일치하는지 체크
                 $bindtype = substr($s, 1, 1);
                 $bvmatched = false;
                 switch ($bindtype) {
                     case "s":
                         if (is_string($args[$n])) {
                             $bvmatched = true;
                         }
                         break;
                     case "d":
                         if (is_int($args[$n])) {
                             $bvmatched = true;
                         }
                         break;
                     case "f":
                         if (is_float($args[$n])) {
                             $bvmatched = true;
                         }
                         break;
                     case "b":
                         if (is_binary($args[$n])) {
                             $bvmatched = true;
                         }
                         break;
                 }
                 if ($bvmatched) {
                     $sql = str_replace($s, "%" . $bindtype, $sql);
                     $sql = sprintf("{$sql}", $args[$n]);
                 } else {
                     $sql = false;
                     break;
                 }
             }
         }
     }
     return $sql;
 }
<?php

// This one is just for Saving and Uploading a Text based file you working on.
echo "<h2>Sending to {$config->current}</h2><h3>{$store}</h3>";
$selectedFiles = explode("' '", getenv('TM_SELECTED_FILES'));
foreach ($selectedFiles as $file) {
    $file = trim($file, "'");
    if (is_dir($file) || empty($file)) {
        continue;
    }
    $assetKey = calc_asset_key($file);
    //Get the extension
    $extension = pathinfo($assetKey, PATHINFO_EXTENSION);
    if (is_binary($file)) {
        $filecontents = base64_encode(file_get_contents($file));
        $reqData = sprintf($xmlDataTempImage, $filecontents, $assetKey);
    } else {
        $filecontents = htmlspecialchars(file_get_contents($file), ENT_QUOTES, 'UTF-8');
        $reqData = sprintf($xmlDataTemp, $filecontents, $assetKey);
    }
    //Dump the xml into a tmp file
    $xmlFile = tempnam('/tmp', 'foo') . '.xml';
    file_put_contents($xmlFile, $reqData);
    echo "Sending asset: {$assetKey}...<br>";
    $response = send_asset($api_key, $password, $store, $xmlFile);
    if ('200' == response_code($response)) {
        echo "Uploaded: {$assetKey}<br>";
    } else {
        // Not ideal, but it works. Problem (though not much of one ):
        // response on a fail will return the full curl page: ie, shopify 404 full html, + error code at the bottom
        // Will robustify if it becomes an issue.
Пример #9
0
 /**
  * out
  * 
  * @param type $data 
  */
 protected function out($data) {
         $this->Log->debug(__METHOD__);
         
         // Establish the return_options we will work with
         if(isset($this->request['return_options']) && is_array($this->request['return_options'])) {
                 $return_options = array_merge($this->return_options,$this->request['return_options']);
         }
         
         // Override the return_options if we are outputting error data
         if(isset($data['error'])) {
                 $return_options = array(
                     'no_cache'          => true,
                     'last_modified'     => null,
                     'callback'          => null,
                     'mime_type'         => 'text/plain',
                     'format'            => (isset($this->request['return_options']['format']) && 'php'==$this->request['return_options']['format']) ? 'php' : 'json',
                     'pretty_print'      => true,
                 );
         }
         
         // Manage headers related to caching
         if(isset($return_options['no_cache']) && true === $return_options['no_cache']) {
                 header( 'Pragma: no-cache' );
                 header( 'Cache-Control: no-store, no-cache, must-revalidate' ); 
                 //header( 'Cache-Control: post-check=0, pre-check=0', false ); 
         }
         
         // Manage the last modified header
         if(isset($return_options['last_modified']) && !empty($return_options['last_modified'])) {
                 $timestamp = @strtotime($return_options['last_modified']);
                 if($timestamp) {
                         header( 'Last-Modified: ' . gmdate( 'D, d M Y H:i:s',$timestamp ) . ' GMT' ); 
                 }
         }
         
         // callback - this value has been confirmed to be a valid url but *not* a valid email in isValidCall()
         if(isset($return_options['callback']['url']) || isset($return_options['callback']['email'])) {
                 throw new Exception('Non internal socket callbacks are not yet implemented');
         }
         
         // return_options['statistics_data']
         if(isset($return_options['statistics_data']) && true === $return_options['statistics_data']) {
                 $this->call_statistics['time']['processing'] = microtime(true) - $this->call_statistics['time']['request'];
                 $this->call_statistics['performance']['per_second'] = (1/$this->call_statistics['time']['processing']);
                 $data['statistics'] = $this->call_statistics;
         }
         
         // Decide if we provide any debug output
         if(isset($return_options['debug_data']) && true === $return_options['debug_data']) {
                 $data['debug'] = $this->getDebugData();
                 $data['debug']['memory_peak_usage'] = memory_get_peak_usage();
                 $this->Log->debug($data['debug']);
         }
         else {
                 if(isset($data['debug'])) {
                         unset($data['debug']);
                 }
         }
         
         // Manage the mime_type header - this value has been confirmed to be a valid url in isValidCall()
         if(isset($return_options['mime_type']) && !empty($return_options['mime_type'])) {
                 
                 if('json'!=$return_options['format'] && 'application/json'==$return_options['mime_type']) {
                         // do not apply a application/json content type header to non json format data
                 } else {
                         header('Content-type: '.$return_options['mime_type']);
                 }
         }
         
         if(in_array($return_options['format'],array('php','json'))) {
                 
                 // If the return data is binary then we need to encode it before json will accept it
                 if(isset($data['return']) && is_binary($data['return'])) {
                         $data['encoding'] = 'Base64';
                         $data['return'] = base64_encode($data['return']);
                 }
                 
                 // Output JSON
                 if('json'==$return_options['format']) {
                         if(isset($return_options['pretty_print']) && true === $return_options['pretty_print']) {
                                 echo $this->prettyJson(json_encode($data));
                         } else {
                                 echo json_encode($data);
                         }
                 } else {
                         // Output PHP
                         echo serialize($data);
                 }
         } else {
                 // Outout 'none' output format
                 echo $data['return'];
         }
         
         exit(0);
 }
Пример #10
0
<?php

$assetKey = calc_asset_key(getenv('TM_FILEPATH'));
//if its an image file, throw an error message.
if (is_binary(getenv('TM_FILEPATH'))) {
    echo "*Error: This is an image file. Use Send Selected Assets to Shopify instead.";
    exit;
}
$filecontents = htmlspecialchars(file_get_contents('php://stdin'), ENT_QUOTES, 'UTF-8');
$reqData = sprintf($xmlDataTemp, $filecontents, $assetKey);
//Dump the xml into a tmp file
$xmlFile = tempnam('/tmp', 'foo') . '.xml';
file_put_contents($xmlFile, $reqData);
$response = send_asset($api_key, $password, $store, $xmlFile);
if ('200' == response_code($response)) {
    echo "Uploaded {$assetKey} to {$config->current}.";
} else {
    // Not ideal, but it works. Problem (though not much of one ):
    // response on a fail will return the full curl page: ie, shopify 404 full html, + error code at the bottom
    // Will robustify if it becomes an issue.
    echo "*Error: Could not upload {$assetKey} to {$config->current}.";
    output_error($response);
}
//And clean up
unlink($xmlFile);
 public function UpdateStatus($status)
 {
     if ($this->id && is_binary($status)) {
         $this->raw = $this->db->query_update("ServerModule", array('status' => $status));
         if ($this->raw) {
             return true;
         } else {
             return false;
         }
     } else {
         throw new Exception("Problems with module id or with status");
     }
 }
Пример #12
0
 /**
  * callData
  * 
  * @param string $function
  * @param array $params
  * @param array $options optional
  */
 public function callData($function, $params=null, $options=null) {
         
         // Set all the possible options
         $options['key']           = isset($options['key'])            ? $options['key'] : $this->key;
         $options['serialization'] = isset($options['serialization'])  ? $options['serialization'] : $this->serialization;
         $options['compression']   = isset($options['compression'])    ? $options['compression'] : $this->compression;
         $options['encryption']    = isset($options['encryption'])     ? $options['encryption'] : $this->encryption;
         $options['encoding']      = isset($options['encoding'])       ? $options['encoding'] : $this->encoding;
         $options['return_options']= isset($options['return_options']) ? $options['return_options'] : $this->return_options;
         
         // Provide a place to observe the options used
         $this->last['options'] = $options;
         
         // Establish the main data array
         $data = array(
             
             // t -or- timestamp
             't' => time(),
             
             // n -or- nonce 
             'n' => mt_rand(10000000,99999999), // Mersenne twisted random number - could also be anything just needs to be random
             
             // f -or- function
             'f' => $function,
             
             // p -or- parameters
             // NOTE: the B64\0 header indicates binary data encoded with base64_encode!
             'p' => is_binary($params) ? "B64\0".base64_encode($params) : $params,
             
             // o -or- return_options
             'r' => $options['return_options'],
         );
         
         // Remove options if there are none
         if(empty($data['r'])) { unset($data['r']); }
         
         // Provide a place to observe the data used
         $this->last['data'] = $data;
         
         // Keep tally of all the operations we make
         $operations = array();
         
         // Serialization
         switch($options['serialization']) {
                 case 'json':
                         $data = json_encode($data);
                         $operations[] = 'Json'; // Note: CamelCase
                         break;
                 case 'php':
                         $data = serialize($data);
                         $operations[] = 'Php'; // Note: CamelCase
                         break;
                 default:
                         throw new Exception('Unsupported serialization option: '.$options['serialization']);
         }
         
         // Compression
         switch($options['compression']) {
                 case 'gz':
                         $data = gzcompress($data,9);
                         $operations[] = 'Gz'; // Note: CamelCase
                         break;
                 case false: break; // do nothing
                 //case null: break; // do nothing
                 case '': break; // do nothing
                 default:
                         throw new Exception('Unsupported compression option: '.$options['compression']);
         }
         
         // Encryption
         switch($options['encryption']) {
                 case 'aes':
                         $data = $this->encryptAes($data,$options['key']);
                         $operations[] = 'Aes'.(strlen($options['key'])*8);  // mcrypt implementation of rijndael means that key length determines which AES is used, ie AES_128, AES_192 or AES_256
                         break;
                 case false: break; // do nothing
                 //case null: break; // do nothing
                 case '': break; // do nothing
                 default:
                         throw new Exception('Unsupported encryption option: '.$options['encryption']);
         }
         
         // Encoding
         switch($options['encoding']) {
                 case 'base64':
                         $data = strtr(base64_encode($data),'+/=','-_,'); // base64url
                         $operations[] = 'Base64'; // Note: CamelCase
                         break;
                 case 'url':
                         $data = rawurlencode($data);
                         $operations[] = 'Url'; // Note: CamelCase
                         break;
                 case false: break; // do nothing
                 //case null: break; // do nothing
                 case '': break; // do nothing
                 default:
                         throw new Exception('Unsupported encoding option: '.$options['encoding']);
         }
         
         // Provide a place to observe the operations used
         $this->last['operations'] = $operations;
         
         // Return our data
         return $data;
 }
Пример #13
0
 /**
  * callback
  * 
  * @param mixed $data
  * @param array $options
  */
 protected function callback($return_data,$options) {
         
         // Callback data via direct socket
         if(isset($options['callback']['socket'])) {
                 
                 // Setup a socket to spew data back into
                 $socket = socket_create(AF_INET,SOCK_STREAM,getprotobyname('tcp'));
                 
                 $timeout_timestamp = time() + $options['callback']['socket']['timeout'];
                 $usleep_interval = 100; // 1/10000th of a second
                 
                 while(!@socket_connect($socket,$options['callback']['socket']['address'],$options['callback']['socket']['port'])) {
                         
                         usleep($usleep_interval);
                         $usleep_interval = $usleep_interval*1.1; // gradual scaling back of $usleep_interval
                         
                         if(time() > $timeout_timestamp) {
                                 $this->Log->error('Timed out after waiting '.$options['callback']['socket']['timeout'].' seconds to make connection with return data socket end point');
                                 return false;
                         }
                 }
                 
                 // Create a return data package
                 if(is_binary($return_data)) {
                         $data = gzcompress("BIN\0".$return_data.'|'.$options['callback']['socket']['token'],9);
                 } else {
                         $data = gzcompress(json_encode($return_data).'|'.$options['callback']['socket']['token'],9);
                 }
                 
                 // Write everything back using a buffer
                 $data_offset = 0;
                 while ($data_offset < strlen($data)) {
                     $data_sent = @socket_write($socket, substr($data,$data_offset),$data_offset+1024);
                     if ($data_sent === false) {
                             $this->Log->error('Failed while writing data back to callback socket - the response_timeout value may be too low!');
                             return false;
                     }
                     $data_offset += $data_sent;
                 }                         
                 
                 // Close the socket
                 socket_close($socket);
         }
         
         // Callback data via post data to url
         if(isset($options['callback']['url'])) {
                 throw new Exception('Not yet implemeted');
         }
         
         // Callback data via email
         if(isset($options['callback']['email'])) {
                 throw new Exception('Not yet implemeted');
         }
         
         // Callback data via couchdb
         if(isset($options['callback']['couchdb'])) {
                 throw new Exception('Not yet implemeted');
         }
         
         return true;
 }
Пример #14
0
 protected function fix_value(&$value)
 {
     //		if (SQLDEFAULT===$value) { return 'DEFAULT'; }
     if (is_null($value)) {
         return 'NULL';
     }
     if (is_bool($value)) {
         return $value ? 1 : 0;
     }
     if (is_int($value)) {
         return $value;
     }
     if (is_binary($value)) {
         return $this->DBM->quote_binary($value);
     }
     if (is_float($value)) {
         return number_format($value, 14, '.', '');
     }
     return $this->quote($value);
 }
Пример #15
0
function detail_package($pid, $vmode = false, $new = 0)
{
    global $file_state, $xoopsModuleConfig;
    $pkg = new InstallPackage($pid);
    $dirname = $pkg->getVar('vcheck');
    $title = $pkg->getVar('name');
    if ($dirname) {
        $title .= " ({$dirname})";
    }
    if ($new) {
        $newpkg = new Package($new);
        $title .= _AM_UPDATE_TO . $newpkg->getVar('name');
        $files = $pkg->checkFiles($newpkg);
        $id = $new;
        //$files = $pkg->checkPackage($newpkg);
    } else {
        if ($vmode) {
            $files = $pkg->modifyFiles();
            if ($xoopsModuleConfig['check_extra']) {
                $files = array_merge($files, $pkg->checkExtra());
                ksort($files);
            }
        } else {
            $files = $pkg->checkFiles();
        }
        $id = $pid;
    }
    if (count($files) == 0) {
        echo _AM_NODATA;
        return;
    }
    echo mystyle();
    echo "<h3>{$title}</h3>";
    if (!$vmode) {
        echo "<form method='POST' name='FileMark'>\n";
        echo "<input type='hidden' name='pkgid' value='{$pid}'/>\n";
    }
    $dels = count(array_keys($files, 'del'));
    if ($dels && $vmode) {
        $sw = " &nbsp; <a href='index.php?op=detail&pkgid={$pid}&view=";
        if ($vmode == 'yes') {
            $sw .= "all'>" . _AM_VIEW_ALL;
        } else {
            $sw .= "yes'>" . _AM_VIEW_SCRIPT;
        }
        $sw .= "</a>";
        $fm = "<form method='post'>\n<input name='clear' type='submit' value='" . _AM_UPDATE_CLEAR . "'/>\n<input name='pkgid' type='hidden' value='{$pid}'/>\n</form>";
    } else {
        $sw = $fm = "";
    }
    echo "<table cellspacing='5'>\n<tr>\n<td>" . _AM_FILE_ALL . " " . count($pkg->files) . "</td>\n<td>" . _AM_CHG . " " . count(array_keys($files, 'chg')) . "</td><td>" . _AM_DEL . " " . $dels . "</td><td>" . $sw . "</td>\n</tr>\n</table>\n";
    echo "<table cellspacing='1' class='outer'>\n";
    $checkall = "<input type='checkbox' id='allconf' name='allconf' onclick='xoopsCheckAll(\"FileMark\", \"allconf\")'/>";
    echo "<tr>";
    if (!$vmode) {
        echo "<th align='center' class='ckbox'>{$checkall}</th>";
    }
    echo "<th>" . _AM_STATUS . "</th><th>" . _AM_FILE . "</th></tr>\n";
    $n = 0;
    foreach ($files as $file => $stat) {
        if ($vmode == 'yes') {
            if ($stat == 'del') {
                continue;
            }
            if (is_binary($file) || preg_match('/\\.css$/', $file)) {
                continue;
            }
        }
        $bg = $n++ % 2 ? 'even' : 'odd';
        $ck = "<input type='checkbox' name='conf[]' value='{$file}'/>";
        $slabel = $file_state[$stat];
        switch ($stat) {
            case 'chg':
                $slabel = "<a href='diff.php?pkgid={$id}&file={$file}' target='diff'>{$slabel}</a>";
                break;
            case 'new':
                $slabel = "<b>{$slabel}</b>";
                break;
        }
        if ($vmode) {
            $diff = $pkg->dbDiff($file);
            if ($stat == 'extra') {
            } elseif (empty($diff)) {
                $stat = 'same';
                $adiff = $new ? $newpkg->getDiff($file) : "";
                if (empty($adiff)) {
                    $file .= " =";
                }
            } elseif (count(preg_split('/\\n/', $diff) < 6) && preg_match('/\\n .*\\n-\\n$/', $diff)) {
                $stat = 'same';
                $file .= " +";
            } elseif ($new) {
                $adiff = $newpkg->getDiff($file);
                if ($adiff == $diff) {
                    $stat = 'mod';
                    $file .= " *";
                }
            }
            $ck = "";
        } else {
            $ck = "<td class='ckbox'><input type='checkbox' name='conf[]' value='{$file}'/></td>";
        }
        $myfile = $pkg->getRealPath($file, false);
        echo "<tr class='{$bg}'>{$ck}";
        echo "<td>{$slabel}</td><td class='{$stat}'>{$myfile}</td></tr>\n";
    }
    echo "</table>\n";
    if (!$vmode) {
        echo "<input type='submit' name='accept' value='" . _AM_REGIST_SUBMIT . "'/>\n";
        echo "</form>\n";
    }
    if ($fm && count($files) && !$new) {
        echo "<hr/>" . $fm;
    }
}
Пример #16
0
function is_utf16($string)
{
    if (is_binary($string, false)) {
        $test = mb_convert_encoding($string, 'UTF-8', 'UTF-16');
        if (strlen($test) > 1) {
            $test2 = mb_convert_encoding($test, 'UTF-16', 'UTF-8');
            $test3 = mb_convert_encoding($test2, 'UTF-8', 'UTF-16');
            if ($test3 == $test) {
                return true;
            }
        }
    }
    return false;
}