Ejemplo n.º 1
0
 /**
  * Store the uploaded image
  */
 function store()
 {
     initiateSession();
     $this->set("title", "Image Upload");
     if (!isset($_SESSION['user_id'])) {
         $this->set("message", "User is not logged in");
         return;
     }
     $img = new Image($_FILES['content_image']);
     if ($img->validate() == false) {
         $this->set("message", "Not an valid image file");
     } else {
         $img->setUploadPath(ROOT . DS . 'public' . DS . 'uploads' . DS . 'users');
         if (isset($_POST['content_caption'])) {
             $caption = sqlSafe($_POST['content_caption']);
         } else {
             $caption = null;
         }
         $author = sqlSafe($_SESSION['user_username']);
         $date = date("Y-m-d H:i:s");
         $img->moveUploadedImage();
         $path = $img->getUploadLocation();
         if ($this->Picture->insertPicture($path, $caption, $author, $date)) {
             $this->set("message", "Upload successful");
         } else {
             $this->set("message", "Upload failed");
         }
     }
 }
Ejemplo n.º 2
0
 /**
  * Sets the contents for the processing of user registration form
  */
 function register()
 {
     initiateSession();
     $this->set("title", "IEEE NIEC | New User Registration");
     if (isset($_SESSION['user_id'])) {
         header("LOCATION: /indexs/home");
     }
     $name = sqlSafe($_POST['name']);
     $username = sqlSafe($_POST['username']);
     $password = sqlSafe($_POST['password']);
     $password2 = sqlSafe($_POST['password2']);
     $salt = generateSalt();
     $email = sqlSafe($_POST['email']);
     $dor = date("Y-m-d H:i:s");
     $dob = sqlSafe($_POST['dob']);
     $profilepicPath = ROOT . DS . 'public' . DS . 'uploads' . DS . 'dp' . DS . 'default.jpg';
     if ($password === $password2) {
         $password = generateHash($password . $salt);
     } else {
         $this->set("message", "Password doesn't match");
     }
     $profilepic = new Image($_FILES['profile_picture']);
     $profilepic->setUploadPath(ROOT . DS . 'public' . DS . 'uploads' . DS . 'dp');
     if ($profilepic->validate() == false) {
         $this->set("message", "Unsupported Image Format for profile picture. Try again.");
     } else {
         if ($profilepic->moveUploadedImage() == true) {
             $profilepicPath = $profilepic->getUploadLocation();
             $profilepic = null;
         } else {
             $this->set("message", "Error uploading profile picture. Try again after some time.");
         }
     }
     if ($this->User->insertUser($name, $username, $password, $salt, $email, $dob, $dor, $profilepicPath) == -1) {
         $this->set("message", "There was some error processing your request. Try again later.");
     } else {
         $this->sendActivationMail($username);
         $this->set("message", "Registration Successful. Please check your mail to activate your account.");
     }
 }
Ejemplo n.º 3
0
 /**
  * handleImageUpload
  * @author Cornelius Hansjakob <*****@*****.**>
  * @version 1.0
  */
 private function handleImageUpload()
 {
     $this->core->logger->debug('media->controllers->UploadController->handleImageUpload()');
     $objImage = new Image();
     $objImage->setUpload($this->objUpload);
     $objImage->setParentId($this->intParentId);
     $objImage->setParentTypeId($this->core->sysConfig->parent_types->folder);
     $objImage->setUploadPath(GLOBAL_ROOT_PATH . $this->core->sysConfig->upload->images->path->local->private);
     $objImage->setPublicFilePath(GLOBAL_ROOT_PATH . $this->core->sysConfig->upload->images->path->local->public);
     $objImage->setDefaultImageSizes($this->core->sysConfig->upload->images->default_sizes->default_size->toArray());
     $objImage->add('Filedata');
     $this->writeViewData($objImage);
 }
Ejemplo n.º 4
0
 /**
  * handleImageVersionUpload
  * @author Thomas Schedler <*****@*****.**>
  */
 private function handleImageVersionUpload()
 {
     $this->core->logger->debug('media->controllers->UploadController->handleImageVersionUpload()');
     $objImage = new Image();
     $objImage->setUpload($this->objUpload);
     $objImage->setId($this->intFileId);
     $objImage->setSegmenting($this->core->sysConfig->upload->images->segmenting->enabled == 'true' ? true : false);
     $objImage->setNumberOfSegments($this->core->sysConfig->upload->images->segmenting->number_of_segments);
     $objImage->setUploadPath(GLOBAL_ROOT_PATH . $this->core->sysConfig->upload->images->path->local->private);
     $objImage->setPublicFilePath(GLOBAL_ROOT_PATH . $this->core->sysConfig->upload->images->path->local->public);
     $objImage->setDefaultImageSizes($this->core->sysConfig->upload->images->default_sizes->default_size->toArray());
     $objImage->setLanguageId($this->intLanguageId);
     $objImage->addVersion(self::UPLOAD_FIELD);
 }
Ejemplo n.º 5
0
 * You should have received a copy of the GNU General Public License
 * along with ZOOLU. If not, see http://www.gnu.org/licenses/gpl-3.0.html.
 *
 * For further information visit our website www.getzoolu.org 
 * or contact us at zoolu@getzoolu.org
 *
 * @category   ZOOLU
 * @package    cli
 * @copyright  Copyright (c) 2008-2009 HID GmbH (http://www.hid.ag)
 * @license    http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License, Version 3
 * @version    $Id: version.php
 */
/**
 * include general (autoloader, config)
 */
require_once dirname(__FILE__) . '/../sys_config/general.inc.php';
try {
    /** 
     * @var Image
     */
    $objImage = new Image();
    $objImage->setUploadPath(GLOBAL_ROOT_PATH . $core->sysConfig->upload->images->path->local->private);
    $objImage->setPublicFilePath(GLOBAL_ROOT_PATH . $core->sysConfig->upload->images->path->local->public);
    $objImage->setDefaultImageSizes($core->sysConfig->upload->images->default_sizes->default_size->toArray());
    $core->logger->debug('start render all images ...');
    $objImage->renderAllImages();
    $core->logger->debug('... finished render all images!');
} catch (Exception $exc) {
    $core->logger->err($exc);
    exit;
}