]> _ Git - cubedesigners-v7.git/commitdiff
- Remove old realisations.js code that is no longer used (from previous version)
authorstephen@cubedesigners.com <stephen@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Mon, 19 Jan 2015 14:16:07 +0000 (14:16 +0000)
committerstephen@cubedesigners.com <stephen@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Mon, 19 Jan 2015 14:16:07 +0000 (14:16 +0000)
- Modify fermer link on realisations to improve performance in Chrome (uses history.back() when a valid referrer is set)
- Important security update to .htaccess to block access to .ini and framework files
- Turn off dev mode for production site in application.ini

.htaccess
framework/application/configs/application.ini
framework/application/views/helpers/Realisation.php
js/realisations.js

index 88807f0ea8e0c868b4e673d57c14b57d82bf9b45..ae0ab6c34bdaa70c01a18f141e84360005238af5 100644 (file)
--- a/.htaccess
+++ b/.htaccess
        RewriteCond %{HTTP_HOST} =cubedesigners.com [OR]
        RewriteCond %{HTTP_HOST} =www.cubedesigners.com
        RewriteRule ^(.*)$ http://www.cubedesigners.fr/$1 [R=301,L]
+
+    # Block browser access to the framework folder and sensitive files
+    RewriteRule ^framework/.*$ - [F]
+    RewriteRule ^.*\.ini$ - [F]
+
        # Redirect auth header to env
        RewriteRule ^.*$ - [E=REMOTE_USER:%{HTTP:Authorization}]
        # Skip static files
index e0636967ce9eb42ebb331619aae7e4e7d487ad51..e65f934ccf42e6a6d26126a0568996fbc9f91d68 100644 (file)
@@ -1,5 +1,5 @@
 [production]
-dev = true
+dev = false
 
 minify.js = true
 minify.css = true
index 12eaeaa60f8250cc8085c30bdfe2e5fc3fc2328a..84b59697c200bbce37fee4e5127cffa4b9619e93 100644 (file)
@@ -12,8 +12,8 @@ class Cubedesigners_View_Helper_Realisation extends CubeIT_View_Helper_Abstract
                $res .= '<div class="content">';
                $res .= '<h1>' . $r->titre . '</h1>';
                $res .= '<h2>' . Cubedesigners_Util::getCategoryById($r->categories) . '</h2>';
