瀏覽代碼

Merge branch 'V3_WEB' into V3

Iñigo Valentin 9 年之前
父節點
當前提交
1865cf988d

+ 269 - 172
www/actividades/actividad.php

@@ -1,232 +1,329 @@
 <?php
     session_start();
-    $http_host = $_SERVER['HTTP_HOST'];
+    $http_host = $_SERVER["HTTP_HOST"];
     include("../functions.php");
     $con = startdb();
     $proto = getProtocol();
+    $server = "$proto$http_host";
     
     //Language
     $lang = selectLanguage();
-    include("../lang/lang_" . $lang . ".php");
+    include("../lang/lang_$lang.php");
     
-    $cur_section = $lng['section_activities'];
+    $cur_section = $lng["section_activities"];
     
     // Get current activity id. Redirect if inexistent or invisible
-    $perm = mysqli_real_escape_string($con, $_GET['perm']);
+    $perm = mysqli_real_escape_string($con, $_GET["perm"]);
     $q = mysqli_query($con, "SELECT id, permalink, title_$lang AS title, text_$lang AS text, after_$lang AS after, price, inscription, people, max_people, user, date, DATE_FORMAT(date, '%Y-%m-%d %T') AS cdate, DATE_FORMAT(date, '%Y-%m-%d') AS isodate, DATE_FORMAT(date,'%b %d, %Y') as fdate, dtime, comments, city FROM activity WHERE permalink = '$perm' AND visible = 1;");
     if (mysqli_num_rows($q) == 0){
-        header("Location: $proto$http_host/actividades/");
+        header("Location: $server/actividades/");
         exit(-1);
     }
     $r = mysqli_fetch_array($q);
-    $id = $r['id'];
+    $id = $r["id"];
 ?>
 <!DOCTYPE html>
 <html>
     <head>
         <meta content="text/html; charset=windows-1252" http-equiv="content-type"/>
         <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1">
-        <title><?php echo $r["title"] . " - Gasteizko Margolariak"; ?></title>
-        <link rel="shortcut icon" href="<?php echo "$proto$http_host/img/logo/favicon.ico";?>">
+        <title><?=$r["title"]?> - Gasteizko Margolariak</title>
+        <link rel="shortcut icon" href="<?=$server?>/img/logo/favicon.ico">
         <!-- CSS files -->
         <style>
-            <?php 
-                include("../css/ui.css"); 
-                include("../css/actividades.css");
-            ?>
+<?php 
+            include("../css/ui.css"); 
+            include("../css/actividades.css");
+?>
         </style>
         <!-- CSS for mobile version -->
         <style media="(max-width : 990px)">
-            <?php 
-                include("../css/m/ui.css"); 
-                include("../css/m/actividades.css");
-            ?>
+<?php 
+            include("../css/m/ui.css"); 
+            include("../css/m/actividades.css");
+?>
         </style>
         <!-- Script files -->
         <script type="text/javascript">
-            <?php
-                include("../script/ui.js");
-                include("../script/actividades.js");
-            ?>
+<?php
+            include("../script/ui.js");
+            include("../script/actividades.js");
+?>
         </script>
         <!-- Meta tags -->
-        <link rel="canonical" href="<?php echo "$proto$http_host/actividades/" . $r['permalink']; ?>"/>
-        <link rel="author" href="<?php echo "$proto$http_host"; ?>"/>
-        <link rel="publisher" href="<?php echo "$proto$http_host"; ?>"/>
-        <meta name="description" content="<?php echo strip_tags($r["text"]);?>"/>
-        <meta property="og:title" content="<?php echo $r["title"] . " - Gasteizko Margolariak"; ?>"/>
-        <meta property="og:url" content="<?php echo "$proto$http_host/actividades/" . $r['permalink']; ?>"/>
-        <meta property="og:description" content="<?php echo strip_tags($r["text"]);?>"/>
-        <?php
-            $q_i = mysqli_query($con, "SELECT image FROM activity_image WHERE activity = $id ORDER BY idx;");
-            if (mysqli_num_rows($q_i) == 0)
-                $img = "$proto$http_host/img/logo/cover.png";
-            else{
-                $r_i = mysqli_fetch_array($q_i);
-                $img = "$proto$http_host/img/actividades/preview/" . $r_i['image'];
-            }
-        ?>
-        <meta property="og:image" content="<?php echo $img;?>"/>
+        <link rel="canonical" href="<?=$server?>/actividades/<?=$r["permalink"]?>"/>
+        <link rel="author" href="<?=$server?>"/>
+        <link rel="publisher" href="<?=$server?>"/>
+        <meta name="description" content="<?=strip_tags($r["text"])?>"/>
+        <meta property="og:title" content="<?=$r["title"]?> - Gasteizko Margolariak"/>
+        <meta property="og:url" content="<?=$server?>/actividades/<?=$r["permalink"]?>"/>
+        <meta property="og:description" content="<?=strip_tags($r["text"])?>?>"/>
+<?php
+        $q_i = mysqli_query($con, "SELECT image FROM activity_image WHERE activity = $id ORDER BY idx;");
+        if (mysqli_num_rows($q_i) == 0){
+            $img = "$server/img/logo/cover.png";
+        }
+        else{
+            $r_i = mysqli_fetch_array($q_i);
+            $img = "$server/img/actividades/preview/" . $r_i["image"];
+        }
+?>
+        <meta property="og:image" content="<?=$img?>"/>
         <meta property="og:site_name" content="Gasteizko Margolariak"/>
         <meta property="og:type" content="article"/>
-        <meta property="og:locale" content="<?php echo $lang;?>"/>
+        <meta property="og:locale" content="<?=$lang?>"/>
         <meta property="article:section" content=""/>
         <!--     TODO: Review time format     -->
-        <meta property="article:published-time" content="<?php echo $r['dtime'];?>"/>
-        <meta property="article:modified-time" content="<?php echo $r['dtime'];?>"/>
+        <meta property="article:published-time" content="<?=$r["dtime"]?>"/>
+        <meta property="article:modified-time" content="<?=$r["dtime"]?>"/>
         <meta property="article:author" content="Gasteizko Margolariak"/>
-        <?php
-            $res_tag = mysqli_query($con, "SELECT tag FROM activity_tag WHERE activity = $id;");
-            $tag_string = "vitoria cuadrilla gasteizko margolariak ";
-            while ($row_tag = mysqli_fetch_array($res_tag))
-                $tag_string = $tag_string . " " . $row_tag['tag']
-        ?>
-        <meta property="article:tag" content="<?php echo $tag_string ?>"/>
+<?php
+        $res_tag = mysqli_query($con, "SELECT tag FROM activity_tag WHERE activity = $id;");
+        $tag_string = "vitoria cuadrilla gasteizko margolariak ";
+        while ($row_tag = mysqli_fetch_array($res_tag)){
+            $tag_string = $tag_string . " " . $row_tag["tag"];
+        }
+?>
+        <meta property="article:tag" content="<?=$tag_string?>"/>
         <meta name="twitter:card" content="summary"/>
-        <meta name="twitter:title" content="<?php echo $r["title"] . " - Gasteizko Margolariak";?>"/>
-        <meta name="twitter:description" content="<?php echo strip_tags($r["text"]);?>"/>
-        <meta name="twitter:image" content="<?php echo $img;?>"/>
-        <meta name="twitter:url" content="<?php echo "$proto$http_host/actividades/$r[permalink]"; ?>"/>
+        <meta name="twitter:title" content="<?=$r["title"]?> - Gasteizko Margolariak"/>
+        <meta name="twitter:description" content="<?=strip_tags($r["text"])?>"/>
+        <meta name="twitter:image" content="<?=$img?>"/>
+        <meta name="twitter:url" content="<?=$server?>/actividades/<?=$r["permalink"]?>"/>
         <meta name="robots" content="index follow"/>
     </head>
     <body>
-        <?php include("../header.php"); ?>
+<?php
+        include("../header.php");
+?>
         <div id="content">
-            <?php
-                //Check if it's a past activity or upcoming activity.
-                $c_date = new Datetime();
-                $a_date = date_create_from_format('Y-m-d H:i:s', $r['cdate']);
-                $future = false;
-                if (date_format($a_date, 'U') > date_format($c_date, 'U')){
-                    $future = true;    
-                }
-            ?>
+<?php
+            //Check if it's a past activity or upcoming activity.
+            $c_date = new Datetime();
+            $a_date = date_create_from_format('Y-m-d H:i:s', $r["cdate"]);
+            $future = false;
+            if (date_format($a_date, 'U') > date_format($c_date, 'U')){
+                $future = true;
+            }
+?>
             <div id="middle_column">
                 <div class="section">
-                    <h3 class='section_title' id="activity_title"><?php echo($r['title']); ?> - <?php echo(formatDate($r['date'], $lang, false)); ?></h3>
+                    <h3 class='section_title' id="activity_title"><?=$r["title"]?> - <?=formatDate($r["date"], $lang, false)?></h3>
                     <div class="entry" itemscope itemtype='http://schema.org/Event'>
