Beispiel #1
0
function getAlbumId($email, $UPLOAD_ALBUM_NAME = "personals")
{
    $UPLOAD_ALBUM_NAME = "personals";
    $q = "select * from albums where user_email = '{$email}' and album_name = '{$UPLOAD_ALBUM_NAME}'";
    $r = selectData($q);
    if (is_string($r)) {
        return 0;
    } else {
        if (is_array($r)) {
            if (count($r) > 0) {
                foreach ($r as $a) {
                    $album = $a;
                }
                $album_id = $album['id'];
                return $album_id;
            } else {
                $dt = date("Y-m-d G:i:s");
                $table = "albums";
                $id = getNewId("{$table}");
                $albumimg_id = 0;
                $fields = array("id", "album_name", "user_email", "date_pub", "privacy", "admin_perm", "remarks", "albumimg_id", "view_count", "rating");
                $values = array("{$id}", "{$UPLOAD_ALBUM_NAME}", "{$email}", "{$dt}", 1, 1, "", "{$albumimg_id}", 0, 0);
                $rs = insertData($table, $fields, $values);
                if ($rs == true) {
                    return $id;
                } else {
                    return 0;
                }
            }
        } else {
            return 0;
        }
    }
}
Beispiel #2
0
function uploadimageToGallery($fieldName, $folder, $width, $height)
{
    $realName = str_replace(" ", "_", $_FILES[$fieldName]['name']);
    while (file_exists($folder . "/" . $realName)) {
        $fileNameParts = explode(".", "{$realName}");
        $fileExtension = end($fileNameParts);
        // part behind last dot
        $ext = $fileExtension . "";
        $realName = $fileNameParts[0] . "1." . $ext;
    }
    if ($width && $height) {
        $uploadfile = $folder . "/cash/" . $realName;
        if (move_uploaded_file($_FILES[$fieldName]['tmp_name'], $uploadfile)) {
            $small = resizeToFile($folder . "/cash/" . $realName, $width, $height, $folder . "/" . $realName);
        }
    } else {
        $uploadfile = $folder . "/" . $realName;
        if (move_uploaded_file($_FILES[$fieldName]['tmp_name'], $uploadfile)) {
            $small = resizeToFile($folder . "/cash/" . $realName, $width, $height, $folder . "/" . $realName);
        }
    }
    $newPhotoId = getNewId("galleries_photos", "id");
    $sql = "INSERT INTO `galleries_photos` ( `id` , `photo` , `description` , `thumb` )\n\t\t\t\t\t\tVALUES ('{$newPhotoId}' , '{$realName}', '', '{$small}');";
    if (mysql_query($sql)) {
        $newGalId = getNewId("galleries_galleries", "id");
        $sql = "INSERT INTO `galleries_galleries` ( `id` , `gallery_name` , `description` , `main_photo` , `photos` )\n\t\t\t\t\t\tVALUES ('{$newGalId}' , '', NULL , '{$newPhotoId}' , '{$newPhotoId}');";
        if (mysql_query($sql)) {
            return $newGalId;
        } else {
            return false;
        }
    } else {
        return false;
    }
}
Beispiel #3
0
     while ($k <= $brATova) {
         if ($json["test_specifications"][$k - 1]["id"] == $id) {
             $i = $k;
             break;
         }
         $k++;
     }
     if ($i == 0) {
         ispisGreske("Nije pronađen autotest sa id-em: {$id}");
         zavrsi();
     }
     $i--;
     // Slijedi izbacivanje AT-a iz json-a, nakon toga modifikovati $data
     for ($k = $i; $k < $brATova - 1; $k++) {
         $json["test_specifications"][$k] = $json["test_specifications"][$k + 1];
         $json["test_specifications"][$k]["id"] = getNewId();
     }
     $brATova--;
     array_splice($json["test_specifications"], $brATova);
     // Izbacimo zadnji element
     saveJson($fileData, $json);
     print "Brisanje izvršeno!";
     admin_log("delete single at, file {$fileData} (mod={$mod})");
 } else {
     if ($mod == 4) {
         // Dodavanje jednog autotesta
         $newATjson = json_decode(getDefAT(), true);
         $json = json_decode(file_get_contents($fileData), true);
         $brATova = count($json["test_specifications"]);
         $json["test_specifications"][$brATova] = $newATjson;
         saveJson($fileData, $json);
Beispiel #4
0
 if (count($Value) == 5) {
     $finalPath = array();
     foreach (explode("\n", trim($Value[4])) as $path) {
         $path = trim($path);
         if ($path != "" && is_dir($path)) {
             if (substr($path, -1) != "/") {
                 $path = $path . "/";
             }
         }
         array_push($finalPath, $path);
     }
     // now we check the existance of each path.
     for ($i = 0; $i < count($finalPath); $i++) {
         if (file_exists(trim($finalPath[$i]))) {
             // first let's check that this sample has not yet been inserted.
             $externalSampleId = getNewId();
             // get sample name from directory
             $output = explode("/", $finalPath[$i]);
             if (is_dir($finalPath[$i])) {
                 $sampleName = $output[count($output) - 2];
             } else {
                 $sampleName = $output[count($output) - 2];
             }
             $query = "INSERT INTO sample (id, sample_name, seq_method, reads_length, reads_mode, ref_genome, raw_data_path, user_id, source, raw_data_path_date) SELECT 'X" . $externalSampleId . "', '" . $sampleName . "','" . $seq_method . "','" . $reads_length . "','" . $reads_mode . "','" . $ref_genome . "','" . $finalPath[$i] . "', user_id, 2, '" . date('Y-m-d H:i:s') . "' FROM users WHERE user_name = '" . $_SESSION["hf_user_name"] . "';";
             $stmt = mysqli_prepare($con, $query);
             if ($stmt) {
                 mysqli_stmt_execute($stmt);
                 mysqli_stmt_store_result($stmt);
                 mysqli_stmt_close($stmt);
                 echo "<span>Sample: " . $sampleName . " has been put in the database with ID X" . $externalSampleId . ".</span><br />\n";
             }
Beispiel #5
0
 $widget_type = $_SESSION[$wr_key]['widget_type'];
 $widget_asset = $_SESSION[$wr_key]['widget_asset'];
 $widget_title = $_SESSION[$wr_key]['widget_title'];
 $widget_help = $_SESSION[$wr_key]['widget_help'];
 $widget_refresh = $_SESSION[$wr_key]['widget_refresh'];
 $widget_height = $_SESSION[$wr_key]['widget_height'];
 $widget_url = $_SESSION[$wr_key]['widget_url'];
 $owner = $_SESSION[$wr_key]['owner'];
 $id_content = $_SESSION[$wr_key]['id_content'];
 $widget_media = $_SESSION[$wr_key]['widget_media'];
 $widget_params = $_SESSION[$wr_key]['widget_params'];
 if ($id_content != "") {
     $column = getColumn($dbconn, $id_content);
     $order = getOrder($dbconn, $id_content);
 } else {
     $id_content = getNewId($dbconn, $tab);
     $column = 0;
     $order = 0;
     $error = reorder_widgets($dbconn, $tab);
 }
 ossim_valid($column, OSS_DIGIT, 'illegal:' . _("Widget Column"));
 ossim_valid($order, OSS_DIGIT, 'illegal:' . _("Widget Row"));
 if (ossim_error()) {
     $info_error[] = ossim_get_error();
     ossim_clean_error();
     $error = true;
 }
 if ($widget_type == 'report' && !$pro) {
     $info_error[] = _('Report section is only available in professional version');
     $error = true;
 }
Beispiel #6
0
function getDefDecodedJson()
{
    // Poziva se u slucaju da ne postoji autotest file + treba ga kreirati
    $def_name = getVar("def_name");
    $def_language = getVar("def_language");
    $def_required_compiler = getVar("def_required_compiler");
    $def_preferred_compiler = getVar("def_preferred_compiler");
    $def_compiler_features = getVar("def_compiler_features");
    $def_compiler_options = getVar("def_compiler_options");
    $def_compiler_options_debug = getVar("def_compiler_options_debug");
    $def_compile = getBoolVar("def_compile");
    $def_run = getBoolVar("def_run");
    $def_test = getBoolVar("def_test");
    $def_debug = getBoolVar("def_debug");
    $def_profile = getBoolVar("def_profile");
    $json = '
			{  
			    "id":' . getNewId() . ',
			    "name":"' . $def_name . '",
			    "language":"' . $def_language . '",
			    "required_compiler":"' . $def_required_compiler . '",
			    "preferred_compiler":"' . $def_preferred_compiler . '",
			    "compiler_features":[  
			    	' . $def_compiler_features . '
			    ],
			    "compiler_options":"' . $def_compiler_options . '",
			    "compiler_options_debug":"' . $def_compiler_options_debug . '",
			    "compile":"' . $def_compile . '",
			    "run":"' . $def_run . '",
			    "test":"' . $def_test . '",
			    "debug":"' . $def_debug . '",
			    "profile":"' . $def_profile . '",
			    "test_specifications":[ ' . getDefAT() . ' ]
		    }
		';
    return json_decode($json, true);
}
Beispiel #7
0
$stmt = mysqli_prepare($con, $QueryMerge);
if ($stmt) {
    mysqli_stmt_execute($stmt);
    mysqli_stmt_store_result($stmt);
    mysqli_stmt_close($stmt);
}
$MergeData = array("sample" => array());
foreach ($_POST as $key => $value) {
    error_log("post {$key} => {$value}");
    if (substr($key, 0, 6) == 'sample') {
        $sample = $value;
        error_log("add sample {$sample}");
        array_push($MergeData["sample"], $sample);
    }
}
$mergePrimaryId = getNewId();
$QueryPrimary = "INSERT INTO primary_analysis ( id, sample_id, options_id, status, user_id, origin, description ) VALUES ( " . $mergePrimaryId . ", '" . $mergeSampleId . "', " . $optID . ", 'scheduled', '" . $user_id . "', 1, '" . mysqli_real_escape_string($con, $_POST['description']) . "'  );";
$stmt = mysqli_prepare($con, $QueryPrimary);
if ($stmt) {
    mysqli_stmt_execute($stmt);
    mysqli_stmt_store_result($stmt);
    mysqli_stmt_close($stmt);
}
foreach ($MergeData["sample"] as $key => $value) {
    $MergeSample = $value;
    $queryMerge2Sample = "INSERT INTO merged_primary (result_primary_id, source_primary_id) VALUES ('" . $mergePrimaryId . "','" . $MergeSample . "');";
    $stmtMerge2Sample = mysqli_prepare($con, $queryMerge2Sample);
    if ($stmtMerge2Sample) {
        mysqli_stmt_execute($stmtMerge2Sample);
        mysqli_stmt_store_result($stmtMerge2Sample);
        mysqli_stmt_close($stmtMerge2Sample);
Beispiel #8
0
$username = "******";
$password = "******";
$dbname = "kaiseisha";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
}
$sql = "SELECT * FROM jos_publications_titles";
$result = $conn->query($sql);
echo "<pre>";
if ($result->num_rows > 0) {
    // output data of each row
    while ($row = $result->fetch_assoc()) {
        var_dump(getNewId($row["illustrator_id"], $row["illustrator2_id"]));
    }
} else {
    echo "0 results";
}
echo "</pre>";
$conn->close();
function getSlug($str)
{
    $str = str_replace(' ', '_', $str);
    return strtolower($str);
}
function getCountryId($str)
{
    if ($str) {
        $str = trim($str, '|');
Beispiel #9
0
$islogin = false;
if (isset($_SESSION['login']) == true && isset($_SESSION)) {
    $l = $_SESSION['login'];
    $islogin = true;
    $email = $l->getEmail();
    $utype = $l->utype;
}
$al->tp->assign('islogin', $islogin);
$al->tp->assign('email', $email);
if ($utype != 1) {
    Errors::report("You do not have permission to view this page.");
    return;
}
extract($_POST);
if ($action == "add") {
    $id = getNewId("articles", $al->db);
    if ($id == false) {
        return;
    }
    $fieldinfo = getFieldInfo('articles', $al->db);
    if (is_string($fieldinfo)) {
        $rep .= $fieldinfo;
    }
    if ($fieldinfo === false) {
        return;
    }
    $i = 0;
    foreach ($fieldinfo as $f) {
        if ($i > 0) {
            $q .= " or ";
        }
Beispiel #10
0
 $checkQuery = "SELECT ref_genome FROM sample WHERE id= '" . $sample . "';";
 $res = mysqli_query($con, $checkQuery);
 while ($line = mysqli_fetch_assoc($res)) {
     $refgenome = $line["ref_genome"];
 }
 // echo $refgenome;
 $checkQuery = "SELECT id FROM primary_analysis WHERE sample_id = '" . $sample . "' and options_id = " . $val_option . ";";
 //echo $checkQuery;
 $res = mysqli_query($con, $checkQuery);
 $VALUEprimary_analysis = 0;
 while ($line = mysqli_fetch_assoc($res)) {
     $VALUEprimary_analysis = $line["id"];
 }
 // echo $VALUEprimary_analysis;
 if ($VALUEprimary_analysis == 0) {
     $primaryId = getNewId();
     $querySample = "INSERT INTO primary_analysis (id, sample_id, options_id, status, user_id, origin, description) SELECT " . $primaryId . ", id," . $val_option . ", 'scheduled', '" . $user_id . "', source, '" . mysqli_real_escape_string($con, $description) . "' FROM sample WHERE id = '" . $sample . "';";
     error_log($querySample);
     $stmt = mysqli_prepare($con, $querySample);
     if ($stmt) {
         mysqli_stmt_execute($stmt);
         mysqli_stmt_store_result($stmt);
         mysqli_stmt_close($stmt);
         array_push($jobs, "primary\t" . $primaryId);
         $messageYes .= "Primary analysis for sample " . $sample . " has been correctly put in the queue with ID " . $primaryId . ".";
     } else {
         $messageNo .= "SAMPLE " . $sample . " has NOT been put in the queue";
     }
 } else {
     $messageNo .= "SAMPLE " . $sample . " has been already analyzed with the options provided. Check the jobs in the queue or the completed ones.";
 }
Beispiel #11
0
$islogin = false;
if (isset($_SESSION['login']) == true && isset($_SESSION)) {
    $l = $_SESSION['login'];
    $islogin = true;
    $email = $l->getEmail();
    $utype = $l->utype;
}
$al->tp->assign('islogin', $islogin);
$al->tp->assign('email', $email);
if ($utype != 1) {
    Errors::report("You do not have permission to view this page.");
    return;
}
extract($_POST);
if ($action == "add") {
    $id = getNewId("categories", $al->db);
    if ($id == false) {
        return;
    }
    $fieldinfo = getFieldInfo('categories', $al->db);
    if (is_string($fieldinfo)) {
        $rep .= $fieldinfo;
    }
    if ($fieldinfo === false) {
        return;
    }
    $i = 0;
    foreach ($fieldinfo as $f) {
        if ($i > 0) {
            $q .= " or ";
        }
Beispiel #12
0
$islogin = false;
if (isset($_SESSION['login']) == true && isset($_SESSION)) {
    $l = $_SESSION['login'];
    $islogin = true;
    $email = $l->getEmail();
    $utype = $l->utype;
}
$al->tp->assign('islogin', $islogin);
$al->tp->assign('email', $email);
if ($utype != 1) {
    Errors::report("You do not have permission to view this page.");
    return;
}
extract($_POST);
if ($action == "add") {
    $id = getNewId("users", $al->db);
    if ($id == false) {
        return;
    }
    list($month, $day, $year) = explode("/", $_POST['birthdate']);
    $fieldinfo = getFieldInfo('users', $al->db);
    if (is_string($fieldinfo)) {
        $rep .= $fieldinfo;
    }
    if ($fieldinfo === false) {
        return;
    }
    $i = 0;
    foreach ($fieldinfo as $f) {
        if ($i > 0) {
            $q .= " or ";
Beispiel #13
0
		</wp:postmeta>
		<wp:postmeta>
			<wp:meta_key>_author_extra</wp:meta_key>
			<wp:meta_value><![CDATA[field_5694ff62c88d3]]></wp:meta_value>
		</wp:postmeta>
		<wp:postmeta>
			<wp:meta_key>illustrator</wp:meta_key>
			<wp:meta_value><![CDATA[' . getNewId($row["illustrator_id"], $row["illustrator2_id"]) . ']]></wp:meta_value>
		</wp:postmeta>
		<wp:postmeta>
			<wp:meta_key>_illustrator</wp:meta_key>
			<wp:meta_value><![CDATA[field_5694ffb891888]]></wp:meta_value>
		</wp:postmeta>
		<wp:postmeta>
			<wp:meta_key>photographer</wp:meta_key>
			<wp:meta_value><![CDATA[' . getNewId($row["photographer_id"], $row["photographer2_id"]) . ']]></wp:meta_value>
		</wp:postmeta>
		<wp:postmeta>
			<wp:meta_key>_photographer</wp:meta_key>
			<wp:meta_value><![CDATA[field_5694ffde9188b]]></wp:meta_value>
		</wp:postmeta>
		<wp:postmeta>
			<wp:meta_key>country_extra_note</wp:meta_key>
			<wp:meta_value><![CDATA[' . $row["country_ext"] . ']]></wp:meta_value>
		</wp:postmeta>
		<wp:postmeta>
			<wp:meta_key>_country_extra_note</wp:meta_key>
			<wp:meta_value><![CDATA[field_5695356a9fd3f]]></wp:meta_value>
		</wp:postmeta>
		<wp:postmeta>
			<wp:meta_key>book_colours</wp:meta_key>