|
From: Eloi G. <ada...@us...> - 2008-11-21 06:13:24
|
Update of /cvsroot/phpwebsite-comm/modules/article/class In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv11519/class Modified Files: AM_Actions.php Section.php AM_Data.php AM_EditForms.php AM_DisplayForms.php AM_ModSettings.php AM_Lists.php Article.php Log Message: Moved installation auto-import of demonstration article and manual to install.php Also took out @module comments Index: Section.php =================================================================== RCS file: /cvsroot/phpwebsite-comm/modules/article/class/Section.php,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** Section.php 21 Aug 2008 20:17:32 -0000 1.27 --- Section.php 21 Nov 2008 06:13:14 -0000 1.28 *************** *** 38,42 **** function PHPWS_Article_Section ($data) { ! $this->template = $GLOBALS['Article']['val']['default_section_template']; PHPWS_Core::plugObject($this, $data); } --- 38,42 ---- function PHPWS_Article_Section ($data) { ! $this->template = PHPWS_Settings::get('article', 'default_section_template'); PHPWS_Core::plugObject($this, $data); } *************** *** 74,78 **** * * @author Eloi George <el...@NO...> ! * @module Article Manager * @param int $section_position : Position of this section in the page (zero-based). * @param int $total_sections : Total number of sections on this page (minus 1). --- 74,78 ---- * * @author Eloi George <el...@NO...> ! * @param int $section_position : Position of this section in the page (zero-based). * @param int $total_sections : Total number of sections on this page (minus 1). *************** *** 89,93 **** * * @author Eloi George <el...@NO...> ! * @module Article Manager * @param int $id : Id of the section data we're looking for. * @return none --- 89,93 ---- * * @author Eloi George <el...@NO...> ! * @param int $id : Id of the section data we're looking for. * @return none *************** *** 117,121 **** * * @author Eloi George <el...@NO...> ! * @module Article Manager * @param none * @return none --- 117,121 ---- * * @author Eloi George <el...@NO...> ! * @param none * @return none Index: AM_ModSettings.php =================================================================== RCS file: /cvsroot/phpwebsite-comm/modules/article/class/AM_ModSettings.php,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** AM_ModSettings.php 19 Nov 2008 06:01:26 -0000 1.13 --- AM_ModSettings.php 21 Nov 2008 06:13:14 -0000 1.14 *************** *** 11,112 **** class PHPWS_AM_ModSettings { - - /* Resets the module's cache. - * - * @author Eloi George <el...@NO...> - * @module Article Manager - * @param none - * @return none - */ - function reset_cache () - { - PHPWS_Cache::remove('CategorizedArticleHeadlines'); - PHPWS_Cache::remove('ChronologicalArticleHeadlines'); - } - - /* Edits the module's default settings. - * - * @author Eloi George <el...@NO...> - * @module Article Manager - * @param none - * @return none - */ - function edit_configuration () - { - PHPWS_Core::initModClass('article', 'AM_EditForms.php'); - return PHPWS_AM_EditForms::edit_configuration(); - } - - /** - * Saves the module's default settings to the database. - * - * @author Eloi George <el...@NO...> - * @module Article Manager - * @param none - * @return none - */ - function save_configuration () - { - $settings = array(); - $settings['default_article_template'] = $_POST['default_article_template']; - $settings['default_section_template'] = $_POST['default_section_template']; - $settings['summaries_on_homepage'] = $_POST['summaries_on_homepage']; - $settings['prev_n_articles'] = $_POST['prev_n_articles']; - $settings['popular_articles'] = $_POST['popular_articles']; - $settings['listings_per_page'] = $_POST['listings_per_page']; - $settings['need_approval'] = (@$_POST['need_approval'])?1:0; - $settings['default_allow_comments'] = (@$_POST['default_allow_comments'])?1:0; - $settings['default_allow_anon'] = (@$_POST['default_allow_anon'])?1:0; - $settings['can_expire'] = (@$_POST['can_expire'])?1:0; - $settings['expiration_years'] = $_POST['expiration_years']; - $settings['expiration_months'] = $_POST['expiration_months']; - $settings['expiration_days'] = $_POST['expiration_days']; - $settings['log_events'] = (@$_POST['log_events'])?1:0; - $settings['max_image_size'] = (is_numeric($_POST['max_image_size'])) - ? (int) $_POST['max_image_size'] - : $GLOBALS['Article']['val']['max_image_size']; - $settings['max_image_height'] = (is_numeric($_POST['max_image_height'])) - ? (int) $_POST['max_image_height'] - : $GLOBALS['Article']['val']['max_image_height']; - $settings['max_image_width'] = (is_numeric($_POST['max_image_width'])) - ? (int) $_POST['max_image_width'] - : $GLOBALS['Article']['val']['max_image_width']; - $settings['lock_expiration_time'] = $_POST['lock_expiration_time']; - $settings['use_comments'] = (@$_POST['use_comments'])?1:0; - $settings['long_date_format'] = $_POST['long_date_format']; - $settings['short_date_format'] = $_POST['short_date_format']; - $settings['categorized_display'] = (@$_POST['categorized_display'])?1:0; - $settings['display_columns'] = $_POST['display_columns']; - $settings['summaries_per_category'] = $_POST['summaries_per_category']; - $settings['category_order'] = $_POST['category_order']; - - $content = "<?php\n"; - foreach ($settings AS $key => $value) - $content .= "\$settings['$key'] = '$value';\n"; - $content .= "?>\n"; - $filename = PHPWS_HOME_DIR . 'files/article/config.php'; - - PHPWS_File::writeFile($filename, $content, true, true); - $GLOBALS['Article']['val'] = $settings; - PHPWS_AM_ModSettings::reset_cache(); - } - - /** - * Resets the module's default settings. - * - * @author Eloi George <el...@NO...> - * @module Article Manager - * @param none - * @return none - */ - function reset_configuration () - { - $file_origin = PHPWS_SOURCE_DIR . 'mod/article/inc/default_config.php'; - $destination_directory = PHPWS_HOME_DIR . 'files/article/'; - PHPWS_File::fileCopy($file_origin, $destination_directory, 'config.php', 1, 0); - include($file_origin); - $GLOBALS['Article']['val'] = $settings; - PHPWS_AM_ModSettings::reset_cache(); - } --- 11,14 ---- *************** *** 115,148 **** * * @author Eloi George <el...@NO...> - * @module Article Manager * @param none * @return none */ function init () ! { ! $just_installed = 0; ! $sess = array(); ! $file = PHPWS_HOME_DIR . 'files/article/config.php'; ! if (!is_file($file)) { ! $file_origin = PHPWS_SOURCE_DIR . 'mod/article/inc/default_config.php'; ! $destination_directory = PHPWS_HOME_DIR . 'files/article/'; ! PHPWS_File::fileCopy($file_origin, $destination_directory, 'config.php', 1, 0); ! $just_installed = 1; ! } ! include($file); ! $GLOBALS['Article']['val'] = $settings; ! $GLOBALS['Article']['error'] = array(); ! PHPWS_Core::initModClass('article', 'AM_Data.php'); PHPWS_Core::initModClass('article', 'Section.php'); PHPWS_Core::initModClass('article', 'Article.php'); PHPWS_Core::initModClass('article', 'Image.php'); ! ! if ($just_installed) { ! // Import Demo Article and Operation Manual ! PHPWS_Core::initModClass('article', 'AM_Actions.php'); ! PHPWS_AM_Actions::XML_import('demo_article.xml','mod/article/docs/', 1, 1); ! PHPWS_AM_Actions::XML_import('manual.xml','mod/article/docs/', 1, 1); ! } // WORKFLOW "assigned to" (person or group) } --- 17,49 ---- * * @author Eloi George <el...@NO...> * @param none * @return none */ function init () ! { ! // $just_installed = 0; ! // $sess = array(); ! // $file = PHPWS_HOME_DIR . 'files/article/config.php'; ! // if (!is_file($file)) { ! // $file_origin = PHPWS_SOURCE_DIR . 'mod/article/inc/default_config.php'; ! // $destination_directory = PHPWS_HOME_DIR . 'files/article/'; ! // PHPWS_File::fileCopy($file_origin, $destination_directory, 'config.php', 1, 0); ! // $just_installed = 1; ! // } ! // include($file); ! // PHPWS_Settings::set('article', $settings); ! // $GLOBALS['Article']['error'] = array(); ! // PHPWS_Core::initModClass('article', 'AM_Data.php'); PHPWS_Core::initModClass('article', 'Section.php'); PHPWS_Core::initModClass('article', 'Article.php'); PHPWS_Core::initModClass('article', 'Image.php'); ! // ! // if ($just_installed) { ! // // Import Demo Article and Operation Manual ! // PHPWS_Core::initModClass('article', 'AM_Actions.php'); ! // PHPWS_AM_Actions::XML_import('demo_article.xml','mod/article/docs/', 1, 1); ! // PHPWS_AM_Actions::XML_import('manual.xml','mod/article/docs/', 1, 1); ! // } // WORKFLOW "assigned to" (person or group) } Index: AM_Lists.php =================================================================== RCS file: /cvsroot/phpwebsite-comm/modules/article/class/AM_Lists.php,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** AM_Lists.php 18 Nov 2008 05:00:13 -0000 1.22 --- AM_Lists.php 21 Nov 2008 06:13:14 -0000 1.23 *************** *** 16,20 **** * * @author Eloi George <el...@NO...> ! * @module Article Manager * @param object $db : Database object to add WHEREs to * @param array $s_arr : Array of Current Search Parameters --- 16,20 ---- * * @author Eloi George <el...@NO...> ! * @param object $db : Database object to add WHEREs to * @param array $s_arr : Array of Current Search Parameters *************** *** 182,186 **** * * @author Eloi George <el...@NO...> ! * @module Article Manager * @param none * @return none --- 182,186 ---- * * @author Eloi George <el...@NO...> ! * @param none * @return none *************** *** 372,376 **** * * @author Eloi George <el...@NO...> ! * @module Article Manager * @param none * @return none --- 372,376 ---- * * @author Eloi George <el...@NO...> ! * @param none * @return none Index: AM_Actions.php =================================================================== RCS file: /cvsroot/phpwebsite-comm/modules/article/class/AM_Actions.php,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** AM_Actions.php 11 Oct 2008 06:13:49 -0000 1.14 --- AM_Actions.php 21 Nov 2008 06:13:14 -0000 1.15 *************** *** 15,19 **** * * @author Eloi George <el...@NO...> - * @module Article Manager * @param none * @return none --- 15,18 ---- *************** *** 42,46 **** * * @author Eloi George <el...@NO...> - * @module Article Manager * @param int id : Id number of the article to be cloned * @param string language : Language of the new article --- 41,44 ---- *************** *** 69,73 **** $new_article->updated_date = date("Y-m-d H:i:s"); $new_article->hits = 0; ! $new_article->approved = (!$GLOBALS['Article']['val']['need_approval'] || Current_User::allow('article', 'approval')) ?1:0; $new_article->version = -1; $new_article->language = $language; --- 67,71 ---- $new_article->updated_date = date("Y-m-d H:i:s"); $new_article->hits = 0; ! $new_article->approved = (!PHPWS_Settings::get('article', 'need_approval') || Current_User::allow('article', 'approval')) ?1:0; $new_article->version = -1; $new_article->language = $language; *************** *** 93,97 **** * * @author Eloi George <el...@NO...> - * @module Article Manager * @param none * @return none --- 91,94 ---- *************** *** 132,136 **** * * @author Eloi George <el...@NO...> - * @module Article Manager * @param none. * @return string : HTML display --- 129,132 ---- *************** *** 196,200 **** * * @author Eloi George <el...@NO...> - * @module Article Manager * @param int $id : id# of the article to export. * @return string : XML Stream --- 192,195 ---- *************** *** 223,227 **** * * @author Eloi George <el...@NO...> - * @module Article Manager * @param int $id : id# of the article to export. * @return string : XML Stream --- 218,221 ---- *************** *** 296,300 **** * * @author Eloi George <el...@NO...> - * @module Article Manager * @return bool : Success or Failiure */ --- 290,293 ---- Index: AM_Data.php =================================================================== RCS file: /cvsroot/phpwebsite-comm/modules/article/class/AM_Data.php,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** AM_Data.php 18 Nov 2008 05:00:13 -0000 1.20 --- AM_Data.php 21 Nov 2008 06:13:14 -0000 1.21 *************** *** 15,19 **** * * @author Eloi George <el...@NO...> ! * @module Article Manager * @param none * @return none --- 15,19 ---- * * @author Eloi George <el...@NO...> ! * @param none * @return none *************** *** 58,62 **** * * @author Eloi George <el...@NO...> ! * @module Article Manager * @param array type : Type of error that occured. Prints an appropriate error message * based on the type. --- 58,62 ---- * * @author Eloi George <el...@NO...> ! * @param array type : Type of error that occured. Prints an appropriate error message * based on the type. *************** *** 81,85 **** * * @author Eloi George <el...@NO...> ! * @module Article Manager * @param & $db : a reference to the db class that we are adding these where clauses to. * @return none --- 81,85 ---- * * @author Eloi George <el...@NO...> ! * @param & $db : a reference to the db class that we are adding these where clauses to. * @return none *************** *** 92,96 **** $db->addWhere('mainarticle', '0'); $db->addWhere('publication_date', $now, '<='); ! if ($GLOBALS['Article']['val']['can_expire']) { $db->addWhere('expiration_date', '0', '=', null, 'expirationgroup'); --- 92,96 ---- $db->addWhere('mainarticle', '0'); $db->addWhere('publication_date', $now, '<='); ! if (PHPWS_Settings::get('article', 'can_expire')) { $db->addWhere('expiration_date', '0', '=', null, 'expirationgroup'); *************** *** 103,107 **** * * @author Eloi George <el...@NO...> ! * @module Article Manager * @param int id : Id number of the article to be cloned * @param int $date : Unix Timestamp. --- 103,107 ---- * * @author Eloi George <el...@NO...> ! * @param int id : Id number of the article to be cloned * @param int $date : Unix Timestamp. *************** *** 112,116 **** { if (!$type) ! $type = $GLOBALS['Article']['val']['long_date_format']; if(!is_numeric($date)) $date = (int) $date; --- 112,116 ---- { if (!$type) ! $type = PHPWS_Settings::get('article', 'long_date_format'); if(!is_numeric($date)) $date = (int) $date; *************** *** 122,126 **** * * @author Eloi George <el...@NO...> ! * @module Article Manager * @param int id : Id number of the article to be cloned * @param int $date : Unix Timestamp. --- 122,126 ---- * * @author Eloi George <el...@NO...> ! * @param int id : Id number of the article to be cloned * @param int $date : Unix Timestamp. *************** *** 131,135 **** { if (!$type) ! $type = $GLOBALS['Article']['val']['short_date_format']; if(!is_int($date)) $date = (int) $date; --- 131,135 ---- { if (!$type) ! $type = PHPWS_Settings::get('article', 'short_date_format'); if(!is_int($date)) $date = (int) $date; *************** *** 179,183 **** * * @author Eloi George <el...@NO...> ! * @module Article Manager * @param array $exclusions : Arguments to exclude from the final list * @return string : hidden <input> statements --- 179,183 ---- * * @author Eloi George <el...@NO...> ! * @param array $exclusions : Arguments to exclude from the final list * @return string : hidden <input> statements *************** *** 198,202 **** * * @author Eloi George <el...@NO...> ! * @module Article Manager * @param object $object : Current Article * @return none --- 198,202 ---- * * @author Eloi George <el...@NO...> ! * @param object $object : Current Article * @return none *************** *** 225,229 **** * * @author Eloi George <el...@NO...> ! * @module Article Manager * @param none * @return array --- 225,229 ---- * * @author Eloi George <el...@NO...> ! * @param none * @return array *************** *** 246,250 **** * * @author Eloi George <el...@NO...> ! * @module Article Manager * @param none * @return array --- 246,250 ---- * * @author Eloi George <el...@NO...> ! * @param none * @return array *************** *** 268,272 **** * * @author Eloi George <el...@NO...> ! * @module Article Manager * @param none * @return none --- 268,272 ---- * * @author Eloi George <el...@NO...> ! * @param none * @return none *************** *** 369,373 **** * * @author Eloi George <el...@NO...> ! * @module Article Manager * @param string text : Text to parse. * @return string : Parsed text --- 369,373 ---- * * @author Eloi George <el...@NO...> ! * @param string text : Text to parse. * @return string : Parsed text *************** *** 384,388 **** * * @author Eloi George <el...@NO...> ! * @module Article Manager * @param string data : Text to process. * @return string : Parsed text --- 384,388 ---- * * @author Eloi George <el...@NO...> ! * @param string data : Text to process. * @return string : Parsed text *************** *** 394,397 **** --- 394,410 ---- return $data; } + + /* Resets the module's cache. + * + * @author Eloi George <el...@NO...> + * @param none + * @return none + */ + function reset_cache () + { + PHPWS_Cache::remove('CategorizedArticleHeadlines'); + PHPWS_Cache::remove('ChronologicalArticleHeadlines'); + } + } Index: AM_EditForms.php =================================================================== RCS file: /cvsroot/phpwebsite-comm/modules/article/class/AM_EditForms.php,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** AM_EditForms.php 19 Nov 2008 06:01:26 -0000 1.9 --- AM_EditForms.php 21 Nov 2008 06:13:14 -0000 1.10 *************** *** 15,19 **** * * @author Eloi George <el...@NO...> ! * @module Article Manager * @param int SECT_id : Database id of the section within this article to be edited. * @return none --- 15,19 ---- * * @author Eloi George <el...@NO...> ! * @param int SECT_id : Database id of the section within this article to be edited. * @return none *************** *** 121,127 **** $form->setTag('ARTICLE_announce', 'announce'); ! if ($GLOBALS['Article']['val']['use_comments'] && (Current_User::allow('article', 'allow_comments') ! || ($GLOBALS['Article']['val']['users_allow_comments'] && Current_User::getId()))) { --- 121,127 ---- $form->setTag('ARTICLE_announce', 'announce'); ! if (PHPWS_Settings::get('article', 'use_comments') && (Current_User::allow('article', 'allow_comments') ! || (PHPWS_Settings::get('article', 'users_allow_comments') && Current_User::getId()))) { *************** *** 139,143 **** $default_comment_approval = $thread->approval; } else { ! $allow_anonymous = $GLOBALS['Article']['val']['default_allow_anon']; $default_comment_approval = PHPWS_Settings::get('comments', 'default_approval'); } --- 139,143 ---- $default_comment_approval = $thread->approval; } else { ! $allow_anonymous = PHPWS_Settings::get('article', 'default_allow_anon'); $default_comment_approval = PHPWS_Settings::get('comments', 'default_approval'); } *************** *** 180,184 **** } ! if (Current_User::allow('article', 'change_dates') && $GLOBALS['Article']['val']['can_expire']) { // $form->addTplTag('EXPIRATION_HELP', PHPWS_Help::show_link('article', 'article_expiration_date')); --- 180,184 ---- } ! if (Current_User::allow('article', 'change_dates') && PHPWS_Settings::get('article', 'can_expire')) { // $form->addTplTag('EXPIRATION_HELP', PHPWS_Help::show_link('article', 'article_expiration_date')); *************** *** 186,192 **** $expdate = $object->expiration_date; else ! $expdate = mktime(0,0,0,date('m')+$GLOBALS['Article']['val']['expiration_months'] ! , date('d')+$GLOBALS['Article']['val']['expiration_days'] ! , date('Y')+$GLOBALS['Article']['val']['expiration_years']); $form->addText('ARTICLE_expiration_date', date('Y/m/d', $expdate)); $form->setSize('ARTICLE_expiration_date', '10'); --- 186,192 ---- $expdate = $object->expiration_date; else ! $expdate = mktime(0,0,0,date('m')+PHPWS_Settings::get('article', 'expiration_months') ! , date('d')+PHPWS_Settings::get('article', 'expiration_days') ! , date('Y')+PHPWS_Settings::get('article', 'expiration_years')); $form->addText('ARTICLE_expiration_date', date('Y/m/d', $expdate)); $form->setSize('ARTICLE_expiration_date', '10'); *************** *** 206,210 **** else { $form->addTplTag('EXPIRATION_LABEL', dgettext('article', 'Expires on')); ! if ($GLOBALS['Article']['val']['can_expire'] || $object->expiration_date==0) $form->addTplTag('EXPIRATION', dgettext('article', 'Never Expires')); else --- 206,210 ---- else { $form->addTplTag('EXPIRATION_LABEL', dgettext('article', 'Expires on')); ! if (PHPWS_Settings::get('article', 'can_expire') || $object->expiration_date==0) $form->addTplTag('EXPIRATION', dgettext('article', 'Never Expires')); else *************** *** 262,266 **** $article_tags['SAVE_DRAFT_BUTTON'] = '<input type="submit" name="ARTICLE_vars[op:save_draft]" value="'.dgettext('article', 'Save Article as Draft').'" />'; ! if (!$GLOBALS['Article']['val']['need_approval'] || Current_User::allow('article', 'approval')) $article_tags['SAVE_PUBLISH_BUTTON'] = '<input type="submit" name="ARTICLE_vars[op:save_approved]" value="'.dgettext('article', 'Save & Publish').'" />'; --- 262,266 ---- $article_tags['SAVE_DRAFT_BUTTON'] = '<input type="submit" name="ARTICLE_vars[op:save_draft]" value="'.dgettext('article', 'Save Article as Draft').'" />'; ! if (!PHPWS_Settings::get('article', 'need_approval') || Current_User::allow('article', 'approval')) $article_tags['SAVE_PUBLISH_BUTTON'] = '<input type="submit" name="ARTICLE_vars[op:save_approved]" value="'.dgettext('article', 'Save & Publish').'" />'; *************** *** 286,290 **** * * @author Eloi George <el...@NO...> ! * @module Article Manager * @param int $section_position : Position of this section in the page (zero-based). * @param int $total_sections : Total number of sections on this page (minus 1). --- 286,290 ---- * * @author Eloi George <el...@NO...> ! * @param int $section_position : Position of this section in the page (zero-based). * @param int $total_sections : Total number of sections on this page (minus 1). *************** *** 382,386 **** * * @author Eloi George <el...@NO...> ! * @module Article Manager * @param none * @return none --- 382,386 ---- * * @author Eloi George <el...@NO...> ! * @param none * @return none *************** *** 389,393 **** { $form = & new PHPWS_Form('Config'); ! $val = $GLOBALS['Article']['val']; /* Section Headers */ --- 389,393 ---- { $form = & new PHPWS_Form('Config'); ! $val = PHPWS_Settings::get('article'); /* Section Headers */ *************** *** 584,587 **** --- 584,633 ---- return PHPWS_Template::processTemplate($form->getTemplate(),'article','config.tpl'); } + + /** + * Saves the module's configuration settings to the database. + * + * @author Eloi George <el...@NO...> + * @param none + * @return none + */ + function save_configuration () + { + $settings = array(); + $settings['default_article_template'] = $_POST['default_article_template']; + $settings['default_section_template'] = $_POST['default_section_template']; + $settings['summaries_on_homepage'] = $_POST['summaries_on_homepage']; + $settings['prev_n_articles'] = $_POST['prev_n_articles']; + $settings['popular_articles'] = $_POST['popular_articles']; + $settings['listings_per_page'] = $_POST['listings_per_page']; + $settings['need_approval'] = (@$_POST['need_approval'])?1:0; + $settings['default_allow_comments'] = (@$_POST['default_allow_comments'])?1:0; + $settings['default_allow_anon'] = (@$_POST['default_allow_anon'])?1:0; + $settings['can_expire'] = (@$_POST['can_expire'])?1:0; + $settings['expiration_years'] = $_POST['expiration_years']; + $settings['expiration_months'] = $_POST['expiration_months']; + $settings['expiration_days'] = $_POST['expiration_days']; + $settings['log_events'] = (@$_POST['log_events'])?1:0; + $settings['max_image_size'] = (is_numeric($_POST['max_image_size'])) + ? (int) $_POST['max_image_size'] + : PHPWS_Settings::get('article', 'max_image_size'); + $settings['max_image_height'] = (is_numeric($_POST['max_image_height'])) + ? (int) $_POST['max_image_height'] + : PHPWS_Settings::get('article', 'max_image_height'); + $settings['max_image_width'] = (is_numeric($_POST['max_image_width'])) + ? (int) $_POST['max_image_width'] + : PHPWS_Settings::get('article', 'max_image_width'); + $settings['lock_expiration_time'] = $_POST['lock_expiration_time']; + $settings['use_comments'] = (@$_POST['use_comments'])?1:0; + $settings['long_date_format'] = $_POST['long_date_format']; + $settings['short_date_format'] = $_POST['short_date_format']; + $settings['categorized_display'] = (@$_POST['categorized_display'])?1:0; + $settings['display_columns'] = $_POST['display_columns']; + $settings['summaries_per_category'] = $_POST['summaries_per_category']; + $settings['category_order'] = $_POST['category_order']; + + PHPWS_Settings::set('article', $settings); + PHPWS_AM_Data::reset_cache(); + } } Index: AM_DisplayForms.php =================================================================== RCS file: /cvsroot/phpwebsite-comm/modules/article/class/AM_DisplayForms.php,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** AM_DisplayForms.php 18 Nov 2008 05:00:13 -0000 1.7 --- AM_DisplayForms.php 21 Nov 2008 06:13:14 -0000 1.8 *************** *** 17,21 **** * * @author Eloi George <el...@NO...> ! * @module Article Manager * @param array $s_arr : Array of current search parameters. * @param array $location : URL argumemts to execute. --- 17,21 ---- * * @author Eloi George <el...@NO...> ! * @param array $s_arr : Array of current search parameters. * @param array $location : URL argumemts to execute. *************** *** 244,248 **** * * @author Eloi George <el...@NO...> ! * @module Article Manager * @param int new : Version # of the newer revision. * @param int old : Version # of the older revision. --- 244,248 ---- * * @author Eloi George <el...@NO...> ! * @param int new : Version # of the newer revision. * @param int old : Version # of the older revision. *************** *** 325,329 **** * * @author Eloi George <el...@NO...> ! * @module Article Manager * @param int articleid : Id of the article to show. * @return none --- 325,329 ---- * * @author Eloi George <el...@NO...> ! * @param int articleid : Id of the article to show. * @return none Index: Article.php =================================================================== RCS file: /cvsroot/phpwebsite-comm/modules/article/class/Article.php,v retrieving revision 1.56 retrieving revision 1.57 diff -C2 -d -r1.56 -r1.57 *** Article.php 18 Nov 2008 05:00:13 -0000 1.56 --- Article.php 21 Nov 2008 06:13:14 -0000 1.57 *************** *** 92,96 **** * * @author Eloi George <el...@NO...> ! * @module Article Manager * @param int id : Database id of the article to be instantiated (sp? heh). * @param string language : Language translation of the article. --- 92,96 ---- * * @author Eloi George <el...@NO...> ! * @param int id : Database id of the article to be instantiated (sp? heh). * @param string language : Language translation of the article. *************** *** 110,123 **** } $this->created_date = $this->updated_date = time(); ! $this->allow_comments = $GLOBALS['Article']['val']['default_allow_comments']; ! $this->expiration_date = ($GLOBALS['Article']['val']['can_expire']) ?mktime(0,0,0 ! ,date('m')+$GLOBALS['Article']['val']['expiration_months'] ! ,date('d')+$GLOBALS['Article']['val']['expiration_days'] ! ,date('Y')+$GLOBALS['Article']['val']['expiration_years']) :0; $this->publication_date = time(); ! $this->template = $GLOBALS['Article']['val']['default_article_template']; ! $this->approved = (!$GLOBALS['Article']['val']['need_approval'] || Current_User::allow('article', 'approval')) ?1:0; // if ($_SESSION['translate']->langActive) // $this->language = $_SESSION['translate']->current_language; --- 110,123 ---- } $this->created_date = $this->updated_date = time(); ! $this->allow_comments = PHPWS_Settings::get('article', 'default_allow_comments'); ! $this->expiration_date = (PHPWS_Settings::get('article', 'can_expire')) ?mktime(0,0,0 ! ,date('m')+PHPWS_Settings::get('article', 'expiration_months') ! ,date('d')+PHPWS_Settings::get('article', 'expiration_days') ! ,date('Y')+PHPWS_Settings::get('article', 'expiration_years')) :0; $this->publication_date = time(); ! $this->template = PHPWS_Settings::get('article', 'default_article_template'); ! $this->approved = (!PHPWS_Settings::get('article', 'need_approval') || Current_User::allow('article', 'approval')) ?1:0; // if ($_SESSION['translate']->langActive) // $this->language = $_SESSION['translate']->current_language; *************** *** 177,181 **** * * @author Eloi George <el...@NO...> ! * @module Article Manager * @param none * @return array --- 177,181 ---- * * @author Eloi George <el...@NO...> ! * @param none * @return array *************** *** 203,207 **** * * @author Eloi George <el...@NO...> ! * @module Article Manager * @param none * @return array --- 203,207 ---- * * @author Eloi George <el...@NO...> ! * @param none * @return array *************** *** 332,336 **** /* If the Comments module is available, get comments information */ ! if($GLOBALS['Article']['val']['use_comments'] && $this->allow_comments && PHPWS_Core::initModClass('comments', 'Comments.php') && $article_tags['thread'] = Comments::getThread($this->key_id)) --- 332,336 ---- /* If the Comments module is available, get comments information */ ! if(PHPWS_Settings::get('article', 'use_comments') && $this->allow_comments && PHPWS_Core::initModClass('comments', 'Comments.php') && $article_tags['thread'] = Comments::getThread($this->key_id)) *************** *** 430,434 **** * * @author Eloi George <el...@NO...> ! * @module Article Manager * @param none * @return none --- 430,434 ---- * * @author Eloi George <el...@NO...> ! * @param none * @return none *************** *** 480,484 **** * * @author Eloi George <el...@NO...> ! * @module Article Manager * @param none * @return none --- 480,484 ---- * * @author Eloi George <el...@NO...> ! * @param none * @return none *************** *** 495,499 **** * * @author Eloi George <el...@NO...> ! * @module Article Manager * @param none * @return none --- 495,499 ---- * * @author Eloi George <el...@NO...> ! * @param none * @return none *************** *** 510,514 **** * * @author Eloi George <el...@NO...> ! * @module Article Manager * @param none * @return array --- 510,514 ---- * * @author Eloi George <el...@NO...> ! * @param none * @return array *************** *** 527,531 **** * * @author Eloi George <el...@NO...> ! * @module Article Manager * @param int page : Page within this article to be edited. * @return none --- 527,531 ---- * * @author Eloi George <el...@NO...> ! * @param int page : Page within this article to be edited. * @return none *************** *** 547,551 **** * * @author Eloi George <el...@NO...> ! * @module Article Manager * @param none * @return none --- 547,551 ---- * * @author Eloi George <el...@NO...> ! * @param none * @return none *************** *** 560,564 **** * * @author Adam Morton <ad...@NO...> ! * @module Article Manager * @param bool $autodetect_id : If false, the article will be saved as a new article with the supplied id * @return array : On success, id & versionid of article; on failure, FALSE --- 560,564 ---- * * @author Adam Morton <ad...@NO...> ! * @param bool $autodetect_id : If false, the article will be saved as a new article with the supplied id * @return array : On success, id & versionid of article; on failure, FALSE *************** *** 576,580 **** * @author Adam Morton <ad...@NO...> * @author Eloi George <el...@NO...> ! * @module Article Manager * @param none * @return none --- 576,580 ---- * @author Adam Morton <ad...@NO...> * @author Eloi George <el...@NO...> ! * @param none * @return none *************** *** 593,597 **** * * @author Eloi George <el...@NO...> ! * @module Article Manager * @param none * @return int New page number. --- 593,597 ---- * * @author Eloi George <el...@NO...> ! * @param none * @return int New page number. *************** *** 608,612 **** * * @author Eloi George <el...@NO...> ! * @module Article Manager * @param none * @return int New section id. --- 608,612 ---- * * @author Eloi George <el...@NO...> ! * @param none * @return int New section id. *************** *** 625,629 **** * * @author Eloi George <el...@NO...> ! * @module Article Manager * @param none * @return int maximum section id found. --- 625,629 ---- * * @author Eloi George <el...@NO...> ! * @param none * @return int maximum section id found. *************** *** 668,672 **** * * @author Eloi George <el...@NO...> ! * @module Article Manager * @param int id : Id of the section to be found * @return array Page and Index number. --- 668,672 ---- * * @author Eloi George <el...@NO...> ! * @param int id : Id of the section to be found * @return array Page and Index number. *************** *** 689,693 **** * * @author Eloi George <el...@NO...> ! * @module Article Manager * @param int $page : Current page. * @param int $id : Id of the section to move. --- 689,693 ---- * * @author Eloi George <el...@NO...> ! * @param int $page : Current page. * @param int $id : Id of the section to move. *************** *** 710,714 **** * * @author Eloi George <el...@NO...> ! * @module Article Manager * @param int $page : Current page. * @param int $offset : Amount of spaces to move the element. Positive numbers move up. --- 710,714 ---- * * @author Eloi George <el...@NO...> ! * @param int $page : Current page. * @param int $offset : Amount of spaces to move the element. Positive numbers move up. *************** *** 728,732 **** * * @author Eloi George <el...@NO...> ! * @module Article Manager * @param int $page : Current page. * @param int $id : Id of the section to place the new section in front of. --- 728,732 ---- * * @author Eloi George <el...@NO...> ! * @param int $page : Current page. * @param int $id : Id of the section to place the new section in front of. *************** *** 751,755 **** * * @author Eloi George <el...@NO...> ! * @module Article Manager * @param int $page : Current page. * @return none --- 751,755 ---- * * @author Eloi George <el...@NO...> ! * @param int $page : Current page. * @return none *************** *** 767,771 **** * * @author Eloi George <el...@NO...> ! * @module Article Manager * @param int SECT_id : Database id of the section to be removed. * @return id of the next section --- 767,771 ---- * * @author Eloi George <el...@NO...> ! * @param int SECT_id : Database id of the section to be removed. * @return id of the next section *************** *** 783,787 **** * * @author Eloi George <el...@NO...> ! * @module Article Manager * @param int PAGE_id : id of the page to be removed. * @return none --- 783,787 ---- * * @author Eloi George <el...@NO...> ! * @param int PAGE_id : id of the page to be removed. * @return none *************** *** 797,801 **** * * @author Eloi George <el...@NO...> ! * @module Article Manager * @param none * @return none --- 797,801 ---- * * @author Eloi George <el...@NO...> ! * @param none * @return none *************** *** 812,816 **** * * @author Eloi George <el...@NO...> ! * @module Article Manager * @param none * @return none --- 812,816 ---- * * @author Eloi George <el...@NO...> ! * @param none * @return none *************** *** 822,828 **** if ($this->expiration_date < $now) $this->expiration_date = mktime(0,0,0 ! ,date('m')+$GLOBALS['Article']['val']['expiration_months'] ! ,date('d')+$GLOBALS['Article']['val']['expiration_days'] ! ,date('Y')+$GLOBALS['Article']['val']['expiration_years']); $this->publication_date = $now; --- 822,828 ---- if ($this->expiration_date < $now) $this->expiration_date = mktime(0,0,0 ! ,date('m')+PHPWS_Settings::get('article', 'expiration_months') ! ,date('d')+PHPWS_Settings::get('article', 'expiration_days') ! ,date('Y')+PHPWS_Settings::get('article', 'expiration_years')); $this->publication_date = $now; *************** *** 836,840 **** * * @author Eloi George <el...@NO...> ! * @module Article Manager * @param none * @return none --- 836,840 ---- * * @author Eloi George <el...@NO...> ! * @param none * @return none *************** *** 854,858 **** * * @author Eloi George <el...@NO...> ! * @module Article Manager * @param $data array : name=>value pairs of the data to change * @return none --- 854,858 ---- * * @author Eloi George <el...@NO...> ! * @param $data array : name=>value pairs of the data to change * @return none *************** *** 874,878 **** /* Reset headline caching */ if ($this->announce) ! PHPWS_AM_ModSettings::reset_cache(); } --- 874,878 ---- /* Reset headline caching */ if ($this->announce) ! PHPWS_AM_Data::reset_cache(); } *************** *** 883,887 **** * * @author Eloi George <el...@NO...> ! * @module Article Manager * @param int action true=set false=remove the lock. * @return none --- 883,887 ---- * * @author Eloi George <el...@NO...> ! * @param int action true=set false=remove the lock. * @return none *************** *** 915,919 **** * * @author Eloi George <el...@NO...> ! * @module Article Manager * @param int lock : Unix time that the lock was created. * @param int ownerid : Id of the user that created the lock. --- 915,919 ---- * * @author Eloi George <el...@NO...> ! * @param int lock : Unix time that the lock was created. * @param int ownerid : Id of the user that created the lock. *************** *** 923,927 **** { /* Calculate time remaining */ ! $timeleft = $lock + $GLOBALS['Article']['val']['lock_expiration_time'] - time(); /* If there is a lock in place... */ if ($timeleft > 0) --- 923,927 ---- { /* Calculate time remaining */ ! $timeleft = $lock + PHPWS_Settings::get('article', 'lock_expiration_time') - time(); /* If there is a lock in place... */ if ($timeleft > 0) *************** *** 936,940 **** * * @author Eloi George <el...@NO...> ! * @module Article Manager * @param bool saving : Whether this is being called by function save() or not. */ --- 936,940 ---- * * @author Eloi George <el...@NO...> ! * @param bool saving : Whether this is being called by function save() or not. */ *************** *** 956,960 **** * * @author Eloi George <el...@NO...> ! * @module Article Manager * @param id : Id of the article to show. * @return none --- 956,960 ---- * * @author Eloi George <el...@NO...> ! * @param id : Id of the article to show. * @return none *************** *** 969,973 **** * * @author Eloi George <el...@NO...> ! * @module Article Manager * @param int $sourceId : Version # of the older revision. * @return array : list of article version ids in descending version order --- 969,973 ---- * * @author Eloi George <el...@NO...> ! * @param int $sourceId : Version # of the older revision. * @return array : list of article version ids in descending version order *************** *** 988,992 **** * * @author Eloi George <el...@NO...> ! * @module Article Manager * @param none * @return object ControlPanel --- 988,992 ---- * * @author Eloi George <el...@NO...> ! * @param none * @return object ControlPanel *************** *** 1037,1041 **** * * @author Eloi George <el...@NO...> ! * @module Article Manager * @param int $version_id : Version id to load, if known. * @return mixed : FALSE if no versions were found, Version object otherwise. --- 1037,1041 ---- * * @author Eloi George <el...@NO...> ! * @param int $version_id : Version id to load, if known. * @return mixed : FALSE if no versions were found, Version object otherwise. |