-                        <?php
-                            echo "<meta itemprop='url' href='$proto$http_host/actividades/$r[permalink]'/>\n";
-                            echo "<meta itemprop='inLanguage' content='$lang'/>\n";
-                            echo "<meta itemprop='name' content='$r[title]'/>\n";
-                            echo "<meta itemprop='description' content='$r[text]'/>\n";
-                            echo "<meta itemprop='startDate endDate' content='$r[isodate]'/>\n";
-                            echo "<meta itemprop='location' content='$r[city]'/>\n";
-                            echo "<div class='hidden' itemprop='organizer' itemscope itemtype='http://schema.org/Organization'>\n";
-                            echo "<meta itemprop='legalName' content='Asociaci&oacute;n Cultural Recreativa Gasteizko Margolariak'/>\n";
-                            echo "<meta itemprop='name' content='Gasteizko Margolariak'/>\n";
-                            echo "<meta itemprop='logo' content='$proto$http_host/img/logo/logo.png'/>\n";
-                            echo "<meta itemprop='foundingDate' content='03-02-2013'/>\n";
-                            echo "<meta itemprop='telephone' content='+34637140371'/>\n";
-                            echo "<meta itemprop='url' content='$proto$http_host'/>\n";
-                            echo "</div>\n";
-                        
-                            if (mysqli_num_rows($q_i) > 0){
-                                echo "<meta itemprop='image' content='$proto$http_host/img/actividades/$r_i[image]'/>\n";
-                                echo "<div id='activity_image'><img src='$proto$http_host/img/actividades/preview/$r_i[image]'/></div>\n";
-                            }
-                            echo "<div id='activity_description'><p>\n";
-                            if ($future == false && strlen($r['after']) > 0){
-                                echo $r['after'];
-                            }
-                            else{
-                                echo $r['text'];
-                            }
-                            echo "</p></div></br>\n";
-                            if ($future){
-                                echo("<div itemscope itemtype='http://schema.org/Offer' id='activity_details'><table id='activity_details'>\n");
-                                echo("<tr><td class='field_name'>$lng[activities_date]</td><td>" . formatDate($r['date'], $lang, false) . "</td></tr>\n");
-                                echo("<tr><td class='field_name'>$lng[activities_city]</td><td>$r[city]</td></tr>\n");
-                                echo "<meta itemprop='priceCurrency' content='EUR'/><meta itemprop='price' content='$r[price]'/>\n";
-                                if ($r['price'] == 0){
-                                    echo "<tr><td class='field_name'>$lng[activities_price]</td><td>$lng[activities_price_0]</td></tr>\n";
+                        <meta itemprop='url' href='<?=$server?>/actividades/<?=$r["permalink"]?>'/>
+                        <meta itemprop='inLanguage' content='$<?=lang?>'/>
+                        <meta itemprop='name' content='<?=$r["title"]?>'/>
+                        <meta itemprop='description' content='<?=$r["text"]?>'/>
+                        <meta itemprop='startDate endDate' content='<?$r["isodate"]?>'/>
+                        <meta itemprop='location' content='<?=$r["city"]?>'/>
+                        <div class='hidden' itemprop='organizer' itemscope itemtype='http://schema.org/Organization'>
+                            <meta itemprop='legalName' content='Asociaci&oacute;n Cultural Recreativa Gasteizko Margolariak'/>
+                            <meta itemprop='name' content='Gasteizko Margolariak'/>
+                            <meta itemprop='logo' content='<?=$server?>/img/logo/logo.png'/>
+                            <meta itemprop='foundingDate' content='03-02-2013'/>
+                            <meta itemprop='telephone' content='+34637140371'/>
+                            <meta itemprop='url' content='<?=$server?>'/>
+                        </div>
+<?php
+                        if (mysqli_num_rows($q_i) > 0){
+?>
+                            <meta itemprop='image' content='</=$server?>/img/actividades/<?=$r_i["image"]?>'/>
+                            <div id='activity_image'>
+                                <img src='<?=$server?>/img/actividades/preview/<?=$r_i["image"]?>'/>
+                            </div>
+<?php
+                        }
+?>
+                        <div id='activity_description'>
+                            <p>
+<?php
+                                if ($future == false && strlen($r["after"]) > 0){
+?>
+                                    <?=$r["after"]?>
+<?php
                                 }
                                 else{
-                                    echo "<tr><td class='field_name'>$lng[activities_price]</td><td>$r[price]€</td></tr>\n";
-                                    if ($r['max_people'] != 0){
-                                        echo "<tr><td class='field_name'>$lng[activities_maxpeople]</td><td>$r[max_people]</td></tr>\n";
-                                    }
-                                    /*if ($r['inscription'] == 1){
-                                        echo "<tr><td class='field_name'>$lng[activities_inscription]</td><td>$lng[yes]</td></tr>\n";
+?>
+                                    <?=$r["text"]?>
+<?php
+                                }
+?>
+                            </p>
+                        </div> <!-- .activity_description -->
+                        <br/>
+<?php
+                        if ($future){
+?>
+                            <div itemscope itemtype='http://schema.org/Offer' id='activity_details'>
+                                <table id='activity_details'>
+                                    <tr>
+                                        <td class='field_name'><?=$lng["activities_date"]?></td>
+                                        <td><?=formatDate($r["date"], $lang, false)?></td>
+                                    </tr>
+                                    <tr>
+                                        <td class='field_name'><?=$lng["activities_city"]?></td>
+                                        <td><?=$r["city"]?></td>
+                                    </tr>
+                                    <meta itemprop='priceCurrency' content='EUR'/>
+                                    <meta itemprop='price' content='<$r["price"]?>'/>
+<?php
+                                    if ($r["price"] == 0){
+?>
+                                        <tr>
+                                            <td class='field_name'><?=$lng["activities_price"]?></td>
+                                            <td><?=$lng["activities_price_0"]?></td>
+                                        </tr>
+<?php
                                     }
                                     else{
-                                        echo "<tr><td class='field_name'>$lng[activities_inscription]</td><td>$lng[no]</td></tr>\n";
-                                    }*/
-                                }
-                                echo "</table></div>\n";
-                                echo("</div><br/><div class='entry'>\n");
-                                $q_it = mysqli_query($con, "SELECT activity_itinerary.name_$lang AS name, description_$lang AS description, place.name_$lang AS place_name, place.address_$lang AS place_address, DATE_FORMAT(start, '%H:%i') AS start, DATE_FORMAT(end, '%H:%i') AS end, DATE_FORMAT(start, '%Y-%m-%d') AS isostart, DATE_FORMAT(end, '%Y-%m-%d') AS isoend FROM activity_itinerary, place WHERE place.id = activity_itinerary.place AND activity = $r[id] ORDER BY start;");
-                                if (mysqli_num_rows($q_it) > 0){
-                                    echo "<div id='activity_itinerary'><h3 class='entry_title'>Itinerario</h3>\n";
-                                    echo "<table id='activity_itinerary'>\n";
-                                    echo "<tr class='th'><th>$lng[activities_when]</th><th>$lng[activities_what]</th></tr>\n";
-                                    while ($r_it = mysqli_fetch_array($q_it)){
-                                        echo "<tr>\n";
-                                        echo "<div class='hidden' itemprop='subEvent' itemscope itemtype='http://schema.org/Event'>\n";
-                                        echo "<meta itemprop='inLanguage' content='$lang'/>\n";
-                                        echo "<meta itemprop='name' content='$r_it[name]'/>\n";
-                                        echo "<meta itemprop='description' content='$r_it[description]'/>\n";
-                                        echo "<meta itemprop='startDate' content='$r_it[isostart]'/>\n";
-                                        echo "<meta itemprop='location' content='$r_it[place_name]'/>\n";
-                                        if (strlen($r_it['end']) > 0){
-                                            echo "<meta itemprop='endDate' content='$r_it[place_end]'/>\n";
-                                        }
-                                        echo "</div>\n";
-                                        if (strlen($r_it['end']) > 0){
-                                            echo "<td>$r_it[start] - $r_it[end]</td>";
-                                        }
-                                        else{
-                                            echo "<td class='time'>$r_it[start]</td>";
-                                        }
-                                        echo "<td><h5>$r_it[name]</h5><p class='description'>$r_it[description]</p><br/>\n";
-                                        if ($r_it['place_name'] == $r_it['place_address']){
-                                            echo "$r_it[place_name]</td>\n";
-                                        }
-                                        else{
-                                            echo "$r_it[place_name]<span class='address'>($r_it[place_address])</span></td>\n";
+?>
+                                        <tr>
+                                            <td class='field_name'><?=$lng["activities_price"]?></td>
+                                            <td><?=$r["price"]?>€</td>
+                                        </tr>
+<?php
+                                        if ($r["max_people"] != 0){
+?>
+                                            <tr>
+                                                <td class='field_name'><?=$lng["activities_maxpeople"]?></td>
+                                                <td><?=$r["max_people"]?></td>
+                                            </tr>
+<?php
                                         }
-                                        echo "</tr>\n";
                                     }
-                                    echo "</table></div>";
-                                }
-                            }
-                        ?>
-                    </div>
-                </div>
-            </div>
+?>
+                                </table> <!-- activity_details -->
+                            </div> <!-- activity_details -->
+<?php
+                        
+?>
+                            </div> <!-- .entry -->
+                            <br/>
+                            <div class='entry'>
+<?php
+                                $q_it = mysqli_query($con, "SELECT activity_itinerary.name_$lang AS name, description_$lang AS description, place.name_$lang AS place_name, place.address_$lang AS place_address, DATE_FORMAT(start, '%H:%i') AS start, DATE_FORMAT(end, '%H:%i') AS end, DATE_FORMAT(start, '%Y-%m-%d') AS isostart, DATE_FORMAT(end, '%Y-%m-%d') AS isoend FROM activity_itinerary, place WHERE place.id = activity_itinerary.place AND activity = $r[id] ORDER BY start;");
+                                if (mysqli_num_rows($q_it) > 0){
+?>
+                                    <div id='activity_itinerary'>
+                                        <!-- TODO: Routes -->
+                                        <h3 class='entry_title'><?=$lng["activity_itinerary"]?></h3>
+                                        <table id='activity_itinerary'>
+                                            <tr class='th'>
+                                                <th><?=$lng["activities_when"]?></th>
+                                                <th><?=$lng["activities_what"]?></th>
+                                            </tr>
+<?php
+                                            while ($r_it = mysqli_fetch_array($q_it)){
+?>
+                                                <tr>
+                                                    <div class='hidden' itemprop='subEvent' itemscope itemtype='http://schema.org/Event'>
+                                                        <meta itemprop='inLanguage' content='<?=$lang?>'/>
+                                                        <meta itemprop='name' content='<?=$r_it["name"]?>'/>
+                                                        <meta itemprop='description' content='<?=$r_it["description"]?>'/>
+                                                        <meta itemprop='startDate' content='<?=$r_it["isostart"]?>'/>
+                                                        <meta itemprop='location' content='<?=$r_it["place_name"]?>'/>
+<?php
+                                                        if (strlen($r_it["end"]) > 0){
+?>
+                                                            <meta itemprop='endDate' content='<?=$r_it["place_end"]?>'/>
+<?php
+                                                        }
+?>
+                                                    </div>
+<?php
+                                                    if (strlen($r_it["end"]) > 0){
+?>
+                                                        <td><?=$r_it["start"]?> - <?=$r_it["end"]?></td>
+<?php
+                                                    }
+                                                    else{
+?>
+                                                        <td class='time'><?=$r_it["start"]?></td>
+<?php
+                                                    }
+?>
+                                                    <td>
+                                                        <h5><?=$r_it["name"]?></h5>
+                                                        <p class='description'><?=$r_it["description"]?></p>
+                                                        <br/>
+<?php
+                                                        if ($r_it["place_name"] == $r_it["place_address"]){
+?>
+                                                            <?=$r_it["place_name"]?>
+<?php
+                                                        }
+                                                        else{
+?>
+                                                            <?=$r_it["place_name"]?>
+                                                            <span class='address'>(<?=$r_it["place_address"]?>)</span>
+<?php
+                                                        }
+?>
+                                                    </td>
+                                                </tr>
+<?php
+                                            } // while ($r_it = mysqli_fetch_array($q_it))
+?>
+                                        </table> <!-- #activity_itinerary -->
+                                    </div> <!-- #activity_itinerary -->
+<?php
+                                } // if (mysqli_num_rows($q_it) > 0)
+?>
+                            </div> <!-- .entry -->
+<?php                    
+                        } //  if ($future)
+?>                    
+                    </div> <!-- .section -->
+                </div> <!-- .entry -->
+            </div> <!-- #middle_column -->
             <div id="right_column">
                 <div id="archive" class="section desktop">
-                    <h3 class="section_title"><?php echo $lng['activities_archive']; ?></h3>
+                    <h3 class="section_title"><?=$lng["activities_archive"] ?></h3>
                     <div class='entry'>
-                        <?php
-                            $res_year = mysqli_query($con, "SELECT year(date) AS year FROM activity WHERE visible = 1 GROUP BY year(date) ORDER BY year DESC;");
-                            while($row_year = mysqli_fetch_array($res_year)){
-                                echo "<div class='year pointer' onClick=\"toggleElement('year_$row_year[year]');\">";
-                                echo("<img class='slid' id='slid_year_$row_year[year]' src='$proto$http_host/img/misc/slid-right.png' alt=' '/><span class='fake_a'>$row_year[year]</span>");
-                                echo "</div>\n";
-                                echo "<div class='list_year pointer' id='list_year_$row_year[year]'>\n";
+<?php
+                        $res_year = mysqli_query($con, "SELECT year(date) AS year FROM activity WHERE visible = 1 GROUP BY year(date) ORDER BY year DESC;");
+                        while($row_year = mysqli_fetch_array($res_year)){
+?>
+                            <div class='year pointer' onClick='toggleElement("year_<?=$row_year["year"]?>");'>
+                                <img class='slid' id='slid_year_<?=$row_year["year"]?>' src='<?=$server?>/img/misc/slid-right.png' alt='<?=$row_year["year"]?>'/>
+                                <span class='fake_a'><?=$row_year["year"]?></span>
+                            </div>
+                            <div class='list_year pointer' id='list_year_<?=$row_year["year"]?>'>
+<?php
                                 $res_month = mysqli_query($con, "SELECT month(date) AS month FROM activity WHERE visible = 1 AND year(date) = $row_year[year] GROUP BY month(date) ORDER BY month DESC;");
                                 while($row_month = mysqli_fetch_array($res_month)){
-                                    echo "<div class='month pointer' onClick=\"toggleElement('month_$row_year[year]_$row_month[month]');\">";
-                                    echo("<img class='slid' id='slid_month_$row_year[year]_$row_month[month]' src='$proto$http_host/img/misc/slid-right.png' alt=' '/><span class='fake_a'>" . $lng['months'][$row_month['month'] - 1] . "</span>");
-                                    echo "</div>\n";
-                                    echo "<ul id='list_month_$row_year[year]_$row_month[month]' class='activity_list'>\n";
+?>                                
+                                    <div class='month pointer' onClick='toggleElement("month_<?=$row_year["year"]?>_<?=$row_month["month"]?>");'>
+                                        <img class='slid' id='slid_month_<?=$row_year["year"]?>_<?=$row_month["month"]?>' src='<?=$server?>/img/misc/slid-right.png' alt='<?=$row_year["year"]?>_<?=$row_month["month"]?>'/>
+                                        <span class='fake_a'><?=$lng["months"][$row_month["month"] - 1]?></span>
+                                    </div>
+                                    <ul id='list_month_<?=$row_year["year"]?>_<?=$row_month["month"]?>' class='activity_list'>
+<?php
                                     $res_title = mysqli_query($con, "SELECT id, permalink, title_$lang AS title FROM activity WHERE visible = 1 AND year(date) = $row_year[year] AND month(date) = '$row_month[month]' ORDER BY date DESC;");
-                                    while($row_title = mysqli_fetch_array($res_title))
-                                        echo "<li><a href='$proto$http_host/actividades/" . $row_title['permalink']  . "'>$row_title[title]</a></li>\n";
-                                    echo "</ul>\n";
+                                    while($row_title = mysqli_fetch_array($res_title)){
+?>
+                                        <li>
+                                            <a href='<?=$server?>/actividades/<?=$row_title["permalink"]?>'><?=$row_title["title"]?></a>
+                                        </li>
+<?php
+                                    }
+?>
+                                    </ul>
+<?php
                                 }
-                                echo "</div>\n";
-                            }
-                        ?>
-                    </div>
-                </div>
-            </div>
-        </div>
-        <?php
-            include("../footer.php");
-            $ad = ad($con, $lang, $lng); 
-            stats($ad, $ad_static, "actividades", "$id");
-        ?>
+?>
+                            </div> <!-- #list_year_<?=$row_year["year"]?> -->
+<?php
+                        }
+?>
+                    </div> <!-- .entry -->
+                </div> <!-- #archive -->
+            </div> <!-- #right_column -->
+        </div> <!-- #content -->
+<?php
+        include("../footer.php");
+        $ad = ad($con, $lang, $lng); 
+        stats($ad, $ad_static, "actividades", "$id");
+?>
     </body>
 </html>

+ 260 - 170
www/actividades/index.php

@@ -1,15 +1,16 @@
 <?php
     session_start();
-    $http_host = $_SERVER['HTTP_HOST'];
+    $http_host = $_SERVER["HTTP_HOST"];
     include("../functions.php");
     $con = startdb();
     $proto = getProtocol();
-    
+    $server = "$proto$http_host";
+
     //Language
     $lang = selectLanguage();
-    include("../lang/lang_" . $lang . ".php");
-    
-    $cur_section = $lng['section_activities'];
+    include("../lang/lang_$lang.php");
+
+    $cur_section = $lng["section_activities"];
 ?>
 <!DOCTYPE html>
 <html>
@@ -17,195 +18,284 @@
         <meta content="text/html; charset=utf-8" http-equiv="content-type"/>
         <meta charset="utf-8"/>
         <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1">
-        <title><?php echo $lng['activities_title'];?> - Gasteizko Margolariak</title>
-        <link rel="shortcut icon" href="<?php echo "$proto$http_host/img/logo/favicon.ico";?>">
+        <title><?=$lng["activities_title"]?> - Gasteizko Margolariak</title>
+        <link rel="shortcut icon" href="<?php echo "$server/img/logo/favicon.ico";?>">
         <!-- CSS files -->
         <style>
-            <?php 
-                include("../css/ui.css"); 
-                include("../css/actividades.css");
-            ?>
+<?php 
+            include("../css/ui.css"); 
+            include("../css/actividades.css");
+?>
         </style>
         <!-- CSS for mobile version -->
         <style media="(max-width : 990px)">
-            <?php 
-                include("../css/m/ui.css"); 
-                include("../css/m/actividades.css");
-            ?>
+<?php 
+            include("../css/m/ui.css"); 
+            include("../css/m/actividades.css");
+?>
         </style>
         <!-- Script files -->
         <script type="text/javascript">
-            <?php
-                include("../script/ui.js");
-                include("../script/actividades.js");
-            ?>
+<?php
+            include("../script/ui.js");
+            include("../script/actividades.js");
+?>
         </script>
         <!-- Meta tags -->
-        <link rel="canonical" href="<?php echo "$proto$http_host/actividades/"; ?>"/>
-        <link rel="author" href="<?php echo "$proto$http_host"; ?>"/>
-        <link rel="publisher" href="<?php echo "$proto$http_host"; ?>"/>
-        <meta name="description" content="<?php echo $lng['activities_description'];?>"/>
-        <meta property="og:title" content="<?php echo $lng['activities_title'];?> - Gasteizko Margolariak"/>
-        <meta property="og:url" content="<?php echo "$proto$http_host/activities/"; ?>"/>
-        <meta property="og:description" content="<?php echo $lng['activities_description'];?>"/>
-        <meta property="og:image" content="<?php echo "$proto$http_host/img/logo/logo.png";?>"/>
-        <meta property="og:site_name" content="<?php echo $lng['index_title'];?>"/>
+        <link rel="canonical" href="<?=$server?>/actividades/"/>
+        <link rel="author" href="<?=$server?>"/>
+        <link rel="publisher" href="<?=$server?>"/>
+        <meta name="description" content="<?=$lng["activities_description"]?>"/>
+        <meta property="og:title" content="<?=$lng["activities_title"]?> - Gasteizko Margolariak"/>
+        <meta property="og:url" content="<?=$server?>/activities/"/>
+        <meta property="og:description" content="<?=$lng["activities_description"]?>"/>
+        <meta property="og:image" content="<?=$server?>/img/logo/logo.png"/>
+        <meta property="og:site_name" content="<?=$lng["index_title"]?>"/>
         <meta property="og:type" content="website"/>
-        <meta property="og:locale" content="<?php echo $lang; ?>"/>
+        <meta property="og:locale" content="<?=$lang?>"/>
         <meta name="twitter:card" content="summary"/>
-        <meta name="twitter:title" content="<?php echo $lng['activities_title'];?> - Gasteizko Margolariak"/>
-        <meta name="twitter:description" content="<?php echo $lng['activities_description'];?>"/>
-        <meta name="twitter:image" content="<?php echo "$proto$http_host/img/logo/logo.png";?>"/>
-        <meta name="twitter:url" content="<?php echo"$proto$http_host"; ?>"/>
+        <meta name="twitter:title" content="<?=$lng["activities_title"]?> - Gasteizko Margolariak"/>
+        <meta name="twitter:description" content="<?=$lng["activities_description"]?>"/>
+        <meta name="twitter:image" content="<?=$server?>/img/logo/logo.png"/>
+        <meta name="twitter:url" content="<?=$server?>"/>
         <meta name="robots" content="index follow"/>
     </head>
     <body>
-        <?php include("../header.php"); ?>
+<?php
+        include("../header.php")
+?>
         <div id="content">
-        <?php
-            //Upcoming activities
-            echo "<div class='section'>\n";
-            echo "<h3 class='section_title'>$lng[activities_upcoming]</h3>\n";
-            $q_upcoming = mysqli_query($con, "SELECT id, permalink, date, DATE_FORMAT(date, '%Y-%m-%d') AS isodate, title_$lang AS title, text_$lang AS text, price, inscription, people, max_people, user, dtime, comments, city FROM activity WHERE visible = 1 AND date > now() ORDER BY date;");
-            if (mysqli_num_rows($q_upcoming) > 0){
-                while ($r_activity = mysqli_fetch_array($q_upcoming)){
-                    echo "<div class='entry' itemscope itemtype='http://schema.org/Event'>\n";
-                    echo "<meta itemprop='inLanguage' content='$lang'/>\n";
-                    echo "<meta itemprop='name' content='$r_activity[title]'/>\n";
-                    echo "<meta itemprop='description' content='$r_activity[text]'/>\n";
-                    echo "<meta itemprop='startDate endDate' content='$r_activity[isodate]'/>\n";
-                    echo("<span class='hidden' itemprop='location' itemscope itemtype='http://schema.org/Place'><meta itemprop='address' itemprop='name' content='$r_activity[city]'/><meta itemprop='name' content='$r_activity[city]'/></span>\n");
-                    echo "<div class='hidden' itemprop='organizer' itemscope itemtype='http://schema.org/Organization'>\n";
-                    echo "<meta itemprop='legalName' content='Asociaci&oacute;n Cultural Recreativa Gasteizko Margolariak'/>\n";
-                    echo "<meta itemprop='name' content='Gasteizko Margolariak'/>\n";
-                    echo "<meta itemprop='logo' content='$proto$http_host/img/logo/logo.png'/>\n";
-                    echo "<meta itemprop='foundingDate' content='03-02-2013'/>\n";
-                    echo "<meta itemprop='telephone' content='+34637140371'/>\n";
-                    echo "<meta itemprop='url' content='$proto$http_host'/>\n";
-                    echo "</div>\n";
-                    echo "<div id='upcoming_text'>\n";
-                    echo "<h3 class='entry_title'><a itemprop='url' href='$proto$http_host/actividades/$r_activity[permalink]'>$r_activity[title]</a><span class='title_date'> - " . formatDate($r_activity['date'], $lang, false) . "</span></h3>\n";
-                    //Table with details
-                    echo "<table class='future_details'><tr>\n";
-                    //If image, show it
-                    $q_activity_image = mysqli_query($con, "SELECT image FROM activity_image WHERE activity = $r_activity[id] ORDER BY idx LIMIT 1;");
-                    if (mysqli_num_rows($q_activity_image) > 0){
-                        $r_activity_image = mysqli_fetch_array($q_activity_image);
-                        echo "<td><div id='upcoming_image'>\n";
-                        echo "<a href='$proto$http_host/actividades/$r_activity[permalink]'>\n";
-                        echo "<meta itemprop='image' content='$proto$http_host/img/actividades/view/$r_activity_image[image]'/>\n";
-                        echo "<img src='$proto$http_host/img/actividades/preview/$r_activity_image[image]' alt='$r_activity[title]'/>\n";
-                        echo "</a>\n";
-                        echo "</div></td>\n";
-                    }
-                    echo("<td>\n<table class='future_data'>\n");
-                    echo("<tr><td class='title'>$lng[activities_city]</td><td>$r_activity[city]</td></tr>\n");
-                    if ($r_activity['price'] == 0){
-                        echo "<tr><td class='title'>$lng[activities_price]</td><td itemprop='offers' itemscope itemtype='http://schema.org/Offer'>\n";
-                        echo "<meta itemprop='priceCurrency' content='EUR'/><meta itemprop='price' content='0'/>\n";
-                        echo "$lng[activities_price_0]</td></tr>\n";
-                    }
-                    else{
-                        echo "<tr><td class='title'>$lng[activities_price]</td><td itemprop='offers' itemscope itemtype='http://schema.org/Offer'>\n";
-                        echo "<meta itemprop='priceCurrency' content='EUR'/><meta itemprop='price' content='$r_activity[price]'/>\n";
-                        echo("$r_activity[price]€</td></tr>\n");
-                    }
-                    if ($r_activity['max_people'] != 0){
-                        echo "<tr><td>$lng[activities_maxpeople]</td><td>$r_activity[max_people]</td></tr>\n";
-                    }
-                    //Show link to schedule (if any)
-                    $q_itinerary = mysqli_query($con, "SELECT id FROM activity_itinerary WHERE activity = $r_activity[id];");
-                    if (mysqli_num_rows($q_itinerary) > 0){
-                        echo "<tr><td></td><td><a href='$proto$http_host/actividades/$r_activity[permalink]'>$lng[activities_see_itinerary]</a></td></tr>\n";
-                    }
-                    echo "</table>";
-                    echo "</td></tr></table>\n";
-                    echo "<p>". cutText($r_activity['text'], 300, "$lng[index_read_more]", "$proto$http_host/actividades/$r_activity[permalink]") . "</p>\n";
-                    echo "</div>\n";
-                    echo "</div>\n"; //Entry
-                }
 
-            }
-            else{ //No upcoming activities
-                echo("<div class='entry'><h3 class='entry_title'>\n$lng[activities_no_upcoming]\n</h3></div>\n");
-            }
-            echo "</div>\n";
-                
-            //Past activities TODO: Meta
+            <div class='section'>
+                <h3 class='section_title'><?=$lng["activities_upcoming"]?></h3>
+<?php
+                $q_upcoming = mysqli_query($con, "SELECT id, permalink, date, DATE_FORMAT(date, '%Y-%m-%d') AS isodate, title_$lang AS title, text_$lang AS text, price, inscription, people, max_people, user, dtime, comments, city FROM activity WHERE visible = 1 AND date > now() ORDER BY date;");
+                if (mysqli_num_rows($q_upcoming) > 0){
+                    while ($r_activity = mysqli_fetch_array($q_upcoming)){
+?>
+                        <div class='entry' itemscope itemtype='http://schema.org/Event'>
+                            <meta itemprop='inLanguage' content='<?=$lang?>'/>
+                            <meta itemprop='name' content='<?=$r_activity["title"]?>'/>
+                            <meta itemprop='description' content='<?=$r_activity["text"]?>'/>
+                            <meta itemprop='startDate endDate' content='<?=$r_activity["isodate"]?>'/>
+                            <span class='hidden' itemprop='location' itemscope itemtype='http://schema.org/Place'>
+                                <meta itemprop='address' itemprop='name' content='<?=$r_activity["city"]?>'/>
+                                <meta itemprop='name' content='<?=$r_activity["city"]?>'/>
+                            </span>
+                            <div class='hidden' itemprop='organizer' itemscope itemtype='http://schema.org/Organization'>
+                                <meta itemprop='legalName' content='Asociaci&oacute;n Cultural Recreativa Gasteizko Margolariak'/>
+                                <meta itemprop='name' content='Gasteizko Margolariak'/>
+                                <meta itemprop='logo' content='<?=$server?>/img/logo/logo.png'/>
+                                <meta itemprop='foundingDate' content='03-02-2013'/>
+                                <meta itemprop='telephone' content='+34637140371'/>
+                                <meta itemprop='url' content='<?=$server?>'/>
+                            </div>
+                            <div id='upcoming_text'>
+                                <h3 class='entry_title'>
+                                    <a itemprop='url' href=<?=$server?>/actividades/<?=$r_activity["permalink"]?>'><?=$r_activity["title"]?></a>
+                                    <span class='title_date'> - <?=formatDate($r_activity["date"], $lang, false)?></span>
+                                </h3>
+                                <table class='future_details'>
+                                    <tr>
+<?php
+                                        //If image, show it
+                                        $q_activity_image = mysqli_query($con, "SELECT image FROM activity_image WHERE activity = $r_activity[id] ORDER BY idx LIMIT 1;");
+                                        if (mysqli_num_rows($q_activity_image) > 0){
+                                            $r_activity_image = mysqli_fetch_array($q_activity_image);
+?>                                            
+                                            <td>
+                                                <div id='upcoming_image'>
+                                                    <a href='<?=$server?>/actividades/<?=$r_activity["permalink"]?>'>
+                                                        <meta itemprop='image' content='<?=$server?>/img/actividades/view/<?=$r_activity_image["image"]?>'/>
+                                                        <img src='<?=$server?>/img/actividades/preview/<?=$r_activity_image["image"]?>' alt='<?=$r_activity["title"]?>'/>
+                                                    </a>
+                                                </div>
+                                            </td>
+<?php
+                                        }
+?>
+                                        <td>
+                                            <table class='future_data'>
+                                                <tr>
+                                                    <td class='title'><?=$lng["activities_city"]?></td>
+                                                    <td><?=$r_activity["city"]?></td>
+                                                </tr>
+<?php
+                                                if ($r_activity["price"] == 0){
+?>
+                                                    <tr>
+                                                        <td class='title'><?=$lng["activities_price"]?></td>
+                                                        <td itemprop='offers' itemscope itemtype='http://schema.org/Offer'>
+                                                            <meta itemprop='priceCurrency' content='EUR'/>
+                                                            <meta itemprop='price' content='0'/>
+                                                            <?=$lng["activities_price_0"]?>
+                                                        </td>
+                                                    </tr>
+<?php
+                                                }
+                                                else{
+?>
+                                                    <tr>
+                                                        <td class='title'><?=$lng["activities_price"]?></td>
+                                                        <td itemprop='offers' itemscope itemtype='http://schema.org/Offer'>
+                                                            <meta itemprop='priceCurrency' content='EUR'/>
+                                                            <meta itemprop='price' content='<?=$r_activity["price"]?>'/>
+                                                            <?=$r_activity["price"]?>€
+                                                        </td>
+                                                    </tr>
+<?php
+                                                }
+                                                if ($r_activity["max_people"] != 0){
+?>
+                                                    <tr>
+                                                        <td><?=$lng["activities_maxpeople"]?></td>
+                                                        <td><?=$r_activity["max_people"]?></td>
+                                                    </tr>
+<?php
+                                                }
+                                                //Show link to schedule (if any)
+                                                $q_itinerary = mysqli_query($con, "SELECT id FROM activity_itinerary WHERE activity = $r_activity[id];");
+                                                if (mysqli_num_rows($q_itinerary) > 0){
+?>
+                                                    <tr>
+                                                        <td></td>
+                                                        <td>
+                                                            <a href='<?=$server?>/actividades/<?$r_activity["permalink"]?>'><?=$lng["activities_see_itinerary"]?></a>
+                                                        </td>
+                                                    </tr>
+<?php
+                                                }
+?>
+                                            </table> <!-- #future_data -->
+                                        </td>
+                                    </tr>
+                                </table> <!-- #future_details -->
+                                <p><?=cutText($r_activity["text"], 300, "$lng[index_read_more]", "$server/actividades/$r_activity[permalink]")?></p>
+                            </div> <!-- #upcoming_text -->
+                        </div> <!-- .entry -->
+<?php
+                    } //while ($r_activity = mysqli_fetch_array($q_upcoming))
+                } //if (mysqli_num_rows($q_upcoming) > 0)
+                else{ //No upcoming activities
+?>
+                    <div class='entry'>
+                        <h3 class='entry_title'><?=$lng["activities_no_upcoming"]?></h3>
+                    </div>
+<?php
+                }
+?>
+            </div> <!-- .section -->
+<?php
             if ($r_activity == null){
                 $next_activity_id = -1;
             }
             else{
-                $next_activity_id = $r_activity['id'];
+                $next_activity_id = $r_activity["id"];
             }
             $q_past = mysqli_query($con, "SELECT id, permalink, date, DATE_FORMAT(date, '%Y-%m-%d') AS isodate, title_$lang AS title, after_$lang AS text, text_$lang AS alt_text, price, inscription, people, max_people, user, dtime, comments, city FROM activity WHERE id != $next_activity_id AND visible = 1 AND date < now() ORDER BY date DESC;");
             if (mysqli_num_rows($q_past) > 0){
-                echo "<br/><br/><div class='section'>\n";
-                echo "<h3 class='section_title'>$lng[activities_past]</h3>\n";
-                $i = 0;
-                while ($r_past = mysqli_fetch_array($q_past)){
-                    echo("<div class='entry past_activity' itemscope itemtype='http://schema.org/Event'>\n");
-                    echo("<meta itemprop='inLanguage' content='$lang'/>\n");
-                    echo("<meta itemprop='name' content='$r_past[title]'/>\n");
-                    echo("<meta itemprop='startDate endDate' content='$r_past[isodate]'/>\n");
-                    echo("<span class='hidden' itemprop='location' itemscope itemtype='http://schema.org/Place'><meta itemprop='address' itemprop='name' content='$r_past[city]'/><meta itemprop='name' content='$r_past[city]'/></span>\n");
-                    echo("<div class='hidden' itemprop='organizer' itemscope itemtype='http://schema.org/Organization'>\n");
-                    echo("<meta itemprop='legalName' content='Asociaci&oacute;n Cultural Recreativa Gasteizko Margolariak'/>\n");
-                    echo("<meta itemprop='name' content='Gasteizko Margolariak'/>\n");
-                    echo("<meta itemprop='logo' content='$proto$http_host/img/logo/logo.png'/>\n");
-                    echo("<meta itemprop='foundingDate' content='03-02-2013'/>\n");
-                    echo("<meta itemprop='telephone' content='+34637140371'/>\n");
-                    echo("<meta itemprop='url' content='$proto$http_host'/>\n");
-                    echo("</div>\n");
-                    $q_activity_image = mysqli_query($con, "SELECT image FROM activity_image WHERE activity = $r_past[id] ORDER BY idx LIMIT 1;");
-                    if ($i == 0 && mysqli_num_rows($q_upcoming) == 0){
-                        echo("<h3 class='entry_title'>");
-                        echo("<img id='slid_past_activity_$r_past[id]' class='slid' src='/img/misc/slid-down.png' onclick=\"showPastActivity('$r_past[id]')\"/>&nbsp;&nbsp;\n");
-                        echo("<a itemprop='url' href='$proto$http_host/actividades/$r_past[permalink]'>$r_past[title]</a>\n");
-                        echo("<span class='title_date'> - " . formatDate($r_past['date'], $lang, false) . "</span>\n");
-                        echo("</h3>\n");
-                        echo("<div class='past_activity_details past_activity_details_first' id='past_activity_details_$r_past[id]'>\n");
-                    }
-                    else{
-                        echo("<h3 class='entry_title'>");
-                        echo("<img id='slid_past_activity_$r_past[id]' class='slid' src='/img/misc/slid-right.png' onclick=\"showPastActivity('$r_past[id]')\"/>&nbsp;&nbsp;");
-                        echo("<a itemprop='url' href='$proto$http_host/actividades/$r_past[permalink]'>$r_past[title]</a>");
-                        echo("<span class='title_date'> - " . formatDate($r_past['date'], $lang, false) . "</span>");
-                        echo("</h3>\n");
-                        echo("<div class='past_activity_details' id='past_activity_details_$r_past[id]'>\n");
-                    }
-                    $i ++;
-                    echo "<table class='past_activity'><tr>\n";
-                    if (mysqli_num_rows($q_activity_image) > 0){
-                        $r_activity_image = mysqli_fetch_array($q_activity_image);
-                        echo "<td><div class='past_image'>\n";
-                        echo "<a href='$proto$http_host/actividades/$r_past[permalink]'>\n";
-                        echo("<meta itemprop='image' content='$proto$http_host/img/actividades/view/$r_activity_image[image]'/>\n");
-                        echo "<img src='$proto$http_host/img/actividades/miniature/$r_activity_image[image]' alt='$r_past[title]'/>\n"; 
-                        echo "</a>\n";
-                        echo "</div></td>\n";
-                    }
-                    echo "<td><div class='past_text'>\n";
-                    if (strlen($r_past['text']) > 0){
-                        echo("<meta itemprop='description' content='$r_past[text]'/>\n");
-                        echo "<p>". cutText($r_past['text'], 300, "$lng[index_read_more]", "$proto$http_host/actividades/$r_past[permalink]") . "</p>\n";
-                    }
-                    else{
-                        echo("<meta itemprop='description' content='$r_past[alt_text]'/>\n");
-                        echo "<p>". cutText($r_past['alt_text'], 300, "$lng[index_read_more]", "$proto$http_host/actividades/$r_past[permalink]") . "</p>\n";
-                    }
-                    echo "</div></td></tr></table>\n";
-                    echo "</div>\n"; //past_activity_details
-                    echo "</div>\n"; //past_activity
-                }
-                echo "</div>\n";
+?>
+                <br/><br/>
+                <div class='section'>
+                    <h3 class='section_title'><?=$lng["activities_past"]?></h3>
+<?php
+                    $i = 0;
+                    while ($r_past = mysqli_fetch_array($q_past)){
+?>
+                        <div class='entry past_activity' itemscope itemtype='http://schema.org/Event'>
+                            <meta itemprop='inLanguage' content='<?=$lang?>'/>
+                            <meta itemprop='name' content='<?=$r_past["title"]?>'/>
+                            <meta itemprop='startDate endDate' content='<?=$r_past["isodate"]?>'/>
+                            <span class='hidden' itemprop='location' itemscope itemtype='http://schema.org/Place'>
+                                <meta itemprop='address' itemprop='name' content='<?=$r_past["city"]?>'/>
+                                <meta itemprop='name' content='<?=$r_past["city"]?>'/>
+                            </span>
+                            <div class='hidden' itemprop='organizer' itemscope itemtype='http://schema.org/Organization'>
+                                <meta itemprop='legalName' content='Asociaci&oacute;n Cultural Recreativa Gasteizko Margolariak'/>
+                                <meta itemprop='name' content='Gasteizko Margolariak'/>
+                                <meta itemprop='logo' content='<?=$server?>/img/logo/logo.png'/>
+                                <meta itemprop='foundingDate' content='03-02-2013'/>
+                                <meta itemprop='telephone' content='+34637140371'/>
+                                <meta itemprop='url' content='<?=$server?>'/>
+                            </div>
+<?php
+                            $q_activity_image = mysqli_query($con, "SELECT image FROM activity_image WHERE activity = $r_past[id] ORDER BY idx LIMIT 1;");
+                            if ($i == 0 && mysqli_num_rows($q_upcoming) == 0){
+                                $past_class = "past_activity_details past_activity_details_first";
+?>
+                                <h3 class='entry_title'>
+                                    <img id='slid_past_activity_<?=$r_past["id"]?>' class='slid' src='<?=$server?>/img/misc/slid-down.png' onclick='showPastActivity("<?=$r_past["id"]?>")'/>
+                                    &nbsp;&nbsp;
+                                    <a itemprop='url' href='<?=$server?>/actividades/<?=$r_past["permalink"]?>'><?=$r_past["title"]?></a>
+                                    <span class='title_date'> - <?=formatDate($r_past["date"], $lang, false)?></span>
+                                </h3>
+<?php
+                            }
+                            else{
+                                $past_class = "past_activity_details";
+?>
+                                <h3 class='entry_title'>
+                                    <img id='slid_past_activity_<?=$r_past["id"]?>' class='slid' src='<?=$server?>/img/misc/slid-right.png' onclick='showPastActivity("<?=$r_past["id"]?>");'/>
+                                    &nbsp;&nbsp;
+                                    <a itemprop='url' href='<?=$server?>/actividades/<?=$r_past["permalink"]?>'><?=$r_past["title"]?></a>
+                                    <span class='title_date'> - <?=formatDate($r_past["date"], $lang, false)?></span>
+                                </h3>
+<?php
+                            }
+                            $i ++;
+?>
+                            <div class='<?=$past_class?>' id='past_activity_details_$r_past[id]'>
+                                <table class='past_activity'>
+                                    <tr>
+<?php
+                                        if (mysqli_num_rows($q_activity_image) > 0){
+                                            $r_activity_image = mysqli_fetch_array($q_activity_image);
+?>
+                                            <td>
+                                                <div class='past_image'>
+                                                    <a href='<?=$server?>/actividades/<?=$r_past["permalink"]?>'>
+                                                        <meta itemprop='image' content='<?=$server?>/img/actividades/view/<?=$r_activity_image["image"]?>'/>
+                                                        <img src='<?=$server?>/img/actividades/miniature/<?=$r_activity_image["image"]?>' alt='<?=$r_past["title"]?>'/>
+                                                    </a>
+                                                </div>
+                                            </td>
+<?php
+                                        }
+?>
+                                        <td>
+                                            <div class='past_text'>
+<?php
+                                                if (strlen($r_past["text"]) > 0){
+?>
+                                                    <meta itemprop='description' content='<?=$r_past["text"]?>'/>
+                                                    <p><?=cutText($r_past["text"], 300, "$lng[index_read_more]", "$server/actividades/$r_past[permalink]")?></p>
+<?php
+                                                }
+                                                else{
+?>
+                                                    <meta itemprop='description' content='<?=$r_past["alt_text"]?>'/>
+                                                    <p><?=cutText($r_past["alt_text"], 300, "$lng[index_read_more]", "$server/actividades/$r_past[permalink]")?>"</p>
+<?php
+                                                }
+?>
+                                            </div> <!-- .past_text -->
+                                        </td>
+                                    </tr>
+                                </table> <!-- .past_activity -->
+                            </div> <!-- #past_activity_details -->
+                        </div> <!-- .past_activity -->
+<?php
+                    } // while ($r_past = mysqli_fetch_array($q_past))
+?>
+                </div> <!-- .section -->
+<?php
             }
-        ?>
-        </div>
-        <?php
-            include("../footer.php");
-            $ad = ad($con, $lang, $lng); 
-            stats($ad, $ad_static, "actividades", "$r_activity[id]");
-        ?>
+?>
+        </div> <!-- #content -->
+<?php
+        include("../footer.php");
+        $ad = ad($con, $lang, $lng); 
+        stats($ad, $ad_static, "actividades", "");
+?>
     </body>
 </html>

+ 87 - 85
www/app/index.php

@@ -1,99 +1,101 @@
 <?php
-	include("../functions.php");
-	$browser_data = get_browser(null, true);
-	$os = $browser_data['platform'];
-
-	if (strpos(strtolower($os), 'android') !== false){
-		header('Location: https://play.google.com/store/apps/details?id=com.ivalentin.margolariak');
-		exit(0);
-	}
-	elseif (strpos(strtolower($os), 'ios') !== false){
-		header('Location: https://itunes.apple.com/us/app/gasteizko-margolariak/id1227846624');
-		exit(0);
-	}
-	else{
-	
-		session_start();
-		#$proto = $_SERVER['SERVER_PROTOCOL'];
-		#$proto = strtolower(substr($_SERVER["SERVER_PROTOCOL"],0,strpos( $_SERVER["SERVER_PROTOCOL"],'/'))).'://';
-		$http_host = $_SERVER['HTTP_HOST'];
-		$proto = getProtocol();
-		$server = "$server";
-		
-		//Language
-		$lang = selectLanguage();
-		include("../lang/lang_" . $lang . ".php");
+    include("../functions.php");
+    $browser_data = get_browser(null, true);
+    $os = $browser_data["platform"];
 
+    if (strpos(strtolower($os), 'android') !== false){
+        header('Location: https://play.google.com/store/apps/details?id=com.ivalentin.margolariak');
+        exit(0);
+    }
+    elseif (strpos(strtolower($os), 'ios') !== false){
+        header('Location: https://itunes.apple.com/us/app/gasteizko-margolariak/id1227846624');
+        exit(0);
+    }
+    else{
+        session_start();
+        $http_host = $_SERVER["HTTP_HOST"];
+        $proto = getProtocol();
+        $server = "$proto$http_host";
+        
+        //Language
+        $lang = selectLanguage();
+        include("../lang/lang_$lang.php");
 ?>
 
 <!DOCTYPE html>
 <html>
-	<head>
-		<meta content="text/html; charset=utf-8" http-equiv="content-type"/>
-		<meta charset="utf-8"/>
-		<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1">
-		<title><?=$lng['index_title']?> - App</title>
-		<link rel="shortcut icon" href="<?=$server?>/img/logo/favicon.ico">
-		<!-- CSS files -->
-		<style>
+    <head>
+        <meta content="text/html; charset=utf-8" http-equiv="content-type"/>
+        <meta charset="utf-8"/>
+        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1">
+        <title><?=$lng["index_title"]?> - App</title>
+        <link rel="shortcut icon" href="<?=$server?>/img/logo/favicon.ico">
+        <!-- CSS files -->
+        <style>
 <?php 
-			include("../css/ui.css"); 
-			include("../css/app.css");
+            include("../css/ui.css"); 
+            include("../css/app.css");
 ?>
-		</style>
-		<!-- CSS for mobile version -->
-		<style media="(max-width : 990px)">
+        </style>
+        <!-- CSS for mobile version -->
+        <style media="(max-width : 990px)">
 <?php 
-			include("../css/m/ui.css"); 
+            include("../css/m/ui.css"); 
+?>
+        </style>
+        <!-- Script files -->
+        <script type="text/javascript">
+<?php
+            include("../script/ui.js");
+?>
+        </script>
+        <!-- Meta tags -->
+        <link rel="canonical" href="<?=$server?>/app/"/>
+        <link rel="author" href="<?=$server?>"/>
+        <link rel="publisher" href="<?=$server?>"/>
+        <meta name="description" content="<?=$lng["index_title"]?> - App"/>
+        <meta property="og:title" content="<?=$lng["index_title"]?> - App"/>
+        <meta property="og:url" content="<?=$server?>"/>
+        <meta property="og:description" content="<?=$lng["index_title"]?> - App"/>
+        <meta property="og:image" content="<?$server?>/img/logo/logo.png"/>
+        <meta property="og:site_name" content="<?=$lng["index_title"]?> - App"/>
+        <meta property="og:type" content="website"/>
+        <meta property="og:locale" content="<?=$lang?>"/>
+        <meta name="twitter:card" content="summary"/>
+        <meta name="twitter:title" content="<?=$lng["index_title"]?> - App"/>
+        <meta name="twitter:description" content="<?=$lng["index_title"]?> - App"/>
+        <meta name="twitter:image" content="<?=$server?>/img/logo/logo.png"/>
+        <meta name="twitter:url" content="<?=$server?>/app/"/>
+        <meta name="robots" content="index follow"/>
+    </head>
+    <body>
+<?php
+        include("../header.php");
+?>
+        <div id="content">
+            <br/><br/><br/><br/><br/><br/><br/><br/><br/><br/>
+            <table>
+                <tr>
+                    <td>
+                        <a target="_blank" href="https://play.google.com/store/apps/details?id=com.ivalentin.margolariak">
+                            <img src="<?=$server?>/img/app/android.gif"/>
+                        </a>
+                    </td>
+                    <td>    
+                        <a target="_blank" href="https://itunes.apple.com/us/app/gasteizko-margolariak/id1227846624">
+                            <img src="<?=$server?>/img/app/ios.gif"/>
+                        </a>
+                    </td>
+                </tr>
+            </table>
+            <br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/>
+        </div>
+<?php
+        include("../footer.php");
 ?>
-		</style>
-		<!-- Script files -->
-		<script type="text/javascript">
-			<?php include("../script/ui.js"); ?>
-		</script>
-		<!-- Meta tags -->
-		<link rel="canonical" href="<?=$server?>/app/"/>
-		<link rel="author" href="<?=$server?>"/>
-		<link rel="publisher" href="<?=$server?>"/>
-		<meta name="description" content="<?=$lng['index_title']?> - App"/>
-		<meta property="og:title" content="<?=$lng['index_title']?> - App"/>
-		<meta property="og:url" content="<?=$server?>"/>
-		<meta property="og:description" content="<?=$lng['index_title']?> - App"/>
-		<meta property="og:image" content="<?$server?>/img/logo/logo.png"/>
-		<meta property="og:site_name" content="<?=$lng['index_title']?> - App"/>
-		<meta property="og:type" content="website"/>
-		<meta property="og:locale" content="<?=$lang?>"/>
-		<meta name="twitter:card" content="summary"/>
-		<meta name="twitter:title" content="<?=$lng['index_title']?> - App"/>
-		<meta name="twitter:description" content="<?=$lng['index_title']?> - App"/>
-		<meta name="twitter:image" content="<?=$server?>/img/logo/logo.png"/>
-		<meta name="twitter:url" content="<?=$server?>/app/"/>
-		<meta name="robots" content="index follow"/>
-	</head>
-	<body>
-		<?php include("../header.php"); ?>
-		<div id="content">
-			<br/><br/><br/><br/><br/><br/><br/><br/><br/><br/>
-			<table>
-				<tr>
-					<td>
-						<a target="_blank" href="https://play.google.com/store/apps/details?id=com.ivalentin.margolariak">
-							<img src="<?=$server?>/img/app/android.gif"/>
-						</a>
-					</td>
-					<td>	
-						<a target="_blank" href="https://itunes.apple.com/us/app/gasteizko-margolariak/id1227846624">
-							<img src="<?=$server?>/img/app/ios.gif"/>
-						</a>
-					</td>
-				</tr>
-			</table>
-			<br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/>
-		</div>
-		<?php include("../footer.php"); ?>
-	</body>
+    </body>
 </html>
 
 <?php
-	}
+    }
 ?>

+ 0 - 21
www/app/location.php

@@ -1,21 +0,0 @@
-<?php
-    include("../functions.php");
-    $con = startdb();
-        
-    //Get user entry
-    // DEBUG 1=0. Disabled.
-    $q = mysqli_query($con, "SELECT lat, lon, dtime, username, manual, action FROM location, user WHERE 0=1 AND action = 'report' AND user.id = location.user AND dtime > NOW() - INTERVAL 30 MINUTE ORDER BY dtime DESC LIMIT 1;");
-    if (mysqli_num_rows($q) > 0){
-        $r = mysqli_fetch_array($q);
-        echo("<reporting>1</reporting>\n");
-        echo("<lat>$r[lat]</lat>\n");
-        echo("<lon>$r[lon]</lon>\n");
-        echo("<user>$r[username]</user>\n");
-        echo("<dtime>$r[dtime]</dtime>\n");
-        echo("<manual>$r[manual]</manual>\n");
-        echo("<action>$r[action]</action>\n");
-    }
-    else{
-        echo("<reporting>0</reporting>\n");
-    }
-?>

+ 0 - 61
www/app/locationreport.php

@@ -1,61 +0,0 @@
-<?php
-    include("../functions.php");
-    $con = startdb('rw');
-    
-    //Get fields
-    $user = mysqli_real_escape_string($con, $_GET['user']);
-    $code = mysqli_real_escape_string($con, $_GET['code']);
-    $lat = mysqli_real_escape_string($con, $_GET['lat']);
-    $lon = mysqli_real_escape_string($con, $_GET['lon']);
-    $action = mysqli_real_escape_string($con, $_GET['action']);
-    $manual = mysqli_real_escape_string($con, $_GET['manual']);
-    
-    //Validate code
-    $q = mysqli_query($con, "SELECT id FROM user WHERE id = $user AND md5(concat(password, md5(salt))) = '$code';");
-    //echo "SELECT id FROM user WHERE id = $user AND md5(concat(password, md5(salt))) = '$code'";
-    if (mysqli_num_rows($q) == 0){
-        echo("Reporting location with wrong credentials (IP $_SERVER[REMOTE_ADDR])");
-        error_log("Reporting location with wrong credentials (IP $_SERVER[REMOTE_ADDR])");
-        echo("<status>0</status>\n");
-        exit(-1);
-    }
-    
-    //If its an automatic update, and the last singal from the user was to stop, stop it
-//     if ($manual == 1){
-//         $q = mysqli_query($con, "SELECT action FROM location WHERE user = $user AND (action = 'start' OR action = 'stop') ORDER BY dtime DESC LIMIT 1");
-//         if (mysqli_num_rows($q) == 0){
-//             echo("<status>0</status>\n");
-//             exit(0);
-//         }
-//         else{
-//             $r = mysqli_fetch_array($q);
-//             if ($r['action'] == 'stop'){
-//                 echo("<status>0</status>\n");
-//                 exit(0);
-//             }
-//         }
-//     }
-    
-    //Validate fields
-    if (is_numeric($lat) == false || is_numeric($lon) == false){
-        error_log("Reporting location: invalid coordinates (IP $_SERVER[REMOTE_ADDR])");
-        echo("<status>0</status>\n");
-        exit(-1);
-    }
-    
-    if ($action != "start" && $action != "stop" && $action != "report"){
-        error_log("Reporting location: invalid action '$action' (IP $_SERVER[REMOTE_ADDR])");
-        echo("<status>0</status>\n");
-        exit(-1);
-    }
-    
-    if ($manual != 0 && $manual != 1){
-        error_log("Reporting location: invalid value for manual '$manual' (IP $_SERVER[REMOTE_ADDR])");
-        echo("<status>0</status>\n");
-        exit(-1);
-    }
-    
-    //Insert
-    mysqli_query($con, "INSERT INTO location (lat, lon, manual, action, user) VALUES ($lat, $lon, $manual, '$action', $user);");
-    echo("<status>1</status>\n");
-?>

+ 0 - 22
www/app/login.php

@@ -1,22 +0,0 @@
-<?php
-    include("../functions.php");
-    $con = startdb();
-    
-    //Get fields
-    $user = mysqli_real_escape_string($con, $_GET['name']);
-    $pass = mysqli_real_escape_string($con, $_GET['password']);
-    
-    //Get user entry
-    $q = mysqli_query($con, "SELECT id, md5(salt) AS salt, fname, lname FROM user WHERE active = 1 AND lcase(username) = lcase('$user') AND password = '$pass';");
-    if (mysqli_num_rows($q) > 0){
-        $r = mysqli_fetch_array($q);
-        echo("<status>1</status>\n");
-        echo("<id>$r[id]</id>\n");
-        echo("<fname>$r[fname]</fname>\n");
-        echo("<lname>$r[lname]</lname>\n");
-        echo("<salt>" . $r['salt'] . "</salt>\n");
-    }
-    else{
-        echo("<status>0</status>\n");
-    }
-?>

+ 0 - 20
www/app/notifications.php

@@ -1,20 +0,0 @@
-<?php
-    include("../functions.php");
-    $con = startdb();
-        
-    //Get user entry
-    // 1=0 Old API is now disabled
-    $q = mysqli_query($con, "SELECT id, action, title_es, title_en, title_eu, text_es, text_en, text_eu FROM notification WHERE 1 = 0 AND dtime > NOW() - INTERVAL duration MINUTE ORDER BY dtime DESC ;");
-    while ($r = mysqli_fetch_array($q)){
-        echo("<notification>\n");
-        echo("\t<id>$r[id]</id>\n");
-        echo("\t<action>$r[action]</action>\n");
-        echo("\t<title_es>$r[title_es]</title_es>\n");
-        echo("\t<title_en>$r[title_en]</title_en>\n");
-        echo("\t<title_eu>$r[title_eu]</title_eu>\n");
-        echo("\t<text_es>$r[text_es]</text_es>\n");
-        echo("\t<text_en>$r[text_en]</text_en>\n");
-        echo("\t<text_eu>$r[text_eu]</text_eu>\n");
-        echo("</notification>\n");
-    }
-?>

+ 0 - 62
www/app/sendnotification.php

@@ -1,62 +0,0 @@
-<?php
-    include("../functions.php");
-    $con = startdb('rw');
-    
-    //Get fields
-    $user = mysqli_real_escape_string($con, $_GET['user']);
-    $code = mysqli_real_escape_string($con, $_GET['code']);
-    $title_es = urldecode(mysqli_real_escape_string($con, $_GET['titleEs']));
-    $title_en = urldecode(mysqli_real_escape_string($con, $_GET['titleEn']));
-    $title_eu = urldecode(mysqli_real_escape_string($con, $_GET['titleEu']));
-    $text_es = urldecode(mysqli_real_escape_string($con, $_GET['textEs']));
-    $text_en = urldecode(mysqli_real_escape_string($con, $_GET['textEn']));
-    $text_eu = urldecode(mysqli_real_escape_string($con, $_GET['textEu']));
-    $duration = mysqli_real_escape_string($con, $_GET['duration']);
-    $action = mysqli_real_escape_string($con, $_GET['action']);
-    
-    //Validate code
-    $q = mysqli_query($con, "SELECT id FROM user WHERE id = $user AND md5(concat(password, md5(salt))) = '$code'");
-    //echo "SELECT id FROM user WHERE id = $user AND md5(concat(password, md5(salt))) = '$code'";
-    if (mysqli_num_rows($q) == 0){
-        error_log("Reporting location with wrong credentials (IP $_SERVER[REMOTE_ADDR])");
-        echo("<status>0</status>\n");
-        exit(-1);
-    }
-    
-    //Validate fields
-    if (strlen($title_es) == 0 || strlen($text_es) == 0){
-        error_log("Sending notification: no text (IP $_SERVER[REMOTE_ADDR])");
-        echo("<status>0</status>\n");
-        exit(-1);
-    }
-
-    if (is_numeric($duration) == false || $duration < 1 && $duration > 48 * 60){
-        error_log("Sending notification: invalid duration: $duration (IP $_SERVER[REMOTE_ADDR])");
-        echo("<status>0</status>\n");
-        exit(-1);
-    }
-    
-    if ($action != 'text' && $action != 'lablanca' && $action != 'gmschedule' && $action != 'cityschedule' && $action != 'location' && $action != 'around' && $action != 'blog' && $action != 'activities' && $action != 'gallery'){
-        error_log("Sending notification: invalid action: '$action' (IP $_SERVER[REMOTE_ADDR])");
-        echo("<status>0</status>\n");
-        exit(-1);
-    }
-    
-    //Handle translations
-    if (strlen($titleEn) == 0){
-        $titleEn = $titleEs;
-    }
-    if (strlen($titleEu) == 0){
-        $titleEu = $titleEs;
-    }
-    if (strlen($textEn) == 0){
-        $textEn = $textEs;
-    }
-    if (strlen($textEu) == 0){
-        $textEu = $textEs;
-    }
-    
-    //Insert
-    mysqli_query($con, "INSERT INTO notification (user, title_es, title_en, title_eu, text_es, text_en, text_eu, action, duration) VALUES ($user, '$title_es', '$title_en', '$title_eu', '$text_es', '$text_en', '$text_eu', '$action', $duration);");
-    echo("<status>1</status>\n");
-?>

+ 0 - 462
www/app/sync.php

@@ -1,462 +0,0 @@
-<?php
-    include('../functions.php');
-    $con = startdb('rw');
-    
-    //Get post data
-    $os = mysqli_real_escape_string($con, $_GET['os']);
-    $user = mysqli_real_escape_string($con, $_GET['code']);
-    $fg = mysqli_real_escape_string($con, $_GET['fg']);
-    $ip = getUserIP();
-    
-    //Get client version
-    $get_version = mysqli_real_escape_string($con, $_GET['v']);
-    
-    //If client version equials server version, theres is nothing to sync
-    $q_v = mysqli_query($con, "SELECT value FROM settings WHERE name = 'version';");
-    if (mysqli_num_rows($q_v) == 0){
-        //Here Im sending the app an OK code, but its not OK.
-        error_log("Trying to sync with a client, but there is no db version!");
-        echo "<synced>1</synced>\n";
-        mysqli_query($con, "INSERT INTO stat_sync (user, fg, os, ip, synced) VALUES ('$user', $fg, '$os', '$ip', 0);");
-        exit(-1);
-    }
-    else{
-        $r_v = mysqli_fetch_array($q_v);
-        if ($r_v['value'] <= $get_version){
-            echo "<synced>1</synced>\n";
-            mysqli_query($con, "INSERT INTO stat_sync (user, fg, os, ip, synced) VALUES ('$user', $fg, '$os', '$ip', 0);");
-            exit(-1);
-        }
-    }
-    
-    mysqli_query($con, "INSERT INTO stat_sync (user, fg, os, ip, synced) VALUES ('$user', $fg, '$os', '$ip', 1);");
-    error_log("INSERT INTO stat_sync (user, fg, os, ip, synced) VALUES ('$user', $fg, '$os', '$ip', 1);");
-    
-    //Header
-    echo "<database>\n";
-    echo "\t<name>gm</name>\n";
-    //Echo version
-    echo "\t<version>$r_v[value]</version>\n";
-    
-    //Rest of settings
-    $q = mysqli_query($con, "SELECT value FROM settings WHERE name = 'photos';");
-    if (mysqli_num_rows($q) > 0){
-        $r = mysqli_fetch_array($q);
-        echo "\t<photos>$r[value]</photos>\n";
-    }
-    $q = mysqli_query($con, "SELECT value FROM settings WHERE name = 'festivals';");
-    if (mysqli_num_rows($q) > 0){
-        $r = mysqli_fetch_array($q);
-        echo "\t<festivals>$r[value]</festivals>\n";
-    }
-    
-    //Table activity
-    echo "\t<table>\n";
-    echo "\t\t<name>activity</name>\n";
-    $q = mysqli_query($con, "SELECT id, permalink, date, city, title_es, title_en, title_eu, text_es, text_en, text_eu, after_es, after_en, after_eu, price, inscription, max_people, album, dtime, comments FROM activity  WHERE visible = 1;");
-    while ($r = mysqli_fetch_array($q)){
-        echo "\t\t<row>\n";
-        echo "\t\t\t<id>$r[id]</id>\n";
-        echo "\t\t\t<permalink>'$r[permalink]'</permalink>\n";
-        echo "\t\t\t<date>'$r[date]'</date>\n";
-        echo "\t\t\t<city>'$r[city]'</city>\n";
-        echo "\t\t\t<title_es>'$r[title_es]'</title_es>\n";
-        echo "\t\t\t<title_en>'$r[title_en]'</title_en>\n";
-        echo "\t\t\t<title_eu>'$r[title_eu]'</title_eu>\n";
-        echo "\t\t\t<text_es>'$r[text_es]'</text_es>\n";
-        echo "\t\t\t<text_en>'$r[text_en]'</text_en>\n";
-        echo "\t\t\t<text_eu>'$r[text_eu]'</text_eu>\n";
-        echo "\t\t\t<after_es>'$r[after_es]'</after_es>\n";
-        echo "\t\t\t<after_en>'$r[after_en]'</after_en>\n";
-        echo "\t\t\t<after_eu>'$r[after_eu]'</after_eu>\n";
-        echo "\t\t\t<price>$r[price]</price>\n";
-        echo "\t\t\t<inscription>$r[inscription]</inscription>\n";
-        echo "\t\t\t<max_people>$r[max_people]</max_people>\n";
-        echo "\t\t\t<album>$r[album]</album>\n";
-        echo "\t\t\t<dtime>'$r[dtime]'</dtime>\n";
-        echo "\t\t\t<comments>$r[comments]</comments>\n";
-        echo "\t\t</row>\n";
-    }
-    echo "\t</table>\n";
-    
-    //Table activity_comment
-    echo "\t<table>\n";
-    echo "\t\t<name>activity_comment</name>\n";
-    $q = mysqli_query($con, "SELECT activity_comment.id AS id, activity, text, dtime, fname, username, lang FROM activity_comment, user WHERE activity_comment.user = user.id AND approved = 1;");
-    while ($r = mysqli_fetch_array($q)){
-        echo "\t\t<row>\n";
-        echo "\t\t\t<id>$r[id]</id>\n";
-        echo "\t\t\t<activity>$r[activity]</activity>\n";
-        echo "\t\t\t<text>'$r[text]'</text>\n";
-        echo "\t\t\t<dtime>'$r[dtime]'</dtime>\n";
-        if (strlen($r['username'] == 0)){
-            echo "\t\t\t\<username>'$r[fname]'</username>\n";
-        }
-        else{
-            echo "\t\t\t\<username>'$r[username]'</username>\n";
-        }
-        echo "\t\t\t<lang>'$r[lang]'</lang>\n";
-        echo "\t\t</row>\n";
-    }
-    echo "\t</table>\n";
-    
-    //Table activity_image
-    echo "\t<table>\n";
-    echo "\t\t<name>activity_image</name>\n";
-    $q = mysqli_query($con, "SELECT * FROM activity_image;");
-    while ($r = mysqli_fetch_array($q)){
-        echo "\t\t<row>\n";
-        echo "\t\t\t<id>$r[id]</id>\n";
-        echo "\t\t\t<activity>$r[activity]</activity>\n";
-        echo "\t\t\t<image>'$r[image]'</image>\n";
-        echo "\t\t\t<idx>$r[idx]</idx>\n";
-        echo "\t\t</row>\n";
-    }
-    echo "\t</table>\n";
-    
-    //Table activity_itinerary
-    echo "\t<table>\n";
-    echo "\t\t<name>activity_itinerary</name>\n";
-    $q = mysqli_query($con, "SELECT * FROM activity_itinerary;");
-    while ($r = mysqli_fetch_array($q)){
-        echo "\t\t<row>\n";
-        echo "\t\t\t<id>$r[id]</id>\n";
-        echo "\t\t\t<activity>$r[activity]</activity>\n";
-        echo "\t\t\t<name_es>'$r[name_es]'</name_es>\n";
-        echo "\t\t\t<name_en>'$r[name_en]'</name_en>\n";
-        echo "\t\t\t<name_eu>'$r[name_eu]'</name_eu>\n";
-        echo "\t\t\t<description_es>'$r[description_es]'</description_es>\n";
-        echo "\t\t\t<description_en>'$r[description_en]'</description_en>\n";
-        echo "\t\t\t<description_eu>'$r[description_eu]'</description_eu>\n";
-        echo "\t\t\t<start>'$r[start]'</start>\n";
-        echo "\t\t\t<end>'$r[end]'</end>\n";
-        echo "\t\t\t<place>'$r[place]'</place>\n";
-        echo "\t\t</row>\n";
-    }
-    echo "\t</table>\n";
-    
-    //Table activity_tag
-    echo "\t<table>\n";
-    echo "\t\t<name>activity_tag</name>\n";
-    $q = mysqli_query($con, "SELECT * FROM activity_tag;");
-    while ($r = mysqli_fetch_array($q)){
-        echo "\t\t<row>\n";
-        echo "\t\t\t<activity>$r[activity]</activity>\n";
-        echo "\t\t\t<tag>'$r[tag]'</tag>\n";
-        echo "\t\t</row>\n";
-    }
-    echo "\t</table>\n";
-    
-    //Table album
-    echo "\t<table>\n";
-    echo "\t\t<name>album</name>\n";
-    $q = mysqli_query($con, "SELECT id, permalink, title_es, title_en, title_eu, description_es, description_en, description_eu, open, dtime FROM album;");
-    while ($r = mysqli_fetch_array($q)){
-        echo "\t\t<row>\n";
-        echo "\t\t\t<id>$r[id]</id>\n";
-        echo "\t\t\t<permalink>'$r[permalink]'</permalink>\n";
-        echo "\t\t\t<name_es>'$r[title_es]'</name_es>\n";
-        echo "\t\t\t<name_en>'$r[title_en]'</name_en>\n";
-        echo "\t\t\t<name_eu>'$r[title_eu]'</name_eu>\n";
-        echo "\t\t\t<description_es>'$r[description_es]'</description_es>\n";
-        echo "\t\t\t<description_en>'$r[description_en]'</description_en>\n";
-        echo "\t\t\t<description_eu>'$r[description_eu]'</description_eu>\n";
-        echo "\t\t\t<open>$r[open]</open>\n";
-        echo "\t\t\t<time>'$r[dtime]'</time>\n";
-        echo "\t\t</row>\n";
-    }
-    echo "\t</table>\n";
-    
-    //Table festival
-    echo "\t<table>\n";
-    echo "\t\t<name>festival</name>\n";
-    $q = mysqli_query($con, "SELECT * FROM festival;");
-    while ($r = mysqli_fetch_array($q)){
-        echo "\t\t<row>\n";
-        echo "\t\t\t<id>$r[id]</id>\n";
-        echo "\t\t\t<year>$r[year]</year>\n";
-        echo "\t\t\t<text_es>'$r[text_es]'</text_es>\n";
-        echo "\t\t\t<text_en>'$r[text_en]'</text_en>\n";
-        echo "\t\t\t<text_eu>'$r[text_eu]'</text_eu>\n";
-        echo "\t\t\t<img>'$r[img]'</img>\n";
-        echo "\t\t</row>\n";
-    }
-    echo "\t</table>\n";
-    
-    //Table festival_day
-    echo "\t<table>\n";
-    echo "\t\t<name>festival_day</name>\n";
-    $q = mysqli_query($con, "SELECT * FROM festival_day;");
-    while ($r = mysqli_fetch_array($q)){
-        echo "\t\t<row>\n";
-        echo "\t\t\t<id>$r[id]</id>\n";
-        echo "\t\t\t<date>'$r[date] 00:00:00'</date>\n";
-        echo "\t\t\t<name_es>'$r[name_es]'</name_es>\n";
-        echo "\t\t\t<name_en>'$r[name_en]'</name_en>\n";
-        echo "\t\t\t<name_eu>'$r[name_eu]'</name_eu>\n";
-        echo "\t\t\t<price>$r[price]</price>\n";
-        echo "\t\t</row>\n";
-    }
-    echo "\t</table>\n";
-    
-    //Table festival_event
-    echo "\t<table>\n";
-    echo "\t\t<name>festival_event</name>\n";
-    $q = mysqli_query($con, "SELECT * FROM festival_event;");
-    while ($r = mysqli_fetch_array($q)){
-        echo "\t\t<row>\n";
-        echo "\t\t\t<id>$r[id]</id>\n";
-        echo "\t\t\t<gm>$r[gm]</gm>\n";
-        echo "\t\t\t<title_es>'$r[title_es]'</title_es>\n";
-        echo "\t\t\t<title_en>'$r[title_en]'</title_en>\n";
-        echo "\t\t\t<title_eu>'$r[title_eu]'</title_eu>\n";
-        echo "\t\t\t<description_es>'$r[description_es]'</description_es>\n";
-        echo "\t\t\t<description_en>'$r[description_en]'</description_en>\n";
-        echo "\t\t\t<description_eu>'$r[description_eu]'</description_eu>\n";
-        echo "\t\t\t<host>$r[host]</host>\n";
-        echo "\t\t\t<place>$r[place]</place>\n";
-        echo "\t\t\t<start>'$r[start]'</start>\n";
-        echo "\t\t\t<end>'$r[end]'</end>\n";
-        echo "\t\t</row>\n";
-    }
-    echo "\t</table>\n";
-    
-    //Table festival_event_image
-    echo "\t<table>\n";
-    echo "\t\t<name>festival_event_image</name>\n";
-    $q = mysqli_query($con, "SELECT * FROM festival_event_image;");
-    while ($r = mysqli_fetch_array($q)){
-        echo "\t\t<row>\n";
-        echo "\t\t\t<id>$r[id]</id>\n";
-        echo "\t\t\t<event>$r[event]</event>\n";
-        echo "\t\t\t<image>'$r[image]'</image>\n";
-        echo "\t\t\t<idx>$r[idx]</idx>\n";
-        echo "\t\t</row>\n";
-    }
-    echo "\t</table>\n";
-    
-    //Table festival_offer
-    echo "\t<table>\n";
-    echo "\t\t<name>festival_offer</name>\n";
-    $q = mysqli_query($con, "SELECT * FROM festival_offer;");
-    while ($r = mysqli_fetch_array($q)){
-        echo "\t\t<row>\n";
-        echo "\t\t\t<id>$r[id]</id>\n";
-        echo "\t\t\t<year>$r[year]</year>\n";
-        echo "\t\t\t<name_es>'$r[name_es]'</name_es>\n";
-        echo "\t\t\t<name_en>'$r[name_en]'</name_en>\n";
-        echo "\t\t\t<name_eu>'$r[name_eu]'</name_eu>\n";
-        echo "\t\t\t<description_es>'$r[description_es]'</description_es>\n";
-        echo "\t\t\t<description_en>'$r[description_en]'</description_en>\n";
-        echo "\t\t\t<description_eu>'$r[description_eu]'</description_eu>\n";
-        echo "\t\t\t<days>$r[days]</days>\n";
-        echo "\t\t\t<price>$r[price]</price>\n";
-        echo "\t\t</row>\n";
-    }
-    echo "\t</table>\n";
-    
-    //Table location
-    echo "\t<table>\n";
-    echo "\t\t<name>location</name>\n";
-    $q = mysqli_query($con, "SELECT id, dtime, lat, lon, manual FROM location;");
-    while ($r = mysqli_fetch_array($q)){
-        echo "\t\t<row>\n";
-        echo "\t\t\t<id>$r[id]</id>\n";
-        echo "\t\t\t<dtime>'$r[dtime]'</dtime>\n";
-        echo "\t\t\t<lat>$r[lat]</lat>\n";
-        echo "\t\t\t<lon>$r[lon]</lon>\n";
-        echo "\t\t\t<manual>$r[manual]</manual>\n";
-        echo "\t\t</row>\n";
-    }
-    echo "\t</table>\n";
-    
-    //Table notification
-    echo "\t<table>\n";
-    echo "\t\t<name>notification</name>\n";
-    $q = mysqli_query($con, "SELECT id, dtime, duration, action, title_es, title_en, title_eu, text_es, text_en, text_eu, internal FROM notification;");
-    while ($r = mysqli_fetch_array($q)){
-        echo "\t\t<row>\n";
-        echo "\t\t\t<id>$r[id]</id>\n";
-        echo "\t\t\t<dtime>'$r[dtime]'</dtime>\n";
-        echo "\t\t\t<duration>$r[duration]</duration>\n";
-        echo "\t\t\t<action>'$r[action]'</action>\n";
-        echo "\t\t\t<title_es>'$r[title_es]'</title_es>\n";
-        echo "\t\t\t<title_en>'$r[title_en]'</title_en>\n";
-        echo "\t\t\t<title_eu>'$r[title_eu]'</title_eu>\n";
-        echo "\t\t\t<text_es>'$r[text_es]'</text_es>\n";
-        echo "\t\t\t<text_en>'$r[text_en]'</text_en>\n";
-        echo "\t\t\t<text_eu>'$r[text_eu]'</text_eu>\n";
-        echo "\t\t\t<internal>$r[internal]</internal>\n";
-        echo "\t\t</row>\n";
-    }
-    echo "\t</table>\n";
-    
-    //Table people
-    echo "\t<table>\n";
-    echo "\t\t<name>people</name>\n";
-    $q = mysqli_query($con, "SELECT * FROM people;");
-    while ($r = mysqli_fetch_array($q)){
-        echo "\t\t<row>\n";
-        echo "\t\t\t<id>$r[id]</id>\n";
-        echo "\t\t\t<name_es>'$r[name_es]'</name_es>\n";
-        echo "\t\t\t<name_en>'$r[name_en]'</name_en>\n";
-        echo "\t\t\t<name_eu>'$r[name_eu]'</name_eu>\n";
-        echo "\t\t\t<link>'$r[link]'</link>\n";
-        echo "\t\t</row>\n";
-    }
-    echo "\t</table>\n";
-    
-    //Table photo
-    echo "\t<table>\n";
-    echo "\t\t<name>photo</name>\n";
-    $q = mysqli_query($con, "SELECT photo.id AS id, file, permalink, title_es, title_en, title_eu, description_es, description_en, description_eu, dtime, uploaded, place, width, height, size, fname FROM photo, user WHERE photo.user = user.id AND approved = 1;");
-    while ($r = mysqli_fetch_array($q)){
-        echo "\t\t<row>\n";
-        echo "\t\t\t<id>$r[id]</id>\n";
-        echo "\t\t\t<file>'$r[file]'</file>\n";
-        echo "\t\t\t<permalink>$r[city]</permalink>\n";
-        echo "\t\t\t<title_es>'$r[title_es]'</title_es>\n";
-        echo "\t\t\t<title_en>'$r[title_en]'</title_en>\n";
-        echo "\t\t\t<title_eu>'$r[title_eu]'</title_eu>\n";
-        echo "\t\t\t<description_es>'$r[description_es]'</description_es>\n";
-        echo "\t\t\t<description_en>'$r[description_en]'</description_en>\n";
-        echo "\t\t\t<description_eu>'$r[description_eu]'</description_eu>\n";
-        echo "\t\t\t<dtime>'$r[dtime]'</dtime>\n";
-        echo "\t\t\t<uploaded>'$r[uploaded]'</uploaded>\n";
-        echo "\t\t\t<place>$r[place]</place>\n";
-        echo "\t\t\t<width>$r[width]</width>\n";
-        echo "\t\t\t<height>$r[height]</height>\n";
-        echo "\t\t\t<size>$r[size]</size>\n";
-        if (strlen($r['username'] == 0)){
-            echo "\t\t\t\<username>'$r[fname]'</username>\n";
-        }
-        else{
-            echo "\t\t\t\<username>'$r[username]'</username>\n";
-        }
-        echo "\t\t</row>\n";
-    }
-    echo "\t</table>\n";
-    
-    //Table photo_album
-    echo "\t<table>\n";
-    echo "\t\t<name>photo_album</name>\n";
-    $q = mysqli_query($con, "SELECT * FROM photo_album;");
-    while ($r = mysqli_fetch_array($q)){
-        echo "\t\t<row>\n";
-        echo "\t\t\t<photo>$r[photo]</photo>\n";
-        echo "\t\t\t<album>$r[album]</album>\n";
-        echo "\t\t</row>\n";
-    }
-    echo "\t</table>\n";
-    
-    //Table photo_comment
-    echo "\t<table>\n";
-    echo "\t\t<name>photo_comment</name>\n";
-    $q = mysqli_query($con, "SELECT photo_comment.id AS id, photo, text, dtime, fname, username, lang FROM photo_comment, user WHERE photo_comment.user = user.id AND approved = 1;");
-    while ($r = mysqli_fetch_array($q)){
-        echo "\t\t<row>\n";
-        echo "\t\t\t<id>$r[id]</id>\n";
-        echo "\t\t\t<photo>$r[photo]</photo>\n";
-        echo "\t\t\t<text>'$r[text]'</text>\n";
-        echo "\t\t\t<dtime>'$r[dtime]'</dtime>\n";
-        if (strlen($r['username'] == 0)){
-            echo "\t\t\t\<username>'$r[fname]'</username>\n";
-        }
-        else{
-            echo "\t\t\t\<username>'$r[username]'</username>\n";
-        }
-        echo "\t\t\t<lang>'$r[lang]'</lang>\n";
-        echo "\t\t</row>\n";
-    }
-    echo "\t</table>\n";
-    
-    //Table place
-    echo "\t<table>\n";
-    echo "\t\t<name>place</name>\n";
-    $q = mysqli_query($con, "SELECT * FROM place;");
-    while ($r = mysqli_fetch_array($q)){
-        echo "\t\t<row>\n";
-        echo "\t\t\t<id>$r[id]</id>\n";
-        echo "\t\t\t<name_es>'$r[name_es]'</name_es>\n";
-        echo "\t\t\t<name_en>'$r[name_en]'</name_en>\n";
-        echo "\t\t\t<name_eu>'$r[name_eu]'</name_eu>\n";
-        echo "\t\t\t<address_es>'$r[address_es]'</address_es>\n";
-        echo "\t\t\t<address_en>'$r[address_en]'</address_en>\n";
-        echo "\t\t\t<address_eu>'$r[address_eu]'</address_eu>\n";
-        echo "\t\t\t<cp>'$r[cp]'</cp>\n";
-        echo "\t\t\t<lat>$r[lat]</lat>\n";
-        echo "\t\t\t<lon>$r[lon]</lon>\n";
-        echo "\t\t</row>\n";
-    }
-    echo "\t</table>\n";
-    
-    //Table post
-    echo "\t<table>\n";
-    echo "\t\t<name>post</name>\n";
-    $q = mysqli_query($con, "SELECT id, permalink, title_es, title_en, title_eu, text_es, text_en, text_eu, dtime, comments FROM post  WHERE visible = 1;");
-    while ($r = mysqli_fetch_array($q)){
-        echo "\t\t<row>\n";
-        echo "\t\t\t<id>$r[id]</id>\n";
-        echo "\t\t\t<permalink>'$r[permalink]'</permalink>\n";
-        echo "\t\t\t<title_es>'$r[title_es]'</title_es>\n";
-        echo "\t\t\t<title_en>'$r[title_en]'</title_en>\n";
-        echo "\t\t\t<title_eu>'$r[title_eu]'</title_eu>\n";
-        echo "\t\t\t<text_es>'$r[text_es]'</text_es>\n";
-        echo "\t\t\t<text_en>'$r[text_en]'</text_en>\n";
-        echo "\t\t\t<text_eu>'$r[text_eu]'</text_eu>\n";
-        echo "\t\t\t<dtime>'$r[dtime]'</dtime>\n";
-        echo "\t\t\t<comments>$r[comments]</comments>\n";
-        echo "\t\t</row>\n";
-    }
-    echo "\t</table>\n";
-    
-    //Table post_comment
-    echo "\t<table>\n";
-    echo "\t\t<name>post_comment</name>\n";
-    //$q = mysqli_query($con, "SELECT post_comment.id AS id, post, text, dtime, fname, post_comment.username AS username, lang FROM post_comment, user WHERE post_comment.user = user.id AND approved = 1;");
-    $q = mysqli_query($con, "SELECT id, post, text, dtime, username, lang FROM post_comment WHERE approved = 1;");
-    while ($r = mysqli_fetch_array($q)){
-        echo "\t\t<row>\n";
-        echo "\t\t\t<id>$r[id]</id>\n";
-        echo "\t\t\t<post>$r[post]</post>\n";
-        echo "\t\t\t<text>'$r[text]'</text>\n";
-        echo "\t\t\t<dtime>'$r[dtime]'</dtime>\n";
-        //if (strlen($r['username'] == 0)){
-        //    echo "\t\t\t<username>'$r[fname]'</username>\n";
-        //}
-        //else{
-            echo "\t\t\t<username>'$r[username]'</username>\n";
-        //}
-        echo "\t\t\t<lang>'$r[lang]'</lang>\n";
-        echo "\t\t</row>\n";
-    }
-    echo "\t</table>\n";
-    
-    //Table post_image
-    echo "\t<table>\n";
-    echo "\t\t<name>post_image</name>\n";
-    $q = mysqli_query($con, "SELECT * FROM post_image;");
-    while ($r = mysqli_fetch_array($q)){
-        echo "\t\t<row>\n";
-        echo "\t\t\t<id>$r[id]</id>\n";
-        echo "\t\t\t<post>$r[post]</post>\n";
-        echo "\t\t\t<image>'$r[image]'</image>\n";
-        echo "\t\t\t<idx>$r[idx]</idx>\n";
-        echo "\t\t</row>\n";
-    }
-    echo "\t</table>\n";
-    
-    //Table post_tag
-    echo "\t<table>\n";
-    echo "\t\t<name>post_tag</name>\n";
-    $q = mysqli_query($con, "SELECT * FROM post_tag;");
-    while ($r = mysqli_fetch_array($q)){
-        echo "\t\t<row>\n";
-        echo "\t\t\t<post>$r[post]</post>\n";
-        echo "\t\t\t<tag>'$r[tag]'</tag>\n";
-        echo "\t\t</row>\n";
-    }
-    echo "\t</table>\n";
-    
-    echo "</database>\n";
-?>

+ 2 - 2
www/archivo/index.php

@@ -1,3 +1,3 @@
-< 
+<?php 
     header("Location: /archivo" . $_GET['file']);
-??php>
+?>

+ 71 - 69
www/ayuda/index.php

@@ -1,6 +1,6 @@
 <?php
     session_start();
-    $http_host = $_SERVER['HTTP_HOST'];
+    $http_host = $_SERVER["HTTP_HOST"];
     include("../functions.php");
     $con = startdb();
     $proto = getProtocol();
@@ -10,7 +10,7 @@
     $lang = selectLanguage();
     include("../lang/lang_" . $lang . ".php");
     
-    $cur_section = $lng['section_help'];
+    $cur_section = $lng["section_help"];
 ?>
 <!DOCTYPE html>
 <html>
@@ -18,109 +18,111 @@
         <meta content="text/html; charset=utf-8" http-equiv="content-type"/>
         <meta charset="utf-8"/>
         <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1">
-        <title><?=$lng['footer_help']?> - Gasteizko Margolariak</title>
+        <title><?=$lng["footer_help"]?> - Gasteizko Margolariak</title>
         <link rel="shortcut icon" href="<?="$server/img/logo/favicon.ico";?>">
         <!-- CSS files -->
         <style>
-            <?php 
-                include("../css/ui.css"); 
-                include("../css/ayuda.css");
-            ?>
+<?php 
+            include("../css/ui.css"); 
+            include("../css/ayuda.css");
+?>
         </style>
         <!-- CSS for mobile version -->
         <style media="(max-width : 990px)">
-            <?php 
-                include("../css/m/ui.css"); 
-                include("../css/m/ayuda.css");
-            ?>
+<?php 
+            include("../css/m/ui.css"); 
+            include("../css/m/ayuda.css");
+?>
         </style>
         <!-- Script files -->
         <script type="text/javascript">
-            <?php
-                include("../script/ui.js");
-            ?>
+<?php
+            include("../script/ui.js");
+?>
         </script>
         <!-- Meta tags -->
         <link rel="canonical" href="<?=$server?>/us/"/>
         <link rel="author" href="<?=$server?>"/>
         <link rel="publisher" href="<?=$server?>"/>
-        <meta name="description" content="<?=$lng['us_description']?>"/>
-        <meta property="og:title" content="<?=$lng['us_title']?> - Gasteizko Margolariak"/>
+        <meta name="description" content="<?=$lng["us_description"]?>"/>
+        <meta property="og:title" content="<?=$lng["us_title"]?> - Gasteizko Margolariak"/>
         <meta property="og:url" content="<?=$server?>"/>
-        <meta property="og:description" content="<?=$lng['us_description']?>"/>
+        <meta property="og:description" content="<?=$lng["us_description"]?>"/>
         <meta property="og:image" content="<?=$server?>/img/logo/logo.png"/>
-        <meta property="og:site_name" content="<?=$lng['us_title']?>"/>
+        <meta property="og:site_name" content="<?=$lng["us_title"]?>"/>
         <meta property="og:type" content="website"/>
         <meta property="og:locale" content="<?=$lang?>"/>
         <meta name="twitter:card" content="summary"/>
-        <meta name="twitter:title" content="<?=$lng['us_title']?> - Gasteizko Margolariak"/>
-        <meta name="twitter:description" content="<?=$lng['us_description']?>"/>
+        <meta name="twitter:title" content="<?=$lng["us_title"]?> - Gasteizko Margolariak"/>
+        <meta name="twitter:description" content="<?=$lng["us_description"]?>"/>
         <meta name="twitter:image" content="<?=$server?>/img/logo/logo.png"/>
         <meta name="twitter:url" content="<?=$server?>"/>
         <meta name="robots" content="index follow"/>
     </head>
     <body>
-        <?php include("../header.php"); ?>
-		<div id="shortcouts_container">
-			<div class="section" id="shortcouts">
-				<h3 class='section_title'><?=$lng['help_shortcouts']?></h3>
-				<div class="entry">
-					<ul>
-						<li><a href="#section_association"><?=$lng['help_contact_title']?></a></li>
-						<li><a href="#section_license"><?=$lng['help_license_title']?></a></li>
-						<li><a href="#section_privacy"><?=$lng['help_privacy_title']?></a></li>
-						<li><a href="#section_cookie"><?=$lng['help_cookie_title']?></a></li>
-						<li><a href="#section_ads"><?=$lng['help_ad_title']?></a></li>
-					</ul>
-				</div> <!-- .entry -->
-			 </div> <!-- .section -->
-		</div> <!-- #shortcouts_container -->
+<?php
+        include("../header.php");
+?>
+        <div id="shortcouts_container">
+            <div class="section" id="shortcouts">
+                <h3 class='section_title'><?=$lng["help_shortcouts"]?></h3>
+                <div class="entry">
+                    <ul>
+                        <li><a href="#section_association"><?=$lng["help_contact_title"]?></a></li>
+                        <li><a href="#section_license"><?=$lng["help_license_title"]?></a></li>
+                        <li><a href="#section_privacy"><?=$lng["help_privacy_title"]?></a></li>
+                        <li><a href="#section_cookie"><?=$lng["help_cookie_title"]?></a></li>
+                        <li><a href="#section_ads"><?=$lng["help_ad_title"]?></a></li>
+                    </ul>
+                </div> <!-- .entry -->
+             </div> <!-- .section -->
+        </div> <!-- #shortcouts_container -->
         <div id="content">
             <div class="content_row">
                 <div class="content_cell">
                     <div class="section" id="section_association">
-                        <h3 class='section_title'><?=$lng['help_contact_title']?></h3>
+                        <h3 class='section_title'><?=$lng["help_contact_title"]?></h3>
                         <div class="entry">
                             <table id="association">
                                 <tr>
-                                    <td class="name"><?=$lng['help_contact_register']?></td>
-                                    <td class="value"><?=$lng['help_contact_register_value']?></td>
+                                    <td class="name"><?=$lng["help_contact_register"]?></td>
+                                    <td class="value"><?=$lng["help_contact_register_value"]?></td>
                                 </tr>
                                 <tr>
-                                    <td class="name"><?=$lng['help_contact_date_constitution']?></td>
-                                    <td class="value"><?=$lng['help_contact_date_constitution_value']?></td>
+                                    <td class="name"><?=$lng["help_contact_date_constitution"]?></td>
+                                    <td class="value"><?=$lng["help_contact_date_constitution_value"]?></td>
                                 </tr>
                                 <tr>
-                                    <td class="name"><?=$lng['help_contact_date_inscription']?></td>
-                                    <td class="value"><?=$lng['help_contact_date_inscription_value']?></td>
+                                    <td class="name"><?=$lng["help_contact_date_inscription"]?></td>
+                                    <td class="value"><?=$lng["help_contact_date_inscription_value"]?></td>
                                 </tr>
                                 <tr>
-                                    <td class="name"><?=$lng['help_contact_city']?></td>
-                                    <td class="value"><?=$lng['help_contact_city_value']?></td>
+                                    <td class="name"><?=$lng["help_contact_city"]?></td>
+                                    <td class="value"><?=$lng["help_contact_city_value"]?></td>
                                 </tr>
                                 <tr>
-                                    <td class="name"><?=$lng['help_contact_territory']?></td>
-                                    <td class="value"><?=$lng['help_contact_territory_value']?></td>
+                                    <td class="name"><?=$lng["help_contact_territory"]?></td>
+                                    <td class="value"><?=$lng["help_contact_territory_value"]?></td>
                                 </tr>
                                 <tr>
-                                    <td class="name"><?=$lng['help_contact_country']?></td>
-                                    <td class="value"><?=$lng['help_contact_country_value']?></td>
+                                    <td class="name"><?=$lng["help_contact_country"]?></td>
+                                    <td class="value"><?=$lng["help_contact_country_value"]?></td>
                                 </tr>
                                 <tr>
-                                    <td class="name"><?=$lng['help_contact_clasification']?></td>
-                                    <td class="value"><?=$lng['help_contact_clasification_value']?></td>
+                                    <td class="name"><?=$lng["help_contact_clasification"]?></td>
+                                    <td class="value"><?=$lng["help_contact_clasification_value"]?></td>
                                 </tr>
                                 <tr>
-                                    <td class="name"><?=$lng['help_contact_objectives']?></td>
-                                    <td class="value"><?=$lng['help_contact_objectives_value']?></td>
+                                    <td class="name"><?=$lng["help_contact_objectives"]?></td>
+                                    <td class="value"><?=$lng["help_contact_objectives_value"]?></td>
                                 </tr>
                                 <tr>
-                                    <td class="name"><?=$lng['help_contact_phone']?></td>
-                                    <td class="value"><?=$lng['help_contact_phone_value']; ?></td>
+                                    <td class="name"><?=$lng["help_contact_phone"]?></td>
+                                    <td class="value"><?=$lng["help_contact_phone_value"]; ?></td>
                                 </tr>
                                 <tr>
-                                    <td class="name"><?=$lng['help_contact_email']?></td>
-                                    <td class="value"><?=$lng['help_contact_email_value']?></td>
+                                    <td class="name"><?=$lng["help_contact_email"]?></td>
+                                    <td class="value"><?=$lng["help_contact_email_value"]?></td>
                                 </tr>
                             </table>
                         </div>
@@ -128,9 +130,9 @@
                 </div>
                 <div class="content_cell">
                     <div class="section" id="section_license">
-                        <h3 class='section_title'><?=$lng['help_license_title']?></h3>
+                        <h3 class='section_title'><?=$lng["help_license_title"]?></h3>
                         <div class="entry">
-                            <?=$lng['help_license']?>
+                            <?=$lng["help_license"]?>
                         </div>
                     </div>
                 </div>
@@ -138,17 +140,17 @@
             <div class="content_row">
                 <div class="content_cell">
                     <div class="section" id="section_privacy">
-                        <h3 class="section_title"><?=$lng['help_privacy_title']?></h3>
+                        <h3 class="section_title"><?=$lng["help_privacy_title"]?></h3>
                         <div class="entry">
-                            <?=$lng['help_privacy']; ?>
+                            <?=$lng["help_privacy"]; ?>
                         </div>
                     </div>
                 </div>
                 <div class="content_cell">
                     <div class="section" id="section_cookie">
-                        <h3 class='section_title'><?=$lng['help_cookie_title']?></h3>
+                        <h3 class='section_title'><?=$lng["help_cookie_title"]?></h3>
                         <div class="entry">
-                            <?=$lng['help_cookie']; ?>
+                            <?=$lng["help_cookie"]; ?>
                         </div>
                     </div>
                 </div>
@@ -156,18 +158,18 @@
             <div class="content_row">
                 <div class="content_cell">
                     <div class="section" id="section_ads">
-                        <h3 class="section_title"><?=$lng['help_ad_title']?></h3>
+                        <h3 class="section_title"><?=$lng["help_ad_title"]?></h3>
                         <div class="entry">
-                            <?=$lng['help_ad']?>
+                            <?=$lng["help_ad"]?>
                         </div>
                     </div>
                 </div>
             </div>
         </div>
-        <?php
-            include("../footer.php");
-            $ad = ad($con, $lang, $lng); 
-            stats($ad, $ad_static, "ayuda", "");
-        ?>
+<?php
+        include("../footer.php");
+        $ad = ad($con, $lang, $lng); 
+        stats($ad, $ad_static, "ayuda", "");
+?>
     </body>
 </html>

+ 36 - 0
www/css/error.css

@@ -0,0 +1,36 @@
+div#error_code{
+    display: inline-block;
+    margin-top: 2em;
+    margin-left: 10%;
+    border: 0.1em solid #000011;
+    border-radius: 1em;
+    padding: 0.5em 0 0.5em 0;
+    background-color: #0078ff;
+    -webkit-filter: drop-shadow(0 0 0.4em #000011);
+    filter: drop-shadow(0 0 0.4em #000011);
+    -ms-filter: "progid:DXImageTransform.Microsoft.Dropshadow(OffX=0, OffY=0, Color='#000011')";
+    filter: "progid:DXImageTransform.Microsoft.Dropshadow(OffX=0, OffY=0, Color='#000011')";
+    color: #ffffff;
+}
+
+
+td#error_number{
+    font-size: 300%;
+    border-right: 0.063em solid #000000;
+    padding-right: 1.875em;
+    padding-left: 1.250em;
+}
+td#error_tag{
+    font-size: 110%;
+    padding-left: 1.750em;
+    padding-right: 1.250em;
+}
+div#error_message{
+    width: 80%;
+    margin-left: 10%;
+    margin-bottom: 4em;
+}
+
+div#error_message div.entry{
+    padding: 0.8em;
+}

