Loading


Advertisement:

Recent Posts

Pages: 1 ... 8 9 [10]
91
3.7.x / Re: [Solved] User alerts
« Last post by marius-ciclistu on April 26, 2017, 11:03:35 am »
Thank you all.
With the help of _CONEJO, the problem is detailed and resolved here:
https://forums.osclass.org/3-7-x/for-_conejo-issue-2140-and-2131-user-alerts/msg149536/#msg149536
92
3.7.x / Re: Info for _Conejo issue #2140 and #2131 user alerts
« Last post by marius-ciclistu on April 26, 2017, 10:59:05 am »
I'm sorry. You were right. When replacing

Code: [Select]
                    foreach($alerts as $alert) {
+                        $user = array();
+                        if($alert['fk_i_user_id']!=0) {
+                            $user = $mUser->findByPrimaryKey($alert['fk_i_user_id']);
+                        }
+                        if(!isset($user['s_name'])) {
+                            $user = array(
+                                's_name' => $alert['s_email'],
+                                's_email' => $alert['s_email']
+                            );
+                        }

The plusses were paste also. it workes now.
Problem solved.

Thank you.
93
3.7.x / Re: Info for _Conejo issue #2140 and #2131 user alerts
« Last post by _CONEJO on April 26, 2017, 10:57:20 am »
Code: [Select]
+                        $user = array();
+                        if($alert['fk_i_user_id']!=0) {
+                            $user = $mUser->findByPrimaryKey($alert['fk_i_user_id']);
+                        }
+                        if(!isset($user['s_name'])) {
+                            $user = array(
+                                's_name' => $alert['s_email'],
+                                's_email' => $alert['s_email']
+                            );
+                        }

All those "+" should not be in the file
94
3.7.x / Re: Info for _Conejo issue #2140 and #2131 user alerts
« Last post by marius-ciclistu on April 26, 2017, 10:55:52 am »
This is the initial code:

Code: [Select]
<?php
/*
 * Copyright 2014 Osclass
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

    
function osc_runAlert($type null$last_exec null) {
        if ( !
in_array($type, array('HOURLY''DAILY''WEEKLY''INSTANT')) ) {
            return;
        }

        if(
$last_exec==null) {
            
$cron Cron::newInstance()->getCronByType($type);
            if( 
is_array($cron) ) {
                
$last_exec $cron['d_last_exec'];
            } else {
                
$last_exec '0000-00-00 00:00:00';
            }
        }

        
$internal_name 'alert_email_hourly';
        switch (
$type) {
            case 
'HOURLY':
                
$internal_name 'alert_email_hourly';
            break;
            case 
'DAILY':
                
$internal_name 'alert_email_daily';
            break;
            case 
'WEEKLY':
                
$internal_name 'alert_email_weekly';
            break;
            case 
'INSTANT':
                
$internal_name 'alert_email_instant';
            break;
        }

        
$active   TRUE;
        
$searches Alerts::newInstance()->findByTypeGroup($type$active);


        foreach(
$searches as $s_search) {
            
// Get if there're new ads on this search
            
$json             $s_search['s_search'];
            
$array_conditions = (array)json_decode($json);

            
$new_search Search::newInstance();
            
$new_search->setJsonAlert($array_conditions);

            
$new_search->addConditions(sprintf(" %st_item.dt_pub_date > '%s' "DB_TABLE_PREFIX$last_exec));

            
$items      $new_search->doSearch();
            
$totalItems $new_search->count();

            if( 
count($items) > ) {
                
// If we have new items from last check
                // Catch the user subscribed to this search
                
$users Alerts::newInstance()->findUsersBySearchAndType($s_search['s_search'], $type$active);

                if( 
count($users) > ) {
                    
$ads '';
                    foreach(
$items as $item) {
                        
$ads .= '<a href="'osc_item_url_ns($item['pk_i_id']).'">' $item['s_title'] . '</a><br/>';
                    }

                    foreach(
$users as $user) {
                        
$alert Alerts::newInstance()->findBySearchAndUser($s_search['s_search'], $user['pk_i_id']);
                        if(
count($alert)>0) {
                            
osc_run_hook('hook_'.$internal_name$user$ads$alert[0], $items$totalItems);
                            
AlertsStats::newInstance()->increase(date('Y-m-d'));
                        }
                    }
                }
            }
        }
    }

And this is the code that is giving the error:

Code: [Select]
<?php
/*
 * Copyright 2014 Osclass
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

    
function osc_runAlert($type null$last_exec null) {
        
$mUser User::newInstance();
        if ( !
in_array($type, array('HOURLY''DAILY''WEEKLY''INSTANT')) ) {
            return;
        }

        if(
$last_exec==null) {
            
$cron Cron::newInstance()->getCronByType($type);
            if( 
is_array($cron) ) {
                
$last_exec $cron['d_last_exec'];
            } else {
                
$last_exec '0000-00-00 00:00:00';
            }
        }

        
$internal_name 'alert_email_hourly';
        switch (
$type) {
            case 
'HOURLY':
                
$internal_name 'alert_email_hourly';
            break;
            case 
'DAILY':
                
$internal_name 'alert_email_daily';
            break;
            case 
'WEEKLY':
                
$internal_name 'alert_email_weekly';
            break;
            case 
'INSTANT':
                
$internal_name 'alert_email_instant';
            break;
        }

        
$active   TRUE;
        
$searches Alerts::newInstance()->findByTypeGroup($type$active);


        foreach(
$searches as $s_search) {
            
// Get if there're new ads on this search
            
$json             $s_search['s_search'];
            
$array_conditions = (array)json_decode($json);

            
$new_search Search::newInstance();
            
$new_search->setJsonAlert($array_conditions);

            
$new_search->addConditions(sprintf(" %st_item.dt_pub_date > '%s' "DB_TABLE_PREFIX$last_exec));

            
$items      $new_search->doSearch();
            
$totalItems $new_search->count();

            if( 
count($items) > ) {
                
// If we have new items from last check
                // Catch the user subscribed to this search
                
$alerts Alerts::newInstance()->findUsersBySearchAndType($s_search['s_search'], $type$active);

                if( 
count($alerts) > ) {
                    
$ads '';
                    foreach(
$items as $item) {
                        
$ads .= '<a href="'osc_item_url_ns($item['pk_i_id']).'">' $item['s_title'] . '</a><br/>';
                    }

                                        foreach(
$alerts as $alert) {
+                        
$user = array();
+                        if(
$alert['fk_i_user_id']!=0) {
+                            
$user $mUser->findByPrimaryKey($alert['fk_i_user_id']);
+                        }
+                        if(!isset(
$user['s_name'])) {
+                            
$user = array(
+                                
's_name' => $alert['s_email'],
+                                
's_email' => $alert['s_email']
+                            );
+                        }
                        if(
count($alert)>0) {
                            
osc_run_hook('hook_'.$internal_name$user$ads$alert$items$totalItems);
                            
AlertsStats::newInstance()->increase(date('Y-m-d'));
                        }
                    }
                }
            }
        }
    }


I opened alerts, user items and email change. After file modifs, i hit refresh. it works.  BUT the error still remains and if I go to dashboard it is all white.
95
Tips, tricks, and tutorials / How remove or replace title site in pages?
« Last post by fmohsen on April 26, 2017, 10:39:08 am »
Hi all
Please Help me
How remove or replace title site in pages?
osclass add site title in title any pages how remove it or replace
96
3.7.x / Re: Info for _Conejo issue #2140 and #2131 user alerts
« Last post by _CONEJO on April 26, 2017, 10:35:05 am »
I remade 2 times the modifs from https://github.com/osclass/Osclass/commit/17ca0114d4905ebaae6ca12ea8915c6701521b78

Something is not ok. My dashboard is all white when I hit refreash page after making the modifs.....

error:
[26-Apr-2017 09:20:26 Europe/Bucharest] PHP Parse error:  syntax error, unexpected 'if' (T_IF) in /oc-includes/osclass/alerts.php on line 79
 if($alert['fk_i_user_id']!=0) { 


(i removed the modificaton from model/Alerts.php)

Please look in previous lines (78, 77, 76, ...) something is not right, probably a missing semicolon ";" on some line, or an opened parentesis that's not closed ...
97
3.7.x / Re: Info for _Conejo issue #2140 and #2131 user alerts
« Last post by marius-ciclistu on April 26, 2017, 10:26:20 am »
I remade 2 times the modifs from https://github.com/osclass/Osclass/commit/17ca0114d4905ebaae6ca12ea8915c6701521b78

Something is not ok. My dashboard is all white when I hit refreash page after making the modifs.....

error:
[26-Apr-2017 09:20:26 Europe/Bucharest] PHP Parse error:  syntax error, unexpected 'if' (T_IF) in /oc-includes/osclass/alerts.php on line 79
 if($alert['fk_i_user_id']!=0) { 

(i removed the modificaton from model/Alerts.php)
98
3.7.x / Re: Info for _Conejo issue #2140 and #2131 user alerts
« Last post by _CONEJO on April 26, 2017, 10:20:11 am »
If the discussion is already in github https://github.com/osclass/Osclass/issues/2131or https://github.com/osclass/Osclass/pull/2140, please continue it there. DO NOT open a new thread in an unrelated place (this) because the participants could not see it and miss it.

As explained https://github.com/osclass/Osclass/pull/2140 the fix you made broke more things than it fixes, so please do not use that fix.


If you have issues with the official / correct fix, then you could share them in those threads, or even here, but please, explain your issue. "dashboard broken" doesn't actually allow us to help you. Enable PHP debug https://doc.osclass.org/Debug_PHP_errors and share with us the underlying issue.

The "official" fix was tested and it's working fine, the fix you ended up doing, seems to fix it (it doesn't), but it break alerts for non registered users.

Also, we do not recommend cherry-picking some modifications and applying them to your website. If you want to have the latest development, please use the full hotfixes branch instead of selected modifications.
99
General help / Re: [solved] Shuffle Premium ads, or sort by Premium activation date
« Last post by kompua on April 26, 2017, 10:13:15 am »
THANK you
100
3.7.x / Re: Info for _Conejo issue #2140 and #2131 user alerts
« Last post by marius-ciclistu on April 26, 2017, 10:11:45 am »
The 2nd modification you suggest is not a proper fix, are you sure that you applied it properly? All the changes are tested multiple times (and new version is practically ready to be released). Re-download master branch and perform a fresh install, you will see that everything works fine.

About last question, there's a nice plugin @ market (not free, and yes, I'm the author), that can do that and then some.

Regards

Thank you.

Well I did not suggest it, I just found it online.  I'll retry making the modifs from first link and come back with an answear.
Pages: 1 ... 8 9 [10]