[ticket/572] Use json_decode/encode instead of serializing data
B3P-572
This commit is contained in:
@@ -265,7 +265,7 @@ class calendar extends module_base
|
||||
* Let's start displaying the events
|
||||
* make sure we only display events in the future
|
||||
*/
|
||||
$events = $this->utf_unserialize($portal_config['board3_calendar_events_' . $module_id]);
|
||||
$events = json_decode($portal_config['board3_calendar_events_' . $module_id], true);
|
||||
|
||||
if (!empty($events) && $this->config['board3_display_events_' . $module_id])
|
||||
{
|
||||
@@ -423,7 +423,7 @@ class calendar extends module_base
|
||||
$link_id = $this->request->variable('id', 99999999); // 0 will trigger unwanted behavior, therefore we set a number we should never reach
|
||||
$portal_config = obtain_portal_config();
|
||||
|
||||
$events = (strlen($portal_config['board3_calendar_events_' . $module_id]) >= 1) ? $this->utf_unserialize($portal_config['board3_calendar_events_' . $module_id]) : array();
|
||||
$events = (strlen($portal_config['board3_calendar_events_' . $module_id]) >= 1) ? json_decode($portal_config['board3_calendar_events_' . $module_id], true) : array();
|
||||
|
||||
// append_sid() adds adm/ already, no need to add it here
|
||||
$u_action = append_sid('index.' . $this->php_ext, 'i=\board3\portal\acp\portal_module&mode=config&module_id=' . $module_id);
|
||||
@@ -533,7 +533,7 @@ class calendar extends module_base
|
||||
$time_ary[$key] = $cur_event['start_time'];
|
||||
}
|
||||
array_multisort($time_ary, SORT_NUMERIC, $events);
|
||||
$board3_events_array = serialize($events);
|
||||
$board3_events_array = json_encode($events);
|
||||
set_portal_config('board3_calendar_events_' . $module_id, $board3_events_array);
|
||||
|
||||
trigger_error($message . adm_back_link($u_action));
|
||||
@@ -555,7 +555,7 @@ class calendar extends module_base
|
||||
array_splice($events, $link_id, 1);
|
||||
$events = array_merge($events);
|
||||
|
||||
$board3_events_array = serialize($events);
|
||||
$board3_events_array = json_encode($events);
|
||||
set_portal_config('board3_calendar_events_' . $module_id, $board3_events_array);
|
||||
|
||||
$this->log->add('admin', $this->user->data['user_id'], $this->user->data['user_ip'], 'LOG_PORTAL_EVENT_REMOVED', false, array($cur_event_title));
|
||||
@@ -711,21 +711,6 @@ class calendar extends module_base
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Unserialize links array
|
||||
*
|
||||
* @param string $serial_str Serialized string
|
||||
*
|
||||
* @return array Unserialized string
|
||||
*/
|
||||
private function utf_unserialize($serial_str)
|
||||
{
|
||||
$out = preg_replace_callback('!s:(\d+):"(.*?)";!s', function ($result) {
|
||||
return 's:' . strlen($result[2]) . ":\"{$result[2]}\";";
|
||||
}, $serial_str);
|
||||
return unserialize($out);
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate URLs and execute apppend_sid if necessary
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user