function show_add_m01() { $db = init_db(); $tpl = init_tpl(SRVROOT . $this->tmpl_path); $plu_header = SRVROOT . $this->plu_header_path; //加入麵包屑 $func_Cname = "新增口碑文章"; $trail = new Breadcrumb(); $trail->add($func_Cname, $_SERVER['REQUEST_URI'], 2); $sel_sql = "SELECT DISTINCT kw_id, kw_content FROM plu_keywords"; $sel_result = $db->get_results($sel_sql, ARRAY_A); $tpl->assign("sel_data", $sel_result); $tpl->assign("jq_multi_select_path", WEBROOT . "/cms/lib/jquery/multiSelect/"); $tpl->assign("func_Cname", $func_Cname); $tpl->assign("css_path", WEBROOT . $this->css_path); $tpl->assign("plu_header_path", $plu_header); $tpl->assign("do_add_m01_url", $this->plu_path . "&func=do_add_m01"); $tpl->assign("cancel_add_url", $this->plu_path . "&func=show_m01_list"); $tpl->assign("meta_field", is_maintainer()); return $tpl->fetch("show_add_m01.tpl"); }
function auth_valid_function($func_id, $site_id = 0) { $user_id = get_login_id(); if (is_maintainer()) { return true; } if (empty($user_id)) { return redirect(WEBROOT . "/cms/admin/index.php?cmsroot=login", 0, '您尚未登入'); } $available_funcs = auth_get_functions($user_id, $site_id); //print_r($available_funcs); if (empty($available_funcs)) { redirect(WEBROOT . "/cms/admin/index.php?cmsroot=login", 0, '您無權使用此功能'); return false; } $key = in_array($func_id, $available_funcs); if ($key == false) { redirect(WEBROOT . "/cms/admin/index.php?cmsroot=login", 0, '您無權使用此功能'); return false; } return true; }
} ?> </li> <?php } //end if ?> <?php } //end if $counter++; } //end foreach if (is_maintainer()) { ?> <li><a href="<?php echo $_SERVER['WEBROOT'] . '/cms/admin/index.php?cmsroot=content&cmsid=0'; ?> "><b><?php echo "結構管理"; ?> </b></a></li> <li><a href="<?php echo $_SERVER['WEBROOT'] . '/cms/admin/index.php?cmsroot=default&cmsid=0'; ?> "><b><?php echo "全域設定"; ?> </b></a></li>
function show_edit_news() { $db = init_db(); $tpl = init_tpl(SRVROOT . $this->tmpl_path); $plu_header = SRVROOT . $this->plu_header_path; require_once SRVROOT . FCK . 'fckeditor.php'; $fckeditor = new FCKeditor('content'); $fckeditor->Width = '100%'; $fckeditor->Height = '400px'; $fckeditor->BasePath = WEBROOT . FCK; //3.重要參數: 以 url路徑指定 FCKeditor 主程式所在位置 //加入麵包屑 $func_Cname = "變更最新消息"; $trail = new Breadcrumb(); $trail->add($func_Cname, $_SERVER['REQUEST_URI'], 2); $sel_sql = "SELECT DISTINCT cate_id, cate_name FROM plu_news_category"; $sel_result = $db->get_results($sel_sql, ARRAY_A); $tpl->assign("sel_data", $sel_result); $news_id = isset($_GET['news_id']) ? $_GET['news_id'] : ""; $sql = "SELECT UNIX_TIMESTAMP(PublishDate) as t,plu_news.* FROM plu_news WHERE news_id={$news_id}"; $result = $db->get_row($sql, ARRAY_A); if (isset($result)) { $fckeditor->Value = $result['content']; $tpl->assign('publish_date', substr($result['PublishDate'], 0, 10)); $tpl->assign('publish_hour', substr($result['PublishDate'], 11, 2)); $tpl->assign('publish_minutes', substr($result['PublishDate'], 14, 2)); foreach ($result as $key => $value) { if ($key == "img_name" || $key == "movie_name") { $tpl->assign($key, WEBROOT . $this->upload_path . $value); } else { $tpl->assign($key, $value); } } } $tpl->assign("validate_url", WEBROOT . '/cms/lib/jquery/jquery.validate.js'); $tpl->assign("func_Cname", $func_Cname); $tpl->assign("plu_header_path", $plu_header); $tpl->assign("do_edit_news_url", $this->plu_path . "&func=do_edit_news&nid=" . $news_id); $tpl->assign("cancel_edit_url", $this->plu_path . "&func=show_news_list"); $tpl->assign("content_editor", $fckeditor->CreateHtml()); $tpl->assign("meta_field", is_maintainer()); return $tpl->fetch("show_edit_news.tpl"); }
function show_edit_product() { $db = init_db(); $tpl = init_tpl(SRVROOT . $this->tmpl_path); $plu_header = SRVROOT . $this->plu_header_path; require_once SRVROOT . FCK . 'fckeditor.php'; $fckeditor = new FCKeditor('content'); $fckeditor->Width = '100%'; $fckeditor->Height = '400px'; $fckeditor->BasePath = WEBROOT . FCK; //3.重要參數: 以 url路徑指定 FCKeditor 主程式所在位置 //加入麵包屑 $func_Cname = "變更商品"; $trail = new Breadcrumb(); $trail->add($func_Cname, $_SERVER['REQUEST_URI'], 2); $sel_sql = "SELECT DISTINCT cate_id, cate_name FROM plu_product_category WHERE parent_id=-1"; $sel_result = $db->get_results($sel_sql, ARRAY_A); $tpl->assign("sel_data", $sel_result); $prod_id = isset($_GET['prod_id']) ? $_GET['prod_id'] : ""; $sql = "SELECT UNIX_TIMESTAMP(PublishDate) as t,plu_product.* FROM plu_product WHERE prod_id={$prod_id}"; $result = $db->get_row($sql, ARRAY_A); if (isset($result)) { $sel_sql = "SELECT DISTINCT cate_id, cate_name, parent_id FROM plu_product_category WHERE parent_id<>-1 AND parent_id=(SELECT parent_id FROM plu_product_category WHERE cate_id=" . $result['cate_id'] . ")"; $sel_result = $db->get_results($sel_sql, ARRAY_A); $tpl->assign("sec_sel_data", $sel_result); $row = $sel_result[0]; if ($sel_result != NULL && $row['parent_id'] != $result['cate_id']) { $tpl->assign('cate_id', $row['parent_id']); $tpl->assign('sec_cate_id', $result['cate_id']); } else { $tpl->assign('cate_id', $result['cate_id']); } $fckeditor->Value = $result['content']; $tpl->assign('publish_date', substr($result['PublishDate'], 0, 10)); $tpl->assign('publish_hour', substr($result['PublishDate'], 11, 2)); $tpl->assign('publish_minutes', substr($result['PublishDate'], 14, 2)); foreach ($result as $key => $value) { if ($key == "img_name" || $key == "movie_name") { $tpl->assign("img_path", WEBROOT . $this->upload_path); $tpl->assign($key, explode('|', $value)); } else { if ($key != "cate_id") { $tpl->assign($key, $value); } } } } $tpl->assign("multiFile_url", WEBROOT . '/cms/lib/jquery/ui/jquery.multifile.js'); $tpl->assign("validate_url", WEBROOT . '/cms/lib/jquery/jquery.validate.js'); $tpl->assign("meta_field", is_maintainer()); $tpl->assign("second_cate", $this->get_subcategory_script()); $tpl->assign("func_Cname", $func_Cname); $tpl->assign("plu_header_path", $plu_header); $tpl->assign("do_edit_product_url", $this->plu_path . "&func=do_edit_product&prod_id=" . $prod_id); $tpl->assign("cancel_edit_url", $this->plu_path . "&func=show_product_list"); $tpl->assign("content_editor", $fckeditor->CreateHtml()); return $tpl->fetch("show_edit_product.tpl"); }