本文整理汇总了PHP中Phpfox::getT方法的典型用法代码示例。如果您正苦于以下问题:PHP Phpfox::getT方法的具体用法?PHP Phpfox::getT怎么用?PHP Phpfox::getT使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Phpfox
的用法示例。
在下文中一共展示了Phpfox::getT方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: query
public function query($sQuery, $iPage, $iTotalShow, $sView = null)
{
if ($sView !== null && Phpfox::isModule($sView))
{
$aModuleResults = Phpfox::callback($sView . '.globalUnionSearch', $this->preParse()->clean($sQuery));
}
else
{
$aModuleResults = Phpfox::massCallback('globalUnionSearch', $this->preParse()->clean($sQuery));
}
$iOffset = ($iPage * $iTotalShow);
$aRows = $this->database()->select('item.*, ' . Phpfox::getUserField())
->unionFrom('item')
->join(Phpfox::getT('user'), 'u', 'u.user_id = item.item_user_id')
->limit($iOffset, $iTotalShow)
->order('item_time_stamp DESC')
->execute('getSlaveRows');
$aResults = array();
foreach ($aRows as $iKey => $aRow)
{
$aResults[] = array_merge($aRow, (array) Phpfox::callback($aRow['item_type_id'] . '.getSearchInfo', $aRow));
}
return $aResults;
}
示例2: get
/**
* Gets the featured members according to Phpfox::getParam('user.how_many_featured_members').
* Uses cache to save a query (stores a cache if none found)
* @return array( array of users, int total featured users )
*/
public function get()
{
if ($sPlugin = Phpfox_Plugin::get('user.service_featured_get_1')) {
eval($sPlugin);
if (isset($mPluginReturn)) {
return $mPluginReturn;
}
}
$iTotal = Phpfox::getParam('user.how_many_featured_members');
// the random will be done with php logic
$sCacheId = $this->cache()->set('featured_users');
if (!($aUsers = $this->cache()->get($sCacheId))) {
$aUsers = $this->database()->select(Phpfox::getUserField() . ', uf.ordering')->from(Phpfox::getT('user'), 'u')->join($this->_sTable, 'uf', 'uf.user_id = u.user_id')->order('ordering DESC')->execute('getSlaveRows');
if (Phpfox::getParam('user.cache_featured_users')) {
$this->cache()->save($sCacheId, $aUsers);
}
}
if (!is_array($aUsers)) {
return array(array(), 0);
}
$aOut = array();
if (Phpfox::getParam('user.randomize_featured_members')) {
shuffle($aUsers);
}
$iCount = count($aUsers);
// using count instead of $this->database()->limit to measure the real value
for ($i = 0; $i <= $iTotal; $i++) {
if (!isset($aUsers[$iCount - $i])) {
continue;
}
// availability check
$aOut[] = $aUsers[$iCount - $i];
}
return array($aOut, count($aUsers));
}
示例3: setHash
public function setHash($sCode)
{
if (Phpfox::getParam('core.store_only_users_in_session')) {
$oRequest = Phpfox::getLib('request');
$oSession = Phpfox::getLib('session');
$sSessionHash = $oSession->get('sessionhash');
$bCreate = true;
if (!empty($sSessionHash)) {
$bCreate = false;
$aRow = $this->database()->select('*')->from(Phpfox::getT('log_session'))->where('session_hash = \'' . $this->database()->escape($sSessionHash) . '\'')->execute('getSlaveRow');
if (isset($aRow['session_hash'])) {
$this->database()->update(Phpfox::getT('log_session'), array('captcha_hash' => $this->_getHash($sCode, $sSessionHash)), "session_hash = '" . $sSessionHash . "'");
} else {
$bCreate = true;
}
}
if ($bCreate) {
$sSessionHash = $oRequest->getSessionHash();
$this->database()->insert(Phpfox::getT('log_session'), array('session_hash' => $sSessionHash, 'id_hash' => $oRequest->getIdHash(), 'captcha_hash' => $this->_getHash($sCode, $sSessionHash), 'user_id' => Phpfox::getUserId(), 'last_activity' => PHPFOX_TIME, 'location' => '', 'is_forum' => '0', 'forum_id' => 0, 'im_hide' => 0, 'ip_address' => '', 'user_agent' => ''));
$oSession->set('sessionhash', $sSessionHash);
}
} else {
$iId = $this->_oSession->getSessionId();
$this->database()->update(Phpfox::getT('log_session'), array('captcha_hash' => $this->_getHash($sCode, $iId)), "session_hash = '" . $iId . "'");
}
}
示例4: export
public function export($sProduct, $sModuleId = null)
{
$aCond = array();
$aCond[] = "me.product_id = '" . $this->database()->escape($sProduct) . "'";
if ($sModuleId !== null) {
$aCond[] = "AND me.module_id = '" . $sModuleId . "'";
}
$aRows = $this->database()->select('me.*, m.module_id AS module_name, p.title AS product_name, pm.var_name as parent_var_name')->from($this->_sTable, 'me')->join(Phpfox::getT('module'), 'm', 'm.module_id = me.module_id')->join(Phpfox::getT('product'), 'p', 'p.product_id = me.product_id')->leftjoin(Phpfox::getT('menu'), 'pm', 'pm.menu_id = me.parent_id')->where($aCond)->execute('getRows');
if (!count($aRows)) {
return false;
}
$oXmlBuilder = Phpfox::getLib('xml.builder');
$oXmlBuilder->addGroup('menus');
foreach ($aRows as $aRow) {
if (!empty($aRow['disallow_access'])) {
$aGroups = unserialize($aRow['disallow_access']);
$aRow['disallow_access'] = array();
foreach ($aGroups as $iGroup) {
if (!in_array($iGroup, array(1, 2, 3, 4))) {
continue;
}
$aRow['disallow_access'][] = $iGroup;
}
$aRow['disallow_access'] = serialize($aRow['disallow_access']);
}
$aTag = array('module_id' => $aRow['module_id'], 'parent_var_name' => $aRow['parent_var_name'], 'm_connection' => $aRow['m_connection'], 'var_name' => $aRow['var_name'], 'ordering' => $aRow['ordering'], 'url_value' => $aRow['url_value'], 'version_id' => $aRow['version_id'], 'disallow_access' => $aRow['disallow_access'], 'module' => $aRow['module_name']);
if (!empty($aRow['mobile_icon'])) {
$aTag['mobile_icon'] = $aRow['mobile_icon'];
}
$oXmlBuilder->addTag('menu', '', $aTag);
}
$oXmlBuilder->closeGroup();
return true;
}
示例5: get
public function get($iContestId, $iPage = 0, $iLimit = 20)
{
$where = 'cta.contest_id = ' . $iContestId;
$iCnt = $this->database()->select('count(*)')->from($this->_sTable, 'cta')->join(Phpfox::getT('user'), 'u', 'u.user_id = cta.user_id')->where($where)->execute('getSlaveField');
$aRows = $this->database()->select('*')->from($this->_sTable, 'cta')->join(Phpfox::getT('user'), 'u', 'u.user_id = cta.user_id')->where($where)->limit($iPage, $iLimit)->execute('getSlaveRows');
return array($iCnt, $aRows);
}
示例6: getFriends
public function getFriends()
{
if ((int) $this->_oApi->get('user_id') === 0) {
$iUserId = $this->_oApi->getUserId();
} else {
$iUserId = $this->_oApi->get('user_id');
}
if ($this->_oApi->isAllowed('friend.get_friends') == false) {
return $this->_oApi->error('friend.get_friends', 'User did not to view friends list');
}
$iCnt = $this->database()->select('COUNT(*)')->from($this->_sTable, 'f')->join(Phpfox::getT('user'), 'u', 'u.user_id = f.friend_user_id')->where('f.is_page = 0 AND f.user_id = ' . (int) $iUserId)->execute('getSlaveField');
$this->_oApi->setTotal($iCnt);
$aRows = $this->database()->select('u.user_id, u.user_name, u.full_name, u.joined, u.user_image, u.country_iso, u.gender')->from($this->_sTable, 'f')->join(Phpfox::getT('user'), 'u', 'u.user_id = f.friend_user_id')->where('f.is_page = 0 AND f.user_id = ' . (int) $iUserId)->limit($this->_oApi->get('page'), 10, $iCnt)->execute('getSlaveRows');
$aFriends = array();
foreach ($aRows as $iKey => $aRow) {
unset($aRows[$iKey]['user_name'], $aRows[$iKey]['country_iso'], $aRows[$iKey]['gender'], $aRows[$iKey]['joined']);
if (!$this->_oApi->isAllowed('user.get_full_name', null, $aRow['user_id'])) {
unset($aRows[$iKey]['full_name']);
} else {
$aRows[$iKey]['name'] = $aRow['full_name'];
}
if (!$this->_oApi->isAllowed('user.get_email', null, $aRow['user_id'])) {
unset($aRows[$iKey]['email']);
}
$sImagePath = $aRow['user_image'];
$aRows[$iKey]['photo_50px'] = Phpfox::getLib('image.helper')->display(array('user' => $aRow, 'suffix' => '_50', 'return_url' => true));
$aRows[$iKey]['photo_50px_square'] = Phpfox::getLib('image.helper')->display(array('user' => $aRow, 'suffix' => '_50_square', 'return_url' => true));
$aRows[$iKey]['photo_120px'] = Phpfox::getLib('image.helper')->display(array('user' => $aRow, 'suffix' => '_120', 'return_url' => true));
$aRows[$iKey]['permalink'] = Phpfox::getLib('url')->makeUrl($aRow['user_name']);
unset($aRows[$iKey]['user_image']);
}
return $aRows;
}
示例7: getNotificationAction
/** This function catches all the "actions" (Dislike, and in the future maybe others)
* */
public function getNotificationAction($aNotification)
{
//d($aNotification);die();
// get the type of item that was marked ("blog", "photo"...)
$aAction = $this->database()->select('*')->from(Phpfox::getT('action'))->where('action_id = ' . (int) $aNotification['item_id'])->limit(1)->execute('getSlaveRow');
if (empty($aAction) || !isset($aAction['item_type_id'])) {
return false;
throw new Exception('No type for this action (' . print_r($aAction, true) . ')');
}
// Check if the module is a sub module
if (preg_match('/(?P<module>[a-z]+)[_]?(?P<submodule>[a-z]{0,99})/i', $aAction['item_type_id'], $aMatch) < 1) {
throw new Exception('Malformed item_type');
}
// Call the module and get the title
if (!Phpfox::isModule($aMatch['module'])) {
return false;
}
$aRow = Phpfox::getService($aMatch['module'])->getInfoForAction($aAction);
$sUsers = Phpfox::getService('notification')->getUsers($aNotification);
$sTitle = Phpfox::getLib('parse.output')->shorten($aRow['title'], Phpfox::getParam('notification.total_notification_title_length'), '...');
$sPhrase = '';
if ($aNotification['user_id'] == $aRow['user_id']) {
// {users} disliked {gender} own {item} "{title}"
$sPhrase = Phpfox::getPhrase('like.users_disliked_gender_own_item_title', array('users' => $sUsers, 'gender' => Phpfox::getService('user')->gender($aRow['gender'], 1), 'title' => $sTitle, 'item' => $aAction['item_type_id']));
} elseif ($aRow['user_id'] == Phpfox::getUserId()) {
// {users} liked your blog "{title}"
$sPhrase = Phpfox::getPhrase('like.users_disliked_your_item_title', array('users' => $sUsers, 'title' => $sTitle, 'item' => $aAction['item_type_id']));
} else {
$sPhrase = Phpfox::getPhrase('like.users_disliked_users_item', array('users' => $sUsers, 'row_full_name' => $aRow['full_name'], 'title' => $sTitle, 'item' => $aAction['item_type_id']));
}
return array('link' => $aRow['link'], 'message' => $sPhrase, 'icon' => Phpfox_Template::instance()->getStyle('image', 'activity.png', 'blog'));
}
示例8: newUploadComplete
public function newUploadComplete()
{
Phpfox::isUser(true);
$bCanAddVideo = false;
$aServer = $this->get('_v');
$aVideoServers = Phpfox::getParam('video.convert_servers');
foreach ($aVideoServers as $sServer) {
if (md5($sServer) == $aServer['url']) {
$mReturn = json_decode(Phpfox::getLib('request')->send($sServer, array('action' => 'check', '_v_id' => $aServer['id'], '_v_secret' => Phpfox::getParam('video.convert_servers_secret'))));
if (!$mReturn->error) {
$bCanAddVideo = true;
break;
}
}
}
if ($bCanAddVideo) {
$aVals = $this->get('val');
$aVideo = $this->get('video');
if (($iId = Phpfox::getService('video.process')->add($aVals, $aVideo)) !== false) {
$aVideo = Phpfox::getService('video')->getForEdit($iId, true);
Phpfox::getLib('database')->update(Phpfox::getT('video'), array('custom_v_id' => $aServer['id']), 'video_id = ' . (int) $aVideo['video_id']);
$this->call('window.location.href = \'' . Phpfox::permalink('video', $aVideo['video_id'], $aVideo['title']) . '\';');
}
}
}
示例9: process
public function process()
{
$aUser = $this->getParam('aUser');
#
# Check User Privacy Settings
if (!Phpfox::getService('user.privacy')->hasAccess($aUser['user_id'], 'megapoke.who_can_poke')) {
return false;
}
# Check for User Group Permission
if (!Phpfox::getUserParam('megapoke.canmegapoke')) {
return false;
}
# User can't Poke themself
if ($aUser['user_id'] == Phpfox::getUserId()) {
return false;
}
# User must be logged in to Poke
if (!Phpfox::getUserId()) {
return false;
}
#GET POKES
$aPokes = phpfox::getLib('phpfox.database')->select('*')->from(Phpfox::getT('megapoke'))->where("poke_active = '0' ")->order('poke_text')->execute('getSlaveRows');
$this->template()->assign(array('sHeader' => Phpfox::getPhrase('megapoke.profilepoketitle'), 'aPokes' => $aPokes, 'sSendText' => Phpfox::getPhrase('megapoke.poke_send', array('user_name' => $aUser['full_name'])), 'pokeFormUrl' => Phpfox::getLib('url')->makeUrl('megapoke')));
return 'block';
}
示例10: export
public function export($sProductId, $sModuleId = null)
{
$aWhere = array();
$aWhere[] = "block.product_id = '" . $sProductId . "'";
if ($sModuleId !== null) {
$aWhere[] = " AND block.module_id = '" . $sModuleId . "'";
}
$aRows = $this->database()->select('block.*, product.title AS product_name, m.module_id AS module_name, bs.source_code, bs.source_parsed')->from($this->_sTable, 'block')->leftJoin(Phpfox::getT('block_source'), 'bs', 'bs.block_id = block.block_id')->leftJoin(Phpfox::getT('product'), 'product', 'product.product_id = block.product_id')->leftJoin(Phpfox::getT('module'), 'm', "m.module_id = block.module_id")->where($aWhere)->execute('getRows');
if (!isset($aRows[0]['product_name'])) {
return Phpfox_Error::set(Phpfox::getPhrase('admincp.product_does_not_have_any_settings'));
}
if (!count($aRows)) {
return false;
}
$oXmlBuilder = Phpfox::getLib('xml.builder');
$oXmlBuilder->addGroup('blocks');
foreach ($aRows as $aRow) {
$oXmlBuilder->addGroup('block', array('type_id' => $aRow['type_id'], 'm_connection' => $aRow['m_connection'], 'module_id' => $aRow['module_name'], 'component' => $aRow['component'], 'location' => $aRow['location'], 'is_active' => $aRow['is_active'], 'ordering' => $aRow['ordering'], 'disallow_access' => $aRow['disallow_access'], 'can_move' => $aRow['can_move']));
$oXmlBuilder->addTag('title', $aRow['title']);
$oXmlBuilder->addTag('source_code', empty($aRow['source_code']) ? '' : $aRow['source_code']);
$oXmlBuilder->addTag('source_parsed', empty($aRow['source_parsed']) ? '' : $aRow['source_parsed']);
$oXmlBuilder->closeGroup();
}
$oXmlBuilder->closeGroup();
return true;
}
示例11: removeCacheUrl
public function removeCacheUrl()
{
$iUrlId = (int) $this->get('iUrlId');
$sUrl = $aCache = Phpfox::getLib('database')->select('u.url')->from(Phpfox::getT('ko_generator_cache_url'), 'u')->where('u.url_id =' . $iUrlId)->execute('getField');
Phpfox::getService('generator.image.process')->ignore($sUrl);
Phpfox::getService('generator.cache.process')->removeCacheUrl($iUrlId);
}
示例12: updateOrdering
public function updateOrdering($aVal)
{
foreach ($aVal as $iId => $iPosition) {
$this->database()->update(Phpfox::getT('contact_category'), array('ordering' => (int) $iPosition), 'category_id = ' . (int) $iId);
}
$this->renewCache();
}
示例13: add
public function add($aVals)
{
if (!isset($aVals['agree'])) {
Phpfox_Error::set('Check our agreement in order to join our site.');
return false;
}
if (!filter_var($aVals['organization_email'], FILTER_VALIDATE_EMAIL)) {
Phpfox_Error::set('Provide a valid email address.');
return false;
}
if (strlen($aVals['organization_password']) < 6) {
Phpfox_Error::set('Not a valid password.');
return false;
}
$aInsert = array('view_id' => 0, 'type_id' => isset($aVals['type_id']) ? (int) $aVals['type_id'] : 2, 'app_id' => isset($aVals['app_id']) ? (int) $aVals['app_id'] : 0, 'category_id' => isset($aVals['category_id']) ? (int) $aVals['category_id'] : 2, 'user_id' => 0, 'title' => $this->preParse()->clean($aVals['organization_name']), 'founder' => $aVals['organization_founder'], 'mission_statement' => $aVals['organization_mission'], 'phone' => $aVals['organization_phone'], 'website' => $aVals['organization_website'], 'time_stamp' => PHPFOX_TIME);
$iId = $this->database()->insert(Phpfox::getT('organization'), $aInsert);
$aInsertText = array('organization_id' => $iId);
if (isset($aVals['info'])) {
$aInsertText['text'] = $this->preParse()->clean($aVals['info']);
$aInsertText['text_parsed'] = $this->preParse()->prepare($aVals['info']);
}
$this->database()->insert(Phpfox::getT('organization_text'), $aInsertText);
$sSalt = $this->_getSalt();
$iUserId = $this->database()->insert(Phpfox::getT('user'), array('profile_organization_id' => $iId, 'user_group_id' => NORMAL_USER_ID, 'view_id' => '7', 'full_name' => $this->preParse()->clean($aVals['organization_name']), 'joined' => PHPFOX_TIME, 'email' => $aVals['organization_email'], 'password' => Phpfox::getLib('hash')->setHash($aVals['organization_password'], $sSalt), 'password_salt' => $sSalt));
$this->database()->update(Phpfox::getT('user'), array('user_name' => 'profile-' . $iUserId), 'user_id=' . $iUserId);
$this->database()->update(Phpfox::getT('organization'), array('user_id' => $iUserId), 'organization_id=' . $iId);
$aExtras = array('user_id' => $iUserId);
$this->database()->insert(Phpfox::getT('user_activity'), $aExtras);
$this->database()->insert(Phpfox::getT('user_field'), $aExtras);
$this->database()->insert(Phpfox::getT('user_space'), $aExtras);
$this->database()->insert(Phpfox::getT('user_count'), $aExtras);
Phpfox::getService('user.activity')->update(Phpfox::getUserId(), 'organization');
Phpfox::getService('like.process')->add('organization', $iId);
return $iId;
}
示例14: getMessages
/**
* Get the latest shoutouts.
*
* @param int $iLimit Define the limit so we don't return all the shoutouts.
* @return array Array of shoutouts.
*/
public function getMessages($iLimit = 5)
{
if (isset($this->_aCallback['module'])) {
if (Phpfox::hasCallback($this->_aCallback['module'], 'getShoutboxData')) {
$aCallback = Phpfox::callback($this->_aCallback['module'] . '.getShoutboxData');
if (isset($aCallback['table'])) {
$this->_sTable = Phpfox::getT($aCallback['table']);
$this->database()->where('item_id = ' . (int) $this->_aCallback['item']);
}
}
}
$aMessages = $this->database()->select('s.shout_id, s.text, s.time_stamp, ' . Phpfox::getUserField())->from($this->_sTable, 's')->join(Phpfox::getT('user'), 'u', 'u.user_id = s.user_id')->limit($iLimit)->order('s.time_stamp DESC')->execute('getSlaveRows');
foreach ($aMessages as $iKey => $aMessage) {
$aMessage['text'] = Phpfox::getLib('parse.output')->replaceHashTags(Phpfox::getLib('parse.output')->split(Phpfox::getLib('parse.output')->clean($aMessage['text']), Phpfox::getParam('shoutbox.shoutbox_wordwrap')));
if (Phpfox::isModule('emoticon')) {
$aMessages[$iKey]['text'] = Phpfox::getService('emoticon')->parse($aMessage['text']);
}
$aMessages[$iKey]['module'] = isset($this->_aCallback['module']) ? $this->_aCallback['module'] : '';
}
// FUDGE Lovinity January 5, 2016: Filter shouts by users who have been blocked or are blocking
$bIsBlocked = Phpfox::getService('user.block')->isBlocked($aMessages[$iKey]['user_id'], Phpfox::getUserId());
$bIsBlocked2 = Phpfox::getService('user.block')->isBlocked(Phpfox::getUserId(), $aMessages[$iKey]['user_id']);
if ($bIsBlocked || $bIsBlocked2) {
$aMessages[$iKey]['text'] = '<img src="file/public/blocked.png">';
}
// END FUDGE
return $aMessages;
}
示例15: deleteCategory
/**
* Deletes a category
* @param int $iId
* @return bool
*/
public function deleteCategory($iId)
{
Phpfox::isAdmin(true);
$this->database()->delete(Phpfox::getT('app_category'), 'category_id = ' . (int) $iId);
$this->database()->delete(Phpfox::getT('app_category_data'), 'category_id = ' . (int) $iId);
return true;
}