sn4k3
(Tiago Caza)
1
hi,
im getting a fatal error, without a reason
Fatal error: Class 'CTheme' not found in D:\wamp\www\yii\eurom\protected\controllers\PayController.php on line 95
// Line 95
$r=HIPAY_MAPI_COMM_XML::analyzeResponseXML($output, &$url, &$err_msg);
// Function:
public static function analyzeResponseXML($xml, &$url, &$err_msg)
{
$url='';
$err_msg='';
try {
$obj = @new SimpleXMLElement(trim($xml));
} catch (Exception $e) {
return false;
}
if (isset($obj->result[0]->url)) {
$url = $obj->result[0]->url;
return true;
}
if (isset($obj->result[0]->message))
$err_msg = $obj->result[0]->message;
return false;
}
mdomba
(Maurizio Domba Cerin)
2
As the error says "CTheme not found"… are you using somewhere that?
sn4k3
(Tiago Caza)
3
im using that in a controller
public function actionGerate()
{
if(Yii::app()->user->isGuest)
die('Erro: Utilizador não autorizado!');
if(!isset($_POST['paywith']))
die('Pedido invalido!');
$paywith=intval($_POST['paywith']);
switch($paywith)
{
case PAY_HIPAY:
return $this->gerateHipay();
break;
}
}
private function gerateHipay()
{
if(!isset($_POST['YII_CSRF_TOKEN']))
die('Pedido invalido! (-1)');
if(isset($_POST['society']) && $_POST['society'])
{
if(!isset($_POST['society_id']) && !$_POST['society_id'])
die('Pedido invalido! (1)');
$societyid = intval($_POST['society_id']);
if(!$societyid)
die('Pedido invalido! (2)');
$society = Society::get($societyid);
if(!$society)
die('Sociedade invalida! '.$societyid);
$params = Payment::hipay();
$t=$params->check();
if (!$t)
{
echo "Ocorreu um erro ao tentar criar o objecto de pagamento.";
exit;
}
/*$tax = Payment::hipay('tax');
$t=$tax->check();
if (!$t)
{
echo "Ocorreu um erro ao tentar criar o objecto da taxa.";
}*/
$order = Payment::hipay('order');
$t=$order->check();
if (!$t)
{
echo "Ocorreu um erro ao tentar criar o objecto de pedido.";
exit;
}
$order->setFixedCost(Yii::app()->params['hipay']['tax'],array()/*,array($tax)*/);
$item1 = new HIPAY_MAPI_Product();
$item1->setName($society['name']);
$item1->setInfo("Participar na sociedade '{$society['name']}' desta semana");
$item1->setquantity(1);
$item1->setRef('SC'.$societyid);
$item1->setCategory(5);
$item1->setPrice($society['price']);
//$item1->setTax(array($tax3,$tax2));
$t=$item1->check();
if (!$t)
{
echo "Ocorreu um erro ao tentar criar o objecto do produto.";
exit;
}
try {
$payment = new HIPAY_MAPI_SimplePayment($params,$order,array($item1));
}
catch (Exception $e) {
echo "Error" .$e->getMessage();
}
$xmlTx=$payment->getXML();
$output=HIPAY_MAPI_SEND_XML::sendXML($xmlTx);
echo $output;
$r=HIPAY_MAPI_COMM_XML::analyzeResponseXML($output, &$url, &$err_msg);
if ($r===true)
header('Location: '.$url);
else
die('Não é possivel analizar a resposta do gateaway de pagamentos, tente mais tarde. '.$err_msg);
die($output);
}
die('Pedido invalido! (0)');
}
if i comment the error line it works well, but i dont see a reason to function broke framework
$r=HIPAY_MAPI_COMM_XML::analyzeResponseXML($output, &$url, &$err_msg);
mdomba
(Maurizio Domba Cerin)
4
In your posted code there is nowhere "CTheme"…
As the error says… it cannot find CTheme… could be misspelled or wrong case…
sn4k3
(Tiago Caza)
5
nop im not using it, im just using themes, i not use ctheme class nowhere, the problem is only in the function i show, when i use, that error happens
mdomba
(Maurizio Domba Cerin)
6
Very strange… as the error say "class CTheme not found" seems that somewhere it is trying to include a class named CTheme
sn4k3
(Tiago Caza)
7
yes i know, but i not use…
this happen when i call
$r=HIPAY_MAPI_COMM_XML::analyzeResponseXML($output, &$url, &$err_msg);
what could i do/try?
sn4k3
(Tiago Caza)
8
note:
after some tries i notice this:
ERROR:
$r=HIPAY_MAPI_COMM_XML::analyzeResponseXML($output, &$url, &$err_msg);
Works, and url got set from function, but is strange because im not passing it as & reference
$r=HIPAY_MAPI_COMM_XML::analyzeResponseXML($output, $url, $err_msg);