Annotation of /trunk/_templates/flex/news/article.page.tpl.php
Parent Directory
|
Revision Log
Revision 14 - (view) (download)
| 1 : | pith7 | 12 | <?php |
| 2 : | /** | ||
| 3 : | * News Article Display Template. | ||
| 4 : | * | ||
| 5 : | * Copyright (c) 2009 FlexCP Contributors | ||
| 6 : | * | ||
| 7 : | * Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| 8 : | * of this software and associated documentation files (the "Software"), to deal | ||
| 9 : | * in the Software without restriction, including without limitation the rights | ||
| 10 : | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| 11 : | * copies of the Software, and to permit persons to whom the Software is | ||
| 12 : | * furnished to do so, subject to the following conditions: | ||
| 13 : | * | ||
| 14 : | * The above copyright notice and this permission notice shall be included in | ||
| 15 : | * all copies or substantial portions of the Software. | ||
| 16 : | * | ||
| 17 : | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| 18 : | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| 19 : | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| 20 : | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| 21 : | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| 22 : | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
| 23 : | * THE SOFTWARE. | ||
| 24 : | * | ||
| 25 : | * @author PiTh7 <friedfrogs888@yahoo.com> | ||
| 26 : | * @package FlexCP | ||
| 27 : | * @subpackage News | ||
| 28 : | * @version $Id$ | ||
| 29 : | */ | ||
| 30 : | |||
| 31 : | $form = new HTML_QuickForm2('frmComment'); | ||
| 32 : | $frm=$form->addElement('fieldset')->setLabel('Write New Comment'); | ||
| 33 : | $frm->addElement('hidden','hidArticle',array('value'=>$this->Article->ID),array()); | ||
| 34 : | $frm->addElement('text','txtTitle',array(),array())->setLabel('Subject:')->addRule('required','This field is required.'); | ||
| 35 : | $frm->addElement('textarea','txtContent',array('class'=>'mceMinimalEditor'),array())->setLabel('Message:')->addRule('required','This field is required.'); | ||
| 36 : | Captcha::AddQF2Control($frm,'', array(),array('label'=>'')); | ||
| 37 : | $frm->addElement('submit',null,array(),array()); | ||
| 38 : | |||
| 39 : | if(!$form->validate()) | ||
| 40 : | { | ||
| 41 : | ?> | ||
| 42 : | <div class="newswrap"> | ||
| 43 : | <h2>#<?=$this->Article->ID?>: <?=$this->Article->Title?></h2> | ||
| 44 : | <p class="newsdata"> | ||
| 45 : | pith7 | 14 | Posted by <?=User::Find(intval($this->Article->User))->GetName()?> at <?=date(DATE_RFC822,$this->Article->Posted)?> |
| 46 : | pith7 | 12 | </p> |
| 47 : | <?=$this->Article->Content?> | ||
| 48 : | </div> | ||
| 49 : | <? | ||
| 50 : | if($this->Article->AllowComments) | ||
| 51 : | { | ||
| 52 : | |||
| 53 : | $rs2=DB::Execute(sprintf('SELECT * FROM %sNewsComments WHERE aclID=%d',ADODB_PREFIX,$this->Article->ID)); | ||
| 54 : | foreach($rs2 as $row) | ||
| 55 : | { | ||
| 56 : | pith7 | 14 | $cu=User::Find(intval($row['usrID'])); |
| 57 : | pith7 | 12 | ?> |
| 58 : | <div class="newscomment"> | ||
| 59 : | pith7 | 14 | <a name="com<?=$row['comID']?>"></a> |
| 60 : | pith7 | 12 | <div class="newscomment_title"> |
| 61 : | <?=$this->eprint($row['comSubj'])?> | ||
| 62 : | </div> | ||
| 63 : | pith7 | 14 | <div class="meta"> |
| 64 : | <a href="#com<?=$row['comID']?>" title="Permalink">#</a> | ||
| 65 : | pith7 | 12 | <? if(User::CheckAuth(GRP_MODERATOR)):?> |
| 66 : | pith7 | 14 | <a href="<?=THISURL?>admin.php/news/com/del/<?=$row['comID']?>"><img src="<?=THISURL?>static/icons/delete.png" style="height:16px !important;" /></a> |
| 67 : | pith7 | 12 | <? endif; ?> |
| 68 : | pith7 | 14 | <?=$cu->GetAvatar(true)?>Posted by <?=$cu->GetName()?> at <?=date(DATE_RFC822,$row['comTime'])?>. |
| 69 : | pith7 | 12 | </div> |
| 70 : | <div class="newscomment_body"> | ||
| 71 : | <?=$row['comContent']?> | ||
| 72 : | </div> | ||
| 73 : | </div> | ||
| 74 : | pith7 | 14 | |
| 75 : | pith7 | 12 | <? } |
| 76 : | pith7 | 14 | Output::RenderQF2($form); |
| 77 : | pith7 | 12 | } |
| 78 : | |||
| 79 : | } else { | ||
| 80 : | if(!User::CheckAuth(GRP_BASIC)) | ||
| 81 : | Output::HardError('This command is limited to registered users.'); | ||
| 82 : | |||
| 83 : | pith7 | 14 | if(!$this->Article->AllowComments) |
| 84 : | Output::HardError('This article has disabled comments.'); | ||
| 85 : | |||
| 86 : | pith7 | 12 | $article=new Article(POST::GetInt('txtArticleID')); |
| 87 : | $com=new NewsComment(); | ||
| 88 : | $com->Article=$this->Article; | ||
| 89 : | $com->Title=POST::GetEString('txtTitle'); | ||
| 90 : | $com->Content=POST::GetEString('txtContent'); // Cleaned before update. | ||
| 91 : | $com->User=User::$Data; | ||
| 92 : | $com->Posted=time(); | ||
| 93 : | $com->Update(); | ||
| 94 : | Output::Redirect(THISURL.'news.php/article/'.$this->Article->ID); | ||
| 95 : | } |
| ViewVC Help | |
| Powered by ViewVC 1.0.0 |