-               $res .= $this->view->link(__('Fermer'), $this->currentPage->getParent()->getHref(), array('class' => 'close'));
-               $res.='</div>';
+        $res .= $this->view->link(__('Fermer'), $this->currentPage->getParent()->getHref(), array('class' => 'close', 'id' => 'closeButton'));
+        $res.='</div>';
 
                $slides = array();
                foreach ($r->visuel_detail as $s) {
index b459321614f346a95794392efe2ea3733cf28852..2fb382859c64c59dff824edd866e38d5932d55cd 100644 (file)
-TO_LOAD_ONCE[TO_LOAD_ONCE.length] = 'load_realisations();';
+registerLoader(loadRealisations);
 
-var showIds = new Array();
-var isAnim = false;
-var currentOpen = 0;
-var currentOpenValues;
-var detail = "";
-var currentSlide = 1;
-var autoSlide = false;
-var totalWidth;
-var lastWidth;
-var showIds = new Array();
+function loadRealisations() {
 
-function load_realisations() {
-       initTagsLink();
-
-       $(".bloc").click(function () {
-
-               var currentRea = $(this).attr("data-pos");
-
-               if (!isAnim && currentRea != currentOpen) {
-
-                       isAnim = true;
-
-                       var reaWidth = $(this).width() + parseInt($(this).css("margin-right").split("px")[0]);
-                       var reaId = $(this).parent().attr("data-id");
-                       var reaPerRow = $(this).parent().parent().width() / reaWidth;
-
-                       var nbReas = $('.project-photo').length;
-
-                       var nbRow = Math.ceil(nbReas / reaPerRow);
-
-                       var reaPos = 1;
-                       var count = 0;
-
-                       var cible = $("#realisations-list").find("[data-pos='1']");
-
-                       while (count < currentRea) {
-                               count++;
-                               if ((count % (reaPerRow + 1)) == 0) {
-                                       reaPos++;
-                                       cible = $("#realisations-list").find("[data-pos='" + count + "']");
-                               }
-                       }
-
-                       detail = "";
-
-                       $.ajax({
-                               url: '/ajax/displayrealisation',
-                               type: 'GET',
-                               data: 'realisation_id=' + reaId,
-                               complete: function (ret) {
-
-                                       var response = JSON.parse(ret.responseText);
-                                       var rea = response.vars.rea;
-
-                                       currentOpenValues = rea;
-
-                                       detail += '<div id="detailContent"><div id="detail">';
-                                       detail += '<div class="detailLeft">';
-                                       detail += '<div class="titre">' + rea.titre + '</div>';
-
-                                       if (rea.legende != '') {
-                                               detail += '<div class="legende">' + rea.legende + '</div>';
-                                       }
-
-                                       if (rea.agence != '') {
-                                               detail += '<div class="agence">Agence : ' + rea.agence + '</div>';
-                                       }
-
-
-                                       detail += '<ul class="taglist">';
-                                       detail += '<li>' + rea.annee + '</li>';
-
-                                       for (var i = 0; i < rea.tags_secondaires.length; i++) {
-                                               detail += '<li>' + rea.tags_secondaires[i] + '</li>';
-                                       }
-
-                                       detail += '</ul>';
-
-
-                                       detail += '<div class="description">' + rea.description + '</div>';
-                                       detail += '<a class="link" href="' + rea.url + '">Voir le site</a>';
-                                       detail += '</div>';
-                                       detail += '<div class="detailRight"><div class="slides"><ul>';
-
-                                       totalWidth = 0;
-                                       for (var i = 0; i < rea.visuel_detail.length; i++) {
-
-                                               var image = new Image();
-                                               image.src = rea.visuel_detail[i];
-                                               totalWidth += image.width;
-
-                                               if (i == (rea.visuel_detail.length - 1)) {
-                                                       lastWidth = image.width;
-                                               }
-
-                                               detail += '<li><img id="visuel_detail" src="' + rea.visuel_detail[i] + '" /></li>';
-                                       }
-
-                                       detail += '</ul></div></div>';
-                                       detail += '</div><div class="close"></div></div>';
-
-                                       if ($("#detail").length > 0) {
-                                               $("#detail").slideUp(500, function () {
-
-                                                       $('#detailContent').remove();
-
-                                                       $(cible.parent()).before(detail);
-
-                                                       $("html, body").animate({scrollTop: $('#detailContent').offset().top - 100}, 1000);
-                                                       $('.close').css("top", $('#detailContent').offset().top);
-
-                                                       $("#detail").slideDown("slow", function () {
-                                                               isAnim = false;
-                                                               addCloseAction();
-                                                               currentSlide = 1;
-                                                               autoSlide = true;
-                                                               initSlideShow();
-
-                                                       }).animate(
-                                                                       {opacity: 1},
-                                                       {queue: true, duration: 'slow'}
-                                                       );
-
-                                               }).animate(
-                                                               {opacity: 1},
-                                               {queue: true, duration: 'slow'}
-                                               );
-                                       } else {
-                                               $(cible.parent()).before(detail);
-
-                                               $("html, body").animate({scrollTop: $('#detailContent').offset().top - 100}, 1000);
-                                               $('.close').css("top", $('#detailContent').offset().top);
-                                               /*
-                                                $( "#detail" ).slideDown( "slow", function() {
-                                                
-                                                isAnim = false;
-                                                addCloseAction();
-                                                currentSlide = 1;
-                                                autoSlide = true;
-                                                initSlideShow();
-                                                
-                                                }).animate(
-                                                { opacity: 1 },
-                                                { queue: true, duration: 'slow' }
-                                                );*/
-
-
-                                               $("#detail").addClass("showDown");
-                                               $('#detail').one("webkitTransitionEnd transitionend oTransitionEnd msTransitionEnd transitionEnd", function (e) {
-                                                       isAnim = false;
-                                                       addCloseAction();
-                                                       currentSlide = 1;
-                                                       autoSlide = true;
-                                                       initSlideShow();
-                                               });
-
-                                       }
-
-                                       /*$(".project-photo").each( function() {
-                                        var id = $(this).parent().attr("data-pos");
-                                        if( id != currentRea ) {
-                                        $(this).addClass("gray");
-                                        }else{
-                                        $(this).removeClass("gray");
-                                        }
-                                        });*/
-                               }
-
-                       });
-
-
-               }
-
-               currentOpen = currentRea;
-       });
-}
-
-function addCloseAction() {
-       $(".close").click(function () {
-               $("html, body").animate({scrollTop: 0}, 1000);
-
-               /* $( "#detail" ).slideUp( "slow", function() {
-                $('#detailContent').remove();
-                currentOpen = 0;
-                $(".project-photo").each( function() {
-                $(this).removeClass("gray");
-                });
-                }).animate(
-                { opacity: 1 },
-                { queue: false, duration: 'slow' }
-                );*/
-
-               $("#detail").addClass("showUp");
-               $('#detail').one("webkitTransitionEnd transitionend oTransitionEnd msTransitionEnd transitionEnd", function (e) {
-                       currentOpen = 0;
-                       $(".project-photo").each(function () {
-                               $(this).removeClass("gray");
-                       });
-               });
-
-       });
-}
-
-function initTagsLink() {
-
-       $(".tag").click(function () {
-
-               $(".close").click();
-
-               $(this).toggleClass('active');
-
-               if ($(this).hasClass('active')) {
-                       if ($(this).attr("data-id") != 0) {
-                               showIds.push($(this).attr("data-id"));
-                       } else {
-                               showIds = new Array();
-                               $(".tag").removeClass('active');
-                       }
-               } else {
-                       var index = $.inArray($(this).attr("data-id"), showIds);
-                       showIds.splice(index, 1);
-               }
-
-               if (showIds.length > 0) {
-                       $(".tag:first").removeClass('active');
-               } else {
-                       $(".tag:first").addClass('active');
-               }
-
-               displayRealisations();
-       });
-
-}
-
-function displayRealisations() {
-
-       if (showIds.length) {
-               $('#realisations-list .bloc').each(function () {
-                       var categories = $(this).attr("data-categories");
-                       if ($.inArray(categories, showIds) == -1) {
-                               $(this).parent().fadeOut(500, function () {
-                               });
-                       } else {
-                               $(this).parent().fadeIn(500, function () {
-                               });
-                       }
-               });
-       } else {
-               $('#realisations-list .bloc').parent().fadeIn(500, function () {
-               });
-       }
-
-}
-
-function initSlideShow() {
-
-       var mouse_move = false;
-       function move(e) {
-               if (mouse_move) {
-                       if (document.documentElement.clientWidth > 0) {
-
-                               position = e.pageX - document.documentElement.scrollLeft;
-                       } else {
-                               position = e.pageX - document.body.scrollLeft;
-                       }
-               }
-       }
-       document.onmousemove = move;
-
-       $(".slides").mouseover(function (e) {
-
-               mouse_move = true;
-               le_div = '.' + 'slides';
-
-               if ($(le_div + " ul li").length > 1) {
-
-                       var total_lenght = totalWidth;
-
-                       var t = setInterval(function () {
-
-                               var offset = $(le_div).offset();
-
-                               if ((position - offset.left) < ($("#detailContent").width() / 2)) {
-                                       if ($(le_div + " ul").css('marginLeft').replace("px", "") > -(total_lenght - lastWidth)) {
-                                               $(le_div + " ul").animate({marginLeft: "-=2px"}, 0);
-                                       }
-                               } else {
-                                       if ($(le_div + " ul").css('marginLeft').replace("px", "") <= 0) {
-                                               $(le_div + " ul").animate({marginLeft: "+=2px"}, 0);
-                                       }
-                               }
-
-                       }, 5);
-
-                       $(le_div).mouseout(function () {
-                               clearInterval(t);
-                               mouse_move = false;
-                       });
-               }
-       });
+    // Check referrer and if it is a cubedesigners page, switch to a history.back() link instead of a standard link to speed things up
+    if(document.referrer.indexOf("cubedesigners.") > -1) {
+        $("#closeButton").on('click',function(){
+            history.back();
+            return false;
+        });
 
+    }
 }
\ No newline at end of file