<?php

include('application/controllers/version.php');
class Temp extends Version
{
	function Temp()
	{
		parent::Controller();
		
		/*if(!admin())
		    redirect('/admin');
		/*else
		    redirect('/temp');*/
	}

	function index(){
		
	//	print "curl verzio: ";
	//	print_r(curl_version());
	//	phpinfo();
	/*	$txt = fopen('/var/www/fcgi/wwwcadline/php.ini');
		while($x = fgets( $txt, 1024)){
			print $x;
		}
		fclose($txt);*/
	//	print "<pre>";
		/*if (preg_match("|googlebot|i", "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html) 	"))
		{
			print "robot\n";
		}else{
			print "nem robot\n";
		}*/
		
		$str = 'programinditas - pw: 4101188310075325, build: 60, isid: 4131, időkód: 0118-4131-A04-55C9, valasz: (( nem kapott valaszt ))';
		
		preg_match('/\d{16}/', $str, $matches);
		print_r($matches);
		
		//print base64_decode("Y2FkbGluZS8yMDY5LzVFM0ZDRTNGLUVCRUItOTY0Mi1CMDZBLUY1QTMxMDdBRUE5Qi5vbGk=");
		
	//	print base64_decode("cHVibGljL2dhbGxlcnkvYmFhdnMv");
		
	/*	$tegnap = strtotime("2013-02-07");
		$ma     = strtotime("2013-02-08");
		print strtotime("2013-02-16");*/
		
	//	$sql = "SELECT COUNT(SUBSTRING(usPwd,8,2)) darab, SUBSTRING(usPwd,8,2) verzio FROM userstats2011 WHERE usDate>{$tegnap} AND usDate<{$ma} GROUP BY SUBSTRING(usPwd,8,2)";
	//	$inditasok = $this->db->query($sql)->result();
	//	print "Tegnapi inditasok: ".$inditasok->darab;
	//	print_r($inditasok);
	}
	
	// montázs a logókból
	function showroombrands(){
		$this->load->model('mcollection2');
		$gyartok = $this->mcollection2->get_gyartok();
		
		
		$elso  = "convert -background transparent +append ";
		$elso .= PATH_WEBSITE."public/img/collection/".$gyartok[0]->dir."/logo.png ";
		$elso .= PATH_WEBSITE."public/img/collection/".$gyartok[1]->dir."/logo.png ";
		$elso .= PATH_WEBSITE."public/img/collection/".$gyartok[2]->dir."/logo.png ";
		$elso .= PATH_WEBSITE."public/img/collection/".$gyartok[3]->dir."/logo.png ";
		$elso .= PATH_WEBSITE."public/img/collection/mont_elso.png ";
		exec($elso);
		
		$maso  = "convert -background transparent +append ";
		$maso .= PATH_WEBSITE."public/img/collection/".$gyartok[4]->dir."/logo.png ";
		$maso .= PATH_WEBSITE."public/img/collection/".$gyartok[5]->dir."/logo.png ";
		$maso .= PATH_WEBSITE."public/img/collection/".$gyartok[6]->dir."/logo.png ";
		$maso .= PATH_WEBSITE."public/img/collection/".$gyartok[7]->dir."/logo.png ";
		$maso .= PATH_WEBSITE."public/img/collection/mont_maso.png";
		exec($maso);
		
		$harm  = "convert -background transparent +append ";
		$harm .= PATH_WEBSITE."public/img/collection/".$gyartok[8]->dir."/logo.png ";
		$harm .= PATH_WEBSITE."public/img/collection/".$gyartok[9]->dir."/logo.png ";
		$harm .= PATH_WEBSITE."public/img/collection/".$gyartok[10]->dir."/logo.png ";
		$harm .= PATH_WEBSITE."public/img/collection/".$gyartok[11]->dir."/logo.png ";
		$harm .= PATH_WEBSITE."public/img/collection/mont_harm.png";
		exec($harm);
		
		$negy  = "convert -background transparent +append ";
		$negy .= PATH_WEBSITE."public/img/collection/".$gyartok[12]->dir."/logo.png ";
		$negy .= PATH_WEBSITE."public/img/collection/".$gyartok[13]->dir."/logo.png ";
		$negy .= PATH_WEBSITE."public/img/collection/".$gyartok[14]->dir."/logo.png ";
		$negy .= PATH_WEBSITE."public/img/collection/mont_negy.png";
		exec($negy);
		
		$montage  = "convert -background transparent -append ";
		$montage .= PATH_WEBSITE."public/img/collection/mont_elso.png ";
		$montage .= PATH_WEBSITE."public/img/collection/mont_maso.png ";
		$montage .= PATH_WEBSITE."public/img/collection/mont_harm.png ";
		$montage .= PATH_WEBSITE."public/img/collection/mont_negy.png ";
		$montage .= PATH_WEBSITE."public/img/collection/montage.png";
		exec($montage);
		
		exec("convert -resize 300x ".PATH_WEBSITE."public/img/collection/montage.png ".PATH_WEBSITE."public/img/collection/montage_300.png");
		
		
		print "elso: ".$elso;
		
	}
	
	
	// eddig gyűjtögetett sikeres letöltések a hibak tablaban
	function downloadcentereventnouser(){
		$this->load->model('mclusers');
		$sql = "SELECT hiba, datum FROM cadline2.a_hibak WHERE hiba LIKE 'Nem talalom a felhasznalot: %'";
		$letoltinfok = $this->db->query($sql)->result();
		
		foreach($letoltinfok as $hiba){
			$info   = str_replace('Nem talalom a felhasznalot: ','',$hiba->hiba);
			$reszek = explode(",",$info);
			$verid  = trim($reszek[0]);
			$serial = trim($reszek[1]);
			/*print_r($reszek); print "id: $verid, serial: $serial\n<br><br>\n";*/
			
			$verzio   = $this->db->query("SELECT ev, pkgid, fajl FROM version WHERE ver_id={$verid}")->row();
			$eseminfo = "Év: {$verzio->ev}, Fájl: {$verzio->fajl}, Build: {$verzio->pkgid}, Sorozatszám: {$serial}";
			//$this->mclusers->hlesemeny(substr($serial,0,6), 20, $eseminfo, substr($hiba->datum,0,10));
			print "\n<br>OK: ".$info;
		}
		
	}
	
