<?php if (!defined('VB_ENTRY')) die('Access denied.'); class vB_Library_Reputation extends vB_Library { public function fetchReppower($userinfo) { $vboptions = vB::getDatastore()->getValue('options'); $usercontext = vB::getUserContext($userinfo['userid']); $reppower = 0; if (!$usercontext->hasPermission('genericpermissions', 'canuserep')) { $reppower = 0; } else if ($usercontext->hasAdminPermission('cancontrolpanel') AND $vboptions['adminpower']) { $reppower = $vboptions['adminpower']; } else if (($userinfo['posts'] < $vboptions['minreputationpost']) OR ($userinfo['reputation'] < $vboptions['minreputationcount'])) { $reppower = 0; } else { $reppower = 1; if ($vboptions['pcpower']) { $reppower += intval($userinfo['posts'] / $vboptions['pcpower']); } if ($vboptions['kppower']) { $reppower += intval($userinfo['reputation'] / $vboptions['kppower']); } if ($vboptions['rdpower']) { $reppower += intval(intval((vB::getRequest()->getTimeNow() - $userinfo['joindate']) / 86400) / $vboptions['rdpower']); } } return $reppower; } } 