Пример #1
0
 function AddNew()
 {
     $this->NoLoginAjaxReturn();
     $id = 0;
     $return = array();
     $type = $this->QueryString('type');
     switch ($type) {
         case "longtext":
             $content = $this->QueryString('content');
             $content = safe_str($content);
             $id = $this->ItemLogic->AddLongtext($this->User['uid'], $this->User['uname'], $content);
             if ($id && $id > 0) {
                 $return['status'] = 'ok';
                 $return['message'] = urlencode('长文本保存成功');
                 $return['item'] = 'longtext';
                 $return['item_id'] = $id;
             } else {
                 $return['status'] = 'failed';
                 $return['message'] = urlencode('长文本保存失败');
                 $return['item'] = 'longtext';
                 $return['item_id'] = 0;
             }
             break;
     }
     echo urldecode(json_encode($return));
 }
Пример #2
0
 function GetTopicByTags()
 {
     $tagName = $this->Post['name'] ? $this->Post['name'] : $this->Get['name'];
     $this->GotoLogin();
     $page = $this->Post['page'] ? $this->Post['page'] : $this->Get['page'];
     $pageSize = $this->Config['topic_pagesize'];
     $pstepsize = $this->Config['page_step_size_topic'];
     if ($page == '') {
         $page = 1;
     }
     $uid = $this->User['uid'];
     if ($tagName != '') {
         $tagName = urldecode($tagName);
         $tagName = safe_str($tagName);
         $topic_ids = "select item_id from item_tag where tag_id in (select id from tag where name='{$tagName}')";
     } else {
         $topic_ids = '';
     }
     $results = $this->TopicLogic->SearchTopics('', '', '', false, '', '', $topic_ids, '', '', '', '', '', '', '', '', '', $page, $pageSize, false);
     $total = $results['total'];
     $topicList = $results['data'];
     $url = "index.php?mod=topic&action=mycomments";
     $pageHtml = PagerRecords('', $url, $pageSize, $page, $total, $pstepsize, 0);
     $hotTags = $this->TagBiz->GetHotTags('topic', 1, $this->Config['hot_tag_pagesize']);
     $this->TemplateHandler->AssignValue('hottags_total', $hotTags['total']);
     $this->TemplateHandler->AssignValue('hottags', $hotTags['data']);
     $this->TemplateHandler->AssignValue('hottags_ps', $this->Config['hot_tag_pagesize']);
     $un = $this->UserLogic->GetUserNotifications($uid);
     $un->CommentsNew = 0;
     $this->UserLogic->UpdateUserNotification($un);
     $this->TemplateHandler->AssignValue('title', "#{$tagName}# 相关主题" . $this->Config['sitetitle']);
     $this->TemplateHandler->AssignValue('topics', $topicList);
     $this->TemplateHandler->AssignValue('total', $total);
     $this->TemplateHandler->Display('topic_main.html');
 }
Пример #3
0
 function SearchTags($tagIds, $uids, $tagName, $page, $pageSize)
 {
     if ($page > 0) {
         if ($pageSize == "" || $pageSize == 0) {
             $pageSize = $this->Config['hot_tag_pagesize'];
         }
         $startrecord = $pageSize * ($page - 1);
         $endrecord = $pageSize * $page;
         $limit = ' limit ' . $startrecord . ',' . $pageSize;
     }
     $sql = "select t.user_id,t.id,t.name,FROM_UNIXTIME(t.dateline) as dateline,FROM_UNIXTIME(t.last_post) as last_post,t.topic_count,t.user_count,u.uname,u.face_url from tag t left join user u on u.uid=t.user_id ";
     $order = "order by t.topic_count desc,t.user_count desc ";
     $where = "where 1=1 ";
     if ($tagIds && $tagIds != '') {
         $where .= "and t.id in({$tagIds}) ";
     }
     if ($uids && $uids != '') {
         $where .= "and t.user_id in({$uids}) ";
     }
     if ($tagName && trim($tagName) != '') {
         $keyword = safe_str($tagName);
         $where .= "and t.name like '%{$keyword}%' ";
     }
     $sqlcount = "select count(t.id) as rs from tag t " . $where;
     $rs = $this->DatabaseHandler->FetchFirst($sqlcount);
     if ($rs) {
         $total = $rs['rs'];
     }
     $sql .= $where . $order . $limit;
     $this->Logger->Write($sql);
     $query = $this->DatabaseHandler->Query($sql);
     if ($query) {
         $rows = $query->GetAll();
     }
     $result['total'] = $total;
     $result['data'] = $rows;
     return $result;
 }
Пример #4
0
 function Login()
 {
     $password = $this->Post['regPassword'];
     $email = $this->Post['regEmail'];
     if (trim($password) == "" && trim($email) == "") {
         $this->TemplateHandler->AssignValue('message', "账户和密码都不能为空");
         $this->TemplateHandler->Display('login.html');
         exit;
     }
     $password = safe_str($password);
     $email = safe_str($email);
     $md5pass = md5($password);
     $loginfo = $this->UserLogic->Login($email, $md5pass);
     if ($loginfo && is_array($loginfo) && count($loginfo) > 0) {
         if (!$loginfo['failed']) {
             //set cookie
             $uid = $loginfo['user']['uid'];
             $encodestr = authcode("{$uid}\\~{$md5pass}", 'ENCODE', $this->Config['auth_key']);
             //$encodestr=urlencode($uid."\~".$md5pass);
             $life = $this->Config['cookie_life'];
             if ($life == 0) {
                 $this->CookieHandler->SetVar('authstr', $encodestr);
             } else {
                 $this->CookieHandler->SetVar('authstr', $encodestr, time() + $life);
             }
             session_start();
             $_SESSION['uid'] = $uid;
             $_SESSION['uemail'] = $email;
             $_SESSION['uname'] = $loginfo['user']['uname'];
             $_SESSION['face_url'] = $loginfo['user']['face_url'];
             $_SESSION['face_url_p'] = $loginfo['user']['face_url_p'];
             $redirectUrl = './index.php?mod=user&action=index';
             if (isset($this->return) && $this->return != '') {
                 $redirectUrl = urldecode($this->return);
             }
             // echo $redirectUrl;
             header("Location:{$redirectUrl}");
             exit;
         } else {
             $this->TemplateHandler->AssignValue('message', $loginfo['info']);
             $this->TemplateHandler->Display('login.html');
             //$this->Messager($loginfo['info'],'./index.php?mod=user&action=login');
         }
     }
 }
