From 1218237bc487eaf948253928e244ec5807bd4266 Mon Sep 17 00:00:00 2001 From: Gabriel Dunne Date: Thu, 10 Nov 2011 17:51:47 +0530 Subject: [PATCH] comments --- .../cat_2/hello_comments/1320927226.json | 1 + .../cat_2/hello_comments/1320927283.json | 1 + .../cat_2/hello_comments/1320927295.json | 1 + content/.DS_Store | Bin 0 -> 6148 bytes content/2011/09/arrive | 11 - content/2011/09/beg | 9 - content/2011/09/habitat | 8 - content/2011/09/sriyantra | 55 ---- content/2011/10/alphabet | 18 -- content/2011/10/dreams | 4 - content/2011/10/dushera | 7 - content/2011/10/islands | 7 - content/2011/10/overlords | 7 - content/2011/10/smog | 5 - content/2011/10/water_is_life | 8 - content/categori1/.DS_Store | Bin 0 -> 6148 bytes content/categori1/cat_2/hello_comments | 6 + content/config | 2 - content/hello_world | 5 + css/comments.css | 22 ++ css/style.css | 3 +- lib/comments.php | 49 ++++ lib/data.php | 26 +- lib/init.php | 20 +- lib/recaptchalib.php | 277 ++++++++++++++++++ pages/about | 4 +- pages/links | 34 --- templates/comments.html.tpl | 30 ++ templates/entry.html.tpl | 19 +- templates/head-inc.html.tpl | 1 + 30 files changed, 448 insertions(+), 192 deletions(-) create mode 100644 comments/categori1/cat_2/hello_comments/1320927226.json create mode 100644 comments/categori1/cat_2/hello_comments/1320927283.json create mode 100644 comments/categori1/cat_2/hello_comments/1320927295.json create mode 100644 content/.DS_Store delete mode 100644 content/2011/09/arrive delete mode 100644 content/2011/09/beg delete mode 100644 content/2011/09/habitat delete mode 100644 content/2011/09/sriyantra delete mode 100644 content/2011/10/alphabet delete mode 100644 content/2011/10/dreams delete mode 100644 content/2011/10/dushera delete mode 100644 content/2011/10/islands delete mode 100644 content/2011/10/overlords delete mode 100644 content/2011/10/smog delete mode 100644 content/2011/10/water_is_life create mode 100644 content/categori1/.DS_Store create mode 100644 content/categori1/cat_2/hello_comments delete mode 100644 content/config create mode 100644 content/hello_world create mode 100644 css/comments.css create mode 100644 lib/comments.php create mode 100644 lib/recaptchalib.php delete mode 100644 pages/links create mode 100644 templates/comments.html.tpl diff --git a/comments/categori1/cat_2/hello_comments/1320927226.json b/comments/categori1/cat_2/hello_comments/1320927226.json new file mode 100644 index 0000000..4278222 --- /dev/null +++ b/comments/categori1/cat_2/hello_comments/1320927226.json @@ -0,0 +1 @@ +{"name":"","www":"","timestamp":"1320927226","comment":"this is a test comment"} \ No newline at end of file diff --git a/comments/categori1/cat_2/hello_comments/1320927283.json b/comments/categori1/cat_2/hello_comments/1320927283.json new file mode 100644 index 0000000..ec6d30b --- /dev/null +++ b/comments/categori1/cat_2/hello_comments/1320927283.json @@ -0,0 +1 @@ +{"name":"test","www":null,"timestamp":"1320927283","comment":"what a test"} \ No newline at end of file diff --git a/comments/categori1/cat_2/hello_comments/1320927295.json b/comments/categori1/cat_2/hello_comments/1320927295.json new file mode 100644 index 0000000..5e4c9f2 --- /dev/null +++ b/comments/categori1/cat_2/hello_comments/1320927295.json @@ -0,0 +1 @@ +{"name":"anonymous","www":null,"timestamp":"1320927295","comment":"test test test test test "} \ No newline at end of file diff --git a/content/.DS_Store b/content/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..16b6615e61e3baf4a802e09d4ca7e26ade6f824f GIT binary patch literal 6148 zcmeHK%}T>S5T3PF6I94W=yCB}q_tvu@DM@;k3tJQSka^@HV~T9r1Vg$!DsM2d>fy~ zncWRo40scuY ziTjREzI=Z=3*sa|?|U$dqcm$YKEzI?y1Tb;*|v2!97NMFS$fH08m70s zNwVxk;W+T;cS_IvY>|5YTzPK%Y=R!8_md<>eQ2TwQJ78co!V-3(Q4M^S-Z2Y%T>GG zsLS(KXT7#9%XZ$Z%RZAetyX{ivkH(a%8Z8S5!(03e!;>;Mzr65zfdAFayj0 zGq8OOn6tn-*uK)aVrGCD_<;f1A0#$H*I=$uZ5`Or^_l!tLK4*JEkP&^x(0KN=s^)W z6;Y=O^TZH39qrP@xdwBMIvs>s8Rs!87mpXAR!6&3;UHX%+%p5rz$OC~J#^^&zrtUp z^pU@r!XsvY8Te-mh-$aj^{^;&wtg#*&RU7>0UHU$<)omXzHte_0qr9-<xyM WbB#0$*;P6sUj!5(+%W^cz`!T4YDxD1 literal 0 HcmV?d00001 diff --git a/content/2011/09/arrive b/content/2011/09/arrive deleted file mode 100644 index 7b269eb..0000000 --- a/content/2011/09/arrive +++ /dev/null @@ -1,11 +0,0 @@ -date = Sept 22 2011, 22:50 -title = arrival --- - Bkng Meals/ Seat/ - Day Date Flight Status Class City Time Other Cabin - --- ----- --------------- ------ ----- ---------------- ------ ------ ------- - Thu 22SEP KLM ROYAL OK T LV SAN FRANCISCO 200P M ** - DUTCH AIRLINES 606 AR AMSTERDAM 915A# - - Fri 23SEP KLM ROYAL OK T LV AMSTERDAM 1120A M ** - DUTCH AIRLINES 871 AR DELHI 1050P diff --git a/content/2011/09/beg b/content/2011/09/beg deleted file mode 100644 index 5056e40..0000000 --- a/content/2011/09/beg +++ /dev/null @@ -1,9 +0,0 @@ -title = beg -date = Oct 16 2011, 15:34:03; IST --- - - - - - -Tapping on the windows, the begger kids have perfected their methods. They move their mouths into a sad frown, they use their eyes, they tap on the windows. \ No newline at end of file diff --git a/content/2011/09/habitat b/content/2011/09/habitat deleted file mode 100644 index ff3e862..0000000 --- a/content/2011/09/habitat +++ /dev/null @@ -1,8 +0,0 @@ -title = habitat -date = 2011-9-27 --- - - - - -view from vishal's room onto the up and coming Guargon area, outside Delhi diff --git a/content/2011/09/sriyantra b/content/2011/09/sriyantra deleted file mode 100644 index e2fc30a..0000000 --- a/content/2011/09/sriyantra +++ /dev/null @@ -1,55 +0,0 @@ -date = 2011-09-28 -title = sri yantra --- - - - - -Shri Yantra - - -Kali → goddess of eternal energy. "She who destroys all". The goddess of time and change. The ultimate reality. - - -> The Sri Chakra or Shri Yantra of Tripura Sundari is a yantra or mandala formed by nine interlocking triangles surrounding the bindu. Four of these triangles are orientated upright representing Shiva or the Masculine. Five of these triangles are inverted triangles represent Shakti or the Feminine. Because it is composed of nine triangles, it is also known as the Navayoni Chakra.[1] - - -sri yantra guides - -> Together the nine triangles are interlaced in such a way as to form 43 smaller triangles in a web symbolic of the entire cosmos or a womb symbolic of creation. Together they express Advaita or non-duality. This is surrounded by a lotus of eight petals, a lotus of sixteen petals, and an earth square resembling a temple with four doors.[1] - -> The Shri Chakra is also known as the nava chakra because it can also be seen as having nine levels. Each level corresponds to a mudra, a yogini, and a specific form of the deity Tripura Sundari along with her mantra. These levels starting from the outside or bottom layer are:[1] - -1. Trailokya Mohana or Bhupara, a square of three lines with four portals -2. Sarvasa Paripuraka, a sixteen-petal lotus -3. Sarva Sankshobahana, an eight-petal lotus -4. Sarva Saubhagyadayaka, composed of fourteen small triangles -5. Sarvarthasadhaka, composed of ten small triangles -6. Sarva Rakshakara, composed of ten small triangles -7. Sarva Rohahara, composed of eight small triangles -8. Sarva siddhi prada, composed of 1 small triangle -9. Sarvanandamaya, composed of a point or bindu - -> The Sri Chakra (called the Shri Yantra) is the symbol of Hindu tantra, which is based on the Hindu philosophy of Kashmir Shaivism. - - -Vijnanamaya — spiritual body composed of prayer and fortified by meditation - -Anandamaya — body of the joy of union with god - -> —he who realizes the truth of the body can then come to tknow the truth of the universe - -Payodhi-jala — primordial waters, force of the manifested universe - -> A fourth dimension of aesthetic sense, where all is in ourselves, ourselves in all —Aurobindo - -Tantra: analogies between the individual and the cosmos, and the life forces which govern them - -> reflections of what is taking place in real life and reminding thought visions of our true nature - - - - - - - diff --git a/content/2011/10/alphabet b/content/2011/10/alphabet deleted file mode 100644 index dc9d78e..0000000 --- a/content/2011/10/alphabet +++ /dev/null @@ -1,18 +0,0 @@ -date = 2011-10-06 -title = alphabet --- - -consanants - - -


- -vowels - - -


- -numbers - - -


\ No newline at end of file diff --git a/content/2011/10/dreams b/content/2011/10/dreams deleted file mode 100644 index 62e1f08..0000000 --- a/content/2011/10/dreams +++ /dev/null @@ -1,4 +0,0 @@ -title = dreams -date = Tue, Oct 4 2011, 12:46:34; IST --- -My dreams have been incredibly vivid. probably due to the heat. sleeping at odd hours. been working in the studio most of the day at Vishal's house, so I haven't been going out as much as I would like. It's also incredibly hot outside, averaging about 36 degrees C, which is about 95 F. \ No newline at end of file diff --git a/content/2011/10/dushera b/content/2011/10/dushera deleted file mode 100644 index 73e05b2..0000000 --- a/content/2011/10/dushera +++ /dev/null @@ -1,7 +0,0 @@ -title = dushera -date = Sun, Oct 06 2011, 06:00:16 PM; IST -draft = true --- - - -dushera \ No newline at end of file diff --git a/content/2011/10/islands b/content/2011/10/islands deleted file mode 100644 index a762a2e..0000000 --- a/content/2011/10/islands +++ /dev/null @@ -1,7 +0,0 @@ -title = islands -date = Wed, Oct 05 2011, 03:53:55 PM; IST --- - -> Imagine that every man's mind is an island, surrounded by ocean. Each seems isolated, yet in reality all are linked by the bedrock from which they spring. If the ocean were to vanish, that would be the end of the islands. They would all be part of one continent, but their individuality would be gone. - -> —"The Inspector" Overlord. Childhoods End, Arthur C. Clark. p.176 diff --git a/content/2011/10/overlords b/content/2011/10/overlords deleted file mode 100644 index 3ba9abb..0000000 --- a/content/2011/10/overlords +++ /dev/null @@ -1,7 +0,0 @@ -title = childhoods end -date = Wed, Oct 05 2011, 03:17:57 PM; IST --- - -> The case of India is particularly instructive. The main difference between us and the British in India was that they had no real motives for going there—no conscious objectives, that is, except such trivial and temporary ones as trade or hostility to other European powers. They found themselves possessors of an empire before they knew what to do with it, and were never really happy until they had got rid of it again. - -> —"The Inspector" Overlord. Childhoods End, Arthur C. Clark. p.161 diff --git a/content/2011/10/smog b/content/2011/10/smog deleted file mode 100644 index b5586f1..0000000 --- a/content/2011/10/smog +++ /dev/null @@ -1,5 +0,0 @@ -title = sun -date = Sun, Oct 23 2011, 06:06:33 PM; IST --- - - diff --git a/content/2011/10/water_is_life b/content/2011/10/water_is_life deleted file mode 100644 index d60a727..0000000 --- a/content/2011/10/water_is_life +++ /dev/null @@ -1,8 +0,0 @@ -title = water_is_life -date = Sun, Oct 23 2011, 06:04:38 PM; IST -draft = true --- - - - -delapitated truck left near the Quotar Minar in Dadabari. Painting on the front bumper reads "Water is Life" in Hindi. \ No newline at end of file diff --git a/content/categori1/.DS_Store b/content/categori1/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..bcb3407b4e683c96f02e9102345b6202a1cc9022 GIT binary patch literal 6148 zcmeH~J&pn~427Q;kXE9h+%gRZU{4SsH~|OXw?v}Y-9AU>*>S@_jYg|y$$7C8&(Bv( z#sF;ncUb`o0H1VMEPWW5F`nU!BYv^R_vPn&J>70sPvax^dO+tj9@leOA_5{H0wN#+ zA}}HXaftK$pO5I7^e7@A0^=ay--kkXt*NbRd^$Kp3qYMR9maX|64c@eYE5ljnW0&B z50<4CZHVWioLX{UO>JF!IV_tG%R8HQF*NJtu)=_5HAI65h`@lrq{jiOXb=6^m?8@WY*`6PL1sx9)1EC_)+{t5950A3ALuSuFTN%BM=xg Jh`?J3+yO<~69E7K literal 0 HcmV?d00001 diff --git a/content/categori1/cat_2/hello_comments b/content/categori1/cat_2/hello_comments new file mode 100644 index 0000000..b395a5d --- /dev/null +++ b/content/categori1/cat_2/hello_comments @@ -0,0 +1,6 @@ + +date = today +comments = 1 +-- + +Hello again. Leave some comments. \ No newline at end of file diff --git a/content/config b/content/config deleted file mode 100644 index 759fb8f..0000000 --- a/content/config +++ /dev/null @@ -1,2 +0,0 @@ -template = index -title = delhi 2011 \ No newline at end of file diff --git a/content/hello_world b/content/hello_world new file mode 100644 index 0000000..24e2111 --- /dev/null +++ b/content/hello_world @@ -0,0 +1,5 @@ +title = hello world +date = nov 10 2011 +-- + +Hello world. \ No newline at end of file diff --git a/css/comments.css b/css/comments.css new file mode 100644 index 0000000..d517577 --- /dev/null +++ b/css/comments.css @@ -0,0 +1,22 @@ +/* comments.css */ + +.comments { + margin-top:50px; +} +.comments textarea { + width:315px; + height:130px; +} +.comments .error { + color:#900; +} +.comments .comment { + margin:20px 0; + font-style:italic; +} +.comments .comment .name { + color:#aaa; +} +.comments .comment_form { + margin-top:40px; +} \ No newline at end of file diff --git a/css/style.css b/css/style.css index f10980a..a7d734c 100644 --- a/css/style.css +++ b/css/style.css @@ -53,7 +53,7 @@ pre { } #content { - padding:50px; + padding:50px 50px 0 50px; background:#fff; } #nextprev { @@ -69,6 +69,7 @@ pre { .entry { + margin-bottom:80px; } .entry h2 { margin-bottom:20px; diff --git a/lib/comments.php b/lib/comments.php new file mode 100644 index 0000000..1b17db3 --- /dev/null +++ b/lib/comments.php @@ -0,0 +1,49 @@ +is_valid) { + + $name = !empty($_POST['name']) ? $_POST['name'] : 'anon'; + $www = !empty($_POST['www']) ? $_POST['www'] : null; + $comment = !empty($_POST['comment']) ? $_POST['comment'] : null; + + if (!$comment) { + + echo '
You must enter a comment.
'; + + } else { + + $comment = json_encode(array( + 'name' => $name, + 'www' => $www, + 'timestamp' => date('U'), + 'comment' => $comment)); + file_put_contents($entry['comments_loc'] . date('U') . '.json', $comment); + + } + + } else { + # set the error code so that we can display it + $error = $resp->error; + } +} + +echo recaptcha_get_html($captcha_publickey, $error); diff --git a/lib/data.php b/lib/data.php index 4ec23d3..c10e4da 100644 --- a/lib/data.php +++ b/lib/data.php @@ -25,6 +25,7 @@ function get_entries( $path = "", $args = array()) $entries = array(); foreach ($dir_iterator as $file => $info) { + // mime type // $finfo = finfo_open(FILEINFO_MIME_TYPE); // $ftype = finfo_file($finfo, join(array($info->getPath(), $info->getFilename()), DIRECTORY_SEPARATOR)); // finfo_close($finfo); @@ -143,21 +144,36 @@ function parse_entry($fileInfo, $page = false) } $f = array(); + + $cat = clean_slashes(str_replace(LOCAL_ROOT . CONTENT_DIR, "", $fileInfo->getPath())); + $clean_path = str_replace(LOCAL_ROOT . CONTENT_DIR, "", clean_slashes($fileInfo->getPath())); + $f['config'] = parse_ini_string($config); $f['title'] = isset($f['config']['title']) ? $f['config']['title'] : $fileInfo->getFilename() ; $f['config']['date'] = isset($f['config']['date']) ? $f['config']['date'] : null; $f['timestamp'] = $f['config']['date'] ? date('U', strtotime( $f['config']['date'])) : $fileInfo->getCTime(); $f['tags'] = isset($f['config']['tags']) ? explode(" ", $f['config']['tags']) : null; $f['content'] = Markdown($content); + + // get comments + $f['comments_enabled'] = isset($f['config']['comments']) && $f['config']['comments']; + $f['comments_loc'] = LOCAL_ROOT . COMMENTS_DIR . $clean_path . DIRECTORY_SEPARATOR . $fileInfo->getFilename() . DIRECTORY_SEPARATOR; + $comments = array(); + if (is_dir($f['comments_loc'])) { + $dir_iterator = new DirectoryIterator($f['comments_loc']); + foreach ($dir_iterator as $file => $info) { + if (!$info->isDir() && $info->getFilename() != '.' && $info->getFilename() != '..') { + $contents = file_get_contents($info->getPath() . DIRECTORY_SEPARATOR . $info->getFilename()); + $comments[] = json_decode($contents, true); + } + } + } + $f['comments'] = $comments; if ($passed_more) $f['content_short'] = Markdown($content_short); - $cat = clean_slashes(str_replace(LOCAL_ROOT . CONTENT_DIR, "", $fileInfo->getPath())); - $clean_path = str_replace(LOCAL_ROOT . CONTENT_DIR, "", clean_slashes($fileInfo->getPath())); - - $f['cat'] = $page ? null : array('name' => $clean_path, 'url' => $clean_path ); - $f['path'] = $fileInfo->getRealPath(); + $f['cat'] = $page ? null : array('name' => $clean_path, 'url' => $clean_path ); $f['url'] = ($page ? '' : $f['cat']['url'] . '/') . $fileInfo->getFilename(); if (!CLEAN_URLS) { diff --git a/lib/init.php b/lib/init.php index 8c030eb..f26a619 100644 --- a/lib/init.php +++ b/lib/init.php @@ -11,10 +11,10 @@ # error reporting error_reporting(E_ALL); -ini_set("display_errors", 1); +ini_set('display_errors', 1); # timezone -putenv('TZ=Asia/Calcutta'); +putenv('TZ=America/Los_Angeles'); # include path ini_set('include_path', ini_get('include_path') . PATH_SEPARATOR . dirname(realpath(__FILE__))); @@ -22,10 +22,11 @@ ini_set('include_path', ini_get('include_path') . PATH_SEPARATOR . dirname(realp # settings define ('CLEAN_URLS', false); define ('SITE_TITLE', 'india 2011'); -define ('LOCAL_ROOT', '/Users/gdunne/Sites/india/'); -define ('WEB_ROOT', '/~gdunne/india/'); +define ('LOCAL_ROOT', '/Users/gdunne/Sites/quilime/'); +define ('WEB_ROOT', '/~gdunne/quilime/'); define ('CONTENT_DIR', 'content/'); define ('TEMPLATE_DIR', 'templates/'); +define ('COMMENTS_DIR', 'comments/'); define ('PAGE_DIR', 'pages/'); define ('CONFIG_DELIMITER', '--'); define ('CONFIG_FILE', 'config'); @@ -35,9 +36,18 @@ define ('ENTRY_DATE_FORMAT', 'M d Y, h:i:s A T'); $_FILE_IGNORES = array(CONFIG_FILE, '.DS_Store'); + +# recaptcha for comments +require_once 'recaptchalib.php'; +// Get a key from https://www.google.com/recaptcha/admin/create +$captcha_publickey = "6Lek-MkSAAAAAAZknQQGSx9DiCqm_wAiFGytc37d"; +$captcha_privatekey = "6Lek-MkSAAAAAK4FAaPKO0Cwp-iHa0OcUaqipee4"; + + # includes require_once 'data.php'; require_once 'output.php'; require_once 'markdown.php'; require_once 'model.php'; -require_once 'view.php'; \ No newline at end of file +require_once 'view.php'; + diff --git a/lib/recaptchalib.php b/lib/recaptchalib.php new file mode 100644 index 0000000..32c4f4d --- /dev/null +++ b/lib/recaptchalib.php @@ -0,0 +1,277 @@ + $value ) + $req .= $key . '=' . urlencode( stripslashes($value) ) . '&'; + + // Cut the last '&' + $req=substr($req,0,strlen($req)-1); + return $req; +} + + + +/** + * Submits an HTTP POST to a reCAPTCHA server + * @param string $host + * @param string $path + * @param array $data + * @param int port + * @return array response + */ +function _recaptcha_http_post($host, $path, $data, $port = 80) { + + $req = _recaptcha_qsencode ($data); + + $http_request = "POST $path HTTP/1.0\r\n"; + $http_request .= "Host: $host\r\n"; + $http_request .= "Content-Type: application/x-www-form-urlencoded;\r\n"; + $http_request .= "Content-Length: " . strlen($req) . "\r\n"; + $http_request .= "User-Agent: reCAPTCHA/PHP\r\n"; + $http_request .= "\r\n"; + $http_request .= $req; + + $response = ''; + if( false == ( $fs = @fsockopen($host, $port, $errno, $errstr, 10) ) ) { + die ('Could not open socket'); + } + + fwrite($fs, $http_request); + + while ( !feof($fs) ) + $response .= fgets($fs, 1160); // One TCP-IP packet + fclose($fs); + $response = explode("\r\n\r\n", $response, 2); + + return $response; +} + + + +/** + * Gets the challenge HTML (javascript and non-javascript version). + * This is called from the browser, and the resulting reCAPTCHA HTML widget + * is embedded within the HTML form it was called from. + * @param string $pubkey A public key for reCAPTCHA + * @param string $error The error given by reCAPTCHA (optional, default is null) + * @param boolean $use_ssl Should the request be made over ssl? (optional, default is false) + + * @return string - The HTML to be embedded in the user's form. + */ +function recaptcha_get_html ($pubkey, $error = null, $use_ssl = false) +{ + if ($pubkey == null || $pubkey == '') { + die ("To use reCAPTCHA you must get an API key from https://www.google.com/recaptcha/admin/create"); + } + + if ($use_ssl) { + $server = RECAPTCHA_API_SECURE_SERVER; + } else { + $server = RECAPTCHA_API_SERVER; + } + + $errorpart = ""; + if ($error) { + $errorpart = "&error=" . $error; + } + return ' + + '; +} + + + + +/** + * A ReCaptchaResponse is returned from recaptcha_check_answer() + */ +class ReCaptchaResponse { + var $is_valid; + var $error; +} + + +/** + * Calls an HTTP POST function to verify if the user's guess was correct + * @param string $privkey + * @param string $remoteip + * @param string $challenge + * @param string $response + * @param array $extra_params an array of extra variables to post to the server + * @return ReCaptchaResponse + */ +function recaptcha_check_answer ($privkey, $remoteip, $challenge, $response, $extra_params = array()) +{ + if ($privkey == null || $privkey == '') { + die ("To use reCAPTCHA you must get an API key from https://www.google.com/recaptcha/admin/create"); + } + + if ($remoteip == null || $remoteip == '') { + die ("For security reasons, you must pass the remote ip to reCAPTCHA"); + } + + + + //discard spam submissions + if ($challenge == null || strlen($challenge) == 0 || $response == null || strlen($response) == 0) { + $recaptcha_response = new ReCaptchaResponse(); + $recaptcha_response->is_valid = false; + $recaptcha_response->error = 'incorrect-captcha-sol'; + return $recaptcha_response; + } + + $response = _recaptcha_http_post (RECAPTCHA_VERIFY_SERVER, "/recaptcha/api/verify", + array ( + 'privatekey' => $privkey, + 'remoteip' => $remoteip, + 'challenge' => $challenge, + 'response' => $response + ) + $extra_params + ); + + $answers = explode ("\n", $response [1]); + $recaptcha_response = new ReCaptchaResponse(); + + if (trim ($answers [0]) == 'true') { + $recaptcha_response->is_valid = true; + } + else { + $recaptcha_response->is_valid = false; + $recaptcha_response->error = $answers [1]; + } + return $recaptcha_response; + +} + +/** + * gets a URL where the user can sign up for reCAPTCHA. If your application + * has a configuration page where you enter a key, you should provide a link + * using this function. + * @param string $domain The domain where the page is hosted + * @param string $appname The name of your application + */ +function recaptcha_get_signup_url ($domain = null, $appname = null) { + return "https://www.google.com/recaptcha/admin/create?" . _recaptcha_qsencode (array ('domains' => $domain, 'app' => $appname)); +} + +function _recaptcha_aes_pad($val) { + $block_size = 16; + $numpad = $block_size - (strlen ($val) % $block_size); + return str_pad($val, strlen ($val) + $numpad, chr($numpad)); +} + +/* Mailhide related code */ + +function _recaptcha_aes_encrypt($val,$ky) { + if (! function_exists ("mcrypt_encrypt")) { + die ("To use reCAPTCHA Mailhide, you need to have the mcrypt php module installed."); + } + $mode=MCRYPT_MODE_CBC; + $enc=MCRYPT_RIJNDAEL_128; + $val=_recaptcha_aes_pad($val); + return mcrypt_encrypt($enc, $ky, $val, $mode, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"); +} + + +function _recaptcha_mailhide_urlbase64 ($x) { + return strtr(base64_encode ($x), '+/', '-_'); +} + +/* gets the reCAPTCHA Mailhide url for a given email, public key and private key */ +function recaptcha_mailhide_url($pubkey, $privkey, $email) { + if ($pubkey == '' || $pubkey == null || $privkey == "" || $privkey == null) { + die ("To use reCAPTCHA Mailhide, you have to sign up for a public and private key, " . + "you can do so at http://www.google.com/recaptcha/mailhide/apikey"); + } + + + $ky = pack('H*', $privkey); + $cryptmail = _recaptcha_aes_encrypt ($email, $ky); + + return "http://www.google.com/recaptcha/mailhide/d?k=" . $pubkey . "&c=" . _recaptcha_mailhide_urlbase64 ($cryptmail); +} + +/** + * gets the parts of the email to expose to the user. + * eg, given johndoe@example,com return ["john", "example.com"]. + * the email is then displayed as john...@example.com + */ +function _recaptcha_mailhide_email_parts ($email) { + $arr = preg_split("/@/", $email ); + + if (strlen ($arr[0]) <= 4) { + $arr[0] = substr ($arr[0], 0, 1); + } else if (strlen ($arr[0]) <= 6) { + $arr[0] = substr ($arr[0], 0, 3); + } else { + $arr[0] = substr ($arr[0], 0, 4); + } + return $arr; +} + +/** + * Gets html to display an email address given a public an private key. + * to get a key, go to: + * + * http://www.google.com/recaptcha/mailhide/apikey + */ +function recaptcha_mailhide_html($pubkey, $privkey, $email) { + $emailparts = _recaptcha_mailhide_email_parts ($email); + $url = recaptcha_mailhide_url ($pubkey, $privkey, $email); + + return htmlentities($emailparts[0]) . "...@" . htmlentities ($emailparts [1]); + +} + + +?> diff --git a/pages/about b/pages/about index 483451b..b4f27b7 100644 --- a/pages/about +++ b/pages/about @@ -2,6 +2,4 @@ title = about -- -INDIA 2011 is a journal by Gabriel L Dunne, documenting a self-initiated 3mo residiency in Delhi, India with fellow artist Vishal K Dar. - -all content © 2011 \ No newline at end of file +plog CMS by Gabriel L Dunne \ No newline at end of file diff --git a/pages/links b/pages/links deleted file mode 100644 index 8a3369e..0000000 --- a/pages/links +++ /dev/null @@ -1,34 +0,0 @@ -title = links -type = page -markdown = true --- -people ------- -+ gabriel dunne [gabrieldunne.com](http://gabrieldunne.com) -+ stephanie sherriff [ssherriff.com](http://ssherriff.com) -+ ryan alexander [onecm.com](http://onecm.com) -+ joshua nimoy [jtnimoy.net](http://jtnimoy.net) -+ daniel massey [oddsympathy.com](http://oddsympathy.com) -+ keith pasko [keithpasko.com](http://keithpasko.com) -+ jeff lubow [dabkitsch.com/jml/](http://dabkitsch.com/jml/) -+ michael chang [ghost-hack.com](http://ghost-hack.com) -+ carbon workshop [carbonworkshop.com](http://carbonworkshop.com) -+ sascha pohflep [pohflepp.com](http://pohflepp.com) -+ mylinh trieu [mylinhtrieu.com](http://mylinhtrieu.com) -+ aaron meyers [universaloscillation.com](http://universaloscillation.com) -+ tom carden [tom-carden.co.uk](http://tom-carden.co.uk) -+ michal migurski [mike.teczno.co](http://mike.teczno.com) -+ adam roth [ripevessel.com](http://ripevessel.com) -+ david rager [davidrager.org](http://davidrager.org) -+ marc nimoy [digitanalog.net](http://digitanalog.net) -+ matthew gale [makaga.com](http://makaga.com) -+ frédéric eyl [fredericeyl.de](http://fredericeyl.de) -+ the green eyl [thegreeneyl.com](http://thegreeneyl.com) - -
-
- -places ------- -+ gray area foundation for the arts [gaffta.org](http://gaffta.org) -+ bay area video coalition [bavc.org](http://bavc.org) \ No newline at end of file diff --git a/templates/comments.html.tpl b/templates/comments.html.tpl new file mode 100644 index 0000000..c16fe7c --- /dev/null +++ b/templates/comments.html.tpl @@ -0,0 +1,30 @@ +
+ +
+ + +
+ +
posted by at
+
+ + +
+ +
+ +
+
+
+ +
+ markdown enabled + + + +
+ + +
+
+
diff --git a/templates/entry.html.tpl b/templates/entry.html.tpl index 58c3f17..bb7c88a 100644 --- a/templates/entry.html.tpl +++ b/templates/entry.html.tpl @@ -1,16 +1,24 @@
+

+ +
+ include_template('comments.html.tpl', array('entry' => $entry)); + ?> +
diff --git a/templates/head-inc.html.tpl b/templates/head-inc.html.tpl index ae6fd8f..54b9e63 100644 --- a/templates/head-inc.html.tpl +++ b/templates/head-inc.html.tpl @@ -3,4 +3,5 @@ + -- 2.34.1