+ 15 - 0
www/css/m/error.css

@@ -0,0 +1,15 @@
+div#error_code{
+    width: 90%;
+    margin-left: 5%;
+    margin-right: auto;
+    margin-top: 4em;
+    margin-bottom: 2em;
+}
+div#error_message{
+    width: 90%;
+    margin-left: 5%;
+    margin-right: auto;
+    margin-top: 0;
+    margin-bottom: 4;
+}
+

+ 86 - 0
www/error/403.php

@@ -0,0 +1,86 @@
+<?php
+    $http_host = $_SERVER['HTTP_HOST'];
+    include("../functions.php");
+    $con = startdb();
+    $proto = getProtocol();
+    $server = "$proto$http_host";
+
+    //Language
+    $lang = selectLanguage();
+    include("../lang/lang_$lang.php");
+
+    $cur_section = $lng['section_home'];
+?>
+<!DOCTYPE html>
+<html>
+    <head>
+        <meta content="text/html; charset=windows-1252" http-equiv="content-type"/>
+        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1">
+        <title><?php echo $lng['error_title'] ?> - Gasteizko Margolariak</title>
+        <link rel="shortcut icon" href="<?php echo "$proto$http_host/img/logo/favicon.ico";?>">
+        <!-- CSS files -->
+        <style>
+<?php
+            include("../css/ui.css");
+            include("../css/error.css");
+?>
+        </style>
+        <!-- CSS for mobile version -->
+        <style media="(max-width : 990px)">
+<?php
+            include("../css/m/ui.css");
+            include("../css/m/error.css");
+?>
+        </style>
+        <!-- Script files -->
+        <script type="text/javascript">
+<?php
+            include("../script/ui.js");
+?>
+        </script>
+        <meta name="robots" content="noindex follow"/>
+    </head>
+    <body>
+<?php
+        include("../header.php")
+?>
+        <div id="error_code">
+            <table id="error_code">
+                <tr>
+                    <td id="error_number">
+                        403
+                    </td>
+                    <td id="error_tag">
+                        <?=$lng["error_error"]?>
+                        <br/>
+                        <?=$lng["error_code"]?>
+                    </td>
+                <tr>
+            </table>
+        </div>
+        <br/><br/><br/><br/>
+        <div id="error_message" class="section">
+            <h3 class='section_title'><?=$lng["error_403_title"]?></h3>
+            <div class="entry">
+                <?=$lng["error_403_description"]?>
+                <br/><br/>
+                <?=$lng["error_403_solution"]?>
+                <ul>
+                    <li>
+                        <a href="javascript: history.go(-1);"><?=$lng["error_403_solution_0"]?></a>
+                    </li>
+                    <li>
+                        <a href="<?php echo "$proto$http_host/";?>"><?=$lng["error_403_solution_1"]?></a>
+                    </li>
+                    <li>
+                        <a target='_blank' href="https://www.youtube.com/results?search_query=cats"><?=$lng["error_403_solution_2"]?></a>
+                    </li>
+                </ul>
+            </div>
+        </div>
+<?php
+        include("../footer.php");
+        stats(-1, $ad_static, "error", "403");
+?>
+    </body>
+</html>

