Ejemplo n.º 1
0
function get_avdb_info()
{
    $r = '';
    $path = PATH_CLAMDB . "/{$filename}";
    $fl = get_dir(PATH_CLAMDB . "/");
    array_shift($fl);
    array_shift($fl);
    foreach ($fl as $fname) {
        $path = PATH_CLAMDB . "/{$fname}";
        $ext = end(explode(".", $fname));
        if ($ext == "cvd" || $ext == "cld") {
            $stl = "style='padding-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 4px; border-left: 1px solid #999999;'";
            if (file_exists($path)) {
                $handle = '';
                if ($handle = fopen($path, "r")) {
                    $fsize = sprintf("%.2f M", filesize($path) / 1024 / 1024);
                    $s = fread($handle, 1024);
                    $s = explode(':', $s);
                    // datetime
                    $dt = explode(" ", $s[1]);
                    $s[1] = strftime("%Y.%m.%d", strtotime("{$dt[0]} {$dt[1]} {$dt[2]}"));
                    if ($s[0] == 'ClamAV-VDB') {
                        $r .= "<tr class='listr'><td {$stl}>{$fname}</td><td {$stl}>{$s[1]}</td><td {$stl} align='right'>{$fsize}</td><td {$stl} align='right'>{$s[2]}</td><td {$stl} align='right'>{$s[3]}</td><td {$stl}>{$s[7]}</td></tr>";
                    }
                }
                fclose($handle);
            }
        }
    }
    return $r;
}
Ejemplo n.º 2
0
function log_path($advertiser_id)
{
    $dir = get_dir('log');
    $exploded = explode('/', $advertiser_id);
    $path = $dir . '/' . end($exploded);
    return $path;
}
Ejemplo n.º 3
0
  /**
   * 产品信息缓存
   */
  function SetDetail(){
    $ids = $_REQUEST['id'];
	$data['id'] = array('in',explode(',',$ids));
    $list = $this->db->where($data)->select();
	$pmodel = M('Pic');
	C('DATA_CACHE_TYPE','File');
	foreach($list as $vo){
		$p_data['source'] = 'Product';
		$p_data['sourceid'] = $vo['id'];
		$pics = $pmodel->field('domain,filepath,is_thumb')->where($p_data)->select();
		$options['dir'] = get_dir($vo['id']);
		$vo['imgs'] = $pics;
		setCache('detail',$vo,0,$options);
	}
	  foreach($list as $array){
	    $data[$array['id']] = $array;
	  }
	  if($_POST['from']=='self'){
	    return $data;exit;
	  }
	  $return = $this->SetCache('detail',$vo);
	  if($return){
	    $msg['error_code'] = 0;
	  }else{
	    $msg['error_code'] = 8002;
	  }
	  if($_POST['status'])$msg['data'] = $data;
	  echo json_encode($msg);exit;
  }
Ejemplo n.º 4
0
 /**
  * 快递查询
  */
 public function detail()
 {
     $data['id'] = $_GET['id'];
     $vo = $this->db->where($data)->find();
     $this->assign('vo', $vo);
     if (!$vo) {
         $this->error('物流信息不存在');
     }
     $dir = get_dir($vo['id']);
     if (file_exists(C('DATA_CACHE_PATH') . '/delivery/' . $dir . '/list.php')) {
         $list = (include C('DATA_CACHE_PATH') . '/delivery/' . $dir . '/list.php');
     } else {
         include C('PUBLIC_INCLUDE') . "kuaidi.class.php";
         $kuaidi = new kuaidi();
         $list = $kuaidi->query($vo['shipping_code'], $vo['shipping_no']);
         krsort($list['data']);
         mk_dir(C('DATA_CACHE_PATH') . '/delivery/');
         if ($list['state'] == 3) {
             mk_dir(C('DATA_CACHE_PATH') . '/delivery/' . $dir . '/');
             F('list', $list, C('DATA_CACHE_PATH') . '/delivery/' . $dir . '/');
         }
     }
     if ($list) {
         $list['count'] = count($list['data']);
     } else {
         $list['message'] = $kuaidi->error;
     }
     if (!$list) {
         $this->error($kuaidi->getError());
     } else {
         $result['data'] = $list;
         $result['notice'] = '查询成功';
         ajaxSucReturn($result);
     }
 }
