| Server IP : 213.186.33.2 / Your IP : 216.73.216.39 Web Server : Apache System : Linux webm005.cluster102.gra.hosting.ovh.net 6.18.42-ovh-vps-grsec-zfs+ #1 SMP PREEMPT_DYNAMIC Wed Aug 5 15:59:48 CEST 2026 x86_64 User : symetry ( 21728) PHP Version : 8.2.31 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/s/y/m/symetry/www/ARCHIVES/application/controllers/ |
Upload File : |
<?php
/** @see Zend_Controller_Action */
require_once 'Zend/Controller/Action.php';
class TagsController extends Zend_Controller_Action
{
function preDispatch()
{
$auth = Zend_Auth::getInstance();
if (!$auth->hasIdentity()) {
$this->view->identified = false;
if (!$auth->hasIdentity()) {
$this->_redirect('Auth/Login');
}
}
else
{
$this->view->identified = true;
}
}
public function indexAction()
{
$tags = new Tags();
$this->view->tags = $tags->fetchAll();
}
public function addAction()
{
$this->view->title = Zend_registry::get('translate')->_('AddTags');
$form = new FormTags();
$form->submit->setLabel(Zend_registry::get('translate')->_('Add'));
$this->view->form = $form;
if ($this->_request->isPost()) {
$formData = $this->_request->getPost();
if ($form->isValid($formData)) {
$tags = new Tags();
$row = $tags->createRow();
$row->tag_name = $form->getValue('tag_name');
$row->save();
$this->_redirect('/Tags/');
} else {
$form->populate($formData);
}
}
}
public function delAction()
{
$this->view->title = Zend_registry::get('translate')->_('DelTags');
// confirmation has been done
if ($this->_request->isPost()) {
$id = (int)$this->_request->getPost('id');
$del = $this->_request->getPost('del');
if ($del == Zend_registry::get('translate')->_('Yes') && $id > 0) {
$tag = new Tags();
$where = 'tag_id = ' . $id;
$tag->delete($where);
}
$this->_redirect('/Tags/');
// confirmation has to be done
} else {
$id = (int)$this->_request->getParam('id');
if ($id > 0) {
$tag = new Tags();
$this->view->tags = $tag->fetchRow('tag_id='.$id);
}
}
}
public function modAction()
{
$this->view->title = Zend_registry::get('translate')->_('ModTags');
$form = new FormTags();
$form->submit->setLabel(Zend_registry::get('translate')->_('Save'));
$this->view->form = $form;
if ($this->_request->isPost()) {
$formData = $this->_request->getPost();
if ($form->isValid($formData)) {
$tag = new Tags();
$id = (int)$form->getValue('tag_id');
$row = $tag->fetchRow('tag_id');
$where = 'tag_id = ' . $id;
$row->tag_name = str_replace("\'", "'", $form->getValue('tag_name'));
$row->save($where);
$this->_redirect('/Tags/');
} else {
$form->populate($formData);
}
} else {
// L'id de l'album est attendu dans $params['id']
$id = (int)$this->_request->getParam('id', 0);
if ($id > 0) {
$tag = new Tags();
$tag = $tag->fetchRow('tag_id='.$id);
$form->populate($tag->toArray());
}
}
}
}