+ 36 - 69
www/error/404.php

@@ -3,11 +3,12 @@
     include("../functions.php");
     $con = startdb();
     $proto = getProtocol();
-    
+    $server = "$proto$http_host";
+
     //Language
     $lang = selectLanguage();
-    include("../lang/lang_" . $lang . ".php");
-    
+    include("../lang/lang_$lang.php");
+
     $cur_section = $lng['section_home'];
 ?>
 <!DOCTYPE html>
@@ -19,101 +20,67 @@
         <link rel="shortcut icon" href="<?php echo "$proto$http_host/img/logo/favicon.ico";?>">
         <!-- CSS files -->
         <style>
-            <?php 
-                include("../css/ui.css"); 
-                include("../css/error.css");
-            ?>
+<?php
+            include("../css/ui.css");
+            include("../css/error.css");
+?>
         </style>
         <!-- CSS for mobile version -->
         <style media="(max-width : 990px)">
-            <?php 
-                include("../css/m/ui.css"); 
-                include("../css/m/error.css");
-            ?>
+<?php
+            include("../css/m/ui.css");
+            include("../css/m/error.css");
+?>
         </style>
         <!-- Script files -->
         <script type="text/javascript">
-            <?php
-                include("../script/ui.js");
-            ?>
+<?php
+            include("../script/ui.js");
+?>
         </script>
-        <style>
-            div#error-code{
-                display:        inline-block;
-                margin-top:        2em;
-                margin-left:     10%;
-            }
-            td#error-number{
-                font-size:        300%;
-                border-right:    0.063em solid #000000;
-                padding-right:    1.875em;
-                padding-left:    1.250em;
-            }
-            td#error-tag{
-                font-size:        110%;
-                padding-left:    1.750em;
-                padding-right:    1.250em;
-            }
-            div#error-message{
-                width:            80%;
-                margin-left:    10%;
-            }
-            @media (max-width: 990px){
-                div#error-code{
-                    width:            90%;
-                    margin-left:    auto;
-                    margin-right:    auto;
-                    margin-top:        0;
-                    margin-bottom:    0;
-                }
-                div#error-message{
-                    width:            90%;
-                    margin-left:    auto;
-                    margin-right:    auto;
-                    margin-top:        0;
-                    margin-bottom:    0;
-                }
-            }
-        </style>
         <meta name="robots" content="noindex follow"/>
     </head>
     <body>
-        <?php  include("../header.php");?>
-        <div class="section" id="error-code">
-            <table id="error-code" class="section">
+<?php
+        include("../header.php")
+?>
+        <div id="error_code">
+            <table id="error_code">
                 <tr>
-                    <td id="error-number">
+                    <td id="error_number">
                         404
                     </td>
-                    <td id="error-tag">
-                        <?php echo "$lng[error_error]<br/>$lng[error_code]\n"; ?>
+                    <td id="error_tag">
+                        <?=$lng["error_error"]?>
+                        <br/>
+                        <?=$lng["error_code"]?>
                     </td>
                 <tr>
             </table>
         </div>
         <br/><br/><br/><br/>
-        <div id="error-message" class="section">
-            <h2><?php echo $lng['error_404_title']; ?></h2>
+        <div id="error_message" class="section">
+            <h3 class='section_title'><?=$lng["error_404_title"]?></h3>
             <div class="entry">
-                <?php echo $lng['error_404_description']; ?>
+                <?=$lng["error_404_description"]?>
                 <br/><br/>
-                <?php echo $lng['error_404_solution']; ?>
+                <?=$lng["error_404_solution"]?>
                 <ul>
                     <li>
-                        <a href="javascript: history.go(-1);"><?php echo $lng['error_404_solution_0']; ?></a>
+                        <a href="javascript: history.go(-1);"><?=$lng["error_404_solution_0"]?></a>
                     </li>
                     <li>
-                        <a href="<?php echo "$proto$http_host/";?>"><?php echo $lng['error_404_solution_1']; ?></a>
+                        <a href="<?php echo "$proto$http_host/";?>"><?=$lng["error_404_solution_1"]?></a>
                     </li>
                     <li>
-                        <a target='_blank' href="https://www.youtube.com/results?search_query=cats"><?php echo $lng['error_404_solution_2']; ?></a>
+                        <a target='_blank' href="https://www.youtube.com/results?search_query=cats"><?=$lng["error_404_solution_2"]?></a>
                     </li>
                 </ul>
             </div>
         </div>
-        <?php
-            include("../footer.php");
-            stats(-1, $ad_static, "error", "404");
-        ?>
+<?php
+        include("../footer.php");
+        stats(-1, $ad_static, "error", "404");
+?>
     </body>
 </html>

+ 86 - 0
www/error/500.php

@@ -0,0 +1,86 @@
+<?php
+    $http_host = $_SERVER['HTTP_HOST'];
+    include("../functions.php");
+    $con = startdb();
+    $proto = getProtocol();
+    $server = "$proto$http_host";
+
+    //Language
+    $lang = selectLanguage();
+    include("../lang/lang_$lang.php");
+
+    $cur_section = $lng['section_home'];
+?>
+<!DOCTYPE html>
+<html>
+    <head>
+        <meta content="text/html; charset=windows-1252" http-equiv="content-type"/>
+        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1">
+        <title><?php echo $lng['error_title'] ?> - Gasteizko Margolariak</title>
+        <link rel="shortcut icon" href="<?php echo "$proto$http_host/img/logo/favicon.ico";?>">
+        <!-- CSS files -->
+        <style>
+<?php
+            include("../css/ui.css");
+            include("../css/error.css");
+?>
+        </style>
+        <!-- CSS for mobile version -->
+        <style media="(max-width : 990px)">
+<?php
+            include("../css/m/ui.css");
+            include("../css/m/error.css");
+?>
+        </style>
+        <!-- Script files -->
+        <script type="text/javascript">
+<?php
+            include("../script/ui.js");
+?>
+        </script>
+        <meta name="robots" content="noindex follow"/>
+    </head>
+    <body>
+<?php
+        include("../header.php")
+?>
+        <div id="error_code">
+            <table id="error_code">
+                <tr>
+                    <td id="error_number">
+                        500
+                    </td>
+                    <td id="error_tag">
+                        <?=$lng["error_error"]?>
+                        <br/>
+                        <?=$lng["error_code"]?>
+                    </td>
+                <tr>
+            </table>
+        </div>
+        <br/><br/><br/><br/>
+        <div id="error_message" class="section">
+            <h3 class='section_title'><?=$lng["error_500_title"]?></h3>
+            <div class="entry">
+                <?=$lng["error_500_description"]?>
+                <br/><br/>
+                <?=$lng["error_500_solution"]?>
+                <ul>
+                    <li>
+                        <a href="javascript: history.go(-1);"><?=$lng["error_500_solution_0"]?></a>
+                    </li>
+                    <li>
+                        <a href="<?php echo "$proto$http_host/";?>"><?=$lng["error_500_solution_1"]?></a>
+                    </li>
+                    <li>
+                        <a target='_blank' href="https://www.youtube.com/results?search_query=cats"><?=$lng["error_500_solution_2"]?></a>
+                    </li>
+                </ul>
+            </div>
+        </div>
+<?php
+        include("../footer.php");
+        stats(-1, $ad_static, "error", "500");
+?>
+    </body>
+</html>

+ 90 - 76
www/galeria/album.php

@@ -1,19 +1,19 @@
 <?php
     session_start();
-    $http_host = $_SERVER['HTTP_HOST'];
+    $http_host = $_SERVER["HTTP_HOST"];
     include("../functions.php");
     $con = startdb();
     $proto = getProtocol();
-    #server = "$proto$http_host";
+    $server = "$proto$http_host";
     
     //Language
     $lang = selectLanguage();
-    include("../lang/lang_" . $lang . ".php");
+    include("../lang/lang_$lang.php");
     
-    $cur_section = $lng['section_gallery'];
+    $cur_section = $lng["section_gallery"];
     
     //Get album
