Procházet zdrojové kódy

Several improvements.

Iñigo Valentin před 8 roky
rodič
revize
3708630d69

+ 23 - 6
sql/02_DATA.SQL

@@ -259,12 +259,18 @@ INSERT INTO text VALUES ('BLOG_COMMENTS_X',  'eu', 'BLOG', 'comentarios.', null)
 
 
 -- PAGE profile
-INSERT INTO text VALUES ('PROFILE_TITLE',       'es', 'PROFILE', 'Yo', null);
-INSERT INTO text VALUES ('PROFILE_TITLE',       'en', 'PROFILE', 'Me', null);
-INSERT INTO text VALUES ('PROFILE_TITLE',       'eu', 'PROFILE', 'Ni', null);
-INSERT INTO text VALUES ('PROFILE_DESCRIPTION', 'es', 'PROFILE', 'Sobre mí', null); --TODO
-INSERT INTO text VALUES ('PROFILE_DESCRIPTION', 'en', 'PROFILE', 'About me', null); --TODO
-INSERT INTO text VALUES ('PROFILE_DESCRIPTION', 'eu', 'PROFILE', 'Niri buruz', null); --TODO
+INSERT INTO text VALUES ('PROFILE_TITLE',            'es', 'PROFILE', 'Yo', null);
+INSERT INTO text VALUES ('PROFILE_TITLE',            'en', 'PROFILE', 'Me', null);
+INSERT INTO text VALUES ('PROFILE_TITLE',            'eu', 'PROFILE', 'Ni', null);
+INSERT INTO text VALUES ('PROFILE_DESCRIPTION',      'es', 'PROFILE', 'Sobre mí', null);
+INSERT INTO text VALUES ('PROFILE_DESCRIPTION',      'en', 'PROFILE', 'About me', null);
+INSERT INTO text VALUES ('PROFILE_DESCRIPTION',      'eu', 'PROFILE', 'Niri buruz', null);
+INSERT INTO text VALUES ('PROFILE_DOWNLOAD_CURRENT', 'es', 'PROFILE', 'Descargar en castellano', null);
+INSERT INTO text VALUES ('PROFILE_DOWNLOAD_CURRENT', 'en', 'PROFILE', 'Download in english', null);
+INSERT INTO text VALUES ('PROFILE_DOWNLOAD_CURRENT', 'eu', 'PROFILE', 'Euzkaraz deskargatu', null);
+INSERT INTO text VALUES ('PROFILE_DOWNLOAD_OTHER', 'es', 'PROFILE', 'Descargar en otros idiomas', null);
+INSERT INTO text VALUES ('PROFILE_DOWNLOAD_OTHER', 'en', 'PROFILE', 'Download in other languages', null);
+INSERT INTO text VALUES ('PROFILE_DOWNLOAD_OTHER', 'eu', 'PROFILE', 'Beste hizkuntzetan deskargatu', null);
 
 
 -- TABLE project_type
