Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Article Manager v1.0


RobAnderson

Recommended Posts

Hi All,

I've got a problem with an install or article manager 1.2

 

When I try and make an update of anything to do with the article manager i get an error:

 

"Warning: Cannot modify header information - headers already sent by (output started at c:\inetpub\wwwroot\ess\catalog\admin\includes\languages\english.php:327) in c:\inetpub\wwwroot\ess\catalog\admin\includes\functions\general.php on line 18"

 

I comment out general line 18 which is header('Location: ' . $url); and it goes through ok but then i have another problem...

 

When I make a change with anything to do with article manager, wether it be to change a configuration setting, or add a new article, i am left with a blank screen, when i click back the change has been made, but why is it that its going to a blank screen...

 

Appreciate any help

 

Thanks

Biz

Link to comment
Share on other sites

Mostly, I don't want to use the articles infobox, and instead point people to certain topic pages via hardlinks (well, firm links, heh (via tep_href_link)) ... the problem seems to be that none of the subtopics are displayed on the topic pages.

 

for example lets say I have main topics "Ideas," "Reviews," and "Help" ... Help has subtopics "Ordering," and "Returns", and Returns has subsubtopics "Defective Returns," and "Nondefective Returns"

 

When I visit articles.php?tPath=3, I get "Help" but none of the subtopics are listed ... so there's no way for people to navigate to any of the subtopics or subsubtopics.

 

When I visit articles.php?tPath=3_7, I get "Defective Returns" ... the breadcrumb shows the right path

 

Am I missing something obvious?

*shrug*

 

Thanks.

Link to comment
Share on other sites

I don't want to use Topics; I want my articles to appear in a flat structure -- i.e., all at the "Top" level. But when I put articles in "Top", they don't appear in the infobox, or in any of the article listing pages. Is this a limitation of the Article Manager at present, or something I need to change in config?

 

TIA

Link to comment
Share on other sites

Hello,

i very satisfied. I have a big problem with article manger.

 

I think i do my best with the installation, but i get a mistake like this...

 

Cannot redeclare tep_parse_topic_path() (previously declared in /home/www/web1/html/php/shop/laumann/admin/includes/functions/articles.php:14) in /home/www/web1/html/php/shop/laumann/admin/includes/functions/articles.php on line 14

 

 

It would have been very nice if somebody could help me.

Link to comment
Share on other sites

HI all

 

As anyone expanded this alrady beautiful contribution?

 

I am after (uploading topics images, articles images ) the same way the actul category works...

 

I have tried a few time but made a mess of it.. :(

 

I would appreciate if someone who has done it, would contribute.

 

Thanks

 

Salvo

Link to comment
Share on other sites

I got images working on articles manager. Just use the code from categories.php and add article_image filed to articles table.

HI Matti,

 

I know it shouldn't be too difficult, But I must be missing something on the line. and following the category file, I can't make upload the images for topics or articles.

 

would you care to share the file so I can compair with mine?

 

Thanks

 

Salvo

Link to comment
Share on other sites

I need some help with a little mod Im doing to the article manager. If you look here:

 

http://unbreakable.server287.com/catalog/index.php

 

you will see that I am basically turning the article manager into a front-page content generator. If I ever get this set up properly, I will be able add news and articles to the homepage via database. The dynamic articles are added to the homepage via an inserted php file. The top three boxes are the articles from the database, the bottom is just some inserted code that is in the format Im looking for.

 

Here is what I would like to do next. I would like to have the page display articles broken up by topic, then date. You can see how I would like to break this up if you look at the bottom news box. I would want the news category to look like that if it had one article.

 

Here is my problem. I know a lot of web design, but Im not a web programmer. I know enough to stumble through certain things, and reverse engineer others, but this combination of tables/php/databases has me stumped. Can someone who has a bit of experience with this particular contribution give me a little advice as of how to approach this, or offer a little code pertaining to what Im looking for? Here is the php file I use to call this content dynamically within my homepage.

 

Thanks!

-Noods

 

<?php

 include(DIR_WS_FUNCTIONS . 'clean_html_comments.php'); 
 $articles_new_array = array();
 $articles_new_query_raw = "select a.articles_id, a.articles_date_added, ad.articles_name, ad.articles_head_desc_tag, au.authors_id, au.authors_name, td.topics_id, td.topics_name from " . TABLE_ARTICLES . " a, " . TABLE_ARTICLES_TO_TOPICS . " a2t left join " . TABLE_TOPICS_DESCRIPTION . " td on a2t.topics_id = td.topics_id left join " . TABLE_AUTHORS . " au on a.authors_id = au.authors_id, " . TABLE_ARTICLES_DESCRIPTION . " ad where (a.articles_date_available IS NULL or to_days(a.articles_date_available) <= to_days(now())) and a.articles_id = a2t.articles_id and a.articles_status = '1' and a.articles_id = ad.articles_id and ad.language_id = '" . (int)$languages_id . "' and td.language_id = '" . (int)$languages_id . "' and a.articles_date_added > SUBDATE(now( ), INTERVAL '" . NEW_ARTICLES_DAYS_DISPLAY . "' DAY) order by a.articles_date_added desc, ad.articles_name";
 $articles_new_split = new splitPageResults($articles_new_query_raw, MAX_NEW_ARTICLES_PER_PAGE);

 if ($articles_new_split->number_of_rows > 0)
 {
   $articles_new_query = tep_db_query($articles_new_split->sql_query);

   while ($articles_new = tep_db_fetch_array($articles_new_query))
   {

?>

       <td bgcolor="#333388" width="100%">
         <table width="100%" border="0" cellspacing="1" cellpadding="3">
         <tr>
         <td>
           <table border="0" width="100%" cellspacing="0" cellpadding="0">
           <tr>
           <td valign="top" class="main" width="75%">

<?php

 echo '<a href="' . tep_href_link(FILENAME_ARTICLE_INFO, 'articles_id=' . $articles_new['articles_id']) . '"><b>' . $articles_new['articles_name'] . '</b></a> ';
 
 if (DISPLAY_AUTHOR_ARTICLE_LISTING == 'true' && tep_not_null($articles_new['authors_name']))
 {
  echo TEXT_BY . ' ' . '<a href="' . tep_href_link(FILENAME_ARTICLES, 'authors_id=' . $articles_new['authors_id']) . '"> ' . $articles_new['authors_name'] . '</a>';
 }

?>

           </td>

<?php
     if (DISPLAY_TOPIC_ARTICLE_LISTING == 'true' && tep_not_null($articles_new['topics_name'])) {
?>
           <td valign="top" class="main" width="25%" nowrap><?php echo TEXT_TOPIC . ' <a href="' . tep_href_link(FILENAME_ARTICLES, 'tPath=' . $articles_new['topics_id']) . '">' . $articles_new['topics_name'] . '</a>'; ?></td>
<?php
     }
?>
         </tr>
<?php
     if (DISPLAY_ABSTRACT_ARTICLE_LISTING == 'true') {
?>
         <tr>
           <td class="main" style="padding-left:15px"><?php echo clean_html_comments(substr($articles_new['articles_head_desc_tag'],0, MAX_ARTICLE_ABSTRACT_LENGTH)) . ((strlen($articles_new['articles_head_desc_tag']) >= MAX_ARTICLE_ABSTRACT_LENGTH) ? '...' : ''); ?></td>
         </tr>
<?php
     }
     if (DISPLAY_DATE_ADDED_ARTICLE_LISTING == 'true') {
?>
         <tr>
           <td class="smalltext" style="padding-left:15px"><?php echo TEXT_DATE_ADDED . ' ' . tep_date_long($articles_new['articles_date_added']); ?></td>
         </tr>
<?php
     }
     if (DISPLAY_ABSTRACT_ARTICLE_LISTING == 'true' || DISPLAY_DATE_ADDED_ARTICLE_LISTING) {
?>
         <tr>
           <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
         </tr>
<?php
}
?>

 </table></td></tr></table></td>

<tr><td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td></tr>
<?php

} // End of listing loop
   } 
?>
     <td bgcolor="#333388" width="100%">
       <table width="100%" border="0" cellspacing="1" cellpadding="3">
       <tr>
       <td colspan="2" bgcolor="#333388"><font face="verdana, arial, helvetica" size="2" color="#3377FF" class="nf" color="#3377FF"> <b> News</b></font>
       </td>
       </tr>
       <tr>
       <td colspan="2" bgcolor="#000000"><font face="verdana,arial,helvetica" size="1" color="#3377FF" class="sf">
         <table border="0" cellspacing="0" cellpadding="0" width="100%">
         <tr>
         <td bgcolor="#333388" width="100%">
           <table width="100%" border="0" cellspacing="1" cellpadding="3">
           <tr>
           <td bgcolor="#333388" width="100%"><font face="verdana, arial, helvetica" size="2" color="#3377FF" class="nf" color = "#3377FF"><b>Another update...</b></font><font face="verdana,arial,helvetica" size="1" color="#3377FF" class="sf"><b> Posted by: Amidrio on 3-29-2003 @ 5:31 PM</b></font>
           </td>
           </tr>
           <tr>
           <th bgcolor="#000000" width="100%" align="right">
             <table width="100%" border="0" cellspacing="0" cellpadding="0" bordercolor="#000000">
             <tr>
             <td bgcolor="#000000" valign="top" align="justify" bordercolor="#000000"><font face="verdana,arial,helvetica" size="1" color="#3377FF" class="sf">Updated the DAoC Links section. Updated the DAoC Maps section.  updated the DAoC Resources section.<br><br></font>
             </td>
             </tr>
             </table>
           <font face="verdana,arial,helvetica" size="1" color="yellow"><a href="http://68.34.99.152/cgi-bin/ikonboard.cgi?s=3e813ec56155ffff;act=ST;f=1;t=356"><b>Report a problem</a></font>
           </th>
           </tr>
           </table>
         </td>
         </tr>
         </table>
       </td>
       </tr>
       </table>
   </td>

Link to comment
Share on other sites

Hi all,

 

I am trying to add copying from admin/category.php the possobility of uploading an article image to the article.php

 

I have created a field to articles table,

 

I have added all ( I think ) codes for the image but:

 

It doesn't upload the image.

 

I can enter and view the image as far as the PREVIEW ARTICLE, but it does NOT upload.

 

I would appreciate any help with this file..

 

Thanks

 

Salvo

Link to comment
Share on other sites

I have added this code below to articles.php taken from categories.php

 

I have changed

case 'product_preview': to case 'article_preview':

 

and placed it in the same position as per categories.php but make I click on it, and it tell me the this case shouldn't be there. any reason?

 

Thanks for any help

 

 

case 'product_preview':

// copy image only if modified

$articles_image = new upload('articles_image');

$articles_image->set_destination(DIR_FS_CATALOG_IMAGES);

if ($articless_image->parse() && $articles_image->save()) {

$articles_image_name = $articles_image->filename;

} else {

$articles_image_name = (isset($HTTP_POST_VARS['articles_previous_image']) ? $HTTP_POST_VARS['articles_previous_image'] : '');

}

break;

}

}

Link to comment
Share on other sites

OK, Well Done Salvo

 

After 3 days, 3 nights try and errors, I have managered to have the article with images....

 

Now I will try to add images to topics.. If someone has done already so and like to share it, I would appreciated it.

 

As soon as I have done finished (topics and articles images) I WILL upload it as a contribution.

Link to comment
Share on other sites

Hi everyone,

 

This is a brilliant contribution. Installed easy and worked first time. Congratulations to the author.

 

In fact its so good that every time I add a new product or update product descriptions in admin, my product description page in Admin looks NAFF!!!.

The HTML editor would look great here too. If only...

 

Is there any way to use the HTML editor which comes with Article Manager, on the boxes in Product Description page as well?? Or would I need a new contribution.

 

Any suggestions would be appreciated.

 

Many thanks

 

Maz.

Link to comment
Share on other sites

Rob - great contribution. We installed and got it up and running with almost no trouble.

 

Just one question about functionality - we are currently able cross-sell a product from the article, but can't figure out how to link from one/several products to an article. What we are trying to do is offer context sensitive artilces that appear based on the product or product group that the customer is browsing. It's the inverse of cross-selling a product from the article (although, we do that too).

 

Is this functionality there, but we haven't found it, or is it not built yet? Can anyone offer suggestions on how to mod it?

 

One more thing - has anyone been able to modify the stock search functionality so that it searches article title/content? This would be a huge plus for customer usability.

 

Thanks in advance,

Link to comment
Share on other sites

Salvo: Could you tell how you did that?

 

Because I have been triyn all day to do something pretty much the same. Also using the code from categories.php. But I cannot upload any images. the field to upload images just doesn't look the same in articles.php as in categories.php??

 

/Martin

Link to comment
Share on other sites

OK, here it is for all of you who need the article image.

 

admin/articles.php

 

from the original upload, I have added the image hack to allow you to upload images for the article.

 

you will have to add a field to your table called articles_image.

most of my additions are commented but NOT all, so, compare or just use it.

 

when creating new field, please BACKUP YOU DATABASE before.

If you use this file, please do not delete yours, or back it up

here it is:

 

If someone like to add the uploading of category image, please let me know. I need it too.

 

<?php

/*

$Id: articles.php, v1.0 2003/12/04 12:00:00 ra Exp $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2003 osCommerce

 

Released under the GNU General Public License

*/

 

require('includes/application_top.php');

 

