public function createNewEvent($writeUpdate = true)
 {
     $models = $this->createModels();
     $location = Location::create_from_string($this->location);
     // Check for existing gallery
     $existingGallery = Gallery::get()->filter(array('Location.PlaceID' => $location->PlaceID))->first();
     // If existing gallery, don't create a new one
     if ($existingGallery) {
         $location = $existingGallery->Location();
         $models['Gallery'] = $existingGallery;
     } else {
         // Write location to database
         $location->write();
         // Write gallery to database
         $models['Gallery']->update(array('LocationID' => $location->ID))->write();
     }
     // Write event to database
     $models['Event']->update(array('GalleryID' => $models['Gallery']->ID))->write();
     // Link event
     $this->update(array('EventID' => $models['Event']->ID, 'State' => 'Merged'));
     if ($writeUpdate) {
         $this->write();
     }
     return $this->Event();
 }
Ejemplo n.º 2
0
 private static function generate_data_for_day(SS_Datetime $date)
 {
     $data = array('timestamp' => time(), 'searchDate' => $date->Format("Y-m-d"), 'collections' => array('events' => array(), 'galleries' => array(), 'locations' => array()));
     $galleryIDs = array();
     $locationIDs = array();
     // Get events
     $where = sprintf("DATE(`StartDate`) = '%s'", $date->Format('Y-m-d'));
     $events = Event::get()->where($where)->exclude(array("GalleryID" => 0, "Gallery.LocationID" => 0));
     foreach ($events as $event) {
         $galleryIDs[] = $event->GalleryID;
         $data['collections']['events'][] = $event->forAPI();
     }
     // Get galleries
     $galleries = Gallery::get()->byIDs(array_unique($galleryIDs));
     foreach ($galleries as $gallery) {
         $locationIDs[] = $gallery->LocationID;
         $data['collections']['galleries'][] = $gallery->forAPI();
     }
     // Get locations
     $locations = Location::get()->byIDs(array_unique($locationIDs));
     foreach ($locations as $location) {
         $data['collections']['locations'][] = $location->forAPI();
     }
     return $data;
 }
 public function getGallery()
 {
     $params = $this->getURLParams();
     $galleryID = (int) $params['ID'];
     $gallery = Gallery::get()->filter(array('ID' => $galleryID))->first();
     return $this->renderWith('Gallery', $gallery);
 }
Ejemplo n.º 4
0
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $fields->removeByName('EventSource');
     // galleries field
     $galleries = function () {
         return Gallery::get()->map('ID', 'Title');
     };
     $galleryField = DropdownField::create('GalleryID', 'Gallery', $galleries());
     $galleryField->useAddNew('Gallery', $galleries);
     if ($this->GalleryID) {
         $galleryField->setDescription($this->Gallery()->getDataAdminEditAnchorTag());
     }
     // add fields to tab
     $fields->addFieldsToTab('Root.Main', array($galleryField));
     return $fields;
 }
