Pārlūkot izejas kodu

Add files via upload

Capitan Cloud 1 gadu atpakaļ
vecāks
revīzija
e17ca2d921
1 mainītis faili ar 60 papildinājumiem un 20 dzēšanām
  1. 60 20
      Private/scripts/home.php

+ 60 - 20
Private/scripts/home.php

@@ -84,7 +84,13 @@
  $magicJar2 = (int)substr(strip_tags(filter_input(INPUT_POST, "txtMagicJar2")??""), 0, 1);
  $magicJar3 = (int)substr(strip_tags(filter_input(INPUT_POST, "txtMagicJar3")??""), 0, 1);
 
- 
+ if ($CURRENT_VIEW === PUBLIC_VIEW ) {
+     $MAXP = (int)substr(strip_tags(filter_input(INPUT_GET, "maxp")??""), 0, 2);
+     if ($MAXP === 0) {
+       $MAXP = APP_BLOG_MAX_POSTS;
+     }  
+ }
+  
  function uploadNewRes() {
 
    global $AVATAR_PATH;
@@ -371,6 +377,34 @@
 
   <link rel="shortcut icon" href="/favicon.ico" />
 
+<?PHP if ($CURRENT_VIEW == PUBLIC_VIEW): ?> 
+ <script>
+ function renderCorrectPag () {
+      if (window.innerWidth <= 500) {
+         if (<?PHP echo($MAXP) ?>!=<?PHP echo(APP_BLOG_ULTRATHIN_MAX_POSTS) ?>) {
+             window.open("http://<?php echo $_SERVER['HTTP_HOST'];?>/?maxp=<?PHP echo(APP_BLOG_ULTRATHIN_MAX_POSTS) ?>","_self");
+          }   
+      } else if (window.innerWidth <= 850) {
+          if (<?PHP echo($MAXP) ?>!=<?PHP echo(APP_BLOG_THIN_MAX_POSTS) ?>) {
+             window.open("http://<?php echo $_SERVER['HTTP_HOST'];?>/?maxp=<?PHP echo(APP_BLOG_THIN_MAX_POSTS) ?>","_self");
+          }  
+      } else {
+          if (<?PHP echo($MAXP) ?>!=<?PHP echo(APP_BLOG_MAX_POSTS) ?>) {
+             window.open("http://<?php echo $_SERVER['HTTP_HOST'];?>/?maxp=<?PHP echo(APP_BLOG_MAX_POSTS) ?>","_self");
+          }  
+      }
+ }
+ 
+  window.addEventListener("load", function() {
+     renderCorrectPag();
+  }, false);
+  
+  window.addEventListener("resize", function() {
+     renderCorrectPag();
+  }, false);
+ </script>
+<?PHP endif; ?>
+
   <meta name="description" content="Welcome to Faceborg! Let everyone have its colorful 'borghetto'."/>
   <meta name="keywords" content="faceborg,on,premise,solution"/>
   <meta name="robots" content="index,follow"/>
@@ -497,23 +531,23 @@
       
       // PAGINATION
 
-      $totPages = (int)(count($aFilePaths)/APP_BLOG_MAX_POSTS); 
-      if ($totPages < (count($aFilePaths)/APP_BLOG_MAX_POSTS)) {
+      $totPages = (int)(count($aFilePaths)/$MAXP); 
+      if ($totPages < (count($aFilePaths)/$MAXP)) {
         $totPages++;
       }
       $firstPost = 0;
-      $prevPost = $blogSP - APP_BLOG_MAX_POSTS;
+      $prevPost = $blogSP - $MAXP;
       if ($prevPost < 0) {
         $prevPost = 0;
       }    
-      $nextPost = $blogSP + APP_BLOG_MAX_POSTS;
-      if ($nextPost > (($totPages - 1) * APP_BLOG_MAX_POSTS)) {
-        $nextPost = (($totPages - 1) * APP_BLOG_MAX_POSTS);
+      $nextPost = $blogSP + $MAXP;
+      if ($nextPost > (($totPages - 1) * $MAXP)) {
+        $nextPost = (($totPages - 1) * $MAXP);
       }
       if ($nextPost < 0) {
         $nextPost = 0;
       }       
-      $lastPost = (($totPages - 1) * APP_BLOG_MAX_POSTS);
+      $lastPost = (($totPages - 1) * $MAXP);
       if ($lastPost < 0) {
         $lastPost = 0;
       }    
@@ -526,7 +560,7 @@
           $iCurEntry++;
           continue;
         }  
-        if ($iEntry>APP_BLOG_MAX_POSTS) {
+        if ($iEntry>$MAXP) {
           break;
         }
         $orifilename = basename($filePath);
@@ -534,7 +568,7 @@
         $date = explode("-",$orifilename)[0];
         $time = explode("-",$orifilename)[1];
         $time = left($time,2) . ":" . substr($time,2,2);
-        if ($iEntry === count($aFilePaths) || $iEntry==APP_BLOG_MAX_POSTS) {
+        if ($iEntry === count($aFilePaths) || $iEntry==$MAXP) {
           $marginbottom = "0px";
         } else {
           $marginbottom = "5px";
@@ -547,12 +581,18 @@
                                       <?php if ($iCurEntry===1 && $iEntry===1): ?>
                                        <!--<img class="blog-img" src="/res/arrow-leftd.png" style="float:left;">-->
                                        <?php elseif ($iEntry===1 && $iCurEntry>1): ?>  
-                                       <div style="float:right;position: absolute;left:+1%; opacity:0.85;"><a href="/<?PHP echo(AVATAR_NAME); ?>/?blogSP=<?PHP echo($prevPost);?>" onclick="event.stopPropagation();"><img class="blog-img" src="/res/arrow-left.png" style="float:left;"></a></div>
+                                       <div style="float:right;position: absolute;left:+1%; opacity:0.85;"><a href="/<?PHP echo(AVATAR_NAME); ?>/?blogSP=<?PHP echo($prevPost);?>&maxp=<?PHP echo($MAXP)?>" onclick="event.stopPropagation();"><img class="blog-img" src="/res/arrow-left.png" style="float:left;"></a></div>
                                        <?php endif; ?>
-                                       <?php if ($iEntry===APP_BLOG_MAX_POSTS && $iCurEntry===$totPost): ?>
+                                       <?php if ($iEntry===$MAXP && $iCurEntry===$totPost): ?>
                                        <!--<img class="blog-img" src="/res/arrow-rightd.png" style="float:right;">-->
-                                       <?php elseif ($iEntry===APP_BLOG_MAX_POSTS): ?>
-                                       <div style="float:right;position: absolute;left:+92%; opacity:0.85;"><a href="/<?PHP echo(AVATAR_NAME); ?>/?blogSP=<?PHP echo($nextPost);?>" onclick="event.stopPropagation();"><img class="blog-img" src="/res/arrow-right.png" style="float:right;"></a></div>
+                                       <?php elseif ($iEntry===$MAXP): ?>
+                                          <?PHP if ($MAXP===APP_BLOG_ULTRATHIN_MAX_POSTS): ?> 
+                                            <div style="float:right;position: absolute;left:+65%; opacity:0.85;"><a href="/<?PHP echo(AVATAR_NAME); ?>/?blogSP=<?PHP echo($nextPost);?>&maxp=<?PHP echo($MAXP)?>" onclick="event.stopPropagation();"><img class="blog-img" src="/res/arrow-right.png" style="float:right;"></a></div>
+                                          <?PHP elseif ($MAXP===APP_BLOG_THIN_MAX_POSTS): ?>   
+                                            <div style="float:right;position: absolute;left:+82%; opacity:0.85;"><a href="/<?PHP echo(AVATAR_NAME); ?>/?blogSP=<?PHP echo($nextPost);?>&maxp=<?PHP echo($MAXP)?>" onclick="event.stopPropagation();"><img class="blog-img" src="/res/arrow-right.png" style="float:right;"></a></div>                                          
+                                          <?PHP else: ?>                                            
+                                            <div style="float:right;position: absolute;left:+92%; opacity:0.85;"><a href="/<?PHP echo(AVATAR_NAME); ?>/?blogSP=<?PHP echo($nextPost);?>&maxp=<?PHP echo($MAXP)?>" onclick="event.stopPropagation();"><img class="blog-img" src="/res/arrow-right.png" style="float:right;"></a></div>
+                                          <?php endif; ?>  
                                        <?php endif; ?>
                                 <?PHP else: ?>
                                        &nbsp;
@@ -574,7 +614,7 @@
    
       <?PHP endif; ?>
 
-    <?PHP for($i=$iEntry;$i<=APP_BLOG_MAX_POSTS;$i++):?>
+    <?PHP for($i=$iEntry;$i<=$MAXP;$i++):?>
             <div class="blog-content"> 
              <div class="blog-entry" style="border:0px;">  
                  &nbsp;
@@ -582,14 +622,14 @@
             </div>   
    <?PHP endfor; ?>
    
-   <?PHP if ((APP_BLOG_MAX_POSTS / 3) > (int)(APP_BLOG_MAX_POSTS / 3)): ?>
+   <?PHP if (($MAXP / 3) > (int)($MAXP / 3)): ?>
             <div class="blog-content"> 
              <div class="blog-entry" style="border:0px;">  
                  &nbsp;
              </div> 
             </div>   
    
-           <?PHP if (((APP_BLOG_MAX_POSTS+1) / 3) > (int)((APP_BLOG_MAX_POSTS+1) / 3)): ?>
+           <?PHP if ((($MAXP+1) / 3) > (int)(($MAXP+1) / 3)): ?>
                  <div class="blog-content"> 
                   <div class="blog-entry" style="border:0px;">  
                       &nbsp;
@@ -978,7 +1018,7 @@
            
  <?PHP endif; ?>           
 
-<script src="/js/home-js.php?hl=<?PHP echo($lang);?>&av=<?PHP echo(AVATAR_NAME);?>&cv=<?PHP echo($CURRENT_VIEW);?>&cu=<?PHP echo($CUDOZ);?>" type="text/javascript"></script>
+<script src="/static/js/home-js.php?hl=<?PHP echo($lang);?>&av=<?PHP echo(AVATAR_NAME);?>&cv=<?PHP echo($CURRENT_VIEW);?>&cu=<?PHP echo($CUDOZ);?>" type="text/javascript"></script>
 
 <?PHP if ($CURRENT_VIEW == PUBLIC_VIEW): ?> 
 <script>
@@ -1095,8 +1135,8 @@
     pich = parseInt((h - $(".header").height() - 80) / 3);
     // picw = parseInt(w / 5); ori
     
-    iimg = parseInt(<?PHP echo(APP_BLOG_MAX_POSTS / 3); ?>);
-    if ((<?PHP echo(APP_BLOG_MAX_POSTS / 3); ?>) > parseInt(<?PHP echo(APP_BLOG_MAX_POSTS / 3); ?>)) {
+    iimg = parseInt(<?PHP echo($MAXP / 3); ?>);
+    if ((<?PHP echo($MAXP / 3); ?>) > parseInt(<?PHP echo($MAXP / 3); ?>)) {
       iimg++;
     }  
     picw = parseInt(w / iimg);