@@ -389,4 +395,15 @@ INSERT INTO cv_category VALUES (3, 'CV_CATEGORY_PROJECTS', 'CV_CATEGORY_PROJECTS
 INSERT INTO cv_category VALUES (4, 'CV_CATEGORY_OTHER',    'CV_CATEGORY_OTHER_SUMMARY',    1 , 4);
 
 
+-- To be filled before installing
+INSERT INTO text VALUES ('USER_NAME', 'es', 'USER', '', null);
+INSERT INTO text VALUES ('USER_NAME', 'en', 'USER', '', null);
+INSERT INTO text VALUES ('USER_NAME', 'eu', 'USER', '', null);
+INSERT INTO text VALUES ('USER_TAGLINE', 'es', 'USER', '', null);
+INSERT INTO text VALUES ('USER_TAGLINE', 'en', 'USER', '', null);
+INSERT INTO text VALUES ('USER_TAGLINE', 'eu', 'USER', '', null);
+INSERT INTO text VALUES ('USER_BIO', 'es', 'USER', '', null);
+INSERT INTO text VALUES ('USER_BIO', 'en', 'USER', '', null);
+INSERT INTO text VALUES ('USER_BIO', 'eu', 'USER', '', null);
+
 -- ADD MORE ROWS AS YOU SEE FIT:

+ 5 - 3
www/blog/index.php

@@ -1,12 +1,12 @@
 <?php
     session_start();
     $http_host = $_SERVER["HTTP_HOST"];
-    $doc_root = $_SERVER["DOCUMENT_ROOT"];
+    $doc_root = $_SERVER["DOCUMENT_ROOT"] . "/";
     include $doc_root . "functions.php";
     $proto = get_protocol();
     $con = start_db();
     $server = $proto . $http_host;
-    $lang = select_language();
+    $lang = select_language($con);
     $lserver = $server . "/" . $lang;
     $cur_section = "blog";
     $cur_entry = "";
@@ -190,7 +190,9 @@
 ?>
                         </div> <!-- .entry -->
                     </div> <!-- #right_column -->
-                </div> <!-- #content -->
+                </div> <!-- .content_cell -->
+             </div> <!-- #content_row -->
+         </div> <!-- #content -->
 <?php
         include $doc_root . "footer.php";
         stats($con, $cur_section, $cur_entry);

+ 140 - 100
www/blog/post.php

@@ -1,12 +1,12 @@
 <?php
     session_start();
     $http_host = $_SERVER["HTTP_HOST"];
-    $doc_root = $_SERVER["DOCUMENT_ROOT"];
+    $doc_root = $_SERVER["DOCUMENT_ROOT"] . "/";
     include $doc_root . "functions.php";
     $proto = get_protocol();
     $con = start_db();
     $server = $proto . $http_host;
-    $lang = select_language();
+    $lang = select_language($con);
     $lserver = $server . "/" . $lang;
 
     // Get post data
@@ -103,148 +103,188 @@
 <?php
         include $doc_root . "header.php";
 ?>
-        <div class='section' id='post'>
-            <h3 class='section_title'><?=$title?></h3>
-            <div class='entry'>
+        <div id='content'>
+            <div id='content_row'>
+                <div id='content_cell_post' class='content_cell'>
+                    <div class='section' id='post'>
+                        <h3 class='section_title'><?=$title?></h3>
+                        <div class='entry'>
 <?php
-                if (strlen($image) > 0){
+                            if (strlen($image) > 0){
 ?>
-                    <img id='post_main_image' src='<?=$lserver?>/img/blog/x6/<?=$image?>' alt='<?=$title?>' title='<?=$title?>' />
+                                <img id='post_main_image' src='<?=$lserver?>/img/blog/x6/<?=$image?>' alt='<?=$title?>' title='<?=$title?>' />
 <?php
-                }
+                            }
 ?>
-                <?=$text?>
+                            <?=$text?>
 <?php
-                $q_image = mysqli_query($con, "SELECT image FROM post_image WHERE post = $id ORDER BY idx OFFSET 1");
-                if (mysqli_num_rows($q_image) > 0){
+                            $q_image = mysqli_query($con, "SELECT image FROM post_image WHERE post = $id ORDER BY idx OFFSET 1");
+                            if (mysqli_num_rows($q_image) > 0){
 ?>
-                    <div id='image_reel'>
+                                <div id='image_reel'>
 <?php
-                        while ($r_image = mysqli_fetch_array($q_image)){
+                                    while ($r_image = mysqli_fetch_array($q_image)){
 ?>
-                            <img src='<?=$lserver?>/img/blog/x6/<?=$r_image["image"]?>' alt='<?=$title?>' title='<?=$title?>' />
+                                        <img src='<?=$lserver?>/img/blog/x6/<?=$r_image["image"]?>' alt='<?=$title?>' title='<?=$title?>' />
 <?php
-                        }
+                                    }
 ?>
-                    </div> <!-- #image_reel -->
+                                </div> <!-- #image_reel -->
 <?php
-                }
+                            }
 ?>
-                <hr/>
-                <!-- TODO: Tags and share -->
+                            <hr/>
 <?php
-                    $q_share = mysqli_query($con, "SELECT id FROM share WHERE visible = 1 ORDER BY idx;");
-                    while ($r_share = mysqli_fetch_array($q_share)){
+                            #Comments
+                            if ($r_post["comments"] == 1){
+                                $q_comment = mysqli_query($con, "SELECT id, post, DATE_FORMAT(dtime, '%Y-%m-%dT%T') AS cdate, DATE_FORMAT(dtime,'%b %d, %Y - %H:%i') AS dtime, user, username, text FROM post_comment WHERE post = $id;");
+                                $count = mysqli_num_rows($q_comment);
+                                if ($count == 1){
 ?>
-                        <?=share_link($con, $r_share["id"], $lserver, "$server/blog/$permalink", $lang)?>
+                                    <span class='comment_counter'>1 <?=text($con, "BLOG_COMMENTS_1", $lang)?></span>
 <?php
-                    }
+                                }
+                                else if ($count == 0){
 ?>
-                <hr/>
+                                    <span class='comment_counter'><?=text($con, "BLOG_COMMENTS_0", $lang)?></span>
 <?php
-                #Comments
-                if ($r_post["comments"] == 1){
-                    $q_comment = mysqli_query($con, "SELECT id, post, DATE_FORMAT(dtime, '%Y-%m-%dT%T') AS cdate, DATE_FORMAT(dtime,'%b %d, %Y - %H:%i') AS dtime, user, username, text FROM post_comment WHERE post = $id;");
-                    $count = mysqli_num_rows($q_comment);
-                    if ($count == 1){
+                                }
+                                else{
 ?>
-                        <span class='comment_counter'>1 <?=text($con, "BLOG_COMMENTS_1", $lang)?></span>
+                                    <span class='comment_counter'><?=$count?> <?=text($con, "BLOG_COMMENTS_X", $lang)?></span>
 <?php
-                    }
-                    else if ($count == 0){
+                                }
+                                while ($r_comment = mysqli_fetch_array($q_comment)){
+                                    $user = $r_comment["username"];
+                                    $user_string = $user;
+                                    if (strlen($user) == 0){
+                                        $user = mysqli_fetch_array(mysqli_query($con, "SELECT concat(fname, concat(' ', lname)) AS name FROM user WHERE id = $r_comment[user];"))["name"];
+                                        $user_string = "<span class='comment_user_registered'>$user</span>";
+                                    }
+?>
+                                    <div itemprop='comment' itemscope itemtype='http://schema.org/UserComments' id='comment_<?=$r_comment["id"]?>' class='comment'>
+                                        <h4  class='comment_user'><?=$user_string?></h4>
+                                        <meta itemprop='creator' content='<?=$user?>'>
+                                        <span class='comment_date date'>
+                                            <time itemprop='commentTime' datetime='<?=$r_comment["cdate"]?>'>
+                                            <?=$r_comment["dtime"]?>
+                                        </span>
+                                        <p itemprop='commentText' class='comment_text'><?=$r_comment["text"]?></p>
+                                    </div>
+<?php
+                                }
+                                //Comment form
 ?>
-                        <span class='comment_counter'><?=text($con, "BLOG_COMMENTS_0", $lang)?></span>
+                                <div class='comment' id='comment_new'>
+                                    <textarea id='new_comment_text' name='text' maxlength='1800' onfocus='showCommentIdentification();' placeholder='<?=text($con, "COMMENT_YOUR", $lang)?>'></textarea>
+                                    <div id='identification_form'>
+                                        <br/>
+                                        <input id='new_comment_user' name='user' maxlength='50' type='text' placeholder='<?text($con, "COMMENT_YOUR_NAME", $lang)?>'/>
+                                        <input type='button' value='<?text($con, "COMMENT_PUBLISH", $lang)?>'/>
+                                    </div>
+                                </div>
 <?php
-                    }
-                    else{
+                            }
+                            else{
 ?>
-                        <span class='comment_counter'><?=$count?> <?=text($con, "BLOG_COMMENTS_X", $lang)?></span>
+                                <h4><?text($con, "COMMENT_CLOSED_POST", $lang)?></h4>
 <?php
-                    }
-                    while ($r_comment = mysqli_fetch_array($q_comment)){
-                        $user = $r_comment["username"];
-                        $user_string = $user;
-                        if (strlen($user) == 0){
-                            $user = mysqli_fetch_array(mysqli_query($con, "SELECT concat(fname, concat(' ', lname)) AS name FROM user WHERE id = $r_comment[user];"))["name"];
-                            $user_string = "<span class='comment_user_registered'>$user</span>";
-                        }
+                            }
 ?>
-                        <div itemprop='comment' itemscope itemtype='http://schema.org/UserComments' id='comment_<?=$r_comment["id"]?>' class='comment'>
-                            <h4  class='comment_user'><?=$user_string?></h4>
-                            <meta itemprop='creator' content='<?=$user?>'>
-                            <span class='comment_date date'>
-                                <time itemprop='commentTime' datetime='<?=$r_comment["cdate"]?>'>
-                                <?=$r_comment["dtime"]?>
-                            </span>
-                            <p itemprop='commentText' class='comment_text'><?=$r_comment["text"]?></p>
+                        </div> <!-- .entry -->
+                    </div> <!-- .section -->
+                </div> <!-- .content_cell -->
+                <div id='content_cell_info' class='content_cell'>
+                    <div class='section' id='info'>
+                        <div id="info_date" class='entry'>
+                            <span class='date'><?=format_date($r_post["dtime"], $lang)?></span>
                         </div>
+                        <div id="info_share" class='entry'>
+<?php
+                            $q_share = mysqli_query($con, "SELECT id FROM share WHERE visible = 1 ORDER BY idx;");
+                            while ($r_share = mysqli_fetch_array($q_share)){
+?>
+                                <?=share_link($con, $r_share["id"], $lserver, "$server/blog/$permalink", $lang)?>
 <?php
-                    }
-                    //Comment form
+                            }
 ?>
-                    <div class='comment' id='comment_new'>
-                        <textarea id='new_comment_text' name='text' maxlength='1800' onfocus='showCommentIdentification();' placeholder='<?text($con, "COMMENT_YOUR", $lang)?>'></textarea>
-                        <div id='identification_form'>
-                            <br/>
-                            <input id='new_comment_user' name='user' maxlength='50' type='text' placeholder='<?text($con, "COMMENT_YOUR_NAME", $lang)?>'/>
-                            <input type='button' value='<?text($con, "COMMENT_PUBLISH", $lang)?>'/>
                         </div>
-                    </div>
 <?php
-                }
-                else{
+                        $q_tag = mysqli_query($con, "SELECT tag FROM post_tag WHERE post = $id;");
+                        if (mysqli_num_rows($q_tag) > 0){
 ?>
-                    <h4><?text($con, "COMMENT_CLOSED_POST", $lang)?></h4>
+                            <div id="info_tags" class='entry'>
 <?php
-                }
-
+                                $tag_string = "<span id='tags'>" . text($con, "BLOG_TAGS", $lang) . ": ";
+                                $tag_raw = "";
+                                while ($r_tag = mysqli_fetch_array($q_tag)){
+                                    $tag_string = $tag_string . "<a href='$lserver/blog/search/tag/$r_tag[tag]'>$r_tag[tag]</a>, ";
+                                    $tag_raw = $tag_raw . "$r_tag[tag],";
+                                }
+                                $tag_string = substr($tag_string, 0, strlen($tag_string) - 2);
+                                $tag_string = $tag_string . "</span>";
+                                $tag_raw = substr($tag_raw, 0, strlen($tag_raw) - 1);
 ?>
-                <hr/>
+                                <span class='tags'><?=$tag_string?></span>
+                                <meta itemprop='keywords' content='<?=$tag_raw?>'/>
+                            </div> <!-- #info_tags -->
 <?php
-                // Previous / next
-                $q_prev = mysqli_query($con, "SELECT id, permalink, title FROM post WHERE id <> $id AND dtime <= '$r_post[dtime]' ORDER BY dtime DESC LIMIT 1;");
-                $q_next = mysqli_query($con, "SELECT id, permalink, title FROM post WHERE id <> $id AND dtime >= '$r_post[dtime]' ORDER BY dtime LIMIT 1;");
-                if (mysqli_num_rows($q_prev) > 0 || mysqli_num_rows($q_next) > 0){
+                        } // if (mysqli_num_rows($q_tag) > 0)
 ?>
-                    <table id='prev_next'>
-                        <tr>
-                            <td id='prev'>
+                        
 <?php
-                                if (mysqli_num_rows($q_prev) > 0){
-                                    $r_prev = mysqli_fetch_array($q_prev);
+                        // Previous / next
+                        $q_prev = mysqli_query($con, "SELECT id, permalink, title FROM post WHERE id <> $id AND dtime <= '$r_post[dtime]' ORDER BY dtime DESC LIMIT 1;");
+                        $q_next = mysqli_query($con, "SELECT id, permalink, title FROM post WHERE id <> $id AND dtime >= '$r_post[dtime]' ORDER BY dtime LIMIT 1;");
+                        if (mysqli_num_rows($q_prev) > 0 || mysqli_num_rows($q_next) > 0){
 ?>
-                                    <a href='<?=$lserver?>/blog/<?=$r_prev["permalink"]?>'>
-                                        <span class='info'>Previous post:</span>
-                                        <br/>
-                                        <span class='title'><?=text($con, $r_prev["title"], $lang)?></span>
-                                    </a>
+                            <div id='info_prev_next' class='entry'>
+                                <table id='prev_next'>
+                                    <tr>
+                                        <td id='prev'>
 <?php
-                                }
+                                            if (mysqli_num_rows($q_prev) > 0){
+                                                $r_prev = mysqli_fetch_array($q_prev);
 ?>
-                            </td>
-                            <td id='next'>
+                                                <a href='<?=$lserver?>/blog/<?=$r_prev["permalink"]?>'>
+                                                    <span class='info'>Previous post:</span>
+                                                    <br/>
+                                                    <span class='title'><?=text($con, $r_prev["title"], $lang)?></span>
+                                                </a>
 <?php
-                                if (mysqli_num_rows($q_next) > 0){
-                                    $r_next = mysqli_fetch_array($q_next);
+                                            }
 ?>
-                                    <a href='<?=$lserver?>/blog/<?=$r_next["permalink"]?>'>
-                                        <span class='info'>Next post:</span>
-                                        <br/>
-                                        <span class='title'><?=text($con, $r_next["title"], $lang)?></span>
-                                    </a>
+                                        </td>
+                                        <td id='next'>
 <?php
-                                }
+                                            if (mysqli_num_rows($q_next) > 0){
+                                                $r_next = mysqli_fetch_array($q_next);
 ?>
-                            </td>
-                        </tr>
-                    </table>
+                                                <a href='<?=$lserver?>/blog/<?=$r_next["permalink"]?>'>
+                                                    <span class='info'>Next post:</span>
+                                                    <br/>
+                                                    <span class='title'><?=text($con, $r_next["title"], $lang)?></span>
+                                                </a>
 <?php
-                }
+                                            }
 ?>
-                <hr/>
-                <!-- TODO: Related posts -->
-            </div> <!-- .entry -->
-        </div> <!-- .section -->
+                                        </td>
+                                    </tr>
+                                </table>
+                            </div> <!-- #info_prev_next -->
+<?php
+                        } //  if (mysqli_num_rows($q_prev) > 0 || mysqli_num_rows($q_next) > 0)
+?>
+                        <div id='info_related' class='entry'>
+                            TODO
+                        </div>
+                        <div id='info_all' class='entry'>
+                            TODO
+                        </div>
+                    </div> <!-- #info -->
+                </div> <!-- .content-cell -->
+            </div> <!-- #content-row -->
+        </div> <!-- #content -->
 <?php
         include $doc_root . "footer.php";
         stats($con, $cur_section, $cur_entry);

+ 52 - 14
www/css/blog.css

@@ -1,5 +1,18 @@
 /* Blog main page */
 
+dov#content{
+    display: table;
+}
+
+div#content div#content_row{
+    display: table-row;
+}
+
+div#content div#content_row div.content_cell{
+    padding: 1em;
+    display: table-cell;
+}
+
 div#post_list img.post_list_image{
     float: left;
     background-color: #ffffff;
