Question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

I am using PostNuke and have decided to create a page for a local basketball
team.  I have this as the create team function:


//////
/// Create a new Team for the given Tournament
///
/// Parameters:
///                 'cid' = Tournament ID
///                'team' = Team name
///             'contact' = name of the team representative
///               'email' = representative's email
///            'homepage' = team's Homepage
//////
function standings_admin_createteam($args)
{
    // Get parameters from whatever input we need.
    list($lid,$cid,$team,$city,$shorts,$tshirt,$shortsa,$tshirta,
         $contact,$phone,$paddress,$email,$homepage,$penpts,$picturet)
         = 
pnVarCleanFromInput('lid','cid','team','city','shorts','tshirt','shortsa','t
shirta',
                   
'contact','phone','paddress','email','homepage','penpts','picturet');

    // Admin functions of this type can be called by other modules.
    extract($args);

    // Confirm authorisation code.
    if (!pnSecConfirmAuthKey()) {
        pnSessionSetVar('errormsg', _BADAUTHKEY);
        pnRedirect(pnModURL('Standings', 'admin', 'viewteams', array('lid'
=> $lid)));
        return true;
    }

    $modid      = pnModGetIDFromName('Standings');
    $modinfo    = pnModGetInfo($modid);
    $picenable  = pnModGetVar('Standings', 'picenable');

    // Notable by its absence there is no security check here.  This is
because
    // the security check is carried out within the API function and as such
we
    // do not duplicate the work here

    // Load API.
    if (!pnModAPILoad('Standings', 'admin')) {
        pnSessionSetVar('errormsg', _LOADFAILED);
        return $output->GetOutput();
    }

    // The API function is called.
    $tid = pnModAPIFunc('Standings','admin','createteam',
                        array('lid'     => $lid,
                              'team'    => $team,
                              'city'    => $city,
                              'shorts'  => $shorts,
                              'tshirt'  => $tshirt,
                              'shortsa' => $shortsa,
                              'tshirta' => $tshirta,
                              'contact' => $contact,
                              'phone'   => $phone,
                              'paddress'=> $paddress,
                              'email'   => $email,
                              'homepage'=> $homepage,
                              'penpts'  => $penpts));

    // The return value of the function is checked here
    if ($tid != false) {
        // Success
        pnSessionSetVar('statusmsg', _STANDINGSTEAMCREATED);
    }


/*
if ($picenable == 1) {
// manage picture Upload if there is a picture sent - Portrait
if ($picture!="") {
$picname = $_FILES['picture']['name'];

with:

if ($picenable == 1) {
// manage picture Upload if there is a picture sent
// make Portrait photo first
$picname = $_FILES['picturep']['name'];
if ($picname != "") {

*/
        if ($picenable == 1) {
        // manage picture Upload if there is a picture sent
        // make Portrait photo first
       $picname = $_FILES['picturet']['name'];
       if ($picname != "") {
                $pictype = $_FILES['picturet']['type'];
                $picsize = $_FILES['picturet']['size'];
               $pictemp = $_FILES['picturet']['tmp_name'];
                $picdest =
"modules/".$modinfo['directory']."/pnimages/photos/teams/team".$tid.".jpg";
               $picmax = pnModGetVar('Standings', 'picmaxt');
               $picwidth = pnModGetVar('Standings', 'xsizet');
               $picheight = pnModGetVar('Standings', 'ysizet');
               $picqual = pnModGetVar('Standings', 'picqualt');

       $picerror = "";
       // check if file is of the right type (jpg - gif - png) - Set in
config???
       if ($pictype != "image/pjpeg") {
          $picerror = _STANDINGSPLAYERPICTERR1;
       }
       if ($picsize > $picmax) {
          $picerror = _STANDINGSPLAYERPICTERR2;
       }
       if ($picerror == "") {
              $g_is=getimagesize($pictemp);
              if(($g_is[0]-$picwidth)>=($g_is[1]-$picheight)) {
                  $g_iw=$picwidth;
                  $g_ih=($picwidth/$g_is[0])*$g_is[1];
              } else {


                  $g_ih=$picheight;
                  $g_iw=($g_ih/$g_is[1])*$g_is[0];
              }

              $img_src = imageCreateFromJpeg($pictemp);
              $img_dst = imageCreateTrueColor($g_iw,$g_ih);
              imageCopyResampled($img_dst, $img_src, 0, 0, 0, 0, $g_iw,
$g_ih, $g_is[0], $g_is[1]);
              imageJpeg($img_dst, $picdest, $picqual);
              imageDestroy($img_dst);
       }
    }
    
    }
    
    // This function generated no output, and so now it is complete we
redirect
    // the user to an appropriate page for them to carry on their work
    pnRedirect(pnModURL('Standings', 'admin', 'viewteams', array('lid' =>
$lid)));

    // Return
    return true;

}

The only problem is that the image upload does not seem to work.   Any help
that you might provide or guidance would be greatly appreciated.  Thank you
in advance.

Jacob L. Hackamack

[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux