public function getAttachment() { global $_G; try { $taskData = $this->checkTask(); } catch (Exception $e) { throw new Cloud_Exception($e); } $task = $taskData['task']; $attach = $taskData['attach']; $taskId = $task['taskid']; C::t('#qqconnect#connect_disktask')->update($taskId, array('status' => 1, 'downloadtime' => $_G['timestamp'])); $db = DB::object(); $db->close(); ob_end_clean(); $attach['filename'] = '"' . (strtolower(CHARSET) == 'utf-8' && strexists($_SERVER['HTTP_USER_AGENT'], 'MSIE') ? urlencode($attach['filename']) : $attach['filename']) . '"'; dheader('Content-Type: application/octet-stream'); dheader('Content-Length: ' . $attach['filesize']); dheader('Content-Disposition: attachment; filename=' . $attach['filename']); self::_checkXSendFile($attach['attachment']); if ($attach['remote']) { self::_getRemoteFile($attach['attachment']); } else { self::_getLocalFile($attach['attachment']); } exit; }
public function respond() { global $_W; load()->func('compat.biz'); $rid = $this->rule; $sql = "SELECT * FROM " . tablename('bm_top_reply') . " WHERE `rid`=:rid LIMIT 1"; $row = pdo_fetch($sql, array(':rid' => $rid)); if (empty($row['id'])) { return $this->respText("系统升级中,请稍候!"); } $desc = $row['desc']; //描述 $n = $row['n']; //粉丝基数 $fromuser = $this->message['from']; $num = mc_fansinfo($fromuser); $numx = $n + $num['fanid']; $name = $_W['account']['name']; //公众号名称 $str = str_replace('{name}', $name, $desc); $str = str_replace('{numx}', $numx, $str); if ($row['pictype'] == 1) { //$str = "嗨,欢迎关注【".$name."】,您是第".$numx."位关注人!\n".$desc."\n <a href='".$url."'>".$urltext."</a>"; return $this->respText($str); } else { $response['FromUserName'] = $this->message['to']; $response['ToUserName'] = $this->message['from']; $response['MsgType'] = 'news'; $response['ArticleCount'] = 1; $response['Articles'] = array(); $response['Articles'][] = array('Title' => $row['title'], 'Description' => $str, 'PicUrl' => !strexists($row['picurl'], 'http://') ? $_W['attachurl'] . $row['picurl'] : $row['picurl'], 'Url' => $row['urlx'], 'TagName' => 'item'); return $response; } }
function tpl_form_field_clock($name, $value = '') { $s = ''; if (!defined('TPL_INIT_CLOCK_TIME')) { $s .= ' <script type="text/javascript"> require(["clockpicker"], function($){ $(function(){ $(".clockpicker").clockpicker({ autoclose: true }); }); }); </script> '; define('TPL_INIT_CLOCK_TIME', 1); } $time = date('H:i'); if (!empty($value)) { if (!strexists($value, ':')) { $time = date('H:i', $value); } else { $time = $value; } } $s .= ' <div class="input-group clockpicker"> <span class="input-group-addon"><i class="fa fa-clock-o"></i></span> <input type="text" name="' . $name . '" value="' . $time . '" class="form-control"> </div>'; return $s; }
public function respond() { global $_W; load()->func('compat.biz'); $rid = $this->rule; $sql = "SELECT * FROM " . tablename('bm_qrsign_reply') . " WHERE `rid`=:rid LIMIT 1"; $reply = pdo_fetch($sql, array(':rid' => $rid)); if (empty($reply['id'])) { return $this->respText("系统升级中,请稍候!"); } if (time() > strtotime($reply['endtime'])) { if (empty($reply['memo2'])) { $msg = '对不起,活动已经于' . $reply['endtime'] . '结束,感谢您的参与!!!'; } else { $msg = $reply['memo2']; } return $this->respText($msg); } if (time() < strtotime($reply['starttime'])) { if (empty($reply['memo1'])) { $msg = '对不起,活动将于' . $reply['starttime'] . '开始,敬请期待!!!'; } else { $msg = $reply['memo1']; } return $this->respText($msg); } $url = $_W['siteroot'] . 'app/' . $this->createMobileUrl('show', array('rid' => $rid, 'from_user' => $this->message['from'])); $response['FromUserName'] = $this->message['to']; $response['ToUserName'] = $this->message['from']; $response['MsgType'] = 'news'; $response['ArticleCount'] = 1; $response['Articles'] = array(); $response['Articles'][] = array('Title' => $reply['title'], 'Description' => $reply['desc'], 'PicUrl' => !strexists($reply['picurl'], 'http://') ? $_W['attachurl'] . $reply['picurl'] : $reply['picurl'], 'Url' => $url, 'TagName' => 'item'); return $response; }
/** * 删除指定ID信息 * * @param unknown_type $id * @return unknown */ function del($id, $uname = "", $other = "") { if (is_numeric($id)) { $wherestr[] = $this->idname . " = " . $id; } elseif (is_array($id)) { $ids = getdotstring($id, 'int'); $wherestr[] = $this->idname . " in ({$ids})"; } elseif (is_string($id) && (strexists($id, ',') || strexists($id, '|'))) { if (strexists($id, ',')) { $ids = getdotstring($id, 'int'); } else { $ids = getdotstring(explode('|', $ids), 'int'); } $wherestr[] = $this->idname . " in ({$ids})"; } else { return lang('ID_format_error'); } if ($uname != "") { $wherestr[] = "uname = '" . $uname . "'"; } if ($other != "") { $wherestr[] = $other; } $wheresql = implode(' AND ', $wherestr); //条件汇总 $this->db->query("delete from {$this->table} where " . $wheresql); return "OK"; }
function fans_search($user, $fields = array()) { global $_W; $struct = cache_load('fansfields'); if (empty($fields)) { $select = '*'; } else { foreach ($fields as $field) { if (!in_array($field, $struct)) { unset($fields[$field]); } } $select = '`from_user`, `' . implode('`,`', $fields) . '`'; } $result = pdo_fetchall("SELECT {$select} FROM " . tablename('fans') . " WHERE from_user IN ('" . implode("','", is_array($user) ? $user : array($user)) . "')", array(), 'from_user'); if (!empty($result)) { foreach ($result as &$row) { if (!empty($row['avatar'])) { if (strexists($row['avatar'], 'avatar_')) { $row['avatar'] = $_W['siteroot'] . 'resource/image/avatar/' . $row['avatar']; } elseif (strexists($row['avatar'], 'http')) { } else { $row['avatar'] = $_W['attachurl'] . $row['avatar']; } } } if (is_array($user)) { return $result; } else { return $result[$user]; } } else { return array(); } }
public function LocationLogoupload($logo) { global $_W; if (!strexists($logo, 'http://') && !strexists($logo, 'https://')) { $path = rtrim(IA_ROOT . '/' . $_W['config']['upload']['attachdir'], '/') . '/'; if (empty($logo) || !file_exists($path . $logo)) { return error(-1, '商户LOGO不存在'); } } else { return error(-1, '商户LOGO只能上传本地图片'); } $token = $this->fetch_token(); if (is_error($token)) { return $token; } $url = "https://api.weixin.qq.com/cgi-bin/media/uploadimg?access_token={$token}"; $data = array('buffer' => '@' . $path . $logo); load()->func('communication'); $response = ihttp_request($url, $data); if (is_error($response)) { return error(-1, "访问公众平台接口失败, 错误: {$response['message']}"); } $result = @json_decode($response['content'], true); if (empty($result)) { return error(-1, "接口调用失败, 元数据: {$response['meta']}"); } elseif (!empty($result['errcode'])) { return error(-1, "访问微信接口错误, 错误代码: {$result['errcode']}, 错误信息: {$result['errmsg']},信息详情:{$this->error_code($result['errcode'])}"); } return $result; }
function checkmagicperm($perms, $id) { $id = $id ? intval($id) : ''; if (!strexists("\t" . trim($perms) . "\t", "\t" . trim($id) . "\t") && $perms) { showmessage('magics_target_nopermission'); } }
function runlog($log, $file = 'wechat', $halt = 0) { global $_SGLOBAL, $_SERVER; $nowurl = $_SERVER['REQUEST_URI'] ? $_SERVER['REQUEST_URI'] : ($_SERVER['PHP_SELF'] ? $_SERVER['PHP_SELF'] : $_SERVER['SCRIPT_NAME']); $log = gmdate('Y-m-d H:i:s', $_SGLOBAL['timestamp']) . "\t{$type}\t" . "\t{$nowurl}\t" . str_replace(array("\r", "\n"), array(' ', ' '), trim($log)) . "\n"; $yearmonth = gmdate('Ym', $_SGLOBAL['timestamp']); $logdir = './data/log/'; if (!is_dir($logdir)) { mkdir($logdir, 0777); } $logfile = $logdir . $yearmonth . '_' . $file . '.php'; if (@filesize($logfile) > 2048000) { $dir = opendir($logdir); $length = strlen($file); $maxid = $id = 0; while ($entry = readdir($dir)) { if (strexists($entry, $yearmonth . '_' . $file)) { $id = intval(substr($entry, $length + 8, -4)); $id > $maxid && ($maxid = $id); } } closedir($dir); $logfilebak = $logdir . $yearmonth . '_' . $file . '_' . ($maxid + 1) . '.php'; @rename($logfile, $logfilebak); } if ($fp = @fopen($logfile, 'a')) { @flock($fp, 2); fwrite($fp, "<?PHP exit;?>\t" . str_replace(array('<?', '?>', "\r", "\n"), '', $log) . "\n"); fclose($fp); } if ($halt) { exit; } }
public function fieldsFormDisplay($rid = 0) { global $_W; if (!empty($rid)) { $row = pdo_fetch("SELECT * FROM " . tablename($this->tablename) . " WHERE rid = :rid ORDER BY `id` DESC", array(':rid' => $rid)); if (!strexists($row['apiurl'], 'http://') && !strexists($row['apiurl'], 'https://')) { $row['apilocal'] = $row['apiurl']; $row['apiurl'] = ''; } } else { $row = array('cachetime' => 0); } $path = IA_ROOT . '/source/modules/userapi/api'; if (is_dir($path)) { $apis = array(); if ($handle = opendir($path)) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != "..") { $apis[] = $file; } } } } include $this->template('form'); }
function helplist($num, $id = '', $aids = "", $orderby = "aid asc") { if (is_numeric($id)) { $wherestr[] = "typeid = " . $id; } elseif (is_array($id)) { $ids = getdotstring($id, 'int'); $wherestr[] = "typeid in ({$ids})"; } elseif (is_string($id) && (strexists($id, ',') || strexists($id, '|'))) { if (strexists($id, ',')) { $ids = getdotstring($id, 'int'); } else { $ids = getdotstring(explode('|', $ids), 'int'); } $wherestr[] = "typeid in ({$ids})"; } else { $wherestr[] = ""; } if (!empty($aids)) { $aids = getdotstring($aids, 'int'); $wherestr[] = "aid in ({$ids})"; } $num = GetNum($num); $wheresql = implode(' AND ', $wherestr); //条件汇总 $articleobj = new TableClass('article', 'aid'); $articlearray = $articleobj->getdata($num, $wheresql, $orderby, 'aid,typeid,title'); return $articlearray; }
public function respond() { global $_W; $content = $this->message['content']; $reply = pdo_fetch('SELECT * FROM ' . tablename('cover_reply') . ' WHERE `rid`=:rid', array(':rid' => $this->rule)); if (!empty($reply)) { load()->model('module'); $module = module_fetch($reply['module']); if (empty($module) && !in_array($reply['module'], array('site', 'mc', 'card'))) { return ''; } $url = $reply['url']; if (empty($reply['url'])) { $entry = pdo_fetch("SELECT eid FROM " . tablename('modules_bindings') . " WHERE module = :module AND do = :do", array(':module' => $reply['module'], ':do' => $reply['do'])); $url = url('entry', array('eid' => $entry['eid'])); } if (!strexists($url, '&j=') && !empty($_W['acid'])) { $url = str_replace("?i={$_W['uniacid']}&", "?i={$_W['uniacid']}&j={$_W['acid']}&", $url); } $news = array(); $news[] = array('title' => $reply['title'], 'description' => $reply['description'], 'picurl' => $reply['thumb'], 'url' => $url); return $this->respNews($news); } return ''; }
public function doMobileDetail() { global $_W, $_GPC; checkauth(); $rid = intval($_GPC['rid']); $reply = pdo_fetch("SELECT * FROM " . tablename('shake_reply') . " WHERE rid = :rid", array(':rid' => $rid)); if (empty($reply)) { message('抱歉,此活动不存在或是还未开始!', 'refresh', 'error'); } $member = pdo_fetch("SELECT * FROM " . tablename('shake_member') . " WHERE rid = :rid AND openid = :openid", array(':rid' => $reply['rid'], ':openid' => $_W['member']['uid'])); if (empty($member)) { $member = array('rid' => $rid, 'openid' => $_W['member']['uid'], 'createtime' => TIMESTAMP, 'shakecount' => 0, 'status' => 0); $maxjoin = pdo_fetchcolumn("SELECT COUNT(*) FROM " . tablename('shake_member') . " WHERE rid = '{$reply['rid']}' AND status = '1'"); if ($maxjoin < $reply['maxjoin']) { mt_srand((double) microtime() * 1000000); $rand = mt_rand(1, 100); if ($rand <= $reply['joinprobability']) { $member['status'] = 1; } } pdo_insert('shake_member', $member); } if (strexists(strtolower($_SERVER['HTTP_USER_AGENT']), 'android')) { $reply['speed'] = $reply['speedandroid']; } include $this->template('detail'); }
function message($msg, $redirect = '', $type = '') { global $_W; if ($redirect == 'refresh') { $redirect = $_W['script_name'] . '?' . $_SERVER['QUERY_STRING']; } elseif (!empty($redirect) && !strexists($redirect, 'http://')) { $urls = parse_url($redirect); $redirect = $_W['siteroot'] . 'app/index.php?' . $urls['query']; } if ($redirect == '') { $type = in_array($type, array('success', 'error', 'info', 'warning', 'ajax', 'sql')) ? $type : 'info'; } else { $type = in_array($type, array('success', 'error', 'info', 'warning', 'ajax', 'sql')) ? $type : 'success'; } if ($_W['isajax'] || $type == 'ajax') { $vars = array(); $vars['message'] = $msg; $vars['redirect'] = $redirect; $vars['type'] = $type; exit(json_encode($vars)); } if (empty($msg) && !empty($redirect)) { header('location: ' . $redirect); } $label = $type; if ($type == 'error') { $label = 'danger'; } if ($type == 'ajax' || $type == 'sql') { $label = 'warning'; } include template('common/message', TEMPLATE_INCLUDEPATH); exit; }
function tpl_form_field_clock($name, $value = '') { $s = ''; if (!defined('TPL_INIT_CLOCK_TIME')) { app()->view->registerJs(<<<EOF require(['clockpicker'], function(\$) { \$(".clockpicker").clockpicker({ autoclose: true }); }); EOF ); define('TPL_INIT_CLOCK_TIME', 1); } $time = date('H:i'); if (!empty($value)) { if (!strexists($value, ':')) { $time = date('H:i', $value); } else { $time = $value; } } $s .= ' <div class="input-group clockpicker"> <span class="input-group-addon"><i class="fa fa-clock-o"></i></span> <input type="text" name="' . $name . '" value="' . $time . '" class="form-control"> </div>'; return $s; }
public function respond() { global $_W; $rid = $this->rule; $sql = "SELECT * FROM " . tablename('weisrc_pano_reply') . " WHERE `rid`=:rid LIMIT 1"; $row = pdo_fetch($sql, array(':rid' => $rid)); $url = $this->createMobileUrl('view', array('rid' => $row['rid'])); return $this->respNews(array('Title' => $row['title'], 'Description' => $row['description'], 'PicUrl' => !strexists($row['picture'], 'http://') ? $_W['attachurl'] . $row['picture'] : $row['picture'], 'Url' => $url)); }
public function pagebar($pageinfo) { $totals = $pageinfo['totals']; $perpage = $pageinfo['length']; $curpage = $pageinfo['curpage']; $mpurl = url($pageinfo['udi']); if (isset($pageinfo['param'])) { $mpurl .= $pageinfo['param']; } $maxpages = isset($pageinfo['maxpages']) ? $pageinfo['maxpages'] : false; //最大页数限制 $page = isset($pageinfo['showpage']) ? $pageinfo['showpage'] : false; //一次显示多少页码 $shownum = isset($pageinfo['shownum']) ? $pageinfo['shownum'] : false; $showkbd = isset($pageinfo['showkbd']) ? $pageinfo['showkbd'] : false; $simple = isset($pageinfo['simple']) ? $pageinfo['simple'] : false; $autogoto = true; $ajaxtarget = ''; // getgpc('g.ajaxtarget') ? " ajaxtarget=\"" . getgpc('g.ajaxtarget', '', 'input_char') . "\" " : ''; $aname = ''; if (strexists($mpurl, '#')) { $astrs = explode('#', $mpurl); $mpurl = $astrs[0]; $aname = '#' . $astrs[1]; } $lang['prev'] = '上一页'; $lang['next'] = '下一页'; $mpurl .= strexists($mpurl, '?') ? '&' : '?'; $offset = floor($page * 0.5); $realpages = ceil($totals / $perpage); $pages = $maxpages && $maxpages < $realpages ? $maxpages : $realpages; if ($page > $pages) { $from = 1; $to = $pages; } else { $from = $curpage - $offset; $to = $from + $page - 1; if ($from < 1) { $to = $curpage + 1 - $from; $from = 1; if ($to - $from < $page) { $to = $page; } } elseif ($to > $pages) { $from = $pages - $page + 1; $to = $pages; } } $multipage = ($curpage - $offset > 1 && $pages > $page ? '<a href="' . $mpurl . 'page=1' . $aname . '" class="first"' . $ajaxtarget . '>1 ...</a>' : '') . ($curpage > 1 && !$simple ? '<a href="' . $mpurl . 'page=' . ($curpage - 1) . $aname . '" class="prev"' . $ajaxtarget . '>' . $lang['prev'] . '</a>' : ''); for ($i = $from; $i <= $to; $i++) { $multipage .= $i == $curpage ? '<strong>' . $i . '</strong>' : '<a href="' . $mpurl . 'page=' . $i . ($ajaxtarget && $i == $pages && $autogoto ? '#' : $aname) . '"' . $ajaxtarget . '>' . $i . '</a>'; } $multipage .= ($to < $pages ? '<a href="' . $mpurl . 'page=' . $pages . $aname . '" class="last"' . $ajaxtarget . '>... ' . $realpages . '</a>' : '') . ($curpage < $pages && !$simple ? '<a href="' . $mpurl . 'page=' . ($curpage + 1) . $aname . '" class="nxt"' . $ajaxtarget . '>' . $lang['next'] . '</a>' : '') . ($showkbd && !$simple && $pages > $page && !$ajaxtarget ? '<kbd><input type="text" name="custompage" size="3" onkeydown="if(event.keyCode==13) {window.location=\'' . $mpurl . 'page=\'+this.value; doane(event);}" /></kbd>' : ''); $multipage = '<div class="pg">' . ($shownum && !$simple ? '<em> ' . $totals . ' </em>' : '') . $multipage . '</div>'; //$maxpage = $realpages; return $multipage; }
function output() { extract($GLOBALS); $_G['forum_thread']['replies'] = $_G['forum_thread']['replies'] >= 0 ? $_G['forum_thread']['replies'] : 0; if ($_G['page'] > @ceil(($_G['forum_thread']['replies'] + 1) / $_G['ppp'])) { $content = ''; } elseif ($postlist) { if (!function_exists('mobileoem_template')) { include_once DISCUZ_ROOT . './source/plugin/mobileoem/discuzcode.func.php'; } $variable = array(); foreach ($GLOBALS['aimgs'] as $pid => $aids) { foreach ($aids as $aid) { $_url = parse_url($postlist[$pid]['attachments'][$aid]['url']); $variable['imagelist'][$aid] = (!$postlist[$pid]['attachments'][$aid]['remote'] && !$_url['scheme'] ? $_G['siteurl'] : '') . $postlist[$pid]['attachments'][$aid]['url'] . $postlist[$pid]['attachments'][$aid]['attachment']; if (strexists($postlist[$pid]['message'], '[attach]' . $aid . '[/attach]')) { $postlist[$pid]['message'] = str_replace('[attach]' . $aid . '[/attach]', mobileoem_parseimg($postlist[$pid]['attachments'][$aid]['width'], 0, $variable['imagelist'][$aid]), $postlist[$pid]['message']); } else { $postlist[$pid]['message'] .= '<br /><br />' . mobileoem_parseimg($postlist[$pid]['attachments'][$aid]['width'], 0, $variable['imagelist'][$aid]); } } } foreach ($postlist as $pid => $post) { if ($post['attachlist']) { foreach ($post['attachlist'] as $aid) { $aidencode = packaids($postlist[$pid]['attachments'][$aid]); $_code = parseurl('/forum.php?mod=attachment&aid=' . $aidencode, $postlist[$pid]['attachments'][$aid]['filename'], 0); if (strexists($postlist[$pid]['message'], '[attach]' . $aid . '[/attach]')) { $postlist[$pid]['message'] = str_replace('[attach]' . $aid . '[/attach]', $_code, $postlist[$pid]['message']); } else { $postlist[$pid]['message'] .= '<br /><br />' . $_code; } } } $postlist[$pid]['message'] = preg_replace("/\\[attach\\]\\d+\\[\\/attach\\]/i", '', $postlist[$pid]['message']); } $get = $_GET; unset($get['page'], $get['debug']); $nexturl = http_build_query($get); include mobileoem_template('forum/viewthread'); if (!empty($_GET['debug'])) { exit; } $content = ob_get_contents(); ob_end_clean(); } $variable['forumname'] = $forum['name']; $variable['datatype'] = $_G['page'] == 1 ? 0 : 1; $variable['webview_page'] = $content; $variable['ppp'] = $_G['ppp']; $variable['posts'] = count($postlist); $variable['page'] = $_G['page']; if ($_G['forum_discuzcode']['passwordauthor']) { $variable['passwordpid'] = array_keys($_G['forum_discuzcode']['passwordauthor']); } mobile_core::result(mobile_core::variable($variable)); }
function site_slide_search_new($params = array()) { global $_GPC, $_W; extract($params); $sql = "SELECT * FROM " . tablename('xcommunity_slide') . " WHERE weid = '{$_W['weid']}' ORDER BY id DESC"; $list = pdo_fetchall($sql); if (!empty($list)) { foreach ($list as &$row) { $row['url'] = strexists($row['url'], 'http') ? $row['url'] : ''; } } return $list; }
public function respond() { global $_W; $rid = $this->rule; $sql = "SELECT * FROM " . tablename('weisrc_audio_reply') . " WHERE `rid`=:rid LIMIT 1"; $row = pdo_fetch($sql, array(':rid' => $rid)); if (empty($row['id'])) { return array(); } $title = pdo_fetchcolumn("SELECT name FROM " . tablename('rule') . " WHERE id = :rid LIMIT 1", array(':rid' => $rid)); $url = $_W['siteroot'] . createMobileUrl('index', array('rid' => $row['rid'], 'from_user' => base64_encode(authcode($this->message['from'], 'ENCODE')))); return $this->respNews(array('Title' => $title, 'Description' => $row['description'], 'PicUrl' => !strexists($row['picture'], 'http://') ? $_W['attachurl'] . $row['picture'] : $row['picture'], 'Url' => $url)); }
function _isfounder($user) { $founders = str_replace(' ', '', $GLOBALS['forumfounders']); if($user['adminid'] <> 1) { return FALSE; } elseif(empty($founders)) { return TRUE; } elseif(strexists(",$founders,", ",$user[uid],")) { return TRUE; } elseif(!is_numeric($user['username']) && strexists(",$founders,", ",$user[username],")) { return TRUE; } else { return FALSE; } }
function site_slide_search($params = array()) { global $_GPC, $_W; extract($params); $sql = "SELECT * FROM " . tablename('site_slide') . " WHERE weid = '{$_W['weid']}' ORDER BY id DESC LIMIT {$limit}"; $list = pdo_fetchall($sql); if (!empty($list)) { foreach ($list as &$row) { $row['url'] = strexists($row['url'], 'http') ? $row['url'] : $_W['siteroot'] . $row['url']; $row['thumb'] = toimage($row['thumb']); } } return $list; }
function isfounder($user = '') { $user = empty($user) ? array('uid' => $GLOBALS['discuz_uid'], 'adminid' => $GLOBALS['adminid'], 'username' => $GLOBALS['discuz_userss']) : $user; $founders = str_replace(' ', '', $GLOBALS['forumfounders']); if($user['adminid'] <> 1) { return FALSE; } elseif(empty($founders)) { return TRUE; } elseif(strexists(",$founders,", ",$user[uid],")) { return TRUE; } elseif(!is_numeric($user['username']) && strexists(",$founders,", ",$user[username],")) { return TRUE; } else { return FALSE; } }
public function checkfounder($user) { $founders = str_replace(' ', '', getglobal('config/admincp/founder')); if (!$user['uid'] || $user['groupid'] != 1 || $user['adminid'] != 1) { return false; } elseif (empty($founders)) { return true; } elseif (strexists(",{$founders},", ",{$user['uid']},")) { return true; } elseif (!is_numeric($user['nickname']) && strexists(",{$founders},", ",{$user['nickname']},")) { return true; } else { return FALSE; } }
public function respond() { global $_W; $rid = $this->rule; $sql = "SELECT * FROM " . tablename('weisrc_dish_reply') . " WHERE `rid`=:rid LIMIT 1"; $row = pdo_fetch($sql, array(':rid' => $rid)); $site_index = 1; $site_store = 2; $site_list = 3; $site_menu = 4; $site_intelligent = 5; if (empty($row['id'])) { return array(); } $method_name = 'wapindex'; //默认为首页 if ($row['type'] == $site_store) { $method_name = 'waprestlist'; } else { if ($row['type'] == $site_list) { $method_name = 'waplist'; } else { if ($row['type'] == $site_menu) { $method_name = 'wapmenu'; } else { if ($row['type'] == $site_intelligent) { $method_name = 'wapselect'; } } } } $url = $this->buildSiteUrl($this->createMobileUrl($method_name, array('storeid' => $row['storeid']))); // $response['FromUserName'] = $this->message['to']; // $response['ToUserName'] = $this->message['from']; // $response['MsgType'] = 'news'; // $response['ArticleCount'] = 1; // $response['Articles'] = array(); // $response['Articles'][] = array( // 'Title' => $row['title'], // 'Description' => $row['description'], // 'PicUrl' => !strexists($row['picture'], 'http://') ? $_W['attachurl'] . $row['picture'] : $row['picture'], // 'Url' => $url, // 'TagName' => 'item', // ); return $this->respNews(array('Title' => $row['title'], 'Description' => $row['description'], 'PicUrl' => !strexists($row['picture'], 'http://') ? $_W['attachurl'] . $row['picture'] : $row['picture'], 'Url' => $url)); //return $response; }
public function __construct($name = '') { parent::__construct(); $this->modulename = 'ewei_shop'; $this->pluginname = $name; $this->loadModel(); if (strexists($_SERVER['REQUEST_URI'], '/web/')) { cpa($this->pluginname); } else { if (strexists($_SERVER['REQUEST_URI'], '/app/')) { if (is_weixin()) { $this->setFooter(); } } } $this->module['title'] = pdo_fetchcolumn('select title from ' . tablename('modules') . " where name='ewei_shop' limit 1"); }
public function add_tag($tags, $itemid, $idtype = 'tid', $returnarray = 0) { if ($tags == '' || !in_array($idtype, array('', 'tid', 'blogid', 'uid'))) { return; } $tags = str_replace(array(chr(0xa3) . chr(0xac), chr(0xa1) . chr(0x41), chr(0xef) . chr(0xbc) . chr(0x8c)), ',', censor($tags)); if (strexists($tags, ',')) { $tagarray = array_unique(explode(',', $tags)); } else { $langcore = lang('core'); $tags = str_replace($langcore['fullblankspace'], ' ', $tags); $tagarray = array_unique(explode(' ', $tags)); } $tagcount = 0; foreach ($tagarray as $tagname) { $tagname = trim($tagname); if (preg_match('/^([\\x7f-\\xff_-]|\\w|\\s){3,20}$/', $tagname)) { $status = $idtype != 'uid' ? 0 : 3; $result = C::t('common_tag')->get_bytagname($tagname, $idtype); if ($result['tagid']) { if ($result['status'] == $status) { $tagid = $result['tagid']; } } else { $tagid = C::t('common_tag')->insert($tagname, $status); } if ($tagid) { if ($itemid) { C::t('common_tagitem')->replace($tagid, $itemid, $idtype); } $tagcount++; if (!$returnarray) { $return .= $tagid . ',' . $tagname . "\t"; } else { $return[$tagid] = $tagname; } } if ($tagcount > 4) { unset($tagarray); break; } } } return $return; }
public function fieldsFormSubmit($rid) { global $_W, $_GPC; $dat = pdo_fetch('SELECT * FROM' . tablename($this->tab_reply) . " WHERE uniacid = :uniacid AND rid = :rid", array(':uniacid' => $_W['uniacid'], ':rid' => $rid)); $data = $_GPC['dat']; if (empty($dat)) { $data['uniacid'] = $_W['uniacid']; $data['rid'] = $rid; if (!strexists(strtolower($data['url']), 'http')) { $data['url'] = 'http://' . $data['url']; } pdo_insert($this->tab_reply, $data); } else { if (!strexists(strtolower($data['url']), 'http')) { $data['url'] = 'http://' . $data['url']; } pdo_update($this->tab_reply, $data, array('uniacid' => $_W['uniacid'], 'rid' => $rid)); } }
function mobile_nav($position) { global $_W; $navs = pdo_fetchall("SELECT id,name, description, url, icon, css, position, module FROM " . tablename('site_nav') . " WHERE position = '{$position}' AND status = 1 AND weid = '{$_W['weid']}' ORDER BY displayorder ASC"); if (!empty($navs)) { foreach ($navs as $index => &$row) { if (!strexists($row['url'], ':') && !strexists($row['url'], 'weid=')) { $row['url'] .= strexists($row['url'], '?') ? '&weid=' . $_W['weid'] : '?weid=' . $_W['weid']; } $row['css'] = unserialize($row['css']); if ($row['position'] == '3') { unset($row['css']['icon']['font-size']); } $row['css']['icon']['style'] = "color:{$row['css']['icon']['color']};font-size:{$row['css']['icon']['font-size']}px;"; $row['css']['name'] = "color:{$row['css']['name']['color']};"; } unset($row); } return $navs; }
function save_media($url) { $config = array('qiniu' => false); $plugin = p('qiniu'); if ($plugin) { $config = $plugin->getConfig(); if ($config) { if (strexists($url, $config['url'])) { return $url; } $qiniu_url = $plugin->save(tomedia($url), $config); if (empty($qiniu_url)) { return $url; } return $qiniu_url; } return $url; } return $url; }