@@ -27,10 +40,14 @@ div#post_list span.tags{
 
 /* Post view page */
 
-div#post{
-    width: 90%;
-    max-width: 80em;
-    margin: 1em auto 1em auto;
+div#content_cell_post{
+    width: 75%;
+}
+
+div#content_cell_info{
+    width: 25%;
+    min-width: 8em;
+    max-width: 20em;
 }
 
 div#post img#post_main_image{
@@ -51,7 +68,7 @@ div#post div#image_reel{
     padding: 0.5em;
 }
 
-div#project_edit div#image_reel img{
+div#post div#image_reel img{
     vertical-align: middle;
     max-height: 5em;
     max-width: 7em;
@@ -61,32 +78,53 @@ div#project_edit div#image_reel img{
     background-color: #ffffff;
 }
 
-table#prev_next{
-    width: 90%;
-    max-width: 60em;
+div#info table#post_details td{
+    width: 50%;
+    padding: 0.5em 1em 0.5em 1em;
+}
+
+div#info div#info_date{
+    text-align: center;
+    font-style: italic;
+    font-size: 70%;
+    opacity: 80%;
+}
+
+div#info div#info_share{
+    text-align: center;
+}
+
+div#info div#info_tags{
+    font-size: 80%;
+    opacity: 90%;
+}
+
+div#info table#prev_next{
     border-collapse: collapse;
     margin: 1em auto 1em auto;
 }
 
