Changeset 4957 for branches/2.2/expressoMail1_2/inc/class.rss.inc.php
- Timestamp:
- 08/19/11 10:46:17 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2/expressoMail1_2/inc/class.rss.inc.php
r4688 r4957 1 1 <?php 2 3 include('../header.inc.php'); 2 4 3 5 class rss 4 6 { 5 6 function rss (){7 }8 7 // BEGIN of functions. 9 function getContent($param){ 8 function getContent($param) 9 { 10 10 $daurl=$param['url']; 11 11 12 if (preg_match('/http(s)?:\/\//i',$daurl,$matches) == 0) 12 13 $daurl = 'http://'.$daurl; … … 34 35 } 35 36 36 private function createTableRSS()37 {38 $query = 'CREATE TABLE phpgw_userrss( uid INT NOT NULL,rss_url VARCHAR(1000),name varchar(50), PRIMARY KEY (uid,rss_url) );';39 40 $GLOBALS['phpgw']->db->query($query);41 42 if ( $GLOBALS['phpgw']->db->Error )43 return false;44 else45 return true;46 }47 48 37 function getChannels() 49 38 { 50 include('../header.inc.php');39 $query = "SELECT config_value FROM phpgw_config WHERE config_name = 'expressoMail_enabled_read_rss';"; 51 40 52 $flag = false; 53 $tableQuery = "select relname from pg_stat_user_tables order by relname;"; 54 55 if( $GLOBALS['phpgw']->db->query( $tableQuery ) ) 41 if( $GLOBALS['phpgw']->db->query( $query ) ) 56 42 { 57 43 while( $GLOBALS['phpgw']->db->next_record() ) 58 44 { 59 $tables[] = $GLOBALS['phpgw']->db->row(); 60 } 61 62 foreach( $tables as $tableName ) 63 { 64 if( strtolower( $tableName['relname'] ) === 'phpgw_userrss' ) 65 { 66 $flag = true; 67 } 45 $result = $GLOBALS['phpgw']->db->row(); 68 46 } 69 47 } 70 48 71 if( !$flag)49 if( $result['config_value'] === 'true' ) 72 50 { 73 $flag = $this->createTableRSS(); 51 $query = "SELECT * FROM phpgw_config WHERE config_name = 'expressoMail_list_rss';"; 52 53 if( $GLOBALS['phpgw']->db->query($query) ) 54 { 55 while( $GLOBALS['phpgw']->db->next_record() ) 56 { 57 $result = $GLOBALS['phpgw']->db->row(); 58 } 59 } 60 61 if( $result['config_value'] ) 62 { 63 $i = 0; 64 $rss = unserialize($result['config_value']); 65 66 foreach( $rss as $item ) 67 { 68 $tmp = explode( "|", $item ); 69 $return[$i]['rss_url'] = $tmp[0]; 70 $return[$i++]['name'] = $tmp[1]; 71 } 72 73 return $return; 74 } 75 else 76 return ""; 74 77 } 75 76 $query = 'SELECT rss_url,name FROM phpgw_userrss WHERE uid = '.$_SESSION['phpgw_session']['account_id'];77 78 if( $GLOBALS['phpgw']->db->query($query) )79 {80 while( $GLOBALS['phpgw']->db->next_record() )81 {82 $return[] = $GLOBALS['phpgw']->db->row();83 }84 }85 86 if( count($return) > 0 )87 return $return;88 else89 return "";90 78 } 91 79 92 function addChannel($param)80 /*function addChannel($param) 93 81 { 94 include('../header.inc.php'); 95 $name = $GLOBALS['phpgw']->db->db_addslashes(htmlentities($param['name'])); 96 $url = $GLOBALS['phpgw']->db->db_addslashes($param['url']); 97 $GLOBALS['phpgw']->db->query('INSERT INTO phpgw_userrss values('.$_SESSION['phpgw_session']['account_id'].',\''.$url.'\',\''.$name.'\');',__LINE__,__FILE__); 82 83 $name = $GLOBALS['phpgw']->db->db_addslashes(htmlentities($param['name'])); 84 $url = $GLOBALS['phpgw']->db->db_addslashes($param['url']); 85 $query = 'INSERT INTO phpgw_userrss values('.$_SESSION['phpgw_session']['account_id'].',\''.$url.'\',\''.$name.'\');'; 86 87 error_log( print_r( $query, true ), 3, "/tmp/log" ); 88 89 $GLOBALS['phpgw']->db->query( $query ,__LINE__,__FILE__ ); 98 90 if ($GLOBALS['phpgw']->db->Error) 99 91 return "Error"; 100 92 else 101 93 return "Success"; 102 94 103 95 } … … 105 97 function removeChannel($param) 106 98 { 107 include('../header.inc.php');108 99 $url = $GLOBALS['phpgw']->db->db_addslashes($param['url']); 109 100 $GLOBALS['phpgw']->db->query('DELETE FROM phpgw_userrss where rss_url = \''.$url.'\';',__LINE__,__FILE__); … … 112 103 else 113 104 return "Success"; 114 } 105 }*/ 115 106 116 107 }
Note: See TracChangeset
for help on using the changeset viewer.