redirect_header("javascript:history.go(-1)", 1, _NOPERM); exit; } $op = ''; foreach ($_POST as $k => $v) { ${$k} = $v; } foreach ($_GET as $k => $v) { ${$k} = $v; } switch ($op) { case "default": default: global $xoopsDB, $xoopsModule; ss_xoops_cp_header(); ss_adminMenu(4, _AM_SS_PERMISSIONS); // View Categories permissions $item_list_view = array(); $block_view = array(); // echo "<h3 style='color: #2F5376; '>"._AM_SS_PERMISSIONSADMIN."</h3>\n" ; ss_collapsableBar('permissionstable', 'permissionsicon', _AM_SS_PERMISSIONSVIEWMAN, _AM_SS_VIEW_CATS); $result_view = $xoopsDB->query("SELECT categoryid, name FROM " . $xoopsDB->prefix("smartsection_categories") . " "); if ($xoopsDB->getRowsNum($result_view)) { while ($myrow_view = $xoopsDB->fetcharray($result_view)) { $item_list_view['cid'] = $myrow_view['categoryid']; $item_list_view['title'] = $myrow_view['name']; $form_view = new XoopsGroupPermForm("", $xoopsModule->getVar('mid'), "category_read", ""); $block_view[] = $item_list_view; foreach ($block_view as $itemlists) { $form_view->addItem($itemlists['cid'], $itemlists['title']); }
echo "<td width='40' class='bg3' align='center'><b>" . _AM_SS_ITEMID . "</b></td>"; echo "<td width='20%' class='bg3' align='center'><b>" . _AM_SS_ITEMCAT . "</b></td>"; echo "<td class='bg3' align='center'><b>" . _AM_SS_TITLE . "</b></td>"; echo "<td width='90' class='bg3' align='center'><b>" . _AM_SS_CREATED . "</b></td>"; echo "<td width='90' class='bg3' align='center'><b>" . _AM_SS_STATUS . "</b></td>"; echo "<td width='90' class='bg3' align='center'><b>" . _AM_SS_ACTION . "</b></td>"; echo "</tr>"; } // Code for the page include_once XOOPS_ROOT_PATH . "/class/xoopslists.php"; include_once XOOPS_ROOT_PATH . '/class/pagenav.php'; global $smartsection_category_handler, $smartsection_item_handler; $startentry = isset($_GET['startentry']) ? intval($_GET['startentry']) : 0; ss_xoops_cp_header(); global $xoopsUser, $xoopsUser, $xoopsConfig, $xoopsDB, $xoopsModuleConfig, $xoopsModule, $itemid; ss_adminMenu(0, _AM_SS_INDEX); // Total ITEMs -- includes everything on the table $totalitems = $smartsection_item_handler->getItemsCount(); // Total categories $totalcategories = $smartsection_category_handler->getCategoriesCount(-1); // Total submitted ITEMs $totalsubmitted = $smartsection_item_handler->getItemsCount(-1, array(_SS_STATUS_SUBMITTED)); // Total published ITEMs $totalpublished = $smartsection_item_handler->getItemsCount(-1, array(_SS_STATUS_PUBLISHED)); // Total offline ITEMs $totaloffline = $smartsection_item_handler->getItemsCount(-1, array(_SS_STATUS_OFFLINE)); // Total rejected $totalrejected = $smartsection_item_handler->getItemsCount(-1, array(_SS_STATUS_REJECTED)); // Check Path Configuration if (ss_admin_getPathStatus('root', true) < 0 || ss_admin_getPathStatus('images', true) < 0 || ss_admin_getPathStatus('images/category', true) < 0 || ss_admin_getPathStatus('images/item', true) < 0) { pathConfiguration();
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); } }
function upgradeDB() { global $xoopsModule, $dbupdater; $xoopsDB =& Database::getInstance(); //1. Determine previous release // *** Update this in sql/mysql.sql for each release ** if (!ss_TableExists('smartsection_meta')) { $ver = '0.93'; } else { if (!($ver = ss_GetMeta('version'))) { exit(_AM_SS_DB_VERSION_ERR); } } $mid = $xoopsModule->getVar('mid'); xoops_cp_header(); ss_adminMenu(-1, _AM_SS_DB_UPDATE_DB); echo "<h2>" . _AM_SS_DB_UPDATE_DB . "</h2>"; $ret = true; //2. Do All Upgrades necessary to make current // Break statements are omitted on purpose switch ($ver) { case '0.93': set_time_limit(60); printf("<h3>" . _AM_SS_DB_UPDATE_TO . "</h3>", '1.0'); echo "<ul>"; // Create table smartsection_meta $table = new SmartsectionTable('smartsection_meta'); $table->setStructure("CREATE TABLE %s (\n \t\t\t\t\t\tmetakey varchar(50) NOT NULL default '', \n \t\t\t\t\t\tmetavalue varchar(255) NOT NULL default '', \n \t\t\t\t\t\tPRIMARY KEY (metakey)) \n \t\t\t\t\t\tTYPE=MyISAM;"); $table->setData(sprintf("'version', %s", $xoopsDB->quoteString($ver))); $ret = $ret && $dbupdater->updateTable($table); unset($table); // Add fields in smartsection_categories $table = new SmartsectionTable('smartsection_categories'); $table->addAlteredField('categoryid', "`categoryid` INT( 11 ) NOT NULL AUTO_INCREMENT"); $table->addAlteredField('parentid', "`parentid` INT( 11 ) DEFAULT '0' NOT NULL"); $ret = $dbupdater->updateTable($table) && $ret; unset($table); // Add fields in smartsection_items $table = new SmartsectionTable('smartsection_items'); $table->addAlteredField('categoryid', "`categoryid` INT( 11 ) DEFAULT '0' NOT NULL"); $table->addAlteredField('itemid', "`itemid` INT( 11 ) NOT NULL AUTO_INCREMENT"); $ret = $dbupdater->updateTable($table) && $ret; unset($table); // Add fields in smartsection_files $table = new SmartsectionTable('smartsection_files'); $table->addAlteredField('itemid', "`itemid` INT( 11 ) DEFAULT '0' NOT NULL"); $table->addAlteredField('fileid', "`fileid` INT( 11 ) NOT NULL AUTO_INCREMENT"); $ret = $dbupdater->updateTable($table) && $ret; unset($table); echo "</ul>"; case '1.0': set_time_limit(60); printf("<h3>" . _AM_SS_DB_UPDATE_TO . "</h3>", '1.01'); echo "<ul>"; // Add fields in smartsection_items $table = new SmartsectionTable('smartsection_items'); $table->addAlteredField('body', "`body` LONGTEXT NOT NULL"); $ret = $dbupdater->updateTable($table) && $ret; unset($table); echo "</ul>"; } $newversion = round($xoopsModule->getVar('version') / 100, 2); //if successful, update smartsection_meta table with new ver if ($ret) { printf(_AM_SS_DB_UPDATE_OK, $newversion); $ret = ss_SetMeta('version', $newversion); } else { printf(_AM_SS_DB_UPDATE_ERR, $newversion); } ss_modFooter(); xoops_cp_footer(); }
echo "\n\t\t<tr>\n\t\t\t<td class='foot' align='center' colspan='6'>\n\t\t\t\t<input type='hidden' name='fct' value='blocksadmin' />\n\t\t\t\t<input type='hidden' name='op' value='order' />\n\t\t\t\t<input type='submit' name='submit' value='" . _SUBMIT . "' />\n\t\t\t</td>\n\t\t</tr>\n\t\t</table>\n\t</form>\n"; ss_close_collapsable('blockstable', 'blocksicon'); } function list_groups() { global $xoopsModule, $block_arr; ss_collapsableBar('groupstable', 'groupsicon', _AM_SS_GROUPS, _AM_SS_GROUPSINFO); foreach (array_keys($block_arr) as $i) { $item_list[$block_arr[$i]->getVar("bid")] = $block_arr[$i]->getVar("title"); } $form = new MyXoopsGroupPermForm('', 1, 'block_read', ""); $form->addAppendix('module_admin', $xoopsModule->mid(), $xoopsModule->name() . ' ' . _AM_ACTIVERIGHTS); $form->addAppendix('module_read', $xoopsModule->mid(), $xoopsModule->name() . ' ' . _AM_ACCESSRIGHTS); foreach ($item_list as $item_id => $item_name) { $form->addItem($item_id, $item_name); } echo $form->render(); ss_close_collapsable('groupstable', 'groupsicon'); } if (!empty($_POST['submit'])) { include_once "mygroupperm.php"; redirect_header(XOOPS_URL . "/modules/" . $xoopsModule->dirname() . "/admin/myblocksadmin.php", 1, _MD_AM_DBUPDATED); } ss_xoops_cp_header(); if (file_exists('./mymenu.php')) { include './mymenu.php'; } ss_adminMenu(5, _AM_SS_BLOCKSANDGROUPS); list_blocks(); list_groups(); xoops_cp_footer();
function editcat($showmenu = false, $categoryid = 0, $nb_subcats = 4, $categoryObj = null) { global $xoopsDB, $smartsection_category_handler, $xoopsUser, $myts, $xoopsConfig, $xoopsModuleConfig, $xoopsModule; include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; // If there is a parameter, and the id exists, retrieve data: we're editing a category if ($categoryid != 0) { // Creating the category object for the selected category $categoryObj = new ssCategory($categoryid); if ($showmenu) { ss_adminMenu(1, _AM_SS_CATEGORIES . " > " . _AM_SS_EDITING); } echo "<br />\n"; if ($categoryObj->notLoaded()) { redirect_header("category.php", 1, _AM_SS_NOCOLTOEDIT); exit; } ss_collapsableBar('edittable', 'edittableicon', _AM_SS_EDITCOL, _AM_SS_CATEGORY_EDIT_INFO); } else { if (!$categoryObj) { $categoryObj = $smartsection_category_handler->create(); } if ($showmenu) { ss_adminMenu(1, _AM_SS_CATEGORIES . " > " . _AM_SS_CREATINGNEW); } //echo "<br />\n"; ss_collapsableBar('createtable', 'createtableicon', _AM_SS_CATEGORY_CREATE, _AM_SS_CATEGORY_CREATE_INFO); } // Start category form $mytree = new XoopsTree($xoopsDB->prefix("smartsection_categories"), "categoryid", "parentid"); $sform = new XoopsThemeForm(_AM_SS_CATEGORY, "op", xoops_getenv('PHP_SELF')); $sform->setExtra('enctype="multipart/form-data"'); // Name $sform->addElement(new XoopsFormText(_AM_SS_CATEGORY, 'name', 50, 255, $categoryObj->name('e')), true); // Decsription $sform->addElement(new XoopsFormTextArea(_AM_SS_COLDESCRIPT, 'description', $categoryObj->description('e'), 7, 60)); /* // IMAGE $image_array = & XoopsLists :: getImgListAsArray( ss_getImageDir('category') ); $image_select = new XoopsFormSelect( '', 'image', $categoryObj->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_SS_IMAGE, ' ' ); $image_tray -> addElement( $image_select ); $image_tray -> addElement( new XoopsFormLabel( '', "<br /><br /><img src='" . ss_getImageDir('category', false) .$categoryObj->image() . "' name='image3' id='image3' alt='' />" ) ); $image_tray->setDescription(_AM_SS_IMAGE_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_DSC); $sform->addElement($file_box); */ // Weight $sform->addElement(new XoopsFormText(_AM_SS_COLPOSIT, 'weight', 4, 4, $categoryObj->weight())); // READ PERMISSIONS $member_handler =& xoops_gethandler('member'); $group_list =& $member_handler->getGroupList(); $groups_read_checkbox = new XoopsFormCheckBox(_AM_SS_PERMISSIONS_CAT_READ, 'groups_read[]', $categoryObj->getGroups_read()); foreach ($group_list as $group_id => $group_name) { if ($group_id != XOOPS_GROUP_ADMIN) { $groups_read_checkbox->addOption($group_id, $group_name); } } $sform->addElement($groups_read_checkbox); // Apply permissions on all items $apply = isset($_POST['applyall']) ? intval($_POST['applyall']) : 0; $addapplyall_radio = new XoopsFormRadioYN(_AM_SS_PERMISSIONS_APPLY_ON_ITEMS, 'applyall', $apply, ' ' . _AM_SS_YES . '', ' ' . _AM_SS_NO . ''); $sform->addElement($addapplyall_radio); // MODERATORS //$moderators_tray = new XoopsFormElementTray(_AM_SS_MODERATORS_DEF, ''); $module_id = $xoopsModule->getVar('mid'); // Parent Category ob_start(); $mytree->makeMySelBox("name", "weight", $categoryObj->parentid(), 1, 'parentid'); //makeMySelBox($title,$order="",$preset_id=0, $none=0, $sel_name="", $onchange="") $sform->addElement(new XoopsFormLabel(_AM_SS_PARENT_CATEGORY_EXP, ob_get_contents())); ob_end_clean(); // Added by fx2024 // sub Categories $cat_tray = new XoopsFormElementTray(_AM_SS_SCATEGORYNAME, '<br /><br />'); for ($i = 0; $i < $nb_subcats; $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_SS_ADD_OPT, $t->render())); $b = new XoopsFormButton('', 'submit', _AM_SS_ADD_OPT_SUBMIT, 'submit'); if ($categoryid == 0) { $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); $sform->addElement($cat_tray); //End of fx2024 code /*$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); $sform->addElement($moderators_tray); */ $sform->addElement(new XoopsFormHidden('categoryid', $categoryid)); //$parentid = $categoryObj->parentid('s'); //$sform -> addElement( new XoopsFormHidden( 'parentid', $parentid ) ); $sform->addElement(new XoopsFormHidden('nb_sub_yet', $nb_subcats)); // Action buttons tray $button_tray = new XoopsFormElementTray('', ''); /*for ($i = 0; $i < sizeof($moderators); $i++) { $allmods[] = $moderators[$i]; } $hiddenmods = new XoopsFormHidden('allmods', $allmods); $button_tray->addElement($hiddenmods); */ $hidden = new XoopsFormHidden('op', 'addcategory'); $button_tray->addElement($hidden); // No ID for category -- then it's new category, button says 'Create' if (!$categoryid) { $butt_create = new XoopsFormButton('', '', _AM_SS_CREATE, 'submit'); $butt_create->setExtra('onclick="this.form.elements.op.value=\'addcategory\'"'); $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('createtable', 'createtableicon'); } else { // button says 'Update' $butt_create = new XoopsFormButton('', '', _AM_SS_MODIFY, 'submit'); $butt_create->setExtra('onclick="this.form.elements.op.value=\'addcategory\'"'); $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('edittable', 'edittableicon'); } //Added by fx2024 if ($categoryid) { include_once XOOPS_ROOT_PATH . "/modules/smartsection/include/displaysubcats.php"; include_once XOOPS_ROOT_PATH . "/modules/smartsection/include/displayitems.php"; } //end of fx2024 code unset($hidden); }
function editfile($showmenu = false, $fileid = 0, $itemid = 0) { global $smartsection_file_handler, $xoopsModule; include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; // If there is a parameter, and the id exists, retrieve data: we're editing a file if ($fileid != 0) { // Creating the File object $fileObj = new ssfile($fileid); if ($fileObj->notLoaded()) { redirect_header("javascript:history.go(-1)", 1, _AM_SS_NOFILESELECTED); exit; } if ($showmenu) { ss_adminMenu(2, _AM_SS_FILE . " > " . _AM_SS_EDITING); } echo "<br />\n"; echo "<span style='color: #2F5376; font-weight: bold; font-size: 16px; margin: 6px 06 0 0; '>" . _AM_SS_FILE_EDITING . "</span>"; echo "<span style=\"color: #567; margin: 3px 0 12px 0; font-size: small; display: block; \">" . _AM_SS_FILE_EDITING_DSC . "</span>"; ss_collapsableBar('bottomtable', 'bottomtableicon', _AM_SS_FILE_INFORMATIONS); } else { // there's no parameter, so we're adding an item $fileObj =& $smartsection_file_handler->create(); $fileObj->setVar('itemid', $itemid); if ($showmenu) { ss_adminMenu(2, _AM_SS_FILE . " > " . _AM_SS_FILE_ADD); } echo "<span style='color: #2F5376; font-weight: bold; font-size: 16px; margin: 6px 06 0 0; '>" . _AM_SS_FILE_ADDING . "</span>"; echo "<span style=\"color: #567; margin: 3px 0 12px 0; font-size: small; display: block; \">" . _AM_SS_FILE_ADDING_DSC . "</span>"; ss_collapsableBar('bottomtable', 'bottomtableicon', _AM_SS_FILE_INFORMATIONS); } // FILES UPLOAD FORM $files_form = new XoopsThemeForm(_AM_SS_UPLOAD_FILE, "files_form", xoops_getenv('PHP_SELF')); $files_form->setExtra("enctype='multipart/form-data'"); // NAME $name_text = new XoopsFormText(_AM_SS_FILE_NAME, 'name', 50, 255, $fileObj->name()); $name_text->setDescription(_AM_SS_FILE_NAME_DSC); $files_form->addElement($name_text, true); // DESCRIPTION $description_text = new XoopsFormTextArea(_AM_SS_FILE_DESCRIPTION, 'description', $fileObj->description()); $description_text->setDescription(_AM_SS_FILE_DESCRIPTION_DSC); $files_form->addElement($description_text, 7, 60); // FILE TO UPLOAD if ($fileid == 0) { $file_box = new XoopsFormFile(_AM_SS_FILE_TO_UPLOAD, "my_file", 0); $file_box->setExtra("size ='50'"); $files_form->addElement($file_box); } $files_button_tray = new XoopsFormElementTray('', ''); $files_hidden = new XoopsFormHidden('op', 'uploadfile'); $files_button_tray->addElement($files_hidden); if ($fileid == 0) { $files_butt_create = new XoopsFormButton('', '', _AM_SS_UPLOAD, 'submit'); $files_butt_create->setExtra('onclick="this.form.elements.op.value=\'uploadfile\'"'); $files_button_tray->addElement($files_butt_create); } else { $files_butt_create = new XoopsFormButton('', '', _AM_SS_MODIFY, 'submit'); $files_butt_create->setExtra('onclick="this.form.elements.op.value=\'modify\'"'); $files_button_tray->addElement($files_butt_create); } $files_butt_clear = new XoopsFormButton('', '', _AM_SS_CLEAR, 'reset'); $files_button_tray->addElement($files_butt_clear); $butt_cancel = new XoopsFormButton('', '', _AM_SS_CANCEL, 'button'); $butt_cancel->setExtra('onclick="history.go(-1)"'); $files_button_tray->addElement($butt_cancel); $files_form->addElement($files_button_tray); // fileid $files_form->addElement(new XoopsFormHidden('fileid', $fileid)); // itemid $files_form->addElement(new XoopsFormHidden('itemid', $itemid)); $files_form->display(); echo "</div>"; }
echo "<br />"; if ($error == true) { $endMsg = _AM_SS_IMPORT_ERROR; } else { $endMsg = _AM_SS_IMPORT_SUCCESS; } echo $endMsg; echo "<br /><br />"; echo "<a href='import.php'>" . _AM_SS_IMPORT_BACK . "</a>"; echo "<br /><br />"; break; case "default": default: $importfile = 'xoops_qa'; xoops_cp_header(); ss_adminMenu(-1, _AM_SS_IMPORT); ss_collapsableBar('bottomtable', 'bottomtableicon', _AM_SS_IMPORT_TITLE, _AM_SS_IMPORT_INFO); global $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 request $ssorm = new XoopsThemeForm(_AM_SS_IMPORT_SELECTION, "op", xoops_getenv('PHP_SELF')); $sform->setExtra('enctype="multipart/form-data"'); // Q&A set to import $importfile_select_array = array("xoops_qa" => _AM_SS_XOOPS_QA); $importfile_select = new XoopsFormSelect('', 'importfile', $importfile); $importfile_select->addOptionArray($importfile_select_array); $importfile_tray = new XoopsFormElementTray(_AM_SS_IMPORT_SELECT_FILE, ' '); $importfile_tray->addElement($importfile_select); $sform->addElement($importfile_tray); // Buttons $button_tray = new XoopsFormElementTray('', '');