Пример #5
0
 function SearchTopics()
 {
     $container_id = $this->QueryString('container_id');
     $container = $this->QueryString('container');
     $container = safe_str($container);
     $page = $this->QueryString('page');
     $pageSize = $this->Config['building_topic_pagesize'];
     $pstepsize = $this->Config['page_step_size_topic'];
     $item = $this->QueryString('item');
     if ($page == '') {
         $page = 1;
     }
     $share_type = $this->QueryString('share_type');
     $tids = '';
     $tag = $this->QueryString('tag');
     $tag = safe_str($tag);
     if ($tag && $tag != '') {
         $tids = "select item_id from item_tag where item='topic' and tag_id in (select id from tag where name like '%{$tag}%')";
     }
     $keywords = $this->QueryString('keywords');
     $keywords = safe_str($keywords);
     if ($item && ($item == 'photo' || $item == 'baobei')) {
         $pageSize = $this->Config['photo_wall_pagesize'];
     }
     if ($this->QueryString('pagesize') && $this->QueryString('pagesize') != '' && $this->QueryString('pagesize') > 0) {
         $pageSize = $this->QueryString('pagesize');
     }
     $uid = $this->QueryString('uid');
     $result = $this->TopicLogic->SearchTopics($uid, $container, $container_id, true, $keywords, '', $tids, $item, '', '', '', '', $share_type, '', '', '', $page, $pageSize);
     $result['page'] = $page;
     $result['pagerecords'] = count($result['data']);
     $result['pagesize'] = $pageSize;
     $total = $result['total'];
     if ($total > 0) {
         if ($total % $pageSize == 0) {
             $result['total_page'] = $total / $pageSize;
         } else {
             $result['total_page'] = intval($total / $pageSize) + 1;
         }
     }
     echo json_encode($result);
     //echo urldecode(json_encode(ArrayToJson($result)));
 }
Пример #6
0
    <b><?php 
echo '<a href="bitcoin:' . $pubAdd . '?amount=' . $_SESSION['total_price'] . '" title="Click this address to launch your Bitcoin client" target="_blank">' . safe_str($pubAdd) . '</a>';
?>
</b>
  </h3> 
  <div id="qrcode"></div>
  
  <?php 
