public function update() { $this->data['last_login_datetime'] = date('Y-m-d H:i:s'); if (array_key_exists('expiresIn', $this->rawData) && $this->rawData['expiresIn'] != '') { $this->data['expires_datetime'] = date('Y-m-d H:i:s', time() + $this->rawData['expiresIn']); } parent::update(); }
function cache() { if ($this->method === 'delete') { $c = new Content(); $c->update('file_modified_on', time()); Shutter::clear_cache('images'); Shutter::clear_cache('icc'); } exit; }
function editContent() { global $lang; $page_lang = scandir('inc/lang/' . $_SESSION['language']); foreach ($page_lang as $file) { if ($file != '.' && $file != '..') { $parts = explode(".", $file); $page = $parts[0]; if ($page == 'content') { $page_file = $file; } } } include_once 'inc/lang/' . $_SESSION['language'] . '/' . $page_file; if ($_SESSION['access']->content > 1) { $results = array(); if (isset($_POST['saveChanges'])) { $_POST['id'] = $_POST['editId']; unset($_POST['editId']); // User has posted the content edit form: save the content changes if (!($content = Content::getById((int) $_POST['id']))) { header("Location: index.php?action=listContent&categoryId=" . $_GET['categoryId'] . "&error=" . ($_POST['type'] == 0) ? "category" : "page" . "NotFound"); return; } $_POST['botAction1'] == 'on' ? $botAction1 = 'index' : ($botAction1 = 'noindex'); $_POST['botAction2'] == 'on' ? $botAction2 = 'follow' : ($botAction2 = 'nofollow'); $_POST['menu'] == 'on' ? $_POST['menu'] = 1 : ($_POST['menu'] = 0); $botActionArray = array($botAction1, $botAction2); $_POST['botAction'] = implode(", ", $botActionArray); unset($_POST['botAction1']); unset($_POST['botAction2']); $_POST['lastModified'] = date('Y-m-d'); $content = new Content(); $content->storeFormValues($_POST); $content->update(); header("Location: index.php?action=listContent&categoryId=" . $_GET['categoryId'] . "&success=changesSaved"); } elseif (isset($_POST['cancel'])) { // User has cancelled their edits: return to the content list header("Location: index.php?action=listContent&categoryId=" . $_GET['categoryId']); } else { // User has not submitted the content edit form: display the form $results['content'] = Content::getById((int) $_GET['editId']); require "inc/layout/editContent.php"; } } else { require "inc/layout/noAccess.php"; } }
/** Edit a content article * @access public * @return void * @throws Pas_Exception_Param */ public function editAction() { if ($this->getParam('id', false)) { $form = new ContentForm(); $form->submit->setLabel('Submit changes'); $form->author->setValue($this->getIdentityForForms()); $this->view->form = $form; if ($this->getRequest()->isPost() && $form->isValid($this->_request->getPost())) { if ($form->isValid($form->getValues())) { $updateData = $form->getValues(); $where = array(); $where[] = $this->_content->getAdapter()->quoteInto('id = ?', $this->getParam('id')); $oldData = $this->_content->fetchRow($this->_content->select()->where('id= ?', (int) $this->getParam('id')))->toArray(); $this->_helper->audit($updateData, $oldData, 'ContentAudit', $this->getParam('id'), $this->getParam('id')); $this->_content->update($updateData, $where); $this->_helper->solrUpdater->update('content', $this->getParam('id')); $this->getFlash()->addMessage('You updated successfully. It is now available for use.'); $this->getCache()->clean(Zend_Cache::CLEANING_MODE_ALL); $this->redirect('admin/content/'); } else { $form->populate($this->_request->getPost()); } } else { // find id is expected in $params['id'] $id = (int) $this->_request->getParam('id', 0); if ($id > 0) { $content = $this->_content->fetchRow('id=' . (int) $id)->toArray(); if ($content) { $form->populate($content); } else { throw new Pas_Exception_Param($this->_nothingFound); } } } } else { throw new Pas_Exception_Param($this->_missingParameter, 500); } }
} LocalDef::setLevelMenu(Constants::ADMIN_MENU_1_CONTENT, $currentPage); include "large_menu.php"; /*include("small_menu_start.php");*/ ?> <!-- MAIN SECTION --> <section class="main-section"> <div class="small-12 columns"> <div class="row"> <h4>contenu - <?php if (isset($_POST["id"])) { $content->initProperty($_POST["id"], $currentPage, $_POST["code"]); $content->validate($mySql); if (!$content->getHasError()) { if ($content->PageMode == Constants::PAGE_MODE_EDIT) { $content->update($mySql); } } echo $content->PageName; } else { echo $content->PageName; } ?> </h4> </div> <div class="row"> <form action="content_edit.php" id="form_content" method="post"> <div class="row"> <div class="small-12 columns"> <label <?php if ($content->attributeHasError('code')) {
function _do_match_visibility($params = false) { if (!$params) { $params = array('left_id' => $this->left_id, 'right_id' => $this->right_id, 'visibility' => $this->visibility); } $aggregator = new Album(); $aggregator->select('id')->where('left_id >=', $params['left_id'])->where('right_id <=', $params['right_id'])->get_iterated(); $ids = array(); foreach ($aggregator as $album) { $ids[] = $album->id; } $c = new Content(); $c->select('id')->where_in_related('album', 'id', $ids)->get_iterated(); $cids = array(); foreach ($c as $content) { $cids[] = $content->id; } if (count($cids)) { $c = new Content(); $c->where_in('id', $cids); if ($this->old_visibility < 2) { $c->where('visibility <', 2); } $c->update(array('visibility' => $params['visibility'])); } }
public function update() { $content = new Content(); $result = $content->update(); header("Location: " . $_POST["app"]); }
$product = Product::first($product); } $product->productName = isset($_REQUEST["productName"]) ? $_REQUEST["productName"] : $product->productName; $product->productNo = isset($_REQUEST["productNo"]) ? $_REQUEST["productNo"] : $product->productNo; $product->productType = isset($_REQUEST["productType"]) ? $_REQUEST["productType"] : $product->productType; $product->mImage = isset($_REQUEST["mImage"]) ? $_REQUEST["mImage"] : $product->mImage; $product->aliUrl = isset($_REQUEST["aliUrl"]) ? $_REQUEST["aliUrl"] : $product->aliUrl; if ($action == "insert") { $newId = Product::insert($product); if ($newId > 0) { Content::insert(array($module . $newId => isset($_REQUEST["productDetail"]) ? $_REQUEST["productDetail"] : ""), $module); } } else { if ($action == "update") { Product::update($product); Content::update(array($module . $product->productId => isset($_REQUEST["productDetail"]) ? $_REQUEST["productDetail"] : ""), $module); } else { if ($action == "delete") { Product::delete($product); Content::delete($module . $product->productId, $module); $docFile = new DocFile(_NONE); $docFile->fileUrl = $product->mImage; DocFile::delete($docFile); } } } } catch (Exception $e) { $result = $e->getMessage(); Tool::logger(__METHOD__, __LINE__, sprintf("数据保存失败: %s", $e->getMessage()), _LOG_ERROR); } } else {