1
Peekay
Content 0.6 : Page title bug-fix
  • 2007/1/28 22:31

  • Peekay

  • XOOPS is my life!

  • Posts: 2335

  • Since: 2004/11/20


The nice thing about Content 0.6 is that you can add custom page titles. Unfortunately, the title was lost on editing the item (at least it was on my setup - see sig).

Anyway, I tinkered with 'admin/index.php' and it now works for me. If you have the same problem, my altered code is below if you want to try it. Make a backup first.

I have posted a report on module dev forge, although this may have already been fixed in the later version.

//  ------------------------------------------------------------------------ //
//                XOOPS - PHP Content Management System                      //
//                    Copyright (c) 2000 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: Tobias Liegl (AKA CHAPI)                                          //
// Site: http://www.chapi.de                                                 //
// Project: The XOOPS Project                                                //
// ------------------------------------------------------------------------- //
include_once "admin_header.php";

if (isset(
$HTTP_GET_VARS)) {
    foreach (
$HTTP_GET_VARS as $k => $v) {
      $
$k $v;
    }
  }

  if (isset(
$HTTP_POST_VARS)) {
    foreach (
$HTTP_POST_VARS as $k => $v) {
      $
$k $v;
    }
  }

// Função que verifica se um conteúdo tem subcategorias
  
function tem_subcategorias($category_id) {
        global 
$xoopsDB;
    
$child_category_query $xoopsDB->query("select count(*) as count from " $xoopsDB->prefix('content') . " where parent_id = '" . (int)$category_id "'");
    
$child_category $xoopsDB->fetchArray($child_category_query);

    if (
$child_category['count'] > 0) {
      return 
true;
    } else {
      return 
false;
    }
  }

// Função que verifica se é Categoria Principal
  
function cat_principal($category_id) {
        global 
$xoopsDB;
    
$child_category_query $xoopsDB->query("select count(*) as count from " $xoopsDB->prefix('content') . " where storyid = '" . (int)$category_id "' and parent_id='0'");
    
$child_category $xoopsDB->fetchArray($child_category_query);

    if (
$child_category['count'] > 0) {
      return 
true;
    } else {
      return 
false;
    }
  }
  
//Função que montará o select
  
function gera_menus($currentParID,$menustr,$catstr,$level) {
    global 
$xoopsDB;
   
$retorna[0] = _C_MAINMENU;
   
$haschildren 0//padrão
   
$cat_principal 0;
   
$categorias_query_catmenu $xoopsDB->query("select storyid, parent_id, title from ".$xoopsDB->prefix('content')." where parent_id = " $currentParID " order by blockid, storyid");
   while (
$categorias $xoopsDB->fetchArray($categorias_query_catmenu))  {
     
//if ($categorias['parent_id'] == 0 ){
                 
$haschildren=tem_subcategorias($categorias['storyid']);
                    
//$cat_principal = cat_principal($categorias['storyid']);
             //if ($categorias['parent_id'] != 0) {
                    
$categorias['title'] = str_repeat("->"$level).$categorias['title'];
             
//}
             
if ($haschildren) {
                       
$menu_tmp $categorias['title'];
                       
$cat_tmp $categorias['storyid'];
                           
$retorna[$categorias['storyid']] = $menu_tmp;
                       
$retorna2 gera_menus($categorias['storyid'],'',''$level 1);
                       foreach (
$retorna2 as $k => $v) {
                               
$retorna[$k] = "     ".$v;
                       }
               } else {
                      
$retorna[$categorias['storyid']] = $categorias['title'];
              }
          
//}
  // Menu "árvore"
//        Menu1_1_1=new Array(Texto a exibir, Link, imagem de fundo (opcional), numero de sub menus, altura, largura);
    
}// end while
    
return $retorna;
  }  
//Fim de Monta Menu

  // checks browser compatibility with the control
  
