171
trspice
Re: How can I change the path to the redirect page?
  • 2007/3/29 18:20

  • trspice

  • Not too shy to talk

  • Posts: 193

  • Since: 2007/3/24


Now I need to change the page redirect time. I did a file search for <$time> which I see in the redirect page meata tag but nothing showed up. Will there be a problem if I just replace that tag with a number?
There's nothing but science....
The Reggae Album



172
trspice
Re: Please adivise
  • 2007/3/29 15:51

  • trspice

  • Not too shy to talk

  • Posts: 193

  • Since: 2007/3/24


I have removed the block list shown on the bocksadmin.php page and just have the editor showing. I used comment tags <!-- --> to block out the HTML codes of blocksadmin.php and though it works fine I just wanted an expert to review what I did and let me know if there will be a problem when viewed on other platforms (mac, linux) and browsers.
There's nothing but science....
The Reggae Album



173
trspice
Please adivise
  • 2007/3/29 6:01

  • trspice

  • Not too shy to talk

  • Posts: 193

  • Since: 2007/3/24


I disabled the block list of blocksadmin.php and now just display the editor. It was a novice hack job but it seems to be working fine. Can an expert review the comment blockouts that I did and let me know if I will have problems when viewed on other platforms? Also is there an easier way to do this.

<?php
// $Id: blocksadmin.php 506 2006-05-26 23:10:37Z skalpa $
//  ------------------------------------------------------------------------ //
//                XOOPS - PHP Content Management System                      //
//                    Copyright (c) 2000 XOOPS.org                           //
//                       <https://xoops.org/>                             //
//  ------------------------------------------------------------------------ //
//  This program is free software; you can redistribute it and/or modify     //
//  it under the terms of the GNU General Public License as published by     //
//  the Free Software Foundation; either version 2 of the License, or        //
//  (at your option) any later version.                                      //
//                                                                           //
//  You may not change or alter any portion of this comment or credits       //
//  of supporting developers from this source code or any supporting         //
//  source code which is considered copyrighted (c) material of the          //
//  original comment or credit authors.                                      //
//                                                                           //
//  This program is distributed in the hope that it will be useful,          //
//  but WITHOUT ANY WARRANTY; without even the implied warranty of           //
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  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 //
//  ------------------------------------------------------------------------ //
// Author: Kazumi Ono (AKA onokazu)                                          //
// URL: http://www.myweb.ne.jp/, https://xoops.org/, http://www.xoopscube.jp/ //
// Project: The XOOPS Project                                                //
// ------------------------------------------------------------------------- //