if (empty($_GET['u'])) {
    ?>
 
  
  <p>Click the confirm button after the BTC has been sent.</p>
  <hr style="width:300px" />
  <p><a href="<?php 
    echo safe_str('?t=' . urlencode($_GET['t']) . '&u=1');
    ?>
" target="_self"><img border='0' src='img/conf_btn.png' alt='CONFIRM PAYMENT' /></a></p>
  <p><a href="#" onClick="confirmCancel();"><img border='0' src='img/canc_btn.png' alt='CANCEL PAYMENT' /></a></p>

  <?php 
} else {
    ?>
 
  
  <p>Please wait while the bitcoin network confirms the payment.<br />
  The progress bar may jump back to 0% after reaching 100%</p>
  
  <p><b>Progress:</b></p>
  <table cellpadding='0' cellspacing='0' id='pro_box'><tr><td align='left'>
    <div id='pro_bar' style='width:0px'></div>
Пример #7
0
include 'session.php';
function safe_str($str)
{
    return mysql_real_escape_string(stripslashes($str));
}
if (!(logged_in_with_valid_credentials() && logged_in_as_admin())) {
    die("Forget it, you must be logged in as admin.");
}
if (!isset($_POST['user_id']) || !isset($_POST['reason'])) {
    die("Did not receive user_id or reason");
}
$user_id = safe_str($_POST['user_id']);
$reason = $_POST['reason'];
$query = "SELECT * from users where user_id=" . $user_id;
$result = mysql_query($query);
if (!result || mysql_num_rows($result) != 1) {
    die("Could not find the user account");
}
$user = mysql_fetch_assoc($result);
if ($user['password'] == "") {
    die("This account is already disabled");
}
$admin = current_username();
$bio = safe_str($user['bio'] . " - " . $reason . " by " . $admin);
$email = safe_str($user['email'] . " disabled");
$query = "UPDATE users SET email='{$email}', bio = '{$bio}', password = ''\n    WHERE user_id={$user_id}";
mysql_query($query);
$query = "UPDATE submissions SET latest=0 WHERE user_id={$user_id}";
mysql_query($query);
header("Location: profile.php?user_id=" . $user_id);
Пример #8
0
 function AddNewBuilding(BuildingEntity &$buildingObj)
 {
     //$buildingObj->SafeFields();
     //$existed=$this->GetExistsBuilding($buildingObj->BName, 0);
     //if($existed && $existed['bid']>0)
     //{
     //	return  $existed;
     //}
     $datalist = array();
     $datalist['bname'] = safe_str($buildingObj->BName);
     if ($buildingObj->NickName && $buildingObj->NickName != '') {
         $datalist['nickname'] = safe_str($buildingObj->NickName);
     }
     if ($buildingObj->PropertyCompanyName && $buildingObj->PropertyCompanyName != '') {
         $datalist['property_company_name'] = $buildingObj->PropertyCompanyName;
     }
     if ($buildingObj->PropertyCompanyPhone && $buildingObj->PropertyCompanyPhone != '') {
         $datalist['property_company_phone'] = $buildingObj->PropertyCompanyPhone;
     }
     if ($buildingObj->OwnercommitteePhone && $buildingObj->OwnercommitteePhone != '') {
         $datalist['owner_committee_phone'] = $buildingObj->OwnercommitteePhone;
     }
     if ($buildingObj->Province && $buildingObj->Province > 0) {
         $datalist['province'] = $buildingObj->Province;
     } else {
         $datalist['province'] = 0;
     }
     if ($buildingObj->City && $buildingObj->City > 0) {
         $datalist['city'] = $buildingObj->City;
     } else {
         $datalist['city'] = 0;
     }
     if ($buildingObj->Area && $buildingObj->Area > 0) {
         $datalist['district'] = $buildingObj->Area;
     } else {
         $datalist['district'] = 0;
     }
     if ($buildingObj->Street && $buildingObj->Street > 0) {
         $datalist['street'] = $buildingObj->Street;
     } else {
         $datalist['street'] = 0;
     }
     $datalist['address'] = safe_str($buildingObj->Address);
     $datalist['build_type_id'] = $buildingObj->Build_Type_Id;
     $datalist['create_uid'] = $buildingObj->Create_uid;
     $datalist['createtime'] = $buildingObj->Createtime;
     $datalist['point_lat'] = $buildingObj->Point_lat;
     $datalist['point_lng'] = $buildingObj->Point_lng;
     $datalist['face_url'] = $buildingObj->Face_URL;
     $datalist['description'] = safe_str($buildingObj->Description);
     //$sql="insert into building (bname,province,city,area,address,build_type_id,create_uid,createtime,point)";
     //$sql.="values('$buildingObj->BName','$buildingObj->Province','$buildingObj->City','$buildingObj->Area','$buildingObj->Address','$buildingObj->Build_Type_Id','$buildingObj->Create_uid','$buildingObj->Createtime','$buildingObj->Point')";
     $result = $this->DatabaseHandler->Insert2($datalist, 'building');
     if ($result && $result > 0) {
         $buildingObj->BId = $result;
         return $result;
     }
 }
Пример #9
0
 function AddTopic(TopicEntity $topic)
 {
     $table = 'topic';
     $topic->SafeFields();
     $datalist = array();
     $contents = $this->_process_content($topic->content, $topic_info);
     $at_uids = $contents['at_uids'];
     $tags = $contents['tags'];
     $tag_ids = '';
     if ($tags && is_array($tags) && count($tags) > 0) {
         $tag_ids = $this->TagLogic->GetTopicTagIds($tags, $topic->uid);
     }
     $datalist['uid'] = $topic->uid;
     $datalist['username'] = $topic->username;
     $datalist['content'] = safe_str($contents['content']);
     $datalist['imageid'] = $topic->imageids;
     $datalist['videoid'] = $topic->videoid;
     $datalist['musicid'] = $topic->musicid;
     $datalist['longtextid'] = $topic->longtextid;
     $datalist['attachid'] = $topic->attachid;
     $datalist['roottid'] = $topic->roottid;
     $datalist['replys'] = $topic->replys;
     $datalist['forwards'] = $topic->forwards;
     $datalist['totid'] = $topic->totid;
     $datalist['touid'] = $topic->touid;
     $datalist['tousername'] = $topic->tousername;
     $datalist['dateline'] = $topic->dateline;
     $datalist['from'] = $topic->from;
     $datalist['type'] = $topic->type;
     $datalist['item_id'] = $topic->item_id;
     $datalist['item'] = $topic->item;
     $datalist['postip'] = $topic->postip;
     $datalist['point_lat'] = $topic->point_lat;
     $datalist['point_lng'] = $topic->point_lng;
     $datalist['container'] = $topic->container;
     $datalist['container_id'] = $topic->container_id;
     $datalist['upid'] = $topic->upid;
     $datalist['lastupdate'] = time();
     $ntid = $this->DatabaseHandler->Insert2($datalist, $table);
     $topic->tid = $ntid;
     //update user topic_count
     if ($topic->uid > 0) {
         //handle topic tags
         $this->AddTopicTags($tag_ids, $topic->tid);
         if ($at_uids && is_array($at_uids)) {
             foreach ($at_uids as $k => $v) {
                 $time_now = time();
                 $this->DatabaseHandler->Query("INSERT into topic_mention(tid,uid,dateline) VALUES({$ntid},{$v},{$time_now})");
                 $un = $this->UserLogic->GetUserNotifications($v);
                 $un->AtNew = $un->AtNew + 1;
                 $this->UserLogic->UpdateUserNotification($un);
             }
         }
         $this->DatabaseHandler->Query("UPDATE user set topic_count = topic_count+1 where uid={$topic->uid}");
     }
     if ($topic->uid > 0) {
         $buddyrow = $this->DatabaseHandler->FetchFirst("select count(*) as rs from buddys where buddyid={$topic->uid}");
         if ($buddyrow && $buddyrow['rs'] > 0) {
             $buddyLastUptime = time();
             $this->DatabaseHandler->Query("UPDATE buddys set buddy_lastuptime={$buddyLastUptime} where buddyid={$topic->uid}");
         }
     }
     if ($topic->container != '' && $topic->container_id > 0) {
         switch ($topic->container) {
             case "building":
                 $this->DatabaseHandler->Query("UPDATE building set topic_count=topic_count+1 where bid={$topic->container_id}");
                 break;
             default:
                 break;
         }
     }
     if (isset($ntid) && $ntid > 0) {
         $totid = $topic->totid;
         if ($totid == '') {
             $totid = 0;
         }
         if ($totid > 0) {
             $t = time();
             $this->DatabaseHandler->Query("UPDATE topic set lastupdate={$t} where tid={$totid}");
         }
         $roottid = $topic->roottid;
         if ($roottid == '') {
             $roottid = 0;
         }
         $parentsold = "";
         $parents = "";
         if (isset($topic->type) && trim($topic->type) != "") {
             //reply and forward, need to handle the releation ship table
             $sql = "select * from topic_more where tid={$totid}";
             $row = $this->DatabaseHandler->FetchFirst($sql);
             if ($row) {
                 if (isset($row['parents'])) {
                     if (trim($row['parents']) == "") {
                         $parents = $totid;
                     } else {
                         $parents = $row['parents'] . ',' . $totid;
                     }
                 }
             } else {
                 $parents = "";
             }
             if ($parents == "") {
                 $parentsold = $totid;
             } else {
                 $parentsold = $parents;
             }
             $sql = "INSERT INTO topic_more(tid,parents,replyids) VALUES({$ntid},'{$parents}','')";
             $this->DatabaseHandler->Query($sql);
             if ($topic->type == 'reply' || $topic->type == 'both') {
                 if ($topic->type == 'both') {
                     if ($topic->totid > 0) {
                         $this->DatabaseHandler->Query("update topic set forwards=forwards+1 where tid={$topic->totid}");
                     }
                     if ($topic->roottid > 0 && $topic->roottid != $topic->totid) {
                         $this->DatabaseHandler->Query("update topic set forwards=forwards+1 where tid={$topic->roottid}");
                     }
                 }
                 $pids = "";
                 if (trim($parentsold) != "") {
                     $pids = split(',', $parentsold);
                 }
                 if (is_array($pids) && count($pids) > 0) {
                     $sql = "select replyids from topic_more where tid in({$parentsold})";
                     $query = $this->DatabaseHandler->Query($sql);
                     $results = $query->GetAll();
                     $sqlp = "";
                     if ($results && count($results) == count($pids)) {
                         for ($i = 0; $i < count($pids); $i++) {
                             $replyids = "{$ntid}";
                             if (isset($results[$i]['replyids']) && $results[$i]['replyids'] != "") {
                                 $replyids = $results[$i]['replyids'] . ',' . $replyids;
                             }
                             $sqlp = "UPDATE topic_more set replyids='{$replyids}' where tid={$pids[$i]}";
                             $this->DatabaseHandler->Query($sqlp);
                             //update topic replys field
                             $this->DatabaseHandler->Query("update topic set replys=replys+1 where tid={$pids[$i]}");
                         }
                     }
                 }
             } else {
                 if ($topic->type == 'forward') {
                     if ($topic->totid > 0) {
                         $this->DatabaseHandler->Query("update topic set forwards=forwards+1 where tid={$topic->totid}");
                     }
                     if ($topic->roottid > 0 && $topic->roottid != $topic->totid) {
                         $this->DatabaseHandler->Query("update topic set forwards=forwards+1 where tid={$topic->roottid}");
                     }
                 }
             }
         }
     }
     if ($topic->item != '' && $topic->item_id > 0 && $topic->type != 'reply') {
         $table = "";
         switch ($topic->item) {
             case "baobei":
                 $table = "baobei";
                 break;
             default:
                 $table = "baobei";
                 break;
         }
         $this->DatabaseHandler->Query("update {$table} set share_count=share_count+1 where Id={$topic->item_id}");
     }
     $push_type = 1;
     //Push reply notification
     if ($topic->type == 'reply' && $topic->touid != $topic->uid) {
         $toUser = $this->UserLogic->GetUser($topic->touid, $this->User['uid']);
         if ($toUser && $toUser["push_uid"] != "" && $toUser["channel_id"] != "" && $toUser["device_type"] != "") {
             //android client
             if ($toUser["device_type"] == 3) {
                 $optional[Channel::USER_ID] = $toUser["push_uid"];
                 $optional[Channel::DEVICE_TYPE] = 3;
                 $optional[Channel::MESSAGE_TYPE] = 0;
                 $message = '{"type":4,"content":"您有新的评论","timestamp":"' . time() . '","uid":' . $this->User['uid'] . ',"uname":"' . $topic->username . '"}';
                 $message_key = "msg_key";
                 $ret = $this->BaiduPush->pushMessage($push_type, $message, $message_key, $optional);
             } else {
                 if ($toUser["device_type"] == 4) {
                     //ios device
                 }
             }
         }
     }
     ////Push @ notification
     if ($at_uids && is_array($at_uids)) {
         foreach ($at_uids as $atid) {
             if ($atid == $topic->uid) {
                 continue;
             }
             $atUser = $this->UserLogic->GetUser($atid, $this->User['uid']);
             if ($atUser && $atUser["push_uid"] != "" && $atUser["channel_id"] != "" && $atUser["device_type"] != "") {
                 //android client
                 if ($atUser["device_type"] == 3) {
                     $optional[Channel::USER_ID] = $atUser["push_uid"];
                     $optional[Channel::DEVICE_TYPE] = 3;
                     $optional[Channel::MESSAGE_TYPE] = 0;
                     $message = '{"type":3,"content":"新的动态提到了您","timestamp":"' . time() . '","uid":' . $this->User['uid'] . ',"uname":"' . $topic->username . '"}';
                     $message_key = "msg_key";
                     $ret = $this->BaiduPush->pushMessage($push_type, $message, $message_key, $optional);
                 } else {
                     if ($atUser["device_type"] == 4) {
                         //ios device
                     }
                 }
             }
         }
     }
     return $topic;
 }
Пример #10
0
 function SearchEvents($creator, $ids, $keywords, $types, $location, $page, $pageSize, $getLatest = false)
 {
     $sql = "SELECT u.uname,u.uid,e.*,t.type,cd1.name as province,cd2.name as city,cd3.name as area FROM event e left join event_class t on t.id=e.type_id";
     $sql .= " left join common_district cd1 on cd1.id=e.province_id left join common_district cd2 on cd2.id=e.city_id left join common_district cd3 on cd3.id=e.area_id";
     $sql .= " left join user u on u.uid=e.post_uid";
     $sqlcount = "select count(id) as rs from event e";
     $order = " order by e.app_num desc, e.last_time desc";
     $where = " where 1=1";
     $limit = '';
     if ($page > 0) {
         if ($pageSize == "" || $pageSize == 0) {
             $pageSize = $this->Config['event_list_pagesize'];
         }
         $startrecord = $pageSize * ($page - 1);
         $endrecord = $pageSize * $page;
         $limit = ' limit ' . $startrecord . ',' . $pageSize;
     }
     if ($getLatest && $creator != '') {
         $where .= " and e.id not in (select id from event where post_uid in ({$creator})) and e.id not in (select event_id from event_application where uid={$creator})";
     }
     if (!$getLatest && $creator != '' && $creator != 0) {
         $where .= " and e.post_uid in ({$creator})";
     }
     if ($ids && $ids != '') {
         $where .= " and e.id in ({$ids})";
     }
     if ($types && $types != '') {
         $where .= " and e.type_id in ({$types})";
     }
     if ($location && is_array($location)) {
         if ($location['province'] && $location['province'] > 0) {
             $where .= " and e.province_id=" . $location['province'];
         }
         if ($location['city'] && $location['city'] > 0) {
             $where .= " and e.city_id=" . $location['city'];
         }
         if ($location['area'] && $location['area'] > 0) {
             $where .= " and e.area_id=" . $location['area'];
         }
         if ($location['address'] && $location['address'] > 0) {
             $where .= " and e.address like '%" . $location['address'] . "%'";
         }
     }
     if ($keywords && $keywords != '') {
         $keywords = safe_str($keywords);
         $where .= " and e.title like '%{$keywords}%'";
     }
     $countrow = $this->DatabaseHandler->FetchFirst($sqlcount . $where);
     if ($countrow) {
         $total = $countrow['rs'];
     }
     $result = array();
     $result['total'] = $total;
     $result['data'] = array();
     if ($total > 0) {
         $query = $this->DatabaseHandler->Query($sql . $where . $order . $limit);
         $rows = $query->GetAll();
         $events = array();
         foreach ($rows as $row) {
             $timeNow = time();
             $oFromTime = $row['from_time'];
             $oEndTime = $row['end_time'];
             if ($row['post_time'] && $row['post_time'] > 0) {
                 $timespan = $timeNow - $row['post_time'];
                 $hours = intval($timespan / 3600);
                 if ($hours >= 12) {
                     $row['date'] = date('Y-m-j H:i', $row['post_time']);
                 } else {
                     if ($hours > 1 && $hours < 12) {
                         $row['date'] = $hours . "小时前";
                     } else {
                         if ($hours == 0) {
                             $mintes = intval($timespan / 60);
                             if ($mintes == 0) {
                                 $row['date'] = "刚刚";
                             } else {
                                 $row['date'] = $mintes . "分钟前";
                             }
                         }
                     }
                 }
             }
             //from_time//end_time
             $weekarray = array("星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六");
             $row['from_time'] = date('Y-m-j H:i', $row['from_time']) . ' (' . $weekarray[date('w', $row['from_time'])] . ')';
             $row['end_time'] = date('Y-m-j H:i', $row['end_time']) . ' (' . $weekarray[date('w', $row['end_time'])] . ')';
             $row['ftime'] = "\"" . date('Y-m-j|H-i', $oFromTime) . "\"";
             $row['etime'] = "\"" . date('Y-m-j|H-i', $oEndTime) . "\"";
             $row['need_info_js'] = "\"" . $row['need_app_info'] . "\"";
             $item_id = $row['id'];
             $app_count = $this->DatabaseHandler->Fetch_first("select count(apply_id) as rs from event_application where event_id={$item_id}");
             if ($app_count) {
                 $row['apply_count'] = $app_count['rs'];
             }
             $apply = $this->GetEventsApplications($row['id'], $this->User['uid'], 1, 100);
             if ($apply && $apply['total'] > 0) {
                 $row['applied'] = 1;
             } else {
                 $row['applied'] = 0;
             }
             $events[] = $row;
         }
         $result['data'] = $events;
     }
     return $result;
 }
Пример #11
0
        $clean_val = remove_ep($value['value']);
        $total_out = bcadd($total_out, $clean_val);
        if (isset($tx['limit'])) {
            $output_str .= "Withdrawal limit of input address updated to: <span class='happy_txt'>" . remove_ep($tx['limit']) . "</span> {$curr_code}<br />";
        } else {
            $output_str .= "<a href='./?address=" . $value['address'] . "'>" . $value['address'] . "</a> &larr; <span class='happy_txt'>{$clean_val}</span> {$curr_code}<br />";
        }
    }
    echo "<h1>Transaction Details</h1><br />";
    echo "<table class='table table-striped table-condensed' style='width:auto;'>";
    echo "<tr><td><b>TxID:</b></td><td><a href='./?rawtx=" . $tx['txid'] . "'>" . $tx['txid'] . "</a></td></tr>";
    if (isset($tx['blockhash'])) {
        echo "<tr><td><b>Block:</b></td><td><a href='./?block=" . $tx['blockhash'] . "'>" . $tx['blockhash'] . "</a></td></tr>";
    } else {
        echo "<tr><td><b>Block:</b></td><td>not in a block yet</td></tr>";
    }
    $tx_time = isset($tx['time']) ? date("Y-m-d h:i A e", $tx['time']) : 'unknown';
    $confirmations = isset($tx['confirmations']) ? $tx['confirmations'] : '0';
    $tx_message = empty($tx['msg']) ? 'none' : safe_str($tx['msg']);
    $tx_fee = $total_in === 0 ? '0' : bcsub($total_in, $total_out);
    echo "<tr><td><b>Time Sent:</b></td><td>{$tx_time}</td></tr>";
    echo "<tr><td><b>Confirmations:</b></td><td>{$confirmations}</td></tr>";
    echo "<tr><td><b>Lock Height:</b></td><td>" . $tx['lockheight'] . "</td></tr>";
    echo "<tr><td><b>Total Input:</b></td><td>{$total_in} {$curr_code}</td></tr>";
    echo "<tr><td><b>Total Output:</b></td><td>{$total_out} {$curr_code}</td></tr>";
    echo "<tr><td><b>Fee:</b></td><td>{$tx_fee} {$curr_code}</td></tr>";
    echo "<tr><td><b>Message:</b></td><td>{$tx_message}</td></tr>";
    echo "</table>";
    echo "<h3>Inputs:</h3><p>{$input_str}</p>";
    echo "<h3>Outputs:</h3><p>{$output_str}</p>";
}
Пример #12
0
 function CreateNewEvent()
 {
     $jsonObj = $this->Post['event'] ? $this->Post['event'] : $this->Get['event'];
     $note = $this->Post['note'] ? $this->Post['note'] : $this->Get['note'];
     $event = json_decode($jsonObj);
     $eventEntity = new EventEntity();
     $eventEntity->title = $event->title;
     $eventEntity->type_id = $event->type;
     $eventEntity->content = safe_str($note);
     $eventEntity->province_id = $event->province;
     if ($event->city != '') {
         $eventEntity->city_id = $event->city;
     } else {
         $eventEntity->city_id = $event->province;
     }
     $fdate = explode('-', $event->start);
     $edate = explode('-', $event->end);
     $eventEntity->from_time = mktime($event->start_hour, $event->start_minute, 0, $fdate[1], $fdate[2], $fdate[0]);
     $eventEntity->end_time = mktime($event->end_hour, $event->end_minute, 0, $edate[1], $edate[2], $edate[0]);
     $eventEntity->area_id = $event->district;
     $eventEntity->money = $event->fee;
     $eventEntity->id = 0;
     $eventEntity->post_uid = $this->User['uid'];
     $eventEntity->post_time = time();
     $eventEntity->item = '';
     $eventEntity->item_id = 0;
     $eventEntity->last_time = time();
     $eventEntity->postip = getIP();
     $eventEntity->address = $event->address;
     $eventEntity->image = '';
     $eventEntity->need_app_info = $event->needinfo;
     $id = $this->EventLogic->AddNewEvent($eventEntity);
     $return = array();
     $item = array();
     if ($id && $id > 0) {
         $item['item_type'] = 'event';
         $item['title'] = $event->title;
         $item['item_id'] = $id;
         $item['item_url'] = $this->Config['server_url'] . "index.php?mod=event&action=profile&from=taobao&id=" . $id;
         $return['status'] = 'ok';
         $return['message'] = urlencode("活动创建成功!");
         $return['item'] = ArrayToJson($item);
     } else {
         $return['status'] = 'failed';
         $return['message'] = urlencode("活动创建失败!");
     }
     echo urldecode(json_encode($return));
 }