$action = (isset($HTTP_GET_VARS['action']) ? $HTTP_GET_VARS['action'] : '');

 

if (tep_not_null($action)) {

switch ($action) {

case 'setflag':

if ( ($HTTP_GET_VARS['flag'] == '0') || ($HTTP_GET_VARS['flag'] == '1') ) {

if (isset($HTTP_GET_VARS['aID'])) {

tep_set_article_status($HTTP_GET_VARS['aID'], $HTTP_GET_VARS['flag']);

}

 

if (USE_CACHE == 'true') {

tep_reset_cache_block('topics');

}

}

 

tep_redirect(tep_href_link(FILENAME_ARTICLES, 'tPath=' . $HTTP_GET_VARS['tPath'] . '&aID=' . $HTTP_GET_VARS['aID']));

break;

case 'new_topic':

case 'edit_topic':

$HTTP_GET_VARS['action']=$HTTP_GET_VARS['action'] . '_ACD';

break;

case 'insert_topic':

case 'update_topic':

if ( ($HTTP_POST_VARS['edit_x']) || ($HTTP_POST_VARS['edit_y']) ) {

$HTTP_GET_VARS['action'] = 'edit_topic_ACD';

} else {

if (isset($HTTP_POST_VARS['topics_id'])) $topics_id = tep_db_prepare_input($HTTP_POST_VARS['topics_id']);

if ($topics_id == '') {

$topics_id = tep_db_prepare_input($HTTP_GET_VARS['tID']);

}

$sort_order = tep_db_prepare_input($HTTP_POST_VARS['sort_order']);

 

$sql_data_array = array('sort_order' => $sort_order);

 

if ($action == 'insert_topic') {

$insert_sql_data = array('parent_id' => $current_topic_id,

'date_added' => 'now()');

 

$sql_data_array = array_merge($sql_data_array, $insert_sql_data);

 

tep_db_perform(TABLE_TOPICS, $sql_data_array);

 

$topics_id = tep_db_insert_id();

} elseif ($action == 'update_topic') {

$update_sql_data = array('last_modified' => 'now()');

 

$sql_data_array = array_merge($sql_data_array, $update_sql_data);

 

tep_db_perform(TABLE_TOPICS, $sql_data_array, 'update', "topics_id = '" . (int)$topics_id . "'");

}

 

$languages = tep_get_languages();

for ($i=0, $n=sizeof($languages); $i<$n; $i++) {

 

$language_id = $languages[$i]['id'];

 

$sql_data_array = array('topics_name' => tep_db_prepare_input($HTTP_POST_VARS['topics_name'][$language_id]),

'topics_heading_title' => tep_db_prepare_input($HTTP_POST_VARS['topics_heading_title'][$language_id]),

'topics_description' => tep_db_prepare_input($HTTP_POST_VARS['topics_description'][$language_id]));

 

if ($action == 'insert_topic') {

$insert_sql_data = array('topics_id' => $topics_id,

'language_id' => $languages[$i]['id']);

 

$sql_data_array = array_merge($sql_data_array, $insert_sql_data);

 

tep_db_perform(TABLE_TOPICS_DESCRIPTION, $sql_data_array);

} elseif ($action == 'update_topic') {

tep_db_perform(TABLE_TOPICS_DESCRIPTION, $sql_data_array, 'update', "topics_id = '" . (int)$topics_id . "' and language_id = '" . (int)$languages[$i]['id'] . "'");

}

}

 

if (USE_CACHE == 'true') {

tep_reset_cache_block('topics');

}

 

tep_redirect(tep_href_link(FILENAME_ARTICLES, 'tPath=' . $tPath . '&tID=' . $topics_id));

break;

}

case 'delete_topic_confirm':

if (isset($HTTP_POST_VARS['topics_id'])) {

$topics_id = tep_db_prepare_input($HTTP_POST_VARS['topics_id']);

 

$topics = tep_get_topic_tree($topics_id, '', '0', '', true);

$articles = array();

$articles_delete = array();

 

for ($i=0, $n=sizeof($topics); $i<$n; $i++) {

$article_ids_query = tep_db_query("select articles_id from " . TABLE_ARTICLES_TO_TOPICS . " where topics_id = '" . (int)$topics[$i]['id'] . "'");

 

while ($article_ids = tep_db_fetch_array($article_ids_query)) {

$articles[$article_ids['articles_id']]['topics'][] = $topics[$i]['id'];

}

}

 

reset($articles);

while (list($key, $value) = each($articles)) {

$topic_ids = '';

 

for ($i=0, $n=sizeof($value['topics']); $i<$n; $i++) {

$topic_ids .= "'" . (int)$value['topics'][$i] . "', ";

}

$topic_ids = substr($topic_ids, 0, -2);

 

$check_query = tep_db_query("select count(*) as total from " . TABLE_ARTICLES_TO_TOPICS . " where articles_id = '" . (int)$key . "' and topics_id not in (" . $topic_ids . ")");

$check = tep_db_fetch_array($check_query);

if ($check['total'] < '1') {

$articles_delete[$key] = $key;

}

}

 

// removing topics can be a lengthy process

tep_set_time_limit(0);

for ($i=0, $n=sizeof($topics); $i<$n; $i++) {

tep_remove_topic($topics[$i]['id']);

}

 

reset($articles_delete);

while (list($key) = each($articles_delete)) {

tep_remove_article($key);

}

}

 

if (USE_CACHE == 'true') {

tep_reset_cache_block('topics');

}

 

tep_redirect(tep_href_link(FILENAME_ARTICLES, 'tPath=' . $tPath));

break;

case 'delete_article_confirm':

if (isset($HTTP_POST_VARS['articles_id']) && isset($HTTP_POST_VARS['article_topics']) && is_array($HTTP_POST_VARS['article_topics'])) {

$article_id = tep_db_prepare_input($HTTP_POST_VARS['articles_id']);

$article_topics = $HTTP_POST_VARS['article_topics'];

 

for ($i=0, $n=sizeof($article_topics); $i<$n; $i++) {

tep_db_query("delete from " . TABLE_ARTICLES_TO_TOPICS . " where articles_id = '" . (int)$article_id . "' and topics_id = '" . (int)$article_topics[$i] . "'");

}

 

$article_topics_query = tep_db_query("select count(*) as total from " . TABLE_ARTICLES_TO_TOPICS . " where articles_id = '" . (int)$article_id . "'");

$article_topics = tep_db_fetch_array($article_topics_query);

 

if ($article_topics['total'] == '0') {

tep_remove_article($article_id);

}

}

 

if (USE_CACHE == 'true') {

tep_reset_cache_block('topics');

}

 

tep_redirect(tep_href_link(FILENAME_ARTICLES, 'tPath=' . $tPath));

break;

case 'move_topic_confirm':

if (isset($HTTP_POST_VARS['topics_id']) && ($HTTP_POST_VARS['topics_id'] != $HTTP_POST_VARS['move_to_topic_id'])) {

$topics_id = tep_db_prepare_input($HTTP_POST_VARS['topics_id']);

$new_parent_id = tep_db_prepare_input($HTTP_POST_VARS['move_to_topic_id']);

 

$path = explode('_', tep_get_generated_topic_path_ids($new_parent_id));

 

if (in_array($topics_id, $path)) {

$messageStack->add_session(ERROR_CANNOT_MOVE_TOPIC_TO_PARENT, 'error');

 

tep_redirect(tep_href_link(FILENAME_ARTICLES, 'tPath=' . $tPath . '&tID=' . $topics_id));

} else {

tep_db_query("update " . TABLE_TOPICS . " set parent_id = '" . (int)$new_parent_id . "', last_modified = now() where topics_id = '" . (int)$topics_id . "'");

 

if (USE_CACHE == 'true') {

tep_reset_cache_block('topics');

}

 

tep_redirect(tep_href_link(FILENAME_ARTICLES, 'tPath=' . $new_parent_id . '&tID=' . $topics_id));

}

}

 

break;

case 'move_article_confirm':

$articles_id = tep_db_prepare_input($HTTP_POST_VARS['articles_id']);

$new_parent_id = tep_db_prepare_input($HTTP_POST_VARS['move_to_topic_id']);

 

$duplicate_check_query = tep_db_query("select count(*) as total from " . TABLE_ARTICLES_TO_TOPICS . " where articles_id = '" . (int)$articles_id . "' and topics_id = '" . (int)$new_parent_id . "'");

$duplicate_check = tep_db_fetch_array($duplicate_check_query);

if ($duplicate_check['total'] < 1) tep_db_query("update " . TABLE_ARTICLES_TO_TOPICS . " set topics_id = '" . (int)$new_parent_id . "' where articles_id = '" . (int)$articles_id . "' and topics_id = '" . (int)$current_topic_id . "'");

 

if (USE_CACHE == 'true') {

tep_reset_cache_block('topics');

}

 

tep_redirect(tep_href_link(FILENAME_ARTICLES, 'tPath=' . $new_parent_id . '&aID=' . $articles_id));

break;

case 'insert_article':

case 'update_article':

if (isset($HTTP_POST_VARS['edit_x']) || isset($HTTP_POST_VARS['edit_y'])) {

$action = 'new_article';

} else {

if (isset($HTTP_GET_VARS['aID'])) $articles_id = tep_db_prepare_input($HTTP_GET_VARS['aID']);

$articles_date_available = tep_db_prepare_input($HTTP_POST_VARS['articles_date_available']);

 

$articles_date_available = (date('Y-m-d') < $articles_date_available) ? $articles_date_available : 'null';

 

$sql_data_array = array('articles_date_available' => $articles_date_available,

'articles_status' => tep_db_prepare_input($HTTP_POST_VARS['articles_status']),

'authors_id' => tep_db_prepare_input($HTTP_POST_VARS['authors_id']));

// Added Image Salvo

if (isset($HTTP_POST_VARS['articles_image']) && tep_not_null($HTTP_POST_VARS['articles_image']) && ($HTTP_POST_VARS['articles_image'] != 'none')) {

$sql_data_array['articles_image'] = tep_db_prepare_input($HTTP_POST_VARS['articles_image']);

}

// Added Image Salvo

if ($action == 'insert_article') {

// If expected article then articles_date _added becomes articles_date_available

if (isset($HTTP_POST_VARS['articles_date_available']) && tep_not_null($HTTP_POST_VARS['articles_date_available'])) {

$insert_sql_data = array('articles_date_added' => tep_db_prepare_input($HTTP_POST_VARS['articles_date_available']));

} else {

$insert_sql_data = array('articles_date_added' => 'now()');

}

 

$sql_data_array = array_merge($sql_data_array, $insert_sql_data);

 

tep_db_perform(TABLE_ARTICLES, $sql_data_array);

$articles_id = tep_db_insert_id();

 

tep_db_query("insert into " . TABLE_ARTICLES_TO_TOPICS . " (articles_id, topics_id) values ('" . (int)$articles_id . "', '" . (int)$current_topic_id . "')");

} elseif ($action == 'update_article') {

$update_sql_data = array('articles_last_modified' => 'now()');

// If expected article then articles_date _added becomes articles_date_available

if (isset($HTTP_POST_VARS['articles_date_available']) && tep_not_null($HTTP_POST_VARS['articles_date_available'])) {

$update_sql_data = array('articles_date_added' => tep_db_prepare_input($HTTP_POST_VARS['articles_date_available']));

}

 

$sql_data_array = array_merge($sql_data_array, $update_sql_data);

 

tep_db_perform(TABLE_ARTICLES, $sql_data_array, 'update', "articles_id = '" . (int)$articles_id . "'");

}

 

$languages = tep_get_languages();

for ($i=0, $n=sizeof($languages); $i<$n; $i++) {

$language_id = $languages[$i]['id'];

 

$sql_data_array = array('articles_name' => tep_db_prepare_input($HTTP_POST_VARS['articles_name'][$language_id]),

'articles_description' => tep_db_prepare_input($HTTP_POST_VARS['articles_description'][$language_id]),

'articles_url' => tep_db_prepare_input($HTTP_POST_VARS['articles_url'][$language_id]),

'articles_head_title_tag' => tep_db_prepare_input($HTTP_POST_VARS['articles_head_title_tag'][$language_id]),

'articles_head_desc_tag' => tep_db_prepare_input($HTTP_POST_VARS['articles_head_desc_tag'][$language_id]),

'articles_head_keywords_tag' => tep_db_prepare_input($HTTP_POST_VARS['articles_head_keywords_tag'][$language_id]));

 

if ($action == 'insert_article') {

$insert_sql_data = array('articles_id' => $articles_id,

'language_id' => $language_id);

 

$sql_data_array = array_merge($sql_data_array, $insert_sql_data);

 

tep_db_perform(TABLE_ARTICLES_DESCRIPTION, $sql_data_array);

} elseif ($action == 'update_article') {

tep_db_perform(TABLE_ARTICLES_DESCRIPTION, $sql_data_array, 'update', "articles_id = '" . (int)$articles_id . "' and language_id = '" . (int)$language_id . "'");

}

}

 

if (USE_CACHE == 'true') {

tep_reset_cache_block('topics');

}

 

tep_redirect(tep_href_link(FILENAME_ARTICLES, 'tPath=' . $tPath . '&aID=' . $articles_id));

}

break;

case 'copy_to_confirm':

if (isset($HTTP_POST_VARS['articles_id']) && isset($HTTP_POST_VARS['topics_id'])) {

$articles_id = tep_db_prepare_input($HTTP_POST_VARS['articles_id']);

$topics_id = tep_db_prepare_input($HTTP_POST_VARS['topics_id']);

 

if ($HTTP_POST_VARS['copy_as'] == 'link') {

if ($topics_id != $current_topic_id) {

$check_query = tep_db_query("select count(*) as total from " . TABLE_ARTICLES_TO_TOPICS . " where articles_id = '" . (int)$articles_id . "' and topics_id = '" . (int)$topics_id . "'");

$check = tep_db_fetch_array($check_query);

if ($check['total'] < '1') {

tep_db_query("insert into " . TABLE_ARTICLES_TO_TOPICS . " (articles_id, topics_id) values ('" . (int)$articles_id . "', '" . (int)$topics_id . "')");

}

} else {

$messageStack->add_session(ERROR_CANNOT_LINK_TO_SAME_TOPIC, 'error');

}

} elseif ($HTTP_POST_VARS['copy_as'] == 'duplicate') {

$article_query = tep_db_query("select articles_date_available, authors_id, articles_image from " . TABLE_ARTICLES . " where articles_id = '" . (int)$articles_id . "'");

$article = tep_db_fetch_array($article_query);

 

tep_db_query("insert into " . TABLE_ARTICLES . " (articles_date_added, articles_date_available, articles_status, authors_id, articles_image) values (now(), '" . tep_db_input($article['articles_date_available']) . "', '0', '" . (int)$article['authors_id'] . "','" . tep_db_input($articles['articles_image']) . "')");

$dup_articles_id = tep_db_insert_id();

 

$description_query = tep_db_query("select language_id, articles_name, articles_description, articles_url, articles_head_title_tag, articles_head_desc_tag, articles_head_keywords_tag from " . TABLE_ARTICLES_DESCRIPTION . " where articles_id = '" . (int)$articles_id . "'");

while ($description = tep_db_fetch_array($description_query)) {

tep_db_query("insert into " . TABLE_ARTICLES_DESCRIPTION . " (articles_id, language_id, articles_name, articles_description, articles_url, articles_head_title_tag, articles_head_desc_tag, articles_head_keywords_tag, articles_viewed) values ('" . (int)$dup_articles_id . "', '" . (int)$description['language_id'] . "', '" . tep_db_input($description['articles_name']) . "', '" . tep_db_input($description['articles_description']) . "', '" . tep_db_input($description['articles_url']) . "', '" . tep_db_input($description['articles_head_title_tag']) . "', '" . tep_db_input($description['articles_head_desc_tag']) . "', '" . tep_db_input($description['articles_head_keywords_tag']) . "', '0')");

}

 

tep_db_query("insert into " . TABLE_ARTICLES_TO_TOPICS . " (articles_id, topics_id) values ('" . (int)$dup_articles_id . "', '" . (int)$topics_id . "')");

$articles_id = $dup_articles_id;

}

 

if (USE_CACHE == 'true') {

tep_reset_cache_block('topics');

}

}

 

tep_redirect(tep_href_link(FILENAME_ARTICLES, 'tPath=' . $topics_id . '&aID=' . $articles_id));

break;

}

}

 