if ( !is_object($xoopsUser) || !is_object($xoopsModule) || !$xoopsUser->isAdmin($xoopsModule->mid()) ) {
    exit(
"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();
        
$selmod = isset($_GET['selmod']) ? intval($_GET['selmod']) : 0;
        
$selvis = isset($_GET['selvis']) ? intval($_GET['selvis']) : 2;
        
$selgrp = isset($_GET['selgrp']) ? intval($_GET['selgrp']) : XOOPS_GROUP_USERS;
        echo 
"
        <!-- <h4 style='text-align:left;'>"
._AM_BADMIN."</h4> -->";
        echo 
'<!-- <form action="admin.php" method="get"> -->';
        
$form "<!-- <select size="1" name="selmod" onchange="location='".XOOPS_URL."/modules/system/admin.php?fct=blocksadmin&selvis=$selvis&selgrp=$selgrp&selmod='+this.options[this.selectedIndex].value"> -->";
        
$module_handler =& xoops_gethandler('module');
        
$criteria = new CriteriaCompo(new Criteria('hasmain'1));
        
$criteria->add(new Criteria('isactive'1));
        
$module_list =& $module_handler->getList($criteria);
        
$toponlyblock false;
        
$module_list[-1] = _AM_TOPPAGE;
        
$selmod = isset($_GET['selmod']) ? intval($_GET['selmod']) : -1;
        
ksort($module_list);
        foreach (
$module_list as $k => $v) {
            
$sel '';
            if (
$k == $selmod) {
                
$sel ' selected="selected"';
            }
            
$form .= '<!-- <option value="'.$k.'"'.$sel.'>'.$v.'</option> -->';
        }
        
$form .= '<!-- </select>&nbsp;<input type="hidden" name="fct" value="blocksadmin" /> -->';
        
/*printf(_AM_SVISIBLEIN, $form);*/
        
$member_handler =& xoops_gethandler('member');
        
$group_list =& $member_handler->getGroupList();
        
/*$group_sel = _AM_GROUP.*/" <!-- <select size="1" name="selgrp" onchange="location='".XOOPS_URL."/modules/system/admin.php?fct=blocksadmin&selvis=$selvis&selmod=$selmod&selgrp='+this.options[this.selectedIndex].value"> -->";
        
$group_list[0] = '#'._AM_UNASSIGNED// fix for displaying blocks unassigned to any group
        
foreach ($group_list as $k => $v) {
            
$sel '';
            if (
$k == $selgrp) {
                
$sel ' selected="selected"';
            }
            
$group_sel .= '<!-- <option value="'.$k.'"'.$sel.'>'.$v.'</option> -->';
        }
        
$group_sel .= '<!-- </select> --> ';
        echo 
$group_sel;
        
/*echo _AM_VISIBLE.*/" <!-- <select size="1" name="selvis" onchange="location='".XOOPS_URL."/modules/system/admin.php?fct=blocksadmin&selmod=$selmod&selgrp=$selgrp&selvis='+this.options[this.selectedIndex].value"> -->";
        
$selvis0 $selvis1 $selvis2 "";
        switch(
$selvis){
        case 
0:
            
$selvis0 'selected="selected"';
            break;
        case 
1:
            
$selvis1 'selected="selected"';
            break;
        case 
2:
        default:
            
$selvis2 'selected="selected"';
            break;
        }
        echo 
'<!-- <option value="0" '.$selvis0.'>'._NO.'</option> -->';
        echo 
'<!-- <option value="1" '.$selvis1.'>'._YES.'</option> -->';
        echo 
'<!-- <option value="2" '.$selvis2.'>'._ALL.'</option> -->';
        echo 
'<!-- </select> <input type="submit" value="'._GO.'" name="selsubmit" /> -->';
        echo 
'<!-- </form> -->';
        echo 
" <!-- <form action='admin.php' name='blockadmin' method='post'>
        <table width='100%' class='outer' cellpadding='4' cellspacing='1'>
        <tr valign='middle'><th width='20%'>"
._AM_BLKDESC."</th><th>"._AM_TITLE."</th><th>"._AM_MODULE."</th><th align='center' nowrap='nowrap'>"._AM_SIDE."<br />"._LEFT."-"._CENTER."-"._RIGHT."</th><th align='center'>"._AM_WEIGHT."</th><th align='center'>"._AM_VISIBLE."</th><th align='right'>"._AM_ACTION."</th></tr>
        "
;
        if (
$selvis == 2$selvis null;
        if (
$selgrp == 0) {
            
// get blocks that are not assigned to any groups
            
$block_arr =& XoopsBlock::getNonGroupedBlocks($selmod$toponlyblock$selvis'b.side,b.weight,b.bid');
        } else {
            
$block_arr =& XoopsBlock::getAllByGroupModule($selgrp$selmod$toponlyblock$selvis'b.side,b.weight,b.bid');
        }
        
$block_count count($block_arr);
        
$class 'even';
        
$module_list2 =& $module_handler->getList();
        
// for custom blocks
        
$module_list2[0] = '&nbsp;';
        foreach (
array_keys($block_arr) as $i) {
            
$sel0 $sel1 $ssel0 $ssel1 $ssel2 $ssel3 $ssel4 $ssel5 $ssel6 $ssel7 "";
            if ( 
$block_arr[$i]->getVar("visible") == ) {
                
$sel1 " checked='checked'";
            } else {
                
$sel0 " checked='checked'";
            }
            if ( 
$block_arr[$i]->getVar("side") == XOOPS_SIDEBLOCK_LEFT){
                
$ssel0 " checked='checked'";
            } elseif ( 
$block_arr[$i]->getVar("side") == XOOPS_SIDEBLOCK_RIGHT ){
                
$ssel1 " checked='checked'";
            } elseif ( 
$block_arr[$i]->getVar("side") == XOOPS_CENTERBLOCK_LEFT ){
                
$ssel2 " checked='checked'";
            } elseif ( 
$block_arr[$i]->getVar("side") == XOOPS_CENTERBLOCK_RIGHT ){
                
$ssel4 " checked='checked'";
            } elseif ( 
$block_arr[$i]->getVar("side") == XOOPS_CENTERBLOCK_CENTER ){
                
$ssel3 " checked='checked'";
            } elseif ( 
$block_arr[$i]->getVar("side") == XOOPS_CENTERBLOCK_BOTTOMLEFT ){
                
$ssel5 " checked='checked'";
            } elseif ( 
$block_arr[$i]->getVar("side") == XOOPS_CENTERBLOCK_BOTTOMRIGHT ){
                
$ssel6 " checked='checked'";
            } elseif ( 
$block_arr[$i]->getVar("side") == XOOPS_CENTERBLOCK_BOTTOM ){
                
$ssel7 " checked='checked'";
            }
            if ( 
$block_arr[$i]->getVar("title") == "" ) {
                
$title "&nbsp;";
            } else {
                
$title $block_arr[$i]->getVar("title");
            }
            
$name $block_arr[$i]->getVar("name");
            
//echo "<tr valign='top'><td class='$class'>".$name."</td><td class='$class'>".$title."</td><td class='$class'>".$module_list2[$block_arr[$i]->getVar('mid')]."</td><td class='$class' align='center' nowrap='nowrap'><input type='radio' name='side[$i]' value='".XOOPS_SIDEBLOCK_LEFT."'$ssel0 />-<input type='radio' name='side[$i]' value='".XOOPS_CENTERBLOCK_LEFT."'$ssel2 /><input type='radio' name='side[$i]' value='".XOOPS_CENTERBLOCK_CENTER."'$ssel3 /><input type='radio' name='side[$i]' value='".XOOPS_CENTERBLOCK_RIGHT."'$ssel4 />-<input type='radio' name='side[$i]' value='".XOOPS_SIDEBLOCK_RIGHT."'$ssel1 /></td><td class='$class' align='center'><input type='text' name='weight[$i]' value='".$block_arr[$i]->getVar("weight")."' size='5' maxlength='5' /></td><td class='$class' align='center' nowrap><input type='radio' name='visible[$i]' value='1'$sel1>"._YES."&nbsp;<input type='radio' name='visible[$i]' value='0'$sel0>"._NO."</td><td class='$class' align='right'><a href='admin.php?fct=blocksadmin&op=edit&bid=".$block_arr[$i]->getVar("bid")."'>"._EDIT."</a>";
            
echo "<tr valign='top'><td class='$class'>".$name."</td><td class='$class'>".$title."</td><td class='$class'>".$module_list2[$block_arr[$i]->getVar('mid')]."</td><td class='$class' align='center' nowrap='nowrap'>
                    <div align='center' >
                    <input type='radio' name='side[
$i]' value='".XOOPS_CENTERBLOCK_LEFT."'$ssel2 />
                        <input type='radio' name='side[
$i]' value='".XOOPS_CENTERBLOCK_CENTER."'$ssel3 />
                    <input type='radio' name='side[
$i]' value='".XOOPS_CENTERBLOCK_RIGHT."'$ssel4 />
                    </div>
                    <div>
                        <span style='float:right'><input type='radio' name='side[
$i]' value='".XOOPS_SIDEBLOCK_RIGHT."'$ssel1 /></span>
                    <div align='left'><input type='radio' name='side[