Пример #13
0
 function DoEventSave($event)
 {
     $title = $this->QueryString('event_title');
     $type = $this->QueryString('event_class');
     $start = $this->QueryString('event_start');
     $start_hour = $this->QueryString('event_start_hour');
     $start_minute = $this->QueryString('event_start_minute');
     if (!$start_minute || $start_minute == '') {
         $start_minute = 0;
     }
     $end = $this->QueryString('event_end');
     $end_hour = $this->QueryString('event_end_hour');
     $end_minute = $this->QueryString('event_end_minute');
     if (!$end_minute || $end_minute == '') {
         $end_minute = 0;
     }
     $province = $this->QueryString('user_province');
     $city = $this->QueryString('user_city');
     $district = $this->QueryString('user_district');
     $street = $this->QueryString('user_street');
     $address = $this->QueryString('event_address');
     $note = $this->QueryString('event_note_h');
     $fee = $this->QueryString('event_fee');
     if (!$fee || $fee == '') {
         $fee = 0;
     }
     $need_info = $this->QueryString('event_needinfo_h');
     $event_img_id = $this->QueryString('event_img_id');
     $event_img_url = $this->QueryString('event_img_url');
     $eventEntity = new EventEntity();
     $eventEntity->title = $title;
     $eventEntity->type_id = $type;
     $eventEntity->content = safe_str($note);
     $eventEntity->province_id = $province;
     if ($city != '') {
         $eventEntity->city_id = $city;
     } else {
         $eventEntity->city_id = $province;
     }
     $eventEntity->image = $event_img_url;
     $fdate = explode('-', $start);
     $edate = explode('-', $end);
     $eventEntity->type_id = $type;
     $eventEntity->from_time = mktime($start_hour, $start_minute, 0, $fdate[1], $fdate[2], $fdate[0]);
     $eventEntity->end_time = mktime($end_hour, $end_minute, 0, $edate[1], $edate[2], $edate[0]);
     $eventEntity->area_id = $district;
     $eventEntity->money = $fee;
     if ($event && $event['id'] && $event['id'] != '' && $event['id'] > 0) {
         $eventEntity->id = $event['id'];
         $eventEntity->post_time = $event['post_time'];
         $eventEntity->postip = $event['postip'];
     } else {
         $eventEntity->id = 0;
         $eventEntity->post_time = time();
         $eventEntity->postip = getIP();
     }
     $eventEntity->post_uid = $this->User['uid'];
     $eventEntity->item = '';
     $eventEntity->item_id = 0;
     $eventEntity->last_time = time();
     $eventEntity->address = $address;
     $eventEntity->need_app_info = $need_info;
     if ($event && $event['id'] && $event['id'] != '' && $event['id'] > 0) {
         $redirectUrl = "index.php?mod=event&action=profile&id=" . $event['id'];
         $ret = $this->EventLogic->Update($eventEntity, $event['type_id']);
         if ($event_img_url != '' && $event['image'] != '' && $event['image'] != $event_img_url) {
             $IoHandler = new IoHandler();
             $urls = Getimageurls($event['image']);
             if (is_array($urls) && count($urls) > 0) {
                 foreach ($urls as $u) {
                     $d = $IoHandler->DeleteFile($u);
                 }
             }
             $this->ImageLogic->DeleteImage('', $event['image']);
             $this->ImageLogic->SetImgToItem('event', $event['id'], $event_img_id);
         }
     } else {
         $ret = $this->EventLogic->AddNewEvent($eventEntity);
         $redirectUrl = "index.php?mod=event&action=profile&id={$ret}";
         $this->ImageLogic->SetImgToItem('event', $ret, $event_img_id);
     }
     header("Location:{$redirectUrl}");
 }