	// a user historyban levo letoltes esemenyt atteni a kulcs esemenyihez is
	function downloadcentereventuser(){
		$this->load->model('mclusers');
		$sql = "SELECT strInfo, dateEvent FROM clusers.cl_history WHERE nTopicID=105 AND strInfo LIKE 'Letöltés: %Sikeres%' GROUP BY strInfo";
		$esemenyek = $this->db->query($sql)->result();
		
		foreach($esemenyek as $esem){
			$info = trim(str_replace('Letöltés: ','',$esem->strInfo));
			$reszek = explode(" ",$info);
			foreach($reszek as $k=>$resz)
				$reszek[$k] = trim($resz,',');
			
			// ha a fájlnévben volt szóköz
			if($reszek[1]!="2011_R2_Patch_Build189_setup.exe" && $reszek[1]!="2010_Build192_setup.exe"){
				$fajl   = $reszek[0];
				$build  = $reszek[2];
				$serial = $reszek[4];
			}
			else{
				$fajl   = $reszek[0]." ".$reszek[1];
				$build  = $reszek[3];
				$serial = $reszek[5];
			}
			//print "\n<br>fajl: ".$fajl." build: ".$build." serial: ".$serial;
			if(!is_numeric($build) || !is_numeric($serial)){
				print "\n<br>Nincs vagy hibas adat: fajl: ".$fajl." build: ".$build." serial: ".$serial.", ".$info;
				continue;
			}
			
			$verzio = $this->db->query("SELECT ev FROM cadline2.version WHERE fajl='{$fajl}'")->row();
			if(!$verzio){
				print "\n<br>Nincs verzio: fajl: ".$fajl." build: ".$build." serial: ".$serial;
				continue;
			}
			
			$eseminfo = "Év: {$verzio->ev}, Fájl: {$fajl}, Build: {$build}, Sorozatszám: {$serial}";
			//$this->mclusers->hlesemeny(substr($serial,0,6), 20, $eseminfo, substr($esem->dateEvent,0,10));
			
		}
		print "<br><br>VEGE";
	}
	
	
	// az ANGOL user historyban levo letoltes esemenyt atteni a kulcs esemenyihez is
	function downloadcentereventusereng(){
		$this->load->model('mclusers');
		$sql = "SELECT strInfo, dateEvent FROM clusers_eng.cl_history WHERE nTopicID=111 AND strInfo LIKE 'Letöltés: %Sikeres%' GROUP BY strInfo";
		$esemenyek = $this->db->query($sql)->result();
		
		foreach($esemenyek as $esem){
			$info = trim(str_replace('Letöltés: ','',$esem->strInfo));
			$reszek = explode(" ",$info);
			foreach($reszek as $k=>$resz)
				$reszek[$k] = trim($resz,',');
			
			// ha a fájlnévben volt szóköz
			if($reszek[1]!="2011_R2_Patch_Build189_setup.exe" && $reszek[1]!="2010_Build192_setup.exe"){
				$fajl   = $reszek[0];
				$build  = $reszek[2];
				$serial = $reszek[4];
			}
			else{
				$fajl   = $reszek[0]." ".$reszek[1];
				$build  = $reszek[3];
				$serial = $reszek[5];
			}
			//print "\n<br>fajl: ".$fajl." build: ".$build." serial: ".$serial;
			if(!is_numeric($build) || !is_numeric($serial)){
				print "\n<br>Nincs vagy hibas adat: fajl: ".$fajl." build: ".$build." serial: ".$serial.", ".$info;
				continue;
			}
			
			$verzio = $this->db->query("SELECT ev FROM cadline2.version WHERE fajl='{$fajl}'")->row();
			if(!$verzio){
				print "\n<br>Nincs verzio: fajl: ".$fajl." build: ".$build." serial: ".$serial;
				continue;
			}
			
			$eseminfo = "Év: {$verzio->ev}, Fájl: {$fajl}, Build: {$build}, Sorozatszám: {$serial}";
			//$this->mclusers->hlesemeny(substr($serial,0,6), 20, $eseminfo, substr($esem->dateEvent,0,10));
			
		}
		print "<br><br>VEGE";
	}
	
	
	function tesztregisztracio(){
		$serial = $this->uri->segment(3);
		$isid   = $this->uri->segment(4);
	//	$kod    = $this->uri->segment(5);
		
		// kód lekérés
		$aktkod =  $this->_getaktivalasikod22($serial);
		
		if($aktkod == "error: nincs vasarlasi idopont" ){
			print $aktkod;
			return;
		}
		
		$command = PATH_CODEGEN." -IsSoftwareKey ".$serial; //	print "<br>parancs: ".$command;
		$ph = popen($command, "r") or die( "A 'codegen' paranccsal nem veheto fel kapcsolat" );
		$szoftveres = fgets($ph, 1024); //	print "<br>ered: ".$szoftveres;
		
		
		
		
		// a páros benne van-e a táblában
		$ered = $this->db->query("SELECT id FROM `clusers`.`cl_serial_pc` WHERE serial='{$serial}' AND isid ='{$isid}'")->result();
		if(count($ered)>0){
			print "error: mar regisztralva";
			return;
		}
		
		$querydb = $this->db->query("SELECT max(hlLan) hlLan FROM `clusers`.`v_allhardlocks` WHERE hlNum='".substr($serial,0,6)."'")->row();
		$maxtelepites = ($querydb->hlLan==0) ? 1 : $querydb->hlLan;
		$telepitett = $this->db->query("SELECT id FROM `clusers`.`cl_serial_pc` WHERE serial='{$serial}' AND isid!='' AND isid IS NOT NULL")->result();
		
		if($szoftveres == "true" && count($telepitett)>=$maxtelepites){
			print "error: tul sok telepites";
			return;
		}
		
		// paros felvétele
		$record->serial = $serial;
		$record->isid   = $isid;
	//	$record->kod    = $kod;
		$record->datum  = date('Y-m-d H:i:s',time());
		$record->aktiv  = 1;
		$this->db->insert('clusers.cl_serial_pc',$record);
//- ide kellene megcsinalni, hogy ha van akitivalasi kod akkor azzal ter vissza
		
	//	$aktkod =  $this->_getaktivalasikod($serial);
		
		print $aktkod;
		
	}
	
	function tesztaktivalasikod(){
		$serial = $this->uri->segment(3);
		$isid   = $this->uri->segment(4);
		$idokod = $this->uri->segment(5);
		$aktkod = $this->aktivalasikod22($serial,$isid,$idokod);
		print $aktkod;
	}
	
