* @author Rowan Seymour * @copyright This source is distributed under the GPL * @file The integration page * @modifications Cyril Maguire */ /* Gutama plugin package * @version 1.6 * @date 01/10/2013 * @author Cyril MAGUIRE */ include 'inc/gutuma.php'; if ($_SESSION['profil'] != PROFIL_ADMIN) { header('Location:compose.php'); exit; } gu_init(); gu_theme_start(); $lists = gu_list::get_all(FALSE, FALSE); $script_import = '<script type="text/javascript" src="' . absolute_url('js/gadgets.js.php') . '"></script>'; $gadget_type = is_post_var('gadget_type') ? get_post_var('gadget_type') : ''; $generate = is_post_var('gadget_generate') && $gadget_type != ''; // Default to first list if one exists $example_list_id = count($lists) > 0 ? $lists[0]->get_id() : 0; if ($generate) { $gadget_list = is_post_var('gadget_list') ? get_post_var('gadget_list') : $example_list_id; switch ($gadget_type) { case 'basic_link': $gadget_text = is_post_var('gadget_text') ? get_post_var('gadget_text') : t('Subscribe to my newsletter'); $script_create = 'gu_gadgets_create_basic_link(' . $gadget_list . ', "' . $gadget_text . '")'; $script_write = '<script type="text/javascript">gu_gadgets_write_basic_link(' . $gadget_list . ', "' . $gadget_text . '")</script>'; $gadget_params = array('list', 'text');
* @project Gutuma Newsletter Managment * @author Rowan Seymour * @copyright This source is distributed under the GPL * @file The AJAX interface to Gutuma * @modifications Cyril Maguire */ /* Gutama plugin package * @version 1.6 * @date 01/10/2013 * @author Cyril MAGUIRE */ include_once 'inc/gutuma.php'; include_once 'inc/subscription.php'; include_once 'inc/newsletter.php'; // Initialize Gutuma without validation or redirection gu_init(FALSE, FALSE); // Acceptable public action values, i.e ones that don't require a valid session $public_actions = array('subscribe', 'unsubscribe'); // Get posted action var which determines which function gets called if (!is_post_var('action')) { gu_ajax_error(t('No action specified in AJAX request')); } $action = get_post_var('action'); $is_public_action = in_array($action, $public_actions); // Check for valid session if not a public action if (!gu_session_is_valid() && !$is_public_action) { gu_ajax_error(t('This action requires a valid session. Try logging in again.')); } // Call the appropriate function switch ($action) { case 'subscribe':