Пример #14
0
 function CreateSearchFilter($uid, $name, $content)
 {
     $dataList = array();
     $dataList['uid'] = $uid;
     $dataList['content'] = safe_str($content);
     $dataList['name'] = $name;
     $dataList['post_time'] = time();
     $dataList['modify_time'] = time();
     $fid = $this->DatabaseHandler->Insert2($dataList, 'user_filters');
     return $fid;
 }
Пример #15
0
 function AddNewGroup()
 {
     $this->NoLoginAjaxReturn();
     $uid = $this->QueryString('uid');
     $type = $this->QueryString('type');
     if (!$uid && $uid == '') {
         $uid = $this->User['uid'];
     }
     $name = $this->QueryString('name');
     $name = safe_str($name);
     $description = $this->QueryString('description');
     $description = safe_str($description);
     $gid = $this->GroupLogic->CreateGroup($uid, $name, $description, $type);
     $return = array();
     $return['status'] = 'failed';
     $return['message'] = urlencode("创建失败");
     if ($gid <= 0) {
         echo urldecode(json_encode($return));
         exit;
     }
     $return['status'] = 'ok';
     $return['message'] = "创建成功";
     $item['item_type'] = 'group';
     $item['item_id'] = $gid;
     $item['item_name'] = $name;
     $return['item'] = $item;
     echo urldecode(json_encode(ArrayToJson($return)));
 }
