/lib/Molinos/File/Handlers/Unlink.php
PHP | 37 lines | 19 code | 5 blank | 13 comment | 1 complexity | 8e88d38dbbb8658d28d9178ea2970930 MD5 | raw file
Possible License(s): BSD-3-Clause, LGPL-2.1, GPL-2.0
- <?php
- /**
- * ?????????? ???????? api/file/unlink.rpc
- *
- * @package Molinos_CMS
- * @subpackage File
- * @author Justin Forest <justin.forest@gmail.com>
- * @copyright 2006-2011 molinos.ru
- * @license http://www.gnu.org/copyleft/gpl.html GPL
- */
- class Molinos_File_Handlers_Unlink extends Molinos_Core_RequestHandler
- {
- /**
- * ?????????? ???? ?? ?????????.
- */
- public function get()
- {
- $t = new Molinos_Database_Transaction();
- $fieldName = $this->rarg('field');
- $node = Molinos_Core_API::getInstance('node')->load(array(
- 'id' => $this->rarg('node'),
- ))->knock(Molinos_Auth_ACL::UPDATE);
- if (Molinos_I18n_Utils::isFieldTranslated($node->class, $fieldName))
- $node->onSave("DELETE FROM {node__rel} WHERE `tid` = ? AND `key` = ? AND `lang` = ?", array($node->id, $fieldName, $node->lang));
- else
- $node->onSave("DELETE FROM {node__rel} WHERE `tid` = ? AND `key` = ?", array($node->id, $fieldName));
- // ????????????? ????, ????? ????????? ??????????? ?????????, ????? ???????????.
- $node->touch()->save();
- $t->commit();
- return new Molinos_HTTP_Responses_Redirect($this->arg('destination'));
- }
- }