Пример #1
0
 public function f()
 {
     $plugin_name = $this->get('ur');
     $token = phpfox::getService('younetcore.core')->getToken($plugin_name);
     if (isset($token['m'])) {
         $token['title'] = phpfox::getLib('database')->select('title')->from(phpfox::getT('product'), 'p')->where('p.product_id = "' . $token['m'] . '"')->execute('getSlaveField');
     }
     phpfox::getBlock('younetcore.form', array('token' => $token));
     $this->html('#verify_lis', $this->getContent(false) . "<script>q();</script>");
 }
 public function addComment($aVals, $iUserId = null, $sUserName = null)
 {
     $aRow = $this->database()->select('m.review_id, m.description, u.full_name, u.user_id, u.gender, u.user_name')->from(phpfox::getT('review_activity'), 'm')->join(Phpfox::getT('user'), 'u', 'u.user_id = m.user_id')->where('m.review_id = ' . (int) $aVals['item_id'])->execute('getSlaveRow');
     if (!isset($aRow['review_id'])) {
         return false;
     }
     Phpfox::isModule('feed') ? Phpfox::getService('feed.process')->add($aVals['type'] . '_comment', $aVals['comment_id']) : null;
     if ($iUserId === null) {
         $iUserId = Phpfox::getUserId();
     }
     if (empty($aVals['parent_id'])) {
         $this->database()->updateCounter('review_activity', 'total_comment', 'review_id', $aVals['item_id']);
     }
     Phpfox::isModule('feed') ? Phpfox::getService('feed.process')->add($aVals['type'] . '_comment', $aVals['comment_id'], 0, 0, 0, $iUserId) : null;
     // Send the user an email
     $sLink = phpfox::getLib('url')->makeUrl($aRow['user_name'] . '.reviewactivity');
     Phpfox::getService('comment.process')->notify(array('user_id' => $aRow['user_id'], 'item_id' => $aRow['review_id'], 'owner_subject' => Phpfox::getPhrase('reviewactivity.full_name_commented_on_your_review_activities', array('full_name' => Phpfox::getUserBy('full_name'))), 'owner_message' => Phpfox::getPhrase('reviewactivity.full_name_commented_on_your_review_activities_to_see_the_comment_thread_follow_the_link_below_a', array('full_name' => Phpfox::getUserBy('full_name'), 'link' => $sLink)), 'owner_notification' => 'comment.add_new_comment', 'notify_id' => 'comment_reviewactivity', 'mass_id' => 'reviewactivity', 'mass_subject' => Phpfox::getPhrase('reviewactivity.full_name_commented_on_your_review_activities', array('full_name' => Phpfox::getUserBy('full_name'))), 'mass_message' => Phpfox::getPhrase('reviewactivity.full_name_commented_on_your_review_activities_to_see_the_comment_thread_follow_the_link_below_a', array('full_name' => Phpfox::getUserBy('full_name'), 'link' => $sLink))));
 }
Пример #3
0
 public function getPhpFoxProducts($isCache = false)
 {
     $aInserted = $this->getProductForQuickCheckFromLicenseTable();
     $aKeys = implode("','", array_keys($aInserted));
     $aRows = $this->database()->select('p.*,ync.params as yncparams,ync.is_active as yncstatus')->from(phpfox::getT('product'), 'p')->leftJoin(phpfox::getT('younetcore_license'), 'ync', 'ync.name = p.product_id')->where("p.product_id IN ('{$aKeys}')")->execute('getSlaveRows');
     return $aRows;
 }
 public function getReviewId($iId)
 {
     $aRow = $this->database()->select('ra.*,l.like_id AS is_liked,' . phpfox::getUserField())->from(phpfox::getT('review_activity'), 'ra')->join(phpfox::getT('user'), 'u', 'u.user_id = ra.user_id')->leftJoin(Phpfox::getT('like'), 'l', 'l.type_id = \'reviewactivity\' AND l.item_id = ra.review_id AND l.user_id = ' . Phpfox::getUserId())->where('ra.review_id = ' . (int) $iId)->execute('getRow');
     return $aRow;
 }
