论坛插入图片无法选择uchome相册的解决方法


  烈火教程 在discuz!论坛顶部可以看到空间选项,和ucenter home连接正常,论坛插入图片内ucenter home的相册无法选择(看不到选项)的问题解决方法:

烈火网(liehuo.net)提示:点击新窗口预览!

  请将ucenter home的api目录discuz.php的代码全选,替换为下边的代码:

  <?php

include_once('../common.php');

$ac = isset($_GET['ac']) ? trim($_GET['ac']) : '';

$uri = $_SERVER['REQUEST_URI']?$_SERVER['REQUEST_URI']:($_SERVER['PHP_SELF']?$_SERVER['PHP_SELF']:$_SERVER['SCRIPT_NAME']);
$siteurl = 'http://'.$_SERVER['HTTP_HOST'].substr($uri, 0, strrpos($uri, '/')-3);

if(!in_array($ac, array('doing', 'album', 'space', 'feed'))) {
 $ac = 'js';
}

if(!empty($_SCONFIG['uc_dir']) && !strexists($_SCONFIG['uc_dir'], ':/') && !strexists($_SCONFIG['uc_dir'], ':\\') && substr($_SCONFIG['uc_dir'], 0, 1) != '/') {
 $_SCONFIG['uc_dir'] = '../'.$_SCONFIG['uc_dir'];
}
include_once(S_ROOT.'./api/discuz/'.$ac.'.php');

function makeurl($str) {
 global $siteurl;
 
 $str = stripslashes(preg_replace("/(\r\n|\n|\r)/", '', $str));
 $str = preg_replace("/src\=\"(?!http\:\/\/)(.+?)\"/i", ' src="'.$siteurl.'\\1"', $str);
 return addslashes(preg_replace("/href\=\"(?!http\:\/\/)(.+?)\"/i", ' target="_blank" href="'.$siteurl.'\\1"', $str));
}

function getdotstring ($string, $vartype, $allownull=false, $varscope=array(), $sqlmode=1, $unique=true) {

 if(is_array($string)) {
  $stringarr = $string;
 } else {
  if(substr($string, 0, 1) == '$') {
   return $string;
  }
  $string = str_replace(',', ',', $string);
  $string = str_replace(' ', ',', $string);
  $stringarr = explode(',', $string);
 }

 $newarr = array();
 foreach ($stringarr as $value) {
  $value = trim($value);
  if($vartype == 'int') {
   $value = intval($value);
  }
  if(!empty($varscope)) {
   if(in_array($value, $varscope)) {
    $newarr[] = $value;
   }
  } else {
   if($allownull) {
    $newarr[] = $value;
   } else {
    if(!empty($value)) $newarr[] = $value;
   }
  }
 }

 if($unique) $newarr = sarray_unique($newarr);
 if($vartype == 'int') {
  $string = implode(',', $newarr);
 } else {
  if($sqlmode) {
   $string = '\''.implode('\',\'', $newarr).'\'';
  } else {
   $string = implode(',', $newarr);
  }
 }
 return $string;
}

//将数组中相同的值去掉,同时将后面的键名也忽略掉
function sarray_unique($array) {
 $newarray = array();
 if(!empty($array) && is_array($array)) {
  $array = array_unique($array);
  foreach ($array as $value) {
   $newarray[] = $value;
  }
 }
 return $newarray;
}
?>
 


 

 

相关内容