当前位置: 首页>>代码示例>>PHP>>正文


PHP Phpfox::permalink方法代码示例

本文整理汇总了PHP中Phpfox::permalink方法的典型用法代码示例。如果您正苦于以下问题:PHP Phpfox::permalink方法的具体用法?PHP Phpfox::permalink怎么用?PHP Phpfox::permalink使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Phpfox的用法示例。


在下文中一共展示了Phpfox::permalink方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: process

 /**
  * Controller
  */
 public function process()
 {
     $bIsUserProfile = $this->getParam('bIsProfile');
     if ($bIsUserProfile) {
         $aUser = $this->getParam('aUser');
     }
     Phpfox::getUserParam('pages.can_view_browse_pages', true);
     if ($this->request()->getInt('req2') > 0) {
         /*
         Phpfox_Module::instance()->setCacheBlockData(array(
         		'table' => 'pages_design_order',
         		'field' => 'page_id',
         		'item_id' => $this->request()->getInt('req2'),
         		'controller' => 'pages.view'
         	)
         );
         */
         return Phpfox_Module::instance()->setController('pages.view');
     }
     if (($iDeleteId = $this->request()->getInt('delete')) && Phpfox::getService('pages.process')->delete($iDeleteId)) {
         $this->url()->send('pages', array(), Phpfox::getPhrase('pages.page_successfully_deleted'));
     }
     $sView = $this->request()->get('view');
     if (defined('PHPFOX_IS_AJAX_CONTROLLER')) {
         $bIsProfile = true;
         $aUser = Phpfox::getService('user')->get($this->request()->get('profile_id'));
         $this->setParam('aUser', $aUser);
     } else {
         $bIsProfile = $this->getParam('bIsProfile');
         if ($bIsProfile === true) {
             $aUser = $this->getParam('aUser');
         }
     }
     if ($bIsProfile) {
         $this->template()->setTitle(Phpfox::getPhrase('pages.full_name_s_pages', array('full_name' => $aUser['full_name'])))->setBreadcrumb(Phpfox::getPhrase('pages.pages'), $this->url()->makeUrl($aUser['user_name'], array('pages')));
     } else {
         $this->template()->setTitle(Phpfox::getPhrase('pages.pages'))->setBreadcrumb(Phpfox::getPhrase('pages.pages'), $this->url()->makeUrl('pages'));
     }
     $this->search()->set(array('type' => 'pages', 'field' => 'pages.page_id', 'search_tool' => array('table_alias' => 'pages', 'search' => array('action' => $bIsProfile === true ? $this->url()->makeUrl($aUser['user_name'], array('pages', 'view' => $this->request()->get('view'))) : $this->url()->makeUrl('pages', array('view' => $this->request()->get('view'))), 'default_value' => Phpfox::getPhrase('pages.search_pages'), 'name' => 'search', 'field' => 'pages.title'), 'sort' => array('latest' => array('pages.time_stamp', Phpfox::getPhrase('pages.latest')), 'most-liked' => array('pages.total_like', Phpfox::getPhrase('pages.most_liked'))), 'show' => array(10, 15, 20))));
     $aBrowseParams = array('module_id' => 'pages', 'alias' => 'pages', 'field' => 'page_id', 'table' => Phpfox::getT('pages'), 'hide_view' => array('pending', 'my'));
     $aFilterMenu = array();
     if (!defined('PHPFOX_IS_USER_PROFILE')) {
         $aFilterMenu = array(Phpfox::getPhrase('pages.all_pages') => '', Phpfox::getPhrase('pages.my_pages') => 'my');
         if (!Phpfox::getParam('core.friends_only_community') && Phpfox::isModule('friend') && !Phpfox::getUserBy('profile_page_id')) {
             $aFilterMenu[Phpfox::getPhrase('pages.friends_pages')] = 'friend';
         }
         if (Phpfox::getUserParam('pages.can_moderate_pages')) {
             $iPendingTotal = Phpfox::getService('pages')->getPendingTotal();
             if ($iPendingTotal) {
                 $aFilterMenu['' . Phpfox::getPhrase('pages.pending_pages') . '<span class="pending">' . $iPendingTotal . '</span>'] = 'pending';
             }
         }
     }
     switch ($sView) {
         case 'my':
             Phpfox::isUser(true);
             $this->search()->setCondition('AND pages.app_id = 0 AND pages.view_id IN(0,1) AND pages.user_id = ' . Phpfox::getUserId());
             break;
         case 'pending':
             Phpfox::isUser(true);
             if (Phpfox::getUserParam('pages.can_moderate_pages')) {
                 $this->search()->setCondition('AND pages.app_id = 0 AND pages.view_id = 1');
             }
             break;
         default:
             if (Phpfox::getUserParam('privacy.can_view_all_items')) {
                 $this->search()->setCondition('AND pages.app_id = 0 ');
             } else {
                 $this->search()->setCondition('AND pages.app_id = 0 AND pages.view_id = 0 AND pages.privacy IN(%PRIVACY%)');
             }
             break;
     }
     // $this->template()->buildSectionMenu('pages', $aFilterMenu);
     $bIsValidCategory = false;
     if ($this->request()->get('req2') == 'category' && ($iCategoryId = $this->request()->getInt('req3')) && ($aType = Phpfox::getService('pages.type')->getById($iCategoryId))) {
         $bIsValidCategory = true;
         $this->setParam('iCategory', $iCategoryId);
         $this->template()->setBreadcrumb(Phpfox_Locale::instance()->convert($aType['name']), Phpfox::permalink('pages.category', $aType['type_id'], $aType['name']) . ($sView ? 'view_' . $sView . '/' . '' : ''), true);
     }
     if ($this->request()->get('req2') == 'sub-category' && ($iSubCategoryId = $this->request()->getInt('req3')) && ($aCategory = Phpfox::getService('pages.category')->getById($iSubCategoryId))) {
         $bIsValidCategory = true;
         $this->setParam('iCategory', $aCategory['type_id']);
         $this->template()->setBreadcrumb(Phpfox_Locale::instance()->convert($aCategory['type_name']), Phpfox::permalink('pages.category', $aCategory['type_id'], $aCategory['type_name']) . ($sView ? 'view_' . $sView . '/' . '' : ''));
         $this->template()->setBreadcrumb(Phpfox_Locale::instance()->convert($aCategory['name']), Phpfox::permalink('pages.sub-category', $aCategory['category_id'], $aCategory['name']) . ($sView ? 'view_' . $sView . '/' . '' : ''), true);
     }
     if (isset($aType['type_id'])) {
         $this->search()->setCondition('AND pages.type_id = ' . (int) $aType['type_id']);
     }
     if (isset($aType['category_id'])) {
         $this->search()->setCondition('AND pages.category_id = ' . (int) $aType['category_id']);
     } elseif (isset($aCategory['category_id'])) {
         $this->search()->setCondition('AND pages.category_id = ' . (int) $aCategory['category_id']);
     }
     if ($bIsUserProfile) {
         $this->search()->setCondition('AND pages.user_id = ' . (int) $aUser['user_id']);
     }
     $aPages = [];
//.........这里部分代码省略.........
开发者ID:noikiy,项目名称:phpfox-dist,代码行数:101,代码来源:index.class.php

示例2: get

 public function get()
 {
     $sType = Phpfox::getParam('themesupporter.block_video_type');
     $sCacheId = $this->cache()->set('brodev_themesupporter_video_' . $sType);
     if (!($aRecords = $this->cache()->get($sCacheId, 300))) {
         switch ($sType) {
             case 'Recently Uploaded Videos':
                 $sOrder = 'time_stamp desc';
                 break;
             case 'Most Viewed Videos':
                 $sOrder = 'total_view desc';
                 break;
             case 'Random Videos':
                 $sOrder = 'rand()';
                 break;
         }
         $aRecords = $this->database()->select('v.*, u.user_name as user_name, u.full_name as full_name')->from($this->_sTable, 'v')->leftJoin(Phpfox::getT('user'), 'u', 'v.user_id = u.user_id')->order($sOrder)->where('v.privacy = 0 AND v.in_process = 0 AND v.view_id = 0')->limit(Phpfox::getParam('themesupporter.block_video_number'))->execute('getRows');
         if (empty($aRecords)) {
             return false;
         }
         foreach ($aRecords as $iKey => $aRow) {
             $aRecords[$iKey]['link'] = Phpfox::permalink('video', $aRow['video_id'], $aRow['title']);
         }
         $this->cache()->save($sCacheId, $aRecords);
     }
     return $aRecords;
 }
开发者ID:PhpFoxPro,项目名称:Better-Mobile-Module,代码行数:27,代码来源:video.class.php

示例3: processRows

	public function processRows(&$aRows)
	{
		foreach ($aRows as $iKey => $aRow)
		{				
			$aRows[$iKey]['link'] = ($this->_aCallback !== false ? Phpfox::getLib('url')->makeUrl($this->_aCallback['url'][0], array_merge($this->_aCallback['url'][1], array($aRow['title']))) : Phpfox::permalink('video', $aRow['video_id'], $aRow['title']));
		}
	}
开发者ID:hoanghd,项目名称:tools,代码行数:7,代码来源:browse.class.php

示例4: process

 /**
  * Class process method wnich is used to execute this component.
  */
 public function process()
 {
     exit('Use AJAX method');
     Phpfox::isUser(true);
     if (!($iId = $this->request()->get('id'))) {
         return Phpfox_Error::display(Phpfox::getPhrase('video.id_must_be_defined'));
     }
     echo '<script type="text/javascript">';
     if (Phpfox::getService('video.convert')->process($iId)) {
         if ($this->request()->get('video-inline') == '1') {
             $iFeedId = Phpfox::getService('feed.process')->getLastId();
             echo 'window.parent.$.ajaxCall(\'video.displayFeed\', \'id=' . $iFeedId . '&video_id=' . $iId . '\', \'GET\');';
         } elseif ($this->request()->get('isajax')) {
             echo 'window.parent.Editor.insert({type: \'video\', id: \'' . (int) $iId . '\', editor_id: \'' . base64_decode($this->request()->get('editor-id')) . '\'});';
         } else {
             $aVideo = Phpfox::getService('video')->getForEdit($iId);
             echo 'window.parent.location.href = \'' . Phpfox::permalink('video', $aVideo['video_id'], $aVideo['title']) . '\';';
         }
     } else {
         Phpfox::getService('video.process')->delete($iId);
         echo 'window.parent.document.getElementById(\'js_video_upload_error\').style.display = \'block\';';
         echo 'window.parent.document.getElementById(\'js_video_upload_message\').innerHTML = \'' . implode('<br />', Phpfox_Error::get()) . '\';';
         echo 'window.parent.document.getElementById(\'js_upload_inner_form\').style.display = \'block\';';
         echo 'window.parent.document.getElementById(\'js_video_detail\').style.display = \'none\';';
         echo 'window.parent.document.getElementById(\'js_video_process\').style.display = \'none\';';
     }
     echo '</script>';
     exit;
 }
开发者ID:googlesky,项目名称:snsp.vn,代码行数:32,代码来源:convert.class.php

示例5: getReportRedirect

 public function getReportRedirect($iId)
 {
     $aApp = Phpfox::getService('apps')->getAppById($iId);
     if (empty($aApp)) {
         Phpfox_Error::add(Phpfox::getPhrase('apps.app_not_found'));
     }
     return Phpfox::permalink('apps', $iId, $aApp['app_title']);
 }
开发者ID:Lovinity,项目名称:EQM,代码行数:8,代码来源:callback.class.php

示例6: processRows

 public function processRows(&$aRows)
 {
     foreach ($aRows as $iKey => $aRow) {
         $aRows[$iKey]['link'] = Phpfox::permalink('apps', $aRow['app_id'], $aRow['app_title']);
         //Phpfox::getService('pages')->getUrl($aRow['page_id'], $aRow['title'], $aRow['vanity_url']);
         $aRows[$iKey]['aFeed'] = array('feed_display' => 'mini', 'comment_type_id' => 'pages', 'privacy' => 0, 'comment_privacy' => 0, 'like_type_id' => 'pages', 'feed_is_liked' => isset($aRow['is_liked']) ? $aRow['is_liked'] : false, 'item_id' => $aRow['page_id'], 'user_id' => $aRow['user_id'], 'total_comment' => $aRow['total_comment'], 'feed_total_like' => $aRow['total_like'], 'total_like' => $aRow['total_like'], 'feed_link' => Phpfox::getService('pages')->getUrl($aRow['page_id'], $aRow['pages_title'], $aRow['vanity_url']), 'feed_title' => $aRow['app_title']);
     }
 }
开发者ID:Lovinity,项目名称:EQM,代码行数:8,代码来源:browse.class.php

示例7: parseTemplate

 /**
  * parse text for showing on form based on the contest
  * it will replace some predefined symbol by the corresponding text
  * @by minhta
  * @param string $sToBeParsedText the text to be parsed 
  * @param array $aContest the corresponding contest
  * @return
  */
 public function parseTemplate($sToBeParsedText, $aContest, $iDonorId = 0, $iInviterId = 0)
 {
     //if a id of contest is passed
     if (!is_array($aContest)) {
         $aContest = Phpfox::getService('contest.contest')->getContestById($aContest);
     }
     $aContest['site_name'] = Phpfox::getParam('core.site_title');
     // in case we need inviter name
     if ($this->_iInviterId) {
         $aUser = Phpfox::getService('user')->getUser($this->_iInviterId);
         $aContest['inviter_name'] = $aUser['full_name'];
     }
     if ($this->_iEntryId) {
         $aEntry = Phpfox::getService('contest.entry')->getContestEntryById($this->_iEntryId);
         if ($aEntry) {
             $aContest['entry_name'] = $aEntry['title'];
             $sEntryUrl = Phpfox::permalink('contest', $aEntry['contest_id'], $aEntry['contest_name']) . 'entry_' . $aEntry['entry_id'] . '/';
             $aContest['entry_url'] = $sEntryUrl;
         }
     }
     if ($this->_iParticipantId) {
         $aParticipant = Phpfox::getService('contest.participant')->getParticipantById($this->_iParticipantId);
         $aUser = Phpfox::getService('user')->getUser($aParticipant['user_id']);
         $aContest['participant_name'] = $aUser['full_name'];
     }
     if ($this->_iEntryOwnerId) {
         $aUser = Phpfox::getService('user')->getUser($this->_iEntryOwnerId);
         $aContest['entry_owner_name'] = $aUser['full_name'];
     }
     $oDate = Phpfox::getLib('date');
     $aLink = Phpfox::getLib('url')->permalink('contest', $aContest['contest_id'], $aContest['contest_name']);
     $sLink = '<a href="' . $aLink . '" title = "' . $aContest['contest_name'] . '" target="_blank">' . $aLink . '</a>';
     $aContest['contest_url'] = $sLink;
     $format_datetime = 'l, F j, Y g:i a';
     $aContest['end_time'] = Phpfox::getTime($format_datetime, $aContest['end_time']);
     $aContest['stop_time'] = Phpfox::getTime($format_datetime, $aContest['stop_time']);
     $aContest['start_time'] = Phpfox::getTime($format_datetime, $aContest['start_time']);
     //the trick here ot send html email along with description
     $aContest['description'] = $aContest['description_parsed'];
     $aOnwerUser = Phpfox::getService('user')->getUser($aContest['user_id']);
     $aContest['owner_name'] = $aOnwerUser['full_name'];
     $aContest['award'] = $aContest['award_description'];
     $aBeReplaced = array();
     $aReplace = array();
     //setup replace and be replaced array
     foreach ($this->_aReplace as $sBeReplaced => $sReplace) {
         if (isset($aContest[$sReplace])) {
             $aBeReplaced[] = $sBeReplaced;
             $aReplace[] = $aContest[$sReplace];
         }
     }
     $sParsedText = str_replace($aBeReplaced, $aReplace, $sToBeParsedText);
     return $sParsedText;
 }
开发者ID:Lovinity,项目名称:EQM,代码行数:62,代码来源:process.class.php

示例8: processRows

 public function processRows(&$aRows)
 {
     foreach ($aRows as $iKey => $aRow) {
         if ($aRow['profile_id'] > 0) {
             $aRows[$iKey]['name'] = Phpfox::getPhrase('photo.profile_pictures');
             $aRows[$iKey]['link'] = Phpfox::permalink('photo.album.profile', $aRow['user_id'], $aRow['user_name']);
         } else {
             $aRows[$iKey]['link'] = Phpfox::permalink('photo.album', $aRow['album_id'], $aRow['name']);
         }
     }
 }
开发者ID:lev1976g,项目名称:core,代码行数:11,代码来源:browse.class.php

示例9: getPost

 public function getPost($iId)
 {
     ($sPlugin = Phpfox_Plugin::get('forum.service_post_getpost')) ? eval($sPlugin) : false;
     if (Phpfox::isModule('like')) {
         $this->database()->select('l.like_id AS is_liked, ')->leftJoin(Phpfox::getT('like'), 'l', 'l.type_id = \'forum_post\' AND l.item_id = fp.post_id AND l.user_id = ' . Phpfox::getUserId());
     }
     $aPost = $this->database()->select('fp.*, ' . (Phpfox::getParam('core.allow_html') ? 'fpt.text_parsed' : 'fpt.text') . ' AS text, ' . Phpfox::getUserField() . ', u.joined, u.country_iso, uf.signature, uf.total_post, ft.forum_id, ft.group_id, ft.user_id AS thread_user_id, ft.title AS thread_title')->from(Phpfox::getT('forum_post'), 'fp')->join(Phpfox::getT('forum_thread'), 'ft', 'ft.thread_id = fp.thread_id')->join(Phpfox::getT('forum_post_text'), 'fpt', 'fpt.post_id = fp.post_id')->join(Phpfox::getT('user'), 'u', 'u.user_id = fp.user_id')->join(Phpfox::getT('user_field'), 'uf', 'uf.user_id = fp.user_id')->where('fp.post_id = ' . $iId)->execute('getRow');
     $aPost['aFeed'] = array('privacy' => 0, 'comment_privacy' => 0, 'like_type_id' => 'forum_post', 'feed_is_liked' => $aPost['is_liked'] ? true : false, 'item_id' => $aPost['post_id'], 'user_id' => $aPost['user_id'], 'total_like' => $aPost['total_like'], 'feed_link' => Phpfox::permalink('forum.thread', $aPost['thread_id'], $aPost['thread_title']) . 'view_' . $aPost['post_id'] . '/', 'feed_title' => $aPost['thread_title'], 'feed_display' => 'mini', 'feed_total_like' => $aPost['total_like'], 'report_module' => 'forum_post', 'report_phrase' => Phpfox::getPhrase('forum.report_this_post'), 'time_stamp' => $aPost['time_stamp']);
     if ($aPost['total_attachment']) {
         list($iAttachmentCnt, $aPost['attachments']) = Phpfox::getService('attachment')->get('attachment.item_id = ' . $aPost['post_id'] . ' AND attachment.view_id = 0 AND attachment.category_id = \'forum\' AND attachment.is_inline = 0', 'attachment.attachment_id DESC', '', '', false);
     }
     $aPost['last_update_on'] = Phpfox::getPhrase('forum.last_update_on_time_stamp_by_update_user', array('time_stamp' => Phpfox::getTime(Phpfox::getParam('forum.forum_time_stamp'), $aPost['update_time']), 'update_user' => $aPost['update_user']));
     return $aPost;
 }
开发者ID:lev1976g,项目名称:core,代码行数:14,代码来源:post.class.php

示例10: getList

 public function getList()
 {
     $sCacheId = $this->cache()->set('music_genre');
     if (!($aRows = $this->cache()->get($sCacheId))) {
         $aRows = $this->database()->select('genre_id, name, name_url')->from($this->_sTable)->order('name ASC')->execute('getRows');
         $this->cache()->save($sCacheId, $aRows);
     }
     foreach ($aRows as $iKey => $aRow) {
         if ($sView = Phpfox_Request::instance()->get('view')) {
             $aRows[$iKey]['link'] = Phpfox::permalink('music.genre', $aRow['genre_id'], $aRow['name'], false, null, array('view' => $sView));
         } else {
             $aRows[$iKey]['link'] = Phpfox::permalink('music.genre', $aRow['genre_id'], $aRow['name']);
         }
     }
     return $aRows;
 }
开发者ID:nima7r,项目名称:phpfox-dist,代码行数:16,代码来源:genre.class.php

示例11: getForBrowse

 public function getForBrowse($iCategoryId = null)
 {
     // $sCacheId = $this->cache()->set('organization_category_browse' . ($iCategoryId === null ? '' : '_' . $iCategoryId));
     $aCategories = array();
     if ($iCategoryId > 0) {
         $aCategories = $this->database()->select('pc.*')->from($this->_sTable, 'pc')->where('pc.type_id = ' . (int) $iCategoryId . ' AND pc.is_active = 1')->order('pc.ordering ASC')->execute('getSlaveRows');
         foreach ($aCategories as $iKey => $aCategory) {
             $aCategories[$iKey]['link'] = Phpfox::permalink('organization.sub-category', $aCategory['category_id'], $aCategory['name']);
         }
         return $aCategories;
     }
     $aCategories = $this->database()->select('pt.*')->from(Phpfox::getT('organization_type'), 'pt')->where('pt.is_active = 1')->order('pt.ordering ASC')->execute('getSlaveRows');
     foreach ($aCategories as $iKey => $aCategory) {
         $aCategories[$iKey]['link'] = Phpfox::permalink('organization.category', $aCategory['type_id'], $aCategory['name']);
     }
     return $aCategories;
 }
开发者ID:laiello,项目名称:kr-indian,代码行数:17,代码来源:category.class.php

示例12: processRows

 public function processRows(&$aRows)
 {
     $oReq = Phpfox::getLib('request');
     foreach ($aRows as $iKey => $aRow) {
         $aRows[$iKey]['link'] = Phpfox::permalink('photo', $aRow['photo_id'], $aRow['title']);
         if (Phpfox::getUserId() && defined('PHPFOX_IS_USER_PROFILE') || $oReq->get('req1') == 'photo' && $oReq->get('view') == 'my') {
             $aRows[$iKey]['link'] .= 'userid_' . $aRow['user_id'] . '/';
         }
         $aRows[$iKey]['destination'] = Phpfox::getService('photo')->getPhotoUrl($aRow);
         if (Phpfox::getLib('request')->get('mode') == 'edit') {
             $sCategoryList = '';
             $aCategories = (array) $this->database()->select('category_id')->from(Phpfox::getT('photo_category_data'))->where('photo_id = ' . (int) $aRow['photo_id'])->execute('getSlaveRows');
             foreach ($aCategories as $aCategory) {
                 $sCategoryList .= $aCategory['category_id'] . ',';
             }
             $aRows[$iKey]['category_list'] = rtrim($sCategoryList, ',');
         }
     }
 }
开发者ID:Lovinity,项目名称:EQM,代码行数:19,代码来源:browse.class.php

示例13: execute

 public function execute()
 {
     if ($this->_sCategory !== null) {
         $sCategories = Phpfox::getService('video.category')->getAllCategories($this->_sCategory);
         $this->database()->innerJoin(Phpfox::getT('video_category_data'), 'vcd', 'vcd.video_id = m.video_id');
         $this->_aConditions[] = ' AND vcd.category_id IN(' . $sCategories . ')';
     }
     $this->_iCnt = $this->database()->select($this->_sCategory !== null ? 'COUNT(DISTINCT m.video_id)' : 'COUNT(*)')->from($this->_sTable, 'm')->where($this->_aConditions)->execute('getSlaveField');
     if ($this->_iCnt) {
         if ($this->_sCategory !== null) {
             $this->database()->innerJoin(Phpfox::getT('video_category_data'), 'vcd', 'vcd.video_id = m.video_id')->group('m.video_id');
         }
         $aVideos = $this->database()->select('m.*, ' . Phpfox::getUserField())->from($this->_sTable, 'm')->join(Phpfox::getT('user'), 'u', 'u.user_id = m.user_id')->where($this->_aConditions)->order($this->_sOrder)->group('m.video_id')->limit($this->_iPage, $this->_iPageSize, $this->_iCnt)->execute('getSlaveRows');
         foreach ($aVideos as $aVideo) {
             $aVideo['breadcrumb'] = Phpfox::getService('video.category')->getCategoriesById($aVideo['video_id']);
             $aVideo['link'] = Phpfox::permalink('video', $aVideo['video_id'], $aVideo['title']);
             $this->_aVideos[] = $aVideo;
         }
     }
 }
开发者ID:Lovinity,项目名称:EQM,代码行数:20,代码来源:browse.class.php

示例14: process

 /**
  * This controller orchestrates to register a new application
  */
 public function process()
 {
     $bIsAdd = $bIsEdit = false;
     Phpfox::getUserParam('apps.can_add_app', true);
     if (!Phpfox::getParam('apps.enable_api_support')) {
         //return Phpfox_Error::display('No api');
     }
     if ($aVals = $this->request()->getArray('app')) {
         $bIsAdd = true;
         $aApp = Phpfox::getService('apps.process')->addApp($aVals);
         if ($aApp == false) {
             $this->template()->assign(array('sErrorMessage' => Phpfox_Error::get()));
         } else {
             $this->url()->send('apps.add', array('id' => $aApp['app_id']), Phpfox::getPhrase('apps.app_successfully_created'));
         }
     }
     if (($iId = $this->request()->getInt('id')) && $this->request()->get('req2') == 'add') {
         // is editing an app
         $aApp = Phpfox::getService('apps')->getAppById($iId);
         $this->template()->assign('aForms', $aApp);
         $bIsEdit = true;
         $aMenus = array('general' => Phpfox::getPhrase('apps.general'), 'photo' => Phpfox::getPhrase('apps.photo'), 'url' => Phpfox::getPhrase('apps.url'));
         $this->template()->buildPageMenu('js_apps_block', $aMenus, array('link' => Phpfox::permalink('apps', $aApp['app_id'], $aApp['app_title']), 'phrase' => Phpfox::getPhrase('apps.view_this_app')));
         if ($aVals = $this->request()->getArray('val')) {
             if (Phpfox::getService('apps.process')->updateApp($aVals, $aApp)) {
                 $this->url()->send('apps.add', array('id' => $aApp['app_id']), Phpfox::getPhrase('apps.successfully_updated_the_app'));
             }
         }
         // check that this user is owner of the app
         // we can have a user group setting here
         if ($aApp['user_id'] != Phpfox::getUserId() && !Phpfox::isAdmin()) {
             Phpfox_Error::display(Phpfox::getPhrase('apps.you_are_not_allowed_to_edit_this_app'));
         } else {
             $this->template()->assign(array('aApp' => $aApp))->setHeader(array('index.js' => 'module_apps'));
         }
     }
     $aCategories = Phpfox::getService('apps.category')->getAllCategories();
     $this->template()->setTitle($bIsEdit ? Phpfox::getPhrase('apps.editing_app') . ': ' . $aApp['app_title'] : Phpfox::getPhrase('apps.create_an_app'))->setFullSite()->setBreadcrumb(Phpfox::getPhrase('apps.apps'), $this->url()->makeUrl('apps'))->setBreadcrumb($bIsEdit ? Phpfox::getPhrase('apps.editing_app') . ': ' . $aApp['app_title'] : Phpfox::getPhrase('apps.create_an_app'), $this->url()->makeUrl('apps.add'), true)->assign(array('aCategories' => $aCategories));
 }
开发者ID:Lovinity,项目名称:EQM,代码行数:42,代码来源:add.class.php

示例15: get

 public function get($iId = 0)
 {
     /*
     @title
     @info Get all public blogs. If you pass a user ID# it will return the blogs for that user. If you pass a blog ID# it will just return that blog.
     @method GET
     @extra user_id=#{User ID# of a specific user|int|no}&id=#{Blog ID# if you wish to return a specific blog|int|no}
     @return id=#{ID# for the blog|int}&title=#{Title of the blog|string}&permalink=#{Link to the blog|string}&likes=#{Total number of likes|int}&content=#{Blog content|string}&created_by=#{User that created the blog|string}&created_by_url=#{Link to the users profile|string}
     */
     if ((int) $this->_oApi->get('id') !== 0) {
         $iId = $this->_oApi->get('id');
     }
     $iUserId = $this->_oApi->get('user_id');
     $iCnt = $this->database()->select('COUNT(*)')->from($this->_sTable, 'b')->where(empty($iId) ? '' . (empty($iUserId) ? '' : 'b.user_id = ' . (int) $iUserId . ' AND ') . ' b.is_approved = 1 AND b.privacy = 0 AND b.post_status = 1' : 'b.blog_id = ' . (int) $iId)->execute('getSlaveField');
     $this->_oApi->setTotal($iCnt);
     $aRows = $this->database()->select('b.*, bt.text_parsed, ' . Phpfox::getUserField())->from($this->_sTable, 'b')->join(Phpfox::getT('user'), 'u', 'u.user_id = b.user_id')->join(Phpfox::getT('blog_text'), 'bt', 'bt.blog_id = b.blog_id')->where(empty($iId) ? '' . (empty($iUserId) ? '' : 'b.user_id = ' . (int) $iUserId . ' AND ') . ' b.is_approved = 1 AND b.privacy = 0 AND b.post_status = 1' : 'b.blog_id = ' . (int) $iId)->limit($this->_oApi->get('page'), 10, $iCnt)->order('b.time_stamp DESC')->execute('getSlaveRows');
     $aReturn = array();
     foreach ($aRows as $iKey => $aRow) {
         $aReturn[$iKey] = array('id' => $aRow['blog_id'], 'title' => $aRow['title'], 'likes' => $aRow['total_like'], 'permalink' => Phpfox::permalink('blog', $aRow['blog_id'], $aRow['title']), 'content' => Phpfox::getLib('parse.output')->parse($aRow['text_parsed']), 'created_by' => $aRow['full_name'], 'created_by_url' => Phpfox::getLib('url')->makeUrl($aRow['user_name']));
     }
     return $aReturn;
 }
开发者ID:googlesky,项目名称:snsp.vn,代码行数:22,代码来源:api.class.php


注:本文中的Phpfox::permalink方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。