Пример #1
0
 /**
 * 根据传递来的用户名, 更新用户数据
 		settingUpdate:修改个人设置权限
 */
 function onsetting_update()
 {
     $hasSettingUpdatePrivilege = $_ENV['menu']->checkPermission($this->ask_login_name, $_SERVER['QUERY_STRING'], "settingUpdate");
     if ($hasSettingUpdatePrivilege['return']) {
         $message = '';
         $img_type = array('image/pjpeg', 'image/x-png', 'image/png', 'image/gif', 'image/jpeg');
         if ($_FILES['photo']['tmp_name'] != '' && is_uploaded_file($_FILES['photo']['tmp_name'])) {
             if (!in_array($_FILES['photo']['type'], $img_type)) {
                 $message .= '对不起,只支持png,jpeg,gif格式的图片';
             }
             if ($_FILES['photo']['size'] > 64 * 1024) {
                 $message .= ' ;图片尺寸不能大于64k';
             }
             $photo = addslashes(file_get_contents($_FILES['photo']['tmp_name']));
         }
         if ($message != '') {
             $this->onsetting($message, 'errormsg');
         } else {
             $qq = $this->post['QQ'];
             $mobile = $this->post['mobile'];
             $weixin = $this->post['weixin'];
             $tel = $this->post['tel'];
             $_ENV['operator']->update($this->post['slogan'], $photo, $this->post['jobnumber'], $this->post['login_name'], $qq, $mobile, $weixin, $tel);
             $this->onsetting('更新成功');
         }
     } else {
         $hasSettingUpdatePrivilege['url'] = "?admin_setting/setting";
         __msg($hasSettingUpdatePrivilege);
     }
 }
Пример #2
0
 function onlogView($msg = '', $ty = '')
 {
     $action = "index.php?admin_log/logView";
     $hasLogViewPrivilege = $_ENV['menu']->checkPermission($this->ask_login_name, $_SERVER['QUERY_STRING'], "logView");
     $hasLogViewPrivilege['url'] = "?admin_main";
     $hasLogViewPrivilege['return'] = true;
     !$hasLogViewPrivilege['return'] && __msg($hasLogViewPrivilege);
     $LogTypeList = $this->ask_config->getLogType();
     $operator_list = $_ENV['operator']->getList(0, 0);
     $ConditionList['StartDate'] = isset($this->post['StartDate']) ? $this->post['StartDate'] : (isset($this->get[2]) ? $this->get[2] : date("Y-m-d", time()));
     $ConditionList['EndDate'] = isset($this->post['EndDate']) ? $this->post['EndDate'] : (isset($this->get[3]) ? $this->get[3] : date("Y-m-d", time()));
     $ConditionList['EndDate'] = min($ConditionList['EndDate'], date("Y-m-d", time()), date("Y-m-t", strtotime($ConditionList['StartDate'])));
     $ConditionList['operatorId'] = isset($this->post['operatorId']) ? intval(urldecode($this->post['operatorId'])) : (isset($this->get[4]) ? intval(urldecode($this->get[4])) : 0);
     $ConditionList['operator'] = !in_array($ConditionList['operatorId'], array(-2, -1, 0)) ? $operator_list[$ConditionList['operatorId']]['login_name'] : $ConditionList['operatorId'];
     $ConditionList['QuestionId'] = isset($this->post['QuestionId']) ? intval($this->post['QuestionId']) : (isset($this->get[5]) ? intval($this->get[5]) : 0);
     $ConditionList['log_type_id'] = isset($this->post['log_type_id']) ? intval(urldecode($this->post['log_type_id'])) : (isset($this->get[6]) ? intval(urldecode($this->get[6])) : 0);
     $ConditionList['AuthorName'] = isset($this->post['AuthorName']) ? trim(urldecode($this->post['AuthorName'])) : (isset($this->get[7]) ? trim(urldecode($this->get[7])) : '');
     $ConditionList['log_type'] = $ConditionList['log_type_id'] ? $LogTypeList[$ConditionList['log_type_id']] : $ConditionList['log_type_id'];
     @($page = max(1, intval($this->get[8])));
     $export = trim($this->get[9]) == "export" ? 1 : 0;
     $setting = $this->setting;
     if (!$export) {
         $pagesize = $this->setting['list_default'];
         $pagesize = 20;
         $log_list = $_ENV['log']->getLogList($ConditionList, $page, $pagesize);
         $departstr = page($log_list['LogCount'], $pagesize, $page, "admin_log/logView/" . $ConditionList['StartDate'] . "/" . $ConditionList['EndDate'] . "/" . urlencode($ConditionList['operatorId']) . "/" . $ConditionList['QuestionId'] . "/" . $ConditionList['log_type_id'] . "/" . urlencode($ConditionList['AuthorName']));
         $downloadstr = page_url("<下载EXCEL表格>", "admin_log/logView/" . $ConditionList['StartDate'] . "/" . $ConditionList['EndDate'] . "/" . urlencode($ConditionList['operatorId']) . "/" . $ConditionList['QuestionId'] . "/" . $ConditionList['log_type_id'] . "/" . urlencode($ConditionList['AuthorName']) . "/" . $page . "/export");
         $msg && ($message = $msg);
         $ty && ($type = $ty);
     } else {
         set_time_limit(0);
         $page = 1;
         $pagesize = 1000;
         $num = 1;
         require TIPASK_ROOT . '/lib/Excel.php';
         $oExcel = new Excel();
         $FileName = '操作日志表';
         $oExcel->download($FileName)->addSheet('日志表');
         //标题栏
         $title = array("日志ID", "对应问题ID", "用户名", "操作人", "操作时间", "日志内容");
         $oExcel->addRows(array($title));
         while ($num > 0) {
             $log_list = $_ENV['log']->getLogList($ConditionList, $page, $pagesize);
             foreach ($log_list['LogList'] as $key => $value) {
                 $value['message'] = htmlspecialchars_decode($value['message']);
                 $log_list['LogList'][$key]['message'] = preg_replace("/<(.*?)>/", "", $value['message']);
                 $excelArr = array("id" => $log_list['LogList'][$key]['id'], "qid" => $log_list['LogList'][$key]['qid'], "AuthorName" => $log_list['LogList'][$key]['AuthorName'], "user" => $log_list['LogList'][$key]['user'], "time" => date("Y-m-d H:i:s", $log_list['LogList'][$key]['time']), "message" => $log_list['LogList'][$key]['message']);
                 $oExcel->addRows(array($excelArr));
             }
             $page++;
             $num = count($order_list['OrderList']);
         }
         $oExcel->closeSheet()->close();
     }
     include template('logview', 'admin');
 }
Пример #3
0
 function onmyInitiateHelp($msg = '', $ty = '')
 {
     $hasIntoMyInitiateHelpPrivilege = $_ENV['menu']->checkPermission($this->ask_login_name, $_SERVER['QUERY_STRING'], "intoMyInitiateHelp");
     $hasIntoMyInitiateHelpPrivilege['url'] = "?admin_main";
     !$hasIntoMyInitiateHelpPrivilege['return'] && __msg($hasIntoMyInitiateHelpPrivilege);
     $login_name = isset($this->ask_login_name) ? trim($this->ask_login_name) : exit('<h2>非法登录<h2>');
     $start = isset($this->post['start_time']) && false != strtotime($this->post['start_time']) ? strtotime($this->post['start_time']) : (isset($this->get[2]) ? $this->get[2] : $_ENV['question']->_getSETime(1));
     $end_time = isset($this->post['end_time']) && false != strtotime($this->post['end_time']) ? strtotime('+1 day', strtotime($this->post['end_time'])) - 1 : (isset($this->get[3]) ? $this->get[3] : $_ENV['question']->_getSETime(2));
     $status = isset($this->post['status']) ? intval($this->post['status']) : (isset($this->get[4]) ? intval($this->get[4]) : -1);
     $qid = isset($this->post['qid']) && $this->post['qid'] ? intval($this->post['qid']) : (isset($this->get[5]) && $this->get[5] != '' ? intval($this->get[5]) : '');
     $overdue = isset($this->post['overdue']) ? intval($this->post['overdue']) : (isset($this->get[6]) ? intval($this->get[6]) : -1);
     $where_search = $_ENV['help']->get_hwhere($start, $end_time, $status, $qid, $overdue, $login_name, $type = 2);
     @($page = max(1, intval($this->get[8])));
     $pagesize = $this->setting['list_default'];
     $startindex = ($page - 1) * $pagesize;
     $rownum = $_ENV['help']->get_hnum($where_search);
     $helplist = $_ENV['help']->get_hlist($startindex, $pagesize, $where_search);
     $helpstr = page($rownum, $pagesize, $page, "admin_question/myInitiateHelp/{$start}/{$end_time}/{$status}/{$qid}/{$overdue}/{$login_name}");
     $isOverdue = $this->ask_config->getOverdue();
     $helpStatus = $this->ask_config->helpStatus();
     $msg && ($message = $msg);
     $ty && ($type = $ty);
     include template('my_initiate_help', 'admin');
 }
