Exemplo n.º 1
0
function license_new($nom, $term)
{
    try {
        sql_do('INSERT INTO ' . DB_PREF . '_licenses (name_lic,terms) VALUES (\'' . str($nom) . '\',\'' . str($term) . '\')');
    } catch (DatabaseException $e) {
        return 0;
    }
    return sql_last_id();
}
Exemplo n.º 2
0
function language_new($nom)
{
    try {
        sql_do('INSERT INTO ' . DB_PREF . '_languages (name_lang) VALUES (\'' . str($nom) . '\')');
    } catch (DatabaseException $e) {
        return 0;
    }
    return sql_last_id();
}
Exemplo n.º 3
0
function platform_new($nom)
{
    try {
        $result = sql_do('INSERT INTO ' . DB_PREF . '_platforms (name_pf) VALUES (\'' . str($nom) . '\')');
    } catch (DatabaseException $e) {
        return 0;
    }
    return sql_last_id();
}
Exemplo n.º 4
0
function release_new($id_branch, $name_rel, $status, $changes, $download, $valid_rel)
{
    try {
        $result = sql_do('INSERT INTO ' . DB_PREF . '_releases (name_rel,date_rel,status,nb_projs,changes,download,valid_rel) VALUES (\'' . str($name_rel) . '\',\'' . date('Y-m-d H:i:s') . '\',\'' . int($status) . '\',\'' . int($nb_projs) . '\',\'' . str($changes) . '\',\'' . str($download) . '\',\'' . (bool) int($valid_rel) . '\')');
    } catch (DatabaseException $e) {
        return 0;
    }
    return sql_last_id();
}
Exemplo n.º 5
0
     }
     $message = aff_code($message);
     $message = str_replace("\n", "<br />", $message);
     if ($allow_bbcode) {
         $message = smile($message);
     }
     $message = make_clickable($message);
     $message = removeHack($message);
     $image_subject = '';
     $message = addslashes($message);
     $time = date("Y-m-d H:i:s", time() + $gmt * 3600);
     $sql = "INSERT INTO " . $NPDS_Prefix . "posts (post_idH, topic_id, image, forum_id, poster_id, post_text, post_time, poster_ip, poster_dns) VALUES ('0', '{$topic}', '{$image_subject}', '{$forum}', '" . $userdata['uid'] . "', '{$message}', '{$time}', '{$poster_ip}', '{$hostname}')";
     if (!($result = sql_query($sql))) {
         forumerror('0020');
     } else {
         $IdPost = sql_last_id();
     }
     $sql = "UPDATE " . $NPDS_Prefix . "users_status SET posts=posts+1 WHERE (uid = '" . $userdata['uid'] . "')";
     $result = sql_query($sql);
     if (!$result) {
         forumerror('0029');
     }
     // ordre de mise à jour d'un champ externe ?
     if ($comments_req_add != "") {
         sql_query("UPDATE " . $NPDS_Prefix . $comments_req_add);
     }
     redirect_url("{$url_ret}");
 } else {
     echo '<p class="text-xs-center">' . translate("You must type a message to post.") . '<br /><br />';
     echo "[ <a href=\"javascript:history.go(-1)\" class=\"noir\">" . translate("Go Back") . "</a> ]</p>";
 }
