示例#1
0
 function replaceMessage($message)
 {
     $message = strip_tags($message, '<b></b><i></i><u></u><a></a><img>');
     $message = str_ireplace("\n", "<BR>", "{$message}");
     // When you store the $message in a database you might get errors cause of the quotes
     $message = str_ireplace("[singleQuote]", "'", $message);
     $message = str_ireplace("[doubleQuote]", "\"", $message);
     $message = str_ireplace("[U]", "<U>", "{$message}");
     $message = str_ireplace("[/U]", "</U>", "{$message}");
     $message = str_ireplace("[I]", "<I>", "{$message}");
     $message = str_ireplace("[/I]", "</I>", "{$message}");
     $message = str_ireplace("[B]", "<B>", "{$message}");
     $message = str_ireplace("[/B]", "</B>", "{$message}");
     $message = replaceUrl($message);
     $message = replaceImg($message);
     return $message;
 }
示例#2
0
 /**
  * 获取指定私信列表中的私信内容
  * @return void
  */
 public function loadMessage()
 {
     $message = model('Message')->getMessageByListId(intval($_POST['list_id']), $this->mid, intval($_POST['since_id']), intval($_POST['max_id']));
     // 临时解决方案
     foreach ($message['data'] as &$value) {
         if ($value['content'] == t($value['content'])) {
             $value['content'] = replaceUrl($value['content']);
         }
     }
     $this->assign('message', $message);
     $this->assign('type', intval($_POST['type']));
     $message['data'] = $message['data'] ? $this->fetch() : null;
     echo json_encode($message);
 }
示例#3
0
<?php

