function submit_f() { $oldpass = $this->get("oldpass"); if (!$oldpass) { error(P_Lang('管理员密码验证不能为空'), $this->url("me", "setting"), "error"); } $rs = $this->model('admin')->get_one($_SESSION["admin_id"]); if (!password_check($oldpass, $rs["pass"])) { error(P_Lang("管理员密码不正确"), $this->url("me", "setting"), "error"); } $name = $this->get('name'); $array = array('email' => $this->get('email')); $update_login = false; $admin = $this->model('admin')->get_one($_SESSION['admin_id'], 'id'); $tip = P_Lang('信息修改成功'); if ($name && $name != $admin['account']) { //修改管理员账号 $check = $this->model('admin')->check_account($name, $_SESSION['admin_id']); if ($check) { error(P_Lang('管理员账号已经存在,请重新设置'), $this->url('me', 'setting'), 'error'); } $array['account'] = $name; $update_login = true; $tip = P_Lang('管理员账号信息变更成功,请重新登录'); } $newpass = $this->get("newpass"); if ($newpass) { $chkpass = $this->get("chkpass"); if ($newpass != $chkpass) { error(P_Lang("两次输入的新密码不一致"), $this->url("me", "setting"), "error"); } $array['pass'] = password_create($newpass); $tip = P_Lang('密码修改成功,请下次登录后使用新密码登录!'); } $array['fullname'] = $this->get('fullname'); $array['close_tip'] = $this->get('close_tip'); $this->model('admin')->save($array, $_SESSION['admin_id']); if ($update_login) { error($tip, $this->url('logout'), 'ok'); } else { $info = $this->model('admin')->get_one($_SESSION['admin_id'], 'id'); $_SESSION['admin_rs'] = $info; $html = '<input type="button" value=" ' . P_Lang('确定') . ' " class="submit" onclick="$.dialog.close();" />'; error_open($tip, "ok", $html); } }
function preview_f() { $id = $this->get("id"); if (!$id) { error_open(P_Lang('未指定附件')); } $rs = $this->model('res')->get_one($id, true); $config = $this->model('res')->type_list(); $type = "files"; foreach ($config as $key => $value) { $ext = array(); if ($value["ext"]) { $ext = explode(",", $value["ext"]); } if (in_array($rs["ext"], $ext)) { $type = $key; } } $this->assign("type", $type); $this->assign("rs", $rs); $this->view("res_action_preview"); }
public function open_f() { $id = $this->get("id"); if (!$id) { $id = "tpl"; } $site_id = $_SESSION["admin_site_id"]; $config = $this->model('site')->get_one($site_id); $tpl_id = $config["tpl_id"]; $rs = $this->model('tpl')->get_one($tpl_id); if (!$rs) { error_open(P_Lang('站点尚未设置默认风格,请先设置好'), "error"); } if (!$rs["ext"]) { $rs["ext"] = "html"; } $this->assign("site_rs", $config); $this->assign("rs", $rs); $folder = $this->get("folder"); if (!$folder) { $folder = "/"; } if (substr($folder, -1) != "/") { $folder .= "/"; } $this->assign("folder", $folder); //绑定目录 $tpl_dir = $this->dir_root . "tpl/" . $rs["folder"] . $folder; $tpl_list = $this->lib('file')->ls($tpl_dir); $ext_length = strlen($rs["ext"]); if ($tpl_list) { $myurl = $this->url("tpl", "open"); $rslist = array(); foreach ($tpl_list as $key => $value) { $bname = $this->lib('string')->to_utf8(basename($value)); $type = is_dir($value) ? "dir" : "file"; $url = $type == "dir" ? $myurl . "&folder=" . rawurlencode($folder . $bname . "/") . "&id=" . $id : ""; $date = date("Y-m-d H:i:s", filemtime($value)); $tplid = ""; if ($type == "file") { if (substr($bname, -$ext_length) == $rs["ext"]) { $tplid = substr($bname, 0, -($ext_length + 1)); $type = "html"; } else { $tmp = explode(".", $bname); $tmp_total = count($tmp); if ($tmp_total > 1) { $tmp_ext = strtolower($tmp[$tmp_total - 1]); if (file_exists($this->dir_root . "images/filetype/" . $tmp_ext . ".gif")) { $type = $tmp_ext; } else { $type = "unknow"; } } else { $type = "unknow"; } } } $rslist[] = array("filename" => $value, "title" => $bname, "date" => $date, "type" => $type, "url" => $url, "tplid" => $tplid); } $this->assign("rslist", $rslist); } $this->assign("id", $id); $this->view("tpl_open"); }
function field_edit_save_f() { $this->fields_auto(); if (!$this->popedom["set"]) { error_open(P_Lang('您没有权限执行此操作')); } $id = $this->get("id", "int"); if (!$id) { error_open(P_Lang('未指定ID')); } $title = $this->get("title"); $note = $this->get("note"); $form_type = $this->get("form_type"); $form_style = $this->get("form_style", "html"); $content = $this->get("content"); $format = $this->get("format"); $taxis = $this->get("taxis", "int"); $ext_form_id = $this->get("ext_form_id"); $ext = array(); if ($ext_form_id) { $list = explode(",", $ext_form_id); foreach ($list as $key => $value) { $val = explode(':', $value); if ($val[1] && $val[1] == "checkbox") { $value = $val[0]; $ext[$value] = $this->get($value, "checkbox"); } else { $value = $val[0]; $ext[$value] = $this->get($value); } } } $array = array(); $array["title"] = $title; $array["note"] = $note; $array["form_type"] = $form_type; $array["form_style"] = $form_style; $array["format"] = $format; $array["content"] = $content; $array["taxis"] = $taxis; $array["ext"] = $ext && count($ext) > 0 ? serialize($ext) : ""; $array["is_edit"] = $this->get("is_edit", "int"); $this->model('user')->fields_save($array, $id); $html = '<input type="button" value=" ' . P_Lang('确定') . ' " class="submit" onclick="$.dialog.close();" />'; error_open(P_Lang('自定义字段信息配置成功'), "ok", $html); }
function field_edit_f() { $id = $this->get("id", "int"); if (!$id) { error_open(P_Lang('未指定ID')); } $rs = $this->model('module')->field_one($id); $this->assign("rs", $rs); $m_rs = $this->model('module')->get_one($rs['module_id']); $this->assign('m_rs', $m_rs); $this->assign("id", $id); $this->view("module_field_set"); }
function url_f() { $id = $this->get("id"); if (!$id) { $id = "content"; } $this->assign("id", $id); $pid = $this->get("pid"); if ($pid) { $p_rs = $this->model('project')->get_one($pid); $type = $this->get("type"); if (!$p_rs) { error_open(P_Lang('项目不存在')); } if ($type == "cate" && $p_rs["cate"]) { $catelist = $this->model('cate')->get_all($p_rs["site_id"], 1, $p_rs["cate"]); $this->assign("rslist", $catelist); $this->assign("p_rs", $p_rs); $this->view("open_url_cate"); } else { $pageid = $this->get($this->config["pageid"], "int"); $psize = $this->config["psize"]; if (!$psize) { $psize = 20; } if (!$pageid) { $pageid = 1; } $offset = ($pageid - 1) * $psize; $pageurl = $this->url("open", "url", "pid=" . $pid . "&type=list&id=" . $id); $condition = "l.site_id='" . $p_rs["site_id"] . "' AND l.project_id='" . $pid . "' AND l.parent_id='0' "; $keywords = $this->get("keywords"); if ($keywords) { $condition .= " AND l.title LIKE '%" . $keywords . "%' "; $pageurl .= "&keywords=" . rawurlencode($keywords); $this->assign("keywords", $keywords); } $rslist = $this->model('list')->get_list($p_rs["module"], $condition, $offset, $psize, $p_rs["orderby"]); if ($rslist) { $sub_idlist = array_keys($rslist); $sub_idstring = implode(",", $sub_idlist); $con_sub = "l.site_id='" . $p_rs["site_id"] . "' AND l.project_id='" . $pid . "' AND l.parent_id IN(" . $sub_idstring . ") "; $sublist = $this->model('list')->get_list($p_rs["module"], $con_sub, 0, 0, $p_rs["orderby"]); if ($sublist) { foreach ($sublist as $key => $value) { $rslist[$value["parent_id"]]["sonlist"][$value["id"]] = $value; } } } //读子主题 $total = $this->model('list')->get_total($p_rs["module"], $condition); $string = 'home=' . P_Lang('首页') . '&prev=' . P_Lang('上一页') . '&next=' . P_Lang('下一页') . '&last=' . P_Lang('尾页') . '&half=3'; $string .= '&add=' . P_Lang('数量:') . '(total)/(psize)' . P_Lang(',') . P_Lang('页码:') . '(num)/(total_page)&always=1'; $pagelist = phpok_page($pageurl, $total, $pageid, $psize, $string); $this->assign("pagelist", $pagelist); $this->assign("p_rs", $p_rs); $this->assign("rslist", $rslist); $this->view("open_url_list"); } } else { $condition = " p.status='1' "; $rslist = $this->model('project')->get_all_project($_SESSION["admin_site_id"], $condition); $this->assign("rslist", $rslist); } $this->assign("id", $id); $this->view("open_url"); }
function edit_f() { if (!$this->popedom["modify"]) { error(P_Lang('您没有权限执行此操作'), '', 'error'); } $id = $this->get("id", "int"); if (!$id) { error_open(P_Lang('未指定ID')); } $rs = $this->model('reply')->get_one($id); if (!$rs) { error_open(P_Lang('数据记录不存在')); } $this->assign("id", $id); $this->assign("rs", $rs); $title_rs = $this->model('list')->get_one($rs["tid"]); $this->assign("title_rs", $title_rs); $this->view("reply_content"); }
public function save1_f() { $title = $this->get("title"); $note = $this->get("note"); $identifier = $this->get("identifier"); if (!$identifier) { error(P_Lang('字段标识不能为空'), "", "error"); } $identifier = strtolower($identifier); //字符串是否符合条件 if (!preg_match("/[a-z][a-z0-9\\_\\-]+/", $identifier)) { error(P_Lang('字段标识不符合系统要求,限字母、数字及下划线且必须是字母开头'), "", "error"); } $chk = $this->model('fields')->is_has_sign($identifier); if ($chk) { error(P_Lang('字段标识已经存在'), "", "error"); } $field_type = $this->get("field_type"); $form_type = $this->get("form_type"); $form_style = $this->get("form_style"); $format = $this->get("format"); $content = $this->get("content"); $taxis = $this->get("taxis", "int"); $ext_form_id = $this->get("ext_form_id"); $ext = array(); if ($ext_form_id) { $list = explode(",", $ext_form_id); foreach ($list as $key => $value) { $val = explode(':', $value); if ($val[1] && $val[1] == "checkbox") { $value = $val[0]; $ext[$value] = $this->get($value, "checkbox"); } else { $value = $val[0]; $ext[$value] = $this->get($value); } } } $myext = $ext && count($ext) > 0 ? serialize($ext) : ""; $array = array(); $array["title"] = $title; if (!$id) { $array["identifier"] = $identifier; } $array["field_type"] = $field_type; $array["note"] = $note; $array["form_type"] = $form_type; $array["form_style"] = $form_style; $array["format"] = $format; $array["content"] = $content; $array["taxis"] = $taxis; $array["ext"] = $myext; $area = $this->get("area", "checkbox"); $array["area"] = $area && is_array($area) ? implode(",", $area) : ""; $this->model('fields')->save($array); $html = P_Lang('系统会在2秒后关闭窗口,') . '<a href="javascript:parent.window.location.reload();void(0);">' . P_Lang('您可以点这里关闭窗口') . '</a>'; $html .= '<script type="text/javascript">' . "\n"; $html .= 'window.setTimeout(\'parent.window.location.reload()\',2000)' . "\n"; $html .= "\n" . '</script>'; error_open(P_Lang('字段创建成功'), "ok", $html); }
function title_f() { $psize = $this->config["psize"]; if (!$psize) { $psize = 30; } $pageid = $this->config["pageid"] ? $this->config["pageid"] : "pageid"; $pageid = $this->get($pageid, "int"); if (!$pageid || $pageid < 1) { $pageid = 1; } $offset = ($pageid - 1) * $psize; $input = $this->get("identifier"); if (!$input) { error_open("未指定表单ID", "error"); } $multi = $this->get("multi", "int"); $pageurl = $this->url("inp", "title") . "&identifier=" . rawurlencode($input); if ($multi) { $pageurl .= "&multi=1"; } $project_id = $this->get("project_id"); if (!$project_id) { error_open("未指定项目ID", "error"); } $tmp = explode(",", $project_id); $lst = array(); foreach ($tmp as $key => $value) { $value = intval($value); if ($value) { $lst[] = $value; } } $lst = array_unique($lst); $project_id = implode(",", $lst); if (!$project_id) { error_open("指定项目异常", "error"); } $pageurl .= "&project_id=" . rawurlencode($project_id); $condition = "l.project_id IN(" . $project_id . ") AND l.status='1'"; $total = $this->model('list')->get_all_total($condition); if ($total < 1) { error("没有内容信息"); } $rslist = $this->model('list')->get_all($condition, $offset, $psize); $this->assign("total", $total); $this->assign("rslist", $rslist); $pagelist = phpok_page($pageurl, $total, $pageid, $psize, "home=首页&prev=上一页&next=下一页&last=尾页&half=5&add=(total)/(psize)&always=1"); $this->assign("pagelist", $pagelist); $this->assign("multi", $multi); $this->assign("input", $input); $this->tpl->path_change(""); $this->view($this->dir_phpok . "view/inp_title.html", "abs-file"); }
function prolist_f() { $id = $this->get('id'); if (!$id) { $id = 'add'; } $currency_id = $this->get('currency_id', 'int'); $this->assign('currency_id', $currency_id); $formurl = $pageurl = $this->url('order', 'prolist', 'id=' . $id . '¤cy_id=' . $currency_id); $project = $this->model('project')->project_all($_SESSION['admin_site_id'], 'id', 'is_biz != 0'); if (!$project) { error_open(P_Lang('您的站点没有启用电子商务功能项目')); } $condition = "l.site_id IN(0," . $_SESSION['admin_site_id'] . ") AND l.status=1"; $idlist = array_keys($project); $condition .= " AND l.project_id IN(" . implode(',', $idlist) . ")"; $exinclude = $this->get('exinclude'); if ($exinclude) { $tmp = explode(",", $exinclude); $exinclude = ''; foreach ($tmp as $key => $value) { $value = intval($value); if ($value) { $exinclude[] = $value; } } $exinclude = implode(',', $exinclude); $condition .= " AND l.id NOT IN(" . $exinclude . ")"; $pageurl .= "&exinclude=" . rawurlencode($exinclude); $formurl .= "&exinclude=" . rawurlencode($exinclude); } $keywords = $this->get('keywords'); if ($keywords) { $pageurl .= "&keywords=" . rawurlencode($keywords); $condition .= " AND l.title LIKE '%" . $keywords . "%' "; $this->assign('keywords', $keywords); } $this->assign('pageurl', $pageurl); $this->assign('formurl', $formurl); $pageid = $this->get($this->config['pageid'], 'int'); if (!$pageid) { $pageid = 1; } $psize = 20; $offset = ($pageid - 1) * $psize; $total = $this->model('list')->get_all_total($condition); if ($total < 1) { error_open(P_Lang('没有产品信息')); } $rslist = $this->model('list')->get_all($condition, $offset, $psize); $string = 'home=' . P_Lang('首页') . '&prev=' . P_Lang('上一页') . '&next=' . P_Lang('下一页') . '&last=' . P_Lang('尾页') . '&half=5'; $string .= '&add=' . P_Lang('数量:') . '(total)/(psize)' . P_Lang(',') . P_Lang('页码:') . '(num)/(total_page)&always=1'; $pagelist = phpok_page($pageurl, $total, $pageid, $psize, $string); $this->assign('pagelist', $pagelist); $this->assign('rslist', $rslist); $this->assign('id', $id); $this->view("order_prolist"); }