-table#prev_next td{
+div#info table#prev_next td{
     width: 50%;
-    text-align: center
     padding: 0.5em;
 }
 
-table#prev_next td#prev{
+div#info table#prev_next td#prev{
     border-right: 0.03em solid #00440088;
+    margin-right: 0.5em;
     text-align: right;
 }
 
-table#prev_next td#next{
+div#info table#prev_next td#next{
     border-left: 0.03em solid #00440088;
+    margin-left: 0.5em;
+    text-align: left;
 }
 
-table#prev_next td span.info{
+div#info table#prev_next td span.info{
     font-size: 80%;
 }
 
-table#prev_next td span.title{
+div#info table#prev_next td span.title{
     font-weight: bold;
 }

+ 23 - 0
www/css/home.css

@@ -29,6 +29,29 @@ div#content div#content_row div#content_cell_content{
     width: 70%;
 }
 
+/* Profile section */
+div#content_cell_profile img{
+    position: relative;
+    max-width: 8em;
+    max-height: 8em;
+    border-radius: 1.2em;
+    margin: 0.5em;
+    border: 0.1em solid #000000;
+    vertical-align: top;
+    z-index: 2;
+}
+
+div#content_cell_profile span#tagline{
+    display: inline-block;
+    padding-top: 0.5em;
+    margin-left: -1em;
+    padding-left: 1em;
+    padding-right: 0.5em;
+    border-bottom: 0.1em solid #000000;
+    border-bottom-right-radius: 0.3em;
+    z-index: 1;
+}
+
 /* Projects section */
 div#projects_section img.project_list_image{
     float: left;

