Exemplo n.º 1
0
 public static function __create()
 {
     $trigger = new static();
     $trigger->sprite_url = 'not-found.png';
     $trigger->map_id = 1;
     $trigger->name = 'Trigger';
     $trigger->x = 50;
     $trigger->y = 50;
     $weaponDealer = clone $trigger;
     $weaponDealer->script = 'merchants/weapon_dealer';
     $weaponDealer->script_arguments = '{"min_level":0,"max_level":80}';
     $weaponDealer->name = 'Weapon Dealer';
     $weaponDealer->map_id = map::load_one('Trainee Village', 'name')->id;
     $weaponDealer->save();
     $weaponDealer->id = null;
     $weaponDealer->name = 'Weapon Dealer';
     $weaponDealer->map_id = map::load_one('Kinata', 'name')->id;
     $weaponDealer->save();
     $dungeonEntrance = clone $trigger;
     $dungeonEntrance->script = 'dungeon_entrance';
     $dungeonEntrance->script_arguments = '{"dungeon_script":"","modes":[0,1,2,3,4,5]}';
     $dungeonEntrance->name = 'Dungeon Entrance';
     $traineeCave = clone $dungeonEntrance;
     $traineeCave->script_arguments = '{"dungeon_script":"trainee_cave","modes":[0,1,2,3,4,5]}';
     $traineeCave->name = 'Trainee Cave';
     $traineeCave->map_id = map::load_one('Trainee Fields', 'name')->id;
     $traineeCave->save();
     $kinataUnderground = clone $dungeonEntrance;
     $kinataUnderground->script_arguments = '{"dungeon_script":"kinata_underground","modes":[0,1,2,3,4,5]}';
     $kinataUnderground->name = 'Kinata Underground';
     $kinataUnderground->x = 100;
     $kinataUnderground->y = 100;
     $kinataUnderground->map_id = map::load_one('Kinata', 'name')->id;
     $kinataUnderground->save();
 }
Exemplo n.º 2
0
 public static function init($table = 'prop', $appid = '1', $field = 'node')
 {
     self::$table = $table;
     self::$field = $field;
     self::$appid = $appid;
     return self;
 }
Exemplo n.º 3
0
 public function __construct()
 {
     $this->BASE_FILE = ROOT_URL . "Carte.php";
     $this->map = map::getinstance();
     $this->lng = language::getinstance()->GetLngBlock('carte');
     parent::__construct();
 }
Exemplo n.º 4
0
 /**
  * Generate the Map Array.
  * These are the maps that show up in the Layer Switcher
  * if $all is set to TRUE all maps are rendered
  * **caveat is that each mapping api js must be loaded **
  * 
  * @param   bool  $all
  * @return  string $js
  */
 public static function layers_array($all = FALSE)
 {
     // Javascript
     $js = "[";
     // Get All Layers
     $layers = map::base();
     // Next get the default base layer
     $default_map = Kohana::config('settings.default_map');
     if (!isset($layers[$default_map])) {
         // Map Layer Doesn't Exist - default to google
         $default_map = "google_normal";
     }
     // Get openlayers type
     $openlayers_type = $layers[$default_map]->openlayers;
     $js .= $default_map;
     foreach ($layers as $layer) {
         if ($layer->name != $default_map and $layer->active) {
             if ($all == TRUE) {
                 $js .= "," . $layer->name;
             } else {
                 if ($layer->openlayers == $openlayers_type) {
                     $js .= "," . $layer->name;
                 }
             }
         }
     }
     $js .= "]";
     return $js;
 }
Exemplo n.º 5
0
 /**
  * 单例模式
  * @return map
  */
 public static function instance()
 {
     if (!self::$_instance instanceof self) {
         self::$_instance = new self();
     }
     return self::$_instance;
 }
Exemplo n.º 6
0
function calcdist($sys1, $sys2)
{
    //Pour avoir l'abscisse des coordonnées du système 1 [syst1 = 2456 ax = 2456%100]
    //Pour avoir l'ordonée des coordonnées du système 1 [syst1 = 2456 ay = (2456-2456%100)/100]
    list($syst1y, $syst1x) = map::ss2xy($sys1);
    list($syst2y, $syst2x) = map::ss2xy($sys2);
    return round(round(round(sqrt(carre($syst1x - $syst2x) + carre($syst1y - $syst2y)), 2), 1), 0);
}
Exemplo n.º 7
0
 /**
  * Google Location GeoCoding
  *
  * Reuses map::geocode() rather than reimplementing.
  * Only really keeping this for backwards compat
  *
  * @param   string location / address
  * @return  array (longitude, latitude)
  */
 function geocode_location($address = NULL)
 {
     $result = map::geocode($address);
     if ($result) {
         return array($result['longitude'], $result['latitude'], $result['country_id']);
     } else {
         return false;
     }
 }
Exemplo n.º 8
0
 public function path($CoordA, $CoordB)
 {
     list($sX, $sY) = map::ss2xy($CoordA);
     list($sX2, $sY2) = map::ss2xy($CoordB);
     $x1 = floor($this->tc * $sX - $this->tc / 2);
     $y1 = floor($this->tc * ($sY + 1) - $this->tc / 2);
     $x2 = floor($this->tc * $sX2 - $this->tc / 2);
     $y2 = floor($this->tc * ($sY2 + 1) - $this->tc / 2);
     imageline($this->im, $x1, $y1, $x2, $y2, $this->color);
 }
Exemplo n.º 9
0
 public function index_action()
 {
     $char = character::current();
     $mapId = $char->map_id;
     $map = map::load_one($mapId);
     if (!$map) {
         page::redirect('/world/map-not-found');
     }
     $this->set('map', $map);
 }
