Exemple #1
0
     // very important
     $phpThumb->setSourceFilename($_FILES['avatar']['tmp_name']);
     $phpThumb->setParameter('w', 80);
     $phpThumb->setParameter('h', 80);
     $phpThumb->setParameter('zc', 1);
     $phpThumb->setParameter('config_output_format', 'png');
     if ($phpThumb->GenerateThumbnail()) {
         include_once 'configs/globals.php';
         $membership_id = $u->getMembershipID($group_name);
         $bigfile = $app_base . "avatars/{$membership_id}/80.png";
         $smallfile = $app_base . "avatars/{$membership_id}/16.png";
         $target = $app_base . "avatars/{$membership_id}/";
         @mkdir($target);
         $phpThumb->RenderToFile($bigfile);
         makeSmallAvatar($bigfile, $smallfile);
         makeFlags($smallfile, $target);
         $u->setCustomAvatar($group_name);
     }
 } else {
     $membership_id = $u->getMembershipID($group_name);
     $u->copyAvatar($group_name, $u->getAvatarNo($group_name), $membership_id);
 }
 ob_end_clean();
 //header("location:{$service_host}{$group_name}/");
 //exit;
 $pg->setLayout($pg->FullColumn);
 $temp_translation_string_1 = $treng->_("<big><strong>You have successfully joined this group! <a href=\"%TRENGVAR_1%%TRENGVAR_2%/\">Continue...</a></strong></big><br /><br />To edit the content, go to the related page (to change your blog address, go to Blogs section) and click one of the control buttons as shown:<br /><br /><img src=\"images/controlshow.jpg\" alt=\"Example Control\" border=\"0\" width=\"600\" height=\"389\" />", "groupjoin", array($service_host, $group_name));
 $xhtml = "<div align=\"center\">\r\n\t\t\t\t\t{$temp_translation_string_1}\r\n\t\t\t\t\t</div>";
 $pg->addBlock($pg->Column, "", $xhtml, "");
 if ($pg->generateHTML()) {
     $page_content .= $pg->getHTML();
function cropCustomPicture($src, $x, $y, $w, $h)
{
    global $access_isGroupMember;
    global $group_name;
    if ($access_isGroupMember && isset($_SESSION['valid_user'])) {
        include 'configs/globals.php';
        $u = new User($_SESSION['valid_user']);
        $membership_id = $u->getMembershipID($group_name);
        $bigfile = $app_base . "avatars/{$membership_id}/80.png";
        $smallfile = $app_base . "avatars/{$membership_id}/16.png";
        $target = $app_base . "avatars/{$membership_id}/";
        $baseplace = "/var/www/html/groups/html/members/wysiwyg_files/tmp/";
        $tmpfile = $baseplace . $src;
        mkdir($target);
        makeBigAvatar($tmpfile, $bigfile, $x, $y, $w, $h);
        makeSmallAvatar($bigfile, $smallfile);
        makeFlags($smallfile, $target);
        unlink($tmpfile);
        $res = $u->setCustomAvatar($group_name);
        if ($res) {
            return '1';
        } else {
            return '0';
        }
    } else {
        return '0';
    }
}