	function aktivalasikod22($serial,$isid,$idokod){
		if(!$serial) $serial = $this->uri->segment(3);
		if(!$isid)   $isid   = $this->uri->segment(4);
		if(!$idokod) $idokod = $this->uri->segment(5);
		
		
		$command = PATH_CODEGEN." -IsSoftwareKey ".$serial; //	print "<br>parancs: ".$command;
		$ph = popen($command, "r") or die( "A 'codegen' paranccsal nem veheto fel kapcsolat" );
		$szoftveres = fgets($ph, 1024); //	print "<br>ered: ".$szoftveres;
		
		$valasz = $this->_getaktivalasikod22($serial,$isid);
		
		
		$command = PATH_CODEGEN." -ParseTimeCode " . $idokod;
		$ph = popen($command, "r");
		$elteltnap = fgets($ph, 1024);
		pclose($ph);
		
		
		if(!is_numeric($elteltnap) && $szoftveres == "true"){
			$this->_hibajelento("aktivalasikod",substr($serial,0,6),"regisztrálási hiba, nincs időkód");
			$elteltnap = 0;
		}
		$timeelteltnap = 60*60*24*$elteltnap;
		
		
		// a páros benne van-e a táblában, regisztrálva van-e
		$ered = $this->db->query("SELECT id, aktiv, datum FROM `clusers`.`cl_serial_pc` WHERE serial='{$serial}' AND isid ='{$isid}' ORDER BY datum DESC")->result();
		if(count($ered)!=1){
			// regisztráljuk ha nincs benne és még van szabad regisztráció
			
			$querydb = $this->db->query("SELECT max(hlLan) hlLan FROM `clusers`.`v_allhardlocks` WHERE hlNum='".substr($serial,0,6)."'")->row();
			$maxtelepites = ($querydb->hlLan==0) ? 1 : $querydb->hlLan;
			$telepitett = $this->db->query("SELECT id FROM `clusers`.`cl_serial_pc` WHERE serial='{$serial}' AND isid!='' AND isid IS NOT NULL")->result();
			
			if($szoftveres == "true" && count($telepitett)>=$maxtelepites){
				return "error: tul sok telepites";
			}/*else{
				print "regisztraltam. szoftveres: ".$szoftveres." , telepitett: ".count($telepitett)." , max ennyit lehet: ".$maxtelepites;
				return;
			}*/
			
			$record->serial = $serial;
			$record->isid   = $isid;
			$record->kod    = $idokod;
			$record->datum  = date('Y-m-d H:i:s',(time())-$timeelteltnap);
			$record->aktiv  = 1;
			$this->db->insert('clusers.cl_serial_pc',$record);
			$regtelepites = $record->datum;
			
		}elseif($ered[0]->aktiv!=1){
			return "error: nem aktiv regisztracio";
			return;
		}else{
			$regtelepites = substr($ered[0]->datum,0,10);
		}
		
		
		// ha nincs aktivalasi kódja, akkor generálni neki
		if($valasz == "error: hianyzo kod"){
			
			$program = $this->db->query("SELECT * FROM `clusers`.`v_hunengspaprograms` WHERE prPass='{$serial}'")->row();
			$timeszerzodes = strtotime($program->prSellDate);
			
			$timetelepites = time()-$timeelteltnap;
			$maxtelepites = max($timeszerzodes,$timetelepites);
			$maxdatetelepites = date('Y-m-d',$maxtelepites);
			
			if($program->prFizetve){
				$fizetvetime = strtotime($program->prFizetve);
				$meddig = date('Y-m-d',$fizetvetime + $this->_plusznap($serial)); 	// vege - telepites
			}elseif(substr($serial,0,2=="99")){
				$meddig = date('Y-m-d',time() + 30);	// először 30 napot kap
			}
			else{
				return "error: nincs kifizetve";
			}
			
			// mostani idő nagyobb mint ameddig jár
			if( date('Y-m-d',time()) > $meddig ){
				return $valasz;
				return;
			}
			
			$command3 = PATH_CODEGEN." -DiffDay ".$maxdatetelepites." ".$meddig; //	print "<br>parancs: ".$command3." ";
			$ph = popen($command3, "r")
				or die( "A 'codegen' paranccsal nem veheto fel kapcsolat" );
			$napok = fgets($ph, 1024); //	print "<br>napok: ".$napok;
			pclose($ph);
			
			$command = PATH_CODEGEN." -GenerateTimeCode ".$serial." ".$isid." ".$napok; //	print "<br>parancs: ".$command;
			$ph = popen($command, "r")
				or die( "A 'codegen' paranccsal nem veheto fel kapcsolat" );
			$aktkod = fgets($ph, 1024); //	print "<br>ered: ".$aktkod."<br>";
			pclose($ph);
			
			// felvenni az adatbázisba
			$serial = mysql_real_escape_string($serial);
			
			if( $program->ab == "eng" )
				$progab = "clusers_eng";
			elseif( $program->ab == "spa" )
				$progab = "clusers_spa";
			else
				$progab = "clusers";
			
			/*$query = "UPDATE `{$progab}`.`cl_fo_programs` SET prActCode='{$aktkod}', prActDate='{$maxdatetelepites}' ";
			$query .= " WHERE prID IN (";
			$query .= "  select max(prID) prID from `{$progab}`.`cl_fo_programs` where prPass='{$serial}' and (prActCode=='' or prActCode is null) ";
			$query .= " ) tmp";*/
			
			$query = "UPDATE `{$progab}`.`cl_fo_programs` SET `prActCode`='{$aktkod}', prActDate='{$maxdatetelepites}' WHERE `prPass`='{$serial}' AND (prActCode='' OR prActCode IS NULL) LIMIT 1";
			
			$this->db->query($query);
				// internetes aktivalas esemény
			$historyba->hiHlNum  = $program->prHlNum;
			$historyba->hiDate   = date('Y-m-d',time());
			$historyba->hiManID  = 0;
			$historyba->hiTypeID = 16;
			$historyba->hiTime   = date('Y-m-d H:i:s',time());
			$historyba->hiCtrID  = substr($serial,0,2);
			$this->db->insert($progab.".cl_fo_history",$historyba);
			$this->_hibajelento("aktivalasikod",substr($serial,0,6),"felvettem: {$query}");
			
			return $aktkod;
		}
		
		
		return $valasz;
		
	}
	