Exemplo n.º 10
0
 public function prepare()
 {
     global $SITE, $db;
     $this->template = "maps";
     $this->tab = 'map';
     $this->title = 'Popular maps';
     $f = $db->query_first("SELECT id, name, rank, score, plays, players FROM tf2_vars v INNER JOIN tf2_maps m on v.value = m.id");
     $fa = array('image' => map_functions::image('x600.y360', $f), 'label' => map_functions::label('', $f), 'link' => map_functions::link('', $f), 'type' => map_functions::type('', $f));
     $mlen = 18;
     $f['display_name'] = strlen($f['name']) > $mlen ? substr($f['name'], 0, $mlen - 3) . '...' : $f['name'];
     $this->params['feat'] = array_merge($f, $fa);
     ///////////////////////////////////////// New maps ////////////////////////////////////
     $this->params['new_maps'] = map::get_map_list(array('funcs' => array('count' => array('func' => 'count', 'param' => '%02d'), 'link' => array('func' => 'link'), 'label' => array('func' => 'label', 'param' => 25)), 'query' => 'SELECT * FROM tf2_maps ORDER BY first_seen DESC LIMIT 10;'));
     //////////////////////////////////////// popular maps ///////////////////////////////////
     $this->params['popular_maps'] = map::get_map_list(array('funcs' => array('link' => array('func' => 'link'), 'label' => array('func' => 'label'), 'image' => array('func' => 'image', 'param' => 'xy165')), 'query' => sprintf('SELECT id,name, official FROM tf2_maps ORDER BY score DESC LIMIT 10', $time)));
 }
 public function prepare()
 {
     global $SITE, $db;
     $this->template = "map_list";
     $this->tab = 'map';
     $this->title = 'Map list';
     $page_size = 50;
     $page = mysql_real_escape_string((int) $this->request[1]);
     $method = $this->request[0];
     $query = '';
     switch ($method) {
         case 'rank':
         case 'score':
         default:
             $method = 'score';
             $query = sprintf('SELECT id, name, official, score, rank, players, servers, plays FROM tf2_maps ORDER BY score DESC LIMIT ' . $page * $page_size . ', ' . $page_size);
     }
     $this->params['maps'] = map::get_map_list(array('funcs' => array('link' => array('func' => 'link'), 'label' => array('func' => 'label'), 'type' => array('func' => 'type'), 'icon' => array('func' => 'icon'), 'image' => array('func' => 'image', 'param' => 'x128.y96')), 'query' => $query));
     $this->params['method'] = $method;
     $this->params['page'] = $page;
 }
 public function prepare()
 {
     global $db;
     $this->template = "map_search";
     require_once 'classes/map.php';
     $q = $this->request['search'];
     //$db->debug=true;
     $db->query("SELECT name FROM tf2_maps WHERE name LIKE %s", array(sprintf("%%%%%s%%%%", $q)));
     //echo mysql_error();
     if ($db->num_rows() == 1) {
         $row = $db->fetch_array();
         //die();
         header('Location: /map/' . $row['name']);
         exit;
     }
     if (!$db->num_rows()) {
         page::error("We searched and searched", "But we just couldn't find the map you were looking for.\r\n\t\t\t\tRest assured Heavy is on the job. He won't rest until he knows who's been tampering with his gun.\r\n\t\t\t\t<br/><br/>That's what you were searching for, right?", array('image' => "heavy_yell"));
     }
     //$db->debug=true;
     $this->params['list'] = map::get_map_list(array('funcs' => array('link' => array('func' => 'link'), 'label' => array('func' => 'label')), 'query' => sprintf('SELECT m.id, m.name, m.official, m.score, plays, servers, first_seen FROM tf2_maps m WHERE name LIKE \'%%%s%%\' ORDER BY score DESC LIMIT 50', $q)));
     $this->title = sprintf("Search: %s", htmlspecialchars($this->request[0]));
 }
Exemplo n.º 13
0
 public function prepare()
 {
     $this->template = "map";
     $this->tab = 'map';
     global $SITE;
     $SITE['head'] .= '<script type="text/javascript" src="https://www.google.com/jsapi"></script>';
     require_once 'classes/map.php';
     $map = new map($this->request[0]);
     $i = $map->get_info();
     $s = $map->get_stats();
     $stats[] = array('key' => 'Players', 'now' => $i['players'], 'average' => $s['avg_players']);
     $stats[] = array('key' => 'Servers', 'now' => $i['servers'], 'average' => $s['avg_servers']);
     $stats[] = array('key' => 'Saturation', 'now' => $i['players'] > 0 ? $i['servers'] / $i['players'] : 0, 'average' => $s['saturation']);
     $this->title = htmlspecialchars($this->request[0]);
     $this->params['info'] = $i;
     $this->params['servers'] = $map->get_servers(25);
     $this->params['images'] = $map->get_images();
     $this->params['extra'] = $map->get_extra();
     $this->params['stats'] = $stats;
 }
