}
// build publish_date
-$publish_month = get_input('publish_month');
-$publish_day = get_input('publish_day');
-$publish_year = get_input('publish_year');
-$publish_hour = get_input('publish_hour');
-$publish_minute = get_input('publish_minute');
-$datetime = "$publish_year-$publish_month-$publish_day $publish_hour:$publish_minute:00";
-$values['publish_date'] = date('U', strtotime($datetime));
+//$publish_month = get_input('publish_month');
+//$publish_day = get_input('publish_day');
+//$publish_year = get_input('publish_year');
+//$publish_hour = get_input('publish_hour');
+//$publish_minute = get_input('publish_minute');
+//$datetime = "$publish_year-$publish_month-$publish_day $publish_hour:$publish_minute:00";
+//$values['publish_date'] = date('U', strtotime($datetime));
+
+// setting publish_date to now until the problems with locale dates can be resolved.
+$values['publish_date'] = time();
// assign values to the entity, stopping on error.
if (!$error) {
if (!(isadminloggedin() || (isloggedin() && $owner_guid == $loggedin_userid))) {
$options['metadata_name_value_pairs'] = array(
array('name' => 'status', 'value' => 'published'),
- array('name' => 'publish_date', 'operand' => '<', 'value' => time())
+ //array('name' => 'publish_date', 'operand' => '<', 'value' => time())
);
}
public function save() {
if (parent::save()) {
global $CONFIG;
- $published = $this->publish_date;
+
+ // try to grab the publish date, but default to now.
+ foreach (array('publish_date', 'time_created') as $field) {
+ if (isset($this->$field) && $this->field) {
+ $published = $this->field;
+ break;
+ }
+ }
+ if (!$published) {
+ $published = time();
+ }
$sql = "UPDATE {$CONFIG->dbprefix}entities SET time_created = '$published', time_updated = '$published' WHERE guid = '{$this->getGUID()}'";
return update_data($sql);
}