Пример #16
0
 function SendMessage()
 {
     $this->NoLoginAjaxReturn();
     $content = $this->Post['content'] ? $this->Post['content'] : $this->Get['content'];
     $subject = $this->Post['subject'] ? $this->Post['subject'] : $this->Get['subject'];
     $tounames = $this->Post['unames'] ? $this->Post['unames'] : $this->Get['unames'];
     $touids = $this->Post['uids'] ? $this->Post['uids'] : $this->Get['uids'];
     $uids = explode(',', $touids);
     $return = array();
     if (!$uids || !is_array($uids) || count($uids) == 0) {
         $return['status'] = "failed";
         $return['message'] = urlencode('请添加收件人,收件人可以是多个,中间用英文键盘下的逗号隔开.');
         echo urldecode(json_encode($return));
         return;
     }
     if ($content != '') {
         $content = safe_str($content);
     } else {
         $return['status'] = "failed";
         $return['message'] = '请输入内容';
         echo json_encode($return);
         return;
     }
     if ($subject != '') {
         $subject = safe_str($subject);
     }
     $send = true;
     $messages = array();
     foreach ($uids as $uid) {
         $message = new MessageEntity();
         $message->IsSafed = true;
         $message->content = $content;
         $message->subject = $subject;
         $message->touid = $uid;
         $message->uid = $this->User['uid'];
         $sent = $this->Message_Logic->AddNew($message);
         if ($sent && $sent['msgid'] > 0) {
             $send = $send & true;
             $messages[] = $sent;
         } else {
             $send = $send & false;
         }
     }
     if ($messages && count($messages) > 0) {
         $return['status'] = "ok";
         $return['message'] = '发送成功';
         $return['item'] = $messages;
         echo json_encode($return);
         return;
     }
 }