Ejemplo n.º 5
0
function convert_to_IMG($attachment, $options)
{
    $path = get_path($attachment);
    $dir = get_dir($attachment);
    $basename = get_basename($attachment);
    $converted_images = array();
    $max_width = $options['max_width'] ? (int) $options['max_width'] : 0;
    $max_height = $options['max_height'] ? (int) $options['max_height'] : 0;
    $img_extension = $options['img_extension'] ? $options['img_extension'] : 'jpg';
    $pages_to_convert = $options["pages_to_convert"] ? (int) $options["pages_to_convert"] : 0;
    if ($pages_to_convert > 5) {
        $pages_to_convert = 5;
    }
    $pages_to_convert = $pages_to_convert - 1;
    $quality = $options['quality'] ? (int) $options['quality'] : 80;
    if ($quality > 100) {
        $quality = 100;
    }
    try {
        $imagick = new Imagick();
        $imagick->clear();
        $imagick->destroy();
        if ($options) {
            $imagick->setResolution(150, 150);
            $imagick->readimage($path);
            $imagick->setCompressionQuality($quality);
        } else {
            $imagick->setResolution(72, 72);
            $imagick->readimage($path);
        }
        foreach ($imagick as $c => $_page) {
            if ($pages_to_convert == -1 || $c <= $pages_to_convert) {
                $_page->setImageBackgroundColor('white');
                $_page->setImageFormat($img_extension);
                if ($max_width && $max_height) {
                    $_page->adaptiveResizeImage($max_width, $max_height, true);
                }
                $blankPage = new \Imagick();
                $blankPage->newPseudoImage($_page->getImageWidth(), $_page->getImageHeight(), "canvas:white");
                $blankPage->compositeImage($_page, \Imagick::COMPOSITE_OVER, 0, 0);
                if ($blankPage->writeImage($dir . "/" . $basename . '-' . $c . '.' . $img_extension)) {
                    array_push($converted_images, $dir . "/" . $basename . '-' . $c . '.' . $img_extension);
                }
                $blankPage->clear();
                $blankPage->destroy();
            }
        }
    } catch (ImagickException $e) {
        $converted_images = false;
    } catch (Exception $e) {
        $converted_images = false;
    }
    return $converted_images;
}
Ejemplo n.º 6
0
  /**
   * 添加收藏
   */
  public function add(){
	$model = D('Collect');
	if($_POST['source']!='Product' && $_POST['source']!='News'){
	  ajaxErrReturn('非添加类型');
	}
	$data['source'] = $_POST['source'];
	$data['sourceid'] = $_POST['sourceid'];
	$data['member_id'] = $this->user['id'];
	$count = $model->where($data)->count();
	if($count>0){
	  ajaxErrReturn('已收藏');
	}
	if($_POST['source']=='Product'){
	  $options['dir'] = get_dir($_POST['sourceid']);
	  $vo = getcache('Product:detail',$options);//产品基本信息
	  $info['id'] = $vo['id'];
	  $info['name'] = $vo['name'];
	  $info['subtitle'] = $vo['subtitle'];
	  $info['lit_pic'] = $vo['lit_pic'];
	  $info['cat_id'] = $vo['cat_id'];
	  $info['cat_name'] = $vo['cat_name'];
	  $info['brand_id'] = $vo['brand_id'];
	  $info['brand_name'] = $vo['brand_name'];
	  $info['market_price'] = $vo['market_price'];
	  $info['price'] = $vo['price'];
	  $info['nw'] = $vo['nw'];
	  $info = serialize($info);
	}
	$data['info'] = $info;
	$data['create_time'] = time();
	$data['ip'] = time();
	$result = $model->add($data);
	if($result){
		if($_POST['source']=='Product'){
		  update_product('collect_num',1,$_POST['sourceid']);
		}
		//权重修改
		$model = M('Weight');
		unset($data['member_id']);
		$model->where($data)->setInc('favorite_count');
		$this->update_weight($_POST['source'],$_POST['sourceid']);

		$msg['error_code'] = 0;
		$msg['id'] = $result;
		$msg['notice'] = '收藏成功';
		ajaxSucReturn($msg); 
	}else{
		ajaxErrReturn('收藏失败');
	}
	exit;
  }