Пример #5
0
 public function getBlogWordPress($userID)
 {
     ($sPlugin = Phpfox_Plugin::get('blog.component_service_blog_get__start')) ? eval($sPlugin) : false;
     ($sPlugin = Phpfox_Plugin::get('blog.service_blog_get')) ? eval($sPlugin) : false;
     $limit = Phpfox::getUserParam('blog.number_of_export_blogs');
     if ($limit == -1) {
         $limit = $this->database()->select('COUNT(*)')->from(phpfox::getT('blog'), 'b')->where(1)->execute('getSlaveField');
     }
     if (defined('PHPFOX_IS_USER_PROFILE') && Phpfox::getUserId()) {
         if (Phpfox::isModule('privacy')) {
             $this->database()->select('p.item_id AS privacy_pass, ')->leftJoin(Phpfox::getT('privacy'), 'p', "p.item_id = blog.blog_id AND p.category_id = 'blog' AND p.user_id = " . Phpfox::getUserId());
         }
         if (Phpfox::isModule('friend')) {
             $this->database()->select('f.friend_id AS is_friend, ')->leftJoin(Phpfox::getT('friend'), 'f', "f.user_id = blog.user_id AND f.friend_user_id = " . Phpfox::getUserId());
         }
     }
     $aRows = $this->database()->select("blog.*,blog_text.text_parsed AS text," . Phpfox::getUserField())->from($this->_sTable, 'blog')->join(Phpfox::getT('blog_text'), 'blog_text', 'blog_text.blog_id = blog.blog_id')->join(Phpfox::getT('user'), 'u', 'u.user_id = blog.user_id')->where('blog.user_id = ' . $userID)->limit($limit)->order('blog.time_stamp DESC')->execute('getSlaveRows');
     $aCache = array();
     foreach ($aRows as $key => $aRow) {
         $categoryNames = $this->getBlogCategoryName($aRow['blog_id']);
         $comment = $this->getBlogComment($aRow['blog_id']);
         $sTitle = preg_replace('/\\&#?[\\d\\w]+[^;]$/', '', $aRow['title']);
         // cleaning special character;
         $aRows[$key]['title'] = $sTitle;
         $aRows[$key]['pubDate'] = date('Y-m-d:h:m', $aRow['time_stamp']);
         $aRows[$key]['upDate'] = date('Y-m-d:h:m', $aRow['time_update']);
         $aRows[$key]['category_name'] = $categoryNames;
         $aRows[$key]['comment'] = $comment;
     }
     ($sPlugin = Phpfox_Plugin::get('blog.component_service_blog_get__end')) ? eval($sPlugin) : false;
     $iOwnerUserId = $userID;
     return array($iOwnerUserId, $aRows);
 }