Exemplo n.º 6
0
function insertAttachment($apli, $IdPost, $IdTopic, $IdForum, $name, $path, $inline = "A", $size = 0, $type = "")
{
    global $upload_table, $visible_forum;
    $size = empty($size) ? filesize($path) : $size;
    $type = empty($type) ? "application/octet-stream" : $type;
    $stamp = time();
    $sql = "INSERT INTO {$upload_table} VALUES ('', '{$IdPost}', '{$IdTopic}','{$IdForum}', '{$stamp}', '{$name}', '{$type}', '{$size}', '{$path}', '1', '{$apli}', '0', '{$visible_forum}')";
    $ret = sql_query($sql);
    if (!$ret) {
        return -1;
    }
    return sql_last_id();
}
Exemplo n.º 7
0
function user_new_pseudo($name, $email)
{
    $result = sql_do('SELECT id_user FROM ' . DB_PREF . '_users WHERE mail=\'' . $email . '\'');
    if ($result->numRows()) {
        append_error("This email address is already registered. Please choose another.");
        return 0;
    }
    try {
        $result = sql_do('INSERT INTO ' . DB_PREF . '_users (name_user,mail,date_user,valid_user) VALUES (\'' . str($name) . '\',\'' . str($email) . '\',\'' . date('Y-m-d H:i:s') . '\',0)');
    } catch (DatabaseException $e) {
        //append_error("Unknown error executing [$sql].");
        return 0;
    }
    return sql_last_id();
}
Exemplo n.º 8
0
function project_new($name_prj, $shortname, $description, $homepage)
{
    $result = sql_do('SELECT id_prj FROM ' . DB_PREF . '_projects WHERE shortname=\'' . str($shortname) . '\'');
    if ($result->numRows()) {
        append_error("Shortname '{$shortname}' already taken.");
        return 0;
    }
    try {
        $result = sql_do('INSERT INTO ' . DB_PREF . '_projects (name_prj,shortname,desc_prj,url_prj,date_prj,valid_prj) VALUES (\'' . str($name_prj) . '\',\'' . str($shortname) . '\',\'' . str($description) . '\',\'' . str($homepage) . '\',\'' . date('Y-m-d H:i:s') . '\',0)');
    } catch (DatabaseException $e) {
        return 0;
    }
    return sql_last_id();
}
Exemplo n.º 9
0
function AddNewGal($galcat, $newgal, $acces)
{
    global $ModPath, $ModStart, $gmt, $NPDS_Prefix, $ThisRedo;
    if (!empty($newgal)) {
        $newgal = addslashes(removeHack($newgal));
        if (sql_num_rows(sql_query("SELECT id FROM " . $NPDS_Prefix . "tdgal_gal WHERE cid='{$galcat}' AND nom='{$newgal}'"))) {
            echo '<p class="font-weight-bold text-danger">' . gal_trans("Cette galerie existe déjà") . '</p>';
        } else {
            $regdate = time() + $gmt * 3600;
            if ($add = sql_query("INSERT INTO " . $NPDS_Prefix . "tdgal_gal VALUES ('','{$galcat}','{$newgal}','{$regdate}','{$acces}')")) {
                $new_gal_id = sql_last_id();
                echo '<h4><i class="fa fa-plus"></i> ' . gal_trans("Ajouter des photos à cette nouvelle galerie") . '</h4>';
                echo '<form enctype="multipart/form-data" method="post" action="' . $ThisFile . '" name="FormImgs">';
                echo '<input type="hidden" name="subop" value="addimgs">';
                echo '<input type="hidden" name="imggal" value="' . $new_gal_id . '">';
                echo '
      <div class="form-group row">
      <label class="col-sm-2 form-control-label">' . gal_trans("Image 1") . '</label>
      <div class="col-sm-6">
      <input type="file" class="form-control-file" name="newcard1" id="">
      <small class="text-muted">' . gal_trans("Sélectionner votre image") . '</small>
      <input type="text" class="form-control" id=""  name="newdesc1" placeholder="' . gal_trans("Description") . '">
      </div></div>';
                echo '
      <div class="form-group row">
      <label class="col-sm-2 form-control-label">' . gal_trans("Image 2") . '</label>
      <div class="col-sm-6">
      <input type="file" class="form-control-file" name="newcard2" id="">
      <small class="text-muted">' . gal_trans("Sélectionner votre image") . '</small>
      <input type="text" class="form-control" id=""  name="newdesc2" placeholder="' . gal_trans("Description") . '">
      </div></div>';
                echo '
      <div class="form-group row">
      <label class="col-sm-2 form-control-label">' . gal_trans("Image 3") . '</label>
      <div class="col-sm-6">
      <input type="file" class="form-control-file" name="newcard3" id="">
      <small class="text-muted">' . gal_trans("Sélectionner votre image") . '</small>
      <input type="text" class="form-control" id=""  name="newdesc3" placeholder="' . gal_trans("Description") . '">
      </div></div>';
                echo '
      <div class="form-group row">
      <label class="col-sm-2 form-control-label">' . gal_trans("Image 4") . '</label>
      <div class="col-sm-6">
      <input type="file" class="form-control-file" name="newcard4" id="">
      <small class="text-muted">' . gal_trans("Sélectionner votre image") . '</small>
      <input type="text" class="form-control" id=""  name="newdesc4" placeholder="' . gal_trans("Description") . '">
      </div></div>';
                echo '
      <div class="form-group row">
      <label class="col-sm-2 form-control-label">' . gal_trans("Image 5") . '</label>
      <div class="col-sm-6">
      <input type="file" class="form-control-file" name="newcard5" id="">
      <small class="text-muted">' . gal_trans("Sélectionner votre image") . '</small>
      <input type="text" class="form-control" id=""  name="newdesc5" placeholder="' . gal_trans("Description") . '">
      </div></div>';
                echo '   
      <div class="form-group row">
      <span class="col-sm-2 form-control-label"></span>
      <div class="col-sm-10">
      <input class="btn btn-primary" type="submit" value="' . gal_trans("Ajouter") . '">
      </div></div>';
                echo '</form>';
            } else {
                echo '<p class="lead text-danger">' . gal_trans("Erreur lors de l'ajout de la galerie") . '</p>';
            }
        }
    } else {
        redirect_url($ThisRedo . "&subop=formcregal");
    }
}
Exemplo n.º 10
0
function submitStory($subject, $story, $bodytext, $topic, $date_debval, $date_finval, $epur, $asb_question, $asb_reponse)
{
    global $user, $EditedMessage, $anonymous, $notify, $NPDS_Prefix;
    if ($user) {
        global $cookie;
        $uid = $cookie[0];
        $name = $cookie[1];
    } else {
        $uid = -1;
        $name = $anonymous;
        //anti_spambot
        if (!R_spambot($asb_question, $asb_reponse, "")) {
            Ecr_Log("security", "Submit Anti-Spam : name=" . $yname . " / mail=" . $ymail, "");
            redirect_url("index.php");
            die;
        }
    }
    $subject = removeHack(stripslashes(FixQuotes(str_replace("\"", "&quot;", strip_tags($subject)))));
    $story = removeHack(stripslashes(FixQuotes($story)));
    $bodytext = removeHack(stripslashes(FixQuotes($bodytext)));
    $result = sql_query("INSERT INTO " . $NPDS_Prefix . "queue VALUES (NULL, '{$uid}', '{$name}', '{$subject}', '{$story}', '{$bodytext}', now(), '{$topic}','{$date_debval}','{$date_finval}','{$epur}')");
    if (sql_last_id()) {
        if ($notify) {
            global $notify_email, $notify_subject, $notify_message, $notify_from;
            send_email($notify_email, $notify_subject, $notify_message, $notify_from, false, "text");
        }
        include 'header.php';
        echo '<h2>' . translate("Submit News") . '</h2>';
        echo '<p class="lead text-info">' . translate("Thanks for your submission.") . '</p>';
        include 'footer.php';
    } else {
        include 'header.php';
        echo sql_error();
        include 'footer.php';
    }
}
Exemplo n.º 11
0
function branch_new($name, $id_prj)
{
    try {
        sql_do('INSERT INTO ' . DB_PREF . '_branches (name_branch,id_prj,date_branch) VALUES (\'' . str($name) . '\',\'' . int($id_prj) . '\',\'' . date('Y-m-d H:i:s') . '\')');
    } catch (DatabaseException $e) {
        return 0;
    }
    return sql_last_id();
}
Exemplo n.º 12
0
function category_new($index, $nom)
{
    # FIXME: increase the actual limit of 10 children by category
    /* recuperation des index existants et correspondants */
    $result = sql_do('SELECT index FROM ' . DB_PREF . '_categories WHERE index LIKE \'' . str($index) . '_\' ORDER BY index');
    for ($i = 0; $i < 10; $i++) {
        $row = $result->fetchRow();
        if ($row[0] != $index . $i) {
            break;
        }
    }
    if ($i == 10) {
        return -1;
    }
    try {
        sql_do('INSERT INTO ' . DB_PREF . '_categories (index,name_cat) VALUES (\'' . str($index) . int($i) . '\',\'' . str($nom) . '\')');
    } catch (DatabaseException $e) {
        return 0;
    }
    return sql_last_id();
}