Ejemplo n.º 5
0
 public function getCMSFields()
 {
     $f = parent::getCMSFields();
     $galleries = Gallery::get();
     $f->addFieldToTab('Root.Main', HTMLEditorField::create('BannerTitle', 'BannerTitle'));
     $f->addFieldToTab('Root.Main', TextField::create('BannerText', 'Banner Text'));
     $f->addFieldToTab('Root.Main', TextField::create('WhyChooseTitle', 'Why Choose Title'));
     $f->addFieldToTab('Root.Main', TextareaField::create('WhyChooseText', 'Why Choose Text'));
     $f->addFieldToTab('Root.Main', TextField::create('WhyChooseLink', 'Why Choose Link'));
     $f->addFieldToTab('Root.Main', UploadField::create('EricImage', 'Erics Image'));
     $f->addFieldToTab('Root.Main', TextField::create('OurTeamTitle', 'Team Title'));
     $f->addFieldToTab('Root.Main', TextareaField::create('OurTeamText', 'Team Text'));
     $f->addFieldToTab('Root.Main', TextField::create('OurTeamLink', 'Team Link'));
     $f->addFieldToTab('Root.Main', TextField::create('AdvantageLink', 'Advantage Link'));
     $f->addFieldToTab('Root.Main', TextField::create('AdvantageTitle', 'Advantage Title'));
     $f->addFieldToTab('Root.Main', TextareaField::create('AdvantageText', 'Advantage Text'));
     $f->addFieldToTab('Root.Main', TextField::create('AdvantageLink', 'Advantage Link'));
     $f->addFieldToTab('Root.Featured', TextField::create('FeatPropTitle', 'Featured Property Title'));
     $f->addFieldToTab('Root.Featured', TextField::create('ShowHomeLink', 'Show Home Link'));
     $f->addFieldToTab('Root.Featured', UploadField::create('ShowHomeImage', 'Show Home Image'));
     $f->addFieldToTab('Root.Featured', TextField::create('ShowHomeBtn', 'Show Home Button'));
     $f->addFieldToTab('Root.Featured', UploadField::create('PlanImage', 'Plan Image'));
     $f->addFieldToTab('Root.Featured', TextField::create('FloorPlanLink', 'Floor Plan Link'));
     $f->addFieldToTab('Root.Featured', TextField::create('FloorPlanBtn', 'Floor Plan Button'));
     $f->addFieldToTab('Root.Featured', UploadField::create('QuoteImage', 'Quote Image'));
     $f->addFieldToTab('Root.Featured', TextField::create('QuoteLink', 'Quote Link'));
     $f->addFieldToTab('Root.Featured', TextField::create('QuoteBtn', 'Quote Button'));
     $f->addFieldToTab('Root.Ideas', TextField::create('IdeasTitle', 'Ideas Title'));
     $f->addFieldToTab('Root.Ideas', UploadField::create('Idea1Image', 'Idea 1 Image'));
     $f->addFieldToTab('Root.Ideas', DropdownField::create('Ideas1Link')->setTitle('Ideas 1 Gallery')->setSource($galleries->map()));
     $f->addFieldToTab('Root.Ideas', TextField::create('Ideas1Btn', 'Idea 1 Button'));
     $f->addFieldToTab('Root.Ideas', UploadField::create('Idea2Image', 'Idea 2 Image'));
     $f->addFieldToTab('Root.Ideas', DropdownField::create('Ideas2Link')->setTitle('Ideas 2 Gallery')->setSource($galleries->map()));
     $f->addFieldToTab('Root.Ideas', TextField::create('Ideas2Btn', 'Idea 2 Button'));
     $f->addFieldToTab('Root.Ideas', UploadField::create('Idea3Image', 'Idea 3 Image'));
     $f->addFieldToTab('Root.Ideas', TextField::create('Ideas3Btn', 'Idea 3 Button'));
     $f->addFieldToTab('Root.Ideas', DropdownField::create('Ideas3Link')->setTitle('Ideas 3 Gallery')->setSource($galleries->map()));
     $f->addFieldToTab('Root.Ideas', UploadField::create('Idea4Image', 'Idea 4 Image'));
     $f->addFieldToTab('Root.Ideas', TextField::create('Ideas4Btn', 'Idea 4 Button'));
     $f->addFieldToTab('Root.Ideas', DropdownField::create('Ideas4Link')->setTitle('Ideas 4 Gallery')->setSource($galleries->map()));
     $banners = BannerImage::get()->sort('Position ASC');
     $f->addFieldToTab('Root.Banners', new GridField('BannerGrid', 'Banners', $banners, GridFieldConfig_RelationEditor::create()));
     return $f;
 }
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     if ($this->isLocked()) {
         return $fields;
     }
     $gallerySource = function () {
         return Gallery::get()->map()->toArray();
     };
     $fields->addFieldsToTab('Root.Main', array(LiteralField::create('Instructions', '<p>To create the the event, set the status to approved and click save</p>'), TextField::create('ArtistName'), $this->obj('StartDate')->scaffoldFormField(), $this->obj('EndDate')->scaffoldFormField(), CheckboxField::create('HasFreeDrinks'), DropdownField::create('GalleryID', 'Gallery', $gallerySource())->setEmptyString('(Find or create gallery)')->useAddNew('Gallery', $gallerySource)));
     // Add user submitted fields as readonly
     $fields->addFieldToTab('Root.Main', HeaderField::create('UserSubmittedHeader', 'User Submitted Data'));
     foreach (self::$db as $key => $type) {
         if (strpos($key, 'UserSubmitted') !== 0) {
             continue;
         }
         $fields->addFieldToTab('Root.Main', ReadonlyField::create($key));
     }
     return $fields;
 }
