Exemplo n.º 1
0
 /**
  * Inserts data into the biblio table
  * @param $data
  * @return int last insterted id if succesefull
  */
 function alreadyInDB($title, $author, $publication)
 {
     $biblioQ = new BiblioQuery();
     $biblioQ->connect();
     if (!$biblioQ->validateBiblio($title, $author, $publication)) {
         $sql = "select bibid from biblio where strcmp(title,'" . $title . "')=0";
         $qShowStatusResult = mysql_query($sql) or die(mysql_error());
         $row = mysql_fetch_assoc($qShowStatusResult);
         return $row["bibid"];
     }
     return 0;
 }
Exemplo n.º 2
0
} else {
    $postVars = $_POST;
    if ($_REQUEST['posted'] == 'media_change') {
        require_once "../shared/logincheck.php";
        showForm($postVars);
    } else {
        $restrictInDemo = true;
        require_once "../shared/logincheck.php";
        $biblio = postVarsToBiblio($postVars);
        $pageErrors = array();
        //     if (!$biblio->validateData()) {
        //       $pageErrors = array_merge($pageErrors, biblioToPageErrors($biblio));
        //     }
        $biblioQ = new BiblioQuery();
        $biblioQ->connect();
        if (!$biblioQ->validateBiblio($title, $author, $publication)) {
            $pageErrors["245a"] = $loc->getText("biblioError2");
        }
        $pageErrors = array_merge($pageErrors, customFieldErrors($biblio));
        if (!empty($pageErrors)) {
            showForm($postVars, $pageErrors);
        } else {
            $bibid = insertBiblio($biblio);
            $msg = $loc->getText("biblioNewSuccess");
            header("Location: ../shared/biblio_view.php?bibid=" . U($bibid) . "&msg=" . U($msg));
        }
    }
}
function postVarsToBiblio($post)
{
    require_once "../classes/Biblio.php";