	function _getaktivalasikod22($serial,$isid,$szoftveres="false"){
		// van-e olyan aktív program aminek ez a sorozatszáma // a/b kulcsok miatt
		//$sql   = "SELECT prStat, prActCode, prSellDate FROM `clusers`.`cl_fo_programs` WHERE prPass='{$serial}' ";
		$sql   = "SELECT prStat, prActCode, prSellDate FROM `clusers`.`v_hunengspaprograms` WHERE prPass='{$serial}' ";
		$ered2 = $this->db->query($sql)->result();
		
		if(count($ered2)==0){
			return "error: nincs ilyen password";
		}
		
		$command = PATH_CODEGEN." -IsSoftwareKey ".$serial; //	print "<br>parancs: ".$command;
		$ph = popen($command, "r") or die( "A 'codegen' paranccsal nem veheto fel kapcsolat" );
		$szoftveres = fgets($ph, 1024); //	print "<br>ered: ".$szoftveres;
		
		$valasz = "error: nem aktiv a program";
		foreach($ered2 as $program){
			if($program->prStat==0){	// aktiv-e
				if( $program->prSellDate == "0000-00-00" ){
					$valasz = "error: nincs vasarlasi idopont";	// van-e eladási dátum
				}
				elseif( $program->prActCode != "" ){
					/*$valasz = $program->prActCode;	// aktuális aktiválási kód
					break;*/
					
					// neki megfelelő aktiválási kód
					if( $szoftveres=="true" ){
						if( substr($program->prActCode,5,4)==$isid ){
							$valasz = $program->prActCode;	// aktuális aktiválási kód
							break;
						}
					}else{
						$valasz = $program->prActCode;	// aktuális aktiválási kód
						break;
					}
					
				}else{
					$valasz = "error: hianyzo kod";		// nincs beirva a kod
			//		$this->_hibajelento("getaktivalasikod",substr($serial,0,6),$valasz);
				}
			}
		}
		
		return $valasz;
	}
	
	
	function fizetesekelmentes(){
		exec("mv -R fizetesek/* fizetesek/save_0621/");
	}
	
	function masosztaly(){
		/*include('application/controllers/version.php');
		print "new elott ";
		$version = new Version;
	//	$version = load_class('Version');
		print "new utan ";
		
		print_r($version->hibajelentes);
		
		print "ered elott ";
		$ered = $version->_getaktivalasikod("3984428300701079");
		//$version->log2013();
		print " ered: ".$ered;*/
	//	9802008300010504/C634/0200-C634-A00-7EB4
		$serial = "9802008300010504";
		$isid   = "C634";
		$idokod = "0200-C634-A00-7EB4";
		print "aktivalasikod elott ";
	//	$ujered = $this->requestAction("version/aktivalasikod/{$serial}/{$isid}/{$idokod}");
		$ujered = parent::aktivalasikod2($serial,$isid,$idokod);
		print " , ujered: ".$ujered;
	}
	
	
	function fooldal(){
		$this->load->model('mflashreel');
		$data['javascript'] = array(
					'welcome',
					'jsor-jcarousel/lib/jquery.jcarousel.min',
					'jquery.mousewheel.min',
					'jscrollpane/jquery.jscrollpane.min',
					'fancybox-1.3.4/fancybox/jquery.fancybox-1.3.4.pack'
				);
				
		$data['style'] = array(
					'../js/fancybox-1.3.4/fancybox/jquery.fancybox-1.3.4v2_min'
				);
		
		
		$order   = array("\r\n", "\n", "\r");
		$replace = '<br />';
		$nyelv   = $this->muser->user['lang'];
		
		$dobozok = $this->cache->get('welcome-dobozok-'.$nyelv);
		$foinfo = $this->cache->get('foinfo-dobozok-'.$nyelv);
		if( !$dobozok || !$foinfo ){
			$dobozok = $this->db->query("SELECT * FROM welcome_box WHERE sorszam>0 AND nyelv='{$nyelv}' ORDER BY sorszam")->result();
			
			foreach($dobozok as $doboz){
				$doboz->infok = $this->db->query("SELECT * FROM welcome_info WHERE doboz=".$doboz->id." AND sorszam>0 AND nyelv='{$nyelv}' ORDER BY sorszam")->result();
				
				// új sorok cseréje html-es új sorra ..
				foreach($doboz->infok as $info){
					$info->info = str_replace($order, $replace, $info->info);
				}
			}
			
			$foinfo = $this->db->query("SELECT * FROM welcome_info WHERE doboz=0 AND sorszam=100 AND nyelv='{$nyelv}' ORDER BY sorszam")->row();
			$foinfo->info = str_replace($order, $replace, $foinfo->info);
				
			$this->cache->write($dobozok, 'welcome-dobozok-'.$nyelv, 6000);
			$this->cache->write($foinfo, 'foinfo-dobozok-'.$nyelv, 6000);
		}
		
		
		$data['dobozok'] = $dobozok;
		$data['fo_info'] = $foinfo;
		
		if(hun())
			$tnagykepek = $this->mflashreel->get_allnext('hun');
		else
			$tnagykepek = $this->mflashreel->get_allnext('eng');
		$nagykepek = array();
		$testobject = new stdClass();
		$testobject->link    ="GNptqN4uADM";
		$testobject->filename="2013_beta_released_ENG.jpg";
		$nagykepek[] = $testobject;
		foreach($tnagykepek as $kep){
			if(substr($kep->filename,-4)==".jpg" || substr($kep->filename,-4)==".png")
				$nagykepek[] = $kep;
		}
		
		$data['nagykepek'] = $nagykepek;
		
		$data['title'] = hun() ? "ARCHLine.XP építészeti, belsőépítészeti és lakberendezési tervezőprogram" : "ARCHLine.XP CAD software, Architect and Interior design";
		
		$data['home']=true;
		
		$this->load->view('site_wel2013',$data);
	}
	
	
	function emailnuserid(){
		$temptomb = explode("/", $_SERVER[ 'REQUEST_URI'] );
		$email = str_replace("%40","@",end($temptomb));
		$nuserid = $this->get_nUserIDByEmail($email);
		print "nUserID: ".$nuserid;
		if($nuserid===false){
			print "false";
		}
	}
	
