add(ERROR_NEWSLETTER_TITLE, 'error'); $newsletter_error = true; } if (empty($module)) { $messageStack->add(ERROR_NEWSLETTER_MODULE, 'error'); $newsletter_error = true; } if ($newsletter_error == false) { $sql_data_array = array('title' => $title, 'content' => $content, 'module' => $newsletter_module); if ($action == 'insert') { $sql_data_array['date_added'] = 'now()'; $sql_data_array['status'] = '0'; $sql_data_array['locked'] = '0'; tep_db_perform(TABLE_NEWSLETTERS, $sql_data_array); $newsletter_id = tep_db_insert_id(); } elseif ($action == 'update') { tep_db_perform(TABLE_NEWSLETTERS, $sql_data_array, 'update', "newsletters_id = '" . (int)$newsletter_id . "'"); } tep_redirect(tep_href_link(FILENAME_NEWSLETTERS, (isset($HTTP_GET_VARS['page']) ? 'page=' . $HTTP_GET_VARS['page'] . '&' : '') . 'nID=' . $newsletter_id)); } else { $action = 'new'; } break; case 'deleteconfirm': $newsletter_id = tep_db_prepare_input($HTTP_GET_VARS['nID']); tep_db_query("delete from " . TABLE_NEWSLETTERS . " where newsletters_id = '" . (int)$newsletter_id . "'"); tep_redirect(tep_href_link(FILENAME_NEWSLETTERS, 'page=' . $HTTP_GET_VARS['page'])); break; case 'delete': case 'new': if (!isset($HTTP_GET_VARS['nID'])) break; case 'send': case 'confirm_send': $newsletter_id = tep_db_prepare_input($HTTP_GET_VARS['nID']); $check_query = tep_db_query("select locked from " . TABLE_NEWSLETTERS . " where newsletters_id = '" . (int)$newsletter_id . "'"); $check = tep_db_fetch_array($check_query); if ($check['locked'] < 1) { switch ($action) { case 'delete': $error = ERROR_REMOVE_UNLOCKED_NEWSLETTER; break; case 'new': $error = ERROR_EDIT_UNLOCKED_NEWSLETTER; break; case 'send': $error = ERROR_SEND_UNLOCKED_NEWSLETTER; break; case 'confirm_send': $error = ERROR_SEND_UNLOCKED_NEWSLETTER; break; } $messageStack->add_session($error, 'error'); tep_redirect(tep_href_link(FILENAME_NEWSLETTERS, 'page=' . $HTTP_GET_VARS['page'] . '&nID=' . $HTTP_GET_VARS['nID'])); } break; } } ?> > <?php echo TITLE; ?>
'', 'content' => '', 'module' => ''); $nInfo = new objectInfo($parameters); if (isset($HTTP_GET_VARS['nID'])) { $form_action = 'update'; $nID = tep_db_prepare_input($HTTP_GET_VARS['nID']); $newsletter_query = tep_db_query("select title, content, module from " . TABLE_NEWSLETTERS . " where newsletters_id = '" . (int)$nID . "'"); $newsletter = tep_db_fetch_array($newsletter_query); $nInfo->objectInfo($newsletter); } elseif ($HTTP_POST_VARS) { $nInfo->objectInfo($HTTP_POST_VARS); } $file_extension = substr($PHP_SELF, strrpos($PHP_SELF, '.')); $directory_array = array(); if ($dir = dir(DIR_WS_MODULES . 'newsletters/')) { while ($file = $dir->read()) { if (!is_dir(DIR_WS_MODULES . 'newsletters/' . $file)) { if (substr($file, strrpos($file, '.')) == $file_extension) { $directory_array[] = $file; } } } sort($directory_array); $dir->close(); } for ($i=0, $n=sizeof($directory_array); $i<$n; $i++) { $modules_array[] = array('id' => substr($directory_array[$i], 0, strrpos($directory_array[$i], '.')), 'text' => substr($directory_array[$i], 0, strrpos($directory_array[$i], '.'))); } ?> module . substr($PHP_SELF, strrpos($PHP_SELF, '.'))); include(DIR_WS_MODULES . 'newsletters/' . $nInfo->module . substr($PHP_SELF, strrpos($PHP_SELF, '.'))); $module_name = $nInfo->module; $module = new $module_name($nInfo->title, $nInfo->content); ?> module . substr($PHP_SELF, strrpos($PHP_SELF, '.'))); include(DIR_WS_MODULES . 'newsletters/' . $nInfo->module . substr($PHP_SELF, strrpos($PHP_SELF, '.'))); $module_name = $nInfo->module; $module = new $module_name($nInfo->title, $nInfo->content); ?> module . substr($PHP_SELF, strrpos($PHP_SELF, '.'))); include(DIR_WS_MODULES . 'newsletters/' . $nInfo->module . substr($PHP_SELF, strrpos($PHP_SELF, '.'))); $module_name = $nInfo->module; $module = new $module_name($nInfo->title, $nInfo->content); ?> send($nInfo->newsletters_id); ?>
module); ?>
title, '', true); ?>
content); ?>
' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . ''; ?>
' . tep_image_button('button_back.gif', IMAGE_BACK) . ''; ?>
content); ?>
' . tep_image_button('button_back.gif', IMAGE_BACK) . ''; ?>
show_choose_audience) { echo $module->choose_audience(); } else { echo $module->confirm(); } ?>
confirm(); ?>
' . tep_image_button('button_back.gif', IMAGE_BACK) . ''; ?>
'' . $nInfo->title . ''); $contents = array('form' => tep_draw_form('newsletters', FILENAME_NEWSLETTERS, 'page=' . $HTTP_GET_VARS['page'] . '&nID=' . $nInfo->newsletters_id . '&action=deleteconfirm')); $contents[] = array('text' => TEXT_INFO_DELETE_INTRO); $contents[] = array('text' => '
' . $nInfo->title . ''); $contents[] = array('align' => 'center', 'text' => '
' . tep_image_submit('button_delete.gif', IMAGE_DELETE) . ' ' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . ''); break; default: if (is_object($nInfo)) { $heading[] = array('text' => '' . $nInfo->title . ''); if ($nInfo->locked > 0) { $contents[] = array('align' => 'center', 'text' => '' . tep_image_button('button_edit.gif', IMAGE_EDIT) . '' . tep_image_button('button_delete.gif', IMAGE_DELETE) . '' . tep_image_button('button_preview.gif', IMAGE_PREVIEW) . '' . tep_image_button('button_send.gif', IMAGE_SEND) . '' . tep_image_button('button_unlock.gif', IMAGE_UNLOCK) . ''); } else { $contents[] = array('align' => 'center', 'text' => '' . tep_image_button('button_preview.gif', IMAGE_PREVIEW) . '' . tep_image_button('button_lock.gif', IMAGE_LOCK) . ''); } $contents[] = array('text' => '
' . TEXT_NEWSLETTER_DATE_ADDED . ' ' . tep_date_short($nInfo->date_added)); if ($nInfo->status == '1') $contents[] = array('text' => TEXT_NEWSLETTER_DATE_SENT . ' ' . tep_date_short($nInfo->date_sent)); } break; } if ( (tep_not_null($heading)) && (tep_not_null($contents)) ) { echo ' ' . "\n"; } ?>
newsletters_id) ) { echo ' ' . "\n"; } else { echo ' ' . "\n"; } ?>
 
' . tep_image(DIR_WS_ICONS . 'preview.gif', ICON_PREVIEW) . ' ' . $newsletters['title']; ?> 0) { echo tep_image(DIR_WS_ICONS . 'locked.gif', ICON_LOCKED); } else { echo tep_image(DIR_WS_ICONS . 'unlocked.gif', ICON_UNLOCKED); } ?> newsletters_id) ) { echo tep_image(DIR_WS_IMAGES . 'icon_arrow_right.gif', ''); } else { echo '' . tep_image(DIR_WS_IMAGES . 'icon_info.gif', IMAGE_ICON_INFO) . ''; } ?> 
display_count($newsletters_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, $HTTP_GET_VARS['page'], TEXT_DISPLAY_NUMBER_OF_NEWSLETTERS); ?> display_links($newsletters_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, MAX_DISPLAY_PAGE_LINKS, $HTTP_GET_VARS['page']); ?>
' . tep_image_button('button_new_newsletter.gif', IMAGE_NEW_NEWSLETTER) . ''; ?>
' . "\n"; $box = new box; echo $box->infoBox($heading, $contents); echo '