Ejemplo n.º 1
0
		<script>
			setTimeout(function () {
			   window.location.href = "index.php";
			}, 3000); 			
		</script>
	</head>
	<body>
		<div id = "wrapper">
			<div id = "header">
				<h1><a href = "../">feel it</a></h1>
				<p>let it all out.</p>
				<ul class = "nav">
					<?php 
require_once '../scripts/functions.php';
if (isset($_SESSION['logged_in'])) {
    $msg_count = get_message_count($_SESSION['username']);
    echo "<a onclick = \"pop_window('../changepass')\"\n\t\t\t\t\t\t\t\t  href = 'javascript:void(0)'><li>" . $_SESSION['username'] . " -</li></a>\n\t\t\t\t\t\t\t<li><a href = '../messages'> messages (" . $msg_count . ") </a> - </li>\n\t\t\t\t\t\t\t<li><a href = '#' onclick = 'logout()'>sign out</a></li>";
} else {
    echo "<li><a href = '../'><div class = 'log_in'>log in</div></a></li>\n\t\t\t\t\t\t          <li><a href = '../signup'><div class = 'sign_up'>sign up</div></a></li>";
}
?>
				</ul> <!-- ul class nav -->
			</div> <!-- header -->
			<?php 
require_once "../scripts/functions.php";
$to = $_POST['r_user'];
$from = $_SESSION['username'];
$subj = $_POST['subj'];
$body = $_POST['body'];
if (send_message($from, $to, $subj, $body)) {
    echo "<div style = 'font-size: 1.2em; color: #00CC00; margin: 0 auto; margin-top: 64px; text-align: center;'>Message sent successfully!</div>";
?>
 <?php 
if (!empty($unionid)) {
    ?>
<h3 class="group_buy_title"><a href="javascript:void(0);" class="on" id="pkname" value="1" style="" name="Partner_b2c_tab">最佳拍档</a></h3>
<div class="union"><form action="<?php 
    echo U("Shopcart/order");
    ?>
"  class="group_buy"name="fiveform" id="orform" method="post" onsubmit="return trySubmit()">
	<div class="content bucket clearfix" id="pk" style="" value="1" name="Package_b2c" isloaded="1"><div class="bucket_cont"><b><i class="red" id="buyto_total"><?php 
    echo get_group_count($info["unionid"]);
    ?>
</i>件商品组合购买</b><br><p>商城总价:<i class="d_price" id="total_sale_price">¥<?php 
    echo get_group_price($info["unionid"]);
    ?>
</i></p><p>市场总价:<i class="m_price"><em class="td_lh" id="total_original_price">¥<?php 
    echo get_group_marketprice($info["unionid"]);
    ?>
</em></i></p><p class="buyfive "><a id="buytogether_btn" href="javascript:void(0);" class="btn btn_pd " onclick="buyFive();return false;" >购买组合</a></p><p><input class="checkbox check-all" type="checkbox" checked="">全选 </p></div><div class="tc pt5"><div class="dp_slide_plug"><div class="over"><ul class="clearfix">
	
	
  <?php 
    if (is_array($unionid)) {
        $k = 0;
        $__LIST__ = $unionid;
        if (count($__LIST__) == 0) {
            echo "";
        } else {
            foreach ($__LIST__ as $key => $v) {
                $mod = $k % 2;
                ++$k;
    function test_get_message_count()
    {
        $result = get_message_count(1);

        $this->assertEquals($result, 2);
    }
<div class="attributes">
    <p><strong>Messages: </strong><?php echo esc(get_message_count($uid)); ?></p>

    <?php if($fname != ""): ?>
    <p><strong>Name</strong> <?php echo esc($fname) ?></p>
    <?php endif; ?>

    <?php if($location != ""): ?>
    <p><strong>Location</strong> <?php echo esc($location) ?></p>
    <?php endif; ?>

    <?php if($web != ""): ?>
    <p><strong>Web</strong> <a href="<?php echo esc($web) ?>"><?php echo esc($web) ?></a></p>
    <?php endif; ?>

    <?php if($bio != ""): ?>
    <p><strong>Bio</strong> <?php echo esc($bio) ?></p>
    <?php endif; ?>

    <p><strong>Message address</strong> <?php echo esc(make_follow_url($uname)); ?></p>
</div>

<?php display_template('relations', array('uid' => $uid, 'uname' => $uname)); ?>
Ejemplo n.º 5
0
function codopm_do_route()
{
    if (isset($_GET['do'])) {
        require 'config.php';
        $conf = new Config(codopm::$db);
        codopm::$config = $conf->get_config();
        require 'getmessages.php';
        $do = $_GET['do'];
        if ($do == 'get_config') {
            echo json_encode(codopm::$config);
        } else {
            if ($do == 'send') {
                if (!isset($_POST['to'])) {
                    $resp = new response();
                    $resp->has_error = true;
                    $resp->msg = "file size exceeded maximum post size, please remove some files";
                    echo json_encode($resp);
                    return;
                }
                send_message((int) $_GET['id'], (int) $_POST['to'], strip_tags($_POST['message']));
            } else {
                if ($do == 'get_messages') {
                    $id = (int) $_GET['id'];
                    $my_name = save_my_details($id);
                    $per_page = codopm::$config['msgs_per_page'];
                    $start = (int) $_GET['range']['from'];
                    $end = (int) $_GET['range']['to'];
                    $resp = new response();
                    if ($_GET['type'] == 'default') {
                        $start = 0;
                    } else {
                        if ($_GET['type'] == 'next') {
                            $start += $per_page;
                        } else {
                            if ($_GET['type'] == 'previous') {
                                $start -= $per_page;
                            } else {
                                exit;
                            }
                        }
                    }
                    $messages = get_messages($id, $start);
                    $msg_cnt = count($messages);
                    $count = get_message_count($id);
                    $cnt = $count[0]["count"];
                    if ($msg_cnt < $per_page) {
                        $end = $cnt;
                    } else {
                        $end = $start + $per_page - 1;
                    }
                    if ($start === 0 && $cnt != 0) {
                        $start = 1;
                        $end = $per_page;
                    }
                    if ($end > $cnt || $end < $cnt && $cnt < $per_page) {
                        $end = $cnt;
                    }
                    $resp->has_error = false;
                    $resp->start = $start;
                    $resp->end = $end;
                    $resp->per_page = $per_page;
                    $resp->messages = $messages;
                    $resp->my_name = $my_name;
                    $resp->count = $cnt;
                    echo json_encode($resp);
                } else {
                    if ($do == 'get_conversations') {
                        $to = (int) $_GET['msg_to'];
                        $from = (int) $_GET['msg_from'];
                        $offset = codopm::$config['conv_load_offset'];
                        $res = get_conversations($to, $from, (int) $_GET['id'], codopm::$config['conv_per_page'] + 1);
                        $conversations = $res['conversations'];
                        $count = $res['count'];
                        set_message_read($to, $from, (int) $_GET['id']);
                        $resp = new response();
                        $resp->has_error = false;
                        if ($count > codopm::$config['conv_per_page']) {
                            array_pop($conversations);
                            $resp->read_more = 'yes';
                        } else {
                            $resp->read_more = 'no';
                        }
                        $resp->conversations = $conversations;
                        $resp->offset = $offset;
                        echo json_encode($resp);
                    } else {
                        if ($do == 'delete_conversation') {
                            delete_conversation((int) $_POST['msg_id']);
                            $resp = new response();
                            $resp->has_error = false;
                            echo json_encode($resp);
                        } else {
                            if ($do == 'load_more_conversations') {
                                $to = (int) $_GET['msg_to'];
                                $from = (int) $_GET['msg_from'];
                                $offset = (int) $_GET['msg_offset'];
                                $res = get_conversations($to, $from, (int) $_GET['id'], codopm::$config['conv_load_offset'] + 1, $offset);
                                $conversations = $res['conversations'];
                                $count = $res['count'];
                                $resp = new response();
                                $resp->has_error = false;
                                if ($count > codopm::$config['conv_load_offset']) {
                                    array_pop($conversations);
                                    $resp->read_more = 'yes';
                                } else {
                                    $resp->read_more = 'no';
                                }
                                $resp->conversations = $conversations;
                                $resp->offset = $offset;
                                echo json_encode($resp);
                            } else {
                                if ($do == 'autocomplete') {
                                    $results = array();
                                    if (isset($_GET['term'])) {
                                        $terms = strip_tags($_GET['term']);
                                        if (strpos($terms, ",") !== FALSE) {
                                            $_term = explode(",", $terms);
                                            $term = trim(end($_term));
                                        } else {
                                            $term = $terms;
                                        }
                                        $query = "SELECT name,username FROM " . codopm::$db_prefix . "users " . "WHERE (username LIKE :term1 OR name LIKE :term2)";
                                        $sth = codopm::$db->prepare($query);
                                        $variable_array = array(":term1" => $term . '%', ":term2" => $term . '%');
                                        $sth->execute($variable_array);
                                        $result = $sth->fetchAll();
                                        foreach ($result as $res) {
                                            $label = $res['name'];
                                            if (empty($label)) {
                                                $label = $res['username'];
                                            } else {
                                                if ($res['name'] != $res['username']) {
                                                    $label = $res['name'] . " " . "(" . $res['username'] . ")";
                                                }
                                            }
                                            $results[] = array("id" => $res['username'], "label" => $label, "value" => $res['username']);
                                        }
                                    }
                                    echo json_encode($results);
                                }
                            }
                        }
                    }
                }
            }
        }
    } else {
        die("CODOPM SAYS: Invalid Req");
    }
}