示例#1
0
 public function __construct($tid)
 {
     $this->id = $tid;
     $result = DB::table('templomok')->join('terkep_geocode as geo', 'geo.tid', '=', 'templomok.id', 'left')->join('varosok', 'varosok.nev', '=', 'templomok.varos', 'left')->select('templomok.*', 'geo.lat', 'geo.lng', 'geo.checked', 'geo.address2', 'varosok.irsz')->where('templomok.id', "=", $this->id)->limit(1)->get();
     if (!count($result)) {
         throw new Exception("There is no church with tid = '{$this->id}'.");
     }
     if ($result[0]->letrehozta != '') {
         $this->responsible = array($result[0]->letrehozta);
     } else {
         $this->responsible = array();
     }
     $acceptedColumns = array('nev', 'ismertnev', 'leiras', 'megjegyzes', 'adminmegj', 'miseaktiv', 'misemegj', 'bucsu', 'frissites', 'eszrevetel', 'kontakt', 'kontaktmail', 'letrehozta', 'megbizhato', 'regdatum', 'modositotta', 'moddatum', 'ok');
     foreach ($acceptedColumns as $column) {
         $this->{$column} = $result[0]->{$column};
     }
     $this->getFullName();
     global $user;
     if (!$this->checkPrivilegeRead($user)) {
         throw new Exception("Read access denied to church tid = '{$tid}'");
     }
     $this->getOSM();
     $this->getLocation();
     $this->getReligious_administration();
     $this->kepek = getImages($this->id);
 }
示例#2
0
function getList($limit = 0)
{
    $data = [];
    for ($i = 0; $i < $limit; $i++) {
        $title = 'Product name ' . $i;
        $data[] = ['title' => $title, 'sku' => 'j' . rand(1000, 9999) . '-' . rand(1000, 9999), 'price' => round(rand(1000, 9999), 2), 'currency' => '$', 'discount' => rand(10, 70), 'code' => base64_encode('product' . time()), 'description' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.', 'meta_keys' => strtolower('Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.'), 'meta_desc' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.', 'images' => getImages($title, rand(2, 9))];
    }
    return $data;
}
示例#3
0
/**
 * Get all albums (directories) and underlying images.
 * @param string $folder  path to directory to read
 * @return array          array containing album data
 */
function getAlbums($folder)
{
    $albums = array();
    if ($handle = opendir($folder)) {
        while (false !== ($file = readdir($handle))) {
            $path = $folder . $file;
            if (is_dir($path) && $file != '..' && $file != '.') {
                $images = getImages($path . '/');
                $albums[$file] = array('name' => ucfirst(substr($file, 2)), 'link' => $path, 'images' => $images, 'size' => count($images));
            }
        }
        closedir($handle);
    }
    ksort($albums);
    return $albums;
}
<?php