function checkBrowser() {
    global 
$HTTP_SERVER_VARS;
    
$browser $HTTP_SERVER_VARS['HTTP_USER_AGENT'];
    
// check if msie
    
if (eregi("MSIE[^;]*",$browser,$msie)) {
      
// get version
      
if (eregi("[0-9]+.[0-9]+",$msie[0],$version)) {
        
// check version
        
if ((float)$version[0]>=5.5) {
          
// finally check if it's not opera impersonating ie
          
if (!eregi("opera",$browser)) {
            return 
true;
          }
        }
      }
    }
    return 
false;
  }

// ------------------------------------------------------------------------- //
// Switch Statement for the different operations                             //
// ------------------------------------------------------------------------- //
$xoopsDB =& Database::getInstance();
global 
$op;
switch (
$op) {

// ------------------------------------------------------------------------- //
// Show Content Page -> Overview                                             //
// ------------------------------------------------------------------------- //
case "show":
        global 
$xoopsDB;
        
$myts =& MyTextSanitizer::getInstance();
    
xoops_cp_header();

        echo 
"";
        echo 
"

"._C_ADMINTITLE."

"
;
        echo 
""._C_HOMEPAGE.""
._C_POSITION.""._C_LINKNAME."";
        echo 
""._C_LINKID.""._C_SUBLINKID.""._C_VISIBLE.""._COMMENTS.""._C_SUBMENU."";
        echo 
""._C_ACTION."";
    
$mostra gera_menus(0,'','');
    
$result $xoopsDB->query("SELECT child.visible, child.submenu, child.nocomments, child.homepage, child.storyid, child.blockid, child.title, child.visible, child.parent_id, child.address,CASE parent.parent_id WHEN 0 THEN parent.blockid ELSE child.blockid END 'menu_block', CASE child.parent_id WHEN 0 THEN child.storyid ELSE child.parent_id END 'menu_id'FROM ".$xoopsDB->prefix('content')." child LEFT JOIN ".$xoopsDB->prefix('content')." parent ON child.parent_id = parent.storyid ORDER BY menu_block, menu_id, parent_id, blockid");
    while (
$tcontent $xoopsDB->fetcharray($result)) {
            
$menu "parent_id[".$tcontent['storyid']."]">";
            foreach (
$mostra as $key => $value) {
                    if (
$key == $tcontent['storyid'])
                    continue;
                    if (
$key == $tcontent['parent_id']){
                            
$menu .= "$key."" selected='selected'>$value";
                    }else{
                            
$menu .= "$key."">$value";
                    }
            }
            
$menu .= '';
      
$title=$myts->makeTboxData4Show($tcontent['title'], 000);

          if (
$tcontent['visible'] == '1') {
           
$check1 "";
           
$check2 "selected='selected'";
          } else {
           
$check1 "selected='selected'";
           
$check2 "";
          }

          if (
$tcontent['homepage'] == '1') {
           
$check3 "checked='checked'";
          } else {
           
$check3 "";
          }

          if (
$tcontent['nocomments'] == '1') {
           
$check4 "selected='selected'";
           
$check5 "";
          } else {
           
$check4 "";
           
$check5 "selected='selected'";
          }

          if (
$tcontent['submenu'] == '0') {
           
$check6 "selected='selected'";
           
$check7 "";
          } else {
           
$check6 "";
           
$check7 "selected='selected'";
          }
          echo 
"";
          echo 
".$tcontent['storyid']."' ".$check3.">";
          echo 
"$menu";
          echo 
".XOOPS_URL."/modules/".$xoopsModule->dirname()."/index.php?id=".$tcontent['storyid']."'>".$title."";
          if (
$tcontent['parent_id'] == 0){
                  echo 
".$tcontent['storyid']."' />.$tcontent['storyid']."]' size='2' maxlength='2' value='".$tcontent['blockid']."'/> ";
          }else{
                  echo 
"-->.$tcontent['storyid']."' />.$tcontent['storyid']."]' size='2' maxlength='2' value='".$tcontent['blockid']."'/>";
          }
          echo 
".$tcontent['storyid']."]'>.$check1." />"._C_NO.".$check2." />"._C_YES."";
          echo 
".$tcontent['storyid']."]'>.$check4." />"._C_NO.".$check5." />"._C_YES."";
          echo 
