function shtTime($dt = null) { return output_time($dt); }
/** * do changedata ajax save checking for legacy * @param str $url [description] * @param str $oldslug [description] */ function changedataAjaxSave($url, $oldslug) { if (isset($_POST['ajaxsave'])) { // ajax response wrapper, still using html parsing for now echo "<div>"; // if this was an autosave add autosave response if (isset($_POST['autosave']) && $_POST['autosave'] == '1') { echo '<div class="autosavenotify">' . sprintf(i18n_r('AUTOSAVE_NOTIFY'), output_time(date())) . '</div>'; } // setup error checking vars and include error checking for notifications $id = $url; $update = 'edit-success'; $ptype = 'edit'; if ($url !== $oldslug) { $oldid = $oldslug; } // if slug was changed set $oldid include 'template/error_checking.php'; // send new inputs for slug changes and new nonces echo '<input id="nonce" name="nonce" type="hidden" value="' . get_nonce("edit", "edit.php") . '" />'; echo '<input id="existing-url" name="existing-url" type="hidden" value="' . $url . '" />'; echo "</div>"; die; } }
/** * do changedata ajax save checking for legacy * @param str $url [description] * @param str $oldslug [description] */ function changedataAjaxSave($url, $oldslug) { global $draft, $pageIsNew; if (isset($_POST['ajaxsave'])) { // force redirects // // @todo we update the slug with the assigned slug, but there could be other things plugins need to do when adding a page, // that needs to be available to the page after, things like custom link menus, actions etc. // for now we redirect, so pagestack works since it is not implemented yet for ajax if ($pageIsNew) { redirect('edit.php?id=' . $url . '&nodraft&upd=edit-success&ptype=new', true); } // ajax response wrapper, still using html parsing for now echo "<div>"; // if this was an autosave add autosave response if (isset($_POST['autosave']) && $_POST['autosave'] == '1') { echo '<div class="autosavenotify">' . sprintf(i18n_r('AUTOSAVE_NOTIFY'), output_time(date())) . '</div>'; } // setup error checking vars and include error checking for notifications $id = $url; $update = 'edit-success'; $ptype = 'edit'; if ($url !== $oldslug) { $oldid = $oldslug; } // if slug was changed set $oldid $upddraft = $draft; include 'template/error_checking.php'; // send new inputs for slug changes and new nonces echo '<input id="nonce" name="nonce" type="hidden" value="' . get_nonce("edit", "edit.php") . '" />'; echo '<input id="existing-url" name="existing-url" type="hidden" value="' . $url . '" />'; echo '<input id="post-id" name="post-id" type="hidden" value="' . $url . '" />'; echo "</div>"; die; } }
function feed_parse($text) { date_default_timezone_set("GMT"); global $ad, $print_data_first, $db_insert, $udb, $insert_only_one, $check_content, $print_art_exists, $print_exists_id, $print_data_num, $picture_insert; $each_row_tmp = explode($this->_repeat_explode_text, $text); $each_row = $this->set_order($each_row_tmp); foreach ($each_row as $key => $each_text) { $input = "Y"; $each_text = $ad->get_latter($this->_repeat_start_text, $each_text); $storyid['content_id'] = $this->make_guid($each_text); $storyid['timestamp'] = time(); $storyid['ccode'] = $this->_info['name']; if ($check_content == "Y") { $is_contentid = $this->isdata_content_table($storyid['content_id']); } if ($is_contentid) { echo $storyid['content_id'] . " - Content exists.<br>"; } else { $this->_imgs_org = array(); $this->_imgs_sel = array(); $this->_imgs_ids = ""; //$data['timestamp'] = time(); $data['timestamp'] = $this->make_time($each_text); $data['title'] = $this->make_title($each_text); $data['body'] = $this->make_body($each_text); $data['summary'] = $this->make_summary($data['body'], $each_text); $data['reporter_name'] = $this->make_reporter($each_text); $data['source_id'] = $this->_info['source_id']; $data['keywords'] = $ad->makeslug($data['title']); $data['feed_id'] = $this->_feed_id; if ($this->_group_id) { $data['group_id'] = $this->_group_id; $data['allow'] = "Y"; } if (function_exists("get_category")) { $cate = get_category($each_text); } if (!$cate['maincat_id']) { $cate['maincat_id'] = $this->_info['maincat_id']; } $data['categories'] = $cate['maincat_id']; if (function_exists("get_specialcat")) { $data['specialcat'] = get_specialcat($each_text, $data); } if ($this->_themes) { $data['themes'] = $this->_themes; } if ($data['title']) { if ($print_data_first == "Y") { print_r($data); echo "Time:" . time_format("datetime_long", output_time($data['timestamp'])) . "<br>"; if ($image) { echo "Image: "; print_r($image); } exit; } if ($print_data_num > 0 && $print_data_num == $key) { echo "Data Number " . $key . "<br><br>"; print_r($data); echo "Time:" . time_format("datetime_long", output_time($data['timestamp'])) . "<br>"; if ($image) { echo "Image: "; print_r($image); } exit; } if ($check_content == "Y") { $is_articleid = $this->isdata_article_table($data['title']); } if ($is_articleid) { echo $data['title'] . " - Article exists.<Br>"; } elseif ($db_insert == "Y" && strlen($data['body']) > $this->_min_body_length) { if ($this->_input_from_days_ago && time() - $data['timestamp'] < $this->_input_from_days_ago * 60 * 60 * 24) { $input = "Y"; } else { $input = ""; } if ($input) { $this->get_article_table(); $pid = $udb->insert($this->_current_article_table, $data); $ad->update_table_info($pid); //article image if ($picture_insert != "N") { if (function_exists("remake_image")) { $body_new = remake_image($each_text, $data, $pid); } else { $body_new = $this->make_image($data['body'], $data, $pid); } if ($this->_imgs_ids) { $iadata['body'] = $body_new; $iadata['images'] = substr($this->_imgs_ids, 0, -1); $udb->update($this->_current_article_table, $iadata, "id='{$pid}'"); } } echo $pid . " / "; if ($this->_article_table == "ib_articles_draft") { $udb->insert($this->_info['content_table'], $storyid); } else { //search $this->search_index($pid, $data); $this->special_search_field($pid, $data); //indexes $udb->insert($this->_info['content_table'], $storyid); $this->input_index('categories', $data['categories'], $pid); $this->input_index('specialcat', $data['specialcat'], $pid); if ($data['themes']) { $this->input_index('themes', $data['themes'], $pid); } //make xml $data['id'] = $pid; //$ar->make_xml($data); //latest update $this->latest_update($pid, $data); } if ($insert_only_one == "Y") { exit; } } } } else { echo "There's no title"; } } } }