Пример #4
0
 function onqtype_add()
 {
     $backReturn = array();
     // 是否有主分类修改/添加权限updateQtype
     $hasAddQtypePrivilege = $_ENV['menu']->checkPermission($this->ask_login_name, $_SERVER['QUERY_STRING'], "updateQtype");
     if ($hasAddQtypePrivilege['return']) {
         if (isset($this->post['submit_add'])) {
             $id = !empty($this->post['id']) ? $this->post['id'] : 0;
             if ($id) {
                 $qtypeInfo = $_ENV['qtype']->GetQType($id);
                 $qtypeInfo['name'] = trim($this->post['name']);
                 $qtypeInfo['complain_type_id'] = intval($this->post['complain_type_id']);
                 $qtypeInfo['complain'] = unserialize($qtypeInfo['complain']);
                 $qtypeInfo['complain']['manager_name'] = trim($this->post['complain']['manager_name']);
                 //$qtypeInfo['complain']['icon'] = trim($this->post['complain']['icon']);
                 $qtypeInfo['complain']['visiable'] = trim($this->post['complain']['visiable']);
                 //$qtypeInfo['complain'] = serialize($qtypeInfo['complain']);
                 $qtypeInfo['visiable'] = trim($this->post['visiable']);
                 $qtypeInfo['pid'] = intval($this->post['pid']);
                 $qtypeInfo['displayOrder'] = intval($this->post['displayOrder']);
                 $qtypeInfo['faq'] = unserialize($qtypeInfo['faq']);
                 $qtypeInfo['faq']['visiable'] = intval($this->post['faq']['visiable']);
                 $qtypeInfo['faq'] = serialize($qtypeInfo['faq']);
                 $qtypeInfo['trading'] = unserialize($qtypeInfo['trading']);
                 $qtypeInfo['trading']['ServiceType'] = intval($this->post['trading']['ServiceType']);
                 $qtypeInfo['trading']['sellingOrderUrl'] = trim($this->post['trading']['sellingOrderUrl']);
                 $qtypeInfo['trading']['buyerOrderUrl'] = trim($this->post['trading']['buyerOrderUrl']);
                 $qtypeInfo['trading']['sellerOrderUrl'] = trim($this->post['trading']['sellerOrderUrl']);
                 $qtypeInfo['trading']['checkOrderUrl'] = trim($this->post['trading']['checkOrderUrl']);
                 $qtypeInfo['trading']['directOrderUrl'] = trim($this->post['trading']['directOrderUrl']);
                 $qtypeInfo['trading']['directPostOrderUrl'] = trim($this->post['trading']['directPostOrderUrl']);
                 $qtypeInfo['trading'] = serialize($qtypeInfo['trading']);
                 if (!empty($_FILES['managerphoto']['name'])) {
                     @(require TIPASK_ROOT . '/api/FastDFSClient/FastDFSClient.php');
                     $FastDFSClient = new FastDFSClient();
                     $FastDFSClient->maxSize = 4194304;
                     // 设置附件上传大小 默认为4M
                     $FastDFSClient->allowExts = array('gif', 'jpg', 'jpeg', 'bmp', 'png');
                     // 设置附件上传类型
                     $FastDFSClient->savePath = TIPASK_ROOT . '/data/attach/' . gmdate('ym', $this->time) . '/';
                     // 设置附件上传目录
                     $FastDFSInfo = $FastDFSClient->upload("sk");
                     $qtypeInfo['complain']['icon'] = $FastDFSInfo != -1 ? $FastDFSInfo : '';
                 }
                 $qtypeInfo['complain'] = serialize($qtypeInfo['complain']);
                 unset($qtypeInfo['id']);
                 $update = $_ENV['qtype']->updateQtype($id, $qtypeInfo);
                 $qtypeList = $_ENV['qtype']->GetAllQType(1, "", 0);
                 $this->cache->set('qtype_list', json_encode($qtypeList), 30 * 60);
                 //缓存60秒
                 $this->onqtype("主分类修改成功!");
             } else {
                 $qtypeInfo['name'] = trim($this->post['name']);
                 $qtypeInfo['complain_type_id'] = intval($this->post['complain_type_id']);
                 $qtypeInfo['complain']['manager_name'] = trim($this->post['complain']['manager_name']);
                 //$qtypeInfo['complain']['icon'] = trim($this->post['complain']['icon']);
                 $qtypeInfo['complain']['visiable'] = trim($this->post['complain']['visiable']);
                 //$qtypeInfo['complain'] = serialize($qtypeInfo['complain']);
                 $qtypeInfo['visiable'] = trim($this->post['visiable']);
                 $qtypeInfo['pid'] = intval($this->post['pid']);
                 $qtypeInfo['displayOrder'] = intval($this->post['displayOrder']);
                 $qtypeInfo['faq']['visiable'] = intval($this->post['faq']['visiable']);
                 $qtypeInfo['faq'] = serialize($qtypeInfo['faq']);
                 $qtypeInfo['trading']['ServiceType'] = intval($this->post['trading']['ServiceType']);
                 $qtypeInfo['trading']['sellingOrderUrl'] = trim($this->post['trading']['sellingOrderUrl']);
                 $qtypeInfo['trading']['buyerOrderUrl'] = trim($this->post['trading']['buyerOrderUrl']);
                 $qtypeInfo['trading']['sellerOrderUrl'] = trim($this->post['trading']['sellerOrderUrl']);
                 $qtypeInfo['trading']['checkOrderUrl'] = trim($this->post['trading']['checkOrderUrl']);
                 $qtypeInfo['trading']['directOrderUrl'] = trim($this->post['trading']['directOrderUrl']);
                 $qtypeInfo['trading']['directPostOrderUrl'] = trim($this->post['trading']['directPostOrderUrl']);
                 $qtypeInfo['trading'] = serialize($qtypeInfo['trading']);
                 if (!empty($_FILES['managerphoto']['name'])) {
                     @(require TIPASK_ROOT . '/api/FastDFSClient/FastDFSClient.php');
                     $FastDFSClient = new FastDFSClient();
                     $FastDFSClient->maxSize = 4194304;
                     // 设置附件上传大小 默认为4M
                     $FastDFSClient->allowExts = array('gif', 'jpg', 'jpeg', 'bmp', 'png');
                     // 设置附件上传类型
                     $FastDFSClient->savePath = TIPASK_ROOT . '/data/attach/' . gmdate('ym', $this->time) . '/';
                     // 设置附件上传目录
                     $FastDFSInfo = $FastDFSClient->upload("sk");
                 }
                 $qtypeInfo['complain']['icon'] = $FastDFSInfo != -1 ? $FastDFSInfo : '';
                 $qtypeInfo['complain'] = serialize($qtypeInfo['complain']);
                 $insert = $_ENV['qtype']->insertQtype($qtypeInfo);
                 $qtypeList = $_ENV['qtype']->GetAllQType(1, "", 0);
                 $this->cache->set('qtype_list', json_encode($qtypeList), 30 * 60);
                 //缓存60秒
                 $this->onqtype("主分类修改成功!");
             }
         }
     } else {
         $hasAddQtypePrivilege['url'] = "?admin_qtype/qtype";
         __msg($hasAddQtypePrivilege);
     }
 }