Exemplo n.º 14
0
Kohana::config_set('settings.email_host', $settings->email_host);
Kohana::config_set('settings.email_servertype', $settings->email_servertype);
Kohana::config_set('settings.email_ssl', $settings->email_ssl);
Kohana::config_set('settings.alerts_email', $settings->alerts_email);
Kohana::config_set('settings.db_version', $settings->db_version);
Kohana::config_set('settings.ushahidi_version', $settings->ushahidi_version);
Kohana::config_set('settings.private_deployment', $settings->private_deployment);
// Set Site Timezone
if (function_exists('date_default_timezone_set')) {
    $timezone = $settings->site_timezone;
    // Set default timezone, due to increased validation of date settings
    // which cause massive amounts of E_NOTICEs to be generated in PHP 5.2+
    date_default_timezone_set(empty($timezone) ? date_default_timezone_get() : $timezone);
    Kohana::config_set('settings.site_timezone', $timezone);
}
// Cache Settings
$cache_pages = $settings->cache_pages ? TRUE : FALSE;
Kohana::config_set('cache.cache_pages', $cache_pages);
Kohana::config_set('cache.default.lifetime', $settings->cache_pages_lifetime);
$default_map = $settings->default_map;
$map_layer = map::base($default_map);
if ($map_layer) {
    Kohana::config_set('settings.api_url', "<script type=\"text/javascript\" src=\"" . $map_layer->api_url . "\"></script>");
}
// And in case you want to display all maps on one page...
$api_google = $settings->api_google;
$api_yahoo = $settings->api_yahoo;
Kohana::config_set('settings.api_url_all', '<script src="http://dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6"></script><script type="text/javascript" src="http://api.maps.yahoo.com/ajaxymap?v=3.0&appid=' . $api_yahoo . '"></script><script src="http://maps.google.com/maps/api/js?v=3.2&amp;sensor=false" type="text/javascript"></script>' . html::script('http://www.openstreetmap.org/openlayers/OpenStreetMap.js'));
// Additional Mime Types (KMZ/KML)
Kohana::config_set('mimes.kml', array('text/xml'));
Kohana::config_set('mimes.kmz', array('text/xml'));
Exemplo n.º 15
0
function article_list($vars)
{
    if ($vars['loop'] === "rel" && empty($vars['id'])) {
        return false;
    }
    $resource = array();
    $map_where = array();
    $status = '1';
    isset($vars['status']) && ($status = (int) $vars['status']);
    $where_sql = "WHERE `status`='{$status}'";
    $vars['call'] == 'user' && ($where_sql .= " AND `postype`='0'");
    $vars['call'] == 'admin' && ($where_sql .= " AND `postype`='1'");
    $hidden = iCache::get('iCMS/category/hidden');
    $hidden && ($where_sql .= iPHP::where($hidden, 'cid', 'not'));
    $maxperpage = isset($vars['row']) ? (int) $vars['row'] : 10;
    $cache_time = isset($vars['time']) ? (int) $vars['time'] : -1;
    isset($vars['userid']) && ($where_sql .= " AND `userid`='{$vars['userid']}'");
    isset($vars['weight']) && ($where_sql .= " AND `weight`='" . _int($vars['weight']) . "'");
    if (isset($vars['ucid']) && $vars['ucid'] != '') {
        $where_sql .= " AND `ucid`='{$vars['ucid']}'";
    }
    if (isset($vars['cid!'])) {
        $ncids = explode(',', $vars['cid!']);
        $vars['sub'] && ($ncids += iCMS::get_category_ids($ncids, true));
        $where_sql .= iPHP::where($ncids, 'cid', 'not');
    }
    if ($vars['cid'] && !isset($vars['cids'])) {
        $cid = explode(',', $vars['cid']);
        $vars['sub'] && ($cid += iCMS::get_category_ids($cid, true));
        $where_sql .= iPHP::where($cid, 'cid');
    }
    if (isset($vars['cids']) && !$vars['cid']) {
        $cids = explode(',', $vars['cids']);
        $vars['sub'] && ($cids += iCMS::get_category_ids($vars['cids'], true));
        if ($cids) {
            iPHP::import(iPHP_APP_CORE . '/iMAP.class.php');
            map::init('category', iCMS_APP_ARTICLE);
            $map_where += map::where($cids);
        }
    }
    if (isset($vars['pid']) && !isset($vars['pids'])) {
        $where_sql .= iPHP::where($vars['pid'], 'pid');
    }
    if (isset($vars['pids']) && !isset($vars['pid'])) {
        iPHP::import(iPHP_APP_CORE . '/iMAP.class.php');
        map::init('prop', iCMS_APP_ARTICLE);
        $map_where += map::where($vars['pids']);
    }
    if (isset($vars['tids'])) {
        iPHP::import(iPHP_APP_CORE . '/iMAP.class.php');
        map::init('tags', iCMS_APP_ARTICLE);
        $map_where += map::where($vars['tids']);
    }
    if (isset($vars['keywords'])) {
        //最好使用 iCMS:article:search
        if (empty($vars['keywords'])) {
            return;
        }
        if (strpos($vars['keywords'], ',') === false) {
            $vars['keywords'] = str_replace(array('%', '_'), array('\\%', '\\_'), $vars['keywords']);
            $where_sql .= " AND CONCAT(title,keywords,description) like '%" . addslashes($vars['keywords']) . "%'";
        } else {
            $kws = explode(',', $vars['keywords']);
            foreach ($kws as $kwv) {
                $keywords .= addslashes($kwv) . "|";
            }
            $keywords = substr($keywords, 0, -1);
            $where_sql .= " AND CONCAT(title,keywords,description) REGEXP '{$keywords}' ";
        }
    }
    $vars['id'] && ($where_sql .= iPHP::where($vars['id'], 'id'));
    $vars['id!'] && ($where_sql .= iPHP::where($vars['id!'], 'id', 'not'));
    $by = $vars['by'] == "ASC" ? "ASC" : "DESC";
    isset($vars['pic']) && ($where_sql .= " AND `haspic`='1'");
    isset($vars['nopic']) && ($where_sql .= " AND `haspic`='0'");
    switch ($vars['orderby']) {
        case "id":
            $order_sql = " ORDER BY `id` {$by}";
            break;
        case "hot":
            $order_sql = " ORDER BY `hits` {$by}";
            break;
        case "week":
            $order_sql = " ORDER BY `hits_week` {$by}";
            break;
        case "month":
            $order_sql = " ORDER BY `hits_month` {$by}";
            break;
        case "comment":
            $order_sql = " ORDER BY `comments` {$by}";
            break;
        case "pubdate":
            $order_sql = " ORDER BY `pubdate` {$by}";
            break;
        case "disorder":
            $order_sql = " ORDER BY `ordernum` {$by}";
            break;
        case "rand":
            $order_sql = " ORDER BY rand() {$by}";
            break;
        case "weight":
            $order_sql = " ORDER BY `weight`,`ordernum` ASC";
            break;
        default:
            $order_sql = " ORDER BY `id` {$by}";
    }
    isset($vars['startdate']) && ($where_sql .= " AND `pubdate`>='" . strtotime($vars['startdate']) . "'");
    isset($vars['enddate']) && ($where_sql .= " AND `pubdate`<='" . strtotime($vars['enddate']) . "'");
    isset($vars['where']) && ($where_sql .= $vars['where']);
    if ($map_where) {
        $map_sql = iCMS::map_sql($map_where, 'join');
        //join
        //empty($vars['cid']) && $map_order_sql = " ORDER BY map.`iid` $by";
        $map_table = 'map';
        $vars['map_order_table'] && ($map_table = $vars['map_order_table']);
        $map_order_sql = " ORDER BY {$map_table}.`iid` {$by}";
        //$map_order_sql = " ORDER BY `icms_article`.`id` $by";
        //
        $where_sql .= ' AND ' . $map_sql['where'];
        $where_sql = ",{$map_sql['from']} {$where_sql} AND `#iCMS@__article`.`id` = {$map_table}.`iid`";
        //derived
        // $where_sql = ",({$map_sql}) map {$where_sql} AND `id` = map.`iid`";
    }
    $offset = 0;
    $limit = "LIMIT {$maxperpage}";
    if ($vars['page']) {
        $total_type = $vars['total_cache'] ? $vars['total_cache'] : null;
        $total = iPHP::total('sql.md5', "SELECT count(*) FROM `#iCMS@__article` {$where_sql}", $total_type);
        $pagenav = isset($vars['pagenav']) ? $vars['pagenav'] : "pagenav";
        $pnstyle = isset($vars['pnstyle']) ? $vars['pnstyle'] : 0;
        $multi = iCMS::page(array('total_type' => $total_type, 'total' => $total, 'perpage' => $maxperpage, 'unit' => iPHP::lang('iCMS:page:list'), 'nowindex' => $GLOBALS['page']));
        $offset = $multi->offset;
        $limit = "LIMIT {$offset},{$maxperpage}";
        iPHP::assign("article_list_total", $total);
    }
    $hash = md5($where_sql . $order_sql . $limit);
    if ($offset) {
        if ($vars['cache']) {
            $map_cache_name = iPHP_DEVICE . '/article_page/' . $hash;
            $ids_array = iCache::get($map_cache_name);
        }
        if (empty($ids_array)) {
            $ids_order_sql = $map_order_sql ? $map_order_sql : $order_sql;
            $ids_array = iDB::all("SELECT `#iCMS@__article`.`id` FROM `#iCMS@__article` {$where_sql} {$ids_order_sql} {$limit}");
            iPHP_SQL_DEBUG && iDB::debug(1);
            $vars['cache'] && iCache::set($map_cache_name, $ids_array, $cache_time);
        }
        $ids = iCMS::get_ids($ids_array);
        $ids = $ids ? $ids : '0';
        $where_sql = "WHERE `id` IN({$ids})";
        $limit = '';
    } else {
        if ($map_order_sql) {
            $order_sql = $map_order_sql;
        }
    }
    if ($vars['cache']) {
        $cache_name = iPHP_DEVICE . '/article/' . $hash;
        $resource = iCache::get($cache_name);
    }
    // $func = '__article_array';
    // if($vars['func']=="user_home"){ //暂时只有一个选项
    //     $func = '__article_user_home_array';
    // }
    if (empty($resource)) {
        $resource = iDB::all("SELECT `#iCMS@__article`.* FROM `#iCMS@__article` {$where_sql} {$order_sql} {$limit}");
        iPHP_SQL_DEBUG && iDB::debug(1);
        $resource = __article_array($vars, $resource);
        $vars['cache'] && iCache::set($cache_name, $resource, $cache_time);
    }
    //print_r($resource);
    return $resource;
}
Exemplo n.º 16
0
 function do_save()
 {
     $appid = $this->appid;
     $cid = (int) $_POST['cid'];
     $rootid = (int) $_POST['rootid'];
     $status = (int) $_POST['status'];
     $isucshow = (int) $_POST['isucshow'];
     $issend = (int) $_POST['issend'];
     $isexamine = (int) $_POST['isexamine'];
     $ordernum = (int) $_POST['ordernum'];
     $mode = (int) $_POST['mode'];
     $pid = implode(',', (array) $_POST['pid']);
     $_pid = iS::escapeStr($_POST['_pid']);
     $_rootid_hash = iS::escapeStr($_POST['_rootid_hash']);
     $name = iS::escapeStr($_POST['name']);
     $subname = iS::escapeStr($_POST['subname']);
     $domain = iS::escapeStr($_POST['domain']);
     $htmlext = iS::escapeStr($_POST['htmlext']);
     $url = iS::escapeStr($_POST['url']);
     $password = iS::escapeStr($_POST['password']);
     $pic = iS::escapeStr($_POST['pic']);
     $mpic = iS::escapeStr($_POST['mpic']);
     $spic = iS::escapeStr($_POST['spic']);
     $dir = iS::escapeStr($_POST['dir']);
     $title = iS::escapeStr($_POST['title']);
     $keywords = iS::escapeStr($_POST['keywords']);
     $description = iS::escapeStr($_POST['description']);
     $categoryURI = iS::escapeStr($_POST['categoryURI']);
     $categoryRule = iS::escapeStr($_POST['categoryRule']);
     $contentRule = iS::escapeStr($_POST['contentRule']);
     $urlRule = iS::escapeStr($_POST['urlRule']);
     $indexTPL = iS::escapeStr($_POST['indexTPL']);
     $listTPL = iS::escapeStr($_POST['listTPL']);
     $contentTPL = iS::escapeStr($_POST['contentTPL']);
     $metadata = iS::escapeStr($_POST['metadata']);
     $contentprop = iS::escapeStr($_POST['contentprop']);
     $body = $_POST['body'];
     $hasbody = (int) $_POST['hasbody'];
     $hasbody or $hasbody = $body ? 1 : 0;
     if ($_rootid_hash) {
         $_rootid = authcode($_rootid_hash);
         if ($rootid != $_rootid) {
             iPHP::alert('非法数据提交!');
         } else {
             iACP::CP($_rootid, 'a', 'alert');
             exit;
         }
     }
     $cid && $cid == $rootid && iPHP::alert('不能以自身做为上级' . $this->category_name);
     empty($name) && iPHP::alert($this->category_name . '名称不能为空!');
     if ($metadata) {
         $md = array();
         foreach ($metadata['key'] as $_mk => $_mval) {
             !preg_match("/[a-zA-Z0-9_\\-]/", $_mval) && iPHP::alert($this->category_name . '附加属性名称只能由英文字母、数字或_-组成(不支持中文)');
             $md[$_mval] = $metadata['value'][$_mk];
         }
         $metadata = addslashes(serialize($md));
     }
     if ($contentprop) {
         $ca = array();
         foreach ($contentprop['key'] as $_cak => $_caval) {
             $_caval or $_caval = strtolower(pinyin($contentprop['name'][$_cak]));
             !preg_match("/[a-zA-Z0-9_\\-]/", $_caval) && iPHP::alert('内容附加属性字段只能由英文字母、数字或_-组成(不支持中文)');
             $ca[$_caval] = $contentprop['name'][$_cak];
         }
         $contentprop = addslashes(serialize($ca));
     }
     if ($mode == "2") {
         if (strpos($categoryRule, '{CDIR}') === FALSE && strpos($categoryRule, '{CID}') === FALSE && strpos($categoryRule, '{0xCID}') === FALSE) {
             iPHP::alert('伪静态模式下版块URL规则<hr />必需要有<br />{CDIR}版块目录<br />或者<br />{CID},{0xCID}版块ID');
         }
         if (strpos($contentRule, '{ID}') === FALSE && strpos($contentRule, '{0xID}') === FALSE && strpos($contentRule, '{LINK}') === FALSE) {
             iPHP::alert('伪静态模式下内容URL规则<hr />必需要有<br />{ID}' . $this->_app_name . 'ID <br />或者<br />{0xID}' . $this->_app_name . 'ID补零<br />或者<br />{LINK}' . $this->_app_name . '自定义链接');
         }
     }
     iPHP::import(iPHP_APP_CORE . '/iMAP.class.php');
     map::init('prop', iCMS_APP_CATEGORY);
     $fields = array('rootid', 'appid', 'ordernum', 'name', 'subname', 'password', 'title', 'keywords', 'description', 'dir', 'mode', 'domain', 'url', 'pic', 'mpic', 'spic', 'htmlext', 'categoryURI', 'categoryRule', 'contentRule', 'urlRule', 'indexTPL', 'listTPL', 'contentTPL', 'metadata', 'contentprop', 'hasbody', 'pid', 'isexamine', 'issend', 'isucshow', 'status');
     $data = compact($fields);
     if (empty($cid)) {
         iACP::CP($rootid, 'a', 'alert');
         $nameArray = explode("\n", $name);
         $_count = count($nameArray);
         foreach ($nameArray as $nkey => $_name) {
             $_name = trim($_name);
             if (empty($_name)) {
                 continue;
             }
             if ($_count == "1") {
                 if (empty($dir) && empty($url)) {
                     $dir = strtolower(pinyin($_name));
                 }
             } else {
                 empty($url) && ($dir = strtolower(pinyin($_name)));
             }
             $this->check_dir($dir, $appid, $url);
             $data['name'] = $_name;
             $data['dir'] = $dir;
             $data['userid'] = iMember::$userid;
             $data['creator'] = iMember::$nickname;
             $data['createtime'] = time();
             $data['count'] = '0';
             $data['comments'] = '0';
             $cid = iDB::insert('category', $data);
             $pid && map::add($pid, $cid);
             $this->cache(false, $this->appid);
             $this->cahce_one($cid);
         }
         $msg = $this->category_name . "添加完成!";
     } else {
         if (empty($dir) && empty($url)) {
             $dir = strtolower(pinyin($name));
         }
         iACP::CP($cid, 'e', 'alert');
         $this->check_dir($dir, $appid, $url, $cid);
         $data['dir'] = $dir;
         iDB::update('category', $data, array('cid' => $cid));
         map::diff($pid, $_pid, $cid);
         $this->cahce_one($cid);
         $msg = $this->category_name . "编辑完成!";
     }
     $hasbody && iCache::set('iCMS/category/' . $cid . '.body', $body, 0);
     iPHP::success($msg, 'url:' . $this->category_uri);
 }