// check if the catalog image directory exists

if (is_dir(DIR_FS_CATALOG_IMAGES)) {

if (!is_writeable(DIR_FS_CATALOG_IMAGES)) $messageStack->add(ERROR_CATALOG_IMAGE_DIRECTORY_NOT_WRITEABLE, 'error');

} else {

$messageStack->add(ERROR_CATALOG_IMAGE_DIRECTORY_DOES_NOT_EXIST, 'error');

}

?>

<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">

<html <?php echo HTML_PARAMS; ?>>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">

<?php

// BOF: WebMakers.com Changed: Header Tag Controller v1.0

// Replaced by header_tags.php

if ( file_exists(DIR_WS_INCLUDES . 'header_tags.php') ) {

require(DIR_WS_INCLUDES . 'header_tags.php');

} else {

?>

<title><?php echo TITLE ?></title>

<?php

}

// EOF: WebMakers.com Changed: Header Tag Controller v1.0

?>

<script language="Javascript1.2"><!-- // load htmlarea

// MaxiDVD Added WYSIWYG HTML Area Box + Admin Function v1.7 - 2.2 MS2 Articles Description HTML - Head

_editor_url = "<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_ADMIN; ?>htmlarea/"; // URL to htmlarea files

var win_ie_ver = parseFloat(navigator.appVersion.split("MSIE")[1]);

if (navigator.userAgent.indexOf('Mac') >= 0) { win_ie_ver = 0; }

if (navigator.userAgent.indexOf('Windows CE') >= 0) { win_ie_ver = 0; }

if (navigator.userAgent.indexOf('Opera') >= 0) { win_ie_ver = 0; }

<?php if (ARTICLE_MANAGER_WYSIWYG_BASIC == 'Basic'){ ?> if (win_ie_ver >= 5.5) {

document.write('<scr' + 'ipt src="' +_editor_url+ 'editor_basic.js"');

document.write(' language="Javascript1.2"></scr' + 'ipt>');

} else { document.write('<scr'+'ipt>function editor_generate() { return false; }</scr'+'ipt>'); }

<?php } else{ ?> if (win_ie_ver >= 5.5) {

document.write('<scr' + 'ipt src="' +_editor_url+ 'editor_advanced.js"');

document.write(' language="Javascript1.2"></scr' + 'ipt>');

} else { document.write('<scr'+'ipt>function editor_generate() { return false; }</scr'+'ipt>'); }

<?php }?>

// --></script>

<link rel="stylesheet" type="text/css" href="includes/stylesheet.css">

<script language="javascript" src="includes/general.js"></script>

</head>

<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF" onload="SetFocus();">

<div id="spiffycalendar" class="text"></div>

<!-- header //-->

<?php require(DIR_WS_INCLUDES . 'header.php'); ?>

<!-- header_eof //-->

 

<!-- body //-->

<table border="0" width="100%" cellspacing="2" cellpadding="2">

<tr>

<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="1" cellpadding="1" class="columnLeft">

<!-- left_navigation //-->

<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>

<!-- left_navigation_eof //-->

</table></td>

<!-- body_text //-->

<td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">

<?php

//----- new_topic / edit_topic -----