include 'controller.php';
$wc = getfiches(1);
echo "<pre>";
print_r($wc);
echo "</pre>";
$wc = getImages(80);
echo "<pre>";
print_r($wc);
echo "</pre>";
echo "<pre>";
print_r(lambert93ToWgs84('352914.52', '6785627.76'));
echo "</pre>";
            break;
        case 'rotate':
            $imageSrc = isset($_REQUEST["image"]) ? $_REQUEST["image"] : '';
            print_r(json_encode(rotateImage($imagesPath, $imagesThumbsPath, $imagesUrl, $imageSrc)));
            break;
        case 'resize':
            $width = isset($_REQUEST["width"]) ? intval($_REQUEST["width"]) : 0;
            $height = isset($_REQUEST["height"]) ? intval($_REQUEST["height"]) : 0;
            $imageSrc = isset($_REQUEST["image"]) ? $_REQUEST["image"] : '';
            print_r(json_encode(resizeImage($imagesPath, $imagesThumbsPath, $imagesUrl, $imageSrc, $width, $height)));
            break;
        case 'imagesList':
            $limit = isset($_REQUEST["limit"]) ? intval($_REQUEST["limit"]) : 10;
            $start = isset($_REQUEST["start"]) ? intval($_REQUEST["start"]) : 0;
            $query = isset($_REQUEST["query"]) ? $_REQUEST["query"] : 0;
            print_r(json_encode(getImages($imagesPath, $imagesUrl, $imagesTumbsUrl, $imagesThumbsPath, $allowedFormats, $start, $limit, $query)));
            break;
        case 'delete':
            $image = isset($_REQUEST["image"]) ? stripslashes($_REQUEST["image"]) : "";
            print_r(json_encode(deleteImage($imagesPath, $imagesThumbsPath, $image)));
            break;
    }
}
function checkAllowedFormats($imageName, $allowedFormats)
{
    // quitamos caracteres extraños
    $imageName = preg_replace('/[^(\\x20-\\x7F)]*/', '', $imageName);
    // extensión del archivo
    $ext = strtolower(substr($imageName, strpos($imageName, '.') + 1, strlen($imageName) - 1));
    if (!in_array($ext, explode(',', $allowedFormats))) {
        return false;
示例#6
0
文件: utils.php 项目: gw-acadtech/VCL
function showTimeTable($links)
{
    global $mode, $viewmode, $user;
    if ($links == 1) {
        $imageid = getContinuationVar('imageid');
        $length = getContinuationVar('length');
        $requestid = getContinuationVar('requestid', 0);
        $showmessage = getContinuationVar('showmessage', 0);
        $platforms = array();
        $schedules = array();
    } else {
        $imageid = 0;
        $length = 0;
        $requestid = 0;
        $showmessage = 0;
        $platforms = getContinuationVar("platforms");
        if (empty($platforms)) {
            $platforms = processInputVar("platforms", ARG_MULTINUMERIC);
        }
        $schedules = getContinuationVar("schedules");
        if (empty($schedules)) {
            $schedules = processInputVar("schedules", ARG_MULTINUMERIC);
        }
    }
    $argstart = getContinuationVar("start");
    $argend = getContinuationVar("end");
    $resources = getUserResources(array("computerAdmin"));
    $userCompIDs = array_keys($resources["computer"]);
    $computerData = getComputers();
    $imageData = getImages();
    $now = time();
    if ($links) {
        $resources = getUserResources(array("imageAdmin", "imageCheckOut"));
        $usercomputerids = array_keys($resources["computer"]);
        # get list of computers' platformids
        $qh = doQuery("SELECT platformid FROM image WHERE id = {$imageid}", 110);
        $row = mysql_fetch_row($qh);
        $platformid = $row[0];
        $computer_platformids = array();
        $qh = doQuery("SELECT id, platformid FROM computer", 111);
        while ($row = mysql_fetch_row($qh)) {
            $computer_platformids[$row[0]] = $row[1];
        }
        $mappedcomputers = getMappedResources($imageid, "image", "computer");
        $compidlist = array_intersect($mappedcomputers, $usercomputerids);
    } else {
        $compidlist = $userCompIDs;
    }
    if (!empty($argstart) && !empty($argend)) {
        $timeslots = getTimeSlots($compidlist, $argend, $argstart);
        $start = $argstart;
        $end = $argend;
    } else {
        $start = $now;
        $end = $start + SECINDAY / 2;
        $timeslots = getTimeSlots($compidlist, $end);
    }
    print "<DIV align=center>\n";
    print "<H2>Time Table</H2>\n";
    print "</DIV>\n";
    $computeridrow = "";
    $displayedids = array();
    $computers = array_keys($timeslots);
    if ($links) {
        $computers = array_intersect($computers, $usercomputerids);
    }
    foreach ($computers as $id) {
        if ($links) {
            # don't show computers that don't meet hardware criteria, are not
            # in the available state, are the wrong platform, or wrong group,
            # or aren't mapped in resourcemap
            if ($computer_platformids[$id] != $platformid || $computerData[$id]["stateid"] != 2 && $computerData[$id]["stateid"] != 3 && $computerData[$id]["stateid"] != 6 && $computerData[$id]["stateid"] != 8 || $computerData[$id]["ram"] < $imageData[$imageid]["minram"] || $computerData[$id]["procnumber"] < $imageData[$imageid]["minprocnumber"] || $computerData[$id]["procspeed"] < $imageData[$imageid]["minprocspeed"] || $computerData[$id]["network"] < $imageData[$imageid]["minnetwork"] || !in_array($id, $mappedcomputers)) {
                continue;
            }
        } elseif (!array_key_exists($id, $computerData) || !in_array($computerData[$id]["platformid"], $platforms) || !in_array($computerData[$id]["scheduleid"], $schedules) || !in_array($id, $userCompIDs)) {
            continue;
        }
        $computeridrow .= "          <TH>{$id}</TH>\n";
        array_push($displayedids, $id);
    }
    if (empty($displayedids)) {
        if ($links) {
            print "There are currently no computers available that can run the application you selected.\n";
        } else {
            print "There are no computers that meet the specified criteria\n";
        }
        return;
    }
    if ($showmessage) {
        print "The time you have requested to use the environment is not ";
        print "available. You may select from the green blocks of time to ";
        print "select an available time slot to make a reservation.<br>\n";
    }
    print "<table summary=\"\">\n";
    print "  <TR>\n";
    print "    <TD>";
    # print Previous/Next links
    if (!empty($argstart) && $argstart - SECINDAY / 2 > $now - 600) {
        $prevstart = $start - SECINDAY / 2;
        $prevend = $end - SECINDAY / 2;
        print "<FORM action=\"" . BASEURL . SCRIPT . "\" method=post>\n";
        $cdata = array('start' => $prevstart, 'end' => $prevend, 'imageid' => $imageid, 'requestid' => $requestid, 'length' => $length, 'platforms' => $platforms, 'schedules' => $schedules);
        $cont = addContinuationsEntry($mode, $cdata, SECINDAY);
        print "<INPUT type=hidden name=continuation value=\"{$cont}\">\n";
        print "<INPUT type=submit value=Previous>\n";
        print "</FORM>\n";
    }
    print "</TD>\n";
    print "    <TD>";
    if ($end + SECINDAY / 2 < $now + DAYSAHEAD * SECINDAY) {
        $nextstart = $start + SECINDAY / 2;
        $nextend = $end + SECINDAY / 2;
        print "<FORM action=\"" . BASEURL . SCRIPT . "\" method=post>\n";
        $cdata = array('start' => $nextstart, 'end' => $nextend, 'imageid' => $imageid, 'requestid' => $requestid, 'length' => $length, 'platforms' => $platforms, 'schedules' => $schedules);
        $cont = addContinuationsEntry($mode, $cdata, SECINDAY);
        print "<INPUT type=hidden name=continuation value=\"{$cont}\">\n";
        print "<INPUT type=submit value=Next>\n";
        print "</FORM>\n";
    }
    print "</TD>\n";
    print "  </TR>\n";
    print "  <TR>\n";
    print "    <TD>\n";
    $tmpArr = array_keys($computers);
    $first = $computers[$tmpArr[0]];
    print "      <table id=ttlayout summary=\"\">\n";
    if (!$links || $viewmode >= ADMIN_DEVELOPER) {
        print "        <TR>\n";
        print "          <TH align=right>Computer&nbsp;ID:</TH>\n";
        print $computeridrow;
        print "        </TR>\n";
    }
    $yesterday = "";
    foreach (array_keys($timeslots[$first]) as $stamp) {
        if ($stamp < $now) {
            continue;
        }
        print "        <TR>\n";
        $stampArr = getdate($stamp);
        $label = "";
        if ($stampArr["mday"] != $yesterday) {
            $label = date('n/d/Y+g:i+a', $stamp);
            $label = str_replace('+', '&nbsp;', $label);
            $yesterday = $stampArr["mday"];
        } elseif ($stampArr["minutes"] == 0) {
            $label = date('g:i a', $stamp);
        }
        print "          <TH align=right>{$label}</TH>\n";
        $free = 0;
        # print the cells
        foreach ($computers as $id) {
            if (!in_array($id, $displayedids)) {
                continue;
            }
            if ($links && ($computer_platformids[$id] != $platformid || $computerData[$id]["stateid"] == 10 || $computerData[$id]["stateid"] == 5)) {
                continue;
            }
            # computer's schedule is currently closed
            if ($timeslots[$id][$stamp]["scheduleclosed"] == 1) {
                print "          <TD bgcolor=\"#a0a0a0\"><img src=images/gray.jpg ";
                print "alt=scheduleclosed border=0></TD>\n";
            } elseif ($computerData[$id]["stateid"] == 10) {
                print "          <TD bgcolor=\"#a0a0a0\"><img src=images/gray.jpg ";
                print "alt=maintenance border=0></TD>\n";
            } elseif ($timeslots[$id][$stamp]['blockRequest'] && ($timeslots[$id][$stamp]['blockRequestInfo']['imageid'] != $imageid || !in_array($timeslots[$id][$stamp]['blockRequestInfo']['groupid'], array_keys($user['groups']))) && $timeslots[$id][$stamp]['available']) {
                if ($links) {
                    print "          <TD bgcolor=\"#ff0000\"><img src=images/red.jpg ";
                    print "alt=blockrequest border=0></TD>\n";
                } else {
                    print "          <TD bgcolor=\"#e58304\"><img src=images/orange.jpg ";
                    $title = "Block Request: {$timeslots[$id][$stamp]['blockRequestInfo']['name']}\n" . "Image: {$timeslots[$id][$stamp]['blockRequestInfo']['image']}";
                    print "alt=blockrequest border=0 title=\"{$title}\"></TD>\n";
                }
            } elseif ($timeslots[$id][$stamp]["available"]) {
                if ($links) {
                    print "          <TD bgcolor=\"#00ff00\"><a href=\"" . BASEURL . SCRIPT;
                    print "?mode=newRequest&stamp={$stamp}&imageid={$imageid}&length={$length}\"><img ";
                    print "src=images/green.jpg alt=free border=0></a></TD>\n";
                } else {
                    print "          <TD bgcolor=\"#00ff00\"><img src=images/green.jpg alt=free border=0></TD>\n";
                }
            } else {
                if ($links) {
                    print "          <TD bgcolor=\"#ff0000\"><font color=\"#ff0000\">used</font></TD>\n";
                } else {
                    $title = "User: "******"unityid"] . " Image: " . $timeslots[$id][$stamp]["prettyimage"];
                    $cdata = array('requestid' => $timeslots[$id][$stamp]["requestid"]);
                    $cont = addContinuationsEntry('viewRequestInfo', $cdata);
                    print "          <TD bgcolor=\"#ff0000\"><a href=\"" . BASEURL;
                    print SCRIPT . "?continuation={$cont}\"><img src=images/red.jpg ";
                    print "alt=used border=0 title=\"{$title}\"></a></TD>\n";
                }
            }
        }
        print "        </TR>\n";
    }
    print "      </table>\n";
    print "    </TD>\n";
    print "  </TR>\n";
    print "  <TR>\n";
    print "    <TD>";
    # print Previous/Next links
    if (!empty($argstart) && $argstart - SECINDAY / 2 > $now - 600) {
        $prevstart = $start - SECINDAY / 2;
        $prevend = $end - SECINDAY / 2;
        print "<FORM action=\"" . BASEURL . SCRIPT . "\" method=post>\n";
        $cdata = array('start' => $prevstart, 'end' => $prevend, 'imageid' => $imageid, 'requestid' => $requestid, 'length' => $length, 'platforms' => $platforms, 'schedules' => $schedules);
        $cont = addContinuationsEntry($mode, $cdata, SECINDAY);
        print "<INPUT type=hidden name=continuation value=\"{$cont}\">\n";
        print "<INPUT type=submit value=Previous>\n";
        print "</FORM>\n";
    }
    print "</TD>\n";
    print "    <TD>";
    if ($end + SECINDAY / 2 < $now + DAYSAHEAD * SECINDAY) {
        $nextstart = $start + SECINDAY / 2;
        $nextend = $end + SECINDAY / 2;
        print "<FORM action=\"" . BASEURL . SCRIPT . "\" method=post>\n";
        $cdata = array('start' => $nextstart, 'end' => $nextend, 'imageid' => $imageid, 'requestid' => $requestid, 'length' => $length, 'platforms' => $platforms, 'schedules' => $schedules);
        $cont = addContinuationsEntry($mode, $cdata, SECINDAY);
        print "<INPUT type=hidden name=continuation value=\"{$cont}\">\n";
        print "<INPUT type=submit value=Next>\n";
        print "</FORM>\n";
    }
    print "</TD>\n";
    print "  </TR>\n";
    print "</table>\n";
}
示例#7
0
function getMappedSubConfigs($mode, $arg1, $arg2, $rec = 0)
{
    # $mode - 0: subimages, 1: subconfigs
    global $user;
    if ($mode == 0) {
        $configsubimageid = $arg1;
        $imageid = $arg2;
        $imgdata = getImages(0, $imageid);
    } else {
        $inlist = implode(',', $arg1);
        $searchid = $arg2;
    }
    $query = "SELECT cm.id, " . "cmt.prettyname AS configmaptype, " . "c.id AS configid, " . "c.name AS config, " . "c.data AS configdata, " . "c.ownerid, " . "CONCAT(u.unityid, '@', ua.name) AS owner, " . "c.configtypeid, " . "ct.prettyname AS configtype, " . "c.optional, " . "cm.configmaptypeid, " . "cm.subid, " . "cm.affiliationid, " . "a.name AS affiliation, " . "cm.configstageid, " . "cs.name AS configstage, " . "csi.imageid AS subimageid, " . "csi.id AS configsubimageid, " . "cm.disabled " . "FROM configmap cm, " . "config c " . "LEFT JOIN configsubimage csi ON (c.id = csi.configid), " . "user u, " . "affiliation ua, " . "configtype ct, " . "configmaptype cmt, " . "affiliation a, " . "configstage cs " . "WHERE cm.configid = c.id AND " . "c.ownerid = u.id AND " . "u.affiliationid = ua.id AND " . "c.configtypeid = ct.id AND " . "cm.configmaptypeid = cmt.id AND " . "cm.affiliationid = a.id AND " . "(cm.affiliationid = {$user['affiliationid']} OR " . "a.name = 'Global') AND " . "cm.configstageid = cs.id AND ";
    if ($mode) {
        $query .= "cmt.name = 'config' AND " . " cm.subid IN ({$inlist})";
    } else {
        $query .= "((cmt.name = 'configsubimage' AND " . "  cm.subid = {$configsubimageid}) OR " . " (cmt.name = 'OStype' AND " . "  cm.subid = {$imgdata[$imageid]['ostypeid']}) OR " . " (cmt.name = 'OS' AND " . "  cm.subid = {$imgdata[$imageid]['osid']}))";
    }
    $qh = doQuery($query);
    $configs = array();
    $configids = array();
    while ($row = mysql_fetch_assoc($qh)) {
        $row['configmapid'] = $row['id'];
        if (is_null($row['subimageid'])) {
            $configids[] = $row['configid'];
        }
        if ($row['configtype'] == 'Cluster') {
            $row['id'] = "{$row['id']}-{$row['configsubimageid']}";
            $row['cluster'] = 1;
        } else {
            $row['cluster'] = 0;
        }
        $row['configdata'] = htmlspecialchars($row['configdata']);
        $row['optional'] = (int) $row['optional'];
        $row['applied'] = true;
        $row['disabled'] = (int) $row['disabled'];
        if ($mode == 0) {
            $row['id'] = "{$configsubimageid}/{$row['id']}";
        } else {
            $row['id'] = "{$searchid}/{$row['id']}";
        }
        $configs[$row['id']] = $row;
        if ($rec < 20 && $row['configtype'] == 'Cluster') {
            $subconfigs = getMappedSubConfigs(0, $row['configsubimageid'], $row['subimageid'], ++$rec);
            $configs = $configs + $subconfigs;
        }
    }
    if ($rec < 20 && !empty($configids)) {
        if ($mode == 0) {
            $subconfigs = getMappedSubConfigs(1, $configids, $configsubimageid, ++$rec);
        } else {
            $subconfigs = getMappedSubConfigs(1, $configids, $searchid, ++$rec);
        }
        $configs = $configs + $subconfigs;
    }
    return $configs;
}
示例#8
0
<?php

include "config.php";
getImages($_GET['id'], $con);
function getImages($id, $con)
{
    $result = mysqli_query($con, "select * from eventphotos where eventid = '{$id}' order by id desc") or die(mysqli_error($con));
    $nara = array();
    while ($y = mysqli_fetch_array($result)) {
        $y['path'] = $_SESSION['serverUrl'] . $y['path'];
        echo $y['path'];
        break;
    }
}
示例#9
0
 function getMapSubName($maptype, $subid)
 {
     switch ($maptype) {
         case "Image":
             $data = getImages(0, $subid);
             return $data[$subid]['prettyname'];
         case "OS Type":
             $ostypes = getOStypes();
             return $ostypes[$subid];
         case "OS":
             $oses = getOSList();
             return $oses[$subid]['prettyname'];
         case "Config":
         case "Cluster":
             $data = $this->_getData($subid);
             return $data[$subid]['name'];
         case "Management Node":
             $managementnodes = getManagementNodes('neither', 0, $subid);
             return $managementnodes[$subid]['hostname'];
             break;
     }
 }
示例#10
0
     //echo "<br> " . $query ;
     $result = cpg_db_fetch_rowset(cpg_db_query($query));
     //echo "result " . $result[0][0];
     if ($result[0][0] != 0) {
         return true;
     } else {
         return false;
     }
 }
 $get = Inspekt::makeGetCage();
 if ($superCage->get->getRAW('check') == 1) {
     securityCheck();
 } else {
     if (verifykey($superCage->get->getRAW('magik'))) {
         if ($superCage->get->getRAW('getalb') == 1) {
             getImages($superCage->get->getRAW('alb'));
         } else {
             if ($superCage->get->getRAW('getroot') == 1) {
                 getroot();
             } else {
                 if ($superCage->get->getRAW('getcat') == 1) {
                     getAlbums($superCage->get->getRAW('cat'));
                 } else {
                     if ($superCage->get->getRAW('albumlisting') == 1) {
                         treeBuilder();
                     } else {
                         if ($superCage->get->getRAW('getimg') == 1) {
                             getimg($superCage->get->getRAW('img'));
                         } else {
                             if ($superCage->get->getRAW('photoinfo') == 1) {
                                 getPhotoInfo($superCage->get->getRAW('photo'));
示例#11
0
文件: gdc.php 项目: vincseize/GDC
        $mimetype = mime_content_type("{$fulldir}{$entry}");
        foreach ($imagetypes as $valid_type) {
            if (preg_match("@^{$valid_type}@", $mimetype)) {
                $retval[] = array('file' => "/{$dir}{$entry}", 'size' => getimagesize("{$fulldir}{$entry}"));
                break;
            }
        }
    }
    $d->close();
    sort($retval);
    return $retval;
}
//test compress image
testTypeImage($directoryBIG, $directoryLOW);
// fetch image details
$images = getImages($directoryBIG, $directoryLOW, $dirVillageAttaque);
$n_images = count($images);
// SCRIPTS JS
/*
echo "<script type='text/javascript'>";
echo "function goDraw(){";
echo "var e = document.getElementById('selectBattleLeft');";
echo "var v = e.options[e.selectedIndex].value;";
echo "	alert(v);";
echo "}";
echo "</script>";
// check screen
echo "<script type='text/javascript'>";
echo "var w_img_gdc=' ';";
echo "var w = window.innerWidth;";
echo "var h = window.innerHeight;";
示例#12
0
文件: getprod.php 项目: jbm160/brs
function getProductMult($d, $type, $cat)
{
    global $i, $o, $revs;
    $imgfileurlcache = $d->find('a.product-image[rel=gal1]', 0)->href;
    $imgtitle = $d->find('a.product-image[rel=gal1]', 0)->title;
    $im = explode("/", strstr($imgfileurlcache, "media/"));
    $imgfileurl = strstr($imgfileurlcache, "media/", true) . implode("/", array($im[0], $im[1], $im[2], $im[7], $im[8], $im[9]));
    $imgfile = $im[9];
    $img = implode("/", array($im[7], $im[8], $im[9]));
    fputcsv($i, array($imgfileurl, $img, $imgfileurlcache));
    if (!is_null($d->find('div[itemprop=description]', 0))) {
        $shortdesc = trim($d->find('div[itemprop=description]', 0)->innertext);
    } else {
        $shortdesc = "";
    }
    if (!is_null($d->find('#tab-full-details', 0))) {
        $description = trim($d->find('#tab-full-details', 0)->innertext);
    } else {
        $description = "";
    }
    $brand = "";
    if (count($d->find('table.grouped-items-table > tbody > tr.item')) < 2) {
        $prodsku = trim($d->find('table.grouped-items-table > tbody > tr.item span.sku', 0)->innertext, "SKU: ");
        $prodname = $d->find('table.grouped-items-table > tbody > tr.item div.product-name', 0)->innertext;
        $prodprice = trim($d->find('table.grouped-items-table > tbody > tr.item span.price', 0)->innertext, "\$ ");
        $prodvis = 4;
        $groupedskus = "";
        $prodtype = "simple";
        getGroupedSku($prodsku, $prodtype, $cat, $description, $img, $brand, $prodname, $prodprice, $shortdesc, $prodvis, $imgtitle, $groupedskus);
    } else {
        $groupskus = array();
        foreach ($d->find('table.grouped-items-table > tbody > tr.item') as $item) {
            if (!is_null($item->find('span.sku', 0))) {
                $prodsku = trim($item->find('span.sku', 0)->innertext, "SKU: ");
                $prodname = $item->find('div.product-name', 0)->innertext;
                $prodprice = trim($item->find('span.price', 0)->innertext, "\$ ");
                $prodvis = 1;
                $groupedskus = "";
                $prodtype = "simple";
                $groupskus[] = $prodsku;
                getGroupedSku($prodsku, $prodtype, $cat, $description, $img, $brand, $prodname, $prodprice, $shortdesc, $prodvis, $imgtitle, $groupedskus);
            }
        }
        $prodsku = $groupskus[0] . "g";
        $prodname = $d->find('div[itemprop=name]', 0)->firstChild()->innertext;
        $prodprice = "";
        $prodvis = 4;
        $groupedskus = implode(",", $groupskus);
        $prodtype = "grouped";
        getGroupedSku($prodsku, $prodtype, $cat, $description, $img, $brand, $prodname, $prodprice, $shortdesc, $prodvis, $imgtitle, $groupedskus);
    }
    getImages($d);
    $revs[$prodsku] = 0;
    getReviews($d, $prodsku);
    return 1;
}
示例#13
0
<?php

require 'config.php';
$result = mysqli_query($con, "select * from events where achievement=1 order by date desc") or die(mysqli_error($con));
$ara = array();
while ($x = mysqli_fetch_array($result)) {
    $sara = array();
    $sara['id'] = $x['id'];
    $sara['name'] = $x['name'];
    $sara['path'] = getImages($x['id'], $con);
    array_push($ara, $sara);
}
function getImages($id, $con)
{
    $result = mysqli_query($con, "select * from eventphotos where eventid = '{$id}' order by id desc") or die(mysqli_error($con));
    $nara = array();
    while ($y = mysqli_fetch_array($result)) {
        $x = $_SESSION['serverUrl'] . $y['path'];
        return $x;
    }
}
echo json_encode($ara);
示例#14
0
 function AJaddSubimage()
 {
     $imageid = getContinuationVar('imageid');
     $adminids = getContinuationVar('adminids');
     $userimageids = getContinuationVar('userimageids');
     $subimages = getContinuationVar('subimages');
     $imagemetaid = getContinuationVar('imagemetaid');
     if (!in_array($imageid, $adminids)) {
         $arr = array('error' => 'noimageaccess', 'msg' => i("You do not have access to manage this image."));
         sendJSON($arr);
         return;
     }
     $newid = processInputVar('imageid', ARG_NUMERIC);
     if (!in_array($newid, $userimageids)) {
         $arr = array('error' => 'nosubimageaccess', 'msg' => i("You do not have access to add this subimage."));
         sendJSON($arr);
         return;
     }
     if (is_null($imagemetaid)) {
         $query = "INSERT INTO imagemeta " . "(subimages) " . "VALUES (1)";
         doQuery($query, 101);
         $imagemetaid = dbLastInsertID();
         $query = "UPDATE image " . "SET imagemetaid = {$imagemetaid} " . "WHERE id = {$imageid}";
         doQuery($query, 101);
     } elseif (!count($subimages)) {
         $query = "UPDATE imagemeta " . "SET subimages = 1 " . "WHERE id = {$imagemetaid}";
         doQuery($query, 101);
     }
     $query = "INSERT INTO subimages " . "(imagemetaid, " . "imageid) " . "VALUES ({$imagemetaid}, " . "{$newid})";
     doQuery($query, 101);
     $subimages[] = $newid;
     $data = array('imageid' => $imageid, 'adminids' => $adminids, 'imagemetaid' => $imagemetaid, 'userimageids' => $userimageids, 'subimages' => $subimages, 'obj' => $this);
     $addcont = addContinuationsEntry('AJaddSubimage', $data, SECINDAY, 1, 0);
     $remcont = addContinuationsEntry('AJremSubimage', $data, SECINDAY, 1, 0);
     $image = getImages(0, $newid);
     $name = $image[$newid]['prettyname'];
     $arr = array('newid' => $newid, 'name' => $name, 'addcont' => $addcont, 'remcont' => $remcont);
     sendJSON($arr);
 }
示例#15
0
文件: testimages.php 项目: W3AMD/W3OI
    // array to hold return value
    $retval = array();
    // full server path to directory
    $fulldir = "{$_SERVER['DOCUMENT_ROOT']}{$dir}";
    $d = @dir($fulldir) or die("getImages: Failed opening directory {$dir} for reading");
    while (false !== ($entry = $d->read())) {
        // skip hidden files
        if ($entry[0] == ".") {
            continue;
        }
        // check for image files
        $f = escapeshellarg("{$fulldir}{$entry}");
        $retval[] = array('file' => "/members/images/large/{$entry}", 'size' => getimagesize("{$fulldir}/{$entry}"));
    }
    $d->close();
    return $retval;
}
// fetch image details
$images = getImages("\\members\\images\\large");
// display on page
foreach ($images as $img) {
    echo "<div class=\"photo\">";
    echo "<img src=\"{$img['file']}\" width='200' height='auto' alt=\"\"><br>\n";
    // display image file name as link
    echo "<a href=\"{$img['file']}\">", basename($img['file']), "</a><br>\n";
    // display image dimenstions
    echo "({$img['size'][0]} x {$img['size'][1]} pixels)<br>\n";
    // display mime_type
    echo $img['size']['mime'];
    echo "</div>\n";
}
示例#16
0
function processRequestInput($checks = 1)
{
    global $submitErr, $submitErrMsg, $mode;
    $return = array();
    $return["requestid"] = processInputVar("requestid", ARG_NUMERIC);
    $return["day"] = preg_replace('[\\s]', '', processInputVar("day", ARG_STRING));
    $return["hour"] = processInputVar("hour", ARG_NUMERIC);
    $return["minute"] = processInputVar("minute", ARG_STRING);
    $return["meridian"] = processInputVar("meridian", ARG_STRING);
    $return["endday"] = preg_replace('[\\s]', '', processInputVar("endday", ARG_STRING));
    $return["endhour"] = processInputVar("endhour", ARG_NUMERIC);
    $return["endminute"] = processInputVar("endminute", ARG_STRING);
    $return["endmeridian"] = processInputVar("endmeridian", ARG_STRING);
    $return["length"] = processInputVar("length", ARG_NUMERIC);
    $return["started"] = getContinuationVar('started', processInputVar("started", ARG_NUMERIC));
    $return["os"] = processInputVar("os", ARG_STRING);
    $return["imageid"] = getContinuationVar('imageid', processInputVar("imageid", ARG_NUMERIC));
    $return["prettyimage"] = processInputVar("prettyimage", ARG_STRING);
    $return["time"] = processInputVar("time", ARG_STRING);
    $return["revisionid"] = processInputVar("revisionid", ARG_MULTINUMERIC);
    $return["ending"] = processInputVar("ending", ARG_STRING, "length");
    $return["enddate"] = processInputVar("enddate", ARG_STRING);
    $return["extend"] = processInputVar("extend", ARG_NUMERIC);
    $return["testjavascript"] = processInputVar("testjavascript", ARG_NUMERIC, 0);
    $return['lengthchanged'] = 0;
    if ($return["minute"] == 0) {
        $return["minute"] = "00";
    }
    if ($return["endminute"] == 0) {
        $return["endminute"] = "00";
    }
    if (!$checks) {
        return $return;
    }
    if (!$return["started"]) {
        $checkdateArr = explode('/', $return["day"]);
        if (!is_numeric($checkdateArr[0]) || !is_numeric($checkdateArr[1]) || !is_numeric($checkdateArr[2]) || !checkdate($checkdateArr[0], $checkdateArr[1], $checkdateArr[2])) {
            $submitErr |= STARTDAYERR;
            $submitErrMsg[STARTDAYERR] = "The submitted start date is invalid. ";
        }
        if (!ereg('^((0?[1-9])|(1[0-2]))$', $return["hour"], $regs)) {
            $submitErr |= STARTHOURERR;
            $submitErrMsg[STARTHOURERR] = "The submitted hour must be from 1 to 12.";
        }
    }
    # TODO check for valid revisionids for each image
    if (!empty($return["revisionid"])) {
        foreach ($return['revisionid'] as $key => $val) {
            if (!is_numeric($val) || $val < 0) {
                unset($return['revisionid']);
            }
        }
    }
    /*if($mode == "confirmAdminEditRequest") {
    		$checkdateArr = explode('/', $return["endday"]);
    		if(! is_numeric($checkdateArr[0]) ||
    		   ! is_numeric($checkdateArr[1]) ||
    		   ! is_numeric($checkdateArr[2]) ||
    		   ! checkdate($checkdateArr[0], $checkdateArr[1], $checkdateArr[2])) {
    			$submitErr |= ENDDAYERR;
    			$submitErrMsg[ENDDAYERR] = "The submitted end date is invalid. ";
    		}
    		if(! ereg('^((0?[1-9])|(1[0-2]))$', $return["endhour"])) {
    			$submitErr |= ENDHOURERR;
    			$submitErrMsg[ENDHOURERR] = "The submitted hour must be from 1 to 12.";
    		}
    	}*/
    // make sure user hasn't submitted something longer than their allowed max length
    $imageData = getImages(0, $return['imageid']);
    $maxtimes = getUserMaxTimes();
    if ($maxtimes['initial'] < $return['length']) {
        $return['lengthchanged'] = 1;
        $return['length'] = $maxtimes['initial'];
    }
    if ($imageData[$return['imageid']]['maxinitialtime'] > 0 && $imageData[$return['imageid']]['maxinitialtime'] < $return['length']) {
        $return['lengthchanged'] = 1;
        $return['length'] = $imageData[$return['imageid']]['maxinitialtime'];
    }
    if ($return["ending"] != "length") {
        if (!ereg('^(20[0-9]{2})-([0-1][0-9])-([0-3][0-9]) (([0-1][0-9])|(2[0-3])):([0-5][0-9]):([0-5][0-9])$', $return["enddate"], $regs)) {
            $submitErr |= ENDDATEERR;
            $submitErrMsg[ENDDATEERR] = "The submitted date/time is invalid.";
        } elseif (!checkdate($regs[2], $regs[3], $regs[1])) {
            $submitErr |= ENDDATEERR;
            $submitErrMsg[ENDDATEERR] = "The submitted date/time is invalid.";
        }
    }
    if ($return["testjavascript"] != 0 && $return['testjavascript'] != 1) {
        $return["testjavascript"] = 0;
    }
    return $return;
}
示例#17
0
function RESTresourceDetail()
{
    $type = validatetype(processRESTarg(1, ARG_STRING));
    $deleted = processInputVar('deleted', ARG_NUMERIC, 0);
    if ($deleted != 0 && $deleted != 1) {
        $deleted = 0;
    }
    $name = processInputVar('name', ARG_STRING, '*');
    $tmp = processInputVar('prettyname', ARG_STRING, '*');
    if ($name == '*' && $tmp != '*') {
        $name = $tmp;
    }
    if (is_null($type)) {
        RESTresponse(404, "invalid resource type");
        return;
    }
    $subid = processRESTarg(2, ARG_NUMERIC, 0);
    if ($type == 'image') {
        $resources = getUserResources(array("imageAdmin", "imageCheckOut"), array('available'), 0, $deleted);
    } elseif ($type == 'computer') {
        $resources = getUserResources(array("computerAdmin"), array("administer"), 0, $deleted);
    } elseif ($type == 'config') {
        $resources = getUserResources(array("configAdmin"), array('available'), 0, $deleted);
    }
    # TODO
    #elseif ...
    if ($subid && !array_key_exists($subid, $resources[$type])) {
        RESTresponse(404, "specified resource does not exist");
        printArray($resources[$type]);
        return;
    }
    if ($_SERVER['REQUEST_METHOD'] == 'DELETE') {
        if (RESTdeleteResource($type, $subid)) {
            RESTresponse(204);
        } else {
            RESTresponse(404, "specified resource does not exist 2");
        }
        return;
    }
    if ($type == 'image') {
        $items = getImages($deleted, $subid);
        $data = array();
        foreach (array_keys($resources[$type]) as $id) {
            if ($name != '*' && !preg_match("/^{$name}\$/i", $items[$id]['prettyname'])) {
                continue;
            }
            if (array_key_exists($id, $items)) {
                $data[$id] = $items[$id];
            }
        }
    } elseif ($type == 'computer') {
        $data = getComputers(1, 0, $subid);
    } elseif ($type == 'config') {
        $cluster = processInputVar('cluster', ARG_NUMERIC, -1);
        $cfg = new Config();
        $items = $cfg->getData($cfg->defaultGetDataArgs);
        $data = array();
        foreach (array_keys($resources[$type]) as $id) {
            if ($name != '*' && !preg_match("/^{$name}\$/i", $items[$id]['name'])) {
                continue;
            }
            if (array_key_exists($id, $items)) {
                if ($cluster == -1 || $cluster == 0 && $items[$id]['configtype'] != 'Cluster' || $cluster == 1 && $items[$id]['configtype'] == 'Cluster') {
                    $data[$id] = $items[$id];
                }
            }
        }
    }
    #elseif ...
    if ($subid == 0) {
        sendREST(dataToJSON($data));
        return;
    }
    sendREST(dataToJSON($data[$subid], 1));
}
示例#18
0
/**
 * Get all photo posts of blog as json
 */
function getAll(){
	global $config;
	
	$client = new Tumblr\API\Client($config['tumblr_consumer_key']);

	$options['limit'] = 50;
	$options['type'] = "photo";
	$options['filter'] = "text";

	$config['post_limit'] = $options['limit'];

	$total = getTotalPosts($client, $config['blog'], $options);
	$response["images"] = array();

	for ($i=0; $i < ceil($total / $options['limit']); $i++) { 
		$data = getImages($i);

		$response['images'] = array_merge($response['images'], $data['images']);
	}


	$onlyUrl = isset($_REQUEST['onlyUrl']); 

	if ($onlyUrl) {
		foreach ($response['images'] as $image) {
			echo $image['src'] . "\r\n";
		}
		die;
	} else {
		die(json_encode($response));
	}
}
示例#19
0
    echo $video;
    ?>
"/>
                    <p class="vjs-no-js">To view this video please enable JavaScript, and consider upgrading to a web
                        browser that <a href="http://videojs.com/html5-video-support/" target="_blank">supports HTML5
                            video</a></p>
                </video>

            </div>

        <?php 
}
?>

        <?php 
$images = getImages($id);
if (!empty($images)) {
    ?>
            <div class="project-images" style="float: none; width: initial;">
                <?php 
    foreach ($images as $image) {
        echo '<img src="' . SITE_URL . '/uploads/images/' . $image['file_name'] . '" alt="">';
    }
    ?>
            </div>
        <?php 
}
?>
    </div>

</div>
示例#20
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Model::unguard();
     // Notendur
     \App\User::create(['name' => 'Netvistun', 'email' => '*****@*****.**', 'password' => bcrypt(env('NETVISTUN')), 'remember_token' => str_random(10)]);
     $faker = Faker\Factory::create();
     function makePage($page = [])
     {
         $page['slug'] = isset($page['slug']) ? $page['slug'] : str_slug($page['title']);
         $page['images'] = isset($page['images']) ? $page['images'] : [];
         return factory(\App\Page::class)->create($page);
     }
     function makeProduct($page = [])
     {
         $page['slug'] = isset($page['slug']) ? $page['slug'] : str_slug($page['title']);
         $page['images'] = isset($page['images']) ? $page['images'] : [];
         return factory(\App\Product::class)->create($page);
     }
     function makeCategory($page = [])
     {
         $page['slug'] = isset($page['slug']) ? $page['slug'] : str_slug($page['title']);
         $page['images'] = isset($page['images']) ? $page['images'] : [];
         return factory(\App\Category::class)->create($page);
     }
     $pages = ['Sagan', 'Vörur', 'Hafa samband'];
     $um_okkur = makePage(['title' => 'Um okkur', 'slug' => 'um-okkur']);
     makePage(['slug' => 'starfsfolk', 'title' => 'Starfsfólk', 'parent_id' => $um_okkur->id]);
     makePage(['slug' => 'stadsetning', 'title' => 'Staðsetning', 'parent_id' => $um_okkur->id, 'content' => '<iframe width="100%" height="400" frameborder="0" src="http://ja.is/kort/embedded/?zoom=10&x=359824&y=406933&layer=map&q=Kleifar%C3%A1s+ehf+heildverslun%2C+%C3%81rm%C3%BAla+22"></iframe>']);
     foreach ($pages as $page) {
         makePage(['title' => $page]);
     }
     $pics = ['slide1.jpg', 'slide2.jpg'];
     $forsidumyndir = makePage(['title' => 'Forsíðumyndir', 'slug' => '_forsidumyndir', 'status' => 0]);
     foreach ($pics as $k => $v) {
         makePage(['title' => $v, 'parent_id' => $forsidumyndir->id, 'images' => [['name' => $v]]]);
     }
     $gleraugu = makeCategory(['title' => 'Gleraugu', 'images' => getImages(3)]);
     $fatnadur = makeCategory(['title' => 'Fatnaður', 'images' => getImages(3)]);
     $snyrtivara = makeCategory(['title' => 'Snyrtivara', 'images' => getImages(3)]);
     $harskraut = makeCategory(['title' => 'Hárskraut', 'images' => getImages(3)]);
     $lipsmacker = makeCategory(['title' => 'Lipsmacker', 'images' => getImages(3)]);
     \App\Category::find($harskraut->id)->extras('is')->add('frontpaged', 1);
     \App\Category::find($harskraut->id)->extras('is')->add('size', 2);
     \App\Category::find($gleraugu->id)->extras('is')->add('frontpaged', 2);
     \App\Category::find($gleraugu->id)->extras('is')->add('size', 2);
     \App\Category::find($fatnadur->id)->extras('is')->add('frontpaged', 3);
     \App\Category::find($fatnadur->id)->extras('is')->add('size', 2);
     \App\Category::find($snyrtivara->id)->extras('is')->add('frontpaged', 4);
     \App\Category::find($snyrtivara->id)->extras('is')->add('size', 2);
     $gleraugu_subs = ['Sólgleraugu', 'Sólgleraugu barna', 'Lesgleraugu'];
     $fatnadur_subs = ['Sokkar', 'Vettlingar', 'Húfur', 'Leggings'];
     $snyrtivara_subs = ['Cala', 'Titanium', 'Hárspray', 'Svitavörn'];
     foreach ($gleraugu_subs as $sub) {
         $images = getImages(1);
         makeCategory(['title' => $sub, 'parent_id' => $gleraugu->id, 'images' => $images]);
     }
     foreach ($fatnadur_subs as $sub) {
         $images = getImages(1);
         makeCategory(['title' => $sub, 'parent_id' => $fatnadur->id, 'images' => $images]);
     }
     foreach ($snyrtivara_subs as $sub) {
         $images = getImages(1);
         makeCategory(['title' => $sub, 'parent_id' => $snyrtivara->id, 'images' => $images]);
     }
     for ($i = 0; $i < 50; $i++) {
         $images = getImages(8);
         makeProduct(['title' => $faker->sentence(3), 'category_id' => mt_rand(1, 8), 'images' => $images]);
     }
     Model::reguard();
 }
function createCollage($covers, $quality, $totalSize, $cols, $rows, $albumInfo, $playcount)
{
    switch ($quality) {
        case 0:
            $pixels = 34;
            break;
        case 1:
            $pixels = 64;
            break;
        case 2:
            $pixels = 126;
            break;
        case 3:
            $pixels = 300;
            break;
    }
    //Create blank image
    $canvas = imagecreatetruecolor($pixels * $cols, $pixels * $rows);
    //Set black colour.
    $backgroundColor = imagecolorallocate($canvas, 0, 0, 0);
    //Fill with black
    imagefill($canvas, 0, 0, $backgroundColor);
    //Note where cursor is.
    $coords['x'] = 0;
    $coords['y'] = 0;
    $i = 1;
    //Grab images with cURL method.
    $images = getImages($covers);
    //For each image returned, create image object and write text
    foreach ($images as $rawdata) {
        error_log("Album Processing: " . $rawdata['artist'] . " - " . $rawdata['album']);
        $image = imagecreatefromstring($rawdata['data']);
        if ($albumInfo || $playcount) {
            $font = "resources/NotoSansCJK-Regular.ttc";
            $white = imagecolorallocate($image, 255, 255, 255);
            $black = imagecolorallocate($image, 0, 0, 0);
            if ($albumInfo && $playcount) {
                imagettfstroketext($image, 10, 0, 5, 20, $white, $black, $font, $rawdata['artist'], 1);
                imagettfstroketext($image, 10, 0, 5, 32, $white, $black, $font, $rawdata['album'], 1);
                imagettfstroketext($image, 10, 0, 5, 44, $white, $black, $font, "Plays: " . $rawdata['playcount'], 1);
            } elseif ($albumInfo) {
                imagettfstroketext($image, 10, 0, 5, 20, $white, $black, $font, $rawdata['artist'], 1);
                imagettfstroketext($image, 10, 0, 5, 32, $white, $black, $font, $rawdata['album'], 1);
            } elseif ($playcount) {
                imagettfstroketext($image, 10, 0, 5, 20, $white, $black, $font, "Plays: " . $rawdata['playcount'], 1);
            }
        }
        imagecopy($canvas, $image, $coords['x'], $coords['y'], 0, 0, $pixels, $pixels);
        //Increase X coords each time
        $coords['x'] += $pixels;
        //If we've hit the side of the image, move down and reset x position.
        if ($i % $cols == 0) {
            $coords['y'] += 300;
            $coords['x'] = 0;
        }
        $i++;
    }
    return $canvas;
}
示例#22
0
function processRequestInput()
{
    global $user;
    $baseaccess = getContinuationVar('baseaccess', 0);
    $imagingaccess = getContinuationVar('imagingaccess', 0);
    $serveraccess = getContinuationVar('serveraccess', 0);
    $openend = getContinuationVar('openend', 0);
    $nousercheck = getContinuationVar('nousercheck', 0);
    $return['imaging'] = getContinuationVar('imaging', 0);
    $maxinitial = getContinuationVar('maxinitial', 0);
    $noimaging = getContinuationVar('noimaging', array());
    $return = array('err' => 0);
    # type
    $return['type'] = processInputVar('type', ARG_STRING);
    if (!preg_match('/^basic|imaging|server$/', $return['type'])) {
        $return['err'] = 1;
        $return['errmsg'] = i('Invalid data submitted');
        return $return;
    }
    if ($return['type'] == 'basic' && !$baseaccess || $return['type'] == 'imaging' && !$imagingaccess || $return['type'] == 'server' && !$serveraccess) {
        $return['err'] = 1;
        $return['errmsg'] = i('No access to submitted reservation type');
        return $return;
    }
    # ending
    $return['ending'] = processInputVar('ending', ARG_STRING);
    if (!preg_match('/^indefinite|endat|duration$/', $return['ending'])) {
        $return['err'] = 1;
        $return['errmsg'] = i('Invalid data submitted');
        return $return;
    }
    if ($return['ending'] == 'duration' && !$baseaccess || $return['ending'] == 'indefinite' && !$serveraccess || $return['ending'] == 'endat' && !$openend && !$serveraccess) {
        $return['err'] = 1;
        $return['errmsg'] = i('No access to submitted end type');
        return $return;
    }
    # imageid
    $return['imageid'] = processInputVar('imageid', ARG_NUMERIC);
    $resources = getUserResources(array("imageAdmin", "imageCheckOut"));
    $withnocheckout = $resources['image'];
    $images = removeNoCheckout($resources["image"]);
    $extraimages = getServerProfileImages($user['id']);
    if (!array_key_exists($return['imageid'], $images) && ($return['type'] != 'server' || !array_key_exists($return['imageid'], $extraimages)) && ($return['type'] != 'imaging' || !array_key_exists($return['imageid'], $withnocheckout)) || $return['type'] == 'imaging' && array_key_exists($return['imageid'], $noimaging)) {
        $return['err'] = 1;
        $return['errmsg'] = i('No access to submitted environment');
        return $return;
    }
    # nousercheck
    $return['nousercheck'] = processInputVar('nousercheck', ARG_NUMERIC);
    if (!$nousercheck || $return['nousercheck'] != 1) {
        $return['nousercheck'] = 0;
    }
    # revisionid
    $revids = processInputVar("revisionid", ARG_STRING);
    $revids = explode(':', $revids);
    $images = getImages(0, $return['imageid']);
    $return['revisionids'] = array();
    if (array_key_exists('subimages', $images[$return['imageid']])) {
        $subimages = $images[$return['imageid']]['subimages'];
        array_unshift($subimages, $return['imageid']);
        foreach ($subimages as $key => $imgid) {
            $revisions = getImageRevisions($imgid);
            if (!array_key_exists($key, $revids) || !is_numeric($revids[$key]) || !array_key_exists($revids[$key], $revisions)) {
                $revid = getProductionRevisionid($imgid);
            } else {
                $revid = $revids[$key];
            }
            if (!array_key_exists($imgid, $return['revisionids'])) {
                $return['revisionids'][$imgid] = array();
            }
            $return['revisionids'][$imgid][] = $revid;
        }
    } elseif ($revids[0] != '' && is_numeric($revids[0])) {
        $return['revisionids'][$return['imageid']][] = $revids[0];
    } else {
        $return['revisionids'][$return['imageid']][] = getProductionRevisionid($return['imageid']);
    }
    # duration
    if ($return['ending'] == 'duration') {
        $return['duration'] = processInputVar('duration', ARG_NUMERIC, 0);
        if ($return['duration'] > $maxinitial) {
            $return['duration'] = $maxinitial;
        }
    }
    # start/end
    $return['start'] = processInputVar('start', ARG_NUMERIC);
    $return['end'] = processInputVar('end', ARG_NUMERIC, 0);
    $now = time();
    if ($return['start'] == 0) {
        $start = $now;
    } else {
        $start = $return['start'];
    }
    if ($return['ending'] == 'endat') {
        $end = $return['end'];
    }
    if ($return['ending'] == 'indefinite') {
        $end = datetimeToUnix('2038-01-01 00:00:00');
    } elseif ($return['ending'] == 'duration') {
        $end = $start + $return['duration'] * 60;
    }
    if ($start < $now) {
        $return['err'] = 1;
        $return['errmsg'] = i('The submitted start time is in the past.');
        return $return;
    }
    if ($start + 900 > $end) {
        $return['err'] = 1;
        $return['errmsg'] = i('The end time must be at least 15 minutes later than the start time.');
        return $return;
    }
    $return['ipaddr'] = '';
    $return['macaddr'] = '';
    # server specific input
    if ($return['type'] == 'server') {
        # name
        $return['name'] = processInputVar('name', ARG_STRING);
        if (!preg_match('/^([-a-zA-Z0-9_\\. ]){0,255}$/', $return['name'])) {
            $return['err'] = 1;
            $return['errmsg'] = i('The reservation name can only contain letters, numbers, spaces, dashes(-), underscores(_), and periods(.) and can be up to 255 characters long');
            return $return;
        }
        # ipaddr
        $return['ipaddr'] = processInputVar('ipaddr', ARG_STRING);
        if ($return['ipaddr'] != '') {
            # validate fixed IP address
            if (!validateIPv4addr($return['ipaddr'])) {
                $return['err'] = 1;
                $return['errmsg'] = i('Invalid IP address. Must be w.x.y.z with each of w, x, y, and z being between 1 and 255 (inclusive)');
                return $return;
            }
            # validate netmask
            $return['netmask'] = processInputVar('netmask', ARG_STRING);
            $bnetmask = ip2long($return['netmask']);
            if (!preg_match('/^[1]+0[^1]+$/', sprintf('%032b', $bnetmask))) {
                $return['err'] = 1;
                $return['errmsg'] = i('Invalid netmask specified');
                return $return;
            }
            # validate router
            $return['router'] = processInputVar('router', ARG_STRING);
            if (!validateIPv4addr($return['router'])) {
                $return['err'] = 1;
                $return['errmsg'] = i('Invalid router address. Must be w.x.y.z with each of w, x, y, and z being between 1 and 255 (inclusive)');
                return $return;
            }
            $return['network'] = ip2long($return['ipaddr']) & $bnetmask;
            if ($return['network'] != (ip2long($return['router']) & $bnetmask)) {
                $return['err'] = 1;
                $return['errmsg'] = i('IP address and router are not on the same subnet based on the specified netmask.');
                return $return;
            }
            # validate dns server(s)
            $dns = processInputVar('dns', ARG_STRING);
            $tmp = explode(',', $dns);
            $cnt = 0;
            $return['dnsArr'] = array();
            foreach ($tmp as $dnsaddr) {
                if ($cnt && $dnsaddr == '') {
                    continue;
                }
                if ($cnt == 3) {
                    $return['err'] = 1;
                    $return['errmsg'] = i('Too many DNS servers specified - up to 3 are allowed.');
                    return $return;
                }
                if (!validateIPv4addr($dnsaddr)) {
                    $return['err'] = 1;
                    $return['errmsg'] = i('Invalid DNS server specified.');
                    return $return;
                }
                $return['dnsArr'][] = $dnsaddr;
                $cnt++;
            }
            # check that a management node can handle the network
            $mappedmns = getMnsFromImage($return['imageid']);
            $mnnets = checkAvailableNetworks($return['ipaddr']);
            $intersect = array_intersect($mappedmns, $mnnets);
            if (empty($intersect)) {
                $return['err'] = 1;
                $return['errmsg'] = i('There are no management nodes that can deploy the selected image with the specified IP address.');
                return $return;
            }
        }
        # macaddr
        $return['macaddr'] = processInputVar('macaddr', ARG_STRING);
        if ($return['macaddr'] != '' && !preg_match('/^(([A-Fa-f0-9]){2}:){5}([A-Fa-f0-9]){2}$/', $return['macaddr'])) {
            $return['err'] = 1;
            $return['errmsg'] = i('Invalid MAC address. Must be XX:XX:XX:XX:XX:XX with each pair of XX being from 00 to FF (inclusive)');
            return $return;
        }
        # profileid
        $return['profileid'] = processInputVar('profileid', ARG_NUMERIC, 0);
        $resources = getUserResources(array("serverCheckOut", "serverProfileAdmin"), array("available", "administer"));
        if (!array_key_exists($return['profileid'], $resources['serverprofile'])) {
            $return['profileid'] = 0;
        } elseif ($return['profileid'] != 0) {
            $tmp = getServerProfiles($return['profileid']);
            $tmp = $tmp[$return['profileid']];
            if ($tmp['imageid'] != $return['imageid'] && ($tmp['fixedIP'] != $return['ipaddr'] && $tmp['fixedMAC'] != $return['macaddr'] || $tmp['fixedIP'] == $return['ipaddr'] && $return['ipaddr'] == '' && $tmp['fixedMAC'] == $return['macaddr'] && $return['macaddr'] == '')) {
                $return['profileid'] = 0;
            }
        }
        # admingroupid
        $usergroups = getUserGroups();
        $return['admingroupid'] = processInputVar('admingroupid', ARG_NUMERIC);
        if ($return['admingroupid'] != 0 && !array_key_exists($return['admingroupid'], $usergroups)) {
            $return['err'] = 1;
            $return['errmsg'] = i('You do not have access to use the specified admin user group.');
            return $return;
        }
        # logingroupid
        $return['logingroupid'] = processInputVar('logingroupid', ARG_NUMERIC);
        if ($return['logingroupid'] != 0 && !array_key_exists($return['logingroupid'], $usergroups)) {
            $return['err'] = 1;
            $return['errmsg'] = i('You do not have access to use the specified access user group.');
            return $return;
        }
        # monitored
        $return['monitored'] = processInputVar('monitored', ARG_NUMERIC, 0);
        if ($return['monitored'] != 0 && $return['monitored'] != 1) {
            $return['monitored'] = 0;
        }
        # configs
        # TODO configs
        /*$tmp = getUserResources(array("configAdmin"));
        		$userconfigs = $tmp['config'];
        		$initconfigs = getMappedConfigs($return['imageid']);
        		if(array_key_exists('configdata', $_POST)) {
        			if(get_magic_quotes_gpc())
        				$_POST['configdata'] = stripslashes($_POST['configdata']);
        			$configdata = json_decode($_POST['configdata']);
        		}
        		if(array_key_exists('configdata', $_POST) &&
        			isset($configdata->configs))
        			$configs = $configdata->configs;
        		else
        			$configs = (object)array();
        		$return['configs'] = array();
        		foreach($initconfigs as $id => $config) {
        			if(isset($configs->{$id}) &&
        				isset($configs->{$id}->applied) &&
        			   $configs->{$config['id']}->applied != 'true' &&
        				$configs->{$config['id']}->applied != 'false')
        				unset($configs->{$config['id']});
        			if($config['optional'] &&
        			   (! isset($configs->{$id}) ||
        			   ! $configs->{$id}->applied))
        				continue;
        			$return['configs'][$id] = array('configid' => $config['configid'],
        			                                'configmapid' => $config['configmapid'],
        			                                'imageid' => $config['subimageid']);
        			if(isset($configs->{$id}))
        				unset($configs->{$id});
        		}
        		$rescfgmapids = array();
        		foreach($configs as $id => $config) {
        			if(! array_key_exists($config->configid, $userconfigs))
        				continue;
        			$return['configs'][$id] = array('configid' => $config->configid,
        			                                'configstageid' => $config->configstageid,
        			                                'imageid' => $config->imageid);
        			$tmp = explode('/', $id);
        			$rescfgmapids[$tmp[1]] = 1;
        		}
        
        		# configvars
        		$tmp = array_splice($initconfigs, 0);
        		$initconfigvars = getImageConfigVariables($tmp);
        		if(array_key_exists('configdata', $_POST) &&
        			isset($configdata->configvars))
        			$configvars = $configdata->configvars;
        		else
        			$configvars = (object)array();
        		#print "/*";
        		#printArray($initconfigvars);
        		#printArray($configvars);
        		#print "*" . "/";
        		$return['configvars'] = array();
        		foreach($initconfigvars as $id => $configvar) {
        			$tmp = explode('/', $id);
        			$cfgid = "{$tmp[0]}/{$tmp[1]}";
        			$varid = $tmp[2];
        			if($configvar['ask'] == 0 ||
        			   ! isset($configvars->{$id}) ||
        			   ! isset($configvars->{$id}->value)) {
        				$return['configvars'][$cfgid][$varid] =
        				         array('value' => $configvar['defaultvalue']);
        			}
        			else {
        				switch($configvar['datatype']) {
        					case 'bool':
        					case 'int':
        					case 'float':
        						$value = processInputData($configvars->{$id}->value, ARG_NUMERIC);
        						break;
        					default:
        						$value = processInputData($configvars->{$id}->value, ARG_STRING);
        						break;
        				}
        				$return['configvars'][$cfgid][$varid] = array('value' => $value);
        			}
        			if(isset($configvars->{$id}))
        				unset($configvars->{$id});
        		}*/
        /*print "/*";
        		printArray($rescfgmapids);
        		foreach($configvars as $id => $var) {
        			$cfgid = explode('/', $id);
        			print "cfgid: {$cfgid[1]}\n";
        			if(! array_key_exists($cfgid[1], $rescfgmapids))
        				continue;
        			// TODO validate based on var type
        			$value = processInputData($configvars->{$id}->value, ARG_STRING);
        			$return['configvars']["{$cfgid[0]}/{$cfgid[1]}"][$cfgid[2]] = array('value' => $value);
        		}
        		printArray($configvars);*/
        #print "*/";
    }
    return $return;
}
示例#23
0
文件: sujet.php 项目: aurelienshz/g1a
$contents['id_auteur'] = $membre['id_auteur'];
$images = getImages($membre['id_auteur']);
$contents['lien'] = $images['lien'];
$contents['id_auteur'] = $membre['id_auteur'];
$nombre = getNombre($contents['id_auteur']);
$contents['COUNT(*)'] = $nombre['COUNT(*)'];
// FIN INFO TOPIC
// INFO REPONSES
$comments = getComments($id);
$contents['comments'] = $comments;
// FIN INFO REPONSES
if (connected()) {
    $id_user = $_SESSION['id'];
    $userDetails = getUserDetails($id_user)['pseudo'];
    $contents['pseudo1'] = $userDetails;
    $userImage = getImages($id_user);
    $contents['lien1'] = $userImage['lien'];
}
/**** Préparation de la vue ****/
$title = $titre['titre'];
$styles = ['forum.css', 'search.css'];
/**** Affichage de la page ****/
//Appel de la vue :
if (empty($_POST)) {
    // Le formulaire n'a pas été rempli
    vue(['sujet'], $styles, $title, $contents);
} else {
    if ($_POST['contenu']) {
        if (connected()) {
            insertMessage($_POST['contenu'], $id, $id_user);
            header('Location: ' . getLink(['forum', 'sujet', $id, 0]));
示例#24
0
<?php

$dockerRegistryDomain = 'registry.localserver.com:5443/';
$dockerRegistryPush = "{$dockerRegistryDomain}v2/";
$userName = '******';
$password = '******';
$email = '*****@*****.**';
echo login($dockerRegistryDomain, $userName, $password, $email);
echo PHP_EOL;
foreach (getImages() as $image) {
    echo $image;
    echo PHP_EOL;
    echo tag($image, $dockerRegistryPush);
    echo PHP_EOL;
    echo push($image, $dockerRegistryPush);
    echo PHP_EOL;
}
function login($registry, $userName, $password, $email = '')
{
    return myExec(sprintf('docker login --username="******" --password="******" --email="%s" %s', $userName, $password, $email, $registry));
}
function tag($imageName, $registry = 'my-registry.com:5000/')
{
    if (preg_match("~{$registry}~i", $imageName)) {
        return "skip\n";
    }
    return myExec(sprintf('docker tag %s %s%s', $imageName, $registry, $imageName));
}
function push($imageName, $registry = 'my-registry.com:5000/')
{
    $registry = preg_match("~{$registry}~i", $imageName) ? $imageName : $registry . $imageName;
示例#25
0
        }
        // check for image files
        $f = escapeshellarg("{$fulldir}{$entry}");
        $mimetype = trim(`file -bi {$f}`);
        foreach ($imagetypes as $valid_type) {
            if (preg_match("@^{$valid_type}@", $mimetype)) {
                $retval[] = array('file' => "/{$dir}{$entry}", 'size' => getimagesize("{$fulldir}{$entry}"));
                break;
            }
        }
    }
    $d->close();
    return $retval;
}
// fetch image details
$images = getImages("FamilyFileShare/uploads/");
$width = "100";
$height = "200";
$bestFit = "true";
// display on page
foreach ($images as $img) {
    echo "<div class=\"photo\">";
    echo "<img height=1000 width=970 src=\"{$img['file']}\" {$img['size'][3]} alt=\"\"> <br>\n";
    // display image file name as link
    echo "<a href=\"{$img['file']}\">", basename($img['file']), "</a><br>\n";
    // display image dimenstions
    echo "({$img['size'][0]} x {$img['size'][1]} pixels)<br>\n";
    // display mime_type
    echo $img['size']['mime'];
    echo "<a href=./del_image.php?img_del=", basename($img['file']), ">", "\n\n Delete", "</a><br>\n";
    echo "</div>\n";
示例#26
0
function listPictures($categoryid)
{
    global $db;
    if ($categoryid == 0) {
        return;
    }
    $c = getCategory((int) $categoryid);
    return getImages($c['uniqid']);
}
示例#27
0
function processBlockAllocationInput()
{
    global $user;
    $return = array();
    $method = getContinuationVar('method');
    $return['name'] = processInputVar('name', ARG_STRING);
    $return['owner'] = processInputVar('owner', ARG_STRING);
    $return['imageid'] = processInputVar('imageid', ARG_NUMERIC);
    $return['seats'] = processInputVar('seats', ARG_NUMERIC);
    $return['groupid'] = processInputVar('groupid', ARG_NUMERIC);
    $override = getContinuationVar('override', 0);
    $type = processInputVar('type', ARG_STRING);
    $err = 0;
    if ($method != 'request' && !preg_match('/^([-a-zA-Z0-9\\. \\(\\)]){3,80}$/', $return['name'])) {
        $errmsg = i("The name can only contain letters, numbers, spaces, dashes(-), and periods(.) and can be from 3 to 80 characters long");
        $err = 1;
    }
    $resources = getUserResources(array("imageAdmin", "imageCheckOut"));
    $resources["image"] = removeNoCheckout($resources["image"]);
    if (!array_key_exists($return['imageid'], $resources['image'])) {
        $errmsg = i("The submitted image is invalid.");
        $err = 1;
    }
    if (!$err && $method != 'request' && !validateUserid($return['owner'])) {
        $errmsg = i("The submitted owner is invalid.");
        $err = 1;
    } else {
        $return['ownerid'] = getUserlistID($return['owner']);
    }
    $groups = getUserGroups(0, $user['affiliationid']);
    $extragroups = getContinuationVar('extragroups');
    if (!$err && !array_key_exists($return['groupid'], $groups) && !array_key_exists($return['groupid'], $extragroups) && $return['groupid'] != 0) {
        $errmsg = i("The submitted user group is invalid.");
        $err = 1;
    }
    if (!$err && $return['groupid'] == 0) {
        $return['groupid'] = 'NULL';
    }
    if (!$err && ($return['seats'] < MIN_BLOCK_MACHINES || $return['seats'] > MAX_BLOCK_MACHINES)) {
        $errmsg = sprintf(i("The submitted number of seats must be between %d and %d."), MIN_BLOCK_MACHINES, MAX_BLOCK_MACHINES);
        $err = 1;
    }
    if (!$err) {
        $imgdata = getImages(0, $return['imageid']);
        $concur = $imgdata[$return['imageid']]['maxconcurrent'];
        if (!is_null($concur) && $concur != 0 && $return['seats'] > $concur) {
            $errmsg = sprintf(i("The selected image can only have %d concurrent reservations. Please reduce the number of requested seats to %d or less."), $concur, $concur);
            $err = 1;
        }
    }
    $dooverride = 0;
    # check user group access to image
    if (($method == 'new' || $method == 'edit') && !$err && !$override) {
        $groupresources = getUserResources(array("imageAdmin", "imageCheckOut"), array("available"), 0, 0, 0, $return['groupid']);
        if (!array_key_exists($return['imageid'], $groupresources['image'])) {
            $dooverride = 1;
            $errmsg = i("WARNING - The selected user group does not currently have access to the selected environment. You can submit the Block Allocation again to ignore this warning.");
            $err = 1;
        }
    }
    if (!$err && $type != 'weekly' && $type != 'monthly' && $type != 'list') {
        $errmsg = i("You must select one of \"Repeating Weekly\", \"Repeating Monthly\", or \"List of Dates/Times\".");
        $err = 1;
    }
    if (!$err) {
        if ($type == 'list') {
            $slots = processInputVar('slots', ARG_STRING);
            $return['slots'] = explode(',', $slots);
            $return['times'] = array();
            $lastdate = array('day' => '', 'ts' => 0);
            foreach ($return['slots'] as $slot) {
                $tmp = explode('|', $slot);
                if (count($tmp) != 3) {
                    $errmsg = i("Invalid date/time submitted.");
                    $err = 1;
                    break;
                }
                $date = $tmp[0];
                if (!$err) {
                    $datets = strtotime($date);
                    if ($method != 'edit' && $datets < time() - SECINDAY) {
                        $errmsg = i("The date must be today or later.");
                        $err = 1;
                        break;
                    }
                }
                $return['times'][] = "{$tmp[1]}|{$tmp[2]}";
                if ($datets > $lastdate['ts']) {
                    $lastdate['ts'] = $datets;
                    $lastdate['day'] = $date;
                }
            }
            if (!$err) {
                $expirets = strtotime("{$lastdate['day']} 23:59:59");
                $return['expiretime'] = unixToDatetime($expirets);
            }
        }
        if ($type == 'weekly' || $type == 'monthly') {
            $return['startdate'] = processInputVar('startdate', ARG_NUMERIC);
            $return['enddate'] = processInputVar('enddate', ARG_NUMERIC);
            $times = processInputVar('times', ARG_STRING);
            $return['startts'] = strtotime($return['startdate']);
            $return['endts'] = strtotime($return['enddate']);
            if ($return['startts'] > $return['endts']) {
                $errmsg = i("The Last Date of Usage must be the same or later than the First Date of Usage.");
                $err = 1;
            } elseif ($method != 'edit' && $return['startts'] < time() - SECINDAY) {
                $errmsg = i("The start date must be today or later.");
                $err = 1;
            }
            $expirets = strtotime("{$return['enddate']} 23:59:59");
            $return['expiretime'] = unixToDatetime($expirets);
            $return['times'] = explode(',', $times);
        }
        foreach ($return['times'] as $time) {
            $tmp = explode('|', $time);
            if (count($tmp) != 2) {
                $errmsg = i("Invalid start/end time submitted");
                $err = 1;
                break;
            }
            $start = explode(':', $tmp[0]);
            if (count($start) != 2 || !is_numeric($start[0]) || !is_numeric($start[1]) || $start[0] < 0 || $start[0] > 23 || $start[1] < 0 || $start[1] > 59) {
                $errmsg = i("Invalid start time submitted");
                $err = 1;
                break;
            }
            $end = explode(':', $tmp[1]);
            if (count($end) != 2 || !is_numeric($end[0]) || !is_numeric($end[1]) || $end[0] < 0 || $end[0] > 23 || $end[1] < 0 || $end[1] > 59) {
                $errmsg = i("Invalid end time submitted");
                $err = 1;
                break;
            }
            $start = minuteOfDay($start[0], $start[1]);
            $end = minuteOfDay($end[0], $end[1]);
            if ($start >= $end) {
                $errmsg = i("Each start time must be less than the corresponding end time.");
                $err = 1;
                break;
            }
        }
        if ($type == 'weekly') {
            $validdays = 0;
            $errmsg = '';
            for ($day = $return['startts'], $i = 0; $i < 7, $day < $return['endts'] + SECINDAY; $i++, $day += SECINDAY) {
                $daynum = date('w', $day);
                $validdays |= 1 << $daynum;
            }
            $days = processInputVar('days', ARG_STRING);
            $dayscheck = processInputVar('days', ARG_NUMERIC);
            if ($days == '' && $dayscheck == '0') {
                $days = 0;
            }
            $return['daymask'] = 0;
            if (!$err) {
                foreach (explode(',', $days) as $day) {
                    if ($day == '' || $day < 0 || $day > 6) {
                        $errmsg = i("Invalid day submitted.");
                        $err = 1;
                        break;
                    }
                    $return['daymask'] |= 1 << $day;
                }
            }
            if (!$err && ($return['daymask'] & $validdays) == 0) {
                $errmsg = i("No valid days submitted for the specified date range.");
                $err = 1;
            }
        }
        if ($type == 'monthly') {
            $return['weeknum'] = processInputVar('weeknum', ARG_NUMERIC);
            $return['day'] = processInputVar('day', ARG_NUMERIC);
            if (!$err && ($return['weeknum'] < 1 || $return['weeknum'] > 5)) {
                $errmsg = i("Invalid week number submitted.");
                $err = 1;
            }
            if (!$err && ($return['day'] < 1 || $return['day'] > 7)) {
                $errmsg = i("Invalid day of week submitted.");
                $err = 1;
            }
            $times = getMonthlyBlockTimes('', $return['startts'], $return['endts'], $return['day'], $return['weeknum'], $return['times']);
            if (!$err && empty($times)) {
                $errmsg = i("Specified day of month not found in date range.");
                $err = 1;
            }
        }
    }
    if ($method == 'request') {
        $return['comments'] = processInputVar('comments', ARG_STRING);
        if (get_magic_quotes_gpc()) {
            $return['comments'] = stripslashes($return['comments']);
        }
        if (!$err && preg_match('/[<>]/', $return['comments'])) {
            $errmsg = i("<>\\'s are not allowed in the comments.");
            $err = 1;
        }
    }
    if ($err) {
        print "clearHideConfirmForm();";
        print "alert('{$errmsg}');";
        $data = array('extragroups' => $extragroups, 'method' => $method);
        if ($method == 'edit') {
            $data['blockid'] = getContinuationVar('blockid');
        }
        $cont = addContinuationsEntry('AJblockAllocationSubmit', $data, SECINWEEK, 1, 0);
        print "dojo.byId('submitcont').value = '{$cont}';";
        if ($dooverride) {
            $data['override'] = 1;
            $cont = addContinuationsEntry('AJblockAllocationSubmit', $data, SECINWEEK, 1, 0);
            print "dojo.byId('submitcont2').value = '{$cont}';";
        } else {
            print "dojo.byId('submitcont2').value = '';";
        }
    }
    $return['type'] = $type;
    $return['err'] = $err;
    return $return;
}
示例#28
0
        $y['path'] = $_SESSION['serverUrl'] . $y['path'];
        $nara[] = $y;
    }
    return $nara;
}
$id = $_GET['id'];
$result = mysqli_query($con, "select * from events where id = '{$id}' order by date desc") or die(mysqli_error($con));
$ara = array();
while ($x = mysqli_fetch_array($result)) {
    $sara = array();
    $sara['id'] = $x['id'];
    $sara['name'] = $x['name'];
    $sara['description'] = $x['description'];
    $sara['date'] = $x['date'];
    $sara['place'] = $x['place'];
    $sara['images'] = getImages($x['id'], $con);
    array_push($ara, $sara);
}
$title = $ara[0]['name'];
$description = $ara[0]['description'];
$image = $ara[0]['images'][0]['path'];
?>

<html>
	<head>

   		<meta property="fb:app_id" content="807373209363035" /> 
	    <meta property="og:title" content="<?php 
echo $ara[0]['name'];
?>
 - Rotaract Club V.V.P." />
示例#29
0
function fixImageURL(&$html, &$did)
{
    $images = getImages($html);
    $imgs = array_unique($images[1]);
    foreach ($imgs as $img) {
        $html = str_replace($img, fixurl($img), $html);
        //print_r($did);
        if (!in_array($img, $did)) {
            $base64 = image_base64_encode($img);
            if ($base64) {
                echo "<img><src><![CDATA[";
                echo fixurl($img);
                echo "]]></src><base64><![CDATA[";
                echo $base64;
                echo "]]></base64></img>";
            }
            array_push($did, $img);
        }
    }
}
示例#30
0
 function AJreloadComputers()
 {
     $imageid = processInputVar('imageid', ARG_NUMERIC);
     $resources = getUserResources(array("imageAdmin", "imageCheckOut"));
     if (!array_key_exists($imageid, $resources['image'])) {
         $ret = array('status' => 'noaccess');
         sendJSON($ret);
         return;
     }
     $compids = $this->validateCompIDs();
     if (array_key_exists('error', $compids)) {
         $ret = array('status' => 'error', 'errormsg' => $compids['msg']);
         sendJSON($ret);
         return;
     }
     if (count($compids) == 0) {
         $ret = array('status' => 'noaction');
         sendJSON($ret);
         return;
     }
     $computers = $this->getData($this->defaultGetDataArgs);
     $imagedata = getImages(0, $imageid);
     $reloadnow = array();
     $reloadasap = array();
     $noreload = array();
     foreach ($compids as $compid) {
         switch ($computers[$compid]['state']) {
             case "available":
             case "failed":
             case "reloading":
                 $reloadnow[] = $compid;
                 break;
             case "inuse":
             case "timeout":
             case "reserved":
                 $reloadasap[] = $compid;
                 break;
             case "maintenance":
                 $noreload[] = $compid;
                 break;
             default:
                 $noreload[] = $compid;
                 break;
         }
     }
     $msg = '';
     if (count($reloadnow)) {
         $msg .= "The following computers will be immediately reloaded with ";
         $msg .= "<strong>{$imagedata[$imageid]['prettyname']}</strong>:<br>\n";
         foreach ($reloadnow as $compid) {
             $msg .= "<span class=\"ready\">{$computers[$compid]['hostname']}</span><br>\n";
         }
         $msg .= "<br>\n";
     }
     if (count($reloadasap)) {
         $msg .= "The following computers are currently in use and will have ";
         $msg .= "<strong>{$imagedata[$imageid]['prettyname']}</strong> set as ";
         $msg .= "a priority for reloading at the end of the existing reservation ";
         $msg .= "on each node:<br>\n";
         foreach ($reloadasap as $compid) {
             $msg .= "<span class=\"wait\">{$computers[$compid]['hostname']}</span><br>\n";
         }
         $msg .= "<br>\n";
     }
     if (count($noreload)) {
         $msg .= "The following computers are currently in the maintenance ";
         $msg .= "state and therefore will have nothing done to them:<br>\n";
         foreach ($noreload as $compid) {
             $msg .= "<span class=\"rederrormsg\">{$computers[$compid]['hostname']}</span><br>\n";
         }
         $msg .= "<br>\n";
     }
     $cdata = $this->basecdata;
     $cdata['imageid'] = $imageid;
     $cdata['imagename'] = $imagedata[$imageid]['prettyname'];
     $cdata['compids'] = $compids;
     $ret = array('status' => 'success', 'title' => "Reload Computers", 'btntxt' => 'Reload Computers', 'actionmsg' => $msg);
     if (count($reloadnow) || count($reloadasap)) {
         $cont = addContinuationsEntry('AJsubmitReloadComputers', $cdata, SECINDAY, 1, 0);
         $ret['cont'] = $cont;
     } else {
         $ret['cont'] = '';
         $ret['disablesubmit'] = 1;
     }
     sendJSON($ret);
 }