+ 33 - 2
www/css/project.css

@@ -3,17 +3,20 @@ span.version_type{
     padding: 0.05em;
     border 0.1em solid #444444;
     border-radius: 0.2em;
+    font-size: 85%;
+    font-family: monospace; 
+    font-weight: bold;
 }
 
 
 /* Projects main page */
 div#right_column div#advanced_search{
+    margin: 0.6em 0.1em 0.5em 0.1em;
     transition: all .3s ease-in-out;
     overflow: hidden;
     height: 0;
 }
 
-
 /* Project view page */
 
 div#content{
@@ -38,6 +41,31 @@ div#content_cell_right{
     width: 20%;
 }
 
+div#main_column div#image_reel{
+    text-align: center;
+    width: 80%;
+    margin: 1em auto 1em auto;
+    border: 0.3em solid #000000;
+    border-radius: 0.3em;
+    padding: 0.5em;
+    background-color: #556655;
+    overflow-x: auto;
+}
+
+div#main_column div#image_reel table{
+    margin: 0 auto 0 auto;
+}
+
+div#main_column div#image_reel img{
+    display: inline-block;
+    border: 0.1em solid #000000;
+    border-radius: 0.1em;
+    background-color: #000000;
+    vertical-align: middle;
+    max-height: 6em;
+    max-width: 6em;
+}
+
 div#main_column div.iframe_container{
     width: 100%;
     text-align: center;