-    $perm = mysqli_real_escape_string($con, $_GET['perm']);
+    $perm = mysqli_real_escape_string($con, $_GET["perm"]);
     $q = mysqli_query($con, "SELECT id, permalink, title_$lang AS title, description_$lang AS description, user, open, dtime FROM album WHERE permalink = '$perm';");
     if (mysqli_num_rows($q) == 0){
         header("Location: /galeria/");
@@ -21,109 +21,123 @@
     }
     else{
         $r = mysqli_fetch_array($q);
-        $id = $r['id'];
+        $id = $r["id"];
 ?>
 <!DOCTYPE html>
 <html>
     <head>
-        <meta content="text/html; charset=utf-8" http-equiv="content-type"/>
+        <meta content='text/html; charset=utf-8" http-equiv="content-type'/>
         <meta charset="utf-8"/>
-        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1">
-        <title><?php echo $r['title'];?> - Gasteizko Margolariak</title>
-        <link rel="shortcut icon" href="<?php echo "$proto$http_host/img/logo/favicon.ico";?>">
+        <meta name='viewport' content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1">
+        <title><?=$r["title"]?> - Gasteizko Margolariak</title>
+        <link rel="shortcut icon" href="<?php echo "$server/img/logo/favicon.ico";?>">
         <!-- CSS files -->
         <style>
-            <?php
-                include("../css/ui.css");
-                include("../css/galeria.css");
-            ?>
+<?php
+            include("../css/ui.css");
+            include("../css/galeria.css");
+?>
         </style>
         <!-- CSS for mobile version -->
         <style media="(max-width : 990px)">
-            <?php
-                include("../css/m/ui.css");
-                include("../css/m/galeria.css");
-            ?>
+<?php
+            include("../css/m/ui.css");
+            include("../css/m/galeria.css");
+?>
         </style>
         <!-- Script files -->
         <script type="text/javascript">
-            <?php
-                include("../script/ui.js");
-                include("../script/galeria.js");
-            ?>
+<?php
+            include("../script/ui.js");
+            include("../script/galeria.js");
+?>
         </script>
         <!-- Meta tags -->
-        <link rel="canonical" href="<?php echo "$proto$http_host/galeria/$perm"; ?>"/>
-        <link rel="author" href="<?php echo "$proto$http_host"; ?>"/>
-        <link rel="publisher" href="<?php echo "$proto$http_host"; ?>"/>
-        <meta name="description" content="<?php echo strip_tags($r['description']);?>"/>
-        <meta property="og:title" content="<?php echo $l['title'];?> - Gasteizko Margolariak"/>
-        <meta property="og:url" content="<?php echo "$proto$http_host/galeria/$perm"; ?>"/>
-        <meta property="og:description" content="<?php echo strip_tags($r['description']); ?>"/>
-        <meta property="og:image" content="<?php  echo "$proto$http_host/img/logo/logo.png";?>"/>
-        <meta property="og:site_name" content="Gasteizko Margolariak"/>
-        <meta property="og:type" content="website"/>
-        <meta property="og:locale" content="<?php echo $lang; ?>"/>
-        <meta name="twitter:card" content="summary"/>
-        <meta name="twitter:title" content="<?php echo $l['title'];?> - Gasteizko Margolariak"/>
-        <meta name="twitter:description" content="<?php echo strip_tags($r['description']); ?>"/>
-        <meta name="twitter:image" content="<?php echo "$proto$http_host/img/logo/logo.png";?>"/>
-        <meta name="twitter:url" content="<?php echo "$proto$http_host/galeria/$perm"; ?>"/>
-        <meta name="robots" content="index follow"/>
+        <link rel='canonical' href='<?=$server?>/galeria/<?=$perm?>'/>
+        <link rel='author' href='<?=$server?>'/>
+        <link rel='publisher' href='<?=$server?>'/>
+        <meta name='description' content='<?=strip_tags($r["description"])?>'/>
+        <meta property='og:title' content='<?=$r["title"]?> - Gasteizko Margolariak'/>
+        <meta property='og:url' content='<?=$server?>/galeria/<?=$perm?>'/>
+        <meta property='og:description' content='<?=strip_tags($r["description"])?>'/>
+        <meta property='og:image' content='<?=$server?>/img/logo/logo.png'/>
+        <meta property='og:site_name' content='Gasteizko Margolariak'/>
+        <meta property='og:type' content='website'/>
+        <meta property='og:locale' content='<?=$lang?>'/>
+        <meta name='twitter:card' content='summary'/>
+        <meta name='twitter:title' content='<?=$r["title"]?> - Gasteizko Margolariak'/>
+        <meta name='twitter:description' content='<?=strip_tags($r["description"]) ?>'/>
+        <meta name='twitter:image' content='<?=$server?>/img/logo/logo.png'/>
+        <meta name='twitter:url' content='<?=$server?>/galeria/<?=$perm?>'/>
+        <meta name='robots' content='index follow'/>
     </head>
     <body onLoad="populatePhotos();" onkeypress="keyDown(event);">
-        <?php include("../header.php"); ?>
-        <div id="content">
-            <div class="section" id="album" itemscope itemtype='https://schema.org/ImageGallery'>
+<?php
+        include("../header.php");
+?>
+        <div id='content'>
+            <div class='section' id='album' itemscope itemtype='https://schema.org/ImageGallery'>
                 <div class='hidden' itemprop='author creator' itemscope itemtype='http://schema.org/Organization'>
                     <meta itemprop='legalName' content='Asociaci&oacute;n Cultural Recreativa Gasteizko Margolariak'/>
                     <meta itemprop='name' content='Gasteizko Margolariak'/>
-                    <meta itemprop='logo' content='$proto$http_host/img/logo/logo.png'/>
+                    <meta itemprop='logo' content='$server/img/logo/logo.png'/>
                     <meta itemprop='foundingDate' content='03-02-2013'/>
                     <meta itemprop='telephone' content='+34637140371'/>
                     <meta itemprop='url' content='<?=$server ?>'/>
                 </div>
-
-                <?php
-                    //Header
-                    echo("<h3 class='section_title' itemprop='name' id='album_title'>$r[title]</h3>\n");
-                    if ($r['description'] != ''){
-                        echo "<div class='entry' id='album_header'>\n";
-                        echo $r['description'];
-                        echo "</div>\n";
-                    }
-
-                    //Photos of the album
-                    $q_photo = mysqli_query($con, "SELECT id, file, permalink, title_$lang AS title, description_$lang AS description, photo.dtime AS dtime, uploaded, width, height, size, user, username FROM photo, photo_album WHERE photo_album.photo = id AND album = $r[id] ORDER BY photo.dtime DESC;");
-                    /* TODO AND approved = 1*/
-                    while ($r_photo = mysqli_fetch_array($q_photo)){
-                        echo "<div class='entry photo'>\n<div class='photo_container'>\n";
-                        echo "<img class='pointer photo_img' path='$r_photo[file]' onClick=\"showPhotoByPath('$r_photo[file]');\" src='/img/galeria/miniature/$r_photo[file]' /></div>\n";
-                        echo("<meta itemprop='image' content='$proto$http_host/img/galeria/view/$r_photo[file]'/>\n");
-                        if (strlen($r_photo['title']) > 0 ){
-                            echo "<h3 class='entry_title'><a href='javascript:;' onClick=\"showPhotoByPath('$r_photo[file]');\">$r_photo[title]</a></h4>\n";
+                <h3 class='section_title' itemprop='name' id='album_title'><?=$r["title"]?></h3>
+<?php
+                if ($r["description"] != ''){
+?>
+                    <div class='entry' id='album_header'>
+                        <?=$r["description"]?>
+                    </div>
+<?php
+                }
+                //Photos of the album
+                $q_photo = mysqli_query($con, "SELECT id, file, permalink, title_$lang AS title, description_$lang AS description, photo.dtime AS dtime, uploaded, width, height, size, user, username FROM photo, photo_album WHERE photo_album.photo = id AND album = $r[id] AND approved = 1 ORDER BY photo.dtime DESC;");
+                while ($r_photo = mysqli_fetch_array($q_photo)){
+?>
+                    <div class='entry photo'>
+                        <div class='photo_container'>
+                            <img class='pointer photo_img' path='<?=$r_photo["file"]?>' onClick='showPhotoByPath("<?=$r_photo["file"]?>");' src='<?=$server?>/img/galeria/miniature/<?=$r_photo["file"]?>'/>
+                        </div>
+                        <meta itemprop='image' content='<?=$server?>/img/galeria/view/<?=$r_photo["file"]?>'/>
+<?php
+                        if (strlen($r_photo["title"]) > 0 ){
+?>
+                            <h3 class='entry_title'>
+                                <a onClick='showPhotoByPath("<?=$r_photo["file"]?>");'><?=$r_photo["title"]?></a>
+                            </h3>
+<?php
                         }
-                        if (strlen($r_photo['description']) > 0 ){
-                            echo "<span class='photo_description'>" . cutText($r_photo['description'], 50) . "</span>\n";
+                        if (strlen($r_photo["description"]) > 0 ){
+?>
+                            <span class='photo_description'><?=cutText($r_photo["description"], 50)?></span>
+<?php
                         }
                         //Count comments
                         $q_comments = mysqli_query($con, "SELECT id FROM photo_comment WHERE photo = $r_photo[id];");
-                        echo "<span class='comment_counter'>" . mysqli_num_rows($q_comments) . "<img src='$proto$http_host/img/misc/comment.png' alt=' '/></span>\n"; //TODO: icon
-                        echo "\n</div>\n";
-                    }
-                ?>
+?>
+                        <span class='comment_counter'><?=mysqli_num_rows($q_comments)?><img src='<?=$server?>/img/misc/comment.png' alt=' '/></span>
+                    </div> <!-- entry photo -->
+<?php
+                }
+?>
             </div>
         </div>
-        <div id="screen_cover" onClick="closeViewer();">
+        <div id='screen_cover' onClick="closeViewer();">
         </div>
-        <div id="photo_viewer" class="section">
+        <div id='photo_viewer' class='section'>
         </div>
-        <?php
-            include("../footer.php");
-            $ad = ad($con, $lang, $lng); 
-            stats($ad, $ad_static, "galeria", "$id");
-        ?>
+<?php
+        include("../footer.php");
+        $ad = ad($con, $lang, $lng); 
+        stats($ad, $ad_static, "galeria", "$id");
+?>
     </body>
 </html>
 
-<?php } ?>
+<?php
+    }
+?>

+ 13 - 8
www/galeria/comment.php

@@ -3,6 +3,8 @@
     $http_host = $_SERVER['HTTP_HOST'];
     include("../functions.php");
     $con = startdb('rw');
+    $proto = getProtocol();
+    $server = "$proto$http_host";
     
     //Get post values
     $from =mysqli_real_escape_string($con, $_POST["from"]);
@@ -55,16 +57,19 @@
     }
     
     //Prepare the page to update the comment section
-    //WARNING: If changes are done here, do the same in album.php
     $q_comment = mysqli_query($con, "SELECT id, photo, DATE_FORMAT(dtime, '%Y-%m-%dT%T') AS isodate, dtime, user, username, lang, text FROM photo_comment WHERE photo = $photo AND approved = 1 ORDER BY dtime;");
     error_log("SELECT id, photo, DATE_FORMAT(dtime, '%Y-%m-%dT%T') AS isodate, dtime, user, username, lang, text FROM photo_comment WHERE photo = $photo AND approved = 1 ORDER BY TIME;");
     while ($r_comment = mysqli_fetch_array($q_comment)){
-        echo "<div itemprop='comment' itemscope itemtype='http://schema.org/UserComments' id='comment_$r_comment[id]' class='comment'>\n";
-        //When official users are implementes, see if there is user or username
-        echo "<span itemprop='creator' class='comment_user'>$r_comment[username]</span>\n";
-        echo "<span class='comment_date date'><meta itemprop='commentTime' content='$r_comment[isodate]'/>" . formatDate($r_comment['dtime'], $lang) . "</span>\n";
-        echo "<p itemprop='commentText' class='comment_text'>$r_comment[text]</p>";
-        echo "<hr class='comment_line'/>\n";
-        echo "</div>\n";
+?>
+        <div itemprop='comment' itemscope itemtype='http://schema.org/UserComments' id='comment_<?=$r_comment["id"]?>' class='comment'>
+            <span itemprop='creator' class='comment_user'><?=$r_comment["username"]?></span>
+            <span class='comment_date date'>
+                <meta itemprop='commentTime' content='<?=$r_comment["isodate"]?>'/>
+                <?=formatDate($r_comment["dtime"], $lang)?>
+            </span>
+            <p itemprop='commentText' class='comment_text'><?$r_comment["text"]?></p>
+            <hr class='comment_line'/>
+        </div>
+<?php
     }
 ?>

+ 103 - 82
www/galeria/index.php

@@ -1,122 +1,143 @@
 <?php
     session_start();
-    $http_host = $_SERVER['HTTP_HOST'];
+    $http_host = $_SERVER["HTTP_HOST"];
     include("../functions.php");
     $con = startdb();
     $proto = getProtocol();
+	$server = "$proto$http_host";
     
     //Language
     $lang = selectLanguage();
     include("../lang/lang_" . $lang . ".php");
     
-    $cur_section = $lng['section_gallery'];
+    $cur_section = $lng["section_gallery"];
 ?>
 <!DOCTYPE html>
 <html>
     <head>
-        <meta content="text/html; charset=utf-8" http-equiv="content-type"/>
+        <meta content='text/html; charset=utf-8" http-equiv="content-type'/>
         <meta charset="utf-8"/>
-        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1">
-        <title><?php echo $lng['gallery_title'];?> - Gasteizko Margolariak</title>
-        <link rel="shortcut icon" href="<?php echo "$proto$http_host/img/logo/favicon.ico";?>">
+        <meta name='viewport' content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1">
+        <title><?=$lng["gallery_title"]?> - Gasteizko Margolariak</title>
+        <link rel="shortcut icon" href="<?=$server?>/img/logo/favicon.ico">
         <!-- CSS files -->
         <style>
-            <?php 
-                include("../css/ui.css"); 
-                include("../css/galeria.css");
-            ?>
+<?php 
+            include("../css/ui.css"); 
+            include("../css/galeria.css");
+?>
         </style>
         <!-- CSS for mobile version -->
         <style media="(max-width : 990px)">
-            <?php 
+<?php 
                 include("../css/m/ui.css"); 
                 include("../css/m/galeria.css");
-            ?>
+?>
         </style>
         <!-- Script files -->
         <script type="text/javascript">
-            <?php
+<?php
                 include("../script/ui.js");
-            ?>
+?>
         </script>
         <!-- Meta tags -->
-        <link rel="canonical" href="<?php echo "$proto$http_host"; ?>"/>
-        <link rel="author" href="<?php echo "$proto$http_host"; ?>"/>
-        <link rel="publisher" href="<?php echo "$proto$http_host"; ?>"/>
-        <meta name="description" content="<?php echo $lng['gallery_description'];?>"/>
-        <meta property="og:title" content="<?php echo $lng['gallery_title'];?> - Gasteizko Margolariak"/>
-        <meta property="og:url" content="<?php echo "$proto$http_host"; ?>"/>
-        <meta property="og:description" content="<?php echo $lng['gallery_description'];?>"/>
-        <meta property="og:image" content="<?php echo "$proto$http_host/img/logo/logo.png";?>"/>
-        <meta property="og:site_name" content="<?php echo $lng['gallery_title'];?>"/>
-        <meta property="og:type" content="website"/>
-        <meta property="og:locale" content="<?php echo $lang; ?>"/>
-        <meta name="twitter:card" content="summary"/>
-        <meta name="twitter:title" content="<?php echo $lng['gallery_title'];?> - Gasteizko Margolariak"/>
-        <meta name="twitter:description" content="<?php echo $lng['gallery_description'];?>"/>
-        <meta name="twitter:image" content="<?php echo "$proto$http_host/img/logo/logo.png";?>"/>
-        <meta name="twitter:url" content="<?php echo"$proto$http_host"; ?>"/>
-        <meta name="robots" content="index follow"/>
+        <link rel='canonical' href='<?=$server?>'/>
+        <link rel='author' href='<?=$server?>'/>
+        <link rel='publisher' href='<?=$server?>'/>
+        <meta name='description' content='<?=$lng["gallery_description"]?>'/>
+        <meta property='og:title' content='<?=$lng["gallery_title"]?> - Gasteizko Margolariak'/>
+        <meta property='og:url' content='<?=$server?>'/>
+        <meta property='og:description' content='<?=$lng["gallery_description"]?>'/>
+        <meta property='og:image' content='<?=$server?>/img/logo/logo.png'/>
+        <meta property='og:site_name' content='<?=$lng["gallery_title"]?>'/>
+        <meta property='og:type' content='website'/>
+        <meta property='og:locale' content='<?=$lang?>'/>
+        <meta name='twitter:card' content='summary'/>
+        <meta name='twitter:title' content='<?=$lng["gallery_title"]?> - Gasteizko Margolariak'/>
+        <meta name='twitter:description' content='<?=$lng["gallery_description"]?>'/>
+        <meta name='twitter:image' content='<?=$server?>/img/logo/logo.png'/>
+        <meta name='twitter:url' content='<?=$server?>'/>
+        <meta name='robots' content='index follow'/>
     </head>
     <body>
-        <?php include("../header.php"); ?>
-        <div id="content">
+<?php include("../header.php"); ?>
+        <div id='content'>
             <br/>
-            <div class="section" id="album_list">
-                <?php
-                    echo "<h3 class='section_title'>$lng[gallery_albums]</h3>\n";
+            <div class='section' id='album_list'>
+                    <h3 class='section_title'><?=$lng["gallery_albums"]?></h3>
+<?php
                     //Album with photos with dates
                     $q = mysqli_query($con, "SELECT album.id AS id, album.permalink AS permalink, album, album.title_$lang AS title, album.description_$lang AS description FROM photo_album, photo, album WHERE album.id = photo_album.album AND photo = photo.id GROUP BY album ORDER BY avg(photo.uploaded) DESC;");
                     while ($r = mysqli_fetch_array($q)){
-                        echo("<div class='entry album_list' itemscope itemtype='https://schema.org/ImageGallery'>\n");
-                        echo("<div class='hidden' itemprop='author creator' itemscope itemtype='http://schema.org/Organization'>\n");
-                        echo("<meta itemprop='legalName' content='Asociaci&oacute;n Cultural Recreativa Gasteizko Margolariak'/>\n");
-                        echo("<meta itemprop='name' content='Gasteizko Margolariak'/>\n");
-                        echo("<meta itemprop='logo' content='$proto$http_host/img/logo/logo.png'/>\n");
-                        echo("<meta itemprop='foundingDate' content='03-02-2013'/>\n");
-                        echo("<meta itemprop='telephone' content='+34637140371'/>\n");
-                        echo("<meta itemprop='url' content='$proto$http_host'/>\n");
-                        echo("</div>\n");
-                        echo "<table class='album_thumbnails'>\n";
-                        echo "<tr>\n";
-                        $i = 0;
-                        $q_photo = mysqli_query($con, "SELECT * FROM photo, photo_album WHERE id = photo AND album = $r[album] ORDER BY rand() LIMIT 4;");
-                        while ($r_photo = mysqli_fetch_array($q_photo)){
-                            echo("<td><a itemprop='url' href='$proto$http_host/galeria/$r[permalink]'>");
-                            echo("<meta itemprop='image' content='$proto$http_host/img/galeria/view/$r_photo[file]'/>\n");
-                            echo("<img src='$proto$http_host/img/galeria/miniature/$r_photo[file]'/></a></td>\n");
-                            $i ++;
-                            if ($i == 2)
-                                echo "</tr>\n<tr>";
-                        }
-                        echo "</tr>\n</table>\n";
-                        $q_count = mysqli_query($con, "SELECT album FROM photo_album WHERE album = $r[id];");
-                        if (mysqli_num_rows($q_count) == 1){
-                            echo "<h3 class='entry_title' itemprop='name'><a href='$proto$http_host/galeria/$r[permalink]'>$r[title]</a></h3>\n";
-                            echo("1 $lng[gallery_photos_singular]");
-                        }
-                        else{
-                            echo "<h3 class='entry_title' itemprop='name'><a href='$proto$http_host/galeria/$r[permalink]'>$r[title]</a></h3>\n";
-                            echo(mysqli_num_rows($q_count) . " $lng[gallery_photos_plural]");
-                        }
-                        if (strlen($r['description']) > 0){
-                            echo("<p itemprop='description'>". cutText($r['description'], 100, "$lng[gallery_read_more]", "$proto$http_host/galeria/$r[permalink]") . "</p>\n");
-                        }
-                        echo "</div>\n";
+?>
+                        <div class='entry album_list' itemscope itemtype='https://schema.org/ImageGallery'>
+							<div class='hidden' itemprop='author creator' itemscope itemtype='http://schema.org/Organization'>
+								<meta itemprop='legalName' content='Asociaci&oacute;n Cultural Recreativa Gasteizko Margolariak'/>
+								<meta itemprop='name' content='Gasteizko Margolariak'/>
+								<meta itemprop='logo' content='<?=$server?>/img/logo/logo.png'/>
+								<meta itemprop='foundingDate' content='03-02-2013'/>
+								<meta itemprop='telephone' content='+34637140371'/>
+								<meta itemprop='url' content='<?=$server?>'/>
+							</div>
+							<table class='album_thumbnails'>
+								<tr>
+<?php
+									$i = 0;
+									$q_photo = mysqli_query($con, "SELECT * FROM photo, photo_album WHERE id = photo AND album = $r[album] ORDER BY rand() LIMIT 4;");
+									while ($r_photo = mysqli_fetch_array($q_photo)){
+?>
+										<td>
+											<a itemprop='url' href='<?=$server?>/galeria/<?=$r["permalink"]?>'>
+												<meta itemprop='image' content='<?=$server?>/img/galeria/view/<?=$r_photo["file"]?>'/>
+												<img src='<?=$server?>/img/galeria/miniature/<?=$r_photo["file"]?>'/>
+											</a>
+										</td>
+<?php
+										$i ++;
+										if ($i == 2){
+?>
+											</tr>
+											<tr>
+<?php
+										}
+									}
+?>
+								</tr>
+							</table>
+							<h3 class='entry_title' itemprop='name'>
+								<a href='<?=$server?>/galeria/<?=$r["permalink"]?>'><?=$r["title"]?></a>
+							</h3>
+<?php
+							$q_count = mysqli_query($con, "SELECT album FROM photo_album WHERE album = $r[id];");
+							if (mysqli_num_rows($q_count) == 1){
+?>
+								1 <?=$lng["gallery_photos_singular"]?>
+<?php
+							}
+							else{
+?>
+								<?=mysqli_num_rows($q_count)?> <?=$lng["gallery_photos_plural"]?>
+<?php
+							}
+							if (strlen($r["description"]) > 0){
+?>
+								<p itemprop='description'><?=cutText($r["description"], 100, "$lng[gallery_read_more]", "$server/galeria/$r[permalink]")?></p>
+<?php
+							}
+?>							
+                        </div> <!--.album_list -->
+<?php
                     }
-                    
-                    //Albums with no photos or photos without dates
-                    $q = mysqli_query($con, "SELECT id, title_es FROM album WHERE id NOT IN (SELECT album FROM photo_album, photo WHERE photo = photo.id GROUP BY album);");
-                ?>
-                <div class="entry" id="gallery_entry_contribute">
-                    <?php echo $lng['gallery_header']; ?>
+?>
+                <div class='entry' id='gallery_entry_contribute'>
+                    <?=$lng["gallery_header"]?>
                 </div>
             </div>
         </div>
-        <?php
-            include("../footer.php");
-            $ad = ad($con, $lang, $lng); 
-            stats($ad, $ad_static, "galeria", "");
-        ?>
+<?php
+        include("../footer.php");
+        $ad = ad($con, $lang, $lng); 
+        stats($ad, $ad_static, "galeria", "");
+?>
     </body>
 </html>

+ 46 - 34
www/galeria/load_photo.php

@@ -1,17 +1,16 @@
 <?php
-    $http_host = $_SERVER['HTTP_HOST'];
+    $http_host = $_SERVER["HTTP_HOST"];
     include("../functions.php");
     $con = startdb();
     $proto = getProtocol();
     $server = "$proto$http_host";
 
-    
     //Language
     $lang = selectLanguage();
-    include("../lang/lang_" . $lang . ".php");
+    include("../lang/lang_$lang.php");
     
     //Get photo data
