$categories =& $category_handler->getTree(0, "submit", "----"); $cat_options = array(); $top_categories = array(); $cat_pid = 0; foreach ($categories as $id => $cat) { $cat_options[$id] = $cat["prefix"] . $cat["cat_title"]; if ($cat["cat_pid"] == 0) { $top_categories[$id]["cat"] = $cat; $cat_pid = $id; } else { $top_categories[$cat_pid]["sub"][$id] = $cat; } } // base category $form_element["inactive"]["cat_id"] = new XoopsFormHidden("cat_id", $cat_id); if (art_isAdministrator() || $isAuthor) { $cat_select = new XoopsFormSelect("", "cat_id", $cat_id); $cat_select->addOptionArray($cat_options); $cat_option_tray = new XoopsFormElementTray(art_constant("MD_CATEGORY_BASE"), "<br />"); $cat_option_tray->addElement($cat_select); $form_element["active"]["cat_id"] = $cat_option_tray; } else { $form_element["active"]["cat_id"] =& $form_element["inactive"]["cat_id"]; } $col_num = 3; $col_wid = floor(95 / $col_num); $category_string = "<div>"; $top_count = 0; //$form_element["active"]["category_hidden"] = array(); //$form_element["inactive"]["category_hidden"] = array(); foreach (array_keys($top_categories) as $id) {
array_unshift($image_array, _NONE); $image_select = new XoopsFormSelect("", "cat_image", $cat_image); $image_select->addOptionArray($image_array); $image_select->setExtra("onchange=\"showImgSelected('img', 'cat_image', '/" . $path_image . "/', '', '" . XOOPS_URL . "')\""); $image_tray = new XoopsFormElementTray("", " "); $image_tray->addElement($image_select); if (!empty($cat_image) && file_exists(XOOPS_ROOT_PATH . "/" . $path_image . "/" . $cat_image)) { $image_tray->addElement(new XoopsFormLabel("", "<div style=\"padding: 8px;\"><img src=\"" . XOOPS_URL . "/" . $path_image . "/" . $cat_image . "\" name=\"img\" id=\"img\" alt=\"\" /></div>")); } else { $image_tray->addElement(new XoopsFormLabel("", "<div style=\"padding: 8px;\"><img src=\"" . XOOPS_URL . "/images/blank.gif\" name=\"img\" id=\"img\" alt=\"\" /></div>")); } $image_option_tray->addElement($image_tray); $form_art->addElement($image_option_tray); } // The moderator if (art_isAdministrator()) { $form_art->addElement(new XoopsFormSelectUser(art_constant("MD_MODERATOR"), 'cat_moderator', false, $category_obj->getVar("cat_moderator"), 5, true)); } else { if ($moderators = $category_obj->getVar("cat_moderator")) { $moderator_checkbox = new XoopsFormCheckBox(art_constant("MD_MODERATOR"), "cat_moderator", array_keys($moderators)); $moderator_checkbox->addOptionArray(art_getUnameFromId($moderators)); $moderator_checkbox->setExtra("\"disabled\""); $form_art->addElement($moderator_checkbox); } } // Entry article $limit_article = 100; if ($category_obj->getVar("cat_id")) { $article_handler =& xoops_getmodulehandler("article", $GLOBALS["artdirname"]); $criteria_article = new Criteria("cat_id", $category_obj->getVar("cat_id")); $article_count = $article_handler->getCount($criteria_article);
* which is considered copyrighted (c) material of the original comment or credit authors. * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ * @license http://www.fsf.org/copyleft/gpl.html GNU public license * @package article * @since 1.0 * @author Taiwen Jiang <*****@*****.**> * @version $Id: cp.category.php 2178 2008-09-26 08:34:09Z phppp $ */ include "header.php"; $from = !empty($_GET["from"]) || !empty($_POST["from"]) ? 1 : 0; $category_handler =& xoops_getmodulehandler("category", $GLOBALS["artdirname"]); $isadmin = art_isAdministrator(); if (!$isadmin) { redirect_header(XOOPS_URL . "/modules/" . $GLOBALS["artdirname"] . "/index.php", 2, art_constant("MD_NOACCESS")); } $xoopsOption["xoops_pagetitle"] = $xoopsModule->getVar("name") . " - " . art_constant("MD_CPCATEGORY"); $template = $xoopsModuleConfig["template"]; $xoopsOption["template_main"] = art_getTemplate("cpcategory", $template); $xoopsOption["xoops_module_header"] = art_getModuleHeader($template); // Disable cache $xoopsConfig["module_cache"][$xoopsModule->getVar("mid")] = 0; include_once XOOPS_ROOT_PATH . "/header.php"; include XOOPS_ROOT_PATH . "/modules/" . $xoopsModule->getVar("dirname") . "/include/vars.php"; // get Category Tree /* array( "prefix" =>
/* if (defined("XOOPS_PATH")): include_once XOOPS_ROOT_PATH."/modules/" . $GLOBALS["artdirname"]."/Frameworks/class/xoopsformloader.php"; else: include_once XOOPS_ROOT_PATH."/class/xoopsformloader.php"; endif; */ // Form $form_art = new XoopsThemeForm(art_constant("MD_AUTHOR") . " " . $writer_obj->getVar("writer_name") . " (" . ($writer_obj->getVar("writer_id") ? _EDIT : _ADD) . ")", "formwriter", xoops_getenv('PHP_SELF')); $form_art->setExtra("enctype=\"multipart/form-data\""); // Title $form_art->addElement(new XoopsFormText(art_constant("MD_NAME"), "writer_name", 50, 255, $writer_obj->getVar("writer_name")), true); // Profile $form_art->addElement(new XoopsFormTextArea(art_constant("MD_PROFILE"), "writer_profile", $writer_obj->getVar("writer_profile", "E"))); // Avatar if (art_isAdministrator() && !empty($xoopsModuleConfig["path_image"])) { //require_once(XOOPS_ROOT_PATH . "/class/xoopstree.php"); $writer_avatar = $writer_obj->getVar("writer_avatar"); $image_option_tray = new XoopsFormElementTray(art_constant("MD_IMAGE_UPLOAD"), "<br />"); $image_option_tray->addElement(new XoopsFormFile("", "userfile", "")); $form_art->addElement($image_option_tray); unset($image_tray); unset($image_option_tray); $image_option_tray = new XoopsFormElementTray(art_constant("MD_IMAGE_SELECT"), "<br />"); $path_image = $xoopsModuleConfig["path_image"]; $image_array =& XoopsLists::getImgListAsArray(XOOPS_ROOT_PATH . "/" . $path_image . "/"); array_unshift($image_array, _NONE); $image_select = new XoopsFormSelect("", "writer_avatar", $writer_avatar); $image_select->addOptionArray($image_array); $image_select->setExtra("onchange=\"showImgSelected('img', 'writer_avatar', '/" . $path_image . "/', '', '" . XOOPS_URL . "')\""); $image_tray = new XoopsFormElementTray("", " ");
/** * Article module for XOOPS * * You may not change or alter any portion of this comment or credits * of supporting developers from this source code or any supporting source code * which is considered copyrighted (c) material of the original comment or credit authors. * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ * @license http://www.fsf.org/copyleft/gpl.html GNU public license * @package article * @since 1.0 * @author Taiwen Jiang <*****@*****.**> * @version $Id: edit.category.php 2178 2008-09-26 08:34:09Z phppp $ */ include "header.php"; $category_id = empty($_GET["category"]) ? 0 : intval($_GET["category"]); $from = empty($_GET["from"]) ? 0 : 1; $category_handler =& xoops_getmodulehandler("category", $GLOBALS["artdirname"]); $category_obj =& $category_handler->get($category_id); if (!empty($category_id) && !$category_handler->getPermission($category_obj, "moderate") || empty($category_id) && !art_isAdministrator()) { redirect_header(XOOPS_URL . "/modules/" . $GLOBALS["artdirname"] . "/index.php", 2, art_constant("MD_NOACCESS")); } // Disable cache $xoopsConfig["module_cache"][$xoopsModule->getVar("mid")] = 0; include XOOPS_ROOT_PATH . '/header.php'; include XOOPS_ROOT_PATH . "/modules/" . $xoopsModule->getVar("dirname") . "/include/vars.php"; include XOOPS_ROOT_PATH . "/modules/" . $GLOBALS["artdirname"] . "/include/form.category.php"; include XOOPS_ROOT_PATH . "/footer.php";
} $tags = array("cat_title"); if (!empty($uid)) { $tags[] = "cat_moderator"; } if (!($categories_obj = $category_handler->getAllByPermission("access", $tags))) { redirect_header("index.php", 2, art_constant("MD_NOACCESS")); } $categories_id = empty($categories_id) ? array_keys($categories_obj) : $categories_id; /* * Instantiate user object */ if (!empty($category_obj)) { $xoopsuser_is_admin = art_isAdministrator() || art_isModerator($category_obj); } else { $xoopsuser_is_admin = art_isAdministrator(); } $xoopsuser_is_author = false; if (!empty($uid)) { if (!empty($xoopsUser) && $uid == $xoopsUser->getVar("uid")) { $author_obj =& $xoopsUser; $xoopsuser_is_author = true; } else { $member_handler =& xoops_gethandler("member"); $author_obj =& $member_handler->getUser($uid); } if (empty($author_obj) || !$author_obj->isActive()) { redirect_header(XOOPS_URL . "/modules/" . $GLOBALS["artdirname"] . "/index.php", 2, art_constant("MD_INVALID")); exit; } $tracks_extra[] = array("title" => $author_obj->getVar("uname"), "link" => XOOPS_URL . "/userinfo.php?uid={$uid}");
$button_tray = new XoopsFormElementTray(""); $button_tray->addElement($add_button); $button_tray->addElement(new XoopsFormButton('', 'edit', _EDIT, 'submit')); $button_tray->addElement(new XoopsFormButton('', '', _CANCEL, 'reset')); $button_tray->addElement($close_button); $form_user->addElement($user_select_tray); //$form_user->addElement(new XoopsFormHidden('target', $_REQUEST["target"])); $form_user->addElement($button_tray); $form_user->display(); } $form_sel = new XoopsThemeForm(_MA_LOOKUP_USER, "searchuser", xoops_getenv('PHP_SELF')); $searchtext = new XoopsFormText(_MA_SEARCH_TEXT, 'query', 60, 255, @$_REQUEST['query']); $searchtext->setDescription(_MA_SEARCH_TEXT_DESC); $form_sel->addElement($searchtext); $close_button = new XoopsFormButton('', '', _CLOSE, 'button'); $close_button->setExtra('onclick="window.close()"'); $button_tray = new XoopsFormElementTray(""); $button_tray->addElement(new XoopsFormButton('', 'search', _SEARCH, 'submit')); $button_tray->addElement($close_button); //$form_sel->addElement(new XoopsFormHidden('target', $_REQUEST["target"])); $form_sel->addElement($button_tray); $form_sel->display(); if (!empty($_POST["edit"]) && !empty($_POST[$name_current])) { $writer_id = intval($_POST[$name_current][0]); } $writer_obj =& $writer_handler->get($writer_id); if (art_isAdministrator() || is_object($xoopsUser) && ($writer_handler->getVar("uid") == $xoopsUser->getVar("uid") || $writer_obj->isNew())) { include XOOPS_ROOT_PATH . "/modules/" . $GLOBALS["artdirname"] . "/include/form.writer.php"; } $xoopsOption['output_type'] = "plain"; include "footer.php";