echo replaceUrl(t($body));
示例#4
0
 /**
  * 获取指定私信列表中的私信内容
  * @return void
  */
 public function loadMessage()
 {
     $message = model('Message')->getMessageByListId(intval($_POST['list_id']), $this->mid, intval($_POST['since_id']), intval($_POST['max_id']));
     // 临时解决方案
     foreach ($message['data'] as &$value) {
         $value['content'] = replaceUrl($value['content']);
     }
     $this->assign('message', $message);
     $this->assign('type', intval($_POST['type']));
     // $imgUrl = array();
     // foreach ($message['data'] as $value) {
     // 	if ($value['attach_type'] === 'message_image') {
     // 		foreach ($value['attach_infos'] as $k => $v) {
     // 			$imgUrl[$value['message_id']][$v['attach_id']] = array('length'=>count($value['attach_infos']), 'index'=>$k + 1, 'url'=>$v['url'], 'attach_id'=>$v['attach_id']);
     // 		}
     // 	}
     // }
     // $this->assign('imgUrl', json_encode($imgUrl));
     $message['data'] = $message['data'] ? $this->fetch() : null;
     //dump($message);
     echo json_encode($message);
 }
 public function showTalkBox()
 {
     $type = t($_GET['t']);
     $id = intval($_GET['id']);
     if (empty($id) || empty($type)) {
         return;
     }
     $share = array();
     $limit = 10;
     if (in_array($type, array('at', 'com'))) {
         if ($type === 'at') {
             $map['atme_id'] = $id;
             $source = model('Atme')->where($map)->find();
             switch (strtolower($source['table'])) {
                 case 'feed':
                     $ownFeed = model('Feed')->get($source['row_id']);
                     $share['row_id'] = $ownFeed['feed_id'];
                     $share['app'] = $ownFeed['app'];
                     $share['table'] = 'feed';
                     $share['to_uid'] = $ownFeed['uid'];
                     break;
                 case 'comment':
                     $ownComment = model('Comment')->getCommentInfo($source['row_id']);
                     $share['row_id'] = $ownComment['row_id'];
                     $share['app'] = $ownComment['app'];
                     $share['table'] = $ownComment['table'];
                     $share['to_uid'] = $ownComment['uid'];
                     break;
             }
         } else {
             if ($type === 'com') {
                 $ownComment = model('Comment')->getCommentInfo($id);
                 $share['row_id'] = $ownComment['row_id'];
                 $share['app'] = $ownComment['app'];
                 $share['table'] = $ownComment['table'];
                 $share['to_uid'] = $ownComment['uid'];
             }
         }
         $source = model('Feed')->get($share['row_id']);
         $source['url'] = U('public/Profile/feed', array('feed_id' => $source['feed_id'], 'uid' => $source['uid']));
         if ($source['is_audit'] == 0 && $source['uid'] != $this->mid) {
             $source['body'] = '内容正在审核';
         }
         $this->assign('source', $source);
         $this->assign('row_id', $source['feed_id']);
         $this->assign('app_uid', $source['uid']);
         $this->assign('app_row_id', $source['app_row_id']);
         $this->assign('app_row_table', $source['app_row_table']);
         $this->assign('app_name', $source['app']);
         $this->assign('table', 'feed');
         // 转发权限判断
         $canrepost = 1;
         $weiboSet = model('Xdata')->get('admin_Config:feed');
         if (!CheckPermission('core_normal', 'feed_share') || !in_array('repost', $weiboSet['weibo_premission'])) {
             $canrepost = 0;
         }
         $this->assign('canrepost', $canrepost);
         $cancomment = intval(CheckPermission('core_normal', 'feed_comment'));
         $this->assign('cancomment', $cancomment);
         $cmap['app'] = $share['app'];
         $cmap['table'] = $share['table'];
         $cmap['row_id'] = $share['row_id'];
         $cmap['_string'] = '( (uid = ' . $this->mid . ' AND to_comment_id = 0) OR (uid = ' . $share['to_uid'] . ' AND to_comment_id = 0) OR (uid = ' . $this->mid . ' AND to_uid = ' . $share['to_uid'] . ') OR (uid = ' . $share['to_uid'] . ' AND to_uid = ' . $this->mid . ') OR (uid = ' . $this->mid . ' AND to_uid = ' . $this->mid . ') OR (uid = ' . $share['to_uid'] . ' AND to_uid = ' . $share['to_uid'] . ') )';
         $talkList = model('Comment')->getCommentList($cmap, 'comment_id ASC', $limit);
         foreach ($talkList['data'] as &$value) {
             if ($value['is_audit'] == 0 && $value['uid'] != $this->mid) {
                 $value['content'] = '内容正在审核';
             }
         }
         $this->assign('talkList', $talkList);
         $this->assign('sourceId', $share['row_id']);
         $sinceId = end($talkList['data']);
         $sinceId = $sinceId['comment_id'];
         $this->assign('sinceId', $sinceId);
         $this->assign('toUid', $share['to_uid']);
         $this->assign('maxId', 0);
         $initNums = model('Xdata')->getConfig('weibo_nums', 'feed');
         $this->assign('initNums', $initNums);
     } else {
         if ($type === 'pmsg') {
             $message = model('Message')->isMember($id, $this->mid, true);
             // 验证数据
             if (empty($message)) {
                 $this->error(L('PUBLIC_PRI_MESSAGE_NOEXIST'));
             }
             $message['member'] = model('Message')->getMessageMembers($id, 'member_uid');
             $message['to'] = array();
             // 添加发送用户ID
             foreach ($message['member'] as $v) {
                 $this->mid != $v['member_uid'] && ($message['to'][] = $v);
             }
             // 设置信息已读(私信列表页去掉new标识)
             model('Message')->setMessageIsRead($id, $this->mid, 0);
             $message['since_id'] = model('Message')->getSinceMessageId($message['list_id'], $message['message_num']);
             $this->assign('message', $message);
             $userinfo = model('User')->getUserInfo($this->mid);
             $this->assign('userinfo', $userinfo);
             $talkList = model('Message')->getMessageByListId($id, $this->mid, $message['since_id'], 0, 10);
             foreach ($talkList['data'] as &$value) {
                 $value['content'] == t($value['content']) && ($value['content'] = replaceUrl($value['content']));
             }
             $this->assign('talkList', $talkList);
             $this->assign('sourceId', $id);
             $this->assign('sinceId', $message['since_id']);
             $maxId = end($talkList['data']);
             $maxId = $maxId['message_id'];
             $this->assign('maxId', $maxId);
             $this->assign('toUid', 0);
             $this->assign('max_since_id', $talkList['data'][0]['message_id']);
         }
     }
     $this->assign('type', $type);
     $this->display('talkBox');
 }
