Mr.Fn4ticHz Shell
Server IP : 10.10.92.66  /  Your IP : 104.23.197.230
Web Server : Apache/2.4.52 (Ubuntu)
System : Linux jurnalpolinema 5.15.0-177-generic #187-Ubuntu SMP Sat Apr 11 22:54:33 UTC 2026 x86_64
User : jurnal ( 1001)
PHP Version : 7.4.33
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /home/jurnal/bckup/plugins/generic/staticPages/classes/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /home/jurnal/bckup/plugins/generic/staticPages/classes/StaticPagesDAO.inc.php
<?php

/**
 * @file classes/StaticPagesDAO.inc.php
 *
 * Copyright (c) 2014-2020 Simon Fraser University
 * Copyright (c) 2003-2020 John Willinsky
 * Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
 *
 * @package plugins.generic.staticPages
 * @class StaticPagesDAO
 * Operations for retrieving and modifying StaticPages objects.
 */

import('lib.pkp.classes.db.DAO');
import('plugins.generic.staticPages.classes.StaticPage');

class StaticPagesDAO extends DAO {

	/**
	 * Get a static page by ID
	 * @param $staticPageId int Static page ID
	 * @param $contextId int Optional context ID
	 */
	function getById($staticPageId, $contextId = null) {
		$params = [(int) $staticPageId];
		if ($contextId) $params[] = (int) $contextId;

		$result = $this->retrieve(
			'SELECT * FROM static_pages WHERE static_page_id = ?'
			. ($contextId?' AND context_id = ?':''),
			$params
		);
		$row = $result->current();
		return $row ? $this->_fromRow((array) $row) : null;
	}

	/**
	 * Get a set of static pages by context ID
	 * @param $contextId int
	 * @param $rangeInfo Object optional
	 * @return DAOResultFactory
	 */
	function getByContextId($contextId, $rangeInfo = null) {
		$result = $this->retrieveRange(
			'SELECT * FROM static_pages WHERE context_id = ?',
			[(int) $contextId],
			$rangeInfo
		);
		return new DAOResultFactory($result, $this, '_fromRow');
	}

	/**
	 * Get a static page by path.
	 * @param $contextId int Context ID
	 * @param $path string Path
	 * @return StaticPage
	 */
	function getByPath($contextId, $path) {
		$result = $this->retrieve(
			'SELECT * FROM static_pages WHERE context_id = ? AND path = ?',
			[(int) $contextId, $path]
		);
		$row = $result->current();
		return $row ? $this->_fromRow((array) $row) : null;
	}

	/**
	 * Insert a static page.
	 * @param $staticPage StaticPage
	 * @return int Inserted static page ID
	 */
	function insertObject($staticPage) {
		$this->update(
			'INSERT INTO static_pages (context_id, path) VALUES (?, ?)',
			[(int) $staticPage->getContextId(), $staticPage->getPath()]
		);

		$staticPage->setId($this->getInsertId());
		$this->updateLocaleFields($staticPage);

		return $staticPage->getId();
	}

	/**
	 * Update the database with a static page object
	 * @param $staticPage StaticPage
	 */
	function updateObject($staticPage) {
		$this->update(
			'UPDATE	static_pages
			SET	context_id = ?,
				path = ?
			WHERE	static_page_id = ?',
			[
				(int) $staticPage->getContextId(),
				$staticPage->getPath(),
				(int) $staticPage->getId()
			]
		);
		$this->updateLocaleFields($staticPage);
	}

	/**
	 * Delete a static page by ID.
	 * @param $staticPageId int
	 */
	function deleteById($staticPageId) {
		$this->update(
			'DELETE FROM static_pages WHERE static_page_id = ?',
			[(int) $staticPageId]
		);
		$this->update(
			'DELETE FROM static_page_settings WHERE static_page_id = ?',
			[(int) $staticPageId]
		);
	}

	/**
	 * Delete a static page object.
	 * @param $staticPage StaticPage
	 */
	function deleteObject($staticPage) {
		$this->deleteById($staticPage->getId());
	}

	/**
	 * Generate a new static page object.
	 * @return StaticPage
	 */
	function newDataObject() {
		return new StaticPage();
	}

	/**
	 * Return a new static pages object from a given row.
	 * @return StaticPage
	 */
	function _fromRow($row) {
		$staticPage = $this->newDataObject();
		$staticPage->setId($row['static_page_id']);
		$staticPage->setPath($row['path']);
		$staticPage->setContextId($row['context_id']);

		$this->getDataObjectSettings('static_page_settings', 'static_page_id', $row['static_page_id'], $staticPage);
		return $staticPage;
	}

	/**
	 * Get the insert ID for the last inserted static page.
	 * @return int
	 */
	function getInsertId() {
		return $this->_getInsertId('static_pages', 'static_page_id');
	}

	/**
	 * Get field names for which data is localized.
	 * @return array
	 */
	function getLocaleFieldNames() {
		return ['title', 'content'];
	}

	/**
	 * Update the localized data for this object
	 * @param $author object
	 */
	function updateLocaleFields(&$staticPage) {
		$this->updateDataObjectSettings('static_page_settings', $staticPage,
			['static_page_id' => $staticPage->getId()]
		);
	}
}


Mr.F4ticHz - 2022
Mr.Fn4tcHzam