function b_gnavi_d3pipes_joints($options) { global $xoopsDB; $mydirname = empty($options[0]) ? basename(dirname(dirname(__FILE__))) : $options[0]; if (preg_match('/[^0-9a-zA-Z_-]/', $mydirname)) { die('Invalid mydirname'); } require dirname(dirname(__FILE__)) . '/include/read_configs.php'; $cat_limitation = empty($options[1]) ? 0 : 1; $photos_num = empty($options[2]) ? 10 : intval($options[2]); $show_desc = empty($options[3]) ? 0 : 1; $query = "ORDER BY unixtime DESC"; $title_max_length = 255; // Category limitation if ($cat_limitation) { include_once XOOPS_ROOT_PATH . "/class/xoopstree.php"; $cattree = new XoopsTree($table_cat, "cid", "pid"); $children = $cattree->getAllChildId($cat_limitation); $whr_cat = "l.cid IN ("; foreach ($children as $child) { $whr_cat .= "{$child},"; } $whr_cat .= "{$cat_limitation})"; for ($i = 1; $i <= 4; $i++) { $whr_cat .= " OR l.cid{$i} IN ("; foreach ($children as $child) { $whr_cat .= "{$child},"; } $whr_cat .= "{$cat_limitation})"; } $whr_cat = "(" . $whr_cat . ")"; } else { $whr_cat = '1'; } $block = array(); $myts =& MyTextSanitizer::getInstance(); if ($show_desc) { $result = $xoopsDB->query("SELECT l.lid , l.cid , l.title , l.ext , l.res_x , l.res_y , l.submitter , l.status , l.date AS unixtime , l.hits , l.rating , l.votes , l.comments , c.title AS cat_title ,t.description ,t.arrowhtml FROM {$table_photos} l LEFT JOIN {$table_cat} c ON l.cid=c.cid LEFT JOIN {$table_text} t ON l.lid=t.lid WHERE l.status>0 AND {$whr_cat} {$query}", $photos_num, 0); } else { $result = $xoopsDB->query("SELECT l.lid , l.cid , l.title , l.ext , l.res_x , l.res_y , l.submitter , l.status , l.date AS unixtime , l.hits , l.rating , l.votes , l.comments , c.title AS cat_title FROM {$table_photos} l LEFT JOIN {$table_cat} c ON l.cid=c.cid WHERE l.status>0 AND {$whr_cat} {$query}", $photos_num, 0); } $count = 1; while ($photo = $xoopsDB->fetchArray($result)) { $photo['title'] = xoops_substr($myts->makeTboxData4Show($photo['title']), 0, $title_max_length + 3); $photo['cat_title'] = $myts->makeTboxData4Show($photo['cat_title']); $photo['date'] = formatTimestamp($photo['unixtime'], 's'); if ($show_desc) { $photo['body'] = xoops_substr(strip_tags($myts->displayTarea($photo['description'], $photo['arrowhtml'], 1, 1, 1, 1, 1)), 0, 512); } else { $photo['body'] = ''; } $photo['date'] = formatTimestamp($photo['unixtime'], 's'); $block['photo'][$count++] = $photo; } $block['mod_url'] = $mod_url; return $block; }
/** * oledrion * * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ * @license http://www.fsf.org/copyleft/gpl.html GNU public license * @author Hervé Thouzard (http://www.herve-thouzard.com/) * @version $Id: oledrion.php 12290 2014-02-07 11:05:17Z beckmi $ */ function b_sitemap_oledrion() { require '../oledrion/header.php'; global $sitemap_configs; $xoopsDB = XoopsDatabaseFactory::getDatabaseConnection(); $table = $xoopsDB->prefix('oledrion_cat'); $id_name = 'cat_cid'; $pid_name = 'cat_pid'; $title_name = 'cat_title'; $url = 'category.php?cat_cid='; $order = 'cat_title'; include_once XOOPS_ROOT_PATH . '/class/xoopstree.php'; $mytree = new XoopsTree($table, $id_name, $pid_name); $xoopsDB = XoopsDatabaseFactory::getDatabaseConnection(); $sitemap = array(); $myts = MyTextSanitizer::getInstance(); $i = 0; $sql = "SELECT `{$id_name}`,`{$title_name}` FROM `{$table}` WHERE `{$pid_name}`=0"; if ($order != '') { $sql .= " ORDER BY `{$order}`"; } $result = $xoopsDB->query($sql); while (list($catid, $name) = $xoopsDB->fetchRow($result)) { $sitemap['parent'][$i]['id'] = $catid; $sitemap['parent'][$i]['title'] = $myts->htmlSpecialChars($name); if (oledrion_utils::getModuleOption('urlrewriting') == 1) { // On utilise l'url rewriting $url = 'category' . '-' . intval($catid) . oledrion_utils::makeSeoUrl($name) . '.html'; } else { // Pas d'utilisation de l'url rewriting $url = 'category.php?cat_cid=' . intval($catid); } $sitemap['parent'][$i]['url'] = $url; if (@$sitemap_configs["show_subcategoris"]) { $j = 0; $child_ary = $mytree->getChildTreeArray($catid, $order); foreach ($child_ary as $child) { $count = strlen($child['prefix']) + 1; $sitemap['parent'][$i]['child'][$j]['id'] = $child[$id_name]; $sitemap['parent'][$i]['child'][$j]['title'] = $myts->htmlSpecialChars($child[$title_name]); $sitemap['parent'][$i]['child'][$j]['image'] = $count > 3 ? 4 : $count; if (oledrion_utils::getModuleOption('urlrewriting') == 1) { // On utilise l'url rewriting $url = 'category' . '-' . intval($child[$id_name]) . oledrion_utils::makeSeoUrl($child[$title_name]) . '.html'; } else { // Pas d'utilisation de l'url rewriting $url = 'category.php?cat_cid=' . intval($child[$id_name]); } $sitemap['parent'][$i]['child'][$j]['url'] = $url; $j++; } } $i++; } return $sitemap; }
function makeTopicSelBox($none = false, $seltopic = null, $selname = '', $onchange = '') { $seltopic = is_null($seltopic) ? intval($this->topic_id) : intval($seltopic); ob_start(); $tree = new XoopsTree($this->table, "topic_id", "topic_pid"); $tree->makeMySelBox("topic_title", "topic_title", $seltopic, $none, $selname, $onchange); $ret = ob_get_contents(); ob_end_clean(); //$ret = str_replace('topic_id','topicid', $ret); // non-sense code? return $ret; }
/** * created elements * @license http://www.blags.org/ * @created:2010年05月21日 20时40分 * @copyright 1997-2010 The Martin Group * @author Martin <*****@*****.**> * */ function createElements() { global $xoopsDB; $mytree = new XoopsTree($xoopsDB->prefix("martin_hotel_city"), "city_id", "city_parentid"); // Parent Category ob_start(); $mytree->makeMySelBox("city_name", "", $this->Obj->city_parentid(), 1, 'city_parentid'); //makeMySelBox($title,$order="",$preset_id=0, $none=0, $sel_name="", $onchange="") $this->addElement(new XoopsFormLabel("父类", ob_get_contents())); ob_end_clean(); // City Name $this->addElement(new XoopsFormText('名称', 'city_name', 50, 255, $this->Obj->city_name()), true); $this->addElement(new XoopsFormText('网址', 'city_alias', 50, 255, $this->Obj->city_alias()), true); $this->addElement(new XoopsFormHidden('id', $this->Obj->city_id())); }
function XmobileTree($table_name, $id_name, $pid_name, $title_name = null, $order = null) { $myts =& MyTextSanitizer::getInstance(); XoopsTree::XoopsTree($table_name, $id_name, $pid_name); $this->title = $myts->addSlashes($title_name); $this->order = $myts->addSlashes($order); // if(is_object($criteria)) // { // $this->criteria =& $criteria; // } global $xmobileControl; $this->utils =& $xmobileControl->utils; }
function b_myalbum_topnews_edit($options) { global $xoopsDB; $mydirname = empty($options[0]) ? basename(dirname(dirname(__FILE__))) : $options[0]; $photos_num = empty($options[1]) ? 5 : intval($options[1]); $title_max_length = empty($options[2]) ? 20 : intval($options[2]); $cat_limitation = empty($options[3]) ? 0 : intval($options[3]); $cat_limit_recursive = empty($options[4]) ? 0 : 1; $cols = empty($options[6]) ? 1 : intval($options[6]); include_once XOOPS_ROOT_PATH . "/class/xoopstree.php"; if (!preg_match('/^(\\D+)(\\d*)$/', $mydirname, $regs)) { echo "invalid dirname: " . htmlspecialchars($mydirname); } $mydirnumber = $regs[2] === '' ? '' : intval($regs[2]); $cattree = new XoopsTree($xoopsDB->prefix("myalbum{$mydirnumber}_cat"), "cid", "pid"); ob_start(); $cattree->makeMySelBox("title", "title", $cat_limitation, 1, 'options[3]'); $catselbox = ob_get_contents(); ob_end_clean(); return "\n\t\t" . _ALBM_TEXT_DISP . " \n\t\t<input type='hidden' name='options[0]' value='{$mydirname}' />\n\t\t<input type='text' size='4' name='options[1]' value='{$photos_num}' style='text-align:right;' />\n\t\t<br />\n\t\t" . _ALBM_TEXT_STRLENGTH . " \n\t\t<input type='text' size='6' name='options[2]' value='{$title_max_length}' style='text-align:right;' />\n\t\t<br />\n\t\t" . _ALBM_TEXT_CATLIMITATION . " {$catselbox}\n\t\t" . _ALBM_TEXT_CATLIMITRECURSIVE . "\n\t\t<input type='radio' name='options[4]' value='1' " . ($cat_limit_recursive ? "checked='checked'" : "") . "/>" . _YES . "\n\t\t<input type='radio' name='options[4]' value='0' " . ($cat_limit_recursive ? "" : "checked='checked'") . "/>" . _NO . "\n\t\t<br />\n\t\t<input type='hidden' name='options[5]' value='' />\n\t\t" . _ALBM_TEXT_COLS . " \n\t\t<input type='text' size='2' name='options[6]' value='{$cols}' style='text-align:right;' />\n\t\t<br />\n\t\t\n"; }
function d3forum_updatecategory($mydirname, $cat_id) { $db =& Database::getInstance(); $requests = d3forum_get_requests4sql_category($mydirname); // get children include_once XOOPS_ROOT_PATH . "/class/xoopstree.php"; $mytree = new XoopsTree($db->prefix($mydirname . "_categories"), "cat_id", "pid"); $children = $mytree->getAllChildId($cat_id); $children[] = $cat_id; // loop check if (in_array($requests['pid'], $children)) { die(_MD_D3FORUM_ERR_PIDLOOP); } if (!$db->query("UPDATE " . $db->prefix($mydirname . "_categories") . " SET cat_title='{$requests['title']}', cat_desc='{$requests['desc']}', cat_weight='{$requests['weight']}', cat_options='{$requests['options']}', pid='{$requests['pid']}' WHERE cat_id={$cat_id}")) { die(_MD_D3FORUM_ERR_SQL . __LINE__); } // rebuild category tree d3forum_sync_cattree($mydirname); return $cat_id; }
function delete(&$post, $isDeleteOne = true) { if ($isDeleteOne) { return $this->_delete($post); } else { include_once XOOPS_ROOT_PATH . "/class/xoopstree.php"; $mytree = new XoopsTree($this->db->prefix("bb_posts"), "post_id", "pid"); $arr = $mytree->getAllChild($post->getVar('post_id')); for ($i = 0; $i < count($arr); $i++) { $childpost =& $this->create(false); $childpost->assignVars($arr[$i]); $this->_delete($childpost); unset($childpost); } $this->_delete($post); } return true; }
function delete(&$post, $isDeleteOne = true, $force = false) { if (!is_object($post) || $post->getVar('post_id') == 0) { return false; } if ($isDeleteOne) { if ($post->isTopic()) { $criteria = new CriteriaCompo(new Criteria("topic_id", $post->getVar('topic_id'))); $criteria->add(new Criteria('approved', 1)); $criteria->add(new Criteria('pid', 0, ">")); if ($this->getPostCount($criteria) > 0) { return false; } } return $this->_delete($post, $force); } else { require_once XOOPS_ROOT_PATH . "/class/xoopstree.php"; $mytree = new XoopsTree($this->db->prefix("bb_posts"), "post_id", "pid"); $arr = $mytree->getAllChild($post->getVar('post_id')); for ($i = 0; $i < count($arr); $i++) { $childpost =& $this->create(false); $childpost->assignVars($arr[$i]); $this->_delete($childpost, $force); unset($childpost); } $this->_delete($post, $force); } return true; }
// 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. See the // // GNU General Public License for more details. // // // // You should have received a copy of the GNU General Public License // // along with this program; if not, write to the Free Software // // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // ------------------------------------------------------------------------ // include "header.php"; include_once XOOPS_ROOT_PATH . "/class/xoopstree.php"; $myts =& MyTextSanitizer::getInstance(); // MyTextSanitizer object $mytree = new XoopsTree($xoopsDB->prefix("mydownloads_cat"), "cid", "pid"); // Used to view just a single DL file information. Called from the rating pages $lid = intval($_GET['lid']); $cid = intval($_GET['cid']); $xoopsOption['template_main'] = 'mydownloads_singlefile.html'; include XOOPS_ROOT_PATH . "/header.php"; $q = "SELECT d.lid, d.cid, d.title, d.url, d.homepage, d.version, d.size, d.platform, d.logourl, d.status, d.date, d.hits, d.rating, d.votes, d.comments, t.description FROM " . $xoopsDB->prefix("mydownloads_downloads") . " d, " . $xoopsDB->prefix("mydownloads_text") . " t WHERE d.lid={$lid} AND d.lid=t.lid AND status>0"; $result = $xoopsDB->query($q); list($lid, $cid, $title, $url, $homepage, $version, $size, $platform, $logourl, $status, $time, $hits, $rating, $votes, $comments, $description) = $xoopsDB->fetchRow($result); $pathstring = "<a href='index.php'>" . _MD_MAIN . "</a> : "; $pathstring .= $mytree->getNicePathFromId($cid, "title", "viewcat.php?op="); $xoopsTpl->assign('category_path', $pathstring); $path = $mytree->getPathFromId($cid, "title"); $path = substr($path, 1); $path = str_replace("/", " <img src='" . XOOPS_URL . "/modules/mydownloads/images/arrow.gif' board='0' alt=''> ", $path); $rating = number_format($rating, 2);
function getNicePathFromId($funcURL){ $xt = new XoopsTree($this->table, "id", "pid"); $ret = $xt->getNicePathFromId($this->id, "title", $funcURL); return $ret; }
$ams_topics = $xoopsDB->prefix('ams_topics'); $ams_articles = $xoopsDB->prefix('ams_article'); $ams_text = $xoopsDB->prefix('ams_text'); $ams_files = $xoopsDB->prefix('ams_files'); $ams_links = $xoopsDB->prefix('ams_link'); $ams_rating = $xoopsDB->prefix('ams_rating'); // Retreive News tables names $news_stories_votedata = $xoopsDB->prefix('nw_stories_votedata'); // Misc $comment_handler =& xoops_gethandler('comment'); $notification_handler =& xoops_gethandler('notification'); $ams_news_topics=array(); // Key => AMS Id, Value => News ID // The import by itself // Read topics by their order $mytree = new XoopsTree($ams_topics,'topic_id','topic_pid'); $ams_topics = $mytree->getChildTreeArray(0,'weight'); foreach($ams_topics as $one_amstopic) { // First we create the topic $topicpid=0; if($one_amstopic['topic_pid']!=0) { // Search for its the parent if(array_key_exists($one_amstopic['topic_pid'],$ams_news_topics)) { $topicpid=$ams_news_topics[$one_amstopic['topic_pid']]; } } $news_topic = new nw_NewsTopic(); $news_topic->setTopicPid($topicpid); $news_topic->setTopicTitle($one_amstopic['topic_title']); $news_topic->setTopicImgurl($one_amstopic['topic_imgurl']); $news_topic->setMenu(0); $news_topic->setTopicFrontpage(1);
function editfaq($showmenu = false, $faqid = -1) { global $faq_handler, $category_handler, $xoopsUser, $xoopsUser, $xoopsConfig, $xoopsDB, $modify, $xoopsModuleConfig, $xoopsModule, $XOOPS_URL, $myts; include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; // If there is a parameter, and the id exists, retrieve data: we're editing a faq if ($faqid != -1) { // Creating the FAQ object $faqObj = new sfFaq($faqid); if ($faqObj->notLoaded()) { redirect_header("faq.php", 1, _AM_SF_NOARTTOEDIT); exit; } switch ($faqObj->status()) { case _SF_STATUS_ASKED: $breadcrumb_action = _AM_SF_APPROVING; $collapsableBar_title = _AM_SF_QUESTION_APPROVING; $collapsableBar_info = _AM_SF_QUESTION_APPROVING_INFO; $button_caption = _AM_SF_QUEUE; break; case "default": default: $breadcrumb_action = _AM_SF_EDITING; $collapsableBar_title = _AM_SF_EDITQUES; $collapsableBar_info = _AM_SF_EDITING_INFO; $button_caption = _AM_SF_MODIFY; break; } // Creating the category of this FAQ $categoryObj =& $category_handler->get($faqObj->categoryid()); if ($showmenu) { sf_adminMenu(3, _AM_SF_OPEN_QUESTIONS . " > " . $breadcrumb_action); } echo "<br />\n"; sf_collapsableBar('bottomtable', 'bottomtableicon'); echo "<img id='bottomtableicon' src=" . XOOPS_URL . "/modules/" . $xoopsModule->dirname() . "/images/icon/close12.gif alt='' /></a> " . $collapsableBar_title . "</h3>"; echo "<div id='bottomtable'>"; echo "<span style=\"color: #567; margin: 3px 0 12px 0; font-size: small; display: block; \">" . $collapsableBar_info . "</span>"; } else { // there's no parameter, so we're adding a faq $faqObj =& $faq_handler->create(); $faqObj->setVar('uid', $xoopsUser->getVar('uid')); $categoryObj =& $category_handler->create(); $breadcrumb_action = _AM_SF_CREATINGNEW; $button_caption = _AM_SF_CREATE; if ($showmenu) { sf_adminMenu(3, _AM_SF_OPEN_QUESTIONS . " > " . $breadcrumb_action); } sf_collapsableBar('bottomtable', 'bottomtableicon'); echo "<img id='bottomtableicon' src=" . XOOPS_URL . "/modules/" . $xoopsModule->dirname() . "/images/icon/close12.gif alt='' /></a> " . _AM_SF_CREATEQUESTION . "</h3>"; echo "<div id='bottomtable'>"; } $sform = new XoopsThemeForm(_AM_SF_OPEN_QUESTION, "op", xoops_getenv('PHP_SELF')); $sform->setExtra('enctype="multipart/form-data"'); // faq requester $sform->addElement(new XoopsFormLabel(_AM_SF_REQUESTED_BY, sf_getLinkedUnameFromId($faqObj->uid(), $xoopsModuleConfig['userealname']))); // CATEGORY /* * Get information for pulldown menu using XoopsTree. * First var is the database table * Second var is the unique field ID for the categories * Last one is not set as we do not have sub menus in Smartfaq */ $mytree = new XoopsTree($xoopsDB->prefix("smartfaq_categories"), "categoryid", "parentid"); ob_start(); $mytree->makeMySelBox("name", "weight", $categoryObj->categoryid()); $sform->addElement(new XoopsFormLabel(_AM_SF_CATEGORY_QUESTION, ob_get_contents())); ob_end_clean(); // faq QUESTION $sform->addElement(new XoopsFormTextArea(_AM_SF_QUESTION, 'question', $faqObj->question(), 7, 60)); // PER ITEM PERMISSIONS $member_handler =& xoops_gethandler('member'); $group_list =& $member_handler->getGroupList(); $groups_checkbox = new XoopsFormCheckBox(_AM_SF_PERMISSIONS_QUESTION, 'groups[]', $faqObj->getGroups_read()); foreach ($group_list as $group_id => $group_name) { if ($group_id != XOOPS_GROUP_ADMIN) { $groups_checkbox->addOption($group_id, $group_name); } } $sform->addElement($groups_checkbox); // faq ID $sform->addElement(new XoopsFormHidden('faqid', $faqObj->faqid())); $button_tray = new XoopsFormElementTray('', ''); $hidden = new XoopsFormHidden('op', 'addfaq'); $button_tray->addElement($hidden); $sform->addElement(new XoopsFormHidden('status', $faqObj->status())); // Setting the FAQ Status /* $status_select = new XoopsFormSelect('', 'status', $status); $status_select->addOptionArray(sf_getStatusArray()); $status_tray = new XoopsFormElementTray(_AM_SF_STATUS_EXP , ' '); $status_tray->addElement($status_select); $sform->addElement($status_tray); */ if ($faqid == -1) { // there's no faqid? Then it's a new faq // $button_tray -> addElement( new XoopsFormButton( '', 'mod', _AM_SF_CREATE, 'submit' ) ); $butt_create = new XoopsFormButton('', '', _AM_SF_CREATE, 'submit'); $butt_create->setExtra('onclick="this.form.elements.op.value=\'addfaq\'"'); $button_tray->addElement($butt_create); $butt_clear = new XoopsFormButton('', '', _AM_SF_CLEAR, 'reset'); $button_tray->addElement($butt_clear); $butt_cancel = new XoopsFormButton('', '', _AM_SF_CANCEL, 'button'); $butt_cancel->setExtra('onclick="history.go(-1)"'); $button_tray->addElement($butt_cancel); } else { // else, we're editing an existing faq // $button_tray -> addElement( new XoopsFormButton( '', 'mod', _AM_SF_MODIFY, 'submit' ) ); $butt_create = new XoopsFormButton('', '', $button_caption, 'submit'); $butt_create->setExtra('onclick="this.form.elements.op.value=\'addfaq\'"'); $button_tray->addElement($butt_create); $butt_edit = new XoopsFormButton('', '', _AM_SF_OPEN_QUESTION_EDIT, 'button'); $butt_edit->setExtra("onclick=\"location='faq.php?op=mod&faqid=" . $faqid . "'\""); $button_tray->addElement($butt_edit); $butt_cancel = new XoopsFormButton('', '', _AM_SF_CANCEL, 'button'); $butt_cancel->setExtra('onclick="history.go(-1)"'); $button_tray->addElement($butt_cancel); } $sform->addElement($button_tray); $sform->display(); echo "</div>"; unset($hidden); }
include 'include/read_configs.php'; } } else { // when this script is included by core's imagemanager.php $mydirname = basename(dirname(__FILE__)); include XOOPS_ROOT_PATH . "/modules/{$mydirname}/include/read_configs.php"; } include XOOPS_ROOT_PATH . "/modules/{$mydirname}/include/get_perms.php"; include_once XOOPS_ROOT_PATH . "/modules/{$mydirname}/include/functions.php"; include_once XOOPS_ROOT_PATH . "/modules/{$mydirname}/include/draw_functions.php"; include_once XOOPS_ROOT_PATH . "/class/xoopstree.php"; include_once XOOPS_ROOT_PATH . '/class/pagenav.php'; include_once XOOPS_ROOT_PATH . '/class/template.php'; $myts =& MyTextSanitizer::getInstance(); // MyTextSanitizer object $cattree = new XoopsTree($table_cat, "cid", "pid"); // Get variables if (empty($_GET['target'])) { exit; } $num = empty($_GET['num']) ? 10 : intval($_GET['num']); $cid = !isset($_GET['cid']) ? 0 : intval($_GET['cid']); $xoopsTpl = new XoopsTpl(); $xoopsTpl->assign('lang_imgmanager', _IMGMANAGER); $xoopsTpl->assign('sitename', $xoopsConfig['sitename']); $target = htmlspecialchars($_GET['target'], ENT_QUOTES); $xoopsTpl->assign('target', $target); $xoopsTpl->assign('mod_url', $mod_url); $xoopsTpl->assign('cid', $cid); $xoopsTpl->assign('can_add', $global_perms & GPERM_INSERTABLE && $cid); $cats = $cattree->getChildTreeArray(0, 'title');
function edititem($showmenu = false, $itemid = 0) { global $smartsection_file_handler, $smartsection_item_handler, $smartsection_category_handler, $xoopsUser, $xoopsModule, $xoopsConfig, $xoopsDB; include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; // If there is a parameter, and the id exists, retrieve data: we're editing a item if ($itemid != 0) { // Creating the ITEM object $itemObj = new ssItem($itemid); if ($itemObj->notLoaded()) { redirect_header("item.php", 1, _AM_SS_NOITEMSELECTED); exit; } switch ($itemObj->status()) { case _SS_STATUS_SUBMITTED: $breadcrumb_action1 = _AM_SS_SUBMITTED; $breadcrumb_action2 = _AM_SS_APPROVING; $page_title = _AM_SS_SUBMITTED_TITLE; $page_info = _AM_SS_SUBMITTED_INFO; $button_caption = _AM_SS_APPROVE; $new_status = _SS_STATUS_PUBLISHED; break; case _SS_STATUS_PUBLISHED: $breadcrumb_action1 = _AM_SS_PUBLISHED; $breadcrumb_action2 = _AM_SS_EDITING; $page_title = _AM_SS_PUBLISHEDEDITING; $page_info = _AM_SS_PUBLISHEDEDITING_INFO; $button_caption = _AM_SS_MODIFY; $new_status = _SS_STATUS_PUBLISHED; break; case _SS_STATUS_OFFLINE: $breadcrumb_action1 = _AM_SS_OFFLINE; $breadcrumb_action2 = _AM_SS_EDITING; $page_title = _AM_SS_OFFLINEEDITING; $page_info = _AM_SS_OFFLINEEDITING_INFO; $button_caption = _AM_SS_MODIFY; $new_status = _SS_STATUS_OFFLINE; break; case "default": default: break; } $categoryObj =& $itemObj->category(); if ($showmenu) { ss_adminMenu(2, $breadcrumb_action1 . " > " . $breadcrumb_action2); } echo "<br />\n"; ss_collapsableBar('edititemtable', 'edititemicon', $page_title, $page_info); } else { // there's no parameter, so we're adding an item $itemObj =& $smartsection_item_handler->create(); $categoryObj =& $smartsection_category_handler->create(); $breadcrumb_action1 = _AM_SS_ITEMS; $breadcrumb_action2 = _AM_SS_CREATINGNEW; $button_caption = _AM_SS_CREATE; $new_status = _SS_STATUS_PUBLISHED; if ($showmenu) { ss_adminMenu(2, $breadcrumb_action1 . " > " . $breadcrumb_action2); } $sel_categoryid = isset($_GET['categoryid']) ? $_GET['categoryid'] : 0; $categoryObj->setVar('categoryid', $sel_categoryid); ss_collapsableBar('createitemtable', 'createitemicon', _AM_SS_ITEM_CREATING, _AM_SS_ITEM_CREATING_DSC); } // ITEM FORM $sform = new XoopsThemeForm(_AM_SS_ITEMS, "op", xoops_getenv('PHP_SELF')); $sform->setExtra('enctype="multipart/form-data"'); // CATEGORY $mytree = new XoopsTree($xoopsDB->prefix("smartsection_categories"), "categoryid", "parentid"); ob_start(); $sform->addElement(new XoopsFormHidden('categoryid', $categoryObj->categoryid())); $mytree->makeMySelBox("name", "weight", $categoryObj->categoryid()); $category_label = new XoopsFormLabel(_AM_SS_CATEGORY, ob_get_contents()); $category_label->setDescription(_AM_SS_CATEGORY_DSC); $sform->addElement($category_label); ob_end_clean(); // TITLE $title_text = new XoopsFormText(_AM_SS_TITLE, 'title', 50, 255, $itemObj->title(0, 'e')); $sform->addElement($title_text, true); // SUMMARY $summary_text = ss_getEditor(_AM_SS_SUMMARY, 'summary', $itemObj->summary(0, 'e')); $summary_text->setDescription(_AM_SS_SUMMARY_DSC); $sform->addElement($summary_text, false); // DISPLAY_SUMMARY $display_summary_radio = new XoopsFormRadioYN(_AM_SS_DISPLAY_SUMMARY, 'display_summary', $itemObj->display_summary(), ' ' . _AM_SS_YES . '', ' ' . _AM_SS_NO . ''); $sform->addElement($display_summary_radio); // BODY $body_text = ss_getEditor(_AM_SS_BODY, 'body', $itemObj->body(0, 'e')); //$body_text = new XoopsFormDhtmlTextArea(_AM_SS_BODY, 'body', $itemObj->body(0, 'e'), 20, 60); $body_text->setDescription(_AM_SS_BODY_DSC); $sform->addElement($body_text, true); // IMAGE $image_array =& XoopsLists::getImgListAsArray(ss_getImageDir('item')); $image_select = new XoopsFormSelect('', 'image', $itemObj->image()); //$image_select -> addOption ('-1', '---------------'); $image_select->addOptionArray($image_array); $image_select->setExtra("onchange='showImgSelected(\"image3\", \"image\", \"" . 'uploads/smartsection/images/item/' . "\", \"\", \"" . XOOPS_URL . "\")'"); $image_tray = new XoopsFormElementTray(_AM_SS_IMAGE_ITEM, ' '); $image_tray->addElement($image_select); $image_tray->addElement(new XoopsFormLabel('', "<br /><br /><img src='" . ss_getImageDir('item', false) . $itemObj->image() . "' name='image3' id='image3' alt='' />")); $image_tray->setDescription(_AM_SS_IMAGE_ITEM_DSC); $sform->addElement($image_tray); // IMAGE UPLOAD $max_size = 5000000; $file_box = new XoopsFormFile(_AM_SS_IMAGE_UPLOAD, "image_file", $max_size); $file_box->setExtra("size ='45'"); $file_box->setDescription(_AM_SS_IMAGE_UPLOAD_ITEM_DSC); $sform->addElement($file_box); // Uid /* We need to retreive the users manually because for some reason, on the frxoops.org server, the method users::getobjects encounters a memory error */ $uid = $itemObj->uid() == 0 ? $xoopsUser->uid() : $itemObj->uid(); $uid_select = new XoopsFormSelect(_AM_SS_UID, 'uid', $uid, 1, false); $uid_select->setDescription(_AM_SS_UID_DSC); $sql = "SELECT uid, uname FROM " . $xoopsDB->prefix('users') . " ORDER BY uname ASC"; $result = $xoopsDB->query($sql); $users_array = array(); while ($myrow = $xoopsDB->fetchArray($result)) { $users_array[$myrow['uid']] = $myrow['uname']; } $uid_select->addOptionArray($users_array); $sform->addElement($uid_select); // Datesub $datesub = $itemObj->getVar('datesub') == 0 ? time() : $itemObj->getVar('datesub'); $datesub_datetime = new XoopsFormDateTime(_AM_SS_DATESUB, 'datesub', $size = 15, $datesub); $datesub_datetime->setDescription(_AM_SS_DATESUB_DSC); $sform->addElement($datesub_datetime); // STATUS $options = array(_SS_STATUS_PUBLISHED => _AM_SS_PUBLISHED, _SS_STATUS_OFFLINE => _AM_SS_OFFLINE); $status_select = new XoopsFormSelect(_AM_SS_STATUS, 'status', $new_status); $status_select->addOptionArray($options); $status_select->setDescription(_AM_SS_STATUS_DSC); $sform->addElement($status_select); // WEIGHT $sform->addElement(new XoopsFormText(_AM_SS_WEIGHT, 'weight', 5, 5, $itemObj->weight()), true); // COMMENTS $addcomments_radio = new XoopsFormRadioYN(_AM_SS_ALLOWCOMMENTS, 'cancomment', $itemObj->cancomment(), ' ' . _AM_SS_YES . '', ' ' . _AM_SS_NO . ''); $sform->addElement($addcomments_radio); // PER ITEM PERMISSIONS $member_handler =& xoops_gethandler('member'); $group_list =& $member_handler->getGroupList(); $groups_checkbox = new XoopsFormCheckBox(_AM_SS_PERMISSIONS_ITEM, 'groups[]', $itemObj->getGroups_read()); $groups_checkbox->setDescription(_AM_SS_PERMISSIONS_ITEM_DSC); foreach ($group_list as $group_id => $group_name) { if ($group_id != XOOPS_GROUP_ADMIN) { $groups_checkbox->addOption($group_id, $group_name); } } $sform->addElement($groups_checkbox); // VARIOUS OPTIONS $options_tray = new XoopsFormElementTray(_AM_SS_OPTIONS, '<br />'); $html_checkbox = new XoopsFormCheckBox('', 'dohtml', $itemObj->dohtml()); $html_checkbox->addOption(1, _AM_SS_DOHTML); $options_tray->addElement($html_checkbox); $smiley_checkbox = new XoopsFormCheckBox('', 'dosmiley', $itemObj->dosmiley()); $smiley_checkbox->addOption(1, _AM_SS_DOSMILEY); $options_tray->addElement($smiley_checkbox); $xcodes_checkbox = new XoopsFormCheckBox('', 'doxcode', $itemObj->doxcode()); $xcodes_checkbox->addOption(1, _AM_SS_DOXCODE); $options_tray->addElement($xcodes_checkbox); $images_checkbox = new XoopsFormCheckBox('', 'doimage', $itemObj->doimage()); $images_checkbox->addOption(1, _AM_SS_DOIMAGE); $options_tray->addElement($images_checkbox); $linebreak_checkbox = new XoopsFormCheckBox('', 'dobr', $itemObj->dobr()); $linebreak_checkbox->addOption(1, _AM_SS_DOLINEBREAK); $options_tray->addElement($linebreak_checkbox); $sform->addElement($options_tray); // item ID $sform->addElement(new XoopsFormHidden('itemid', $itemObj->itemid())); $button_tray = new XoopsFormElementTray('', ''); $hidden = new XoopsFormHidden('op', 'additem'); $button_tray->addElement($hidden); if (!$itemid) { // there's no itemid? Then it's a new item // $button_tray -> addElement( new XoopsFormButton( '', 'mod', _AM_SS_CREATE, 'submit' ) ); $butt_create = new XoopsFormButton('', '', _AM_SS_CREATE, 'submit'); $butt_create->setExtra('onclick="this.form.elements.op.value=\'additem\'"'); $button_tray->addElement($butt_create); $butt_clear = new XoopsFormButton('', '', _AM_SS_CLEAR, 'reset'); $button_tray->addElement($butt_clear); $butt_cancel = new XoopsFormButton('', '', _AM_SS_CANCEL, 'button'); $butt_cancel->setExtra('onclick="history.go(-1)"'); $button_tray->addElement($butt_cancel); $sform->addElement($button_tray); $sform->display(); ss_close_collapsable('createitemtable', 'createitemicon'); } else { // else, we're editing an existing item // $button_tray -> addElement( new XoopsFormButton( '', 'mod', _AM_SS_MODIFY, 'submit' ) ); $butt_create = new XoopsFormButton('', '', $button_caption, 'submit'); $butt_create->setExtra('onclick="this.form.elements.op.value=\'additem\'"'); $button_tray->addElement($butt_create); $butt_cancel = new XoopsFormButton('', '', _AM_SS_CANCEL, 'button'); $butt_cancel->setExtra('onclick="history.go(-1)"'); $button_tray->addElement($butt_cancel); $sform->addElement($button_tray); $sform->display(); ss_close_collapsable('edititemtable', 'edititemicon'); } unset($hidden); if ($itemid != 0) { showfiles($itemObj); } }
require_once $_CONF['path_html'] . 'filemgmt/include/functions.php'; require_once $_CONF['path_html'] . 'filemgmt/include/xoopstree.php'; require_once $_CONF['path_html'] . 'filemgmt/include/textsanitizer.php'; // Setup how many categories you want to show in the category row display $numCategoriesPerRow = 2; $numSubCategories2Show = 5; if (SEC_hasRights('filemgmt.user') or $mydownloads_publicpriv == 1) { $p = new Template($_CONF['path'] . 'plugins/filemgmt/templates'); $p->set_file(array('page' => 'filelisting.thtml', 'records' => 'filelisting_record.thtml', 'category' => 'filelisting_category.thtml')); $p->set_var('layout_url', $_CONF['layout_url']); $p->set_var('site_url', $_CONF['site_url']); $p->set_var('site_admin_url', $_CONF['site_admin_url']); $p->set_var('xhtml', XHTML); $p->set_var('target', $CONF_FM['ignore_target'] ? '' : 'target="_blank"'); $myts = new MyTextSanitizer(); $mytree = new XoopsTree($_DB_name, $_FM_TABLES['filemgmt_cat'], "cid", "pid"); $mytree->setGroupAccessFilter($_GROUPS); $display = ''; //@@@@@20090602update urlrewrite ----> //$lid = COM_applyFilter($_GET['id'],true); COM_setArgNames(array('id')); $lid = COM_applyFilter(COM_getArgument('id'), true); //@@@@@20090602update urlrewrite<----- if ($lid == 0) { // Check if the script is being called from the commentbar $lid = str_replace('fileid_', '', $_POST['id']); } $groupsql = filemgmt_buildAccessSql(); $sql = "SELECT COUNT(*) FROM {$_FM_TABLES['filemgmt_filedetail']} a "; $sql .= "LEFT JOIN {$_FM_TABLES['filemgmt_cat']} b ON a.cid=b.cid "; $sql .= "WHERE a.lid='{$lid}' {$groupsql} AND a.status > 0";
function &getCommentTree() { $mytree = new XoopsTree($this->ctable, "comment_id", "pid"); $ret = array(); $tarray = $mytree->getChildTreeArray($this->getVar("comment_id"), "comment_id"); foreach ($tarray as $ele) { $ret[] = new XoopsComments($this->ctable, $ele); } return $ret; }
if (!(include dirname(dirname(__FILE__)) . '/include/process_this_forum.inc.php')) { die(_MD_D3FORUM_ERR_READFORUM); } // get&check this category ($category4assign, $category_row), override options if (!(include dirname(dirname(__FILE__)) . '/include/process_this_category.inc.php')) { die(_MD_D3FORUM_ERR_READCATEGORY); } // get $post4assign include dirname(dirname(__FILE__)) . '/include/process_this_post.inc.php'; // check delete permission if (empty($can_delete)) { die(_MD_D3FORUM_ERR_DELETEPOST); } // count children include_once XOOPS_ROOT_PATH . "/class/xoopstree.php"; $mytree = new XoopsTree($db->prefix($mydirname . "_posts"), "post_id", "pid"); $children = $mytree->getAllChildId($post_id); // special permission check for delete if ($isadminormod) { // admin delete // ok } else { if (($uid == $post_row['uid'] || $uid == $post_row['uid_hidden']) && $xoopsModuleConfig['selfdellimit'] > 0) { // self delete if (time() < $post_row['post_time'] + intval($xoopsModuleConfig['selfdellimit'])) { // before time limit if (count($children) > 0) { // child(ren) exist(s) redirect_header(XOOPS_URL . "/modules/{$mydirname}/index.php?post_id={$post_id}", 2, _MD_D3FORUM_DELCHILDEXISTS); exit; } else {
<?php // ------------------------------------------------------------------------- // // myAlbum-P - XOOPS photo album // // <http://www.peak.ne.jp/> // // ------------------------------------------------------------------------- // include "header.php"; $myts =& MyTextSanitizer::getInstance(); // MyTextSanitizer object include_once XOOPS_ROOT_PATH . "/class/xoopstree.php"; $cattree = new XoopsTree($table_cat, "cid", "pid"); // GET variables $lid = empty($_GET['lid']) ? 0 : intval($_GET['lid']); $cid = empty($_GET['cid']) ? 0 : intval($_GET['cid']); $xoopsOption['template_main'] = "myalbum{$mydirnumber}_photo.html"; include XOOPS_ROOT_PATH . "/header.php"; if ($global_perms & GPERM_INSERTABLE) { $xoopsTpl->assign('lang_add_photo', _ALBM_ADDPHOTO); } $xoopsTpl->assign('lang_album_main', _ALBM_MAIN); include 'include/assign_globals.php'; $xoopsTpl->assign($myalbum_assign_globals); // update hit count $xoopsDB->queryF("UPDATE {$table_photos} SET hits=hits+1 WHERE lid='{$lid}' AND status>0"); $prs = $xoopsDB->query("SELECT l.lid, l.cid, l.title, l.ext, l.res_x, l.res_y, l.status, l.date, l.hits, l.rating, l.votes, l.comments, l.submitter, t.description FROM {$table_photos} l LEFT JOIN {$table_text} t ON l.lid=t.lid WHERE l.lid={$lid} AND status>0"); $p = $xoopsDB->fetchArray($prs); if ($p == false) { redirect_header($mod_url . '/', 3, _ALBM_NOMATCH); exit; } $photo = myalbum_get_array_for_photo_assign($p);
function nw_b_news_latestnews_edit($options) { global $xoopsDB; include_once NW_MODULE_PATH . '/include/functions.php'; include_once NW_MODULE_PATH . '/class/class.newstopic.php'; $tabletag1='<tr><td>'; $tabletag2='</td><td>'; $form = "<table border='0'>"; $form .= $tabletag1._MB_NW_LATESTNEWS_DISPLAY.$tabletag2; $form .= "<input type='text' name='options[]' value='".$options[0]."' size='4'> "._MB_NW_LATESTNEWS."</td></tr>"; $form .= $tabletag1._MB_NW_LATESTNEWS_COLUMNS.$tabletag2; $form .= "<input type='text' name='options[]' value='".$options[1]."' size='4'> "._MB_NW_LATESTNEWS_COLUMN."</td></tr>"; $form .= $tabletag1._MB_NW_LATESTNEWS_TEXTLENGTH.$tabletag2; $form .= "<input type='text' name='options[]' value='".$options[2]."' size='4'> "._MB_NW_LATESTNEWS_LETTER."</td></tr>"; $form .= $tabletag1._MB_NW_LATESTNEWS_IMGWIDTH.$tabletag2; $form .= "<input type='text' name='options[]' value='".$options[3]."' size='4'> "._MB_NW_LATESTNEWS_PIXEL."</td></tr>"; $form .= $tabletag1._MB_NW_LATESTNEWS_IMGHEIGHT.$tabletag2; $form .= "<input type='text' name='options[]' value='".$options[4]."' size='4'> "._MB_NW_LATESTNEWS_PIXEL."</td></tr>"; $form .= $tabletag1._MB_NW_LATESTNEWS_BORDER.$tabletag2; $form .= "<input type='text' name='options[]' value='".$options[5]."' size='4'> "._MB_NW_LATESTNEWS_PIXEL."</td></tr>"; $form .= $tabletag1._MB_NW_LATESTNEWS_BORDERCOLOR.$tabletag2; $form .= "<input type='text' name='options[]' value='".$options[6]."' size='8'></td></tr>"; $form .= $tabletag1._MB_NW_LATESTNEWS_SELECTEDSTORIES.$tabletag2; $form .= "<input type='text' name='options[]' value='".$options[7]."' size='16'></td></tr>"; $form .= $tabletag1._MB_NW_LATESTNEWS_IMGPOSITION.$tabletag2; $form .= nw_latestnews_mk_select($options,8); $form .= $tabletag1._MB_NW_LATESTNEWS_TOPICLINK.$tabletag2; $form .= nw_latestnews_mk_chkbox($options,9); $form .= $tabletag1._MB_NW_LATESTNEWS_ARCHIVELINK.$tabletag2; $form .= nw_latestnews_mk_chkbox($options,10); $form .= $tabletag1._MB_NW_LATESTNEWS_SUBMITLINK.$tabletag2; $form .= nw_latestnews_mk_chkbox($options,11); $form .= $tabletag1._MB_NW_LATESTNEWS_POSTEDBY.$tabletag2; $form .= nw_latestnews_mk_chkbox($options,12); $form .= $tabletag1._MB_NW_LATESTNEWS_POSTTIME.$tabletag2; $form .= nw_latestnews_mk_chkbox($options,13); $form .= $tabletag1._MB_NW_LATESTNEWS_TOPICIMAGE.$tabletag2; $form .= nw_latestnews_mk_chkbox($options,14); $form .= $tabletag1._MB_NW_LATESTNEWS_TOPICTITLE.$tabletag2; $form .= nw_latestnews_mk_chkbox($options,15); $form .= $tabletag1._MB_NW_LATESTNEWS_READ.$tabletag2; $form .= nw_latestnews_mk_chkbox($options,16); $form .= $tabletag1._MB_NW_LATESTNEWS_COMMENT.$tabletag2; $form .= nw_latestnews_mk_chkbox($options,17); $form .= $tabletag1._MB_NW_LATESTNEWS_PRINT.$tabletag2; $form .= nw_latestnews_mk_chkbox($options,18); $form .= $tabletag1._MB_NW_LATESTNEWS_PDF.$tabletag2; $form .= nw_latestnews_mk_chkbox($options,19); $form .= $tabletag1._MB_NW_LATESTNEWS_EMAIL.$tabletag2; $form .= nw_latestnews_mk_chkbox($options,20); $form .= $tabletag1._MB_NW_LATESTNEWS_MORELINK.$tabletag2; $form .= nw_latestnews_mk_chkbox($options,21); $form .= $tabletag1._MB_NW_LATESTNEWS_SCROLL.$tabletag2; $form .= nw_latestnews_mk_chkbox($options,22); $form .= $tabletag1._MB_NW_LATESTNEWS_SCROLLHEIGHT.$tabletag2; $form .= "<input type='text' name='options[]' value='".$options[23]."' size='4'></td></tr>"; $form .= $tabletag1._MB_NW_LATESTNEWS_SCROLLSPEED.$tabletag2; $form .= "<input type='text' name='options[]' value='".$options[24]."' size='4'></td></tr>"; //order $form .= $tabletag1._MB_NW_LATESTNEWS_ORDERBY.$tabletag2; $form .= "<select name='options[]'>"; $form .= "<option value='published'"; if ( $options[25] == 'published' ) { $form .= " selected='selected'"; } $form .= '>'._MB_NW_LATESTNEWS_DATE."</option>\n"; $form .= "<option value='counter'"; if($options[25] == 'counter'){ $form .= " selected='selected'"; } $form .= '>'._MB_NW_LATESTNEWS_HITS.'</option>'; $form .= "<option value='rating'"; if ( $options[25] == 'rating' ) { $form .= " selected='selected'"; } $form .= '>' . _MB_NW_LATESTNEWS_RATE . '</option>'; $form .= "</select></td></tr>"; //topics $form .= $tabletag1._MB_NW_LATESTNEWS_TOPICSDISPLAY.$tabletag2; $form .= "<select name='options[]' multiple='multiple'>"; $topics_arr=array(); $xt = new XoopsTree($xoopsDB->prefix('nw_topics'), 'topic_id', 'topic_pid'); $topics_arr = $xt->getChildTreeArray(0,'topic_title'); $size = count($options); foreach ($topics_arr as $onetopic) { $sel = ''; if($onetopic['topic_pid']!=0) { $onetopic['prefix'] = str_replace('.','-',$onetopic['prefix']) . ' '; } else { $onetopic['prefix'] = str_replace('.','',$onetopic['prefix']); } for ( $i = 26; $i < $size; $i++ ) { if ($options[$i] == $onetopic['topic_id']) { $sel = " selected='selected'"; } } $form .= "<option value='".$onetopic['topic_id']."'$sel>".$onetopic['prefix'].$onetopic['topic_title'].'</option>'; } $form .= '</select></td></tr>'; $form .= "</table>"; return $form; }
$ret = substr($ret, 0, -1); return $ret; } include "admin_header.php"; require_once XOOPS_ROOT_PATH . "/include/xoopscodes.php"; include_once XOOPS_ROOT_PATH . "/class/xoopsformloader.php"; include_once XOOPS_ROOT_PATH . "/class/xoopslists.php"; include_once XOOPS_ROOT_PATH . "/class/xoopstree.php"; include_once XOOPS_ROOT_PATH . "/class/xoopscomments.php"; // GPCS vars $action = isset($_POST['action']) ? $_POST['action'] : ''; $disp = isset($_GET['disp']) ? $_GET['disp'] : ''; $cid = isset($_GET['cid']) ? intval($_GET['cid']) : 0; // Initializations $myts =& MyTextSanitizer::getInstance(); $cattree = new XoopsTree($table_cat, "cid", "pid"); // // DB part // if ($action == "insert") { // anti-CSRF (Double Check) if (!xoops_refcheck()) { die("XOOPS_URL is not included in your REFERER"); } // newly insert $sql = "INSERT INTO {$table_cat} SET "; $cols = array("pid" => "I:N:0", "title" => "50:E:1", "imgurl" => "150:E:0"); $sql .= mysql_get_sql_set($cols); $xoopsDB->query($sql) or die("DB Error: insert category"); // Check if cid == pid $cid = $xoopsDB->getInsertId();
function delete() { $sql = sprintf("DELETE FROM %s WHERE post_id = %u", $this->db->prefix("xhnewbb_posts"), $this->post_id); if (!($result = $this->db->query($sql))) { return false; } $sql = sprintf("DELETE FROM %s WHERE post_id = %u", $this->db->prefix("xhnewbb_posts_text"), $this->post_id); if (!($result = $this->db->query($sql))) { echo "Could not remove posts text for Post ID:" . $this->post_id . ".<br />"; } if (!empty($this->uid)) { $sql = sprintf("UPDATE %s SET posts=posts-1 WHERE uid = %u", $this->db->prefix("users"), $this->uid); if (!($result = $this->db->query($sql))) { // echo "Could not update user posts."; } } if ($this->istopic()) { $sql = sprintf("DELETE FROM %s WHERE topic_id = %u", $this->db->prefix("xhnewbb_topics"), $this->topic_id); if (!($result = $this->db->query($sql))) { echo "Could not delete topic."; } // u2t table $this->db->query("DELETE FROM " . $this->db->prefix("xhnewbb_users2topics") . " WHERE topic_id = {$this->topic_id}"); // end of u2t table } include_once XOOPS_ROOT_PATH . "/class/xoopstree.php"; $mytree = new XoopsTree($this->db->prefix("xhnewbb_posts"), "post_id", "pid"); $arr = $mytree->getAllChild($this->post_id); $size = count($arr); if ($size > 0) { for ($i = 0; $i < $size; $i++) { $sql = sprintf("DELETE FROM %s WHERE post_id = %u", $this->db->prefix("xhnewbb_posts"), $arr[$i]['post_id']); if (!($result = $this->db->query($sql))) { echo "Could not delete post " . $arr[$i]['post_id'] . ""; } $sql = sprintf("DELETE FROM %s WHERE post_id = %u", $this->db->prefix("xhnewbb_posts_text"), $arr[$i]['post_id']); if (!($result = $this->db->query($sql))) { echo "Could not delete post text " . $arr[$i]['post_id'] . ""; } if (!empty($arr[$i]['uid'])) { $sql = "UPDATE " . $this->db->prefix("users") . " SET posts=posts-1 WHERE uid=" . $arr[$i]['uid'] . ""; if (!($result = $this->db->query($sql))) { // echo "Could not update user posts."; } } } } }
function getAllChildTopicsId() { $xt = new XoopsTree($this->table, "topic_id", "topic_pid"); $ret = $xt->getAllChildId($this->topic_id, "toppic_title"); return $ret; }
/** * Function used to edit the block */ function b_news_top_edit($options) { global $xoopsDB; $tmpstory = new NewsStory(); $form = _MB_NEWS_ORDER . " <select name='options[]'>"; $form .= "<option value='published'"; if ($options[0] == 'published') { $form .= " selected='selected'"; } $form .= '>' . _MB_NEWS_DATE . "</option>\n"; $form .= "<option value='counter'"; if ($options[0] == 'counter') { $form .= " selected='selected'"; } $form .= '>' . _MB_NEWS_HITS . '</option>'; $form .= "<option value='rating'"; if ($options[0] == 'rating') { $form .= " selected='selected'"; } $form .= '>' . _MB_NEWS_RATE . '</option>'; $form .= "</select>\n"; $form .= ' ' . _MB_NEWS_DISP . " <input type='text' name='options[]' value='" . $options[1] . "'/> " . _MB_NEWS_ARTCLS; $form .= " <br /><br />" . _MB_NEWS_CHARS . " <input type='text' name='options[]' value='" . $options[2] . "'/> " . _MB_NEWS_LENGTH . '<br /><br />'; $form .= _MB_NEWS_TEASER . " <input type='text' name='options[]' value='" . $options[3] . "' />" . _MB_NEWS_LENGTH; $form .= '<br /><br />'; $form .= _MB_NEWS_SPOTLIGHT . " <input type='radio' name='options[]' value='1'"; if ($options[4] == 1) { $form .= " checked='checked'"; } $form .= ' />' . _YES; $form .= "<input type='radio' name='options[]' value='0'"; if ($options[4] == 0) { $form .= " checked='checked'"; } $form .= ' />' . _NO . '<br /><br />'; $form .= _MB_NEWS_WHAT_PUBLISH . " <select name='options[]'><option value='1'"; if ($options[5] == 1) { $form .= ' selected'; } $form .= ' />' . _MB_NEWS_RECENT_NEWS; $form .= "</option><option value='0'"; if ($options[5] == 0) { $form .= ' selected'; } $form .= ' />' . _MB_NEWS_RECENT_SPECIFIC . '</option></select>'; $form .= '<br /><br />' . _MB_NEWS_SPOTLIGHT_ARTICLE . '<br />'; $articles = $tmpstory->getAllPublished(200, 0, false, 0, 0, false); // I have limited the listbox to the last 200 articles $form .= "<select name ='options[]'>"; $form .= "<option value='0'>" . _MB_NEWS_FIRST . '</option>'; foreach ($articles as $storyid => $storytitle) { $sel = ''; if ($options[6] == $storyid) { $sel = " selected='selected'"; } $form .= "<option value='{$storyid}'{$sel}>" . $storytitle . '</option>'; } $form .= '</select><br /><br />'; $form .= _MB_NEWS_IMAGE . " <input type='text' id='spotlightimage' name='options[]' value='" . $options[7] . "' size='50'/>"; $form .= " <img align='middle' onmouseover='style.cursor=\"hand\"' onclick='javascript:openWithSelfMain(\"" . XOOPS_URL . "/imagemanager.php?target=spotlightimage\",\"imgmanager\",400,430);' src='" . XOOPS_URL . "/images/image.gif' alt='image' title='image' />"; $form .= '<br /><br />' . _MB_NEWS_DISP . " <select name='options[]'><option value='1' "; if ($options[8] == 1) { $form .= 'selected'; } $form .= '>' . _MB_NEWS_VIEW_TYPE1 . "</option><option value='2' "; if ($options[8] == 2) { $form .= 'selected'; } $form .= '>' . _MB_NEWS_VIEW_TYPE2 . '</option></select><br /><br />'; $form .= "<table border=0>\n"; $form .= "<tr><td colspan='2' align='center'><u>" . _MB_NEWS_DEFAULT_COLORS . "</u></td></tr>"; $form .= "<tr><td>" . _MB_NEWS_TAB_COLOR1 . "</td><td><input type='text' name='options[]' value='" . $options[9] . "' size=7></td></tr>"; $form .= "<tr><td>" . _MB_NEWS_TAB_COLOR2 . "</td><td><input type='text' name='options[]' value='" . $options[10] . "' size=7></td></tr>"; $form .= "<tr><td>" . _MB_NEWS_TAB_COLOR3 . "</td><td><input type='text' name='options[]' value='" . $options[11] . "' size=7></td></tr>"; $form .= "<tr><td>" . _MB_NEWS_TAB_COLOR4 . "</td><td><input type='text' name='options[]' value='" . $options[12] . "' size=7></td></tr>"; $form .= "<tr><td>" . _MB_NEWS_TAB_COLOR5 . "</td><td><input type='text' name='options[]' value='" . $options[13] . "' size=7></td></tr>"; $form .= "</table>\n"; $form .= '<br /><br />' . _MB_SPOTLIGHT_TOPIC . "<br /><select name='options[]' multiple='multiple'>"; include_once XOOPS_ROOT_PATH . '/modules/news/class/class.newstopic.php'; $topics_arr = array(); include_once XOOPS_ROOT_PATH . '/class/xoopstree.php'; $xt = new XoopsTree($xoopsDB->prefix('topics'), 'topic_id', 'topic_pid'); $topics_arr = $xt->getChildTreeArray(0, 'topic_title'); $size = count($options); foreach ($topics_arr as $onetopic) { $sel = ''; if ($onetopic['topic_pid'] != 0) { $onetopic['prefix'] = str_replace('.', '-', $onetopic['prefix']) . ' '; } else { $onetopic['prefix'] = str_replace('.', '', $onetopic['prefix']); } for ($i = 14; $i < $size; $i++) { if ($options[$i] == $onetopic['topic_id']) { $sel = " selected='selected'"; } } $form .= "<option value='" . $onetopic['topic_id'] . "'{$sel}>" . $onetopic['prefix'] . $onetopic['topic_title'] . '</option>'; } $form .= '</select><br />'; return $form; }
} else { echo "<span style=\"color: #567; margin: 3px 0 12px 0; font-size: small; display: block; \">" . sprintf(_AM_PUBLISHER_IMPORT_MODULE_FOUND, $importFromModuleName, $totalArticles, $totalCat) . "</span>"; $form = new Xoops\Form\ThemeForm(_AM_PUBLISHER_IMPORT_SETTINGS, 'import_form', PUBLISHER_ADMIN_URL . "/import/{$scriptname}"); // Categories to be imported $sql = "SELECT cat.topic_id, cat.topic_pid, cat.topic_title, COUNT(art.storyid) FROM " . $xoopsDB->prefix("topics") . " AS cat INNER JOIN " . $xoopsDB->prefix("stories") . " AS art ON cat.topic_id=art.topicid GROUP BY art.topicid"; $result = $xoopsDB->query($sql); $cat_cbox_options = array(); while (list($cid, $pid, $cat_title, $art_count) = $xoopsDB->fetchRow($result)) { $cat_title = $myts->displayTarea($cat_title); $cat_cbox_options[$cid] = "{$cat_title} ({$art_count})"; } $cat_label = new Xoops\Form\Label(_AM_PUBLISHER_IMPORT_CATEGORIES, implode("<br />", $cat_cbox_options)); $cat_label->setDescription(_AM_PUBLISHER_IMPORT_CATEGORIES_DSC); $form->addElement($cat_label); // Publisher parent category $mytree = new XoopsTree($xoopsDB->prefix("publisher_categories"), "categoryid", "parentid"); ob_start(); $mytree->makeMySelBox("name", "weight", $preset_id = 0, $none = 1, $sel_name = "parent_category"); $parent_cat_sel = new Xoops\Form\Label(_AM_PUBLISHER_IMPORT_PARENT_CATEGORY, ob_get_contents()); $parent_cat_sel->setDescription(_AM_PUBLISHER_IMPORT_PARENT_CATEGORY_DSC); $form->addElement($parent_cat_sel); ob_end_clean(); $form->addElement(new Xoops\Form\Hidden('op', 'go')); $form->addElement(new Xoops\Form\Button('', 'import', _AM_PUBLISHER_IMPORT, 'submit')); $form->addElement(new Xoops\Form\Hidden('from_module_version', $_POST['news_version'])); $form->display(); } } PublisherUtils::closeCollapsableBar('newsimport', 'newsimporticon'); $xoops->footer(); }
// 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. See the // // GNU General Public License for more details. // // // // You should have received a copy of the GNU General Public License // // along with this program; if not, write to the Free Software // // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // ------------------------------------------------------------------------ // include "header.php"; $myts =& MyTextSanitizer::getInstance(); // MyTextSanitizer object include_once XOOPS_ROOT_PATH . "/class/xoopstree.php"; $mytree = new XoopsTree($xoopsDB->prefix("mylinks_cat"), "cid", "pid"); $xoopsOption['template_main'] = 'mylinks_topten.html'; include XOOPS_ROOT_PATH . "/header.php"; //generates top 10 charts by rating and hits for each main category if (!empty($_GET['rate'])) { $sort = _MD_RATING; $sortDB = "rating"; } else { $sort = _MD_HITS; $sortDB = "hits"; } $xoopsTpl->assign('lang_sortby', $sort); $xoopsTpl->assign('lang_rank', _MD_RANK); $xoopsTpl->assign('lang_title', _MD_TITLE); $xoopsTpl->assign('lang_category', _MD_CATEGORY); $xoopsTpl->assign('lang_hits', _MD_HITS);
// 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. See the // // GNU General Public License for more details. // // // // You should have received a copy of the GNU General Public License // // along with this program; if not, write to the Free Software // // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // ------------------------------------------------------------------------ // include "header.php"; $myts =& MyTextSanitizer::getInstance(); // MyTextSanitizer object include_once XOOPS_ROOT_PATH . "/class/xoopstree.php"; $mytree = new XoopsTree($xoopsDB->prefix("mylinks_cat"), "cid", "pid"); $xoopsOption['template_main'] = 'mylinks_index.html'; include XOOPS_ROOT_PATH . "/header.php"; $result = $xoopsDB->query("SELECT cid, title, imgurl FROM " . $xoopsDB->prefix("mylinks_cat") . " WHERE pid = 0 ORDER BY title") or exit("Error"); $count = 1; while ($myrow = $xoopsDB->fetchArray($result)) { $imgurl = ''; if ($myrow['imgurl'] && $myrow['imgurl'] != "http://") { $imgurl = $myts->makeTboxData4Edit($myrow['imgurl']); } $totallink = getTotalItems($myrow['cid'], 1); // get child category objects $arr = array(); $arr = $mytree->getFirstChild($myrow['cid'], "title"); $space = 0; $chcount = 0;
// // // 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. See the // // GNU General Public License for more details. // // // // You should have received a copy of the GNU General Public License // // along with this program; if not, write to the Free Software // // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // ------------------------------------------------------------------------ // include "header.php"; $myts =& MyTextSanitizer::getInstance(); // MyTextSanitizer object include_once XOOPS_ROOT_PATH . "/class/xoopstree.php"; include_once XOOPS_ROOT_PATH . "/class/module.errorhandler.php"; $mytree = new XoopsTree($xoopsDB->prefix("mylinks_cat"), "cid", "pid"); if (!empty($HTTP_POST_VARS['submit'])) { $eh = new ErrorHandler(); //ErrorHandler object if (empty($xoopsUser)) { redirect_header(XOOPS_URL . "/user.php", 2, _MD_MUSTREGFIRST); exit; } else { $user = $xoopsUser->getVar('uid'); } $lid = intval($HTTP_POST_VARS["lid"]); // Check if Title exist if ($HTTP_POST_VARS["title"] == "") { $eh->show("1001"); } // Check if URL exist
function createElements() { global $xoopsDB; $mytree = new XoopsTree($xoopsDB->prefix("smartsection_categories"), "categoryid", "parentid"); // Parent Category ob_start(); $mytree->makeMySelBox("name", "weight", $this->targetObject->parentid(), 1, 'parentid'); //makeMySelBox($title,$order="",$preset_id=0, $none=0, $sel_name="", $onchange="") $this->addElement(new XoopsFormLabel(_AM_SSECTION_PARENT_CATEGORY_EXP, ob_get_contents())); ob_end_clean(); // Name $this->addElement(new XoopsFormText(_AM_SSECTION_CATEGORY, 'name', 50, 255, $this->targetObject->name('e')), true); // Description $this->addElement(new XoopsFormTextArea(_AM_SSECTION_COLDESCRIPT, 'description', $this->targetObject->description('e'), 7, 60)); if (SMARTSECTION_LEVEL > 0) { // Header $text_header = smartsection_getEditor(_AM_SSECTION_CATEGORY_HEADER, 'header', $this->targetObject->header('e')); $text_header->setDescription(_AM_SSECTION_CATEGORY_HEADER_DSC); $this->addElement($text_header); } // IMAGE $image_array = XoopsLists::getImgListAsArray(smartsection_getImageDir('category')); $image_select = new XoopsFormSelect('', 'image', $this->targetObject->image()); //$image_select -> addOption ('-1', '---------------'); $image_select->addOptionArray($image_array); $image_select->setExtra("onchange='showImgSelected(\"image3\", \"image\", \"" . 'uploads/smartsection/images/category/' . "\", \"\", \"" . XOOPS_URL . "\")'"); $image_tray = new XoopsFormElementTray(_AM_SSECTION_IMAGE, ' '); $image_tray->addElement($image_select); $image_tray->addElement(new XoopsFormLabel('', "<br /><br /><img src='" . smartsection_getImageDir('category', false) . $this->targetObject->image() . "' name='image3' id='image3' alt='' />")); $image_tray->setDescription(_AM_SSECTION_IMAGE_DSC); $this->addElement($image_tray); // IMAGE UPLOAD $max_size = 5000000; $file_box = new XoopsFormFile(_AM_SSECTION_IMAGE_UPLOAD, "image_file", $max_size); $file_box->setExtra("size ='45'"); $file_box->setDescription(_AM_SSECTION_IMAGE_UPLOAD_DSC); $this->addElement($file_box); if (SMARTSECTION_LEVEL > 0) { // Short url $text_short_url = new XoopsFormText(_AM_SSECTION_CATEGORY_SHORT_URL, 'short_url', 50, 255, $this->targetObject->short_url('e')); $text_short_url->setDescription(_AM_SSECTION_CATEGORY_SHORT_URL_DSC); $this->addElement($text_short_url); // Meta Keywords $text_meta_keywords = new XoopsFormTextArea(_AM_SSECTION_CATEGORY_META_KEYWORDS, 'meta_keywords', $this->targetObject->meta_keywords('e'), 7, 60); $text_meta_keywords->setDescription(_AM_SSECTION_CATEGORY_META_KEYWORDS_DSC); $this->addElement($text_meta_keywords); // Meta Description $text_meta_description = new XoopsFormTextArea(_AM_SSECTION_CATEGORY_META_DESCRIPTION, 'meta_description', $this->targetObject->meta_description('e'), 7, 60); $text_meta_description->setDescription(_AM_SSECTION_CATEGORY_META_DESCRIPTION_DSC); $this->addElement($text_meta_description); } // Weight $this->addElement(new XoopsFormText(_AM_SSECTION_COLPOSIT, 'weight', 4, 4, $this->targetObject->weight())); if (SMARTSECTION_LEVEL > 0) { // Added by skalpa: custom template support $this->addElement(new XoopsFormText("Custom template", 'template', 50, 255, $this->targetObject->template('e')), false); } // READ PERMISSIONS $groups_read_checkbox = new XoopsFormCheckBox(_AM_SSECTION_PERMISSIONS_CAT_READ, 'groups_read[]', $this->targetObject->getGroups_read()); foreach ($this->userGroups as $group_id => $group_name) { if ($group_id != XOOPS_GROUP_ADMIN) { $groups_read_checkbox->addOption($group_id, $group_name); } } $this->addElement($groups_read_checkbox); // Apply permissions on all items $apply = isset($_POST['applyall']) ? intval($_POST['applyall']) : 0; $addapplyall_radio = new XoopsFormRadioYN(_AM_SSECTION_PERMISSIONS_APPLY_ON_ITEMS, 'applyall', $apply, ' ' . _AM_SSECTION_YES . '', ' ' . _AM_SSECTION_NO . ''); $this->addElement($addapplyall_radio); // SUBMIT PERMISSIONS $groups_submit_checkbox = new XoopsFormCheckBox(_AM_SSECTION_PERMISSIONS_CAT_SUBMIT, 'groups_submit[]', $this->targetObject->getGroups_submit()); $groups_submit_checkbox->setDescription(_AM_SSECTION_PERMISSIONS_CAT_SUBMIT_DSC); foreach ($this->userGroups as $group_id => $group_name) { if ($group_id != XOOPS_GROUP_ADMIN) { $groups_submit_checkbox->addOption($group_id, $group_name); } } $this->addElement($groups_submit_checkbox); if (SMARTSECTION_LEVEL > 0) { // Added by fx2024 // sub Categories $cat_tray = new XoopsFormElementTray(_AM_SSECTION_SCATEGORYNAME, '<br /><br />'); for ($i = 0; $i < $this->subCatsCount; $i++) { if ($i < (isset($_POST['scname']) ? sizeof($_POST['scname']) : 0)) { $subname = isset($_POST['scname']) ? $_POST['scname'][$i] : ''; } else { $subname = ''; } $cat_tray->addElement(new XoopsFormText('', 'scname[' . $i . ']', 50, 255, $subname), true); } $t = new XoopsFormText('', 'nb_subcats', 3, 2); $l = new XoopsFormLabel('', sprintf(_AM_SSECTION_ADD_OPT, $t->render())); $b = new XoopsFormButton('', 'submit', _AM_SSECTION_ADD_OPT_SUBMIT, 'submit'); if (!$this->targetObject->categoryid()) { $b->setExtra('onclick="this.form.elements.op.value=\'addsubcats\'"'); } else { $b->setExtra('onclick="this.form.elements.op.value=\'mod\'"'); } $r = new XoopsFormElementTray(''); $r->addElement($l); $r->addElement($b); $cat_tray->addElement($r); $this->addElement($cat_tray); //End of fx2024 code } /* $module_id = $xoopsModule->getVar('mid'); $gperm_handler = &xoops_gethandler('groupperm'); $mod_perms = $gperm_handler->getGroupIds('category_moderation', $categoryid, $module_id); $moderators_select = new XoopsFormSelect('', 'moderators', $moderators, 5, true); $moderators_tray->addElement($moderators_select); $butt_mngmods = new XoopsFormButton('', '', 'Manage mods', 'button'); $butt_mngmods->setExtra('onclick="javascript:small_window(\'pop.php\', 370, 350);"'); $moderators_tray->addElement($butt_mngmods); $butt_delmod = new XoopsFormButton('', '', 'Delete mod', 'button'); $butt_delmod->setExtra('onclick="javascript:deleteSelectedItemsFromList(this.form.elements[\'moderators[]\']);"'); $moderators_tray->addElement($butt_delmod); $this->addElement($moderators_tray); */ $this->addElement(new XoopsFormHidden('categoryid', $this->targetObject->categoryid())); //$parentid = $this->targetObject->parentid('s'); //$this -> addElement( new XoopsFormHidden( 'parentid', $parentid ) ); $this->addElement(new XoopsFormHidden('nb_sub_yet', $this->subCatsCount)); }
} else { echo "<span style=\"color: #567; margin: 3px 0 12px 0; font-size: small; display: block; \">" . sprintf(_AM_PUBLISHER_IMPORT_MODULE_FOUND, $importFromModuleName, $totalArticles, $totalCat) . '</span>'; $form = new XoopsThemeForm(_AM_PUBLISHER_IMPORT_SETTINGS, 'import_form', PUBLISHER_ADMIN_URL . "/import/{$scriptname}"); // Categories to be imported $sql = 'SELECT cat.categoryid, cat.parentid, cat.name, COUNT(art.itemid) FROM ' . $GLOBALS['xoopsDB']->prefix('smartsection_categories') . ' AS cat INNER JOIN ' . $GLOBALS['xoopsDB']->prefix('smartsection_items') . ' AS art ON cat.categoryid=art.categoryid GROUP BY art.categoryid'; $result = $GLOBALS['xoopsDB']->query($sql); $cat_cbox_options = array(); while ((list($cid, $pid, $cat_title, $art_count) = $GLOBALS['xoopsDB']->fetchRow($result)) !== false) { $cat_title = $myts->displayTarea($cat_title); $cat_cbox_options[$cid] = "{$cat_title} ({$art_count})"; } $cat_label = new XoopsFormLabel(_AM_PUBLISHER_IMPORT_CATEGORIES, implode('<br />', $cat_cbox_options)); $cat_label->setDescription(_AM_PUBLISHER_IMPORT_CATEGORIES_DSC); $form->addElement($cat_label); // Publisher parent category $mytree = new XoopsTree($GLOBALS['xoopsDB']->prefix('publisher_categories'), 'categoryid', 'parentid'); ob_start(); $mytree->makeMySelBox('name', 'weight', $preset_id = 0, $none = 1, $sel_name = 'parent_category'); $parent_cat_sel = new XoopsFormLabel(_AM_PUBLISHER_IMPORT_PARENT_CATEGORY, ob_get_contents()); $parent_cat_sel->setDescription(_AM_PUBLISHER_IMPORT_PARENT_CATEGORY_DSC); $form->addElement($parent_cat_sel); ob_end_clean(); $form->addElement(new XoopsFormHidden('op', 'go')); $form->addElement(new XoopsFormButton('', 'import', _AM_PUBLISHER_IMPORT, 'submit')); $form->addElement(new XoopsFormHidden('from_module_version', XoopsRequest::getString('news_version', '', 'POST'))); $form->display(); } } publisherCloseCollapsableBar('newsimport', 'newsimporticon'); xoops_cp_footer(); }