Ejemplo n.º 1
0
 public function fieldsFormDisplay($rid = 0)
 {
     //要嵌入规则编辑页的自定义内容,这里 $rid 为对应的规则编号,新增时为 0
     global $_W;
     if (!empty($rid)) {
         $reply = pdo_fetch("SELECT * FROM " . tablename($this->table_reply) . " WHERE rid = :rid ORDER BY `id` DESC", array(':rid' => $rid));
         if (!empty($reply)) {
             $reply['fields'] = iunserializer($reply['fields']);
         }
     }
     $fields = fans_fields();
     $reply['start_time'] = empty($reply['start_time']) ? strtotime(date('Y-m-d')) : $reply['start_time'];
     $reply['end_time'] = empty($reply['end_time']) ? TIMESTAMP : $reply['end_time'] + 86399;
     $reply['checkkeyword'] = empty($reply['checkkeyword']) ? "分享排名" : $reply['checkkeyword'];
     include $this->template('upfansdata/form');
 }
Ejemplo n.º 2
0
 public function doCard()
 {
     global $_GPC, $_W;
     $setting = pdo_fetch("SELECT * FROM " . tablename('card') . " WHERE weid = '{$_W['weid']}'");
     if (!empty($setting)) {
         $setting['color'] = iunserializer($setting['color']);
         $setting['background'] = iunserializer($setting['background']);
         $setting['fields'] = iunserializer($setting['fields']);
     }
     if (checksubmit('submit')) {
         if (empty($_GPC['title'])) {
             message('请输入会员卡名称!');
         }
         if (empty($_GPC['format'])) {
             message('请输入会员卡的卡号生成格式!');
         }
         $data = array('title' => $_GPC['title'], 'color' => iserializer(array('title' => $_GPC['color-title'], 'number' => $_GPC['color-number'])), 'background' => iserializer(array('background' => $_GPC['background'], 'image' => $_GPC[$_GPC['background'] . '-bg'])), 'logo' => $_GPC['logo'], 'format' => $_GPC['format']);
         if (!empty($_GPC['fields'])) {
             foreach ($_GPC['fields']['title'] as $index => $row) {
                 if (empty($_GPC['fields']['title'])) {
                     continue;
                 }
                 $data['fields'][] = array('title' => $_GPC['fields']['title'][$index], 'require' => intval($_GPC['fields']['require'][$index]), 'bind' => $_GPC['fields']['bind'][$index]);
             }
             $data['fields'] = iserializer($data['fields']);
         }
         if (!empty($setting)) {
             pdo_update('card', $data, array('weid' => $_W['weid']));
         } else {
             $data['weid'] = $_W['weid'];
             pdo_insert('card', $data);
         }
         message('会员卡设置成功!', referer(), 'success');
     }
     $fields = fans_fields();
     include $this->template('card');
 }