if ($HTTP_GET_VARS['action'] == 'new_topic_ACD' || $HTTP_GET_VARS['action'] == 'edit_topic_ACD') {

if ( ($HTTP_GET_VARS['tID']) && (!$HTTP_POST_VARS) ) {

$topics_query = tep_db_query("select t.topics_id, td.topics_name, td.topics_heading_title, td.topics_description, t.parent_id, t.sort_order, t.date_added, t.last_modified from " . TABLE_TOPICS . " t, " . TABLE_TOPICS_DESCRIPTION . " td where t.topics_id = '" . $HTTP_GET_VARS['tID'] . "' and t.topics_id = td.topics_id and td.language_id = '" . $languages_id . "' order by t.sort_order, td.topics_name");

$topic = tep_db_fetch_array($topics_query);

 

$tInfo = new objectInfo($topic);

} elseif ($HTTP_POST_VARS) {

$tInfo = new objectInfo($HTTP_POST_VARS);

$topics_name = $HTTP_POST_VARS['topics_name'];

$topics_heading_title = $HTTP_POST_VARS['topics_heading_title'];

$topics_description = $HTTP_POST_VARS['topics_description'];

$topics_url = $HTTP_POST_VARS['topics_url'];

} else {

$tInfo = new objectInfo(array());

}

 

$languages = tep_get_languages();

 

$text_new_or_edit = ($HTTP_GET_VARS['action']=='new_topic_ACD') ? TEXT_INFO_HEADING_NEW_TOPIC : TEXT_INFO_HEADING_EDIT_TOPIC;

?>

<tr>

<td><table border="0" width="100%" cellspacing="0" cellpadding="0">

<tr>

<td class="pageHeading"><?php echo sprintf($text_new_or_edit, tep_output_generated_topic_path($current_topic_id)); ?></td>

<td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>

</tr>

</table></td>

</tr>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>

</tr>

<tr><?php echo tep_draw_form('new_topic', FILENAME_ARTICLES, 'tPath=' . $tPath . '&tID=' . $HTTP_GET_VARS['tID'] . '&action=new_topic_preview', 'post', 'enctype="multipart/form-data"'); ?>

<td><table border="0" cellspacing="0" cellpadding="2">

<?php

for ($i=0; $i<sizeof($languages); $i++) {

?>

<tr>

<td class="main"><?php if ($i == 0) echo TEXT_EDIT_TOPICS_NAME; ?></td>

<td class="main"><?php echo tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']) . ' ' . tep_draw_input_field('topics_name[' . $languages[$i]['id'] . ']', (($topics_name[$languages[$i]['id']]) ? stripslashes($topics_name[$languages[$i]['id']]) : tep_get_topic_name($tInfo->topics_id, $languages[$i]['id']))); ?></td>

</tr>

<?php

}

?>

<tr>

<td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>

</tr>

<?php

for ($i=0; $i<sizeof($languages); $i++) {

?>

<tr>

<td class="main"><?php if ($i == 0) echo TEXT_EDIT_TOPICS_HEADING_TITLE; ?></td>

<td class="main"><?php echo tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']) . ' ' . tep_draw_input_field('topics_heading_title[' . $languages[$i]['id'] . ']', (($topics_name[$languages[$i]['id']]) ? stripslashes($topics_name[$languages[$i]['id']]) : tep_get_topic_heading_title($tInfo->topics_id, $languages[$i]['id']))); ?></td>

</tr>

<?php

}

?>

<tr>

<td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>

</tr>

<?php

for ($i=0; $i<sizeof($languages); $i++) {

?>

<tr>

<td class="main" valign="top"><?php if ($i == 0) echo TEXT_EDIT_TOPICS_DESCRIPTION; ?></td>

<td><table border="0" cellspacing="0" cellpadding="0">

<tr>

<td class="main" valign="top"><?php echo tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']); ?> </td>

<td class="main"><?php echo tep_draw_textarea_field('topics_description[' . $languages[$i]['id'] . ']', 'soft', '70', '15', (($topics_description[$languages[$i]['id']]) ? stripslashes($topics_description[$languages[$i]['id']]) : tep_get_topic_description($tInfo->topics_id, $languages[$i]['id']))); ?></td>

</tr>

</table></td>

</tr>

<?php

}

?>

<tr>

<td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>

</tr>

<tr>

<td class="main"><?php echo TEXT_EDIT_SORT_ORDER; ?></td>

<td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_input_field('sort_order', $tInfo->sort_order, 'size="2"'); ?></td>

</tr>

<tr>

<td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>

</tr>

</table></td>

</tr>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>

</tr>

<tr>

<td class="main" align="right"><?php echo tep_draw_hidden_field('topics_date_added', (($tInfo->date_added) ? $tInfo->date_added : date('Y-m-d'))) . tep_draw_hidden_field('parent_id', $tInfo->parent_id) . tep_image_submit('button_preview.gif', IMAGE_PREVIEW) . '  <a href="' . tep_href_link(FILENAME_ARTICLES, 'tPath=' . $tPath . '&tID=' . $HTTP_GET_VARS['tID']) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>'; ?></td>

</form></tr>

<?php

//MaxiDVD Added WYSIWYG HTML Area Box + Admin Function v1.7 - 2.2 MS2 Articles Description HTML - </form>

if (ARTICLE_WYSIWYG_ENABLE == 'Enable') {

?>

<script language="JavaScript1.2" defer>

// MaxiDVD Added WYSIWYG HTML Area Box + Admin Function v1.7 Articles Description HTML - Head

var config = new Object();

config.width = "<?php echo ARTICLE_MANAGER_WYSIWYG_WIDTH; ?>px";

config.height = "<?php echo ARTICLE_MANAGER_WYSIWYG_HEIGHT; ?>px";

config.bodyStyle = 'background-color: <?php echo ARTICLE_MANAGER_WYSIWYG_BG_COLOUR; ?>; font-family: "<?php echo ARTICLE_MANAGER_WYSIWYG_FONT_TYPE; ?>"; color: <?php echo ARTICLE_MANAGER_WYSIWYG_FONT_COLOUR; ?>; font-size: <?php echo ARTICLE_MANAGER_WYSIWYG_FONT_SIZE; ?>pt;';

config.debug = <?php echo ARTICLE_MANAGER_WYSIWYG_DEBUG; ?>;

// More Configs can added here:

// Dreamscape added Dynamic Language Function

<?php for ($i = 0, $n = sizeof($languages); $i < $n; $i++) { ?>

editor_generate('topics_description[<?php echo $languages[$i]['id']; ?>]',config);

<?php } ?>

</script>

<?php

}

//----- new_topic_preview -----

} elseif ($HTTP_GET_VARS['action'] == 'new_topic_preview') {

if ($HTTP_POST_VARS) {

$tInfo = new objectInfo($HTTP_POST_VARS);

$topics_name = $HTTP_POST_VARS['topics_name'];

$topics_heading_title = $HTTP_POST_VARS['topics_heading_title'];

$topics_description = $HTTP_POST_VARS['topics_description'];

} else {

$topic_query = tep_db_query("select t.topics_id, td.language_id, td.topics_name, td.topics_heading_title, td.topics_description, t.sort_order, t.date_added, t.last_modified from " . TABLE_TOPICS . " t, " . TABLE_TOPICS_DESCRIPTION . " td where t.topics_id = td.topics_id and t.topics_id = '" . $HTTP_GET_VARS['tID'] . "'");

$topic = tep_db_fetch_array($topic_query);

 

$tInfo = new objectInfo($topic);

}

 

$form_action = ($HTTP_GET_VARS['tID']) ? 'update_topic' : 'insert_topic';

 

echo tep_draw_form($form_action, FILENAME_ARTICLES, 'tPath=' . $tPath . '&tID=' . $HTTP_GET_VARS['tID'] . '&action=' . $form_action, 'post', 'enctype="multipart/form-data"');

 

$languages = tep_get_languages();

for ($i=0; $i<sizeof($languages); $i++) {

if ($HTTP_GET_VARS['read'] == 'only') {

$tInfo->topics_name = tep_get_topic_name($tInfo->topics_id, $languages[$i]['id']);

$tInfo->topics_heading_title = tep_get_topic_heading_title($tInfo->topics_id, $languages[$i]['id']);

$tInfo->topics_description = tep_get_topic_description($tInfo->topics_id, $languages[$i]['id']);

} else {

$tInfo->topics_name = tep_db_prepare_input($topics_name[$languages[$i]['id']]);

$tInfo->topics_heading_title = tep_db_prepare_input($topics_heading_title[$languages[$i]['id']]);

$tInfo->topics_description = tep_db_prepare_input($topics_description[$languages[$i]['id']]);

}

?>

<tr>

<td><table border="0" width="100%" cellspacing="0" cellpadding="0">

<tr>

<td class="pageHeading"><?php echo tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']) . ' ' . $tInfo->topics_heading_title; ?></td>

</tr>

</table></td>

</tr>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>

</tr>

<tr>

<td class="main"><?php echo $tInfo->topics_description; ?></td>

</tr>

 

<?php

}

if ($HTTP_GET_VARS['read'] == 'only') {

if ($HTTP_GET_VARS['origin']) {

$pos_params = strpos($HTTP_GET_VARS['origin'], '?', 0);

if ($pos_params != false) {

$back_url = substr($HTTP_GET_VARS['origin'], 0, $pos_params);

$back_url_params = substr($HTTP_GET_VARS['origin'], $pos_params + 1);

} else {

$back_url = $HTTP_GET_VARS['origin'];

$back_url_params = '';

}

} else {

$back_url = FILENAME_ARTICLES;

$back_url_params = 'tPath=' . $tPath . '&tID=' . $tInfo->topics_id;

}

?>

<tr>

<td align="right"><?php echo '<a href="' . tep_href_link($back_url, $back_url_params, 'NONSSL') . '">' . tep_image_button('button_back.gif', IMAGE_BACK) . '</a>'; ?></td>

</tr>

<?php

} else {

?>

<tr>

<td align="right" class="smallText">

<?php

/* Re-Post all POST'ed variables */

reset($HTTP_POST_VARS);

while (list($key, $value) = each($HTTP_POST_VARS)) {

if (!is_array($HTTP_POST_VARS[$key])) {

echo tep_draw_hidden_field($key, htmlspecialchars(stripslashes($value)));

}

}

$languages = tep_get_languages();

for ($i=0; $i<sizeof($languages); $i++) {

echo tep_draw_hidden_field('topics_name[' . $languages[$i]['id'] . ']', htmlspecialchars(stripslashes($topics_name[$languages[$i]['id']])));

echo tep_draw_hidden_field('topics_heading_title[' . $languages[$i]['id'] . ']', htmlspecialchars(stripslashes($topics_heading_title[$languages[$i]['id']])));

echo tep_draw_hidden_field('topics_description[' . $languages[$i]['id'] . ']', htmlspecialchars(stripslashes($topics_description[$languages[$i]['id']])));

}

 

echo tep_image_submit('button_back.gif', IMAGE_BACK, 'name="edit"') . '  ';

 

if ($HTTP_GET_VARS['tID']) {

echo tep_image_submit('button_update.gif', IMAGE_UPDATE);

} else {

echo tep_image_submit('button_insert.gif', IMAGE_INSERT);

}

echo '  <a href="' . tep_href_link(FILENAME_ARTICLES, 'tPath=' . $tPath . '&tID=' . $HTTP_GET_VARS['tID']) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>';

?></td>

</form></tr>

<?php

}

} elseif ($action == 'new_article') {

$parameters = array('articles_name' => '',

'articles_description' => '',

'articles_url' => '',

'articles_head_title_tag' => '',

'articles_head_desc_tag' => '',

'articles_head_keywords' => '',

'articles_id' => '',

'articles_image' => '',

'articles_date_added' => '',

'articles_last_modified' => '',

'articles_date_available' => '',

'articles_status' => '',

'authors_id' => '');

 

$aInfo = new objectInfo($parameters);

 

if (isset($HTTP_GET_VARS['aID']) && empty($HTTP_POST_VARS)) {

$article_query = tep_db_query("select ad.articles_name, ad.articles_description, ad.articles_url, ad.articles_head_title_tag, ad.articles_head_desc_tag, ad.articles_head_keywords_tag, a.articles_id, a.articles_date_added, a.articles_last_modified, date_format(a.articles_date_available, '%Y-%m-%d') as articles_date_available, a.articles_status, a.authors_id, a.articles_image from " . TABLE_ARTICLES . " a, " . TABLE_ARTICLES_DESCRIPTION . " ad where a.articles_id = '" . (int)$HTTP_GET_VARS['aID'] . "' and a.articles_id = ad.articles_id and ad.language_id = '" . (int)$languages_id . "'");

$article = tep_db_fetch_array($article_query);

 

$aInfo->objectInfo($article);

} elseif (tep_not_null($HTTP_POST_VARS)) {

$aInfo->objectInfo($HTTP_POST_VARS);

$articles_name = $HTTP_POST_VARS['articles_name'];

$articles_description = $HTTP_POST_VARS['articles_description'];

$articles_url = $HTTP_POST_VARS['articles_url'];

$articles_head_title_tag = $HTTP_POST_VARS['articles_head_title_tag'];

$articles_head_desc_tag = $HTTP_POST_VARS['articles_head_desc_tag'];

$articles_head_keywords_tag = $HTTP_POST_VARS['articles_head_keywords_tag'];

}

 

$authors_array = array(array('id' => '', 'text' => TEXT_NONE));

$authors_query = tep_db_query("select authors_id, authors_name from " . TABLE_AUTHORS . " order by authors_name");

while ($authors = tep_db_fetch_array($authors_query)) {

$authors_array[] = array('id' => $authors['authors_id'],

'text' => $authors['authors_name']);

}

 

$languages = tep_get_languages();

 

if (!isset($aInfo->articles_status)) $aInfo->articles_status = '1';

switch ($aInfo->articles_status) {

case '0': $in_status = false; $out_status = true; break;

case '1':

default: $in_status = true; $out_status = false;

}

?>

<link rel="stylesheet" type="text/css" href="includes/javascript/spiffyCal/spiffyCal_v2_1.css">

<script language="JavaScript" src="includes/javascript/spiffyCal/spiffyCal_v2_1.js"></script>

<script language="javascript">

<!--

var dateAvailable = new ctlSpiffyCalendarBox("dateAvailable", "new_article", "articles_date_available","btnDate1","<?php echo $aInfo->articles_date_available; ?>",scBTNMODE_CUSTOMBLUE);

-->

</script>

<?php echo tep_draw_form('new_article', FILENAME_ARTICLES, 'tPath=' . $tPath . (isset($HTTP_GET_VARS['aID']) ? '&aID=' . $HTTP_GET_VARS['aID'] : '') . '&action=article_preview', 'post', 'enctype="multipart/form-data"'); ?>

<table border="0" width="100%" cellspacing="0" cellpadding="2">

<tr>

<td><table border="0" width="100%" cellspacing="0" cellpadding="0">

<tr>

<td class="pageHeading"><?php echo sprintf(TEXT_NEW_ARTICLE, tep_output_generated_topic_path($current_topic_id)); ?></td>

<td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>

</tr>

</table></td>

</tr>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>

</tr>

<tr>

<td><table border="0" cellspacing="0" cellpadding="2">

<tr>

<td class="main"><?php echo TEXT_ARTICLES_STATUS; ?></td>

<td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_radio_field('articles_status', '0', $out_status) . ' ' . TEXT_ARTICLE_NOT_AVAILABLE . ' ' . tep_draw_radio_field('articles_status', '1', $in_status) . ' ' . TEXT_ARTICLE_AVAILABLE; ?></td>

</tr>

<tr>

<td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>

</tr>

<tr>

<td class="main"><?php echo TEXT_ARTICLES_DATE_AVAILABLE; ?><br><small>(YYYY-MM-DD)</small></td>

<td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' '; ?><script language="javascript">dateAvailable.writeControl(); dateAvailable.dateFormat="yyyy-MM-dd";</script></td>

</tr>

<tr>

<td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>

</tr>

<tr>

<tr>

<td class="main"><?php echo TEXT_ARTICLES_AUTHOR; ?></td>

<td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_pull_down_menu('authors_id', $authors_array, $aInfo->authors_id); ?></td>

</tr>

<tr>

<td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>

</tr>

<?php

for ($i=0, $n=sizeof($languages); $i<$n; $i++) {

?>

<tr>

<td class="main"><?php if ($i == 0) echo TEXT_ARTICLES_NAME; ?></td>

<td class="main"><?php echo tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']) . ' ' . tep_draw_input_field('articles_name[' . $languages[$i]['id'] . ']', (isset($articles_name[$languages[$i]['id']]) ? $articles_name[$languages[$i]['id']] : tep_get_articles_name($aInfo->articles_id, $languages[$i]['id'])), 'size="35"'); ?></td>

</tr>

<?php

}

?>

<tr>

<td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>

</tr>

<?php

for ($i=0, $n=sizeof($languages); $i<$n; $i++) {

?>

<tr bgcolor="#ffffcc">

<td class="main"><?php if ($i == 0) echo TEXT_ARTICLES_HEAD_TITLE_TAG; ?></td>

<td class="main"><?php echo tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']) . ' ' . tep_draw_input_field('articles_head_title_tag[' . $languages[$i]['id'] . ']', (isset($articles_head_title_tag[$languages[$i]['id']]) ? $articles_head_title_tag[$languages[$i]['id']] : tep_get_articles_head_title_tag($aInfo->articles_id, $languages[$i]['id'])), 'size="35"'); ?></td>

</tr>

<?php

}

?>

<tr bgcolor="#ffffcc">

<td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>

</tr>

<?php

for ($i=0, $n=sizeof($languages); $i<$n; $i++) {

?>

<tr bgcolor="#ffffcc">

<td class="main" valign="top"><?php if ($i == 0) echo sprintf(TEXT_ARTICLES_HEAD_DESC_TAG, MAX_ARTICLE_ABSTRACT_LENGTH); ?></td>

<td><table border="0" cellspacing="0" cellpadding="0">

<tr>

<td class="main" valign="top"><?php echo tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']); ?> </td>

<td class="main"><?php echo tep_draw_textarea_field('articles_head_desc_tag[' . $languages[$i]['id'] . ']', 'soft', '70', '5', (isset($articles_head_desc_tag[$languages[$i]['id']]) ? $articles_head_desc_tag[$languages[$i]['id']] : tep_get_articles_head_desc_tag($aInfo->articles_id, $languages[$i]['id']))); ?></td>

</tr>

</table></td>

</tr>

<?php

}

?>

<tr bgcolor="#ffffcc">

<td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>

</tr>

<?php

for ($i=0, $n=sizeof($languages); $i<$n; $i++) {

?>

<tr bgcolor="#ffffcc">

<td class="main" valign="top"><?php if ($i == 0) echo TEXT_ARTICLES_HEAD_KEYWORDS_TAG; ?></td>

<td><table border="0" cellspacing="0" cellpadding="0">

<tr>

<td class="main" valign="top"><?php echo tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']); ?> </td>

<td class="main"><?php echo tep_draw_textarea_field('articles_head_keywords_tag[' . $languages[$i]['id'] . ']', 'soft', '70', '5', (isset($articles_head_keywords_tag[$languages[$i]['id']]) ? $articles_head_keywords_tag[$languages[$i]['id']] : tep_get_articles_head_keywords_tag($aInfo->articles_id, $languages[$i]['id']))); ?></td>

</tr>

</table></td>

</tr>

<?php

}

?>

<tr>

<td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>

</tr>

 

<?php

for ($i=0, $n=sizeof($languages); $i<$n; $i++) {

?>

<tr>

<td class="main" valign="top"><?php if ($i == 0) echo TEXT_ARTICLES_DESCRIPTION; ?></td>

<td><table border="0" cellspacing="0" cellpadding="0">

<tr>

<td class="main" valign="top"><?php echo tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']); ?> </td>

<td class="main"><?php echo tep_draw_textarea_field('articles_description[' . $languages[$i]['id'] . ']', 'soft', '70', '15', (isset($articles_description[$languages[$i]['id']]) ? $articles_description[$languages[$i]['id']] : tep_get_articles_description($aInfo->articles_id, $languages[$i]['id']))); ?></td>

</tr>

</table></td>

</tr>

<?php

}

?>

<tr>

<td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>

</tr>

 

<tr>

<td class="main"><?php echo TEXT_PRODUCTS_IMAGE; ?></td>

<td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_file_field('articles_image') . '<br>' . tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . $aInfo->articles_image . tep_draw_hidden_field('articles_previous_image', $aInfo->articles_image); ?></td>

</tr>

 

<?php

for ($i=0, $n=sizeof($languages); $i<$n; $i++) {

?>

<tr>

<td class="main"><?php if ($i == 0) echo TEXT_ARTICLES_URL . '<br><small>' . TEXT_ARTICLES_URL_WITHOUT_HTTP . '</small>'; ?></td>

<td class="main"><?php echo tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']) . ' ' . tep_draw_input_field('articles_url[' . $languages[$i]['id'] . ']', (isset($articles_url[$languages[$i]['id']]) ? $articles_url[$languages[$i]['id']] : tep_get_articles_url($aInfo->articles_id, $languages[$i]['id'])), 'size="35"'); ?></td>

</tr>

<?php

}

?>

</table></td>

</tr>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>

</tr>

<tr>

<td class="main" align="right"><?php echo tep_draw_hidden_field('articles_date_added', (tep_not_null($aInfo->articles_date_added) ? $aInfo->articles_date_added : date('Y-m-d'))) . tep_image_submit('button_preview.gif', IMAGE_PREVIEW) . '  <a href="' . tep_href_link(FILENAME_ARTICLES, 'tPath=' . $tPath . (isset($HTTP_GET_VARS['aID']) ? '&aID=' . $HTTP_GET_VARS['aID'] : '')) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>'; ?></td>

</tr>

</table></form>

<?php

//MaxiDVD Added WYSIWYG HTML Area Box + Admin Function v1.7 - 2.2 MS2 Articles Description HTML - </form>

if (ARTICLE_WYSIWYG_ENABLE == 'Enable') {

?>

<script language="JavaScript1.2" defer>

var config = new Object(); // create new config object

config.width = "<?php echo ARTICLE_MANAGER_WYSIWYG_WIDTH; ?>px";

config.height = "<?php echo ARTICLE_MANAGER_WYSIWYG_HEIGHT; ?>px";

config.bodyStyle = 'background-color: <?php echo ARTICLE_MANAGER_WYSIWYG_BG_COLOUR; ?>; font-family: "<?php echo ARTICLE_MANAGER_WYSIWYG_FONT_TYPE; ?>"; color: <?php echo ARTICLE_MANAGER_WYSIWYG_FONT_COLOUR; ?>; font-size: <?php echo ARTICLE_MANAGER_WYSIWYG_FONT_SIZE; ?>pt;';

config.debug = <?php echo ARTICLE_MANAGER_WYSIWYG_DEBUG; ?>;

<?php for ($i = 0, $n = sizeof($languages); $i < $n; $i++) { ?>

editor_generate('articles_description[<?php echo $languages[$i]['id']; ?>]',config);

<?php } ?>

config.height = "35px";

config.bodyStyle = 'background-color: white; font-family: Arial; color: black; font-size: 12px;';

config.toolbar = [ ['InsertImageURL'] ];

config.OscImageRoot = '<?= trim(HTTP_SERVER . DIR_WS_CATALOG_IMAGES) ?>';

</script>

<?php

}

} elseif ($action == 'article_preview') {

if (tep_not_null($HTTP_POST_VARS)) {

$aInfo = new objectInfo($HTTP_POST_VARS);

$articles_name = $HTTP_POST_VARS['articles_name'];

$articles_description = $HTTP_POST_VARS['articles_description'];

$articles_url = $HTTP_POST_VARS['articles_url'];

$articles_head_title_tag = $HTTP_POST_VARS['articles_head_title_tag'];

$articles_head_desc_tag = $HTTP_POST_VARS['articles_head_desc_tag'];

$articles_head_keywords_tag = $HTTP_POST_VARS['articles_head_keywords_tag'];

} else {

$article_query = tep_db_query("select a.articles_id, a.articles_image, ad.language_id, ad.articles_name, ad.articles_description, ad.articles_url, ad.articles_head_title_tag, ad.articles_head_desc_tag, ad.articles_head_keywords_tag, a.articles_date_added, a.articles_last_modified, a.articles_date_available, a.articles_status, a.authors_id from " . TABLE_ARTICLES . " a, " . TABLE_ARTICLES_DESCRIPTION . " ad where a.articles_id = ad.articles_id and a.articles_id = '" . (int)$HTTP_GET_VARS['aID'] . "'");

$article = tep_db_fetch_array($article_query);

 

$aInfo = new objectInfo($article);

// Added Salvo Image

$articles_image_name = $aInfo->articles_image;

//

}

 

$form_action = (isset($HTTP_GET_VARS['aID'])) ? 'update_article' : 'insert_article';

 

echo tep_draw_form($form_action, FILENAME_ARTICLES, 'tPath=' . $tPath . (isset($HTTP_GET_VARS['aID']) ? '&aID=' . $HTTP_GET_VARS['aID'] : '') . '&action=' . $form_action, 'post', 'enctype="multipart/form-data"');

 

$languages = tep_get_languages();

for ($i=0, $n=sizeof($languages); $i<$n; $i++) {

if (isset($HTTP_GET_VARS['read']) && ($HTTP_GET_VARS['read'] == 'only')) {

$aInfo->articles_name = tep_get_articles_name($aInfo->articles_id, $languages[$i]['id']);

$aInfo->articles_description = tep_get_articles_description($aInfo->articles_id, $languages[$i]['id']);

$aInfo->articles_url = tep_get_articles_url($aInfo->articles_id, $languages[$i]['id']);

$aInfo->articles_head_title_tag = tep_get_articles_head_title_tag($aInfo->articles_id, $languages[$i]['id']);

$aInfo->articles_head_desc_tag = tep_get_articles_head_desc_tag($aInfo->articles_id, $languages[$i]['id']);

$aInfo->articles_head_keywords_tag = tep_get_articles_head_keywords_tag($aInfo->articles_id, $languages[$i]['id']);

} else {

$aInfo->articles_name = tep_db_prepare_input($articles_name[$languages[$i]['id']]);

$aInfo->articles_description = tep_db_prepare_input($articles_description[

Link to comment
Share on other sites

I need help making a little mod. Im trying to combine some functionality from articles.php and article_info.php. I basically want to have the list of articles pulled, like articles.php does, but I would like for it to pull the actual article like article_info.php does. I have messed around with this, but Im not having any luck. Can anyone lend a hand here? Thanks!

 

-Noods

Link to comment
Share on other sites

here you are.....

admin/article.php

 

 

<?php

/*

$Id: articles.php, v1.0 2003/12/04 12:00:00 ra Exp $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2003 osCommerce

 

Released under the GNU General Public License

*/

 

require('includes/application_top.php');

 

$action = (isset($HTTP_GET_VARS['action']) ? $HTTP_GET_VARS['action'] : '');

 

if (tep_not_null($action)) {

switch ($action) {

case 'setflag':

if ( ($HTTP_GET_VARS['flag'] == '0') || ($HTTP_GET_VARS['flag'] == '1') ) {

if (isset($HTTP_GET_VARS['aID'])) {

tep_set_article_status($HTTP_GET_VARS['aID'], $HTTP_GET_VARS['flag']);

}

 

if (USE_CACHE == 'true') {

tep_reset_cache_block('topics');

}

}

 

tep_redirect(tep_href_link(FILENAME_ARTICLES, 'tPath=' . $HTTP_GET_VARS['tPath'] . '&aID=' . $HTTP_GET_VARS['aID']));

break;

case 'new_topic':

case 'edit_topic':

$HTTP_GET_VARS['action']=$HTTP_GET_VARS['action'] . '_ACD';

break;

case 'insert_topic':

case 'update_topic':

if ( ($HTTP_POST_VARS['edit_x']) || ($HTTP_POST_VARS['edit_y']) ) {

$HTTP_GET_VARS['action'] = 'edit_topic_ACD';

} else {

if (isset($HTTP_POST_VARS['topics_id'])) $topics_id = tep_db_prepare_input($HTTP_POST_VARS['topics_id']);

if ($topics_id == '') {

$topics_id = tep_db_prepare_input($HTTP_GET_VARS['tID']);

}

$sort_order = tep_db_prepare_input($HTTP_POST_VARS['sort_order']);

 

$sql_data_array = array('sort_order' => $sort_order);

 

if ($action == 'insert_topic') {

$insert_sql_data = array('parent_id' => $current_topic_id,

'date_added' => 'now()');

 

$sql_data_array = array_merge($sql_data_array, $insert_sql_data);

 

tep_db_perform(TABLE_TOPICS, $sql_data_array);

 

$topics_id = tep_db_insert_id();

} elseif ($action == 'update_topic') {

$update_sql_data = array('last_modified' => 'now()');

 

$sql_data_array = array_merge($sql_data_array, $update_sql_data);

 

tep_db_perform(TABLE_TOPICS, $sql_data_array, 'update', "topics_id = '" . (int)$topics_id . "'");

}

 

$languages = tep_get_languages();

for ($i=0, $n=sizeof($languages); $i<$n; $i++) {

 

$language_id = $languages[$i]['id'];

 

$sql_data_array = array('topics_name' => tep_db_prepare_input($HTTP_POST_VARS['topics_name'][$language_id]),

'topics_heading_title' => tep_db_prepare_input($HTTP_POST_VARS['topics_heading_title'][$language_id]),

'topics_description' => tep_db_prepare_input($HTTP_POST_VARS['topics_description'][$language_id]));

 

if ($action == 'insert_topic') {

$insert_sql_data = array('topics_id' => $topics_id,

'language_id' => $languages[$i]['id']);

 

$sql_data_array = array_merge($sql_data_array, $insert_sql_data);

 

tep_db_perform(TABLE_TOPICS_DESCRIPTION, $sql_data_array);

} elseif ($action == 'update_topic') {

tep_db_perform(TABLE_TOPICS_DESCRIPTION, $sql_data_array, 'update', "topics_id = '" . (int)$topics_id . "' and language_id = '" . (int)$languages[$i]['id'] . "'");

}

}

 

if (USE_CACHE == 'true') {

tep_reset_cache_block('topics');

}

 

tep_redirect(tep_href_link(FILENAME_ARTICLES, 'tPath=' . $tPath . '&tID=' . $topics_id));

break;

}

case 'delete_topic_confirm':

if (isset($HTTP_POST_VARS['topics_id'])) {

$topics_id = tep_db_prepare_input($HTTP_POST_VARS['topics_id']);

 

$topics = tep_get_topic_tree($topics_id, '', '0', '', true);

$articles = array();

$articles_delete = array();

 

for ($i=0, $n=sizeof($topics); $i<$n; $i++) {

$article_ids_query = tep_db_query("select articles_id from " . TABLE_ARTICLES_TO_TOPICS . " where topics_id = '" . (int)$topics[$i]['id'] . "'");

 

while ($article_ids = tep_db_fetch_array($article_ids_query)) {

$articles[$article_ids['articles_id']]['topics'][] = $topics[$i]['id'];

}

}

 

reset($articles);

while (list($key, $value) = each($articles)) {

$topic_ids = '';

 

for ($i=0, $n=sizeof($value['topics']); $i<$n; $i++) {

$topic_ids .= "'" . (int)$value['topics'][$i] . "', ";

}

$topic_ids = substr($topic_ids, 0, -2);

 

$check_query = tep_db_query("select count(*) as total from " . TABLE_ARTICLES_TO_TOPICS . " where articles_id = '" . (int)$key . "' and topics_id not in (" . $topic_ids . ")");

$check = tep_db_fetch_array($check_query);

if ($check['total'] < '1') {

$articles_delete[$key] = $key;

}

}

 

// removing topics can be a lengthy process

tep_set_time_limit(0);

for ($i=0, $n=sizeof($topics); $i<$n; $i++) {

tep_remove_topic($topics[$i]['id']);

}

 

reset($articles_delete);

while (list($key) = each($articles_delete)) {

tep_remove_article($key);

}

}

 

if (USE_CACHE == 'true') {

tep_reset_cache_block('topics');

}

 

tep_redirect(tep_href_link(FILENAME_ARTICLES, 'tPath=' . $tPath));

break;

case 'delete_article_confirm':

if (isset($HTTP_POST_VARS['articles_id']) && isset($HTTP_POST_VARS['article_topics']) && is_array($HTTP_POST_VARS['article_topics'])) {

$article_id = tep_db_prepare_input($HTTP_POST_VARS['articles_id']);

$article_topics = $HTTP_POST_VARS['article_topics'];

 

for ($i=0, $n=sizeof($article_topics); $i<$n; $i++) {

tep_db_query("delete from " . TABLE_ARTICLES_TO_TOPICS . " where articles_id = '" . (int)$article_id . "' and topics_id = '" . (int)$article_topics[$i] . "'");

}

 

$article_topics_query = tep_db_query("select count(*) as total from " . TABLE_ARTICLES_TO_TOPICS . " where articles_id = '" . (int)$article_id . "'");

$article_topics = tep_db_fetch_array($article_topics_query);

 

if ($article_topics['total'] == '0') {

tep_remove_article($article_id);

}

}

 

if (USE_CACHE == 'true') {

tep_reset_cache_block('topics');

}

 

tep_redirect(tep_href_link(FILENAME_ARTICLES, 'tPath=' . $tPath));

break;

case 'move_topic_confirm':

if (isset($HTTP_POST_VARS['topics_id']) && ($HTTP_POST_VARS['topics_id'] != $HTTP_POST_VARS['move_to_topic_id'])) {

$topics_id = tep_db_prepare_input($HTTP_POST_VARS['topics_id']);

$new_parent_id = tep_db_prepare_input($HTTP_POST_VARS['move_to_topic_id']);

 

$path = explode('_', tep_get_generated_topic_path_ids($new_parent_id));

 

if (in_array($topics_id, $path)) {

$messageStack->add_session(ERROR_CANNOT_MOVE_TOPIC_TO_PARENT, 'error');

 

tep_redirect(tep_href_link(FILENAME_ARTICLES, 'tPath=' . $tPath . '&tID=' . $topics_id));

} else {

tep_db_query("update " . TABLE_TOPICS . " set parent_id = '" . (int)$new_parent_id . "', last_modified = now() where topics_id = '" . (int)$topics_id . "'");

 

if (USE_CACHE == 'true') {

tep_reset_cache_block('topics');

}

 

tep_redirect(tep_href_link(FILENAME_ARTICLES, 'tPath=' . $new_parent_id . '&tID=' . $topics_id));

}

}

 

break;

case 'move_article_confirm':

$articles_id = tep_db_prepare_input($HTTP_POST_VARS['articles_id']);

$new_parent_id = tep_db_prepare_input($HTTP_POST_VARS['move_to_topic_id']);

 

$duplicate_check_query = tep_db_query("select count(*) as total from " . TABLE_ARTICLES_TO_TOPICS . " where articles_id = '" . (int)$articles_id . "' and topics_id = '" . (int)$new_parent_id . "'");

$duplicate_check = tep_db_fetch_array($duplicate_check_query);

if ($duplicate_check['total'] < 1) tep_db_query("update " . TABLE_ARTICLES_TO_TOPICS . " set topics_id = '" . (int)$new_parent_id . "' where articles_id = '" . (int)$articles_id . "' and topics_id = '" . (int)$current_topic_id . "'");

 

if (USE_CACHE == 'true') {

tep_reset_cache_block('topics');

}

 

tep_redirect(tep_href_link(FILENAME_ARTICLES, 'tPath=' . $new_parent_id . '&aID=' . $articles_id));

break;

case 'insert_article':

case 'update_article':

if (isset($HTTP_POST_VARS['edit_x']) || isset($HTTP_POST_VARS['edit_y'])) {

$action = 'new_article';

} else {

if (isset($HTTP_GET_VARS['aID'])) $articles_id = tep_db_prepare_input($HTTP_GET_VARS['aID']);

$articles_date_available = tep_db_prepare_input($HTTP_POST_VARS['articles_date_available']);

 

$articles_date_available = (date('Y-m-d') < $articles_date_available) ? $articles_date_available : 'null';

 

$sql_data_array = array('articles_date_available' => $articles_date_available,

'articles_status' => tep_db_prepare_input($HTTP_POST_VARS['articles_status']),

'authors_id' => tep_db_prepare_input($HTTP_POST_VARS['authors_id']));

// Added Image Salvo

if (isset($HTTP_POST_VARS['articles_image']) && tep_not_null($HTTP_POST_VARS['articles_image']) && ($HTTP_POST_VARS['articles_image'] != 'none')) {

$sql_data_array['articles_image'] = tep_db_prepare_input($HTTP_POST_VARS['articles_image']);

}

// Added Image Salvo

if ($action == 'insert_article') {

// If expected article then articles_date _added becomes articles_date_available

if (isset($HTTP_POST_VARS['articles_date_available']) && tep_not_null($HTTP_POST_VARS['articles_date_available'])) {

$insert_sql_data = array('articles_date_added' => tep_db_prepare_input($HTTP_POST_VARS['articles_date_available']));

} else {

$insert_sql_data = array('articles_date_added' => 'now()');

}

 

$sql_data_array = array_merge($sql_data_array, $insert_sql_data);

 

tep_db_perform(TABLE_ARTICLES, $sql_data_array);

$articles_id = tep_db_insert_id();

 

tep_db_query("insert into " . TABLE_ARTICLES_TO_TOPICS . " (articles_id, topics_id) values ('" . (int)$articles_id . "', '" . (int)$current_topic_id . "')");

} elseif ($action == 'update_article') {

$update_sql_data = array('articles_last_modified' => 'now()');

// If expected article then articles_date _added becomes articles_date_available

if (isset($HTTP_POST_VARS['articles_date_available']) && tep_not_null($HTTP_POST_VARS['articles_date_available'])) {

$update_sql_data = array('articles_date_added' => tep_db_prepare_input($HTTP_POST_VARS['articles_date_available']));

}

 

$sql_data_array = array_merge($sql_data_array, $update_sql_data);

 

tep_db_perform(TABLE_ARTICLES, $sql_data_array, 'update', "articles_id = '" . (int)$articles_id . "'");

}

 

$languages = tep_get_languages();

for ($i=0, $n=sizeof($languages); $i<$n; $i++) {

$language_id = $languages[$i]['id'];

 

$sql_data_array = array('articles_name' => tep_db_prepare_input($HTTP_POST_VARS['articles_name'][$language_id]),

'articles_description' => tep_db_prepare_input($HTTP_POST_VARS['articles_description'][$language_id]),

'articles_url' => tep_db_prepare_input($HTTP_POST_VARS['articles_url'][$language_id]),

'articles_head_title_tag' => tep_db_prepare_input($HTTP_POST_VARS['articles_head_title_tag'][$language_id]),

'articles_head_desc_tag' => tep_db_prepare_input($HTTP_POST_VARS['articles_head_desc_tag'][$language_id]),

'articles_head_keywords_tag' => tep_db_prepare_input($HTTP_POST_VARS['articles_head_keywords_tag'][$language_id]));

 

if ($action == 'insert_article') {

$insert_sql_data = array('articles_id' => $articles_id,

'language_id' => $language_id);

 

$sql_data_array = array_merge($sql_data_array, $insert_sql_data);

 

tep_db_perform(TABLE_ARTICLES_DESCRIPTION, $sql_data_array);

} elseif ($action == 'update_article') {

tep_db_perform(TABLE_ARTICLES_DESCRIPTION, $sql_data_array, 'update', "articles_id = '" . (int)$articles_id . "' and language_id = '" . (int)$language_id . "'");

}

}

 

if (USE_CACHE == 'true') {

tep_reset_cache_block('topics');

}

 

tep_redirect(tep_href_link(FILENAME_ARTICLES, 'tPath=' . $tPath . '&aID=' . $articles_id));

}

break;

case 'copy_to_confirm':

if (isset($HTTP_POST_VARS['articles_id']) && isset($HTTP_POST_VARS['topics_id'])) {

$articles_id = tep_db_prepare_input($HTTP_POST_VARS['articles_id']);

$topics_id = tep_db_prepare_input($HTTP_POST_VARS['topics_id']);

 

if ($HTTP_POST_VARS['copy_as'] == 'link') {

if ($topics_id != $current_topic_id) {

$check_query = tep_db_query("select count(*) as total from " . TABLE_ARTICLES_TO_TOPICS . " where articles_id = '" . (int)$articles_id . "' and topics_id = '" . (int)$topics_id . "'");

$check = tep_db_fetch_array($check_query);

if ($check['total'] < '1') {

tep_db_query("insert into " . TABLE_ARTICLES_TO_TOPICS . " (articles_id, topics_id) values ('" . (int)$articles_id . "', '" . (int)$topics_id . "')");

}

} else {

$messageStack->add_session(ERROR_CANNOT_LINK_TO_SAME_TOPIC, 'error');

}

} elseif ($HTTP_POST_VARS['copy_as'] == 'duplicate') {

$article_query = tep_db_query("select articles_date_available, authors_id, articles_image from " . TABLE_ARTICLES . " where articles_id = '" . (int)$articles_id . "'");

$article = tep_db_fetch_array($article_query);

 

tep_db_query("insert into " . TABLE_ARTICLES . " (articles_date_added, articles_date_available, articles_status, authors_id, articles_image) values (now(), '" . tep_db_input($article['articles_date_available']) . "', '0', '" . (int)$article['authors_id'] . "','" . tep_db_input($articles['articles_image']) . "')");

$dup_articles_id = tep_db_insert_id();

 

$description_query = tep_db_query("select language_id, articles_name, articles_description, articles_url, articles_head_title_tag, articles_head_desc_tag, articles_head_keywords_tag from " . TABLE_ARTICLES_DESCRIPTION . " where articles_id = '" . (int)$articles_id . "'");

while ($description = tep_db_fetch_array($description_query)) {

tep_db_query("insert into " . TABLE_ARTICLES_DESCRIPTION . " (articles_id, language_id, articles_name, articles_description, articles_url, articles_head_title_tag, articles_head_desc_tag, articles_head_keywords_tag, articles_viewed) values ('" . (int)$dup_articles_id . "', '" . (int)$description['language_id'] . "', '" . tep_db_input($description['articles_name']) . "', '" . tep_db_input($description['articles_description']) . "', '" . tep_db_input($description['articles_url']) . "', '" . tep_db_input($description['articles_head_title_tag']) . "', '" . tep_db_input($description['articles_head_desc_tag']) . "', '" . tep_db_input($description['articles_head_keywords_tag']) . "', '0')");

}

 

tep_db_query("insert into " . TABLE_ARTICLES_TO_TOPICS . " (articles_id, topics_id) values ('" . (int)$dup_articles_id . "', '" . (int)$topics_id . "')");

$articles_id = $dup_articles_id;

}

 

if (USE_CACHE == 'true') {

tep_reset_cache_block('topics');

}

}

 

tep_redirect(tep_href_link(FILENAME_ARTICLES, 'tPath=' . $topics_id . '&aID=' . $articles_id));

break;

}

}

 

// check if the catalog image directory exists

if (is_dir(DIR_FS_CATALOG_IMAGES)) {

if (!is_writeable(DIR_FS_CATALOG_IMAGES)) $messageStack->add(ERROR_CATALOG_IMAGE_DIRECTORY_NOT_WRITEABLE, 'error');

} else {

$messageStack->add(ERROR_CATALOG_IMAGE_DIRECTORY_DOES_NOT_EXIST, 'error');

}

?>

<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">

<html <?php echo HTML_PARAMS; ?>>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">

<?php

// BOF: WebMakers.com Changed: Header Tag Controller v1.0

// Replaced by header_tags.php

if ( file_exists(DIR_WS_INCLUDES . 'header_tags.php') ) {

require(DIR_WS_INCLUDES . 'header_tags.php');

} else {

?>

<title><?php echo TITLE ?></title>

<?php

}

// EOF: WebMakers.com Changed: Header Tag Controller v1.0

?>

<script language="Javascript1.2"><!-- // load htmlarea

// MaxiDVD Added WYSIWYG HTML Area Box + Admin Function v1.7 - 2.2 MS2 Articles Description HTML - Head

_editor_url = "<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_ADMIN; ?>htmlarea/"; // URL to htmlarea files

var win_ie_ver = parseFloat(navigator.appVersion.split("MSIE")[1]);

if (navigator.userAgent.indexOf('Mac') >= 0) { win_ie_ver = 0; }

if (navigator.userAgent.indexOf('Windows CE') >= 0) { win_ie_ver = 0; }

if (navigator.userAgent.indexOf('Opera') >= 0) { win_ie_ver = 0; }

<?php if (ARTICLE_MANAGER_WYSIWYG_BASIC == 'Basic'){ ?> if (win_ie_ver >= 5.5) {

document.write('<scr' + 'ipt src="' +_editor_url+ 'editor_basic.js"');

document.write(' language="Javascript1.2"></scr' + 'ipt>');

} else { document.write('<scr'+'ipt>function editor_generate() { return false; }</scr'+'ipt>'); }

<?php } else{ ?> if (win_ie_ver >= 5.5) {

document.write('<scr' + 'ipt src="' +_editor_url+ 'editor_advanced.js"');

document.write(' language="Javascript1.2"></scr' + 'ipt>');

} else { document.write('<scr'+'ipt>function editor_generate() { return false; }</scr'+'ipt>'); }

<?php }?>

// --></script>

<link rel="stylesheet" type="text/css" href="includes/stylesheet.css">

<script language="javascript" src="includes/general.js"></script>

</head>

<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF" onload="SetFocus();">

<div id="spiffycalendar" class="text"></div>

<!-- header //-->

<?php require(DIR_WS_INCLUDES . 'header.php'); ?>

<!-- header_eof //-->

 

<!-- body //-->

<table border="0" width="100%" cellspacing="2" cellpadding="2">

<tr>

<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="1" cellpadding="1" class="columnLeft">

<!-- left_navigation //-->

<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>

<!-- left_navigation_eof //-->

</table></td>

<!-- body_text //-->

<td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">

<?php

//----- new_topic / edit_topic -----

if ($HTTP_GET_VARS['action'] == 'new_topic_ACD' || $HTTP_GET_VARS['action'] == 'edit_topic_ACD') {

if ( ($HTTP_GET_VARS['tID']) && (!$HTTP_POST_VARS) ) {

$topics_query = tep_db_query("select t.topics_id, td.topics_name, td.topics_heading_title, td.topics_description, t.parent_id, t.sort_order, t.date_added, t.last_modified from " . TABLE_TOPICS . " t, " . TABLE_TOPICS_DESCRIPTION . " td where t.topics_id = '" . $HTTP_GET_VARS['tID'] . "' and t.topics_id = td.topics_id and td.language_id = '" . $languages_id . "' order by t.sort_order, td.topics_name");

$topic = tep_db_fetch_array($topics_query);

 

$tInfo = new objectInfo($topic);

} elseif ($HTTP_POST_VARS) {

$tInfo = new objectInfo($HTTP_POST_VARS);

$topics_name = $HTTP_POST_VARS['topics_name'];

$topics_heading_title = $HTTP_POST_VARS['topics_heading_title'];

$topics_description = $HTTP_POST_VARS['topics_description'];

$topics_url = $HTTP_POST_VARS['topics_url'];

} else {

$tInfo = new objectInfo(array());

}

 

$languages = tep_get_languages();

 

$text_new_or_edit = ($HTTP_GET_VARS['action']=='new_topic_ACD') ? TEXT_INFO_HEADING_NEW_TOPIC : TEXT_INFO_HEADING_EDIT_TOPIC;

?>

<tr>

<td><table border="0" width="100%" cellspacing="0" cellpadding="0">

<tr>

<td class="pageHeading"><?php echo sprintf($text_new_or_edit, tep_output_generated_topic_path($current_topic_id)); ?></td>

<td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>

</tr>

</table></td>

</tr>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>

</tr>

<tr><?php echo tep_draw_form('new_topic', FILENAME_ARTICLES, 'tPath=' . $tPath . '&tID=' . $HTTP_GET_VARS['tID'] . '&action=new_topic_preview', 'post', 'enctype="multipart/form-data"'); ?>

<td><table border="0" cellspacing="0" cellpadding="2">

<?php

for ($i=0; $i<sizeof($languages); $i++) {

?>

<tr>

<td class="main"><?php if ($i == 0) echo TEXT_EDIT_TOPICS_NAME; ?></td>

<td class="main"><?php echo tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']) . ' ' . tep_draw_input_field('topics_name[' . $languages[$i]['id'] . ']', (($topics_name[$languages[$i]['id']]) ? stripslashes($topics_name[$languages[$i]['id']]) : tep_get_topic_name($tInfo->topics_id, $languages[$i]['id']))); ?></td>

</tr>

<?php

}

?>

<tr>

<td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>

</tr>

<?php

for ($i=0; $i<sizeof($languages); $i++) {

?>

<tr>

<td class="main"><?php if ($i == 0) echo TEXT_EDIT_TOPICS_HEADING_TITLE; ?></td>

<td class="main"><?php echo tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']) . ' ' . tep_draw_input_field('topics_heading_title[' . $languages[$i]['id'] . ']', (($topics_name[$languages[$i]['id']]) ? stripslashes($topics_name[$languages[$i]['id']]) : tep_get_topic_heading_title($tInfo->topics_id, $languages[$i]['id']))); ?></td>

</tr>

<?php

}

?>

<tr>

<td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>

</tr>

<?php

for ($i=0; $i<sizeof($languages); $i++) {

?>

<tr>

<td class="main" valign="top"><?php if ($i == 0) echo TEXT_EDIT_TOPICS_DESCRIPTION; ?></td>

<td><table border="0" cellspacing="0" cellpadding="0">

<tr>

<td class="main" valign="top"><?php echo tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']); ?> </td>

<td class="main"><?php echo tep_draw_textarea_field('topics_description[' . $languages[$i]['id'] . ']', 'soft', '70', '15', (($topics_description[$languages[$i]['id']]) ? stripslashes($topics_description[$languages[$i]['id']]) : tep_get_topic_description($tInfo->topics_id, $languages[$i]['id']))); ?></td>

</tr>

</table></td>

</tr>

<?php

}

?>

<tr>

<td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>

</tr>

<tr>

<td class="main"><?php echo TEXT_EDIT_SORT_ORDER; ?></td>

<td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_input_field('sort_order', $tInfo->sort_order, 'size="2"'); ?></td>

</tr>

<tr>

<td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>

</tr>

</table></td>

</tr>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>

</tr>

<tr>

<td class="main" align="right"><?php echo tep_draw_hidden_field('topics_date_added', (($tInfo->date_added) ? $tInfo->date_added : date('Y-m-d'))) . tep_draw_hidden_field('parent_id', $tInfo->parent_id) . tep_image_submit('button_preview.gif', IMAGE_PREVIEW) . '  <a href="' . tep_href_link(FILENAME_ARTICLES, 'tPath=' . $tPath . '&tID=' . $HTTP_GET_VARS['tID']) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>'; ?></td>

</form></tr>

<?php

//MaxiDVD Added WYSIWYG HTML Area Box + Admin Function v1.7 - 2.2 MS2 Articles Description HTML - </form>

if (ARTICLE_WYSIWYG_ENABLE == 'Enable') {

?>

<script language="JavaScript1.2" defer>

// MaxiDVD Added WYSIWYG HTML Area Box + Admin Function v1.7 Articles Description HTML - Head

var config = new Object();

config.width = "<?php echo ARTICLE_MANAGER_WYSIWYG_WIDTH; ?>px";

config.height = "<?php echo ARTICLE_MANAGER_WYSIWYG_HEIGHT; ?>px";

config.bodyStyle = 'background-color: <?php echo ARTICLE_MANAGER_WYSIWYG_BG_COLOUR; ?>; font-family: "<?php echo ARTICLE_MANAGER_WYSIWYG_FONT_TYPE; ?>"; color: <?php echo ARTICLE_MANAGER_WYSIWYG_FONT_COLOUR; ?>; font-size: <?php echo ARTICLE_MANAGER_WYSIWYG_FONT_SIZE; ?>pt;';

config.debug = <?php echo ARTICLE_MANAGER_WYSIWYG_DEBUG; ?>;

// More Configs can added here:

// Dreamscape added Dynamic Language Function

<?php for ($i = 0, $n = sizeof($languages); $i < $n; $i++) { ?>

editor_generate('topics_description[<?php echo $languages[$i]['id']; ?>]',config);

<?php } ?>

</script>

<?php

}

//----- new_topic_preview -----

} elseif ($HTTP_GET_VARS['action'] == 'new_topic_preview') {

if ($HTTP_POST_VARS) {

$tInfo = new objectInfo($HTTP_POST_VARS);

$topics_name = $HTTP_POST_VARS['topics_name'];

$topics_heading_title = $HTTP_POST_VARS['topics_heading_title'];

$topics_description = $HTTP_POST_VARS['topics_description'];

} else {

$topic_query = tep_db_query("select t.topics_id, td.language_id, td.topics_name, td.topics_heading_title, td.topics_description, t.sort_order, t.date_added, t.last_modified from " . TABLE_TOPICS . " t, " . TABLE_TOPICS_DESCRIPTION . " td where t.topics_id = td.topics_id and t.topics_id = '" . $HTTP_GET_VARS['tID'] . "'");

$topic = tep_db_fetch_array($topic_query);

 

$tInfo = new objectInfo($topic);

}

 

$form_action = ($HTTP_GET_VARS['tID']) ? 'update_topic' : 'insert_topic';

 

echo tep_draw_form($form_action, FILENAME_ARTICLES, 'tPath=' . $tPath . '&tID=' . $HTTP_GET_VARS['tID'] . '&action=' . $form_action, 'post', 'enctype="multipart/form-data"');

 

$languages = tep_get_languages();

for ($i=0; $i<sizeof($languages); $i++) {

if ($HTTP_GET_VARS['read'] == 'only') {

$tInfo->topics_name = tep_get_topic_name($tInfo->topics_id, $languages[$i]['id']);

$tInfo->topics_heading_title = tep_get_topic_heading_title($tInfo->topics_id, $languages[$i]['id']);

$tInfo->topics_description = tep_get_topic_description($tInfo->topics_id, $languages[$i]['id']);

} else {

$tInfo->topics_name = tep_db_prepare_input($topics_name[$languages[$i]['id']]);

$tInfo->topics_heading_title = tep_db_prepare_input($topics_heading_title[$languages[$i]['id']]);

$tInfo->topics_description = tep_db_prepare_input($topics_description[$languages[$i]['id']]);

}

?>

<tr>

<td><table border="0" width="100%" cellspacing="0" cellpadding="0">

<tr>

<td class="pageHeading"><?php echo tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']) . ' ' . $tInfo->topics_heading_title; ?></td>

</tr>

</table></td>

</tr>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>

</tr>

<tr>

<td class="main"><?php echo $tInfo->topics_description; ?></td>

</tr>

 

<?php

}

if ($HTTP_GET_VARS['read'] == 'only') {

if ($HTTP_GET_VARS['origin']) {

$pos_params = strpos($HTTP_GET_VARS['origin'], '?', 0);

if ($pos_params != false) {

$back_url = substr($HTTP_GET_VARS['origin'], 0, $pos_params);

$back_url_params = substr($HTTP_GET_VARS['origin'], $pos_params + 1);

} else {

$back_url = $HTTP_GET_VARS['origin'];

$back_url_params = '';

}

} else {

$back_url = FILENAME_ARTICLES;

$back_url_params = 'tPath=' . $tPath . '&tID=' . $tInfo->topics_id;

}

?>

<tr>

<td align="right"><?php echo '<a href="' . tep_href_link($back_url, $back_url_params, 'NONSSL') . '">' . tep_image_button('button_back.gif', IMAGE_BACK) . '</a>'; ?></td>

</tr>

<?php

} else {

?>

<tr>

<td align="right" class="smallText">

<?php

/* Re-Post all POST'ed variables */

reset($HTTP_POST_VARS);

while (list($key, $value) = each($HTTP_POST_VARS)) {

if (!is_array($HTTP_POST_VARS[$key])) {

echo tep_draw_hidden_field($key, htmlspecialchars(stripslashes($value)));

}

}

$languages = tep_get_languages();

for ($i=0; $i<sizeof($languages); $i++) {

echo tep_draw_hidden_field('topics_name[' . $languages[$i]['id'] . ']', htmlspecialchars(stripslashes($topics_name[$languages[$i]['id']])));

echo tep_draw_hidden_field('topics_heading_title[' . $languages[$i]['id'] . ']', htmlspecialchars(stripslashes($topics_heading_title[$languages[$i]['id']])));

echo tep_draw_hidden_field('topics_description[' . $languages[$i]['id'] . ']', htmlspecialchars(stripslashes($topics_description[$languages[$i]['id']])));

}

 

echo tep_image_submit('button_back.gif', IMAGE_BACK, 'name="edit"') . '  ';

 

if ($HTTP_GET_VARS['tID']) {

echo tep_image_submit('button_update.gif', IMAGE_UPDATE);

} else {

echo tep_image_submit('button_insert.gif', IMAGE_INSERT);

}

echo '  <a href="' . tep_href_link(FILENAME_ARTICLES, 'tPath=' . $tPath . '&tID=' . $HTTP_GET_VARS['tID']) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>';

?></td>

</form></tr>

<?php

}

} elseif ($action == 'new_article') {

$parameters = array('articles_name' => '',

'articles_description' => '',

'articles_url' => '',

'articles_head_title_tag' => '',

'articles_head_desc_tag' => '',

'articles_head_keywords' => '',

'articles_id' => '',

'articles_image' => '',

'articles_date_added' => '',

'articles_last_modified' => '',

'articles_date_available' => '',

'articles_status' => '',

'authors_id' => '');

 

$aInfo = new objectInfo($parameters);

 

if (isset($HTTP_GET_VARS['aID']) && empty($HTTP_POST_VARS)) {

$article_query = tep_db_query("select ad.articles_name, ad.articles_description, ad.articles_url, ad.articles_head_title_tag, ad.articles_head_desc_tag, ad.articles_head_keywords_tag, a.articles_id, a.articles_date_added, a.articles_last_modified, date_format(a.articles_date_available, '%Y-%m-%d') as articles_date_available, a.articles_status, a.authors_id, a.articles_image from " . TABLE_ARTICLES . " a, " . TABLE_ARTICLES_DESCRIPTION . " ad where a.articles_id = '" . (int)$HTTP_GET_VARS['aID'] . "' and a.articles_id = ad.articles_id and ad.language_id = '" . (int)$languages_id . "'");

$article = tep_db_fetch_array($article_query);

 

$aInfo->objectInfo($article);

} elseif (tep_not_null($HTTP_POST_VARS)) {

$aInfo->objectInfo($HTTP_POST_VARS);

$articles_name = $HTTP_POST_VARS['articles_name'];

$articles_description = $HTTP_POST_VARS['articles_description'];

$articles_url = $HTTP_POST_VARS['articles_url'];

$articles_head_title_tag = $HTTP_POST_VARS['articles_head_title_tag'];

$articles_head_desc_tag = $HTTP_POST_VARS['articles_head_desc_tag'];

$articles_head_keywords_tag = $HTTP_POST_VARS['articles_head_keywords_tag'];

}

 

$authors_array = array(array('id' => '', 'text' => TEXT_NONE));

$authors_query = tep_db_query("select authors_id, authors_name from " . TABLE_AUTHORS . " order by authors_name");

while ($authors = tep_db_fetch_array($authors_query)) {

$authors_array[] = array('id' => $authors['authors_id'],

'text' => $authors['authors_name']);

}

 

$languages = tep_get_languages();

 

if (!isset($aInfo->articles_status)) $aInfo->articles_status = '1';

switch ($aInfo->articles_status) {

case '0': $in_status = false; $out_status = true; break;

case '1':

default: $in_status = true; $out_status = false;

}

?>

<link rel="stylesheet" type="text/css" href="includes/javascript/spiffyCal/spiffyCal_v2_1.css">

<script language="JavaScript" src="includes/javascript/spiffyCal/spiffyCal_v2_1.js"></script>

<script language="javascript">

<!--

var dateAvailable = new ctlSpiffyCalendarBox("dateAvailable", "new_article", "articles_date_available","btnDate1","<?php echo $aInfo->articles_date_available; ?>",scBTNMODE_CUSTOMBLUE);

-->

</script>

<?php echo tep_draw_form('new_article', FILENAME_ARTICLES, 'tPath=' . $tPath . (isset($HTTP_GET_VARS['aID']) ? '&aID=' . $HTTP_GET_VARS['aID'] : '') . '&action=article_preview', 'post', 'enctype="multipart/form-data"'); ?>

<table border="0" width="100%" cellspacing="0" cellpadding="2">

<tr>

<td><table border="0" width="100%" cellspacing="0" cellpadding="0">

<tr>

<td class="pageHeading"><?php echo sprintf(TEXT_NEW_ARTICLE, tep_output_generated_topic_path($current_topic_id)); ?></td>

<td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>

</tr>

</table></td>

</tr>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>

</tr>

<tr>

<td><table border="0" cellspacing="0" cellpadding="2">

<tr>

<td class="main"><?php echo TEXT_ARTICLES_STATUS; ?></td>

<td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_radio_field('articles_status', '0', $out_status) . ' ' . TEXT_ARTICLE_NOT_AVAILABLE . ' ' . tep_draw_radio_field('articles_status', '1', $in_status) . ' ' . TEXT_ARTICLE_AVAILABLE; ?></td>

</tr>

<tr>

<td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>

</tr>

<tr>

<td class="main"><?php echo TEXT_ARTICLES_DATE_AVAILABLE; ?><br><small>(YYYY-MM-DD)</small></td>

<td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' '; ?><script language="javascript">dateAvailable.writeControl(); dateAvailable.dateFormat="yyyy-MM-dd";</script></td>

</tr>

<tr>

<td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>

</tr>

<tr>

<tr>

<td class="main"><?php echo TEXT_ARTICLES_AUTHOR; ?></td>

<td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_pull_down_menu('authors_id', $authors_array, $aInfo->authors_id); ?></td>

</tr>

<tr>

<td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>

</tr>

<?php

for ($i=0, $n=sizeof($languages); $i<$n; $i++) {

?>

<tr>

<td class="main"><?php if ($i == 0) echo TEXT_ARTICLES_NAME; ?></td>

<td class="main"><?php echo tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']) . ' ' . tep_draw_input_field('articles_name[' . $languages[$i]['id'] . ']', (isset($articles_name[$languages[$i]['id']]) ? $articles_name[$languages[$i]['id']] : tep_get_articles_name($aInfo->articles_id, $languages[$i]['id'])), 'size="35"'); ?></td>

</tr>

<?php

}

?>

<tr>

<td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>

</tr>

<?php

for ($i=0, $n=sizeof($languages); $i<$n; $i++) {

?>

<tr bgcolor="#ffffcc">

<td class="main"><?php if ($i == 0) echo TEXT_ARTICLES_HEAD_TITLE_TAG; ?></td>

<td class="main"><?php echo tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']) . ' ' . tep_draw_input_field('articles_head_title_tag[' . $languages[$i]['id'] . ']', (isset($articles_head_title_tag[$languages[$i]['id']]) ? $articles_head_title_tag[$languages[$i]['id']] : tep_get_articles_head_title_tag($aInfo->articles_id, $languages[$i]['id'])), 'size="35"'); ?></td>

</tr>

<?php

}

?>

<tr bgcolor="#ffffcc">

<td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>

</tr>

<?php

for ($i=0, $n=sizeof($languages); $i<$n; $i++) {

?>

<tr bgcolor="#ffffcc">

<td class="main" valign="top"><?php if ($i == 0) echo sprintf(TEXT_ARTICLES_HEAD_DESC_TAG, MAX_ARTICLE_ABSTRACT_LENGTH); ?></td>

<td><table border="0" cellspacing="0" cellpadding="0">

<tr>

<td class="main" valign="top"><?php echo tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']); ?> </td>

<td class="main"><?php echo tep_draw_textarea_field('articles_head_desc_tag[' . $languages[$i]['id'] . ']', 'soft', '70', '5', (isset($articles_head_desc_tag[$languages[$i]['id']]) ? $articles_head_desc_tag[$languages[$i]['id']] : tep_get_articles_head_desc_tag($aInfo->articles_id, $languages[$i]['id']))); ?></td>

</tr>

</table></td>

</tr>

<?php

}

?>

<tr bgcolor="#ffffcc">

<td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>

</tr>

<?php

for ($i=0, $n=sizeof($languages); $i<$n; $i++) {

?>

<tr bgcolor="#ffffcc">

<td class="main" valign="top"><?php if ($i == 0) echo TEXT_ARTICLES_HEAD_KEYWORDS_TAG; ?></td>

<td><table border="0" cellspacing="0" cellpadding="0">

<tr>

<td class="main" valign="top"><?php echo tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']); ?> </td>

<td class="main"><?php echo tep_draw_textarea_field('articles_head_keywords_tag[' . $languages[$i]['id'] . ']', 'soft', '70', '5', (isset($articles_head_keywords_tag[$languages[$i]['id']]) ? $articles_head_keywords_tag[$languages[$i]['id']] : tep_get_articles_head_keywords_tag($aInfo->articles_id, $languages[$i]['id']))); ?></td>

</tr>

</table></td>

</tr>

<?php

}

?>

<tr>

<td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>

</tr>

 

<?php

for ($i=0, $n=sizeof($languages); $i<$n; $i++) {

?>

<tr>

<td class="main" valign="top"><?php if ($i == 0) echo TEXT_ARTICLES_DESCRIPTION; ?></td>

<td><table border="0" cellspacing="0" cellpadding="0">

<tr>

<td class="main" valign="top"><?php echo tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']); ?> </td>

<td class="main"><?php echo tep_draw_textarea_field('articles_description[' . $languages[$i]['id'] . ']', 'soft', '70', '15', (isset($articles_description[$languages[$i]['id']]) ? $articles_description[$languages[$i]['id']] : tep_get_articles_description($aInfo->articles_id, $languages[$i]['id']))); ?></td>

</tr>

</table></td>

</tr>

<?php

}

?>

<tr>

<td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>

</tr>

 

<tr>

<td class="main"><?php echo TEXT_PRODUCTS_IMAGE; ?></td>

<td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_file_field('articles_image') . '<br>' . tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . $aInfo->articles_image . tep_draw_hidden_field('articles_previous_image', $aInfo->articles_image); ?></td>

</tr>

 

<?php

for ($i=0, $n=sizeof($languages); $i<$n; $i++) {

?>

<tr>

<td class="main"><?php if ($i == 0) echo TEXT_ARTICLES_URL . '<br><small>' . TEXT_ARTICLES_URL_WITHOUT_HTTP . '</small>'; ?></td>

<td class="main"><?php echo tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']) . ' ' . tep_draw_input_field('articles_url[' . $languages[$i]['id'] . ']', (isset($articles_url[$languages[$i]['id']]) ? $articles_url[$languages[$i]['id']] : tep_get_articles_url($aInfo->articles_id, $languages[$i]['id'])), 'size="35"'); ?></td>

</tr>

<?php

}

?>

</table></td>

</tr>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>

</tr>

<tr>

<td class="main" align="right"><?php echo tep_draw_hidden_field('articles_date_added', (tep_not_null($aInfo->articles_date_added) ? $aInfo->articles_date_added : date('Y-m-d'))) . tep_image_submit('button_preview.gif', IMAGE_PREVIEW) . '  <a href="' . tep_href_link(FILENAME_ARTICLES, 'tPath=' . $tPath . (isset($HTTP_GET_VARS['aID']) ? '&aID=' . $HTTP_GET_VARS['aID'] : '')) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>'; ?></td>

</tr>

</table></form>

<?php

//MaxiDVD Added WYSIWYG HTML Area Box + Admin Function v1.7 - 2.2 MS2 Articles Description HTML - </form>

if (ARTICLE_WYSIWYG_ENABLE == 'Enable') {

?>

<script language="JavaScript1.2" defer>

var config = new Object(); // create new config object

config.width = "<?php echo ARTICLE_MANAGER_WYSIWYG_WIDTH; ?>px";

config.height = "<?php echo ARTICLE_MANAGER_WYSIWYG_HEIGHT; ?>px";

config.bodyStyle = 'background-color: <?php echo ARTICLE_MANAGER_WYSIWYG_BG_COLOUR; ?>; font-family: "<?php echo ARTICLE_MANAGER_WYSIWYG_FONT_TYPE; ?>"; color: <?php echo ARTICLE_MANAGER_WYSIWYG_FONT_COLOUR; ?>; font-size: <?php echo ARTICLE_MANAGER_WYSIWYG_FONT_SIZE; ?>pt;';

config.debug = <?php echo ARTICLE_MANAGER_WYSIWYG_DEBUG; ?>;

<?php for ($i = 0, $n = sizeof($languages); $i < $n; $i++) { ?>

editor_generate('articles_description[<?php echo $languages[$i]['id']; ?>]',config);

<?php } ?>

config.height = "35px";

config.bodyStyle = 'background-color: white; font-family: Arial; color: black; font-size: 12px;';

config.toolbar = [ ['InsertImageURL'] ];

config.OscImageRoot = '<?= trim(HTTP_SERVER . DIR_WS_CATALOG_IMAGES) ?>';

</script>

<?php

}

} elseif ($action == 'article_preview') {

if (tep_not_null($HTTP_POST_VARS)) {

$aInfo = new objectInfo($HTTP_POST_VARS);

$articles_name = $HTTP_POST_VARS['articles_name'];

$articles_description = $HTTP_POST_VARS['articles_description'];

$articles_url = $HTTP_POST_VARS['articles_url'];

$articles_head_title_tag = $HTTP_POST_VARS['articles_head_title_tag'];

$articles_head_desc_tag = $HTTP_POST_VARS['articles_head_desc_tag'];

$articles_head_keywords_tag = $HTTP_POST_VARS['articles_head_keywords_tag'];

} else {

$article_query = tep_db_query("select a.articles_id, a.articles_image, ad.language_id, ad.articles_name, ad.articles_description, ad.articles_url, ad.articles_head_title_tag, ad.articles_head_desc_tag, ad.articles_head_keywords_tag, a.articles_date_added, a.articles_last_modified, a.articles_date_available, a.articles_status, a.authors_id from " . TABLE_ARTICLES . " a, " . TABLE_ARTICLES_DESCRIPTION . " ad where a.articles_id = ad.articles_id and a.articles_id = '" . (int)$HTTP_GET_VARS['aID'] . "'");

$article = tep_db_fetch_array($article_query);

 

$aInfo = new objectInfo($article);

// Added Salvo Image

$articles_image_name = $aInfo->articles_image;

//

}

 

$form_action = (isset($HTTP_GET_VARS['aID'])) ? 'update_article' : 'insert_article';

 

echo tep_draw_form($form_action, FILENAME_ARTICLES, 'tPath=' . $tPath . (isset($HTTP_GET_VARS['aID']) ? '&aID=' . $HTTP_GET_VARS['aID'] : '') . '&action=' . $form_action, 'post', 'enctype="multipart/form-data"');

 

$languages = tep_get_languages();

for ($i=0, $n=sizeof($languages); $i<$n; $i++) {

if (isset($HTTP_GET_VARS['read']) && ($HTTP_GET_VARS['read'] == 'only')) {

$aInfo->articles_name = tep_get_articles_name($aInfo->articles_id, $languages[$i]['id']);

$aInfo->articles_description = tep_get_articles_description($aInfo->articles_id, $languages[$i]['id']);

$aInfo->articles_url = tep_get_articles_url($aInfo->articles_id, $languages[$i]['id']);

$aInfo->articles_head_title_tag = tep_get_articles_head_title_tag($aInfo->articles_id, $languages[$i]['id']);

$aInfo->articles_head_desc_tag = tep_get_articles_head_desc_tag($aInfo->articles_id, $languages[$i]['id']);

$aInfo->articles_head_keywords_tag = tep_get_articles_head_keywords_tag($aInfo->articles_id, $languages[$i]['id']);

} else {

$aInfo->articles_name = tep_db_prepare_input($articles_name[$languages[$i]['id']]);

$aInfo->articles_description = tep_db_prepare_input($articles_description[$languages[$i]['id']]);

$aInfo->articles_url = tep_db_prepare_input($articles_url[$languages[$i]['id']]);

$aInfo->articles_head_title_tag = tep_db_prepare_input($articles_head_title_tag[$languages[$i]['id']]);

$aInfo->articles_head_desc_tag = tep_db_prepare_input($articles_head_desc_tag[$languages[$i]['id']]);

$aInfo->articles_head_keywords_tag = tep_db_prepare_input($articles_head_keyw

Link to comment
Share on other sites

Hi

 

Articles Manager works fine, except that it does not display the WYSIWYG editor and at the bottom of the explorer window it shows a javascript error:

 

Line: 351 Char;29 Error: Syntax error Code:0

URL: http://mysite/catalog/admin/articles.php?t...ion=new_article

 

In my setup, Line 351 on articles.php is

} else { document.write('<scr'+'ipt>function editor_generate() { return false; }</scr'+'ipt>'); }

 

Any help would be appreciated

 

Thanks

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...