".$tcontent['storyid']."]'>.$check5." />"._C_NO.".$check7." />"._C_YES."";
            if (
$tcontent['link'] == '1') {
              echo 
".$tcontent['storyid']."'>"._C_EDIT."";
            } else {
              echo 
".$tcontent['storyid']."'>"._C_EDIT."";
            }
          echo 
" | .$tcontent['storyid']."'>"._C_DELETE."";

      }

          echo 
"";

          echo 
"
               
                  ._SUBMIT." />
";
      echo 
"";

          
xoops_cp_footer();
        break;

// ------------------------------------------------------------------------- //
// Show add content Page                                                     //
// ------------------------------------------------------------------------- //
case "submit":
        global 
$xoopsDB$xoopsModuleConfig;
        
xoops_cp_header();
        
$currentParent 0;
        
$result $xoopsDB->query("SELECT CASE parent_id WHEN 0 THEN storyid ELSE parent_id END 'sortorder' FROM ".$xoopsDB->prefix('content')." WHERE visible='1' AND storyid=".$HTTP_GET_VARS['id']);
        list(
$currentParent) = $xoopsDB->fetchRow($result);
        echo 
"

"._C_ADMINTITLE."

"
;

        
$form = new XoopsThemeForm(_C_ADDCONTENT"form_name""index.php");
        
$categoria_select = new XoopsFormSelect(_C_POSITION"parent_id"$currentParent);
        
$categoria_select->addOptionArray(gera_menus(0,'',''));
        
$form->addElement($categoria_select);
        
// Search os menus na tabela:

        
$text_box = new XoopsFormText(_C_LINKNAME"title"5030);
        
$form->addElement($text_box);

        
$ptitle = new XoopsFormText(_C_PAGETITLE"ptitle"50300);
        
$form->addElement($ptitle);

        
$url_box = new XoopsFormText(_C_EXTURL"externalURL"50255);
        
$form->addElement($url_box);

        
$visible_checkbox = new XoopsFormCheckBox(_C_VISIBLE'visible');
          
$visible_checkbox->addOption(1_C_YES);
        
$form->addElement($visible_checkbox);

        
$submenu_checkbox = new XoopsFormCheckBox(_C_SUBMENU'submenu');
          
$submenu_checkbox->addOption(1_C_YES);
        
$form->addElement($submenu_checkbox);

        if (
$xoopsModuleConfig['cont_wysiwyg'] == '1') {
                
$fckeditor_root XOOPS_ROOT_PATH.'/modules/content/admin/fckeditor/';
                include 
XOOPS_ROOT_PATH.'/modules/content/admin/fckeditor/fckeditor.php';
                
ob_start();
                
$oFCKeditor = new FCKeditor('message') ;
                
$oFCKeditor->BasePath        XOOPS_URL."/modules/content/admin/fckeditor/" ;
                
$oFCKeditor->Value                $message ;
                
$oFCKeditor->Height                500 ;
                
$oFCKeditor->Create() ;
                
$form->addElement(new XoopsFormLabel(_C_CONTENTob_get_contents()));
                
ob_end_clean();
        } else {
                
$t_area = new XoopsFormDhtmlTextArea(_C_CONTENT'message'''3735);
                
$form->addElement($t_area);
        }
        