Ejemplo n.º 3
0
 public function doWebPost()
 {
     global $_W, $_GPC;
     $reid = intval($_GPC['id']);
     $hasData = false;
     if ($reid) {
         $sql = 'SELECT COUNT(*) FROM ' . tablename('research_rows') . ' WHERE `reid`=' . $reid;
         if (pdo_fetchcolumn($sql) > 0) {
             $hasData = true;
         }
     }
     if (checksubmit()) {
         $record = array();
         $record['title'] = trim($_GPC['activity']);
         $record['weid'] = $_W['uniacid'];
         $record['description'] = trim($_GPC['description']);
         $record['content'] = trim($_GPC['content']);
         $record['information'] = trim($_GPC['information']);
         if (!empty($_GPC['thumb'])) {
             $record['thumb'] = $_GPC['thumb'];
             load()->func('file');
             file_delete($_GPC['thumb-old']);
         }
         $record['status'] = intval($_GPC['status']);
         $record['inhome'] = intval($_GPC['inhome']);
         $record['pretotal'] = intval($_GPC['pretotal']);
         $record['alltotal'] = intval($_GPC['alltotal']);
         $record['starttime'] = strtotime($_GPC['starttime']);
         $record['endtime'] = strtotime($_GPC['endtime']);
         $record['noticeemail'] = trim($_GPC['noticeemail']);
         if (is_numeric($_GPC['mobile'])) {
             $record['mobile'] = trim($_GPC['mobile']);
         }
         if (empty($reid)) {
             $record['status'] = 1;
             $record['createtime'] = TIMESTAMP;
             pdo_insert('research', $record);
             $reid = pdo_insertid();
             if (!$reid) {
                 message('保存预约失败, 请稍后重试.');
             }
         } else {
             if (pdo_update('research', $record, array('reid' => $reid)) === false) {
                 message('保存预约失败, 请稍后重试.');
             }
         }
         if (!$hasData) {
             $sql = 'DELETE FROM ' . tablename('research_fields') . ' WHERE `reid`=:reid';
             $params = array();
             $params[':reid'] = $reid;
             pdo_query($sql, $params);
             foreach ($_GPC['title'] as $k => $v) {
                 $field = array();
                 $field['reid'] = $reid;
                 $field['title'] = trim($v);
                 $field['displayorder'] = range_limit($_GPC['displayorder'][$k], 0, 254);
                 $field['type'] = $_GPC['type'][$k];
                 $field['essential'] = $_GPC['essentialvalue'][$k] == 'true' ? 1 : 0;
                 $field['bind'] = $_GPC['bind'][$k];
                 $field['value'] = urldecode($_GPC['value'][$k]);
                 $field['description'] = urldecode($_GPC['desc'][$k]);
                 pdo_insert('research_fields', $field);
             }
         }
         message('保存预约成功.', 'refresh');
     }
     $types = array();
     $types['number'] = '数字(number)';
     $types['text'] = '字串(text)';
     $types['textarea'] = '文本(textarea)';
     $types['radio'] = '单选(radio)';
     $types['checkbox'] = '多选(checkbox)';
     $types['select'] = '选择(select)';
     $types['calendar'] = '日历(calendar)';
     $types['email'] = '电子邮件(email)';
     $types['image'] = '上传图片(image)';
     $types['range'] = '日期范围(range)';
     $types['reside'] = '居住地(reside)';
     $fields = fans_fields();
     if ($reid) {
         $sql = 'SELECT * FROM ' . tablename('research') . ' WHERE `weid`=:weid AND `reid`=:reid';
         $params = array();
         $params[':weid'] = $_W['uniacid'];
         $params[':reid'] = $reid;
         $activity = pdo_fetch($sql, $params);
         $activity['starttime'] && ($activity['starttime'] = date($activity['starttime']));
         $activity['endtime'] && ($activity['endtime'] = date($activity['endtime']));
         if ($activity) {
             $sql = 'SELECT * FROM ' . tablename('research_fields') . ' WHERE `reid`=:reid ORDER BY `refid`';
             $params = array();
             $params[':reid'] = $reid;
             $ds = pdo_fetchall($sql, $params);
         }
     }
     if (empty($activity['endtime'])) {
         $activity['endtime'] = date(time() + 86400);
     }
     include $this->template('post');
 }