function wpdm_block_dllink($package)
{
    global $wpdb, $current_user, $wpdm_download_button_class;
    $uroles = array_keys($current_user->caps);
    $urole = array_shift($uroles);
    get_currentuserinfo();
    $users = maybe_unserialize(get_post_meta($package['ID'], '__wpdm_user_access', true));
    if (!isset($package['access'])) {
        $package['access'] = array();
    }
    if (!$users || is_user_logged_in() && in_array($current_user->roles[0], $package['access']) || in_array('guest', $package['access'])) {
        return $package;
    }
    if (is_user_logged_in() && in_array($current_user->user_login, $users)) {
        $dkey = is_array($package['files']) ? md5(serialize($package['files'])) : md5($package['files']);
        $package['access'] = array('guest');
        $package['download_url'] = wpdm_download_url($package, '');
        if (wpdm_is_download_limit_exceed($package['ID'])) {
            $package['download_url'] = '#';
            $package['link_label'] = __msg('DOWNLOAD_LIMIT_EXCEED');
        }
        $package['download_link'] = $package['download_link_extended'] = "<a class='wpdm-download-link {$wpdm_download_button_class}' rel='noindex nofollow' href='{$package['download_url']}'>{$package['link_label']}</a>";
        return $package;
    } else {
        $package['download_url'] = "#";
        $package['access'] = array();
        $package['download_link'] = $package['download_link_extended'] = stripslashes(get_option('wpdm_permission_msg'));
        if (get_option('_wpdm_hide_all', 0) == 1) {
            $package['download_link'] = $package['download_link_extended'] = 'blocked';
        }
    }
    return $package;
}
Пример #6
0
 function onbindLogView($msg = '', $ty = '')
 {
     $action = "index.php?admin_binding/bindLogView";
     $hasOrderLogViewPrivilege = $_ENV['menu']->checkPermission($this->ask_login_name, $_SERVER['QUERY_STRING'], "bindLogView");
     $hasOrderLogViewPrivilege['url'] = "?admin_main";
     !$hasOrderLogViewPrivilege['return'] && __msg($hasOrderLogViewPrivilege);
     $ConditionList['StartDate'] = isset($this->post['StartDate']) ? $this->post['StartDate'] : (isset($this->get[2]) ? $this->get[2] : date("Y-m-d", time()));
     $ConditionList['EndDate'] = isset($this->post['EndDate']) ? $this->post['EndDate'] : (isset($this->get[3]) ? $this->get[3] : date("Y-m-d", time()));
     $ConditionList['author'] = isset($this->post['author']) ? trim(urldecode($this->post['author'])) : (isset($this->get[4]) ? trim(urldecode($this->get[4])) : "");
     $ConditionList['EndDate'] = min($ConditionList['EndDate'], date("Y-m-d", time()), date("Y-m-t", strtotime($ConditionList['StartDate'])));
     $OperatorInfo = $_ENV['operator']->getByColumn("login_name", urldecode($this->ask_login_name));
     $ConditionList['operator_loginId'] = isset($this->post['operator_loginId']) ? trim(urldecode($this->post['operator_loginId'])) : (isset($this->get[5]) ? trim(urldecode($this->get[5])) : "");
     if ($ConditionList['operator_loginId'] != "") {
         $OperatorInfo = $_ENV['operator']->getByColumn("login_name", urldecode($ConditionList['operator_loginId']));
         if ($OperatorInfo['id']) {
             $ConditionList['scopid'] = $OperatorInfo['id'];
         } else {
             $ConditionList['operator_loginId'] = "";
         }
     }
     $ConditionList['bid'] = isset($this->post['bid']) ? trim($this->post['bid']) : (isset($this->get[6]) ? trim($this->get[6]) : 'all');
     $BindTypeList = $this->ask_config->getBindOperateType();
     @($page = max(1, intval($this->get[7])));
     $export = trim($this->get[8]) == "export" ? 1 : 0;
     $setting = $this->setting;
     if (!$export) {
         $pagesize = $this->setting['list_default'];
         $pagesize = 20;
         $bind_log_list = $_ENV['bind_log']->getBindLogList($ConditionList, $page, $pagesize);
         foreach ($bind_log_list['BindLogList'] as $key => $value) {
             if (!isset($OperatorList[$value['scopid']])) {
                 $OperatorList[$value['scid']] = $_ENV['operator']->get($value['scid']);
             }
             $bind_log_list['BindLogList'][$key]['login_name'] = $OperatorList[$value['scid']]['login_name'];
             $bind_log_list['BindLogList'][$key]['bind_type'] = $BindTypeList[$value['bind_type']];
         }
         $departstr = page($bind_log_list['BindLogCount'], $pagesize, $page, "admin_binding/bindLogView/" . $ConditionList['StartDate'] . "/" . $ConditionList['EndDate'] . "/" . urlencode($ConditionList['author']) . "/" . urlencode($ConditionList['operator_loginId']) . "/" . $ConditionList['bid']);
         $downloadstr = page_url("<下载EXCEL表格>", "admin_binding/bindLogView/" . $ConditionList['StartDate'] . "/" . $ConditionList['EndDate'] . "/" . urlencode($ConditionList['author']) . "/" . urlencode($ConditionList['operator_loginId']) . "/" . $ConditionList['bid'] . "/" . $page . "/export");
         $msg && ($message = $msg);
         $ty && ($type = $ty);
     } else {
         set_time_limit(0);
         $page = 1;
         $pagesize = 1000;
         $num = 1;
         require TIPASK_ROOT . '/lib/Excel.php';
         $oExcel = new Excel();
         $FileName = '专属客服绑定记录表';
         $oExcel->download($FileName)->addSheet('绑定记录表');
         //标题栏
         $title = array("客服账号", "被绑定用户帐号", "操作类型", "操作时间");
         $oExcel->addRows(array($title));
         while ($num > 0) {
             $bind_log_list = $_ENV['bind_log']->getBindLogList($ConditionList, $page, $pagesize);
             foreach ($bind_log_list['BindLogList'] as $key => $value) {
                 if (!isset($OperatorList[$value['scopid']])) {
                     $OperatorList[$value['scid']] = $_ENV['operator']->get($value['scid']);
                 }
                 $bind_log_list['BindLogList'][$key]['login_name'] = $OperatorList[$value['scid']]['login_name'];
                 $bind_log_list['BindLogList'][$key]['bind_type'] = $BindTypeList[$value['bind_type']];
                 $excelArr = array("login_name" => $bind_log_list['BindLogList'][$key]['login_name'], "author" => $bind_log_list['BindLogList'][$key]['author'], "bind_type" => $bind_log_list['BindLogList'][$key]['bind_type'], "time" => date("Y-m-d H:i:s", $bind_log_list['BindLogList'][$key]['time']));
                 $oExcel->addRows(array($excelArr));
             }
             $page++;
             $num = count($bind_log_list['BindLogList']);
         }
         $oExcel->closeSheet()->close();
     }
     include template('bindLogview', 'admin');
 }
Пример #7
0
 function onmessage()
 {
     $hasIntoMessagePrivilege = $_ENV['menu']->checkPermission($this->ask_login_name, $_SERVER['QUERY_STRING'], "intoMessage");
     $hasUpdateMessagePrivilege = $_ENV['menu']->checkPermission($this->ask_login_name, $_SERVER['QUERY_STRING'], "message");
     if ($hasIntoMessagePrivilege['return']) {
         $set_array = array();
         if (isset($this->post['submit'])) {
             $msg_switch = $this->post['msg_switch'];
             $set_array['msg_switch_off'] = intval($msg_switch);
             $msg = $this->post['msg_content'];
             !empty($msg) ? $set_array['msg_content'] = $msg : ($message = '短信内容不能为空');
             if ($message == '') {
                 // 是否有短信配置权限
                 if ($hasUpdateMessagePrivilege['return']) {
                     $_ENV['setting']->update($set_array);
                     $message = '数据更新成功';
                 } else {
                     $hasUpdateMessagePrivilege['url'] = "?admin_config/message";
                     __msg($hasUpdateMessagePrivilege);
                 }
             } else {
                 $message .= ',数据更新失败';
                 $type = 'errormsg';
             }
         }
         $setting = $this->setting = $this->cache->load('setting');
         include template('message', 'admin');
     } else {
         $hasIntoMessagePrivilege['url'] = "?admin_main";
         __msg($hasIntoMessagePrivilege);
     }
 }