$i]' value='".XOOPS_SIDEBLOCK_LEFT."'$ssel0 /></div>
                    </div>
                     <div align='center'>
                    <input type='radio' name='side[
$i]' value='".XOOPS_CENTERBLOCK_BOTTOMLEFT."'$ssel5 />
                        <input type='radio' name='side[
$i]' value='".XOOPS_CENTERBLOCK_BOTTOM."'$ssel7 />
                    <input type='radio' name='side[
$i]' value='".XOOPS_CENTERBLOCK_BOTTOMRIGHT."'$ssel6 />
                    </div>
                </td><td class='
$class' align='center'><input type='text' name='weight[$i]' value='".$block_arr[$i]->getVar("weight")."' size='5' maxlength='5' /></td><td class='$class' align='center' nowrap><input type='radio' name='visible[$i]' value='1'$sel1>"._YES."&nbsp;<input type='radio' name='visible[$i]' value='0'$sel0>"._NO."</td><td class='$class' align='right'><a href='admin.php?fct=blocksadmin&op=edit&bid=".$block_arr[$i]->getVar("bid")."'>"._EDIT."</a>";


            if (
$block_arr[$i]->getVar('block_type') != 'S') {
                echo 
"&nbsp;<a href='admin.php?fct=blocksadmin&op=delete&bid=".$block_arr[$i]->getVar("bid")."'>"._DELETE."</a>";
            }
            echo 
