/admin/app/controllers/stoxfoto_controller.php
PHP | 1304 lines | 1129 code | 136 blank | 39 comment | 90 complexity | 38aa3320bf5619e22b5e7cfe59bf2a3f MD5 | raw file
Possible License(s): LGPL-2.1, AGPL-1.0
- <?php
- class StoxfotoController extends AppController
- {
- var $name='Stoxfotos';
- var $helpers = array('Html','Javascript','Ajax','Pagination','error');
- var $components = array('Pagination','Sendmail','Download','Image');
-
- function managestoxitem()
- {
- $this->checkSession();
- $this->pageTitle = 'Manage Stoxfoto';
- $this->layout = 'default_user';
- ################################################ SUBMISSION ######################
- $photoQuery = "SELECT * from stoxfotos WHERE media_type='Photos' and is_approved='0' and is_temp='0' ";
- $photoQuery_res = mysql_query($photoQuery);
- $this->set('Numofphoto',mysql_num_rows($photoQuery_res));
-
- $photoQuery = "SELECT * from stoxfotos WHERE media_type='PhotoElement' and is_approved='0' and is_temp='0' ";
- $photoQuery_res = mysql_query($photoQuery);
- $this->set('NumofphotoElement',mysql_num_rows($photoQuery_res));
-
- $photoQuery = "SELECT * from stoxfotos WHERE media_type='Illustration' and is_approved='0' and is_temp='0' ";
- $photoQuery_res = mysql_query($photoQuery);
- $this->set('Numofillustration',mysql_num_rows($photoQuery_res));
-
- $photoQuery = "SELECT * from stoxfotos WHERE media_type='Flash' and is_approved='0' and is_temp='0' ";
- $photoQuery_res = mysql_query($photoQuery);
- $this->set('Numofflash',mysql_num_rows($photoQuery_res));
-
- $photoQuery = "SELECT * from stoxfotos WHERE media_type='Movie' and is_approved='0' and is_temp='0' ";
- $photoQuery_res = mysql_query($photoQuery);
- $this->set('Numofmovie',mysql_num_rows($photoQuery_res));
-
- $photoQuery = "SELECT * from stoxfotos WHERE media_type='Web' and is_approved='0' and is_temp='0' ";
- $photoQuery_res = mysql_query($photoQuery);
- $this->set('Numofweb',mysql_num_rows($photoQuery_res));
-
-
- ################################################ SUBMISSION ######################
- }
-
- function managestoxsubmission($viewType=null)
- {
- $this->checkSession();
- $this->pageTitle = 'Manage Stoxfoto '.ucfirst($viewType);
- $this->layout = 'default_user';
- $this->set('pageView',$viewType);
-
- if((isset($this->params['url']['hfsearch']) && $this->params['url']['hfsearch']!='') || isset($_REQUEST['hfsearch']) )
- $viewSearchType=$_REQUEST['hfsearch'];
-
-
- $select = "SELECT stoxfotos.id,stoxfotos.title ,users.username , stoxfoto_categories.category_name,stoxfotos.stoxfoto_category_id ,stoxfotos.media_type ,stoxfotos.is_featured,stoxfotos.numofview,stoxfotos.posted_date,stoxfotos.is_adultcontent ,stoxfotos.stoxfoto_code ,stoxfotos.is_blocked ,stoxfotos.is_republished,stoxfotos.exclusive,
- IF(stoxfotos.media_type='Photos',stoxfoto_photo.photo_name ,IF(stoxfotos.media_type='PhotoElement',stoxfoto_photoelement.photo_name,IF(stoxfotos.media_type='Illustration',stoxfoto_illustration.sale_imagefile,IF(stoxfotos.media_type='Flash',stoxfoto_flash.sale_imagefile,IF(stoxfotos.media_type='Movie',stoxfoto_movie.sale_imagefile,IF(stoxfotos.media_type='Web',stoxfoto_web.sale_imagefile,'nostoximage.jpg')))))) as photoname ,
- stoxfotos_tickets.msg_to_user ,stoxfotos_tickets.ticket_number,stoxfotos_tickets.status ";
-
-
- $from="from stoxfotos
-
- LEFT JOIN stoxfoto_categories ON (stoxfotos.stoxfoto_category_id=stoxfoto_categories.id)
- LEFT JOIN users ON (stoxfotos.user_id=users.id)
- LEFT JOIN stoxfoto_photo ON(stoxfotos.media_type='Photos' and stoxfoto_photo.stoxfoto_id =stoxfotos.id )
- LEFT JOIN stoxfoto_photoelement ON(stoxfotos.media_type='PhotoElement' and stoxfoto_photoelement.stoxfoto_id =stoxfotos.id )
- LEFT JOIN stoxfoto_illustration ON(stoxfotos.media_type='Illustration' and stoxfoto_illustration.stoxfoto_id =stoxfotos.id )
- LEFT JOIN stoxfoto_flash ON(stoxfotos.media_type='Flash' and stoxfoto_flash.stoxfoto_id =stoxfotos.id )
- LEFT JOIN stoxfoto_movie ON(stoxfotos.media_type='Movie' and stoxfoto_movie.stoxfoto_id =stoxfotos.id )
- LEFT JOIN stoxfoto_web ON(stoxfotos.media_type='Web' and stoxfoto_web.stoxfoto_id =stoxfotos.id )
- LEFT JOIN stoxfotos_tickets ON stoxfotos.id=stoxfotos_tickets.stoxfoto_id
-
- ";
-
- $where="WHERE 1 AND stoxfotos.is_temp='0' AND stoxfotos.is_approved='0' ";
-
- $searchpass='';
- if(isset($viewSearchType) && $viewSearchType=='title' && isset($_REQUEST['txtsrch']) && $_REQUEST['txtsrch']!='')
- {
- $where.=" AND stoxfotos.title like '%".$_REQUEST['txtsrch']."%' ";
- $searchpass = "&txtsrch=".$_REQUEST['txtsrch'] ;
- }
- if(isset($viewSearchType) && $viewSearchType=='exclusive')
- {
- $where.=" AND stoxfotos.exclusive='Yes'";
- //$searchexclusive = 'Yes';
- $searchpass = "&exclusive=yes" ;
- }
- if(isset($viewSearchType) && $viewSearchType=='daterange')
- {
- if($_REQUEST['inpdatefrom'] && $_REQUEST['inpdatefrom']!='mm/dd/YY')
- {
- $eventFromDate=date("Y-m-d",strtotime($_REQUEST['inpdatefrom']));
- $urlfromdate = $_REQUEST['inpdatefrom'];
- }
- else
- {
- $eventFromDate=date("Y-m-d");
- $urlfromdate = $_REQUEST['inpdatefrom'];
-
- }
-
- if($_REQUEST['inpdateto'] && $_REQUEST['inpdateto']!='mm/dd/YY')
- {
- $eventToDate=date("Y-m-d",strtotime($_REQUEST['inpdateto']));
- $urltodate = $_REQUEST['inpdateto'];
- }
- else
- {
- $eventToDate=date("Y-m-d");
- $urltodate = $_REQUEST['inpdateto'];
-
- }
-
- $where.=" AND stoxfotos.posted_date between '".$eventFromDate."' and '".$eventToDate."' ";
- $searchpass = "&inpdatefrom=".$urlfromdate."&inpdateto=".$urltodate ;
- }
- $this->set('searchpass',$where);
-
-
-
-
-
-
- $others=" ";
-
- if($viewType || (isset($_REQUEST['listview']) && $_REQUEST['listview']!='') )
- {
- if($viewType)
- $listView = $viewType ;
- if(isset($_REQUEST['listview']) && $_REQUEST['listview']!='')
- $listView = $_REQUEST['listview'] ;
- }
-
- $where.=" and stoxfotos.media_type='".$listView."' ";
-
- $others.=" order by stoxfotos.id desc ";
-
-
- if(isset($viewSearchType) && $viewSearchType!='')
- {
- $PassParameter="listview=".$listView."&hfsearch=".$viewSearchType.$searchpass;
- }
- else
- $PassParameter="listview=".$listView;
-
- $CountField="stoxfotos.id";
- $this->set("controller","stoxfoto");
- $this->set("action","managestoxsubmission");
-
- //echo $select.$from.$where.$others ;
- $this->pagination($select,$from,$where,$others,$CountField,$this->params['url'],$PassParameter);
- if(isset($this->params['url']['Page']) || isset($viewSearchType))
- {
- $this->render("managestoxsubmission2","ajax");
- }
- }
-
-
-
- function pagination($select,$from,$where,$others,$CountField,$arg,$PassParameter)
- {
- if(isset($arg['Page']))
- $pageFlag=$arg['Page'];
- $this->set("PassParameter",$PassParameter);
- $SetUserNumberOfVpsPerPage=50; /* Defined in config->paths.php*/
-
- $this->set("BackgroundClass",'pagination');
- $this->set("SelectedPage",'pagination_over');
- $this->set("Linkpage",'pagination_over');
- $this->set("FirstImage",'fdd.gif');
- $this->set("PreviousImage",'previous.gif');
- $this->set("NextImage",'next.gif');
- $this->set("LastImage",'rewd.gif');
-
- $UserNumberOfVpsPerPage=50; /* Defined in config->paths.php*/
- if(!is_numeric($UserNumberOfVpsPerPage)|| (intval($UserNumberOfVpsPerPage)!=$UserNumberOfVpsPerPage)||($UserNumberOfVpsPerPage<=0))
- $UserNumberOfVpsPerPage = $SetUserNumberOfVpsPerPage;
-
- if(!isset($arg['Page'])) $arg['Page']=1;
- if(!isset($arg['Offset'])) $arg['Offset']=0;
-
- //echo "$select $from $where $others" ;
- $Query_ForNumber_Records=mysql_query("$select $from $where $others") or die('Line no 120' . mysql_error());
- //$Result_Query_ForNumber_Records=mysql_fetch_object($Query_ForNumber_Records);
-
- //$NoOfVps=$Result_Query_ForNumber_Records->NoOfVps;
- $NoOfVps=mysql_num_rows($Query_ForNumber_Records);
-
- $NumberOfVpsPerPage=$UserNumberOfVpsPerPage;
- $NoOfPages=ceil($NoOfVps/$NumberOfVpsPerPage); //3
- if($arg['Offset']==$NoOfVps)
- {
- if(isset($Offset))
- {
- $Offset=$Offset-$NumberOfVpsPerPage;
- $Page--;
- if($Offset<0)
- {
- $Offset=0;$Page=1;
- }
- }else{
- $Offset=0;$Page=1;
- }
- }
-
- $this->set("Page",$arg['Page']);
- $this->set("Offset",$arg['Offset']);
- $this->set("NumberOfVpsPerPage",$NumberOfVpsPerPage);
- $this->set("NoOfPages",$NoOfPages);
- $this->set("UserNumberOfVpsPerPage",$UserNumberOfVpsPerPage);
-
- //print "$select $from $where $others";
- $this->set("qryOthr","$select $from $where)");
- $this->set("tesrqryOthr","$where $others)");
-
- //echo "$select $from $where $others LIMIT ".$arg['Offset'].",$NumberOfVpsPerPage" ;
- $SelectRecord = mysql_query("$select $from $where $others LIMIT ".$arg['Offset'].",$NumberOfVpsPerPage") or die('Line no '.__LINE__ . mysql_error());
- $this->set("query",$SelectRecord);
- }
-
-
- function approvestoxitem($stocxid=null)
- {
- $this->layout="loginblank";
- $stoxInfo = $this->stoxitemInfo($stocxid);
- $this->set('mediatype',$stoxInfo['media_type']);
- $this->set('Stoxinfo',$stoxInfo);
-
- if($stoxInfo['media_type']=='Photos')
- {
- ###### PHOTO INFORMATION
- $selectImageinfo = "SELECT photo_name,orginal_photo_name from stoxfoto_photo where stoxfoto_id='".$stoxInfo['id']."' ";
- $selectImageinfo_query = mysql_query($selectImageinfo);
- if(mysql_num_rows($selectImageinfo_query)>0)
- {
- $selectImageinfo_arr = mysql_fetch_array($selectImageinfo_query);
- $this->set('stoxItemImage','../../app/webroot/stoxfoto_media/photo/medium/'.$selectImageinfo_arr['photo_name']);
- $this->set('OrgstoxItemImage',$selectImageinfo_arr['photo_name']);
-
- }
-
-
- $stoxinfosql = "
- SELECT stoxfoto_photo_pricing.* ,stoxfoto_photosize.printable_size ,if(stoxfoto_photosize.caption='Original size','Special Usage License',stoxfoto_photosize.caption)as caption,
- if(stoxfoto_photosize.width_size>0,CONCAT_WS(' X ',stoxfoto_photosize.width_size,stoxfoto_photosize.height_size),'Original size') as Photpixelsize
- from stoxfoto_photo_pricing
- LEFT JOIN stoxfoto_photosize ON (stoxfoto_photo_pricing.stoxfoto_photosize_id=stoxfoto_photosize.id)
- where stoxfoto_photo_pricing.stoxfoto_id='".$stocxid."' order by stoxfoto_photosize.id";
-
- $noofdownload_res = mysql_query($stoxinfosql);
- $tempUploadingarray=array();
- while($noofdownload_arr = mysql_fetch_array($noofdownload_res))
- {
- $tempUploadingarray[] = array('id'=>$noofdownload_arr['id'],'is_donate'=>$noofdownload_arr['donate'],'caption'=>$noofdownload_arr['caption'],'printsize'=>$noofdownload_arr['printable_size'],'pixels'=>$noofdownload_arr['Photpixelsize'],'pixelprice'=>$noofdownload_arr['price']);
- }
- $this->set('Uploadpricearray',$tempUploadingarray);
- $this->set('fileformat','JPEG');
- ###### PHOTO INFORMATION
-
- $this->set('pricelistElement','show_stoxprice_photos');
-
- ###### Freee sample file ###########
- $sampleimgFile = "SELECT * from stoxfoto_photo_pricing where stoxfoto_id='".$stocxid."' and donate='Yes'";
- $sampleimgFile_res = mysql_query($sampleimgFile);
- if(mysql_num_rows($sampleimgFile_res)>0)
- $SampleFile = 'photo/'.$stocxid;
- else
- $SampleFile = '';
- #################################
- }
-
- if($stoxInfo['media_type']=='PhotoElement')
- {
- ###### PHOTO INFORMATION
- $selectImageinfo = "SELECT photo_name,orginal_photo_name from stoxfoto_photoelement where stoxfoto_id='".$stoxInfo['id']."' ";
- $selectImageinfo_query = mysql_query($selectImageinfo);
- if(mysql_num_rows($selectImageinfo_query)>0)
- {
- $selectImageinfo_arr = mysql_fetch_array($selectImageinfo_query);
- $this->set('stoxItemImage','../../app/webroot/stoxfoto_media/element/medium/'.$selectImageinfo_arr['photo_name']);
- $this->set('OrgstoxItemImage',$selectImageinfo_arr['photo_name']);
- }
-
-
- $stoxinfosql = "
- SELECT stoxfoto_photo_pricing.* ,stoxfoto_photosize.printable_size ,if(stoxfoto_photosize.caption='Original size','Special Usage License',stoxfoto_photosize.caption)as caption,
- if(stoxfoto_photosize.width_size>0,CONCAT_WS(' X ',stoxfoto_photosize.width_size,stoxfoto_photosize.height_size),'Original size') as Photpixelsize
- from stoxfoto_photo_pricing
- LEFT JOIN stoxfoto_photosize ON (stoxfoto_photo_pricing.stoxfoto_photosize_id=stoxfoto_photosize.id)
- where stoxfoto_photo_pricing.stoxfoto_id='".$stocxid."' order by stoxfoto_photosize.id";
-
- $noofdownload_res = mysql_query($stoxinfosql);
- $tempUploadingarray=array();
- while($noofdownload_arr = mysql_fetch_array($noofdownload_res))
- {
- $tempUploadingarray[] = array('id'=>$noofdownload_arr['id'],'is_donate'=>$noofdownload_arr['donate'],'caption'=>$noofdownload_arr['caption'],'printsize'=>$noofdownload_arr['printable_size'],'pixels'=>$noofdownload_arr['Photpixelsize'],'pixelprice'=>$noofdownload_arr['price']);
- }
- $this->set('Uploadpricearray',$tempUploadingarray);
- $this->set('fileformat','PNG');
- $this->set('pricelistElement','show_stoxprice_photos');
- ###### PHOTO INFORMATION
- ###### Freee sample file ###########
- $sampleimgFile = "SELECT * from stoxfoto_photo_pricing where stoxfoto_id='".$stocxid."' and donate='Yes'";
- $sampleimgFile_res = mysql_query($sampleimgFile);
- if(mysql_num_rows($sampleimgFile_res)>0)
- $SampleFile = 'element/'.$stocxid;
- else
- $SampleFile = '';
- #################################
-
- }
-
- if($stoxInfo['media_type']=='Illustration')
- {
- ###### PHOTO INFORMATION
- $selectImageinfo = "SELECT sale_epsfile,donate_epsfile,sale_imagefile,sale_orginal_imagefile,donate_epsfile from stoxfoto_illustration where stoxfoto_id='".$stoxInfo['id']."' ";
- $selectImageinfo_query = mysql_query($selectImageinfo);
- if(mysql_num_rows($selectImageinfo_query)>0)
- {
- $selectImageinfo_arr = mysql_fetch_array($selectImageinfo_query);
- $this->set('stoxItemImage','../../app/webroot/stoxfoto_media/illustration/preview/medium/'.$selectImageinfo_arr['sale_imagefile']);
- $this->set('OrgstoxItemImage',$selectImageinfo_arr['sale_imagefile']);
-
- $this->set('OrgstoxFile',$selectImageinfo_arr['sale_epsfile']);
- $this->set('OrgstoxDownloadFile',$selectImageinfo_arr['donate_epsfile']);
-
- ###### Freee sample file ###########
- if($selectImageinfo_arr['donate_epsfile']!='')
- $SampleFile = 'illustration/'.$stocxid;
- else
- $SampleFile = '';
- #################################
-
-
- }
-
-
- $stoxinfosql = "SELECT stoxfoto_illustration_pricing.* From stoxfoto_illustration_pricing
- where stoxfoto_illustration_pricing.stoxfoto_id='".$stocxid."' order by stoxfoto_illustration_pricing.id";
-
- $noofdownload_res = mysql_query($stoxinfosql);
- $tempUploadingarray=array();
- while($noofdownload_arr = mysql_fetch_array($noofdownload_res))
- {
- $tempUploadingarray[] = array('id'=>$noofdownload_arr['id'],'caption'=>$noofdownload_arr['licence_type'],'price'=>$noofdownload_arr['licence_fee']);
- }
- $this->set('Uploadpricearray',$tempUploadingarray);
- $this->set('fileformat','AI');
- $this->set('pricelistElement','show_stoxprice_illustration');
- ###### PHOTO INFORMATION
-
-
-
-
- }
-
- if($stoxInfo['media_type']=='Flash')
- {
- ###### PHOTO INFORMATION
- $selectImageinfo = "SELECT sale_imagefile,original_sale_imagefile,donate_zipfile,sale_zipfile from stoxfoto_flash where stoxfoto_id='".$stoxInfo['id']."' ";
- $selectImageinfo_query = mysql_query($selectImageinfo);
- if(mysql_num_rows($selectImageinfo_query)>0)
- {
- $selectImageinfo_arr = mysql_fetch_array($selectImageinfo_query);
- $this->set('stoxItemImage','../../app/webroot/stoxfoto_media/flash/image/medium/'.$selectImageinfo_arr['sale_imagefile']);
- $this->set('OrgstoxItemImage',$selectImageinfo_arr['sale_zipfile']);
- $this->set('OrgstoxFile',$selectImageinfo_arr['sale_zipfile']);
- $this->set('OrgstoxDownloadFile',$selectImageinfo_arr['donate_zipfile']);
-
- ###### Freee sample file ###########
- if($selectImageinfo_arr['donate_zipfile']!='')
- $SampleFile = 'flash/'.$stocxid;
- else
- $SampleFile = '';
- #################################
-
-
-
- }
-
-
- $stoxinfosql = "SELECT stoxfoto_flash_pricing.* From stoxfoto_flash_pricing
- where stoxfoto_flash_pricing.stoxfoto_id='".$stocxid."' order by stoxfoto_flash_pricing.id";
-
- $noofdownload_res = mysql_query($stoxinfosql);
- $tempUploadingarray=array();
- while($noofdownload_arr = mysql_fetch_array($noofdownload_res))
- {
- $tempUploadingarray[] = array('id'=>$noofdownload_arr['id'],'caption'=>$noofdownload_arr['licence_type'],'price'=>$noofdownload_arr['licence_fee']);
- }
- $this->set('Uploadpricearray',$tempUploadingarray);
- $this->set('fileformat','ZIP');
- $this->set('pricelistElement','show_stoxprice_illustration');
- ###### PHOTO INFORMATION
- }
-
- if($stoxInfo['media_type']=='Movie')
- {
- ###### PHOTO INFORMATION
- $selectImageinfo = "SELECT sale_imagefile,original_sale_imagefile,movie_type,CONCAT_WS(' X ',moviesizeX,moviesizeY) as stxfileXY , moviefilesize , moviesizefps ,movielength , donate_moviefile,sale_moviefile from stoxfoto_movie where stoxfoto_id='".$stoxInfo['id']."' ";
- $selectImageinfo_query = mysql_query($selectImageinfo);
- if(mysql_num_rows($selectImageinfo_query)>0)
- {
- $selectImageinfo_arr = mysql_fetch_array($selectImageinfo_query);
- $this->set('stoxItemImage','../../app/webroot/stoxfoto_media/movie/image/medium/'.$selectImageinfo_arr['sale_imagefile']);
- $this->set('OrgstoxItemImage',$selectImageinfo_arr['sale_moviefile']);
- $this->set('fileformat',$selectImageinfo_arr['movie_type']);
-
- $this->set('fileXY',$selectImageinfo_arr['stxfileXY']);
- $this->set('movfilesize',$selectImageinfo_arr['moviefilesize']);
- $this->set('movfilefps',$selectImageinfo_arr['moviesizefps']);
- $this->set('movfilelength',$selectImageinfo_arr['movielength']);
-
- $this->set('OrgstoxFile',$selectImageinfo_arr['sale_moviefile']);
- $this->set('OrgstoxDownloadFile',$selectImageinfo_arr['donate_moviefile']);
-
- ###### Freee sample file ###########
- if($selectImageinfo_arr['donate_moviefile']!='')
- $SampleFile = 'movie/'.$stocxid;
- else
- $SampleFile = '';
- #################################
-
-
-
-
- }
-
-
- $stoxinfosql = "SELECT stoxfoto_movie_pricing.* From stoxfoto_movie_pricing
- where stoxfoto_movie_pricing.stoxfoto_id='".$stocxid."' order by stoxfoto_movie_pricing.id";
-
- $noofdownload_res = mysql_query($stoxinfosql);
- $tempUploadingarray=array();
- while($noofdownload_arr = mysql_fetch_array($noofdownload_res))
- {
- $tempUploadingarray[] = array('id'=>$noofdownload_arr['id'],'caption'=>$noofdownload_arr['licence_type'],'price'=>$noofdownload_arr['licence_fee']);
- }
- $this->set('Uploadpricearray',$tempUploadingarray);
-
- $this->set('pricelistElement','show_stoxprice_illustration');
- ###### PHOTO INFORMATION
- }
-
- if($stoxInfo['media_type']=='Web')
- {
- ###### PHOTO INFORMATION
- $selectImageinfo = "SELECT sale_imagefile,original_sale_imagefile,movie_type,sale_zipfile from stoxfoto_web where stoxfoto_id='".$stoxInfo['id']."' ";
- $selectImageinfo_query = mysql_query($selectImageinfo);
- if(mysql_num_rows($selectImageinfo_query)>0)
- {
- $selectImageinfo_arr = mysql_fetch_array($selectImageinfo_query);
- $this->set('stoxItemImage','../../app/webroot/stoxfoto_media/web/image/medium/'.$selectImageinfo_arr['sale_imagefile']);
- $this->set('OrgstoxItemImage',$selectImageinfo_arr['sale_imagefile']);
- $this->set('fileformat',$selectImageinfo_arr['movie_type']);
- $this->set('OrgstoxFile',$selectImageinfo_arr['sale_zipfile']);
-
- }
-
-
- $stoxinfosql = "SELECT stoxfoto_web_pricing.* From stoxfoto_web_pricing
- where stoxfoto_web_pricing.stoxfoto_id='".$stocxid."' order by stoxfoto_web_pricing.id";
-
- $noofdownload_res = mysql_query($stoxinfosql);
- $tempUploadingarray=array();
- while($noofdownload_arr = mysql_fetch_array($noofdownload_res))
- {
- $tempUploadingarray[] = array('id'=>$noofdownload_arr['id'],'caption'=>$noofdownload_arr['licence_type'],'price'=>$noofdownload_arr['licence_fee']);
- }
- $this->set('Uploadpricearray',$tempUploadingarray);
-
- $this->set('pricelistElement','show_stoxprice_illustration');
- ###### PHOTO INFORMATION
- }
- $this->set('sampledownload',$SampleFile);
-
-
- }
-
-
- function stoxitemInfo($stoxfotoid=null)
- {
- $getInfo = "
- SELECT stoxfotos.id,stoxfotos.stoxfoto_code,stoxfotos.is_featured,stoxfotos.title,stoxfoto_categories.category_name ,stoxfotos.stoxfoto_category_id,GROUP_CONCAT(stoxfoto_tag.tagname) as taglist ,stoxfotos.media_type,stoxfotos.exclusive,stoxfotos.model_release,stoxfotos.property_release,stoxfotos.orginal_model_release,stoxfotos.orginal_property_release,stoxfotos.posted_date,users.username,stoxfotos.user_id,stoxfotos.numofview , stoxfotos.is_adultcontent ,stoxfotos.is_approved
-
- ,stoxfotos_tickets.ticket_number , stoxfotos_tickets.msg_to_user
- from stoxfotos
- LEFT JOIN stoxfoto_tag ON (stoxfoto_tag.stoxfoto_id=stoxfotos.id)
- LEFT JOIN stoxfoto_categories ON(stoxfotos.stoxfoto_category_id=stoxfoto_categories.id)
- LEFT Join users On (stoxfotos.user_id=users.id)
- LEFT JOIN stoxfotos_tickets ON (stoxfotos_tickets.stoxfoto_id=stoxfotos.id)
- where stoxfotos.id='".$stoxfotoid."'
- GROUP BY stoxfotos.id
- " ;
-
- $getInfo_res = mysql_query($getInfo);
-
- $getInfo_array = mysql_fetch_array($getInfo_res);
- //$this->set('firstSteparray',$getInfo_array);
- return $getInfo_array ;
-
- }
- function downloadstoxfotophoto()
- {
- $fileName=$this->params['url']['f'];
- $fileType=$this->params['url']['type'];
- $basePath='../../app/webroot/stoxfoto_media/photo/';
- $this->Download->downloadFile($basePath,$fileName);
- }
- function downloadstoxfotophotoelement()
- {
- $fileName=$this->params['url']['f'];
- $fileType=$this->params['url']['type'];
- $basePath='../../app/webroot/stoxfoto_media/element/';
- $this->Download->downloadFile($basePath,$fileName);
- }
-
- function downloadstoxfotoillustration()
- {
- $fileName=$this->params['url']['f'];
- $fileType=$this->params['url']['type'];
- $basePath='../../app/webroot/stoxfoto_media/illustration/eps/';
- $this->Download->downloadFile($basePath,$fileName);
- }
- function downloadstoxfotoflash()
- {
- $fileName=$this->params['url']['f'];
- $fileType=$this->params['url']['type'];
- $basePath='../../app/webroot/stoxfoto_media/flash/zip/';
- $this->Download->downloadFile($basePath,$fileName);
- }
- function downloadstoxfotoweb()
- {
- $fileName=$this->params['url']['f'];
- $fileType=$this->params['url']['type'];
- $basePath='../../app/webroot/stoxfoto_media/web/zip/';
- $this->Download->downloadFile($basePath,$fileName);
- }
-
- function downloadstoxfotomovie()
- {
- $fileName=$this->params['url']['f'];
- $fileType=$this->params['url']['type'];
- $basePath='../../app/webroot/stoxfoto_media/movie/video/';
- $this->Download->downloadFile($basePath,$fileName);
- }
-
- function downloadstoxrelease()
- {
- $fileName=$this->params['url']['f'];
- $fileType=$this->params['url']['type'];
- $basePath='../../app/webroot/stoxfoto_licence/'.$fileType.'/';
- $this->Download->downloadFile($basePath,$fileName);
- }
-
- function savesubmission($stoxid=null)
- {
- $ticketstatus='';
- if(isset($_REQUEST['stxstatus']) && $_REQUEST['stxstatus']!='')
- {
- $txtstxstatus = $_REQUEST['stxstatus'];
- }
- else
- $txtstxstatus=0;
-
-
- if(isset($_REQUEST['stxstatus']) && $_REQUEST['stxstatus']==1)
- $ticketstatus = 'approve';
- if(isset($_REQUEST['stxstatus']) && $_REQUEST['stxstatus']==-1)
- $ticketstatus = 'reject';
-
- $this->set('stxticstatus',$ticketstatus);
-
- $updateStocx = "UPDATE stoxfotos SET is_approved='".$txtstxstatus."' , is_adultcontent='".$_REQUEST['stxadult']."' where id='".$stoxid."' and is_temp='0'";
- @mysql_query($updateStocx);
-
- $updateTickets = "Update stoxfotos_tickets SET status='".$ticketstatus."' , msg_to_user ='".$_REQUEST['txtmsg']."' where stoxfoto_id='".$stoxid."'";
- @mysql_query($updateTickets);
-
- ##################################### MAil to the user for the approval or disapproval
- $stoxInfo = $this->stoxitemInfo($stoxid);
- $this->set('stoxinfo',$stoxInfo);
-
-
- ##### USER EMAIL ADDRESS
- $selectBackdropuser = "Select user_details.email , user_details.first_name ,user_details.last_name from user_details where user_id='".$stoxInfo['user_id']."'" ;
- $selectBackdropuser_res = mysql_query($selectBackdropuser);
- $selectBackdropuser_arr = mysql_fetch_array($selectBackdropuser_res);
-
- $this->set('stoxfotoFirst',$selectBackdropuser_arr['first_name']);
- $this->set('stoxfotoLast',$selectBackdropuser_arr['last_name']);
-
- if($ticketstatus!='')
- {
- $this->Sendmail->Mail();
- $this->Sendmail->From('xoadmin@gmail.com');
-
- $this->Sendmail->To($selectBackdropuser_arr['email']);
- $this->Sendmail->Cc("sanjib@navsoft.in");
- $this->Sendmail->Cc("sujoy@navsoft.in");
- $subject="Stoxfoto Ticket ".$stoxInfo['ticket_number']." status";
- $this->Sendmail->Subject($subject);
- $this->Sendmail->layout='email';
- $this->Sendmail->view='mail_stoxstatus';
- $this->Sendmail->startup($this);
- $messageBody=$this->Sendmail->bodyText();
- $this->Sendmail->Body($messageBody); // set the body
- $this->Sendmail->Priority(1) ; // set the priority to Low
- $this->Sendmail->Send(); /**/
- }
- ##################################### MAil to the user for the approval or disapproval
- }
-
- function viewstoxsales($viewType=null)
- {
- $this->checkSession();
- $this->pageTitle = 'Manage Stoxfoto '.ucfirst($viewType);
- $this->layout = 'default_user';
- $this->set('pageView',$viewType);
-
- if((isset($this->params['url']['hfsearch']) && $this->params['url']['hfsearch']!='') || isset($_REQUEST['hfsearch']) )
- $viewSearchType=$_REQUEST['hfsearch'];
-
-
- $select = "SELECT stoxfotos.id,stoxfotos.title ,stoxfotos.media_type ,stoxfotos.stoxfoto_code ,stoxfotos.exclusive,
- IF(stoxfotos.media_type='Photos',stoxfoto_photosize.caption ,IF(stoxfotos.media_type='PhotoElement',stoxfoto_photosize.caption,IF(stoxfotos.media_type='Illustration',stoxfoto_illustration_pricing.licence_type,IF(stoxfotos.media_type='Flash',stoxfoto_flash_pricing.licence_type,IF(stoxfotos.media_type='Movie',stoxfoto_movie_pricing.licence_type,IF(stoxfotos.media_type='Web',stoxfoto_web_pricing.licence_type,'-')))))) as photoLicense ,
- transaction_stoxfoto.total_amount,transaction_stoxfoto.date,transaction_stoxfoto.invoice ,transaction_stoxfoto.admin_comission ,transaction_stoxfoto.admin_comission_paid ";
-
-
- $from=" FROM stoxfoto_cart
- LEFT JOIN stoxfotos On (stoxfoto_cart.stoxfoto_id = stoxfotos.id)
- LEFT JOIN stoxfoto_photo_pricing ON((stoxfotos.media_type='Photos' or stoxfotos.media_type='PhotoElement') and stoxfoto_photo_pricing.stoxfoto_id =stoxfotos.id )
- LEFT JOIN stoxfoto_photosize ON(stoxfoto_photosize.id =stoxfoto_photo_pricing.stoxfoto_photosize_id)
- LEFT JOIN stoxfoto_illustration_pricing ON(stoxfotos.media_type='Illustration' and stoxfoto_illustration_pricing.stoxfoto_id =stoxfotos.id )
- LEFT JOIN stoxfoto_flash_pricing ON(stoxfotos.media_type='Flash' and stoxfoto_flash_pricing.stoxfoto_id =stoxfotos.id )
- LEFT JOIN stoxfoto_movie_pricing ON(stoxfotos.media_type='Movie' and stoxfoto_movie_pricing.stoxfoto_id =stoxfotos.id )
- LEFT JOIN stoxfoto_web_pricing ON(stoxfotos.media_type='Web' and stoxfoto_web_pricing.stoxfoto_id =stoxfotos.id )
- LEFT JOIN transaction_stoxfoto ON (stoxfoto_cart.transaction_stoxfoto_id=transaction_stoxfoto.id)
-
- ";
-
- $where="WHERE 1 AND stoxfotos.is_temp='0' AND stoxfotos.is_approved='1' and stoxfoto_cart.payflag='1'";
-
- $searchpass='';
- if(isset($viewSearchType) && $viewSearchType=='title' && isset($_REQUEST['txtsrch']) && $_REQUEST['txtsrch']!='')
- {
- $where.=" AND stoxfotos.title like '%".$_REQUEST['txtsrch']."%' ";
- $searchpass = "&txtsrch=".$_REQUEST['txtsrch'] ;
- }
- if(isset($viewSearchType) && $viewSearchType=='invoice')
- {
- $where.=" AND transaction_stoxfoto.invoice='".$_REQUEST['txtsrch']."'";
- //$searchexclusive = 'Yes';
- $searchpass = "&txtsrch=".$_REQUEST['txtsrch'] ;
- }
- if(isset($viewSearchType) && $viewSearchType=='daterange')
- {
- if($_REQUEST['inpdatefrom'] && $_REQUEST['inpdatefrom']!='mm/dd/YY')
- {
- $eventFromDate=date("Y-m-d",strtotime($_REQUEST['inpdatefrom']));
- $urlfromdate = $_REQUEST['inpdatefrom'];
- }
- else
- {
- $eventFromDate=date("Y-m-d");
- $urlfromdate = $_REQUEST['inpdatefrom'];
-
- }
-
- if($_REQUEST['inpdateto'] && $_REQUEST['inpdateto']!='mm/dd/YY')
- {
- $eventToDate=date("Y-m-d",strtotime($_REQUEST['inpdateto']));
- $urltodate = $_REQUEST['inpdateto'];
- }
- else
- {
- $eventToDate=date("Y-m-d");
- $urltodate = $_REQUEST['inpdateto'];
-
- }
-
- $where.=" AND transaction_stoxfoto.status_date between '".$eventFromDate."' and '".$eventToDate."' ";
- $searchpass = "&inpdatefrom=".$urlfromdate."&inpdateto=".$urltodate ;
- }
- if(isset($viewSearchType) && $viewSearchType=='license')
- {
- $where.=" and (IF(stoxfotos.media_type='Photos',stoxfoto_photosize.caption ,IF(stoxfotos.media_type='PhotoElement',stoxfoto_photosize.caption,IF(stoxfotos.media_type='Illustration',stoxfoto_illustration_pricing.licence_type,IF(stoxfotos.media_type='Flash',stoxfoto_flash_pricing.licence_type,IF(stoxfotos.media_type='Movie',stoxfoto_movie_pricing.licence_type,IF(stoxfotos.media_type='Web',stoxfoto_web_pricing.licence_type,'-')))))) ) like '% ".$_REQUEST['txtsrch']."%'";
- //$searchexclusive = 'Yes';
- $searchpass = "&txtsrch=".$_REQUEST['txtsrch'] ;
- }
-
- if(isset($viewSearchType) && $viewSearchType=='license')
- {
- //$where.=" AND transaction_stoxfoto.invoice='".$_REQUEST['txtsrch']."'";
- //$searchexclusive = 'Yes';
- $searchpass = "&license=".$_REQUEST['txtsrch'] ;
- }
- if(isset($viewSearchType) && $viewSearchType=='payment')
- {
- $where.=" AND transaction_stoxfoto.admin_comission_paid>=0'";
- //$searchexclusive = 'Yes';
- $searchpass = "&txtsrch=".$_REQUEST['txtsrch'] ;
- }
-
-
- $this->set('searchpass',$where);
-
-
-
-
-
-
- // $others=" ";
- $others=" GROUP BY transaction_stoxfoto.id ";
-
- if($viewType || (isset($_REQUEST['listview']) && $_REQUEST['listview']!='') )
- {
- if($viewType)
- $listView = $viewType ;
- if(isset($_REQUEST['listview']) && $_REQUEST['listview']!='')
- $listView = $_REQUEST['listview'] ;
- }
-
- $where.=" and stoxfotos.media_type='".$listView."' ";
-
- $others.=" order by transaction_stoxfoto.id desc ";
-
-
- if(isset($viewSearchType) && $viewSearchType!='')
- {
- $PassParameter="listview=".$listView."&hfsearch=".$viewSearchType.$searchpass;
- }
- else
- $PassParameter="listview=".$listView;
-
- $CountField="stoxfotos.id";
- $this->set("controller","stoxfoto");
- $this->set("action","viewstoxsales");
- $this->pagination($select,$from,$where,$others,$CountField,$this->params['url'],$PassParameter);
- if(isset($this->params['url']['Page']) || isset($viewSearchType))
- {
- $this->render("viewstoxsales2","ajax");
- }
- }
-
- ############################### For the Sizes mnagement ##########
- function managestoxsize()
- {
- $this->checkSession();
- $this->pageTitle = 'Manage Stoxfoto Sizes';
- $this->layout = 'default_user';
-
- $stoxsize = array();
- $stoxquery = "SELECT * from stoxfoto_photosize where is_delete='0'";
- $stoxquery_res = mysql_query($stoxquery);
- while($stoxquery_res_arr = mysql_fetch_assoc($stoxquery_res))
- {
- $stoxsize[] = $stoxquery_res_arr;
- }
- //pr($stoxsize);
- $this->set('stoxsizes',$stoxsize);
-
-
- }
-
- function editstoxsize($show=null,$sizeid=null)
- {
- $stoxinfo_res = "SELECT * from stoxfoto_photosize where id='".base64_decode($sizeid)."' ";
- $stoxinfo_res_query = mysql_query($stoxinfo_res);
- $stoxinfo_res_array = mysql_fetch_array($stoxinfo_res_query);
- $this->set('stoxinfo',$stoxinfo_res_array);
- $this->set('stoxview',$show);
- $this->render('editstoxsize', 'ajax');
- }
- function addstoxsize()
- {
- $this->render('addstoxsize', 'ajax');
- }
-
- function saveditstoxsize($stoxsize=null)
- {
- if($stoxsize)
- {
- //pr($_REQUEST);
-
- $stoxinfo_res = "UPDATE stoxfoto_photosize SET " ;
- if(isset($_REQUEST['txtcaption']) && $_REQUEST['txtcaption']!='')
- $stoxinfo_res .= " caption='".$_REQUEST['txtcaption']."' " ;
-
- if(isset($_REQUEST['txtheight']) && $_REQUEST['txtheight']>0)
- $stoxinfo_res .= " ,height_size='".$_REQUEST['txtheight']."' " ;
-
- if(isset($_REQUEST['txtwidth']) && $_REQUEST['txtwidth']>0)
- $stoxinfo_res .= " ,width_size='".$_REQUEST['txtwidth']."' " ;
-
- if(isset($_REQUEST['txtprint']) && $_REQUEST['txtprint']!='')
- $stoxinfo_res .= " ,printable_size='".addslashes($_REQUEST['txtprint'])."' " ;
-
-
- $stoxinfo_res .=" where id='".$stoxsize."' ";
- $stoxinfo_res_query = mysql_query($stoxinfo_res);
-
- }
- $this->redirect('/stoxfoto/managestoxsize');
- }
- function savestoxsize($stoxsize=null)
- {
- //pr($_REQUEST);
-
- $stoxinfo_res = "INSERT INTO stoxfoto_photosize SET " ;
- if(isset($_REQUEST['txtcaption']) && $_REQUEST['txtcaption']!='')
- $stoxinfo_res .= " caption='".$_REQUEST['txtcaption']."' " ;
-
- if(isset($_REQUEST['txtheight']) && $_REQUEST['txtheight']>0)
- $stoxinfo_res .= " ,height_size='".$_REQUEST['txtheight']."' " ;
-
- if(isset($_REQUEST['txtwidth']) && $_REQUEST['txtwidth']>0)
- $stoxinfo_res .= " ,width_size='".$_REQUEST['txtwidth']."' " ;
-
- if(isset($_REQUEST['txtprint']) && $_REQUEST['txtprint']!='')
- $stoxinfo_res .= " ,printable_size='".addslashes($_REQUEST['txtprint'])."' " ;
-
-
- //$stoxinfo_res .=" where id='".$stoxsize."' ";
- $stoxinfo_res_query = mysql_query($stoxinfo_res);
-
-
- $this->redirect('/stoxfoto/managestoxsize');
- }
-
-
-
- function delstoxsize($sizeid=null)
- {
- $stoxinfo_res = "UPDATE stoxfoto_photosize SET is_delete='1' where id='".base64_decode($sizeid)."' ";
- $stoxinfo_res_query = mysql_query($stoxinfo_res);
- $this->redirect('/stoxfoto/managestoxsize');
-
- }
-
- function managestoxpayout()
- {
- $this->checkSession();
- $this->pageTitle = 'Manage Stoxfoto Payouts';
- $this->layout = 'default_user';
-
- $stoxsize = array();
- $stoxquery = "SELECT * from stoxfoto_commission";
- $stoxquery_res = mysql_query($stoxquery);
- while($stoxquery_res_arr = mysql_fetch_assoc($stoxquery_res))
- {
- $stoxsize[] = $stoxquery_res_arr;
- }
- //pr($stoxsize);
- $this->set('stoxInfo',$stoxsize);
-
- }
-
- function addpayoutcomm()
- {
-
- }
- function savestoxpayoutsize()
- {
- //pr($_REQUEST);
- $tempStDown = 0;
- $tempwEndDown = 0;
- $startNumberofdown=0;
- $endNumberofdown=0;
-
- if(isset($_REQUEST['txtstnumofdownloads']) && $_REQUEST['txtstnumofdownloads']>0)
- {
- $startNumberofdown = $_REQUEST['txtstnumofdownloads'] ;
- $checkfordownload = "SELECT * from stoxfoto_commission where
-
- (if(end_no_sale=0,1=1,'".$startNumberofdown."' between start_no_sale and end_no_sale))
- " ;
- //echo $checkfordownload;
- //$checkfordownload_res = mysql_query($checkfordownload);
- if(mysql_num_rows($checkfordownload_res)>0)
- $tempStDown=1;
- }
- if(isset($_REQUEST['txtstnumofdownloads']) && $_REQUEST['txtstnumofdownloads']>0)
- {
- $endNumberofdown = $_REQUEST['txtendnumofdownloads'] ;
- //$checkfordownload = "SELECT * from stoxfoto_commission where '".$endNumberofdown."' between start_no_sale and end_no_sale " ;
-
- $checkfordownload = "SELECT * from stoxfoto_commission where
-
- (if(end_no_sale=0,1=1,'".$endNumberofdown."' between start_no_sale and end_no_sale))
- " ;
-
-
- $checkfordownload_res = mysql_query($checkfordownload);
- if(mysql_num_rows($checkfordownload_res)>0)
- $tempwEndDown=1;
- }
-
- if($tempStDown==0 && $tempwEndDown ==0)
- {
- if($startNumberofdown>0 && $endNumberofdown>=0 && (isset($_REQUEST['txtexclusive']) && $_REQUEST['txtexclusive']>0) && (isset($_REQUEST['txtnonexclusive']) && $_REQUEST['txtnonexclusive']>0))
- {
- $savetopayroll ="INSERT INTO stoxfoto_commission SET start_no_sale='".$startNumberofdown."' , end_no_sale='".$endNumberofdown."' , exclusive_commission='".$_REQUEST['txtexclusive']."' , non_exclusive_commission='".$_REQUEST['txtnonexclusive']."' ";
- @mysql_query($savetopayroll);
-
- }
-
- } else {
- /*if($startNumberofdown>0 && $endNumberofdown>=0 && (isset($_REQUEST['txtexclusive']) && $_REQUEST['txtexclusive']>0) && (isset($_REQUEST['txtnonexclusive']) && $_REQUEST['txtnonexclusive']>0))
- {
- $savetopayroll ="update stoxfoto_commission SET start_no_sale='".$startNumberofdown."' , end_no_sale='".$endNumberofdown."' , exclusive_commission='".$_REQUEST['txtexclusive']."' , non_exclusive_commission='".$_REQUEST['txtnonexclusive']."' where ";
- @mysql_query($savetopayroll);
-
- }*/
- }
- //$this->redirect('/stoxfoto/managestoxpayout');
- }
-
- function editstoxpayout($show=null,$sizeid=null)
- {
- $stoxinfo_res = "SELECT * from stoxfoto_commission where id='".base64_decode($sizeid)."' ";
- $stoxinfo_res_query = mysql_query($stoxinfo_res);
- $stoxinfo_res_array = mysql_fetch_array($stoxinfo_res_query);
- $this->set('stoxinfo',$stoxinfo_res_array);
- $this->set('stoxview',$show);
- $this->render('editstoxpayout', 'ajax');
-
- }
- function saveeditstoxpayoutsize($stoxsize=null)
- {
- $tempStDown = 0;
- $tempwEndDown = 0;
- $startNumberofdown=0;
- $endNumberofdown=0;
-
- if(isset($_REQUEST['txtstnumofdownloads']) && $_REQUEST['txtstnumofdownloads']>=0)
- {
- $startNumberofdown = $_REQUEST['txtstnumofdownloads'] ;
- $checkfordownload = "SELECT * from stoxfoto_commission where
-
- (if(end_no_sale=0,1=1,'".$startNumberofdown."' between start_no_sale and end_no_sale))
- " ;
- $checkfordownload_res = mysql_query($checkfordownload);
- if(mysql_num_rows($checkfordownload_res)>0)
- $tempStDown=1;
- }
-
- if(isset($_REQUEST['txtstnumofdownloads']) && $_REQUEST['txtstnumofdownloads']>=0)
- {
- $endNumberofdown = $_REQUEST['txtendnumofdownloads'] ;
- //$checkfordownload = "SELECT * from stoxfoto_commission where '".$endNumberofdown."' between start_no_sale and end_no_sale " ;
-
- $checkfordownload = "SELECT * from stoxfoto_commission where
-
- (if(end_no_sale=0,1=1,'".$endNumberofdown."' between start_no_sale and end_no_sale))
- " ;
-
-
- $checkfordownload_res = mysql_query($checkfordownload);
- if(mysql_num_rows($checkfordownload_res)>0)
- $tempwEndDown=1;
- }
-
- if($tempStDown==1 && $tempwEndDown ==1)
- {
- if($startNumberofdown>=0 && $endNumberofdown>=0 && (isset($_REQUEST['txtexclusive']) && $_REQUEST['txtexclusive']>0) && (isset($_REQUEST['txtnonexclusive']) && $_REQUEST['txtnonexclusive']>0))
- {
- $savetopayroll ="UPDATE stoxfoto_commission SET start_no_sale='".$startNumberofdown."' , end_no_sale='".$endNumberofdown."' , exclusive_commission='".$_REQUEST['txtexclusive']."' , non_exclusive_commission='".$_REQUEST['txtnonexclusive']."' where id='".$stoxsize."' ";
- @mysql_query($savetopayroll);
-
- }
-
- }
-
- /*if($startNumberofdown>=0 && $endNumberofdown>=0 && (isset($_REQUEST['txtexclusive']) && $_REQUEST['txtexclusive']>0) && (isset($_REQUEST['txtnonexclusive']) && $_REQUEST['txtnonexclusive']>0))
- {
- $savetopayroll ="UPDATE stoxfoto_commission SET start_no_sale='".$startNumberofdown."' , end_no_sale='".$endNumberofdown."' , exclusive_commission='".$_REQUEST['txtexclusive']."' , non_exclusive_commission='".$_REQUEST['txtnonexclusive']."' where id='".$stoxsize."' ";
- @mysql_query($savetopayroll);
-
- }*/
- $this->redirect('/stoxfoto/managestoxpayout');
-
- }
-
-
- function delstoxpayout($stoxsize=null)
- {
- $delquery = "DELETE from stoxfoto_commission where id='".$stoxsize."'";
- @mysql_query($delquery);
- $this->redirect('/stoxfoto/managestoxpayout');
-
- }
-
-
- ##########################################
-
- function managestoxprice()
- {
- $this->checkSession();
- $this->pageTitle = 'Manage Stox Price';
- $this->layout = 'default_user';
-
- $stoxsize = array();
- $stoxquery = "SELECT stoxfoto_photopngprice.*,stoxfoto_photosize.caption from stoxfoto_photopngprice
- LEFT JOIN stoxfoto_photosize ON (stoxfoto_photopngprice.stoxfoto_photosize_id=stoxfoto_photosize.id and stoxfoto_photosize.is_delete='0')
- ORDER BY stoxfoto_photopngprice.id asc ,stoxfoto_photopngprice.file_type
- ";
- $stoxquery_res = mysql_query($stoxquery);
- while($stoxquery_res_arr = mysql_fetch_assoc($stoxquery_res))
- {
- $stoxsize[] = $stoxquery_res_arr;
- }
- //pr($stoxsize);
- $this->set('stoxInfo',$stoxsize);
- }
-
- function addstoxpricing()
- {
- ########## PHOTO SUIZE #####
- $stoxsize = array();
- $stoxquery = "SELECT * from stoxfoto_photosize where is_delete='0'";
- $stoxquery_res = mysql_query($stoxquery);
- while($stoxquery_res_arr = mysql_fetch_assoc($stoxquery_res))
- {
- $stoxsize[$stoxquery_res_arr['id']] = $stoxquery_res_arr['caption'];
- }
- $this->set('photosizes',$stoxsize);
- ########## PHOTO SUIZE #####
- $filetype = array('Photos'=>'Photos','PhotoElement'=>'PhotoElement') ;
- $this->set('photofileType',$filetype);
- }
-
- function savestoxprice()
- {
- //pr($_REQUEST);
- //echo $this->data['stoxpricing']['filetype'] ;
- //exit();
- $tempStDown = 0;
- $tempwEndDown = 0;
- $startNumberofdown=0;
- $endNumberofdown=0;
-
- if(isset($_REQUEST['txtstnumofdownloads']) && $_REQUEST['txtstnumofdownloads']>0)
- {
- $startNumberofdown = $_REQUEST['txtstnumofdownloads'] ;
- $checkfordownload = " SELECT * from stoxfoto_photopngprice where file_type='".$this->data['stoxpricing']['filetype']."' and stoxfoto_photosize_id='".$this->data['stoxpricing']['filesize']."' and
-
- (if(end_no_downloads=0,1=1,'".$startNumberofdown."' between start_no_downloads and end_no_downloads))
- " ;
- $checkfordownload_res = mysql_query($checkfordownload);
- if(mysql_num_rows($checkfordownload_res)>0)
- $tempStDown=1;
- }
- if(isset($_REQUEST['txtendnumofdownloads']) && $_REQUEST['txtendnumofdownloads']>0)
- {
- $endNumberofdown = $_REQUEST['txtendnumofdownloads'] ;
- //$checkfordownload = "SELECT * from stoxfoto_commission where '".$endNumberofdown."' between start_no_sale and end_no_sale " ;
-
- $checkfordownload = " SELECT * from stoxfoto_photopngprice where file_type='".$this->data['stoxpricing']['filetype']."' and stoxfoto_photosize_id='".$this->data['stoxpricing']['filesize']."' and
-
- (if(end_no_downloads=0,1=1,'".$endNumberofdown."' between start_no_downloads and end_no_downloads))
- " ;
-
-
- $checkfordownload_res = mysql_query($checkfordownload);
- if(mysql_num_rows($checkfordownload_res)>0)
- $tempwEndDown=1;
- }
-
- if($tempStDown==0 && $tempwEndDown ==0)
- {
- if($startNumberofdown>0 && $endNumberofdown>=0 && (isset($_REQUEST['txtnonexclusive']) && $_REQUEST['txtnonexclusive']>0))
- {
- $savetopayroll ="INSERT INTO stoxfoto_photopngprice SET start_no_downloads='".$startNumberofdown."' , end_no_downloads='".$endNumberofdown."' , file_type='".$this->data['stoxpricing']['filetype']."' , stoxfoto_photosize_id='".$this->data['stoxpricing']['filesize']."' , price='".$_REQUEST['txtnonexclusive']."' ";
- @mysql_query($savetopayroll);
-
- }
-
- }
- $this->redirect('/stoxfoto/managestoxprice');
-
- }
-
- function editstoxprice($show=null,$sizeid=null)
- {
- $stoxinfo_res = "SELECT * from stoxfoto_photopngprice where id='".base64_decode($sizeid)."' ";
- $stoxinfo_res_query = mysql_query($stoxinfo_res);
- $stoxinfo_res_array = mysql_fetch_array($stoxinfo_res_query);
- $this->set('stoxinfo',$stoxinfo_res_array);
- $this->set('stoxview',$show);
-
-
- ########## PHOTO SUIZE #####
- $stoxsize = array();
- $stoxquery = "SELECT * from stoxfoto_photosize where is_delete='0'";
- $stoxquery_res = mysql_query($stoxquery);
- while($stoxquery_res_arr = mysql_fetch_assoc($stoxquery_res))
- {
- $stoxsize[$stoxquery_res_arr['id']] = $stoxquery_res_arr['caption'];
- }
- $this->set('photosizes',$stoxsize);
- ########## PHOTO SUIZE #####
- $filetype = array('Photos'=>'Photos','PhotoElement'=>'PhotoElement') ;
- $this->set('photofileType',$filetype);
-
- $this->render('editstoxprice', 'ajax');
- }
- function saveeditstoxprice($stoxsize=null)
- {
- $tempStDown = 0;
- $tempwEndDown = 0;
- $startNumberofdown=0;
- $endNumberofdown=0;
-
- if(isset($_REQUEST['txtstnumofdownloads']) && $_REQUEST['txtstnumofdownloads']>0)
- {
- $startNumberofdown = $_REQUEST['txtstnumofdownloads'] ;
- $checkfordownload = " SELECT * from stoxfoto_photopngprice where file_type='".$this->data['stoxpricing']['filetype']."' and stoxfoto_photosize_id='".$this->data['stoxpricing']['filesize']."' and
-
- (if(end_no_downloads=0,1=1,'".$startNumberofdown."' between start_no_downloads and end_no_downloads))
- " ;
- $checkfordownload_res = mysql_query($checkfordownload);
- if(mysql_num_rows($checkfordownload_res)>0)
- $tempStDown=1;
- }
- if(isset($_REQUEST['txtendnumofdownloads']) && $_REQUEST['txtendnumofdownloads']>0)
- {
- $endNumberofdown = $_REQUEST['txtendnumofdownloads'] ;
- //$checkfordownload = "SELECT * from stoxfoto_commission where '".$endNumberofdown."' between start_no_sale and end_no_sale " ;
-
- $checkfordownload = " SELECT * from stoxfoto_photopngprice where file_type='".$this->data['stoxpricing']['filetype']."' and stoxfoto_photosize_id='".$this->data['stoxpricing']['filesize']."' and
-
- (if(end_no_downloads=0,1=1,'".$endNumberofdown."' between start_no_downloads and end_no_downloads))
- " ;
-
-
- $checkfordownload_res = mysql_query($checkfordownload);
- if(mysql_num_rows($checkfordownload_res)>0)
- $tempwEndDown=1;
- }
-
- echo $tempStDown ;
-
- echo $tempwEndDown ;
- if($tempStDown==0 && $tempwEndDown ==0)
- {
- if($startNumberofdown>0 && $endNumberofdown>=0 && (isset($_REQUEST['txtnonexclusive']) && $_REQUEST['txtnonexclusive']>0))
- {
- $savetopayroll ="UPDATE stoxfoto_photopngprice SET start_no_downloads='".$startNumberofdown."' , end_no_downloads='".$endNumberofdown."' , file_type='".$this->data['stoxpricing']['filetype']."' , stoxfoto_photosize_id='".$this->data['stoxpricing']['filesize']."' , price='".$_REQUEST['txtnonexclusive']."' where id='".$stoxsize."' ";
- @mysql_query($savetopayroll);
-
- }
-
- }
- else
- {
- $savetopayroll ="UPDATE stoxfoto_photopngprice SET ";
- if(isset($_REQUEST['txtnonexclusive']) && $_REQUEST['txtnonexclusive']>0)
- $savetopayroll .=" price='".$_REQUEST['txtnonexclusive']."' ";
-
- $savetopayroll .=" where id='".$stoxsize."'";
- @mysql_query($savetopayroll);
-
-
- }
- $this->redirect('/stoxfoto/managestoxprice');
- }
-
- function delstoxprice($stoxsize=null)
- {
- $delquery = "DELETE from stoxfoto_photopngprice where id='".base64_decode($stoxsize)."' ";
- @mysql_query($delquery);
- $this->redirect('/stoxfoto/managestoxprice');
-
- }
-
- function stoximagehome()
- {
-
- $this->checkSession();
- $this->layout = 'default_user_cat';
-
- $selectTextimg = " SELECT id,helpimage,helptitle FROM homepage_texts where category='stoxfoto'";
- $categorysql_res = mysql_query($selectTextimg);
- $categorysql_num = mysql_num_rows($categorysql_res);
- if($categorysql_num>0)
- {
- $listarr=array();
- while($categorysql_array = mysql_fetch_array($categorysql_res))
- {
- $listarr[]=array('id'=>$categorysql_array['id'],'helpimage'=>$categorysql_array['helpimage'],'helptitle'=>$categorysql_array['helptitle']) ;
- }
- $this->set('slidearr',$listarr);
-
- }
- $this->set('slideNumber',$categorysql_num);
-
- }
-
- function editslide($slideId=null)
- {
- $this->checkSession();
- $this->layout = 'default_user_cat';
- $selectTextimg = " SELECT * FROM homepage_texts where id='".$slideId."' ";
- $categorysql_res = mysql_query($selectTextimg);
- $categorysql_num = mysql_num_rows($categorysql_res);
- if($categorysql_num>0)
- {
- $listarr=array();
- $categorysql_array = mysql_fetch_array($categorysql_res);
- $listarr[]=array('id'=>$categorysql_array['id'],'categoryName'=>$categorysql_array['category'],'helpimage'=>$categorysql_array['helpimage'],'helptitle'=>$categorysql_array['helptitle'],'helpdescription'=>$categorysql_array['helpdescription'],'morelink'=>$categorysql_array['morelink']) ;
- }
- $this->set('slidearr',$listarr);
- $this->set('slideNumber',$categorysql_num);
- }
- function saveslide($slideid=null)
- {
- if($slideid)
- {
- $destination = realpath('../../../app/webroot/homepageslide/images/') . '/';
- $file = $this->data['homepageText']['screenshot'];
- //pr($this->data);
- //pr($_FILES);
-
- $Uploadfile = '';
- $result = $this->Image->stox_upload_image_and_thumbnail($this->data,'screenshot',300,300,'aaaa',0);
-
- /*//$inFile, $outFile="", $width=200, $height=200, $quality=100, $resize=false
-
- $infile = $this->data['homepageText']['screenshot']['tmp_name'] ;
- $outFile = $destination.'/'.$this->data['homepageText']['screenshot']['name'] ;
-
-
-
-
- $result = $this->Thumb->imgOptCpy($inFile, $outFile="", $width=200, $height=200, $quality=100, $resize=false);
-
-
-
- exit();*/
-
-
- if($result!='')
- $Uploadfile = basename($result);
-
- //$this->Upload_video->eventheader_upload($destination,'1');
-
-
- $insertssql = "UPDATE homepage_texts SET category = 'stoxfoto' , helptitle = '".$this->data['homepageText']['helptitle']."'" ;
- if($Uploadfile!='')
- $insertssql .= " , helpimage ='".$Uploadfile."' " ;
-
- $insertssql .= " where id='".$slideid."' " ;
-
- $insertssql_sql = mysql_query($insertssql);
- }
- else
- {
- ################# UPLOADING FILE <br />
- $destination = realpath('../../../app/webroot/homepageslide/images/') . '/';
- $file = $this->data['homepageText']['screenshot'];
- $Uploadfile = '';
- $result = $this->Image->upload_image_and_thumbnail($this->data,'screenshot',300,300,'aaaa',1);
-
- if($result!='')
- $Uploadfile = basename($result);
-
- /* INSERTINO in the sitehelp_group_topic_qa Table */
- $insertssql = "INSERT INTO homepage_texts SET category = 'stoxfoto' , helptitle = '".$this->data['homepageText']['helptitle']."' , helpimage ='".$Uploadfile."' " ;
- $insertssql_sql = mysql_query($insertssql);
- ############
-
- }
- $this->redirect('stoxfoto/stoximagehome');
- }
- function delslide($Slideid=null)
- {
- $this->checkSession();
- if($_SESSION['Admin_role']==1)
- {
- if($Slideid)
- {
- $delquery = "Delete from homepage_texts where id='".$Slideid."'";
- $delquery_res = @mysql_query($delquery);
- }
- }
- $this->redirect($_SERVER['HTTP_REFERER']);
-
- }
- function addslide($category=null)
- {
- $this->checkSession();
- $this->layout = 'default_user_cat';
-
- }
-
-
-
-
-
-
-
-
-
- }
- ?>