[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] CVS: news_admin/inc class.bonews.inc.php, 1.1.2.1.2.3
From: |
Dave Hall <address@hidden> |
Subject: |
[Phpgroupware-cvs] CVS: news_admin/inc class.bonews.inc.php, 1.1.2.1.2.3, 1.1.2.1.2.4 class.sonews.inc.php, 1.1.2.1.2.5, 1.1.2.1.2.6 class.uinews.inc.php, 1.10.2.6.2.4, 1.10.2.6.2.5 |
Date: |
Fri, 11 Jul 2003 06:57:02 -0400 |
Update of /cvsroot/phpgroupware/news_admin/inc
In directory subversions:/tmp/cvs-serv14589/inc
Modified Files:
Tag: Version-0_9_16-branch
class.bonews.inc.php class.sonews.inc.php class.uinews.inc.php
Log Message:
added html support
Index: class.bonews.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/news_admin/inc/Attic/class.bonews.inc.php,v
retrieving revision 1.1.2.1.2.3
retrieving revision 1.1.2.1.2.4
diff -C2 -r1.1.2.1.2.3 -r1.1.2.1.2.4
*** class.bonews.inc.php 28 Jun 2003 04:44:02 -0000 1.1.2.1.2.3
--- class.bonews.inc.php 11 Jul 2003 10:56:59 -0000 1.1.2.1.2.4
***************
*** 41,53 ****
foreach(array('start','query','sort','order','cat_id') as $var)
{
! if (isset($_POST[$var]))
! {
! $this->$var = $_POST[$var];
! }
! elseif (isset($_GET[$var]))
! {
! $this->$var = $_GET[$var];
! }
}
$this->cat_id = $this->cat_id ? $this->cat_id :
'all';
$this->save_sessiondata();
--- 41,47 ----
foreach(array('start','query','sort','order','cat_id') as $var)
{
! $this->$var = get_var($var,
array('POST', 'GET'), '');
}
+
$this->cat_id = $this->cat_id ? $this->cat_id :
'all';
$this->save_sessiondata();
***************
*** 87,109 ****
function get_newslist($cat_id, $start=0,
$order='',$sort='',$limit=0,$activeonly=False)
{
if ($cat_id == 'all')
{
- $cat_id_list = array();
foreach($this->cats as $cat)
{
if ($this->acl->is_readable($cat['id']))
{
! $cat_id_list[] = $cat['id'];
}
}
! return $cat_id_list ?
!
$this->sonews->get_newslist($cat_id_list,
$start,$order,$sort,$limit,$activeonly,$this->total) :
! array();
}
else
{
! return $this->acl->is_readable($cat_id) ?
! $this->sonews->get_newslist($cat_id,
$start,$order,$sort,$limit,$activeonly,$this->total) :
! array();
}
}
--- 81,112 ----
function get_newslist($cat_id, $start=0,
$order='',$sort='',$limit=0,$activeonly=False)
{
+ $cats = False;
if ($cat_id == 'all')
{
foreach($this->cats as $cat)
{
if ($this->acl->is_readable($cat['id']))
{
! $cats[] = $cat['id'];
}
}
! }
! elseif($this->acl->is_readable($cat_id))
! {
! $cats = $cat_id;
! }
!
! if($cats)
! {
! $news = $this->sonews->get_newslist($cats,
$start,$order,$sort,$limit,$activeonly,$this->total);
! foreach($news as $id => $item)
! {
! $news[$id]['content'] =
($item['is_html'] ? $item['content'] : nl2br(htmlentities($item['content'])));
! }
! return $news;
}
else
{
! return array();
}
}
***************
*** 111,115 ****
function get_all_public_news($limit = 5)
{
! return $this->sonews->get_all_public_news($limit);
}
--- 114,123 ----
function get_all_public_news($limit = 5)
{
! $news = $this->sonews->get_all_public_news($limit);
! foreach($news as $id => $item)
! {
! $news[$id]['content'] = ($item['is_html'] ?
$item['content'] : nl2br(htmlentities($item['content'])));
! }
! return $news;
}
***************
*** 283,286 ****
--- 291,295 ----
{
$this->total = 1;
+ $news['content'] = ($news['html'] ?
$news['content']: nl2br(htmlentities($news['content'])));
return $news;
}
Index: class.sonews.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/news_admin/inc/Attic/class.sonews.inc.php,v
retrieving revision 1.1.2.1.2.5
retrieving revision 1.1.2.1.2.6
diff -C2 -r1.1.2.1.2.5 -r1.1.2.1.2.6
*** class.sonews.inc.php 28 Jun 2003 04:44:02 -0000 1.1.2.1.2.5
--- class.sonews.inc.php 11 Jul 2003 10:57:00 -0000 1.1.2.1.2.6
***************
*** 62,66 ****
{
$news[$this->db->f('news_id')] = array(
! 'subject' =>
htmlentities(stripslashes($this->db->f('news_subject'))),
'submittedby' =>
$this->db->f('news_submittedby'),
'date' => $this->db->f('news_date'),
--- 62,66 ----
{
$news[$this->db->f('news_id')] = array(
! 'subject' =>
htmlentities($this->db->f('news_subject', True)),
'submittedby' =>
$this->db->f('news_submittedby'),
'date' => $this->db->f('news_date'),
***************
*** 68,73 ****
'begin' => $this->db->f('news_begin'),
'end' => $this->db->f('news_end'),
! 'teaser' =>
htmlentities(stripslashes($this->db->f('news_teaser'))),
! 'content' =>
nl2br(htmlentities(stripslashes($this->db->f('news_content'))))
);
}
--- 68,74 ----
'begin' => $this->db->f('news_begin'),
'end' => $this->db->f('news_end'),
! 'teaser' =>
htmlentities($this->db->f('news_teaser', True)),
! 'content' =>
$this->db->f('news_content',True),
! 'is_html' =>
($this->db->f('is_html') ? True : False),
);
}
***************
*** 85,94 ****
{
$news[$this->db->f('news_id')] = array(
! 'subject' =>
$this->db->f('news_subject'),
'submittedby' =>
$this->db->f('news_submittedby'),
'date' => $this->db->f('news_date'),
'id' => $this->db->f('news_id'),
! 'teaser' => $this->db->f('news_teaser'),
! 'content' =>
nl2br(stripslashes($this->db->f('news_content')))
);
}
--- 86,96 ----
{
$news[$this->db->f('news_id')] = array(
! 'subject' =>
$this->db->f('news_subject', True),
'submittedby' =>
$this->db->f('news_submittedby'),
'date' => $this->db->f('news_date'),
'id' => $this->db->f('news_id'),
! 'teaser' => $this->db->f('news_teaser',
True),
! 'content' =>
$this->db->f('news_content', True),
! 'is_html' =>
($this->db->f('is_html') ? True : False),
);
}
***************
*** 98,106 ****
function add($news)
{
! $sql = 'INSERT INTO phpgw_news
(news_date,news_submittedby,news_content,news_subject,news_begin,news_end,news_teaser,news_cat)
';
$sql .= 'VALUES (' . intval($news['date']) . ',';
$sql .= $GLOBALS['phpgw_info']['user']['account_id'] .
",'" . $this->db->db_addslashes($news['content']) ."','";
$sql .= $this->db->db_addslashes($news['subject'])
."'," . intval($news['begin']) . "," . intval($news['end']) . ",'";
! $sql .= $this->db->db_addslashes($news['teaser']) .
"'," . intval($news['category']) . ')';
$this->db->query($sql);
--- 100,108 ----
function add($news)
{
! $sql = 'INSERT INTO phpgw_news
(news_date,news_submittedby,news_content,news_subject,news_begin,news_end,news_teaser,news_cat,is_html)
';
$sql .= 'VALUES (' . intval($news['date']) . ',';
$sql .= $GLOBALS['phpgw_info']['user']['account_id'] .
",'" . $this->db->db_addslashes($news['content']) ."','";
$sql .= $this->db->db_addslashes($news['subject'])
."'," . intval($news['begin']) . "," . intval($news['end']) . ",'";
! $sql .= $this->db->db_addslashes($news['teaser']) .
"'," . intval($news['category']) . ',' . intval($news['is_html']) .')';
$this->db->query($sql);
***************
*** 114,120 ****
. "news_subject='" .
$this->db->db_addslashes($news['subject']) . "', "
. "news_teaser='" .
$this->db->db_addslashes($news['teaser']) . "', "
! . "news_begin=" . intval($news['begin']) . ", "
! . "news_end=" . intval($news['end']) . ", "
! . "news_cat='" .
$this->db->db_addslashes($news['category']) . "' "
. "WHERE news_id=" .
intval($news['id']),__LINE__,__FILE__);
}
--- 116,123 ----
. "news_subject='" .
$this->db->db_addslashes($news['subject']) . "', "
. "news_teaser='" .
$this->db->db_addslashes($news['teaser']) . "', "
! . 'news_begin=' . intval($news['begin']) . ', '
! . 'news_end=' . intval($news['end']) . ', '
! . 'news_cat=' . intval($news['category']) . ' '
! . 'is_html=' . ($news['is_html'] ? 1 : 0)
. "WHERE news_id=" .
intval($news['id']),__LINE__,__FILE__);
}
***************
*** 133,143 ****
'id' => $this->db->f('news_id'),
'date' => $this->db->f('news_date'),
! 'subject' => $this->db->f('news_subject'),
'submittedby' =>
$this->db->f('news_submittedby'),
! 'teaser' =>
$this->db->f('news_teaser'),
! 'content' => $this->db->f('news_content'),
! 'begin' => $this->db->f('news_begin'),
! 'end' => $this->db->f('news_end'),
! 'category' => $this->db->f('news_cat')
);
return $item;
--- 136,147 ----
'id' => $this->db->f('news_id'),
'date' => $this->db->f('news_date'),
! 'subject' => $this->db->f('news_subject',
True),
'submittedby' =>
$this->db->f('news_submittedby'),
! 'teaser' =>
$this->db->f('news_teaser', True),
! 'content' => $this->db->f('news_content',
True),
! 'begin' =>
$this->db->f('news_begin'),
! 'end' =>
$this->db->f('news_end'),
! 'category' => $this->db->f('news_cat'),
! 'is_html' =>
($this->db->f('is_html') ? True : False),
);
return $item;
Index: class.uinews.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/news_admin/inc/Attic/class.uinews.inc.php,v
retrieving revision 1.10.2.6.2.4
retrieving revision 1.10.2.6.2.5
diff -C2 -r1.10.2.6.2.4 -r1.10.2.6.2.5
*** class.uinews.inc.php 28 Jun 2003 04:44:02 -0000 1.10.2.6.2.4
--- class.uinews.inc.php 11 Jul 2003 10:57:00 -0000 1.10.2.6.2.5
***************
*** 56,62 ****
$link_data['start'] = 0;
$right = ($type == 'read') ? PHPGW_ACL_READ :
PHPGW_ACL_ADD;
- @reset($this->bo->cats);
$selectlist = ($default === false) ? ('<option>' .
lang($type . ' news') . '</option>') : '';
! while(list(,$cat) = @each($this->bo->cats))
{
if($this->bo->acl->is_permitted($cat['id'],$right))
--- 56,61 ----
$link_data['start'] = 0;
$right = ($type == 'read') ? PHPGW_ACL_READ :
PHPGW_ACL_ADD;
$selectlist = ($default === false) ? ('<option>' .
lang($type . ' news') . '</option>') : '';
! foreach($this->bo->cats as $cat)
{
if($this->bo->acl->is_permitted($cat['id'],$right))
***************
*** 65,69 ****
$link_data['cat_id'] = $cat_id;
$selectlist .= '<option value="';
! $selectlist .= $default ? $cat_id :
$GLOBALS['phpgw']->link('/index.php',$link_data);
$selectlist .= '"';
$selectlist .= ($default === $cat_id) ?
' selected="selected"' : '';
--- 64,68 ----
$link_data['cat_id'] = $cat_id;
$selectlist .= '<option value="';
! $selectlist .= $default !== False ?
$cat_id : $GLOBALS['phpgw']->link('/index.php',$link_data);
$selectlist .= '"';
$selectlist .= ($default === $cat_id) ?
' selected="selected"' : '';
***************
*** 82,86 ****
function read_news()
{
! $limit = 5;
$news_id = get_var('news_id',Array('GET'));
--- 81,86 ----
function read_news()
{
! $limit = ($GLOBALS['phpgw_info']['common']['maxmatchs']
! ?
$GLOBALS['phpgw_info']['common']['maxmatchs'] : 5);
$news_id = get_var('news_id',Array('GET'));
***************
*** 101,105 ****
$var['lang_read'] = lang('Read');
$var['lang_write'] = lang('Write');
! $var['readable'] = $this->selectlist('read');
$var['maintainlink'] = (($this->cat_id != 'all') &&
$this->bo->acl->is_permitted($this->cat_id,PHPGW_ACL_ADD)) ?
('<a href="' .
$GLOBALS['phpgw']->link('/index.php','menuaction=news_admin.uinews.write_news&start=0&cat_id='.$this->cat_id)
.
--- 101,105 ----
$var['lang_read'] = lang('Read');
$var['lang_write'] = lang('Write');
! $var['readable'] = $this->selectlist('read',
$_SERVER['QUERY_STRING']);
$var['maintainlink'] = (($this->cat_id != 'all') &&
$this->bo->acl->is_permitted($this->cat_id,PHPGW_ACL_ADD)) ?
('<a href="' .
$GLOBALS['phpgw']->link('/index.php','menuaction=news_admin.uinews.write_news&start=0&cat_id='.$this->cat_id)
.
***************
*** 117,121 ****
'subject' => $newsitem['subject'],
'submitedby' => 'Submitted by ' .
$GLOBALS['phpgw']->accounts->id2name($newsitem['submittedby']) . ' on ' .
$GLOBALS['phpgw']->common->show_date($newsitem['date']),
! 'content' =>
nl2br($newsitem['content'])
);
--- 117,121 ----
'subject' => $newsitem['subject'],
'submitedby' => 'Submitted by ' .
$GLOBALS['phpgw']->accounts->id2name($newsitem['submittedby']) . ' on ' .
$GLOBALS['phpgw']->common->show_date($newsitem['date']),
! 'content' => $newsitem['content'],
);
***************
*** 414,424 ****
'done_button' => '<input type="submit"
name="cancel" value="' . lang('Done') . '">',
'label_subject' => lang('subject') . ':',
! 'value_subject' => '<input name="news[subject]"
size="60" value="' . $this->news_data['subject'] . '">',
'label_teaser' => lang('teaser') . ':',
! 'value_teaser' => '<input name="news[teaser]"
size="60" value="' . stripslashes($this->news_data['teaser']) . '"
maxLength=100>',
'label_content' => lang('Content') . ':',
! 'value_content' => '<textarea cols="60"
rows="6" name="news[content]" wrap="virtual">' .
stripslashes($this->news_data['content']) . '</textarea>',
'label_category' => lang('Category') . ':',
! 'value_category' => '<select
name="news[category]">' . $this->selectlist('write',
(int)$this->news_data['category']) . '</select>',
'label_visible' => lang('Visible') . ':',
'value_begin_d' =>
$this->sbox->getDays('news[begin_d]',date('j',$this->news_data['begin'])),
--- 414,424 ----
'done_button' => '<input type="submit"
name="cancel" value="' . lang('Done') . '">',
'label_subject' => lang('subject') . ':',
! 'value_subject' => '<input name="news[subject]"
size="60" value="' . htmlentities($this->news_data['subject']) . '">',
'label_teaser' => lang('teaser') . ':',
! 'value_teaser' => '<input name="news[teaser]"
size="60" value="' . htmlentities($this->news_data['teaser']) . '"
maxLength=100>',
'label_content' => lang('Content') . ':',
! 'value_content' => '<textarea cols="60"
rows="6" name="news[content]" wrap="virtual">' .
htmlentities($this->news_data['content']) . '</textarea>',
'label_category' => lang('Category') . ':',
! 'value_category' => '<select
name="news[category]">' . $this->selectlist('write',
intval($this->news_data['category'])) . '</select>',
'label_visible' => lang('Visible') . ':',
'value_begin_d' =>
$this->sbox->getDays('news[begin_d]',date('j',$this->news_data['begin'])),
***************
*** 430,433 ****
--- 430,435 ----
'value_end_m' =>
$this->sbox->getMonthText('news[end_m]',date('n',$this->news_data['end'])),
'value_end_y' =>
$this->sbox->getYears('news[end_y]',date('Y',$this->news_data['end']),date('Y')),
+ 'label_is_html' => lang('Contains HTML'),
+ 'value_is_html' => '<input type="checkbox"
name="news[is_html]"' . ($this->news_data['is_html'] ? ' CHECKED' : '') .'>',
));
***************
*** 478,482 ****
));
! while ((list(,$item) = @each($items)))
{
$this->nextmatchs->template_alternate_row_color(&$this->template);
--- 480,484 ----
));
! foreach($items as $item)
{
$this->nextmatchs->template_alternate_row_color(&$this->template);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] CVS: news_admin/inc class.bonews.inc.php, 1.1.2.1.2.3, 1.1.2.1.2.4 class.sonews.inc.php, 1.1.2.1.2.5, 1.1.2.1.2.6 class.uinews.inc.php, 1.10.2.6.2.4, 1.10.2.6.2.5,
Dave Hall <address@hidden> <=
- Prev by Date:
[Phpgroupware-cvs] CVS: news_admin/setup setup.inc.php, 1.5.4.4, 1.5.4.5 tables_current.inc.php, 1.3.4.3, 1.3.4.4 tables_update.inc.php, 1.1.4.3, 1.1.4.4
- Next by Date:
[Phpgroupware-cvs] CVS: property/setup tables_current.inc.php, 1.112, 1.113
- Previous by thread:
[Phpgroupware-cvs] CVS: news_admin/setup setup.inc.php, 1.5.4.4, 1.5.4.5 tables_current.inc.php, 1.3.4.3, 1.3.4.4 tables_update.inc.php, 1.1.4.3, 1.1.4.4
- Next by thread:
[Phpgroupware-cvs] CVS: property/setup tables_current.inc.php, 1.112, 1.113
- Index(es):