}
+$reg = gwvpmini_getConfigVal("gravatarenabled");
+
+$use_gravatar = false;\r
+if($reg == null) {\r
+ gwvpmini_setConfigVal("gravatarenabled", "1");\r
+} else if($reg == 1) {\r
+ $use_gravatar = true;\r
+} else {\r
+ $use_gravatar = false;\r
+}\r
+\r
+global $use_gravatar;
function gwvpmini_AdminCallMe()\r
{\r
if($qspl[1] == "switchenablerepo") {
return "gwvpmini_SwitchEnableRepo";
}
+ if($qspl[1] == "changegravs") {
+ return "gwvpmini_SwitchGravatars";
+ }
} else {\r
error_log("i got here, where next?");\r
return "gwvpmini_AdminMainPage";\r
function gwvpmini_AdminMainPageBody()
{
global $BASE_URL;
- global $can_register, $reg_reqs_confirm, $confirm_from_address;
+ global $can_register, $reg_reqs_confirm, $confirm_from_address, $use_gravatar;
if($can_register) {
$register = "Registration Enabled (<a href=\"$BASE_URL/admin/changereg\">Disable</a>)";
} else {
$regconfirm = "Registration Doesnt Require Confirmation (<a href=\"$BASE_URL/admin/changeconfirm\">Enable</a>)";
}
+
+ if($use_gravatar) {
+ $usegrav = "Gravatars are enabled (<a href=\"$BASE_URL/admin/changegravs\">Disable</a>)";
+ } else {
+ $usegrav = "Gravatars are disabled (<a href=\"$BASE_URL/admin/changegravs\">Enable</a>)";
+ }
+
$totalusers = gwvpmini_GetNUsers();
echo "<table><tr valign=\"top\"><td>";
echo "<h2>Users - $totalusers</h2>";
- echo "$register<br>$regconfirm<br>";
+ echo "$register<br>$regconfirm<br>$usegrav<br>";
echo "<form method=\"post\" action=\"$BASE_URL/admin/changefromemail\">";
echo "Address emails are sent from <input type=\"text\" name=\"fromemail\" value=\"$confirm_from_address\"><input type=\"submit\" name=\"Update\" value=\"Update\"><br>";
echo "</form>";
\r
header("Location: $BASE_URL/admin");
}
+
+function gwvpmini_SwitchGravatars()
+{
+ global $BASE_URL, $use_gravatar;\r
+ \r
+ if($newst == 1) $stat = "disabled";\r
+ else $stat = "enabled";\r
+
+ if($use_gravatar) {
+ gwvpmini_setConfigVal("gravatarenabled", "0");
+ } else {
+ gwvpmini_setConfigVal("gravatarenabled", "1");
+ }
+ \r
+ gwvpmini_SendMessage("info", "Gravatars $stat");\r
+ \r
+ header("Location: $BASE_URL/admin");
+}
?>
\ No newline at end of file
$owner = gwvpmini_getUser(null, null, $repo["owner"]);
$repname = "<a href=\"$BASE_URL/view/$name\">$name</a>";
- $repown = get_gravatar($owner["email"], 30, 'mm', 'g', true)."<br><a href=\"$BASE_URL/user/".$owner["username"]."\">".$owner["username"]."</a>";
+ $repown = gwvpmini_HtmlGravatar($owner["email"], 30, "<br>")."<a href=\"$BASE_URL/user/".$owner["username"]."\">".$owner["username"]."</a>";
echo "<tr><td>$repname</td><td>$repown</td><td>$desc</td><td>$lastlog</td></tr>";
echo "<tr valign=\"top\"><td>";
- // get_gravatar( $email, $s = 80, $d = 'mm', $r = 'g', $img = false, $atts = array() ) {
+
if($reps != false) {
echo "<table border=\"1\">";
foreach($reps as $rep) {
$ownerinfo = gwvpmini_getUser(null, null, $rep["owner"]);
- $userdets = get_gravatar($ownerinfo["email"], 40, 'mm', 'g', true);
- $userdets .= "<br><a href=\"$BASE_URL/user/".$ownerinfo["username"]."\">".$ownerinfo["username"]."</a>";
+ $userdets = gwvpmini_HtmlGravatar($ownerinfo["email"], 40, "<br>")."<a href=\"$BASE_URL/user/".$ownerinfo["username"]."\">".$ownerinfo["username"]."</a>";
$repodets = "<b><a href=\"$BASE_URL/view/".$rep["name"]."\">".$rep["name"]."</a></b><br>".$rep["desc"];
echo "<tr><td>$userdets</td><td>$repodets</td></tr>";
echo "<table border=\"1\">";
$ownedrepos = "BLAHBLAH";\r
foreach($ppls as $ppl) {\r
- $userdets = get_gravatar($ppl["email"], 40, 'mm', 'g', true);
- $userdets .= "<br><a href=\"$BASE_URL/user/".$ppl["username"]."\">".$ppl["username"]."</a>";
+ $userdets = gwvpmini_HtmlGravatar($ppl["email"], 40, "<br>")."<a href=\"$BASE_URL/user/".$ppl["username"]."\">".$ppl["username"]."</a>";
$repos = gwvpmini_GetOwnedRepos($ppl["username"]);
if($repos == false) $ownedrepos = "No Repos";
else {
if($owner_view) $owner_extra = " (YOU)";
else $owner_extra = "";\r
- echo "<h2>".get_gravatar($owner["email"], 30, 'mm', 'g', true)."$repo_view_call - $owner_name$owner_extra</h2>";
+ echo "<h2>".gwvpmini_HtmlGravatar($owner["email"], 30)."$repo_view_call - $owner_name$owner_extra</h2>";
if(!$owner_view) echo "<b>$desc</b><br>";
if($owner_view) {
foreach($bperms_f as $key=>$val) {
if($val == 1) {
$dets = gwvpmini_getUser(null, null, $key);
- echo get_gravatar($dets["email"], 18, 'mm', 'g', true)." <input type=\"checkbox\" name=\"$key\"> ".$dets["username"]."<br>";
+ echo gwvpmini_HtmlGravatar($dets["email"], 18, " ")."<input type=\"checkbox\" name=\"$key\"> ".$dets["username"]."<br>";
$nl = 1;
}
}
foreach($bperms_f as $key=>$val) {\r
if($val == 2) {\r
$dets = gwvpmini_getUser(null, null, $key);\r
- echo get_gravatar($dets["email"], 18, 'mm', 'g', true)." <input type=\"checkbox\" name=\"$key\"> ".$dets["username"]."<br>";
+ echo gwvpmini_HtmlGravatar($dets["email"], 18, " ")."<input type=\"checkbox\" name=\"$key\"> ".$dets["username"]."<br>";
$nl = 1;\r
}\r
}\r
$flon = "$flin3 (external)";
}
}
- echo "<tr><td>".get_gravatar($flin2, 18, 'mm', 'g', true)."$flon</td><td>$flin1</td><td>$flin4</td></tr>";
+ echo "<tr><td>".gwvpmini_HtmlGravatar($flin2, 18)."$flon</td><td>$flin1</td><td>$flin4</td></tr>";
}
echo "</table>";
} else {
* @param array $atts Optional, additional key/value attributes to include in the IMG tag\r
* @return String containing either just a URL or a complete image tag\r
* @source http://gravatar.com/site/implement/images/php/\r
- */\r
+ */
+function gwvpmini_HtmlGravatar($email, $size, $htmlappend="")
+{
+
+ global $use_gravatar;
+
+
+ if($use_gravatar == false) return "";
+ return get_gravatar( $email, $size, 'mm', 'g', true)."$htmlappend";
+}
+\r
function get_gravatar( $email, $s = 80, $d = 'mm', $r = 'g', $img = false, $atts = array() ) {\r
$url = 'http://en.gravatar.com/avatar/';\r
$url .= md5( strtolower( trim( $email ) ) );\r