Skip to content
Products
Resources
Solutions
Pricing
Contact
Log In
Sign Up
Docs
Getting Started
Configuration
Apps
CODE
Developer Architecture
Code Convention
Code Quality
Directory Structure
Storage System
Common Mistakes
Payment Provider Integration
How to Add an App
Auth
Docs
CODE
Code Convention
On this page

Code Convention

How UNA 15 PHP names classes, variables, SQL placeholders, CSRF tokens, and singletons.
Android
iOS
Web
Core
~15.0
Copy Page
Note
<?php defined('BX_DOL') or die('hack attempt');
/**
 * Copyright (c) UNA, Inc - https://una.io
 * MIT License - https://opensource.org/licenses/MIT
 *
 * @defgroup    Posts Posts
 * @ingroup     UnaModules
 *
 * @{
 */
public function serviceCheckAllowedCommentsPost($iContentId, $sObjectComments)
{
	$CNF = &$this->_oConfig->CNF;
	$aContentInfo = $this->_oDb->getContentInfoById($iContentId);
	if ($aContentInfo && $aContentInfo[$CNF['FIELD_ALLOW_COMMENTS']] == 0)
		return false;

	return parent::serviceCheckAllowedCommentsPost($iContentId, $sObjectComments);
}
class BxDolDb extends BxDolFactory implements iBxDolSingleton
{
	protected function __construct($aDbConf = false)
	{
		if (isset($GLOBALS['bxDolClasses'][get_class($this)]))
			trigger_error ('Multiple instances are not allowed for the class: ' . get_class($this), E_USER_ERROR);
$aBindings = array(
	'author' => $iAuthorId
);
$CNF = &$this->_oConfig->CNF;

return $this->getRow("SELECT COUNT(id) AS count, SUM(views) AS views, SUM(votes) AS votes, SUM(rvotes) AS rvotes FROM `" . $CNF['TABLE_ENTRIES'] . "` WHERE `author`=:author", $aBindings);
$sQuery = $this->prepare("SELECT `name` FROM `sys_options` WHERE `name` = ? LIMIT 1", $sKey);
return $this->getOne($sQuery) == $sKey;
$this->aInputs['csrf_token'] = array(
	'type' => 'hidden',
	'name' => 'csrf_token',
	'value' => $mixedCsrfToken,
	'db' => array ('pass' => 'Xss'),
	'visible_for_levels' => PHP_INT_MAX,
);
class BxDolDb extends BxDolFactory implements iBxDolSingleton
{
	public static function getInstance()
	{
		$null = null;
		return self::getInstanceWithConf(false, $null);
	}
}
18d
On this page
File headerClasses and methodsHungarian prefixesBracesSQLCSRFSingletonsLanguage keys
Auto
public function serviceCheckAllowedCommentsPost($iContentId, $sObjectComments)
{
	$CNF = &$this->_oConfig->CNF;
	$aContentInfo = $this->_oDb->getContentInfoById($iContentId);
	if ($aContentInfo && $aContentInfo[$CNF['FIELD_ALLOW_COMMENTS']] == 0)
		return false;

	return parent::serviceCheckAllowedCommentsPost($iContentId, $sObjectComments);
}
class BxDolDb extends BxDolFactory implements iBxDolSingleton
{
	protected function __construct($aDbConf = false)
	{
		if (isset($GLOBALS['bxDolClasses'][get_class($this)]))
			trigger_error ('Multiple instances are not allowed for the class: ' . get_class($this), E_USER_ERROR);
$aBindings = array(
	'author' => $iAuthorId
);
$CNF = &$this->_oConfig->CNF;

return $this->getRow("SELECT COUNT(id) AS count, SUM(views) AS views, SUM(votes) AS votes, SUM(rvotes) AS rvotes FROM `" . $CNF['TABLE_ENTRIES'] . "` WHERE `author`=:author", $aBindings);
$this->aInputs['csrf_token'] = array(
	'type' => 'hidden',
	'name' => 'csrf_token',
	'value' => $mixedCsrfToken,
	'db' => array ('pass' => 'Xss'),
	'visible_for_levels' => PHP_INT_MAX,
);