本文整理汇总了PHP中tomedia函数的典型用法代码示例。如果您正苦于以下问题:PHP tomedia函数的具体用法?PHP tomedia怎么用?PHP tomedia使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了tomedia函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: respond
public function respond()
{
global $_W;
$rid = $this->rule;
$reply = pdo_fetch("SELECT * FROM " . tablename('vote_reply') . " WHERE `rid`=:rid LIMIT 1", array(':rid' => $rid));
if ($reply == false) {
return $this->respText('活动已经取消...');
}
$nowtime = time();
$endtime = $reply['endtime'] + 86399;
if ($reply['status'] == 0) {
return $this->respText("投票已暂停,请等待...");
}
if ($reply['votelimit'] == 1) {
if ($reply['votetotal'] > 0 && $reply['votenum'] >= $reply['votetotal']) {
return $this->respText("投票人数已满,活动结束...");
}
} else {
if ($reply['starttime'] > $nowtime) {
return $this->respText("投票未开始,请等待...");
} elseif ($endtime < $nowtime) {
return $this->respText("投票已结束...");
} else {
// if ($reply['status'] != 1) {
// return $this->respText("投票已暂停,请等待...");
// }
}
}
return $this->respNews(array('Title' => $reply['title'], 'Description' => $reply['description'], 'PicUrl' => tomedia($reply['thumb']), 'Url' => $this->createMobileUrl("index", array("id" => $rid))));
}
示例2: setHeader
public function setHeader()
{
global $_W, $_GPC;
$_var_0 = m('user')->getOpenid();
$_var_1 = m('user')->followed($_var_0);
@session_start();
if (!$_var_1) {
$_var_2 = intval($_GPC['mid']);
$_var_3 = m('common')->getSysset();
$this->header = array('url' => $_var_3['share']['followurl']);
$_var_4 = false;
if (!empty($_var_2)) {
if (!empty($_SESSION[EWEI_SHOP_PREFIX . '_shareid']) && $_SESSION[EWEI_SHOP_PREFIX . '_shareid'] == $_var_2) {
$_var_2 = $_SESSION[EWEI_SHOP_PREFIX . '_shareid'];
}
$_var_5 = m('member')->getMember($_var_2);
if (!empty($_var_5)) {
$_SESSION[EWEI_SHOP_PREFIX . '_shareid'] = $_var_2;
$_var_4 = true;
$this->header['icon'] = $_var_5['avatar'];
$this->header['text'] = '来自好友 <span>' . $_var_5['nickname'] . '</span> 的推荐';
}
}
if (!$_var_4) {
$this->header['icon'] = tomedia($_var_3['shop']['logo']);
$this->header['text'] = '欢迎进入 <span>' . $_var_3['shop']['name'] . '</span>';
}
}
}
示例3: doMobileIndex
public function doMobileIndex()
{
global $_W, $_GPC;
// 分享量
if ($_W['isajax'] && $_GPC['op'] == 'share') {
pdo_query("UPDATE " . tablename('qiyue_qiuqian') . " SET sharenum=sharenum+1 WHERE uniacid=:uniacid", array(':uniacid' => $_W['uniacid']));
message(array('error_code' => 0), '', 'ajax');
}
$qian_r = pdo_fetch("SELECT * FROM " . tablename('qiyue_qiuqian') . " WHERE uniacid=:uniacid", array(':uniacid' => $_W['uniacid']));
$morepic = array();
$imgcount = 0;
if ($qian_r['morepic']) {
$f_exp = "::::::";
$r_exp = PHP_EOL;
$rr = explode($r_exp, $qian_r['morepic']);
$imgcount = count($rr);
for ($i = 0; $i < $imgcount; $i++) {
$fr = explode($f_exp, $rr[$i]);
$morepic[] = array('title' => $fr['1'], 'url' => tomedia($fr['0']));
}
}
$_share = $this->module['config'];
unset($_share['cnzzid']);
// 去掉CNZZ
$cnzzid = $this->module['config']['cnzzid'];
// 增加浏览量
pdo_query("UPDATE " . tablename('qiyue_qiuqian') . " SET viewnum=viewnum+1 WHERE uniacid=:uniacid", array(':uniacid' => $_W['uniacid']));
include $this->template('index');
}
示例4: respond
public function respond()
{
$rid = $this->rule;
$fromuser = $this->message['from'];
if (!empty($rid)) {
$reply = pdo_fetch("SELECT * FROM " . tablename($this->table_reply) . " WHERE rid = :rid", array(':rid' => $rid));
if ($reply) {
if ($reply['starttime'] > time()) {
//检测时间是否开始
return $this->respText("本次活动尚未开始,敬请期待!");
} elseif ($reply['endtime'] < time() || $reply['endtime'] == 0) {
//检测时间是否结束或者状态是否为结束
return $this->respText("本次活动已经结束,请关注我们后续的活动!");
} elseif ($reply['endtime'] == 2) {
//检测状态是否暂停
return $this->respText("本次活动暂停中");
} else {
//活动大状态正常 检测每天的时间是否正常
$news = array();
$news[] = array('title' => $reply['title'], 'description' => $reply['description'], 'picurl' => tomedia($reply['thumb']), 'url' => $this->createMobileUrl('main', array('id' => $reply['id'])));
return $this->respNews($news);
}
}
}
return null;
}
示例5: fieldsFormDisplay
public function fieldsFormDisplay($rid = 0)
{
global $_W;
load()->func('tpl');
$replies = array();
$replies = pdo_fetchall("SELECT * FROM " . tablename($this->tablename) . " WHERE rid = :rid AND parent_id = -1 ORDER BY `displayorder` DESC, id ASC", array(':rid' => $rid));
if (!empty($replies)) {
$parent_id = $replies[0]['id'];
pdo_update($this->tablename, array('parent_id' => $parent_id), array('rid' => $rid));
pdo_update($this->tablename, array('parent_id' => 0), array('rid' => $rid, 'id' => $parent_id));
}
$rows = pdo_fetchall("SELECT * FROM " . tablename($this->tablename) . " WHERE rid = :rid ORDER BY `parent_id` ASC, `id` ASC", array(':rid' => $rid));
$replies = array();
foreach ($rows as &$row) {
if (!empty($row['thumb'])) {
$row['thumb'] = tomedia($row['thumb']);
}
if (empty($row['parent_id'])) {
$replies[$row['id']][] = $row;
} else {
$replies[$row['parent_id']][] = $row;
}
}
$replies = array_values($replies);
include $this->template('display');
}
示例6: respond
public function respond()
{
global $_W;
$rid = $this->rule;
$sql = "SELECT * FROM " . tablename('news_reply') . " WHERE rid = :id AND parent_id = -1 ORDER BY displayorder DESC, id ASC LIMIT 8";
$commends = pdo_fetchall($sql, array(':id' => $rid));
if (empty($commends)) {
$sql = "SELECT * FROM " . tablename('news_reply') . " WHERE rid = :id AND parent_id = 0 ORDER BY RAND()";
$main = pdo_fetch($sql, array(':id' => $rid));
if (empty($main['id'])) {
return false;
}
$sql = "SELECT * FROM " . tablename('news_reply') . " WHERE id = :id OR parent_id = :parent_id ORDER BY parent_id ASC, displayorder DESC, id ASC LIMIT 8";
$commends = pdo_fetchall($sql, array(':id' => $main['id'], ':parent_id' => $main['id']));
}
if (empty($commends)) {
return false;
}
$news = array();
foreach ($commends as $c) {
$row = array();
$row['title'] = $c['title'];
$row['description'] = $c['description'];
!empty($c['thumb']) && ($row['picurl'] = tomedia($c['thumb']));
$row['url'] = empty($c['url']) ? $this->createMobileUrl('detail', array('id' => $c['id'])) : $c['url'];
$news[] = $row;
}
return $this->respNews($news);
}
示例7: tpl_form_field_image
function tpl_form_field_image($name, $value = '')
{
$thumb = empty($value) ? 'images/global/nopic.jpg' : $value;
$thumb = tomedia($thumb);
$html = <<<EOF
<div class="input-group">
\t<input type="text" name="{$name}" value="{$value}" class="form-control" autocomplete="off" readonly="readonly">
\t<span class="input-group-btn">
\t\t<button class="btn btn-default" onclick="appupload(this)" type="button">上传图片</button>
\t</span>
</div>
<span class="help-block">
\t<img style="max-height:100px;" src="{$thumb}" >
</span>
<script>
window.appupload = window.appupload || function(obj){
\trequire(['jquery', 'util'], function(\$, u){
\t\tu.image(obj, function(url){
\t\t\t\$(obj).parent().prev().val(url.attachment);
\t\t\t\$(obj).parent().parent().next().find('img').attr('src',url.url);
\t\t});
\t});
}
</script>
EOF;
return $html;
}
示例8: setHeader
public function setHeader()
{
global $_W, $_GPC;
$openid = m('user')->getOpenid();
$followed = m('user')->followed($openid);
@session_start();
if (!$followed) {
$mid = intval($_GPC['mid']);
$set = m('common')->getSysset();
$this->header = array('url' => $set['share']['followurl']);
$friend = false;
if (!empty($mid)) {
if (!empty($_SESSION[EWEI_SHOP_PREFIX . '_shareid']) && $_SESSION[EWEI_SHOP_PREFIX . '_shareid'] == $mid) {
$mid = $_SESSION[EWEI_SHOP_PREFIX . '_shareid'];
}
$member = m('member')->getMember($mid);
if (!empty($member)) {
$_SESSION[EWEI_SHOP_PREFIX . '_shareid'] = $mid;
$friend = true;
$this->header['icon'] = $member['avatar'];
$this->header['text'] = '来自好友 <span>' . $member['nickname'] . '</span> 的推荐';
}
}
if (!$friend) {
$this->header['icon'] = tomedia($set['shop']['logo']);
$this->header['text'] = '欢迎进入 <span>' . $set['shop']['name'] . '</span>';
}
}
}
示例9: doWebSetting
public function doWebSetting()
{
global $_W, $_GPC;
checklogin();
load()->func('tpl');
$item = pdo_fetch("SELECT * FROM " . tablename($this->modulename . '_setting') . " WHERE weid = :weid", array(':weid' => $_W['uniacid']));
if (!empty($item)) {
if (!empty($item['share_image'])) {
$share_image = tomedia($item['share_image']);
}
}
if (checksubmit('submit')) {
$data = array('weid' => $_W['weid'], 'share_title' => trim($_GPC['share_title']), 'share_desc' => trim($_GPC['share_desc']), 'share_cancel' => trim($_GPC['share_cancel']), 'share_url' => trim($_GPC['share_url']), 'follow_url' => trim($_GPC['follow_url']));
if (!empty($_GPC['share_image'])) {
$data['share_image'] = $_GPC['share_image'];
load()->func('file');
file_delete($_GPC['share_image-old']);
}
if (!empty($item)) {
pdo_update($this->modulename . '_setting', $data, array('weid' => $_W['uniacid']));
} else {
pdo_insert($this->modulename . '_setting', $data);
}
message('更新成功!', $this->createWebUrl('setting'), 'success');
}
include $this->template('setting');
}
示例10: settingsDisplay
public function settingsDisplay($settings)
{
global $_W, $_GPC;
load()->func('file');
$_W['page']['title'] = '签文参数设置';
if ($_W['isajax'] && $_GPC['op'] == 'delete' && $_GPC['filename']) {
file_delete($_GPC['filename']);
exit('ok');
}
if (checksubmit()) {
// 配置
$dat = $_GPC['add'];
$dat['imgUrl'] = $_GPC['imgUrl'];
$this->saveSettings($dat);
// 签文
$qian = $_GPC['qian'];
$f_exp = "::::::";
$r_exp = PHP_EOL;
$morepic = "";
for ($i = 0; $i < count($qian['filename']); $i++) {
//替换非法字符
$name = str_replace($f_exp, "", $qian['title'][$i]);
$name = str_replace($r_exp, "", $name);
$pic = str_replace($f_exp, "", $qian['filename'][$i]);
$pic = str_replace($r_exp, "", $pic);
if ($pic) {
$morepic .= $pic . $f_exp . $name . $r_exp;
}
}
// 去掉最后的字符
// $morepic = substr($morepic,0,strlen($morepic)-2);
$morepic = trim($morepic);
$check = pdo_fetchcolumn("SELECT COUNT(*) FROM " . tablename('qiyue_qiuqian') . " WHERE uniacid=:uniacid", array(':uniacid' => $_W['uniacid']));
if ($check) {
pdo_update('qiyue_qiuqian', array('morepic' => $morepic), array('uniacid' => $_W['uniacid']));
} else {
$add['uniacid'] = $_W['uniacid'];
$add['morepic'] = $morepic;
pdo_insert('qiyue_qiuqian', $add);
}
message('设置成功', 'referer', 'success');
}
if (empty($settings)) {
$settings = array('title' => '新年祈福签', 'desc' => '我在' . $_W['account']['name'] . '求了一支新年签,你也来吧!', 'imgUrl' => tomedia('./addons/qiuqian/icon.jpg'));
}
$qian_r = pdo_fetch("SELECT * FROM " . tablename('qiyue_qiuqian') . " WHERE uniacid=:uniacid", array(':uniacid' => $_W['uniacid']));
$morepic = array();
if ($qian_r['morepic']) {
$f_exp = "::::::";
$r_exp = PHP_EOL;
$rr = explode($r_exp, $qian_r['morepic']);
for ($i = 0; $i < count($rr); $i++) {
$fr = explode($f_exp, $rr[$i]);
$morepic[] = array('title' => $fr['1'], 'filename' => $fr['0']);
}
unset($qian_r['morepic']);
}
include $this->template('setting');
}
示例11: doWebChatlog
public function doWebChatlog()
{
global $_GPC, $_W;
load()->func('tpl');
$acids = uni_accounts($_W['uniacid']);
if (!empty($acids)) {
$data = array();
foreach ($acids as $acid) {
if (in_array($acid['level'], array(3, 4))) {
$data[] = $acid;
}
}
}
$starttime = empty($_GPC['starttime']) ? strtotime(date('Y-m-d')) : strtotime($_GPC['starttime']);
if (!empty($_GPC['token'])) {
unset($_GPC['token']);
$avatar = '';
$endtime = $starttime + 23 * 3600 + 3599;
$acid = intval($_GPC['acid']);
if (!empty($_GPC['nickname']) && empty($_GPC['openid'])) {
$user = pdo_fetch('SELECT b.openid,a.avatar FROM ' . tablename('mc_members') . ' AS a LEFT JOIN ' . tablename('mc_mapping_fans') . ' AS b ON a.uid = b.uid WHERE a.nickname = :nickname', array(':nickname' => trim($_GPC['nickname'])));
if (empty($user['openid'])) {
message('没有找到昵称为 "' . $_GPC['nickname'] . '" 的用户', $this->createWebUrl('chatlog', array('acid' => $acid, 'nickname' => $_GPC['nickname'], 'openid' => $_GPC['openid'], 'starttime' => $_GPC['starttime'])), 'error');
} else {
if (!empty($user['avatar'])) {
$avatar = tomedia($user['avatar']);
$nickname = $user['nickname'];
}
}
} else {
$openid = trim($_GPC['openid']);
$user = pdo_fetch('SELECT b.openid,a.avatar,a.nickname FROM ' . tablename('mc_members') . ' AS a LEFT JOIN ' . tablename('mc_mapping_fans') . ' AS b ON a.uid = b.uid WHERE b.openid = :openid', array(':openid' => trim($_GPC['openid'])));
if (!empty($user['avatar'])) {
$avatar = tomedia($user['avatar']);
$nickname = $user['nickname'];
}
}
if ($acid > 0 && !empty($starttime) && !empty($endtime) && !empty($openid)) {
$pindex = max(1, intval($_GPC['page']));
$acc = WeAccount::create($acid);
$params = array('openid' => trim($_GPC['openid']), 'starttime' => $starttime, 'endtime' => $endtime, 'pageindex' => $pindex, 'pagesize' => 1000);
$logs = $acc->fetchChatLog($params);
$next = 1;
if (is_error($logs) || empty($logs['recordlist']) || count($logs['recordlist']) < $params['pagesize']) {
$next = 0;
}
$codedata = array();
$codedata[1000] = '创建未接入会话';
$codedata[1001] = '接入会话';
$codedata[1002] = '主动发起会话';
$codedata[1004] = '关闭会话';
$codedata[1005] = '抢接会话';
$codedata[2001] = '公众号收到消息';
$codedata[2002] = '客服发送消息';
$codedata[2003] = '客服收到消息';
}
}
include $this->template('chatlog');
}
示例12: getpicurl
private function getpicurl($url)
{
global $_W;
if ($url) {
return tomedia($url);
} else {
return $_W['siteroot'] . 'addons/lxy_marry/template/img/art_pic.png';
}
}
示例13: respond
public function respond()
{
global $_W;
$rid = $this->rule;
$sql = "SELECT * FROM " . tablename('hl_tug_reply') . " WHERE `rid`=:rid LIMIT 1";
$row = pdo_fetch($sql, array(':rid' => $rid));
if (empty($row['id'])) {
return array();
}
return $this->respNews(array('Title' => $row['title'], 'Description' => $row['description'], 'PicUrl' => tomedia($row['picture']), 'Url' => $this->createMobileUrl('index', array('id' => $rid))));
}
示例14: getData
public function getData($page)
{
global $_W;
$data = htmlspecialchars_decode($page['datas']);
$d = json_decode($data, true);
$goodsids = array();
foreach ($d as $k1 => &$dd) {
if ($dd['temp'] == 'goods') {
foreach ($dd['data'] as $k2 => $ddd) {
$goodsids[] = array('id' => $ddd['goodid'], 'k1' => $k1, 'k2' => $k2);
}
} elseif ($dd['temp'] == 'richtext') {
$dd['content'] = $this->unescape($dd['content']);
}
}
unset($dd);
$arr = array();
foreach ($goodsids as $a) {
$arr[] = $a['id'];
}
if (count($arr) > 0) {
$goodinfos = pdo_fetchall("SELECT id,title,productprice,marketprice,thumb FROM " . tablename('ewei_shop_goods') . " WHERE id in ( " . implode(',', $arr) . ") and uniacid= :uniacid ", array(':uniacid' => $_W['uniacid']), 'id');
$goodinfos = set_medias($goodinfos, 'thumb');
foreach ($d as $k1 => &$dd) {
if ($dd['temp'] == 'goods') {
foreach ($dd['data'] as $k2 => &$ddd) {
$cdata = $goodinfos[$ddd['goodid']];
$ddd['name'] = $cdata['title'];
$ddd['priceold'] = $cdata['productprice'];
$ddd['pricenow'] = $cdata['marketprice'];
$ddd['img'] = $cdata['thumb'];
}
unset($ddd);
}
}
unset($dd);
}
$data = json_encode($d);
$data = rtrim($data, "]");
$data = ltrim($data, "[");
$pageinfo = htmlspecialchars_decode($page['pageinfo']);
$p = json_decode($pageinfo, true);
$page_title = empty($p[0]['params']['title']) ? "未设置页面标题" : $p[0]['params']['title'];
$page_desc = empty($p[0]['params']['desc']) ? "未设置页面简介" : $p[0]['params']['desc'];
$page_img = empty($p[0]['params']['img']) ? "" : tomedia($p[0]['params']['img']);
$page_keyword = empty($p[0]['params']['kw']) ? "" : $p[0]['params']['kw'];
$shopset = m('common')->getSysset(array('shop', 'share'));
$system = $shopset;
$system['shop'] = set_medias($system['shop'], 'logo');
$system = json_encode($system);
$pageinfo = rtrim($pageinfo, "]");
$pageinfo = ltrim($pageinfo, "[");
return array('page' => $page, 'pageinfo' => $pageinfo, 'data' => $data, 'share' => array('title' => $page_title, 'desc' => $page_desc, 'imgUrl' => $page_img), 'footermenu' => intval($p[0]['params']['footer']), 'system' => $system);
}
示例15: fieldsFormDisplay
public function fieldsFormDisplay($rid = 0)
{
global $_W;
load()->func('tpl');
$replies = pdo_fetchall("SELECT * FROM " . tablename($this->tablename) . " WHERE rid = :rid ORDER BY `displayorder` DESC", array(':rid' => $rid));
foreach ($replies as &$reply) {
if (!empty($reply['thumb'])) {
$reply['src'] = tomedia($reply['thumb']);
}
}
include $this->template('display');
}