public function __construct($options = null) { $baseDir = $options['baseDir']; $pageID = $options['pageID']; parent::__construct($options); /****************************************/ // PARAMETERS /****************************************/ // select box category (Parameter #1) $blockCategory = new Zend_Form_Element_Select('Param1'); $blockCategory->setLabel($this->getView()->getCibleText('form_gallery_blockCategory_label'))->setAttrib('class', 'largeSelect')->setOrder(11); $categories = new Categories(); $select = $categories->select()->setIntegrityCheck(false)->from('Categories')->join('CategoriesIndex', 'C_ID = CI_CategoryID')->where('C_ModuleID = ?', 9)->where('CI_LanguageID = ?', Zend_Registry::get("languageID"))->order('CI_Title'); $categoriesArray = $categories->fetchAll($select); foreach ($categoriesArray as $category) { $blockCategory->addMultiOption($category['C_ID'], $category['CI_Title']); } $this->addElement($blockCategory); $blockGallery = new Zend_Form_Element_Select('Param2'); $blockGallery->setLabel($this->getView()->getCibleText('form_gallery_blockGallerey_label'))->setAttrib('class', 'largeSelect')->setOrder(12); $galleries = new Galleries(); $selectG = $galleries->select()->setIntegrityCheck(false)->from('Galleries')->join('GalleriesIndex', 'G_ID = GI_GalleryID')->where('G_Online = 1')->where('GI_LanguageID = ?', Zend_Registry::get("languageID"))->order('GI_Title'); $galleriesArray = $galleries->fetchAll($selectG); //echo $selectG; $blockGallery->addMultiOption('0', $this->getView()->getCibleText('form_gallery_blockGallerey_None')); foreach ($galleriesArray as $gallery) { $blockGallery->addMultiOption($gallery['GI_GalleryID'], $gallery['GI_Title']); } $this->addElement($blockGallery); $this->removeDisplayGroup('parameters'); $this->addDisplayGroup(array('Param999', 'Param1', 'Param2'), 'parameters'); $parameters = $this->getDisplayGroup('parameters'); }
/** * Displays a particular model. * @param integer $id the ID of the model to be displayed */ public function actionView($id) { try { $model = $this->loadModel($id); $content = $model->content; $pattern = '/[{]G[0-9]{3,6}[}]/'; preg_match_all($pattern, $content, $matches); if (!empty($matches)) { for ($i = 0; $i < count($matches[0]); $i++) { if (!empty($matches[0][$i])) { $code = $matches[0][$i]; $gallery_id = Galleries::model()->find(array('condition' => 'code = "' . $code . '"'))->id; if (!empty($gallery_id)) { $photos = Photos::model()->findAll(array('condition' => 'gallery_id =' . $gallery_id)); $htmlReplace = ActiveRecord::getHtmlGalleryBox($photos); } } $content = str_replace($code, $htmlReplace, $content); } } $this->render('view', array('model' => $model, 'content' => $content, 'actions' => $this->listActionsCanAccess)); } catch (Exception $e) { Yii::log("Exception " . print_r($e, true), 'error'); throw new CHttpException("Exception " . print_r($e, true)); } }
function display_page_content() { $gallery_slug = requestIdParam(); $gallery = Galleries::FindBySlug($gallery_slug); foreach ($gallery->get_photos() as $photo) { echo "<a href='{$photo->getPublicUrl()}' title='{$photo->caption}'>Photo</a>"; } }
public function action_gallery($galleryID) { if (Auth::guest()) { Session::put('lastURL', URI::full()); } Galleries::incrementViews($galleryID); $images = Images::fromGallery($galleryID); return View::make('home.gallery')->with('images', $images)->with('galleryID', $galleryID); }
public function get_upload($galleryID) { $gallery = Galleries::get($galleryID); if ($gallery != null) { return View::make('admin/galleries.upload')->with('gallery', $gallery); } else { return "Error"; } }
public function listAction() { $this->view->title = "Liste des galleries"; if ($this->view->aclIsAllowed('gallery', 'manage', true)) { // variables $this->view->params = $this->_getAllParams(); $blockID = $this->_getParam('blockID'); $pageID = $this->_getParam('pageID'); $baseDir = $this->view->baseUrl(); $base = substr($baseDir, 0, strpos($baseDir, "/{$this->_config->document_root}/")); if ($blockID != '') { $blockParameters = Cible_FunctionsBlocks::getBlockParameters($blockID); $this->_categoryID = $blockParameters[0]['P_Value']; } $this->view->headScript()->appendFile($baseDir . '/js/jquery.json-1.3.min.js'); $this->view->headScript()->appendFile($baseDir . '/js/tiny_mce/plugins/imagemanager/js/mcimagemanager.js'); //get category details $this->view->categoryDetails = Cible_FunctionsCategories::getCategoryDetails($this->_categoryID); // get all galleries $galleriesSelect = new Galleries(); $select = $galleriesSelect->select()->setIntegrityCheck(false)->from('Galleries')->join('GalleriesIndex', 'G_ID = GI_GalleryID')->join('Images', 'G_ImageID = I_ID')->where('GI_LanguageID = ?', $this->_defaultEditLanguage)->order('G_Position')->order('GI_Title'); if ($this->_categoryID > 0) { $select->where('G_CategoryID = ?', $this->_categoryID); } $galleriesData = $galleriesSelect->fetchAll($select); $this->view->galleriesData = $galleriesData->toArray(); $this->view->imagesAjaxLink = "{$baseDir}/gallery/index/list-all-images"; if ($blockID != '') { $this->view->imagesEditLink = "{$baseDir}/gallery/image/edit/blockID/{$blockID}"; } else { $this->view->imagesEditLink = "{$baseDir}/gallery/image/edit"; } $this->view->imagesDeleteLink = "{$baseDir}/gallery/image/delete"; /* $galleriesImages = new GalleriesImages(); $select = $galleriesImages->select()->setIntegrityCheck(false) ->from('Galleries_Images') ->join('ImagesIndex', 'II_ImageID = GI_ImageID') ->where('GI_GalleryID = ?', $galleryID); $ImagesData = $galleriesImages->fetchAll($select); */ } }
public function action_index() { $this->xslt_stylesheet = 'generic'; // Get all categories $this->xml_content_categories = $this->xml_content->appendChild($this->dom->createElement('categories')); xml::to_XML(Galleries::get_categories_for_xml(), $this->xml_content_categories, 'category'); // Get all galleries $this->xml_content_galleries = $this->xml_content->appendChild($this->dom->createElement('galleries')); xml::to_XML(Galleries::get_for_xml(), $this->xml_content_galleries, 'gallery'); $images = array(); foreach (Content_image::get_images(NULL, array('frontimage' => TRUE)) as $image_name => $image_data) { $images[] = $image_name; } if (count($images)) { xml::to_XML(array('frontimage' => $images[rand(0, count($images) - 1)]), $this->xml_content); } }
public function before() { // Get all categories $this->xml_content_categories = $this->xml_content->appendChild($this->dom->createElement('categories')); xml::to_XML(Galleries::get_categories_for_xml(), $this->xml_content_categories, 'category'); // Get all galleries $this->xml_content_galleries = $this->xml_content->appendChild($this->dom->createElement('galleries')); xml::to_XML(Galleries::get_for_xml(), $this->xml_content_galleries, 'gallery'); // We need to put some HTML in from our transformator // The reason for all this mess is that we must inject this directly in to the DOM, or else the <> will get destroyed $XPath = new DOMXpath($this->dom); foreach ($XPath->query('/root/content/galleries/gallery/description') as $raw_content_node) { $html_content = call_user_func(Kohana::$config->load('content.content_transformator'), $raw_content_node->nodeValue); $html_node = $raw_content_node->parentNode->appendChild($this->dom->createElement('description_html')); xml::xml_to_DOM_node($html_content, $html_node); } }
public function __construct() { parent::__construct('editGallery', 'Edit Gallery'); $gallery = Galleries::getById(Sanitizer::getInstance()->filterUint('id')); $this->addElement(new ElementHidden('mode', null, 'edit')); $this->addElement(new ElementHidden('id', null, $gallery['id'])); $this->addElement(new ElementInput('title', 'Title', $gallery['title'])); $this->addElement(new ElementInput('folderName', 'Folder Name', $gallery['folderName'])); $this->addElement(new ElementInput('coverImage', 'Cover Image', $gallery['coverImage'], 'The filename of the THUMBNAIL already in the gallery that will be the cover image.')); $this->addElement(new ElementNumeric('ordinal', 'Ordinal', $gallery['ordinal'], 'Used for organizing the gallery.')); $this->addElement(new ElementAlphaNumeric('description', 'Description', $gallery['description'], 'A description that is shown when people view the gallery.')); $this->getElement('description')->setPunctuationAllowed(true); $this->getElement('description')->setMinMaxLengths(0, 64); $elStatus = new ElementSelect('status', 'Status', $gallery['status']); $elStatus->addOption('Open'); $elStatus->addOption('Closed'); $elStatus->addOption('Staff'); $this->addElement($elStatus); $this->addDefaultButtons(); }
function display_page_content() { $galleries = Galleries::FindAll("DESC"); ?> <div id="edit-header" class="gallerynav"> <div class="nav-left column"> <h1>Choose a Gallery to Edit</h1> </div> <div class="nav-right column"> <a href="<?php echo get_link("admin/add_gallery"); ?> " class="hcd_button">Add a New Gallery</a> </div> <div class="clearleft"></div> </div> <?php if (isset($galleries) && count($galleries) > 0) { ?> <div id="table-header" class="documents"> <strong class="item-link">Gallery Name & Thumbnail</strong> <span class="item-public">Image Count</span> </div> <ul id="listgalleries" class="managelist"> <?php foreach ($galleries as $gallery) { $count = $gallery->number_of_photos(); $thumb = $gallery->get_thumb(); echo "\t\t<li>\n\t\t\t<span class=\"item-link\"><a href=\"" . get_link("/admin/edit_gallery/{$gallery->id}") . "\">"; if ($thumb) { echo "<img src=\"{$thumb->getPublicUrl()}\" alt=\"{$gallery->name}\" />"; } echo "{$gallery->name}</a></span>\n\t\t\t<span class=\"item-public\">{$count} images</span>"; if (in_array($gallery->id, explode(",", PROTECTED_ADMIN_GALLERIES))) { echo "<span class=\"item-public red\">This gallery is used by a template. It can not be deleted.</span>"; } echo "</li>\n"; } ?> </ul> <?php } else { echo "<h3 class=\"empty-list\">There are no galleries yet! <a href=\"" . get_link("admin/add_gallery") . "\">Add one if you like</a>.</h3>\n"; } ?> <p> </p> <h3>More about Galleries</h3> <p>Galleries can be inserted into content for pages and other things with a shortcode that looks like this:</p> <p><span style="color: #137;">}}gallery:name-of-galley}}</span></p> <p>The direction of the curly braces in the shortcode define how the gallery will lay out. For example: </p> <ul> <li><span style="color: #137; display: inline-block; width: 280px;">{{gallery:name-of-galley}}</span> Gallery will center in the content and be as large as the column will allow</li> <li><span style="color: #137; display: inline-block; width: 280px;">}}gallery:name-of-galley}}</span> Gallery will float left (the braces point left) and display as a thumbnail</li> <li><span style="color: #137; display: inline-block; width: 280px;">{{gallery:name-of-galley{{</span> Gallery will float right (the braces point right) and display as a thumbnail</li> </ul> <p>Other patterns display galleries as different types of collections of images. Here are the other patterns:</p> <ul> <li><span style="color: #137; display: inline-block; width: 280px;">{{carousel:name-of-gallery{{</span> Inserts an auto-scrolling carousel and displays it much like the gallery will display. Images can also be opened in a lightbox. </li> <li><span style="color: #137; display: inline-block; width: 280px;">{{random-from-gallery:name-of-gallery{{</span> Inserts one image randomly from the gallery, and floats it right or left or centers the image accordingly.</li> </ul> <?php }
function carousel_display($content_to_display) { $pattern_recog = array("left" => array("{", "{"), "right" => array("}", "}"), "center" => array("{", "}")); foreach ($pattern_recog as $float => $direction) { $carouselPattern = "*" . $direction[0] . "{2}(carousel:[A-Za-z0-9_ \\-]+)" . $direction[1] . "{2}*"; $carouselSlugs = getFilterIds($content_to_display, $carouselPattern); foreach ($carouselSlugs as $slug) { $galname = end(explode(":", $slug)); $carousel = Galleries::FindBySlug($galname); if (is_object($carousel)) { // Start the Carousel. Width should be set by _required.css $replacement = '<figure id="carousel_' . $carousel->slug . '" class="hcd-photo hcd-photo__' . $float . '"><div class="slideshow slideshow__inserted"><div class="slideshow--wrapper flexslider js-slideshow js-gallery"><ul class="slides slideshow--list">'; // create the LIs in the UL foreach ($carousel->get_photos() as $photo) { $url = $photo->getPublicUrl(); $caption = cleanupSpecialChars($photo->caption); $replacement .= '<li class="slideshow--item"><div class="slideshow--slide"><a class="slideshow--link js-popup" href="' . $url . '" title="' . $caption . '"><img src="' . $url . '" alt="' . $caption . '" /></a></div></li>'; } $replacement .= "</ul></div></div></figure>"; $content_to_display = updateContent($content_to_display, "*" . $direction[0] . "{2}carousel:{$carousel->slug}" . $direction[1] . "{2}*", $replacement); } else { $content_to_display = "<span class=\"database_error\">HCd>CMS Warning: Gallery “{$galname}” not found!</span> " . $content_to_display; } } } return $content_to_display; }
if (in_array(getRequestVarAtIndex(1), $pages)) { echo "\t<div id=\"areachild\" class=\"dropslide\""; if (getRequestVarAtIndex(1) == "add_page") { echo ">\n"; } else { echo " style=\"display: none;\">\n"; } SUB_PAGES ? require_once snippetPath("admin-area_child") : (require_once snippetPath("admin-area")); echo "\t</div>\n"; } $documents = Documents::FindAll(); require_once snippetPath("admin-insertDoc"); $images = Images::FindAll(); require_once snippetPath("admin-insertImage"); if (GALLERY_INSTALL && !in_array(getRequestVarAtIndex(1), $portfolio)) { $galleries = Galleries::FindAll("DESC"); require_once snippetPath("admin-insertGallery"); } if (PORTFOLIO_INSTALL && (ITEM_GALLERY_INSERT && !in_array(getRequestVarAtIndex(1), $portfolio))) { //$galleries = Galleries::FindAll(); require_once snippetPath("admin-insertItemGallery"); } if (VIDEO_INSTALL) { require_once snippetPath("admin-insertVideo"); } if (TESTIMONIAL_INSTALL) { require_once snippetPath("admin-insertTestimonial"); } if (PRODUCT_INSTALL) { $products = Product::FindAll(); require_once snippetPath("admin-insertProduct");
function display_page_content() { $gallery = Galleries::FindById(requestIdParam()); $photos = $gallery->get_photos(); $user = Users::GetCurrentUser(); ?> <script type="text/javascript"> $().ready(function() { $("#edit_gallery").validate({ errorLabelContainer: $("#error_container"), rules: { name: "required" }, messages: { name: "Please enter a name for this gallery<br/>" } }); }); $().ready(function() { $("#photo_list_order").sortable({ stop: function() { $("#photo_list_order li input[type=hidden]").each(function(i) { $(this).val(i+1); }); } }); }); </script> <div id="edit-header" class="documentnav"> <h1>Edit Gallery</h1> </div> <?php // DEBUG block. Run some tests. NOT PERFECT but should help point in the right direction. if (HCd_debug()) { echo '<div class="debug-block">'; // Check the folder path to see if it exists if (is_dir(SERVER_DOCUMENTS_ROOT)) { echo '<span class="debug-feedback passed">“' . SERVER_DOCUMENTS_ROOT . '” exists</span>'; $permmode = substr(sprintf('%o', fileperms(SERVER_DOCUMENTS_ROOT)), -4); if ($permmode == '0777' || $permmode == '0775') { echo '<span class="debug-feedback passed">The folder permission is <strong>' . $permmode . '</strong></span>'; } else { echo '<span class="debug-feedback failed">The folder permission is <strong>' . $permmode . '</strong></span>'; } if (is_dir(SERVER_DOCUMENTS_ROOT . "gallery_photos")) { echo '<span class="debug-feedback passed">“' . SERVER_DOCUMENTS_ROOT . 'gallery_photos” exists</span>'; $permmode2 = substr(sprintf('%o', fileperms(SERVER_DOCUMENTS_ROOT . "gallery_photos")), -4); if ($permmode2 == '0777' || $permmode2 == '0775') { echo '<span class="debug-feedback passed">The folder permission is <strong>' . $permmode2 . '</strong></span>'; } else { echo '<span class="debug-feedback failed">The folder permission is <strong>' . $permmode2 . '</strong></span>'; } } else { echo '<span class="debug-feedback failed">“' . SERVER_DOCUMENTS_ROOT . 'gallery_photos” does NOT exist or can not be seen</span>'; } } else { echo '<span class="debug-feedback failed">“' . SERVER_DOCUMENTS_ROOT . '” does NOT exist</span>'; } $test_file = SERVER_INCLUDES_ROOT . "www/lib/admin_images/hcdlogo_24.png"; if (is_file($test_file)) { $test_imagecreatefromjpeg = @imagecreatefrompng($test_file); if ($test_imagecreatefromjpeg !== false) { echo '<span class="debug-feedback passed">“@imagecreatefrompng” works</span>'; } else { echo '<span class="debug-feedback failed">“@imagecreatefrompng” returns false</span>'; } } else { echo '<span class="debug-feedback failed">Test file does not exist. “imagecreatefrompng” test cannot run. </span>'; echo '<span class="debug-feedback failed">Test file path: “' . $test_file . '”</span>'; } echo '</div>'; } ?> <form method="POST" id="edit_gallery" enctype="multipart/form-data"> <p><span class="hint">If a text box is underlined in red, it is a required field</span></p> <a name="top"></a> <p class="display_name"> <label for="name">Gallery Display Name:</label> <span class="hint">This is the Proper Name of the gallery.</span><br /> <?php textField("name", $gallery->name, "required: true"); ?> </p> <p class="announce"> <strong>Note:</strong> While the server will attempt to upload very large images and resize them, doing so may take a very long time. Please try to resize images to reasonable dimensions (about 800 pixels wide) before uploading. We recommend the Adobe Photoshop “Save for Web” feature, which makes the image file size very small (In Photoshop, under File > Save for Web. Use JPEG file type and a compression of about 60%. Click Progressive as well).<br /> <br /> The server will attempt to resize an image to a maximum dimension of: <strong><?php echo MAX_GALLERY_IMAGE_WIDTH; ?> pixels wide by <?php echo MAX_GALLERY_IMAGE_HEIGHT; ?> pixels tall</strong>. This is best for viewing images for the web. </p> <p> </p> <!-- Start the Show/Hide for editing photos and changing order --> <div id="gallery-options" class="clearfix"> <a name="editgal"></a> <ul id="gallery-options-nav" class="menu tabs"> <li><a href="#gallery_sort" class="openclose opened">Change Photo Order</a></li> <li><a href="#add_edit_images" class="openclose">Add / Edit Photos and Captions</a></li> </ul> <div id="gallery_sort" class="dropslide"> <h2>Click and Drag the image to change the order of the display in the Gallery</h2> <div id="sortable_container"> <?php if (count($photos) > 0) { echo "\t\t\t\t<ol id=\"photo_list_order\">\n"; foreach ($photos as $photo) { echo "\t\t\t\t\n\t<li><img class=\"changeorderThumb\" src=\"{$photo->getPublicUrl()}\" /><input type=\"hidden\" name=\"photos_display_order[" . $photo->id . "]\" value=\"" . $photo->display_order . "\" /></li>\n"; } echo "\t\t\t\t</ol>\n"; } else { echo "\n\n\n\n<h3>There are no photos to put in order. Go ahead and add some.</h3>\n"; } ?> </div> <div class="clearleft"></div> </div> <div id="add_edit_images" class="dropslide" style="display: none;"> <div id="add_image_wrap"> <h2>Add an Additional Gallery Image</h2> <p><span class="hint">Images for your site would be best displayed at <?php echo MAX_GALLERY_IMAGE_WIDTH; ?> pixels wide. If an image is larger, the system will attempt to resize it. Images that are too large might require more memory than the system can handle, and an error may result.</span></p> <p><label for="new_photo">Add an additional image:</label> <input type="file" name="new_photo" id="new_photo" value="" /> </p> <p><label for="new_photo_caption">Caption for new image:</label> <?php textField("new_photo_caption", "", ""); ?> </p> <p><input type="submit" class="submitbutton" name="submit" value="Add Image to Gallery" /></p> </div> <p> </p> <h2>Edit Existing Gallery Photos (delete photos or edit captions. Click Save when done)</label></h2> <p><span class="hint"><strong>Image size:</strong> The CSS control for the images designates that they display here (for ease of use) at 50% their actual size. Dont’t worry if they appear smaller than on the front-end.<!--[if IE 6]><br /><b>IE 6 Users: The CSS can only force the image to be 240 pixels wide, which for some images, may be larger than normal, resulting in pixellation. </b><![endif]--></span></p> <?php if (count($photos) > 0) { echo "<ul id=\"add_photo_list\">\n"; foreach ($photos as $photo) { echo "<li><img src=\"{$photo->getPublicUrl()}\" />\n"; echo "<div><input type=\"checkbox\" name=\"deleted_photos[]\" value=\"{$photo->id}\"/> DELETE</div>"; textField("captions[{$photo->id}]", "{$photo->caption}", ""); echo "</li>\n"; } echo "</ul>\n"; } else { echo "<h3>There are no photos to edit. Go ahead and add some.</h3>\n"; } ?> <p><a href="#top">Back to the Top of the Page</a></p> </div> </div> <!-- End the Show/Hide --> <div id="edit-footer" class="gallerynav clearfix"> <div id="error_container"></div> <div class="column half"> <p> <input type="submit" class="submitbutton" name="submit" value="Edit Gallery" /> <br /> <input type="submit" class="submitbuttonsmall" name="submit" value="Edit and Return to List" /> </p> </div> <div class="column half last"> <?php if ($user->has_role() && !in_array($gallery->id, explode(",", PROTECTED_ADMIN_GALLERIES))) { ?> <p><label for="delete">Delete this Gallery?</label> <input name="delete" class="boxes" type="checkbox" value="<?php echo $gallery->id; ?> " /> <span class="hint">Check the box and click “Edit” to delete from the database</span></p> <?php } else { ?> <p>This gallery is being used by a template, so it can not be deleted. Please edit its name or contents only. </p> <?php } ?> </div> </div> </form> <?php }
<?php require_once 'includes/common.php'; $tpl->assign('pageTitle', 'Photo Galleries'); require_once 'includes/widgets/header.php'; require_once 'includes/widgets/sidebar.php'; $listGalleries = Galleries::getAll(); foreach ($listGalleries as &$itemGallery) { $itemGallery = $itemGallery->getFields(); } $tpl->assign('galleryIntro', getContent('galleryIntro')); $tpl->assign('listGalleries', $listGalleries); $tpl->display('listGalleries.tpl'); require_once 'includes/widgets/footer.php';
<?php require_once 'includes/widgets/header.php'; use libAllure\Session; use libAllure\Sanitizer; use libAllure\DatabaseFactory; Session::requirePriv('GALLERY_DELETE_IMAGE'); $filename = Sanitizer::getInstance()->filterString('filename'); $gallery = Sanitizer::getInstance()->filterUint('gallery'); $image = Galleries::getImage($filename, $gallery); if ($image == false) { redirect('index.php', 'Image does not exist.'); } if (is_int($gallery) && $image['inDatabase'] && !empty($filename)) { $sql = 'DELETE FROM images WHERE filename = :filename AND gallery = :gallery'; $stmt = DatabaseFactory::getInstance()->prepare($sql); $stmt->bindValue(':filename', $filename); $stmt->bindValue(':gallery', $gallery); $stmt->execute(); @unlink($image['fullPath']); @unlink($image['thumbPath']); } redirect('viewGallery.php?id=' . $image['galleryId'], 'Image deleted'); require_once 'includes/widgets/footer.php';
<!-- Insert an Item Gallery function --> <div id="itemgal_insert" class="dropslide" style="display: none; "> <p><span class="hint">Click the name of the Item Gallery to insert the link to it in the edit window above. </span> The system will insert the default gallery link: }}gallery:name-of-gallery}}. The direction of the braces “design” the display – pointing left, the thumbnail floats left; pointing right, the thumbnail floats right; and centered, the thumbnail displays large in the content column. Other allowed values and patterns are: {{carousel:name-of-gallery{{ or {{random-from-gallery:name-of-gallery{{ </p> <?php $itemgals = Galleries::FindAll("DESC", false); if (count($itemgals) > 0) { ?> <table class="dropdown" cellpadding="0" cellspacing="0" border="0" width="98%"> <tbody> <tr> <?php $counter_gal = 1; foreach ($itemgals as $gallery) { if ($counter_gal == 4) { echo "\t\t\t</tr><tr>\n"; $counter_gal = 1; } $thumb = $gallery->get_thumb(); if ($thumb) { ?> <td class="gallerythumb divider" valign="top"><a href="#" onclick="insertDocument('gallery:<?php echo $gallery->slug; ?> ', '}}', '}}'); return false;"><img src="<?php echo $thumb->getPublicUrl(); ?> "> <?php echo $gallery->name; ?>
function FindByPagination($perpage, $pagenum) { // Check to see if there is a page number. If not, set it to page 1 if (!isset($pagenum)) { $pagenum = 1; } $last = Galleries::FindLastPage($perpage); // Ensure the page number isn't below one, or more than the maximum pages if ($pagenum < 1) { $pagenum = 1; } elseif ($pagenum > $last) { $pagenum = $last; } // Sets the limit value for the query $max = 'LIMIT ' . ($pagenum - 1) * $perpage . ', ' . $perpage; return MyActiveRecord::FindBySQL('Galleries', "SELECT * FROM galleries ORDER BY id DESC {$max}"); }
function getGallery() { $galid = $this->gallery_id; return Galleries::FindById($galid); }
function editAction() { $this->view->title = "Modification d'une image"; //if ($this->view->aclIsAllowed('gallery','manage',true)){ $this->view->assign('isXmlHttpRequest', $this->_isXmlHttpRequest); $this->view->assign('success', false); $pageID = $this->_getParam('pageID'); $blockID = $this->_getParam('blockID'); $imageID = $this->_getParam('imageID'); $baseDir = $this->view->baseUrl(); $imageSelect = new ImagesIndex(); $select = $imageSelect->select()->setIntegrityCheck(false)->from('ImagesIndex')->join('Galleries_Images', 'GI_ImageID = II_ImageID')->where('II_ImageID = ?', $imageID); $imageData = $imageSelect->fetchRow($select); if (!$imageData) { if ($this->_request->isPost()) { $this->view->assign('success', true); } $this->view->assign('deleted', true); $this->view->assign('imageID', $imageID); } else { $imageObject = new ImageObject(); $imageData = $imageObject->populate($imageID, Zend_Registry::get("currentEditLanguage")); $this->view->assign('deleted', false); $galleryImageSelect = new GalleriesImages(); $select = $galleryImageSelect->select()->where('GI_ImageID = ?', $imageID); $galleryImageData = $galleryImageSelect->fetchRow($select); $imageData['GI_Online'] = $galleryImageData['GI_Online']; $imageData['GI_Position'] = $galleryImageData['GI_Position']; $cancelUrl = "/gallery/index/list/blockID/{$blockID}/pageID/{$pageID}"; $form = new FormImage(array('baseDir' => $baseDir, 'cancelUrl' => "", 'galleryID' => '', 'imageID' => $imageID)); if ($this->_request->isPost()) { $formData = $this->_request->getPost(); if ($form->isValid($formData)) { $formData['ImageSrc'] = $imageData['ImageSrc']; $imageObject = new ImageObject(); $imageObject->save($imageID, $formData, Zend_Registry::get("currentEditLanguage")); $galleryImageData['GI_Online'] = $form->getValue('GI_Online'); $galleryImageData['GI_Position'] = $form->getValue('GI_Position'); $galleryImageData->save(); $gallerySelect = new Galleries(); $select = $gallerySelect->select()->where('G_ID = ?', $galleryImageData['GI_GalleryID']); $galleryData = $gallerySelect->fetchRow($select); if ($blockID > 0) { $blockParameters = Cible_FunctionsBlocks::getBlockParameters($blockID); $categoryID = $blockParameters[0]['P_Value']; $indexData['pageID'] = $categoryID; $indexData['moduleID'] = $this->_moduleID; $indexData['contentID'] = $galleryImageData['GI_GalleryID']; $indexData['languageID'] = Zend_Registry::get("currentEditLanguage"); $indexData['title'] = $formData['II_Title']; $indexData['text'] = ''; $indexData['link'] = 'image'; $indexData['contents'] = $formData['II_Title'] . " " . $formData['II_Description']; if ($formData['GI_Online'] == 1 && $galleryData['G_Online'] == 1) { $indexData['action'] = 'update'; } else { $indexData['action'] = 'delete'; } Cible_FunctionsIndexation::indexation($indexData); } if (!$this->_isXmlHttpRequest) { $this->_redirect("/gallery/index/list/blockID/{$blockID}/pageID/{$pageID}"); } else { $buttonAction = $formData['buttonAction']; $this->view->assign('buttonAction', $buttonAction); $this->view->assign('success', true); $this->view->assign('imageID', $imageID); $this->view->assign('imageTitle', $form->getValue('II_Title')); $this->view->assign('imageDescription', $form->getValue('II_Description')); } } else { $this->view->form = $form; } } else { $form->populate($imageData); $this->view->form = $form; } } //} }
function get_gallery() { return Galleries::FindById($this->gallery_id); }
<?php require_once 'includes/common.php'; use libAllure\Sanitizer; $sanitizer = new Sanitizer(); $gallery = Galleries::GetById($sanitizer->filterUint('gallery')); $image = Galleries::getImage($sanitizer->filterString('filename'), $gallery); require_once 'includes/widgets/header.php'; require_once 'includes/widgets/sidebar.php'; Galleries::getPrevNext($image['filename'], $gallery, $prev, $next, $cii, $count); $tpl->assign('imageNumber', $cii + 1); $tpl->assign('imageCount', $count); $tpl->assign('prevFilename', $prev); $tpl->assign('nextFilename', $next); $tpl->assign('image', $image); $tpl->assign('gallery', $gallery); if (strpos($image['filename'], '.jpg') != null) { $tpl->assign('exifData', \libAllure\array_flatten(@exif_read_data($gallery['fullPath'] . $image['filename']))); } else { $tpl->assign('exifData', null); } $tpl->display('viewGalleryImage.tpl'); require_once 'includes/widgets/footer.php';
function wikify($content) { $content = htmlify($content, false); $content = preg_replace('#\\[\\[([\\w ]+);([\\w ]+)?\\]\\]#', '<a href = "wpage.php?title=$1">$2</a>', $content); $content = preg_replace('#\\[\\[([\\w ]+)\\]\\]#', '<a href = "wpage.php?title=$1">$1</a>', $content); $matches = array('#\\[url\\=(http://.*?)\\](.*?)\\[/url\\]#', '#\\[email:([\\w\\. ]+);([\\w\\@\\.]+)\\]#', '#funcFullArticle\\(([\\w ]+)\\)#', '#\\_([\\w ]+)\\_#', '#\\*([\\w \\d\\p{P}]+)\\*#', '#-([\\w \\&]+)-#', '#^=([\\w?\'\\"\\(\\)\\\\.,/ \\&]+)=#m', '#\\[img\\.(\\d+)\\](.+)\\[\\/img\\]#', '#\\[img\\](.+)\\[\\/img\\]#', '#\\|-([^\\|]+)#sm', '#{.(.+?).}#sm', '#^\\!(.+?)\\n#m', '#\\%(.+?)\\n#', '#\\[list\\]#', '#\\[\\/list\\]#', '#\\n-([\\w \\p{P}]+)#', '#\\[center\\]#', '#\\[\\/center\\]#', '#\\[space\\]#', '#\\[br\\]#'); $replacements = array('<a href = "$1" class = "external" title = "This is an external link.">$2</a>', '<a href = "mailto:$2" class = "external" title = "This is an email address.">$1</a>', '<span class = "subtle">The following is a snippit, there is a full article available: <a href = "wiki.php?title=$1">$1</a>.</span><br />', '<em>$1</em>', '<b>$1</b>', '<del>$1</del>', '<h3>$1</h3>' . "\n", '<img src = "$2" width = "$1" alt = "unknown" />', '<img src = "$1" alt = "unknown" />', '<tr>\\1</tr>', '<table>\\1</table>', '<td>\\1</td>', '<th>\\1</th>', '<ul>', '</ul>', '<li>\\1</li>', '<div class = "centered">', '</div>', ' ', '<br />'); $content = preg_replace($matches, $replacements, $content); while (strpos($content, 'imgPromo') !== FALSE) { $img = Galleries::getRandomImage(); $rep = '<a href = "viewGalleryImage.php?filename=' . $img['filename'] . '&galleryId=' . $img['galleryId'] . '"><img src = "' . $img['fullPath'] . '" width = "$1" alt = "unknown"></a>'; $content = preg_replace('#\\[imgPromo\\.(\\d+)\\]#', $rep, $content, 1); } return $content; }
public function listAction() { $blockID = $this->_getParam('BlockID'); $blockParameters = Cible_FunctionsBlocks::getBlockParameters($blockID); $categoryID = $blockParameters[0]['P_Value']; $galleriesSelect = new Galleries(); $select = $galleriesSelect->select()->setIntegrityCheck(false)->from('Galleries')->join('GalleriesIndex', 'GI_GalleryID = G_ID AND GI_LanguageID = ' . Zend_Registry::get("languageID"))->join('Images', 'I_ID = G_ImageID')->where('G_CategoryID = ?', $categoryID)->where('G_Online = 1')->order('G_Position'); $galleriesData = $galleriesSelect->fetchAll($select)->toArray(); $config = Zend_Registry::get('config')->toArray(); $thumbMaxHeight = $config['gallery']['image']['thumb']['maxHeight']; $thumbMaxWidth = $config['gallery']['image']['thumb']['maxWidth']; $i = 0; foreach ($galleriesData as $gallery) { $galleriesData[$i]['I_ThumbLink'] = str_replace($gallery['I_OriginalLink'], $thumbMaxWidth . 'x' . $thumbMaxHeight . '_' . $gallery['I_OriginalLink'], $gallery['I_OriginalLink']); $galleriesData[$i]['linkDetails'] = Cible_FunctionsCategories::getPagePerCategoryView($categoryID, 'details', 9); $i++; } // var_dump($galleriesData); $details_page = Cible_FunctionsCategories::getPagePerCategoryView($categoryID, 'details', 9); $this->view->assign('details_page', $details_page); $this->view->assign('galleriesData', $galleriesData); }
public static function indexationBuild() { set_time_limit(0); /* * ****** PAGE ******* */ $pageSelect = new PagesIndex(); $select = $pageSelect->select()->where('PI_Status = 1'); $pageData = $pageSelect->fetchAll($select)->toArray(); $cpt = count($pageData); for ($i = 0; $i < $cpt; $i++) { $indexData['action'] = "add"; $indexData['pageID'] = $pageData[$i]['PI_PageID']; $indexData['moduleID'] = 0; $indexData['contentID'] = $pageData[$i]['PI_PageID']; $indexData['languageID'] = $pageData[$i]['PI_LanguageID']; $indexData['title'] = $pageData[$i]['PI_PageTitle']; $indexData['text'] = ''; $indexData['link'] = ''; $indexData['contents'] = $pageData[$i]['PI_PageTitle']; Cible_FunctionsIndexation::indexation($indexData); } /* * ****** TEXT ******* */ if (class_exists('Text', false)) { $textSelect = new Text(); $select = $textSelect->select()->setIntegrityCheck(false)->from('TextData', array('ID' => 'TD_ID', 'LanguageID' => 'TD_LanguageID', 'Text' => 'TD_OnlineText'))->join('Blocks', 'B_ID = TD_BlockID', array('BlockID' => 'B_ID', 'ModuleID' => 'B_ModuleID'))->where('B_Online = 1')->join('PagesIndex', 'PI_PageID = B_PageID', array('PageID' => 'PI_PageID', 'Title' => 'PI_PageTitle'))->where('PI_Status = 1')->where('PI_LanguageID = TD_LanguageID'); $textData = $textSelect->fetchAll($select)->toArray(); $cpt = count($textData); for ($i = 0; $i < $cpt; $i++) { $indexData['action'] = "add"; $indexData['pageID'] = $textData[$i]['PageID']; $indexData['moduleID'] = $textData[$i]['ModuleID']; $indexData['contentID'] = $textData[$i]['ID']; $indexData['languageID'] = $textData[$i]['LanguageID']; $indexData['title'] = $textData[$i]['Title']; $indexData['text'] = ''; $indexData['link'] = ''; $indexData['contents'] = $textData[$i]['Title'] . " " . $textData[$i]['Text']; Cible_FunctionsIndexation::indexation($indexData); } } /* * ********************* */ /* * ****** NEWS ******* */ if (class_exists('NewsData', false)) { $newsSelect = new NewsData(); $select = $newsSelect->select()->setIntegrityCheck(false)->from('NewsData', array('NewsID' => 'ND_ID', 'CategoryID' => 'ND_CategoryID'))->join('NewsIndex', 'NI_NewsDataID = ND_ID', array('LanguageID' => 'NI_LanguageID', 'NewsTitle' => 'NI_Title', 'NewsBrief' => 'NI_Brief', 'NewsText' => 'NI_Text', 'NewsImageAlt' => 'NI_ImageAlt'))->where('NI_Status = 1'); $newsData = $newsSelect->fetchAll($select); $cpt = count($newsData); for ($i = 0; $i < $cpt; $i++) { $indexData['action'] = "add"; $indexData['pageID'] = $newsData[$i]['CategoryID']; $indexData['moduleID'] = 2; $indexData['contentID'] = $newsData[$i]['NewsID']; $indexData['languageID'] = $newsData[$i]['LanguageID']; $indexData['title'] = $newsData[$i]['NewsTitle']; $indexData['text'] = ''; $indexData['link'] = ''; $indexData['contents'] = $newsData[$i]['NewsTitle'] . " " . $newsData[$i]['NewsBrief'] . " " . $newsData[$i]['NewsText'] . " " . $newsData[$i]['NewsImageAlt']; Cible_FunctionsIndexation::indexation($indexData); } } /* * ********************* */ /* * ****** EVENTS ******* */ if (class_exists('EventsIndex', false)) { $eventsSelect = new EventsIndex(); $select = $eventsSelect->select()->setIntegrityCheck(false)->from('EventsIndex', array('ID' => 'EI_EventsDataID', 'LanguageID' => 'EI_LanguageID', 'Title' => 'EI_Title', 'Brief' => 'EI_Brief', 'Text' => 'EI_Text', 'ImageAlt' => 'EI_ImageAlt'))->join('EventsData', 'ED_ID = EI_EventsDataID', array('CategoryID' => 'ED_CategoryID'))->where('EI_Status = 1'); $eventsData = $eventsSelect->fetchAll($select)->toArray(); $cpt = count($eventsData); for ($i = 0; $i < $cpt; $i++) { $indexData['action'] = "add"; $indexData['pageID'] = $eventsData[$i]['CategoryID']; $indexData['moduleID'] = 7; $indexData['contentID'] = $eventsData[$i]['ID']; $indexData['languageID'] = $eventsData[$i]['LanguageID']; $indexData['title'] = $eventsData[$i]['Title']; $indexData['text'] = ''; $indexData['link'] = ''; $indexData['contents'] = $eventsData[$i]['Title'] . " " . $eventsData[$i]['Brief'] . " " . $eventsData[$i]['Text'] . " " . $eventsData[$i]['ImageAlt']; Cible_FunctionsIndexation::indexation($indexData); } } /* * ********************* */ /* * ****** GALLERY ******* */ if (class_exists('Galleries', false)) { $gallerySelect = new Galleries(); $select = $gallerySelect->select()->setIntegrityCheck(false)->from('Galleries', array('ID' => 'G_ID', 'CategoryID' => 'G_CategoryID'))->where('G_Online = 1')->join('GalleriesIndex', 'GI_GalleryID = G_ID', array('LanguageID' => 'GI_LanguageID', 'Title' => 'GI_Title', 'Description' => 'GI_Description'))->join('ImagesIndex', 'II_ImageID = G_ImageID', array('ImageTitle' => 'II_Title', 'ImageDescription' => 'II_Description'))->where('II_LanguageID = GI_LanguageID'); $galleryData = $gallerySelect->fetchAll($select); $cpt = count($galleryData); for ($i = 0; $i < $cpt; $i++) { $indexData['action'] = "add"; $indexData['pageID'] = $galleryData[$i]['CategoryID']; $indexData['moduleID'] = 9; $indexData['contentID'] = $galleryData[$i]['ID']; $indexData['languageID'] = $galleryData[$i]['LanguageID']; $indexData['title'] = $galleryData[$i]['Title']; $indexData['text'] = ''; $indexData['link'] = 'gallery'; $indexData['contents'] = $galleryData[$i]['Title'] . " " . $galleryData[$i]['Description'] . " " . $galleryData[$i]['ImageTitle'] . " " . $galleryData[$i]['ImageDescription']; Cible_FunctionsIndexation::indexation($indexData); $imagesSelect = new GalleriesImages(); $select = $imagesSelect->select()->setIntegrityCheck(false)->from('Galleries_Images', array('ID' => 'GI_ImageID'))->where('GI_GalleryID = ?', $galleryData[$i]['ID'])->where('GI_Online = 1')->join('ImagesIndex', 'II_ImageID = GI_ImageID', array('LanguageID' => 'II_LanguageID', 'Title' => 'II_Title', 'Description' => 'II_Description')); $imagesData = $imagesSelect->fetchAll($select); $cptImage = count($imagesData); for ($y = 0; $y < $cptImage; $y++) { $indexData['action'] = "add"; $indexData['pageID'] = $galleryData[$i]['CategoryID']; $indexData['moduleID'] = 9; $indexData['contentID'] = $galleryData[$i]['ID']; $indexData['languageID'] = $imagesData[$y]['LanguageID']; $indexData['title'] = $imagesData[$y]['Title']; $indexData['text'] = ''; $indexData['link'] = 'image'; $indexData['contents'] = $imagesData[$y]['Title'] . " " . $imagesData[$y]['Description']; Cible_FunctionsIndexation::indexation($indexData); } } } /* * ********************* */ /* * ****** NEWSLETTERS ******* */ if (class_exists('NewsletterRelease', false)) { $newsletterSelect = new NewsletterReleases(); $select = $newsletterSelect->select()->from('Newsletter_Releases', array('ID' => 'NR_ID', 'LanguageID' => 'NR_LanguageID', 'Title' => 'NR_Title'))->where('NR_Online = 1'); $newsletterData = $newsletterSelect->fetchAll($select)->toArray(); $cpt = count($newsletterData); for ($i = 0; $i < $cpt; $i++) { $indexData['action'] = "add"; $indexData['pageID'] = $newsletterData[$i]['ID']; $indexData['moduleID'] = 8; $indexData['contentID'] = $newsletterData[$i]['ID']; $indexData['languageID'] = $newsletterData[$i]['LanguageID']; $indexData['title'] = $newsletterData[$i]['Title']; $indexData['text'] = ''; $indexData['link'] = 'release'; $indexData['contents'] = $newsletterData[$i]['Title']; Cible_FunctionsIndexation::indexation($indexData); $articlesSelect = new NewsletterArticles(); $select = $articlesSelect->select()->from('Newsletter_Articles', array('ID' => 'NA_ID', 'Title' => 'NA_Title', 'Resume' => 'NA_Resume', 'Text' => 'NA_Text'))->where('NA_ReleaseID = ?', $newsletterData[$i]['ID']); $articlesData = $articlesSelect->fetchAll($select); $cptArticle = count($articlesData); for ($y = 0; $y < $cptArticle; $y++) { $indexData['action'] = "add"; $indexData['pageID'] = $newsletterData[$i]['ID']; $indexData['moduleID'] = 8; $indexData['contentID'] = $articlesData[$y]['ID']; $indexData['languageID'] = $newsletterData[$i]['LanguageID']; $indexData['title'] = $articlesData[$y]['Title']; $indexData['text'] = ''; $indexData['link'] = 'article'; $indexData['contents'] = $articlesData[$y]['Title'] . " " . $articlesData[$y]['Resume'] . " " . $articlesData[$y]['Text']; Cible_FunctionsIndexation::indexation($indexData); } } } /* * ********************* */ }
<?php require_once 'includes/widgets/header.php'; require_once 'includes/widgets/sidebar.php'; use libAllure\Sanitizer; use libAllure\Session; $gallery = Galleries::getById(Sanitizer::getInstance()->filterUint('id')); $files = $gallery->fetchImages(); try { $tpl->assign('event', Events::getByGalleryId($gallery['id'])); } catch (Exception $e) { $tpl->assign('event', null); } $tpl->assign('privViewUnpublished', Session::hasPriv('GALLERY_VIEW_UNPUBLISHED')); $tpl->assign('files', $files); $tpl->assign('gallery', $gallery); $tpl->display('viewGallery.tpl'); require_once 'includes/widgets/footer.php';
function getGallery() { return Galleries::FindBySlug("portfolioGal_" . $this->id . "_" . $this->name); }
use libAllure\Session; if (!Session::hasPriv('GALLERY_SCAN')) { throw new PermissionsException(); } if (!isset($_REQUEST['reallyDoIt'])) { $tpl->assign('title', 'Scan image gallery'); $msg = ''; $msg .= '<p>This page allows you to scan the image gallery for problems like missing thumbnails or badly named directories. This scans the entire gallery, can take a while and put a load on the webserver. Try to do it at quiet times.</p>'; $msg .= '<p><a href = "?mode=scanImageGallery&reallyDoIt=yuppers">Okay, scan the gallery!</a></p>'; $tpl->assign('message', $msg); $tpl->display('notification.tpl'); require_once 'includes/widgets/footer.php'; } $galleryDir = scandir('resources/images/galleries/'); $results = array(); foreach ($galleryDir as $gallery) { Galleries::checkDirectory($gallery, $results); } if (count($results) == 0) { $tpl->assign('title', 'Gallery scan'); $tpl->assign('message', 'There were no errors found in the gallery scan! Yay! Now you can go and play outside!'); $tpl->display('notification.tpl'); } else { $tpl->assign('Gallery scan'); $tpl->assign('message', 'Uh oh, there were errors'); $tpl->display('notification.tpl'); echo '<div class = "box"><pre>'; echo implode('<br />', $results); echo '</pre></div>'; } require_once 'includes/widgets/footer.php';