This commit has been accessed 604 times via Git panel.
commit 8069d34424eb33791f32d635c40ed53bad8b2b36
tree 99a90cec38a4429c59ba69890c9d9df4c4a4cce6
parent e72805553c344dc907a849d010a3936fe053dadd
author Magie Antonio <magie@majcms.org> 1310642906 +0800
committer Magie Antonio <magie@majcms.org> 1310642906 +0800
Add Google +1 support
diff --git a/album.php b/album.php
index 1cf8012..16d627d 100644
--- a/album.php
+++ b/album.php
@@ -111,6 +111,10 @@ echo "\n<style>body { margin: {$maj_wspace}px; } .input, .click { width: 100%; }
echo "\n<title>$maj_req_show</title>\n";
+if (file_exists("$maj_data_directory/gl.txt")) {
+ echo "\n<script type=\"text/javascript\" src=\"https://apis.google.com/js/plusone.js\"></script>\n";
+}
+
if (file_exists("images/$maj_req_entry/album")) {
if ($dh_album = opendir("images/$maj_req_entry/album")) {
while (($entry_album = readdir($dh_album)) !== false) {
@@ -281,20 +285,25 @@ if (file_exists("images/$maj_req_entry/album/$maj_req_show")) {
}
echo "</td></tr></table>";
-
-
- if (file_exists("data/fb.txt") and file_exists("data/items/$maj_req_entry/fb.txt")) {
-
+
+ if ((file_exists("$maj_data_directory/gl.txt") and file_exists("$maj_data_directory/items/$maj_req_entry/gl.txt")) or (file_exists("data/fb.txt") and file_exists("data/items/$maj_req_entry/fb.txt"))) {
+
if (isset($_SERVER['HTTPS'])) {
$entry_url = "https://" . $_SERVER['HTTP_HOST'] . rtrim(dirname($_SERVER['PHP_SELF']), "/\\") . "/album.php?entry=$maj_req_entry&show=$maj_req_show";
}
else {
$entry_url = "http://" . $_SERVER['HTTP_HOST'] . rtrim(dirname($_SERVER['PHP_SELF']), "/\\") . "/album.php?entry=$maj_req_entry&show=$maj_req_show";
}
+ }
+ if (file_exists("$maj_data_directory/gl.txt") and file_exists("$maj_data_directory/items/$maj_req_entry/gl.txt")) {
+ echo "<div style=\"margin: 4px;\"><g:plusone size=\"medium\" href=\"$entry_url\"></g:plusone></div>";
+ }
+
+
+ if (file_exists("data/fb.txt") and file_exists("data/items/$maj_req_entry/fb.txt")) {
echo "<div style=\"margin: 4px;\"><div id=\"fb-root\"></div><script src=\"http://connect.facebook.net/en_US/all.js#xfbml=1\"></script><fb:like href=\"$entry_url\" send=\"false\" width=\"$album_image_width\" show_faces=\"true\" font=\"\"></fb:like></div>";
}
-
echo "<table border=\"0\" cellspacing=\"1\" cellpadding=\"2\"><tr><td valign=\"top\" colspan=\"3\">";
diff --git a/edit.php b/edit.php
index 04e47fd..58f0784 100644
--- a/edit.php
+++ b/edit.php
@@ -471,6 +471,17 @@ else {
<?php
+if (file_exists("$maj_data_directory/gl.txt")) {
+
+ echo "<tr><td><input type=\"checkbox\" name=\"gl\"";
+
+ if (file_exists("$maj_data_directory/items/$maj_req_entry/gl.txt")) {
+ echo checked;
+ }
+
+ echo ">Enable Google support.</td></tr>";
+}
+
if (file_exists("$maj_data_directory/fb.txt")) {
echo "<tr><td><input type=\"checkbox\" name=\"fb\"";
@@ -1130,6 +1141,20 @@ if (file_exists("images/$maj_req_entry/album")) {
}
}
+ $gl_sem = "$maj_data_directory/items/$maj_req_entry/gl.txt";
+
+ if (isset($_POST['gl']) and !empty($_POST['gl']) and ($_POST['gl'] == "on")) {
+ if (!file_exists($gl_sem)) {
+ touch($gl_sem);
+ }
+ }
+
+ if (!isset($_POST['gl']) or empty($_POST['gl'])) {
+ if (file_exists($gl_sem)) {
+ unlink($gl_sem);
+ }
+ }
+
$fb_sem = "$maj_data_directory/items/$maj_req_entry/fb.txt";
if (isset($_POST['fb']) and !empty($_POST['fb']) and ($_POST['fb'] == "on")) {
@@ -1144,7 +1169,6 @@ if (file_exists("images/$maj_req_entry/album")) {
}
}
-
$lastmod_sem = "$maj_data_directory/items/$maj_req_entry/lastmod.txt";
if (isset($_POST['lastmod']) and !empty($_POST['lastmod']) and ($_POST['lastmod'] == "on")) {
diff --git a/index.php b/index.php
index cf00288..8c508c6 100644
--- a/index.php
+++ b/index.php
@@ -489,6 +489,10 @@ else {
echo "<title>$maj_default_title</title>\r\n";
}
+if (file_exists("$maj_data_directory/gl.txt")) {
+ echo "\n<script type=\"text/javascript\" src=\"https://apis.google.com/js/plusone.js\"></script>\n";
+}
+
if (file_exists("$maj_data_directory/comments/pending") and (file_exists("$maj_data_directory/xscreen.txt") or (isset($maj_logged_in_username) and file_exists("$maj_data_directory/members/active/$maj_logged_in_username/xscreen.txt")))) {
if ($maj_dh_xscreen_comments = opendir("$maj_data_directory/comments/pending")) {
@@ -2169,16 +2173,22 @@ foreach ($maj_disp as $maj_d) {
echo "<br><br>--<br>$maj_sig";
}
- if (file_exists("$maj_data_directory/fb.txt") and file_exists("$maj_data_directory/items/$maj_d/fb.txt")) {
-
+ if ((file_exists("$maj_data_directory/gl.txt") and file_exists("$maj_data_directory/items/$maj_d/gl.txt")) or (file_exists("$maj_data_directory/fb.txt") and file_exists("$maj_data_directory/items/$maj_d/fb.txt"))) {
+
if (isset($_SERVER['HTTPS'])) {
$entry_url = "https://" . $_SERVER['HTTP_HOST'] . rtrim(dirname($_SERVER['PHP_SELF']), "/\\") . "/index.php?entry=$maj_d";
}
else {
$entry_url = "http://" . $_SERVER['HTTP_HOST'] . rtrim(dirname($_SERVER['PHP_SELF']), "/\\") . "/index.php?entry=$maj_d";
}
+ }
+
+ if (file_exists("$maj_data_directory/gl.txt") and file_exists("$maj_data_directory/items/$maj_d/gl.txt")) {
+ echo "<p><g:plusone size=\"medium\" href=\"$entry_url\"></g:plusone></p>";
+ }
- echo "<br><br><div id=\"fb-root\"></div><script src=\"http://connect.facebook.net/en_US/all.js#xfbml=1\"></script><fb:like href=\"$entry_url\" send=\"false\" width=\"510\" show_faces=\"false\" font=\"\"></fb:like>";
+ if (file_exists("$maj_data_directory/fb.txt") and file_exists("$maj_data_directory/items/$maj_d/fb.txt")) {
+ echo "<p><div id=\"fb-root\"></div><script src=\"http://connect.facebook.net/en_US/all.js#xfbml=1\"></script><fb:like href=\"$entry_url\" send=\"false\" width=\"510\" show_faces=\"false\" font=\"\"></fb:like></p>";
}
if (isset($maj_d_text_b)) {
diff --git a/settings.php b/settings.php
index 114b510..79bd518 100644
--- a/settings.php
+++ b/settings.php
@@ -353,6 +353,18 @@ if (!isset($_POST['old']) or empty($_POST['old'])) {
}
}
+if (isset($_POST['gl']) and !empty($_POST['gl']) and ($_POST['gl'] == "on") and !file_exists("data/gl.txt")) {
+ touch("data/gl.txt");
+}
+
+if (!isset($_POST['gl']) or empty($_POST['gl'])) {
+ if (isset($_POST['edit']) and ($_POST['edit'] == "on")) {
+ if (file_exists("data/gl.txt")) {
+ unlink("data/gl.txt");
+ }
+ }
+}
+
if (isset($_POST['fb']) and !empty($_POST['fb']) and ($_POST['fb'] == "on") and !file_exists("data/fb.txt")) {
touch("data/fb.txt");
}
@@ -1417,6 +1429,8 @@ if (file_exists("images/background.gif") or file_exists("images/background.jpg")
<?php if (!file_exists("data/lite.txt")) { ?>
+<tr><td>google</td><td><input type="checkbox" name="gl" <?php if (file_exists("data/gl.txt")) { echo checked; } ?>> Enable Google support.</td></tr>
+
<tr><td>facebook</td><td><input type="checkbox" name="fb" <?php if (file_exists("data/fb.txt")) { echo checked; } ?>> Enable Facebook support.</td></tr>
<tr><td>wiki</td><td><input type="checkbox" name="wiki" <?php if (file_exists("data/wiki.txt")) { echo checked; } ?>> Enable wiki-style editing.</td></tr>
diff --git a/video.php b/video.php
index fc3401b..53e815e 100644
--- a/video.php
+++ b/video.php
@@ -83,6 +83,10 @@ if (isset($_REQUEST['entry']) and !empty($_REQUEST['entry']) and isset($_REQUEST
echo "<title>$title ($maj_s)</title>";
+ if (file_exists("data/gl.txt")) {
+ echo "\n<script type=\"text/javascript\" src=\"https://apis.google.com/js/plusone.js\"></script>\n";
+ }
+
echo "<table border=\"0\" cellspacing=\"1\" cellpadding=\"2\">";
echo "<tr><td colspan=\"2\"><div style=\"margin: 5px;\"><a style=\"font-size: 14px;\" href=\".?entry=$maj_d\">$title</a></div></td></tr>";
@@ -146,16 +150,23 @@ if (isset($_REQUEST['entry']) and !empty($_REQUEST['entry']) and isset($_REQUEST
echo "</table>";
echo "</div>";
- if (file_exists("data/fb.txt") and file_exists("data/items/$maj_d/fb.txt")) {
-
+ if ((file_exists("data/gl.txt") and file_exists("data/items/$maj_d/gl.txt")) or (file_exists("data/fb.txt") and file_exists("data/items/$maj_d/fb.txt"))) {
+
if (isset($_SERVER['HTTPS'])) {
$entry_url = "https://" . $_SERVER['HTTP_HOST'] . rtrim(dirname($_SERVER['PHP_SELF']), "/\\") . "/video.php?entry=$maj_d&show=$maj_s";
}
else {
$entry_url = "http://" . $_SERVER['HTTP_HOST'] . rtrim(dirname($_SERVER['PHP_SELF']), "/\\") . "/video.php?entry=$maj_d&show=$maj_s";
}
+ }
- echo "<div style=\"margin: 4px;\"><div id=\"fb-root\"></div><script src=\"http://connect.facebook.net/en_US/all.js#xfbml=1\"></script><fb:like href=\"$entry_url\" send=\"false\" width=\"320\" show_faces=\"true\" font=\"\"></fb:like></div>";
+ if (file_exists("data/gl.txt") and file_exists("data/items/$maj_d/gl.txt")) {
+ echo "<div style=\"margin: 4px;\"><g:plusone size=\"medium\" href=\"$entry_url\"></g:plusone></div>";
+ }
+
+
+ if (file_exists("data/fb.txt") and file_exists("data/items/$maj_d/fb.txt")) {
+ echo "<div style=\"margin: 4px;\"><div id=\"fb-root\"></div><script src=\"http://connect.facebook.net/en_US/all.js#xfbml=1\"></script><fb:like href=\"$entry_url\" send=\"false\" width=\"$album_image_width\" show_faces=\"true\" font=\"\"></fb:like></div>";
}
//echo "<form method=\"post\"><input type=\"hidden\" name=\"back\" value=\"$maj_d\"><input type=\"submit\" class=\"click\" style=\"width: 100%; margin: 1px;\" value=\"click here to go to the main entry\"></form>";
tree 99a90cec38a4429c59ba69890c9d9df4c4a4cce6
parent e72805553c344dc907a849d010a3936fe053dadd
author Magie Antonio <magie@majcms.org> 1310642906 +0800
committer Magie Antonio <magie@majcms.org> 1310642906 +0800
Add Google +1 support
diff --git a/album.php b/album.php
index 1cf8012..16d627d 100644
--- a/album.php
+++ b/album.php
@@ -111,6 +111,10 @@ echo "\n<style>body { margin: {$maj_wspace}px; } .input, .click { width: 100%; }
echo "\n<title>$maj_req_show</title>\n";
+if (file_exists("$maj_data_directory/gl.txt")) {
+ echo "\n<script type=\"text/javascript\" src=\"https://apis.google.com/js/plusone.js\"></script>\n";
+}
+
if (file_exists("images/$maj_req_entry/album")) {
if ($dh_album = opendir("images/$maj_req_entry/album")) {
while (($entry_album = readdir($dh_album)) !== false) {
@@ -281,20 +285,25 @@ if (file_exists("images/$maj_req_entry/album/$maj_req_show")) {
}
echo "</td></tr></table>";
-
-
- if (file_exists("data/fb.txt") and file_exists("data/items/$maj_req_entry/fb.txt")) {
-
+
+ if ((file_exists("$maj_data_directory/gl.txt") and file_exists("$maj_data_directory/items/$maj_req_entry/gl.txt")) or (file_exists("data/fb.txt") and file_exists("data/items/$maj_req_entry/fb.txt"))) {
+
if (isset($_SERVER['HTTPS'])) {
$entry_url = "https://" . $_SERVER['HTTP_HOST'] . rtrim(dirname($_SERVER['PHP_SELF']), "/\\") . "/album.php?entry=$maj_req_entry&show=$maj_req_show";
}
else {
$entry_url = "http://" . $_SERVER['HTTP_HOST'] . rtrim(dirname($_SERVER['PHP_SELF']), "/\\") . "/album.php?entry=$maj_req_entry&show=$maj_req_show";
}
+ }
+ if (file_exists("$maj_data_directory/gl.txt") and file_exists("$maj_data_directory/items/$maj_req_entry/gl.txt")) {
+ echo "<div style=\"margin: 4px;\"><g:plusone size=\"medium\" href=\"$entry_url\"></g:plusone></div>";
+ }
+
+
+ if (file_exists("data/fb.txt") and file_exists("data/items/$maj_req_entry/fb.txt")) {
echo "<div style=\"margin: 4px;\"><div id=\"fb-root\"></div><script src=\"http://connect.facebook.net/en_US/all.js#xfbml=1\"></script><fb:like href=\"$entry_url\" send=\"false\" width=\"$album_image_width\" show_faces=\"true\" font=\"\"></fb:like></div>";
}
-
echo "<table border=\"0\" cellspacing=\"1\" cellpadding=\"2\"><tr><td valign=\"top\" colspan=\"3\">";
diff --git a/edit.php b/edit.php
index 04e47fd..58f0784 100644
--- a/edit.php
+++ b/edit.php
@@ -471,6 +471,17 @@ else {
<?php
+if (file_exists("$maj_data_directory/gl.txt")) {
+
+ echo "<tr><td><input type=\"checkbox\" name=\"gl\"";
+
+ if (file_exists("$maj_data_directory/items/$maj_req_entry/gl.txt")) {
+ echo checked;
+ }
+
+ echo ">Enable Google support.</td></tr>";
+}
+
if (file_exists("$maj_data_directory/fb.txt")) {
echo "<tr><td><input type=\"checkbox\" name=\"fb\"";
@@ -1130,6 +1141,20 @@ if (file_exists("images/$maj_req_entry/album")) {
}
}
+ $gl_sem = "$maj_data_directory/items/$maj_req_entry/gl.txt";
+
+ if (isset($_POST['gl']) and !empty($_POST['gl']) and ($_POST['gl'] == "on")) {
+ if (!file_exists($gl_sem)) {
+ touch($gl_sem);
+ }
+ }
+
+ if (!isset($_POST['gl']) or empty($_POST['gl'])) {
+ if (file_exists($gl_sem)) {
+ unlink($gl_sem);
+ }
+ }
+
$fb_sem = "$maj_data_directory/items/$maj_req_entry/fb.txt";
if (isset($_POST['fb']) and !empty($_POST['fb']) and ($_POST['fb'] == "on")) {
@@ -1144,7 +1169,6 @@ if (file_exists("images/$maj_req_entry/album")) {
}
}
-
$lastmod_sem = "$maj_data_directory/items/$maj_req_entry/lastmod.txt";
if (isset($_POST['lastmod']) and !empty($_POST['lastmod']) and ($_POST['lastmod'] == "on")) {
diff --git a/index.php b/index.php
index cf00288..8c508c6 100644
--- a/index.php
+++ b/index.php
@@ -489,6 +489,10 @@ else {
echo "<title>$maj_default_title</title>\r\n";
}
+if (file_exists("$maj_data_directory/gl.txt")) {
+ echo "\n<script type=\"text/javascript\" src=\"https://apis.google.com/js/plusone.js\"></script>\n";
+}
+
if (file_exists("$maj_data_directory/comments/pending") and (file_exists("$maj_data_directory/xscreen.txt") or (isset($maj_logged_in_username) and file_exists("$maj_data_directory/members/active/$maj_logged_in_username/xscreen.txt")))) {
if ($maj_dh_xscreen_comments = opendir("$maj_data_directory/comments/pending")) {
@@ -2169,16 +2173,22 @@ foreach ($maj_disp as $maj_d) {
echo "<br><br>--<br>$maj_sig";
}
- if (file_exists("$maj_data_directory/fb.txt") and file_exists("$maj_data_directory/items/$maj_d/fb.txt")) {
-
+ if ((file_exists("$maj_data_directory/gl.txt") and file_exists("$maj_data_directory/items/$maj_d/gl.txt")) or (file_exists("$maj_data_directory/fb.txt") and file_exists("$maj_data_directory/items/$maj_d/fb.txt"))) {
+
if (isset($_SERVER['HTTPS'])) {
$entry_url = "https://" . $_SERVER['HTTP_HOST'] . rtrim(dirname($_SERVER['PHP_SELF']), "/\\") . "/index.php?entry=$maj_d";
}
else {
$entry_url = "http://" . $_SERVER['HTTP_HOST'] . rtrim(dirname($_SERVER['PHP_SELF']), "/\\") . "/index.php?entry=$maj_d";
}
+ }
+
+ if (file_exists("$maj_data_directory/gl.txt") and file_exists("$maj_data_directory/items/$maj_d/gl.txt")) {
+ echo "<p><g:plusone size=\"medium\" href=\"$entry_url\"></g:plusone></p>";
+ }
- echo "<br><br><div id=\"fb-root\"></div><script src=\"http://connect.facebook.net/en_US/all.js#xfbml=1\"></script><fb:like href=\"$entry_url\" send=\"false\" width=\"510\" show_faces=\"false\" font=\"\"></fb:like>";
+ if (file_exists("$maj_data_directory/fb.txt") and file_exists("$maj_data_directory/items/$maj_d/fb.txt")) {
+ echo "<p><div id=\"fb-root\"></div><script src=\"http://connect.facebook.net/en_US/all.js#xfbml=1\"></script><fb:like href=\"$entry_url\" send=\"false\" width=\"510\" show_faces=\"false\" font=\"\"></fb:like></p>";
}
if (isset($maj_d_text_b)) {
diff --git a/settings.php b/settings.php
index 114b510..79bd518 100644
--- a/settings.php
+++ b/settings.php
@@ -353,6 +353,18 @@ if (!isset($_POST['old']) or empty($_POST['old'])) {
}
}
+if (isset($_POST['gl']) and !empty($_POST['gl']) and ($_POST['gl'] == "on") and !file_exists("data/gl.txt")) {
+ touch("data/gl.txt");
+}
+
+if (!isset($_POST['gl']) or empty($_POST['gl'])) {
+ if (isset($_POST['edit']) and ($_POST['edit'] == "on")) {
+ if (file_exists("data/gl.txt")) {
+ unlink("data/gl.txt");
+ }
+ }
+}
+
if (isset($_POST['fb']) and !empty($_POST['fb']) and ($_POST['fb'] == "on") and !file_exists("data/fb.txt")) {
touch("data/fb.txt");
}
@@ -1417,6 +1429,8 @@ if (file_exists("images/background.gif") or file_exists("images/background.jpg")
<?php if (!file_exists("data/lite.txt")) { ?>
+<tr><td>google</td><td><input type="checkbox" name="gl" <?php if (file_exists("data/gl.txt")) { echo checked; } ?>> Enable Google support.</td></tr>
+
<tr><td>facebook</td><td><input type="checkbox" name="fb" <?php if (file_exists("data/fb.txt")) { echo checked; } ?>> Enable Facebook support.</td></tr>
<tr><td>wiki</td><td><input type="checkbox" name="wiki" <?php if (file_exists("data/wiki.txt")) { echo checked; } ?>> Enable wiki-style editing.</td></tr>
diff --git a/video.php b/video.php
index fc3401b..53e815e 100644
--- a/video.php
+++ b/video.php
@@ -83,6 +83,10 @@ if (isset($_REQUEST['entry']) and !empty($_REQUEST['entry']) and isset($_REQUEST
echo "<title>$title ($maj_s)</title>";
+ if (file_exists("data/gl.txt")) {
+ echo "\n<script type=\"text/javascript\" src=\"https://apis.google.com/js/plusone.js\"></script>\n";
+ }
+
echo "<table border=\"0\" cellspacing=\"1\" cellpadding=\"2\">";
echo "<tr><td colspan=\"2\"><div style=\"margin: 5px;\"><a style=\"font-size: 14px;\" href=\".?entry=$maj_d\">$title</a></div></td></tr>";
@@ -146,16 +150,23 @@ if (isset($_REQUEST['entry']) and !empty($_REQUEST['entry']) and isset($_REQUEST
echo "</table>";
echo "</div>";
- if (file_exists("data/fb.txt") and file_exists("data/items/$maj_d/fb.txt")) {
-
+ if ((file_exists("data/gl.txt") and file_exists("data/items/$maj_d/gl.txt")) or (file_exists("data/fb.txt") and file_exists("data/items/$maj_d/fb.txt"))) {
+
if (isset($_SERVER['HTTPS'])) {
$entry_url = "https://" . $_SERVER['HTTP_HOST'] . rtrim(dirname($_SERVER['PHP_SELF']), "/\\") . "/video.php?entry=$maj_d&show=$maj_s";
}
else {
$entry_url = "http://" . $_SERVER['HTTP_HOST'] . rtrim(dirname($_SERVER['PHP_SELF']), "/\\") . "/video.php?entry=$maj_d&show=$maj_s";
}
+ }
- echo "<div style=\"margin: 4px;\"><div id=\"fb-root\"></div><script src=\"http://connect.facebook.net/en_US/all.js#xfbml=1\"></script><fb:like href=\"$entry_url\" send=\"false\" width=\"320\" show_faces=\"true\" font=\"\"></fb:like></div>";
+ if (file_exists("data/gl.txt") and file_exists("data/items/$maj_d/gl.txt")) {
+ echo "<div style=\"margin: 4px;\"><g:plusone size=\"medium\" href=\"$entry_url\"></g:plusone></div>";
+ }
+
+
+ if (file_exists("data/fb.txt") and file_exists("data/items/$maj_d/fb.txt")) {
+ echo "<div style=\"margin: 4px;\"><div id=\"fb-root\"></div><script src=\"http://connect.facebook.net/en_US/all.js#xfbml=1\"></script><fb:like href=\"$entry_url\" send=\"false\" width=\"$album_image_width\" show_faces=\"true\" font=\"\"></fb:like></div>";
}
//echo "<form method=\"post\"><input type=\"hidden\" name=\"back\" value=\"$maj_d\"><input type=\"submit\" class=\"click\" style=\"width: 100%; margin: 1px;\" value=\"click here to go to the main entry\"></form>";