Onderwerp bekijken
Vragen/Problemen in verband met infusions
 Onderwerp afdrukken
Autonews Infusion
afoster
Trying to adapt the autonews infusion to php-fusion 8.00.xx and after some trial and error was able to infuse it. I still can't get it to send out emails but at the moment, I am getting the following error message in the error log.

Error
autonews/autonews_include.php
mysql_result() expects parameter 1 to be resource, object given Line: 393

line: 393 shows


$rtn = mysql_result($result, 0);


Can anyone tell me how to fix it?
 
douwe_yntema
mysql_result is deprecated in php5.6 and removed in php 7.0, so it is not recommend to use this function


You should use the function dbcount from maincore

It should be something like:

$rtn = dbcount("somefield", DB_USERS, "autonews='1'")


**
 * Count the number of rows in a table filtered by conditions
 *
 * @global int   $mysql_queries_count
 * @global array $mysql_queries_time
 *
 * @param string $field      Parenthesized field name
 * @param string $table      Table name
 * @param string $conditions conditions after "where"
 *
 * @return boolean
 */
function dbcount($field, $table, $conditions = "") {
    $cond = ($conditions ? " WHERE ".$conditions : "");
    $sql = "SELECT COUNT".$field." FROM ".$table.$cond;
    try {
        $statement = dbconnection()->prepare($sql);
        $statement->execute();
        return $statement->fetchColumn();
    } catch (PDOException $e) {
        trigger_error($e->getMessage(), E_USER_ERROR);
        echo $e;
        return FALSE;
    }
}

Gewijzigd door douwe_yntema op 24 February 2019, 15:31
 
http://www.php-fusi
afoster

Quote

douwe_yntema schreef:

mysql_result is deprecated in php5.6 and removed in php 7.0, so it is not recommend to use this function


You should use the function dbcount from maincore

It should be something like:

$rtn = dbcount("somefield", DB_USERS, "autonews='1'")


**
 * Count the number of rows in a table filtered by conditions
 *
 * @global int   $mysql_queries_count
 * @global array $mysql_queries_time
 *
 * @param string $field      Parenthesized field name
 * @param string $table      Table name
 * @param string $conditions conditions after "where"
 *
 * @return boolean
 */
function dbcount($field, $table, $conditions = "") {
    $cond = ($conditions ? " WHERE ".$conditions : "");
    $sql = "SELECT COUNT".$field." FROM ".$table.$cond;
    try {
        $statement = dbconnection()->prepare($sql);
        $statement->execute();
        return $statement->fetchColumn();
    } catch (PDOException $e) {
        trigger_error($e->getMessage(), E_USER_ERROR);
        echo $e;
        return FALSE;
    }
}


Thank you so much for your help.
 
douwe_yntema
You are welcome.

Please let me know if you get the infusion working. I am interested in it.
 
http://www.php-fusi
afoster

Quote

douwe_yntema schreef:

You are welcome.

Please let me know if you get the infusion working. I am interested in it.


No I still can't send any emails and making the change you suggested gave me all kinds of error messages that I do not know how to fix. I am attaching the infusion to this message in the hope you can figure out how get it working. I have it working on php-fusion 7.02.07 but it will not send emails on php-fusion 8.00.21
afoster voegde bij, bestand:
autonews_infusion1.zip [54.49KB / 140 Downloads]
 
douwe_yntema
Without looking in the code my first guess the source of the problem lies in the php-version in stead of the php-fusion version.

I will take a look at your attached files. But not whitin this week.
 
http://www.php-fusi
douwe_yntema
On what configuration have you tested the autonews infusion?

I tested it on PHP-Fusion 8.0.20 on PHP 5.6.40 and 5.5.5-10.1.38-MariaDB

It is not running at all.

And next question: On what configuration are you planning to use it?

Just to make sure.
 
http://www.php-fusi
afoster

Quote

douwe_yntema schreef:

On what configuration have you tested the autonews infusion?

I tested it on PHP-Fusion 8.0.20 on PHP 5.6.40 and 5.5.5-10.1.38-MariaDB

It is not running at all.

And next question: On what configuration are you planning to use it?

Just to make sure.


I have been using it on two sites running php-fusion 7.02.07 and am trying to adapt it to a site running php-fusion 8.00.21 using php version 5.6.3. I have been able to get it infused but can't get it to send out any email. I am attaching a zip file that contains all the original files of the infusion and I thank you for your offer to help.
afoster voegde bij, bestand:
autonews_infusion1_1.zip [54.49KB / 130 Downloads]
 
douwe_yntema
I Got your infusion working and sending mail.

In file autonews_include.php line 393 must be changed to:


$rtn = dbrows($result);


Furthermore to send mail, it is file autonews_cronjob.php that says:

// To activate this file, set $locale['AN042'] to TRUE and insert a password below
// Use 'http://wwww.mysite.com/infusion/autonews/autonews_cronjob.php?pw=mypassword' from cronjob

But, $locale['AN042'] does not exist. You need to change in file autonews_param.php, line 30 to:

$autonews_params['cronjob'] = TRUE;    // TRUE if cronjob is used - FALSE otherwise


and enter a password in file autonews_cronjob.php in line 24.

Then call the cronjob as state as:
http://wwww.mysite.com/infusion/autonews/autonews_cronjob.php?pw=mypassword

where the password is from autonews_cronjob.php line 24.

of course you need to set up PHP-Fusion correctly for sending mail.

There are some warnings about shoutbox, I infused the shoutbox, but not set it up. Don't know if this need to be digged out deeper.
douwe_yntema voegde bij, afbeelding: (Klik het plaatje voor vergroting!)
schermafdruk_van_2019-03-02_20-50-35.png
 
http://www.php-fusi
afoster

Quote

douwe_yntema schreef:

I Got your infusion working and sending mail.

In file autonews_include.php line 393 must be changed to:


$rtn = dbrows($result);


Furthermore to send mail, it is file autonews_cronjob.php that says:

// To activate this file, set $locale['AN042'] to TRUE and insert a password below
// Use 'http://wwww.mysite.com/infusion/autonews/autonews_cronjob.php?pw=mypassword' from cronjob

But, $locale['AN042'] does not exist. You need to change in file autonews_param.php, line 30 to:

$autonews_params['cronjob'] = TRUE;    // TRUE if cronjob is used - FALSE otherwise


and enter a password in file autonews_cronjob.php in line 24.

Then call the cronjob as state as:
http://wwww.mysite.com/infusion/autonews/autonews_cronjob.php?pw=mypassword

where the password is from autonews_cronjob.php line 24.

of course you need to set up PHP-Fusion correctly for sending mail.

There are some warnings about shoutbox, I infused the shoutbox, but not set it up. Don't know if this need to be digged out deeper.


Thanks for your response again douwe_yntema. I was never running a cron job on my other sites, but if that is what it takes to make this work with this version of autonews, then I will do so. I will follow your suggestions and get back to you.
 
Spring naar forum:
Nieuw onderwerp Antwoorden
Gebruik BBcode of HTML om naar; 'Autonews Infusion', te verwijzen!
BBcode:
HTML:
Vergelijkbare onderwerpen
Onderwerp Forum         Laatste bericht
infusion aanpassen via phpmyadmin Infusions : 12 19 Feb 2017, 07:28
nieuwe infusion Infusions : 1 18 Feb 2017, 22:05
nieuw infusion shoutchat Infusions : 2 01 Feb 2015, 14:34
Versie infusion Modificaties : 5 24 Sep 2014, 18:59
infusion of mod Infusions : 4 08 Dec 2013, 12:57