コード例 #1
0
function insertNodeAndLinks($pid, $x, $y, $isConnector, $link1, $link2, $link3)
{
    insertNode($isConnector, $pid, $x, $y);
    $nid1 = getMaxNid();
    if ($link1 != null) {
        insertLink($nid1, $link1);
    }
    if ($link2 != null) {
        insertLink($nid1, $link2);
    }
    if ($link3 != null) {
        insertLink($nid1, $link3);
    }
}
コード例 #2
0
ファイル: makeEntry.php プロジェクト: hbeyer/liddel-tool
function makeComment($text)
{
    include 'targetData.php';
    $result = '';
    if ($text != '') {
        foreach ($patternSystems as $key => $pattern) {
            $target = $bases[$key];
            $text = insertLink($text, $pattern, $target);
        }
        $result = '<span class="comment">' . $text . '</span>';
    }
    return $result;
}
コード例 #3
0
ファイル: addDomain.php プロジェクト: kasiCS744/PCMeshNetwork
<?php

include_once "../dao/getNode.php";
include_once "../dao/getLink.php";
$pName = "";
$nName = "";
$nid = getMaxNid() + 1;
$nid2 = getMaxNid() + 2;
$did = getMaxDid() + 1;
$pid = getMaxPatternID() + 1;
$domains = $_POST['domains'];
insertNode($nid, 2, -1, $pName, $nName, "yes", $did);
foreach ($domains as $key => $value) {
    insertLink($nid, $value);
}
insertNode($nid2, 1, $pid, $pName, $nName, "yes", $did);
insertLink($nid, $nid2);
echo "success";
コード例 #4
0
<?php