	function get_nUserIDByEmail($email,$lang='hun'){
		if(!$email)
			return false;
		
		if($lang == 'hun')
			$query = " SELECT nUserID FROM `clusers`.`cl_users_emails` WHERE email = '".$email."' AND deleted = '0' ";
		elseif($lang == 'esp')
			$query = " SELECT nUserID FROM `clusers_spa`.`cl_users` WHERE strEMail = '".$email."'";
		else
			$query = " SELECT nUserID FROM `clusers_eng`.`cl_users_emails` WHERE email = '".$email."' AND deleted = '0' ";
		
		$query = $this->db->query($query)->result();
		
		/*if( count($query)==1 )
			return $query[0]->nUserID;
		else
			return false;*/
		
		if( count($query)==1 ){
			return $query[0]->nUserID;
		}
		elseif( count($query)==0 ){
			return false;
		}
		else{
			// ha egyértelműen van olyan, aki nem lakber. iskola
			if($lang != 'hun')
				return false;
			
			$useridlist = ""; //print_r($query);
			foreach($query as $userid){
				$useridlist .= $userid->nUserID . ", ";
			}
			$useridlist = trim($useridlist,", ");
			
			$query2 = "SELECT nUserID FROM `clusers`.`cl_users` WHERE nUserID IN ({$useridlist}) AND nUserProf!=7 ";
			$query2 = $this->db->query($query2)->result();
			if( count($query2)==1 )
				return $query2[0]->nUserID;
			else
				return false;
		}
	}
	
	
	function egyedicookie(){
		if( strstr($_SERVER['HTTP_USER_AGENT'],'Firefox') ){
			setcookie("egyedicookie","Firefox-Egyedi-ertek",time()+8000,"/");
			// C:\Users\Eszter\AppData\Roaming\Mozilla\Firefox\Profiles\iigwhs3i.default\cookies.sqlite-wal
		}elseif( strstr($_SERVER['HTTP_USER_AGENT'],'Chrome') ){
			setcookie("egyedicookie","Chrome-Egyedi-ertek",time()+8000,"/");
			// C:\Users\Eszter\AppData\Local\Google\Chrome\User Data\Default\Cookies
		}elseif( strstr($_SERVER['HTTP_USER_AGENT'],'MSIE ') ){
			setcookie("egyedicookie","IE-Egyedi-ertek",time()+8000,"/");
			// C:\Users\Eszter\AppData\Roaming\Microsoft\Windows\Cookies\Low\RANDOMFAJLNEV.txt
		}else{
			setcookie("egyedicookie","Egyeb-Egyedi-ertek",time()+8000,"/");
		}
		
		
		//setcookie("egyedicookie","Harmadik-Egyedi-ertek",time()+8000,"/");
	}
	
	function decorexatnevez(){
		include('application/helpers/myimg_helper.php');
		$dir   = "public/gallery/moodboardcollection/";
		$kepek = scandir($dir);
		unset($kepek[0],$kepek[1]);
		
		$i=100;
		
		foreach($kepek as $kep){
			if(is_dir($dir.$kep)) continue;
			print "<br>kep: ".$kep;
			//exec("convert '{$dir}{$kep}' -resize 960x '{$dir}{$kep}'");
			//exec("mv '{$dir}{$kep}' '{$dir}kbb_{$i}.jpg'");
			//kemeretezesvagassh($dir.$kep,$dir."300/{$kep}",300,225);
			//kemeretezesvagassh($dir.$kep,$dir."thumbs/{$kep}",70,70);
			//kemeretezesvagassh($dir.$kep,$dir."68/{$kep}",68,68);
			$i+=10;
		}
			
		print "<br>".base64_encode($dir);
	}
	
	function olasznffkulcsok(){
		$kulcsok = $this->db->query("SELECT kulcs FROM clusers.`temp_olasznff` WHERE javitva=0 ORDER BY kulcs")->result();
		
		foreach($kulcsok as $kulcs)
			print $kulcs->kulcs.';';
		
		print "<br>darab:".count($kulcsok);
	}
	
	function teszt(){
		$sql = "SELECT * FROM clusers.cl_history WHERE nEventID=130559";
		print_r($this->db->query($sql)->row());
		print "<br>sql: ".$sql;
		//exec('echo "Bejegyzes regi adatbzisba/bol: '.$sql.'" | mail -s "REGI AB hbia" eszter@cadline.hu');
		//print " ... exec utan ";
	}
	
	function phpmemcache(){
	//	phpinfo();
		$memcache = new Memcache;
		$memcache->connect('localhost', 11211) or die ("Could not connect");
		
		$version = $memcache->getVersion();
		echo "Server's version: ".$version."<br/>\n";
		
		echo "<pre>";
		if ($get = $memcache->get("valtozoNev")) {
			echo "memcache-bol:<br>";
			print_r($get);
		} else {
			echo "sql lekerdezesbol:<br>";
			$adat = $this->db->query("SELECT * FROM a_hibak")->result();
			$memcache->set('valtozoNev', $adat, false, 300) or die ("Nem sikerult elmenteni");
			print_r($adat);
		}
		$memcache->close();
	}
	
	function dbcachetime(){
		//$this->load->driver('cache');
		print "egy ";
		/*$this->_cache_init();*/ print " ketto ";
		$this->load_rdriver();
		
		echo "aa <pre>";
		$adat = $this->CACHE->read("SELECT * FROM a_hibak");
		print_r($adat);
		
		/*if ($get = $this->cache->file->get('foo', $adat, 10)) {
			echo "memcache-bol:<br>";
			print_r($get);
		} else {
			echo "file cachebol:<br>";
			$adat = $this->db->query("SELECT * FROM a_hibak")->result();
			$this->cache->file->save('foo', $adat, 10);
			print_r($adat);
		}*/
		
	}
	
	function emailekinfobolesemenyhez(){
		$this->load->model('mclusers');
		$infok = $this->db->query("SELECT id, hiba FROM a_hibak WHERE hiba LIKE '%eng , 196 , év képe, eng%' ")->result();
		$i=0;
		foreach($infok as $info){
			$id = $info->id;
			$info = $info->hiba;
			$email = substr($info,34,-36);
			print $email." , id: ".$id."<br />";
			
			$egyezes = "www.archline.hu/yearpicture2012";
			$ujinfo = "Megtekintve: www.archline.hu/yearpicture2012";
			
		/*	$this->mclusers->levelesemeny($email, "temp", "emailekinfobol", 163, $egyezes, $ujinfo, "hun", "Kékbe év képe");
			$this->db->query("DELETE FROM a_hibak WHERE id=".$id);
		/*	if($i>20)
				break;
			
			$i++;*/
		}
		
	}
	