Пример #8
0
 function onQcontent_del()
 {
     $backReturn = array();
     // 是否有快速回复删除权限deleteQcontent
     $hasDelQcontentPrivilege = $_ENV['menu']->checkPermission($this->ask_login_name, $_SERVER['QUERY_STRING'], "deleteQcontent");
     if ($hasDelQcontentPrivilege['return']) {
         $id = !empty($this->get[2]) ? $this->get[2] : 0;
         if ($id) {
             $SubList = $_ENV['qcontent']->GetSubList($id);
             if (count($SubList) == 0) {
                 $delete = $_ENV['qcontent']->deleteQcontent($id);
                 if ($delete) {
                     $this->onQcontent("快速回复删除成功!");
                 } else {
                     $this->onQcontent("快速回复删除失败!");
                 }
             } else {
                 $this->onQcontent("此分类下有数据,请移除后再删除!");
             }
         }
     } else {
         $hasDelQcontentPrivilege['url'] = "?admin_qcontent/qcontent";
         __msg($hasDelQcontentPrivilege);
     }
 }
<?php

if (!defined('ABSPATH')) {
    die('Error!');
}
do_action("wpdm_onstart_download", $package);
global $current_user, $dfiles;
$speed = 1024;
//in KB - default 1 MB
$speed = apply_filters('wpdm_download_speed', $speed);
get_currentuserinfo();
if (wpdm_is_download_limit_exceed($package['ID'])) {
    wp_die(__msg('DOWNLOAD_LIMIT_EXCEED'));
}
$files = $package['files'];
$dir = isset($package['package_dir']) ? $package['package_dir'] : '';
if ($dir != '') {
    $dfiles = array();
    $dfiles = wpdm_get_files($dir);
}
$log = new Stats();
$oid = isset($_GET['oid']) ? esc_attr($_GET['oid']) : '';
$indsc = 1;
$indsc = isset($_GET['ind']) && get_option('__wpdm_ind_stats') == 0 ? 0 : 1;
if ($indsc && !isset($_GET['nostat'])) {
    $log->NewStat($package['ID'], $current_user->ID, $oid);
}
if (count($files) == 0 && count($dfiles) == 0) {
    if (isset($package['sourceurl']) && $package['sourceurl'] != '') {
        if (!isset($package['url_protect']) || $package['url_protect'] == 0 && strpos($package['sourceurl'], '://')) {
            header('location: ' . $package['sourceurl']);
Пример #10
0
 function ontransformLogView($msg = '', $ty = '')
 {
     //只查询转为投诉的问题
     $ConditionList['transformed'] = 1;
     $action = "index.php?admin_complain/transformLogView";
     $hasIntoComplainTransformLogViewPrivilege = $_ENV['menu']->checkPermission($this->ask_login_name, $_SERVER['QUERY_STRING'], "intoTransformLogView");
     $hasIntoComplainTransformLogViewPrivilege['url'] = "?admin_main";
     !$hasIntoComplainTransformLogViewPrivilege['return'] && __msg($hasIntoComplainTransformLogViewPrivilege);
     $AcceptComplainTransformLogPrivilege = $_ENV['menu']->checkPermission($this->ask_login_name, $_SERVER['QUERY_STRING'], "acceptTransformLog");
     $ConditionList['StartDate'] = isset($this->post['StartDate']) ? $this->post['StartDate'] : (isset($this->get[2]) ? $this->get[2] : date("Y-m-d", time() - 7 * 86400));
     $ConditionList['EndDate'] = isset($this->post['EndDate']) ? $this->post['EndDate'] : (isset($this->get[3]) ? $this->get[3] : date("Y-m-d", time()));
     $ConditionList['author'] = isset($this->post['author']) ? urldecode(trim($this->post['author'])) : (isset($this->get[4]) ? urldecode(trim($this->get[4])) : "");
     $operator_list = $_ENV['operator']->getList(0, 0);
     $ConditionList['AcceptOperator'] = isset($this->post['AcceptOperator']) ? trim($this->post['AcceptOperator']) : (isset($this->get[5]) ? trim($this->get[5]) : "");
     $ConditionList['ApplyOperator'] = isset($this->post['ApplyOperator']) ? trim($this->post['ApplyOperator']) : (isset($this->get[6]) ? trim($this->get[6]) : "");
     $ConditionList['QuestionId'] = isset($this->post['QuestionId']) ? intval($this->post['QuestionId']) : (isset($this->get[7]) ? intval($this->get[7]) : 0);
     $ConditionList['TransformStatus'] = isset($this->post['TransformStatus']) ? intval($this->post['TransformStatus']) : (isset($this->get[8]) ? intval($this->get[8]) : -1);
     $ConditionList['ToType'] = "complain";
     $TransformComplainStatus = $this->ask_config->getTransformComplainStatus();
     @($page = max(1, intval($this->get[9])));
     $export = trim($this->get[9]) == "export" ? 1 : 0;
     $setting = $this->setting;
     if (!$export) {
         $pagesize = $this->setting['list_default'];
         $pagesize = 20;
         $TransformLogList = $_ENV['question']->getTransformLogList($ConditionList, $page, $pagesize);
         foreach ($TransformLogList['LogList'] as $key => $value) {
             $TransformLogList['LogList'][$key]['AcceptStatus'] = $TransformComplainStatus[intval($value['transform_status'])];
             $TransformLogList['LogList'][$key]['applyTime'] = date("Y-m-d H:i", $value['applyTime']);
             $TransformLogList['LogList'][$key]['acceptTime'] = $value['acceptTime'] ? date("Y-m-d H:i", $value['acceptTime']) : "尚未审批";
             $TransformLogList['LogList'][$key]['AcceptOperator'] = $value['AcceptOperator'] ? $value['AcceptOperator'] == "system" ? "系统自动" : $value['AcceptOperator'] : "尚未审批";
             $QuestionInfo = $_ENV['question']->Get($value['from_id']);
             $TransformLogList['LogList'][$key]['QuestionInfo']['author'] = str_replace('<x>', '<?>', $QuestionInfo['author']);
             $QuestionInfo['description'] = preg_replace('/[&amp;&nbsp;&quot;]/', '', $QuestionInfo['description']);
             $TransformLogList['LogList'][$key]['QuestionInfo']['description'] = strip_tags($QuestionInfo['description']);
             $TransformLogList['LogList'][$key]['QuestionInfo']['description_short'] = cutstr(trim($TransformLogList['LogList'][$key]['QuestionInfo']['description']), 8);
             $TransformLogList['LogList'][$key]['QuestionInfo']['time'] = date("Y-m-d H:i", $QuestionInfo['time']);
             $TransformLogList['LogList'][$key]['QuestionInfo']['js_kf'] = $QuestionInfo['js_kf'] == "" ? "尚未接单" : $QuestionInfo['js_kf'];
             $TransformLogList['LogList'][$key]['QuestionInfo']['assess'] = $QuestionInfo['is_pj'] != 0 ? $QuestionInfo['is_pj'] == 1 ? "满意" : "不满意" : "尚未评价";
             $TransformLogList['LogList'][$key]['to_url'] = $value['to_id'] > 0 ? "<a href = '" . $_ENV['question']->getQuestionLink($value['to_id'], "complain") . "' target='_BLANK'><投诉></a>" : "尚未转换";
             $Comment = unserialize($value['comment']);
             $TransformLogList['LogList'][$key]['TransformReason'] = $Comment['TransformReason'];
             $cidInfoList[$Comment['CidArr']['cid']] = isset($cidInfoList[$Comment['CidArr']['cid']]['id']) ? $cidInfoList[$Comment['CidArr']['cid']] : $_ENV['category']->get($Comment['CidArr']['cid']);
             $cidInfoList[$Comment['CidArr']['cid1']] = isset($cidInfoList[$Comment['CidArr']['cid1']]['id']) ? $cidInfoList[$Comment['CidArr']['cid1']] : $_ENV['category']->get($Comment['CidArr']['cid1']);
             $cidInfoList[$Comment['CidArr']['cid2']] = isset($cidInfoList[$Comment['CidArr']['cid2']]['id']) ? $cidInfoList[$Comment['CidArr']['cid2']] : $_ENV['category']->get($Comment['CidArr']['cid2']);
             $cidInfoList[$Comment['CidArr']['cid3']] = isset($cidInfoList[$Comment['CidArr']['cid3']]['id']) ? $cidInfoList[$Comment['CidArr']['cid3']] : $_ENV['category']->get($Comment['CidArr']['cid3']);
             $cidInfoList[$Comment['CidArr']['cid4']] = isset($cidInfoList[$Comment['CidArr']['cid4']]['id']) ? $cidInfoList[$Comment['CidArr']['cid4']] : $_ENV['category']->get($Comment['CidArr']['cid4']);
             $to_type = "";
             if ($cidInfoList[$Comment['CidArr']['cid']]['id']) {
                 $to_type .= '-' . $cidInfoList[$Comment['CidArr']['cid']]['name'] . '-';
             }
             if ($cidInfoList[$Comment['CidArr']['cid1']]['id']) {
                 $to_type .= '-' . $cidInfoList[$Comment['CidArr']['cid1']]['name'] . '-';
             }
             if ($cidInfoList[$Comment['CidArr']['cid2']]['id']) {
                 $to_type .= '-' . $cidInfoList[$Comment['CidArr']['cid2']]['name'] . '-';
             }
             if ($cidInfoList[$Comment['CidArr']['cid3']]['id']) {
                 $to_type .= '-' . $cidInfoList[$Comment['CidArr']['cid3']]['name'] . '-';
             }
             if ($cidInfoList[$Comment['CidArr']['cid4']]['id']) {
                 $to_type .= '-' . $cidInfoList[$Comment['CidArr']['cid4']]['name'] . '-';
             }
             $TransformLogList['LogList'][$key]['to_type'] = $to_type;
         }
         $departstr = page($TransformLogList['LogCount'], $pagesize, $page, "admin_complain/transformLogView/" . $ConditionList['StartDate'] . "/" . $ConditionList['EndDate'] . "/" . urlencode($ConditionList['author']) . "/" . urlencode($ConditionList['AcceptOperator']) . "/" . urlencode($ConditionList['ApplyOperator']) . "/" . $ConditionList['QuestionId'] . "/" . $ConditionList['TransformStatus']);
         $downloadstr = page_url("<下载EXCEL表格>", "admin_complain/transformLogView/" . $ConditionList['StartDate'] . "/" . $ConditionList['EndDate'] . "/" . urlencode($ConditionList['author']) . "/" . urlencode($ConditionList['AcceptOperator']) . "/" . urlencode($ConditionList['ApplyOperator']) . "/" . $ConditionList['QuestionId'] . "/" . $ConditionList['TransformStatus'] . "/" . $page . "/export");
         $msg && ($message = $msg);
         $ty && ($type = $ty);
     } else {
     }
     include template('transformlogview', 'admin');
 }
Пример #11
0
 function onviewHistory_export()
 {
     $hasviewHistoryExportPrivilege = $_ENV['menu']->checkPermission($this->ask_login_name, $_SERVER['QUERY_STRING'], "viewHistoryExport");
     $hasviewHistoryExportPrivilege['url'] = "?admin_history/viewHistory";
     !$hasviewHistoryExportPrivilege['return'] && __msg($hasviewHistoryExportPrivilege);
     if ($_SESSION['his_session']['num'] >= 10000) {
         $this->onviewHistory('数据量太大,请重新筛选条件后进行导出!', "errormsg");
         exit;
     }
     require TIPASK_ROOT . '/lib/php_excel.class.php';
     $export = array();
     $export_header = array("问题ID", "5173帐号", "问题标题", "问题描述", "问题分类", "提问时间", "回答客服", "接手时间", "回答时间", "回复时长", "处理状态", "协助处理", "评价状态", "浏览量", "问题的状态", "来源站点", "游戏名称");
     array_push($export, $export_header);
     $cat = $_ENV['category']->getNameById();
     $_his = $_SESSION['his_session'];
     $where = $_ENV['question_h']->Get_Where_H($_his['ask_start_time_search'], $_his['ask_end_time_search'], $_his['wait_start_time_search'], $_his['wait_end_time_search'], $_his['answer_start_time_search'], $_his['answer_end_time_search'], $_his['question_start_time_search'], $_his['question_end_time_search'], $_his['revocation_search'], $_his['que_status_search'], $_his['question_search'], $_his['assess_search'], $_his['qid_search'], $_his['operator_search'], $_his['user_name_search'], $_his['question_title_search'], $_his['display_method'], $_his['category_search'], $_his['order_search'], $_his['help_search'], $_his['all_kf_search'], $_his['r_site_search']);
     $export_arr = $_ENV['question_h']->Get_All_Question_H($where, false, $_his['all_kf_search'], $_his['history_year']);
     foreach ($export_arr as $val) {
         if ($val['is_pj'] == 0) {
             $asses = "未评价";
         } elseif ($val['is_pj'] == 1) {
             $asses = "满意";
         } else {
             $asses = "不满意";
         }
         if ($val['status'] == 1) {
             $q_status = "等待处理";
         } elseif ($val['status'] == 2) {
             $q_status = "等待评价";
         } else {
             $q_status = "已结束";
         }
         if ($val[q_handle_status] == 0) {
             $mange_status = '未处理';
         } else {
             $mange_status = '已处理';
         }
         if ($val[help_status] == 0) {
             $help_status = '未协助';
         } else {
             $help_status = '协助处理';
         }
         if ($val['r_site'] == 1) {
             $r_site = '寄售';
         } elseif ($val['r_site'] == 2) {
             $r_site = '担保';
         } elseif ($val['r_site'] == 3) {
             $r_site = '账号';
         } else {
             $r_site = '';
         }
         $q_cat = '';
         $val['cid'] && ($q_cat .= '-' . $cat[$val['cid']] . '-');
         $val['cid1'] && ($q_cat .= '-' . $cat[$val['cid1']] . '-');
         $val['cid2'] && ($q_cat .= '-' . $cat[$val['cid2']] . '-');
         $val['cid3'] && ($q_cat .= '-' . $cat[$val['cid3']] . '-');
         $val['cid4'] && ($q_cat .= '-' . $cat[$val['cid4']] . '-');
         $replay_range = getHour($val['Atime'] - $val['receive_time']);
         $val['receive_time'] = empty($val['receive_time']) ? '' : date("Y-m-d H:i:s", $val['receive_time']);
         $val['Atime'] = empty($val['Atime']) ? '' : date("Y-m-d H:i:s", $val['Atime']);
         $export[] = array($val['id'], $val['author'], $val['title'], $val['description'], $q_cat, date("Y-m-d H:i:s", $val['time']), $val['Aauthor'], $val['receive_time'], $val['Atime'], $replay_range, $mange_status, $help_status, $asses, $val['views'], $q_status, $r_site, $val['game_name']);
     }
     $xls = new Excel_XML('UTF-8', false, 'My Sheet');
     $xls->addArray($export);
     $xls->generateXML('question_h' . date('Ymd'));
 }
Пример #12
0
 function __construct($conf)
 {
     $this->link = mysql_connect($conf['host'], $conf['user'], $conf['password']);
     if (!$this->link) {
         __msg('无法连接: ' . mysql_error() . ' <br /> 如果是初次使用b2core 请配置 config.php 文件,并导入 db.sql ');
         return FALSE;
     }
     $db_selected = mysql_select_db($conf['default_db']);
     if (!$db_selected) {
         __msg('无法使用 : ' . mysql_error());
     }
     mysql_query('set names utf8', $this->link);
 }
Пример #13
0
 function onmy_revokeNoReason()
 {
     $id = isset($this->get[2]) ? intval($this->get[2]) : "";
     $author = isset($this->get[3]) ? trim($this->get[3]) : "";
     $skipUrl = isset($this->get[4]) ? trim($this->get[4]) : "";
     $rtime = $_SERVER['REQUEST_TIME'];
     if ($id && author) {
         $complainSwitch = intval($this->setting['complainSwitch']);
         $complainInfo = $_ENV['complain']->Get($id, 'id,time,description,status,sync,author,comment');
         $loginName = $this->ask_front_name;
         $hiddenRevocation = false;
         if ($loginName == '游客') {
             if (isset($_COOKIE['quickask'])) {
                 $ask_type = unserialize(stripslashes($_COOKIE['quickask']));
                 if (isset($ask_type['ts'])) {
                     $IsFind = strpos($ask_type['ts'], $complainInfo['id']);
                     if ($IsFind !== false) {
                         $hiddenRevocation = true;
                     }
                 }
             }
         } else {
             if (strtolower($complainInfo["author"]) == strtolower($loginName)) {
                 $hiddenRevocation = true;
             }
         }
         if ($complainInfo['sync'] == 1 && $hiddenRevocation) {
             if ($complainInfo['status'] == 2) {
                 $backReturn = array('comment' => '该投诉已撤销,请勿重复撤销!', 'url' => "?question/{$skipUrl}/{$id}");
                 // 重复撤销
             } else {
                 if ($complainInfo['status'] == 0 || $complainSwitch == 1) {
                     $ip = $_SERVER["REMOTE_ADDR"];
                     $comment = unserialize($complainInfo['comment']);
                     $comment['revoke'] = array('rtime' => $rtime, 'revokeReason' => '无理由', 'ip' => $ip);
                     $updateNum = $_ENV['complain']->Update($id, array('status' => 2, 'rtime' => $rtime, 'comment' => serialize($comment)));
                     if ($updateNum > 0) {
                         $q_search['id'] = 'c_' . $id;
                         $q_search['title'] = $complainInfo['description'];
                         $q_search['description'] = $complainInfo['description'];
                         $q_search['tag'] = json_encode(array(), true);
                         $q_search['question_type'] = 'complain';
                         $q_search['time'] = $complainInfo['time'];
                         $q_search['atime'] = -1;
                         $this->set_search($q_search);
                         $url = "http://complain.5173esb.com/Sc/PostCancel.aspx";
                         $data = "scid={$id}&uid=" . urlencode($author) . "&revokeTime={$rtime}&sign=" . config::TS_SIGN . "&ip={$ip}";
                         $result = do_post($url, $data);
                         $result_arr = json_decode($result, true);
                         if ($result_arr['return'] != 1) {
                             $revokeArr = array('scid' => $id, 'uid' => $author, 'ip' => $ip, 'revokeTime' => $rtime, 'revokeReason' => "");
                             $_ENV['complain']->insertRevokeQueue($revokeArr);
                         }
                         $_ENV['question']->rebuildQuestionDetail($id, "complain");
                         $backReturn = array('comment' => '您的撤销已成功!', 'url' => "?question/{$skipUrl}/{$id}");
                     } else {
                         $backReturn = array('comment' => '您的撤销失败,请刷新重试!', 'url' => "?question/{$skipUrl}/{$id}");
                     }
                 } else {
                     $backReturn = array('comment' => '对不起,您没有撤销权限!', 'url' => "?question/{$skipUrl}/{$id}");
                 }
             }
         } else {
             $backReturn = array('comment' => '系统忙,请稍后再试!', 'url' => "?question/{$skipUrl}/{$id}");
         }
     } else {
         $backReturn = array('comment' => '非法参数', 'url' => "?question");
     }
     __msg($backReturn);
 }
Пример #14
0
 function onmenu_updatePrivilegeConfig()
 {
     $hasMenuUpdatePrivilege = $_ENV['menu']->checkPermission($this->ask_login_name, $_SERVER['QUERY_STRING'], "menuUpdatePrivilege");
     if ($hasMenuUpdatePrivilege['return']) {
         $menu_id = isset($this->post['menu_id']) ? intval($this->post['menu_id']) : 0;
         $PermissionDetailList = isset($this->post['PermissionDetailList']) ? $this->post['PermissionDetailList'] : false;
         if ($menu_id) {
             $result = $_ENV['menu']->updatePermissionByMenu($menu_id, $PermissionDetailList);
             $reurnBack = array();
             if ($result) {
                 $reurnBack = array('comment' => "修改成功", 'type' => "correctmsg");
             } else {
                 $reurnBack = array('comment' => "修改出错,请重新修改!", 'type' => "errormsg");
             }
         } else {
             $reurnBack = array('comment' => "该菜单不存在", 'type' => "errormsg");
         }
         $this->onmenu($reurnBack['comment'], $reurnBack['type']);
     } else {
         $hasMenuUpdatePrivilege['url'] = "?admin_menu/menu";
         __msg($hasMenuUpdatePrivilege);
     }
 }
Пример #15
0
 function onpageViewDetail($msg = '', $ty = '')
 {
     //只查询转为投诉的问题
     $action = "index.php?admin_data/PageViewDetail";
     $hasIntoViewDetailPrivilege = $_ENV['menu']->checkPermission($this->ask_login_name, $_SERVER['QUERY_STRING'], "intoPageViewDetail");
     $hasIntoResponseDayDataPrivilege['url'] = "?admin_main";
     !$hasIntoViewDetailPrivilege['return'] && __msg($hasIntoViewDetailPrivilege);
     $ConditionList['StartDate'] = isset($this->post['StartDate']) ? $this->post['StartDate'] : (isset($this->get[2]) ? $this->get[2] : date("Y-m-d", time()));
     $ConditionList['EndDate'] = isset($this->post['EndDate']) ? $this->post['EndDate'] : (isset($this->get[3]) ? $this->get[3] : date("Y-m-d", time()));
     $ConditionList['PageId'] = isset($this->post['PageId']) ? intval($this->post['PageId']) : (isset($this->get[4]) ? intval($this->get[4]) : 0);
     $ConditionList['EndDate'] = min($ConditionList['EndDate'], date("Y-m-t", strtotime($ConditionList['StartDate'])), date("Y-m-d", time()));
     $PageList = $_ENV['view']->GetAllPage();
     $export = trim($this->get[6]) == "export" ? 1 : 0;
     @($page = max(1, intval($this->get[5])));
     if (!$export) {
         $pagesize = $this->setting['list_default'];
         $pagesize = 10;
         $PageViewDetail = $_ENV['view']->getPageViewDetail($ConditionList, $page, $pagesize);
         foreach ($PageViewDetail['PageViewList'] as $key => $value) {
             $PageViewDetail['PageViewList'][$key]['PageName'] = isset($PageList[$value['PageId']]) ? $PageList[$value['PageId']]['PageName'] : '未知页面';
         }
         $downloadstr = page_url("<下载EXCEL表格>", "admin_data/PageViewDetail/" . $ConditionList['StartDate'] . "/" . $ConditionList['EndDate'] . "/" . $ConditionList['PageId'] . "/" . $page . "/export");
         $departstr = page($PageViewDetail['PageViewCount'], $pagesize, $page, "admin_data/PageViewDetail/" . $ConditionList['StartDate'] . "/" . $ConditionList['EndDate'] . "/" . $ConditionList['PageId']);
         $msg && ($message = $msg);
         $ty && ($type = $ty);
     } else {
         set_time_limit(0);
         $page = 1;
         $pagesize = 1000;
         $num = 1;
         require TIPASK_ROOT . '/lib/Excel.php';
         $oExcel = new Excel();
         $FileName = '页面浏览记录';
         $oExcel->download($FileName)->addSheet('页面浏览记录');
         //标题栏
         $title = array("页面", "浏览IP", "浏览时间");
         $oExcel->addRows(array($title));
         while ($num > 0) {
             $PageViewDetail = $_ENV['view']->getPageViewDetail($ConditionList, $page, $pagesize);
             foreach ($PageViewDetail['PageViewList'] as $key => $value) {
                 $excelArr = array("PageName" => isset($PageList[$value['PageId']]) ? $PageList[$value['PageId']]['PageName'] : '未知页面', "ViewIP" => long2ip($value['ViewIP']), "ViewTime" => date('Y-m-d H:i:s', $value['Time']));
                 $oExcel->addRows(array($excelArr));
             }
             $page++;
             $num = count($PageViewDetail['PageViewList']);
         }
         $oExcel->closeSheet()->close();
     }
     include template('PageViewDetail', 'admin');
 }
Пример #16
0
 function onquick_add()
 {
     $backReturn = array();
     // 是否有主分类修改/添加权限updateQtype
     $hasAddQuickPrivilege = $_ENV['menu']->checkPermission($this->ask_login_name, $_SERVER['QUERY_STRING'], "updateQuick");
     if ($hasAddQuickPrivilege['return']) {
         if (isset($this->post['submit_add'])) {
             $id = !empty($this->post['Id']) ? $this->post['Id'] : 0;
             if ($id) {
                 $quicklinkInfo = $_ENV['quick']->GetQuicklink($id);
                 $quicklinkInfo['LinkName'] = trim($this->post['LinkName']);
                 $quicklinkInfo['Parent'] = intval($this->post['Parent']);
                 $quicklinkInfo['LinkUrl'] = trim($this->post['LinkUrl']);
                 $quicklinkInfo['LinkType'] = trim($this->post['LinkType']);
                 if (!empty($_FILES['LinkIcon']['name'])) {
                     @(require TIPASK_ROOT . '/api/FastDFSClient/FastDFSClient.php');
                     $FastDFSClient = new FastDFSClient();
                     $FastDFSClient->maxSize = 4194304;
                     // 设置附件上传大小 默认为4M
                     $FastDFSClient->allowExts = array('gif', 'jpg', 'jpeg', 'bmp', 'png');
                     // 设置附件上传类型
                     $FastDFSClient->savePath = TIPASK_ROOT . '/data/attach/' . gmdate('ym', $this->time) . '/';
                     // 设置附件上传目录
                     $FastDFSInfo = $FastDFSClient->upload("sk");
                     $quicklinkInfo['LinkIcon'] = $FastDFSInfo != -1 ? $FastDFSInfo : '';
                 }
                 unset($quicklinkInfo['Id']);
                 $update = $_ENV['quick']->updateQuicklink($id, $quicklinkInfo);
                 $this->onquick("快捷链接修改成功!");
             } else {
                 $quicklinkInfo['LinkName'] = trim($this->post['LinkName']);
                 $quicklinkInfo['Parent'] = intval($this->post['Parent']);
                 $quicklinkInfo['LinkUrl'] = trim($this->post['LinkUrl']);
                 $quicklinkInfo['LinkType'] = trim($this->post['LinkType']);
                 if (!empty($_FILES['LinkIcon']['name'])) {
                     @(require TIPASK_ROOT . '/api/FastDFSClient/FastDFSClient.php');
                     $FastDFSClient = new FastDFSClient();
                     $FastDFSClient->maxSize = 4194304;
                     // 设置附件上传大小 默认为4M
                     $FastDFSClient->allowExts = array('gif', 'jpg', 'jpeg', 'bmp', 'png');
                     // 设置附件上传类型
                     $FastDFSClient->savePath = TIPASK_ROOT . '/data/attach/' . gmdate('ym', $this->time) . '/';
                     // 设置附件上传目录
                     $FastDFSInfo = $FastDFSClient->upload("sk");
                     $quicklinkInfo['LinkIcon'] = $FastDFSInfo != -1 ? $FastDFSInfo : '';
                 }
                 $update = $_ENV['quick']->insertQuicklink($quicklinkInfo);
                 $this->onquick("快捷链接添加成功!");
             }
         }
     } else {
         $hasAddQuickPrivilege['url'] = "?admin_quick/quick";
         __msg($hasAddQuickPrivilege);
     }
 }
Пример #17
0
/**
 * return download link after verifying password
 * data format: json
 */
function wpdm_getlink()
{
    global $wpdb;
    if (!isset($_POST['id'])) {
        return;
    }
    $id = (int) $_POST['id'];
    $password = isset($_POST['password']) ? addslashes($_POST['password']) : '';
    $file = get_post($id, ARRAY_A);
    $file['ID'] = $file['ID'];
    $file = wpdm_setup_package_data($file);
    $key = uniqid();
    $file1 = $file;
    // and( password='******' or password like '%[$password]%')
    $plock = isset($file['password_lock']) ? $file['password_lock'] : 0;
    $data = array('error' => '', 'downloadurl' => '');
    if (isset($_POST['verify']) && $_POST['verify'] == 'email' && $file['email_lock'] == 1) {
        if (wpdm_verify_email($_POST['email'])) {
            $subject = "Your Download Link";
            $site = get_option('blogname');
            add_post_meta($file['ID'], "__wpdmkey_" . $key, 3);
            //file_put_contents(WPDM_CACHE_DIR.'wpdm_'.$key,"3");
            $download_url = wpdm_download_url($file, "_wpdmkey={$key}");
            $cff = isset($_POST['custom_form_field']) ? $_POST['custom_form_field'] : array();
            $wpdb->insert("{$wpdb->prefix}ahm_emails", array('email' => $_POST['email'], 'pid' => $file['ID'], 'date' => time(), 'custom_data' => serialize($cff)));
            $eml = get_option('_wpdm_etpl');
            $eml['fromname'] = isset($eml['fromname']) ? $eml['fromname'] : get_bloginfo('name');
            $eml['frommail'] = isset($eml['frommail']) ? $eml['frommail'] : get_bloginfo('admin_email');
            $eml['subject'] = isset($eml['subject']) ? $eml['subject'] : 'Download ' . $file['post_title'];
            $headers = 'From: ' . $eml['fromname'] . ' <' . $eml['frommail'] . '>' . "\r\nContent-type: text/html\r\n";
            $file = wpdm_setup_package_data($file);
            $file['download_url'] = $download_url;
            //Custom Download URL for email lock
            $keys = array();
            foreach ($file as $key => $value) {
                $_key = "[{$key}]";
                $tdata[$_key] = $value;
            }
            $tdata["[site_url]"] = home_url('/');
            $tdata["[site_name]"] = get_bloginfo('sitename');
            $tdata["[download_url]"] = $download_url;
            $tdata["unsaved:///"] = "";
            $tdata["[date]"] = date(get_option('date_format'), time());
            $message = $eml['body'];
            foreach ($tdata as $skey => $svalue) {
                if (!is_array($svalue)) {
                    $message = str_replace(strval($skey), strval($svalue), $message);
                    $eml['subject'] = str_replace(strval($skey), strval($svalue), $eml['subject']);
                }
            }
            //do something before sending download link
            do_action("wpdm_before_email_download_link", $_POST, $file);
            $message = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>' . __("Welcome Message", "wpdmpro") . '</title></head><body>' . stripslashes($message) . '</body></html>';
            wp_mail($_POST['email'], stripcslashes($eml['subject']), stripcslashes($message), $headers);
            $idl = isset($file['email_lock_idl']) ? $file['email_lock_idl'] : 0;
            if ($idl != 1) {
                $data['downloadurl'] = "";
                $data['error'] = '<div class="alert alert-success">' . __('Download link sent to your email!', 'wpdmpro') . '</div>';
            } else {
                $data['downloadurl'] = $file['download_url'];
                $data['error'] = '';
                $data['msg'] = '<div class="alert alert-success">' . __('Download link also sent to your email!', 'wpdmpro') . '</div>';
            }
            header('HTTP/1.0 200 OK');
            header("Content-type: application/json");
            echo json_encode($data);
            die;
        } else {
            $data['downloadurl'] = "";
            $data['error'] = '<div class="alert alert-danger">' . __('Invalid Email Address!', 'wpdmpro') . '</i>';
            header("Content-type: application/json");
            echo json_encode($data);
            die;
        }
    }
    if (isset($_POST['force']) && $_POST['force'] != '') {
        $vr = explode('|', base64_decode($_POST['force']));
        if ($vr[0] == 'unlocked') {
            $social = array('f' => 'wpdm_fb_likes', 'g' => 'wpdm_gplus1s', 't' => 'wpdm_tweets', 'l' => 'wpdm_lishare');
            if ($_POST['social'] && isset($social[$_POST['social']])) {
                update_option($social[$_POST['social']], (int) get_option($social[$_POST['social']]) + 1);
            }
            add_post_meta($file['ID'], "__wpdmkey_" . $key, 3);
            $data['downloadurl'] = wpdm_download_url($file, "_wpdmkey={$key}");
            $adata = apply_filters("wpdmgetlink", $data, $file);
            $data = is_array($adata) ? $adata : $data;
            header("Content-type: application/json");
            die(json_encode($data));
        }
    }
    if ($plock == 1 && $password != $file['password'] && !strpos("__" . $file['password'], "[{$password}]")) {
        $data['error'] = 'Wrong Password!';
        $file = array();
    }
    if ($plock == 1 && $password == '') {
        $data['error'] = 'Wrong Password!';
        $file = array();
    }
    $ux = "";
    if ($plock == 1) {
        add_post_meta($file['ID'], "__wpdmkey_" . $key, 3);
    }
    if ($file['ID'] != '') {
        $pu = isset($file['password_usage']) && is_array($file['password_usage']) ? $file['password_usage'] : array();
        $pul = $file['password_usage_limit'];
        if (is_array($pu) && isset($pu[$password]) && $pu[$password] >= $pul && $pul > 0) {
            $data['error'] = __msg('PASSWORD_LIMIT_EXCEED');
        } else {
            if (!is_array($pu)) {
                $pu = array();
            }
            $pu[$password] = isset($pu[$password]) ? $pu[$password] + 1 : 1;
            update_post_meta($file['ID'], '__wpdm_password_usage', $pu);
        }
    }
    if (isset($_COOKIE['unlocked_' . $file['ID']]) && $_COOKIE['unlocked_' . $file['ID']] == 1) {
        $data['error'] = '';
        $file = $file1;
    }
    if ($data['error'] == '') {
        $data['downloadurl'] = wpdm_download_url($file, "_wpdmkey={$key}");
    }
    // home_url('/?downloadkey='.md5($file['files']).'&file='.$id.$ux);
    $adata = apply_filters("wpdmgetlink", $data, $file);
    $data = is_array($adata) ? $adata : $data;
    header("Content-type: application/json");
    die(json_encode($data));
}
Пример #18
0
 function onhelpTime_export()
 {
     $hashelpTimeExportPrivilege = $_ENV['menu']->checkPermission($this->ask_login_name, $_SERVER['QUERY_STRING'], "helpTimeExport");
     if ($hashelpTimeExportPrivilege['return']) {
         @(require TIPASK_ROOT . '/lib/php_excel.class.php');
         $export = array();
         $export_header = array("操作员", "回复量", "平均响应时长", "0-10分钟数量", "比率", "11-20分钟数量", "比率", "21-30分钟数量", "比率", "30分钟以上数量", "比率");
         array_push($export, $export_header);
         $export_arr = $_SESSION['sorce_list'];
         foreach ($export_arr as $val) {
             $export[] = array($val['aid'], $val['reply'], $val['avg_time'], $val['ten_reply'], $val['ten_rate'], $val['twenty_reply'], $val['twenty_rate'], $val['thirty_reply'], $val['thirty_rate'], $val['more_reply'], $val['more_rate']);
         }
         $xls = new Excel_XML('UTF-8', false, 'My Sheet');
         $xls->addArray($export);
         $xls->generateXML('ht_data' . date('Ymd'));
     } else {
         $hashelpTimeExportPrivilege['url'] = "?admin_count/helpTime";
         __msg($hashelpTimeExportPrivilege);
     }
 }
Пример #19
0
 function onhelp_manage_time()
 {
     $hasHelpManageTimePrivilege = $_ENV['menu']->checkPermission($this->ask_login_name, $_SERVER['QUERY_STRING'], "helpManageTime");
     if ($hasHelpManageTimePrivilege['return']) {
         if ($this->post != null) {
             $data = $this->post;
             array_shift($data);
             $_ENV['hekp_config']->hekpUpdate($data);
             $this->onhelp('配置成功');
         } else {
             $this->onhelp('配置出错,没有参数', 'errormsg');
         }
     } else {
         $hasHelpManageTimePrivilege['url'] = "?admin_system/help";
         __msg($hasHelpManageTimePrivilege);
     }
 }
Пример #20
0
 function onbroadcast_update()
 {
     $backReturn = array();
     // 是否公告修改权限updateBroadCast
     $hasUpdatebroadcastPrivilege = $_ENV['menu']->checkPermission($this->ask_login_name, $_SERVER['QUERY_STRING'], "updateBroadCast");
     if ($hasUpdatebroadcastPrivilege['return']) {
         $Id = !empty($this->post['Id']) ? intval($this->post['Id']) : 0;
         $broadcastInfo = $_ENV['broadcast']->GetBroadCast($Id);
         $BroadCastZoneList = $this->ask_config->getBroadCastZone();
         if ($this->post['operation'] == "update") {
             $DataArr['StartTime'] = strtotime(trim($this->post['StartTime']));
             $DataArr['EndTime'] = strtotime(trim($this->post['EndTime']));
             if ($DataArr['EndTime'] <= time()) {
                 echo 2;
                 return;
             }
             $DataArr['Content'] = cutstr(trim($this->post['Content']), 50);
             if ($DataArr['Content'] == "") {
                 echo 3;
                 return;
             }
             $DataArr['BroadCastZone'] = intval($this->post['BroadCastZone']) ? intval($this->post['BroadCastZone']) : 0;
             if ($this->post['BroadCastAvailable'] == 1) {
                 $DataArr['BroadCastStatus'] = 3;
             } else {
                 $DataArr['BroadCastStatus'] = 1;
             }
             $update = $_ENV['broadcast']->updateBroadCast($Id, $DataArr);
             if ($update) {
                 echo 1;
                 if ($broadcastInfo['StartTime'] != $DataArr['StartTime']) {
                     $updateArr['StartTime'] = "开始时间由" . date("Y-m-d H:i:s", $broadcastInfo['StartTime']) . "改为" . date("Y-m-d H:i:s", $DataArr['StartTime']);
                 }
                 if ($broadcastInfo['EndTime'] != $DataArr['EndTime']) {
                     $updateArr['EndTime'] = "结束时间时间由" . date("Y-m-d H:i:s", $broadcastInfo['EndTime']) . "改为" . date("Y-m-d H:i:s", $DataArr['EndTime']);
                 }
                 if ($broadcastInfo['Content'] != $DataArr['Content']) {
                     $updateArr['Content'] = "公告内容由" . $broadcastInfo['Content'] . "改为" . $DataArr['Content'];
                 }
                 if ($broadcastInfo['BroadCastZone'] != $DataArr['BroadCastZone']) {
                     $updateArr['BroadCastZone'] = "作用区域由" . $BroadCastZoneList[$broadcastInfo['BroadCastZone']] . "改为" . $BroadCastZoneList[$DataArr['BroadCastZone']];
                 }
                 $this->sys_admin_log(0, $this->ask_login_name, $this->ask_login_name . '修改公告:' . implode(',', $updateArr), 17);
                 //系统操作日志
                 return;
             } else {
                 echo 0;
                 return;
             }
         } else {
             include template('broadcast_update', 'admin');
         }
     } else {
         $hasUpdatebroadcastPrivilege['url'] = "?admin_broadcast/broadcast";
         __msg($hasUpdatebroadcastPrivilege);
     }
 }