Пример #17
0
 private function GetPostInput()
 {
     $cop = new CompanyEntity();
     $cop->id = $this->QueryString('id');
     $cop->name = safe_str($this->QueryString('name'));
     $cop->nickname = safe_str($this->QueryString('nickname'));
     $cop->address = safe_str($this->QueryString('address'));
     $cop->description = safe_str($this->QueryString('description'));
     $cop->category = safe_str($this->QueryString('category'));
     $cop->building_id = safe_str($this->QueryString('building_id'));
     $cop->create_uid = $this->User['uid'];
     $cop->post_time = time();
     $cop->update_uid = $this->User['uid'];
     $cop->update_time = time();
     return $cop;
 }
Пример #18
0
 public static function rewrite_uri()
 {
     $request_uri = explode('?', $_SERVER['REQUEST_URI']);
     if (count($request_uri) > 1) {
         $rewrite_url = explode('&', $request_uri[1]);
         foreach ($rewrite_url as $key => $value) {
             $_value = explode('=', $value);
             if (count($_value) > 1) {
                 if ($_value[1]) {
                     $_value[1] = safe_str($_value[1]);
                 }
             }
             $__value = implode('=', $_value);
             $_rewrite_url[$key] = $__value;
         }
         $__rewrite_url = implode('&', $_rewrite_url);
         return $request_uri[0] . '?' . $__rewrite_url;
     } else {
         return $_SERVER['REQUEST_URI'];
     }
 }
