public function show($condition, $offset = 0, $count = 20, $orderby = '') { $orderby = $orderby ? $orderby : " ORDER BY order_id DESC "; $limit = " LIMIT " . $offset . "," . $count; $sql = "SELECT * FROM " . DB_PREFIX . "vote_question "; $sql .= " WHERE 1 " . $condition . $orderby . $limit; $q = $this->db->query($sql); $return = array(); $sort = $this->get_sort_name(); while ($row = $this->db->fetch_array($q)) { $entrip = create_filename($row['create_time'] . $row['id'], APP_UNIQUEID); if (file_exists(DATA_DIR . $entrip . '/index.html')) { $row['url'] = VOTE_DOMAIN . $entrip . '/index.html'; } $row['create_time'] = date('Y-m-d H:i', $row['create_time']); $row['update_time'] = date('Y-m-d H:i', $row['update_time']); if (strtotime(date('Y-m-d', TIMENOW)) == $row['end_time']) { $row['end_time_flag'] = $row['end_time'] + 86400 - 1 > TIMENOW ? 1 : 0; $row['start_time'] = $row['start_time'] ? date('Y-m-d H:i', $row['start_time']) : 0; $row['end_time'] = $row['end_time'] ? date('Y-m-d H:i', $row['end_time']) : 0; } else { $row['end_time_flag'] = $row['end_time'] && $row['end_time'] > TIMENOW ? 1 : 0; $row['start_time'] = $row['start_time'] ? date('Y-m-d', $row['start_time']) : 0; $row['end_time'] = $row['end_time'] ? date('Y-m-d', $row['end_time']) : 0; } $row['pictures_info'] = unserialize($row['pictures_info']); if ($row['pictures_info']) { $row['pictures_info_url'] = hg_material_link($row['pictures_info']['host'], $row['pictures_info']['dir'], $row['pictures_info']['filepath'], $row['pictures_info']['filename'], '40x30/'); } $row['more_info'] = unserialize($row['more_info']); $row['appuniqueid'] = APP_UNIQUEID; $row['column_id'] = unserialize($row['column_id']); $row['column_url'] = unserialize($row['column_url']); $row['vod_pic'] = unserialize($row['vod_pic']); $row['sort_name'] = $sort[$row['node_id']]; $return[] = $row; } return $return; }
function AcceptPageBreak() { return false; } } */ $subdir = get_subdir(); if (isset($inData['preview'])) { $subdir .= "/generated_documents_preview/"; } else { $subdir .= "/generated_documents/"; } if (!is_dir($upload_dir . $subdir)) { mkdir($upload_dir . $subdir, 0700, true); } $filename = create_filename() . ".pdf"; $pdf = new FPDF2File(); $pdf->Open($upload_dir . $subdir . $filename); $pdf->SetAutoPageBreak(false, 0); $pdf->SetMargins(0, 0, 0); //$pdf->AliasNbPages(); $csvHeaders = array(); if ($server->outData['data'][1]['datasource_file_name'] !== "") { if (isset($server->outData['data'][1]['datasource_file_name'])) { $csv->parse(".." . $server->outData['data'][1]['datasource_data_path'] . $server->outData['data'][1]['datasource_file_name'], 0, 1000); // At max 1000 lines. //Leon 24-03-14 - Add this back in, and add error handling into the page designer to print a handy error message to the user //if($csv->error_info) { // die(array("error" => 1, "details" => print_r($csv->error_info, 1)) ); //} foreach ($csv->titles as $key => $header) {
public function create_form() { if (!($id = $this->input['id'])) { $this->errorOutput(NOID); } $feedback = $this->mode->detail($id, SORT_ASC); $feedback['submit_text'] = $feedback['submit_text'] ? $feedback['submit_text'] : '确定'; if ($this->user['group_type'] > MAX_ADMIN_TYPE && $feedback['admin_user']) { $admin_user = explode(',', $feedback['admin_user']); if (!in_array($this->user['user_name'], $admin_user)) { $this->errorOutput("对不起,您没有此表单的权限"); } } if (!$feedback) { $this->errorOutput(NO_FORM); } $forms = $feedback['forms']; $html = ''; foreach ($forms as $k => $v) { if ($v['type'] == 'standard') { $html .= $this->mode->formtypes($v); } elseif ($v['type'] == 'fixed') { switch ($v['form_type']) { case 1: case 2: case 3: case 5: $v['form_type'] = $v['standard_type']; $html .= $this->mode->formtypes($v); break; case 4: case 6: $html .= '<p class="title">' . $v['name'] . '</p>'; $html .= '<div class="item file-item">'; if (is_array($v['element'])) { foreach ($v['element'] as $element) { $formname = $formname . '[' . $element['id'] . ']'; $element['ele_id'] = $element['id']; $element['id'] = $v['id']; $element['options'] = $element['value'] ? $element['value'] : array(); $element['name'] = ''; $element['tips'] = '请填写详细地址'; $element['type'] = $v['type']; if ($element['form_type'] == 4) { $html .= $this->mode->formtypes($element); } elseif ($element['form_type'] == 1) { $html .= $this->mode->formtypes($element); } } } $html .= '</div>'; break; default: break; } } } if (!defined('FB_DOMAIN') || !FB_DOMAIN) { $this->errorOutput(ERROR_URL); } $feedback['page_title'] = $feedback['page_title'] ? $feedback['page_title'] : $feedback['title']; $souce_dir = CUR_CONF_PATH . 'core/'; $dir = CUR_CONF_PATH . 'data/'; $template_name = defined('TEMPLATE_NAME') && TEMPLATE_NAME ? TEMPLATE_NAME : 'Baoming'; $form = @file_get_contents($souce_dir . 'html' . $template_name . '/' . 'html_' . strtolower($template_name) . '.html'); if (!$form) { $this->errorOutput('获取模板文件失败'); } $indexpic = $feedback['indexpic'] ? hg_fetchimgurl($feedback['indexpic'], 400) : ''; unset($feedback['indexpic']); $feedback['indexpic'] = $indexpic ? $indexpic : ''; if ($feedback['is_verifycode'] && $this->settings['App_verifycode']) { $type = $feedback['verifycode_type']; $verifycode = @file_get_contents($souce_dir . 'htmlVerifycode/' . 'html_verifycode.html'); if (!$verifycode) { $this->errorOutput('获取验证码模板失败'); } $feedback['verifycode'] = str_replace('#type#', $type, $verifycode); } $feedback['url'] = $url = !defined('FB_DOMAIN') || !FB_DOMAIN ? '../feedback.php' : FB_DOMAIN . 'feedback.php'; $feedback['html'] = $html; $feedback['basecss'] = FB_DOMAIN . strtolower($template_name); $form = $this->mode->replace_cell($form, $feedback, 'liv_'); $form = str_replace($find, $replace, $form); if (!is_writeable($dir)) { $this->errorOutput(NOWRITE); } if ($this->input['encryption']) { $filename = create_filename(strtotime($feedback['create_time']) . $feedback['id']); $fname = '/index.html'; } else { $filename = strtotime($feedback['create_time']) . $feedback['id']; $fname = '/' . $feedback['id'] . '.html'; } /**生成入口文件**/ $this->mode->create_file(); $this->generate_assist($souce_dir, $dir); $this->generate_assist($souce_dir . 'html' . $template_name . '/', $dir . $template_name . '/'); /**生成入口文件结束**/ $html_dir = $dir . $filename . '/'; hg_mkdir($html_dir); file_put_contents($html_dir . $id . '.html', $form); if (file_exists($souce_dir . 'feedback.css')) { $fb_css = file_get_contents($souce_dir . 'feedback.css'); if (!is_dir($html_dir . 'css/')) { hg_mkdir($html_dir . 'css/'); } file_put_contents($html_dir . 'css/fb.css', $fb_css); } if (file_exists($souce_dir . 'feedback.js')) { $fb_js = file_get_contents($souce_dir . 'feedback.js'); if (!is_dir($html_dir . 'js/')) { hg_mkdir($html_dir . 'js/'); } file_put_contents($html_dir . 'js/fb.js', $fb_js); } if (file_exists($souce_dir . 'html' . $template_name . '/index.html')) { $this->create_index($id); } if (file_exists($html_dir . $fname)) { $ret['state'] = 1; $ret['url'] = FB_DOMAIN . $filename . $fname; } else { $ret['state'] = 0; } $this->addItem($ret); $this->output(); }
public function generate() { require_once CUR_CONF_PATH . 'lib/template.class.php'; $this->template = new template_mode(); $id = intval($this->input['id']); if (!$id) { $this->errorOutput(NOID); } $vote = $this->mVote->get_vote($id); if ($vote['status'] == 0 || $vote['status'] == 2) { $this->errorOutput('对不起,该投票未通过审核'); } if (!$vote['template_id']) { $this->errorOutput('对不起,尚未选择模板'); } $vote['url'] = !defined('VOTE_DOMAIN') || !VOTE_DOMAIN ? '../submit.php' : VOTE_DOMAIN . 'submit.php'; $temp = $this->template->get_template($vote['template_id']); $template_file = $temp['template_file']; $style_dir = $temp['style_dir']; $entrip = create_filename($vote['create_time'] . $vote['id'], APP_UNIQUEID); $html_dir = DATA_DIR . $entrip . '/'; $options = $this->mVote->get_vote_options($id); if (!$options) { $this->errorOutput('该问卷为空问卷'); } $vote['mode_type'] = 'choose'; $vote['options'] = $options; $vote['unique_name'] = 'option_id'; $vote['cor'] = $vote['option_type']; $forms[] = $vote; $content = $this->template->generation($vote, $template_file, $forms); if (!$content) { $this->errorOutput('生成模板失败'); } if (!is_dir($html_dir)) { hg_mkdir($html_dir); } if (!$this->template->create_file($html_dir, $content)) { $this->errorOutput('生成失败'); } if (!$this->template->generate_assist($style_dir, $html_dir)) { $this->errorOutput('生成辅助文件失败'); } if (file_exists($html_dir . 'index.html')) { if ($vote['status']) { $this->mVote->update(array('reupdate' => 0, 'id' => $id)); } $ret['state'] = 1; $ret['url'] = VOTE_DOMAIN . $entrip . '/index.html'; } else { $ret['state'] = 0; } $this->addItem($ret); $this->output(); }