$option_tray = new XoopsFormElementTray(_OPTIONS,'');

          if (
$xoopsModuleConfig['cont_wysiwyg'] != '1') {
                  
$form->addElement(new XoopsFormHidden(_DISABLEHTML0));
                
$form->addElement(new XoopsFormHidden(_DISABLESMILEY0));
          } else {
                 
$nohtml_checkbox = new XoopsFormCheckBox('''nohtml'0);
                  
$nohtml_checkbox->addOption(1_DISABLEHTML);
                
$option_tray->addElement($nohtml_checkbox);
                  
$smiley_checkbox = new XoopsFormCheckBox('''nosmiley'0);
                  
$smiley_checkbox->addOption(1_DISABLESMILEY);
                
$option_tray->addElement($smiley_checkbox);
          }

        if (
$xoopsModuleConfig['cont_wysiwyg'] != '1') {
          
$form->addElement(new XoopsFormHidden('nobreaks'1));
        } else {
          
$breaks_checkbox = new XoopsFormCheckBox('''nobreaks'0);
          
$breaks_checkbox->addOption(1_C_DISABLEBREAKS);
                
$option_tray->addElement($breaks_checkbox);
        }

          
$comments_checkbox = new XoopsFormCheckBox('''nocomments'0);
          
$comments_checkbox->addOption(1_C_DISABLECOM);

                
$option_tray->addElement($comments_checkbox);
        
$form->addElement($option_tray);
        
$add "add";
        
$form->addElement(new XoopsFormHidden('op'$add));
        if (
$return == 1) {
                
$form->addElement(new XoopsFormHidden('return'1));
        }
        
$submit = new XoopsFormButton("""submit"_SUBMIT"submit");
        
$form->addElement($submit);
        
$form->display();

        
xoops_cp_footer();
        break;

// ------------------------------------------------------------------------- //
// Add a content to database                                                 //
// ------------------------------------------------------------------------- //
case "add":
        
$myts =& MyTextSanitizer::getInstance();

        
$title=$myts->makeTboxData4Save($title);
        
$message=$myts->makeTareaData4Save($message);

        
$result $xoopsDB->query("SELECT * FROM ".$xoopsDB->prefix(_MIC_CONTENT_PREFIX)."");
        
$rows mysql_num_rows($result);

        if (
$rows == 0) {
          
$hp 1;
        } else {
          
$hp 0;
        }

        
$sqlinsert="INSERT INTO ".$xoopsDB->prefix(_MIC_CONTENT_PREFIX)." (parent_id,title,ptitle,text,visible,homepage,nohtml,nosmiley,nobreaks,nocomments,link,address,submenu) VALUES ('".intval($parent_id)."','".$title."','".$ptitle."','".$message."','".intval($visible)."','".$hp."','".intval($nohtml)."','".intval($nosmiley)."','".intval($nobreaks)."','"."','0','".$externalURL"','".intval($submenu)."')";
        if ( !
$result $xoopsDB->query($sqlinsert) )
                        {
                                echo 
_C_ERRORINSERT;
                        }
        if (
$return == 1) {
                
redirect_header(XOOPS_URL."/modules/content/index.php?id=".$xoopsDB->getInsertId(),2,_C_DBUPDATED);
        }else{
                
redirect_header("index.php?op=show",2,_C_DBUPDATED);
        }

        
redirect_header("index.php",2,_C_DBUPDATED);

        break;

// ------------------------------------------------------------------------- //
// Update Content -> Show Content Page                                       //
// ------------------------------------------------------------------------- //
case "update":

        foreach (
$id as $storyid) {

        if (
$storyid == intval($homepage[0])) {
            
$hp 1;
          } else {
            
$hp 0;
          }

          
$sqlinsert="UPDATE ".$xoopsDB->prefix(_MIC_CONTENT_PREFIX)." SET parent_id='".intval($parent_id[$storyid])."', blockid='".intval($blockid[$storyid])."',visible='".intval($visible[$storyid])."',homepage='".$hp."',nocomments='".intval($nocomments[$storyid])."',submenu='".intval($submenu[$storyid])."' WHERE storyid='".intval($storyid)."'";
        if ( !
$result $xoopsDB->query($sqlinsert) )
                        {
                                echo 
_C_ERRORINSERT;
                        }

        }
        
redirect_header("index.php?op=show",2,_C_DBUPDATED);

        break;

// ------------------------------------------------------------------------- //
// Show Edit Content Page                                                    //
// ------------------------------------------------------------------------- //
case "edit":
        global 
$xoopsDB$xoopsModuleConfig;
        
$myts =& MyTextSanitizer::getInstance();
        
xoops_cp_header();

    
$result $xoopsDB->query("SELECT storyid,parent_id,title,ptitle,text,visible,nohtml,nosmiley,nobreaks,nocomments,address,submenu FROM ".$xoopsDB->prefix(_MIC_CONTENT_PREFIX)." WHERE storyid=".intval($id));

    list(
$storyid,$parent_id,$title,$ptitle,$text,$visible,$nohtml,$nosmiley,$nobreaks,$nocomments,$externalURL,$submenu) = $xoopsDB->fetchRow($result);

        
$title=$myts->makeTboxData4Edit($title);
        
$message=$text;

        echo 
"

"._C_ADMINTITLE."

"
;

        
$form = new XoopsThemeForm(_C_EDITCONTENT"form_name""index.php");
        
$categoria_select = new XoopsFormSelect(_C_POSITION"parent_id"$parent_id);
        
$categoria_select->addOptionArray(gera_menus(0,'',''));
        
$form->addElement($categoria_select);
        
$text_box = new XoopsFormText(_C_LINKNAME"title"5030$title);
        
$form->addElement($text_box);
        
$ptitle = new XoopsFormText(_C_PAGETITLE"ptitle"50300$ptitle);
        
$form->addElement($ptitle);
        
$url_box = new XoopsFormText(_C_EXTURL"externalURL"50255$externalURL);
        
$form->addElement($url_box);

        
$visible_checkbox = new XoopsFormCheckBox(_C_VISIBLE'visible'$visible);
          
$visible_checkbox->addOption(1_C_YES);
        
$form->addElement($visible_checkbox);

        
$submenu_checkbox = new XoopsFormCheckBox(_C_SUBMENU'submenu'$submenu);
          
$submenu_checkbox->addOption(1_C_YES);
        
$form->addElement($submenu_checkbox);

        if (
$xoopsModuleConfig['cont_wysiwyg'] == '1') {
                
$fckeditor_root XOOPS_ROOT_PATH.'/modules/content/admin/fckeditor/';
                include 
XOOPS_ROOT_PATH.'/modules/content/admin/fckeditor/fckeditor.php';
                
ob_start();
                
$oFCKeditor = new FCKeditor('message') ;
                
$oFCKeditor->BasePath        XOOPS_URL."/modules/content/admin/fckeditor/" ;
                
$oFCKeditor->Value                $message ;
                
$oFCKeditor->Height                500 ;
                
$oFCKeditor->Create() ;
                
$form->addElement(new XoopsFormLabel(_C_CONTENTob_get_contents()));
                
ob_end_clean();
        } else {
                
$t_area = new XoopsFormDhtmlTextArea(_C_CONTENT'message'$message3735);
                
$form->addElement($t_area);
        }

        
$option_tray = new XoopsFormElementTray(_OPTIONS,'');

          if (
$xoopsModuleConfig['cont_wysiwyg'] != '1') {
                  
$form->addElement(new XoopsFormHidden(_DISABLEHTML0));
                
$form->addElement(new XoopsFormHidden(_DISABLESMILEY0));
          } else {
                 
$nohtml_checkbox = new XoopsFormCheckBox('''nohtml'0);
                  
$nohtml_checkbox->addOption(1_DISABLEHTML);
                
$option_tray->addElement($nohtml_checkbox);
                  
$smiley_checkbox = new XoopsFormCheckBox('''nosmiley'0);
                  
$smiley_checkbox->addOption(1_DISABLESMILEY);
                
$option_tray->addElement($smiley_checkbox);
          }

        if (
$xoopsModuleConfig['cont_wysiwyg'] == '1') {
          
$form->addElement(new XoopsFormHidden('nobreaks'1));
        } else {
          
$breaks_checkbox = new XoopsFormCheckBox('''nobreaks'0);
          
$breaks_checkbox->addOption(1_C_DISABLEBREAKS);
                
$option_tray->addElement($breaks_checkbox);
        }

          
$comments_checkbox = new XoopsFormCheckBox('''nocomments'$nocomments);
          
$comments_checkbox->addOption(1_C_DISABLECOM);
                
$option_tray->addElement($comments_checkbox);
        
$form->addElement($option_tray);
        
$editit "editit";
        
$form->addElement(new XoopsFormHidden('op'$editit));
        
$form->addElement(new XoopsFormHidden('id'$storyid));
        if (
$return == 1) {
                
$form->addElement(new XoopsFormHidden('return'1));
        }
        
$submit = new XoopsFormButton("""submit"_SUBMIT"submit");
        
$form->addElement($submit);
        
$form->display();

        
xoops_cp_footer();
        break;

// ------------------------------------------------------------------------- //
// Do the edit of the Content                                                //
// ------------------------------------------------------------------------- //
case "editit":
        
$myts =& MyTextSanitizer::getInstance();

        
$title=$myts->makeTboxData4Save($title);
        
$message=$myts->makeTareaData4Save($message);

        
$sqlinsert="UPDATE ".$xoopsDB->prefix(_MIC_CONTENT_PREFIX)." SET parent_id='".intval($parent_id)."',title='".$title."',ptitle='".$ptitle."',text='".$message."',visible='".intval($visible)."',nohtml='".intval($nohtml)."',nosmiley='".intval($nosmiley)."',nobreaks='".intval($nobreaks)."',nocomments='".intval($nocomments)."',address='".$externalURL."',submenu='".intval($submenu)."' WHERE storyid='".intval($id)."'";
        if ( !
$result $xoopsDB->query($sqlinsert) )
                        {
                                echo 
_C_ERRORINSERT;
                        }
        if (
$return == 1) {
                
redirect_header(XOOPS_URL."/modules/content/index.php?id=".$id,2,_C_DBUPDATED);
        }else{

                
redirect_header("index.php?op=show",2,_C_DBUPDATED);
        }

        break;

// ------------------------------------------------------------------------- //
// Show new link Page                                                        //
// ------------------------------------------------------------------------- //
case "nlink":
        
xoops_cp_header();

        echo 
"

"._C_ADMINTITLE."

"
;

        
$dir XOOPS_ROOT_PATH."/modules/content/content/";
        if(!
eregi("777",decoct(fileperms($dir)))) {
          echo
"

"._C_PERMERROR."

"
;
        }

// Upload File
        
echo "";
        echo 
"";
        echo 
""._C_ULFILE."";
        echo 
""._C_SFILE."";
        echo 
"._C_UPLOAD."' />";
        echo 
"";
    echo 
"";

// Delete File
        
$form = new XoopsThemeForm(_C_DELFILE"form_name""index.php");

        
$address_select = new XoopsFormSelect(_C_URL"address");
    
$folder dir("../content/");
        while(
$file $folder->read()) {
      if (
$file != "." && $file != "..") {
             
$address_select->addOption($file$file);
          }
        }
    
$folder->close();
        
$form->addElement($address_select);

        
$delfile "delfile";
        
$form->addElement(new XoopsFormHidden('op'$delfile));
        
$submit = new XoopsFormButton("""submit"_C_DELETE"submit");
        
$form->addElement($submit);
        
$form->display();

// Add PageWrap
        
$form = new XoopsThemeForm(_C_ADDLINK"form_name""index.php");
        
$categoria_select = new XoopsFormSelect(_C_POSITION"parent_id");
        
$categoria_select->addOptionArray(gera_menus(0,'',''));
        
$form->addElement($categoria_select);
        
$text_box = new XoopsFormText(_C_LINKNAME"title"5030);
        
$form->addElement($text_box);

        
$visible_checkbox = new XoopsFormCheckBox(_C_VISIBLE'visible');
          
$visible_checkbox->addOption(1_C_YES);
        
$form->addElement($visible_checkbox);

        
$submenu_checkbox = new XoopsFormCheckBox(_C_SUBMENU'submenu');
          
$submenu_checkbox->addOption(1_C_YES);
        
$form->addElement($submenu_checkbox);

        
$address_select = new XoopsFormSelect(_C_URL"address");
    
$folder dir("../content/");
        while(
$file $folder->read()) {
      if (
$file != "." && $file != "..") {
             
$address_select->addOption($file"".$file."");
          }
        }
    
$folder->close();
        
$form->addElement($address_select);

        
$comments_checkbox = new XoopsFormCheckBox(_C_DISABLECOM'nocomments'0);
          
$comments_checkbox->addOption(1_C_YES);
        
$form->addElement($comments_checkbox);

        
$addlink "addlink";
        
$form->addElement(new XoopsFormHidden('op'$addlink));
        
$submit = new XoopsFormButton("""submit"_SUBMIT"submit");
        
$form->addElement($submit);
        
$form->display();

        
xoops_cp_footer();
        break;

// ------------------------------------------------------------------------- //
// Upload File                                                //
// ------------------------------------------------------------------------- //
case "upload":

        
$uploadpath=XOOPS_ROOT_PATH."/modules/"._MIC_DIR_NAME."/content/";
        
$source=$_FILES[fileupload][tmp_name];
        
$fileupload_name=$_FILES[fileupload][name];
        if ( (
$source != 'none') && ($source != '' )) {
          
$dest=$uploadpath.$fileupload_name;
          if(
file_exists($uploadpath.$fileupload_name)) {
            
redirect_header("index.php",2,_C_ERRORUPL);
          } else {
            if (
copy($source$dest)) {
              
redirect_header("index.php",2,_C_UPLOADED);
            } else {
                  
redirect_header("index.php",2,_C_ERRORUPL);
            }
          
unlink ($source);
          }
        }

        break;

// ------------------------------------------------------------------------- //
// Delete File - Confirmation Question                                    //
// ------------------------------------------------------------------------- //
case "delfile":
        
xoops_cp_header();
        
xoops_confirm(array('address' => $address'op' => 'delfileok'), 'index.php'_C_RUSUREDELF_YES);
        
xoops_cp_footer();
        break;

// ------------------------------------------------------------------------- //
// Delete it definitely                                                      //
// ------------------------------------------------------------------------- //
case "delfileok":
        
$dir=XOOPS_ROOT_PATH."/modules/"._MIC_DIR_NAME."/content/";
        @
unlink($dir."/".$address);
    
redirect_header("index.php",2,_C_FDELETED);
        break;

// ------------------------------------------------------------------------- //
// Add a PageWrap to database                                                //
// ------------------------------------------------------------------------- //
case "addlink":
        
$myts =& MyTextSanitizer::getInstance();

        
$title=$myts->makeTboxData4Save($title);
        
$address=$myts->makeTboxData4Save($address);

        
$result $xoopsDB->query("SELECT * FROM ".$xoopsDB->prefix(_MIC_CONTENT_PREFIX)."");
        
$rows mysql_num_rows($result);

        if (
$rows == 0) {
          
$hp 1;
        } else {
          
$hp 0;
        }

        
$sqlinsert="INSERT INTO ".$xoopsDB->prefix(_MIC_CONTENT_PREFIX)." (parent_id,title,ptitle,text,visible,homepage,nohtml,nosmiley,nocomments,link,address,submenu) VALUES ('".intval($parent_id)."','".$title."','Page Title Here','0','".intval($visible)."','".$hp."','0','0','".intval($nocomments)."','1','".$address."','".intval($submenu)."')";
        if ( !
$result $xoopsDB->query($sqlinsert) )
                        {
                                echo 
_C_ERRORINSERT;
                        }
        
redirect_header("index.php",2,_C_DBUPDATED);

        break;

// ------------------------------------------------------------------------- //
// Show Edit Link Page                                                       //
// ------------------------------------------------------------------------- //
case "elink":
        global 
$xoopsDB;
        
$myts =& MyTextSanitizer::getInstance();
        
xoops_cp_header();

    
$result $xoopsDB->query("SELECT storyid,parent_id,title,ptitle,visible,nocomments,address,submenu FROM ".$xoopsDB->prefix(_MIC_CONTENT_PREFIX)." WHERE storyid=".intval($id));

    list(
$storyid,$parent_id,$title,$ptitle,$visible,$nocomments,$address,$submenu) = $xoopsDB->fetchRow($result);
$mostra gera_menus(0,'','');
$menu "parent_id">";
            foreach (
$mostra as $key => $value) {
                    if (
$key == $storyid)
                    continue;
                    if (
$key == $parent_id){
                            
$menu .= "$key."" selected='selected'>$value";
                    }else{
                            
$menu .= "$key."">$value";
                    }
            }
           
$menu .= '';
        
$title=$myts->makeTboxData4Edit($title);
        
$address=$myts->makeTboxData4Edit($address);

        if (
$visible == 1) {
           
$check1 "checked";
          } else {
           
$check1 "";
          }

        if (
$nocomments == 1) {
           
$check2 "checked";
          } else {
           
$check2 "";
          }

        if (
$submenu == 1) {
           
$check3 "checked";
          } else {
           
$check3 "";
          }

        echo 
"

"._C_ADMINTITLE."

"
;
        echo 
"";
        echo 
"";
        echo 
""._C_EDITLINK."";
        echo 
"Exibir em:$menu";
        echo 
""._C_LINKNAME.".$title."' />";
        echo 
""._C_VISIBLE.".$check1." />";
        echo 
""._C_SUBMENU.".$check3." />";
        echo 
""._C_URL."";

   
$folder dir("../content/");
        while(
$file $folder->read()) {
      if (
$file != "." && $file != "..") {
             if (
$file == $address) {
                   echo 
".$file."' selected>".$file."";
                 } else {
                   echo 
".$file."'>".$file."";
                 }
          }
        }

        echo 
"";
        echo 
""._C_DISABLECOM.".$check2." />";
        echo 
".$storyid."' />._SUBMIT."' />";
        echo 
"";
    echo 
"";

        
xoops_cp_footer();
        break;

// ------------------------------------------------------------------------- //
// Do the edit of the PageWrap                                               //
// ------------------------------------------------------------------------- //
case "linkeditit":
        
$myts =& MyTextSanitizer::getInstance();

        
$title=$myts->makeTboxData4Save($title);
        
$address=$myts->makeTboxData4Save($address);

        
$sqlinsert="UPDATE ".$xoopsDB->prefix(_MIC_CONTENT_PREFIX)." SET parent_id='".intval($parent_id)."',title='".$title."',ptitle='".$ptitle."',visible='".intval($visible)."',nocomments='".intval($nocomments)."',address='".$address."',submenu='".$submenu."' WHERE storyid='".intval($id)."'";
        if ( !
$result $xoopsDB->query($sqlinsert) )
                        {

                                echo 
_C_ERRORINSERT;
                        }
        
redirect_header("index.php?op=show",2,_C_DBUPDATED);

        break;

// ------------------------------------------------------------------------- //
// Delete Content - Confirmation Question                                    //
// ------------------------------------------------------------------------- //
case "delete":
        
xoops_cp_header();
        
xoops_confirm(array('id' => intval($id), 'op' => 'deleteit'), 'index.php'_C_RUSUREDEL_YES);
        
xoops_cp_footer();
        break;

// ------------------------------------------------------------------------- //
// Delete it definitely                                                      //
// ------------------------------------------------------------------------- //
case "deleteit":
        global 
$xoopsDB;
    
$result=$xoopsDB->query("DELETE FROM ".$xoopsDB->prefix(_MIC_CONTENT_PREFIX)." WHERE storyid=".intval($id));
        
xoops_comment_delete($xoopsModule->getVar('mid'), $id);
        
redirect_header("index.php?op=show",1,_C_DBUPDATED);
        break;

// ------------------------------------------------------------------------- //
// Admin menu: displayed after click on module logo                          //
// ------------------------------------------------------------------------- //
default:
        
xoops_cp_header();
    echo 
"

"._C_ADMINTITLE."

"
;
        echo 
" - "._C_MD_ADMENU1.""
;
        echo 
"";
        echo 
" - "._C_MD_ADMENU2.""
;
        echo 
"";
        echo 
" - "._C_MD_ADMENU3.""
;
        echo 
"";
        echo 
" - "._C_MD_ADMENU4.""
;
        echo 
"";
        echo 
" - "._C_MD_ADMENU4.""
;
        echo 
"";
        echo 
"- .XOOPS_URL."/modules/system/admin.php?fct=preferences&op=showmod&mod=".$xoopsModule->getVar('mid') ."'>"._PREFERENCES."";

        
xoops_cp_footer();
        break;
}
?>
A thread is for life. Not just for Christmas.

Login

Who's Online

347 user(s) are online (218 user(s) are browsing Support Forums)


Members: 0


Guests: 347


more...

Donat-O-Meter

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

Latest GitHub Commits