Exemple #1
0
if (isset($username) && isset($_GET["commentid"])) {
    $commentid = $_GET["commentid"];
    rmComment($commentid);
}
if (isset($username) && $_SERVER["REQUEST_METHOD"] == "POST") {
    if (!empty($_POST["playlist"])) {
        foreach ($_POST["playlist"] as $playlistid) {
            addPlaylistMedia($playlistid, $mediaid);
        }
    }
    if (!empty($_POST["comment"])) {
        $content = $_POST["comment"];
        addComment($username, $mediaid, $content);
    }
    if (!empty($_POST["rate"])) {
        $score = $_POST["rate"];
        rateMedia($mediaid, $username, $score);
    }
}
$recommend = recommend($mediaid, 8);
$media = viewMedia($mediaid);
$comments = getComments($mediaid);
if (isset($username) && isset($_GET["subscribe"])) {
    $subscriber_id = $username;
    $channel_id = $media['username'];
    if ($subscriber_id != $channel_id) {
        addChannel($subscriber_id, $channel_id);
    }
}
render("video_template.php", ["media" => $media, "comments" => $comments, "mediaid" => $mediaid, "recommend" => $recommend, "playlists" => $playlists, "Category" => $Category, "Keywords" => $Keywords]);
$db->sql_close();
 /**
  * 推荐
  * @author MaWei (http://www.phpyrb.com)
  * @date 2014-10-4  下午10:39:37
  */
 function recommend()
 {
     $recomm = intval($_REQUEST['recomm']) == 1 ? 0 : 1;
     $reid = recommend('SourcCategory', $_REQUEST['ids'], $recomm);
     if ($reid === false) {
         $msg['status'] = null;
         $msg['msg'] = '推荐失败';
     } else {
         $msg['status'] = 1;
         $msg['msg'] = '推荐设置成功';
         $msg['text'] = intval($_REQUEST['recomm']) == 0 ? '已推荐' : '未推荐';
     }
     echo json_encode($msg);
     exit;
 }
<!DOCTYPE html>
<html lang="ja">
<head>
	<meta charset="UTF-8">
	<title>デフォルト引き数を指定したい</title>
</head>
	<body>
	<div>
	<?php 
// 関数のデフォルト引数値を指定する
function recommend($musician = 'The Beatles')
{
    return 'おすすめの音楽は' . $musician . '<br>';
}
// 関数を実行して結果を表示する
echo recommend();
echo recommend('The Rolling Stones');
?>
	</div>
</body>
</html>
Exemple #4
0
     send_reportreview($rev_id, $option);
     break;
     /* Reply review */
 /* Reply review */
 case 'replyreview':
     $rev_id = JRequest::getInt('rev_id', 0);
     replyreview($rev_id, $option);
     break;
 case 'send_replyreview':
     $rev_id = JRequest::getInt('rev_id', 0);
     send_replyreview($rev_id, $option);
     break;
     /* Recommend to Friend */
 /* Recommend to Friend */
 case "recommend":
     recommend($link_id, $option);
     break;
 case "send_recommend":
     send_recommend($link_id, $option);
     break;
     /* Contact Owner */
 /* Contact Owner */
 case "contact":
     contact($link_id, $option);
     break;
 case "send_contact":
     send_contact($link_id, $option);
     break;
     /* Report Listing */
 /* Report Listing */
 case "report":
Exemple #5
0
*/
function lovestation()
{
    include MooTemplate('public/loveStation', 'module');
}
/***********************************************控制层(C)*****************************************/
$h = MooGetGPC('h', 'string');
switch ($h) {
    case 'crazyfan':
        crazyfan();
        break;
    case 'vote':
        vote();
        break;
    case 'recommend':
        recommend();
        break;
    case 'lovecar':
        lovecar();
        break;
    case "carrelaxbar":
        carrelaxbar();
        break;
    case "carrelaxbargame":
        carrelaxbargame();
        break;
    case "carfaq":
        carfaq();
        break;
    case "ls":
        lovestation();
{
    $query = "SELECT * FROM auction WHERE\n\t  auction.auction_id IN( SELECT bid.auction_id FROM bid\n\t  WHERE bid.bidder_id IN( SELECT bid.bidder_id FROM bid\n\t  WHERE bid.bidder_id <> {$user_id} AND bid.auction_id IN(\n      SELECT bid.auction_id FROM bid WHERE bid.bidder_id = {$user_id}\n      GROUP BY bid.auction_id) GROUP BY bid.bidder_id ) GROUP BY\n\t  bid.auction_id ) AND auction.has_ended = '0' LIMIT 10;";
    $recommends = mysqli_query($dbconnection, $query);
    if ($recommends->num_rows == 0) {
        return '';
    }
    $str_recommends = "You may be interested in:<br><br>";
    while ($result = mysqli_fetch_array($recommends)) {
        $get_item_name_query = "SELECT name FROM item WHERE item_id = " . $result['item_id'];
        $get_item_name = mysqli_query($dbconnection, $get_item_name_query);
        $item_name = mysqli_fetch_array($get_item_name)['name'];
        $str_recommends .= 'Auction (<a href="http://ec2-52-58-25-40.eu-central-1.compute.amazonaws.com/auction.php?auction=' . $result['auction_id'] . '">' . $item_name . '</a>)<br>
                   End Date: ' . $result['end_date'] . '<br>
                   Current Price: ' . $result['current_price'] . '<br>
                   <br>';
    }
    return $str_recommends;
}
echo date("Y-m-d H:i:s") . " recommendation.php : \n";
$query = "SELECT user_id,email_address from user";
$users = mysqli_query($connection, $query);
$sender = new email_sender();
$counter = 0;
while ($user = mysqli_fetch_array($users)) {
    $str_recommends = recommend($connection, $user['user_id']);
    if ($str_recommends != '') {
        $counter++;
        $sender->send_with_log($user['email_address'], 'Recommended Items for You!!', $str_recommends);
    }
}
echo "{$counter} emails sent\n";