	function emailtorolgetes(){
		$emailek = $hibasak = $forumban = array();
		$txt = fopen( 'public/tmp_emails.txt', "r" );
		while($x = fgets( $txt, 1024)){
			if( trim($x) != "" && strstr($x,"@") )
				$emailek[] = trim($x);
			else
				$hibasak[] =  trim($x);
		}
		fclose($txt);
		
		$i=0;
		
		foreach( $emailek as $email ){
			
			$nuserids = $this->db->query("SELECT nUserID FROM `clusers`.`cl_users_emails` WHERE email LIKE '%".$email."%'")->result();
			// beirni az infoba
			if( $nuserids != array() ){
				foreach( $nuserids as $uid ){
					$parancs = "UPDATE `clusers`.`cl_users` SET `strInfo`=CONCAT(strInfo,' , hibas e-mail: {$email}') WHERE nUserID='".$uid->nUserID."'";
					print " parancs: ".$parancs;
	//				$this->db->query($parancs);
				}
			}
			
			
			// benne van-e a forumban
			$volte = $this->db->query("SELECT nUserID, login, nev FROM `cadline2`.`forum_user` WHERE login='".$email."' LIMIT 0,1")->result();
			if( $volte != array() ){
				print "<br> FORUM: "; print_r($volte);
				$forumban[] = $email;
			}else{
				// törlés az e-mail mezőből
	//			$this->db->query("DELETE FROM `clusers`.`cl_users_emails` WHERE email='".$email."'");
				
			}
			
			
			print "<br />torolni: ".$email."<br><br>";
			$i++;
		}
		
		print "<br /><br />FORUMBAN: ";
		foreach( $forumban as $email ){
			print "<br>".$email;
		}
		foreach( $hibasak as $email ){
			print "<br />hiba: ".$email;
		}
		
	}
	
	
	function tesztexec(){
	//	exec("du -sh /var/www/hosting/cadline.hu/www/public/ > /var/www/hosting/cadline.hu/www/public/bugfajlok.txt");
	//	exec("mkdir public/img/newsletter && chmod 777 public/img/newsletter");
		
	//	echo exec('find / -name "*codegen.so" -exec echo {} \; > /var/www/hosting/cadline.hu/www/public/bugfajlok.txt');
	//	if(file_exists('/var/www/tamas/codegen_library/codegen.so'))
	//		print "létezik";
	//	else
	//		print "nem létezik";
	//	$ftemp = fopen( "public/bugfajlok.txt", "r" );
	//	while($x = fgets( $ftemp, 1024))
	//		print $x."<br>";
	//	fclose($ftemp);
	//	exec('crontab -r && crontab public/render/ellenorzesidozito');
	//	exec('crontab -r && crontab public/bugfajlok.txt');
		exec('crontab -l >> public/bugfajlok.txt');
	//	exec('ls -l /var/www/tamas/ >> public/bugfajlok.txt');
	//	exec('ls -l /home/cadline/public_html/tamas/codegen_php/ >> public/bugfajlok.txt');
	//	exec('chmod 777 -R public/tamas_cp/');
	//	exec('cp /var/www/hosting/cadline.hu/www/codegen.so /home/cadline/public_html/tamas/codegen_library/codegen.so');
	//	exec('cp public/downloads/eng/Multilang_XP2012_setup.exe public/downloads/eng/ARCHLINE_XP2012_setup.exe');
		
	//	exec('df -h >> /var/www/hosting/cadline.hu/www/public/bugfajlok.txt');
	//	exec('chmod -R 777 /var/www/hosting/cadline.hu/www/public/img/collection/users/1044');
	//	exec('rm -R /var/www/hosting/cadline.hu/www/public/img/collection/users/trash/guest/*');
		
	//	print_r($_SERVER);
	/*	$tmpfajl = "public/tmp/Eredmeny_".rand(10,99).".pdf";
		exec('php public/tcexam/public/code/tce_pdf_results_save.php 8 '.$tmpfajl);
		exec('chmod 777 '.$tmpfajl);*/
	//	include('application/helpers/myimg_helper.php');
	//	kemeretezesvagassh('public/img/temp/Harosi_Krisztina_Moncucco_Vista03.jpg','public/img/temp/Harosi_Krisztina_Moncucco_Vista03_285.jpg',285,220);
	//	exec('find /var/www/hosting/cadline.hu/www/public/img/collection/szintetika/ -name \'zz_small.jpg\' | xargs jpegoptim --strip-all');
		print "ez ok";
		
	}
	
	function semmi(){
		$allow = '<p><ul><li><b><strong><a>';
		
		$egywordossor = $this->db->query(" select szoveg from `cadline2`.`hozzaszolasok` WHERE hsz_id = 766 ")->row();
		//print_r($egywordossor);
		$str = $egywordossor->szoveg;
		
	//	$str = '<p style="text-align:center">Paragraph</p><strong>Bold</strong><br/><span style="color:red">Red</span><h1>Header</h1>';

	//	$result = strip_tags($str,$allow);
	//	$result = $this->clean_inside_tags($str,$allow);
		$result = $this->removeUnsafeAttributesAndGivenTags($str,$allow);
		
	//	$result = preg_replace ('/<[^>]*>/', '', $result);
		
		echo '<textarea rows="20" cols="110">'.$result.'</textarea>';
	}
	
	//Clean the inside of the tags
	function clean_inside_tags($txt,$tags){   
		preg_match_all("/<([^>]+)>/i",$tags,$allTags,PREG_PATTERN_ORDER);
		foreach ($allTags[1] as $tag){
			$txt = preg_replace("/<".$tag."[^>]*>/i","<".$tag.">",$txt);
		}
		
		
		preg_match_all("/<w:([^>]+)>/i",$tags,$allTags,PREG_PATTERN_ORDER);
		foreach ($allTags[1] as $tag){
			$txt = preg_replace("/<".$tag."[^>]*>/i","<22 ".$tag.">",$txt);
		}
		return $txt;
	}
	