"
            <input type='hidden' name='oldside[
$i]' value='".$block_arr[$i]->getVar('side')."' />
            <input type='hidden' name='oldweight[
$i]' value='".$block_arr[$i]->getVar('weight')."' />
            <input type='hidden' name='oldvisible[
$i]' value='".$block_arr[$i]->getVar('visible')."' />
            <input type='hidden' name='bid[
$i]' value='".$i."' />
            </td></tr>
            "
;
            
$class = ($class == 'even') ? 'odd' 'even';
        }
        echo 
"<tr><td class='foot' align='center' colspan='7'>
        <input type='hidden' name='fct' value='blocksadmin' />
        <input type='hidden' name='op' value='order' />
        "
.$GLOBALS['xoopsSecurity']->getTokenHTML()."
        <input type='submit' name='submit' value='"
._SUBMIT."' />
        </td></tr></table>
        </form>
        <br /><br /> -->"
;

        
$block = array('form_title' => _AM_ADDBLOCK'side' => 0'weight' => 0'visible' => 1'title' => '''content' => '''modules' => array(-1), 'is_custom' => true'ctype' => 'H''cachetime' => 0'op' => 'save''edit_form' => false);
        include 
XOOPS_ROOT_PATH.'/modules/system/admin/blocksadmin/blockform.php';
        
$form->display();
    }

    function 
save_block($bside$bweight$bvisible$btitle$bcontent$bctype$bmodule$bcachetime)
    {
        global 
$xoopsUser;
        if (empty(
$bmodule)) {
            
xoops_cp_header();
            
xoops_error(sprintf(_AM_NOTSELNG_AM_VISIBLEIN));
            
xoops_cp_footer();
            exit();
        }
        
$myblock = new XoopsBlock();
        
$myblock->setVar('side'$bside);
        
$myblock->setVar('weight'$bweight);
        
$myblock->setVar('visible'$bvisible);
        
$myblock->setVar('weight'$bweight);
        
$myblock->setVar('title'$btitle);
        
$myblock->setVar('content'$bcontent);
        
$myblock->setVar('c_type'$bctype);
        
$myblock->setVar('block_type''C');
        
$myblock->setVar('bcachetime'$bcachetime);
        switch (
$bctype) {
        case 
'H':
            
$name _AM_CUSTOMHTML;
            break;
        case 
'P':
            
$name _AM_CUSTOMPHP;
            break;
        case 
'S':
            
$name _AM_CUSTOMSMILE;
            break;
        default:
            
$name _AM_CUSTOMNOSMILE;
            break;
        }
        
$myblock->setVar('name'$name);
        
$newid $myblock->store();
        if (!
$newid) {
            
xoops_cp_header();
            
$myblock->getHtmlErrors();
            
xoops_cp_footer();
            exit();
        }
        
$db =& Database::getInstance();
        foreach (
$bmodule as $bmid) {
            
$sql 'INSERT INTO '.$db->prefix('block_module_link').' (block_id, module_id) VALUES ('.$newid.', '.intval($bmid).')';
            
$db->query($sql);
        }
        
$groups =& $xoopsUser->getGroups();
        
$count count($groups);
        for (
$i 0$i $count$i++) {
            
$sql "INSERT INTO ".$db->prefix('group_permission')." (gperm_groupid, gperm_itemid, gperm_name, gperm_modid) VALUES (".$groups[$i].", ".$newid.", 'block_read', 1)";
            
$db->query($sql);
        }
        
redirect_header('admin.php?fct=blocksadmin&t='.time(),1,_AM_DBUPDATED);
        exit();
    }

    function 
