Inheritance: extends Widget
Exemple #1
0
 function showImage()
 {
     $il = new ImageList($this->image, $this->portfolio_id, $this);
     $this->elementStart('a', array('href' => common_local_url('imageview', array('image_id' => $this->image->id, 'portfolio_id' => $this->portfolio_id, 'nickname' => $this->nickname))));
     $il->showImage('original');
     $this->elementEnd('a');
 }
Exemple #2
0
 function showPortfolioList()
 {
     $this->element('h2', null, 'ImageList');
     $imagelist = $this->portfolio->getImageList(0, null, 0);
     if ($imagelist) {
         $il = new ImageList($imagelist, $this->portfolio->id, $this);
         $il->show(150);
     }
 }
 public function render()
 {
     $list = new ImageList();
     $list->setHidden('Id');
     if (!$this->isFullscreen()) {
         $list->setHidden('TimeCreated');
         $list->setHidden('LastModified');
         $list->setHidden('InUse');
     }
     $list->render();
 }
Exemple #4
0
" />
        <input type="submit" class="button" name="approve" value="<?php 
    echo $translator->trans('Approve selected', array(), 'media_archive');
    ?>
" />
        <input type="submit" class="button" name="disapprove" value="<?php 
    echo $translator->trans('Disapprove selected', array(), 'media_archive');
    ?>
" />
    <?php 
}
?>
    </fieldset>

    <?php 
$list = new ImageList();
$list->setSearch(TRUE);
$list->render();
?>
</div><!-- /#images -->

