From: <txm...@us...> - 2012-01-31 18:19:13
|
Revision: 8848 http://xoops.svn.sourceforge.net/xoops/?rev=8848&view=rev Author: txmodxoops Date: 2012-01-31 18:19:00 +0000 (Tue, 31 Jan 2012) Log Message: ----------- backup files Removed Paths: ------------- XoopsModules/xnews/trunk/timgno/xnews/admin/admin_header.php~ XoopsModules/xnews/trunk/timgno/xnews/admin/clonate.php~ XoopsModules/xnews/trunk/timgno/xnews/admin/export.php~ XoopsModules/xnews/trunk/timgno/xnews/admin/import.php~ XoopsModules/xnews/trunk/timgno/xnews/admin/importer.php~ XoopsModules/xnews/trunk/timgno/xnews/admin/index.php~ XoopsModules/xnews/trunk/timgno/xnews/admin/menu.php~ XoopsModules/xnews/trunk/timgno/xnews/admin/newsletter.php~ XoopsModules/xnews/trunk/timgno/xnews/admin/permissions.php~ XoopsModules/xnews/trunk/timgno/xnews/admin/stories.php~ XoopsModules/xnews/trunk/timgno/xnews/admin/topics.php~ Deleted: XoopsModules/xnews/trunk/timgno/xnews/admin/admin_header.php~ =================================================================== --- XoopsModules/xnews/trunk/timgno/xnews/admin/admin_header.php~ 2012-01-31 18:04:15 UTC (rev 8847) +++ XoopsModules/xnews/trunk/timgno/xnews/admin/admin_header.php~ 2012-01-31 18:19:00 UTC (rev 8848) @@ -1,133 +0,0 @@ -<?php -/** - * **************************************************************************** - * - Original Copyright (TDM) - * - TDMCreate By TDM - TEAM DEV MODULE FOR XOOPS - * - Licence GPL Copyright (c) (http://www.tdmxoops.net) - * - Developers TEAM TDMCreate Xoops - (http://www.xoops.org) - * **************************************************************************** - * XNEWS - MODULE FOR XOOPS - * Copyright (c) 2007 - 2011 - * TXMod Xoops (http://www.txmodxoops.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. - * - * ------------------------------------------------------------------------ - * - * @copyright TXMod Xoops (http://www.txmodxoops.org) - * @license GPL see LICENSE - * @package xnews - * @author TXMod Xoops (in...@tx...) - * - * Version : 1.72 Tue 2011/12/13 22:29:37 : Timgno Exp $ - * **************************************************************************** - */ -include_once dirname(dirname(dirname(dirname(__FILE__)))) . "/mainfile.php"; -/*include_once XOOPS_ROOT_PATH."/include/cp_functions.php"; -include_once(XOOPS_ROOT_PATH."/kernel/module.php"); -include_once XOOPS_ROOT_PATH."/class/xoopsformloader.php"; -include_once XOOPS_ROOT_PATH."/class/tree.php"; -include_once XOOPS_ROOT_PATH."/class/xoopslists.php"; -include_once XOOPS_ROOT_PATH.'/class/pagenav.php'; -include_once XOOPS_ROOT_PATH.'/class/xoopsform/grouppermform.php'; -include_once "../include/static_var.php"; -include_once "../include/functions.php";*/ - -define("NW_SUBPREFIX", "nw"); -define("NW_MODULE_DIR_NAME", "xnews"); -define("NW_MODULE_PATH", XOOPS_ROOT_PATH . "/modules/" . NW_MODULE_DIR_NAME); -define("NW_MODULE_URL", XOOPS_URL . "/modules/" . NW_MODULE_DIR_NAME); -define("NW_UPLOADS_NEWS_PATH", XOOPS_ROOT_PATH . "/uploads/" . NW_MODULE_DIR_NAME); -define("NW_TOPICS_FILES_PATH", XOOPS_ROOT_PATH . "/uploads/" . NW_MODULE_DIR_NAME . "/topics"); -define("NW_ATTACHED_FILES_PATH", XOOPS_ROOT_PATH . "/uploads/" . NW_MODULE_DIR_NAME . "/attached"); -define("NW_TOPICS_FILES_URL", XOOPS_URL . "/uploads/" . NW_MODULE_DIR_NAME . "/topics"); -define("NW_ATTACHED_FILES_URL", XOOPS_URL . "/uploads/" . NW_MODULE_DIR_NAME . "/attached"); - -include_once XOOPS_ROOT_PATH.'/class/xoopstopic.php'; -include_once XOOPS_ROOT_PATH.'/class/xoopslists.php'; -include_once NW_MODULE_PATH . '/config.php'; -include_once NW_MODULE_PATH . '/class/class.newsstory.php'; -include_once NW_MODULE_PATH . '/class/class.newstopic.php'; -include_once NW_MODULE_PATH . '/class/class.sfiles.php'; -include_once NW_MODULE_PATH . '/class/blacklist.php'; -include_once NW_MODULE_PATH . '/class/registryfile.php'; -include_once XOOPS_ROOT_PATH.'/class/uploader.php'; -include_once XOOPS_ROOT_PATH.'/class/pagenav.php'; -include_once NW_MODULE_PATH . '/admin/functions.php'; -include_once NW_MODULE_PATH . '/include/functions.php'; -include_once XOOPS_ROOT_PATH.'/class/tree.php'; -$dateformat=nw_getmoduleoption('dateformat', NW_MODULE_DIR_NAME); -$myts =& MyTextSanitizer::getInstance(); -$topicscount=0; - -$storiesTableName = $xoopsDB->prefix('nw_stories'); -if(!nw_FieldExists('picture', $storiesTableName)) { - nw_AddField('`picture` VARCHAR( 50 ) NOT NULL', $storiesTableName); -} - -$pathDir = $GLOBALS['xoops']->path('/Frameworks/moduleclasses/moduleadmin'); -$globlang = $GLOBALS['xoopsConfig']['language']; - -if ( file_exists($pathDir.'/language/'.$globlang.'/main.php')){ - include_once $pathDir.'/language/'.$globlang.'/main.php'; - }else{ - include_once $pathDir.'/language/english/main.php'; - } - -if ( file_exists($pathDir.'/moduleadmin.php')){ - include_once $pathDir.'/moduleadmin.php'; - //return true; - }else{ - xoops_cp_header(); - echo xoops_error(_AM_ERROR_NOFRAMEWORKS); - xoops_cp_footer(); - //return false; - } -$dirname = basename( dirname( dirname( __FILE__ ) ) ); -$module_handler =& xoops_gethandler("module"); -$xoopsModule =& XoopsModule::getByDirname($dirname); -$moduleInfo =& $module_handler->get($xoopsModule->getVar("mid")); -$pathImageIcon = XOOPS_URL .'/'. $moduleInfo->getInfo('icons16'); -$pathImageAdmin = XOOPS_URL .'/'. $moduleInfo->getInfo('icons32'); - -$topicsHandler=& xoops_getModuleHandler('xnews_topics','xnews'); -$storiesHandler=& xoops_getModuleHandler('xnews_stories','xnews'); - -$myts =& MyTextSanitizer::getInstance(); - -if ($xoopsUser) { - $moduleperm_handler =& xoops_gethandler('groupperm'); - if (!$moduleperm_handler->checkRight('module_admin', $xoopsModule->getVar( 'mid' ), $xoopsUser->getGroups())) { - redirect_header(XOOPS_URL, 1, _NOPERM); - exit(); - } -} else { - redirect_header(XOOPS_URL . "/user.php", 1, _NOPERM); - exit(); -} - -if (!isset($xoopsTpl) || !is_object($xoopsTpl)) { - include_once(XOOPS_ROOT_PATH."/class/template.php"); - $xoopsTpl = new XoopsTpl(); -} - -$xoopsTpl->assign('pathImageIcon', $pathImageIcon); -$xoopsTpl->assign('pathImageAdmin', $pathImageAdmin); - -//Load languages -xoops_loadLanguage('admin', $xoopsModule->getVar("dirname")); -xoops_loadLanguage('modinfo', $xoopsModule->getVar("dirname")); -xoops_loadLanguage('main', $xoopsModule->getVar("dirname")); \ No newline at end of file Deleted: XoopsModules/xnews/trunk/timgno/xnews/admin/clonate.php~ =================================================================== --- XoopsModules/xnews/trunk/timgno/xnews/admin/clonate.php~ 2012-01-31 18:04:15 UTC (rev 8847) +++ XoopsModules/xnews/trunk/timgno/xnews/admin/clonate.php~ 2012-01-31 18:19:00 UTC (rev 8848) @@ -1,394 +0,0 @@ -<?php -/** - * **************************************************************************** - * - Original Copyright (TDM) - * - TDMCreate By TDM - TEAM DEV MODULE FOR XOOPS - * - Licence GPL Copyright (c) (http://www.tdmxoops.net) - * - Developers TEAM TDMCreate Xoops - (http://www.xoops.org) - * **************************************************************************** - * XNEWS - MODULE FOR XOOPS - * Copyright (c) 2007 - 2011 - * TXMod Xoops (http://www.txmodxoops.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. - * - * ------------------------------------------------------------------------ - * - * @copyright TXMod Xoops (http://www.txmodxoops.org) - * @license GPL see LICENSE - * @package xnews - * @author TXMod Xoops (in...@tx...) - * - * Version : 1.72 Tue 2011/12/13 22:29:36 : Timgno Exp $ - * **************************************************************************** - */ -include "admin_header.php"; -xoops_cp_header(); - -$op = xnews_CleanVars($_REQUEST, 'op', 'default', 'string'); -$clonerAdmin = new ModuleAdmin(); -switch ($op) -{ - case 'default': - default: - echo $clonerAdmin->addNavigation("clonate.php"); - $clonerAdmin->addItemButton(_AM_XNEWS_ADDCLONE, 'clonate.php?op=add_clone', 'add'); - echo $clonerAdmin->renderButton(); - global $xoopsDB, $xoopsConfig, $xoopsModule, $myts; - include_once XOOPS_ROOT_PATH.'/class/xoopsformloader.php'; - - $clone_modulename = ''; - - $start = isset($_GET['start']) ? intval($_GET['start']) : 0; - - $result = $xoopsDB->query('SELECT * FROM ' . $xoopsDB->prefix('news_clonerdata')); - $ix = 0; - $iy = 0; - $clone_arr = array(); - while ( $clone = $xoopsDB->fetchArray($result) ) { - //DNPROSSI - Control if clone dir exists - if ( is_dir(XOOPS_ROOT_PATH . "/modules/" . $clone['clone_dir']) ) { - $clone_arr[$ix] = $clone; - $ix++; - } else { - $nonclone_arr[$iy] = $clone; - $iy++; - } - } - // If cloned dir does not exists because deleted remove from dtb - if ( isset($nonclone_arr) ) { - for ($iy = 0; $iy < count($nonclone_arr); $iy++) { - $result = $xoopsDB->queryF("DELETE FROM " . $xoopsDB->prefix('news_clonerdata') . " WHERE clone_dir = '" . $nonclone_arr[$iy]['clone_dir'] . "' ;"); - } - } - - $totalclones = count($clone_arr); - $class=''; - - //echo '<h2>' . _AM_XNEWS_CLONER . '</h2>'; - //xnews_collapsableBar('NewsCloner', 'topNewsCloner'); - //echo "<img onclick=\"toggle('toptable'); toggleIcon('toptableicon');\" id='topNewsCloner' name='topNewsCloner' src='" . NW_MODULE_URL . "/images/close12.gif' alt='' /></a> " . _AM_XNEWS_CLONER_CLONES . ' (' . $totalclones . ')'."</h4>"; - echo "<div id='NewsCloner'>"; - echo '<br />'; - echo "<div style='text-align: center;'>"; - echo "<table width='100%' cellspacing='1' cellpadding='3' border='0' class='outer'><tr class='bg5'><th align='center'>" . _AM_XNEWS_CLONER_NAME . "</th><th align='center'>" . _AM_XNEWS_CLONER_DIRFOL . "</th><th align='center'>" . _AM_XNEWS_SUBPREFIX . "</th><th align='center'>" . _AM_XNEWS_CLONER_VERSION . "</th><th align='center'>" . _AM_XNEWS_ACTION . "</th><th align='center'>" . _AM_XNEWS_CLONER_ACTION_INSTALL . "</th></tr>"; - if(is_array($clone_arr) && $totalclones) { - $cpt=1; - $tmpcpt=$start; - $ok=true; - $output=''; - while($ok) { - if($tmpcpt < $totalclones) { - //DNPROSSI - Upgrade if clone version is different from original news version - //DNPROSSI - Install if cloned - if ( $clone_arr[$tmpcpt]['clone_dir'] != $clone_arr[0]['clone_dir'] ) { - if ( $clone_arr[$tmpcpt]['clone_version'] != $clone_arr[0]['clone_version'] ) - { - $linkupgrade = NW_MODULE_URL . '/admin/clonate.php?op=cloneupgrade&clone_id=' . $clone_arr[$tmpcpt]['clone_id']; - $action = sprintf("<a href='%s'>%s</a>", $linkupgrade, _AM_XNEWS_UPGRADE); - if ( $clone_arr[$tmpcpt]['clone_installed'] == 1 ) - { - $linkupgrade = XOOPS_URL . '/modules/system/admin.php?fct=modulesadmin&op=uninstall&module=' . $clone_arr[$tmpcpt]['clone_dir']; - $installaction = sprintf("<a href='%s'>%s</a>", $linkupgrade, _AM_XNEWS_CLONER_UNINSTALL); - } else { - $linkupgrade = XOOPS_URL . '/modules/system/admin.php?fct=modulesadmin&op=install&module=' . $clone_arr[$tmpcpt]['clone_dir']; - $linkdelete = NW_MODULE_URL . '/admin/clonate.php?op=clonedelete&clone_id=' . $clone_arr[$tmpcpt]['clone_id']; - $installaction = sprintf("<a href='%s'>%s</a> - <a href='%s'>%s</a>", $linkupgrade, _AM_XNEWS_CLONER_INSTALL, $linkdelete, _AM_XNEWS_DELETE); - } - } else { - $linkforce = NW_MODULE_URL . '/admin/clonate.php?op=cloneupgrade&clone_id=' . $clone_arr[$tmpcpt]['clone_id']; - $action=sprintf( _AM_XNEWS_CLONER_CLONEUPGRADED . " - <a href='%s'>%s</a>", $linkforce, _AM_XNEWS_CLONER_UPGRADEFORCE); - if ( $clone_arr[$tmpcpt]['clone_installed'] == 1 ) - { - $linkupgrade = XOOPS_URL . '/modules/system/admin.php?fct=modulesadmin&op=uninstall&module=' . $clone_arr[$tmpcpt]['clone_dir']; - $installaction = sprintf("<a href='%s'>%s</a>", $linkupgrade, _AM_XNEWS_CLONER_UNINSTALL); - } else { - $linkupgrade = XOOPS_URL . '/modules/system/admin.php?fct=modulesadmin&op=install&module=' . $clone_arr[$tmpcpt]['clone_dir']; - $linkdelete = NW_MODULE_URL . '/admin/clonate.php?op=clonedelete&clone_id=' . $clone_arr[$tmpcpt]['clone_id']; - $installaction = sprintf("<a href='%s'>%s</a> - <a href='%s'>%s</a>", $linkupgrade, _AM_XNEWS_CLONER_INSTALL, $linkdelete, _AM_XNEWS_DELETE); - } - } - } else { - $linkupgrade = XOOPS_URL . '/modules/system/admin.php?fct=modulesadmin&op=update&module=' . $clone_arr[$tmpcpt]['clone_dir']; - $action = sprintf("<a href='%s'>%s</a>", $linkupgrade, _AM_XNEWS_CLONER_UPDATE); - $installaction = ''; - } - $class = ($class == 'even') ? 'odd' : 'even'; - $output = $output . "<tr class='" . $class . "'><td align='center'>" . $clone_arr[$tmpcpt]['clone_name'] . "</td><td align='center'>" . $clone_arr[$tmpcpt]['clone_dir'] . "</td><td align='center'>" . $clone_arr[$tmpcpt]['clone_subprefix'] . "</td><td align='center'>" . round($clone_arr[$tmpcpt]['clone_version'] / 100, 2) . "</td><td>" . $action . "</td><td>" . $installaction . "</td></tr>"; - } else { - $ok=false; - } - if($cpt>=xnews_getmoduleoption('storycountadmin', NW_MODULE_DIR_NAME)) { - $ok=false; - } - $tmpcpt++; - $cpt++; - } - echo $output; - } - $pagenav = new XoopsPageNav( $totalclones, xnews_getmoduleoption('storycountadmin', NW_MODULE_DIR_NAME), $start, 'start', 'op=clonemanager'); - echo "</table><div align='right'>".$pagenav->renderNav().'</div><br />'; - echo "</div></div><br />\n"; - - $clone_id = isset($_GET['clone_id']) ? intval($_GET['clone_id']) : 0; - if($clone_id>0) { - $xtmod = new xnews_NewsTopic($clone_id); - $clone_name=$xtmod->clone_name('E'); - $clone_dir=$xtmod->clone_dir('E'); - $clone_version=$xtmod->clone_version('E'); - $op='modClone'; - $btnlabel=_AM_XNEWS_MODIFY; - $parent=$xtmod->topic_pid(); - $formlabel=_AM_XNEWS_MODIFYTOPIC; - $oldnewsimport=$xtmod->menu(); - $topic_frontpage=$xtmod->topic_frontpage(); - $topic_color=$xtmod->topic_color(); - unset($xtmod); - } else { - $clone_name=''; - $clone_frontpage=1; - $clone_dir=''; - $op='addTopic'; - $btnlabel=_AM_XNEWS_ADD; - $parent=-1; - $oldnewsimport=0; - $clone_version=''; - $formlabel=_AM_XNEWS_ADD_TOPIC; - } - break; - case 'add_clone': - echo $clonerAdmin->addNavigation("clonate.php"); - $clonerAdmin->addItemButton(_AM_XNEWS_CLONESLIST, 'clonate.php?op=default', 'list'); - echo $clonerAdmin->renderButton(); - //Draw Form - include_once XOOPS_ROOT_PATH.'/class/xoopsformloader.php'; - $sform = new XoopsThemeForm(_AM_XNEWS_CLONER_ADD, "clonerform", NW_MODULE_URL . "/admin/clonate.php", "post"); - - $filedir_tray = new XoopsFormElementTray(_AM_XNEWS_CLONER_NEWNAME, ""); - $label = sprintf(_AM_XNEWS_CLONER_NEWNAMEDESC, $xoopsModule->name()); - $filedir_tray->addElement(new XoopsFormLabel($label), false); - $filedir_tray->addElement(new XoopsFormText(_AM_XNEWS_CLONER_NEWNAMELABEL, "clone_modulename", 50, 255, $clone_modulename), true); - $sform->addElement($filedir_tray); - - $sform->addElement(new XoopsFormHidden("op", "default"), false); - $sform->addElement(new XoopsFormHidden("op", "clonerapply"), false); - - $button_tray = new XoopsFormElementTray("" ,""); - $submit_btn = new XoopsFormButton("", "post", _SUBMIT, "submit"); - $button_tray->addElement($submit_btn); - $sform->addElement($button_tray); - $sform->display(); - - - //recalc original subprefix - $sub = xnews_remove_numbers(NW_SUBPREFIX); - $result2 = $xoopsDB->query("SELECT * FROM " . $xoopsDB->prefix($sub.'_stories')); - $count = $xoopsDB->getRowsNum($result2); - - $tmpmodule_handler =& xoops_gethandler('module'); - break; - case 'clonerapply': - include_once "cloner.php"; - global $xoopsDB, $xoopsConfig, $xoopsModule; - if ( !empty($_POST['clone_modulename']) ) { - $module_version = $xoopsModule->version(); - $old_dirname = $xoopsModule->dirname(); - $old_modulename = $xoopsModule->name(); - $old_subprefix = NW_SUBPREFIX; - - $new_modulename = $_POST['clone_modulename']; - - $new_dirname = strtolower(str_replace(' ', '', $new_modulename)); - $new_modulename = ucwords(strtolower($new_modulename)); - - //Select last id for new sub-prefix. - $result = $xoopsDB->query("SHOW TABLE STATUS LIKE '" . $xoopsDB->prefix("news_clonerdata") . "'"); - $row = $xoopsDB->fetchArray($result); - $Auto_increment = $row['Auto_increment']; - - $new_subprefix = 'nw' . strval($Auto_increment); - //trigger_error($result. ' ---- ' .$count. ' ---- ' .$new_subprefix , E_USER_WARNING); - - $patterns = array( - $old_dirname => $new_dirname, - '$modversion["original"] = 1;' => '$modversion["original"] = 0;', - '$modversion["name"] = "' . 'x' . 'News' . '"' => '$modversion["name"] = "' . $new_modulename . '"', - $old_subprefix => strtolower($new_subprefix), - strtoupper($old_subprefix) => strtoupper($new_subprefix) - ); - - $patKeys = array_keys($patterns); - $patValues = array_values($patterns); - - $newPath = str_replace($patKeys[0], $patValues[0], NW_MODULE_PATH); - $oldlogo = $newPath . "/" . $old_dirname . "_logo.png"; - $newlogo = $newPath . "/" . $new_dirname . "_logo.png"; - - if ( !is_dir($newPath) ) { //&& !$old_subprefix == $new_subprefix ) { - xnews_cloneFileFolder(NW_MODULE_PATH, $patterns); - //rename logo.png - @rename( $oldlogo, $newlogo ); - //trigger_error($oldlogo. ' ---- ' .$newlogo , E_USER_WARNING); - - $path_array[0] = $newPath . '/templates/'; - $path_array[1] = $newPath . '/templates/blocks/'; - - // check all files in dir, and process them - xnews_clonefilename($path_array, $old_subprefix, $new_subprefix); - - //Add cloned module to cloner dtb - $result = $xoopsDB->query("INSERT INTO " . $xoopsDB->prefix('news_clonerdata') . - " (clone_name, clone_dir, clone_version, clone_subprefix, clone_installed)" . - " VALUES ('" . $new_modulename . "', '" . $new_dirname . "', '" . $module_version . "', '" . $new_subprefix . "', 0);"); - - $label = sprintf(_AM_XNEWS_CLONER_CREATED, $new_modulename); - redirect_header('clonate.php?op=default', 5, $label); - } else { - $label = sprintf(_AM_XNEWS_CLONER_DIREXISTS, $new_dirname); - redirect_header('clonate.php?op=default', 5, $label); - } - } - break; - - case 'cloneupgrade': - include_once "cloner.php"; - global $xoopsDB, $xoopsConfig, $xoopsModule; - - if ( !isset($_GET['clone_id']) ) { - //trigger_error("Not set", E_USER_WARNING); - redirect_header('clonate.php?op=default', 5, _AM_XNEWS_CLONER_NOMODULEID); - } else { - $cloneid = $_GET['clone_id']; - - $result = $xoopsDB->query("SELECT * FROM " . $xoopsDB->prefix('news_clonerdata') . " WHERE clone_id = " . $cloneid ); - $ix = 0; - while ( $clone = $xoopsDB->fetchArray($result) ) { - $clone_arr[$ix] = $clone; - $ix++; - } - - $org_modulename = $xoopsModule->name(); - $org_dirname = $xoopsModule->dirname(); - $org_version = $xoopsModule->version(); - $org_subprefix = NW_SUBPREFIX; - - $upg_modulename = $clone_arr[0]['clone_name']; - $upg_dirname = $clone_arr[0]['clone_dir']; - $upg_version = $clone_arr[0]['clone_version']; - $upg_subprefix = $clone_arr[0]['clone_subprefix']; - - $patterns = array( - $org_dirname => $upg_dirname, - '$modversion["original"] = 1;' => '$modversion["original"] = 0;', - '$modversion["name"] = "' . 'x' . 'News' . '"' => '$modversion["name"] = "' . $upg_modulename . '"', - $org_subprefix => strtolower($upg_subprefix), - strtoupper($org_subprefix) => strtoupper($upg_subprefix), - ); - - $patKeys = array_keys($patterns); - $patValues = array_values($patterns); - - $newPath = str_replace($patKeys[0], $patValues[0], NW_MODULE_PATH); - $oldlogo = $newPath . "/" . $org_dirname . "_logo.png"; - $newlogo = $newPath . "/" . $upg_dirname . "_logo.png"; - - xnews_cloneFileFolder(NW_MODULE_PATH, $patterns); - //rename logo.png - @rename( $oldlogo, $newlogo ); - - $path_array[0] = $newPath . '/templates/'; - $path_array[1] = $newPath . '/templates/blocks/'; - - xnews_deleteclonefile($path_array, $upg_subprefix); - - // check all files in dir, and process them - xnews_clonefilename($path_array, $org_subprefix, $upg_subprefix); - - //Update module dtb - $xoopsDB->queryF("UPDATE " . $xoopsDB->prefix('news_clonerdata') . " SET clone_version = " . $org_version . " WHERE clone_id = " . $cloneid); - - $label = sprintf(_AM_XNEWS_CLONER_UPRADED, $upg_modulename); - redirect_header('clonate.php?op=default', 5, $label); - } - break; - - case 'clonedelete': - include_once XOOPS_ROOT_PATH.'/class/xoopsformloader.php'; - xoops_cp_header(); - global $xoopsDB, $xoopsConfig, $xoopsModule; - - if ( !isset($_GET['clone_id']) ) { - - redirect_header('clonate.php?op=default', 5, _AM_XNEWS_CLONER_CLONEID); - } else { - $cloneid = $_GET['clone_id']; - - $result = $xoopsDB->query("SELECT * FROM " . $xoopsDB->prefix('news_clonerdata') . " WHERE clone_id = " . $cloneid ); - $ix = 0; - while ( $clone = $xoopsDB->fetchArray($result) ) { - $clone_arr[$ix] = $clone; - $ix++; - } - - $module_dirname = $clone_arr[0]['clone_dir']; - - echo "<div id='NewsCloner' style='text-align: center;'>"; - echo "<h2>" . _AM_XNEWS_CLONER_CLONEDELETION . "</h2>"; - echo "</div>"; - //echo "<div style='text-align: center;'>"; - $message = sprintf(_AM_XNEWS_CLONER_SUREDELETE, $module_dirname); - xoops_confirm(array('op' => 'clonedeleteapply', 'clone_id' => $cloneid, 'ok' => 1, 'module_name' => $module_dirname), 'index.php', $message); - } - break; - - case 'clonedeleteapply': - include_once "cloner.php"; - global $xoopsDB, $xoopsConfig, $xoopsModule; - //trigger_error("Not set", E_USER_WARNING); - if ( !isset($_POST['clone_id']) ) { - redirect_header('clonate.php?op=default', 5, _AM_XNEWS_CLONER_CLONEID); - } else { - - $del_dirname = $_POST['module_name']; - - $delPath1 = XOOPS_ROOT_PATH . "/modules/" . $del_dirname; - $delPath2 = XOOPS_ROOT_PATH . "/uploads/" . $del_dirname; - - if ( file_exists($delPath2) && is_dir($delPath2) ) - { - if ( xnews_removewholeclone($delPath1) == TRUE && xnews_removewholeclone($delPath2) == TRUE ) - { - $label = sprintf(_AM_XNEWS_CLONER_CLONEDELETED, $del_dirname); - redirect_header('clonate.php?op=default', 5, $label); - } else { - $label = sprintf(_AM_XNEWS_CLONER_CLONEDELETEERR, $del_dirname); - redirect_header('clonate.php?op=default', 5, $label); - } - } - elseif ( xnews_removewholeclone($delPath1) == TRUE ) - { - $label = sprintf(_AM_XNEWS_CLONER_CLONEDELETED, $del_dirname); - redirect_header('clonate.php?op=default', 5, $label); - } else { - $label = sprintf(_AM_XNEWS_CLONER_CLONEDELETEERR, $del_dirname); - redirect_header('clonate.php?op=default', 5, $label); - } - } - break; -} - -include "admin_footer.php"; -?> \ No newline at end of file Deleted: XoopsModules/xnews/trunk/timgno/xnews/admin/export.php~ =================================================================== --- XoopsModules/xnews/trunk/timgno/xnews/admin/export.php~ 2012-01-31 18:04:15 UTC (rev 8847) +++ XoopsModules/xnews/trunk/timgno/xnews/admin/export.php~ 2012-01-31 18:19:00 UTC (rev 8848) @@ -1,89 +0,0 @@ -<?php -/** - * **************************************************************************** - * - Original Copyright (TDM) - * - TDMCreate By TDM - TEAM DEV MODULE FOR XOOPS - * - Licence GPL Copyright (c) (http://www.tdmxoops.net) - * - Developers TEAM TDMCreate Xoops - (http://www.xoops.org) - * **************************************************************************** - * XNEWS - MODULE FOR XOOPS - * Copyright (c) 2007 - 2011 - * TXMod Xoops (http://www.txmodxoops.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. - * - * ------------------------------------------------------------------------ - * - * @copyright TXMod Xoops (http://www.txmodxoops.org) - * @license GPL see LICENSE - * @package xnews - * @author TXMod Xoops (in...@tx...) - * - * Version : 1.72 Tue 2011/12/13 22:29:36 : Timgno Exp $ - * **************************************************************************** - */ - -include "admin_header.php"; -xoops_cp_header(); - - $exportAdmin = new ModuleAdmin(); - echo $exportAdmin->addNavigation("export.php"); - - global $dateformat; - $start = isset($_GET['startexp']) ? intval($_GET['startexp']) : 0; - $expiredcount = $storiesHandler->getAllStoriesCount(1,false); - $storyarray = $storiesHandler->getAllExpired(xnews_getmoduleoption('storycountadmin', NW_MODULE_DIR_NAME), $start, 0, 1 ); - $pagenav = new XoopsPageNav( $expiredcount, xnews_getmoduleoption('storycountadmin', NW_MODULE_DIR_NAME), $start, 'startexp', 'op=newarticle'); - - if(count($storyarray) > 0) { - $class=''; - nw_collapsableBar('expstories', 'topexpstories'); - echo "<img onclick=\"toggle('toptable'); toggleIcon('toptableicon');\" id='topexpstories' name='topexpstories' src='" . NW_MODULE_URL . "/images/close12.gif' alt='' /></a> "._AM_NW_EXPARTS."</h4>"; - echo "<div id='expstories'>"; - echo '<br />'; - echo "<div style='text-align: center;'>"; - echo "<table width='100%' cellspacing='1' cellpadding='3' border='0' class='outer'><tr class='bg3'><td align='center'>" . _AM_NW_STORYID . "</td><td align='center'>" . _AM_NW_TITLE . "</td><td align='center'>" . _AM_NW_TOPIC . "</td><td align='center'>" . _AM_NW_POSTER . "</td><td align='center' class='news'>" . _AM_NW_CREATED . "</td><td align='center' class='news'>" . _AM_NW_EXPIRED . "</td><td align='center'>" . _AM_NW_ACTION . "</td></tr>"; - foreach( $storyarray as $eachstory ) { - $created = formatTimestamp($eachstory->created(),$dateformat); - $expired = formatTimestamp($eachstory->expired(),$dateformat); - $topic = $eachstory -> topic(); - // added exired value field to table - $class = ($class == 'even') ? 'odd' : 'even'; - echo "<tr class='".$class."'>"; - echo "<td align='center'><b>" . $eachstory -> storyid() . "</b> - </td><td align='left'><a href='" . NW_MODULE_URL . "/article.php?returnside=1&storyid=" . $eachstory -> storyid() . "'>" . $eachstory -> title() . "</a> - </td><td align='center'>" . $topic -> topic_title() . " - </td><td align='center'><a href='" . XOOPS_URL . "/userinfo.php?uid=" . $eachstory -> uid() . "'>" . $eachstory -> uname() . "</a></td><td align='center' class='news'>" . $created . "</td><td align='center' class='news'>" . $expired . "</td><td align='center'><a href='".NW_MODULE_URL . "/submit.php?returnside=1&op=edit&storyid=" . $eachstory -> storyid() . "'>" . _AM_NW_EDIT . "</a>-<a href='".NW_MODULE_URL . "/admin/index.php?op=delete&storyid=" . $eachstory -> storyid() . "'>" . _AM_NW_DELETE . "</a>"; - echo "</td></tr>\n"; - } - echo '</table><br />'; - echo "<div align='right'>".$pagenav->renderNav().'</div><br />'; - echo "<form action='index.php' method='get'> - " . _AM_NW_STORYID . " <input type='text' name='storyid' size='10' /> - <select name='op'> - <option value='edit' selected='selected'>" . _AM_NW_EDIT . "</option> - <option value='delete'>" . _AM_NW_DELETE . "</option> - </select> - <input type='hidden' name='returnside' value='1'> - <input type='submit' value='" . _AM_NW_GO . "' /> - </form> - </div>"; - echo '</div><br />'; - } - -include "admin_footer.php"; - -?> \ No newline at end of file Deleted: XoopsModules/xnews/trunk/timgno/xnews/admin/import.php~ =================================================================== --- XoopsModules/xnews/trunk/timgno/xnews/admin/import.php~ 2012-01-31 18:04:15 UTC (rev 8847) +++ XoopsModules/xnews/trunk/timgno/xnews/admin/import.php~ 2012-01-31 18:19:00 UTC (rev 8848) @@ -1,401 +0,0 @@ -<?php -/** - * **************************************************************************** - * - Original Copyright (TDM) - * - TDMCreate By TDM - TEAM DEV MODULE FOR XOOPS - * - Licence GPL Copyright (c) (http://www.tdmxoops.net) - * - Developers TEAM TDMCreate Xoops - (http://www.xoops.org) - * **************************************************************************** - * XNEWS - MODULE FOR XOOPS - * Copyright (c) 2007 - 2011 - * TXMod Xoops (http://www.txmodxoops.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. - * - * ------------------------------------------------------------------------ - * - * @copyright TXMod Xoops (http://www.txmodxoops.org) - * @license GPL see LICENSE - * @package xnews - * @author TXMod Xoops (in...@tx...) - * - * Version : 1.72 Tue 2011/12/13 22:29:36 : Timgno Exp $ - * **************************************************************************** - */ - -include "admin_header.php"; -include_once '../include/functions.php'; -include_once '../class/class.xnewstopic.php'; -include_once '../class/class.xnewsstory.php'; -include_once '../class/class.xnewsimport.php'; -xoops_cp_header(); - - $importAdmin = new ModuleAdmin(); - echo $importAdmin->addNavigation("import.php"); - -function NewsImport() -{ - global $xoopsDB; - $importfrom = 'none'; - $importto = 'none'; - - xoops_load('XoopsFormLoader'); - - // Iterate through installed modules tables for articles, items, category, - // topics and add them to selectlist - // This will also find clones - $news_fieldsearch_array = array( - 'topic_id', - 'topic_pid', - 'banner' - ); - - $other_fieldsearch_array = array( - 'categoryid', - 'parentid', - 'moderator' - ); - - //Get From Module Data - $module_handler =& xoops_gethandler('module'); - $installed_mods = $module_handler->getObjects(); - $listed_mods = array(); - $count = 0; - foreach ( $installed_mods as $module ) { - if ( $module->getVar('dirname') != 'system' && $module->getVar('isactive') == 1 ) { - $module->loadInfo($module->getVar('dirname')); - $modtables = $module->getInfo('tables'); - if ( $modtables != false && is_array($modtables) ) { - foreach ( $modtables as $table ) { - $newscount = 0; - foreach ($news_fieldsearch_array as $field ) { - if ( xni_fieldexists($field, $xoopsDB->prefix($table)) ) { - $newscount++; - } - } - if ( $newscount == 2 ) { - $from_module_version = round($module->getVar('version') / 100, 2); - if (($from_module_version >= 1.64)) { - $importfrom_array["news/" . $module->getVar('dirname')] = $module->getVar('dirname') . " " . $from_module_version; - } - } - /*} elseif ($newscount == 3) { - $from_module_version = round($module->getVar('version') / 100, 2); - if (($from_module_version >= 2.0)) { - $importfrom_array["ams/" . $module->getVar('dirname')] = $module->getVar('dirname') . " " . $from_module_version; - } - } - $smartcount = 0; - foreach ( $other_fieldsearch_array as $field ) { - if ( xni_fieldexists($field, $xoopsDB->prefix($table)) ) { - $smartcount++; - } - } - if ( $smartcount == 2 ) { - $from_module_version = round($module->getVar('version') / 100, 2); - if (($from_module_version >= 2.0)) { - $importfrom_array["smartsection/" . $module->getVar('dirname')] = $module->getVar('dirname') . " " . $from_module_version; - } - } elseif ($smartcount == 3) { - $from_module_version = round($module->getVar('version') / 100, 2); - if (($from_module_version >= 1.0)) { - $importfrom_array["publisher/" . $module->getVar('dirname')] = $module->getVar('dirname') . " " . $from_module_version; - } - }*/ - } - } - } - } - - $result = $xoopsDB->query("SELECT * FROM " . $xoopsDB->prefix('news_clonerdata') . " WHERE clone_installed = 1"); - $ix = 0; - while ( $clone = $xoopsDB->fetchArray($result) ) { - $importto_array[$ix] = $clone['clone_dir']; - $ix++; - } - - if (isset($importfrom_array) && count($importfrom_array) > 0 && isset($importto_array) && count($importto_array) > 0) { - - $sform = new XoopsThemeForm(_AM_XNI_IMPORT_SELECTION, "op", xoops_getenv('PHP_SELF')); - $sform->setExtra('enctype="multipart/form-data"'); - - // Partners to import from - $importfrom = new XoopsFormSelect('', 'importfrom', $importfrom); - $importfrom->addOptionArray($importfrom_array); - $importfrom_tray = new XoopsFormElementTray(_AM_XNI_IMPORT_FROM , ' '); - $importfrom_tray->addElement($importfrom); - $importfrom_tray->setDescription(_AM_XNI_IMPORT_FROM_DSC); - $sform->addElement($importfrom_tray); - - // xNews & clones to import to - $importto = new XoopsFormSelect('', 'importto', $importto); - $importto->addOptionArray($importto_array); - $importto_tray = new XoopsFormElementTray(_AM_XNI_IMPORT_TO_TOPICS , ' '); - $importto_tray->addElement($importto); - $importto_tray->setDescription(_AM_XNI_IMPORT_TO_TOPICS_DSC); - $sform->addElement($importto_tray); - - // Buttons - $button_tray = new XoopsFormElementTray('', ''); - $hidden = new XoopsFormHidden('op', 'topicselect'); - $button_tray->addElement($hidden); - - $butt_import = new XoopsFormButton('', '', _AM_XNI_IMPORT, 'submit'); - $butt_import->setExtra('onclick="this.form.elements.op.value=\'topicselect\'"'); - $button_tray->addElement($butt_import); - - $butt_cancel = new XoopsFormButton('', '', _AM_XNI_CANCEL, 'button'); - $butt_cancel->setExtra('onclick="this.form.elements.op.value=\'default\'"'); - $button_tray->addElement($butt_cancel); - $sform->addElement($button_tray); - $sform->display(); - unset($hidden); - } else { - echo "<span style=\"color: #567; margin: 3px 0 12px 0; font-weight: bold; font-size: small; display: block; \">" . _AM_XNI_IMPORT_NO_MODULE . "</span>"; - } -} - -function TopicSelect() -{ - echo '<script type="text/javascript" src="' . XNI_MODULE_URL . '/js/funcs.js"></script>'; - xoops_load('XoopsFormLoader'); - global $xoopsDB; - - $begin = isset($_GET['begin']) ? intval($_GET['begin']) : 0; - include_once XOOPS_ROOT_PATH . '/class/xoopstree.php'; - include_once XOOPS_ROOT_PATH . '/class/xoopstopic.php'; - include_once XOOPS_ROOT_PATH . '/class/xoopslists.php'; - include_once XOOPS_ROOT_PATH . '/class/pagenav.php'; - include_once XOOPS_ROOT_PATH . '/class/tree.php'; - $myts =& MyTextSanitizer::getInstance(); - - //Detect in out modules and prepare form - $from_import = (isset($_POST['importfrom'])) ? $_POST['importfrom'] : 'nonselected'; - $to_import_clone_id = (isset($_POST['importto'])) ? $_POST['importto'] : 'nonselected'; - - $options = explode('/', $from_import); - - $from_import_type = $options[0]; - $from_import_dirname = $options[1]; - - //Get selected xNews module or clone to import to - $result = $xoopsDB->query("SELECT * FROM " . $xoopsDB->prefix('news_clonerdata') . " WHERE clone_installed = 1"); - $ix = 0; - while ( $clone = $xoopsDB->fetchArray($result) ) { - $clone_arr[$ix] = $clone; - $ix++; - } - - $to_import_dirname = $clone_arr[$to_import_clone_id]['clone_dir']; - $to_subprefix = $clone_arr[$to_import_clone_id]['clone_subprefix'] . "_"; - - if ($from_import_dirname == $to_import_dirname) - { - //REDIRECT IF SAME - redirect_header('index.php?op=import', 2, "It's not possible to import the same ".$options[1]." module!"); - } - - $from_import_type = $options[0]; - $from_import_dirname = $options[1]; - - $from_topic_id_type = ''; - $from_topic_pid_type = ''; - $from_topic_title_type = ''; - $from_table_name = ''; - - //GET ALL MODULE-FROM DATA - $module_handler = &xoops_gethandler('module'); - $from_module = &$module_handler->getByDirname($from_import_dirname); - $from_module->loadInfo($from_module->getVar('dirname')); - - $from_modtables = $from_module->getInfo('tables'); - if ( $from_modtables != false && is_array($from_modtables) ) { - foreach ( $from_modtables as $from_table ) { - $from_table_arr = explode('_', $from_table); - if ( count($from_table_arr) > 0 ) { //&& $from_import_dirname != 'news') { - if ($from_import_dirname != 'news') { - $subprefix = $from_table_arr[0] . "_"; - } else { - $subprefix = ''; - } - //trigger_error($subprefix . " NEWS ".$from_table_arr[0], E_USER_WARNING); - switch ($from_import_type) { - case 'news': - $from_subprefix = $subprefix; - $from_topics_arr = xni_gettopics($from_subprefix); - $from_topic_id = 'topic_id'; - $from_topic_pid = 'topic_pid'; - $from_topic_title = 'topic_title'; - $from_topic_table = $from_subprefix . 'topics'; - $from_story_table = $from_subprefix . 'stories'; - break; - /*case 'ams': - $from_subprefix = $subprefix; - $from_topics_arr = xni_gettopics($from_subprefix); - $from_topic_id = 'topic_id'; - $from_topic_pid = 'topic_pid'; - $from_topic_title = 'topic_title'; - $from_topic_table = $from_subprefix . 'topics'; - $from_story_table = $from_subprefix . 'stories'; - break; - case 'smartsection': - $from_subprefix = $subprefix; - $from_topics_arr = xni_getcategories($from_subprefix); - $from_topic_id = 'categoryid'; - $from_topic_pid = 'parentid'; - $from_topic_title = 'name'; - $from_topic_table = $from_subprefix . 'categories'; - $from_story_table = $from_subprefix . 'items'; - break; - case 'publisher': - $from_subprefix = $subprefix; - $from_topics_arr = xni_getcategories($from_subprefix); - $from_topic_id = 'categoryid'; - $from_topic_pid = 'parentid'; - $from_topic_title = 'name'; - $from_topic_table = $from_subprefix . 'categories'; - $from_story_table = $from_subprefix . 'items'; - break;*/ - } - - //trigger_error($from_table_arr[0], E_USER_WARNING); - } - } - } - - //------------------------------------------------------------------ - - $result = $xoopsDB->query("SELECT COUNT(*) FROM " . $xoopsDB->prefix($from_topic_table)); - list ($totalCat) = $xoopsDB->fetchRow($result); - - if ($totalCat == 0) { - echo "<span style=\"color: #567; margin: 3px 0 12px 0; font-size: small; display: block; \">" . _AM_XNI_IMPORT_NO_CATEGORY . "</span>"; - } else { - - $result = $xoopsDB->query("SELECT COUNT(*) FROM " . $xoopsDB->prefix($from_story_table)); - list ($totalArticles) = $xoopsDB->fetchRow($result); - - if ($totalArticles == 0) { - echo "<span style=\"color: #567; margin: 3px 0 12px 0; font-size: small; display: block; \">" . sprintf(_AM_XNI_IMPORT_MODULE_FOUND_NO_ITEMS, $from_import_dirname, $totalArticles) . "</span>"; - } else { - echo "<span style=\"color: #567; margin: 3px 0 12px 0; font-size: small; display: block; \">" . sprintf(_AM_XNI_IMPORT_MODULE_FOUND, $totalArticles, $totalCat, $from_import_dirname) . "</span>"; - - $form = new XoopsThemeForm(_AM_XNI_IMPORT_SETTINGS, 'import_form', XNI_MODULE_URL . "/admin/import.php"); - - $table_name = $from_topic_table; - $topiclist=new XoopsFormSelect(_AM_XNI_IMPORT_FROM_TOPICS, 'from_topics','',5,true); - $topics_arr=array(); - $xt = new xni_NewsTopic(); - $allTopics = $xt->getAllTopics($table_name, false); // The webmaster can see everything - $topic_tree = new XoopsObjectTree($allTopics, 'topic_id', 'topic_pid'); - $topics_arr = $topic_tree->getAllChild(0); - if(count($topics_arr)) { - foreach ($topics_arr as $onetopic) { - $topiclist->addOption($onetopic->topic_id(),$onetopic->topic_title()); - } - } - $topiclist->setDescription(_AM_XNI_IMPORT_FROM_TOPICS_DSC); - $form->addElement($topiclist, false); - - /*$to_table_name = $to_subprefix . 'topics'; - $to_topiclist=new XoopsFormSelect(_AM_XNI_IMPORT_TO_TOPICS, 'to_topic','',5,false); - $to_topics_arr=array(); - $to_xt = new xni_NewsTopic(); - $to_allTopics = $to_xt->getAllTopics($to_table_name, false); // The webmaster can see everything - $to_topic_tree = new XoopsObjectTree($to_allTopics, 'topic_id', 'topic_pid'); - $to_topics_arr = $to_topic_tree->getAllChild(0); - if(count($to_topics_arr)) { - foreach ($to_topics_arr as $to_onetopic) { - $to_topiclist->addOption($to_onetopic->topic_id(),$to_onetopic->topic_title()); - } - } - $to_topiclist->setDescription(_AM_XNI_IMPORT_TO_TOPICS_DSC); - $form->addElement($to_topiclist, false); - */ - $form->addElement (new XoopsFormHidden('importfromdirname', $from_import_dirname)); - $form->addElement (new XoopsFormHidden('importtodirname', $to_import_dirname)); - $form->addElement (new XoopsFormHidden('importfromsubprefix', $from_subprefix)); - $form->addElement (new XoopsFormHidden('importtosubprefix', $to_subprefix)); - - $form->addElement (new XoopsFormHidden('op', 'startimport')); - $form->addElement (new XoopsFormButton ('', 'import', _AM_XNI_IMPORT, 'submit')); - - $form->display(); - } - } -} - -function StartImport() -{ - global $xoopsDB, $xoopsConfig, $xoopsModule; - - if (isset($_POST['importfromdirname'])) - { - $from_module_dirname = $_POST['importfromdirname']; - $from_module_subprefix = $_POST['importfromsubprefix']; - $to_module_dirname = $_POST['importtodirname']; - $to_module_subprefix = $_POST['importtosubprefix']; - } - - $module_handler =& xoops_gethandler('module'); - $moduleObj = $module_handler->getByDirname($from_module_dirname); - $news_module_id = $moduleObj->getVar('mid'); - - $gperm_handler =& xoops_gethandler('groupperm'); - - $cnt_imported_cat = 0; - $cnt_imported_articles = 0; - $cnt_imported_comments = 0; - $cnt_imported_files = 0; - - // If none selected then import all topics - if (!isset($_POST['from_topics'])) - { - $resultCat = $xoopsDB->query("SELECT * FROM " . $xoopsDB->prefix($from_module_subprefix . "topics")); - include_once('importer.php'); - } - // Import selected topics - else - { - $ftpcs = $_POST['from_topics']; - $ftpcs = implode("', '", $ftpcs); - $resultCat = $xoopsDB->query("SELECT * FROM " . $xoopsDB->prefix($from_module_subprefix . "topics") . " WHERE topic_id IN ('".$ftpcs."')"); - include_once('importer.php'); - } -} - -$op = 'none'; - -if (isset($_GET['op'])) $op = $_GET['op']; -if (isset($_POST['op'])) $op = $_POST['op']; - -switch ($op) { - case "startimport": - StartImport(); - break; - case "topicselect": - TopicSelect(); - break; - case "import": - NewsImport(); - break; - case "default": - default: - NewsImport(); - break; -} -include "admin_footer.php"; -?> \ No newline at end of file Deleted: XoopsModules/xnews/trunk/timgno/xnews/admin/importer.php~ =================================================================== --- XoopsModules/xnews/trunk/timgno/xnews/admin/importer.php~ 2012-01-31 18:04:15 UTC (rev 8847) +++ XoopsModules/xnews/trunk/timgno/xnews/admin/importer.php~ 2012-01-31 18:19:00 UTC (rev 8848) @@ -1,238 +0,0 @@ -<?php -/** -* Module: xNews Import -* Author: DNPROSSI -* Licence: GNU -*/ - -//DELETE ALL DATA FROM DESTINATION TABLES -$resultDELETE=$xoopsDB->query("DELETE FROM " . $xoopsDB->prefix($to_module_subprefix . 'topics')); -$resultDELETE=$xoopsDB->query("DELETE FROM " . $xoopsDB->prefix($to_module_subprefix . 'stories')); -$resultDELETE=$xoopsDB->query("DELETE FROM " . $xoopsDB->prefix($to_module_subprefix . 'stories_files')); -$resultDELETE=$xoopsDB->query("DELETE FROM " . $xoopsDB->prefix($to_module_subprefix . 'stories_votedata')); -//RESET ALL TABLE AUTOINCREMENT VALUES -$resultALTER=$xoopsDB->query("ALTER TABLE " . $xoopsDB->prefix($to_module_subprefix . 'topics') . " AUTO_INCREMENT = 1"); -$resultALTER=$xoopsDB->query("ALTER TABLE " . $xoopsDB->prefix($to_module_subprefix . 'stories') . " AUTO_INCREMENT = 1"); -$resultALTER=$xoopsDB->query("ALTER TABLE " . $xoopsDB->prefix($to_module_subprefix . 'stories_files') . " AUTO_INCREMENT = 1"); -$resultALTER=$xoopsDB->query("ALTER TABLE " . $xoopsDB->prefix($to_module_subprefix . 'stories_votedata') . " AUTO_INCREMENT = 1"); - -$newArticleArray = array(); - -while ($arrCat = $xoopsDB->fetchArray($resultCat)) -{ - $topic = new xni_NewsTopic(0, $to_module_subprefix); - - $topic->topic_pid = $arrCat['topic_pid']; - $topic->topic_title = $arrCat['topic_title']; - $topic->topic_description = $arrCat['topic_description']; - $topic->menu = $arrCat['menu']; - $topic->topic_frontpage = $arrCat['topic_frontpage']; - $topic->topic_rssurl = $arrCat['topic_rssurl']; - $topic->topic_color = $arrCat['topic_color']; - //DNPROSSI - Added for version 1.69 - if ( isset($arrCat['topic_weight'] ) ) { $topic->topic_weight = $arrCat['topic_weigth']; } - - if ($from_module_dirname == 'news') - { - $sourcepath = XOOPS_ROOT_PATH . '/modules/'.$from_module_dirname.'/images/topics/'; - $destinationpath = XOOPS_ROOT_PATH . '/uploads/'.$to_module_dirname.'/topics/'; - } - else - { - $sourcepath = XOOPS_ROOT_PATH . '/uploads/'.$from_module_dirname.'/topics/'; - $destinationpath = XOOPS_ROOT_PATH . '/uploads/'.$to_module_dirname.'/topics/'; - } - - // Category image - if ( ($arrCat['topic_imgurl'] != 'blank.gif') && ($arrCat['topic_imgurl'] != '') ) - { - if ($arrCat['topic_imgurl'] == 'xoops.gif') - { - $topic->topic_imgurl = $arrCat['topic_imgurl']; - } - else - { - if ( copy($sourcepath . $arrCat['topic_imgurl'], $destinationpath . $arrCat['topic_imgurl']) ) - { - $topic->topic_imgurl = $arrCat['topic_imgurl']; - echo sprintf(_AM_XNI_IMPORTED_FILE, $topic->topic_imgurl()) . "<br />"; - $cnt_imported_files++; - } - } - } - - $idresult = $xoopsDB->query("SHOW TABLE STATUS LIKE '" . $xoopsDB->prefix($to_module_subprefix . 'topics') . "'"); - $row = $xoopsDB->fetchArray($idresult); - $auto_increment = $row['Auto_increment']; - - //trigger_error(intval($auto_increment -1) , E_USER_WARNING); - if (!$topic->store($topic)) - { - echo sprintf(_AM_XNI_IMPORT_CATEGORY_ERROR, $arrCat['topic_title']) . "<br/>"; - continue; - } - - // Saving topic permissions - if ($from_module_dirname == 'news') - { - $groupsIds = $gperm_handler->getGroupIds('news_approve', $arrCat['topic_id'], $news_module_id); - xni_savePermissions($to_module_dirname, $groupsIds, $topic->topic_id(), $to_module_subprefix . 'approve'); - $groupsIds = $gperm_handler->getGroupIds('news_view', $arrCat['topic_id'], $news_module_id); - xni_savePermissions($to_module_dirname, $groupsIds, $topic->topic_id(), $to_module_subprefix . 'view'); - $groupsIds = $gperm_handler->getGroupIds('news_submit', $arrCat['topic_id'], $news_module_id); - xni_savePermissions($to_module_dirname, $groupsIds, $topic->topic_id(), $to_module_subprefix . 'submit'); - // echo intval($topic->topic_id()) . '<br/>'; - } - else - { - $groupsIds = $gperm_handler->getGroupIds($from_module_subprefix . 'approve', $arrCat['topic_id'], $news_module_id); - xni_savePermissions($to_module_dirname, $groupsIds, $topic->topic_id(), $to_module_subprefix . 'approve'); - $groupsIds = $gperm_handler->getGroupIds($from_module_subprefix . 'view', $arrCat['topic_id'], $news_module_id); - xni_savePermissions($to_module_dirname, $groupsIds, $topic->topic_id(), $to_module_subprefix . 'view'); - $groupsIds = $gperm_handler->getGroupIds($from_module_subprefix . 'submit', $arrCat['topic_id'], $news_module_id); - xni_savePermissions($to_module_dirname, $groupsIds, $topic->topic_id(), $to_module_subprefix . 'submit'); - } - - $cnt_imported_cat++; - - echo sprintf(_AM_XNI_IMPORT_CATEGORY_SUCCESS, $topic->topic_title()); - - $sql = "SELECT * FROM " . $xoopsDB->prefix($from_module_subprefix . 'stories') . " WHERE topicid=" . $arrCat['topic_id']; - $resultArticles = $xoopsDB->query($sql); - while ($arrArticle = $xoopsDB->fetchArray($resultArticles)) - { - // Insert article - $story =new xni_NewsStory(-1, $to_module_subprefix); - - $story->uid = $arrArticle['uid']; - $story->title = $arrArticle['title']; - $story->created = $arrArticle['created']; - $story->published = $arrArticle['published']; - $story->expired = $arrArticle['expired']; - $story->hostname = $arrArticle['hostname']; - $story->nohtml = $arrArticle['nohtml']; - $story->nosmiley = $arrArticle['nosmiley']; - $story->hometext = $arrArticle['hometext']; - $story->bodytext = $arrArticle['bodytext']; - $story->keywords = $arrArticle['keywords']; //META - $story->description = $arrArticle['description']; //META - $story->counter = $arrArticle['counter']; - $story->topicid = $auto_increment; //$arrArticle['topicid']; - $story->ihome = $arrArticle['ihome']; - $story->notifypub = $arrArticle['notifypub']; - $story->story_type = $arrArticle['story_type']; - $story->topicdisplay = $arrArticle['topicdisplay']; - $story->topicalign = $arrArticle['topicalign']; - $story->comments = $arrArticle['comments']; - $story->rating = $arrArticle['rating']; - $story->votes = $arrArticle['votes']; - $story->picture = $arrArticle['picture']; - if ( isset($arrArticle['dobr']) ) { $story->dobr = $arrArticle['dobr']; } - if ( isset($arrArticle['tags']) ) { $story->tags = $arrArticle['tags']; } - - // Picture - if ( ($arrArticle['picture'] != '') ) - { - if ( copy($sourcepath . $arrArticle['picture'], $destinationpath . $arrArticle['picture']) ) - { - $story->picture = $arrArticle['picture']; - echo sprintf(_AM_XNI_IMPORTED_FILE, $story->picture()) . "<br />"; - $cnt_imported_files++; - } - } - - // Attached files - if ($from_module_dirname == 'news') - { - $attached_sourcepath = XOOPS_ROOT_PATH . '/uploads/'; - $attached_destinationpath = XOOPS_ROOT_PATH . '/uploads/'.$to_module_dirname.'/attached/'; - } - else - { - $attached_sourcepath = XOOPS_ROOT_PATH . '/uploads/'.$from_module_dirname.'/attached/'; - $attached_destinationpath = XOOPS_ROOT_PATH . '/uploads/'.$to_module_dirname.'/attached/'; - } - - $sql = "SELECT * FROM " . $xoopsDB->prefix($from_module_subprefix . 'stories_files') . " WHERE storyid=" . $arrArticle['storyid']; - $resultfiles = $xoopsDB->query($sql); - while ($arrFiles = $xoopsDB->fetchArray($resultfiles)) - { - $result = $xoopsDB->query("INSERT INTO " . $xoopsDB->prefix($to_module_subprefix . 'stories_files') . - " (file_realname, files_storyid, files_date, files_mimetype, files_downloadname, files_counter)" . - " VALUES ('" . $arrFiles['file_realname'] . "', '" . - $arrFiles['files_storyid'] . "', '" . - $arrFiles['files_date'] . "', '" . - $arrFiles['files_mimetype'] . "', '" . - $arrFiles['files_downloadname'] . "', '" . - $arrFiles['files_counter'] . "'); "); - if ( copy($attached_sourcepath . $arrFiles['files_downloadname'], $attached_destinationpath . $arrFiles['files_downloadname']) ) - { - echo sprintf(_AM_XNI_IMPORTED_FILE, $arrFiles['files_downloadname']) . "<br />"; - $cnt_imported_files++; - } - } - - // Vote Data - $sql = "SELECT * FROM " . $xoopsDB->prefix($from_module_subprefix . 'stories_votedata') . " WHERE storyid=" . $arrArticle['storyid']; - $resultvotes = $xoopsDB->query($sql); - while ($arrVotes = $xoopsDB->fetchArray($resultvotes)) - { - $result = $xoopsDB->query("INSERT INTO " . $xoopsDB->prefix($to_module_subprefix . 'stories_votedata') . - " (votedata_storyid, votedata_ratinguser, votedata_rating, votedata_ratinghostname, votedata_ratingtimestamp)" . - " VALUES ('" . $arrVotes['votedata_storyid'] . "', '" . - $arrVotes['votedata_ratinguser'] . "', '" . - $arrVotes['votedata_rating'] . "', '" . - $arrVotes['votedata_ratinghostname'] . "', '" . - $arrVotes['votedata_ratingtimestamp'] . "'); "); - } - - // Save story - $storyPublished = $arrArticle['published'] != 0 ? $story->setApproved(1) : $story->setApproved(0); - if ( !$story->store() ) - { - echo sprintf(" " . _AM_XNI_IMPORT_ARTICLE_ERROR, $arrArticle['title']) . "<br/>"; - continue; - } - else - { - $newArticleArray[$arrArticle['storyid']] = $story->storyid(); - echo sprintf(_AM_XNI_IMPORTED_ARTICLE, $story->title()) . "<br />"; - $cnt_imported_articles++; - } - } -} - -// Looping through the comments to link them to the new articles and module -//echo _AM_XNI_IMPORT_COMMENTS . "<br />"; -$module_handler =& xoops_gethandler('module'); -$moduleObj = $module_handler->getByDirname($to_module_dirname); -$module_id = $moduleObj->getVar('mid'); - -$comment_handler = xoops_gethandler('comment'); -$criteria = new CriteriaCompo(); -$criteria->add(new Criteria('com_modid', $news_module_id)); -$comments = $comment_handler->getObjects($criteria); -foreach ($comments as $comment) -{ - $comment->setVar('com_itemid', $newArticleArray[$comment->getVar('com_itemid')]); - $comment->setVar('com_modid', $module_id); - $comment->setNew(); - if (!$comment_handler->insert($comment)) - { - echo sprintf(_AM_XNI_IMPORTED_COMMENT_ERROR, $comment->getVar('com_title')) . "<br />"; - } - else - { - echo sprintf(_AM_XNI_IMPORTED_COMMENT, $comment->getVar('com_title')) . "<br />"; - $cnt_imported_comments++; - } -} - -echo "<br/><br/>Done.<br/>"; -echo sprintf(_AM_XNI_IMPORTED_CATEGORIES, $cnt_imported_cat) . "<br/>"; -echo sprintf(_AM_XNI_IMPORTED_ARTICLES, $cnt_imported_articles) . "<br/>"; -echo sprintf(_AM_XNI_IMPORTED_FILES, $cnt_imported_files) . "<br/>"; -echo sprintf(_AM_XNI_IMPORTED_COMMENTS, $cnt_imported_comments) . "<br/>"; -echo "<br/><a href='". XOOPS_URL . "/modules/" . $to_module_dirname ."/index.php'>" . _AM_XNI_IMPORT_GOTOMODULE . "</a><br/>"; - -?> Deleted: XoopsModules/xnews/trunk/timgno/xnews/admin/index.php~ =================================================================== --- XoopsModules/xnews/trunk/timgno/xnews/admin/index.php~ 2012-01-31 18:04:15 UTC (rev 8847) +++ XoopsModules/xnews/trunk/timgno/xnews/admin/index.php~ 2012-01-31 18:19:00 UTC (rev 8848) @@ -1,80 +0,0 @@ -<?php -/** - * **************************************************************************** - * - Original Copyright (TDM) - * - TDMCreate By TDM - TEAM DEV MODULE FOR XOOPS - * - Licence GPL Copyright (c) (http://www.tdmxoops.net) - * - Developers TEAM TDMCreate Xoops - (http://www.xoops.org) - * **************************************************************************** - * XNEWS - MODULE FOR XOOPS - * Copyright (c) 2007 - 2011 - * TXMod Xoops (http://www.txmodxoops.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. - * - * ------------------------------------------------------------------------ - * - * @copyright TXMod Xoops (http://www.txmodxoops.org) - * @license GPL see LICENSE - * @package xnews - * @author TXMod Xoops (in...@tx...) - * - * Version : 1.72 Tue 2011/12/13 22:29:36 : Timgno Exp $ - * **************************************************************************** - */ - -include "admin_header.php"; -xoops_cp_header(); - - $indexAdmin = new ModuleAdmin(); - - //compte "total" - $count_stories = $storiesHandler->getCount(); - //compte "attente" - $criteria = new CriteriaCompo(); - $criteria->add(new Criteria("stories_online", 1)); - $stories_online = $storiesHandler->getCount($criteria); - - //compte "total" - $count_topics = $topicsHandler->getCount(); - //compte "attente" - $criteria = new CriteriaCompo(); - $criteria->add(new Criteria("topics_online", 1)); - $topics_online = $topicsHandler->getCount($criteria); - - $clr_count_stories = ($count_stories == 0) ? 'red': 'green'; - $clr_count_topics = ($count_topics == 0) ? 'red': 'green'; - $clr_online_stories = ($stories_online == 0) ? 'red': 'green'; - $clr_online_topics = ($topics_online == 0) ? 'red': 'green'; - //$clr_imported_topics = ($imported_online == 0) ? 'red': 'green'; - //$clr_imported_stories = ($imported_online == 0) ? 'red': 'green'; - //$clr_exported_stories = ($exported_online == 0) ? 'red': 'green'; - - $indexAdmin->addInfoBox(_AM_XNEWS_STATISTICS); - $indexAdmin->addInfoBoxLine(_AM_XNEWS_STATISTICS,_AM_XNEWS_THEREARE_TOPICS, $count_topics, $clr_count_topics); - $indexAdmin->a... [truncated message content] |