WordPress.org

Plugin Directory

Changeset 607105


Ignore:
Timestamp:
10/02/12 18:23:08 (19 months ago)
Author:
SteveAtty
Message:

Version 2.1.20 - The stupid database bug fix version

Location:
wordbooker
Files:
2 edited
17 copied

Legend:

Unmodified
Added
Removed
  • wordbooker/tags/2.1.20/readme.txt

    r605697 r607105  
    66Requires at least: 2.9 
    77Tested up to: 3.4.2 
    8 Stable tag: 2.1.19 
     8Stable tag: 2.1.20 
    99 
    1010This plugin allows you to cross-post your blog posts to your Facebook Wall and to any Facebook Fan Page / Group that you are an administrator for.  
     
    115115 
    116116== Changelog == 
     117 
     118= Version 2.1.20  02/10/2012 = 
     119- DB changes needed to support new feature not included in create script so new installs would mis-behave 
     120- Remove a totally obsolete function. 
    117121 
    118122= Version 2.1.19  29/09/2012 = 
     
    392396== Upgrade Notice == 
    393397 
     398= 2.1.20 = 
     399Database problem with new installs fixed. 
     400 
    394401= 2.1.19 = 
    395402Improved comment handling plus other various performance tweaks. 
  • wordbooker/tags/2.1.20/wordbooker.php

    r605697 r607105  
    66Author: Steve Atty  
    77Author URI: http://wordbooker.tty.org.uk 
    8 Version: 2.1.19 
     8Version: 2.1.20 
    99*/ 
    1010 
     
    3939    define('WORDBOOKER_DEBUG', false); 
    4040    define('WORDBOOKER_TESTING', false); 
    41     define('WORDBOOKER_CODE_RELEASE',"2.1.19 R00 - Better Weather"); 
     41    define('WORDBOOKER_CODE_RELEASE',"2.1.20 R00 - Embroidery in childhood"); 
    4242 
    4343    # For Troubleshooting  
     
    7474    define('WORDBOOKER_OPTION_SCHEMAVERS', 'schema_vers'); 
    7575    define('WORDBOOKER_USER_AGENT','WordPress/' . $wp_version . '; Wordbooker-' .WORDBOOKER_CODE_RELEASE ); 
    76     define('WORDBOOKER_SCHEMA_VERSION', '5.3'); 
     76    define('WORDBOOKER_SCHEMA_VERSION', '5.4'); 
    7777 
    7878    $new_wb_table_prefix=$wpdb->base_prefix; 
     
    263263              `auths_needed` int(1) default NULL, 
    264264              `blog_id` bigint(20) default NULL, 
    265               PRIMARY KEY  (`user_ID`), 
     265              PRIMARY KEY  (`user_ID` , `blog_id` ) , 
    266266              KEY `facebook_idx` (`facebook_id`) 
    267267            ) DEFAULT CHARSET=utf8; 
     
    280280          `fb_comment_id` varchar(240) default NULL, 
    281281          `in_out` varchar(20) default NULL, 
     282            `FB_USER_ID` varchar(120) NOT NULL, 
     283           `FB_TARGET_ID` varchar(120) NOT NULL, 
    282284          UNIQUE KEY `fb_comment_id_idx` (`fb_comment_id`), 
    283285          KEY `in_out_idx` (`in_out`), 
     
    516518    } 
    517519     
     520    if ($wordbooker_settings['schema_vers']=='5.3') { 
     521 
     522        $result = $wpdb->query('ALTER TABLE '. WORDBOOKER_USERDATA. '  DROP PRIMARY KEY , ADD PRIMARY KEY ( `user_ID` , `blog_id` ) ');  
     523        $result = $wpdb->query('ALTER TABLE '. WORDBOOKER_POSTCOMMENTS. '  ADD `FB_USER_ID` VARCHAR( 120 ) NOT NULL '); 
     524        $result = $wpdb->query('ALTER TABLE '. WORDBOOKER_POSTCOMMENTS. ' ADD `FB_TARGET_ID` VARCHAR( 120 ) NOT NULL '); 
     525        wordbooker_set_option('schema_vers', "5.4"); 
     526    } 
     527     
    518528    $dummy=wp_clear_scheduled_hook('wb_cron_job'); 
    519529    $dummy=wp_schedule_event(current_time( 'timestamp' ), 'hourly', 'wb_cron_job'); 
    520530    #wordbooker_set_option('schema_vers', WORDBOOKER_SCHEMA_VERSION ); 
    521531    wp_cache_flush(); 
    522 } 
    523  
    524 function wordbooker_db_crosscheck() { 
    525     global $wpdb;  
    526     $table_array= array (WORDBOOKER_ERRORLOGS,WORDBOOKER_POSTLOGS,WORDBOOKER_USERDATA,WORDBOOKER_USERSTATUS,WORDBOOKER_POSTCOMMENTS,WORDBOOKER_PROCESS_QUEUE,WORDBOOKER_FB_FRIENDS,WORDBOOKER_FB_FRIEND_LISTS); 
    527  
    528     $wordbooker_columns[WORDBOOKER_ERRORLOGS]=array('timestamp','user_ID','method','error_code','error_msg','post_id','blog_id','sequence_id','diag_level'); 
    529     $wordbooker_columns[WORDBOOKER_POSTLOGS]=array('post_id','blog_id','timestamp'); 
    530     $wordbooker_columns[WORDBOOKER_USERDATA]=array('user_ID','uid','expires','access_token','sig','use_facebook','onetime_data','facebook_error','secret','session_key','facebook_id','name','status','updated','url','pic','pages','auths_needed','blog_id'); 
    531     $wordbooker_columns[WORDBOOKER_USERSTATUS]=array('user_ID','name','status','updated','url','pic','blog_id','facebook_id'); 
    532     $wordbooker_columns[WORDBOOKER_POSTCOMMENTS]=array('fb_post_id','user_id','comment_timestamp','wp_post_id','blog_id','wp_comment_id','fb_comment_id','in_out'); 
    533     $wordbooker_columns[WORDBOOKER_PROCESS_QUEUE]=array('entry_type','blog_id','post_id','priority','status'); 
    534     $wordbooker_columns[WORDBOOKER_FB_FRIENDS]=array('user_id','blog_id','facebook_id','name'); 
    535     $wordbooker_columns[WORDBOOKER_FB_FRIEND_LISTS]=array('user_id','flid','owner','name'); 
    536  
    537     $wordbooker_column_def[WORDBOOKER_ERRORLOGS]=array ('timestamp'=>'timestamp','user_ID'=>'bigint(20) unsigned','method'=>'longtext','error_code'=>'int(11)','error_msg'=>'longtext','post_id'=>'bigint(20)','blog_id'=>'bigint(20)','sequence_id'=>'bigint(20)','diag_level'=>'int(4)'); 
    538     $wordbooker_column_def[WORDBOOKER_POSTLOGS]=array ('post_id'=>'bigint(20)','blog_id'=>'bigint(20)','timestamp'=>'timestamp'); 
    539     $wordbooker_column_def[WORDBOOKER_USERDATA]=array ('user_ID'=>'bigint(20) unsigned','uid'=>'varchar(80)','expires'=>'varchar(80)','access_token'=>'varchar(255)','sig'=>'varchar(80)','use_facebook'=>'tinyint(1)','onetime_data'=>'longtext','facebook_error'=>'longtext','secret'=>'varchar(80)','session_key'=>'varchar(80)','facebook_id'=>'varchar(80)','name'=>'varchar(250)','status'=>'varchar(2048)','updated'=>'int(20)','url'=>'varchar(250)','pic'=>'varchar(250)','pages'=>'longtext','auths_needed'=>'int(1)','blog_id'=>'bigint(20)'); 
    540     $wordbooker_column_def[WORDBOOKER_USERSTATUS]=array ('user_ID'=>'bigint(20) unsigned','name'=>'varchar(250)','status'=>'varchar(2048)','updated'=>'int(20)','url'=>'varchar(250)','pic'=>'varchar(250)','blog_id'=>'bigint(20)','facebook_id'=>'varchar(80)'); 
    541     $wordbooker_column_def[WORDBOOKER_POSTCOMMENTS]=array ('fb_post_id'=>'varchar(240)','user_id'=>'bigint(20)','comment_timestamp'=>'int(20)','wp_post_id'=>'int(11)','blog_id'=>'bigint(20)','wp_comment_id'=>'int(20)','fb_comment_id'=>'varchar(240)','in_out'=>'varchar(20)'); 
    542     $wordbooker_column_def[WORDBOOKER_PROCESS_QUEUE]=array ('entry_type'=>'varchar(20)','blog_id'=>'int(11)','post_id'=>'int(11)','priority'=>'int(11)','status'=>'varchar(20)'); 
    543     $wordbooker_column_def[WORDBOOKER_FB_FRIENDS]=array ('user_id'=>'int(11)','blog_id'=>'bigint(20)','facebook_id'=>'varchar(80)','name'=>'varchar(200)'); 
    544     $wordbooker_column_def[WORDBOOKER_FB_FRIEND_LISTS]=array ('user_id'=>'int(11)','flid'=>'varchar(240)','owner'=>'varchar(80)','name'=>'varchar(240)'); 
    545      
    546     foreach ($table_array as $table) { 
    547         $working_table=$wordbooker_columns[$table]; 
    548         $working_table_def=$wordbooker_column_def[$table]; 
    549         foreach ($working_table as $chardata){ 
    550             $sql="SELECT column_name,column_type,extra FROM information_schema.COLUMNS WHERE table_name='".$table."' and table_schema='".DB_NAME."' and column_name='".$chardata."'"; 
    551             $rows =  $wpdb->get_row($sql,ARRAY_N); 
    552             if ($chardata==$rows[0]) { 
    553                 $col_status=" present";$correct_sql='zed';       
    554                 if ($working_table_def[$chardata]==$rows[1]) {$col_def_status=" matches";$correct_def_sql='zed';}  
    555                 else {$col_def_status=" mismatches"; $correct_def_sql="alter table ".$table." change ".$chardata." ".$chardata." ".$working_table_def[$chardata];} 
    556             } else { 
    557                 $col_status=" missing"; $correct_sql="alter table ".$table." add ".$chardata." ".$working_table_def[$chardata]; 
    558             } 
    559             if ($correct_sql!='zed') {$sql_run[]=$correct_sql;} 
    560             if ($correct_def_sql!='zed') {$sql_run[]=$correct_def_sql;} 
    561         } 
    562     } 
    563  
    564  
    565     $wordbooker_sequence[WORDBOOKER_ERRORLOGS]=array ('sequence_id'); 
    566     foreach ($table_array as $table) { 
    567         $working_table_seq=$wordbooker_sequence[$table]; 
    568         if(count($working_table_seq)>0){ 
    569         foreach ($working_table_seq as $chardata){ 
    570             $sql="SELECT column_name,extra FROM information_schema.COLUMNS WHERE table_name='".$table."' and table_schema='".DB_NAME."' and column_name='".$chardata."'"; 
    571             $rows =  $wpdb->get_row($sql,ARRAY_N); 
    572             if ($chardata==$rows[0]) { 
    573                 $col_status=" present";$correct_sql='zed';       
    574                 if ('auto_increment'==$rows[1]) {$col_seq_status=" matches";$correct_seq_sql='zed';}  
    575                 else {$col_seq_status=" mismatches"; $correct_seq_sql="alter table ".$table." change ".$chardata." ".$chardata." BIGINT(20) NOT NULL AUTO_INCREMENT"; } 
    576             } else { 
    577                 $col_status=" missing"; $correct_sql="alter table ".$table." add ".$chardata." ".$chardata." BIGINT(20) NOT NULL AUTO_INCREMENT"; 
    578             } 
    579             if ($correct_sql!='zed') {$sql_run[]=$correct_sql;} 
    580             if ($correct_seq_sql!='zed') { 
    581                 $sql_run[]='truncate table '.$table; 
    582                 $sql_run[]=$correct_seq_sql; 
    583             } 
    584         } 
    585     } 
    586     } 
    587  
    588     if (is_array($sql_run)) { 
    589         echo '<div id="message" class="updated fade"><p>Schema differences found - fixing up <br /></p></div>'; 
    590         foreach($sql_run as $sql_fix) { 
    591         #   echo "Executing : ".$sql_fix."<br />"; 
    592             $result=@mysql_query($sql_fix); 
    593         } 
    594         echo "<br />"; 
    595     } 
    596532} 
    597533 
     
    1004940    global $user_ID, $wp_version,$blog_id; 
    1005941    wordbooker_upgrade(); 
    1006     #wordbooker_db_crosscheck(); 
    1007942    wordbooker_trim_postlogs(); 
    1008943    wordbooker_trim_errorlogs(); 
     
    1055990    $result = $wpdb->get_results($sql); 
    1056991    $today=date('z'); 
    1057     foreach($result as $user_row){ 
     992        foreach($result as $user_row){ 
     993        if (strlen($user_row->access_token)>15) { 
    1058994            wordbooker_debugger("Access token was ",unserialize($user_row->access_token),-5,88) ; 
    1059995            try { 
     
    10681004            wordbooker_debugger("Return code is ",$ret_code,-5,88) ; 
    10691005            $x=split('&',$ret_code); 
     1006            $ex=$x[1]; 
     1007            $ex2=split('=',$ex); 
    10701008            $x=split('=',$x[0]); 
    10711009            $access_token=$x[1]; 
     1010            $time=time()+$ex2[1]; 
    10721011            if (strlen($access_token) < 15) {$access_token=unserialize($user_row->access_token);} 
    10731012            if (strlen($access_token) > 15) { 
    1074                 $sql= "Update " . WORDBOOKER_USERDATA . " set access_token = '" . serialize($access_token) . "', updated=".$today." where user_id=".$userid; 
     1013            $sql= "Update " . WORDBOOKER_USERDATA . " set access_token = '" . serialize($access_token) . "', updated=".$today." where user_id=".$userid; 
     1014                if (strlen($ex2[1])> 3) {$sql= "Update " . WORDBOOKER_USERDATA . " set access_token = '" . serialize($access_token) . "',  expires='".$time."', updated=".$today." where user_id=".$userid;} 
    10751015                $result = $wpdb->query($sql); 
    10761016                wordbooker_debugger("Access token was ",unserialize($user_row->access_token),-5,88) ; 
     
    10781018                wordbooker_debugger("Access token updated"," ",-5,88) ; 
    10791019            } 
    1080             else {wordbooker_debugger("Access token wasn't updated as it was too short",print_r($ret_code,true),-5,88) ; } 
     1020            else {wordbooker_debugger("Access token wasn't updated as new one was too short",print_r($ret_code,true),-5,88) ; } 
     1021        }  else {wordbooker_debugger("Access token wasn't updated as original was too short",print_r($ret_code,true),-5,88) ; } 
    10811022    } 
    10821023} 
     
    17521693    global $post; 
    17531694    $newimages = array(); 
    1754     $image_types= array ('jpg','jpeg','gif','png','tif','bmp','jpe'); 
     1695    $image_types= array ('jpg','jpeg','gif','png','tif','bmp','jpe','php','svg'); 
    17551696    $strip_array= array ('addthis.com','gravatar.com','zemanta.com','wp-includes','plugins','favicon.ico','facebook.com','themes','mu-plugins','fbcdn.net'); 
    17561697    foreach($images as $single){ 
    1757         $file_extension = trim(strtolower(substr($single , strrpos($single , '.') +1)));  
    1758         if (in_array($file_extension,$image_types)){ 
    1759         foreach ($strip_array as $strip_domain) { 
    1760             if ($flag==1) {wordbooker_debugger("Looking for ".$strip_domain." in ".$single," ",$post->ID,80) ;} 
    1761             if (stripos($single,$strip_domain)) {wordbooker_debugger("Found a match so dump the image",$single,$post->ID,80) ;} else { if (!in_array($single,$newimages)){$newimages[]=$single;}} 
    1762         }} else {wordbooker_debugger("Image URL ".$single." ( ".$file_extension." ) not valid "," ",$post->ID,90) ;} 
     1698        $ok=true; 
     1699        $file_extension = trim(strtolower(substr($single , strrpos($single , '.') +1,strlen($single))));  
     1700        if (in_array($file_extension,$image_types)) { 
     1701            foreach ($strip_array as $strip_domain) { 
     1702                if ($flag==1) {wordbooker_debugger("Looking for ".$strip_domain." in ".$single," ",$post->ID,80) ;} 
     1703                if (stripos($single,$strip_domain)){$ok=false;break;} 
     1704            }  
     1705            if ($ok) { if (!in_array($single,$newimages)){$newimages[]=$single;}} 
     1706            else { wordbooker_debugger("Found a match so dump the image",$single,$post->ID,80); } 
     1707        }  
     1708        else { 
     1709        wordbooker_debugger("Image URL ".$single." ( ".$file_extension." ) not valid "," ",$post->ID,90) ;} 
     1710    } 
     1711    $images=$newimages; 
     1712    $newimages = array();    
     1713    foreach($images as $single){ 
     1714      if (preg_match('/.*googleusercontent.*proxy.*url=(.+)/ix', $single, $matches_google_proxy) === 1) { 
     1715        $newimages[] = urldecode($matches_google_proxy[1]); 
     1716      } else { 
     1717        $newimages[] = $single; 
     1718      } 
    17631719    } 
    17641720    return $newimages; 
  • wordbooker/trunk/readme.txt

    r605697 r607105  
    66Requires at least: 2.9 
    77Tested up to: 3.4.2 
    8 Stable tag: 2.1.19 
     8Stable tag: 2.1.20 
    99 
    1010This plugin allows you to cross-post your blog posts to your Facebook Wall and to any Facebook Fan Page / Group that you are an administrator for.  
     
    115115 
    116116== Changelog == 
     117 
     118= Version 2.1.20  02/10/2012 = 
     119- DB changes needed to support new feature not included in create script so new installs would mis-behave 
     120- Remove a totally obsolete function. 
    117121 
    118122= Version 2.1.19  29/09/2012 = 
     
    392396== Upgrade Notice == 
    393397 
     398= 2.1.20 = 
     399Database problem with new installs fixed. 
     400 
    394401= 2.1.19 = 
    395402Improved comment handling plus other various performance tweaks. 
  • wordbooker/trunk/wordbooker.php

    r605697 r607105  
    66Author: Steve Atty  
    77Author URI: http://wordbooker.tty.org.uk 
    8 Version: 2.1.19 
     8Version: 2.1.20 
    99*/ 
    1010 
     
    3939    define('WORDBOOKER_DEBUG', false); 
    4040    define('WORDBOOKER_TESTING', false); 
    41     define('WORDBOOKER_CODE_RELEASE',"2.1.19 R00 - Better Weather"); 
     41    define('WORDBOOKER_CODE_RELEASE',"2.1.20 R00 - Embroidery in childhood"); 
    4242 
    4343    # For Troubleshooting  
     
    7474    define('WORDBOOKER_OPTION_SCHEMAVERS', 'schema_vers'); 
    7575    define('WORDBOOKER_USER_AGENT','WordPress/' . $wp_version . '; Wordbooker-' .WORDBOOKER_CODE_RELEASE ); 
    76     define('WORDBOOKER_SCHEMA_VERSION', '5.3'); 
     76    define('WORDBOOKER_SCHEMA_VERSION', '5.4'); 
    7777 
    7878    $new_wb_table_prefix=$wpdb->base_prefix; 
     
    263263              `auths_needed` int(1) default NULL, 
    264264              `blog_id` bigint(20) default NULL, 
    265               PRIMARY KEY  (`user_ID`), 
     265              PRIMARY KEY  (`user_ID` , `blog_id` ) , 
    266266              KEY `facebook_idx` (`facebook_id`) 
    267267            ) DEFAULT CHARSET=utf8; 
     
    280280          `fb_comment_id` varchar(240) default NULL, 
    281281          `in_out` varchar(20) default NULL, 
     282            `FB_USER_ID` varchar(120) NOT NULL, 
     283           `FB_TARGET_ID` varchar(120) NOT NULL, 
    282284          UNIQUE KEY `fb_comment_id_idx` (`fb_comment_id`), 
    283285          KEY `in_out_idx` (`in_out`), 
     
    516518    } 
    517519     
     520    if ($wordbooker_settings['schema_vers']=='5.3') { 
     521 
     522        $result = $wpdb->query('ALTER TABLE '. WORDBOOKER_USERDATA. '  DROP PRIMARY KEY , ADD PRIMARY KEY ( `user_ID` , `blog_id` ) ');  
     523        $result = $wpdb->query('ALTER TABLE '. WORDBOOKER_POSTCOMMENTS. '  ADD `FB_USER_ID` VARCHAR( 120 ) NOT NULL '); 
     524        $result = $wpdb->query('ALTER TABLE '. WORDBOOKER_POSTCOMMENTS. ' ADD `FB_TARGET_ID` VARCHAR( 120 ) NOT NULL '); 
     525        wordbooker_set_option('schema_vers', "5.4"); 
     526    } 
     527     
    518528    $dummy=wp_clear_scheduled_hook('wb_cron_job'); 
    519529    $dummy=wp_schedule_event(current_time( 'timestamp' ), 'hourly', 'wb_cron_job'); 
    520530    #wordbooker_set_option('schema_vers', WORDBOOKER_SCHEMA_VERSION ); 
    521531    wp_cache_flush(); 
    522 } 
    523  
    524 function wordbooker_db_crosscheck() { 
    525     global $wpdb;  
    526     $table_array= array (WORDBOOKER_ERRORLOGS,WORDBOOKER_POSTLOGS,WORDBOOKER_USERDATA,WORDBOOKER_USERSTATUS,WORDBOOKER_POSTCOMMENTS,WORDBOOKER_PROCESS_QUEUE,WORDBOOKER_FB_FRIENDS,WORDBOOKER_FB_FRIEND_LISTS); 
    527  
    528     $wordbooker_columns[WORDBOOKER_ERRORLOGS]=array('timestamp','user_ID','method','error_code','error_msg','post_id','blog_id','sequence_id','diag_level'); 
    529     $wordbooker_columns[WORDBOOKER_POSTLOGS]=array('post_id','blog_id','timestamp'); 
    530     $wordbooker_columns[WORDBOOKER_USERDATA]=array('user_ID','uid','expires','access_token','sig','use_facebook','onetime_data','facebook_error','secret','session_key','facebook_id','name','status','updated','url','pic','pages','auths_needed','blog_id'); 
    531     $wordbooker_columns[WORDBOOKER_USERSTATUS]=array('user_ID','name','status','updated','url','pic','blog_id','facebook_id'); 
    532     $wordbooker_columns[WORDBOOKER_POSTCOMMENTS]=array('fb_post_id','user_id','comment_timestamp','wp_post_id','blog_id','wp_comment_id','fb_comment_id','in_out'); 
    533     $wordbooker_columns[WORDBOOKER_PROCESS_QUEUE]=array('entry_type','blog_id','post_id','priority','status'); 
    534     $wordbooker_columns[WORDBOOKER_FB_FRIENDS]=array('user_id','blog_id','facebook_id','name'); 
    535     $wordbooker_columns[WORDBOOKER_FB_FRIEND_LISTS]=array('user_id','flid','owner','name'); 
    536  
    537     $wordbooker_column_def[WORDBOOKER_ERRORLOGS]=array ('timestamp'=>'timestamp','user_ID'=>'bigint(20) unsigned','method'=>'longtext','error_code'=>'int(11)','error_msg'=>'longtext','post_id'=>'bigint(20)','blog_id'=>'bigint(20)','sequence_id'=>'bigint(20)','diag_level'=>'int(4)'); 
    538     $wordbooker_column_def[WORDBOOKER_POSTLOGS]=array ('post_id'=>'bigint(20)','blog_id'=>'bigint(20)','timestamp'=>'timestamp'); 
    539     $wordbooker_column_def[WORDBOOKER_USERDATA]=array ('user_ID'=>'bigint(20) unsigned','uid'=>'varchar(80)','expires'=>'varchar(80)','access_token'=>'varchar(255)','sig'=>'varchar(80)','use_facebook'=>'tinyint(1)','onetime_data'=>'longtext','facebook_error'=>'longtext','secret'=>'varchar(80)','session_key'=>'varchar(80)','facebook_id'=>'varchar(80)','name'=>'varchar(250)','status'=>'varchar(2048)','updated'=>'int(20)','url'=>'varchar(250)','pic'=>'varchar(250)','pages'=>'longtext','auths_needed'=>'int(1)','blog_id'=>'bigint(20)'); 
    540     $wordbooker_column_def[WORDBOOKER_USERSTATUS]=array ('user_ID'=>'bigint(20) unsigned','name'=>'varchar(250)','status'=>'varchar(2048)','updated'=>'int(20)','url'=>'varchar(250)','pic'=>'varchar(250)','blog_id'=>'bigint(20)','facebook_id'=>'varchar(80)'); 
    541     $wordbooker_column_def[WORDBOOKER_POSTCOMMENTS]=array ('fb_post_id'=>'varchar(240)','user_id'=>'bigint(20)','comment_timestamp'=>'int(20)','wp_post_id'=>'int(11)','blog_id'=>'bigint(20)','wp_comment_id'=>'int(20)','fb_comment_id'=>'varchar(240)','in_out'=>'varchar(20)'); 
    542     $wordbooker_column_def[WORDBOOKER_PROCESS_QUEUE]=array ('entry_type'=>'varchar(20)','blog_id'=>'int(11)','post_id'=>'int(11)','priority'=>'int(11)','status'=>'varchar(20)'); 
    543     $wordbooker_column_def[WORDBOOKER_FB_FRIENDS]=array ('user_id'=>'int(11)','blog_id'=>'bigint(20)','facebook_id'=>'varchar(80)','name'=>'varchar(200)'); 
    544     $wordbooker_column_def[WORDBOOKER_FB_FRIEND_LISTS]=array ('user_id'=>'int(11)','flid'=>'varchar(240)','owner'=>'varchar(80)','name'=>'varchar(240)'); 
    545      
    546     foreach ($table_array as $table) { 
    547         $working_table=$wordbooker_columns[$table]; 
    548         $working_table_def=$wordbooker_column_def[$table]; 
    549         foreach ($working_table as $chardata){ 
    550             $sql="SELECT column_name,column_type,extra FROM information_schema.COLUMNS WHERE table_name='".$table."' and table_schema='".DB_NAME."' and column_name='".$chardata."'"; 
    551             $rows =  $wpdb->get_row($sql,ARRAY_N); 
    552             if ($chardata==$rows[0]) { 
    553                 $col_status=" present";$correct_sql='zed';       
    554                 if ($working_table_def[$chardata]==$rows[1]) {$col_def_status=" matches";$correct_def_sql='zed';}  
    555                 else {$col_def_status=" mismatches"; $correct_def_sql="alter table ".$table." change ".$chardata." ".$chardata." ".$working_table_def[$chardata];} 
    556             } else { 
    557                 $col_status=" missing"; $correct_sql="alter table ".$table." add ".$chardata." ".$working_table_def[$chardata]; 
    558             } 
    559             if ($correct_sql!='zed') {$sql_run[]=$correct_sql;} 
    560             if ($correct_def_sql!='zed') {$sql_run[]=$correct_def_sql;} 
    561         } 
    562     } 
    563  
    564  
    565     $wordbooker_sequence[WORDBOOKER_ERRORLOGS]=array ('sequence_id'); 
    566     foreach ($table_array as $table) { 
    567         $working_table_seq=$wordbooker_sequence[$table]; 
    568         if(count($working_table_seq)>0){ 
    569         foreach ($working_table_seq as $chardata){ 
    570             $sql="SELECT column_name,extra FROM information_schema.COLUMNS WHERE table_name='".$table."' and table_schema='".DB_NAME."' and column_name='".$chardata."'"; 
    571             $rows =  $wpdb->get_row($sql,ARRAY_N); 
    572             if ($chardata==$rows[0]) { 
    573                 $col_status=" present";$correct_sql='zed';       
    574                 if ('auto_increment'==$rows[1]) {$col_seq_status=" matches";$correct_seq_sql='zed';}  
    575                 else {$col_seq_status=" mismatches"; $correct_seq_sql="alter table ".$table." change ".$chardata." ".$chardata." BIGINT(20) NOT NULL AUTO_INCREMENT"; } 
    576             } else { 
    577                 $col_status=" missing"; $correct_sql="alter table ".$table." add ".$chardata." ".$chardata." BIGINT(20) NOT NULL AUTO_INCREMENT"; 
    578             } 
    579             if ($correct_sql!='zed') {$sql_run[]=$correct_sql;} 
    580             if ($correct_seq_sql!='zed') { 
    581                 $sql_run[]='truncate table '.$table; 
    582                 $sql_run[]=$correct_seq_sql; 
    583             } 
    584         } 
    585     } 
    586     } 
    587  
    588     if (is_array($sql_run)) { 
    589         echo '<div id="message" class="updated fade"><p>Schema differences found - fixing up <br /></p></div>'; 
    590         foreach($sql_run as $sql_fix) { 
    591         #   echo "Executing : ".$sql_fix."<br />"; 
    592             $result=@mysql_query($sql_fix); 
    593         } 
    594         echo "<br />"; 
    595     } 
    596532} 
    597533 
     
    1004940    global $user_ID, $wp_version,$blog_id; 
    1005941    wordbooker_upgrade(); 
    1006     #wordbooker_db_crosscheck(); 
    1007942    wordbooker_trim_postlogs(); 
    1008943    wordbooker_trim_errorlogs(); 
     
    1055990    $result = $wpdb->get_results($sql); 
    1056991    $today=date('z'); 
    1057     foreach($result as $user_row){ 
     992        foreach($result as $user_row){ 
     993        if (strlen($user_row->access_token)>15) { 
    1058994            wordbooker_debugger("Access token was ",unserialize($user_row->access_token),-5,88) ; 
    1059995            try { 
     
    10681004            wordbooker_debugger("Return code is ",$ret_code,-5,88) ; 
    10691005            $x=split('&',$ret_code); 
     1006            $ex=$x[1]; 
     1007            $ex2=split('=',$ex); 
    10701008            $x=split('=',$x[0]); 
    10711009            $access_token=$x[1]; 
     1010            $time=time()+$ex2[1]; 
    10721011            if (strlen($access_token) < 15) {$access_token=unserialize($user_row->access_token);} 
    10731012            if (strlen($access_token) > 15) { 
    1074                 $sql= "Update " . WORDBOOKER_USERDATA . " set access_token = '" . serialize($access_token) . "', updated=".$today." where user_id=".$userid; 
     1013            $sql= "Update " . WORDBOOKER_USERDATA . " set access_token = '" . serialize($access_token) . "', updated=".$today." where user_id=".$userid; 
     1014                if (strlen($ex2[1])> 3) {$sql= "Update " . WORDBOOKER_USERDATA . " set access_token = '" . serialize($access_token) . "',  expires='".$time."', updated=".$today." where user_id=".$userid;} 
    10751015                $result = $wpdb->query($sql); 
    10761016                wordbooker_debugger("Access token was ",unserialize($user_row->access_token),-5,88) ; 
     
    10781018                wordbooker_debugger("Access token updated"," ",-5,88) ; 
    10791019            } 
    1080             else {wordbooker_debugger("Access token wasn't updated as it was too short",print_r($ret_code,true),-5,88) ; } 
     1020            else {wordbooker_debugger("Access token wasn't updated as new one was too short",print_r($ret_code,true),-5,88) ; } 
     1021        }  else {wordbooker_debugger("Access token wasn't updated as original was too short",print_r($ret_code,true),-5,88) ; } 
    10811022    } 
    10821023} 
     
    17521693    global $post; 
    17531694    $newimages = array(); 
    1754     $image_types= array ('jpg','jpeg','gif','png','tif','bmp','jpe'); 
     1695    $image_types= array ('jpg','jpeg','gif','png','tif','bmp','jpe','php','svg'); 
    17551696    $strip_array= array ('addthis.com','gravatar.com','zemanta.com','wp-includes','plugins','favicon.ico','facebook.com','themes','mu-plugins','fbcdn.net'); 
    17561697    foreach($images as $single){ 
    1757         $file_extension = trim(strtolower(substr($single , strrpos($single , '.') +1)));  
    1758         if (in_array($file_extension,$image_types)){ 
    1759         foreach ($strip_array as $strip_domain) { 
    1760             if ($flag==1) {wordbooker_debugger("Looking for ".$strip_domain." in ".$single," ",$post->ID,80) ;} 
    1761             if (stripos($single,$strip_domain)) {wordbooker_debugger("Found a match so dump the image",$single,$post->ID,80) ;} else { if (!in_array($single,$newimages)){$newimages[]=$single;}} 
    1762         }} else {wordbooker_debugger("Image URL ".$single." ( ".$file_extension." ) not valid "," ",$post->ID,90) ;} 
     1698        $ok=true; 
     1699        $file_extension = trim(strtolower(substr($single , strrpos($single , '.') +1,strlen($single))));  
     1700        if (in_array($file_extension,$image_types)) { 
     1701            foreach ($strip_array as $strip_domain) { 
     1702                if ($flag==1) {wordbooker_debugger("Looking for ".$strip_domain." in ".$single," ",$post->ID,80) ;} 
     1703                if (stripos($single,$strip_domain)){$ok=false;break;} 
     1704            }  
     1705            if ($ok) { if (!in_array($single,$newimages)){$newimages[]=$single;}} 
     1706            else { wordbooker_debugger("Found a match so dump the image",$single,$post->ID,80); } 
     1707        }  
     1708        else { 
     1709        wordbooker_debugger("Image URL ".$single." ( ".$file_extension." ) not valid "," ",$post->ID,90) ;} 
     1710    } 
     1711    $images=$newimages; 
     1712    $newimages = array();    
     1713    foreach($images as $single){ 
     1714      if (preg_match('/.*googleusercontent.*proxy.*url=(.+)/ix', $single, $matches_google_proxy) === 1) { 
     1715        $newimages[] = urldecode($matches_google_proxy[1]); 
     1716      } else { 
     1717        $newimages[] = $single; 
     1718      } 
    17631719    } 
    17641720    return $newimages; 
Note: See TracChangeset for help on using the changeset viewer.