/** * @param int $iId video_id * @return array in the format: * array( * 'title' => 'item title', <-- required * 'link' => 'makeUrl()'ed link', <-- required * 'paypal_msg' => 'message for paypal' <-- required * 'item_id' => int <-- required * 'user_id' => owner's user id <-- required * 'error' => 'phrase if item doesnt exit' <-- optional * 'extra' => 'description' <-- optional * 'image' => 'path to an image', <-- optional * 'image_dir' => 'photo.url_photo|... <-- optional (required if image) * ) */ public function getToSponsorThreadInfo($iId) { $aThread = $this->database()->select('fp.user_id, f.name, f.name_url, fpt.text_parsed as extra, fp.thread_id as item_id, ft.title, ft.title_url') ->from(Phpfox::getT('forum'),'f') ->join(Phpfox::getT('forum_thread'),'ft','ft.forum_id = f.forum_id') ->join(Phpfox::getT('forum_post'),'fp', 'fp.thread_id = ft.thread_id') ->join(Phpfox::getT('forum_post_text'),'fpt','fpt.post_id = fp.post_id') ->where('fp.post_id = ' . (int)$iId) ->execute('getSlaveRow'); if (empty($aThread)) { return array('error' => Phpfox::getPhrase('forum.sponsor_error_not_found')); } $aThread['title'] = Phpfox::getPhrase('forum.sponsor_title',array('sThreadTitle' => $aThread['title'])); $aThread['paypal_msg'] = PHpfox::getPhrase('forum.sponsor_paypal_message', array('sThreadTitle' => $aThread['title'])); $aThread['link'] = Phpfox::getLib('url')->makeUrl('forum.'.$aThread['name_url'].'.'.$aThread['title_url']); return $aThread; }