edit_block($bid)
    {
        
$myblock = new XoopsBlock($bid);
        
$db =& Database::getInstance();
        
$sql 'SELECT module_id FROM '.$db->prefix('block_module_link').' WHERE block_id='.intval($bid);
        
$result $db->query($sql);
        
$modules = array();
        while (
$row $db->fetchArray($result)) {
            
$modules[] = intval($row['module_id']);
        }
        
$is_custom = ($myblock->getVar('block_type') == 'C' || $myblock->getVar('block_type') == 'E') ? true false;
        
$block = array('form_title' => _AM_EDITBLOCK'name' => $myblock->getVar('name'), 'side' => $myblock->getVar('side'), 'weight' => $myblock->getVar('weight'), 'visible' => $myblock->getVar('visible'), 'title' => $myblock->getVar('title''E'), 'content' => $myblock->getVar('content''E'), 'modules' => $modules'is_custom' => $is_custom'ctype' => $myblock->getVar('c_type'), 'cachetime' => $myblock->getVar('bcachetime'), 'op' => 'update''bid' => $myblock->getVar('bid'), 'edit_form' => $myblock->getOptions(), 'template' => $myblock->getVar('template'), 'options' => $myblock->getVar('options'));
        echo 
'<a href="admin.php?fct=blocksadmin">'_AM_BADMIN .'</a>&nbsp;<span style="font-weight:bold;">»»</span>&nbsp;'._AM_EDITBLOCK.'<br /><br />';
        include 
XOOPS_ROOT_PATH.'/modules/system/admin/blocksadmin/blockform.php';
        
$form->display();
    }

    function 
update_block($bid$bside$bweight$bvisible$btitle$bcontent$bctype$bcachetime$bmodule$options=array())
    {
        global 
$xoopsConfig;
        if (empty(
$bmodule)) {
            
xoops_cp_header();
            
xoops_error(sprintf(_AM_NOTSELNG_AM_VISIBLEIN));
            
xoops_cp_footer();
            exit();
        }
        
$myblock = new XoopsBlock($bid);
        
$myblock->setVar('side'$bside);
        
$myblock->setVar('weight'$bweight);
        
$myblock->setVar('visible'$bvisible);
        
$myblock->setVar('title'$btitle);
        
$myblock->setVar('content'$bcontent);
        
$myblock->setVar('bcachetime'$bcachetime);
        if (isset(
$options)) {
            
$options_count count($options);
            if (
$options_count 0) {
                
//Convert array values to comma-separated
                
for ( $i 0$i $options_count$i++ ) {
                    if (
is_array($options[$i])) {
                        
$options[$i] = implode(','$options[$i]);
                    }
                }
                
$options implode('|'$options);
                
$myblock->setVar('options'$options);
            }
        }
        if (
$myblock->getVar('block_type') == 'C') {
            switch (
$bctype) {
            case 
'H':
                
$name _AM_CUSTOMHTML;
                break;
            case 
'P':
                
$name _AM_CUSTOMPHP;
                break;
            case 
'S':
                
$name _AM_CUSTOMSMILE;
                break;
            default:
                
$name _AM_CUSTOMNOSMILE;
                break;
            }
            
$myblock->setVar('name'$name);
            
$myblock->setVar('c_type'$bctype);
        } else {
            
$myblock->setVar('c_type''H');
        }
        
$msg _AM_DBUPDATED;
        if (
$myblock->store() != false) {
            
$db =& Database::getInstance();
            
$sql sprintf("DELETE FROM %s WHERE block_id = %u"$db->prefix('block_module_link'), $bid);
            
$db->query($sql);
            foreach (
$bmodule as $bmid) {
                
$sql sprintf("INSERT INTO %s (block_id, module_id) VALUES (%u, %d)"$db->prefix('block_module_link'), $bidintval($bmid));
                
$db->query($sql);
            }
            include_once 
XOOPS_ROOT_PATH.'/class/template.php';
            
$xoopsTpl = new XoopsTpl();
            
$xoopsTpl->xoops_setCaching(2);
            if (
$myblock->getVar('template') != '') {
                if (
$xoopsTpl->is_cached('db:'.$myblock->getVar('template'), 'blk_'.$myblock->getVar('bid'))) {
                    if (!
$xoopsTpl->clear_cache('db:'.$myblock->getVar('template'), 'blk_'.$myblock->getVar('bid'))) {
                        
$msg 'Unable to clear cache for block ID '.$bid;
                    }
                }
            } else {
                if (
$xoopsTpl->is_cached('db:system_dummy.html''blk_'.$bid)) {
                    if (!
$xoopsTpl->clear_cache('db:system_dummy.html''blk_'.$bid)) {
                        
$msg 'Unable to clear cache for block ID '.$bid;
                    }
                }
            }
        } else {
            
$msg 'Failed update of block. ID:'.$bid;
        }
        
redirect_header('admin.php?fct=blocksadmin&t='.time(),1,$msg);
        exit();
    }

    function 
