public function getNewsItems($f_iLimit = 0, $f_szOrderBy = 'created DESC') { if (null === $this->_items) { $arrItems = ARONewsItem::finder()->findMany('news_implementation_id = ' . $this->implementation_id . ' ORDER BY ' . $f_szOrderBy); foreach ($arrItems as $item) { $item->init($this); } $this->_items = $arrItems; } return $this->_items; }
<?php require_once 'cfg_admin.php'; logincheck(); $objNews = AROImplementation::loadImplementationByID($_GET['id']); $objItem = ARONewsItem::finder()->findOne('id = ? AND news_implementation_id = ?', $_GET['item'], $objNews->implementation_id)->init($objNews); if (isset($_POST['title'], $_POST['content_1'])) { $arrUpdate = array('title' => $_POST['title'], 'content_1' => $_POST['content_1']); foreach (array('title_2', 'content_2', 'datetime_1', 'datetime_2') as $k) { if (isset($_POST[$k])) { $arrUpdate[$k] = $_POST[$k]; } } $goto = $_SERVER['HTTP_REFERER']; foreach (array('2', '1') as $n) { $szColName = 'image_' . $n; if ($objNews->{'use_' . $szColName} && !empty($_FILES[$szColName]) && 0 == $_FILES[$szColName]['error']) { $szExt = strtolower(substr(strrchr($_FILES[$szColName]['name'], '.'), 1)); if (in_array($szExt, array('jpg', 'jpeg', 'gif', 'png'))) { $path = PROJECT_PUBLIC_RESOURCES . '/news_item_' . $objItem->id . '_' . $n . '_' . $_FILES[$szColName]['name']; if ($u = move_uploaded_file($_FILES[$szColName]['tmp_name'], $path)) { chmod($path, 0777); $arrUpdate[$szColName] = $_FILES[$szColName]['name']; // thumbnail $tw = $objNews->{'image_' . $n . '_thumb_x'}; $th = $objNews->{'image_' . $n . '_thumb_y'}; if ($tw && $th) { $tpath = PROJECT_PUBLIC_RESOURCES . '/thumbs/news_item_' . $objItem->id . '_' . $n . '_' . $_FILES[$szColName]['name']; copy($path, $tpath); chmod($tpath, 0777); $tpubpath = '/' . PROJECT_RESOURCES_FOLDER . '/thumbs/' . basename($tpath);