function updateContent($content_id, $vpath)
 {
     $db =& Database::getInstance();
     $content_id = intval($content_id);
     $file_info = $this->getFileInfo($vpath);
     // check the file is newer than the contents
     $sql = "SELECT modified_time FROM " . $db->prefix($this->mydirname . "_contents") . " WHERE content_id={$content_id}";
     list($modified_time) = $db->fetchRow($db->query($sql));
     if ($modified_time < $file_info['mtime']) {
         // make backup
         require_once dirname(dirname(__FILE__)) . '/include/transact_functions.php';
         pico_transact_backupcontent($this->mydirname, $content_id);
         // update the content
         $set4subject = $file_info['subject'] ? "`subject`='" . mysql_real_escape_string($file_info['subject']) . "'," : '';
         $sql = "UPDATE " . $db->prefix($this->mydirname . "_contents") . " SET {$set4subject} `modified_time`={$file_info['mtime']},body_cached='',for_search='',`last_cached_time`=0,modifier_uid=0,modifier_ip='' WHERE content_id={$content_id}";
         $db->queryF($sql);
         return $db->getAffectedRows();
     }
     return 0;
 }
function pico_transact_copyfromwaitingcontent($mydirname, $content_id)
{
    global $xoopsUser;
    $db =& Database::getInstance();
    // backup the content, first
    pico_transact_backupcontent($mydirname, $content_id);
    $uid = is_object($xoopsUser) ? $xoopsUser->getVar('uid') : 0;
    if (!$db->query("UPDATE " . $db->prefix($mydirname . "_contents") . " SET body=body_waiting, subject=subject_waiting, htmlheader=htmlheader_waiting, visible=1, approval=1 WHERE content_id={$content_id}")) {
        die(_MD_PICO_ERR_SQL . __LINE__ . __FUNCTION__);
    }
    if (!$db->query("UPDATE " . $db->prefix($mydirname . "_contents") . " SET body_waiting='',subject_waiting='',htmlheader_waiting='' ,body_cached='',for_search='' WHERE content_id={$content_id}")) {
        die(_MD_PICO_ERR_SQL . __LINE__ . __FUNCTION__);
    }
    // /*,`modified_time`=UNIX_TIMESTAMP(),modifier_uid='$uid',modifier_ip='".mysql_real_escape_string(@$_SERVER['REMOTE_ADDR'])."'*/
    return $content_id;
}