示例#6
0
 /**
  * 处理微博附件数据
  * @param array $data 频道关联数组信息
  * @return array 处理后的微博数据
  */
 private function _formatContent($data)
 {
     // 组装微博信息
     foreach ($data as &$value) {
         // 获取微博信息
         $feedInfo = model('Feed')->get($value['feed_id']);
         $value = array_merge($value, $feedInfo);
         switch ($value['type']) {
             case 'postimage':
                 $feedData = unserialize($value['feed_data']);
                 $imgAttachId = is_array($feedData['attach_id']) ? $feedData['attach_id'][0] : $feedData['attach_id'];
                 $attach = model('Attach')->getAttachById($imgAttachId);
                 $value['attachInfo'] = getImageUrl($attach['save_path'] . $attach['save_name'], '225');
                 $value['attach_id'] = $feedData['attach_id'];
                 $value['body'] = parse_html($feedData['body']);
                 break;
             case 'postvideo':
                 $feedData = unserialize($value['feed_data']);
                 $value['body'] = replaceUrl($feedData['body']);
                 $value['flashimg'] = $feedData['flashimg'];
                 break;
             case 'postfile':
                 $feedData = unserialize($value['feed_data']);
                 $attach = model('Attach')->getAttachByIds($feedData['attach_id']);
                 foreach ($attach as $key => $val) {
                     $_attach = array('attach_id' => $val['attach_id'], 'name' => $val['name'], 'attach_url' => getImageUrl($val['save_path'] . $val['save_name'], '225'), 'extension' => $val['extension'], 'size' => $val['size']);
                     $value['attachInfo'][] = $_attach;
                 }
                 $value['body'] = parse_html($feedData['body']);
                 break;
             case 'repost':
                 $feedData = unserialize($value['feed_data']);
                 $value['body'] = parse_html($feedData['body']);
                 break;
             case 'weiba_post':
                 $feedData = unserialize($value['feed_data']);
                 $post_url = '<a class="ico-details" target="_blank" href="' . U('weiba/Index/postDetail', array('post_id' => $value['app_row_id'])) . '"></a>';
                 $value['body'] = preg_replace('/\\<a href="javascript:void\\(0\\)" class="ico-details"(.*)\\>(.*)\\<\\/a\\>/', $post_url, $value['body']);
                 break;
             case 'weiba_repost':
                 $feedData = unserialize($value['feed_data']);
                 $post_id = D('feed')->where('feed_id=' . $value['app_row_id'])->getField('app_row_id');
                 $post_url = '<a class="ico-details" target="_blank" href="' . U('weiba/Index/postDetail', array('post_id' => $post_id)) . '"></a>';
                 $value['body'] = preg_replace('/\\<a href="javascript:void\\(0\\)" class="ico-details"(.*)\\>(.*)\\<\\/a\\>/', $post_url, $value['body']);
                 break;
         }
     }
     return $data;
 }
