// require('includes/application_top.php'); require('includes/functions/news_general.php'); if (!isset($_GET['aID']) || !zen_not_null($_GET['aID'])) { zen_redirect(zen_href_link(FILENAME_NEWS)); } if (isset($_GET['action'])) { switch ($_GET['action']) { case 'setflag': if (($_GET['flag'] == '0') || ($_GET['flag'] == '1')) { if (isset($_GET['cID']) && zen_not_null($_GET['cID'])) { $sql_data_array = array('approved' => zen_db_prepare_input($_GET['flag'])); zen_db_perform(TABLE_NEWS_COMMENTS, $sql_data_array, 'update', 'comments_id = \'' . (int)$_GET['cID'] . '\''); $messageStack->add(SUCCESS_STATUS, 'success'); } } break; } } if ($_POST) { $article_id = zen_db_prepare_input($_GET['aID']); $comments_id = zen_db_prepare_input($_GET['cID']); $customers_name = zen_db_prepare_input($_POST['customers_name']); $comments_subject = zen_db_prepare_input($_POST['comments_subject']); $comments_text = zen_db_prepare_input($_POST['comments_text']); } switch ($_GET['query']) { case 'add_comment': // Check if all fields are filled up if (!zen_not_null($customers_name)) { $error = true; $messageStack->add(ERROR_BLANK_COMMENTS_BY_NAME, 'error'); } if (!zen_not_null($comments_text)) { $error = true; $messageStack->add(ERROR_BLANK_COMMENTS, 'error'); } // Good to go if (!$error) { $sql_data_array = array( 'article_id' => $article_id, 'customers_name' => $customers_name, 'date_added' => 'now()', 'approved' => '1', ); zen_db_perform(TABLE_NEWS_COMMENTS, $sql_data_array); $comments_id = $db->Insert_ID(); $sql_data_array = array( 'comments_id' => $comments_id, 'language_id' => $_SESSION['languages_id'], 'comments_subject' => $comments_subject, 'comments_text' => $comments_text, ); zen_db_perform(TABLE_NEWS_COMMENTS_DESCRIPTION, $sql_data_array); $messageStack->add_session(SUCCESS_NEW_COMMENT, 'success'); zen_redirect(zen_href_link(FILENAME_NEWS_COMMENTS, 'page=' . $_GET['page'] . '&aID=' . $article_id . '&cID=' . $comments_id)); } break; case 'update_comment': // Check if all fields are filled up if (!zen_not_null($customers_name)) { $error = true; $messageStack->add(ERROR_BLANK_COMMENTS_BY_NAME, 'error'); } if (!zen_not_null($comments_text)) { $error = true; $messageStack->add(ERROR_BLANK_COMMENTS, 'error'); } // Good to go if (!$error) { $sql_data_array = array( 'customers_name' => $customers_name, 'last_modified' => 'now()', ); zen_db_perform(TABLE_NEWS_COMMENTS, $sql_data_array, 'update', 'comments_id = \'' . (int)$comments_id . '\''); $sql_data_array = array( 'comments_subject' => $comments_subject, 'comments_text' => $comments_text, ); zen_db_perform(TABLE_NEWS_COMMENTS_DESCRIPTION, $sql_data_array, 'update', 'comments_id = \'' . (int)$comments_id . '\''); $messageStack->add_session(SUCCESS_NEW_COMMENT, 'success'); zen_redirect(zen_href_link(FILENAME_NEWS_COMMENTS, 'page=' . $_GET['page'] . '&aID=' . $article_id . '&cID=' . $comments_id)); } break; case 'delete_comment': $db->Execute("DELETE FROM " . TABLE_NEWS_COMMENTS . " WHERE comments_id = '" . (int)$comments_id . "'"); $db->Execute("DELETE FROM " . TABLE_NEWS_COMMENTS_DESCRIPTION . " WHERE comments_id = '" . (int)$comments_id . "'"); $messageStack->add_session(SUCCESS_DELETE_COMMENT, 'success'); zen_redirect(zen_href_link(FILENAME_NEWS_COMMENTS, 'page=' . $_GET['page'] . '&aID=' . $article_id)); break; } // start page output echo ''. "\n" . '' . '' . '' . '' . TITLE . '' . '' . '' . '' . '' . '' . '' . '' . '' . '' . '' . '' . '
' . '' . '' . '' . '' . '' . '' . '' . '' . '' . '' . '' . '' . '' . '
' . '' . '' . '' . '' . '' . '' . '' . '' . '' . '' . '' . '' . '' . '' . '' . '' . '' . '' . '
ΝΌΚΎ
' . TEXT_NEWS_LEGEND_STATUS_OFF . '' . TEXT_NEWS_LEGEND_STATUS_ON . '' . TEXT_NEWS_LEGEND_EDIT . '' . TEXT_NEWS_LEGEND_DELETE . '' . TEXT_NEWS_LEGEND_INFO . '
' . zen_image(DIR_WS_IMAGES . 'icon_red_on.gif', IMAGE_ICON_STATUS_OFF) . '' . zen_image(DIR_WS_IMAGES . 'icon_green_on.gif', IMAGE_ICON_STATUS_ON) . '' . zen_image(DIR_WS_IMAGES . 'icon_edit.gif', ICON_EDIT) . '' . zen_image(DIR_WS_IMAGES . 'icon_delete.gif', ICON_DELETE) . '' . zen_image(DIR_WS_IMAGES . 'icon_info.gif', IMAGE_ICON_INFO) . '
' . '
' . zen_draw_separator('pixel_trans.gif', '1', '10') . '
' . '' . '' . '' . '' . '' . '
' . sprintf(HEADING_TITLE, news_get_news_article_name($_GET['aID'])) . '' . zen_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT) . '
' . '
' . '' . '' . ''; $heading = array(); $contents = array(); switch ($_GET['action']) { case 'new': $heading[] = array('text' => '' . TEXT_HEADING_NEW_COMMENT . ''); $contents = array('form' => zen_draw_form('new_comment', FILENAME_NEWS_COMMENTS, 'page=' . $_GET['page'] . '&aID=' . $_GET['aID'] . '&query=add_comment&action=new', 'post', 'enctype="multipart/form-data"')); $contents[] = array('text' => TEXT_NEW_INTRO); $contents[] = array('text' => '
' . TEXT_COMMENTS_BY . '
' . zen_draw_input_field('customers_name', (($customers_name) ? $customers_name : ''))); $contents[] = array('text' => '
' . TEXT_SUBJECT . '
' . zen_draw_input_field('comments_subject', (($comments_subject) ? $comments_subject : ''))); $contents[] = array('text' => '
' . TEXT_COMMENTS . '
' . zen_draw_textarea_field('comments_text', 'soft', '30', '20', (($comments_text) ? $comments_text : ''), 'style="width: 100%;"')); $contents[] = array('align' => 'center', 'text' => '
' . zen_image_submit('button_save.gif', IMAGE_SAVE) . ' ' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . ''); break; case 'edit': $heading[] = array('text' => '' . TEXT_HEADING_EDIT_COMMENT . ''); $contents = array('form' => zen_draw_form('update_comment', FILENAME_NEWS_COMMENTS, 'page=' . $_GET['page'] . '&aID=' . $_GET['aID'] . '&cID=' . $cInfo->comments_id . '&query=update_comment&action=edit', 'post', 'enctype="multipart/form-data"')); $contents[] = array('text' => TEXT_EDIT_INTRO); $contents[] = array('text' => '
' . TEXT_COMMENTS_BY . '
' . zen_draw_input_field('customers_name', (($customers_name) ? $customers_name : $cInfo->customers_name))); $contents[] = array('text' => '
' . TEXT_SUBJECT . '
' . zen_draw_input_field('comments_subject', (($comments_subject) ? $comments_subject : $cInfo->comments_subject))); $contents[] = array('text' => '
' . TEXT_COMMENTS . '
' . zen_draw_textarea_field('comments_text', 'soft', '30', '20', (($comments_text) ? $comments_text : $cInfo->comments_text), 'style="width: 100%;"')); $contents[] = array('align' => 'center', 'text' => '
' . zen_image_submit('button_save.gif', IMAGE_SAVE) . ' ' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . ''); break; case 'delete': $heading[] = array('text' => '' . TEXT_HEADING_DELETE_COMMENT . ''); $contents = array('form' => zen_draw_form('delete_author', FILENAME_NEWS_COMMENTS, 'page=' . $_GET['page'] . '&aID=' . $_GET['aID'] . '&cID=' . $cInfo->comments_id . '&query=delete_comment&action=delete')); $contents[] = array('text' => TEXT_DELETE_INTRO); $contents[] = array('text' => '
' . $cInfo->comments_subject . '
' . $cInfo->customers_name); $contents[] = array('text' => '
' . $cInfo->comments_text); $contents[] = array('align' => 'center', 'text' => '
' . zen_image_submit('button_delete.gif', IMAGE_DELETE) . ' ' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . ''); break; default: if (is_object($cInfo)) { $heading[] = array('text' => '' . TEXT_HEADING_COMMENT . ''); $contents[] = array('align' => 'center', 'text' => '' . zen_image_button('button_edit.gif', IMAGE_EDIT) . '' . zen_image_button('button_delete.gif', IMAGE_DELETE) . ''); $contents[] = array('text' => '
' . $cInfo->comments_subject . '
' . $cInfo->customers_name); $contents[] = array('text' => '
' . $cInfo->comments_text); } break; } if ( (zen_not_null($heading)) && (zen_not_null($contents)) ) { $box = new box; echo ''; } echo '' . '
' . '' . '' . '' . '' . '' . '' . '' . ''; $comments_query_raw = "select nc.comments_id, nc.article_id, nc.customers_id, nc.customers_name, nc.date_added, nc.last_modified, nc.approved, ncd.comments_subject, ncd.comments_text from " . TABLE_NEWS_COMMENTS . " nc left join " . TABLE_NEWS_COMMENTS_DESCRIPTION . " ncd on (nc.comments_id = ncd.comments_id and ncd.language_id = '" . (int)$_SESSION['languages_id'] . "') where nc.article_id = '" . (int)$_GET['aID'] . "' order by nc.date_added DESC"; $comments_split = new splitPageResults($_GET['page'], MAX_DISPLAY_SEARCH_RESULTS, $comments_query_raw, $comments_query_numrows); $comments = $db->Execute($comments_query_raw); while (!$comments->EOF) { if (((!$_GET['cID']) || (@$_GET['cID'] == $comments->fields['comments_id'])) && (!$cInfo) && (substr($_GET['action'], 0, 3) != 'new')) { $cInfo = new objectInfo($comments->fields); } if ( (is_object($cInfo)) && ($comments->fields['comments_id'] == $cInfo->comments_id) ) { echo ''; } else { echo ''; } echo '' . '' . '' . '' . '' . ''; $comments->MoveNext(); } echo '' . '' . ''; if ($_GET['action'] != 'new') { echo '' . '' . ''; } echo '
' . TABLE_HEADING_COMMENTS_BY . '' . TABLE_HEADING_SUBJECT . '' . TABLE_HEADING_DATE_ADDED . '' . TABLE_HEADING_STATUS . '' . TABLE_HEADING_ACTION . ' 
' . $comments->fields['customers_name'] . '' . $comments->fields['comments_subject'] . '' . zen_datetime_short($comments->fields['date_added']) . ''; if ($comments->fields['approved'] == '1') { echo '' . zen_image(DIR_WS_IMAGES . 'icon_green_on.gif', IMAGE_ICON_STATUS_ON) . ''; } else { echo '' . zen_image(DIR_WS_IMAGES . 'icon_red_on.gif', IMAGE_ICON_STATUS_OFF) . ''; } echo '' . '' . zen_image(DIR_WS_IMAGES . 'icon_edit.gif', ICON_EDIT) . ' ' . '' . zen_image(DIR_WS_IMAGES . 'icon_delete.gif', ICON_DELETE) . ' '; if ( (is_object($cInfo)) && ($comments->fields['comments_id'] == $cInfo->comments_id) ) { echo zen_image(DIR_WS_IMAGES . 'icon_arrow_right.gif') . ' '; } else { echo '' . zen_image(DIR_WS_IMAGES . 'icon_info.gif', IMAGE_ICON_INFO) . ' '; } echo '
' . '' . '' . '' . '' . '' . '
' . $comments_split->display_count($comments_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, $_GET['page'], TEXT_DISPLAY_NUMBER_OF_COMMENTS) . '' . $comments_split->display_links($comments_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, MAX_DISPLAY_PAGE_LINKS, $_GET['page']) . '
' . '
' . zen_image_button('button_insert.gif', IMAGE_INSERT) . '
' . '
' . $box->infoBox($heading, $contents) . '
' . '
' . '
' . '' . ''; require(DIR_WS_INCLUDES . 'footer.php'); echo '' . ''. ''; require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>