Пример #6
0
 /**
  * uninstall
  */
 public function uninstall()
 {
     $sPrefix = Phpfox::getParam(array('db', 'prefix'));
     //delete import and export menu from previous version
     $deleteSql = "DELETE FROM `" . phpfox::getT('menu') . "` WHERE (`var_name` LIKE '%menu_blog_import_blog%') OR (`var_name` LIKE '%menu_blog_export_blog%') OR (`var_name` LIKE '%menu_import_add_new_blog%') OR (`var_name` LIKE '%menu_export_add_new_blog%')";
     if (!$this->database()->query($deleteSql)) {
         return false;
     }
     /*  $deleteTable = "DROP TABLE IF EXISTS`".  Phpfox::getT('blog_importer')."`";
         if(!$this->database()->query($deleteTable))
         {
             return false;
         }*/
     $phrases = array(array('back', 'Back'), array('choose_a_file_from_your_computer', 'Choose a file from your computer'), array('have_a_blogger_export_file', 'Have a Blogger export file?'), array('have_a_wordpress_export_file', 'Have a WordPress export file?'), array('import_blog', 'Import blog'), array('import_blogger', 'Import blogger'), array('import_tumblr', 'Import tumblr'), array('import_wordpress', 'Import WordPress'), array('import_blog_s', 'Import Blogs'), array('export_blog_s', 'Export Blogs'), array('create_an_xml_file_wordpress_export', 'Create an xml wordpress export file'), array('create_an_xml_file_blogger_export', 'Create an xml blogger export file'), array('create_an_xml_file_tumblr_export', 'Create an xml tumblr export file'), array('maximum_size', 'Maximum file size: 10MB'), array('size', 'size'), array('tumblr_import_instruction', 'Original Tumblr blog name [<i>xyz</i>.tumblr.com, not your email address or custom domain]:'), array('upload_file_and_import', 'Upload file and import'), array('url', 'URL'), array('blog_import_instruction', 'If you have posts in another system, you can import those into this site. To get started, choose a system to import from below'), array('blogger', 'Blogger'), array('import_post_s_from_a_blogger_export_file', 'Import posts from a blogger export file.'), array('import_post_s_from_a_tumblr_username', 'Import posts from a tumblr Username'), array('import_post_s_from_a_wordpress_export_file', 'Import posts from a WordPress export file.'), array('tumblr', 'Tumblr'), array('wordpress', 'Wordpress'), array('menu_blog_import_blog', 'Import blog'), array('menu_blog_export_blog', 'Export blog'), array('menu_import_add_new_blog', 'Add new blog'), array('menu_export_add_new_blog', 'Add new blog'), array('user_setting_can_import_blog', 'Can import blog?'), array('user_setting_can_export_blog', 'Can export blog?'), array('user_setting_number_of_import_blogs', 'How many blogs can a user import?\\r\\n\\r\\nNote: Setting it to "-1" (without quotes) If you want user can import all'), array('user_setting_number_of_export_blogs', 'How many blogs can a user export?\\r\\n\\r\\nNote: Setting it to "-1" (without quotes) If you want user can export all'), array('blog_has_been_inserted', ' blog has been inserted'), array('blog_s_have_been_inserted', 'blogs have been inserted'), array('importing_records', 'Importing records...'), array('load_and_reading_file', 'Load and reading file...'), array('invalid_file', 'Invalid file'), array('there_is_no_any_blog_in_this_file_yet', 'Ther is no any blog in this file yet'), array('username_does_not_exist', 'Username does not exist'), array('please_choose_a_file', 'Please choose a file'), array('please_enter_a_username', 'Please enter a username'));
     if ($this->request()->get('req4') == 'install') {
         $phrases[] = array('admin_menu_uninstall_blog_importer', 'Uninstall blog Importer');
         $phrases[] = array('admin_menu_install_blog_importer', 'Install blog Importer');
     }
     $deleteSql = "DELETE FROM `" . phpfox::getT('language_phrase') . "` WHERE `var_name` IN(";
     foreach ($phrases as $index => $phrase) {
         $deleteSql .= "'" . $phrase[0] . "',";
     }
     $deleteSql = substr($deleteSql, 0, strlen($deleteSql) - 1) . ") AND module_id='blog'";
     if (!$this->database()->query($deleteSql)) {
         return false;
     }
     //add menus import and export for module
     //$menus = array('menu_blog_import_blog', 'menu_blog_export_blog', 'menu_import_add_new_blog', 'menu_export_add_new_blog');
     $deleteSql = "DELETE FROM `" . phpfox::getT('menu') . "` WHERE `var_name` IN('menu_blog_import_blog', 'menu_blog_export_blog','menu_import_add_new_blog', 'menu_export_add_new_blog') AND module_id='blog'";
     if (!$this->database()->query($deleteSql)) {
         return false;
     }
     //$settings = array('can_import_blog', 'can_import_blog', 'number_of_import_blogs', 'number_of_export_blogs');
     $deleteSql = "DELETE FROM `" . phpfox::getT('user_group_setting') . "` WHERE name IN('can_import_blog', 'can_export_blog', 'number_of_import_blogs', 'number_of_export_blogs') AND module_id='blog'";
     if (!$this->database()->query($deleteSql)) {
         return false;
     }
     // change uninstall to install state
     //insert install phrase
     /*if($this->request()->get('req4') == 'uninstall'){
     		$installPhrase = array('admin_menu_install_blog_importer', 'Install blog Importer');
     		$insertSql = "INSERT INTO `".$sPrefix."language_phrase` ( `language_id`, `module_id`, `product_id`, `version_id`, `var_name`, `text`, `text_default`, `added`) VALUES";
     		$insertSql .= "( 'en', 'blog', 'phpfox', '".PhpFox::getId()."', '".$installPhrase[0]."', '".$installPhrase[1]."', '".$installPhrase[1]."', ".PHPFOX_TIME." )";
     		if (!$this->database()->query($insertSql)){
     		return false;
     		}
     		}*/
     //insert into module menu;
     $sMenu = $this->database()->select('menu')->from(Phpfox::getT('module'))->where('module_id=\'blog\'')->execute('getField');
     $aMenu = unserialize($sMenu);
     unset($aMenu['blog.admin_menu_uninstall_blog_importer_v4_01']);
     $aMenu['blog.admin_menu_install_blog_importer_v4_01'] = array('url' => array('blog', 'installer', 'install'));
     $this->database()->update(Phpfox::getT('module'), array('menu' => serialize($aMenu)), 'module_id = \'blog\'');
     return true;
 }
Пример #7
0
 public function __construct()
 {
     $this->_sTable = phpfox::getT('notification');
     $this->_sTableLive = phpfox::getT('notification_live');
 }