@@ -57,6 +85,8 @@ div#right_column{
 
 div#right_column div.url{
     vertical-align: middle;
+    font-size: 70%;
+    margin-bottom: 0.3em;
 }
 
 div#right_column div.url img{
@@ -66,7 +96,8 @@ div#right_column div.url img{
 }
 
 div#right_column img#img_license{
-    max-height: 1.3em;
+    max-height: 2.3em;
+    text-align: center;
 }
 
 div#license{

+ 5 - 5
www/css/ui.css

@@ -196,7 +196,7 @@ div#footer hr#footer_separator{
 /* Left area of the footer */
 div#footer td#footer_left{
     width: 33%;
-    text-align: left;
+    text-align: center;
 }
 
 /* Middle area of the footer */
@@ -327,8 +327,8 @@ div.unavailable{
 
 /* Icons for sharing page in a social network */
 img.social_icon{
-    width: 4.286em;
-    height: 4.286em;
+    width: 3em;
+    height: 3em;
 }
 
 /* Elements that should have the cursor as pointer */
@@ -567,8 +567,8 @@ a.share img.share{
     display: inline-block;
     vertical-align: top;
     overflow: hidden;
-    width: 2em;
-    height: 2em;
+    width: 1.6em;
+    height: 1.6em;
     border: 0.1em solid #003300;
     border-radius: 2em;
     box-shadow: 0 0 0.3em #005500;

+ 2 - 2
www/error/403.php

@@ -1,12 +1,12 @@
 <?php
     session_start();
     $http_host = $_SERVER["HTTP_HOST"];
-    $doc_root = $_SERVER["DOCUMENT_ROOT"]; 
+    $doc_root = $_SERVER["DOCUMENT_ROOT"] . "/";
     include $doc_root . "functions.php";
     $proto = get_protocol();
     $con = start_db();
     $server = $proto . $http_host;
-    $lang = select_language();
+    $lang = select_language($con);
     $lserver = $server . "/" . $lang;
     $cur_section = "error";
     $cur_entry = "403";

+ 2 - 2
www/error/404.php

@@ -1,12 +1,12 @@
 <?php
     session_start();
     $http_host = $_SERVER["HTTP_HOST"];
-    $doc_root = $_SERVER["DOCUMENT_ROOT"]; 
+    $doc_root = $_SERVER["DOCUMENT_ROOT"] . "/";
     include $doc_root . "functions.php";
     $proto = get_protocol();
     $con = start_db();
     $server = $proto . $http_host;
-    $lang = select_language();
+    $lang = select_language($con);
     $lserver = $server . "/" . $lang;
     $cur_section = "error";
     $cur_entry = "404";

+ 2 - 2
www/error/500.php

@@ -1,12 +1,12 @@
 <?php
     session_start();
     $http_host = $_SERVER["HTTP_HOST"];
-    $doc_root = $_SERVER["DOCUMENT_ROOT"];
+    $doc_root = $_SERVER["DOCUMENT_ROOT"] . "/";
     include $doc_root . "functions.php";
     $proto = get_protocol();
     $con = start_db();
     $server = $proto . $http_host;
-    $lang = select_language();
+    $lang = select_language($con);
     $lserver = $server . "/" . $lang;
     $cur_section = "error";
     $cur_entry = "500";

+ 16 - 9
www/functions.php

@@ -62,21 +62,29 @@
      * be displayed inf the page. Several methods are    *
      * used: cookie detection, and browser language      *
      * preferences.                                      *
+     * @params:                                          *
+     *    con (Mysql connection): Connection handler.    *
      * @return: (string): Language code.                 *
      *****************************************************/
-    // TODO: Redo using database
-    function select_language(){
+    function select_language($con){
+
+        // Get available languages from db
+        $available_languages = array();
+        $q_lang = mysqli_query($con, "SELECT code FROM lang WHERE active = 1;");
+        while ($r_lang = mysqli_fetch_array($q_lang)){
+            array_push($available_languages, $r_lang["code"]);
+        }
 
         // Check for language in uri
-        $lang = substr($_SERVER['REQUEST_URI'], 1, 2);
-        if ($lang == "es" || $lang == "en" || $lang == "eu"){
+        $lang = substr($_SERVER["REQUEST_URI"], 1, 2);
+        if (in_array($lang, $available_languages)){
             return $lang;
         }
         else{
             // Language is not in url. Find it out and redirect
             // Is passed on the URL?
             $lang = $_GET["lang"];
-            if ($lang == "es" || $lang == "en" || $lang == "eu"){
+            if (in_array($lang, $available_languages)){
                 header("Location: " . get_protocol() . $_SERVER["HTTP_HOST"] . "/" . $lang . $_SERVER["REQUEST_URI"]);
                 return $lang;
             }
@@ -85,7 +93,7 @@
             header("Cache-control: private");
             if (isSet($_COOKIE["lang"])){
                 $lang = $_COOKIE["lang"];
-                if ($lang == "es" || $lang == "en" || $lang == "eu"){
+                if (in_array($lang, $available_languages)){
                     header("Location: " . get_protocol() . $_SERVER["HTTP_HOST"] . "/" . $lang . $_SERVER["REQUEST_URI"]);
                     return $lang;
                 }
@@ -93,17 +101,16 @@
 
             //If no cookie, select from client browser preferences.
             else{
-                $available_languages = array("en", "eu", "es");
                 $langs = prefered_language($available_languages, $_SERVER["HTTP_ACCEPT_LANGUAGE"]);
                 $lang = $langs[0];
-                if ($lang == "es" || $lang == "en" || $lang == "eu"){
+                if (in_array($lang, $available_languages)){
                     header("Location: " . get_protocol() . $_SERVER["HTTP_HOST"] . "/" . $lang . $_SERVER["REQUEST_URI"]);
                     return $lang;
                 }
             }
 
             // If no method was succesfull, default language
-            $lang = "es";
+            $lang = $available_languages[0];
             header("Location: " . get_protocol() . $_SERVER["HTTP_HOST"] . "/" . $lang . $_SERVER["REQUEST_URI"]);
             return $lang;
         }

+ 2 - 2
www/help/index.php

@@ -1,12 +1,12 @@
 <?php
     session_start();
     $http_host = $_SERVER["HTTP_HOST"];
-    $doc_root = $_SERVER["DOCUMENT_ROOT"]; 
+    $doc_root = $_SERVER["DOCUMENT_ROOT"] . "/";
     include $doc_root . "functions.php";
     $proto = get_protocol();
     $con = start_db();
     $server = $proto . $http_host;
-    $lang = select_language();
+    $lang = select_language($con);
     $lserver = $server . "/" . $lang;
     $cur_section = "";
     $cur_entry = "";

+ 5 - 4
www/index.php

@@ -1,12 +1,12 @@
 <?php
     session_start();
     $http_host = $_SERVER["HTTP_HOST"];
-    $doc_root = $_SERVER["DOCUMENT_ROOT"]; 
+    $doc_root = $_SERVER["DOCUMENT_ROOT"] . "/";
     include $doc_root . "functions.php";
     $proto = get_protocol();
     $con = start_db();
     $server = $proto . $http_host;
-    $lang = select_language();
+    $lang = select_language($con);
     $lserver = $server . "/" . $lang;
     $cur_section = "";
     $cur_entry = "";
@@ -71,13 +71,14 @@
                     <div class='section'>
                         <h3 class='section_title'><?=text($con, "USER_NAME", $lang);?></h3>
                         <div class='entry'>
-                            <img id='profile' src='<?=$lserver?>/img/profile/x16/preview/0.png' alt='<?=text($con, "USER_NAME", $lang);?>' title='<?=text($con, "USER_NAME", $lang);?>' />
+                            <img id='profile' src='<?=$lserver?>/img/profile/x6/0.png' alt='<?=text($con, "USER_NAME", $lang);?>' title='<?=text($con, "USER_NAME", $lang);?>' />
+                            <span id='tagline'><?=text($con, "USER_TAGLINE", $lang);?></span>
                         </div> <!-- .entry -->
                     </div> <!-- .section -->
                 </div> <!-- #content_cell_profile -->
                 <div class='content_cell' id='content_cell_content'>
                     <div class='section' id='projects_section'>
-                        <h3 class='section_title'><?=text($con, 'INDEX_LATEST_PROJECTS', $lang)?></h3>
+                        <h3 class='section_title'><?=text($con, "INDEX_LATEST_PROJECTS", $lang)?></h3>
 <?php
                         $q_project = mysqli_query($con, "SELECT id, permalink, type, title, logo, header, license, (SELECT dtime FROM project_version WHERE project = p.id AND visible = 1 ORDER BY dtime desc LIMIT 1) AS modified FROM project p WHERE visible = 1 ORDER BY modified DESC LIMIT 3;");
                         while ($r_project = mysqli_fetch_array($q_project)){

+ 4 - 4
www/profile/index.php

@@ -1,12 +1,12 @@
 <?php
     session_start();
     $http_host = $_SERVER["HTTP_HOST"];
-    $doc_root = $_SERVER["DOCUMENT_ROOT"];
+    $doc_root = $_SERVER["DOCUMENT_ROOT"] . "/";
     include $doc_root . "functions.php";
     $proto = get_protocol();
     $con = start_db();
     $server = $proto . $http_host;
-    $lang = select_language();
+    $lang = select_language($con);
     $lserver = $server . "/" . $lang;
     $cur_section = "me";
     $cur_entry = "";
@@ -82,10 +82,10 @@
                 <h3 class='section_title'><?=text($con, "PROFILE_CV", $lang);?></h3>
                 <ul class='cv_download'>
                     <li>
-                        <a target='_blank' href='TODO' title='<?=text($con, "USER_NAME", $lang);?> - <?=text($con, "PROFILE_CV", $lang);?>'>TR#Download in currlang</a>
+                        <a target='_blank' href='TODO' title='<?=text($con, "USER_NAME", $lang);?> - <?=text($con, "PROFILE_CV", $lang);?>'><?=text($con, "PROFILE_DOWNLOAD_CURRENT", $lang);?></a>
                     </li>
                     <li>
-                        <a href='TODO' title='<?=text($con, "PROFILE_CV_DOWNLOAD_LANG", $lang);?>'><?=text($con, "PROFILE_CV_DOWNLOAD_LANG", $lang);?></a>
+                        <a href='TODO' title='<?=text($con, "PROFILE_CV_DOWNLOAD_LANG", $lang);?>'><?=text($con, "PROFILE_DOWNLOAD_OTHER", $lang);?></a>
                     </li>
                 </ul>
 <?php

+ 3 - 3
www/project/index.php

@@ -1,12 +1,12 @@
 <?php
     session_start();
     $http_host = $_SERVER["HTTP_HOST"];
-    $doc_root = $_SERVER["DOCUMENT_ROOT"];
+    $doc_root = $_SERVER["DOCUMENT_ROOT"] . "/";
     include $doc_root . "functions.php";
     $proto = get_protocol();
     $con = start_db();
     $server = $proto . $http_host;
-    $lang = select_language();
+    $lang = select_language($con);
     $lserver = $server . "/" . $lang;
     $cur_section = "project";
     $cur_entry = "";
@@ -100,7 +100,7 @@
                 </div> <!-- #content_cell_main -->
                 <div class='content_cell'  id='content_cell_right'>
                     <div class='section' id='right_column'>
-                        <h3 class='section_title'>TR#Search projects</h3>
+                        <h3 class='section_title'><?=text($con, "PROJECT_SEARCH", $lang)?></h3>
                         <div class='entry'>
                             <input type='text' placeholder='<?=text($con, "PROJECT_SEARCH", $lang)?>' name='text'/>
                             <input type='hidden' id='advanced_search_indicator' value='0'/>

+ 22 - 3
www/project/project.php

@@ -1,12 +1,12 @@
 <?php
     session_start();
     $http_host = $_SERVER["HTTP_HOST"];
-    $doc_root = $_SERVER["DOCUMENT_ROOT"];
+    $doc_root = $_SERVER["DOCUMENT_ROOT"] . "/";
     include $doc_root . "functions.php";
     $proto = get_protocol();
     $con = start_db();
     $server = $proto . $http_host;
-    $lang = select_language();
+    $lang = select_language($con);
     $lserver = $server . "/" . $lang;
 
     // Get project data
@@ -117,8 +117,27 @@
                         <div class='entry'>
                             <h4><?=$summary?></h4>
                             <?=text($con, $r_project["text"], $lang)?>
-                            <!-- TODO: Images -->
 <?php
+                            $q_image = mysqli_query($con, "SELECT * FROM project_image WHERE project = $id ORDER BY idx");
+                            if (mysqli_num_rows($q_image) > 0){
+?>
+                                <div id='image_reel'>
+                                    <table>
+                                        <tr>
+<?php
+                                            while ($r_image = mysqli_fetch_array($q_image)){
+?>
+                                                <td>
+                                                    <img title='<?=$title?>' alt='<?=$title?>' src='<?=$lserver?>/img/project/x4/<?=$r_image["image"]?>'/>
+                                                </td>
+<?php
+                                            } // while ($r_image = mysqli_fetch_array($q_image))
+?>
+                                        </tr>
+                                    </table>
+                                </div> <!-- #image_reel -->
+<?php
+                            } // if (mysqli_num_rows($q_image) > 0)
                             $q_embed = mysqli_query($con, "SELECT * FROM project_url WHERE type = 'E' AND project = $id;");
                             while ($r_embed = mysqli_fetch_array($q_embed)){
 ?>

+ 2 - 2
www/rss.php

@@ -2,12 +2,12 @@
     header('Content-type: application/xml');
     session_start();
     $http_host = $_SERVER["HTTP_HOST"];
-    $doc_root = $_SERVER["DOCUMENT_ROOT"];
+    $doc_root = $_SERVER["DOCUMENT_ROOT"] . "/";
     include $doc_root . "functions.php";
     $proto = get_protocol();
     $con = start_db();
     $server = $proto . $http_host;
-    $lang = select_language();
+    $lang = select_language($con);
     $lserver = $server . "/" . $lang;
     $cur_section = "";
     $cur_entry = "";