Exemplo n.º 17
0
/**
 * @author Alex10336
 * Dernière modification: $Id$
 * @license GNU Public License 3.0 ( http://www.gnu.org/licenses/gpl-3.0.txt )
 * @license Creative Commons 3.0 BY-SA ( http://creativecommons.org/licenses/by-sa/3.0/deed.fr )
 *
 **/
require_once './init.php';
require_once INCLUDE_PATH . 'Script.php';
require_once CLASS_PATH . 'parser.class.php';
require_once CLASS_PATH . 'cartographie.class.php';
require_once CLASS_PATH . 'map.class.php';
if (!Members::CheckPermsOrDie('CARTOGRAPHIE')) {
}
$map = map::getinstance();
$carto = cartographie::getinstance();
$lng = language::getinstance()->GetLngBlock('cartographie');
if (isset($_POST['massedit'])) {
    foreach ($_POST['item'] as $k => $arr) {
        if ($arr['delete']) {
            $carto->Delete_Entry($k, $arr['type']);
        } else {
            if ($arr['edit']) {
                unset($arr['edit']);
                if (isset($arr['TROOP'])) {
                    $arr['TROOP'] = DataEngine::strip_number($arr['TROOP']);
                }
                $carto->Edit_Entry($k, $arr);
            }
        }
Exemplo n.º 18
0
				, maxExtent: new OpenLayers.Bounds(-20037508.34, -20037508.34, 20037508.34, 20037508.34)
				, controls: [	new OpenLayers.Control.Navigation(),
													new OpenLayers.Control.MouseDefaults(),
													new OpenLayers.Control.PanZoom(),
													new OpenLayers.Control.ArgParser(),
													new OpenLayers.Control.MousePosition(),
													new OpenLayers.Control.LoadingPanel({minSize: new OpenLayers.Size(573, 366)}) ]
										};
				
				var map = new OpenLayers.Map('map', options);
				
				<?php 
echo map::layers_js(TRUE);
?>
				map.addLayers(<?php 
echo map::layers_array(TRUE);
?>
);
				
				
				// Transform feature point coordinate to Spherical Mercator
				preFeatureInsert = function(feature) {		
					var point = new OpenLayers.Geometry.Point(feature.geometry.x, feature.geometry.y);
					OpenLayers.Projection.transform(point, DispProj, MapProj);
				};
				
				
				// Create the markers layer
				markers = new OpenLayers.Layer.Markers("Markers", {
					preFeatureInsert:preFeatureInsert,
					projection: DispProj
Exemplo n.º 19
0
function img_dot($image, $coord, $clr)
{
    $tc = map::getinstance()->taille / 100;
    $td = floor($tc / 2);
    $td = $td % 2 ? $td + 3 : $td + 2;
    list($sX, $sY) = map::ss2xy($coord);
    $x1 = floor($tc * $sX - $tc / 2);
    $y1 = floor($tc * ($sY + 1) - $tc / 2);
    imagefilledellipse($image, $x1, $y1, $td, $td, $clr);
}
Exemplo n.º 20
0
function user_list($vars = null)
{
    $maxperpage = isset($vars['row']) ? (int) $vars['row'] : "100";
    $cache_time = isset($vars['time']) ? (int) $vars['time'] : "-1";
    $where_sql = "WHERE `status`='1'";
    isset($vars['userid']) && ($where_sql .= " AND `uid`='{$vars['userid']}'");
    isset($vars['gid']) && ($where_sql .= " AND `gid` ='{$vars['gid']}'");
    isset($vars['type']) && ($where_sql .= " AND `type` ='{$vars['type']}'");
    if (isset($vars['pid']) && !isset($vars['pids'])) {
        $where_sql .= iPHP::where($vars['pid'], 'pid');
    }
    if (isset($vars['pids']) && !isset($vars['pid'])) {
        iPHP::import(iPHP_APP_CORE . '/iMAP.class.php');
        map::init('prop', iCMS_APP_USER);
        //$where_sql.= map::exists($vars['pid'],'`#iCMS@__user`.uid'); //map 表大的用exists
        $map_where = map::where($vars['pids']);
    }
    $by = $vars['by'] == "ASC" ? "ASC" : "DESC";
    switch ($vars['orderby']) {
        case "id":
            $order_sql = " ORDER BY `uid` {$by}";
            break;
        case "article":
            $order_sql = " ORDER BY `article` {$by}";
            break;
        case "comments":
            $order_sql = " ORDER BY `comments` {$by}";
            break;
        case "follow":
            $order_sql = " ORDER BY `follow` {$by}";
            break;
        case "fans":
            $order_sql = " ORDER BY `fans` {$by}";
            break;
        case "hits":
            $order_sql = " ORDER BY `hits` {$by}";
            break;
        default:
            $order_sql = " ORDER BY `uid` {$by}";
    }
    if ($map_where) {
        $map_sql = iCMS::map_sql($map_where);
        $where_sql = ",({$map_sql}) map {$where_sql} AND `uid` = map.`iid`";
    }
    $offset = 0;
    $limit = "LIMIT {$maxperpage}";
    if ($vars['page']) {
        $total = iPHP::total('sql.md5', "SELECT count(*) FROM `#iCMS@__user` {$where_sql} ");
        $multi = iCMS::page(array('total' => $total, 'perpage' => $maxperpage, 'unit' => iPHP::lang('iCMS:page:sql'), 'nowindex' => $GLOBALS['page']));
        $offset = $multi->offset;
        $limit = "LIMIT {$offset},{$maxperpage}";
        iPHP::assign("user_list_total", $total);
    }
    $hash = md5($where_sql . $order_sql . $limit);
    if ($map_sql || $offset) {
        if ($vars['cache']) {
            $map_cache_name = iPHP_DEVICE . '/user_map/' . $hash;
            $ids_array = iCache::get($map_cache_name);
        }
        if (empty($ids_array)) {
            $ids_array = iDB::all("SELECT `id` FROM `#iCMS@__user` {$where_sql} {$order_sql} {$limit}");
            iPHP_SQL_DEBUG && iDB::debug(1);
            $vars['cache'] && iCache::set($map_cache_name, $ids_array, $cache_time);
        }
        //iDB::debug(1);
        $ids = iCMS::get_ids($ids_array, 'uid');
        $ids = $ids ? $ids : '0';
        $where_sql = "WHERE `uid` IN({$ids})";
    }
    if ($vars['cache']) {
        $cache_name = iPHP_DEVICE . '/user_list/' . $hash;
        $resource = iCache::get($cache_name);
    }
    if (empty($resource)) {
        $resource = iDB::all("SELECT * FROM `#iCMS@__user` {$where_sql} {$order_sql} {$limit}");
        iPHP_SQL_DEBUG && iDB::debug(1);
        if ($resource) {
            foreach ($resource as $key => $value) {
                $value['url'] = user::router($value['uid'], "url");
                $value['urls'] = user::router($value['uid'], "urls");
                $value['avatar'] = user::router($value['uid'], "avatar", $vars['size'] ? $vars['size'] : 0);
                $value['at'] = '<a href="' . $value['url'] . '" class="iCMS_user_link" target="_blank" data-tip="iCMS:ucard:' . $value['uid'] . '">@' . $value['nickname'] . '</a>';
                $value['link'] = '<a href="' . $value['url'] . '" class="iCMS_user_link" target="_blank" data-tip="iCMS:ucard:' . $value['uid'] . '">' . $value['nickname'] . '</a>';
                $value['gender'] = $value['gender'] ? 'male' : 'female';
                isset($vars['data']) && ($value['data'] = (array) user::data($value['uid']));
                $resource[$key] = $value;
            }
        }
        $vars['cache'] && iCache::set($cache_name, $resource, $cache_time);
    }
    return $resource;
}
Exemplo n.º 21
0
	public function geocode()
	{
		$this->template = "";
		$this->auto_render = FALSE;

		if (isset($_POST['address']) AND ! empty($_POST['address']))
		{
			$geocode = map::geocode($_POST['address']);
			if ($geocode)
			{
				echo json_encode(array("status"=>"success", "message"=>array($geocode['lat'], $geocode['lon'])));
			}
			else
			{
				echo json_encode(array("status"=>"error", "message"=>"ERROR!"));
			}
		}
		else
		{
			echo json_encode(array("status"=>"error", "message"=>"ERROR!"));
		}
	}
    public function prepare()
    {
        global $db, $user, $settings;
        // auth check
        $auth = $db->query_first("SELECT mp.type FROM  tf2stats_map_to_player mp LEFT JOIN tf2_maps m ON m.id = mp.map_id\r\n\t\t\t\t\t\tWHERE mp.player_id = %s AND m.name = %s", array($user->id(), $this->request[0]));
        if (!in_array($auth['type'], array('M', 'A', 'C'))) {
            page::error("Little man", "You are no match for me!");
        }
        // handle file removals
        if ($this->request[1] == 'delimg') {
            $db->query("DELETE FROM tf2stats_map_images WHERE image = %s", array($this->request[2]));
            $this->params['success'] = "Deleted " . $this->request[2];
        }
        // update
        if ($_REQUEST['update']) {
            if ($_REQUEST['filesize'] && !is_numeric($_REQUEST['filesize'])) {
                $this->params['error'] = 'Filesize must be numeric. Do not append "MB".';
            } elseif ($_REQUEST['url'] && !filter_var($_REQUEST['url'], FILTER_VALIDATE_URL, FILTER_FLAG_SCHEME_REQUIRED)) {
                $this->params['error'] = 'Download URL is not valid.';
            } else {
                $i = $db->query_first("SELECT m.id, m.official FROM tf2_maps m WHERE m.name = %s", array($this->request[0]));
                if (IsUserAdmin()) {
                    $Official = (int) (isset($_REQUEST['official']) && $_REQUEST['official'] == 'official');
                    cache::log("Changing official status for " . $i['id'] . " - old: " . $i['official'] . " - new: " . $Official);
                    if ($i['official'] != $Official) {
                        $db->query("UPDATE tf2_maps SET official = %s WHERE id = %s", array($Official, $i['id']));
                    }
                }
                $db->query("INSERT INTO tf2stats_managed_maps (player_id, map_id, edit_time, description, file_size, download_url) VALUES(%s, %s, %s, %s, %s, %s)\r\n\t\t\t\t\t\t\tON DUPLICATE KEY UPDATE edit_time=%s, description=%s, file_size=%s, download_url = %s", array($user->id(), $i['id'], time(), $_REQUEST['description'], $_REQUEST['filesize'], $_REQUEST['url'], time(), $_REQUEST['description'], $_REQUEST['filesize'], $_REQUEST['url']));
            }
        }
        // map info
        $map_info = $db->query_first("SELECT m.name, m.id, m.official, mp.description, mp.file_size, mp.download_url, mp.edit_time, p.name as player_name FROM  tf2stats_managed_maps mp \r\n\t\t\t\t\t\tLEFT JOIN tf2_maps m ON m.id = mp.map_id\r\n\t\t\t\t\t\tLEFT JOIN tf2_players p on mp.player_id = p.id\r\n\t\t\t\t\t\tWHERE m.name = %s\r\n\t\t\t\t\t\tORDER BY edit_time DESC\r\n\t\t\t\t\t\tLIMIT 1", array($this->request[0]));
        if ($map_info) {
            $this->params['old'] = true;
        } else {
            $map_info = $db->query_first("SELECT m.name,  m.id FROM tf2_maps m WHERE m.name = %s", array($this->request[0]));
        }
        $this->params['map_info'] = $map_info;
        // handle adding authors.
        if ($this->request[1] == 'addauthor') {
            if ($this->request['search']) {
                $player_id = $this->request['search'];
                if (!is_id64($player_id)) {
                    $player_id = get_id64($this->request['search']);
                }
                $player = new player($player_id);
                if ($player->id()) {
                    $db->query("INSERT INTO tf2stats_map_to_player(player_id, map_id, type) VALUES(%s, %s, %s)", array($player->id(), $map_info['id'], 'A'));
                    $this->params['success'] = $player_id . ' has been added to the author list.';
                } else {
                    $this->params['error'] = "Could not find a player by '" . $_REQUEST['search'] . "'. Please refine your search.";
                }
            } else {
                $this->template = "manage_map_author";
                $this->title = sprintf("Adding author for %s", htmlspecialchars($map_info['name']));
                return;
            }
        }
        if ($this->request[1] == 'delauthor') {
            $id = $this->request[2];
            $db->query("DELETE FROM tf2stats_map_to_player WHERE player_id=%s AND map_id = %s", array($id, $map_info['id']));
            $this->params['success'] = "Deleted author";
        }
        // handle file uploads.
        if ($this->request[1] == 'upload') {
            $this->template = "manage_map_upload";
            $this->title = sprintf("Upload image for %s", htmlspecialchars($map_info['name']));
            $this->params['allowed_images'] = implode(', ', $settings['upload']['allowed_images']);
            if ($_FILES['image']) {
                if (!$_FILES['image']['tmp_name']) {
                    $this->params['error'] = 'Upload failed. (This usually happens when you try to upload a file larger than 1MB!)';
                    return;
                }
                // check extension.
                $ext = end(explode(".", strtolower($_FILES['image']['name'])));
                if (!in_array($ext, $settings['upload']['allowed_images'])) {
                    $this->params['error'] = 'Unsupported file extension ' . $ext . '. Please convert your image to one of these formats: ' . implode(', ', $settings['upload']['allowed_images']);
                    return;
                }
                // rename if already exists
                $filename = sprintf("%s_%s", $map_info['id'], str_replace(array('(', ')', ' '), '_', basename($_FILES['image']['name'])));
                $target_path = $settings['upload']['folder']['maps'] . $filename;
                while (file_exists($target_path)) {
                    $filename = md5(time() . rand()) . '.' . $ext;
                    $target_path = $settings['upload']['folder']['maps'] . $filename;
                }
                //var_dump($target_path);
                if (filesize($_FILES['image']['tmp_name']) > 2097152) {
                    $this->params['error'] = 'Uploaded file cannot exceed 1MB.';
                    return;
                }
                if (move_uploaded_file($_FILES['image']['tmp_name'], $target_path)) {
                    $db->query("INSERT INTO tf2stats_map_images (map_id, player_id, image) VALUES(%s, %s, %s)", array($map_info['id'], $user->id(), $filename));
                    $this->params['success'] = basename($_FILES['image']['name']) . ' uploaded successfully.';
                } else {
                    echo $_FILES['image']['tmp_name'];
                    echo $target_path;
                    $this->params['error'] = 'Unknown error. Please nag FireSlash until he fixes it.';
                }
            }
            return;
        }
        // tinyMCE setup
        $this->head .= '<script type="text/javascript" src="/static/js/tiny_mce/jquery.tinymce.js"></script>
		<script type="text/javascript">
	$().ready(function() {
		$(\'textarea.tinymce\').tinymce({
			// Location of TinyMCE script
			script_url : "/static/js/tiny_mce/tiny_mce.js",

			theme : "advanced",
			mode : "none",
			plugins : "bbcode",
			theme_advanced_buttons1 : "bold,italic,underline,undo,redo,link,unlink,image,forecolor,styleselect,removeformat,cleanup,code",
			theme_advanced_buttons2 : "",
			theme_advanced_buttons3 : "",
			theme_advanced_toolbar_location : "top",
			theme_advanced_toolbar_align : "left",
			theme_advanced_styles : "Code=codeStyle;Quote=quoteStyle",
			content_css : "css/bbcode.css",
			entity_encoding : "raw",
			add_unload_trigger : false,
			remove_linebreaks : false,
			inline_styles : false,
			convert_fonts_to_spans : false,
			apply_source_formatting : false
			
		});
	});
</script>
		';
        // map info
        $this->template = "manage_map";
        require_once 'classes/map.php';
        $m = new map($this->request[0]);
        $this->params['images'] = $m->get_images('xy165');
        $this->params['has_images'] = $this->params['images'];
        $this->params['can_set_official'] = IsUserAdmin();
        // associated peoples
        $db->query("SELECT p.id, p.name, mp.type from tf2stats_map_to_player mp LEFT JOIN tf2_players p ON mp.player_id = p.id WHERE mp.map_id = %s", array($map_info['id']));
        while ($row = $db->fetch_array()) {
            $row['del_link'] = sprintf('/manage_map/%s/delauthor/%s/', $this->request[0], $row['id']);
            $p[] = $row;
        }
        $this->title = sprintf("Managing %s", htmlspecialchars($this->request[0]));
        $this->params['people'] = $p;
    }
Exemplo n.º 23
0
 /**
  * This handles sms alerts subscription via phone
  *
  * @param string $message_from Subscriber MSISDN (mobile phone number)
  * @param string $message_description Message content
  * @return bool
  */
 public static function mobile_alerts_register($message_from, $message_description)
 {
     // Preliminary validation
     if (empty($message_from) or empty($message_description)) {
         // Log the error
         Kohana::log('info', 'Insufficient data to proceed with subscription via mobile phone');
         // Return
         return FALSE;
     }
     //Get the message details (location, category, distance)
     $message_details = explode(" ", $message_description);
     $message = $message_details[1] . "," . Kohana::config('settings.default_country');
     $geocoder = map::geocode($message);
     // Generate alert code
     $alert_code = text::random('distinct', 8);
     // POST variable with items to save
     $post = array('alert_type' => self::MOBILE_ALERT, 'alert_mobile' => $message_from, 'alert_code' => $alert_code, 'alert_lon' => $geocoder['lon'], 'alert_lat' => $geocoder['lat'], 'alert_radius' => '20', 'alert_confirmed' => '1');
     // Create ORM object for the alert and validate
     $alert_orm = new Alert_Model();
     if ($alert_orm->validate($post)) {
         return self::_send_mobile_alert($post, $alert_orm);
     }
     return FALSE;
 }
Exemplo n.º 24
0
			var options = {
				units: "mi",
				numZoomLevels: 20,
				controls:[],
				projection: proj_900913,
				'displayProjection': proj_4326,
				eventListeners: {
						"zoomend": mapMove
				    },
				'theme': null
				};
			map = new OpenLayers.Map('map', options);
			map.addControl( new OpenLayers.Control.LoadingPanel({minSize: new OpenLayers.Size(573, 366)}) );
			
			<?php echo map::layers_js(TRUE); ?>
			map.addLayers(<?php echo map::layers_array(TRUE); ?>);
			
			
			// Add Controls
			map.addControl(new OpenLayers.Control.Navigation());
			map.addControl(new OpenLayers.Control.Attribution());
			map.addControl(new OpenLayers.Control.PanZoomBar());
			map.addControl(new OpenLayers.Control.MousePosition(
				{
					div: document.getElementById('mapMousePosition'),
					numdigits: 5
				}));    
			map.addControl(new OpenLayers.Control.Scale('mapScale'));
            map.addControl(new OpenLayers.Control.ScaleLine());
			map.addControl(new OpenLayers.Control.LayerSwitcher());
			
Exemplo n.º 25
0
 function do_batch()
 {
     $idArray = (array) $_POST['id'];
     $idArray or iPHP::alert("请选择要操作的标签");
     $ids = implode(',', $idArray);
     $batch = $_POST['batch'];
     switch ($batch) {
         case 'dels':
             iPHP::$break = false;
             foreach ($idArray as $id) {
                 $this->do_del($id, false);
             }
             iPHP::$break = true;
             iPHP::success('标签全部删除完成!', 'js:1');
             break;
         case 'move':
             $_POST['cid'] or iPHP::alert("请选择目标栏目!");
             iPHP::import(iPHP_APP_CORE . '/iMAP.class.php');
             map::init('category', $this->appid);
             $cid = (int) $_POST['cid'];
             foreach ($idArray as $id) {
                 $_cid = iDB::value("SELECT `cid` FROM `#iCMS@__tags` where `id` ='{$id}'");
                 iDB::update("tags", compact('cid'), compact('id'));
                 if ($_cid != $cid) {
                     map::diff($cid, $_cid, $id);
                     $this->categoryApp->update_count_one($_cid, '-');
                     $this->categoryApp->update_count_one($cid);
                 }
             }
             iPHP::success('成功移动到目标栏目!', 'js:1');
             break;
         case 'mvtcid':
             $_POST['tcid'] or iPHP::alert("请选择目标分类!");
             iPHP::import(iPHP_APP_CORE . '/iMAP.class.php');
             map::init('category', $this->appid);
             $tcid = (int) $_POST['tcid'];
             foreach ($idArray as $id) {
                 $_tcid = iDB::value("SELECT `tcid` FROM `#iCMS@__tags` where `id` ='{$id}'");
                 iDB::update("tags", compact('tcid'), compact('id'));
                 if ($_tcid != $tcid) {
                     map::diff($tcid, $_tcid, $id);
                     $this->categoryApp->update_count_one($_tcid, '-');
                     $this->categoryApp->update_count_one($tcid);
                 }
             }
             iPHP::success('成功移动到目标分类!', 'js:1');
             break;
         case 'prop':
             iPHP::import(iPHP_APP_CORE . '/iMAP.class.php');
             map::init('prop', $this->appid);
             $pid = implode(',', (array) $_POST['pid']);
             foreach ((array) $_POST['id'] as $id) {
                 $_pid = iDB::value("SELECT pid FROM `#iCMS@__tags` WHERE `id`='{$id}'");
                 iDB::update("tags", compact('pid'), compact('id'));
                 map::diff($pid, $_pid, $id);
             }
             iPHP::success('属性设置完成!', 'js:1');
             break;
         case 'weight':
             $weight = _int($_POST['mweight']);
             $sql = "`weight` = '{$weight}'";
             break;
         case 'tpl':
             $tpl = iS::escapeStr($_POST['mtpl']);
             $sql = "`tpl` = '{$tpl}'";
             break;
         case 'keyword':
             if ($_POST['pattern'] == 'replace') {
                 $sql = "`keywords` = '" . iS::escapeStr($_POST['mkeyword']) . "'";
             } elseif ($_POST['pattern'] == 'addto') {
                 foreach ($idArray as $id) {
                     $keywords = iDB::value("SELECT keywords FROM `#iCMS@__tags` WHERE `id`='{$id}'");
                     $sql = "`keywords` = '" . ($keywords ? $keywords . ',' . iS::escapeStr($_POST['mkeyword']) : iS::escapeStr($_POST['mkeyword'])) . "'";
                     iDB::query("UPDATE `#iCMS@__tags` SET {$sql} WHERE `id`='{$id}'");
                 }
                 iPHP::success('关键字更改完成!', 'js:1');
             }
             break;
         case 'tag':
             if ($_POST['pattern'] == 'replace') {
                 $sql = "`related` = '" . iS::escapeStr($_POST['mtag']) . "'";
             } elseif ($_POST['pattern'] == 'addto') {
                 foreach ($idArray as $id) {
                     $keywords = iDB::value("SELECT related FROM `#iCMS@__tags` WHERE `id`='{$id}'");
                     $sql = "`related` = '" . ($keywords ? $keywords . ',' . iS::escapeStr($_POST['mtag']) : iS::escapeStr($_POST['mtag'])) . "'";
                     iDB::query("UPDATE `#iCMS@__tags` SET {$sql} WHERE `id`='{$id}'");
                 }
                 iPHP::success('相关标签更改完成!', 'js:1');
             }
             break;
         default:
             if (strpos($batch, ':')) {
                 $data = iACP::fields($batch);
                 foreach ($idArray as $id) {
                     $data && iDB::update("tags", $data, array('id' => $id));
                 }
                 iPHP::success('操作成功!', 'js:1');
             } else {
                 iPHP::alert('请选择要操作项!', 'js:1');
             }
     }
     $sql && iDB::query("UPDATE `#iCMS@__tags` SET {$sql} WHERE `id` IN ({$ids})");
     iPHP::success('操作成功!', 'js:1');
 }
Exemplo n.º 26
0
function openMapFile($prompt = "")
{
    $mapFile = prompt($prompt);
    try {
        $map = @fopen($mapFile, "r");
        return $map;
    } catch (Exception $ex) {
        print "\nMap file does not exist!\n";
        return false;
    }
}
function label($string = "")
{
    echo "\n\n{$string}\n\n";
}
$mapClass = new map();
$map = openMapFile($prompt);
// repeat while map not found and input was not interrupted by user
do {
    if ($map) {
        $mapClass->create($map);
        label("O U T P U T");
        echo "highest elevation : " . $mapClass->MAX . "\n X-coordinate: " . $mapClass->X . "\n Y-coordinate: " . $mapClass->Y . "\n Drop = " . $mapClass->DROP . "\n Length = " . $mapClass->LENGTH;
        echo "\n\nAnswer Email : " . $mapClass->LENGTH . $mapClass->DROP . "@redmart.com";
        break;
    } else {
        if (prompt("File not found. Do you want to try again? (y/n) : ") === "y") {
            $map = openMapFile($prompt);
            if ($map) {
                $mapClass->create($map);
                label("O U T P U T");
Exemplo n.º 27
0
 private function _generate_settings_map_js()
 {
     $map_layers = array();
     $layers = map::base();
     foreach ($layers as $layer) {
         $map_layers[$layer->name] = array();
         $map_layers[$layer->name]['title'] = $layer->title;
         $map_layers[$layer->name]['openlayers'] = $layer->openlayers;
         if (isset($layer->api_signup)) {
             $map_layers[$layer->name]['api_signup'] = $layer->api_signup;
         } else {
             $map_layers[$layer->name]['api_signup'] = "";
         }
     }
     return json_encode($map_layers);
 }
Exemplo n.º 28
0
			var options = {
				units: "mi",
				numZoomLevels: 18,
				controls:[],
				projection: proj_900913,
				'displayProjection': proj_4326,
				eventListeners: {
						"zoomend": mapMove
				    },
				'theme': null
				};
			map = new OpenLayers.Map('map', options);
			map.addControl( new OpenLayers.Control.LoadingPanel({minSize: new OpenLayers.Size(573, 366)}) );
			
			<?php echo map::layers_js(FALSE); ?>
			map.addLayers(<?php echo map::layers_array(FALSE); ?>);
			
			
			// Add Controls
			map.addControl(new OpenLayers.Control.Navigation());
			map.addControl(new OpenLayers.Control.Attribution());
			map.addControl(new OpenLayers.Control.PanZoomBar());
			map.addControl(new OpenLayers.Control.MousePosition(
				{
					div: document.getElementById('mapMousePosition'),
					numdigits: 5
				}));    
			map.addControl(new OpenLayers.Control.Scale('mapScale'));
            map.addControl(new OpenLayers.Control.ScaleLine());
			map.addControl(new OpenLayers.Control.LayerSwitcher());
			
Exemplo n.º 29
0
	// Now initialise the map
	var options = {
	units: "m"
	, numZoomLevels: 16
	, controls:[],
	projection: proj_900913,
	'displayProjection': proj_4326
	};
	
	map = new OpenLayers.Map('ReporterMap', options);
	
	<?php 
echo map::layers_js(FALSE);
?>
	map.addLayers(<?php 
echo map::layers_array(FALSE);
?>
);
	
	map.addControl(new OpenLayers.Control.Navigation());
	map.addControl(new OpenLayers.Control.PanZoom());
	map.addControl(new OpenLayers.Control.MousePosition());
	map.addControl(new OpenLayers.Control.LayerSwitcher());
	
	// Create the markers layer
	markers = new OpenLayers.Layer.Markers("Markers");
	map.addLayer(markers);
	
	// create a lat/lon object
	var latitude, longitude;
	if ($("#latitude").val() != "" && $("#longitude").val() != "") {
Exemplo n.º 30
0
<?php

return;
require_once 'ajax.php';
require_once 'classes/map.php';
$map = new map($_REQUEST['map']);
$history = $map->get_history();
$r = 0;
foreach ($history as $h) {
    $d = getdate($h['time']);
    $d['row'] = $r++;
    $d['players'] = $h['players'];
    $d['slots'] = $h['slots'];
    $d['servers'] = $h['servers'];
    $rows[] = sprintf("[new Date(%s,%s,%s,%s,%s),%s,%s,%s]", $d['year'], $d['mon'] - 1, $d['mday'], $d['hours'], $d['minutes'], $h['players'], $h['servers'], $h['slots']);
    //,$h['slots']);
}
printf('[%s]', implode(',', $rows));