Fatal error: Class 'JFactory' not found in Joomla upgrade - php

I've just upgraded my Joomla to the version 2.5.16
One file with the following code is now returning the error:
Fatal error: Class 'JFactory' not found in
This is the code:
<?php
$user = JFactory::getUser();
$group_id = &JFactory::group_id();
$user_id = $user->get('id');
?>

Related

Call to undefined method Infusionsoft\Api\Rest\ContactService::addWithDupCheck()

This was working all this while with no issues and updates.
$user_id = $infusionsoft->contacts->addWithDupCheck($contact, 'Email');
Now all of a sudden it isn't
PHP Fatal error: Uncaught Error: Call to undefined method
Infusionsoft\Api\Rest\ContactService::addWithDupCheck() in
/home/user/public_html/infusionsoft/addContact.cli.php:29
~/public_html/infusionsoft$ cat composer.json
{
"require": {
"infusionsoft/php-sdk": "^1.0"
}
}
InfusionSoft has replaced their older XML-RPC API with REST. REST is now default. So I had to do :
$user_id = $infusionsoft->contacts('xml')->addWithDupCheck($contact, 'Email');

PHP Fatal error: Uncaught Error: Call to a member function getTimestamp() on boolean

I'm running my PHP CodeIgniter app on Heroku and many users started getting 500 errors just today.
I checked the logs and found multiple entries for:
PHP Fatal error: Uncaught Error: Call to a member function getTimestamp() on boolean
Doing some searching, it seems as though others have encountered problems with getTimestamp(). Are there any alternatives?
Here is the corresponding code:
public function compareDates($date){
$LastFiveDates = $this->getLastFiveDates();
$signUpDate = $this->getUserSignUpDate();
$requested_date = $date;
if($LastFiveDates[0] < $signUpDate){
$signUpDate = $LastFiveDates[0];
}
if($signUpDate == NULL){
$signUpDate = "09-25-2017";
}
$signUpDate_dt = DateTime::createFromFormat("m-d-Y", $signUpDate);
$signUpDate_ts = $signUpDate_dt->getTimestamp();
$requested_date_dt = DateTime::createFromFormat("m-d-Y", $requested_date);
$requested_date_ts = $requested_date_dt->getTimestamp();
if ($signUpDate_ts > $requested_date_ts) {
$this->noAccess();
}
}

Catchable fatal error - Joomla Compoent - FOF

I Newly Create Joomla Component using Framework on Framework. Administrator Section Working Fine. In Site Section Display Following Error. How to Resolve this Error.
Catchable fatal error: Argument 1 passed to FOFTable::setInput() must
be an instance of FOFInput, instance of F0FInput given, called in
/var/www/testjoomla/libraries/f0f/table/table.php on line 434 and
defined in /var/www/testjoomla/libraries/fof/table/table.php on line
3236
in my Dispatcher code :
include_once JPATH_LIBRARIES.'/fof/include.php';
class GulfJobDispatcher extends FOFDispatcher
{
public function onBeforeDispatch() {
$result = parent::onBeforeDispatch();
if($result) {
// Load Akeeba Strapper
include_once JPATH_ROOT.'/media/akeeba_strapper/strapper.php';
AkeebaStrapper::bootstrap();
AkeebaStrapper::jQueryUI();
AkeebaStrapper::addCSSfile('media://com_gulfjob/css/frontend.css');
}
return $result;
}
}
change F0F to FOF in your Controller or Other Area

PHP SOAP Fatal Error

I'm trying to integrate cargo system to my website. Then I'm using their webservice.
But I've an error like that:
"Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't find in "
And error show me that line: 2 second. And that line has that code:
$client = new SoapClient("http://customerservices.araskargo.com.tr/ArasCargoCustomerIntegrationService/ArasCargoIntegrationService.svc");
And here's my full code:
<?php
$client = new SoapClient("http://customerservices.araskargo.com.tr/ArasCargoCustomerIntegrationService/ArasCargoIntegrationService.svc");
$queryInfo = "<QueryInfo>".
"<QueryType>2</QueryType>".
"<Date>07.10.2015</Date>".
"</QueryInfo>";
$loginInfo = "<LoginInfo>".
"<UserName>xxx</UserName>".
"<Password>xxx</Password>".
"<CustomerCode>xxx</CustomerCode>".
"</LoginInfo>";
$result = $client->GetQueryXML(array('loginInfo'=>$loginInfo,'queryInfo'=>$queryInfo));
echo $result;
How can I solve my problem?
The url you're passing to SoapClient is not that of a wsdl file. You maybe meant to use:
$client = new SoapClient("http://customerservices.araskargo.com.tr/ArasCargoCustomerIntegrationService/ArasCargoIntegrationService.svc?singleWsdl");

Using Adldap php class, but getting error when looking for group user belongs to

<?php
ini_set('display_errors',1);
error_reporting(E_ALL);
require_once('/include/adLDAP.php');
$adldap = new adLDAP();
$username = "user123";
$password = "pass123";
$authUser = $adldap->authenticate($username, $password);
if ($authUser === true) {
echo "<p>User authenticated successfully</p>";
}
else {
echo "User authentication unsuccessful";
}
$result=$ldap->user_groups($username);
print_r($result);
?>
I am using this class http://adldap.sourceforge.net/ and authentication works fine, but it gives me the following error:
Notice: Undefined variable: ldap in /web/protected/protected.php on line 18
Fatal error: Call to a member function user_groups() on a non-object in /web/protected/protected.php on line 18
Line 18 is:
$result=$ldap->user_groups($username);
Never used this class before, so I am unsure of why it is giving me that error, any help is appreciated.
When instanciating the adLDAP class, you're storing the instance object in $adldap :
$adldap = new adLDAP();
But, later, you are trying to use $ldap :
$result=$ldap->user_groups($username);
That $ldap variable doesn't exist -- hence the notice.
And as it doesn't exist, PHP considers it's null
And null is not an object -- which means you cannot call a method on it -- which explains the Fatal Error.
I suppose you should replace this line :
$result=$ldap->user_groups($username);
By this one :
$result=$adldap->user_groups($username);
Note the $adldap instead of $ldap, to use the instance of your adLDAP class, instead of a non-existing variable.

Categories