Ejemplo n.º 7
0
 /**
  * 添加信息
  */
 public function add()
 {
     if (IS_POST) {
         $model = M('Member_card');
         import("ORG.Net.UploadFile");
         if ($_FILES['text']['name']) {
             $upload = new UploadFile();
             $upload->thumbRemoveOrigin = true;
             //$firstLetter=substr($this->token,0,1);
             // 设置附件上传目录
             $firstLetter = get_dir(session('uid'));
             //$upload->savePath =  './uploads/'.$firstLetter.'/'.$this->token.'/';// 设置附件上传目录
             $upload->savePath = C('IMG_ROOT') . $firstLetter . '/' . $this->token . '/' . date('Y') . '/' . date('m') . '/' . date('d') . '/';
             // 设置附件上传目录
             mk_dir($upload->savePath, 0777);
             $upload->upload();
             $info = $upload->getUploadFileInfo();
             //echo $info[0]['savepath'].$info[0]['savename'];exit;
             $arr_code = $this->daoru($info[0]['savepath'] . $info[0]['savename']);
         } else {
             //$arr_code = explode(',',$_POST['sns']);
             $arr_code['code'][] = $_POST['code'];
             $arr_code['psw'][] = $_POST['psw'];
         }
         if (!$arr_code) {
             $this->error('添加失败');
         }
         foreach ($arr_code['code'] as $key => $code) {
             $add_data['code'] = $code;
             $count = $model->where($add_data)->count();
             if ($count > 0) {
                 continue;
                 //$this->error($code.'已经导入');
                 //exit;
             }
             $add_data['psw'] = $arr_code['psw'][$key];
             $id = $model->add($add_data);
         }
         if ($id) {
             $this->success('添加成功!');
         } else {
             $this->error('添加失败!');
         }
         exit;
     }
     $this->display();
 }
 private function loadFromDisk()
 {
     $cached_files = get_dir(self::$cacheDir);
     if (count($cached_files)) {
         foreach ($cached_files as $file) {
             preg_match('/^sr-(.*).json/', $file, $matches);
             if (strtotime($matches[1]) >= strtotime('-' . self::$cache_life . ' minutes', time())) {
                 $last_modified_time = filemtime(self::$cacheDir . $file);
                 $etag = md5_file(self::$cacheDir . $file);
                 header("Last-Modified: " . gmdate("D, d M Y H:i:s", $last_modified_time) . " GMT");
                 header("Etag: {$etag}");
                 if (@strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) == $last_modified_time || @trim($_SERVER['HTTP_IF_NONE_MATCH']) == $etag) {
                     header("HTTP/1.1 304 Not Modified");
                     exit;
                 }
                 return file_get_contents(self::$cacheDir . $file);
             }
         }
     }
     return null;
 }
