From: <on...@us...> - 2002-09-18 12:23:54
|
Update of /cvsroot/xoops/xoops-current/html/modules/system/admin/blocksadmin In directory usw-pr-cvs1:/tmp/cvs-serv16672 Modified Files: main.php blocksadmin.php Log Message: no message Index: main.php =================================================================== RCS file: /cvsroot/xoops/xoops-current/html/modules/system/admin/blocksadmin/main.php,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** main.php 15 Jul 2002 08:13:44 -0000 1.1.1.1 --- main.php 18 Sep 2002 12:23:51 -0000 1.2 *************** *** 18,23 **** if ( $op == "list" ) { xoops_cp_header(); ! list_blocks(); ! xoops_cp_footer(); exit(); } --- 18,23 ---- if ( $op == "list" ) { xoops_cp_header(); ! list_blocks(); ! xoops_cp_footer(); exit(); } *************** *** 34,45 **** if ( $op == "save" ) { ! save_block($bside, $bweight, $bvisible, $btitle, $bcontent, $bctype); exit(); } if ( $op == "update" ) { ! update_block($bid, $bside, $bweight, $bposition, $bvisible, $btitle, $bcontent, $bctype, $options); ! exit(); } if ( $op == "delete_ok" ) { --- 34,45 ---- if ( $op == "save" ) { ! save_block($bside, $bweight, $bvisible, $btitle, $bcontent, $bctype, $btemplate, $balias, $bcachetime, $bmodule); exit(); } if ( $op == "update" ) { ! update_block($bid, $bside, $bweight, $bposition, $bvisible, $btitle, $btemplate, $bcontent, $bctype, $balias, $bcachetime, $bmodule, $options); } + if ( $op == "delete_ok" ) { Index: blocksadmin.php =================================================================== RCS file: /cvsroot/xoops/xoops-current/html/modules/system/admin/blocksadmin/blocksadmin.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** blocksadmin.php 4 Aug 2002 19:59:24 -0000 1.2 --- blocksadmin.php 18 Sep 2002 12:23:51 -0000 1.3 *************** *** 1,39 **** <?php // $Id$ ! if ( !eregi("admin.php", $PHP_SELF) ) { ! die ("Access Denied"); } // check if the user is authorised if ( $xoopsUser->isAdmin($xoopsModule->mid()) ) { ! include_once(XOOPS_ROOT_PATH."/class/xoopsblock.php"); function list_blocks(){ ! global $xoopsUser; ! OpenTable(); echo " <h4 style='text-align:left;'>"._AM_BADMIN."</h4> ! <form action='admin.php' name='blockadmin' id='blockadmin' method='post' style='position:relative;z-index:3'><b>"._AM_SIDEBADMIN."</b><br /> ! <table border='0' cellpadding='0' cellspacing='0' valign='top' width='100%'><tr><td class='bg2'> <table width='100%' border='0' cellpadding='4' cellspacing='1'> <tr valign='middle' class='bg3'><td width='20%'><b>"._AM_BLKDESC."</b></td><td width='20%'><b>"._AM_TITLE."</b></td><td><b>"._AM_SIDE."</b></td><td align='center'><b>"._AM_WEIGHT."</b></td><td align='center'><b>"._AM_VISIBLE."</b></td><td align='right'><b>"._AM_ACTION."</b></td></tr> "; $arr =& XoopsBlock::getAllBlocks("object", XOOPS_SIDEBLOCK_BOTH); ! foreach ( $arr as $ele ) { ! show_block($ele); } echo " ! </table></td></tr></table> <br /> <b>"._AM_CENTERBADMIN."</b><br /> - <table border='0' cellpadding='0' cellspacing='0' valign='top' width='100%'><tr><td class='bg2'> <table width='100%' border='0' cellpadding='4' cellspacing='1'> <tr valign='middle' class='bg3'><td width='20%'><b>"._AM_BLKDESC."</b></td><td width='20%'><b>"._AM_TITLE."</b></td><td><b>"._AM_SIDE."</b></td><td align='center'><b>"._AM_WEIGHT."</b></td><td align='center'><b>"._AM_VISIBLE."</b></td><td align='right'><b>"._AM_ACTION."</b></td></tr> "; $arr =& XoopsBlock::getAllBlocks("object", XOOPS_CENTERBLOCK_ALL); ! foreach($arr as $ele){ ! show_block($ele); } echo " ! </table></td></tr></table><br /><div> <input type='hidden' name='fct' value='blocksadmin' /> <input type='hidden' name='op' value='order' /> --- 1,41 ---- <?php // $Id$ ! if ( !eregi('admin.php', $PHP_SELF) ) { ! die ('Access Denied'); } // check if the user is authorised if ( $xoopsUser->isAdmin($xoopsModule->mid()) ) { ! include_once(XOOPS_ROOT_PATH.'/class/xoopsblock.php'); function list_blocks(){ ! global $xoopsUser, $xoopsConfig; ! include_once(XOOPS_ROOT_PATH.'/class/xoopslists.php'); ! //OpenTable(); echo " <h4 style='text-align:left;'>"._AM_BADMIN."</h4> ! <form action='admin.php' name='blockadmin' id='blockadmin' method='post'><b>"._AM_SIDEBADMIN."</b><br /> ! <table width='100%' border='0' cellpadding='4' cellspacing='1'> <tr valign='middle' class='bg3'><td width='20%'><b>"._AM_BLKDESC."</b></td><td width='20%'><b>"._AM_TITLE."</b></td><td><b>"._AM_SIDE."</b></td><td align='center'><b>"._AM_WEIGHT."</b></td><td align='center'><b>"._AM_VISIBLE."</b></td><td align='right'><b>"._AM_ACTION."</b></td></tr> "; $arr =& XoopsBlock::getAllBlocks("object", XOOPS_SIDEBLOCK_BOTH); ! $block_count = count($arr); ! for ($i = 0; $i < $block_count; $i++) { ! show_block($arr[$i]); } echo " ! </table> <br /> <b>"._AM_CENTERBADMIN."</b><br /> <table width='100%' border='0' cellpadding='4' cellspacing='1'> <tr valign='middle' class='bg3'><td width='20%'><b>"._AM_BLKDESC."</b></td><td width='20%'><b>"._AM_TITLE."</b></td><td><b>"._AM_SIDE."</b></td><td align='center'><b>"._AM_WEIGHT."</b></td><td align='center'><b>"._AM_VISIBLE."</b></td><td align='right'><b>"._AM_ACTION."</b></td></tr> "; $arr =& XoopsBlock::getAllBlocks("object", XOOPS_CENTERBLOCK_ALL); ! $block_count = count($arr); ! for ($i = 0; $i < $block_count; $i++) { ! show_block($arr[$i]); } echo " ! </table><br /><div> <input type='hidden' name='fct' value='blocksadmin' /> <input type='hidden' name='op' value='order' /> *************** *** 46,50 **** <h4 style='text-align:left;'>" ._AM_ADDBLOCK."</h4> <form action='admin.php?fct=blocksadmin' method='post'> - <table border='0' cellpadding='0' cellspacing='0' valign='top' width='100%'><tr><td class='bg2'> <table width='100%' border='0' cellpadding='4' cellspacing='1'> <tr align='left' valign='top'><td class='bg3' width='30%'> --- 48,51 ---- *************** *** 69,73 **** <option value='1' selected='selected'>" ._AM_YES."</option> </select> ! </td></tr><tr align='left' valign='top'><td class='bg3'> <b>" ._AM_TITLE."</b> </td><td class='bg1'> --- 70,81 ---- <option value='1' selected='selected'>" ._AM_YES."</option> </select> ! </td></tr>"; ! echo '<tr><td class="bg3" valign="top"><b>'._AM_VISIBLEIN.'</b></td><td class="bg1"><select size="5" name="bmodule[]" multiple="multiple"><option value="-1">'._AM_TOPONLY.'</option><option value="0">'._AM_ALLPAGES.'</option>'; ! $module_list =& XoopsModule::getHasMainModulesList(); ! foreach ($module_list as $k => $v) { ! echo '<option value="'.$k.'">'.$v.'</option>'; ! } ! echo '</select></td></tr>'; ! echo "<tr align='left' valign='top'><td class='bg3'> <b>" ._AM_TITLE."</b> </td><td class='bg1'> *************** *** 86,98 **** <option value='T' selected='selected'>" ._AM_AFNOSMILE."</option> </select> ! </td></tr> <tr align='left' valign='top'><td class='bg3'> </td> <td class='bg1'> <input type='hidden' name='op' value='save' /> <input type='submit' value='" ._AM_SUBMIT."' /> ! </td></tr></table></td></tr></table> </form> "; ! CloseTable(); } --- 94,120 ---- <option value='T' selected='selected'>" ._AM_AFNOSMILE."</option> </select> ! </td></tr>"; ! if (!is_dir(XOOPS_ROOT_PATH.'/themes/'.$xoopsConfig['default_theme'].'/blocks')) { ! $block_templates =& XoopsLists::getFileListAsArray(XOOPS_ROOT_PATH.'/themes/xoops/blocks'); ! } else { ! $block_templates =& XoopsLists::getFileListAsArray(XOOPS_ROOT_PATH.'/themes/'.$xoopsConfig['default_theme'].'/blocks'); ! } ! echo '<tr valign="top"><td class="bg3"><b>'._AM_BTEMPLATE.'</b></td><td class="bg1"><select name="btemplate">'; ! foreach ($block_templates as $key => $value) { ! echo '<option value="'.$key.'">'.$value.'</option>'; ! } ! echo '</select></td></tr>'; ! echo '<tr valign="top"><td class="bg3"><b>'._AM_ADVANCED.'</b></td><td class="bg1">'._AM_BCACHETIME.' <input type="text" name="bcachetime" size="10" maxlength="10" value="0" />'; ! //echo '<br />'._AM_BALIAS.' <input type="text" name="balias" size="50" maxlength="50" value="" />'; ! echo '</td></tr>'; ! echo " <tr align='left' valign='top'><td class='bg3'> </td> <td class='bg1'> <input type='hidden' name='op' value='save' /> <input type='submit' value='" ._AM_SUBMIT."' /> ! </td></tr></table> </form> "; ! //CloseTable(); } *************** *** 125,155 **** } echo " ! <input type='hidden' name='oldside[]' value='".$ele->getVar("side")."' /> ! <input type='hidden' name='oldweight[]' value='".$ele->getVar("weight")."' /> ! <input type='hidden' name='oldvisible[]' value='".$ele->getVar("visible")."' /> ! <input type='hidden' name='bid[]' value='".$ele->getVar("bid")."' /> </td></tr> "; } ! function save_block($bside, $bweight, $bvisible, $btitle, $bcontent, $bctype){ $myblock = new XoopsBlock(); ! $myblock->setVar("side", $bside); ! $myblock->setVar("weight", $bweight); ! //$myblock->setVar("position", $bposition); ! $myblock->setVar("visible", $bvisible); ! $myblock->setVar("weight", $bweight); ! $myblock->setVar("title", $btitle); ! $myblock->setVar("content", $bcontent); ! $myblock->setVar("c_type", $bctype); ! $myblock->setVar("type", "C"); switch ($bctype) { ! case "H": $name = _AM_CUSTOMHTML; break; ! case "P": $name = _AM_CUSTOMPHP; break; ! case "S": $name = _AM_CUSTOMSMILE; break; --- 147,181 ---- } echo " ! <input type='hidden' name='oldside[]' value='".$ele->getVar('side')."' /> ! <input type='hidden' name='oldweight[]' value='".$ele->getVar('weight')."' /> ! <input type='hidden' name='oldvisible[]' value='".$ele->getVar('visible')."' /> ! <input type='hidden' name='bid[]' value='".$ele->getVar('bid')."' /> </td></tr> "; } ! function save_block($bside, $bweight, $bvisible, $btitle, $bcontent, $bctype, $btemplate, $balias, $bcachetime, $bmodule){ ! global $xoopsUser; $myblock = new XoopsBlock(); ! $myblock->setVar('side', $bside); ! $myblock->setVar('weight', $bweight); ! //$myblock->setVar('position', $bposition); ! $myblock->setVar('visible', $bvisible); ! $myblock->setVar('weight', $bweight); ! $myblock->setVar('title', $btitle); ! $myblock->setVar('content', $bcontent); ! $myblock->setVar('c_type', $bctype); ! $myblock->setVar('type', 'C'); ! $myblock->setVar('btemplate', $btemplate); ! $myblock->setVar('balias', $balias); ! $myblock->setVar('bcachetime', $bcachetime); switch ($bctype) { ! case 'H': $name = _AM_CUSTOMHTML; break; ! case 'P': $name = _AM_CUSTOMPHP; break; ! case 'S': $name = _AM_CUSTOMSMILE; break; *************** *** 158,163 **** break; } ! $myblock->setVar("name", $name); ! if ( !$myblock->store() ) { xoops_cp_header(); $myblock->getErrors(); --- 184,190 ---- break; } ! $myblock->setVar('name', $name); ! $newid = $myblock->store(); ! if (!$newid) { xoops_cp_header(); $myblock->getErrors(); *************** *** 165,199 **** exit(); } ! redirect_header("admin.php?fct=blocksadmin",1,_AM_DBUPDATED); exit(); } function edit_block($bid){ $myblock = new XoopsBlock($bid); ! OpenTable(); ! echo "<h4 style='text-align:left;'>" ._AM_EDITBLOCK."</h4> ! <form action='admin.php?fct=blocksadmin' method='post'> ! <table border='0' cellpadding='0' cellspacing='0' valign='top' width='100%'><tr><td class='bg2'> ! <table width='100%' border='0' cellpadding='4' cellspacing='1'> ! <tr align='left' valign='top'><td class='bg3' width='30%'> ! <b>"._AM_NAME."</b></td><td class='bg1'>".$myblock->getVar("name")."</td></tr> ! <tr align='left' valign='top'><td class='bg3'> ! <b>"._AM_BLKTYPE."</b></td> ! <td class='bg1'> ! <select name='bside'> ! <option value='0'"; ! if ( $myblock->getVar("side") == 0 ) echo " selected='selected'"; echo ">" ._AM_SBLEFT."</option> <option value='1'"; ! if ( $myblock->getVar("side") == 1 ) echo " selected='selected'"; echo ">" ._AM_SBRIGHT."</option> <option value='3'"; ! if ( $myblock->getVar("side") == 3 ) echo " selected='selected'"; echo ">" ._AM_CBLEFT."</option> <option value='5'"; ! if ( $myblock->getVar("side") == 5 ) echo " selected='selected'"; echo ">" ._AM_CBCENTER."</option> <option value='4'"; ! if ( $myblock->getVar("side") == 4 ) echo " selected='selected'"; echo ">" ._AM_CBRIGHT."</option> </select> --- 192,241 ---- exit(); } ! $db =& Database::getInstance(); ! foreach ($bmodule as $bmid) { ! $sql = 'INSERT INTO '.$db->prefix('block_module_link').' (block_id, module_id) VALUES ('.$newid.', '.$bmid.')'; ! $db->query($sql); ! } ! $groups =& $xoopsUser->getGroups(); ! $count = count($groups); ! for ($i = 0; $i < $count; $i++) { ! $sql = "INSERT INTO ".$db->prefix('groups_blocks_link')." (groupid, block_id, type) VALUES (".$groups[$i].", ".$newid.", 'R')"; ! $db->query($sql); ! } ! redirect_header('admin.php?fct=blocksadmin',1,_AM_DBUPDATED); exit(); } function edit_block($bid){ + global $xoopsConfig; + include_once(XOOPS_ROOT_PATH.'/class/xoopslists.php'); $myblock = new XoopsBlock($bid); ! //OpenTable(); ! echo "<h4 style='text-align:left;'>" ._AM_EDITBLOCK."</h4>"; ! ?> ! <form action="admin.php?fct=blocksadmin" name="editblock" method="post"> ! <table border="0" cellpadding="0" cellspacing="0" valign="top" width="100%"><tr><td class="bg2"> ! <table width="100%" border="0" cellpadding="4" cellspacing="1"> ! <tr align="left" valign="top"><td class="bg3" width="30%"> ! <b><?php _AM_NAME;?></b></td><td class="bg1"><?php $myblock->getVar('name');?></td></tr> ! <tr align="left" valign="top"><td class="bg3"> ! <b><?php _AM_BLKTYPE;?></b></td> ! <td class="bg1"> ! <select name="bside"> ! <?php ! echo '<option value="0"'; ! if ( $myblock->getVar('side') == 0 ) echo ' selected="selected"'; echo ">" ._AM_SBLEFT."</option> <option value='1'"; ! if ( $myblock->getVar('side') == 1 ) echo " selected='selected'"; echo ">" ._AM_SBRIGHT."</option> <option value='3'"; ! if ( $myblock->getVar('side') == 3 ) echo " selected='selected'"; echo ">" ._AM_CBLEFT."</option> <option value='5'"; ! if ( $myblock->getVar('side') == 5 ) echo " selected='selected'"; echo ">" ._AM_CBCENTER."</option> <option value='4'"; ! if ( $myblock->getVar('side') == 4 ) echo " selected='selected'"; echo ">" ._AM_CBRIGHT."</option> </select> *************** *** 202,226 **** </td><td class='bg1'> <input type='text' name='bweight' size='2' maxlength='2' value='"; ! echo $myblock->getVar("weight"); ! echo "' /> ! </td></tr><tr align='left' valign='top'><td class='bg3'> ! <b>"._AM_VISIBLE."</b></td><td class='bg1'> ! <select name='bvisible'> ! <option value='0'"; ! if ( $myblock->getVar("visible") == 0 ) echo " selected='selected'"; ! echo ">" ._AM_NO."</option> ! <option value='1'"; ! if ( $myblock->getVar("visible") == 1 ) echo " selected='selected'"; ! echo ">" ._AM_YES."</option>"; ! echo "</select> ! </td></tr><tr align='left' valign='top'><td class='bg3'> <b>" ._AM_TITLE."</b></td><td class='bg1'> <input type='text' name='btitle' size='60' maxlength='60' value='"; ! echo $myblock->getVar("title", "E"); echo "' /> </td></tr><tr align='left' valign='top'><td class='bg3'> <b>"._AM_CONTENT."</b><br /><br /><span style='font-size:x-small;font-weight:bold;'>"._AM_USEFULTAGS."</span><br /><span style='font-size:x-small;font-weight:normal;'>".sprintf(_AM_BLOCKTAG1, "{X_SITEURL}", XOOPS_URL."/")."</span></td><td class='bg1'> <textarea name='bcontent' cols='60' rows='10'>"; ! echo $myblock->getContent("E"); echo "</textarea> </td></tr>"; --- 244,282 ---- </td><td class='bg1'> <input type='text' name='bweight' size='2' maxlength='2' value='"; ! echo $myblock->getVar('weight'); ! echo "' /></td></tr><tr align='left' valign='top'><td class='bg3'><b>"._AM_VISIBLE."</b></td><td class='bg1'><select name='bvisible'><option value='0'"; ! if ( $myblock->getVar('visible') == 0 ) echo " selected='selected'"; ! echo ">" ._AM_NO."</option><option value='1'"; ! if ( $myblock->getVar('visible') == 1 ) echo " selected='selected'"; ! echo '>'._AM_YES.'</option></select></td></tr>'; ! echo '<tr><td class="bg3" valign="top"><b>'._AM_VISIBLEIN.'</b></td><td class="bg1"><select size="5" name="bmodule[]" multiple="multiple">'; ! $db =& Database::getInstance(); ! $sql = 'SELECT module_id FROM '.$db->prefix('block_module_link').' WHERE block_id='.intval($bid); ! $result = $db->query($sql); ! $selected = array(); ! while ($row = $db->fetchArray($result)) { ! $selected[] = intval($row['module_id']); ! } ! $module_list =& XoopsModule::getHasMainModulesList(); ! $module_list[0] = _AM_ALLPAGES; ! $module_list[-1] = _AM_TOPONLY; ! ksort($module_list); ! foreach ($module_list as $k => $v) { ! $sel = ''; ! if (in_array($k, $selected)) { ! $sel = ' selected="selected"'; ! } ! echo '<option value="'.$k.'"'.$sel.'>'.$v.'</option>'; ! } ! echo '</select></td></tr>'; ! echo "<tr align='left' valign='top'><td class='bg3'> <b>" ._AM_TITLE."</b></td><td class='bg1'> <input type='text' name='btitle' size='60' maxlength='60' value='"; ! echo $myblock->getVar('title', 'E'); echo "' /> </td></tr><tr align='left' valign='top'><td class='bg3'> <b>"._AM_CONTENT."</b><br /><br /><span style='font-size:x-small;font-weight:bold;'>"._AM_USEFULTAGS."</span><br /><span style='font-size:x-small;font-weight:normal;'>".sprintf(_AM_BLOCKTAG1, "{X_SITEURL}", XOOPS_URL."/")."</span></td><td class='bg1'> <textarea name='bcontent' cols='60' rows='10'>"; ! echo $myblock->getContent('E'); echo "</textarea> </td></tr>"; *************** *** 230,237 **** <select name='bposition'> <option value='0'"; ! if ( $myblock->getVar("position") == 0) echo " selected='selected'"; echo ">" ._AM_ABOVEORG."</option> <option value='1'"; ! if ( $myblock->getVar("position") == 1) echo " selected='selected'"; echo ">" ._AM_AFTERORG."</option> </select> --- 286,293 ---- <select name='bposition'> <option value='0'"; ! if ( $myblock->getVar('position') == 0) echo " selected='selected'"; echo ">" ._AM_ABOVEORG."</option> <option value='1'"; ! if ( $myblock->getVar('position') == 1) echo " selected='selected'"; echo ">" ._AM_AFTERORG."</option> </select> *************** *** 242,259 **** <select name='bctype'> <option value='H'"; ! if ( $myblock->getVar("c_type") == "H") echo " selected='selected'"; echo ">" ._AM_HTML."</option> <option value='P'"; ! if ( $myblock->getVar("c_type") == "P") echo " selected='selected'"; echo ">" ._AM_PHP."</option> <option value='S'"; ! if ( $myblock->getVar("c_type") == "S") echo " selected='selected'"; echo ">" ._AM_AFWSMILE."</option> <option value='T'"; ! if ( $myblock->getVar("c_type") == "T") echo " selected='selected'"; echo ">" ._AM_AFNOSMILE."</option> </select> </td></tr>"; ! $edit_form = $myblock->getOptions(); if ( $edit_form != false ) { --- 298,328 ---- <select name='bctype'> <option value='H'"; ! if ( $myblock->getVar('c_type') == 'H') echo " selected='selected'"; echo ">" ._AM_HTML."</option> <option value='P'"; ! if ( $myblock->getVar('c_type') == 'P') echo " selected='selected'"; echo ">" ._AM_PHP."</option> <option value='S'"; ! if ( $myblock->getVar('c_type') == 'S') echo " selected='selected'"; echo ">" ._AM_AFWSMILE."</option> <option value='T'"; ! if ( $myblock->getVar('c_type') == 'T') echo " selected='selected'"; echo ">" ._AM_AFNOSMILE."</option> </select> </td></tr>"; ! if (!is_dir(XOOPS_ROOT_PATH.'/themes/'.$xoopsConfig['default_theme'].'/blocks')) { ! $block_templates =& XoopsLists::getFileListAsArray(XOOPS_ROOT_PATH.'/themes/xoops/blocks/'); ! } else { ! $block_templates =& XoopsLists::getFileListAsArray(XOOPS_ROOT_PATH.'/themes/'.$xoopsConfig['default_theme'].'/blocks/'); ! } ! echo '<tr valign="top"><td class="bg3"><b>'._AM_BTEMPLATE.'</b></td><td class="bg1"><select name="btemplate">'; ! foreach ($block_templates as $key => $value) { ! echo '<option value="'.$key.'"'; ! if ($myblock->getVar('btemplate') == $key) { ! echo ' selected="selected"'; ! } ! echo '>'.$value.'</option>'; ! } ! echo '</select></td></tr>'; $edit_form = $myblock->getOptions(); if ( $edit_form != false ) { *************** *** 262,300 **** echo "</td></tr>"; } echo "<tr align='left' valign='top'><td class='bg3'> </td> <td class='bg1'> <input type='hidden' name='op' value='update' /> <input type='hidden' name='bid' value='".$myblock->getVar("bid")."' /> ! <input type='submit' value='" ._AM_SAVECHANGES."' /> <input type='button' onclick='location=\"admin.php?fct=blocksadmin\"' value='" ._CANCEL."' /> </td></tr></table></td></tr></table> </form> "; ! CloseTable(); } ! function update_block($bid, $bside, $bweight, $bposition, $bvisible, $btitle, $bcontent, $bctype, $options=""){ $myblock = new XoopsBlock($bid); ! $myblock->setVar("side", $bside); ! $myblock->setVar("weight", $bweight); ! $myblock->setVar("position", $bposition); ! $myblock->setVar("visible", $bvisible); ! $myblock->setVar("weight", $bweight); ! $myblock->setVar("title", $btitle); ! $myblock->setVar("content", $bcontent); if ( isset($options) && (count($options) > 0) ) { ! $options = implode("|", $options); ! $myblock->setVar("options", $options); } ! $myblock->setVar("c_type", $bctype); ! if ( $myblock->getVar("type") == "C" ) { switch ($bctype) { ! case "H": $name = _AM_CUSTOMHTML; break; ! case "P": $name = _AM_CUSTOMPHP; break; ! case "S": $name = _AM_CUSTOMSMILE; break; --- 331,376 ---- echo "</td></tr>"; } + echo '<tr valign="top"><td class="bg3"><b>'._AM_ADVANCED.'</b></td><td class="bg1">'._AM_BCACHETIME.' <input type="text" name="bcachetime" size="10" maxlength="10" value="'.$myblock->getVar('bcachetime').'" />'; + //echo '<br />'._AM_BALIAS.' <input type="text" name="balias" size="50" maxlength="50" value="'.$myblock->getVar('balias', 'E').'" />'; + echo '</td></tr>'; echo "<tr align='left' valign='top'><td class='bg3'> </td> <td class='bg1'> <input type='hidden' name='op' value='update' /> <input type='hidden' name='bid' value='".$myblock->getVar("bid")."' /> ! <input type='submit' name='savebutton' value='" ._AM_SAVECHANGES."' /> <input type='button' onclick='location=\"admin.php?fct=blocksadmin\"' value='" ._CANCEL."' /> </td></tr></table></td></tr></table> </form> "; ! //CloseTable(); } ! function update_block($bid, $bside, $bweight, $bposition, $bvisible, $btitle, $btemplate, $bcontent, $bctype, $balias, $bcachetime, $bmodule, $options=array()){ ! global $xoopsConfig; $myblock = new XoopsBlock($bid); ! $myblock->setVar('side', $bside); ! $myblock->setVar('weight', $bweight); ! $myblock->setVar('position', $bposition); ! $myblock->setVar('visible', $bvisible); ! $myblock->setVar('weight', $bweight); ! $myblock->setVar('title', $btitle); ! $myblock->setVar('content', $bcontent); ! $myblock->setVar('btemplate', $btemplate); ! $myblock->setVar('balias', $balias); ! $myblock->setVar('bcachetime', $bcachetime); if ( isset($options) && (count($options) > 0) ) { ! $options = implode('|', $options); ! $myblock->setVar('options', $options); } ! $myblock->setVar('c_type', $bctype); ! if ( $myblock->getVar('type') == 'C' ) { switch ($bctype) { ! case 'H': $name = _AM_CUSTOMHTML; break; ! case 'P': $name = _AM_CUSTOMPHP; break; ! case 'S': $name = _AM_CUSTOMSMILE; break; *************** *** 303,310 **** break; } ! $myblock->setVar("name", $name); } ! $myblock->store(); ! redirect_header("admin.php?fct=blocksadmin",1,_AM_DBUPDATED); exit(); } --- 379,403 ---- break; } ! $myblock->setVar('name', $name); } ! if ($myblock->store() != false) { ! $db =& Database::getInstance(); ! $sql = 'DELETE FROM '.$db->prefix('block_module_link').' WHERE block_id='.$bid; ! $db->query($sql); ! foreach ($bmodule as $bmid) { ! $sql = 'INSERT INTO '.$db->prefix('block_module_link').' (block_id, module_id) VALUES ('.$bid.', '.$bmid.')'; ! $db->query($sql); ! } ! include_once(XOOPS_ROOT_PATH.'/class/xoopstpl.php'); ! $xoopsTpl = new XoopsTpl('user'); ! $xoopsTpl->setCaching(2); ! $xoopsTpl->setCacheDir(XOOPS_ROOT_PATH.'/cache'); ! $xoopsTpl->setCompileDir(XOOPS_ROOT_PATH.'/templates_c'); ! $xoopsTpl->setTemplateDir(XOOPS_ROOT_PATH.'/themes/'.$xoopsConfig['default_theme']); ! if (!$xoopsTpl->clear_cache('file:'.XOOPS_ROOT_PATH.'/themes/'.$xoopsConfig['default_theme'].'/blocks/'.$btemplate, $bid)) { ! echo 'false'; ! } ! } ! redirect_header('admin.php?fct=blocksadmin',1,_AM_DBUPDATED); exit(); } *************** *** 312,329 **** function delete_block($bid){ $myblock = new XoopsBlock($bid); ! if ( $myblock->getVar("type") == "S" ) { $message = _AM_SYSTEMCANT; ! redirect_header("admin.php?fct=blocksadmin",4,$message); exit(); ! } elseif ($myblock->getVar("type") == "M") { $message = _AM_MODULECANT; ! redirect_header("admin.php?fct=blocksadmin",4,$message); exit(); } else { echo "<h4 style='text-align:left;'>".sprintf(_AM_RUSUREDEL,$myblock->getVar("title"))."</h4>"; echo "<table><tr><td>\n"; ! echo myTextForm("admin.php?fct=blocksadmin&op=delete_ok&bid=".$myblock->getVar("bid") , _AM_YES); echo "</td><td>\n"; ! echo myTextForm("admin.php?fct=blocksadmin" , _AM_NO); echo "</td></tr></table>\n"; } --- 405,422 ---- function delete_block($bid){ $myblock = new XoopsBlock($bid); ! if ( $myblock->getVar('type') == 'S' ) { $message = _AM_SYSTEMCANT; ! redirect_header('admin.php?fct=blocksadmin',4,$message); exit(); ! } elseif ($myblock->getVar('type') == 'M') { $message = _AM_MODULECANT; ! redirect_header('admin.php?fct=blocksadmin',4,$message); exit(); } else { echo "<h4 style='text-align:left;'>".sprintf(_AM_RUSUREDEL,$myblock->getVar("title"))."</h4>"; echo "<table><tr><td>\n"; ! echo myTextForm('admin.php?fct=blocksadmin&op=delete_ok&bid='.$myblock->getVar('bid') , _AM_YES); echo "</td><td>\n"; ! echo myTextForm('admin.php?fct=blocksadmin' , _AM_NO); echo "</td></tr></table>\n"; } *************** *** 333,337 **** $myblock = new XoopsBlock($bid); $myblock->delete(); ! redirect_header("admin.php?fct=blocksadmin",1,_AM_DBUPDATED); exit(); } --- 426,430 ---- $myblock = new XoopsBlock($bid); $myblock->delete(); ! redirect_header('admin.php?fct=blocksadmin',1,_AM_DBUPDATED); exit(); } *************** *** 339,351 **** function order_block($bid, $weight, $visible, $side){ $myblock = new XoopsBlock($bid); ! $myblock->setVar("weight", $weight); ! $myblock->setVar("visible", $visible); ! $myblock->setVar("side", $side); $myblock->store(); } ! /* function preview_cblock(){ ! }*/ ! } else { echo "Access Denied"; --- 432,507 ---- function order_block($bid, $weight, $visible, $side){ $myblock = new XoopsBlock($bid); ! $myblock->setVar('weight', $weight); ! $myblock->setVar('visible', $visible); ! $myblock->setVar('side', $side); $myblock->store(); } ! /* function preview_block($bid, $bside, $bweight, $bposition, $bvisible, $btitle, $btemplate, $bcontent, $bctype, $balias, $bcachetime, $bmodule, $options){ ! global $xoopsConfig; ! include_once(XOOPS_ROOT_PATH.'/class/xoopstpl.php'); ! $xoopsTpl = new XoopsTpl('user'); ! $xoopsTpl->setCaching(2); ! $xoopsTpl->setCacheDir(XOOPS_ROOT_PATH.'/cache'); ! $xoopsTpl->setCompileDir(XOOPS_ROOT_PATH.'/templates_c'); ! $xoopsTpl->setTemplateDir(XOOPS_ROOT_PATH.'/themes/'.$xoopsConfig['default_theme']); ! $myblock = new XoopsBlock($bid); ! $myblock->setVar('side', $bside); ! $myblock->setVar('weight', $bweight); ! $myblock->setVar('position', $bposition); ! $myblock->setVar('visible', $bvisible); ! $myblock->setVar('weight', $bweight); ! $myblock->setVar('title', $btitle); ! $myblock->setVar('content', $bcontent); ! $myblock->setVar('btemplate', $btemplate); ! $myblock->setVar('balias', $balias); ! $myblock->setVar('bcache', $bcache); ! $myblock->setVar('bcachetime', $bcachetime); ! if ( isset($options) && (count($options) > 0) ) { ! $options = implode('|', $options); ! $myblock->setVar('options', $options); ! } ! $myblock->setVar('c_type', $bctype); ! $block =& $myblock->buildBlock(); ! if ($block) { ! $xoopsTpl->assign_by_ref('xoops_block', $block); ! } ! $fetched = $xoopsTpl->fetch('file:'.XOOPS_ROOT_PATH.'/themes/'.$xoopsConfig['default_theme'].'/blocks/'.$btemplate);echo $fetched; ! switch ($myblock->getVar('side')) { ! case XOOPS_SIDEBLOCK_LEFT: ! $xoopsTpl->append_by_ref('xoops_lblocks', $fetched); ! break; ! case XOOPS_CENTERBLOCK_LEFT: ! if (!isset($show_cblock)) { ! $xoopsTpl->assign('xoops_showcblock', 1); ! $show_cblock = 1; ! } ! $xoopsTpl->append_by_ref('xoops_clblocks', $fetched); ! break; ! case XOOPS_CENTERBLOCK_RIGHT: ! if (!isset($show_cblock)) { ! $xoopsTpl->assign('xoops_showcblock', 1); ! $show_cblock = 1; ! } ! $xoopsTpl->append_by_ref('xoops_crblocks', $fetched); ! break; ! case XOOPS_CENTERBLOCK_CENTER: ! if (!isset($show_cblock)) { ! $xoopsTpl->assign('xoops_showcblock', 1); ! $show_cblock = 1; ! } ! $xoopsTpl->append_by_ref('xoops_ccblocks', $fetched); ! break; ! case XOOPS_SIDEBLOCK_RIGHT: ! if (!isset($show_rblock)) { ! $xoopsTpl->assign('xoops_showrblock', 1); ! $show_rblock = 1; ! } ! $xoopsTpl->append_by_ref('xoops_rblocks', $fetched); ! break; ! } ! $xoopsTpl->display('layout.html'); ! } ! */ } else { echo "Access Denied"; |