示例#1
0
function articleversionrestore($vid)
{
    global $dbcon;
    $get = $dbcon->Execute("select * from articles_version where vid = {$vid}") or die($dbcon->ErrorMsg());
    $id = $get->Fields("id");
    articleversion($id);
    $i = 0;
    foreach ($get->FetchRow() as $k => $v) {
        if ($i % 2) {
            $matchedpairs .= $k . " = '" . addslashes($v) . "',";
        }
        $i++;
    }
    $matchedpairs = substr($matchedpairs, 0, -1);
    $matchedpairs = preg_replace("/vid = '(\\d+)',/", " ", $matchedpairs);
    $sql = "UPDATE articles SET {$matchedpairs} where id  = {$id}";
    //	echo $sql;
    $update = $dbcon->Execute($sql) or die($dbcon->ErrorMsg());
}
示例#2
0
if ($_GET['restore']) {
    articleversionrestore($_GET['restore']);
    $org_id = $_GET['id'];
    ampredirect("article_edit.php?id={$org_id}");
}
if ($_POST['MM_update'] && $_POST['MM_recordId'] or $_POST['MM_insert'] or $_POST['MM_delete'] && $_POST['MM_recordId']) {
    //set non POST passed varablies
    $userlookup = AMPSystem_Lookup::instance('users');
    $article = trim($_POST['article']);
    $_POST['updatedby'] = array_search($_SERVER['REMOTE_USER'], $userlookup);
    if (isset($_POST['MM_insert'])) {
        $_POST['datecreated'] = date("y-n-j");
        $_POST['enteredby'] = $_POST['updatedby'];
    } else {
        if (isset($_POST['MM_update']) or isset($_POST['MM_delete'])) {
            articleversion($_POST['MM_recordId']);
        }
    }
    //upload picture
    $getimgset = $dbcon->Execute("SELECT thumb, optw, optl FROM sysvar where id =1") or die($dbcon->ErrorMsg());
    if ($_FILES['file']['name']) {
        $picture = upload_image('', $getimgset->Fields("optw"), $getimgset->Fields("optl"), $getimgset->Fields("thumb"));
    }
    $date = DateConvertIn($date);
    #$_POST['textfield'] =htmlspecialchars($_POST['textfield']);
    if ($_POST['mlink']) {
        $link = $_POST['mlink'];
        $linkuse = 1;
    }
    $MM_editColumn = "id";
    $MM_editTable = "articles";