	function removeUnsafeAttributesAndGivenTags($input, $validTags = ''){
		$regex = '#\s*<(/?\w+)\s+(?:on\w+\s*=\s*(["\'\s])?.+?
\(\1?.+?\1?\);?\1?|style=["\'].+?["\'])\s*>#is';
		return preg_replace($regex, '<${1}>',strip_tags($input, $validTags));
	}
	
	// javascript-es ..
/*	function CleanWordHTML( $str ){
		str = str.replace(/<o:p>\s*<\/o:p>/g, "") ;
		str = str.replace(/<o:p>.*?<\/o:p>/g, "&nbsp;") ;
		str = str.replace( /\s*mso-[^:]+:[^;"]+;?/gi, "" ) ;
		str = str.replace( /\s*MARGIN: 0cm 0cm 0pt\s*;/gi, "" ) ;
		str = str.replace( /\s*MARGIN: 0cm 0cm 0pt\s*"/gi, "\"" ) ;
		str = str.replace( /\s*TEXT-INDENT: 0cm\s*;/gi, "" ) ;
		str = str.replace( /\s*TEXT-INDENT: 0cm\s*"/gi, "\"" ) ;
		str = str.replace( /\s*TEXT-ALIGN: [^\s;]+;?"/gi, "\"" ) ;
		str = str.replace( /\s*PAGE-BREAK-BEFORE: [^\s;]+;?"/gi, "\"" ) ;
		str = str.replace( /\s*FONT-VARIANT: [^\s;]+;?"/gi, "\"" ) ;
		str = str.replace( /\s*tab-stops:[^;"]*;?/gi, "" ) ;
		str = str.replace( /\s*tab-stops:[^"]*/                                /*gi, "" ) ;
		str = str.replace( /\s*face="[^"]*"/gi, "" ) ;
		str = str.replace( /\s*face=[^ >]*/                                    /*gi, "" ) ;
		str = str.replace( /\s*FONT-FAMILY:[^;"]*;?/gi, "" ) ;
		str = str.replace(/<(\w[^>]*) class=([^ |>]*)([^>]*)/gi, "<$1$3") ;
		str = str.replace( /<(\w[^>]*) style="([^\"]*)"([^>]*)/gi, "<$1$3" ) ;
		str = str.replace( /\s*style="\s*"/gi, '' ) ;
		str = str.replace( /<SPAN\s*[^>]*>\s*&nbsp;\s*<\/SPAN>/gi, '&nbsp;' ) ;
		str = str.replace( /<SPAN\s*[^>]*><\/SPAN>/gi, '' ) ;
		str = str.replace(/<(\w[^>]*) lang=([^ |>]*)([^>]*)/gi, "<$1$3") ;
		str = str.replace( /<SPAN\s*>(.*?)<\/SPAN>/gi, '$1' ) ;
		str = str.replace( /<FONT\s*>(.*?)<\/FONT>/gi, '$1' ) ;
		str = str.replace(/<\\?\?xml[^>]*>/gi, "") ;
		str = str.replace(/<\/?\w+:[^>]*>/gi, "") ;
		str = str.replace( /<H\d>\s*<\/H\d>/gi, '' ) ;
		str = str.replace( /<H1([^>]*)>/gi, '' ) ;
		str = str.replace( /<H2([^>]*)>/gi, '' ) ;
		str = str.replace( /<H3([^>]*)>/gi, '' ) ;
		str = str.replace( /<H4([^>]*)>/gi, '' ) ;
		str = str.replace( /<H5([^>]*)>/gi, '' ) ;
		str = str.replace( /<H6([^>]*)>/gi, '' ) ;
		str = str.replace( /<\/H\d>/gi, '<br>' ) ; //remove this to take out breaks where Heading tags were
		str = str.replace( /<(U|I|STRIKE)>&nbsp;<\/\1>/g, '&nbsp;' ) ;
		str = str.replace( /<(B|b)>&nbsp;<\/\b|B>/g, '' ) ;
		str = str.replace( /<([^\s>]+)[^>]*>\s*<\/\1>/g, '' ) ;
		str = str.replace( /<([^\s>]+)[^>]*>\s*<\/\1>/g, '' ) ;
		str = str.replace( /<([^\s>]+)[^>]*>\s*<\/\1>/g, '' ) ;
		//some RegEx code for the picky browsers
		var re = new RegExp("(<P)([^>]*>.*?)(<\/P>)","gi") ;
		str = str.replace( re, "<div$2</div>" ) ;
		var re2 = new RegExp("(<font|<FONT)([^*>]*>.*?)(<\/FONT>|<\/font>)","gi") ;
		str = str.replace( re2, "<div$2</div>") ;
		str = str.replace( /size|SIZE = ([\d]{1})/g, '' ) ;
	
		return $str ;
	}*/
	
	
	// képet táblázatba
	function konvert2(){
		include('application/helpers/myimg_helper.php');
		$img = imagecreatefrombmp('public/render/temp/egykep.bmp');
		$filename = 'public/render/temp/kep.html';
		$wid = imagesx($img);
		$hei = imagesy($img);
		$wid_pad = str_pad('', $wid % 4, "\0");
		
		$size = 54 + ($wid + $wid_pad) * $hei * 3; //fixed
		
	/*	//prepare & save header
		$header['identifier']		= 'BM';print "fajl: ".$size;
		$header['file_size']		= dword($size);
		$header['reserved']			= dword(0);
		$header['bitmap_data']		= dword(54);
		$header['header_size']		= dword(40);
		$header['width']			= dword($wid);
		$header['height']			= dword($hei);
		$header['planes']			= word(1);
		$header['bits_per_pixel']	= word(24);
		$header['compression']		= dword(0);
		$header['data_size']		= dword(0);
		$header['h_resolution']		= dword(0);
		$header['v_resolution']		= dword(0);
		$header['colors']			= dword(0);
		$header['important_colors']	= dword(0);*/
		
		print "<div style='font-size: 4px; letter-spacing: 0pt; font-weight: bold; line-height: 100%; '>";
		print "<table cellpadding='0' cellspacing='0' border='0'>";
		if ($filename)
		{
			$f = fopen($filename, "wb");
			
			//save pixels
			for ($y=$hei-1; $y>=0; $y--){
				print "<tr style='border: 0;'>";
				for ($x=0; $x<$wid; $x++){
					$rgb = imagecolorat($img, $x, $y);
					if(!$rgb)
						$rgb = "#fff";
					$ki = "<td style='height: 1px; width: 1px; font-size: 1px; border: 0; padding: 0; margin: 0; background-color: rgb(".(($rgb >> 16) & 0xFF).", ".(($rgb >> 8) & 0xFF).",".($rgb & 0xFF).");'>&nbsp;</td>\n\t";
					print $ki;
				}
				print "</tr>\n";
			}
			fclose($f);
		}
		print "</table>";
		print "</div>";
		
	}
	
	
	function atpakolgatas(){
		$honnan = "/var/www/hosting/cadline.hu/www/public/downloads/hun/updates";
		$hova = "/var/www/hosting/cadline.hu/www/public/downloads/eng/updates";
		
		$fajlok = scandir($honnan);
		foreach($fajlok as $fajl){
			if($fajl != ".." && $fajl != "."){
				if( file_exists($hova."/".$fajl) )
					print "<br>Ez a fajl mar letezik: ".$hova."/".$fajl;
				else{
	//				copy($honnan."/".$fajl, $hova."/".$fajl);
					print "<br>atmasolva: ".$hova."/".$fajl;
				}
			}
		}
	}
	
	
	function vizjel(){
		
		/*$k_nev = "/usr/share/fonts/truetype/ttf-dejavu/";
		if ($konyvtar = opendir($k_nev)) {
			while (false !== ($egyfajl = readdir($konyvtar))) {
				if ($egyfajl != "." && $egyfajl != ".." && $egyfajl != "thumbs.db") {
					echo $k_nev . $egyfajl."<br>";
				}
			}
		}*/
		
		
		/*
		$config['image_library'] = 'gd2';
		$config['source_image'] = 'public/img/teszt/tesztkep.jpg';
		$config['wm_text'] = 'SZÖVEG';
		$config['wm_font_color'] = '#ff8800';
		$config['dynamic_output'] = TRUE;
		$config['wm_font_size'] = '40';
		$config['wm_hor_alignment'] = "R";
		$config['wm_padding'] = -10;
		$config['wm_shadow_distance'] = FALSE;
		$config['wm_font_path'] = '/usr/share/fonts/truetype/ttf-dejavu/DejaVuSansMono-Bold.ttf';
		*/
	//	$config['wm_use_truetype'] = FALSE;
	//	$config['wm_use_drop_shadow'] = TRUE;
		
	//	$this->load->library('image_lib', $config);
		
	//	$this->image_lib->text_watermark();
		
		
	//	print "x";
		
		
		
		/*  Átméretezéssel  */
		// kep atmeretezese 200x150-re
		/*$ujkep = 'public/img/teszt/tesztkep.jpg';
		
		// Get new dimensions
		list($width, $height) = getimagesize($ujkep);
		$new_width = 200;
		$new_height = 150;
		
		// Resample
		$image_p = imagecreatetruecolor($new_width, $new_height);
		$image = imagecreatefromjpeg($ujkep);
		imagecopyresampled($image_p, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height);
		
		// Output1
		imagejpeg($image_p, $ujkep, 100);
		
		
		$config['image_library'] = 'gd2';
		$config['full_src_path'] = 'public/img/teszt/tesztkep.jpg';
		$config['wm_overlay_path'] = 'public/img/forum/stilus/watermark.png';
	//	$config['wm_font_color'] = '#ff8800';
		$config['dynamic_output'] = TRUE;
	//	$config['wm_font_size'] = '40';
	//	$config['wm_hor_alignment'] = "R";
		
		$this->load->library('image_lib', $config);
		$this->image_lib->overlay_watermark();
		*/
		
		
		
		
		
		/*   SZOVEGET    */
		
		$alap=@imagecreatefromjpeg("public/img/teszt/tesztkep.jpg"); // Erre a képre akarok vízjelet
		if(!$alap)die("Valami gáz van!");
	
		$x=imagesx($alap);
		$y=imagesy($alap);
	
		$uj=imagecreatetruecolor($x,$y);    // ez lesz az új kép
		imagecopy($uj,$alap,0,0,0,0,$x,$y);
	
		$wm=imagecreatetruecolor($x,$y);    // ebbe írom a watermarkot
		$white=imagecolorallocate($wm,255,150,0);     // Fehérrel (255,255,255) akarok írni
		imagealphablending($wm,false);                  //
		$col=imagecolorallocatealpha($wm,0,0,0,127);    // A fekete (0,0,0) teljesen átlátszó lesz(127)
		imagecolortransparent($wm,$col);                // Itt állítom be, hogy valóban átlátszó legyen a fekete
		imagefilledrectangle($wm,0,0,$x,$y,$col);       // Készítek egy teljesen átlátszó képet
		imagefttext($wm,40,0,0,$y/2,$white,"/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf","Vízjel &#369;ő");
		imagecopymerge($uj,$wm,0,0,0,0,$x,$y,60);      // Rámásolom a vízjelet az eredeti képre. Az utolsó paraméterként megadott
						// 100 jelenti, hogy ami nem átlátszó színű, az legyen teljesen átlátszatlan
						// Minél kisebb ez az érték, annál átlátszóbb a teljes réteg.
		
		imagepng($uj,"public/img/teszt/uj.png");
		
		//header('Content-type: image/png');
		header('Content-Disposition: attachment; filename="public/img/teszt/uj.png"');
		imagepng($uj);
		imagedestroy($wm);
		imagedestroy($uj);
		imagedestroy($alap);
		
		
		
		
		/*  KEPET  */
		/*
		$url = "public/img/teszt/tesztkep.jpg";
		
		if ($url != ""){
		
		$adatok = GetImageSize($url);
		$szelesseg = $adatok[0];
		$magassag = $adatok[1];
		$tipus = $adatok[2];
		
		$kep = ImageCreateTrueColor(100, 100);
		if ($tipus == 1) {
			$kep = ImageCreateFromGif($url);
		} elseif ($tipus == 2) {
			$kep = ImageCreateFromJpeg($url);
		} elseif ($tipus == 3) {
			$kep = ImageCreateFromPng($url);
		}
		
		$vizjel = ImageCreateFromGif("public/img/close.gif");
		imagealphablending($vizjel,false); //---------------------------------------------------------------
		imagesavealpha($vizjel,true); //---------------------------------------------------------------
		$vizjel_szelesseg = imagesx($vizjel);
		$vizjel_magassag = imagesy($vizjel);
		
		$vizjel_szelesseg = imagesx($vizjel);
		$vizjel_magassag = imagesy($vizjel);
		
		$margo_jobb = 10;
		$margo_also = 10;
		$vizjel_x = $szelesseg - $vizjel_szelesseg - $margo_jobb;
		$vizjel_y = $magassag - $vizjel_magassag - $margo_also;
		
		ImageCopyMerge($kep, $vizjel, $vizjel_x, $vizjel_y, 0, 0, $vizjel_szelesseg, $vizjel_magassag, 100);
		
		header ("Content-type: image/png");
		ImagePng($kep);
		
		ImageDestroy($kep);
		}
		*/
	}
	
	
	function twitter(){
		$msg = "Új hír: Lakberendező képzés a Stílusházban! (http://www.archline.hu/news/show/stilushaz-tanfolyam)";
		/*require_once('application/plugins/Twitter-PHP/twitter.class.php');
		require_once('application/plugins/Twitter-PHP/OAuth.php');
		$consumerKey       = 'y550xIIROlUYS0TubCqAJA';
		$consumerSecret    = 'sWHuS8TevjHopNeSCf73AeX6JUT1B3e1ma1zF810I';
		$accessToken       = '136217633-6MIHowRunalfGoUHUoMd53MtgGqtXCO36vtxEWAL';
		$accessTokenSecret = 'KNGkVbV8cTqY9DlSj61neMNJYgdexL90WXSpEgqwmw';
		
		
		
		print "twitter kozben 1";
		$twitter = new Twitter($consumerKey, $consumerSecret, $accessToken, $accessTokenSecret);
		print " new Ok ";
		print $status = $twitter->send($msg);
		print " send Ok ";*/
		
		require_once('application/plugins/codebird-php-2.4.1/src/codebird.php'); print " 1 ";
		//\Codebird\Codebird::setConsumerKey('YOURKEY', 'YOURSECRET'); // static, see 'Using multiple Codebird instances'
		print " 2 ";
		$cb = \Codebird\Codebird::getInstance(); print " 3 ";
		//$reply = $cb->statuses_update('status='.$msg); print " OK ";
	}
	
}
