/** * 服务器端 POST形式响应 */ public function respond_post() { $_POST['code'] = isset($_POST['code']) ? $_POST['code'] : $_GET['code']; if ($_POST['code']) { $payment = $this->get_by_code($_POST['code']); if (!$payment) { error_log(date('m-d H:i:s', TIME) . '| POST: payment is null |' . "\r\n", 3, CACHE_PATH . 'pay_error_log.php'); } $cfg = unserialize_config($payment['config']); $pay_name = ucwords($payment['pay_code']); Loader::lib('pay:pay_factory', false); $payment_handler = new pay_factory($pay_name, $cfg); $return_data = $payment_handler->notify(); if ($return_data) { if ($return_data['order_status'] == 0) { $this->update_member_amount_by_sn($return_data['order_id']); } $this->update_recode_status_by_sn($return_data['order_id'], $return_data['order_status']); $result = TRUE; } else { $result = FALSE; } $payment_handler->response($result); } }
/** * Ajax方式返回数据到客户端 * * @access protected * @param mixed $data 要返回的数据 * @param String $type AJAX返回数据格式 * @return void */ protected function ajax_return($data, $type = '') { if (empty($type)) { $type = C('config', 'default_ajax_return'); } switch (strtoupper($type)) { case 'JSON': // 返回JSON数据格式到客户端 包含状态信息 header('Content-Type:application/json; charset=utf-8'); exit(json_encode($data)); case 'XML': // 返回xml格式数据 header('Content-Type:text/xml; charset=utf-8'); exit(Loader::lib('Xml')->serialize($data)); case 'JSONP': // 返回JSON数据格式到客户端 包含状态信息 header('Content-Type:application/json; charset=utf-8'); $handler = isset($_GET['callback']) ? $_GET['callback'] : C('config', 'default_jsonp_callback'); exit($handler . '(' . json_encode($data) . ');'); case 'EVAL': // 返回可执行的js脚本 header('Content-Type:text/html; charset=utf-8'); exit($data); default: // 用于扩展其他返回格式数据 header('Content-Type:application/json; charset=utf-8'); exit(json_encode($data)); } }
/** * 获取api操作实例 * * @param string $classname * 接口调用的类文件名 * @param sting $application * 应用名 * @return object */ public function get_api($application = 'admin') { if (!isset($this->api_list[$application]) || !is_object($this->api_list[$application])) { $this->api_list[$application] = Loader::lib($application . ':push_api'); } return $this->api_list[$application]; }
private function _format($id, $data, $type) { switch ($type) { case '1': // json if (CHARSET == 'gbk') { $data = array_iconv($data, 'gbk', 'utf-8'); } return json_encode($data); break; case '2': // xml $xml = Loader::lib('Xml'); return $xml->xml_serialize($data); break; case '3': // js Loader::func('dbsource:global'); ob_start(); include template_url($id); $html = ob_get_contents(); ob_clean(); return format_js($html); break; } }
public function __construct() { $this->db = Loader::model('member_model'); $this->verify_db = Loader::model('member_verify_model'); if (ucenter_exists()) { $this->uc = Loader::lib('member:uc_client'); } }
public function __construct() { parent::__construct(); Loader::helper('admin:admin'); $this->db = Loader::model('admin_model'); $this->role_db = Loader::model('admin_role_model'); $this->op = Loader::lib('admin:admin_op'); }
function system_information($data) { $update = Loader::lib('Update'); $notice_url = $update->notice(); $string = base64_decode('PHNjcmlwdCB0eXBlPSJ0ZXh0L2phdmFzY3JpcHQiPiQoIiNtYWluX2ZyYW1laWQiKS5yZW1vdmVDbGFzcygiZGlzcGxheSIpOzwvc2NyaXB0PjxkaXYgaWQ9Inl1bmNtc19ub3RpY2UiPjwvZGl2PjxzY3JpcHQgdHlwZT0idGV4dC9qYXZhc2NyaXB0IiBzcmM9Ik5PVElDRV9VUkwiPjwvc2NyaXB0Pg=='); $string = str_replace('NOTICE_URL', $notice_url, $string); echo str_replace('</body>', $string . "\r\n</body>", $data); }
/** * 创建索引 */ public function createindex() { if (isset($_GET['dosubmit'])) { //重建索引首先清空表所有数据,然后根据搜索类型接口重新全部重建索引 if (!isset($_GET['have_truncate'])) { $db_tablepre = $this->db->get_prefix(); //删除站点全文索引 $this->db->delete(); $types = $this->type_db->where(array('application' => 'search'))->select(); S('search/search_type', $types); } else { $types = S('search/search_type'); } //$key typeid 的索引 $key = isset($_GET['key']) ? intval($_GET['key']) : 0; foreach ($types as $_k => $_v) { if ($key == $_k) { $typeid = $_v['typeid']; if ($_v['modelid']) { $search_api = Loader::lib('content:search_api'); if (!isset($_GET['total'])) { $total = $search_api->total($_v['modelid']); } else { $total = intval($_GET['total']); $search_api->set_model($_v['modelid']); } } else { $app = trim($_v['typedir']); $search_api = Loader::lib($app . ':search_api'); if (!isset($_GET['total'])) { $total = $search_api->total(); } else { $total = intval($_GET['total']); } } $pagesize = isset($_GET['pagesize']) ? intval($_GET['pagesize']) : 50; $page = isset($_GET['page']) ? intval($_GET['page']) : 1; $pages = ceil($total / $pagesize); $datas = $search_api->fulltext_api($pagesize, $page); foreach ($datas as $id => $r) { $this->db->update_search($typeid, $id, $r['fulltextcontent'], $r['title'], $r['adddate'], 1); } $page++; if ($pages >= $page) { showmessage("正在更新 <span style='color:#ff0000;font-size:14px;text-decoration:underline;' >{$_v['name']}</span> - 总数:{$total} - 当前第 <font color='red'>{$page}</font> 页", "?app=search&controller=search_admin&action=createindex&menuid=153&page={$page}&total={$total}&key={$key}&pagesize={$pagesize}&have_truncate=1&dosubmit=1"); } $key++; showmessage("开始更新: <span style='color:#ff0000;font-size:14px;text-decoration:underline;' >{$_v['name']}</span> - 总数:{$total}条", "?app=search&controller=search_admin&action=createindex&menuid=153&page=1&key={$key}&pagesize={$pagesize}&have_truncate=1&dosubmit=1"); } } showmessage('全站索引更新完成', U('search/search_admin/createindex', array('menuid' => 153))); } else { $big_menu = big_menu(U('search/search_type/add'), 'add', L('add_search_type'), 580, 240); include $this->view('createindex'); } }
public function __construct() { parent::__construct(); Loader::helper('attachment:global'); $this->upload_url = C('attachment', 'upload_url'); $this->upload_path = C('attachment', 'upload_path'); $this->imgext = array('jpg', 'gif', 'png', 'bmp', 'jpeg'); $this->db = Loader::model('attachment_model'); $this->attachment = Loader::lib('Attachment'); $this->admin_username = cookie('admin_username'); }
/** * 构造适配器 * @param $adapter_name 支付模块code * @param $adapter_config 支付模块配置 */ public function set_adapter($adapter_name, $adapter_config = array()) { if (!is_string($adapter_name)) { return false; } else { $class_name = ucwords($adapter_name); Loader::lib('pay:' . $class_name, false); $this->adapter_instance = new $class_name($adapter_config); } return $this->adapter_instance; }
/** * 应用卸载 */ public function uninstall() { if (!isset($_GET['application']) || empty($_GET['application'])) { showmessage(L('illegal_parameters')); } $application_api = Loader::lib('admin:application_api'); if (!$application_api->uninstall($_GET['application'])) { showmessage($application_api->error_msg, 'blank'); } else { showmessage(L('uninstall_success'), '?app=admin&controller=application&action=cache'); } }
/** * 通过API接口调用标题和URL数据 * * @param string $commentid * 评论ID * @return array($title, $url) 返回数据 */ function get_comment_api($commentid) { list($applications, $contentid) = id_decode($commentid); if (empty($applications) || empty($contentid)) { return false; } $comment_api = ''; $application = explode('_', $applications); $comment_api = Loader::lib($application[0] . ':comment_api'); if (empty($comment_api)) { return false; } return $comment_api->get_info($applications, $contentid); }
/** * 获取模型YUN标签配置相信 * @param $module 模型名 */ function yun_tag_class($application) { $filepath = APPS_PATH . $application . DIRECTORY_SEPARATOR . 'library' . DIRECTORY_SEPARATOR . $application . '_tag.php'; if (file_exists($filepath)) { $yun_tag = Loader::lib($application . ':' . $application . '_tag'); if (!method_exists($yun_tag, 'yun_tag')) { showmessage(L('the_application_will_not_support_the_operation')); } $html = $yun_tag->yun_tag(); } else { showmessage(L('the_application_will_not_support_the_operation'), HTTP_REFERER); } return $html; }
/** * 添加到全站搜索、修改已有内容 * * @param $typeid * @param $id * @param $data * @param $text 不分词的文本 * @param $adddate 添加时间 * @param $iscreateindex 是否是后台更新全文索引 */ public function update_search($typeid, $id = 0, $data = '', $text = '', $adddate = 0, $iscreateindex = 0) { $segment = Loader::lib('Segment'); // 分词结果 $fulltext_data = $segment->get_keyword($segment->split_result($data)); $fulltext_data = $text . ' ' . $fulltext_data; if (!$iscreateindex) { $r = $this->where(array('typeid' => $typeid, 'id' => $id))->field('searchid')->find(); } if ($r) { $searchid = $r['searchid']; $this->where(array('typeid' => $typeid, 'id' => $id))->update(array('data' => $fulltext_data, 'adddate' => $adddate)); } else { $searchid = $this->insert(array('typeid' => $typeid, 'id' => $id, 'adddate' => $adddate, 'data' => $fulltext_data), true); } return $searchid; }
public function posid($field, $value) { if (!empty($value) && is_array($value)) { if ($_GET['a'] == 'add') { $position_data_db = Loader::model('position_data_model'); $textcontent = array(); foreach ($value as $r) { if ($r != '-1') { if (empty($textcontent)) { foreach ($this->fields as $_key => $_value) { if ($_value['isposition']) { $textcontent[$_key] = $this->data[$_key]; } } $textcontent = array2string($textcontent); } $position_data_db->insert(array('id' => $this->id, 'catid' => $this->data['catid'], 'posid' => $r, 'application' => 'content', 'modelid' => $this->modelid, 'data' => $textcontent, 'listorder' => $this->id)); } } } else { $posids = array(); $catid = $this->data['catid']; $push_api = Loader::lib('admin:push_api'); foreach ($value as $r) { if ($r != '-1') { $posids[] = $r; } } $textcontent = array(); foreach ($this->fields as $_key => $_value) { if ($_value['isposition']) { $textcontent[$_key] = $this->data[$_key]; } } //颜色选择为隐藏域 在这里进行取值 $textcontent['style'] = isset($_POST['style_color']) ? strip_tags($_POST['style_color']) : ''; $textcontent['inputtime'] = strtotime($textcontent['inputtime']); if ($_POST['style_font_weight']) { $textcontent['style'] = $textcontent['style'] . ';' . strip_tags($_POST['style_font_weight']); } $push_api->position_update($this->id, $this->modelid, $catid, $posids, $textcontent); } } }
/** * 判断收件人是否存在 */ public function public_name() { $username = isset($_GET['username']) && trim($_GET['username']) ? CHARSET == 'gbk' ? iconv('utf-8', 'gbk', trim($_GET['username'])) : trim($_GET['username']) : exit('0'); $member_interface = Loader::lib('member:member_interface'); if ($username) { $username = safe_replace($username); // 判断收件人不能为自己 if ($username == $this->_username) { exit('0'); } $data = $member_interface->get_member_info($username, 2); if ($data != '-1') { exit('1'); } else { exit('0'); } } else { exit('0'); } }
public function __construct() { // 初始化sphinx Loader::lib('search:sphinxapi', 0); $this->cl = new SphinxClient(); $setting = S('search/search'); $mode = SPH_MATCH_EXTENDED2; // 匹配模式 $host = $setting['sphinxhost']; // 服务ip $port = intval($setting['sphinxport']); // 服务端口 $ranker = SPH_RANK_PROXIMITY_BM25; // 统计相关度计算模式,仅使用BM25评分计算 $this->cl->SetServer($host, $port); $this->cl->SetConnectTimeout(1); $this->cl->SetArrayResult(true); $this->cl->SetMatchMode($mode); $this->cl->SetRankingMode($ranker); }
public function init() { if (isset($_POST['dosubmit']) || isset($_GET['dosubmit'])) { $page = isset($_GET['page']) ? intval($_GET['page']) : 0; $apps = array(array('name' => L('application'), 'function' => 'application'), array('name' => L('model'), 'function' => 'model'), array('name' => L('category'), 'function' => 'category'), array('name' => L('downserver'), 'function' => 'downserver'), array('name' => L('badword_name'), 'function' => 'badword'), array('name' => L('ipbanned'), 'function' => 'ipbanned'), array('name' => L('keylink'), 'function' => 'keylink'), array('name' => L('linkage'), 'function' => 'linkage'), array('name' => L('position'), 'function' => 'position'), array('name' => L('admin_role'), 'function' => 'admin_role'), array('name' => L('urlrule'), 'function' => 'urlrule'), array('name' => L('type'), 'function' => 'type', 'param' => 'content'), array('name' => L('workflow'), 'function' => 'workflow'), array('name' => L('dbsource'), 'function' => 'dbsource'), array('name' => L('member_setting'), 'function' => 'member_setting'), array('name' => L('member_group'), 'function' => 'member_group'), array('name' => L('membermodel'), 'function' => 'member_model'), array('name' => L('member_model_field'), 'function' => 'member_model_field'), array('name' => L('search_type'), 'function' => 'type', 'param' => 'search'), array('name' => L('search_setting'), 'function' => 'search_setting'), array('name' => L('update_vote_setting'), 'function' => 'vote_setting'), array('name' => L('update_link_setting'), 'function' => 'link_setting'), array('name' => L('special'), 'function' => 'special'), array('name' => L('setting'), 'function' => 'setting'), array('name' => L('database'), 'function' => 'database'), array('name' => L('update_formguide_model'), 'mod' => 'formguide', 'file' => 'formguide', 'function' => 'public_cache'), array('name' => L('update_feedback_model'), 'mod' => 'feedback', 'file' => 'feedback', 'function' => 'public_cache'), array('name' => L('update_cache', '', 'admin'), 'function' => 'category_cache', 'target' => 'iframe', 'link' => 'app=admin&controller=category&action=public_cache&application=admin'), array('name' => L('cache_copyfrom'), 'function' => 'copyfrom'), array('name' => L('clear_files'), 'function' => 'del_file')); $this->cache_api = Loader::lib('admin:cache_api'); $m = $apps[$page]; if (isset($m['mod']) && $m['function']) { if ($m['file'] == '') { $m['file'] = $m['function']; } $APP = S('common/application'); if (in_array($m['mod'], array_keys($APP))) { $cache = Loader::lib($m['mod'] . ':' . $m['file']); $cache->{$m}['function'](); } } else { if (isset($m['target']) && $m['target'] == 'iframe') { $str = '<script type="text/javascript">window.parent.frames["hidden"].location="index.php?'; $str .= $m['link']; $str .= '";</script>'; echo $str; } else { $this->cache_api->cache($m['function'], isset($m['param']) ? $m['param'] : ''); } } $page++; if (!empty($apps[$page])) { echo '<script type="text/javascript">window.parent.addtext("<li>' . L('update') . $m['name'] . L('cache_file_success') . '..........</li>");</script>'; showmessage(L('update') . $m['name'] . L('cache_file_success'), U('admin/cache_all/init', array('page' => $page, 'dosubmit' => '1')), 0); } else { echo '<script type="text/javascript">window.parent.addtext("<li>' . L('update') . $m['name'] . L('site_cache_success') . '..........</li>")</script>'; showmessage(L('update') . $m['name'] . L('site_cache_success'), 'blank'); } } else { include $this->view('cache_all'); } }
/** * 用户登陆 * * @param string $username 用户名或邮箱 * @param string $password 密码 * @return array userid 大于 0:返回用户 ID,表示用户登录成功 -1:用户不存在,或者被删除 -2:密码错 * -3:安全提问错 -4 用户被锁定 */ public function login($username, $password) { $field = strpos($username, '@') ? 'email' : 'username'; // 判断是否是邮箱 $res = $this->get_user($username, $field); if (!$res) { return array('userid' => -1); // 用户不存在 } $pwd = password($password, $res['encrypt']); if ($res['password'] != $pwd) { return array('userid' => -2); // 密码错误 } $res['password'] = $pwd; if ($res['islock'] == 1) { return array('userid' => -4); // 用户被锁定 } if (ucenter_exists()) { // UCenter登录 $ucuid = Loader::lib('member:uc_client')->uc_user_login($username, $password); if ($ucuid < 0) { return array('userid' => $ucuid); } $res['synloginstr'] = Loader::lib('member:uc_client')->uc_user_synlogin($ucuid); } $updatearr = array('lastip' => IP, 'lastdate' => TIME); // 检查用户积分,更新新用户组,除去邮箱认证、禁止访问、游客组用户、vip用户 if ($res['point'] >= 0 && !in_array($res['groupid'], array('1', '2', '3')) && empty($res['vip'])) { $check_groupid = $this->_get_usergroup_bypoint($res['point']); if ($check_groupid != $res['groupid']) { $updatearr['groupid'] = $groupid = $check_groupid; } } $this->update($updatearr, array('userid' => $res['userid'])); return $res; }
/** * Enter 生成google sitemap, 百度新闻协议 */ public function set() { $hits_db = Loader::model('hits_model'); //$dosubmit = isset ( $_POST ['dosubmit'] ) ? $_POST ['dosubmit'] : $_GET ['dosubmit']; // 根据当前站点,取得文件存放路径 $systemconfig = C('system'); $html_root = substr($systemconfig['html_root'], 1); // 当前站点目录 $dir = BASE_PATH; // 模型缓存 $modelcache = S('common/model'); // 获取当前站点域名,下面生成URL时会用到. $this_domain = substr(SITE_URL, 0, strlen(SITE_URL) - 1); if (isset($_POST['dosubmit']) || isset($_GET['dosubmit'])) { //W ( 'common/googlesitemap', $_POST ); // 生成百度新闻 if (isset($_POST['mark'])) { $baidunum = $_POST['baidunum'] ? intval($_POST['baidunum']) : 20; if ($_POST['catids'] == "") { showmessage(L('choose_category'), HTTP_REFERER); } $catids = $_POST['catids']; $catid_cache = $this->categorys; // 栏目缓存 $this->content_db = Loader::model('content_model'); foreach ($catids as $catid) { $modelid = $catid_cache[$catid]['modelid']; // 根据栏目ID查出modelid // 进而确定表名,并结合栏目ID:catid // 检索出对应栏目下的新闻条数 $this->content_db->set_model($modelid); $result = $this->content_db->where(array('catid' => $catid, 'status' => 99))->limit("0,{$baidunum}")->order('id desc')->select(); // 重设表前缀,for循环时用来查,文章正文 $this->content_db->table_name = $this->content_db->table_name . '_data'; foreach ($result as $arr) { // 把每一条数据都装入数组中 //extract ( $arr ); if (!preg_match('/^(http|https):\\/\\//', $arr['url'])) { $arr['url'] = $this_domain . $arr['url']; } if ($arr['thumb'] != "") { if (!preg_match('/^(http|https):\\/\\//', $arr['thumb'])) { $arr['thumb'] = $this_domain . $arr['thumb']; } } // 取当前新闻模型 附属表 取 新闻正文 $arr['url'] = htmlspecialchars($arr['url']); $arr['description'] = htmlspecialchars(strip_tags($arr['description'])); // 根据本条ID,从对应tablename_data取出正文内容 $content_arr = $this->content_db->where(array('id' => $arr['id']))->field('content')->find(); $content = htmlspecialchars(strip_tags($content_arr['content'])); // 组合数据 $smi = $this->baidunews_item($arr['title'], $arr['url'], $arr['description'], $content, $arr['thumb'], $arr['keywords'], $catid_cache[$arr['catid']]['catname'], $arr['username'], isset($content_arr['copyfrom']) ? $content_arr['copyfrom'] : '', date('Y-m-d', $arr['inputtime'])); // 推荐文件 $this->add_baidunews_item($smi); } } $baidunews_file = $dir . 'baidunews.xml'; @mkdir($dir, 0777, true); $this->baidunews_build($baidunews_file, $this_domain, $_POST['email'], $_POST['time']); } // 生成网站地图 $content_priority = $_POST['content_priority']; $content_changefreq = $_POST['content_changefreq']; $num = isset($_POST['num']) ? intval($_POST['num']) : 100; $today = date('Y-m-d'); $domain = $this_domain; // 生成地图头部 -第一条 $smi = $this->google_sitemap_item($domain, $today, 'daily', '1.0'); $this->add_item2($smi); $this->content_db = Loader::model('content_model'); // 只提取该站点的模型.再循环取数据,生成站点地图. $modelcache = S('common/model'); $new_model = array(); foreach ($modelcache as $modelid => $mod) { $new_model[$modelid]['modelid'] = $modelid; $new_model[$modelid]['name'] = $mod['name']; } foreach ($new_model as $modelid => $m) { // 每个模块取出num条数据 $this->content_db->set_model($modelid); // 或者 // $this->conetnt_db->set_model($modelid); $result = $this->content_db->where(array('status' => 99))->order('inputtime desc')->limit("0,{$num}")->select(); foreach ($result as $arr) { if (substr($arr['url'], 0, 1) == '/') { $url = htmlspecialchars(strip_tags($domain . $arr['url'])); } else { $url = htmlspecialchars(strip_tags($arr['url'])); } $hit_r = $hits_db->where(array('hitsid' => 'c-' . $modelid . '-' . $arr['id']))->find(); if ($hit_r['views'] > 1000) { $content_priority = 0.9; } $smi = $this->google_sitemap_item($url, $today, $content_changefreq, $content_priority); // 推荐文件 $this->add_item2($smi); } } $sm_file = $dir . 'sitemaps.xml'; if ($this->build($sm_file)) { showmessage(L('create_success'), HTTP_REFERER); } } else { $tree = Loader::lib('Tree'); $tree->icon = array(' │ ', ' ├─ ', ' └─ '); $tree->nbsp = ' '; $categorys = array(); foreach ($this->categorys as $catid => $r) { if ($r['type']) { continue; } if (isset($modelid) && $modelid != $r['modelid']) { continue; } $r['disabled'] = $r['child'] ? 'disabled' : ''; $r['selected'] = 'selected'; // $this->setting['']; $categorys[$catid] = $r; } $str = "<option value='\$catid' \$selected \$disabled>\$spacer \$catname</option>"; $tree->init($categorys); $string = $tree->get_tree(0, $str); include $this->view('googlesitemap'); } }
<?php //Leaps Cache @ 2015-03-04 17:07:51 defined('LEAPS_VERSION') or exit('No permission resources.'); error_reporting(E_ERROR); $Head = S('common/common'); $CSS_PATH = SKIN_PATH . 'default/css/'; $IMG_PATH = SKIN_PATH . 'default/images/'; $JS_PATH = SKIN_PATH . 'default/js/'; ?> <div id="footer"> <?php if (defined('IN_ADMIN') && !defined('HTML')) { echo "<div class=\"admin_piao\" yun_action=\"content\" data=\"op=content&tag_md5=ce7ff2b1583eb026be4d387347410e01&do=category&catid=1&num=15&order=listorder+ASC\"><a href=\"javascript:void(0);\" class=\"admin_piao_edit\">编辑</a>"; } $content_tag = Loader::lib("content:content_tag"); if (method_exists($content_tag, 'category')) { $data = $content_tag->category(array('catid' => '1', 'order' => 'listorder ASC', 'limit' => '15')); } $n = 1; if (is_array($data)) { foreach ($data as $r) { ?> <a href="<?php echo $r['url']; ?> " target="_blank"><?php echo $r['catname']; ?> </a> | <?php
/** * 修改财务 */ public function modify_deposit() { if (isset($_POST['dosubmit'])) { $username = isset($_POST['username']) && trim($_POST['username']) ? trim($_POST['username']) : showmessage(L('username') . L('error')); $usernote = isset($_POST['usernote']) && trim($_POST['usernote']) ? addslashes(trim($_POST['usernote'])) : showmessage(L('usernote') . L('error')); $userinfo = $this->get_useid($username); if ($userinfo) { // 如果增加金钱或点数,想pay_account 中记录数据 if ($_POST['pay_unit']) { $value = floatval($_POST['unit']); $payment = L('admin_recharge'); $receipts = Loader::lib('pay:receipts'); $func = $_POST['pay_type'] == '1' ? 'amount' : 'point'; $receipts->{$func}($value, $userinfo['userid'], $username, create_sn(), 'offline', $payment, cookie('admin_username'), $status = 'succ', $usernote); } else { $value = floatval($_POST['unit']); $msg = L('background_operation') . $usernote; $spend = Loader::lib('pay:spend'); $func = $_POST['pay_type'] == '1' ? 'amount' : 'point'; $spend->{$func}($value, $msg, $userinfo['userid'], $username, cookie('userid'), cookie('admin_username')); } if (intval($_POST['sendemail'])) { $op = $_POST['pay_unit'] ? $value : '-' . $value; $op = $_POST['pay_type'] ? $op . L('yuan') : $op . L('point'); $msg = L('account_changes_notice_tips', array('username' => $username, 'time' => date('Y-m-d H:i:s', TIME), 'op' => $op, 'note' => $usernote, 'amount' => $userinfo['amount'], 'point' => $userinfo['point'])); sendmail($userinfo['email'], L('send_account_changes_notice'), $msg); } showmessage(L('public_discount_succ'), HTTP_REFERER); } } else { $show_validator = true; include $this->view('modify_deposit'); } }
/** * 删除附件 */ public function swfdelete() { $attachment = Loader::lib('Attachment'); $att_del_arr = explode('|', $_GET['data']); foreach ($att_del_arr as $n => $att) { if ($att) { $attachment->where(array('aid' => $att, 'userid' => $this->userid, 'uploadip' => IP))->delete(); } } }
<?php if (defined('IN_ADMIN') && !defined('HTML')) { echo '</div>'; } ?> </div> </div> <div class="bk10"></div> <div class="box"> <h5 class="title-2">链接要求</h5> <div class="tag_a pad-lr-10"> <?php if (defined('IN_ADMIN') && !defined('HTML')) { echo "<div class=\"admin_piao\" yun_action=\"block\" data=\"op=block&tag_md5=f0b69d8366d7f8c1d7a0f92ba649dee7&pos=1\"><a href=\"javascript:void(0);\" class=\"admin_piao_edit\">添加碎片</a>"; } $block_tag = Loader::lib('block:block_tag'); echo $block_tag->yun_tag(array('pos' => '1')); ?> <?php if (defined('IN_ADMIN') && !defined('HTML')) { echo '</div>'; } ?> </div> </div> </div>
public function __construct() { $this->special_api = Loader::lib('special:special_api'); }
/** * 检查支付状态 */ protected function _check_payment($flag, $paytype) { $_userid = $this->_userid; $_username = $this->_username; if (!$_userid) { return false; } Loader::lib('pay:spend'); $setting = $this->category_setting; $repeatchargedays = intval($setting['repeatchargedays']); if ($repeatchargedays) { $fromtime = TIME - 86400 * $repeatchargedays; $r = spend::spend_time($_userid, $fromtime, $flag); if ($r['id']) { return true; } } return false; }
/** * 测试文章URL采集 */ public function public_test() { $nodeid = isset($_GET['nodeid']) ? intval($_GET['nodeid']) : showmessage(L('illegal_parameters'), HTTP_REFERER); if ($data = $this->db->getby_nodeid($nodeid)) { Loader::lib('collection:collection', false); $urls = collection::url_list($data, 1); if (!empty($urls)) { foreach ($urls as $v) { $url = collection::get_url_lists($v, $data); } } $show_header = $show_dialog = true; include $this->view('public_test'); } else { showmessage(L('notfound')); } }
/** * 关键词搜索 */ public function init() { G('begin_time'); // 搜索配置 $setting = S('search/search'); $search_model = S('search/search_model'); $type_application = S('search/type_application'); if (isset($_GET['q'])) { if (trim($_GET['q']) == '') { header('Location: ' . SITE_URL . 'index.php?app=search'); exit; } $typeid = isset($_GET['typeid']) && $_GET['typeid'] > 0 ? intval($_GET['typeid']) : 1; $time = empty($_GET['time']) ? 'all' : trim($_GET['time']); $page = isset($_GET['page']) ? intval($_GET['page']) : 1; $pagesize = 10; $q = safe_replace(trim($_GET['q'])); $q = htmlspecialchars(strip_tags($q)); $q = str_replace('%', '', $q); // 过滤'%',用户全文搜索 $search_q = $q; // 搜索原内容 // 按时间搜索 $where = array(); if ($time == 'day') { $search_time = TIME - 86400; $where['adddate'] = array('gt', $search_time); } elseif ($time == 'week') { $search_time = TIME - 604800; $where['adddate'] = array('gt', $search_time); } elseif ($time == 'month') { $search_time = TIME - 2592000; $where['adddate'] = array('gt', $search_time); } elseif ($time == 'year') { $search_time = TIME - 31536000; $where['adddate'] = array('gt', $search_time); } else { $search_time = 0; } if ($page == 1 && !$setting['sphinxenable']) { // 精确搜索 if ($typeid != 0) { $where['typeid'] = $typeid; } $where['data'] = array('like', "%{$q}%"); $commend = $this->db->where($where)->find(); } else { $commend = ''; } // 如果开启sphinx if ($setting['sphinxenable']) { $sphinx = Loader::lib('search:search_interface', '', 0); $sphinx = new search_interface(); $offset = $pagesize * ($page - 1); $res = $sphinx->search($q, array($typeid), array($search_time, TIME), $offset, $pagesize, '@weight desc'); $totalnums = $res['total']; // 如果结果不为空 if (!empty($res['matches'])) { $result = $res['matches']; } } else { $segment = Loader::lib('Segment'); // 分词结果 $segment_q = $segment->get_keyword($segment->split_result($q)); // 如果分词结果为空 if (!empty($segment_q)) { $sql = array(); $sql['typeid'] = $typeid; $sql = array_merge($where, $sql); $sql = $this->db->where($sql)->to_sql(); $sql = "{$sql} AND MATCH (`data`) AGAINST ('{$segment_q}' IN BOOLEAN MODE)"; } else { $sql = array(); $sql['typeid'] = $typeid; $sql = array_merge($where, $sql); $sql['data'] = array('like', "%{$q}%"); } $result = $this->db->where($where)->order('searchid DESC')->listinfo($page, 10); } // 如果开启相关搜索功能 if ($setting['relationenble']) { // 如果关键词长度在8-16之间,保存关键词作为relation search $this->keyword_db = loader::model('search_keyword_model'); if (strlen($q) < 17 && strlen($q) > 5 && !empty($segment_q)) { $res = $this->keyword_db->where(array('keyword' => $q))->find(); if ($res) { // 关键词搜索数+1 $this->keyword_db->where(array('keyword' => $q))->update(array('searchnums' => '+=1')); } else { // 关键词转换为拼音 $pinyin = string_to_pinyin($q); $this->keyword_db->insert(array('keyword' => $q, 'searchnums' => 1, 'data' => $segment_q, 'pinyin' => $pinyin)); } } // 相关搜索 if (!empty($segment_q)) { $relation_q = str_replace(' ', '%', $segment_q); } else { $relation_q = $q; } $relation = $this->keyword_db->where("MATCH (`data`) AGAINST ('%{$relation_q}%' IN BOOLEAN MODE)")->order('searchnums DESC')->limit(10)->select(); } // 如果结果不为空 if (!empty($result) || !empty($commend['id'])) { // 开启sphinx后文章id取法不同 if ($setting['sphinxenable']) { foreach ($result as $_v) { $sids[] = $_v['attrs']['id']; } } else { foreach ($result as $_v) { $sids[] = $_v['id']; } } if (!empty($commend['id'])) { $sids[] = $commend['id']; } $sids = array_unique($sids); $ids = implode(',', $sids); $where = array('id' => array('in', $ids)); // 获取模型id $model_type_cache = S('search/type_model'); $model_type_cache = array_flip($model_type_cache); $modelid = $model_type_cache[$typeid]; // 是否读取其他模块接口 if ($modelid) { $this->content_db->set_model($modelid); if ($setting['sphinxenable']) { $data = $this->content_db->where($where)->order('id DESC')->listinfo(1, $pagesize); $pages = Page::pages($totalnums, $page, $pagesize); } else { $data = $this->content_db->where($where)->select(); $pages = $this->db->pages; $totalnums = $this->db->number; } // 如果分词结果为空 if (!empty($segment_q)) { $replace = explode(' ', $segment_q); foreach ($replace as $replace_arr_v) { $replace_arr[] = '<font color=red>' . $replace_arr_v . '</font>'; } foreach ($data as $_k => $_v) { $data[$_k]['title'] = str_replace($replace, $replace_arr, $_v['title']); $data[$_k]['description'] = str_replace($replace, $replace_arr, $_v['description']); } } else { foreach ($data as $_k => $_v) { $data[$_k]['title'] = str_replace($q, '<font color=red>' . $q . '</font>', $_v['title']); $data[$_k]['description'] = str_replace($q, '<font color=red>' . $q . '</font>', $_v['description']); } } } else { // 读取专辑搜索接口 $special_api = Loader::lib('special:search_api'); $data = $special_api->get_search_data($sids); } } G('search_time'); $pages = isset($pages) ? $pages : ''; $totalnums = isset($totalnums) ? $totalnums : 0; $data = isset($data) ? $data : ''; $execute_time = G('begin_time', 'search_time'); include template('search', 'list'); } else { include template('search', 'index'); } }
/** * 获取用户头像 * * @param $uid 默认为userid * @param $size 头像大小有四种[30x30 45x45 90x90 180x180] 默认30 */ function get_memberavatar($userid, $size = '30') { $memberinfo = Loader::model('member_model')->getby_userid($userid); if (!$memberinfo) { return false; } if (ucenter_exists() && isset($memberinfo['ucenterid'])) { $avatar = Loader::lib('member:uc_client')->uc_get_avatar($memberinfo['ucenterid']); } else { if (!$memberinfo['avatar']) { return false; } $dir1 = ceil($userid / 10000); $dir2 = ceil($userid % 10000 / 1000); $url = C('attachment', 'avatar_url') . $dir1 . '/' . $dir2 . '/' . $userid . '/'; $avatar = array('180' => $url . '180x180.jpg', '90' => $url . '90x90.jpg', '45' => $url . '45x45.jpg', '30' => $url . '30x30.jpg'); } if (isset($avatar) && !$size) { return $avatar; } else { if (isset($avatar[$size])) { return $avatar[$size]; } else { return false; } } }
* @version $Id: Chinabank.php 672 2013-07-30 03:31:18Z 85825770@qq.com $ */ if (isset($set_modules) && $set_modules == TRUE) { $i = isset($modules) ? count($modules) : 0; $modules[$i]['code'] = basename(__FILE__, '.php'); $modules[$i]['name'] = L('chinabank', '', 'pay'); $modules[$i]['desc'] = L('chinabank_tip', '', 'pay'); $modules[$i]['is_cod'] = '0'; $modules[$i]['is_online'] = '1'; $modules[$i]['author'] = 'YUNCMS开发团队'; $modules[$i]['website'] = 'http://www.chinabank.com.cn'; $modules[$i]['version'] = '1.0.0'; $modules[$i]['config'] = array(array('name' => 'chinabank_account', 'type' => 'text', 'value' => ''), array('name' => 'chinabank_key', 'type' => 'text', 'value' => '')); return; } Loader::lib('pay:pay_abstract', false); class Chinabank extends paymentabstract { public function __construct($config = array()) { if (!empty($config)) { $this->set_config($config); } $this->config['gateway_url'] = 'https://pay3.chinabank.com.cn/PayGate'; $this->config['gateway_method'] = 'POST'; $this->config['return_url'] = return_url('chinabank'); Loader::func('pay:alipay'); } public function getpreparedata() { $prepare_data['v_mid'] = $this->config['chinabank_account'];