aboutsummaryrefslogtreecommitdiffstats
path: root/index.php
blob: eb4b008e79252b3e8282146a72f3858db7e3e13d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
<?php
/**
 * hugs.mageia.org - a place where to send the grumpy ones.
 *
 * Got an argument (or approaching) with someone on IRC or by email?
 * Things get tense? Be cool! And be the first to give this virtual hug!
 *
 * PHP version 5
 *
 * @category  Mageia_Web_Sites
 * @package   Hugs.mageia.org
 * @author    Romain d'Alverny  <rda@mageia.org>
 * @copyright 2011 Romain d'Alverny
 * @license   MIT License, see LICENSE.txt
 * @link      http://svnweb.mageia.org/svn/web/hugs/
*/

$app_root = realpath(dirname(__FILE__));
$images   = glob(sprintf('%s/var/hugs/*.jpg', $app_root));

if (count($images) > 0) {

    $img_tmpl = '<img id="hi" src="%s" alt="Free Hugs!" title="Come get a hug!">';
    $img      = $images[array_rand($images)];
    $out      = sprintf($img_tmpl,
        str_replace($app_root, '', $img));

    // TIP use jhead -ce photo.jpg to edit photo COMMENT field
    $exif = exif_read_data($img, null, true);
    if (!is_null($exif)
        && isset($exif['COMMENT'])) {

        $out .= sprintf('<figcaption id="hicomment">%s</figcaption>',
            nl2br($exif['COMMENT'][0]));
    }
    $out = sprintf('<figure>%s</figure>', $out);

} else {

    $out = '<div id="hi"><p>404 Hug Not Found :(</p></div>';
}

?><!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
    <meta charset="utf-8">
    <title>Free Hugs! @ Mageia</title>
    <meta name="description" content="Be kind. Enough with bugs. Hug someone!">
    <meta name="keywords" content="mageia, linux, distribution, community,
        fun, friendly, happy, hugs, no bug, calins">
    <meta name="robots" content="noindex, follow">
    <link rel="canonical" href="http://hugs.mageia.org/">
    <link rel="icon" type="image/png" href="/static/favicon.png">
    <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Pacifico">
    <style>
    html { margin: 0; padding: 0; background: #fff; }
    body { margin: 0 auto; padding: 20px 40px; font-size: 100%; }
    h1, h2 { font-family: Pacifico, "Times New Roman", serif; font-weight: normal;
        font-effect: outline; }
    h1 { margin: 0 0 1em 0; font-size: 260%; }
    h2 { margin-top: 2em; font-size: 180%; }
    a, a:link { color: #2383c2; text-decoration: none; }
    a:hover { text-decoration: underline; }
    ul { margin-bottom: 4em; }
    li { margin-bottom: 0.6em; }
    img { border: 0; }
    figure, figcaption { display: block; margin: 0; padding: 0; }
    #hi { margin: 10px 0 0 0; width: 350px;
        -webkit-box-shadow: 0 0 40px #555; -moz-box-shadow: 0 0 40px #555;
        box-shadow: 0 0 40px #555;
        -webkit-transition: all 1.5s ease; -moz-transition: all 1.5s ease;
        transition: all 1.5s ease;
        border: 4px solid #fff;
        -webkit-border-radius: 3px; -moz-border-radius: 3px; border-radius: 3px;
    }
    #hi.flipped { -webkit-transform: rotateY(180deg);
        -moz-transform: rotateY(180deg);
    }
    #hi p { padding: 2em; }
    p { font-family: "Trebuchet MS"; font-size: 90%; color: #222; }
    section { float: left; margin-left: 20px; }
    aside { float: left; text-align: left; margin-left: 60px; width: 350px;
        display: block; }
    article { display: block; width: auto; margin: auto; }
    footer { clear: both; color: #aaa; margin-top: 3em; }
    footer p { color: #aaa; }
    footer a { color: #aaa; text-decoration: none;  }
    p.yours { font-size: 70%; color: #aaa; font-family: Verdana; }
    p.yours a { color: #aaa; }
    div.clear { clear: both; }
    </style>
</head>
<body>
    <article>
        <section><?php echo $out; ?></section>
        <aside>
            <h1>Need a hug?</h1>
            
            <p>Maybe you wanted to visit <a href="http://bugs.mageia.org/"
                    rel="nofollow">bugs.mageia.org</a> (with a b!) actually?</p>
            <p>Or to check our <a href="http://mageia.org/en/about/code-of-conduct/"
                rel="nofollow">code of conduct</a>;
                just some advice to help collaboration within our project.</p>
            <p>Or to learn more about <a href="http://mageia.org/">Mageia</a>!
                We're nice fellows <!-- <a href="http://bonjourmageia.fr/"
                    rel="nofollow"></a>-->
                and we gather to build a Linux-based operating system.
                It's fun, it's great, <a href="http://mageia.org/">have a look</a>
                and join us!</p>
            <p style="text-align: center;"><a href="http://mageia.org/">
                <img src="static/mageia-logo-small.png"
                    style="width: 200px;"
                    alt="Mageia"></a></p>

            <h2>Free hugs?</h2>
            <p>Yes! A hug definitely will make you feel better.
                It's free and it's great!</p>

            <p>Check the <a href="http://www.freehugscampaign.org/">Free
                Hugs Campaign</a> out, and save the date: next International
                Free Hugs Day is on <time datetime="2011-07-02">July,
                    2<sup>nd</sup> 2011</time>.</p>
        </aside>
        <div class="clear"></div>
    </article>
    <footer>
        <p><a href="http://mageia.org/">mageia.org</a></p>
    </footer>
</body>
</html>