| 100 | | if ((!isset($cache_lastpostdate)) OR (!$use_cache)) { |
|---|
| 101 | | $now = gmdate('Y-m-d H:i:s'); |
|---|
| 102 | | $lastpostdate = $wpdb->get_var("SELECT post_date FROM $tableposts WHERE post_date <= '$now' AND post_status = 'publish' ORDER BY post_date DESC LIMIT 1"); |
|---|
| 103 | | $cache_lastpostdate = $lastpostdate; |
|---|
| 104 | | } else { |
|---|
| 105 | | $lastpostdate = $cache_lastpostdate; |
|---|
| | 100 | $add_seconds_blog = get_settings('gmt_offset') * 3600; |
|---|
| | 101 | $add_seconds_server = date('Z'); |
|---|
| | 102 | $now = gmdate('Y-m-d H:i:s'); |
|---|
| | 103 | if ((!isset($cache_lastpostdate[$timezone])) OR (!$use_cache)) { |
|---|
| | 104 | switch(strtolower($timezone)) { |
|---|
| | 105 | case 'gmt': |
|---|
| | 106 | $lastpostdate = $wpdb->get_var("SELECT post_date FROM $tableposts WHERE post_date <= '$now' AND post_status = 'publish' ORDER BY post_date DESC LIMIT 1"); |
|---|
| | 107 | break; |
|---|
| | 108 | case 'blog': |
|---|
| | 109 | $lastpostdate = $wpdb->get_var("SELECT DATE_ADD(post_date, INTERVAL '$add_seconds_blog' SECOND) FROM $tableposts WHERE post_date <= '$now' AND post_status = 'publish' ORDER BY post_date DESC LIMIT 1"); |
|---|
| | 110 | break; |
|---|
| | 111 | case 'server': |
|---|
| | 112 | $lastpostdate = $wpdb->get_var("SELECT DATE_ADD(post_date, INTERVAL '$add_seconds_server' SECOND) FROM $tableposts WHERE post_date <= '$now' AND post_status = 'publish' ORDER BY post_date DESC LIMIT 1"); |
|---|
| | 113 | break; |
|---|
| | 114 | } |
|---|
| | 115 | $cache_lastpostdate[$timezone] = $lastpostdate; |
|---|
| | 116 | } else { |
|---|
| | 117 | $lastpostdate = $cache_lastpostdate[$timezone]; |
|---|
| 112 | | if ((!isset($cache_lastpostmodified)) OR (!$use_cache)) { |
|---|
| 113 | | $now = gmdate('Y-m-d H:i:s'); |
|---|
| 114 | | $lastpostmodified = $wpdb->get_var("SELECT post_modified FROM $tableposts WHERE post_modified <= '$now' AND post_status = 'publish' ORDER BY post_modified DESC LIMIT 1"); |
|---|
| 115 | | $cache_lastpostmodified = $lastpostmodified; |
|---|
| 116 | | } else { |
|---|
| 117 | | $lastpostmodified = $cache_lastpostmodified; |
|---|
| | 124 | $add_seconds_blog = get_settings('gmt_offset') * 3600; |
|---|
| | 125 | $add_seconds_server = date('Z'); |
|---|
| | 126 | $now = gmdate('Y-m-d H:i:s'); |
|---|
| | 127 | if ((!isset($cache_lastpostmodified[$timezone])) OR (!$use_cache)) { |
|---|
| | 128 | switch($timezone) { |
|---|
| | 129 | case 'gmt': |
|---|
| | 130 | $lastpostmodified = $wpdb->get_var("SELECT post_modified FROM $tableposts WHERE post_modified <= '$now' AND post_status = 'publish' ORDER BY post_modified DESC LIMIT 1"); |
|---|
| | 131 | break; |
|---|
| | 132 | case 'blog': |
|---|
| | 133 | $lastpostmodified = $wpdb->get_var("SELECT DATE_ADD(post_modified, INTERVAL '$add_seconds_blog' SECOND) FROM $tableposts WHERE post_modified <= '$now' AND post_status = 'publish' ORDER BY post_modified DESC LIMIT 1"); |
|---|
| | 134 | break; |
|---|
| | 135 | case 'server': |
|---|
| | 136 | $lastpostmodified = $wpdb->get_var("SELECT DATE_ADD(post_modified, INTERVAL '$add_seconds_server' SECOND) FROM $tableposts WHERE post_modified <= '$now' AND post_status = 'publish' ORDER BY post_modified DESC LIMIT 1"); |
|---|
| | 137 | break; |
|---|
| | 138 | } |
|---|
| | 139 | $lastpostdate = get_lastpostdate($timezone); |
|---|
| | 140 | if ($lastpostdate > $lastpostmodified) { |
|---|
| | 141 | $lastpostmodified = $lastpostdate; |
|---|
| | 142 | } |
|---|
| | 143 | $cache_lastpostmodified[$timezone] = $lastpostmodified; |
|---|
| | 144 | } else { |
|---|
| | 145 | $lastpostmodified = $cache_lastpostmodified[$timezone]; |
|---|