Beispiel #1
0
 public function vxUserMove()
 {
     if (isset($_GET['geo'])) {
         $geo = strtolower(make_single_safe($_GET['geo']));
         if (get_magic_quotes_gpc()) {
             $geo = stripslashes($geo);
         }
         if (!$this->Geo->vxIsExist($geo)) {
             $geo = $this->User->usr_geo;
         }
     } else {
         $geo = $this->User->usr_geo;
     }
     $geo_md5 = md5($geo);
     $geo_real = mysql_real_escape_string($geo, $this->db);
     $Geo = new Geo($geo, $this->Geo->map);
     $geos_all_children = $Geo->vxGetRecursiveChildrenArray('', true);
     $geos_all_children_sql = implode(',', $geos_all_children);
     echo '<div id="main">';
     echo '<div class="blank" align="left">';
     _v_ico_map();
     echo ' <a href="/">' . Vocabulary::site_name . '</a> &gt; <a href="/u/' . urlencode($this->User->usr_nick) . '">' . make_plaintext($this->User->usr_nick) . '</a> &gt; <a href="/user/modify.vx">' . Vocabulary::action_modifyprofile . '</a> &gt; ' . Vocabulary::action_modifygeo;
     echo '</div>';
     echo '<div class="blank">';
     echo '当前浏览到 &gt; ';
     $geo_route = $Geo->vxGetRoute();
     $i = 0;
     foreach ($geo_route as $g => $n) {
         $i++;
         if ($g == $geo) {
             if ($i == 1) {
                 echo $n;
             } else {
                 echo ' &gt; ' . $n;
             }
         } else {
             if ($i == 1) {
                 echo '<a href="/user/move/' . $g . '" class="o">' . $n . '</a>';
             } else {
                 echo ' &gt; <a href="/user/move/' . $g . '" class="o">' . $n . '</a>';
             }
         }
     }
     if ($geo == $this->User->usr_geo) {
         echo ' <img src="/img/geo_here.gif" align="absmiddle" />';
     } else {
         echo ' <a href="/user/settle/' . $geo . '" class="var"><img src="/img/geo_set.gif" align="absmiddle" border="0" /></a>';
     }
     _v_hr();
     $geos_children = $Geo->vxGetChildrenArray($geo);
     if (count($geos_children) > 0) {
         $len_total = 0;
         foreach ($geos_children as $elem) {
             $len_total = $len_total + mb_strlen($elem, 'UTF-8');
         }
         $len_avg = floor($len_total / count($geos_children));
         switch ($len_avg) {
             case 2:
             default:
                 $br = 12;
                 break;
             case 3:
                 $br = 10;
                 break;
             case 4:
                 $br = 8;
                 break;
             case 5:
                 $br = 6;
                 break;
             case 6:
                 $br = 4;
                 break;
         }
         echo '<img src="/img/gt.gif" align="absmiddle" /> 下属于' . $Geo->geo->name->cn . '的区域';
         echo '<blockquote>';
         $i = 0;
         foreach ($geos_children as $g => $n) {
             $i++;
             $css_color = rand_color();
             echo '<a href="/user/move/' . $g . '" class="var" style="color: ' . $css_color . ';">' . $n . '</a>&nbsp; ';
             if ($i % $br == 0) {
                 echo '<br />';
             }
         }
         echo '</blockquote>';
         _v_hr();
     }
     $geos_parallel = $Geo->vxGetParallelArray($geo);
     if (count($geos_parallel) > 0) {
         $len_total = 0;
         foreach ($geos_parallel as $elem) {
             $len_total = $len_total + mb_strlen($elem, 'UTF-8');
         }
         $len_avg = floor($len_total / count($geos_parallel));
         switch ($len_avg) {
             case 2:
             default:
                 $br = 12;
                 break;
             case 3:
                 $br = 10;
                 break;
             case 4:
                 $br = 8;
                 break;
             case 5:
                 $br = 6;
                 break;
             case 6:
                 $br = 4;
                 break;
         }
         echo '<img src="/img/gt.gif" align="absmiddle" /> 与' . $Geo->geo->name->cn . '平行的区域';
         echo '<blockquote>';
         $i = 0;
         foreach ($geos_parallel as $g => $n) {
             $i++;
             $css_color = rand_color();
             echo '<a href="/user/move/' . $g . '" class="var" style="color: ' . $css_color . ';">' . $n . '</a>&nbsp; ';
             if ($i % $br == 0) {
                 echo '<br />';
             }
         }
         echo '</blockquote>';
     }
     _v_hr();
     if ($Geo->geo->geo != $this->User->usr_geo) {
         echo '<img src="/img/gt.gif" align="absmiddle" /> 我当前设置好的所在地 &gt <a href="/user/move/' . $this->User->usr_geo . '" class="o">' . $this->Geo->map['name'][$this->User->usr_geo] . '</a>';
         _v_hr();
     }
     echo '<div class="geo_home_middle">';
     if (mb_strlen($Geo->geo->description->cn, 'UTF-8') > 0) {
         echo '<span class="geo_home_desc">' . $Geo->geo->description->cn . '</span>';
     } else {
         echo '<span class="tip_i"><small>no description yet ...</small></span>';
     }
     echo '</div>';
     _v_hr();
     echo '<img src="/img/ico_tip.gif" align="absmiddle" class="ico" />浏览到你想要设置为所在地的区域之后,请点击地名右侧的蓝色条幅完成设置</span>';
     _v_hr();
     if ($geo_count = $this->cs->get('babel_geo_settle_count_' . $geo_md5)) {
         $geo_count = intval($geo_count);
     } else {
         $sql = "SELECT COUNT(*) FROM babel_user WHERE usr_geo IN ({$geos_all_children_sql})";
         $rs = mysql_query($sql, $this->db);
         $geo_count = intval(mysql_result($rs, 0, 0));
         mysql_free_result($rs);
         $this->cs->save(strval($geo_count), 'babel_geo_settle_count_' . $geo_md5);
     }
     echo '<img src="/img/gt.gif" align="absmiddle" /> 有 <a href="/who/settle/' . $geo . '" class="t">&nbsp;' . $geo_count . '&nbsp;</a> 人在' . $Geo->geo->name->cn . '。';
     echo '</div>';
     echo '</div>';
 }