Commit 584713c0 authored by Chris Graham's avatar Chris Graham
Browse files

Fixed MANTIS-4869 (Problems with scheduled news)

parent 6bf1d306
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -408,7 +408,7 @@ class Module_cms_blogs extends Standard_crud_module
        $scheduled = mixed();

        if (addon_installed('calendar')) {
            $schedule_code = ':$GLOBALS[\'SITE_DB\']->query_update(\'news\',array(\'date_and_time\'=>$GLOBALS[\'_EVENT_TIMESTAMP\'],\'validated\'=>1),array(\'id\'=>' . strval($id) . '),\'\',1);';
            $schedule_code = ':$GLOBALS[\'SITE_DB\']->query_update(\'news\',array(\'date_and_time\'=>$GLOBALS[\'_EVENT_TIMESTAMP\'],\'validated\'=>1),array(\'id\'=>' . strval($id) . '),\'\',1); require_code(\'sitemap_xml\'); notify_sitemap_node_edit(\'_SEARCH:news:view:' . strval($id) . '\');';
            $past_event = $GLOBALS['SITE_DB']->query_select('calendar_events', array('e_start_day', 'e_start_month', 'e_start_year', 'e_start_hour', 'e_start_minute'), array($GLOBALS['SITE_DB']->translate_field_ref('e_content') => $schedule_code), '', 1);
            $scheduled = array_key_exists(0, $past_event) ? array($past_event[0]['e_start_minute'], $past_event[0]['e_start_hour'], $past_event[0]['e_start_month'], $past_event[0]['e_start_day'], $past_event[0]['e_start_year']) : null;
            if ((!is_null($scheduled)) && (mktime($scheduled[1], $scheduled[0], 0, $scheduled[2], $scheduled[3], $scheduled[4]) < time())) {
@@ -507,7 +507,7 @@ class Module_cms_blogs extends Standard_crud_module

        if (!is_null($schedule)) {
            require_code('calendar');
            $schedule_code = ':$GLOBALS[\'SITE_DB\']->query_update(\'news\',array(\'date_and_time\'=>$GLOBALS[\'_EVENT_TIMESTAMP\'],\'validated\'=>1),array(\'id\'=>' . strval($id) . '),\'\',1);';
            $schedule_code = ':$GLOBALS[\'SITE_DB\']->query_update(\'news\',array(\'date_and_time\'=>$GLOBALS[\'_EVENT_TIMESTAMP\'],\'validated\'=>1),array(\'id\'=>' . strval($id) . '),\'\',1); require_code(\'sitemap_xml\'); notify_sitemap_node_edit(\'_SEARCH:news:view:' . strval($id) . '\');';
            $start_year = intval(date('Y', $schedule));
            $start_month = intval(date('m', $schedule));
            $start_day = intval(date('d', $schedule));
@@ -564,7 +564,7 @@ class Module_cms_blogs extends Standard_crud_module

        if ((addon_installed('calendar')) && (has_privilege(get_member(), 'scheduled_publication_times'))) {
            require_code('calendar2');
            $schedule_code = ':$GLOBALS[\'SITE_DB\']->query_update(\'news\',array(\'date_and_time\'=>$GLOBALS[\'_EVENT_TIMESTAMP\'],\'validated\'=>1),array(\'id\'=>' . strval($id) . '),\'\',1);';
            $schedule_code = ':$GLOBALS[\'SITE_DB\']->query_update(\'news\',array(\'date_and_time\'=>$GLOBALS[\'_EVENT_TIMESTAMP\'],\'validated\'=>1),array(\'id\'=>' . strval($id) . '),\'\',1); require_code(\'sitemap_xml\'); notify_sitemap_node_edit(\'_SEARCH:news:view:' . strval($id) . '\');';
            $past_event = $GLOBALS['SITE_DB']->query_select_value_if_there('calendar_events', 'id', array($GLOBALS['SITE_DB']->translate_field_ref('e_content') => $schedule_code));
            require_code('calendar');
            if (!is_null($past_event)) {
@@ -579,7 +579,7 @@ class Module_cms_blogs extends Standard_crud_module
                $start_day = intval(date('d', $schedule));
                $start_hour = intval(date('H', $schedule));
                $start_minute = intval(date('i', $schedule));
                $event_id = add_calendar_event(db_get_first_id(), 'none', null, 0, do_lang('PUBLISH_NEWS', 0, post_param_string('title')), $schedule_code, 3, $start_year, $start_month, $start_day, 'day_of_month', $start_hour, $start_minute);
                $event_id = add_calendar_event(db_get_first_id(), 'none', null, 0, do_lang('PUBLISH_NEWS', post_param_string('title')), $schedule_code, 3, $start_year, $start_month, $start_day, 'day_of_month', $start_hour, $start_minute);
                regenerate_event_reminder_jobs($event_id, true);
            }
        }
+4 −4
Original line number Diff line number Diff line
@@ -505,7 +505,7 @@ class Module_cms_news extends Standard_crud_module
        $scheduled = mixed();

        if (addon_installed('calendar')) {
            $schedule_code = ':$GLOBALS[\'SITE_DB\']->query_update(\'news\',array(\'date_and_time\'=>$GLOBALS[\'_EVENT_TIMESTAMP\'],\'validated\'=>1),array(\'id\'=>' . strval($id) . '),\'\',1);';
            $schedule_code = ':$GLOBALS[\'SITE_DB\']->query_update(\'news\',array(\'date_and_time\'=>$GLOBALS[\'_EVENT_TIMESTAMP\'],\'validated\'=>1),array(\'id\'=>' . strval($id) . '),\'\',1); require_code(\'sitemap_xml\'); notify_sitemap_node_edit(\'_SEARCH:news:view:' . strval($id) . '\');';
            $past_event = $GLOBALS['SITE_DB']->query_select('calendar_events', array('*'), array($GLOBALS['SITE_DB']->translate_field_ref('e_content') => $schedule_code), '', 1);
            $scheduled = array_key_exists(0, $past_event) ? array($past_event[0]['e_start_minute'], $past_event[0]['e_start_hour'], $past_event[0]['e_start_month'], $past_event[0]['e_start_day'], $past_event[0]['e_start_year']) : null;
            if ((!is_null($scheduled)) && (mktime($scheduled[1], $scheduled[0], 0, $scheduled[2], $scheduled[3], $scheduled[4]) < time())) {
@@ -612,7 +612,7 @@ class Module_cms_news extends Standard_crud_module

        if (!is_null($schedule)) {
            require_code('calendar');
            $schedule_code = ':$GLOBALS[\'SITE_DB\']->query_update(\'news\',array(\'date_and_time\'=>$GLOBALS[\'_EVENT_TIMESTAMP\'],\'validated\'=>1),array(\'id\'=>' . strval($id) . '),\'\',1);';
            $schedule_code = ':$GLOBALS[\'SITE_DB\']->query_update(\'news\',array(\'date_and_time\'=>$GLOBALS[\'_EVENT_TIMESTAMP\'],\'validated\'=>1),array(\'id\'=>' . strval($id) . '),\'\',1); require_code(\'sitemap_xml\'); notify_sitemap_node_edit(\'_SEARCH:news:view:' . strval($id) . '\');';
            $start_year = intval(date('Y', $schedule));
            $start_month = intval(date('m', $schedule));
            $start_day = intval(date('d', $schedule));
@@ -682,7 +682,7 @@ class Module_cms_news extends Standard_crud_module

        if ((addon_installed('calendar')) && (!fractional_edit()) && (has_privilege(get_member(), 'scheduled_publication_times'))) {
            require_code('calendar2');
            $schedule_code = ':$GLOBALS[\'SITE_DB\']->query_update(\'news\',array(\'date_and_time\'=>$GLOBALS[\'_EVENT_TIMESTAMP\'],\'validated\'=>1),array(\'id\'=>' . strval($id) . '),\'\',1);';
            $schedule_code = ':$GLOBALS[\'SITE_DB\']->query_update(\'news\',array(\'date_and_time\'=>$GLOBALS[\'_EVENT_TIMESTAMP\'],\'validated\'=>1),array(\'id\'=>' . strval($id) . '),\'\',1); require_code(\'sitemap_xml\'); notify_sitemap_node_edit(\'_SEARCH:news:view:' . strval($id) . '\');';
            $past_event = $GLOBALS['SITE_DB']->query_select_value_if_there('calendar_events', 'id', array($GLOBALS['SITE_DB']->translate_field_ref('e_content') => $schedule_code));
            require_code('calendar');
            if (!is_null($past_event)) {
@@ -697,7 +697,7 @@ class Module_cms_news extends Standard_crud_module
                $start_day = intval(date('d', $schedule));
                $start_hour = intval(date('H', $schedule));
                $start_minute = intval(date('i', $schedule));
                $event_id = add_calendar_event(db_get_first_id(), 'none', null, 0, do_lang('PUBLISH_NEWS', 0, post_param_string('title')), $schedule_code, 3, $start_year, $start_month, $start_day, 'day_of_month', $start_hour, $start_minute);
                $event_id = add_calendar_event(db_get_first_id(), 'none', null, 0, do_lang('PUBLISH_NEWS', post_param_string('title')), $schedule_code, 3, $start_year, $start_month, $start_day, 'day_of_month', $start_hour, $start_minute);
                regenerate_event_reminder_jobs($event_id, true);
            }
        }