Ejemplo n.º 7
0
        return Redirect::to('/admin/category/add');
    });
    Route::post('/add', array('uses' => 'RainGalleryContent@postAddNewCategory'));
});
// Admin Panel | photogallery
Route::group(array('before' => 'admin.login', 'prefix' => 'admin/photogallery'), function () {
    # Admin Add photo
    Route::get('/add', function () {
        $user = Sentry::getUser();
        return View::make('backend.photoadd')->with('edit', false)->with('editData', [])->with('user', $user);
    });
    Route::post('/add', array('uses' => 'RainGalleryContent@postAddNewImage'));
    # Admin List photo
    Route::get('/list', function () {
        $user = Sentry::getUser();
        $galleryImages = Gallery::get();
        return View::make('backend.photolist')->with('user', $user)->with('galleryimg', $galleryImages);
    });
    # Admin Edit category
    Route::get('/edit/{id}', function ($id) {
        $user = Sentry::getUser();
        $editVarsdata = Gallery::find($id);
        return View::make('backend.photoadd')->with('edit', true)->with('editData', $editVarsdata)->with('user', $user);
    });
    Route::get('/delete/{id}', function ($id) {
        $user = Sentry::getUser();
        $getDelData = Gallery::find($id);
        if ($getDelData) {
            $getDelData->delete();
        }
        return Redirect::to('/admin/photogallery/list');
Ejemplo n.º 8
0
 public function Galleries()
 {
     return Gallery::get()->sort('Position ASC');
 }
Ejemplo n.º 9
0
header('Content-Type: application/xml');
$rssmode = getRSSAlbumsmode();
$albumfolder = getRSSAlbumnameAndCollection("albumfolder");
$collection = getRSSAlbumnameAndCollection("collection");
$albumname = getRSSAlbumTitle();
$albumpath = getRSSImageAndAlbumPaths("albumpath");
$imagepath = getRSSImageAndAlbumPaths("imagepath");
$size = getRSSImageSize();
$items = getOption('feed_items');
// # of Items displayed on the feed
$gallery = new Gallery();
?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/">
<channel>
<title><?php 
echo strip_tags(get_language_string($gallery->get('gallery_title'), $locale)) . ' ' . strip_tags($albumname);
?>
</title>
<link><?php 
echo $protocol . "://" . $host . WEBPATH;
?>
</link>
<atom:link href="<?php 
echo $protocol;
?>
://<?php 
echo html_encode($_SERVER["HTTP_HOST"]);
echo html_encode($_SERVER["REQUEST_URI"]);
?>
" rel="self"	type="application/rss+xml" />
<description><?php 
Ejemplo n.º 10
0
 function insert(Gallery $imagen)
 {
     return $this->bd->insert($this->tabla, $imagen->get());
 }
Ejemplo n.º 11
0
    require_once 'includes/classes/User.php';
    $ADK_USER = new User();
    $ADK_USER->id = $ADK_USER_ID;
    $ADK_USER->get($con);
    $ADK_HIKES = new Hikes();
    $ADK_HIKES->userid = $ADK_USER_ID;
    $ADK_HIKES->get($con);
}
$ADK_PEAKS = new Peaks();
$ADK_PEAKS->get($con);
$ADK_GALLERY = new Gallery();
$ADK_GALLERY->userid = $ADK_USER_ID;
if ($ADK_USERGROUP_CDE === 'COR') {
    $ADK_GALLERY->corrid = $_SESSION['ADK_USER_ID'];
}
$ADK_GALLERY->get($con);
if ($ADK_USERGROUP_CDE !== 'HIK') {
    require_once 'includes/classes/Hiker.php';
    $ADK_HIKERS = new Hikers();
    $ADK_HIKERS->get($con, $ADK_USERGROUP_CDE === 'COR' ? $_SESSION['ADK_USER_ID'] : '%');
}
$con->close();
function getTitle($photo)
{
    $title = $photo->name;
    if ($photo->peaks != '') {
        $title .= "\n" . $photo->peaks;
    }
    if ($photo->username != '') {
        $title .= "\n" . $photo->username;
    }
Ejemplo n.º 12
0
$id = getRSSID();
$title = getRSSTitle();
if (!empty($title)) {
    $title = " - " . html_encode($title);
}
$type = getRSSType();
$albumpath = getRSSImageAndAlbumPaths("albumpath");
$imagepath = getRSSImageAndAlbumPaths("imagepath");
$items = getOption('feed_items');
// # of Items displayed on the feed
$gallery = new Gallery();
?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title><?php 
echo strip_tags(get_language_string($gallery->get('gallery_title'), $locale)) . $title . gettext(' (latest comments)');
?>
</title>
<link><?php 
echo $protocol . "://" . $host . WEBPATH;
?>
</link>
<atom:link href="<?php 
echo $protocol;
?>
://<?php 
echo html_encode($_SERVER["HTTP_HOST"]);
echo html_encode($_SERVER["REQUEST_URI"]);
?>
" rel="self"	type="application/rss+xml" />
<description><?php 
Ejemplo n.º 13
0
/**
 * Send an mail to the mailing list. We also attempt to intercept any form injection
 * attacks by slime ball spammers. Returns error message if send failure.
 *
 * @param string $subject  The subject of the email.
 * @param string $message  The message contents of the email.
 * @param string $from_mail Optional sender for the email.
 * @param string $from_name Optional sender for the name.
 * @param array $email_list a list of email addresses
 * @param array $cc_addresses a list of addresses to send copies to.
 * @param array $bcc_addresses a list of addresses to send blind copies to.
 *
 * @return string
 *
 * @author Todd Papaioannou (lucky@luckyspin.org)
 * @since  1.0.0
 */
function zp_mail($subject, $message, $email_list = NULL, $cc_addresses = NULL, $bcc_addresses = NULL)
{
    global $_zp_authority;
    $gallery = new Gallery();
    $result = '';
    if (is_null($email_list)) {
        $email_list = $_zp_authority->getAdminEmail();
    } else {
        foreach ($email_list as $key => $email) {
            if (!is_valid_email_zp($email)) {
                unset($email_list[$key]);
                if (empty($result)) {
                    $result = gettext('Mail send failed.');
                }
                $result .= ' ' . sprintf(gettext('Invalid "to" mail address %s.'), $email);
            }
        }
    }
    if (is_null($cc_addresses)) {
        $cc_addresses = array();
    } else {
        if (empty($email_list) && !empty($cc_addresses)) {
            if (empty($result)) {
                $result = gettext('Mail send failed.');
            }
            $result .= ' ' . gettext('"cc" list provided without "to" address list.');
            return $result;
        }
        foreach ($cc_addresses as $key => $email) {
            if (!is_valid_email_zp($email)) {
                unset($cc_addresses[$key]);
                if (empty($result)) {
                    $result = gettext('Mail send failed.');
                }
                $result = ' ' . sprintf(gettext('Invalid "cc" mail address %s.'), $email);
            }
        }
    }
    if (is_null($bcc_addresses)) {
        $bcc_addresses = array();
    } else {
        foreach ($bcc_addresses as $key => $email) {
            if (!is_valid_email_zp($email)) {
                unset($bcc_addresses[$key]);
                if (empty($result)) {
                    $result = gettext('Mail send failed. ');
                }
                $result = ' ' . sprintf(gettext('Invalid "bcc" mail address %s.'), $email);
            }
        }
    }
    if (count($email_list) + count($bcc_addresses) > 0) {
        if (zp_has_filter('sendmail')) {
            // Make sure no one is trying to use our forms to send Spam
            // Stolen from Hosting Place:
            //   http://support.hostingplace.co.uk/knowledgebase.php?action=displayarticle&cat=0000000039&id=0000000040
            $badStrings = array("Content-Type:", "MIME-Version:", "Content-Transfer-Encoding:", "bcc:", "cc:");
            foreach ($_POST as $k => $v) {
                foreach ($badStrings as $v2) {
                    if (strpos($v, $v2) !== false) {
                        header("HTTP/1.0 403 Forbidden");
                        header("Status: 403 Forbidden");
                        die("Forbidden");
                        exit;
                    }
                }
            }
            foreach ($_GET as $k => $v) {
                foreach ($badStrings as $v2) {
                    if (strpos($v, $v2) !== false) {
                        header("HTTP/1.0 403 Forbidden");
                        header("Status: 403 Forbidden");
                        die("Forbidden");
                        exit;
                    }
                }
            }
            $from_mail = getOption('site_email');
            $from_name = get_language_string($gallery->get('gallery_title'), getOption('locale'));
            // Convert to UTF-8
            if (LOCAL_CHARSET != 'UTF-8') {
                $subject = $_zp_UTF8->convert($subject, LOCAL_CHARSET);
                $message = $_zp_UTF8->convert($message, LOCAL_CHARSET);
            }
            // Send the mail
            if (count($email_list) > 0) {
                $result = zp_apply_filter('sendmail', '', $email_list, $subject, $message, $from_mail, $from_name, $cc_addresses);
                // will be true if all mailers succeeded
            }
            if (count($bcc_addresses) > 0) {
                foreach ($bcc_addresses as $bcc) {
                    $result = zp_apply_filter('sendmail', '', array($bcc), $subject, $message, $from_mail, $from_name, array());
                    // will be true if all mailers succeeded
                }
            }
        } else {
            $result = gettext('Mail send failed. There is no mail handler configured.');
        }
    } else {
        if (empty($result)) {
            $result = gettext('Mail send failed.');
        }
        $result .= ' ' . gettext('No "to" address list provided.');
    }
    return $result;
}
Ejemplo n.º 14
0
?>
</title>
<link><?php 
echo $protocol . "://" . $host . WEBPATH;
?>
</link>
<atom:link href="<?php 
echo $protocol;
?>
://<?php 
echo html_encode($_SERVER["HTTP_HOST"]);
echo html_encode($_SERVER["REQUEST_URI"]);
?>
" rel="self" type="application/rss+xml" />
<description><?php 
echo html_encode(strip_tags(get_language_string($gallery->get('Gallery_description'), $locale)));
?>
</description>
<language><?php 
echo $validlocale;
?>
</language>
<pubDate><?php 
echo date("r", time());
?>
</pubDate>
<lastBuildDate><?php 
echo date("r", time());
?>
</lastBuildDate>
<docs>http://blogs.law.harvard.edu/tech/rss</docs>
Ejemplo n.º 15
0
 function insert(Gallery $param)
 {
     $parametros = $param->get();
     return $this->db->insert($this->table, $parametros, false);
 }
Ejemplo n.º 16
0
    ?>
"><img src="images/reset.png" alt="" /><strong><?php 
    echo gettext("Reset");
    ?>
</strong></button>
					</p>
					</td>
				</tr>
				<tr>
					<td width="175"><?php 
    echo gettext("Gallery title:");
    ?>
</td>
					<td width="350">
					<?php 
    print_language_string_list($gallery->get('gallery_title'), 'gallery_title');
    ?>
					</td>
					<td><?php 
    echo gettext("What you want to call your Zenphoto site.");
    ?>
</td>
				</tr>
				<tr>
					<td width="175"><?php 
    echo gettext("Gallery description:");
    ?>
</td>
					<td width="350">
					<?php 
    print_language_string_list($gallery->get('Gallery_description'), 'Gallery_description', true, NULL, 'texteditor');