Exemplo n.º 1
0
 public function add_lecture($uid, $title, $time, $location, $tag, $description, $slide)
 {
     $sql = "INSERT INTO `app_lecture_info` (uid, title, time, location, tag, description, slide) values({$uid}, '{$title}', '{$time}', '{$location}', '{$tag}', '{$description}', '{$slide}');";
     $result = $this->Csdb->query($sql);
     if ($result) {
         $appid_sql = "SELECT appid FROM `cs_app` WHERE name = 'lecture';";
         $appid_result = $this->Csdb->query($appid_sql);
         $row = $appid_result->fetch_assoc();
         $lid_sql = "SELECT lid FROM `app_lecture_info` WHERE uid = '{$uid}' AND title = '{$title}' AND time = '{$time}';";
         $lid_result = $this->Csdb->query($lid_sql);
         $lid_row = $lid_result->fetch_assoc();
         $message = "时间:{$time}<br/>地点:{$location}";
         $activityObj = new ActivityClass();
         $activityObj->insert_activity($uid, $row["appid"], "《" . $title . "》", "label-info", "发起讲座", $message, "app/lecture/index.php?lid=" . $lid_row["lid"]);
     }
     return $result;
 }
Exemplo n.º 2
0
<?php

session_start();
require_once dirname(dirname(__FILE__)) . '/config.php';
include_once BASE_PATH . "/includes/activity.class.php";
$msg = $_POST["activity_text"];
$uid = $_SESSION["uid"];
$res = array('state' => '', 'msg' => '');
if ($msg == "") {
    $res['state'] = 'failed';
    $res['msg'] = '不能发表空动态';
    echo json_encode($res);
    exit;
}
$message = "话题:";
preg_match_all('/#([^#\\s]+)#/is', $msg, $topics);
foreach ($topics[1] as $topic) {
    $message = $message . '<label class="label label-info m-l-xs"><a href="' . SITE_DOMAIN . '/search.php?wd=%23' . $topic . '%23" style="color:#fff">' . $topic . '</a></label>';
}
if ($message == "话题:") {
    $message = "";
}
$activityObj = new ActivityClass();
$activityObj->insert_activity($uid, 0, $msg, "label-success", "发表动态", $message, "#");
$res['state'] = 'success';
$res['msg'] = '动态发表成功';
echo json_encode($res);