include_once "../dao/getNode.php";
include_once "../dao/getLink.php";
$pName = "";
$nName = "";
$nid = getMaxNid() + 1;
$did = $_POST['did'];
$pid = getMaxPatternID() + 1;
$domains = $_POST['nodes1'];
$domain = getDomainByDid($did)[0];
insertNode($nid, 1, $pid, $pName, $nName, "yes", $did);
foreach ($domains as $key => $value) {
    insertLink($nid, $value);
}
insertLink($domain, $nid);
echo "success";
コード例 #5
0
ファイル: addEdge.php プロジェクト: kasiCS744/PCMeshNetwork
}
$count = getLinkCountByNid($from);
if ($connector == 0 && $count < 3) {
    foreach ($to as $key => $value) {
        $linkCount = getLinkCountByNid($value);
        $receiver = getNodeConnector($value);
        if ($receiver != 0) {
            if (linkExists($from, $value) == 0) {
                insertLink($from, $value);
            } else {
                $result = "Link already exists";
            }
        }
        if ($receiver == 0 && $linkCount < 3) {
            if (linkExists($from, $value) == 0) {
                insertLink($from, $value);
            } else {
                $result = "Link already exists";
            }
        }
        if ($receiver == 0 && $linkCount == 3) {
            echo "222";
            $result = "failure";
        }
    }
} else {
    if ($connector == 0 && $count == 3) {
        echo "333";
        $result = "failure";
    }
}
コード例 #6
0
ファイル: projektneStrane.php プロジェクト: msehalic/zamger
function formProcess_links($option)
{
    $errorText = '';
    if (!check_csrf_token()) {
        zamgerlog("csrf token nije dobar", 3);
        zamgerlog2("csrf token nije dobar");
        return "Poslani podaci nisu ispravni. Vratite se nazad, ponovo popunite formu i kliknite na dugme Pošalji";
    }
    if (!in_array($option, array('add', 'edit'))) {
        $errorText = 'Doslo je do greske prilikom spasavanja podataka. Molimo kontaktirajte administratora.';
        return $errorText;
    }
    $id = intval($_REQUEST['id']);
    if ($option == 'edit' && $id <= 0) {
        $errorText = 'Doslo je do greske prilikom spasavanja podataka. Molimo kontaktirajte administratora.';
        zamgerlog("pokusao urediti nepostojeci link {$id}, projekat {$projekat} (pp{$predmet})", 3);
        zamgerlog2("pokusao urediti nepostojeci link", $id, $projekat);
        return $errorText;
    }
    //get variables
    $naziv = $_REQUEST['naziv'];
    $url = $_REQUEST['url'];
    $opis = $_REQUEST['opis'];
    $projekat = intval($_REQUEST['projekat']);
    $predmet = intval($_REQUEST['predmet']);
    global $userid;
    if (empty($naziv) || empty($url)) {
        $errorText = 'Unesite sva obavezna polja.';
        return $errorText;
    }
    $naziv = trim($naziv);
    $url = trim($url);
    $opis = trim($opis);
    $data = array('naziv' => $naziv, 'url' => $url, 'opis' => $opis, 'osoba' => $userid, 'projekat' => $projekat);
    if ($option == 'add') {
        if (!insertLink($data)) {
            $errorText = 'Doslo je do greske prilikom spasavanja podataka. Molimo kontaktirajte administratora.';
            return $errorText;
        }
    } else {
        if (!updateLink($data, $id)) {
            $errorText = 'Doslo je do greske prilikom spasavanja podataka. Molimo kontaktirajte administratora.';
            return $errorText;
        }
    }
    //option == edit
    return $errorText;
}
コード例 #7
0
ファイル: addNode.php プロジェクト: kasiCS744/PCMeshNetwork
        $flag = false;
    }
    foreach ($nodes0 as $key => $value) {
        if (getNodeByNid($value)['isConnector'] == 1) {
            $links = getLinksArrayByNid($value);
            foreach ($links as $key1 => $value1) {
                if (getNodeByNid($value1)['isConnector'] == 1 || getNodeByNid($value1)['isConnector'] == 2) {
                    unset($links[$key1]);
                }
            }
            if (count($links) >= 3) {
                echo "Can not connect to Node" . $value . " because it is already connected with three nodes\n";
                $flag = false;
                break;
            }
        } else {
            if (getLinkCountByNid($value) >= 3) {
                echo "Can not connect to Node" . $value . " because it is already connected with three nodes\n";
                $flag = false;
                break;
            }
        }
    }
    if ($flag) {
        foreach ($nodes0 as $key => $value) {
            insertLink($nid, $value);
        }
        insertNode($nid, 0, $pid, $pName, $nName, "yes", $did);
        echo "success";
    }
}
コード例 #8
0
ファイル: createlink.php プロジェクト: Kodagrux/URL-Shortener
$allowedCharsReversed = array("a" => 1, "A" => 2, "b" => 3, "B" => 4, "c" => 5, "C" => 6, "d" => 7, "D" => 8, "e" => 9, "E" => 10, "f" => 11, "F" => 12, "g" => 13, "G" => 14, "h" => 15, "H" => 16, "i" => 17, "I" => 18, "j" => 19, "J" => 20, "k" => 21, "K" => 22, "l" => 23, "L" => 24, "m" => 25, "M" => 26, "n" => 27, "N" => 28, "o" => 29, "O" => 30, "p" => 31, "P" => 32, "q" => 33, "Q" => 34, "r" => 35, "R" => 36, "s" => 37, "S" => 38, "t" => 39, "T" => 40, "u" => 41, "U" => 42, "v" => 43, "V" => 44, "w" => 45, "W" => 46, "x" => 47, "X" => 48, "y" => 49, "Y" => 50, "z" => 51, "Z" => 52, "0" => 53, "1" => 54, "2" => 55, "3" => 56, "4" => 57, "5" => 58, "6" => 59, "7" => 60, "8" => 61, "9" => 62, "\$" => 63, "-" => 64, "+" => 65, "!" => 66, "'" => 67, "(" => 68, ")" => 69);
require_once 'signinCheck.php';
if (!$signedin) {
    header("Location: http://arbr.se/signup/?misc=" . "<li>In order to create a link you need to sign up and then sign in</li>");
    exit;
} else {
    if ($link == null || $link == "") {
        //Empty link
        header("Location: http://arbr.se");
        exit;
    }
}
$link = fixLink($link);
if ($link != false) {
    //echo $IDuser;
    insertLink($link);
    //echo $link;
} else {
    //FAIL
    header("Location: http://arbr.se/?error=" . $link_orginal);
    //echo "Something wrong with your link: '" . $link . "'";
}
//FUNCTIIONS
function fixLink($link)
{
    if (preg_match("/^(https?:\\/\\/)?([\\da-zåäöA-ZÅÄÖ0-9\\.-]+)\\.([a-zA-Z0-9\\.]{1,6})([\\/\\w \\.-]*)*\\/?\$/", $link)) {
        //correct
        if (strstr($link, "https://") == false && strstr($link, "http://") == false) {
            //add http
            $link = "http://" . $link;
        }