Location: PHPKode > projects > ProNuke. Postnuke To Oracle > postnuke/html/modules/Web_Links/wl-addlink.php
<?php
// File: $Id: wl-addlink.php,v 1.4 2001/12/08 02:28:44 nkame Exp $ $Name:  $
// ----------------------------------------------------------------------
// POST-NUKE Content Management System
// Copyright (C) 2001 by the Post-Nuke Development Team.
// http://www.postnuke.com/
// ----------------------------------------------------------------------
// Based on:
// PHP-NUKE Web Portal System - http://phpnuke.org/
// Thatware - http://thatware.org/
// ----------------------------------------------------------------------
// LICENSE
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License (GPL)
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// To read the license please visit http://www.gnu.org/copyleft/gpl.html
// ----------------------------------------------------------------------
// Original Author of file: Francisco Burzi
// Purpose of file:
// ----------------------------------------------------------------------
// 11-30-2001:ahumphr - created file as part of modularistation

/**
 * AddLink
 */
function AddLink() {
    global $user, $pntable, $dbconn, $links_anonaddlinklock, $ModName;
    global $modurl;
    include("header.php");
    $mainlink = 1;

    menu(1);

    echo "<br>";
    OpenTable();
    echo "<center><font class=\"pn-title\">"._ADDALINK."</font></center><br><br>";

    if (is_user($user) || $links_anonaddlinklock != 0) {
        echo "<font class=\"pn-normal\"><b>"._INSTRUCTIONS.":</b><br>"
        ."<strong><big>&middot;</big></strong> "._SUBMITONCE."<br>"
        ."<strong><big>&middot;</big></strong> "._POSTPENDING."<br>"
        ."<strong><big>&middot;</big></strong> "._USERANDIP."<br></font>"
        ."<form method=\"post\" action=\"${modurl}\">"
        ."<font class=\"pn-normal\">"
        .""._PAGETITLE.": <input type=\"text\" name=\"title\" size=\"50\" maxlength=\"100\"><br>"
        .""._PAGEURL.": <input type=\"text\" name=\"url\" size=\"50\" maxlength=\"100\" value=\"http://\"><br>";
        echo ""._CATEGORY.": <select name=\"cat\">";
        echo CatList(0, 0);
        echo "</select><br><br>"
            .""._LDESCRIPTION."<br><textarea name=\"description\" cols=\"60\" rows=\"5\"></textarea><br><br><br>"
            .""._YOURNAME.": <input type=\"text\" name=\"nname\" size=\"30\" maxlength=\"60\"><br>"
            .""._YOUREMAIL.": <input type=\"text\" name=\"email\" size=\"30\" maxlength=\"60\"><br><br>"
            ."<input type=\"hidden\" name=\"req\" value=\"Add\">"
            ."<input type=\"submit\" value=\""._ADDURL."\"> "._GOBACK."<br><br>"
            ."</font></form>";
    }else {
        echo "<font class=\"pn-normal\"><center>"._LINKSNOTUSER1."<br>"
        .""._LINKSNOTUSER2."<br><br>"
            .""._LINKSNOTUSER3."<br>"
            .""._LINKSNOTUSER4."<br>"
            .""._LINKSNOTUSER5."<br>"
            .""._LINKSNOTUSER6."<br>"
            .""._LINKSNOTUSER7."<br><br>"
            .""._LINKSNOTUSER8."</font>";
    }
    CloseTable();
    include("footer.php");
}

/**
 * Add
 */
function Add($title, $url, $nname, $cat, $description, $email) {
    global $user, $pntable, $dbconn, $ModName, $modurl;

    csrfcheck();

    $column = &$pntable['links_links_column'];

    $result = $dbconn->Execute("SELECT COUNT(*) FROM $pntable[links_links] WHERE $column[url]='$url'");
    list($numrows) = $result->fields;

    if ($numrows>0) {
    include("header.php");
    menu(1);
    echo "<br>";
    OpenTable();
    echo "<font class=\"pn-normal\"><center><b>"._LINKALREADYEXT."</b><br><br>"
        .""._GOBACK."</font>";
    CloseTable();
    include("footer.php");
    } else {
    if(is_user($user)) {
        $user2 = base64_decode($user);
        $cookie = explode(":", $user2);
        cookiedecode($user);
        $submitter = $cookie[1];
    }

// Check if Title exist
    if ($title=="") {
    include("header.php");
    menu(1);
    echo "<br>";
    OpenTable();
    echo "<font class=\"pn-normal\"><center><b>"._LINKNOTITLE."</b><br><br>"
        .""._GOBACK."</font>";
    CloseTable();
    include("footer.php");
}

// Check if URL exist
	$url = pn_validation_url($url);
    if ($url == -1) {
    include("header.php");
    menu(1);
    echo "<br>";
    OpenTable();
    echo "<center><font class=\"pn-normal\"><b>"._LINKNOURL."</b><br><br>"
        .""._GOBACK."</font>";
    CloseTable();
    include("footer.php");
    }

// Check if Description exist
    if ($description=="") {
    include("header.php");
    menu(1);
    echo "<br>";
    OpenTable();
    echo "<center><font class=\"pn-normal\"><b>"._LINKNODESC."</b><br><br>"
        .""._GOBACK."</font>";
    CloseTable();
    include("footer.php");
    }
    $title = stripslashes(FixQuotes($title));
    $url = stripslashes(FixQuotes($url));
    $description = stripslashes(FixQuotes($description));
    $nname = stripslashes(FixQuotes($nname));
    $email = stripslashes(FixQuotes($email));
    $column = &$pntable['links_newlink_column'];
// FTO : Add SEQ suffix to avoid conflict name with ORACLE
    $nextid = $dbconn->GenId("{$pntable['links_newlink']}_SEQ");
    $dbconn->Execute("INSERT INTO $pntable[links_newlink] ($column[lid], $column[cat_id], $column[title], $column[url], $column[description], $column[name], $column[email], $column[submitter]) VALUES ($nextid, '$cat', '$title', '$url', '$description', '$nname', '$email', '$submitter')");
    include("header.php");
    menu(1);
    echo "<br>";
    OpenTable();
    echo "<center><font class=\"pn-normal\"><b>"._LINKRECEIVED."</b><br>";
    if ($email != "") {
        echo _EMAILWHENADD;
    } else {
        echo _CHECKFORIT;
    }
    CloseTable();
        include("footer.php");
    }
}

?>
Return current item: ProNuke. Postnuke To Oracle