Пример #19
0
 function GetBuilding()
 {
     $this->GotoLogin();
     $name = trim($this->Post['name'] ? $this->Post['name'] : $this->Get['name']);
     if ($name && $name != "") {
         $name = safe_str(urldecode($name));
     }
     $address = trim($this->Post['address'] ? $this->Post['address'] : $this->Get['address']);
     if ($address && $address != "") {
         $address = safe_str(urldecode($address));
     }
     $bids = $this->Post['$bids'] ? $this->Post['$bids'] : $this->Get['$bids'];
     $province = $this->Post['province'] ? $this->Post['province'] : $this->Get['province'];
     $city = $this->Post['city'] ? $this->Post['city'] : $this->Get['city'];
     $district = $this->Post['district'] ? $this->Post['district'] : $this->Get['district'];
     $street = $this->Post['street'] ? $this->Post['street'] : $this->Get['street'];
     $btype = $this->Post['type'] ? $this->Post['type'] : $this->Get['type'];
     $page = $this->Post['page'] ? $this->Post['page'] : $this->Get['page'];
     $pageSize = $this->QueryString('pagesize');
     if (!$page || !is_numeric($page)) {
         $page = 1;
     }
     if (!$pageSize || !is_numeric($pageSize)) {
         $pageSize = 30;
     }
     $result = $this->BuildingLogic->SearchBuildings($name, '', $address, $bids, $province, $city, $district, $street, $btype, $pageSize, $page, true);
     $json = array();
     $json['status'] = 'ok';
     $json['message'] = '没有找到相关位置信息';
     if ($result['total'] > 0) {
         if ($this->CallType = "localsite") {
             $dlist = $result['data'];
             $this->TemplateHandler->AssignValue('dlist', $dlist);
             $this->TemplateHandler->AssignValue('total', $result['total']);
             $this->TemplateHandler->Display('point_list.html');
         } else {
             if ($this->CallType == 'open') {
                 $json['status'] = 'ok';
                 $json['message'] = '';
                 $json['result'] = $result;
                 echo urldecode(json_encode($json));
             }
         }
         //
         exit;
     }
     echo urldecode(json_encode(ArrayToJson($json)));
 }
Пример #20
0
 private function DoLogin($email, $password)
 {
     $return = array();
     $password = safe_str($password);
     $email = safe_str($email);
     $md5pass = md5($password);
     $loginfo = $this->UserLogic->Login($email, $md5pass);
     if (isset($loginfo) && is_array($loginfo) && count($loginfo) > 0) {
         if (!isset($loginfo['failed'])) {
             //set cookie
             $uid = $loginfo['user']['uid'];
             $encodestr = authcode("{$uid}\\~{$md5pass}", 'ENCODE', $this->Config['auth_key']);
             //$encodestr=urlencode($uid."\~".$md5pass);
             $life = $this->Config['cookie_life'];
             if ($life == 0) {
                 $this->CookieHandler->SetVar('authstr', $encodestr);
             } else {
                 $this->CookieHandler->SetVar('authstr', $encodestr, time() + $life);
             }
             session_start();
             $_SESSION['uid'] = $uid;
             $_SESSION['uemail'] = $email;
             $_SESSION['uname'] = $loginfo['user']['uname'];
             $_SESSION['face_url'] = $loginfo['user']['face_url'];
             $_SESSION['face_url_p'] = $loginfo['user']['face_url_p'];
             $return['status'] = 'ok';
             $return['message'] = '注册成功';
             $return['uid'] = $uid;
             echo urldecode(json_encode(ArrayToJson($return)));
             exit;
         } else {
             $return['status'] = 'failed';
             $return['message'] = $loginfo['info'];
             echo urldecode(json_encode(ArrayToJson($return)));
         }
     }
 }