-    $path = mysqli_real_escape_string($con, $_GET['path']);
+    $path = mysqli_real_escape_string($con, $_GET["path"]);
     $q = mysqli_query($con, "SELECT id, file, permalink, title_$lang AS title, description_$lang AS description, uploaded, size, user, username FROM photo WHERE file = '$path' AND approved = 1");
     if (mysqli_num_rows($q) == 0){
         exit(0);
@@ -25,11 +24,11 @@
 ?>
         <h3 class='section_title'>
 <?php
-            if (strlen($r['title']) > 0){
-                echo($r['title']);
+            if (strlen($r["title"]) > 0){
+                echo($r["title"]);
             }
             else{
-                echo($r_album['title']);
+                echo($r_album["title"]);
             }
 ?>
             <div id='viewer_close_container'>
@@ -48,7 +47,7 @@
                                     </td>
                                     <td id='image'>
                                         <div id='photo_viewer_image_container'>
-                                            <img id='photo_viewer_image' src='/img/galeria/preview/<?=$r['file']?>'/>
+                                            <img id='photo_viewer_image' src='/img/galeria/preview/<?=$r["file"]?>'/>
                                         </div>
                                     </td>
                                     <td class='arrow'>
@@ -56,18 +55,19 @@
                                     </td>
                                 </tr>
                             </table>
-                            <!-- Arrows -->
-                            <!--<div id='viewer_controls'>
-                                <img id='viewer_arrow_left' class='viewer_arrow pointer' alt=' ' src='<?=$server?>/img/misc/slid-left.png' onClick='scrollPhoto(-1);'/>
-                                <img id='viewer_arrow_right' class='viewer_arrow pointer' alt=' ' src='<?=$server?>/img/misc/slid-right.png' onClick='scrollPhoto(1);'/>
-                            </div>  #viewer_controls -->
 <?php
-                            if (strlen($r['description']) > 0){
-                                echo("<span id='photo_description'>$r[description]</span>\n");
+                            if (strlen($r["description"]) > 0){
+?>
+                                <span id='photo_description'><?=$r["description"]?></span>
+<?php
                             }
-                            echo("<span id='photo_date'>" . formatDate($r['uploaded'], $lang) . "</span>\n");
-                            if (strlen($r['username']) > 0){
-                                echo("<span id='photo_user'>$lng[gallery_user]$r[username]</span>\n");
+?>
+                            <span id='photo_date'><?=formatDate($r["uploaded"], $lang)?></span>
+<?php
+                            if (strlen($r["username"]) > 0){
+?>
+                                <span id='photo_user'><?=$lng["gallery_user"]?><?=$r["username"]?></span>
+<?php
                             }
 ?>
                         </div> <!-- #photo_data -->
@@ -78,30 +78,41 @@
                             $q_comment = mysqli_query($con, "SELECT * FROM photo_comment WHERE photo = $r[id];");
                             $comment_count = mysqli_num_rows($q_comment);
 ?>
-                            <div class='entry' id='comments_section'/>
+                            <div class='entry' id='comments_section'>
                                 <div id='photo_viewer_comment_counter'>
 <?php
                                     switch ($comment_count){
                                         case 0:
-                                            echo("<h3 class='entry_title'><meta itemprop='interactionCount' content='0'/>$lng[gallery_comment_count_0]</h3>\n");
+?>
+                                            <h3 class='entry_title'>
+                                                <meta itemprop='interactionCount' content='0'/><?=$lng["gallery_comment_count_0"]?>
+                                            </h3>
+<?php
                                             break;
                                         case 1:
-                                            echo("<h3 class='entry_title'><span itemprop='interactionCount'>1</span> $lng[gallery_comment_count_1]</h3>\n");
+?>
+                                            <h3 class='entry_title'>
+                                                <span itemprop='interactionCount'>1 </span><?=$lng["gallery_comment_count_1"]?>
+                                            </h3>
+<?php
                                             break;
                                         default:
-                                            echo("<h3 class='entry_title'><span itemprop='interactionCount'>$comment_count</span> $lng[gallery_comment_count_several]</h3>\n");
+?>
+                                            <h3 class='entry_title'>
+                                                <span itemprop='interactionCount'><?=$comment_count?></span> <?=$lng["gallery_comment_count_several"]?>
+                                            </h3>
+<?php
                                     }
 ?>
                                 </div> <!-- #photo_viewer_comment_counter -->
                                 <div id='comment_list'>
 <?php
-                                    //WARNING: If changes are done here, do the same in comment.php
                                     while ($r_comment = mysqli_fetch_array($q_comment)){
 ?>
-                                        <div itemprop='comment' itemscope itemtype='http://schema.org/UserComments' id='comment_<?=$r_comment['id']?>' class='comment'>
-                                            <span itemprop='creator' class='comment_user'><?=$r_comment['username']?></span>
-                                            <span class='comment_date date'><meta itemprop='commentTime' content='<?=$r_comment['isodate']?>'/><?=formatDate($r_comment['dtime'], $lang)?></span>
-                                            <p itemprop='commentText' class='comment_text'><?=$r_comment['text']?></p>
+                                        <div itemprop='comment' itemscope itemtype='http://schema.org/UserComments' id='comment_<?=$r_comment["id"]?>' class='comment'>
+                                            <span itemprop='creator' class='comment_user'><?=$r_comment["username"]?></span>
+                                            <span class='comment_date date'><meta itemprop='commentTime' content='<?=$r_comment["isodate"]?>'/><?=formatDate($r_comment["dtime"], $lang)?></span>
+                                            <p itemprop='commentText' class='comment_text'><?=$r_comment["text"]?></p>
                                             <hr class='comment_line'/>
                                         </div>
 <?php
@@ -110,21 +121,22 @@
                                 </div> <!-- #comment_list -->
                                 <!-- Comment form -->
                                 <div class='comment' id='comment_new'>
-                                    <form id='comment_form' method='post' action='/' onsubmit='event.preventDefault();postComment(<?=$r['id']?>, "<?=$lang?>");'>
+                                    <form id='comment_form' method='post' action='/' onsubmit='event.preventDefault();postComment(<?=$r["id"]?>, "<?=$lang?>");'>
                                         <textarea id='new_comment_text' name='text' maxlength='1800' onChange='defaultInputBorder(this);' onKeyDown='defaultInputBorder(this);' placeholder='<?=$lng[blog_placeholder_text]?>'></textarea>
                                         <div id='identification_form'>
                                             <br/>
-                                            <input id='new_comment_user' name='user' maxlength='50' type='text' placeholder='<?=$lng['blog_placeholder_name']?>' onChange='defaultInputBorder(this);' onKeyDown='defaultInputBorder(this);'/>
-                                            <input type='submit' value='<?=$lng['blog_send']?>'/>
+                                            <input id='new_comment_user' name='user' maxlength='50' type='text' placeholder='<?=$lng["blog_placeholder_name"]?>' onChange='defaultInputBorder(this);' onKeyDown='defaultInputBorder(this);'/>
+                                            <input type='submit' value='<?=$lng["blog_send"]?>'/>
                                         </div> <!-- #identification_form -->
                                     </form>
                                 </div> <!-- #comment_new -->
                             </div> <!-- #comments_section -->
-                        <!-- </div>  #cell_details -->
+                        </div> <!-- $photo_viewer_details -->
+                    </div> <!-- #cell_comments -->
+                </div> <!-- #viewer_row -->
+            </div> <!-- #viewer_table -->
+        </div> <!-- #viewer_container -->
 <?php
-        echo "</div>\n"; //Row
-        echo "</div></div>\n"; //Container
-        
         stats(-1, 0, "photo", "$r[id]");
     }
 ?>

+ 37 - 41
www/galeria/save.php

@@ -1,16 +1,16 @@
 <?php
-    $http_host = $_SERVER['HTTP_HOST'];
+    $http_host = $_SERVER["HTTP_HOST"];
     include("../functions.php");
-    $con = startdb('rw');
-    
+    $con = startdb("rw");
+
     //Language
     $lang = selectLanguage();
-    include("../lang/lang_" . $lang . ".php");
-    
+    include("../lang/lang_$lang.php");
+
     //Get post data
     $username = mysqli_real_escape_string($con, $_POST["username"]);
     $album = mysqli_real_escape_string($con, $_POST["album"]);
-        
+
     //Get the data form the photos
     $total = 0;
     $files = [];
@@ -21,33 +21,30 @@
         $img = $_POST["file_$total"];
         error_log("FILE: " . $img);
         //The next line wont work
-        if (strpos($img, 'data:image/jpeg;base64,') < 10){
-            $ext = 'jpg';
-            $img = str_replace('data:image/jpeg;base64,', '', $img);
+        if (strpos($img, "data:image/jpeg;base64,") < 10){
+            $ext = "jpg";
+            $img = str_replace("data:image/jpeg;base64,", "", $img);
         }
-        else if (strpos($img, 'data:image/png;base64,') < 10){
-            $ext = 'png';
-            $img = str_replace('data:image/png;base64,', '', $img);
+        else if (strpos($img, "data:image/png;base64,") < 10){
+            $ext = "png";
+            $img = str_replace("data:image/png;base64,", "", $img);
         }
-        $img = str_replace(' ', '+', $img);
-        //echo "IMG idx " . $total . ": " . $img . "<br/><br/><br/>br/><br/>";
+        $img = str_replace(" ", "+", $img);
         $files[$total] = base64_decode($img);
-        
-        //$file = 'image.png';
-        //$success = file_put_contents($file, $data);
+
         $titles[$total] = mysqli_real_escape_string($con, $_POST["title_$total"]);
         $descriptions[$total] = mysqli_real_escape_string($con, $_POST["description_$total"]);
         //Save image to file
-        $file = 'image.' . $ext;
+        $file = "image." . $ext;
         $success = file_put_contents($file, $files[$total]);
         $total ++;
     }
-    
+
     //Get next photo id
     $q_id = mysqli_query($con, "SELECT max(id) AS maxid FROM photo;");
     $r_id = mysqli_fetch_array($q_id);
     $id = $r_id["maxid"] + 1;
-    
+
     //Store information
     for ($i = 0; $i < $total; $i++){
         //Get filename
@@ -63,27 +60,27 @@
         error_log("SUCCESS" . $success);
         //Convert to jpg and create miniature and preview_image
         //$im = new imagick("../img/galeria/$fname.png");
-        //$handle = fopen("../img/galeria/$fname.png", 'rb');
+        //$handle = fopen("../img/galeria/$fname.png", "rb");
         $im = new Imagick("../img/galeria/$fname.$ext");
-        //$im->readImageFile($handle);
-        $im->setImageBackgroundColor('white');
-        $im = $im->flattenImages();
-        $im->setImageFormat('jpg');
-        $im->writeImage("../img/galeria/$fname.jpg");
-        $im->resizeImage(800, 0, Imagick::FILTER_POINT, true);
-        $im->resizeImage(0, 800, Imagick::FILTER_POINT, true);
-        $im->writeImage("../img/galeria/view/$fname.jpg");
-        $im->resizeImage(600, 0, Imagick::FILTER_POINT, true);
-        $im->resizeImage(0, 600, Imagick::FILTER_POINT, true);
-        $im->writeImage("../img/galeria/preview/$fname.jpg");
-        $im->resizeImage(400, 0, Imagick::FILTER_POINT, true);
-        $im->resizeImage(0, 400, Imagick::FILTER_POINT, true);
-        $im->writeImage("../img/galeria/miniature/$fname.jpg");
-        $im->resizeImage(200, 0, Imagick::FILTER_POINT, true);
-        $im->resizeImage(0, 200, Imagick::FILTER_POINT, true);
-        $im->writeImage("../img/galeria/thumb/$fname.jpg");
-        $im->clear();
-        $im->destroy();
+        //$im -> readImageFile($handle);
+        $im -> setImageBackgroundColor("white");
+        $im = $im -> flattenImages();
+        $im -> setImageFormat("jpg");
+        $im -> writeImage("../img/galeria/$fname.jpg");
+        $im -> resizeImage(800, 0, Imagick::FILTER_POINT, true);
+        $im -> resizeImage(0, 800, Imagick::FILTER_POINT, true);
+        $im -> writeImage("../img/galeria/view/$fname.jpg");
+        $im -> resizeImage(600, 0, Imagick::FILTER_POINT, true);
+        $im -> resizeImage(0, 600, Imagick::FILTER_POINT, true);
+        $im -> writeImage("../img/galeria/preview/$fname.jpg");
+        $im -> resizeImage(400, 0, Imagick::FILTER_POINT, true);
+        $im -> resizeImage(0, 400, Imagick::FILTER_POINT, true);
+        $im -> writeImage("../img/galeria/miniature/$fname.jpg");
+        $im -> resizeImage(200, 0, Imagick::FILTER_POINT, true);
+        $im -> resizeImage(0, 200, Imagick::FILTER_POINT, true);
+        $im -> writeImage("../img/galeria/thumb/$fname.jpg");
+        $im -> clear();
+        $im -> destroy();
         //Delete initial png
         //unlink("../img/galeria/$fname.png");
         //Get width, height ans size
@@ -97,5 +94,4 @@
         version();
         $id ++;
     }
-    
 ?>

+ 70 - 60
www/galeria/upload.php

@@ -1,115 +1,125 @@
 <?php
     session_start();
-    $http_host = $_SERVER['HTTP_HOST'];
+    $http_host = $_SERVER["HTTP_HOST"];
     include("../functions.php");
     $con = startdb();
     $proto = getProtocol();
-    
+    $server = "$proto$http_host";
+
     //Language
     $lang = selectLanguage();
-    include("../lang/lang_" . $lang . ".php");
+    include("../lang/lang_$lang.php");
     
-    $cur_section = $lng['section_gallery'];
+    $cur_section = $lng["section_gallery"];
     
-    //TODO: Set metadata
 ?>
 <!DOCTYPE html>
 <html>
     <head>
-        <meta content="text/html; charset=utf-8" http-equiv="content-type"/>
+        <meta content='text/html; charset=utf-8" http-equiv="content-type'/>
         <meta charset="utf-8"/>
-        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1">
-        <title><?php echo $lng['gallery_title'];?> - Gasteizko Margolariak</title>
-        <link rel="shortcut icon" href="<?php echo "$proto$http_host/img/logo/favicon.ico";?>">
+        <meta name='viewport' content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1">
+        <title><?=$lng["gallery_title"]?> - Gasteizko Margolariak</title>
+        <link rel="shortcut icon" href="<?=$server?>/img/logo/favicon.ico";?>">
         <!-- CSS files -->
         <style>
-            <?php 
-                include("../css/ui.css"); 
-                include("../css/galeria.css");
-            ?>
+<?php 
+            include("../css/ui.css"); 
+            include("../css/galeria.css");
+?>
         </style>
         <!-- CSS for mobile version -->
         <style media="(max-width : 990px)">
-            <?php 
-                include("../css/m/ui.css"); 
-                include("../css/m/galeria.css");
-            ?>
+<?php 
+            include("../css/m/ui.css"); 
+            include("../css/m/galeria.css");
+?>
         </style>
         <!-- Script files -->
         <script type="text/javascript">
-            <?php
-                include("../script/ui.js");
-                include("../script/galeria.js");
-            ?>
+<?php
+            include("../script/ui.js");
+            include("../script/galeria.js");
+?>
         </script>
         <!-- Meta tags -->
-        <link rel="canonical" href="<?php echo "$proto$http_host"; ?>"/>
-        <link rel="author" href="<?php echo "$proto$http_host"; ?>"/>
-        <link rel="publisher" href="<?php echo "$proto$http_host"; ?>"/>
-        <meta name="description" content="<?php echo $lng['gallery_description'];?>"/>
-        <meta property="og:title" content="<?php echo $lng['gallery_title'];?> - Gasteizko Margolariak"/>
-        <meta property="og:url" content="<?php echo "$proto$http_host"; ?>"/>
-        <meta property="og:description" content="<?php echo $lng['gallery_description'];?>"/>
-        <meta property="og:image" content="<?php echo "$proto$http_host/img/logo/logo.png";?>"/>
-        <meta property="og:site_name" content="<?php echo $lng['gallery_title'];?>"/>
-        <meta property="og:type" content="website"/>
-        <meta property="og:locale" content="<?php echo $lang; ?>"/>
-        <meta name="twitter:card" content="summary"/>
-        <meta name="twitter:title" content="<?php echo $lng['gallery_title'];?> - Gasteizko Margolariak"/>
-        <meta name="twitter:description" content="<?php echo $lng['gallery_description'];?>"/>
-        <meta name="twitter:image" content="<?php echo "$proto$http_host/img/logo/logo.png";?>"/>
-        <meta name="twitter:url" content="<?php echo"$proto$http_host"; ?>"/>
-        <meta name="robots" content="noindex nofollow"/>
+        <link rel='canonical' href='<?=$server?>'/>
+        <link rel='author' href='<?=$server?>'/>
+        <link rel='publisher' href='<?=$server?>'/>
+        <meta name='description' content='<?=$lng["gallery_description"]?>'/>
+        <meta property='og:title' content='<?=$lng["gallery_title"]?> - Gasteizko Margolariak'/>
+        <meta property='og:url' content='<?=$server?>'/>
+        <meta property='og:description' content='<?=$lng["gallery_description"]?>'/>
+        <meta property='og:image' content='<?=$server?>/img/logo/logo.png'/>
+        <meta property='og:site_name' content='<?=$lng["gallery_title"]?>'/>
+        <meta property='og:type' content='website'/>
+        <meta property='og:locale' content='<?php echo $lang; ?>'/>
+        <meta name='twitter:card' content='summary'/>
+        <meta name='twitter:title' content='<?=$lng["gallery_title"]?> - Gasteizko Margolariak'/>
+        <meta name='twitter:description' content='<?=$lng["gallery_description"]?>'/>
+        <meta name='twitter:image' content='<?=$server?>/img/logo/logo.png'/>
+        <meta name='twitter:url' content='<?=$server?>'/>
+        <meta name='robots' content='noindex nofollow'/>
     </head>
     <body>
-        <?php include("../header.php"); ?>
-        <div id="content">
-            <form onSubmit="event.preventDefault(); submitPhotos();">
-                <div class="section">
-                    <h3 class="section_title"><?php echo($lng['gallery_upload_submit']); ?></h3>
-                    <div class="entry">
-                        <?php echo $lng["gallery_upload_header"]; ?>
+<?php
+        include("../header.php");
+?>
+        <div id='content'>
+            <form onSubmit='event.preventDefault(); submitPhotos();'>
+                <div class='section'>
+                    <h3 class='section_title'><?=$lng["gallery_upload_submit"]?></h3>
+                    <div class='entry'>
+                        <?=$lng["gallery_upload_header"]?>
                     </div>
                 
-                    <div id="file_box" ondragover="event.preventDefault();" ondrop="dropFile(event, '<?php echo $lng['gallery_upload_placeholder_title'] ?>', '<?php echo $lng['gallery_upload_placeholder_description'] ?>');">
+                    <div id='file_box' ondragover='event.preventDefault();' ondrop='dropFile(event, "<?=$lng["gallery_upload_placeholder_title"]?>", "<?=$lng["gallery_upload_placeholder_description"]?>");'>
                         <br/><br/><br/>
-                        <span id='drag'><?php echo $lng["gallery_upload_drag"]; ?></span>
-                        <input class='hidden' multiple accept='image/x-png, image/gif, image/jpeg' type='file' id='file_selector' onChange="selectFile(event, this, '<?php echo $lng['gallery_upload_placeholder_title'] ?>', '<?php echo $lng['gallery_upload_placeholder_description'] ?>');"/>
+                        <span id='drag'><?=$lng["gallery_upload_drag"]?></span>
+                        <input class='hidden' multiple accept='image/x-png, image/gif, image/jpeg' type='file' id='file_selector' onChange='selectFile(event, this, "<?=$lng["gallery_upload_placeholder_title"]?>", "<?=$lng["gallery_upload_placeholder_description"]?>");'/>
                         <br/><br/>
-                        <span id='select' class='desktop'><a href='javascript:launchFileSelector();'><?php echo $lng["gallery_upload_select"];?></a></span>
+                        <span id='select' class='desktop'>
+                            <a href='javascript:launchFileSelector();'><?=$lng["gallery_upload_select"]?></a>
+                        </span>
                         <br/><br/><br/>
                     </div>
                     
-                    <div  id="photo_upload_preview">
-                        <div id="file_list">
+                    <div  id='photo_upload_preview'>
+                        <div id='file_list'>
                         </div>
                         <table>
                             <tr>
                                 <td class='entry'>
-                                    <?php echo $lng["gallery_upload_tooltip_album"]; ?>
+                                    <?=$lng["gallery_upload_tooltip_album"]?>
                                     <br/><br/>
-                                    <select id="album" type="select">
-                                        <option value="-1" selected="selected"><?php echo $lng['gallery_upload_select_album'] ?></option>
-                                        <?php
+                                    <select id='album' type='select'>
+                                        <option value="-1" selected='selected'>
+                                            <?=$lng["gallery_upload_select_album"]?>
+                                        </option>
+<?php
                                             $q_album = mysqli_query($con, "SELECT id, title_$lang AS title FROM album ORDER BY title;");
                                             while ($r_album = mysqli_fetch_array($q_album)){
-                                                echo "<option value='$r_album[id]'>$r_album[title]</option>\n";
+?>                                                
+                                                <option value='<?=$r_album["id"]?>'><?=$r_album[title]?></option>
+<?php
                                             }
-                                        ?>
+?>
                                     </select>
                                 </td>
                                 <td class='entry'>
-                                    <?php echo $lng["gallery_upload_tooltip_name"]; ?>
+                                    <?=$lng["gallery_upload_tooltip_name"]?>
                                     <br/><br/>
                                     <input type='text' id='username'/>
                                 </td>
                             </tr>
                         </table>
-                        <input type="submit" id="photo_submit" value="<?php echo $lng["gallery_upload_submit"];?>">
+                        <input type="submit" id='photo_submit' value="<?=$lng["gallery_upload_submit"]?>">
                     </div>
                 </div>
             </form>
         </div>
-        <?php include("../footer.php"); ad($con, $lang, $lng); ?>
+<?php
+        include("../footer.php");
+?>
     </body>
 </html>

+ 180 - 152
www/index.php

@@ -1,6 +1,6 @@
 <?php
     session_start();
-    $http_host = $_SERVER['HTTP_HOST'];
+    $http_host = $_SERVER["HTTP_HOST"];
     include("functions.php");
     $proto = getProtocol();
     $con = startdb();
@@ -10,7 +10,7 @@
     $lang = selectLanguage();
     include("lang/lang_" . $lang . ".php");
 
-    $cur_section = $lng['section_home'];
+    $cur_section = $lng["section_home"];
 ?>
 <!DOCTYPE html>
 <html>
@@ -18,7 +18,7 @@
         <meta content="text/html; charset=utf-8" http-equiv="content-type"/>
         <meta charset="utf-8"/>
         <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1"/>
-        <title><?=$lng['index_title']?></title>
+        <title><?=$lng["index_title"]?></title>
         <link rel="shortcut icon" href="<?=$server?>/img/logo/favicon.ico"/>
         <!-- CSS files -->
         <style>
@@ -42,23 +42,25 @@
         <link rel="canonical" href="<?=$server?>"/>
         <link rel="author" href="<?=$server?>"/>
         <link rel="publisher" href="<?=$server?>"/>
-        <meta name="description" content="<?php echo $lng['index_us_content'];?>"/>
-        <meta property="og:title" content="<?php echo $lng['index_title'];?>"/>
+        <meta name="description" content="<?php echo $lng["index_us_content"];?>"/>
+        <meta property="og:title" content="<?php echo $lng["index_title"];?>"/>
         <meta property="og:url" content="<?=$server?>"/>
-        <meta property="og:description" content="<?=$lng['index_us_content']?>"/>
+        <meta property="og:description" content="<?=$lng["index_us_content"]?>"/>
         <meta property="og:image" content="<?=$server?>/img/logo/logo.png"/>
-        <meta property="og:site_name" content="<?=$lng['index_title']?>"/>
+        <meta property="og:site_name" content="<?=$lng["index_title"]?>"/>
         <meta property="og:type" content="website"/>
         <meta property="og:locale" content="<?php echo $lang; ?>"/>
         <meta name="twitter:card" content="summary"/>
-        <meta name="twitter:title" content="<?=$lng['index_title']?>"/>
-        <meta name="twitter:description" content="<?=$lng['index_us_content']?>"/>
+        <meta name="twitter:title" content="<?=$lng["index_title"]?>"/>
+        <meta name="twitter:description" content="<?=$lng["index_us_content"]?>"/>
         <meta name="twitter:image" content="<?=$server?>/img/logo/logo.png"/>
         <meta name="twitter:url" content="<?=$server?>"/>
         <meta name="robots" content="index follow"/>
     </head>
     <body>
-        <?php include("header.php"); ?>
+<?php
+        include("header.php");
+?>
         <div id="content">
 
 <?php
@@ -68,9 +70,9 @@
                     $r_location = mysqli_fetch_array($q_location);
 ?>
                     <div class='section' id='location'>
-                    <h3 class='section_title'><?=$lng[index_festivals_location]?></h3>
+                    <h3 class='section_title'><?=$lng["index_festivals_location"]?></h3>
                         <div class='entry' id='map'>
-                            <iframe src='https://www.google.com/maps/embed/v1/place?key=AIzaSyCZHP7t2on_G3eyyoCTfhGAlDx1mJnX7iI&q=<?=$r_location[lat]?>,<?=$r_location[lon]?>' allowfullscreen></iframe>
+                            <iframe src='https://www.google.com/maps/embed/v1/place?key=AIzaSyCZHP7t2on_G3eyyoCTfhGAlDx1mJnX7iI&q=<?=$r_location["lat"]?>,<?=$r_location["lon"]?>' allowfullscreen></iframe>
                         </div>
                     </div>
 <?php
@@ -80,7 +82,7 @@
                 $year = date("Y");
                 $q_settings = mysqli_query($con, "SELECT value FROM settings WHERE name = 'festivals';");
                 $r_settings = mysqli_fetch_array($q_settings);
-                $festivals = $r_settings['value'];
+                $festivals = $r_settings["value"];
                 if ($festivals == 1){
 ?>
                     <div class='section' id='festivals' itemscope itemtype='http://schema.org/Event'>
@@ -93,8 +95,8 @@
                         </div> <!-- .hidden -->
 
                         <meta itemprop='inLanguage' content='<?=$lang?>'/>
-                        <meta itemprop='name' content='<?=$lng['index_festivals_header']?> <?=$year?>'/>
-                        <meta itemprop='description' content='<?=$lng['index_festivals_header']?> <?=$year?>'/>
+                        <meta itemprop='name' content='<?=$lng["index_festivals_header"]?> <?=$year?>'/>
+                        <meta itemprop='description' content='<?=$lng["index_festivals_header"]?> <?=$year?>'/>
                         <meta itemprop='startDate' content='<?=$year?>-08-04'/>
                         <meta itemprop='endDate' content='<?=$year?>-08-09'/>
                         <meta itemprop='url' content='<?=$server?>/lablanca/'/>
@@ -102,7 +104,7 @@
                             <meta itemprop='name' content='Vitoria-Gasteiz'/>
                             <meta itemprop='address' content='Vitoria-Gasteiz'/>
                         </span>
-                        <h3 class='section_title'><?=$lng['index_festivals_header']?> <?=$year?></h3>
+                        <h3 class='section_title'><?=$lng["index_festivals_header"]?> <?=$year?></h3>
                         <div class='entry' id='festivals_summary'>
 <?php
                             // Offers (for metadata)
@@ -110,9 +112,9 @@
                             while($r_offer = mysqli_fetch_array($q_offer)){
 ?>
                                 <span class='hidden' itemprop='offers' itemscope itemtype='http://schema.org/Offer'>
-                                    <meta itemprop='name' content='<?=$r_offer['name']?>'/>
-                                    <meta itemprop='description' content='<?=$r_offer['description']?>'/>
-                                    <meta itemprop='price' content='<?=$r_offer['price']?>'/>
+                                    <meta itemprop='name' content='<?=$r_offer["name"]?>'/>
+                                    <meta itemprop='description' content='<?=$r_offer["description"]?>'/>
+                                    <meta itemprop='price' content='<?=$r_offer["price"]?>'/>
                                     <meta itemprop='priceCurrency' content='EUR'/>
                                     <meta itemprop='url' content='<?=$server?>/lablanca/'/>
                                     <meta itemprop='availability' content='Sold Out'/>
@@ -124,25 +126,25 @@
                             $q_festivals = mysqli_query($con, "SELECT text_$lang AS text, summary_$lang AS summary, img FROM festival WHERE year = $year;");
                             if(mysqli_num_rows($q_festivals)){
                                 $r_festivals = mysqli_fetch_array($q_festivals);
-                                if ($r_festivals['img'] != ''){
+                                if ($r_festivals["img"] != ''){
 ?>
-                                    <meta itemprop='image' content='<?=$server?>/img/fiestas/view/<?=$r_festivals['img']?>'/>
-                                    <img id='festivals_image' alt='<?=$lng['index_festivals_header'] . ' ' . $year?>' src='<?=$server?>/img/fiestas/preview/<?=$r_festivals['img']?>'/>
+                                    <meta itemprop='image' content='<?=$server?>/img/fiestas/view/<?=$r_festivals["img"]?>'/>
+                                    <img id='festivals_image' alt='<?=$lng["index_festivals_header"]?> <?=$year?>' src='<?=$server?>/img/fiestas/preview/<?=$r_festivals["img"]?>'/>
 <?php
                                 }
-                                if ($r_festivals['summary'] != ''){
+                                if ($r_festivals["summary"] != ''){
 ?>
-                                    <br/><span class='entry_title' id='festivals_summary_text'><?=$r_festivals['summary']?></span>
+                                    <br/><span class='entry_title' id='festivals_summary_text'><?=$r_festivals["summary"]?></span>
                                     <br/><br/><br/>
-                                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href='<?=$server?>/lablanca/'><?=$lng['index_festivals_link']?></a>
+                                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href='<?=$server?>/lablanca/'><?=$lng["index_festivals_link"]?></a>
 <?php
                                 }
                                 else{
 ?>
                                     <span id='festivals_summary_text'>
                                         <br/>
-                                        <span class='mobile'><?=cutText($r_festivals['text'], 300, "$lng[index_read_more]", "$server/lablanca/")?></span>
-                                        <span class='desktop'><?=cutText($r_festivals['text'], 500, "$lng[index_read_more]", "$server/lablanca/")?></span>
+                                        <span class='mobile'><?=cutText($r_festivals["text"], 300, "$lng[index_read_more]", "$server/lablanca/")?></span>
+                                        <span class='desktop'><?=cutText($r_festivals["text"], 500, "$lng[index_read_more]", "$server/lablanca/")?></span>
                                     </span>
 <?php
                                 }
@@ -159,7 +161,7 @@
                                     if (mysqli_num_rows($q_sch_curr) > 0 || mysqli_num_rows($q_sch_next) > 0){
 ?>
                                         <div class='entry festival_schedule' id='festivals_gm'>
-                                            <h3 class='entry_title'><?=$lng['index_festivals_gm_schedule']?></h3>
+                                            <h3 class='entry_title'><?=$lng["index_festivals_gm_schedule"]?></h3>
 <?php
                                         if (mysqli_num_rows($q_sch_curr) > 0){
                                             $r_sch_curr = mysqli_fetch_array($q_sch_curr);
@@ -167,47 +169,47 @@
                                             <div class='festival_event' itemprop='subEvent' itemscope itemtype='http://schema.org/Event'>
                                                 <h4><?=$lng[index_festivals_schedule_now]?></h4>
                                                 <meta itemprop='inLanguage' content='<?=$lang?>'/>
-                                                <meta itemprop='name' content='<?=$r_sch_curr['title']?>'/>
-                                                <meta itemprop='startDate' content='<?=$r_sch_curr['isostart']?>'/>
+                                                <meta itemprop='name' content='<?=$r_sch_curr["title"]?>'/>
+                                                <meta itemprop='startDate' content='<?=$r_sch_curr["isostart"]?>'/>
                                                 <span class='hidden' itemprop='location' itemscope itemtype='http://schema.org/Place'>
                                                     <meta itemprop='address' content='Vitoria-Gasteiz'/>
                                                 </span>
 <?php
-                                                if (strlen($r_sch_curr['isoend']) > 0){
+                                                if (strlen($r_sch_curr["isoend"]) > 0){
 ?>
-                                                    <meta itemprop='endDate' content='<?=$r_sch_curr['isoend']?>'/>
+                                                    <meta itemprop='endDate' content='<?=$r_sch_curr["isoend"]?>'/>
 <?php
                                                 }
 ?>
                                                 <div class='schedule_content'>
-                                                    <span class='title'><?=$r_sch_curr['title']?></span>
+                                                    <span class='title'><?=$r_sch_curr["title"]?></span>
 <?php
                                                     if (strlen($r_sch_curr["description"]) > 0 && $r_sch_curr["description"] != $r_sch_curr["title"]){
 ?>
-                                                        <br/><p class='description'><?=$r_sch_curr['description']?></p>
-                                                        <meta itemprop='description' content='<?=$r_sch_curr['description']?>'/>
+                                                        <br/><p class='description'><?=$r_sch_curr["description"]?></p>
+                                                        <meta itemprop='description' content='<?=$r_sch_curr["description"]?>'/>
 <?php
                                                     }
 ?>
                                                     <table class='location'>
                                                         <tr>
                                                             <td>
-                                                                <a target='_blank' href='http://maps.google.com/maps?q=<?=$r_sch_curr[lat]?>,<?=$r_sch_curr[lon]?>+Gasteizko+Margolariak)&z=14&ll=<?=$r_sch_curr[lat]?>,<?=$r_sch_curr[lon]?>'>
-                                                                    <img alt='<?=$r_sch_curr['title']?>'' src='<?server?>/img/misc/pinpoint.png'/>
+                                                                <a target='_blank' href='http://maps.google.com/maps?q=<?=$r_sch_curr["lat"]?>,<?=$r_sch_curr["lon"]?>+Gasteizko+Margolariak)&z=14&ll=<?=$r_sch_curr["lat"]?>,<?=$r_sch_curr["lon"]?>'>
+                                                                    <img alt='<?=$r_sch_curr["title"]?>'' src='<?=$server?>/img/misc/pinpoint.png'/>
                                                                 </a>
                                                             </td>
                                                             <td>
 <?php
                                                                 //If name and address are the same, show only name
-                                                                if ($r_sch_curr['place'] == $r_sch_curr['address']){
+                                                                if ($r_sch_curr["place"] == $r_sch_curr["address"]){
 ?>
-                                                                    <?=$r_sch_curr['place']?>
+                                                                    <?=$r_sch_curr["place"]?>
 <?php
                                                                 }
                                                                 else{
 ?>
-                                                                    <?=$r_sch_curr['place']?><br/>
-                                                                    <span class='address'><?=$r_sch_curr['address']?></span>
+                                                                    <?=$r_sch_curr["place"]?><br/>
+                                                                    <span class='address'><?=$r_sch_curr["address"]?></span>
 <?php
                                                                 }
 ?>
@@ -222,45 +224,49 @@
                                             $r_sch_next = mysqli_fetch_array($q_sch_next);
 ?>
                                             <div class='festival_event' itemprop='subEvent' itemscope itemtype='http://schema.org/Event'>
-                                                <h4><?=$lng['index_festivals_schedule_next']?></h4>
+                                                <h4><?=$lng["index_festivals_schedule_next"]?></h4>
                                                 <meta itemprop='inLanguage' content='<?=$lang?>'/>
-                                                <meta itemprop='name' content='<?=$r_sch_next['title']?>'/>
-                                                <meta itemprop='startDate' content='<?=$r_sch_next['isostart']?>'/>
+                                                <meta itemprop='name' content='<?=$r_sch_next["title"]?>'/>
+                                                <meta itemprop='startDate' content='<?=$r_sch_next["isostart"]?>'/>
                                                 <span class='hidden' itemprop='location' itemscope itemtype='http://schema.org/Place'>
                                                     <meta itemprop='address' itemprop='name'>Vitoria-Gasteiz</meta>
                                                 </span>
 <?php
-                                                if (strlen($r_sch_curr['isoend']) > 0){
+                                                if (strlen($r_sch_curr["isoend"]) > 0){
 ?>
-                                                    <meta itemprop='endDate' content='<?=$r_sch_next['isoend']?>'/>
+                                                    <meta itemprop='endDate' content='<?=$r_sch_next["isoend"]?>'/>
 <?php
                                                 }
 ?>
                                                 <div class='schedule_content'>
-                                                    <span class='title'><?=$r_sch_next['title']?> - <?=$r_sch_next['st']?></span>
+                                                    <span class='title'><?=$r_sch_next["title"]?> - <?=$r_sch_next["st"]?></span>
 <?php
                                                     if (strlen($r_sch_next["description"]) > 0 && $r_sch_next["description"] != $r_sch_next["title"]){
 ?>
-                                                        <br/><p class='description'><?=$r_sch_next['description']?></p>
-                                                        <meta itemprclass='entry'op='description' content='<?=$r_sch_next['description']?>'/>
+                                                        <br/><p class='description'><?=$r_sch_next["description"]?></p>
+                                                        <meta itemprclass='entry' itemprop='description' content='<?=$r_sch_next["description"]?>'/>
 <?php
                                                     }
 ?>
                                                     <table class='location'>
                                                         <tr>
                                                             <td>
-                                                                <a target='_blank' href='http://maps.google.com/maps?q=<?=$r_sch_next[lat]?>,<?=$r_sch_next[lon]?>+(My+Point)&z=14&ll=<?=$r_sch_next[lat]?>,<?=$r_sch_next[lon]?>'>
+                                                                <a target='_blank' href='http://maps.google.com/maps?q=<?=$r_sch_next["lat"]?>,<?=$r_sch_next["lon"]?>+(Gasteizko+Margolariak)&z=14&ll=<?=$r_sch_next["lat"]?>,<?=$r_sch_next["lon"]?>'>
                                                                     <img alt=' ' src='<?=server?>/img/misc/pinpoint.png'/>
                                                                 </a>
                                                             </td>
                                                             <td>
 <?php
                                                                 //If name and address are the same, show only name
-                                                                if ($r_sch_next['place'] == $r_sch_next['address']){
-                                                                    echo("$r_sch_next[place]\n");
+                                                                if ($r_sch_next["place"] == $r_sch_next["address"]){
+?>
+                                                                    <?$r_sch_next["place"]?>
+<?php
                                                                 }
                                                                 else{
-                                                                    echo("$r_sch_next[place] </br><span class='address'> $r_sch_next[address]</span>\n");
+?>
+                                                                    <?=$r_sch_next["place"]?> </br><span class='address'> <?=$r_sch_next["address"]?></span>
+<?php
                                                                 }
 ?>
                                                             </td>
@@ -288,41 +294,52 @@
                                             $r_sch_curr = mysqli_fetch_array($q_sch_curr);
 ?>
                                             <div class='festival_event' itemprop='subEvent' itemscope itemtype='http://schema.org/Event'>
-                                                <h4><?=$lng['index_festivals_schedule_now']?></h4>
+                                                <h4><?=$lng["index_festivals_schedule_now"]?></h4>
                                                 <meta itemprop='inLanguage' content='<?=$lang?>'/>
-                                                <meta itemprop='name' content='<?=$r_sch_curr['title']?>'/>
-                                                <meta itemprop='startDate' content='<?=$r_sch_curr['isostart']?>'/>
+                                                <meta itemprop='name' content='<?=$r_sch_curr["title"]?>'/>
+                                                <meta itemprop='startDate' content='<?=$r_sch_curr["isostart"]?>'/>
                                                 <span class='hidden' itemprop='location' itemscope itemtype='http://schema.org/Place'>
                                                     <meta itemprop='address' itemprop='name'>Vitoria-Gasteiz</meta>
                                                 </span>
 <?php
-                                                if (strlen($r_sch_curr['isoend']) > 0){
-                                                    echo("<meta itemprop='endDate' content='$r_sch_curr[isoend]'/>\n");
+                                                if (strlen($r_sch_curr["isoend"]) > 0){
+?>
+                                                    <meta itemprop='endDate' content='<?=$r_sch_curr["isoend"]?>'/>
+<?php
                                                 }
 ?>
                                                 <div class='schedule_content'>
-                                                    <span class='title'><?=$r_sch_curr['title']?></span>
+                                                    <span class='title'><?=$r_sch_curr["title"]?></span>
 <?php
                                                     if (strlen($r_sch_curr["description"]) > 0 && $r_sch_curr["description"] != $r_sch_curr["title"]){
-                                                        echo("<br/><p class='description'>$r_sch_curr[description]</p>\n");
-                                                        echo("<meta itemprop='description' content='$r_sch_curr[description]'/>\n");
+?>
+                                                        <br/>
+                                                        <p class='description'><?=$r_sch_curr["description"]?></p>
+                                                        <meta itemprop='description' content='<?=$r_sch_curr["description"]?>'/>
+<?php
                                                     }
 ?>
                                                     <table class='location'>
                                                         <tr>
                                                             <td>
-                                                                <a target='_blank' href='http://maps.google.com/maps?q=<?=$r_sch_curr[lat]?>,<?=$r_sch_curr[lon]?>+(My+Point)&z=14&ll=<?=$r_sch_curr[lat]?>,<?=$r_sch_curr[lon]?>'>
+                                                                <a target='_blank' href='http://maps.google.com/maps?q=<?=$r_sch_curr["lat"]?>,<?=$r_sch_curr["lon"]?>+(Gasteizko+Margolariak)&z=14&ll=<?=$r_sch_curr["lat"]?>,<?=$r_sch_curr["lon"]?>'>
                                                                     <img alt=' ' src='<?=$server?>/img/misc/pinpoint.png'/>
                                                                 </a>
                                                             </td>
                                                             <td>
 <?php
                                                                 //If name and address are the same, show only name
-                                                                if ($r_sch_curr['place'] == $r_sch_curr['address']){
-                                                                    echo("$r_sch_curr[place]\n");
+                                                                if ($r_sch_curr["place"] == $r_sch_curr["address"]){
+?>
+                                                                    <?=$r_sch_curr["place"]?>
+<?php
                                                                 }
                                                                 else{
-                                                                    echo("$r_sch_curr[place] <br/><span class='address'> $r_sch_curr[address]</span>\n");
+?>
+                                                                    <?=$r_sch_curr["place"]?>
+                                                                    <br/>
+                                                                    <span class='address'> <?=$r_sch_curr["address"]?></span>
+<?php
                                                                 }
 ?>
                                                             </td>
@@ -336,41 +353,52 @@
                                             $r_sch_next = mysqli_fetch_array($q_sch_next);
 ?>
                                             <div class='festival_event' itemprop='subEvent' itemscope itemtype='http://schema.org/Event'>
-                                                <h4><?=$lng['index_festivals_schedule_next']?></h4>
+                                                <h4><?=$lng["index_festivals_schedule_next"]?></h4>
                                                 <meta itemprop='inLanguage' content='<?=$lang?>'/>
-                                                <meta itemprop='name' content='<?=$r_sch_next['title']?>'/>
-                                                <meta itemprop='startDate' content='<?=$r_sch_next['isostart']?>'/>
+                                                <meta itemprop='name' content='<?=$r_sch_next["title"]?>'/>
+                                                <meta itemprop='startDate' content='<?=$r_sch_next["isostart"]?>'/>
                                                 <span class='hidden' itemprop='location' itemscope itemtype='http://schema.org/Place'>
                                                     <meta itemprop='address' itemprop='name'>Vitoria-Gasteiz</meta>
                                                 </span>
 <?php
-                                                if (strlen($r_sch_curr['isoend']) > 0){
-                                                    echo "<meta itemprop='endDate' content='$r_sch_next[isoend]'/>\n";
+                                                if (strlen($r_sch_curr["isoend"]) > 0){
+?>
+                                                    <meta itemprop='endDate' content='<?=$r_sch_next["isoend"]?>'/>
+<?php
                                                 }
 ?>
                                                 <div class='schedule_content'>
-                                                    <span class='title'><?=$r_sch_next['title']?> - <?=$r_sch_next['st']?></span>
+                                                    <span class='title'><?=$r_sch_next["title"]?> - <?=$r_sch_next["st"]?></span>
 <?php
                                                     if (strlen($r_sch_next["description"]) > 0 && $r_sch_next["description"] != $r_sch_next["title"]){
-                                                        echo "<br/><p class='description'>$r_sch_next[description]</p>\n";
-                                                        echo "<meta itemprop='description' content='$r_sch_next[description]'/>\n";
+?>
+                                                        <br/>
+                                                        <p class='description'><?=$r_sch_next["description"]?></p>
+                                                        <meta itemprop='description' content='<?=$r_sch_next["description"]?>'/>
+<?php
                                                     }
 ?>
                                                     <table class='location'>
                                                         <tr>
                                                             <td>
-                                                                <a target='_blank' href='http://maps.google.com/maps?q=<?=$r_sch_next[lat]?>,<?=$r_sch_next[lon]?>+(My+Point)&z=14&ll=<?=$r_sch_next[lat]?>,<?=$r_sch_next[lon]?>'>
+                                                                <a target='_blank' href='http://maps.google.com/maps?q=<?=$r_sch_next["lat"]?>,<?=$r_sch_next["lon"]?>+(Gasteizko+Margolariak)&z=14&ll=<?=$r_sch_next["lat"]?>,<?=$r_sch_next["lon"]?>'>
                                                                     <img alt=' ' src='<?=$server?>/img/misc/pinpoint.png'/>
                                                                 </a>
                                                             </td>
                                                             <td>
 <?php
                                                                 //If name and address are the same, show only name
-                                                                if ($r_sch_next['place'] == $r_sch_next['address']){
-                                                                    echo("$r_sch_next[place]\n");
+                                                                if ($r_sch_next["place"] == $r_sch_next["address"]){
+?>                                                                
+                                                                    <?=$r_sch_next["place"]?>
+<?php
                                                                 }
                                                                 else{
-                                                                    echo("$r_sch_next[place] <br/><span class='address'> $r_sch_next[address]</span>\n");
+?>
+                                                                    <?=$r_sch_next["place"]?>
+                                                                    <br/>
+                                                                    <span class='address'> <?=$r_sch_next["address"]?></span>
+<?php
                                                                 }
 ?>
                                                             </td>
@@ -400,19 +428,19 @@
                     $upcoming_activity_shown = true;
 ?>
                     <div class='section'>
-                        <h3 class='section_title'><?=$lng['index_upcoming_activity']?></h3>
+                        <h3 class='section_title'><?=$lng["index_upcoming_activity"]?></h3>
 <?php
                         while($r_activity = mysqli_fetch_array($q_activity)){
 ?>
                             <div class='entry' itemscope itemtype='http://schema.org/Event'>
                                 <meta itemprop='inLanguage' content='<?=$lang?>'/>
-                                <meta itemprop='name' content='<?=$r_activity['title']?>'/>
-                                <meta itemprop='description' content='<?=$r_activity['text']?>'/>
-                                <meta itemprop='startDate endDate' content='<?=$r_activity['isodate']?>'/>
+                                <meta itemprop='name' content='<?=$r_activity["title"]?>'/>
+                                <meta itemprop='description' content='<?=$r_activity["text"]?>'/>
+                                <meta itemprop='startDate endDate' content='<?=$r_activity["isodate"]?>'/>
                                 <span class='hidden' itemprop='location' itemscope itemtype='http://schema.org/Place'>
-                                    <meta itemprop='address' itemprop='name' content='=<?=$r_activity[city]?>'/>
+                                    <meta itemprop='address' itemprop='name' content='=<?=$r_activity["city"]?>'/>
                                 </span>
-                                <meta itemprop='url' content='<?=$server?>/actividades/<?=$r_activity['permalink']?>'/>
+                                <meta itemprop='url' content='<?=$server?>/actividades/<?=$r_activity["permalink"]?>'/>
                                 <div class='hidden' itemprop='organizer performer' itemscope itemtype='http://schema.org/Organization'>
                                     <meta itemprop='legalName' content='Asociaci&oacute;n Cultural Recreativa Gasteizko Margolariak'/>
                                     <meta itemprop='name' content='Gasteizko Margolariak'/>
@@ -430,9 +458,9 @@
 ?>
                                             <div class='td'>
                                                 <div id='upcoming_image'>
-                                                    <a href='<?=$server?>/actividades/<?=$r_activity['permalink']?>'>
-                                                        <meta itemprop='image' content='<?=$server?>/img/actividades/<?=$r_activity_image['image']?>'/>
-                                                        <img src='<?=$server?>/img/actividades/miniature/<?=$r_activity_image['image']?>' alt='<?=$r_activity['title']?>'/>
+                                                    <a href='<?=$server?>/actividades/<?=$r_activity["permalink"]?>'>
+                                                        <meta itemprop='image' content='<?=$server?>/img/actividades/<?=$r_activity_image["image"]?>'/>
+                                                        <img src='<?=$server?>/img/actividades/miniature/<?=$r_activity_image["image"]?>' alt='<?=$r_activity["title"]?>'/>
                                                     </a>
                                                 </div> <!-- #upcoming_image -->
                                             </div> <!-- .td-->
@@ -442,72 +470,72 @@
                                         <div class='td'>
                                             <div id='upcoming_text'>
                                                 <h3 class='entry_title'>
-                                                    <a itemprop='url' href='<?=$server?>/actividades/<?=$r_activity['permalink']?>'><?=$r_activity['title']?></a>
+                                                    <a itemprop='url' href='<?=$server?>/actividades/<?=$r_activity["permalink"]?>'><?=$r_activity["title"]?></a>
                                                 </h3>
-                                                <p class='mobile'><?=cutText($r_activity['text'], 250, $lng['index_read_more'], "$server/actividades/$r_activity[permalink]")?></p>
-                                                <p class='desktop'><?=cutText($r_activity['text'], 450, $lng['index_read_more'], "$server/actividades/$r_activity[permalink]")?></p>
+                                                <p class='mobile'><?=cutText($r_activity["text"], 250, $lng["index_read_more"], "$server/actividades/$r_activity[permalink]")?></p>
+                                                <p class='desktop'><?=cutText($r_activity["text"], 450, $lng["index_read_more"], "$server/actividades/$r_activity[permalink]")?></p>
                                             </div> <!-- #upcoming_text -->
                                         </div> <!-- .td -->
                                         <div class='td'>
                                             <div id='upcoming_details'>
                                                 <table>
                                                     <tr>
-                                                        <td><?=$lng['index_upcoming_activity_date']?></td>
-                                                        <td><?=formatDate($r_activity['date'], $lang, false)?></td>
+                                                        <td><?=$lng["index_upcoming_activity_date"]?></td>
+                                                        <td><?=formatDate($r_activity["date"], $lang, false)?></td>
                                                     </tr>
                                                     <tr>
-                                                        <td><?=$lng['index_upcoming_activity_price']?></td>
+                                                        <td><?=$lng["index_upcoming_activity_price"]?></td>
 <?php
-                                                        if ($r_activity['price'] == 0){
+                                                        if ($r_activity["price"] == 0){
 ?>
                                                             <td itemprop='offers' itemscope itemtype='http://schema.org/Offer'>
-                                                                <?=$lng['index_upcoming_activity_free']?>
+                                                                <?=$lng["index_upcoming_activity_free"]?>
                                                                 <meta itemprop='priceCurrency' content='EUR'/>
                                                                 <meta itemprop='price' content='0'/>
                                                                 <meta itemprop='availability' content='Sold Out'/>
-                                                                <meta itemprop='validfrom' content='<?=$r_activity['isodate']?>'/>
-                                                                <meta itemprop='url' content='<?=$server?>/actividades/<?=$r_activity['permalink']?>'/>
+                                                                <meta itemprop='validfrom' content='<?=$r_activity["isodate"]?>'/>
+                                                                <meta itemprop='url' content='<?=$server?>/actividades/<?=$r_activity["permalink"]?>'/>
                                                             </td>
                                                         </tr>
                                                         <tr>
-                                                            <td><?=$lng['index_upcoming_activity_inscription']?></td>
+                                                            <td><?=$lng["index_upcoming_activity_inscription"]?></td>
 <?php
-                                                            if ($r_activity['inscription'] == 1){
+                                                            if ($r_activity["inscription"] == 1){
 ?>
-                                                                <td><?=$lng['yes']?></td>
+                                                                <td><?=$lng["yes"]?></td>
 <?php
                                                             }
                                                             else{
 ?>
-                                                                <td><?=$lng['no']?></td>
+                                                                <td><?=$lng["no"]?></td>
 <?php
                                                             }
                                                         }
                                                         else{
 ?>
                                                             <td itemprop='offers' itemscope itemtype='http://schema.org/Offer'>
-                                                                <?=$r_activity['price']?> €
+                                                                <?=$r_activity["price"]?> €
                                                                     <meta itemprop='priceCurrency' content='EUR'/>
                                                                     <meta itemprop='availability' content='Sold Out'/>
-                                                                    <meta itemprop='validfrom' content='<?=$r_activity['isodate']?>'/>
-                                                                    <meta itemprop='price' content='<?=$r_activity['price']?>'/>
+                                                                    <meta itemprop='validfrom' content='<?=$r_activity["isodate"]?>'/>
+                                                                    <meta itemprop='price' content='<?=$r_activity["price"]?>'/>
                                                             </td>
 <?php
                                                         }
 ?>
                                                     </tr>
 <?php
-                                                    if ($r_activity['max_people'] > 0){
+                                                    if ($r_activity["max_people"] > 0){
 ?>
                                                         <tr>
-                                                            <td><?=$lng['index_upcoming_activity_max_people']?></td>
-                                                            <td><?=$r_activity['max_people']?></td>
+                                                            <td><?=$lng["index_upcoming_activity_max_people"]?></td>
+                                                            <td><?=$r_activity["max_people"]?></td>
                                                         </tr>
 <?php
                                                     }
 ?>
                                                 </table>
-                                                <a href='<?=$server?>/actividades/<?=$r_activity['permalink']?>'><?=$lng['index_upcoming_activity_see']?></a>
+                                                <a href='<?=$server?>/actividades/<?=$r_activity["permalink"]?>'><?=$lng["index_upcoming_activity_see"]?></a>
                                                <br/><br/>
                                             </div> <!-- #upcoming_details -->
                                         </div> <!-- .td -->
@@ -517,7 +545,7 @@
 <?php
                         } // while($r_activity = mysqli_fetch_array($q_activity))
 ?>
-                        <a class='go_to_section' href='<?=$server?>/actividades/'><?=$lng['index_upcoming_activity_see_all']?></a>
+                        <a class='go_to_section' href='<?=$server?>/actividades/'><?=$lng["index_upcoming_activity_see_all"]?></a>
                         <br/>
                     </div> <!-- .section -->
 <?php
@@ -525,11 +553,11 @@
 ?>
                 <div class='section' itemscope itemtype='http://schema.org/Organization'>
                     <meta itemprop='url' content='<?=$server?>'/>
-                    <h3 class='section_title' itemprop='name'><?=$lng['index_us']?></h3>
+                    <h3 class='section_title' itemprop='name'><?=$lng["index_us"]?></h3>
                     <div class='entry' id='us'>
-                        <p itemprop='description'><?=$lng['index_us_content']?></p>
+                        <p itemprop='description'><?=$lng["index_us_content"]?></p>
                     </div> <!-- .entry -->
-                    <a class='go_to_section' href='<?=$server?>/nosotros/'><?=$lng['index_us_more']?></a>
+                    <a class='go_to_section' href='<?=$server?>/nosotros/'><?=$lng["index_us_more"]?></a>
                     </br>
                 </div> <!-- .section -->
 								<br/>
@@ -537,13 +565,13 @@
                 <div class='content_row'>
                     <div class='content_cell' id='cell_posts'>
                         <div class='section' id='latest_posts'>
-                            <h3 class='section_title'><?=$lng['index_latest_posts']?></h3>
+                            <h3 class='section_title'><?=$lng["index_latest_posts"]?></h3>
 <?php
                                 $q_post = mysqli_query($con, "SELECT id, permalink, title_$lang AS title, text_$lang AS text, dtime, DATE_FORMAT(dtime, '%Y-%m-%dT%T') AS isodate FROM post WHERE visible = 1 ORDER BY dtime DESC LIMIT 2;");
                                 if (mysqli_num_rows($q_post) == 0){
 ?>
                                     <div class='entry'>
-                                        <h3 class='entry_title'><?=$lng['index_no_post']?></h3>
+                                        <h3 class='entry_title'><?=$lng["index_no_post"]?></h3>
                                     </div>
 <?php
                                 }
@@ -569,24 +597,24 @@
                                             if (mysqli_num_rows($q_post_image) > 0){
                                                 $r_post_image = mysqli_fetch_array($q_post_image);
 ?>
-                                                <a href='<?=$server?>/blog/<?=$r_post['permalink']?>'>
-                                                    <img itemprop='image' src='<?=$server?>/img/blog/miniature/<?=$r_post_image['image']?>'/>
+                                                <a href='<?=$server?>/blog/<?=$r_post["permalink"]?>'>
+                                                    <img itemprop='image' src='<?=$server?>/img/blog/miniature/<?=$r_post_image["image"]?>'/>
                                                 </a>
 <?php
                                             } //if (mysqli_num_rows($q_post_image) > 0)
 ?>
                                             <h3 class='entry_title'>
-                                                <a itemprop='url' href='<?=$server?>/blog/<?=$r_post['permalink']?>'><?=$r_post['title']?></a>
+                                                <a itemprop='url' href='<?=$server?>/blog/<?=$r_post["permalink"]?>'><?=$r_post["title"]?></a>
                                             </h3>
-                                            <p class='mobile'><?=cutText($r_post['text'], 100, $lng['index_read_more'], "$server/blog/$r_post[permalink]")?></p>
-                                            <p class='desktop'><?=cutText($r_post['text'], 150, $lng['index_read_more'], "$server/blog/$r_post[permalink]")?></p>
-                                            <span><?=formatDate($r_post['dtime'], $lang, false)?></span>
+                                            <p class='mobile'><?=cutText($r_post["text"], 100, $lng["index_read_more"], "$server/blog/$r_post[permalink]")?></p>
+                                            <p class='desktop'><?=cutText($r_post["text"], 150, $lng["index_read_more"], "$server/blog/$r_post[permalink]")?></p>
+                                            <span><?=formatDate($r_post["dtime"], $lang, false)?></span>
                                         </div> <!-- .entry -->
 <?php
                                     } //while ($r_post = mysqli_fetch_array($q_post))
 ?>
 
-                                    <a class='go_to_section' href='<?=$server?>/blog/'><?$lng['index_see_all_posts']?></a>
+                                    <a class='go_to_section' href='<?=$server?>/blog/'><?$lng["index_see_all_posts"]?></a>
                                     <br/>
 <?php
                                 } //if (mysqli_num_rows($q_post) == 0) ELSE
@@ -595,12 +623,12 @@
                     </div> <!-- .cell_posts-->
                     <div class='content_cell' id='cell_photos'>
                         <div class='section' id='latest_photos'>
-                            <h3 class='section_title'><?=$lng['index_latest_photos']?></h3>
+                            <h3 class='section_title'><?=$lng["index_latest_photos"]?></h3>
 <?php
                                 $q_photos = mysqli_query($con, "SELECT id, file, title_$lang AS title, DATE_FORMAT(uploaded, '%Y-%m-%d') AS isodate FROM photo WHERE approved = 1 ORDER BY uploaded DESC LIMIT 6;");
                                 if (mysqli_num_rows($q_photos) == 0){
 ?>
-                                    <div class='entry'><?=$lng['index_no_photos']?></div>
+                                    <div class='entry'><?=$lng["index_no_photos"]?></div>
 <?php
                                 }
                                 else{
@@ -615,10 +643,10 @@
                                                     $r_album = mysqli_fetch_array($q_album);
 ?>
                                                     <td itemscope itemtype='http://schema.org/Photograph'>
-                                                        <meta itemprop='datePublished' content='<?=$r_photos['isodate']?>'/>
-                                                        <a href='$server/galeria/<?=$r_album['permalink']?>'>
+                                                        <meta itemprop='datePublished' content='<?=$r_photos["isodate"]?>'/>
+                                                        <a href='<?=$server?>/galeria/<?=$r_album["permalink"]?>'>
                                                             <meta itemprop='image' content='<?=$server?>/img/galeria/<?=$r_photos["file"]?>'/>
-                                                            <img src='<?=$server?>/img/galeria/miniature/<?=$r_photos['file']?>' alt='<?=$r_photos['title']?>' />
+                                                            <img src='<?=$server?>/img/galeria/miniature/<?=$r_photos["file"]?>' alt='<?=$r_photos["title"]?>' />
                                                         </a>
                                                     </td>
 <?php
@@ -634,7 +662,7 @@
                                             </tr>
                                         </table>
                                     </div> <!-- .entry -->
-                                    <a class='go_to_section' href='<?=$server?>/galeria/'><?=$lng['index_see_all_photos']?></a>
+                                    <a class='go_to_section' href='<?=$server?>/galeria/'><?=$lng["index_see_all_photos"]?></a>
                                     <br/>
 <?php
                                 } //if (mysqli_num_rows($q_photos) == 0) ELSE
@@ -649,18 +677,18 @@
                     if (mysqli_num_rows($q_activity) > 0){
 ?>
                         <div class='section' id='latest_activities'>
-                            <h3 class='section_title'><?=$lng['index_latest_activities']?></h3>
+                            <h3 class='section_title'><?=$lng["index_latest_activities"]?></h3>
 <?php
                             while ($r_activity = mysqli_fetch_array($q_activity)){
 ?>
                                 <div class='entry' itemscope itemtype='http://schema.org/Event'>
                                     <meta itemprop='inLanguage' content='<?=$lang?>'/>
-                                    <meta itemprop='name' content='<?=$r_activity['title']?>'/>
-                                    <meta itemprop='description' content='<?=$r_activity['text']?>'/>
-                                    <meta itemprop='startDate endDate' content='<?=$r_activity['isodate']?>'/>
+                                    <meta itemprop='name' content='<?=$r_activity["title"]?>'/>
+                                    <meta itemprop='description' content='<?=$r_activity["text"]?>'/>
+                                    <meta itemprop='startDate endDate' content='<?=$r_activity["isodate"]?>'/>
                                     <span class='hidden' itemprop='location' itemscope itemtype='http://schema.org/Place'>
-                                        <meta itemprop='address' itemprop='name' content='<?=$r_activity['city']?>'/>
-                                        <meta itemprop='name' content='<?=$r_activity['city']?>'/>
+                                        <meta itemprop='address' itemprop='name' content='<?=$r_activity["city"]?>'/>
+                                        <meta itemprop='name' content='<?=$r_activity["city"]?>'/>
                                     </span>
                                     <div class='hidden' itemprop='organizer performer' itemscope itemtype='http://schema.org/Organization'>
                                         <meta itemprop='legalName' content='Asociaci&oacute;n Cultural Recreativa Gasteizko Margolariak'/>
@@ -674,19 +702,19 @@
 
 
                                     <span class='hidden' itemprop='offers' itemscope itemtype='http://schema.org/Offer'>
-                                        <meta itemprop='name' content='<?=$r_activity['title']?>'/>
-                                        <meta itemprop='description' content='<?=$r_activity['text']?>'/>
-                                        <meta itemprop='price' content='<?=$r_activity['price']?>'/>
+                                        <meta itemprop='name' content='<?=$r_activity["title"]?>'/>
+                                        <meta itemprop='description' content='<?=$r_activity["text"]?>'/>
+                                        <meta itemprop='price' content='<?=$r_activity["price"]?>'/>
                                         <meta itemprop='priceCurrency' content='EUR'/>
-                                        <meta itemprop='url' content='<?=$server?>/actividades/<?=$r_activity['permalink']?>'/>
+                                        <meta itemprop='url' content='<?=$server?>/actividades/<?=$r_activity["permalink"]?>'/>
                                         <meta itemprop='availability' content='Sold Out'/>
-                                        <meta itemprop='validfrom' content='<?=$r_activity['isodate']?>'/>
+                                        <meta itemprop='validfrom' content='<?=$r_activity["isodate"]?>'/>
                                     </span>
 
 
 
                                     <h3 class='entry_title'>
-                                        <a itemprop='url' href='<?=$server?>/actividades/<?=$r_activity['permalink']?>'><?=$r_activity['title']?></a>
+                                        <a itemprop='url' href='<?=$server?>/actividades/<?=$r_activity["permalink"]?>'><?=$r_activity["title"]?></a>
                                     </h3>
                                     <table class='latest_activity'>
                                         <tr>
@@ -696,33 +724,33 @@
                                                 $r_activity_image = mysqli_fetch_array($q_activity_image);
 ?>
                                                 <td class='latest_activity_image'>
-                                                    <a href='<?=$server?>/actividades/<?=$r_activity['permalink']?>'>
-                                                        <meta itemprop='image' content='<?=$server?>/img/actividades/<?=$r_activity_image['image']?>'/>
-                                                        <img src='<?=$server?>/img/actividades/miniature/<?=$r_activity_image['image']?>' alt='<?=$r_activity['title']?>'/>
+                                                    <a href='<?=$server?>/actividades/<?=$r_activity["permalink"]?>'>
+                                                        <meta itemprop='image' content='<?=$server?>/img/actividades/<?=$r_activity_image["image"]?>'/>
+                                                        <img src='<?=$server?>/img/actividades/miniature/<?=$r_activity_image["image"]?>' alt='<?=$r_activity["title"]?>'/>
                                                     </a>
                                                 </td>
 <?php
                                             } // if (mysqli_num_rows($q_activity_image) > 0)
-                                            if ($r_activity['after'] == ''){
+                                            if ($r_activity["after"] == ''){
 ?>
                                                 <td class='mobile latest_activity_text'>
-                                                    <?=cutText($r_activity['text'], 260, "$lng[index_read_more]", "$server/actividades/$r_activity[permalink]")?>
+                                                    <?=cutText($r_activity["text"], 260, "$lng[index_read_more]", "$server/actividades/$r_activity[permalink]")?>
                                                 </td>
                                                 <td class='desktop latest_activity_text'>
-                                                    <?=cutText($r_activity['text'], 400, "$lng[index_read_more]", "$server/actividades/$r_activity[permalink]")?>
+                                                    <?=cutText($r_activity["text"], 400, "$lng[index_read_more]", "$server/actividades/$r_activity[permalink]")?>
                                                 </td>
 <?php
-                                            } // if ($r_activity['after'] == '')
+                                            } // if ($r_activity["after"] == '')
                                             else{
 ?>
                                                 <td class='mobile latest_activity_text'>
-                                                    <?=cutText($r_activity['after'], 260, "$lng[index_read_more]", "$server/actividades/$r_activity[permalink]")?>
+                                                    <?=cutText($r_activity["after"], 260, "$lng[index_read_more]", "$server/actividades/$r_activity[permalink]")?>
                                                 </td>
                                                 <td class='desktop latest_activity_text'>
-                                                    <?=cutText($r_activity['after'], 400, "$lng[index_read_more]", "$server/actividades/$r_activity[permalink]")?>
+                                                    <?=cutText($r_activity["after"], 400, "$lng[index_read_more]", "$server/actividades/$r_activity[permalink]")?>
                                                 </td>
 <?php
-                                            } // if ($r_activity['after'] == '') ELSE
+                                            } // if ($r_activity["after"] == '') ELSE
 ?>
                                         </tr>
                                     </table>
@@ -730,7 +758,7 @@
 <?php
                             }
 ?>
-                            <a class='go_to_section' href='<?=$server?>/actividades/'><?=$lng['index_upcoming_activity_see_all']?></a>
+                            <a class='go_to_section' href='<?=$server?>/actividades/'><?=$lng["index_upcoming_activity_see_all"]?></a>
                             <br/>
                         </div> <!-- .section -->
 <?php
@@ -741,13 +769,13 @@
                 if ($festivals == 0){
 ?>
                     <div class='section'>
-                        <h3 class='section_title'><?=$lng['index_festivals_header']?></h3>
+                        <h3 class='section_title'><?=$lng["index_festivals_header"]?></h3>
                         <div class='entry'>
                             <span class='desktop'>
-                                <?=cutText($lng['lablanca_no_content'] . '<br/>' . $lng['lablanca_no_content_2'], 300, $lng['index_read_more'], "$server/lablanca/")?>
+                                <?=cutText($lng["lablanca_no_content"] . '<br/>' . $lng["lablanca_no_content_2"], 300, $lng["index_read_more"], "$server/lablanca/")?>
                             </span>
                             <span class='desktop'>
-                                <?=cutText($lng['lablanca_no_content'] . '<br/>' . $lng['lablanca_no_content_2'], 200, $lng['index_read_more'], "$server/lablanca/")?>
+                                <?=cutText($lng["lablanca_no_content"] . '<br/>' . $lng["lablanca_no_content_2"], 200, $lng["index_read_more"], "$server/lablanca/")?>
                             </span>
                         </div> <!-- .entry -->
                     </div> <!-- .section -->

+ 127 - 108
www/lablanca/index.php

@@ -3,14 +3,14 @@
     include("../functions.php");
     $con = startdb();
     $proto = getProtocol();
-    $http_host = $_SERVER['HTTP_HOST'];
-    $server = "$proto" . "$http_host";
+    $http_host = $_SERVER["HTTP_HOST"];
+    $server = "$proto$http_host";
     
     //Language
     $lang = selectLanguage();
-    include("../lang/lang_" . $lang . ".php");
+    include("../lang/lang_$lang.php");
     
-    $cur_section = $lng['section_lablanca'];
+    $cur_section = $lng["section_lablanca"];
     
     //Is festivals enabled in settings?
     $q = mysqli_query($con, "SELECT value FROM settings WHERE name = 'festivals';");
@@ -18,7 +18,7 @@
         $is_festivals = false;
     else{
         $r = mysqli_fetch_array($q);
-        if ($r['value'] == 1){
+        if ($r["value"] == 1){
             $is_festivals = true;
         }
         else{
@@ -28,134 +28,153 @@
     
     //Get year
     $year = date("Y");
-    //if (is_int($_GET['year']) == false){ 
-    if ($_GET['year'] != ''){ 
-        $q_year = mysqli_query($con, "SELECT id FROM festival WHERE year = " . mysqli_real_escape_string($con, $_GET['year']));
+    if ($_GET["year"] != ''){ 
+        $q_year = mysqli_query($con, "SELECT id FROM festival WHERE year = " . mysqli_real_escape_string($con, $_GET["year"]));
         if (mysqli_num_rows($q_year) > 0){
-            $year = $_GET['year'];
+            $year = $_GET["year"];
             $is_festivals = true;
         }
     }
     
-    //echo $_GET['year'];
 
 ?>
 <!DOCTYPE html>
 <html>
     <head>
-        <meta content="text/html; charset=utf-8" http-equiv="content-type"/>
-        <meta charset="utf-8"/>
-        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1">
+        <meta content='text/html; charset=utf-8' http-equiv='content-type'/>
+        <meta charset='utf-8'/>
+        <meta name='viewport' content='width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1'>
         <title>
-            <?php
-                if ($is_festivals){
-                    echo str_replace('#', $year, $lng['lablanca_title']);
-                }
-                else{
-                    echo $lng['lablanca_no_title'];
-                }
-            ?>
+<?php
+            if ($is_festivals){
+?>
+                <?=str_replace('#', $year, $lng["lablanca_title"])?>
+<?php
+            }
+            else{
+?>
+                <?=$lng["lablanca_no_title"]?>
+<?php
+             }
+?>
              - Gasteizko Margolariak
         </title>
-        <link rel="shortcut icon" href="<?php echo "$proto$http_host/img/logo/favicon.ico";?>">
+        <link rel='shortcut icon' href='<?=$server?>/img/logo/favicon.ico'>
         <!-- CSS files -->
         <style>
-            <?php 
-                include("../css/ui.css"); 
-                include("../css/lablanca.css");
-            ?>
+<?php 
+            include("../css/ui.css"); 
+            include("../css/lablanca.css");
+?>
         </style>
         <!-- CSS for mobile version -->
         <style media="(max-width : 990px)">
-            <?php 
-                include("../css/m/ui.css"); 
-                include("../css/m/lablanca.css");
-            ?>
+<?php 
+            include("../css/m/ui.css"); 
+            include("../css/m/lablanca.css");
+?>
         </style>
         <!-- Script files -->
         <script type="text/javascript">
-            <?php
-                include("../script/ui.js");
-                include("../script/lablanca.js");
-            ?>
+<?php
+            include("../script/ui.js");
+            include("../script/lablanca.js");
+?>
         </script>
         <!-- Meta tags -->
-        <link rel="canonical" href="<?php echo "$proto$http_host/lablanca/"; ?>"/>
-        <link rel="author" href="<?php echo "$proto$http_host"; ?>"/>
-        <link rel="publisher" href="<?php echo "$proto$http_host"; ?>"/>
-        <meta name="description" content="<?php echo $lng['lablanca_description'];?>"/>
-        <meta property="og:title" 
-            content="<?php
-                if ($is_festivals){
-                    echo str_replace('#', $year, $lng['lablanca_title']);
-                }
-                else{
-                    echo $lng['lablanca_no_title'];
-                }
-            ?> - Gasteizko Margolariak"
-        />
-        <meta property="og:url" content="<?php echo "$proto$http_host"; ?>"/>
-        <meta property="og:description" content="<?php echo $lng['lablanca_description'];?>"/>
-        <meta property="og:image" content="<?php echo "$proto$http_host/img/logo/logo.png";?>"/>
-        <meta property="og:site_name" content="<?php echo $lng['lablanca_title'];?>"/>
-        <meta property="og:type" content="website"/>
-        <meta property="og:locale" content="<?php echo $lang; ?>"/>
-        <meta name="twitter:card" content="summary"/>
-        <meta name="twitter:title" 
-            content="<?php
-                if ($is_festivals){
-                    echo str_replace('#', $year, $lng['lablanca_title']);
-                }
-                else{
-                    echo $lng['lablanca_no_title'];
-                }
-            ?> - Gasteizko Margolariak"
-        />
-        <meta name="twitter:description" content="<?php echo $lng['lablanca_description'];?>"/>
-        <meta name="twitter:image" content="<?php echo "$proto$http_host/img/logo/logo.png";?>"/>
-        <meta name="twitter:url" content="<?php echo"$proto$http_host"; ?>"/>
+        <link rel="canonical" href="<?=$server?>/lablanca/"/>
+        <link rel="author" href="<?=$server?>"/>
+        <link rel="publisher" href="<?=$server?>"/>
+        <meta name='description' content='<?=$lng["lablanca_description"]?>'/>
+<?php
+        if ($is_festivals){
+?>
+            <meta property="og:title" content='<?=str_replace('#', $year, $lng["lablanca_title"])?> - Gasteizko Margolariak'/>
+<?php
+        }
+        else{
+?>
+            <meta property="og:title" content='<?=str_replace('#', $year, $lng["lablanca_no_title"])?> - Gasteizko Margolariak'/>
+<?php
+        }
+?>
+        <meta property='og:url' content='<?=$server?>'/>
+        <meta property='og:description' content='<?=$lng["lablanca_description"]?>'/>
+        <meta property='og:image' content='<?=$server?>/img/logo/logo.png'/>
+        <meta property='og:site_name' content='<?=$lng["lablanca_title"]?>'/>
+        <meta property='og:type' content='website'/>
+        <meta property='og:locale' content='<?=$lang?>'/>
+        <meta name='twitter:card' content='summary'/>
+<?php
+        if ($is_festivals){
+?>
+            <meta property="twitter:title" content='<?=str_replace('#', $year, $lng["lablanca_title"])?> - Gasteizko Margolariak'/>
+<?php
+        }
+        else{
+?>
+            <meta property="twitter:title" content='<?=str_replace('#', $year, $lng["lablanca_no_title"])?> - Gasteizko Margolariak'/>
+<?php
+        }
+?>
+        <meta name="twitter:description" content="<?=$lng["lablanca_description"]?>"/>
+        <meta name="twitter:image" content="<?=$server?>/img/logo/logo.png";?>"/>
+        <meta name="twitter:url" content="<?=$server?>"/>
         <meta name="robots" content="index follow"/>
     </head>
     <body>
-        <?php include("../header.php"); ?>
-        <div id="content">
-            <?php                
-                //Include file
-                if ($is_festivals){
-                    include("fiestas.php");
-                }
-                else{
-                    include("nofiestas.php");
-                }
-            ?>
-            <?php
-                //If the program of previous years exist, show a drop list
-                $year = date("Y");
-                if (date("M") <= 8 || (date("M") == 8 && date("D") < 25)){
-                    $year --;
-                }
-                if (date("M") <= 8){
-                    $q_years = mysqli_query($con, "SELECT year FROM festival WHERE year != " . date("Y") . " ORDER BY year DESC;");
-                }
-                else{
-                    $q_years = mysqli_query($con, "SELECT year FROM festival WHERE year <= " . date("Y") . " ORDER BY year DESC;");
-                }
-                if (mysqli_num_rows($q_years) >= 0){
-                    echo("<br/><br/><div class='section' id='past_festivals'>\n");
-                    echo("<h3 class='section_title'>$lng[lablanca_past_title]</h3>\n");
-                    echo("<div class='entry'><ul>\n");
-                    while ($r_years = mysqli_fetch_array($q_years)){
-                        echo("<li><a href='$proto$http_host/lablanca/$r_years[year]'>$lng[lablanca_past_link] $r_years[year]</a></li>\n");
-                    }        
-                    echo("</ul></div>\n");
-                    echo("</div>\n");
-                }
-            ?>
-        </div>
-        <?php
-            include("../footer.php");
-            $ad = ad($con, $lang, $lng); 
-            stats($ad, $ad_static, "fiestas", "");
-        ?>
+<?php
+    include("../header.php");
+?>
+    <div id="content">
+<?php                
+        //Include file
+        if ($is_festivals){
+            include("fiestas.php");
+        }
+        else{
+            include("nofiestas.php");
+        }
+?>
+<?php
+        //If the program of previous years exist, show a drop list
+        $year = date("Y");
+        if (date("M") <= 8 || (date("M") == 8 && date("D") < 25)){
+            $year --;
+        }
+        if (date("M") <= 8){
+            $q_years = mysqli_query($con, "SELECT year FROM festival WHERE year != " . date("Y") . " ORDER BY year DESC;");
+        }
+        else{
+            $q_years = mysqli_query($con, "SELECT year FROM festival WHERE year <= " . date("Y") . " ORDER BY year DESC;");
+        }
+        if (mysqli_num_rows($q_years) >= 0){
+?>
+            <br/><br/>
+            <div class='section' id='past_festivals'>
+                <h3 class='section_title'><?=$lng["lablanca_past_title"]?></h3>
+                <div class='entry'>
+                    <ul>
+<?php
+                        while ($r_years = mysqli_fetch_array($q_years)){
+?>
+                            <li>
+                                <a href='<?=$server?>/lablanca/<?=$r_years["year"]?>'><?=$lng["lablanca_past_link"]?> <?=$r_years["year"]?></a>
+                            </li>
+<?php
+                        }
+?>
+                    </ul>
+                </div> <!-- .entry -->
+            </div> <!-- .section -->
+<?php
+        }
+?>
+    </div> <!-- #content -->
+<?php
+    include("../footer.php");
+    $ad = ad($con, $lang, $lng); 
+    stats($ad, $ad_static, "fiestas", "");
+?>
     </body>
 </html>

+ 6 - 6
www/lablanca/nofiestas.php

@@ -1,15 +1,15 @@
-<?php //TODO: Revisit this file.?>
+<!-- TODO: Revisit this file. -->
 <div class="section">
-    <h3 class="section_title"><?php echo($lng['lablanca_no_intro']); ?></h3>
+    <h3 class="section_title"><?=$lng["lablanca_no_intro"])?></h3>
     <div class="entry">
         <div class="horiz">
-            <p><?php echo($lng['lablanca_no_content']); ?></p>
-<!--             <img src="TODO"/> -->
+            <p><?=$lng["lablanca_no_content"])?></p>
+            <!-- TODO <img/> -->
         </div>
         <br/>
         <div class="horiz">
-<!--             <img src="TODO"/> -->
-            <p><?php echo($lng['lablanca_no_content_2']); ?></p>
+            <!-- TODO <img/> -->
+            <p><?=$lng["lablanca_no_content_2"])?></p>
         </div>
     </div>
 </div>

File diff suppressed because it is too large
+ 1 - 0
www/lang/lang_en.php


File diff suppressed because it is too large
+ 1 - 0
www/lang/lang_es.php


File diff suppressed because it is too large
+ 1 - 0
www/lang/lang_eu.php


+ 0 - 15
www/langtranslate.php

@@ -1,15 +0,0 @@
-<?php
-    include include("lang/lang_es.php");
-    $lng_es = $lng;
-    include include("lang/lang_en.php");
-    $lng_en = $lng;
-    include include("lang/lang_eu.php");
-    $lng_eu = $lng;
-    $total = count($lng_es);
-    echo "<table style='border:0.1em solid #000000; border-collapse:collapse'>\n";
-    echo "<tr><th style='border:0.1em solid #000000; width:8em;'>Code</th><th style='border:0.1em solid #000000;'>es</th><th style='border:0.1em solid #000000;display:none;'>en</th><th style='border:0.1em solid #000000;'>eu</th><tr>\n";
-    for ($i = 0; $i < count($lng_es); $i++){
-        echo "<tr><td style='padding:0em; border:0.1em solid #000000; width:8em; font-size:60%; font-weight:bold; word-break: break-all;'>" . array_search(array_values($lng_es)[$i], $lng_es, true) . "</td><td style='padding:-0.3em 0.1em -0.3em 0.1em; border:0.1em solid #000000;line-height: 110%;font-size:90%;'>" . array_values($lng_es)[$i] . "</td><td style='adding:-0.3em 0.1em -0.3em 0.1em; border:0.1em solid #000000;display:none;'>" . array_values($lng_en)[$i] . "</td><td style='padding:adding:-0.3em 0.1em -0.3em 0.1em;; border:0.1em solid #000000;line-height: 110%;font-size:90%;'>" . array_values($lng_eu)[$i] . "</td></tr>";
-    }
-    echo "</table>";
-?>

+ 52 - 50
www/nosotros/index.php

@@ -4,11 +4,12 @@
     include("../functions.php");
     $con = startdb();
     $proto = getProtocol();
-    
+    $server = "$proto$http_host";
+
     //Language
     $lang = selectLanguage();
-    include("../lang/lang_" . $lang . ".php");
-    
+    include("../lang/lang_$lang.php");
+
     $cur_section = $lng['section_us'];
 ?>
 <!DOCTYPE html>
@@ -17,66 +18,68 @@
         <meta content="text/html; charset=utf-8" http-equiv="content-type"/>
         <meta charset="utf-8"/>
         <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1">
-        <title><?php echo $lng['us_title'];?> - Gasteizko Margolariak</title>
-        <link rel="shortcut icon" href="<?php echo "$proto$http_host/img/logo/favicon.ico";?>">
+        <title><?=$lng["us_title"]?> - Gasteizko Margolariak</title>
+        <link rel="shortcut icon" href="<?=$server?>/img/logo/favicon.ico">
         <!-- CSS files -->
         <style>
-            <?php 
-                include("../css/ui.css"); 
-                include("../css/nosotros.css");
-            ?>
+<?php
+            include("../css/ui.css");
+            include("../css/nosotros.css");
+?>
         </style>
         <!-- CSS for mobile version -->
         <style media="(max-width : 990px)">
-            <?php 
-                include("../css/m/ui.css"); 
-                include("../css/m/nosotros.css");
-            ?>
+<?php
+            include("../css/m/ui.css");
+            include("../css/m/nosotros.css");
+?>
         </style>
         <!-- Script files -->
         <script type="text/javascript">
-            <?php
-                include("../script/ui.js");
-            ?>
+<?php
+            include("../script/ui.js");
+?>
         </script>
         <!-- Meta tags -->
-        <link rel="canonical" href="<?php echo "$proto$http_host/nosotros/"; ?>"/>
-        <link rel="author" href="<?php echo "$proto$http_host"; ?>"/>
-        <link rel="publisher" href="<?php echo "$proto$http_host"; ?>"/>
-        <meta name="description" content="<?php echo $lng['us_description'];?>"/>
-        <meta property="og:title" content="<?php echo $lng['us_title'];?> - Gasteizko Margolariak"/>
-        <meta property="og:url" content="<?php echo "$proto$http_host"; ?>"/>
-        <meta property="og:description" content="<?php echo $lng['us_description'];?>"/>
-        <meta property="og:image" content="<?php echo "$proto$http_host/img/logo/logo.png";?>"/>
-        <meta property="og:site_name" content="<?php echo $lng['us_title'];?>"/>
+        <link rel="canonical" href="<?=$server?>/nosotros/"/>
+        <link rel="author" href="<?=$server?>"/>
+        <link rel="publisher" href="<?=$server?>"/>
+        <meta name="description" content="<?=$lng["us_description"]?>"/>
+        <meta property="og:title" content="<?=$lng["us_title"]?> - Gasteizko Margolariak"/>
+        <meta property="og:url" content="<?=$server?>"/>
+        <meta property="og:description" content="<?=$lng["us_description"]?>"/>
+        <meta property="og:image" content="<?=$server?>/img/logo/logo.png"/>
+        <meta property="og:site_name" content="<?=$lng["us_title"]?>"/>
         <meta property="og:type" content="website"/>
-        <meta property="og:locale" content="<?php echo $lang; ?>"/>
+        <meta property="og:locale" content="<?=$lang?>"/>
         <meta name="twitter:card" content="summary"/>
-        <meta name="twitter:title" content="<?php echo $lng['us_title'];?> - Gasteizko Margolariak"/>
-        <meta name="twitter:description" content="<?php echo $lng['us_description'];?>"/>
-        <meta name="twitter:image" content="<?php echo "$proto$http_host/img/logo/logo.png";?>"/>
-        <meta name="twitter:url" content="<?php echo"$proto$http_host"; ?>"/>
+        <meta name="twitter:title" content="<?=$lng["us_title"]?> - Gasteizko Margolariak"/>
+        <meta name="twitter:description" content="<?=$lng["us_description"]?>"/>
+        <meta name="twitter:image" content="<?=$server?>/img/logo/logo.png"/>
+        <meta name="twitter:url" content="<?=$server?>"/>
         <meta name="robots" content="index follow"/>
     </head>
     <body>
-        <?php include("../header.php"); ?>
+<?php
+        include("../header.php");
+?>
         <div id="content">
             <div class="content_row">
                 <div class="content_cell">
                     <div class="section" id="section_association">
-                        <h3 class='section_title'><?php echo $lng['us_association']; ?></h3>
+                        <h3 class='section_title'><?=$lng["us_association"] ?></h3>
                         <div class="entry">
-                            <img src="/img/nosotros/logo.png" alt=" "/>
-                            <?php echo $lng['us_association_content']; ?>
+                            <img src="<?=$server?>/img/nosotros/logo.png" alt=" "/>
+                            <?=$lng["us_association_content"] ?>
                         </div>
                     </div>
                 </div>
                 <div class="content_cell">
                     <div class="section" id="section_cuadrilla">
-                        <h3 class='section_title'><?php echo $lng['us_cuadrilla']; ?></h3>
+                        <h3 class='section_title'><?=$lng["us_cuadrilla"] ?></h3>
                         <div class="entry">
-                            <img src="/img/nosotros/margolo.png" alt=" "/>
-                            <?php echo $lng['us_cuadrilla_content']; ?>
+                            <img src="<?=$server?>/img/nosotros/margolo.png" alt=" "/>
+                            <?=$lng["us_cuadrilla_content"] ?>
                         </div>
                     </div>
                 </div>
@@ -84,32 +87,31 @@
             <div class="content_row">
                 <div class="content_cell">
                     <div class="section" id="section_activities">
-                        <h3 class='section_title'><?php echo $lng['us_activities']; ?></h3>
+                        <h3 class='section_title'><?=$lng["us_activities"] ?></h3>
                         <div class="entry">
-                            <img src="/img/nosotros/actividades.png" alt=" "/>
-                            <?php echo $lng['us_activities_content']; ?>
+                            <img src="<?=$server?>/img/nosotros/actividades.png" alt=" "/>
+                            <?=$lng["us_activities_content"] ?>
                         </div>
                     </div>
                 </div>
                 <div class="content_cell">
                     <div class="section" id="section_transparency">
-                        <h3 class='section_title'><?php echo $lng['us_transparency']; ?></h3>
+                        <h3 class='section_title'><?=$lng["us_transparency"] ?></h3>
                         <div class="entry">
-                            <img src="/img/nosotros/transparencia.png" alt=" "/>
-                            <?php echo $lng['us_transparency_content']; ?>
+                            <img src="<?=$server?>/img/nosotros/transparencia.png" alt=" "/>
+                            <?=$lng["us_transparency_content"] ?>
                             <div>
-                                <!-- TODO: Link like button -->
-<!--                                 <a href="/nosotros/transparencia/">Consulta nuestras cuentas</a> -->
+                                 <!-- <a class='button' href="/nosotros/transparencia/">Consulta nuestras cuentas</a> -->
                             </div>
                         </div>
                     </div>
                 </div>
             </div>
         </div>
-        <?php
-            include("../footer.php");
-            $ad = ad($con, $lang, $lng); 
-            stats($ad, $ad_static, "nosotros", "");
-        ?>
+<?php
+        include("../footer.php");
+        $ad = ad($con, $lang, $lng); 
+        stats($ad, $ad_static, "nosotros", "");
+?>
     </body>
 </html>

+ 58 - 72
www/traducir/index.php

@@ -21,13 +21,13 @@
                     <meta content="text/html; charset=utf-8" http-equiv="content-type"/>
                     <meta charset="utf-8"/>
                     <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1">
-                    <title>Traducciones - Gasteizko Margolariak</title>
+                    <title><?=$lng["translation_title"]?> - Gasteizko Margolariak</title>
                     <link rel="shortcut icon" href="<?=$server?>/img/logo/favicon.ico">
                     <!-- CSS files -->
                     <style>
 <?php
-                            include("../css/ui.css"); 
-                            include("../css/traducir.css");
+                        include("../css/ui.css"); 
+                        include("../css/traducir.css");
 ?>
                     </style>
                     <!-- CSS for mobile version -->
@@ -44,32 +44,32 @@
 ?>
                     </script>
                     <!-- Meta tags -->
-                    <link rel="canonical" href="<?=$server?>/traducir/"/>
-                    <link rel="author" href="<?=server?>"/>
-                    <link rel="publisher" href="<?=server?>"/>
-                    <meta name="description" content="Traduccion de contenidos de la web de Gasteizko Margolariak"/>
-                    <meta property="og:title" content="Traducciones - Gasteizko Margolariak"/>
-                    <meta property="og:url" content="<?=$server?>/traducir/"/>
-                    <meta property="og:description" content="Traduccion de contenidos de la web de Gasteizko Margolariak"/>
-                    <meta property="og:image" content="<?=$server?>/img/logo/logo.png"/>
-                    <meta property="og:site_name" content="Gasteizko Margolariak"/>
-                    <meta property="og:type" content="website"/>
-                    <meta property="og:locale" content="es"/>
-                    <meta name="twitter:card" content="summary"/>
-                    <meta name="twitter:title" content="Traducciones - Gasteizko Margolariak"/>
-                    <meta name="twitter:description" content="Traduccion de contenidos de la web de Gasteizko Margolariak"/>
-                    <meta name="twitter:image" content="<?=$server?>/img/logo/logo.png"/>
-                    <meta name="twitter:url" content="<?$server?>/traducir/"/>
-                    <meta name="robots" content="noindex nofollow"/>
+                    <link rel='canonical' href='<?=$server?>/traducir/'/>
+                    <link rel='author' href='<?=server?>'/>
+                    <link rel='publisher' href='<?=server?>'/>
+                    <meta name='description' content='Traduccion de contenidos de la web de Gasteizko Margolariak'/>
+                    <meta property='og:title' content='<?=$lng["translation_title"]?> - Gasteizko Margolariak'/>
+                    <meta property='og:url' content='<?=$server?>/traducir/'/>
+                    <meta property='og:description' content='<?=$lng["translation_description"]?>'/>
+                    <meta property='og:image' content='<?=$server?>/img/logo/logo.png'/>
+                    <meta property='og:site_name' content='Gasteizko Margolariak'/>
+                    <meta property='og:type' content='website'/>
+                    <meta property='og:locale' content='<?=$lang?>'/>
+                    <meta name='twitter:card' content='summary'/>
+                    <meta name='twitter:title' content='<?=$lng["translation_title"]?> - Gasteizko Margolariak'/>
+                    <meta name='twitter:description' content='<?=$lng["translation_description"]?>'/>
+                    <meta name='twitter:image' content='<?=$server?>/img/logo/logo.png'/>
+                    <meta name='twitter:url' content='<?$server?>/traducir/'/>
+                    <meta name='robots' content='noindex nofollow'/>
                 </head>
                 <body>
 <?php                include("../header.php"); ?>
                     <div id="content">
                         <div class='section' id='w_init'>
-                            <h3 class='section_title'>Traducciones</h3>
+                            <h3 class='section_title'><?=$lng["translation_title"]?></h3>
                             <div class='entry'>
-                                <a class='lang' href='<?=$server?>/traducir/eu/'>Traducir al euskera</a>
-                                <a class='lang' href='<?=$server?>/traducir/en/'>Traducir al ingl&eacute;s</a>
+                                <a class='lang' href='<?=$server?>/traducir/eu/'<?=$lng["translation_to_eu"]?></a>
+                                <a class='lang' href='<?=$server?>/traducir/en/'<?=$lng["translation_to_en"]?></a>
                             </div>
                         </div>
                     </div>
@@ -137,23 +137,23 @@
 <!DOCTYPE html>
 <html>
     <head>
-        <meta content="text/html; charset=utf-8" http-equiv="content-type"/>
-        <meta charset="utf-8"/>
-        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1">
-        <title>Traducciones - Gasteizko Margolariak</title>
-        <link rel="shortcut icon" href="<?=$server?>/img/logo/favicon.ico">
+        <meta content='text/html; charset=utf-8' http-equiv='content-type'/>
+        <meta charset='utf-8'/>
+        <meta name='viewport' content='width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1'>
+        <title><?=$lng["translation_title"]?> - Gasteizko Margolariak</title>
+        <link rel='shortcut icon' href='<?=$server?>/img/logo/favicon.ico'>
         <!-- CSS files -->
         <style>
 <?php 
-                include("../css/ui.css"); 
-                include("../css/traducir.css");
+            include("../css/ui.css"); 
+            include("../css/traducir.css");
 ?>
         </style>
         <!-- CSS for mobile version -->
         <style media="(max-width : 990px)">
 <?php
-                include("../css/m/ui.css"); 
-                include("../css/m/traducir.css");
+            include("../css/m/ui.css"); 
+            include("../css/m/traducir.css");
 ?>
         </style>
         <!-- Script files -->
@@ -273,55 +273,41 @@
 
         </script>
         <!-- Meta tags -->
-        <link rel="canonical" href="<?=$server?>/traducir/"/>
-        <link rel="author" href="<?=$server?>"/>
-        <link rel="publisher" href="<?=$server?>"/>
-        <meta name="description" content="Traduccion de contenidos de la web de Gasteizko Margolariak"/>
-        <meta property="og:title" content="Traducciones - Gasteizko Margolariak"/>
-        <meta property="og:url" content="<?=$server?>/traducir/"/>
-        <meta property="og:description" content="Traduccion de contenidos de la web de Gasteizko Margolariak"/>
-        <meta property="og:image" content="<?=$server?>/img/logo/logo.png"/>
-        <meta property="og:site_name" content="Gasteizko Margolariak"/>
-        <meta property="og:type" content="website"/>
-        <meta property="og:locale" content="es"/>
-        <meta name="twitter:card" content="summary"/>
-        <meta name="twitter:title" content="Traducciones - Gasteizko Margolariak"/>
-        <meta name="twitter:description" content="Traduccion de contenidos de la web de Gasteizko Margolariak"/>
-        <meta name="twitter:image" content="<?=$server?>/img/logo/logo.png"/>
-        <meta name="twitter:url" content="<?=$server?>/traducir/"/>
-        <meta name="robots" content="noindex nofollow"/>
+        <link rel='canonical' href='<?=$server?>/traducir/'/>
+        <link rel='author' href='<?=$server?>'/>
+        <link rel='publisher' href='<?=$server?>'/>
+        <meta name='description' content='<?=$lng["translation_description"]?>'/>
+        <meta property='og:title' content='<?=$lng["translation_title"]?> - Gasteizko Margolariak'/>
+        <meta property='og:url' content='<?=$server?>/traducir/'/>
+        <meta property='og:description' content='<?=$lng["translation_description"]?>'/>
+        <meta property='og:image' content='<?=$server?>/img/logo/logo.png'/>
+        <meta property='og:site_name' content='Gasteizko Margolariak'/>
+        <meta property='og:type' content='website'/>
+        <meta property='og:locale' content='<?=$lang?>'/>
+        <meta name='twitter:card' content='summary'/>
+        <meta name='twitter:title' content='<?=$lng["translation_title"]?> - Gasteizko Margolariak'/>
+        <meta name='twitter:description' content='<?=$lng["translation_description"]?>'/>
+        <meta name='twitter:image' content='<?=$server?>/img/logo/logo.png'/>
+        <meta name='twitter:url' content='<?=$server?>/traducir/'/>
+        <meta name='robots' content='noindex nofollow'/>
     </head>
     <body onLoad='prepare();'>
-<?php     include("../header.php"); ?>
+<?php
+		include("../header.php");
+?>
         <div id="content">
             <div class='section'>
                 <h3 class='section_title'>Traducciones en 
-<?php
-                    if ($l == 'en'){
-                        echo("ingl&eacute;s");
-                    }
-                    else{
-                        echo("euskera");
-                    }
-?>
+					<?=$lng["translation_translating_$l"]?>
                 </h3>
                 <div class='entry' id='w_target'>
                     <div class='translation' id='original'>
-                        <h3 class='entry_title'>Original (Castellano)</h3>
+                        <h3 class='entry_title'><?=$lng["translation_original"]?></h3>
                         <span id='i_original'></span>
                         <p id='t_original'></p>
                     </div>
                     <div class='translation' id='translation'>
-                        <h3 class='entry_title'>Traducci&oacute;n (
-<?php
-                            if ($l == 'en'){
-                                echo("Ingl&eacute;s");
-                            }
-                            else{
-                                echo("Euskera");
-                            }
-?>
-                        )</h3>
+                        <h3 class='entry_title'><?=$lng["translation_translation_$l"]?></h3>
                         <input type='text' id='i_translation'/>
                         <textarea id='t_translation'></textarea>
                     </div>
@@ -332,13 +318,13 @@
                     <table id='buttons'>
                         <tr>
                             <td>
-                                <input type='text' id='name' placeholder='Tu nombre...'/>
+                                <input type='text' id='name' placeholder='<?=$lng["translation_name"]?>'/>
                             </td>
                             <td>
-                                <input type='button' id='next' value='Saltar esta' onClick='next();'/>
+                                <input type='button' id='next' value='<?=$lng["translation_skip"]?>' onClick='next();'/>
                             </td>
                             <td>
-                                <input type='button' id='save' value='Guardar' onClick='save();'/>
+                                <input type='button' id='save' value='<?=$lng["translation_save"]?>' onClick='save();'/>
                             </td>
                         </tr>
                     </table>

+ 8 - 20
www/traducir/load.php

@@ -1,19 +1,16 @@
 <?php
     session_start();
-    $http_host = $_SERVER['HTTP_HOST'];
+    $http_host = $_SERVER["HTTP_HOST"];
     include("../functions.php");
-    $proto = getProtocol();
-    $con = startdb('rw');
-    $server = "$proto$http_host";
+    $con = startdb("rw");
 
     // Get parameters
-
-    $t = mysqli_real_escape_string($con, urldecode($_GET['t'])); // table
-    $f = mysqli_real_escape_string($con, urldecode($_GET['f'])); // field (column)
-    $i = mysqli_real_escape_string($con, urldecode($_GET['i'])); // id
-    $c = mysqli_real_escape_string($con, urldecode($_GET['c'])); // content (translation)
-    $l = mysqli_real_escape_string($con, urldecode($_GET['l'])); // language
-    $n = mysqli_real_escape_string($con, urldecode($_GET['n'])); // translator name
+    $t = mysqli_real_escape_string($con, urldecode($_GET["t"])); // table
+    $f = mysqli_real_escape_string($con, urldecode($_GET["f"])); // field (column)
+    $i = mysqli_real_escape_string($con, urldecode($_GET["i"])); // id
+    $c = mysqli_real_escape_string($con, urldecode($_GET["c"])); // content (translation)
+    $l = mysqli_real_escape_string($con, urldecode($_GET["l"])); // language
+    $n = mysqli_real_escape_string($con, urldecode($_GET["n"])); // translator name
 
     if (strlen($t) == 0 || strlen($f) == 0 || 
       is_numeric($i) == false || strlen($c) == 0 || 
@@ -21,15 +18,6 @@
          http_response_code(400); // Bad request
     }
     else{
-
-        /*$t = urldecode($_GET['t']); // table
-        $f = urldecode($_GET['f']); // field (column)
-        $i = urldecode($_GET['i']); // id
-        $c = urldecode($_GET['c']); // content (translation)
-        $l = urldecode($_GET['l']); // language
-        $n = urldecode($_GET['n']); // translator name*/
-
-        // TODO: Validate parameters
         $q_string = "INSERT INTO translation (username, tab, field, eid, lang, text) VALUES ('$n', '$t', '$f', '$i', '$l', '$c');";
         mysqli_query($con, $q_string);
     }

Some files were not shown because too many files changed in this diff