Ejemplo n.º 9
0
function build_grid(array $fields, $controller, $json, $i = 2, $url = '', $loadonce = true, $out = true)
{
    $script = '<script>';
    if ($json) {
        $script .= "var mydata ={$json};";
    }
    $script .= '
        jQuery("#list' . $i . '").jqGrid(
        { 
            direction:"' . get_dir() . '",';
    if ($url != '') {
        $script .= 'datatype:"json",';
        $script .= 'url:"' . site_url($url) . '?' . convert_post_to_get() . '",';
    } else {
        $script .= 'datatype: "local",';
    }
    $script .= 'colNames:[';
    foreach ($fields as $field) {
        $script .= '"' . lang("{$controller}_{$field}") . '",';
    }
    $script .= '"' . lang('global_page_order') . '",' . '"' . lang('global_is_active') . '",' . '"",' . '"",' . '],' . 'colModel:' . '[';
    foreach ($fields as $field) {
        $script .= '{name:"' . $field . '",index:"' . $field . '",width:180},';
    }
    $script .= '{name:"page_order",index:"page_order",width:80,sorttype:function(cell,row){return parseInt($(cell).text());}},' . '{name:"is_active",index:"is_active",width:80,classes:\'grid_center\'},' . '{name:"edit",index:"edit",width:80},' . '{name:"delete",index:"delete",width:80}' . '],' . 'rowNum:10,' . 'rowList:[10,20,30],' . 'height:230,' . 'width:910,' . "pager: '#pager{$i}'," . "sortname: 'page_order'," . "viewrecords: true," . "sortorder: 'desc',";
    if ($json) {
        $script .= "data: mydata,";
    }
    if ($loadonce) {
        $script .= "loadonce: true";
    }
    $script .= "});";
    $script .= "jQuery('#list{$i}').jqGrid('navGrid','#pager{$i}',{edit:false,add:false,del:false,search:false});";
    $script .= "</script>";
    if ($out) {
        echo $script;
    }
}
 // Load forces in surrounding sectors
 $x = $spacegame['player']['x'];
 $y = $spacegame['player']['y'];
 $db = isset($db) ? $db : new DB();
 // We are grabbing one extra sector around systems for the navigation
 // panel and may get multiple systems if stars are close to each other.
 $rs = $db->get_db()->query("select * from ordnance where (x - 1) <= {$x} and (x + 1) >= {$x} and (y - 1) <= {$y} and (y + 1) >= {$y}");
 $rs->data_seek(0);
 while ($row = $rs->fetch_assoc()) {
     $spacegame['ordnance'][$row['record_id']] = $row;
     $spacegame['ordnance_count']++;
 }
 foreach ($spacegame['ordnance'] as $ordnance_id => $row) {
     for ($dy = -1; $dy <= 1; $dy++) {
         for ($dx = -1; $dx <= 1; $dx++) {
             $dir = get_dir($dx, $dy);
             if (!isset($spacegame['sector'][$dir]['ordnance_count'])) {
                 $spacegame['sector'][$dir]['ordnance'] = array();
                 $spacegame['sector'][$dir]['ordnance_count'] = 0;
             }
             if ($row['y'] != $y + $dy) {
                 continue;
             }
             if ($row['x'] != $x + $dx) {
                 continue;
             }
             $spacegame['sector'][$dir]['ordnance'][$ordnance_id] = $row;
             $spacegame['sector'][$dir]['ordnance_count']++;
             if (!isset($spacegame['sector'][$dir]['allied_ordnance_count'])) {
                 $spacegame['sector'][$dir]['allied_ordnance'] = array();
                 $spacegame['sector'][$dir]['allied_ordnance_count'] = 0;
Ejemplo n.º 11
0
             if ($email[$i]['is_dispose'] == 0) {
                 $r = sendSMS($email[$i]['tel'], $sms_content);
                 if ($r == true) {
                     $sql = "UPDATE " . $ecs->table('booking_goods') . " SET is_dispose = 2 WHERE  goods_id = '{$_REQUEST['goods_id']}'";
                     $db->query($sql);
                 } else {
                     $sql = "UPDATE " . $ecs->table('booking_goods') . " SET is_dispose = 3 WHERE  goods_id = '{$_REQUEST['goods_id']}'";
                     $db->query($sql);
                 }
             }
         }
     }
 }
 /* 代码增加_start  By  www.68ecshop.com */
 if ($is_insert) {
     $dir_clear = get_dir('category', $catgory_id);
     $prefix_clear = "category-" . $catgory_id;
     clearhtml_dir(ROOT_PATH . $dir_clear, $prefix_clear);
 } else {
     clearhtml_file('goods', $catgory_id, $goods_id);
 }
 /* 代码增加_end  By  www.68ecshop.com */
 /* 代码增加_start  Byjdy    为了便于新手朋友修改,这里采用增加代码的方法来修改,没有采用修改代码的方法 */
 $sql = "UPDATE " . $ecs->table('goods') . " SET is_catindex = '{$_REQUEST['is_catindex']}' WHERE goods_id = '{$goods_id}' LIMIT 1";
 $db->query($sql);
 /*存入条形码*/
 if ($_POST['txm_shu'] && $_POST['tiaoxingm']) {
     //如果txm_shu 和 tiaoxingm存在 就存入  不存在就不执行
     if (isset($_POST['txm_shu']) && isset($_POST['tiaoxingm']) || empty($_POST['txm_shu']) && empty($_POST['tiaoxingm'])) {
         $type = $_POST['txm_shu'];
         $bar_code = $_POST['tiaoxingm'];
Ejemplo n.º 12
0
function get_dir($path, $max_depth = '', $l = 0, $total = '')
{
    if (!is_dir($path)) {
        echo "\nInvalid Path\n";
        return;
    }
    echo "<table border='0' cellpadding='5' cellspacing='0'>";
    $path = substr($path, -1) != "/" ? $path . "/" : $path;
    if (!$l) {
        echo "\n<tr><td colspan='4'>Contents of directory {$path} :</td></tr>\n";
        echo "\n<tr><td>Permissions</td><td>File Size</td><td>File Name</td><td>&nbsp;</td></tr>\n";
        $total = 0;
    }
    if ($max_depth === '' || $max_depth > $l && is_int($max_depth)) {
        $test_depth = true;
    } else {
        $test_depth = false;
    }
    $pre = "";
    $c = $l;
    while ($c--) {
        $pre .= "\t";
    }
    $dir = opendir($path);
    while ($f = readdir($dir)) {
        if ($f == "." || $f == "..") {
            continue;
        }
        $file = $path . $f;
        $size = "";
        if (is_file($file) || !is_dir($file)) {
            $s = filesize($file);
            $total += $s;
            $size = "[ " . fsize($s) . " ]";
        } else {
            $f .= "/";
        }
        while (strlen($size) < 16) {
            $size = " " . $size;
        }
        //       echo "\n".get_permissions(fileperms($file)).$size.$pre."\t".$f;
        //       echo "\n<tr><td>".get_permissions(fileperms($file))."</td><td>".$size.$pre."</td><td>".$f."</td><td><a href=\"upld1/download.php?name=$f&mode=view\">View</a>&nbsp;<a href=\"upld1/download.php?name=$f\">Download</a>&nbsp;<a href=\"$me?mode=delete&name=$f\" onclick=\"return delete_confirm();\">Delete</a></td></tr>";
        echo "\n<tr><td>" . get_permissions(fileperms($file)) . "</td><td>" . $size . $pre . "</td><td>" . $f . "</td><td>";
        switch ($f) {
            case 'download.php':
            case 'dl.php':
            case 'index.php':
                echo "&nbsp;</td></tr>";
                break;
            default:
                echo "<a href=\"{$urlpath}/dl.php?name={$f}&mode=view\">View</a>&nbsp;<a href=\"{$urlpath}/dl.php?name={$f}\">Download</a>&nbsp;<a href=\"{$me}?mode=delete&name={$f}\" onclick=\"return delete_confirm();\">Delete</a></td></tr>";
                break;
        }
        if (is_dir($file) && $test_depth) {
            $total = get_dir($file, $max_depth, $l + 1, $total);
        }
    }
    if (!$l) {
        echo "\n<tr><td colspan='4'>Total size: " . fsize($total) . "</td></tr></table>";
    }
    return $total;
}
Ejemplo n.º 13
0
 /**
  * 生成缓存
  */
 protected function GiveCache($id = 0)
 {
     $ids = $id ? $id : $_REQUEST['id'];
     $data['id'] = array('in', explode(',', $ids));
     $list = $this->db->where($data)->select();
     //echo $this->db->getlastsql();dump($list);exit;
     $pmodel = M('Pic');
     C('DATA_CACHE_TYPE', 'File');
     foreach ($list as $vo) {
         $p_data['source'] = 'Product';
         $p_data['sourceid'] = $vo['id'];
         $pics = $pmodel->field('domain,filepath,is_thumb')->where($p_data)->select();
         $options['dir'] = get_dir($vo['id']);
         $options['id'] = $vo['id'];
         $vo['imgs'] = $pics;
         setCache('detail', $vo, 0, $options);
         //setCache('detail',$vo,0,$options);//详情
         //setCache('pics',$pics,0,$options);//图片
     }
 }
Ejemplo n.º 14
0
 * @package org.genitis.yuki
 */
// Requires conf.php
require 'conf.php';
require DIR_LIB . 'functions.php';
// Exit, if GET parameter 'url' is not set
if (!isset($_GET['url'])) {
    exit;
}
$url = $_GET['url'];
// request
// Check for GET parameter 'file'
if (isset($_GET['file'])) {
    // Load necessary modules
    load_modules($modules);
    // Include file
    get_file($url);
} elseif (isset($_GET['dir'])) {
    // Load necessary modules
    load_modules($modules);
    // Include dir
    get_dir($url);
} elseif (isset($_GET['err'])) {
    require 'redirect.php';
    // If a redirection for $url is defined, make a redirect as defined.
    if (isset($redirections[$url])) {
        redirect(301, $redirections[$url]);
    } else {
        redirect(404, ERROR_404, $url);
    }
}
            }
        }
    } else {
        // There should never be a situation where a pod is on a base. All pods
        // are ejected into space.
        $rs = $db->get_db()->query("select places.record_id as id, x, y from places, place_types where places.type = place_types.record_id and place_types.caption = 'Ship Dealer'");
        $rs->data_seek(0);
        while ($row = $rs->fetch_assoc()) {
            $dx = $row['x'] - $spacegame['player']['x'];
            $dy = $row['y'] - $spacegame['player']['y'];
            $adx = abs($dx);
            $ady = abs($dy);
            $dist2 = max($adx, $ady);
            if ($dist2 < $spacegame['target_dist']) {
                $spacegame['target_dist'] = $dist2;
                $spacegame['target_dir'] = get_dir($dx, $dy);
            }
        }
    }
    // if ship_type <= 0
    $spacegame['players']['safe'] = array();
    $spacegame['players']['hostile'] = array();
    $players = get_players($spacegame['player']);
} while (false);
function get_players($player)
{
    global $spacegame;
    global $db;
    $db = isset($db) ? $db : new DB();
    $rs = null;
    if ($player['base_id'] > 0) {
Ejemplo n.º 16
0
 public function head_up()
 {
     $config['thumb'] = true;
     $config['thumbPrefix'] = 'Original';
     //原图压缩
     $config['thumbMaxWidth'] = '500';
     $config['thumbMaxHeight'] = '500';
     $config['saveRule'] = '';
     $config['savePath'] = 'avatar/' . get_dir($_POST['member_id']) . '/';
     $config['saveName'] = 'logo';
     $config['subName'] = '';
     $config['saveExt'] = 'jpg';
     $config['replace'] = true;
     $result = $this->upload($config);
     //dump($result['url']);exit;
     $arr['img'] = $result['url']['profileLogo'] . '?' . NOW_TIME;
     echo json_encode($arr);
 }
Ejemplo n.º 17
0
 $y = $spacegame['player']['y'];
 $db = isset($db) ? $db : new DB();
 // We are grabbing one extra sector around systems for the navigation
 // panel and may get multiple systems if stars are close to each other.
 $rs = $db->get_db()->query("select * from systems where (x - radius - 1) <= {$x} and (x + radius + 1) >= {$x} and (y - radius - 1) <= {$y} and (y + radius + 1) >= {$y}");
 $rs->data_seek(0);
 while ($row = $rs->fetch_assoc()) {
     $spacegame['systems'][$row['record_id']] = $row;
 }
 foreach ($spacegame['systems'] as $system_id => $row) {
     for ($dy = -1; $dy <= 1; $dy++) {
         for ($dx = -1; $dx <= 1; $dx++) {
             if ($x + $dx >= $row['x'] - $row['radius'] && $y + $dy >= $row['y'] - $row['radius']) {
                 if ($x + $dx <= $row['x'] + $row['radius'] && $y + $dy <= $row['y'] + $row['radius']) {
                     $spacegame['sector_grid'][$x + $dx][$y + $dy] = $row;
                     $spacegame['sector'][get_dir($dx, $dy)]['system'] = $row;
                 }
             }
         }
     }
 }
 if (isset($spacegame['sector']['m']['system'])) {
     $angle = atan2($spacegame['sector']['m']['system']['x'] - $x, $spacegame['sector']['m']['system']['y'] - $y);
     $angles = array('dl', 'l', 'ul', 'u', 'ur', 'r', 'dr', 'd');
     $spacegame['sector']['m']['system']['direction'] = $angles[3 + $angle / (M_PI / 4)];
     $spacegame['system'] = $spacegame['sector']['m']['system'];
 }
 $spacegame['own_tax_rate'] = $spacegame['races'][$spacegame['player']['race']]['tax_rate'];
 $spacegame['other_tax_rate'] = 0;
 if (isset($spacegame['system']) && $spacegame['system']['race'] > 0) {
     if ($spacegame['system']['race'] != $spacegame['player']['race']) {
Ejemplo n.º 18
0
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
include_once 'inc/common.php';
include_once 'inc/game.php';
do {
    // Dummy loop
    $spacegame['places'] = array();
    $spacegame['place_count'] = 0;
    $db = isset($db) ? $db : new DB();
    $x = $spacegame['player']['x'];
    $y = $spacegame['player']['y'];
    $rs = $db->get_db()->query("select places.record_id as id, places.type as place_type, places.caption as caption, place_types.caption as type, system, x, y from places, place_types where x >= '{$x}' - 1 and y >= '{$y}' - 1 and x <= '{$x}' + 1 and y <= '{$y}' + 1 and places.type = place_types.record_id");
    $rs->data_seek(0);
    while ($row = $rs->fetch_assoc()) {
        $dx = $row['x'] - $x;
        $dy = $row['y'] - $y;
        $spacegame['sector'][get_dir($dx, $dy)]['places'][] = $row['place_type'];
        if ($x == $row['x'] && $y == $row['y']) {
            $spacegame['places'][$row['id']] = $row;
            $spacegame['place_count']++;
        }
    }
} while (false);
Ejemplo n.º 19
0
} elseif ($_SERVER['PATH_INFO'] == '/index-frame') {
    print doctype("XHTML/1.0") . "\n";
    ?>
<html>
	<head><title>Index</title>
		<meta http-equiv='Content-type' value='text/html; charset=UTF-8' />
		<?php 
    if (STYLESHEET_BASE) {
        $ss = STYLESHEET_BASE . "/style.css";
        print "<link rel='StyleSheet' href='{$ss}' type='text/css'/>";
    }
    ?>
	</heaD>
	<body>
<?php 
    $d = get_dir($n = dirname($_SERVER['SCRIPT_FILENAME']));
    asort($d);
    foreach ($d as $e) {
        if (preg_match('/jpg|jpeg$/i', $e)) {
            $ee = rawurlencode($e);
            //			print("<div class='image'><a target='view' href='".script_name()."?show=$ee'><img src='".php_self()."?thumb=$ee' alt='$e' /><br />$e</a></div>");
            print "<p><a target='view' href='" . script_name() . "?show={$ee}'>" . preg_replace('/.jpeg$|.jpg$/i', '', $e) . "</a></p>";
        } elseif (is_dir($n . '/' . $e) and file_exists($n . '/' . $e . '/index.php')) {
            print "<p><a href='../{$e}/index.php/index-frame'>{$e}</a></p>";
        } elseif (is_dir($n . '/' . $e)) {
            print "<p><a href='../{$e}/'>{$e}</a></p>";
        }
    }
    ?>
	</body>
</html>
Ejemplo n.º 20
0
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html dir="<?php 
echo get_dir();
?>
">
    <head>
        <meta content="text/html; charset=utf-8" http-equiv="content-type"/>
        <script>
            var selecValue = "<?php 
echo lang('global_select_text');
?>
";
            var delete_confirm_msg = "<?php 
echo lang('global_confirm_msg');
?>
";
        </script>
        <title><?php 
if (isset($page_header)) {
    echo strip_tags($page_header);
} elseif (isset($page_title)) {
    echo strip_tags($page_title);
} else {
    echo lang("page_title");
}
?>
</title>
        <link rel="shortcut icon" href="<?php 
echo base_url();
?>
layout/favicon.ico" type="image/x-icon" />
Ejemplo n.º 21
0
 /**
  *  我的二维码
  */
 public function qrcode()
 {
     $r = base64_encode($this->user['mobile']);
     $url = C('PRO_URL') . "/index.php?m=Public&a=register&r={$r}";
     $IMG_ROOT = C('IMG_ROOT') . 'avatar/' . get_dir($this->user['id']);
     $IMG_URL = C('IMG_URL') . 'avatar/' . get_dir($this->user['id']);
     $img_dir = $IMG_ROOT . '/qrcode.png';
     $img_url = $IMG_URL . '/qrcode.png';
     if (!file_exists($img_dir)) {
         include C('PUBLIC_INCLUDE') . 'phpqrcode.php';
         mk_dir($IMG_ROOT);
         QRcode::png($url, $img_dir, 'L', 8, 2);
     }
     //echo $img_url;exit;
     $data['img_url'] = $img_url;
     ajaxSucReturn($data);
 }
Ejemplo n.º 22
0
function clearhtml_file($type, $cid, $id)
{
    if ($type == 'goods') {
        $dir = ROOT_PATH . get_dir('category', $cid);
        $file = $dir . "/goods-" . $id . ".html";
        @unlink($file);
    } elseif ($type == 'article') {
        $dir = ROOT_PATH . get_dir('article_cat', $cid);
        $file = $dir . "/article-" . $id . ".html";
        @unlink($file);
    } elseif ($type == 'index') {
        $dir = ROOT_PATH;
        $file = $dir . "index.html";
        @unlink($file);
    } elseif ($type == 'topic') {
        $dir = ROOT_PATH . 'zhuanti';
        $file = $dir . "/topic-" . $id . ".html";
        @unlink($file);
    }
}
Ejemplo n.º 23
0
function get_dir($path)
{
    $files = array();
    if (!file_exists($path)) {
        return $files;
    }
    if ($dir = scandir($path)) {
        $tmp_directories = array();
        foreach ($dir as $data) {
            if ($data == '.' or $data == '..') {
                continue;
            }
            if (is_dir($path . $data)) {
                $tmp_directories[] = $data;
            }
        }
        $dir = $tmp_directories;
    }
    foreach ($dir as $data) {
        $files = array_merge($files, array($path . $data . '/'), get_dir($path . $data . '/'));
    }
    return $files;
}
			<line x1="94" y1="0" x2="94" y2="96" style="stroke:rgb(48,64,64);stroke-width:1;stroke-opacity:0.8;" />
			<line x1="98" y1="0" x2="98" y2="96" style="stroke:rgb(48,64,64);stroke-width:1;stroke-opacity:0.8;" />

			<?php 
$scanner_players = array();
foreach ($players as $id => $player) {
    if ($player['base_id'] > 0) {
        continue;
    }
    if ($id == $spacegame['player']['record_id']) {
        // Uncomment to show self, really just debug
        //echo '<image class="o9" x="'. (88 + $player['x'] - $spacegame['player']['x']) .'" y="'. (38 + $spacegame['player']['y'] - $player['y']) .'" width="15" height="15" xlink:href="res/bdot.png" />';
        continue;
    }
    if ($player['x'] - $spacegame['player']['x'] >= -1 && $player['x'] - $spacegame['player']['x'] <= 1 && $player['y'] - $spacegame['player']['y'] >= -1 && $player['y'] - $spacegame['player']['y'] <= 1) {
        $scanner_players[get_dir($player['x'] - $spacegame['player']['x'], $player['y'] - $spacegame['player']['y'])][] = $player;
    }
    $dt = round((DOT_TIME - (PAGE_START_TIME - $player['last_move'])) / (DOT_TIME / 10));
    if ($dt < 1) {
        continue;
    }
    if ($dt > 9) {
        $dt = 9;
    }
    if ($player['alliance'] > 0 && $player['alliance'] == $spacegame['player']['alliance']) {
        echo '<image class="o' . $dt . '" x="' . (88 + $player['x'] - $spacegame['player']['x']) . '" y="' . (38 + $spacegame['player']['y'] - $player['y']) . '" width="15" height="15" xlink:href="res/bdot.png" />';
    } else {
        echo '<image class="o' . $dt . '" x="' . (88 + $player['x'] - $spacegame['player']['x']) . '" y="' . (38 + $spacegame['player']['y'] - $player['y']) . '" width="15" height="15" xlink:href="res/rdot.png" />';
    }
}
?>
Ejemplo n.º 25
0
$base = "c:\\inetpub\\wwwroot\\tms\\userimages\\";
$path = $base . $dir . "/";
if (!empty($dir)) {
    $html_img_lst = "Directory: <b>{$dir}</b><br><a href=\"javascript:history.go(-1)\"><--Back</a><br>\n";
    if ($list = opendir($path)) {
        while (false !== ($file = readdir($list))) {
            if (is_file($path . $file)) {
                if ($file != "." && $file != "..") {
                    $file = $dir . "/" . $file;
                    $html_img_lst .= "<a href=\"javascript:getImage('{$file}');\">{$file}</a><br>\n";
                }
            }
        }
    }
} else {
    $html_img_lst = get_dir($base);
}
function get_dir($base)
{
    if ($dir = opendir($base)) {
        while (false !== ($file = readdir($dir))) {
            if (is_dir($base . $file)) {
                if ($file != "." && $file != "..") {
                    $dir_list .= "[<a href=\"?dir={$file}\">{$file}</a>]<br>\n";
                }
            } else {
                $dir_list .= "<a href=\"javascript:getImage('{$file}');\">{$file}</a><br>\n";
            }
        }
    }
    return $dir_list;
Ejemplo n.º 26
0
  /**
   * 商品图文详情
   */
  public function imageText(){
	//$data['id'] = $_GET['id'];
	//$vo = $model->where($data)->find();
	$options['dir'] = get_dir($_GET['id']);
	$vo = getcache('detail',$options);//产品基本信息
	if(!$vo && $vo['status']==0){
	  $this->error('产品不存在');
	}  
	$this->assign('vo',$vo);
	$this->assign('headerTitle','商品详情-'.$vo['name']);
	$this->assign('headerKeywords','商品详情');
	$this->assign('headerDescription','商品详情');
	$this->display();  
  }