Ejemplo n.º 4
0
function fans_require($user, $fields, $pre = '')
{
    global $_W;
    if (empty($fields) || !is_array($fields)) {
        return false;
    }
    if (!in_array('weid', $fields)) {
        $fields[] = 'weid';
    }
    if (!empty($pre)) {
        $pre .= '<br/>';
    }
    $profile = fans_search($user, $fields);
    $weid = $profile['weid'];
    $titles = fans_fields();
    $message = '';
    $ks = array();
    foreach ($profile as $k => $v) {
        if (empty($v)) {
            $ks[] = $k;
            $message .= $titles[$k] . ', ';
        }
    }
    if (!empty($message)) {
        $redirect = $_W['script_name'] . '?' . $_SERVER['QUERY_STRING'] . '#qq.com#wechat_redirect';
        $site = WeUtility::createModuleSite('fans');
        $site->module = $_W['account']['modules']['fans'];
        $site->weid = $_W['weid'];
        $site->inMobile = true;
        $site->doMobileRequire($fields, $redirect);
    }
    return $profile;
}
Ejemplo n.º 5
0
 public function doWebPost()
 {
     global $_W, $_GPC;
     $reid = intval($_GPC['id']);
     $hasData = false;
     if ($reid) {
         $sql = 'SELECT COUNT(*) FROM ' . tablename('signup_rows') . ' WHERE `reid`=' . $reid;
         if (pdo_fetchcolumn($sql) > 0) {
             $hasData = true;
         }
     }
     if (checksubmit()) {
         $recrod = array();
         $recrod['title'] = trim($_GPC['activity']);
         $recrod['weid'] = $_W['weid'];
         $recrod['description'] = trim($_GPC['description']);
         $recrod['content'] = trim($_GPC['content']);
         $recrod['information'] = trim($_GPC['information']);
         if (!empty($_FILES['thumb']['tmp_name'])) {
             $ret = file_upload($_FILES['thumb']);
             if (!$ret['success']) {
                 message('上传封面失败, 请稍后重试.');
             }
             $recrod['thumb'] = trim($ret['path']);
         }
         $recrod['status'] = intval($_GPC['status']);
         $recrod['inhome'] = intval($_GPC['inhome']);
         $recrod['pretotal'] = intval($_GPC['pretotal']);
         $recrod['starttime'] = strtotime($_GPC['starttime']);
         $recrod['endtime'] = strtotime($_GPC['endtime']);
         $recrod['noticeemail'] = trim($_GPC['noticeemail']);
         if (empty($reid)) {
             $recrod['status'] = 1;
             $recrod['createtime'] = TIMESTAMP;
             pdo_insert('signup', $recrod);
             $reid = pdo_insertid();
             if (!$reid) {
                 message('保存报名失败, 请稍后重试.');
             }
         } else {
             if ($hasData) {
                 message('已经存在报名记录, 不能修改报名.');
             }
             if (pdo_update('signup', $recrod, array('reid' => $reid)) === false) {
                 message('保存报名失败, 请稍后重试.');
             }
         }
         if (!$hasData) {
             $sql = 'DELETE FROM ' . tablename('signup_fields') . ' WHERE `reid`=:reid';
             $params = array();
             $params[':reid'] = $reid;
             pdo_query($sql, $params);
             foreach ($_GPC['title'] as $k => $v) {
                 $field = array();
                 $field['reid'] = $reid;
                 $field['title'] = trim($v);
                 $field['type'] = $_GPC['type'][$k];
                 $field['essential'] = $_GPC['essentialvalue'][$k] == 'true' ? 1 : 0;
                 $field['bind'] = $_GPC['bind'][$k];
                 $field['value'] = $_GPC['value'][$k];
                 $field['value'] = urldecode($field['value']);
                 $field['description'] = $_GPC['desc'][$k];
                 pdo_insert('signup_fields', $field);
             }
         }
         message('保存报名成功.', 'refresh');
     }
     $types = array();
     $types['number'] = '数字(number)';
     $types['text'] = '字串(text)';
     $types['textarea'] = '文本(textarea)';
     $types['radio'] = '单选(radio)';
     $types['checkbox'] = '多选(checkbox)';
     $types['select'] = '选择(select)';
     $types['calendar'] = '日历(calendar)';
     $types['email'] = '电子邮件(email)';
     $types['image'] = '上传图片(image)';
     $types['range'] = '日期范围(range)';
     $fields = fans_fields();
     if ($reid) {
         $sql = 'SELECT * FROM ' . tablename('signup') . ' WHERE `weid`=:weid AND `reid`=:reid';
         $params = array();
         $params[':weid'] = $_W['weid'];
         $params[':reid'] = $reid;
         $activity = pdo_fetch($sql, $params);
         $activity['starttime'] && ($activity['starttime'] = date('Y-m-d H:i:s', $activity['starttime']));
         $activity['endtime'] && ($activity['endtime'] = date('Y-m-d H:i:s', $activity['endtime']));
         if ($activity) {
             $sql = 'SELECT * FROM ' . tablename('signup_fields') . ' WHERE `reid`=:reid ORDER BY `refid`';
             $params = array();
             $params[':reid'] = $reid;
             $ds = pdo_fetchall($sql, $params);
         }
     }
     include $this->template('post');
 }