|
From: <ada...@us...> - 2003-07-09 20:24:29
|
Update of /cvsroot/phpwebsite-comm/modules/article/inc
In directory sc8-pr-cvs1:/tmp/cvs-serv30555/inc
Added Files:
editconfig.php importANN.php importPM.php saveconfig.php
Log Message:
Initial commit to CVS
--- NEW FILE: editconfig.php ---
<?php
/**
* This is the configuration editing file for the article module.
*
* Edits the module's default settings.
*
* @author Eloi George <el...@NO...>
* @module Article Manager
* @param none
* @return none
*/
/* Section Headers */
$tags['GEN_HEADER'] = $_SESSION['translate']->it('General Settings');
$tags['ARTICLE_HEADER'] = $_SESSION['translate']->it('Article Settings');
$tags['USERS_HEADER'] = $_SESSION['translate']->it('User Settings');
$tags['IMAGE_HEADER'] = $_SESSION['translate']->it('Image Settings');
/* Get the Default Page Template */
$article_tpl_array = $GLOBALS['core']->listTemplates('article',true,'article');
if (is_array($article_tpl_array))
{
/* Sort the list */
asort($article_tpl_array);
$tags['DEFAULT_ARTICLE_TEMPLATE'] =
$GLOBALS['core']->formSelect('CONFIG_default_article_template', $article_tpl_array, $this->val['default_article_template'], true, NULL, NULL)
. ' ' . $_SESSION['translate']->it('Default page template')
. $_SESSION['OBJ_help']->show_link('article', 'article_template');
}
/* Get the Default Section Template */
$sect_tpl_array = $GLOBALS['core']->listTemplates('article',false,'section');
if (is_array($sect_tpl_array))
{
/* Strip the extensions off for readability */
$sect_tpl_array = str_replace('.tpl', NULL, $sect_tpl_array);
/* Sort the list */
asort($sect_tpl_array);
$tags['DEFAULT_SECTION_TEMPLATE'] =
$GLOBALS['core']->formSelect('CONFIG_default_section_template', $sect_tpl_array, $this->val['default_section_template'], true, NULL, NULL)
. ' ' . $_SESSION['translate']->it('Default section template')
. $_SESSION['OBJ_help']->show_link('article', 'section_template');
}
/* summaries_on_homepage */
$tags['SUMMARIES_ON_HOMEPAGE'] =
$GLOBALS['core']->formSelect('CONFIG_summaries_on_homepage', range(0,50)
, $this->val['summaries_on_homepage'], NULL, NULL, NULL)
. ' ' . $_SESSION['translate']->it('Number of summaries to show on the Home Page')
. $_SESSION['OBJ_help']->show_link('article', 'summaries_on_homepage');
/* popular_articles */
$tags['POPULAR_ARTICLES'] =
$GLOBALS['core']->formSelect('CONFIG_popular_articles', range(0,50)
, $this->val['popular_articles'], NULL, NULL, NULL)
. ' ' . $_SESSION['translate']->it('Number of links in the "Popular Articles" Block')
. $_SESSION['OBJ_help']->show_link('article', 'popular_articles');
/* prev_n_articles */
$tags['PREV_N_ARTICLES'] =
$GLOBALS['core']->formSelect('CONFIG_prev_n_articles', range(0,50)
, $this->val['prev_n_articles'], NULL, NULL, NULL)
. ' ' . $_SESSION['translate']->it('Number of links in the "Previous Articles" Block')
. $_SESSION['OBJ_help']->show_link('article', 'prev_n_articles');
/* listings_per_page */
$tags['LISTINGS_PER_PAGE'] =
$GLOBALS['core']->formSelect('CONFIG_listings_per_page', range(0,50)
, $this->val['listings_per_page'], NULL, NULL, NULL)
. ' ' . $_SESSION['translate']->it('Number of listings to show per page under the Main Menu')
. $_SESSION['OBJ_help']->show_link('article', 'listings_per_page');
/* need_approval */
$tags['NEED_APPROVAL'] =
$GLOBALS['core']->formCheckBox('CONFIG_need_approval',1,$this->val['need_approval'],NULL
,$_SESSION['translate']->it('Articles need approval before publication'))
. $_SESSION['OBJ_help']->show_link('configmanager', 'need_approval');
/* default_allow_comments */
$tags['DEFAULT_ALLOW_COMMENTS'] = $GLOBALS['core']->formCheckBox('CONFIG_default_allow_comments',1
,$this->val['default_allow_comments'],NULL
,$_SESSION['translate']->it('Comments are allowed by default'))
. $_SESSION['OBJ_help']->show_link('configmanager', 'default_allow_comments');
/* default_allow_anon */
$tags['DEFAULT_ALLOW_ANON'] = $GLOBALS['core']->formCheckBox('CONFIG_default_allow_anon',1
,$this->val['default_allow_anon'],NULL
,$_SESSION['translate']->it('Comments by unregistered users are allowed by default'))
. $_SESSION['OBJ_help']->show_link('configmanager', 'default_allow_anon');
$tags['USERS_LABEL'] = $_SESSION['translate']->it('Registered users can');
/* users_can_submit */
$tags['USERS_CAN_SUBMIT'] = $GLOBALS['core']->formCheckBox('CONFIG_users_can_submit',1
,$this->val['users_can_submit'],NULL
,$_SESSION['translate']->it('Submit articles'))
. $_SESSION['OBJ_help']->show_link('configmanager', 'users_can_submit');
/* users_select_article_tpl */
$tags['USERS_SELECT_ARTICLE_TPL'] = $GLOBALS['core']->formCheckBox('CONFIG_users_select_article_tpl',1
,$this->val['users_select_article_tpl'],NULL
,$_SESSION['translate']->it('Select article templates'))
. $_SESSION['OBJ_help']->show_link('configmanager', 'users_select_article_tpl');
/* users_select_section_tpl */
$tags['USERS_SELECT_SECTION_TPL'] = $GLOBALS['core']->formCheckBox('CONFIG_users_select_section_tpl',1
,$this->val['users_select_section_tpl'],NULL
,$_SESSION['translate']->it('Select section templates'))
. $_SESSION['OBJ_help']->show_link('configmanager', 'users_select_section_tpl');
/* users_allow_comments */
$tags['USERS_ALLOW_COMMENTS'] = $GLOBALS['core']->formCheckBox('CONFIG_users_allow_comments',1
,$this->val['users_allow_comments'],NULL
,$_SESSION['translate']->it('Allow/Disallow comments'))
. $_SESSION['OBJ_help']->show_link('configmanager', 'users_allow_comments');
/* users_change_dates */
$tags['USERS_CHANGE_DATES'] = $GLOBALS['core']->formCheckBox('CONFIG_users_change_dates',1
,$this->val['users_change_dates'],NULL
,$_SESSION['translate']->it('Set Publication Dates'))
. $_SESSION['OBJ_help']->show_link('configmanager', 'users_change_dates');
/* user_images_in_article */
$tags['USER_IMAGES_IN_ARTICLE'] = $GLOBALS['core']->formCheckBox('CONFIG_user_images_in_article',1
,$this->val['user_images_in_article'],NULL
,$_SESSION['translate']->it('Place images in articles'))
. $_SESSION['OBJ_help']->show_link('configmanager', 'user_images_in_article');
/* user_upload_images */
$tags['USER_UPLOAD_IMAGES'] = $GLOBALS['core']->formCheckBox('CONFIG_user_upload_images',1
,$this->val['user_upload_images'],NULL
,$_SESSION['translate']->it('Upload images to the site'))
. $_SESSION['OBJ_help']->show_link('configmanager', 'user_upload_images');
/* can_expire */
$tags['CAN_EXPIRE'] = $GLOBALS['core']->formCheckBox('CONFIG_can_expire',1
,$this->val['can_expire'],NULL
,$_SESSION['translate']->it('Articles can expire on a predefined date'))
. $_SESSION['OBJ_help']->show_link('configmanager', 'can_expire');
/* expiration_years */
/* expiration_months */
/* expiration_days */
$tags['EXPIRATION_LABEL'] = $_SESSION['translate']->it('The default expiration date is [var1] years, [var2] months, and [var3] days from article creation.'
, $GLOBALS['core']->formSelect('CONFIG_expiration_years', range(0,5), $this->val['expiration_years'], NULL, NULL, NULL)
, $GLOBALS['core']->formSelect('CONFIG_expiration_months', range(0,11), $this->val['expiration_months'], NULL, NULL, NULL)
, $GLOBALS['core']->formSelect('CONFIG_expiration_days', range(0,31), $this->val['expiration_days'], NULL, NULL, NULL))
. $_SESSION['OBJ_help']->show_link('article', 'expiration_default');
/* default_year_count*/
$tags['DEFAULT_YEAR_COUNT'] = $_SESSION['translate']->it('Publication dates can be set up to [var1] year(s) from article creation.'
, $GLOBALS['core']->formSelect('CONFIG_default_year_count', range(1,5)
, $this->val['default_year_count'], NULL, NULL, NULL) )
. $_SESSION['OBJ_help']->show_link('article', 'default_year_count');
/* max_image_size */
$tags['MAX_IMAGE_SIZE'] = $_SESSION['translate']->it('The maximum uploaded image [var1] allowed is [var2] Kb'
, 'filesize'
, $GLOBALS['core']->formTextField('CONFIG_max_image_size'
, $this->val['max_image_size'], 4, 4))
. $_SESSION['OBJ_help']->show_link('article', 'max_image_size');
/* max_image_height */
$tags['MAX_IMAGE_HEIGHT'] = $_SESSION['translate']->it('The maximum uploaded image [var1] allowed is [var2] pixels'
, 'height'
, $GLOBALS['core']->formTextField('CONFIG_max_image_height'
, $this->val['max_image_height'], 4, 4))
. $_SESSION['OBJ_help']->show_link('article', 'max_image_height');
/* max_image_width */
$tags['MAX_IMAGE_WIDTH'] = $_SESSION['translate']->it('The maximum uploaded image [var1] allowed is [var2] pixels'
, 'width'
, $GLOBALS['core']->formTextField('CONFIG_max_image_width'
, $this->val['max_image_width'], 4, 4))
. $_SESSION['OBJ_help']->show_link('article', 'max_image_width');
/* restricted_viewing */
$tags['RESTRICTED_VIEWING'] = $GLOBALS['core']->formCheckBox('CONFIG_restricted_viewing',1
,$this->val['restricted_viewing'],NULL
,$_SESSION['translate']->it('Users can only see articles that belong to a group that they are members of'))
. $_SESSION['OBJ_help']->show_link('configmanager', 'restricted_viewing');
/* lock_expiration_time */
$tags['LOCK_EXPIRATION_TIME'] = $_SESSION['translate']->it('The maximum time someone can spend editing an article is [var1] seconds'
,$GLOBALS['core']->formTextField('CONFIG_lock_expiration_time'
, $this->val['lock_expiration_time'], 4, 4))
. $_SESSION['OBJ_help']->show_link('article', 'lock_expiration_time');
/* make_metatags */
$tags['MAKE_METATAGS'] = $GLOBALS['core']->formCheckBox('CONFIG_make_metatags',1
,$this->val['make_metatags'],NULL
,$_SESSION['translate']->it('Let Article Manager automatically generate meta descriptions'))
. $_SESSION['OBJ_help']->show_link('configmanager', 'make_metatags');
$tags['SAVE'] = $GLOBALS['core']->formSubmit($_SESSION['translate']->it('Save Settings'), 'ARTICLE_vars[config:save]')
. $_SESSION['OBJ_help']->show_link('article', 'config_save');
$tags['RESET'] = $GLOBALS['core']->formSubmit($_SESSION['translate']->it('Reset Settings'), 'ARTICLE_vars[config:reset]')
. $_SESSION['OBJ_help']->show_link('article', 'config_save');
$content[0] = $GLOBALS['core']->processTemplate($tags,'article','config.tpl');
$content[0] .= $GLOBALS['core']->formHidden('module', 'article');
$title = $_SESSION['translate']->it('Article Manager Configuration');
$content = $GLOBALS['core']->makeForm('ART_config', 'index.php', $content, 'post', 0, TRUE);
$_SESSION['OBJ_layout']->popbox($title, $content, NULL, 'CNT_article');
?>
--- NEW FILE: importANN.php ---
<?php
/* Security Check **********************************/
if(!$_SESSION['OBJ_user']->isDeity())
exit();
/***************************************************/
/* Include announce classes */
require_once(PHPWS_SOURCE_DIR . 'mod/announce/class/Announcement.php');
$ArticleM_path = PHPWS_HOME_DIR . 'images/article/ANN/';
$ANNOUNCE_path = PHPWS_HOME_DIR . 'images/announce/';
/* If you require your announcements to look different than your articles,
* define a default announcement template here.
* Make sure it does not have the ".tpl" extension.
* ex: $DefaultPageTemplate = "Announcement";
*/
$DefaultArticleTemplate = NULL;
$DefaultSectionTemplate = NULL;
/* Get all the pages from old database */
$page_result = $GLOBALS['core']->getAll('SELECT id FROM mod_announce ORDER BY dateUpdated', true);
/* Check to see if any pages were found */
if(!$page_result)
{
echo 'No Announcements were found for conversion!<br />';
return;
}
foreach($page_result as $value)
{
/* Create an old page object to store data temporarily */
$old_ann = new PHPWS_Announcement($value['id']);
/* Create a new page object to transfer old data into */
$_SESSION['SES_ART_article'] = new PHPWS_Article;
/* Assign directly transferable data to class variables */
$_SESSION['SES_ART_article']->title = $old_ann->_subject;
$_SESSION['SES_ART_article']->created_username = $old_ann->_userCreated;
$_SESSION['SES_ART_article']->updated_username = $old_ann->_userUpdated;
$_SESSION['SES_ART_article']->created_date = $old_ann->_dateCreated;
$_SESSION['SES_ART_article']->updated_date = $old_ann->_dateUpdated;
$_SESSION['SES_ART_article']->summary = $old_ann->_summary;
$_SESSION['SES_ART_article']->allow_comments = $old_ann->_comments;
$_SESSION['SES_ART_article']->allow_anonymous = $old_ann->_anonymous;
$_SESSION['SES_ART_article']->hits = $old_ann->_hits;
$_SESSION['SES_ART_article']->expiration_date = $old_ann->_expiration;
$_SESSION['SES_ART_article']->publication_date = ($old_ann->_active)?$old_ann->_dateCreated :$old_ann->_expiration;
$_SESSION['SES_ART_article']->approved = $old_ann->_approved;
/* Set up page template if necessary */
if ($DefaultArticleTemplate)
$_SESSION['SES_ART_article']->template = $DefaultArticleTemplate;
/* Create a new section to transfer old data into */
$current_section = new PHPWS_Article_Section;
if ($old_ann->_body)
$current_section->text = $old_ann->_body;
if ($DefaultSectionTemplate)
$current_section->template = $DefaultSectionTemplate;
/* Image Data Conversion */
if($old_ann->_image && is_file($ANNOUNCE_path.$old_ann->_image['name']))
{
$current_section->image = $old_ann->_image; /* name, width, height & alt */
$current_section->image['directory'] = 'ANN/';
$current_section->image['link'] = $current_section->image['caption'] = '';
/* Image file copy */
$GLOBALS['core']->fileCopy($ANNOUNCE_path . $current_section->image['name']
, $ArticleM_path, $current_section->image['name'], 1, 1);
}
/* Add the section to the page */
$current_section->changed = true;
$_SESSION['SES_ART_article']->sections[$current_section->id] = $current_section;
$_SESSION['SES_ART_article']->order[] = $current_section->id;
/* Save final page structure into database */
$_SESSION['SES_ART_article']->save();
/* Setup page id array for menu conversion use */
$page_ids[$value['id']] = $_SESSION['SES_ART_article']->id;
}// END PAGE LOOP
/* Convert Comments */
$page_result = $GLOBALS['core']->getAll('SELECT cid,itemId FROM mod_comments_data WHERE module="announce"', true);
if($page_result)
foreach($page_result as $value)
{
$newid = $page_ids[$value['itemId']];
$GLOBALS['core']->query('UPDATE mod_comments_data SET module="article",itemId='.$newid.' WHERE cid='.$value['cid'], true);
}
/* Convert Menu */
$page_result = $GLOBALS['core']->getAll('SELECT menu_item_id,menu_item_url FROM mod_menuman_items WHERE menu_item_url LIKE "%ANN_user_op=view%"', true);
if($page_result)
foreach($page_result as $value)
{
$newid = $page_ids[(int)substr(strrchr($value['menu_item_url'], '='), 1)];
$GLOBALS['core']->query('UPDATE mod_menuman_items SET menu_item_url="./index.php?module=article&ART=view:'.$newid.'" WHERE menu_item_id='.$value['menu_item_id'], true);
}
/* Convert FatCat */
$page_result = $GLOBALS['core']->getAll('SELECT element_id,module_id FROM mod_fatcat_elements WHERE module_title="announce"', true);
if($page_result)
foreach($page_result as $value)
{
$newid = $page_ids[$value['module_id']];
$GLOBALS['core']->query('UPDATE mod_fatcat_elements SET module_title="article",module_id='.$newid.',link="index.php?module=article&view='.$newid.'" WHERE element_id='.$value['element_id'], true);
}
/* Convert Approval */
$page_result = $GLOBALS['core']->getAll('SELECT id,mod_title,mod_id FROM mod_approval_jobs WHERE mod_title="announce"', true);
if($page_result)
foreach($page_result as $value)
{
$newid = $page_ids[$value['mod_id']];
$GLOBALS['core']->query('UPDATE mod_approval_jobs SET mod_title="article",mod_id=$newid WHERE id='.$value['id'], true);
}
/* Write routing map to disk (taken from function writeReroute in convert/db.php */
$directory = PHPWS_HOME_DIR . 'convert/reroute/';
if (!is_dir($directory) || !is_writable($directory))
{
echo 'Unable to create reroute file in convert/reroute directory.';
return;
}
else
{
$file = "<?php \n";
foreach ($page_ids as $oldID=>$newID)
$file .= "\$convert['". $oldID . "'] = ". $newID . ";\n";
$file .= "\n?>";
$GLOBALS['core']->writeFile($directory.'/announce.AM', $file, TRUE, TRUE);
}
echo "<h3>Announcements Conversion Complete!</h3>";
?>
--- NEW FILE: importPM.php ---
<?php
/* Security Check **********************************/
if(!$_SESSION['OBJ_user']->isDeity())
exit();
/***************************************************/
/* Include pagemaster classes */
require_once(PHPWS_SOURCE_DIR . 'mod/pagemaster/class/Page.php');
require_once(PHPWS_SOURCE_DIR . 'mod/pagemaster/class/Section.php');
$ArticleM_path = PHPWS_HOME_DIR . 'images/article/PM/';
include(PHPWS_SOURCE_DIR . 'mod/pagemaster/conf/config.php');
$PageM_path = PHPWS_HOME_DIR . $image_directory;
/* Get all the pages from old database */
$page_result = $GLOBALS['core']->getAll('SELECT id FROM mod_pagemaster_pages ORDER BY updated_date', true);
/* Check to see if any pages were found */
if(!$page_result)
{
echo count($page_result).'No PageMaster pages were found for conversion!<br />';
return;
}
foreach($page_result as $value)
{
/* Create an old page object to store data temporarily */
$old_page = new PHPWS_Page($value['id']);
/* Create a new page object to transfer old data into */
$_SESSION['SES_ART_article'] = new PHPWS_Article;
/* Assign directly transferable data to class variables */
$_SESSION['SES_ART_article']->title = $old_page->title;
$_SESSION['SES_ART_article']->mainarticle = $old_page->mainpage;
$_SESSION['SES_ART_article']->created_username = $old_page->created_username;
$_SESSION['SES_ART_article']->updated_username = $old_page->updated_username;
$_SESSION['SES_ART_article']->created_date = $old_page->created_date;
$_SESSION['SES_ART_article']->updated_date = $old_page->updated_date;
if ($old_page->active)
$_SESSION['SES_ART_article']->publication_date = $old_page->created_date;
else
$_SESSION['SES_ART_article']->publication_date = $_SESSION['SES_ART_article']->expiration_date;
$_SESSION['SES_ART_article']->approved = $old_page->approved;
/* Loop through & convert all sections */
foreach($old_page->order as $x)
{
/* Check to see if this section was empty or not */
if(!$old_page->sections[$x]->title && !$old_page->sections[$x]->text && !$old_page->sections[$x]->image)
continue;
else
{
/* Create a new section to transfer old data into */
$current_section = new PHPWS_Article_Section;
if ($old_page->sections[$x]->title)
$current_section->title = $old_page->sections[$x]->title;
if ($old_page->sections[$x]->text)
$current_section->text = $old_page->sections[$x]->text;
if ($old_page->sections[$x]->template=='image_center.tpl')
$current_section->template = 'Centered Image';
elseif ($old_page->sections[$x]->template=='image_left.tpl')
$current_section->template = 'Image Block Left';
elseif ($old_page->sections[$x]->template=='image_right.tpl')
$current_section->template = 'Image Block Right';
elseif ($old_page->sections[$x]->template=='subtitle_and_text.tpl')
$current_section->template = 'No Image';
elseif ($old_page->sections[$x]->template=='text_only.tpl')
$current_section->template = 'Text Only';
elseif ($old_page->sections[$x]->template=='date_info_and_print.tpl')
$_SESSION['SES_ART_article']->template = 'Dated';
elseif ($old_page->sections[$x]->template=='default.tpl')
$current_section->template = 'Centered Image';
else
$current_section->template = str_replace(".tpl", "", $old_page->sections[$x]->template);
/* Image Data Conversion */
if($old_page->sections[$x]->image && is_file($PageM_path.$old_page->sections[$x]->image['name']))
{
$current_section->image = $old_page->sections[$x]->image; /* name, width, height & alt */
$current_section->image['directory'] = 'PM/';
$current_section->image['link'] = $current_section->image['caption'] = '';
/* Image file copy */
$GLOBALS['core']->fileCopy($PageM_path . $current_section->image['name']
, $ArticleM_path, $current_section->image['name'], 1, 1);
}
/* Add the section to the page */
$current_section->changed = true;
$_SESSION['SES_ART_article']->sections[$current_section->id] = $current_section;
$_SESSION['SES_ART_article']->order[] = $current_section->id;
}
}// END SECTION LOOP
/* Save final page structure into database */
$_SESSION['SES_ART_article']->save();
/* Setup page id array for menu conversion use */
$page_ids[$value['id']] = $_SESSION['SES_ART_article']->id;
}// END PAGE LOOP
/* Convert Comments */
$page_result = $GLOBALS['core']->getAll('SELECT cid,itemId FROM mod_comments_data WHERE module="pagemaster"', true);
if($page_result)
foreach($page_result as $value)
{
$newid = $page_ids[$value['itemId']];
$GLOBALS['core']->query('UPDATE mod_comments_data SET module="article",itemId='.$newid.' WHERE cid='.$value['cid'], true);
}
/* Convert Menu */
$page_result = $GLOBALS['core']->getAll('SELECT menu_item_id,menu_item_url FROM mod_menuman_items WHERE menu_item_url LIKE "%PAGE_user_op=view_page%"', true);
if($page_result)
foreach($page_result as $value)
{
$newid = $page_ids[substr(strrchr($value['menu_item_url'], '='), 1)];
if (is_numeric($newid))
$GLOBALS['core']->query('UPDATE mod_menuman_items SET menu_item_url="./index.php?module=article&view='.$newid.'" WHERE menu_item_id='.$value['menu_item_id'], true);
}
/* Convert FatCat */
$page_result = $GLOBALS['core']->getAll('SELECT element_id,module_id FROM mod_fatcat_elements WHERE module_title="pagemaster"', true);
if($page_result)
foreach($page_result as $value)
{
$newid = $page_ids[$value['module_id']];
$GLOBALS['core']->query('UPDATE mod_fatcat_elements SET module_title="article",module_id='.$newid.',link="index.php?module=article&view='.$newid.'" WHERE element_id='.$value['element_id'], true);
}
/* Convert Approval */
$page_result = $GLOBALS['core']->getAll('SELECT id,mod_title,mod_id FROM mod_approval_jobs WHERE mod_title="pagemaster"', true);
if($page_result)
foreach($page_result as $value)
{
$newid = $page_ids[$value['mod_id']];
$GLOBALS['core']->query('UPDATE mod_approval_jobs SET mod_title="article",mod_id='.$newid.' WHERE id='.$value['id'], true);
}
/* Write routing map to disk (taken from function writeReroute in convert/db.php */
$directory = PHPWS_HOME_DIR . 'convert/reroute/';
if (!is_dir($directory) || !is_writable($directory))
{
echo 'Unable to create reroute file in convert/reroute directory.';
return;
}
else
{
$file = "<?php \n";
foreach ($page_ids as $oldID=>$newID)
$file .= "\$convert['". $oldID . "'] = ". $newID . ";\n";
$file .= "\n?>";
$GLOBALS['core']->writeFile($directory.'/pagemaster.AM', $file, TRUE, TRUE);
}
echo '<h3>PageMaster Conversion Complete!</h3>';
?>
--- NEW FILE: saveconfig.php ---
<?php
/**
* This is the configuration save file for the article module.
*
* Saves the module's new default settings.
*
* @author Eloi George <el...@NO...>
* @module Article Manager
* @param none
* @return none
*/
$query_data['default_article_template'] = $_POST['CONFIG_default_article_template'];
$query_data['default_section_template'] = $_POST['CONFIG_default_section_template'];
$query_data['summaries_on_homepage'] = $_POST['CONFIG_summaries_on_homepage'];
$query_data['prev_n_articles'] = $_POST['CONFIG_prev_n_articles'];
$query_data['popular_articles'] = $_POST['CONFIG_popular_articles'];
$query_data['listings_per_page'] = $_POST['CONFIG_listings_per_page'];
$query_data['need_approval'] = ($_POST['CONFIG_need_approval'])?1:0;
$query_data['default_allow_comments'] = ($_POST['CONFIG_default_allow_comments'])?1:0;
$query_data['default_allow_anon'] = ($_POST['CONFIG_default_allow_anon'])?1:0;
$query_data['users_can_submit'] = ($_POST['CONFIG_users_can_submit'])?1:0;
$query_data['users_select_article_tpl'] = ($_POST['CONFIG_users_select_article_tpl'])?1:0;
$query_data['users_select_section_tpl'] = ($_POST['CONFIG_users_select_section_tpl'])?1:0;
$query_data['users_allow_comments'] = ($_POST['CONFIG_users_allow_comments'])?1:0;
$query_data['users_change_dates'] = ($_POST['CONFIG_users_change_dates'])?1:0;
$query_data['user_images_in_article'] = ($_POST['CONFIG_user_images_in_article'])?1:0;
$query_data['user_upload_images'] = ($_POST['CONFIG_user_upload_images'])?1:0;
$query_data['can_expire'] = ($_POST['CONFIG_can_expire'])?1:0;
$query_data['expiration_years'] = $_POST['CONFIG_expiration_years'];
$query_data['expiration_months'] = $_POST['CONFIG_expiration_months'];
$query_data['expiration_days'] = $_POST['CONFIG_expiration_days'];
$query_data['default_year_count'] = $_POST['CONFIG_default_year_count'];
$query_data['max_image_size'] = (is_numeric($_POST['CONFIG_max_image_size']))
?$_POST['CONFIG_max_image_size']
:$this->val['max_image_size'];
$query_data['max_image_height'] = (is_numeric($_POST['CONFIG_max_image_height']))
?$_POST['CONFIG_max_image_height']
:$this->val['max_image_height'];
$query_data['max_image_width'] = (is_numeric($_POST['CONFIG_max_image_width']))
?$_POST['CONFIG_max_image_width']
:$this->val['max_image_width'];
$query_data['restricted_viewing'] = ($_POST['CONFIG_restricted_viewing'])?1:0;
$query_data['lock_expiration_time'] = $_POST['CONFIG_lock_expiration_time'];
$query_data['make_metatags'] = ($_POST['CONFIG_make_metatags'])?1:0;
$GLOBALS['core']->sqlUpdate($query_data, "mod_article_config");
?>
|