示例#7
0
$sqlOriginal = 'master';
// File name for backup 'master'
tryConnections($dbData);
// Try connection
echo "Correct connection in all databases...<br>";
echo "Export DB 'master'...<br>";
backupDb($dbData, 'master');
// Export db 'master'
echo "Importando DB a 'stage'...<br>";
replaceUrl($dbData, 'master', 'stage');
// Change the url
echo "Replace Url'...<br>";
emptyDb($dbData, 'stage');
importDb($dbData, 'stage');
echo "Importando DB a 'dev'...<br>";
replaceUrl($dbData, 'stage', 'dev');
// Change the url
echo "Replace Url'...<br>";
emptyDb($dbData, 'dev');
importDb($dbData, 'dev');
echo "Elimando archivo SQL original...<br>";
unlink($sqlOriginal . '.sql');
echo "Done!...<br>";
function tryConnections($dbData)
{
    foreach ($dbData as $key => $data) {
        try {
            $dbh = new PDO('mysql:host=' . $data['host'] . ';port=' . $data['port'] . ';dbname=' . $data['db'], $data['user'], $data['pass']);
            echo "SUCCESS - DB:" . $key . "<br>";
        } catch (PDOException $e) {
            print "ERROR!!! - DB:{$key} : " . $e->getMessage() . "\n";
示例#8
0
function returnWidgetCode()
{
    $original = get_option("original_l");
    $request_uri = getRequestUri();
    $thisL = getLangFromUrl($request_uri);
    $url = isset($thisL) && $thisL != '' ? substr($request_uri, 3) : $request_uri;
    $full = get_option("is_fullname") == 'on';
    $current = isset($thisL) && $thisL != '' ? $thisL : $original;
    $list = "<ul>";
    $destEx = explode(",", get_option("destination_l"));
    array_unshift($destEx, $original);
    foreach ($destEx as $d) {
        if ($d != $current) {
            $list .= '<li class="' . $d . '"><a wg-notranslate href="' . ($d != $original ? replaceUrl($url, $d) : replaceUrl($url, '')) . '">' . ($full ? getLangNameFromCode($d, false) : strtoupper($d)) . '</a></li>';
        }
    }
    $list .= "</ul>";
    $moreclass = get_option("with_flags") == 'on' ? 'wg-flags ' : '';
    $moreclass .= get_option("is_dropdown") == 'on' ? 'wg-drop ' : 'wg-list ';
    $button = '<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" type="text/css"><!--Weglot 0.34--><aside id="weglot_switcher" wg-notranslate class="' . $moreclass . 'country-selector closed" onclick="openClose(this);" ><div class="current ' . $current . '"><a href="javascript:void(0);">' . ($full ? getLangNameFromCode($current, false) : strtoupper($current)) . '</a></div>' . $list . '</aside>';
    return $button;
}
 /**
  * 处理分享附件数据
  * @param array $data 频道关联数组信息
  * @return array 处理后的分享数据
  */
 private function _formatContent($data)
 {
     // 组装分享信息
     foreach ($data as &$value) {
         // 获取分享信息
         $feedInfo = model('Feed')->get($value['feed_id']);
         $value = array_merge($value, $feedInfo);
         switch ($value['type']) {
             case 'postimage':
                 $feedData = unserialize($value['feed_data']);
                 $imgAttachId = is_array($feedData['attach_id']) ? $feedData['attach_id'][0] : $feedData['attach_id'];
                 $attach = model('Attach')->getAttachById($imgAttachId);
                 $value['attachInfo'] = getImageUrl($attach['save_path'] . $attach['save_name'], '236');
                 $value['attach_id'] = $feedData['attach_id'];
                 $feedData['body'] = replaceUrl($feedData['body']);
                 $value['body'] = parse_html($feedData['body']);
                 break;
             case 'postvideo':
                 $feedData = unserialize($value['feed_data']);
                 $value['body'] = replaceUrl($feedData['body']);
                 if ($feedData['video_id']) {
                     $value['flashimg'] = SITE_URL . $feedData['image_path'];
                     $image_info = getimagesize($value['flashimg']);
                     $value['width'] = 236;
                     $value['height'] = $image_info[1] / ($image_info[0] / 236);
                 } else {
                     $value['flashimg'] = $feedData['flashimg'];
                 }
                 break;
             case 'postfile':
                 $feedData = unserialize($value['feed_data']);
                 $attach = model('Attach')->getAttachByIds($feedData['attach_id']);
                 foreach ($attach as $key => $val) {
                     $_attach = array('attach_id' => $val['attach_id'], 'name' => $val['name'], 'attach_url' => getImageUrl($val['save_path'] . $val['save_name'], '236'), 'extension' => $val['extension'], 'size' => $val['size']);
                     $value['attachInfo'][] = $_attach;
                 }
                 $feedData['body'] = replaceUrl($feedData['body']);
                 $value['body'] = parse_html($feedData['body']);
                 break;
             case 'repost':
                 $feedData = unserialize($value['feed_data']);
                 $value['body'] = parse_html($feedData['body']);
                 break;
             case 'weiba_post':
                 $feedData = unserialize($value['feed_data']);
                 $post_url = '<a class="ico-details" target="_blank" href="' . U('weiba/Index/postDetail', array('post_id' => $value['app_row_id'])) . '"></a>';
                 $value['body'] = preg_replace('/\\<a href="javascript:void\\(0\\)" class="ico-details"(.*)\\>(.*)\\<\\/a\\>/', $post_url, $value['body']);
                 if ($value['api_source']['pic_url']) {
                     $url = parse_url($value['api_source']['pic_url']);
                     $site_url = parse_url(SITE_URL);
                     if ($url['host'] == $site_url['host']) {
                         $value['api_source']['pic_url'] = getImageUrl($value['api_source']['pic_url'], '236');
                         //获取图片高度,避免瀑布流高度计算错误导致重叠
                         $pic_info = getimagesize($value['api_source']['pic_url']);
                         $value['api_source']['pic_height'] = $pic_info[1];
                     } else {
                         $img_info = myGetImageSize($value['api_source']['pic_url']);
                         $width = $img_info['width'];
                         $value['api_source']['pic_height'] = 236 / $width * $img_info['height'];
                     }
                 }
                 break;
         }
     }
     return $data;
 }