<div id="slideshows">
<?php 
$limit = 25;
$paginator = Zend_Paginator::factory($this->_helper->service('package')->getCountBy(array()));
$paginator->setItemCountPerPage($limit);
$paginator->setCurrentPageNumber(1);
echo $this->view->partial('slideshow-list.phtml', array('slideshows' => $this->view->slideshowsJson($this->_helper->service('package')->findBy(array(), array('id' => 'desc'), $limit, 0)), 'pages' => $paginator->count(), 'articlePage' => false));
?>
</div>
    $sql_where = "(moderation_status = 2)";
    $sql_order = "gridimage_id asc";
}
if (isset($_GET['xmas'])) {
    $ii = $db->getAll("select gridsquare_id from gridimage as gi where imageclass like '%christmas%' and moderation_status = 'pending' and submitted > date_sub(now(),interval 1 day) limit 10");
    foreach ($ii as $i => $row) {
        $db->Execute("REPLACE INTO gridsquare_moderation_lock SET user_id = {$USER->user_id}, gridsquare_id = {$row['gridsquare_id']}");
    }
    $sql_where .= " AND (lock_type = 'modding' OR imageclass like '%christmas%')";
}
$sql = "select gi.*,grid_reference,user.realname,imagecount {$sql_columns}\nfrom \n\tgridimage as gi\n\tinner join gridsquare as gs\n\t\tusing(gridsquare_id)\n\t{$sql_from}\n\tleft join gridsquare_moderation_lock as l\n\t\ton(gi.gridsquare_id=l.gridsquare_id and lock_obtained > date_sub(NOW(),INTERVAL 1 HOUR) )\n\tinner join user\n\t\ton(gi.user_id=user.user_id)\nwhere\n\t{$sql_where}\n\t{$sql_where2}\ngroup by gridimage_id\norder by\n\t{$sql_order}\nlimit {$limit}";
//implied: and user_id != {$USER->user_id}
// -> because squares with users images are locked
#############################
# fetch the list of images...
$images = new ImageList();
$c = $images->_getImagesBySql($sql);
$realname = array();
foreach ($images->images as $i => $image) {
    $token = new Token();
    $fix6fig = 0;
    if ($image->use6fig && ($image->natgrlen > 6 || $image->viewpoint_grlen > 6)) {
        $fix6fig = 1;
        $images->images[$i]->use6fig = 0;
    }
    $token->setValue("g", $images->images[$i]->getSubjectGridref(true));
    if ($image->viewpoint_eastings) {
        //note $image DOESNT work non php4, must use $images->images[$i]
        //move the photographer into the center to match the same done for the subject
        $correction = $images->images[$i]->viewpoint_grlen > 4 ? 0 : 500;
        $images->images[$i]->distance = sprintf("%0.2f", sqrt(pow($images->images[$i]->grid_square->nateastings - $images->images[$i]->viewpoint_eastings - $correction, 2) + pow($images->images[$i]->grid_square->natnorthings - $images->images[$i]->viewpoint_northings - $correction, 2)) / 1000);
     header("HTTP/1.0 404 Not Found");
     header("Status: 404 Not Found");
     $smarty->display('static_404.tpl');
     exit;
 }
 $profile->getStats();
 if ($uid == $USER->user_id) {
     $profile->countTickets();
     $USER->tickets = $profile->tickets;
     $USER->last_ticket_time = $profile->last_ticket_time;
     if (!empty($_SESSION['last_ticket_time']) && $profile->last_ticket_time <= $_SESSION['last_ticket_time']) {
         $profile->tickets = 0;
     }
 }
 $smarty->assign_by_ref('profile', $profile);
 $images = new ImageList();
 if ($uid == $USER->user_id || $USER->hasPerm('moderator')) {
     if (isset($_GET['reject']) && empty($_GET['reject'])) {
         $statuses = array('pending', 'accepted', 'geograph');
     } else {
         $statuses = '';
         //all
     }
 } else {
     $statuses = array('accepted', 'geograph');
 }
 $images->getImagesByUser($uid, $statuses, 'gridimage_id desc', $limit, true);
 $images->assignSmarty($smarty, 'userimages');
 if (count($images->images) == $limit) {
     $smarty->assign('limit', $limit);
 }
Exemple #7
0
 $sphinx->pageSize = 15;
 if (isset($_GET['takenfrom'])) {
     $ids = $sphinx->returnIdsViewpoint($square->getNatEastings(), $square->getNatNorthings(), $square->reference_index, $square->grid_reference);
     $smarty->assign('viewpoint_query', $sphinx->q);
     $viewpoint_count = 0;
     //set this to zero to suppress the prompt!
     $smarty->assign('mode', 'takenfrom');
 } else {
     $sphinx->prepareQuery("{$square->grid_reference} -grid_reference:{$square->grid_reference}");
     $ids = $sphinx->returnIds(1, "_images");
     $smarty->assign('mode', 'mentioning');
     $mention_count = 0;
     //set this to zero to suppress the prompt!
 }
 if (!empty($ids) && count($ids)) {
     $images = new ImageList();
     $images->getImagesByIdList($ids);
     $square->totalimagecount = $sphinx->resultCount;
     //otherwise, lets gether the info we need to display some thumbs
     if ($square->totalimagecount) {
         $smarty->assign_by_ref('images', $images->images);
     }
     $smarty->assign('totalimagecount', $sphinx->resultCount);
     $smarty->assign('imagecount', $sphinx->resultCount);
     if ($square->totalimagecount < 10 || $USER->registered && !empty($_GET['big'])) {
         $smarty->assign('thumbw', 213);
         $smarty->assign('thumbh', 160);
     } else {
         $smarty->assign('thumbw', 120);
         $smarty->assign('thumbh', 120);
     }
        if ($pg < 10 && $offset < 250 && $images->numberOfPages > $pg) {
            $next = $pg + 1;
            $rss->nextURL = "http://{$_SERVER['HTTP_HOST']}/feed/results/" . $_GET['i'] . ($next > 1 ? "/{$next}" : '') . "." . strtolower($format);
        }
        $rss->icon = "http://{$CONF['STATIC_HOST']}/templates/basic/img/logo.gif";
    }
    $images->images =& $images->results;
    /**
     * A user specific feed
     */
} elseif (isset($_GET['u']) && is_numeric($_GET['u'])) {
    $profile = new GeographUser($_GET['u']);
    $rss->description = 'Latest Images by ' . $profile->realname;
    $rss->syndicationURL = "http://{$_SERVER['HTTP_HOST']}/profile/" . intval($_GET['u']) . "/feed/recent." . strtolower($format);
    //lets find some recent photos
    $images = new ImageList();
    $images->getImagesByUser($_GET['u'], array('accepted', 'geograph'), 'gridimage_id desc', 15, false);
    /**
     * general feed of all images
     */
} else {
    $rss->description = 'Latest Images';
    $rss->syndicationURL = "http://{$_SERVER['HTTP_HOST']}/feed/recent." . strtolower($format);
    //lets find some recent photos
    $images = new ImageList(array('accepted', 'geograph'), 'gridimage_id desc', 15);
}
$cnt = count($images->images);
$geoformat = $format == 'KML' || $format == 'GeoRSS' || $format == 'GeoPhotoRSS' || $format == 'GPX' || $format == 'MEDIA';
$photoformat = $format == 'KML' || $format == 'GeoPhotoRSS' || $format == 'BASE' || $format == 'MEDIA';
//create some feed items
for ($i = 0; $i < $cnt; $i++) {
function makefile($prefix = 'TQ')
{
    //assign local filename
    $csvfilename = 'memorymap/geograph' . $prefix . '.csv';
    //get age of file, if new enough, go back
    if (file_exists($csvfilename)) {
        $fileage = time() - filemtime($csvfilename);
        //If it's new enough already, just serve it as is (TIME HERE IN SECONDS)
        if ($fileage < 3600) {
            return '';
        }
    }
    //OK, file must be too old, or not exist, let's make a shiny new one
    if (file_exists($csvfilename)) {
        if (!@unlink($csvfilename)) {
            return "Something is wrong, could not delete {$csvfile}." . " Click <a href=\"{$csvfilename}\">here to try to download a stale copy";
        }
    }
    if (!($csvfile = fopen($csvfilename, 'w'))) {
        return "Something is wrong, could not open {$csvfile} for writing.";
    }
    $images = new ImageList();
    $recordSet =& $images->getRecordSetbyPrefix($prefix);
    //Memory Map header, define geograph.bmp as icon #800
    fwrite($csvfile, "IC01,800,\"geograph.bmp\"\n");
    while (!$recordSet->EOF) {
        $image = $recordSet->fields;
        //limit decimal places
        $lat = sprintf("%.6f", $image['wgs84_lat']);
        $long = sprintf("%.6f", $image['wgs84_long']);
        //avoid problems with stray commas
        if (strpos($image['title'], ',') !== FALSE || strpos($image['title'], '"') !== FALSE) {
            $image['title'] = '"' . str_replace('"', '""', $image['title']) . '"';
        }
        //WP04,Lat,Lon,Symbol,Name,Comment,File,Radius,Display,Unique,Visible,Locked,Category,Circle
        fwrite($csvfile, "WP04,{$lat},{$long},800,{$image['title']},,http://{$_SERVER['HTTP_HOST']}/photo/{$image['gridimage_id']},0,1,{$image['grid_reference']},1,1,Geographs,0\r\n");
        $recordSet->MoveNext();
    }
    $recordSet->Close();
    fclose($csvfile);
    return '';
}
Exemple #10
0
    exit;
}
require dirname(__FILE__) . "/../../classes/utils/CDatabaza.php";
require dirname(__FILE__) . "/../../classes/utils/UserRights.php";
$data = CDatabaza::getInstance();
if (!$data) {
    exit("Nemozem sa pripojit na databazu");
}
$data->connect();
$user = new UserRights($data, $_COOKIE['user']);
$clanok = $data->escape_string($_GET['article_id']);
$sql = "SELECT * FROM Clanok_uzivatel WHERE clanok_id={$clanok} AND uzivatel_id=" . $_COOKIE['user'];
$query = $data->query($sql);
if (!$query) {
    echo "Chyba v pripojení na databázu";
    $data->close();
    exit;
}
if (!$query->num_rows && !$user->approved('EDIT_ALL')) {
    echo "Nemáte oprávnenie na prezeranie obsahu. Prístup zamietnutý.";
    $data->close();
    exit;
}
$data->close();
require_once dirname(__FILE__) . '/classes/ImageList.php';
$images = new ImageList(dirname(__FILE__) . "/../../..", $_GET['article_id']);
$images->display();
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
Exemple #11
0
 function handleUserTimeline()
 {
     $uid = intval($this->params[0]);
     $_GET['key'] = $this->params[1];
     $profile = new GeographUser($uid);
     if ($profile->realname) {
         header("Content-Type:text/xml");
         echo "<data>\n";
         $images = new ImageList();
         $images->getImagesByUser($uid, array('accepted', 'geograph'), 'RAND()', 200);
         foreach ($images->images as $i => $image) {
             if (!preg_match('/00(-|$)/', $image->imagetaken)) {
                 $bits = explode('-', $image->imagetaken);
                 $date = mktime(0, 0, 0, $bits[1], $bits[2], $bits[0]);
                 printf("\t<event start=\"%s\" title=\"%s\">%s &lt;b&gt;%s&lt;/b&gt;&lt;br/&gt; %s</event>\n", date('M d Y 00:00:00', $date) . ' GMT', htmlentities2($image->title), htmlentities("<a href=\"/photo/{$image->gridimage_id}\">" . $image->getThumbnail(120, 120) . "</a>"), $image->grid_reference, htmlentities2(GeographLinks($image->comment)));
             }
         }
         echo "</data>\n";
     } else {
         $this->error("Invalid User id {$uid}");
     }
 }
    }
}
$ab = floor($USER->user_id / 10000);
$cacheid = "user{$ab}|{$USER->user_id}|{$max_gridimage_id}";
//what style should we use?
$style = $USER->getStyle();
if ($smarty->caching) {
    $smarty->caching = 2;
    // lifetime is per cache
    $smarty->cache_lifetime = 300;
    customExpiresHeader(300, false, true);
}
$smarty->assign('maincontentclass', 'content_photo' . $style);
//regenerate?
if (!$smarty->is_cached($template, $cacheid)) {
    $imagelist = new ImageList();
    $sql = "select gi.*,grid_reference " . "from gridimage as gi " . "inner join gridsquare as gs using(gridsquare_id) " . "where moderation_status != 'rejected' " . "and gi.user_id={$USER->user_id} " . ($max_gridimage_id ? " and gridimage_id < {$max_gridimage_id} " : '') . "order by gridimage_id desc limit 20";
    $imagelist->_getImagesBySql($sql);
    if (count($imagelist->images)) {
        foreach ($imagelist->images as $i => $image) {
            $imagelist->images[$i]->imagetakenString = getFormattedDate($image->imagetaken);
        }
        $smarty->assign_by_ref('images', $imagelist->images);
        $first = $imagelist->images[0];
        $smarty->assign('criteria', $first->submitted);
        $last = $imagelist->images[count($imagelist->images) - 1];
        $max_gridimage_id = $last->gridimage_id;
        $count++;
        if ($count < 10 && count($imagelist->images) == 20) {
            $token = new Token();
            $token->setValue("id", intval($max_gridimage_id));