Here is a way to clone the news 1.44 module
1. upload the news 1.44 modules to your modules directory
2. Save the code below as clone.php and upload it into your XOOPS root...in this example it will clone the news module to a new module that i named as blog...
/*
Usage:
Copy clone.php in
Change current working directory to
Update mappings as per new modulename.
php -q clone.php
*/
// ##########################################################
// Define your mapping here
// ##########################################################
$patterns = array(
// first one must be module directory name
'news' => 'blog',
'NEWS' => 'BLOG',
'stories' => 'blogs',
'stories_files' => 'blogs_files',
'topics' => 'topicblogs',
'article' =>'blogitem',
'storyid' => 'blogid',
'stories_votedata' => 'blog_votedata',
'getmoduleoption' => 'getmoduleoption2',
'_MI_STORYHOME' => '_MI_STORYHOME2',
'_MI_NOTIFYSUBMIT' => '_MI_NOTIFYSUBMIT12',
'_MI_DISPLAYNAV' => '_MI_DISPLAYNAV12',
'_MI_AUTOAPPROVE' => '_MI_AUTOAPPROVE2',
'_MI_ALLOWEDSUBMITGROUPS' => '_MI_ALLOWEDSUBMITGROUPS2',
'_MI_ALLOWEDAPPROVEGROUPS' => '_MI_ALLOWEDAPPROVEGROUPS2',
'_MI_NAMEDISPLAY' => '_MI_NAMEDISPLAY2',
'_MI_COLUMNMODE' => '_MI_COLUMNMODE2',
'_MI_STORYCOUNTADMIN' => '_MI_STORYCOUNTADMIN2',
'_MI_UPLOADFILESIZE' => '_MI_UPLOADFILESIZE2',
'_MI_UPLOADGROUPS' => '_MI_UPLOADGROUPS2',
'_MI_STORYHOMEDSC' => '_MI_STORYHOMEDSC2',
'_MI_NOTIFYSUBMITDSC' => '_MI_NOTIFYSUBMITDSC2',
'_MI_DISPLAYNAVDSC' => '_MI_DISPLAYNAVDSC2',
'_MI_AUTOAPPROVEDSC' => '_MI_AUTOAPPROVEDSC2',
'_MI_ALLOWEDSUBMITGROUPSDESC' => '_MI_ALLOWEDSUBMITGROUPSDESC12',
'_MI_ALLOWEDAPPROVEGROUPSDESC' => '_MI_ALLOWEDAPPROVEGROUPSDESC2',
'_MI_ADISPLAYNAMEDSC' => '_MI_ADISPLAYNAMEDSC2',
'_MI_COLUMNMODE_DESC' => '_MI_COLUMNMODE_DESC2',
'_MI_STORYCOUNTADMIN_DESC' => '_MI_STORYCOUNTADMIN_DESC2',
'_MI_UPLOADFILESIZE_DESC' => '_MI_UPLOADFILESIZE_DESC2',
'_MI_UPLOADGROUPS_DESC' => '_MI_UPLOADGROUPS_DESC2',
'_MI_DISPLAYNAME1' => '_MI_DISPLAYNAME12',
'_MI_DISPLAYNAME2' => '_MI_DISPLAYNAME22',
'_MI_DISPLAYNAME3' => '_MI_DISPLAYNAME32' ,
'_MI_UPLOAD_GROUP1' => '_MI_UPLOAD_GROUP12',
'_MI_UPLOAD_GROUP2' => '_MI_UPLOAD_GROUP22',
'_MI_UPLOAD_GROUP3' => '_MI_UPLOAD_GROUP32',
'_MI_NEWS_GLOBAL_NOTIFY' => '_MI_NEWS_GLOBAL_NOTIFY2',
'_MI_NEWS_GLOBAL_NOTIFYDSC' => '_MI_NEWS_GLOBAL_NOTIFYDSC2',
'_MI_RESTRICTINDEX' => 'MI_RESTRICTINDEX2',
'_MI_RESTRICTINDEXDSC' => '_MI_RESTRICTINDEXDSC2',
'MygetItemIds' => 'MygetItemIds2',
'CreateSiteNavBar' => 'CreateSiteNavBar2',
'_MB_POSTER' => '_MB_POSTER2',
'updateCache' => 'updateCache2',
'TableExists' => 'TableExists2',
'AddField' => 'AddField2',
'FieldExistsAddField' => 'FieldExistsAddField2',
'is_admin_group' => 'is_admin_group2',
'make_infotips' => 'make_infotips2',
'FieldExists' => 'FieldExists2',
);
$patKeys = array_keys($patterns);
$patValues = array_values($patterns);
// work around for PHP < 5.0.x
if(!function_exists('file_put_contents')) {
function file_put_contents($filename, $data, $file_append = false) {
$fp = fopen($filename, (!$file_append ? 'w+' : 'a+'));
if(!$fp) {
trigger_error('file_put_contents cannot write in file.', E_USER_ERROR);
return;
}
fputs($fp, $data);
fclose($fp);
}
}
// recursive clonning script
function cloneFileFolder($path)
{
global $patKeys;
global $patValues;
$newPath = str_replace($patKeys[0], $patValues[0], $path);
if (is_dir($path))
{
// create new dir
mkdir($newPath);
// check all files in dir, and process it
if ($handle = opendir($path))
{
while ($file = readdir($handle))
{
if ($file != '.' && $file != '..')
{
cloneFileFolder("$path/$file");
}
}
closedir($handle);
}
}
else
{
if(preg_match('/(.jpg|.gif|.png|.zip)$/i', $path))
{
copy($path, $newPath);
}
else
{
// file, read it
$content = file_get_contents($path);
$content = str_replace($patKeys, $patValues, $content);
file_put_contents($newPath, $content);
}
}
}
cloneFileFolder('modules/news');
echo "Happy cloning...n";
echo "check directory modules/" . $patterns['smartsection'] . " for cloned module n";
echo "Consider modifying new module by editing language/english/modinfo.php and images/news_slogo.png manually (if you care)n";
?>
** the code above is originally from SmartFactory's smartsection modules zip file..i modify it a bit **
u can change the name of the clone module to anything...as long u follow the caps rule..example - if u want the name of the clone module to be mynews...find
'news' => 'blog',
'NEWS' => 'BLOG',
'stories' => 'blogs',
'stories_files' => 'blogs_files',
'topics' => 'topicblogs',
'article' =>'blogitem',
'storyid' => 'blogid',
'stories_votedata' => 'blog_votedata',
and replace it with these
'news' => 'mynews',
'NEWS' => 'MYNEWS',
'stories' => 'mynewsstories',
'stories_files' => 'news_files',
'topics' => 'topicnews',
'article' =>'newsitem',
'storyid' => 'newsid',
'stories_votedata' => 'news_votedata',
don't change other part of the code..
3. run the code .. XOOPS root/clone.php ...example
http://www.yoursite.com/clone.php3. Install the new cloned module, edit the language/english/modinfo.php and images/news_slogo.png
4. update clone module
5. enjoy..
so far i don't have any problem using the clone module and news 1.44 at the same time in my site
Ok Good luck