Esempio n. 1
0
 function update_post_content()
 {
     $query = "SELECT * FROM posts WHERE posts_permalink='" . $this->permalink . "' LIMIT 1;";
     $result = mysql_query($query);
     // This URL doesn't exist, so we'll make a new row.
     if (!mysql_num_rows($result)) {
         debug("[update_post_content] Could not find this row in the posts table.");
         $escaped_content = str_replace("'", "\\'", $this->content);
         $this->site_id = find_parent_site($this->permalink);
         $r_time = new RousseauDate(time());
         $this->timestamp = $r_time->print_sql_time();
         $create_query = "INSERT INTO posts (posts_content,posts_site_id," . "posts_timestamp,posts_permalink,posts_xid," . "posts_blog_xid, posts_fb_id) " . "VALUES (" . "'" . $escaped_content . "'," . $this->site_id . "," . "'" . $this->timestamp . "'," . "'" . $this->permalink . "'," . "'" . $this->xid . "'," . "'" . $this->blog_xid . "'," . "'" . $this->fb_id . "'" . ");";
         debug("[update_post_content] Insert query is {$create_query}");
         $result = mysql_query($create_query);
     } else {
         $this->id = mysql_result($result, 0, "posts_id");
         $this->site_id = mysql_result($result, 0, "posts_site_id");
         $this->fb_id = mysql_result($result, 0, "posts_fb_id");
         $content = mysql_result($result, 0, "posts_content");
         // if the text has changed, update the db.
         if (strlen($content) != strlen($this->content)) {
             $escaped_content = str_replace("'", "\\'", $this->content);
             $query = "UPDATE posts SET posts_content ='" . $escaped_content . "' WHERE posts_id=" . $this->id . ";";
             $result = mysql_query($query);
         }
     }
 }
Esempio n. 2
0
<?php

require_once 'rousseau-includes/rousseau-utilities.php';
$right_now = time();
$r_date = new RousseauDate($right_now);
echo "Now is: " . $r_date->print_readable_time();
echo "SQL-readable now is: " . $r_date->print_sql_time();