Update of /cvsroot/phpwebsite-comm/modules/article/inc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2278/inc Modified Files: A_save.php A_mail.php A_update.php runtime.php runtime_categorized.php runtime_chronological.php xmlrpc.php Log Message: Article Manager 4.1.0 Index: xmlrpc.php =================================================================== RCS file: /cvsroot/phpwebsite-comm/modules/article/inc/xmlrpc.php,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** xmlrpc.php 17 Sep 2007 01:12:29 -0000 1.8 --- xmlrpc.php 21 Aug 2008 20:17:19 -0000 1.9 *************** *** 1,525 **** ! <?php ! require_once(PHPWS_SOURCE_DIR . 'mod/article/lib/XML-RPC/IXR_Library.inc.php'); ! /** ! * This is a XML-RPC Server. ! * ! * This script allows offline blog editors to manipulate articles on the website. ! * ! * @version $Id$ ! * ! * @author Eloi George <el...@NO...> [...1023 lines suppressed...] ! function helloWorld($args) { ! return 'Hello, World!'; ! } ! function ooh($args) { ! return new IXR_Error(4000, 'ha ha ha'); ! } ! function times10($value) { ! return array( ! 'times10' => (int)$value * 10, ! 'times100' => (int)$value * 10, ! 'times1000' => (int)$value * 10, ! ); ! } ! } ! ! // Run the server, serve the request ! $s = new MyServer(); ! ?> \ No newline at end of file Index: runtime.php =================================================================== RCS file: /cvsroot/phpwebsite-comm/modules/article/inc/runtime.php,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** runtime.php 17 Sep 2007 04:24:28 -0000 1.15 --- runtime.php 21 Aug 2008 20:17:19 -0000 1.16 *************** *** 1,87 **** ! <?php ! /** ! * This is the runtime file for the article module. ! * ! * @version $Id$ ! * ! * @author Eloi George <el...@NO...> ! * @module Article Manager ! */ ! if(!isset($_REQUEST['module'])) ! { ! PHPWS_Core::initModClass('article', 'AM_ModSettings.php'); ! PHPWS_AM_ModSettings::init(); ! ! $config = $GLOBALS['Article']['val']; ! ! /* Display the homepage articles */ ! $db = & new PHPWS_DB('article'); ! $db->addWhere('mainarticle', '1'); ! Key::restrictView($db, 'article'); ! $db->addOrder('rank desc'); ! $result = $db->select(); ! if (PHPWS_Error::logIfError($result)) ! return; ! if ($result) ! foreach($result as $row) ! { ! /* Initialize Article object */ ! $article = new PHPWS_Article($row); ! Layout::add($article->view_full(), 'article', 'view', true); ! /* Increment the articleview counter */ ! $article->increment_counter((int) $result); ! } ! unset($article); ! ! if ($config['summaries_on_homepage']>0) { ! if ($config['categorized_display'] && !empty($config['category_order'])) ! include(PHPWS_SOURCE_DIR . 'mod/article/inc/runtime_categorized.php'); ! else { ! /* Display summary listings of last n articles on the homepage. */ ! $TotalCount = $config['summaries_on_homepage'] + $config['prev_n_articles']; ! /* Determine how many summaries we're going to show */ ! if ($TotalCount>0) ! include(PHPWS_SOURCE_DIR . 'mod/article/inc/runtime_chronological.php'); ! } ! } ! ! ! /* Display a block listing of the n most popular last n articles. */ ! if ($config['popular_articles']>0) ! { ! /* Load all articles at once */ ! $db = & new PHPWS_DB('article'); ! $db->addColumn('id'); ! $db->addColumn('title'); ! $db->addWhere('announce', '1'); ! $db->addOrder('hits desc'); ! PHPWS_AM_Data::get_published_sql($db); ! $db->setLimit($config['popular_articles']); ! $result = $db->select(); ! if (PHPWS_Error::logIfError($result)) ! exit('Article::Runtime -- a database error occured.'); ! /* If there are summaries to display, display 'em */ ! if(count($result)) ! { ! $content = ''; ! foreach($result AS $summary) { ! if (MOD_REWRITE_ENABLED && $summary['id'] > 0) ! $link = PHPWS_Text::rewriteLink($summary['title'], 'article', $summary['id']); ! else ! $link = PHPWS_Text::moduleLink($summary['title'], 'article', array('id'=> $summary['id'])); ! $content .= '<li>'.$link.'</li><br />
'; ! } ! if (!empty($content)) ! { ! $template['TITLE'] = dgettext('article', 'Popular Articles'); ! $template['CONTENT'] = '<ul>'.$content.'</ul>'; ! $finalContent = PHPWS_Template::process($template, 'layout', 'box.tpl'); ! Layout::add($finalContent, 'article', 'popular'); ! } ! } ! } ! /* Display MiniAdmin Options */ ! PHPWS_AM_Data::MiniAdmin(); ! } ! ?> \ No newline at end of file --- 1,87 ---- ! <?php ! /** ! * This is the runtime file for the article module. ! * ! * @version $Id$ ! * ! * @author Eloi George <el...@NO...> ! * @module Article Manager ! */ ! if(!isset($_REQUEST['module'])) ! { ! PHPWS_Core::initModClass('article', 'AM_ModSettings.php'); ! PHPWS_AM_ModSettings::init(); ! ! $config = $GLOBALS['Article']['val']; ! ! /* Display the homepage articles */ ! $db = & new PHPWS_DB('article'); ! $db->addWhere('mainarticle', '1'); ! Key::restrictView($db, 'article'); ! $db->addOrder('rank desc'); ! $result = $db->select(); ! if (PHPWS_Error::logIfError($result)) ! return; ! if ($result) ! foreach($result as $row) ! { ! /* Initialize Article object */ ! $article = new PHPWS_Article($row); ! Layout::add($article->view_full(), 'article', 'view', true); ! /* Increment the articleview counter */ ! $article->increment_counter((int) $result); ! } ! unset($article); ! ! if ($config['summaries_on_homepage']>0) { ! if ($config['categorized_display'] && !empty($config['category_order'])) ! include(PHPWS_SOURCE_DIR . 'mod/article/inc/runtime_categorized.php'); ! else { ! /* Display summary listings of last n articles on the homepage. */ ! $TotalCount = $config['summaries_on_homepage'] + $config['prev_n_articles']; ! /* Determine how many summaries we're going to show */ ! if ($TotalCount>0) ! include(PHPWS_SOURCE_DIR . 'mod/article/inc/runtime_chronological.php'); ! } ! } ! ! ! /* Display a block listing of the n most popular last n articles. */ ! if ($config['popular_articles']>0) ! { ! /* Load all articles at once */ ! $db = & new PHPWS_DB('article'); ! $db->addColumn('id'); ! $db->addColumn('title'); ! $db->addWhere('announce', '1'); ! $db->addOrder('hits desc'); ! PHPWS_AM_Data::get_published_sql($db); ! $db->setLimit($config['popular_articles']); ! $result = $db->select(); ! if (PHPWS_Error::logIfError($result)) ! exit('Article::Runtime -- a database error occured.'); ! /* If there are summaries to display, display 'em */ ! if(count($result)) ! { ! $content = ''; ! foreach($result AS $summary) { ! if (MOD_REWRITE_ENABLED && $summary['id'] > 0) ! $link = PHPWS_Text::rewriteLink($summary['title'], 'article', $summary['id']); ! else ! $link = PHPWS_Text::moduleLink($summary['title'], 'article', array('id'=> $summary['id'])); ! $content .= '<li>'.$link.'</li><br />
'; ! } ! if (!empty($content)) ! { ! $template['TITLE'] = dgettext('article', 'Popular Articles'); ! $template['CONTENT'] = '<ul>'.$content.'</ul>'; ! $finalContent = PHPWS_Template::process($template, 'layout', 'box.tpl'); ! Layout::add($finalContent, 'article', 'popular'); ! } ! } ! } ! /* Display MiniAdmin Options */ ! PHPWS_AM_Data::MiniAdmin(); ! } ! ?> \ No newline at end of file Index: A_mail.php =================================================================== RCS file: /cvsroot/phpwebsite-comm/modules/article/inc/A_mail.php,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** A_mail.php 22 Jan 2008 04:55:07 -0000 1.12 --- A_mail.php 21 Aug 2008 20:17:19 -0000 1.13 *************** *** 17,88 **** $sendmail = false; if (isset($_POST['ART_yes']) && isset($_POST['ART_mail_type'])) { ! $error = array(); ! if (!isset($_POST['ART_r_email']) || !PHPWS_Text::isValidInput($_POST['ART_r_email'], 'email')) ! $error[0] = dgettext('article', 'Please enter a valid email address'); ! if (!isset($_POST['ART_s_name'])) ! $error[1] = dgettext('article', 'Please enter your name'); ! if (!isset($_POST['ART_s_email']) || !PHPWS_Text::isValidInput($_POST['ART_s_email'], 'email')) ! $error[2] = dgettext('article', 'Please enter a valid email address'); ! if (Captcha::verify($_POST['captcha'])) ! $error[3] = dgettext('article', 'The string you entered for the image verification did not match what was displayed.'); ! if (!count($error)) ! $sendmail = true; } if ($sendmail) { ! /* Construct email */ ! $homepage = PHPWS_Core::getHomeHttp(0, 0, 0); ! $homepage_link = '<a href="'.PHPWS_Core::getHomeHttp().'">'.$homepage.'</a>'; ! if (isset($_POST['ART_s_msg'])) { ! $tags['MESSAGE_LABEL'] = dgettext('article', 'Personal Message').':'; ! $tags['MESSAGE'] = $_POST['ART_s_msg']; ! } ! $L1 = PHPWS_Core::getHomeHttp().'index.php?module=article&view='.$this->id; ! $L2 = PHPWS_Core::getHomeHttp().'index.php?module=article&email='.$this->id; ! $tags['VIEW_LINK'] = sprintf(dgettext('article', 'To view the entire article, go to %1$s or %2$s') ! , $L1, '<a href="'.$L1.'">'.dgettext('article', 'Click Here').'</a>'); ! $tags['MAIL_LINK'] = sprintf(dgettext('article', 'Would you like to send this article to a friend? Go to %1$s or %2$s') ! , $L2, '<a href="'.$L2.'">'.dgettext('article', 'Click Here').'</a>'); ! $text = $html = ''; ! if ($_POST['ART_mail_type']=='full') ! { ! $tags['INTRO'] = sprintf(dgettext('article', '%s has sent you a news article! (Email address not verified)'), '<b>'.$_POST['ART_s_name'].'</b> ('.$_POST['ART_s_email'].')'); ! $tags['PLUG'] = sprintf(dgettext('article', 'Courtesy of %s'), $homepage_link); ! $tags['FOOTER'] = sprintf(dgettext('article', 'Copyright %1$s %2$s'), date('Y'), $homepage_link); ! $tags['TEXT'] = $this->view_full(); ! $html_body = PHPWS_Template::processTemplate($tags, 'article', 'mail_full.tpl'); ! $tags['TEXT'] = ''; ! } ! /* text email body creation */ ! $tags['INTRO'] = sprintf(dgettext('article', '%s has sent you a news article! (Email address not verified)'), $_POST['ART_s_name'].' ('.$_POST['ART_s_email'].')'); ! $tags['PLUG'] = sprintf(dgettext('article', 'Courtesy of %s'), $homepage); ! $tags['TITLE'] = PHPWS_Text::parseOutput($this->title); ! $tags['FOOTER'] = sprintf(dgettext('article', 'Copyright %1$s %2$s'), date('Y'), $homepage); ! if ($this->summary) ! $tags['TEXT'] = PHPWS_AM_Data::parseOutput($this->summary); ! $txt_body = strip_tags(PHPWS_Template::processTemplate($tags, 'article', 'mail_link.tpl')); ! $subject = $homepage.' '.dgettext('article', 'Article').' - '.PHPWS_Text::parseOutput($this->title); ! $sender_name = $_POST['ART_s_name']; ! $sender_email = $_POST['ART_s_email']; ! $recipient_email = $_POST['ART_r_email']; ! $status = PHPWS_AM_Actions::sendmail ($subject, $sender_name, $sender_email, $recipient_email, $txt_body, $html_body = '', $CC = true) ! if ($status===true) { ! $content = sprintf(dgettext('article', 'The %1$s <b>%2$s</b> has successfully been %s') ! , dgettext('article', 'article') ! , $this->title ! , dgettext('article', 'sent to').' '.$recipient_email); ! } elseif($status===false) ! $content = 'EMAIL ERROR: '.$content = dgettext('article', 'Email is not correctly set up on this server.'); ! else ! $content = 'EMAIL ERROR: ' . $status->getMessage(); Layout::addPageTitle(dgettext('article', 'E-mail A Friend').': "'.$this->title); ! $template['TITLE'] = dgettext('article', 'E-mail this Article to a Friend'); ! $template['CONTENT'] = $content .'<br /><br /><div style="text-align:center">[' . PHPWS_Text::moduleLink(sprintf(dgettext('article', 'Go back to %s'), PHPWS_Text::parseOutput($this->title)), 'article', array('id'=>$this->id)). ']</div>'; $finalContent = PHPWS_Template::process($template, 'layout', 'box.tpl'); --- 17,89 ---- $sendmail = false; + $error = array(); if (isset($_POST['ART_yes']) && isset($_POST['ART_mail_type'])) { ! if (!isset($_POST['ART_r_email']) || !PHPWS_Text::isValidInput($_POST['ART_r_email'], 'email')) ! $error[0] = dgettext('article', 'Please enter a valid email address'); ! if (!isset($_POST['ART_s_name'])) ! $error[1] = dgettext('article', 'Please enter your name'); ! if (!isset($_POST['ART_s_email']) || !PHPWS_Text::isValidInput($_POST['ART_s_email'], 'email')) ! $error[2] = dgettext('article', 'Please enter a valid email address'); ! if (!Captcha::verify($_POST['captcha'])) ! $error[3] = dgettext('article', 'The string you entered for the image verification did not match what was displayed.'); ! if (!count($error)) ! $sendmail = true; } if ($sendmail) { ! /* Construct email */ ! $homepage = PHPWS_Core::getHomeHttp(0, 0, 0); ! $homepage_link = '<a href="'.PHPWS_Core::getHomeHttp().'">'.$homepage.'</a>'; ! if (isset($_POST['ART_s_msg'])) { ! $tags['MESSAGE_LABEL'] = dgettext('article', 'Personal Message').':'; ! $tags['MESSAGE'] = $_POST['ART_s_msg']; ! } ! $L1 = PHPWS_Core::getHomeHttp().'index.php?module=article&op=view&id='.$this->id; ! $L2 = PHPWS_Core::getHomeHttp().'index.php?module=article&op=email&id='.$this->id; ! $tags['VIEW_LINK'] = sprintf(dgettext('article', 'To view the entire article, go to %1$s or %2$s') ! , $L1, '<a href="'.$L1.'">'.dgettext('article', 'Click Here').'</a>'); ! $tags['MAIL_LINK'] = sprintf(dgettext('article', 'Would you like to send this article to a friend? Go to %1$s or %2$s') ! , $L2, '<a href="'.$L2.'">'.dgettext('article', 'Click Here').'</a>'); ! $txt_body = $html_body = ''; ! if ($_POST['ART_mail_type']=='full') ! { ! $tags['INTRO'] = sprintf(dgettext('article', '%s has sent you a news article! (Email address not verified)'), '<b>'.$_POST['ART_s_name'].'</b> ('.$_POST['ART_s_email'].')'); ! $tags['PLUG'] = sprintf(dgettext('article', 'Courtesy of %s'), $homepage_link); ! $tags['FOOTER'] = sprintf(dgettext('article', 'Copyright %1$s %2$s'), date('Y'), $homepage_link); ! $tags['TEXT'] = $this->view_full(); ! $html_body = PHPWS_Template::processTemplate($tags, 'article', 'mail_full.tpl'); ! $tags['TEXT'] = ''; ! } ! /* text email body creation */ ! $tags['INTRO'] = sprintf(dgettext('article', '%s has sent you a news article! (Email address not verified)'), $_POST['ART_s_name'].' ('.$_POST['ART_s_email'].')'); ! $tags['PLUG'] = sprintf(dgettext('article', 'Courtesy of %s'), $homepage); ! $tags['TITLE'] = PHPWS_Text::parseOutput($this->title); ! $tags['FOOTER'] = sprintf(dgettext('article', 'Copyright %1$s %2$s'), date('Y'), $homepage); ! if ($this->summary) ! $tags['TEXT'] = strip_tags(PHPWS_AM_Data::parseOutput($this->summary)); ! $txt_body = PHPWS_Template::processTemplate($tags, 'article', 'mail_link.tpl'); ! $subject = $homepage.' '.dgettext('article', 'Article').' - '.PHPWS_Text::parseOutput($this->title); ! $sender_name = $_POST['ART_s_name']; ! $sender_email = $_POST['ART_s_email']; ! $recipient_email = $_POST['ART_r_email']; ! PHPWS_Core::initModClass('article', 'AM_Actions.php'); ! $status = PHPWS_AM_Actions::sendmail ($subject, $sender_name, $sender_email, $recipient_email, $txt_body, $html_body, $CC = true); ! if ($status===true) { ! $content = sprintf(dgettext('article', 'The %1$s <b>%2$s</b> has successfully been %3$s') ! , dgettext('article', 'article') ! , $this->title ! , dgettext('article', 'sent to').' '.$recipient_email); ! } elseif($status===false) ! $content = 'EMAIL ERROR: '.$content = dgettext('article', 'Email is not correctly set up on this server.'); ! else ! $content = 'EMAIL ERROR: ' . $status->getMessage(); Layout::addPageTitle(dgettext('article', 'E-mail A Friend').': "'.$this->title); ! $template['TITLE'] = dgettext('article', 'E-mail this Article to a Friend'); ! $template['CONTENT'] = $content .'<br /><br /><div style="text-align:center">[' . PHPWS_Text::moduleLink(sprintf(dgettext('article', 'Go back to %s'), PHPWS_Text::parseOutput($this->title)), 'article', array('id'=>$this->id)). ']</div>'; $finalContent = PHPWS_Template::process($template, 'layout', 'box.tpl'); *************** *** 91,140 **** else if(isset($_POST['ART_no'])) { ! Layout::add($this->view_full()); } else { ! $tags['SEND'] = '<input name="ART_yes" value="'.dgettext('article', 'Send').'" type="submit">'; ! $tags['CANCEL'] = '<input name="ART_no" value="'.dgettext('article', 'Cancel').'" type="submit">'; ! $tags['TITLE'] = PHPWS_Text::parseOutput($this->title); ! if ($this->summary) ! $tags['SUMMARYTEXT'] = PHPWS_AM_Data::parseOutput($this->summary); ! if (MOD_REWRITE_ENABLED && $this->id > 0) ! $link = PHPWS_Text::rewriteLink(dgettext('article', 'Back to Article'), 'article', $this->id); ! else ! $link = PHPWS_Text::moduleLink(dgettext('article', 'Back to Article'), 'article', array('id' => $this->id)); ! $tags['BACKLINK'] = '['.. ']'; ! $tags['R_MAIL_ERROR'] = dgettext('article', 'Friend\'s Email').':'; ! $tags['R_MAIL_LABEL'] = dgettext('article', 'Friend\'s Email').':'; ! $tags['R_MAIL_ADDR'] = '<input type="text" name="ART_r_email" value="" maxlength="200" style="width:50%" />'; ! $tags['R_MAIL_HELP'] = dgettext('article', 'Separate multiple addresses with commas. Maximum 200 characters.'); ! $tags['S_NAME_LABEL'] = dgettext('article', 'Your Full Name: (optional)'); ! $tags['S_NAME'] = '<input type="text" name="ART_s_name" value="'.Current_User::getDisplayName().'" maxlength="155" style="width:50%" />'; ! $tags['S_MAIL_LABEL'] = dgettext('article', 'Your Email Address').':'; ! $tags['S_MAIL_ADDR'] = '<input type="text" name="ART_s_email" value="'.Current_User::getEmail().'" maxlength="100" style="width:50%" />'; ! $tags['S_MAIL_HELP'] = dgettext('article', 'These email addresses will be used to email the information on your behalf and will not be collected or used by us for any marketing purposes without your permission.'); ! $tags['S_COPY_LABEL'] = dgettext('article', 'Send a copy to yourself'); ! $tags['S_COPY'] = '<input name="ART_copy_s" value="1" type="checkbox">'; ! $tags['S_MSG_LABEL'] = dgettext('article', 'Enter a brief message to your friend: (optional)'); ! $tags['S_MSG'] = '<textarea id="ART_s_msg" name="ART_s_msg" rows="3" style="width:95%"></textarea>'; ! $tags['MAIL_TYPE1_LABEL'] = dgettext('article', 'Full Information in HTML'); ! $tags['MAIL_TYPE1'] = '<input name="ART_mail_type" value="full" checked="checked" type="radio">'; ! $tags['MAIL_TYPE2_LABEL'] = dgettext('article', 'Link Only'); ! $tags['MAIL_TYPE2'] = '<input name="ART_mail_type" value="link" type="radio">'; ! foreach ($error AS $key => $value) ! $tags['ERROR_'.$key] = '
<span class="error">'.dgettext('article', 'ERROR: ').$value.'</span><br />
'; ! $tags['CAPTCHA_MSG'] = '<input type="text" name="captcha" value="" maxlength="10" style="width:20%" />'; ! $tags['CAPTCHA_IMAGE'] = Captcha::get(); ! $tags['CAPTCHA_LABEL'] = dgettext('article', 'Copy the word seen in the above image'); Layout::addPageTitle(dgettext('article', 'E-mail A Friend').': "'.$this->title); ! $template['TITLE'] = dgettext('article', 'E-mail this Article to a Friend'); ! $template['CONTENT'] = '<form name="ARTICLE_emailAfriend" action="index.php" method="post">' ! . '<input name="module" value="article" type="hidden">' ! . '<input name="id" value="'.$this->id.'" type="hidden">' ! . '<input name="op" value="email" type="hidden">' ! . PHPWS_Template::processTemplate($tags,'article','mail_form.tpl') ! . '</form>'; $finalContent = PHPWS_Template::process($template, 'layout', 'box.tpl'); Layout::add($finalContent); --- 92,141 ---- else if(isset($_POST['ART_no'])) { ! Layout::add($this->view_full()); } else { ! $tags['SEND'] = '<input name="ART_yes" value="'.dgettext('article', 'Send').'" type="submit">'; ! $tags['CANCEL'] = '<input name="ART_no" value="'.dgettext('article', 'Cancel').'" type="submit">'; ! $tags['TITLE'] = PHPWS_Text::parseOutput($this->title); ! if ($this->summary) ! $tags['SUMMARYTEXT'] = PHPWS_AM_Data::parseOutput($this->summary); ! if (MOD_REWRITE_ENABLED && $this->id > 0) ! $link = PHPWS_Text::rewriteLink(dgettext('article', 'Back to Article'), 'article', $this->id); ! else ! $link = PHPWS_Text::moduleLink(dgettext('article', 'Back to Article'), 'article', array('id' => $this->id)); ! $tags['BACKLINK'] = '["../"]'; ! $tags['R_MAIL_ERROR'] = dgettext('article', 'Friend\'s Email').':'; ! $tags['R_MAIL_LABEL'] = dgettext('article', 'Friend\'s Email').':'; ! $tags['R_MAIL_ADDR'] = '<input type="text" name="ART_r_email" value="" maxlength="200" style="width:50%" />'; ! $tags['R_MAIL_HELP'] = dgettext('article', 'Separate multiple addresses with commas. Maximum 200 characters.'); ! $tags['S_NAME_LABEL'] = dgettext('article', 'Your Full Name: (optional)'); ! $tags['S_NAME'] = '<input type="text" name="ART_s_name" value="'.Current_User::getDisplayName().'" maxlength="155" style="width:50%" />'; ! $tags['S_MAIL_LABEL'] = dgettext('article', 'Your Email Address').':'; ! $tags['S_MAIL_ADDR'] = '<input type="text" name="ART_s_email" value="'.Current_User::getEmail().'" maxlength="100" style="width:50%" />'; ! $tags['S_MAIL_HELP'] = dgettext('article', 'These email addresses will be used to email the information on your behalf and will not be collected or used by us for any marketing purposes without your permission.'); ! $tags['S_COPY_LABEL'] = dgettext('article', 'Send a copy to yourself'); ! $tags['S_COPY'] = '<input name="ART_copy_s" value="1" type="checkbox">'; ! $tags['S_MSG_LABEL'] = dgettext('article', 'Enter a brief message to your friend: (optional)'); ! $tags['S_MSG'] = '<textarea id="ART_s_msg" name="ART_s_msg" rows="3" style="width:95%"></textarea>'; ! $tags['MAIL_TYPE1_LABEL'] = dgettext('article', 'Full Information in HTML'); ! $tags['MAIL_TYPE1'] = '<input name="ART_mail_type" value="full" checked="checked" type="radio">'; ! $tags['MAIL_TYPE2_LABEL'] = dgettext('article', 'Link Only'); ! $tags['MAIL_TYPE2'] = '<input name="ART_mail_type" value="link" type="radio">'; ! foreach ($error AS $key => $value) ! $tags['ERROR_'.$key] = '
<span class="error">'.dgettext('article', 'ERROR: ').$value.'</span><br />
'; ! $tags['CAPTCHA_MSG'] = '<input type="text" name="captcha" value="" maxlength="10" style="width:20%" />'; ! $tags['CAPTCHA_IMAGE'] = Captcha::get(); ! $tags['CAPTCHA_LABEL'] = dgettext('article', 'Copy the word seen in the above image'); Layout::addPageTitle(dgettext('article', 'E-mail A Friend').': "'.$this->title); ! $template['TITLE'] = dgettext('article', 'E-mail this Article to a Friend'); ! $template['CONTENT'] = '<form name="ARTICLE_emailAfriend" action="index.php" method="post">' ! . '<input name="module" value="article" type="hidden">' ! . '<input name="id" value="'.$this->id.'" type="hidden">' ! . '<input name="op" value="email" type="hidden">' ! . PHPWS_Template::processTemplate($tags,'article','mail_form.tpl') ! . '</form>'; $finalContent = PHPWS_Template::process($template, 'layout', 'box.tpl'); Layout::add($finalContent); Index: A_save.php =================================================================== RCS file: /cvsroot/phpwebsite-comm/modules/article/inc/A_save.php,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** A_save.php 17 Oct 2007 04:35:33 -0000 1.18 --- A_save.php 21 Aug 2008 20:17:19 -0000 1.19 *************** *** 1,147 **** ! <?php ! /** ! * function save () ! * Saves this article to the database. ! * ! * @version $Id$ ! * ! * @author Eloi George <el...@NO...> ! * @module Article Manager ! * @param none ! * @return none ! * ! */ ! if(is_string($this->pages)) ! $this->unserialize_sections(); ! /* Save any POSTed article edits */ ! $result = $this->update(); ! if (is_array($result)) ! return implode('<br />', $result); ! if ($result===false) ! return false; ! ! $db = & new PHPWS_DB('article'); ! ! /* Process all sections */ ! $this->pagecount = count($this->pages); ! $this->wordcount = 0; ! foreach($this->pages as $page) { ! foreach($page['section'] as $section) { ! $this->wordcount += substr_count($section['title'],' ') ! + substr_count($section['text'],' ') ! + (($section['title'] !=='')?1:0) ! + (($section['text'] !=='')?1:0); ! } ! } ! ! /* Convert all sections to XML for storage */ ! require_once(PHPWS_SOURCE_DIR . 'lib/pear/XML/Serializer.php'); ! $XML_buffer = $this->pages; ! $options = array( ! 'indent' => "\t", ! 'defaultTagName' => 'array_item', ! 'typeHints' => true ! // 'keyAttribute' => false, ! // 'classAttribute' => true, ! // "addDecl" => true, ! // "encoding" => "UTF-8", ! // 'rootName' => 'PHPWS_Article' ! ); ! $serializer = new XML_Serializer($options); ! $serializer->setErrorHandling(PEAR_ERROR_DIE); ! $serializer->serialize($this->pages); ! $this->pages = str_replace(array(' _type="string"',' _type="integer"'), '', $serializer->getSerializedData()); ! ! ! /* If this is a new or approved article... */ ! if ($this->approved || !$this->id) { ! if ($this->approved) ! $this->draft = 0; ! /* Kludge to allow AM to use negative numbers */ ! if ($autodetect_id && ($this->id < 0)) ! $db->addWhere('id', $this->id); ! /* save the article to article */ ! $result = $db->saveObject($this, FALSE, $autodetect_id); ! if (PHPWS_Error::logIfError($result)) ! return sprintf(dgettext('article', 'There was an error when inserting %1$s into the database %2$s'), 'article data','article').'!';; ! } ! ! ! if ($this->approved) { ! /* Create/Update this article's Key */ ! $update_article = FALSE; ! if (empty($this->key_id)) ! { ! $key = & new Key; ! $update_article = TRUE; ! } ! else ! { ! $key = & new Key($this->key_id); ! if (PHPWS_Error::logIfError($key->_error)) { ! $key = & new Key; ! $update_article = TRUE; ! } ! } ! $key->setModule('article'); ! $key->setItemName('article'); ! $key->setItemId($this->id); ! $key->setEditPermission('edit_articles'); ! $key->setUrl('index.php?module=article&id='.$this->id); ! $key->setTitle($this->title); ! $key->setSummary($this->summary); ! $key->active = 1; ! $result = $key->save(); ! $this->key_id = $key->id; ! if ($update_article) { ! $db1 = & new PHPWS_DB('article'); ! $db1->addValue('key_id', $this->key_id); ! $db1->addWhere('id', $this->id); ! $db1->update(); ! } ! ! /* Comments */ ! if($this->allow_comments && PHPWS_Core::initModClass('comments', 'Comments.php')) { ! $thread = Comments::getThread($this->key_id); ! $thread->allowAnonymous($this->allow_anonymous); ! $thread->save(); ! } ! ! /* Search */ ! $texttags = $this->_get_tags(); ! $search = new Search($this->key_id); ! $search->resetKeywords(); ! $search->addKeywords($texttags['TITLE']); ! $search->addKeywords(@$texttags['SUMMARYTEXT']); ! $search->addKeywords($texttags['BODYTEXT']); ! $result = $search->save(); ! unset($texttags); ! if (PHPWS_Error::logIfError($result)) ! return $result; ! ! /* Save Metatags */ ! require_once(PHPWS_SOURCE_DIR . 'mod/layout/class/LayoutAdmin.php'); ! $_POST['key_id'] = $this->key_id; ! $_POST['page_title'] = strip_tags($this->title); $_POST['meta_description'] = strip_tags($this->summary); ! Layout_Admin::postMeta(); ! ! /* Reset headline caching if this will be on there */ ! if ($this->announce) ! PHPWS_AM_ModSettings::reset_cache(); ! } ! ! /* Save the article in the version archives */ ! PHPWS_Core::initModClass('version', 'Version.php'); ! $version = & new Version('article'); ! $version->setSource($this); ! if (!empty($this->_version_id)) ! $version->setId($this->_version_id); ! $version->setApproved($this->approved); ! $version->save(); ! ! /* Put sections array back into place */ ! $this->pages = $XML_buffer; ! ! return true; ?> \ No newline at end of file --- 1,153 ---- ! <?php ! /** ! * function save () ! * Saves this article to the database. ! * ! * @version $Id$ ! * ! * @author Eloi George <el...@NO...> ! * @module Article Manager ! * @param bool $autodetect_id : If false, the article will be saved as a new article with the supplied id ! * @return none ! * ! */ ! if(is_string($this->pages)) ! $this->unserialize_sections(); ! /* Save any POSTed article edits */ ! $result = $this->update(); ! if (is_array($result)) ! return implode('<br />', $result); ! if ($result===false) ! return false; ! ! $db = & new PHPWS_DB('article'); ! ! /* Process all sections */ ! $this->pagecount = count($this->pages); ! $this->wordcount = 0; ! foreach($this->pages as $page) { ! foreach($page['section'] as $section) { ! $this->wordcount += substr_count($section['title'],' ') ! + substr_count($section['text'],' ') ! + (($section['title'] !=='')?1:0) ! + (($section['text'] !=='')?1:0); ! } ! } ! ! /* Convert all sections to XML for storage */ ! require_once(PHPWS_SOURCE_DIR . 'lib/pear/XML/Serializer.php'); ! $XML_buffer = $this->pages; ! $options = array( ! 'indent' => "\t", ! 'defaultTagName' => 'array_item', ! 'typeHints' => true ! // 'keyAttribute' => false, ! // 'classAttribute'... [truncated message content] |