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 $form_view->render(); } else { echo "<img id='toptableicon' src=" . XOOPS_URL . "/modules/" . $xoopsModule->dirname() . "/images/icon/close12.gif alt='' /></a> " . _AM_SS_PERMISSIONSVIEWMAN . "</h3><div id='toptable'><span style=\"color: #567; margin: 3px 0 0 0; font-size: small; display: block; \">" . _AM_SS_NOPERMSSET . "</span>"; } ss_close_collapsable('permissionstable', 'permissionsicon'); echo "<br />\n"; } $modfooter = ss_modFooter(); echo "<div align='center'>" . $modfooter . "</div>"; xoops_cp_footer();
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(); }