376 lines
8.2 KiB
PHP
376 lines
8.2 KiB
PHP
|
<?php
|
|||
|
|
|||
|
namespace Core;
|
|||
|
class Utils {
|
|||
|
|
|||
|
/*
|
|||
|
@ <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
*/
|
|||
|
public function redirect( $url ) {
|
|||
|
header( 'location: ' . $url );
|
|||
|
}
|
|||
|
|
|||
|
/*
|
|||
|
@ <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
@
|
|||
|
*/
|
|||
|
public static function lookStats($m) {
|
|||
|
$ist = array();
|
|||
|
$di = explode('|',$m);
|
|||
|
$i = 0; $de = false;
|
|||
|
while($i<count($di))
|
|||
|
{
|
|||
|
$de = explode('=',$di[$i]);
|
|||
|
if(isset($de[0],$de[1]))
|
|||
|
{
|
|||
|
if(!isset($ist[$de[0]])) {
|
|||
|
$ist[$de[0]] = 0;
|
|||
|
}
|
|||
|
$ist[$de[0]] = $de[1];
|
|||
|
}
|
|||
|
$i++;
|
|||
|
}
|
|||
|
return $ist;
|
|||
|
}
|
|||
|
|
|||
|
/*
|
|||
|
@ <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
@ TYPE: 0 - <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
*/
|
|||
|
public function num( $val, $type ) {
|
|||
|
if( $type == 0 ) {
|
|||
|
$val = floor((int)$val);
|
|||
|
}
|
|||
|
return $val;
|
|||
|
}
|
|||
|
|
|||
|
/*
|
|||
|
@ <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD>
|
|||
|
@ TYPE: 0 - <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, 1 - <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
*/
|
|||
|
public function emptyVal( $val, $type ) {
|
|||
|
$r = true;
|
|||
|
if( !isset($val) ) {
|
|||
|
$r = false;
|
|||
|
}elseif( $type == 0 ) {
|
|||
|
if( $val == 0 ) {
|
|||
|
$r = false;
|
|||
|
}
|
|||
|
}elseif( $type == 1 ) {
|
|||
|
$val = str_replace( ' ', '', str_replace( ' ', '', $val ) );
|
|||
|
if( $val == '' ) {
|
|||
|
$r = false;
|
|||
|
}
|
|||
|
}
|
|||
|
return $r;
|
|||
|
}
|
|||
|
|
|||
|
/*
|
|||
|
@ <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (<EFBFBD><EFBFBD><EFBFBD> POST <EFBFBD><EFBFBD><EFBFBD> GET)
|
|||
|
*/
|
|||
|
public function fs( $val ) {
|
|||
|
$val = htmlspecialchars( $val ) ;
|
|||
|
return $val;
|
|||
|
}
|
|||
|
|
|||
|
/*
|
|||
|
@ <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
*/
|
|||
|
public function cookie( $name , $value = NULL , $time = NULL ) {
|
|||
|
if( $value == NULL ) {
|
|||
|
return $_COOKIE[$name];
|
|||
|
}elseif( $value != false ) {
|
|||
|
if( $time == NULL ) {
|
|||
|
$time = 86400;
|
|||
|
}
|
|||
|
return setcookie( $name , $value , OK + $time , '/' );
|
|||
|
}else{
|
|||
|
return setcookie( $name , '' , OK - 86400 , '/' );
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
/*
|
|||
|
@ <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
*/
|
|||
|
public function ses_start() {
|
|||
|
if ( session_id() ) return true;
|
|||
|
else return session_start();
|
|||
|
}
|
|||
|
|
|||
|
/*
|
|||
|
@ <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
*/
|
|||
|
public function testVal( $val , $min , $max , $sym , $nosym , $nostart , $noend , $data ) {
|
|||
|
$r = true;
|
|||
|
if( mb_strlen($val,'UTF-8') < $min || mb_strlen($val,'UTF-8') > $max ) {
|
|||
|
$r = false;
|
|||
|
}else{
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
if( $sym != false ) {
|
|||
|
$i = 0;
|
|||
|
$new_val = mb_strtolower($val,'UTF-8');
|
|||
|
while( $i < mb_strlen($val,'UTF-8') ) {
|
|||
|
$j = 0;
|
|||
|
$k = 0;
|
|||
|
$k2 = 0;
|
|||
|
while( $j < mb_strlen($sym,'UTF-8') ) {
|
|||
|
if( mb_strtolower($val[$i],'UTF-8') == mb_strtolower($sym[$j],'UTF-8') ) {
|
|||
|
$k++;
|
|||
|
}else{
|
|||
|
if( isset($data['noXsym']) ) {
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> X <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
$l = 0;
|
|||
|
$notxt = '';
|
|||
|
while( $l < $data['noXsym'] ) {
|
|||
|
$notxt .= mb_strtolower($sym[$j],'UTF-8');
|
|||
|
$l++;
|
|||
|
}
|
|||
|
if( mb_strpos($new_val,$notxt,NULL,'UTF-8') !== false ) {
|
|||
|
$k2++;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
$j++;
|
|||
|
}
|
|||
|
if( $k == 0 || $k2 > 0 ) {
|
|||
|
$i = mb_strlen($val,'UTF-8');
|
|||
|
$r = false;
|
|||
|
}
|
|||
|
$i++;
|
|||
|
}
|
|||
|
}
|
|||
|
//<2F><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
if( $nosym != false ) {
|
|||
|
$i = 0;
|
|||
|
$new_val = '';
|
|||
|
while( $i < count($nosym) ) {
|
|||
|
if( mb_strpos(mb_strtolower($val,'UTF-8'),mb_strtolower($nosym[$i],'UTF-8'),NULL,'UTF-8') !== false ) {
|
|||
|
$i = count($nosym);
|
|||
|
$r = false;
|
|||
|
}
|
|||
|
$i++;
|
|||
|
}
|
|||
|
}
|
|||
|
//<2F><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
if( $nostart != false ) {
|
|||
|
$i = 0;
|
|||
|
$new_val = '';
|
|||
|
while( $i < count($nostart) ) {
|
|||
|
if( mb_substr( $val, 0, mb_strlen($nostart[$i],'UTF-8'),'UTF-8') == $nostart[$i] ) {
|
|||
|
$i = count($nostart);
|
|||
|
$r = false;
|
|||
|
}
|
|||
|
$i++;
|
|||
|
}
|
|||
|
}
|
|||
|
//<2F><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
if( $noend != false ) {
|
|||
|
$i = 0;
|
|||
|
$new_val = '';
|
|||
|
while( $i < count($noend) ) {
|
|||
|
if( mb_substr( $val, ( mb_strlen($val,'UTF-8') - mb_strlen($noend[$i],'UTF-8') ) , 0 , 'UTF-8') == $noend[$i] ) {
|
|||
|
$i = count($noend);
|
|||
|
$r = false;
|
|||
|
}
|
|||
|
$i++;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
return $r;
|
|||
|
}
|
|||
|
|
|||
|
/*
|
|||
|
@ <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>" <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
*/
|
|||
|
public function ses_end() {
|
|||
|
if ( session_id() ) {
|
|||
|
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,
|
|||
|
setcookie(session_name(), session_id(), time()-60*60*24);
|
|||
|
// <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
session_unset();
|
|||
|
session_destroy();
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
/*
|
|||
|
@ <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <EFBFBD><EFBFBD>.<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
*/
|
|||
|
public function takeType( $val ) {
|
|||
|
|
|||
|
if( preg_match( "|^[-0-9a-z_\.]+@[-0-9a-z_^\.]+\.[a-z]{2,6}$|i", $val ) ) {
|
|||
|
//<2F><>.<2E><><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
return 2;
|
|||
|
}else{
|
|||
|
preg_match_all( '([0-9])', $val, $matches );
|
|||
|
$res = implode( NULL, $matches[0] );
|
|||
|
if( mb_strlen( $val, 'UTF-8' ) > mb_strlen( $res, 'UTF-8' ) ) {
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
return 1;
|
|||
|
}else{
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
return 3;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
/*
|
|||
|
@ <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
*/
|
|||
|
public function testPass( $psw1, $psw2 ) {
|
|||
|
if( $psw1 == $psw2 ) {
|
|||
|
return true;
|
|||
|
}else{
|
|||
|
return false;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
/*
|
|||
|
@ <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
*/
|
|||
|
public function createAuth( $par ) {
|
|||
|
if( !isset( $par['rand'] ) ) {
|
|||
|
$par['rand'] = rand(10000000,90000000);
|
|||
|
}
|
|||
|
$r = $par['rand'] . md5( $par['ip'] . '+' . $par['id'] . '+' . $par['pass'] . '+' . $par['rand'] );
|
|||
|
return $r;
|
|||
|
}
|
|||
|
|
|||
|
/*
|
|||
|
@ <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
*/
|
|||
|
public function testAuth( $auth, $par ) {
|
|||
|
$par['rand'] = substr( $auth, 0, 8 );
|
|||
|
if( $auth == self::createAuth( $par ) ) {
|
|||
|
return true;
|
|||
|
}else{
|
|||
|
return false;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
/*
|
|||
|
@ <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> JSON <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
*/
|
|||
|
public function JSON_Headers() {
|
|||
|
header('Expires: Mon, 26 Jul 1970 05:00:00 GMT');
|
|||
|
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
|
|||
|
header('Cache-Control: no-store, no-cache, must-revalidate');
|
|||
|
header('Cache-Control: post-check=0, pre-check=0', false);
|
|||
|
header('Pragma: no-cache');
|
|||
|
header('Content-Type: application/json; charset=utf-8');
|
|||
|
return true;
|
|||
|
}
|
|||
|
|
|||
|
/*
|
|||
|
@ <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> JSON
|
|||
|
*/
|
|||
|
public function jsonencode( $val ) {
|
|||
|
array_walk_recursive( $val, function( &$value, $key ) {
|
|||
|
$value = iconv( "CP1251", "UTF-8", $value );
|
|||
|
});
|
|||
|
return json_encode( $val );
|
|||
|
//return json_encode( $val );
|
|||
|
//return self::json_fix_cyr( json_encode( $val ) );
|
|||
|
}
|
|||
|
|
|||
|
/*
|
|||
|
@ <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> JSON <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
*/
|
|||
|
public function jsondecode( $val ) {
|
|||
|
return json_decode( $val );
|
|||
|
}
|
|||
|
|
|||
|
/*
|
|||
|
@ <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
*/
|
|||
|
public function json_fix_cyr($json_str) {
|
|||
|
$cyr_chars = array (
|
|||
|
'\u0430' => '<27>', '\u0410' => '<27>',
|
|||
|
'\u0431' => '<27>', '\u0411' => '<27>',
|
|||
|
'\u0432' => '<27>', '\u0412' => '<27>',
|
|||
|
'\u0433' => '<27>', '\u0413' => '<27>',
|
|||
|
'\u0434' => '<27>', '\u0414' => '<27>',
|
|||
|
'\u0435' => '<27>', '\u0415' => '<27>',
|
|||
|
'\u0451' => '<27>', '\u0401' => '<27>',
|
|||
|
'\u0436' => '<27>', '\u0416' => '<27>',
|
|||
|
'\u0437' => '<27>', '\u0417' => '<27>',
|
|||
|
'\u0438' => '<27>', '\u0418' => '<27>',
|
|||
|
'\u0439' => '<27>', '\u0419' => '<27>',
|
|||
|
'\u043a' => '<27>', '\u041a' => '<27>',
|
|||
|
'\u043b' => '<27>', '\u041b' => '<27>',
|
|||
|
'\u043c' => '<27>', '\u041c' => '<27>',
|
|||
|
'\u043d' => '<27>', '\u041d' => '<27>',
|
|||
|
'\u043e' => '<27>', '\u041e' => '<27>',
|
|||
|
'\u043f' => '<27>', '\u041f' => '<27>',
|
|||
|
'\u0440' => '<27>', '\u0420' => '<27>',
|
|||
|
'\u0441' => '<27>', '\u0421' => '<27>',
|
|||
|
'\u0442' => '<27>', '\u0422' => '<27>',
|
|||
|
'\u0443' => '<27>', '\u0423' => '<27>',
|
|||
|
'\u0444' => '<27>', '\u0424' => '<27>',
|
|||
|
'\u0445' => '<27>', '\u0425' => '<27>',
|
|||
|
'\u0446' => '<27>', '\u0426' => '<27>',
|
|||
|
'\u0447' => '<27>', '\u0427' => '<27>',
|
|||
|
'\u0448' => '<27>', '\u0428' => '<27>',
|
|||
|
'\u0449' => '<27>', '\u0429' => '<27>',
|
|||
|
'\u044a' => '<27>', '\u042a' => '<27>',
|
|||
|
'\u044b' => '<27>', '\u042b' => '<27>',
|
|||
|
'\u044c' => '<27>', '\u042c' => '<27>',
|
|||
|
'\u044d' => '<27>', '\u042d' => '<27>',
|
|||
|
'\u044e' => '<27>', '\u042e' => '<27>',
|
|||
|
'\u044f' => '<27>', '\u042f' => '<27>',
|
|||
|
|
|||
|
'\r' => '',
|
|||
|
'\n' => '<br />',
|
|||
|
'\t' => ''
|
|||
|
);
|
|||
|
foreach ($cyr_chars as $cyr_char_key => $cyr_char) {
|
|||
|
$json_str = str_replace($cyr_char_key, $cyr_char, $json_str);
|
|||
|
}
|
|||
|
return $json_str;
|
|||
|
}
|
|||
|
|
|||
|
public static function timeOut($ttm)
|
|||
|
{
|
|||
|
$out = '';
|
|||
|
$time_still = $ttm;
|
|||
|
$tmp = floor($time_still/2592000);
|
|||
|
$id=0;
|
|||
|
if ($tmp > 0)
|
|||
|
{
|
|||
|
$id++;
|
|||
|
if ($id<3) {$out .= $tmp." <20><><EFBFBD>. ";}
|
|||
|
$time_still = $time_still-$tmp*2592000;
|
|||
|
}
|
|||
|
$tmp = floor($time_still/86400);
|
|||
|
if ($tmp > 0)
|
|||
|
{
|
|||
|
$id++;
|
|||
|
if ($id<3) {$out .= $tmp." <20><>. ";}
|
|||
|
$time_still = $time_still-$tmp*86400;
|
|||
|
}
|
|||
|
$tmp = floor($time_still/3600);
|
|||
|
if ($tmp > 0)
|
|||
|
{
|
|||
|
$id++;
|
|||
|
if ($id<3) {$out .= $tmp." <20>. ";}
|
|||
|
$time_still = $time_still-$tmp*3600;
|
|||
|
}
|
|||
|
$tmp = floor($time_still/60);
|
|||
|
if ($tmp > 0)
|
|||
|
{
|
|||
|
$id++;
|
|||
|
if ($id<3) {$out .= $tmp." <20><><EFBFBD>. ";}
|
|||
|
}
|
|||
|
if($out=='')
|
|||
|
{
|
|||
|
if($time_still<0)
|
|||
|
{
|
|||
|
$time_still = 0;
|
|||
|
}
|
|||
|
$out = $time_still.' <20><><EFBFBD>.';
|
|||
|
}
|
|||
|
return $out;
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
?>
|