delete_block($bid)
    {
        
$myblock = new XoopsBlock($bid);
        if ( 
$myblock->getVar('block_type') == 'S' ) {
            
$message _AM_SYSTEMCANT;
            
redirect_header('admin.php?fct=blocksadmin',4,$message);
            exit();
        } elseif (
$myblock->getVar('block_type') == 'M') {
            
// Fix for duplicated blocks created in 2.0.9 module update
            // A module block can be deleted if there is more than 1 that
            // has the same func_num/show_func which is mostly likely
            // be the one that was duplicated in 2.0.9
            
if (>= $count XoopsBlock::countSimilarBlocks($myblock->getVar('mid'), $myblock->getVar('func_num'), $myblock->getVar('show_func'))) {
                
$message _AM_MODULECANT;
                
redirect_header('admin.php?fct=blocksadmin',4,$message);
                exit();
            }
        }
        
xoops_confirm(array('fct' => 'blocksadmin''op' => 'delete_ok''bid' => $myblock->getVar('bid')), 'admin.php'sprintf(_AM_RUSUREDEL,$myblock->getVar('title')));
    }

    function 
delete_block_ok($bid)
    {
        
$myblock = new XoopsBlock($bid);
        
$myblock->delete();
        if (
$myblock->getVar('template') != '') {
            
$tplfile_handler =& xoops_gethandler('tplfile');
            
$btemplate =& $tplfile_handler->find($GLOBALS['xoopsConfig']['template_set'], 'block'$bid);
            if (
count($btemplate) > 0) {
                
$tplfile_handler->delete($btemplate[0]);
            }
        }
        
redirect_header('admin.php?fct=blocksadmin&t='.time(),1,_AM_DBUPDATED);
        exit();
    }

    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 
clone_block($bid)
    {
        global 
$xoopsConfig;
        
xoops_cp_header();
        
$myblock = new XoopsBlock($bid);
        
$db =& Database::getInstance();
        
$sql 'SELECT module_id FROM '.$db->prefix('block_module_link').' WHERE block_id='.intval($bid);
        
$result $db->query($sql);
        
$modules = array();
        while (
$row $db->fetchArray($result)) {
            
$modules[] = intval($row['module_id']);
        }
        
$is_custom = ($myblock->getVar('block_type') == 'C' || $myblock->getVar('block_type') == 'E') ? true false;
        
$block = array('form_title' => _AM_CLONEBLOCK'name' => $myblock->getVar('name'), 'side' => $myblock->getVar('side'), 'weight' => $myblock->getVar('weight'), 'visible' => $myblock->getVar('visible'), 'content' => $myblock->getVar('content''N'), 'modules' => $modules'is_custom' => $is_custom'ctype' => $myblock->getVar('c_type'), 'cachetime' => $myblock->getVar('bcachetime'), 'op' => 'clone_ok''bid' => $myblock->getVar('bid'), 'edit_form' => $myblock->getOptions(), 'template' => $myblock->getVar('template'), 'options' => $myblock->getVar('options'));
        echo 
'<a href="admin.php?fct=blocksadmin">'_AM_BADMIN .'</a>&nbsp;<span style="font-weight:bold;">»»</span>&nbsp;'._AM_CLONEBLOCK.'<br /><br />';
        include 
XOOPS_ROOT_PATH.'/modules/system/admin/blocksadmin/blockform.php';
        
$form->display();
        
xoops_cp_footer();
        exit();
    }

    function 
clone_block_ok($bid$bside$bweight$bvisible$bcachetime$bmodule$options)
    {
        global 
$xoopsUser;
        
$block = new XoopsBlock($bid);
        
$clone =& $block->xoopsClone();
        if (empty(
$bmodule)) {
            
xoops_cp_header();
            
xoops_error(sprintf(_AM_NOTSELNG_AM_VISIBLEIN));
            
xoops_cp_footer();
            exit();
        }
        
$clone->setVar('side'$bside);
        
$clone->setVar('weight'$bweight);
        
$clone->setVar('visible'$bvisible);
        
$clone->setVar('content'$bcontent);
        
//$clone->setVar('title', $btitle);
        
$clone->setVar('bcachetime'$bcachetime);
        if ( isset(
$options) && (count($options) > 0) ) {
            
$options implode('|'$options);
            
$clone->setVar('options'$options);
        }
        
$clone->setVar('bid'0);
        if (
$block->getVar('block_type') == 'C' || $block->getVar('block_type') == 'E') {
            
$clone->setVar('block_type''E');
        } else {
            
$clone->setVar('block_type''D');
        }
        
$newid $clone->store();
        if (!
$newid) {
            
xoops_cp_header();
            
$clone->getHtmlErrors();
            
xoops_cp_footer();
            exit();
        }
        if (
$clone->getVar('template') != '') {
            
$tplfile_handler =& xoops_gethandler('tplfile');
            
$btemplate =& $tplfile_handler->find($GLOBALS['xoopsConfig']['template_set'], 'block'$bid);
            if (
count($btemplate) > 0) {
                
$tplclone =& $btemplate[0]->xoopsClone();
                
$tplclone->setVar('tpl_id'0);
                
$tplclone->setVar('tpl_refid'$newid);
                
$tplman->insert($tplclone);
            }
        }
        
$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('group_permission')." (gperm_groupid, gperm_itemid, gperm_modid, gperm_name) VALUES (".$groups[$i].", ".$newid.", 1, 'block_read')";
            
$db->query($sql);
        }
        
