| Server IP : 180.180.241.3 / Your IP : 216.73.216.35 Web Server : Microsoft-IIS/7.5 System : Windows NT NETWORK-NHRC 6.1 build 7601 (Windows Server 2008 R2 Standard Edition Service Pack 1) i586 User : IUSR ( 0) PHP Version : 5.3.28 Disable Function : NONE MySQL : ON | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /AppServ/www/app/webroot/news/tmp/install_53214838987c8/admin/tables/ |
Upload File : |
<?php
/*------------------------------------------------------------------------
# Timage
# ------------------------------------------------------------------------
# author Trust Elegance
# copyright Copyright (C) 2012 trustelegance.com. All Rights Reserved.
# @license - http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
# Websites: http://www.trustelegance.com
# Technical Support: http://http://www.trustelegance.com/index.php?option=com_rsform&view=rsform&Itemid=55
-------------------------------------------------------------------------*/
defined('_JEXEC') or die('Restricted access');
jimport('joomla.database.table');
class TimageTableTimage extends JTable
{
function __construct(&$db)
{
parent::__construct('#__timage', 'id', $db);
}
public function bind($array, $ignore = '')
{
/*Upload Script Start Here*/
$rootsiteaddress=JPATH_BASE;
$rootsiteexplode=explode('administrator',$rootsiteaddress);
$filename = basename($_FILES['upfile']['name']);
$postid=rand(999999, 1005);
if($filename){
$ext = substr($filename, strrpos($filename, '.') + 1);
if (($ext=="jpg")||($ext=="gif")||($ext=="png")||($ext=="bmp") && ($_FILES["upfile"]["size"] < 2000000)) {
$_FILES['upfile']['name']=$postid.".$ext";
$target = $rootsiteexplode[0].'/media/com_timage/timagelevel/';
$target = $target . basename( $_FILES['upfile']['name']) ;
if(move_uploaded_file($_FILES['upfile']['tmp_name'], $target)){
$post['upfile']=$_FILES['upfile']['name'];
}
}
}
/*Upload Script End Here*/
if (isset($array['params']) && is_array($array['params']))
{
$parameter = new JRegistry;
$parameter->loadArray($array['params']);
$array['imageloc'] = $_FILES["upfile"]["name"];
$array['params'] = (string)$parameter;
}
return parent::bind($array, $ignore);
}
public function load($pk = null, $reset = true)
{
if (parent::load($pk, $reset))
{
$params = new JRegistry;
$params->loadJSON($this->params);
$this->params = $params;
return true;
}
else
{
return false;
}
}
protected function _getAssetName()
{
$k = $this->_tbl_key;
return 'com_timage.message.'.(int) $this->$k;
}
protected function _getAssetTitle()
{
return $this->greeting;
}
protected function _getAssetParentId()
{
$asset = JTable::getInstance('Asset');
$asset->loadByName('com_timage');
return $asset->id;
}
}
?>