redirect_header('admin.php?fct=blocksadmin&t='.time(),1,_AM_DBUPDATED);
    }
} else {
    echo 
"Access Denied";
}
?>
There's nothing but science....
The Reggae Album



174
trspice
How can I change the path to the redirect page?
  • 2007/3/27 18:31

  • trspice

  • Not too shy to talk

  • Posts: 193

  • Since: 2007/3/24


When a guest tries to access a registered only area I want to send them directly to the registration page instead of the current redirect page. What files(s) must be edited to do this?

Also, where is the refresh time changed. I see <$time> in the refresh meta tag of modules/system/templates/system_redirect.html but didn't see an edit for it in the configuration.

Thanks
There's nothing but science....
The Reggae Album



175
trspice
Re: Cloning Debaser 0.92
  • 2007/3/27 16:14

  • trspice

  • Not too shy to talk

  • Posts: 193

  • Since: 2007/3/24


That search returned nothing logical.
There's nothing but science....
The Reggae Album



176
trspice
Cloning Debaser 0.92
  • 2007/3/27 5:42

  • trspice

  • Not too shy to talk

  • Posts: 193

  • Since: 2007/3/24


I needed a clone of debaser to handle a different area of my site so I tried to clone it. I changed all occurences of debaser to debaser2 and when uploaded to the modules directory it causes an error in the admin. It is not listed in the uninstalled modules and all modules below it are not displayed either.

Can anyone give a suggestion on cloning this module or point me to a source which has a cloned debaser?
There's nothing but science....
The Reggae Album



177
trspice
Re: How do you add smarty tags to a block with the editor?
  • 2007/3/27 5:26

  • trspice

  • Not too shy to talk

  • Posts: 193

  • Since: 2007/3/24


Stefan that edit did work so now the banner displays, thanks. I guess there is no method of publishing a smart tag with the editor. I'll keep testing.
There's nothing but science....
The Reggae Album



178
trspice
Re: How do you add smarty tags to a block with the editor?
  • 2007/3/26 19:14

  • trspice

  • Not too shy to talk

  • Posts: 193

  • Since: 2007/3/24


stefan88 I appreciate your effort and I do want to display the rw_banner ad but ultimately I want to figure how to use the editor to publish a smart tag.

I tried the methods you suggested but neither have worked. Thanks.

Using XOOPS 2.0.16
There's nothing but science....
The Reggae Album



179
trspice
Re: How do you add smarty tags to a block with the editor?
  • 2007/3/26 18:49

  • trspice

  • Not too shy to talk

  • Posts: 193

  • Since: 2007/3/24


nachenko you get it! That's exactly what I am trying to achieve.

stefan88 I have no clue what this means. It doesn't seem to relate
Quote:
If it doesn't work try using only the inclide ... part without $mod=... and if{}


The BBcode method didn't work even with the textsanitizer hack.

Is there a php command that I can wrap it in.
There's nothing but science....
The Reggae Album



180
trspice
Re: How do you add smarty tags to a block with the editor?
  • 2007/3/26 0:58

  • trspice

  • Not too shy to talk

  • Posts: 193

  • Since: 2007/3/24


Is it that no one has a clue about this? With 88 views I figure one might be a developer or have some inside knowledge. This is strange for a support forum. I'll check again later.
There's nothing but science....
The Reggae Album




TopTop
« 1 ... 15 16 17 (18) 19 »



Login

Who's Online

204 user(s) are online (137 user(s) are browsing Support Forums)


Members: 0


Guests: 204


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: May 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits