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';
 }
Beispiel #2
0
 public function process()
 {
     if ($_POST['poke_user'] and $_POST['poke_userid'] and $_POST['poke_type_id']) {
         # Check User Privacy Settings
         if (!Phpfox::getService('user.privacy')->hasAccess($_POST['poke_userid'], 'megapoke.who_can_poke')) {
             $this->url()->send($_POST['poke_user'], null, Phpfox::getPhrase('megapoke.user_turned_off_megapoke'));
             exit;
         }
         if (Phpfox::getUserId() == $_POST['poke_userid']) {
             $this->url()->send($_POST['poke_user'], null, Phpfox::getPhrase('megapoke.you_can_not_send_yourself_a_megapoke'));
             exit;
         }
         # Flood Control: 2 mins
         $time = time() - 120;
         $aFlood = phpfox::getLib('phpfox.database')->select('*')->from(Phpfox::getT('feed'))->where("type_id = 'megapoke' and user_id = '" . Phpfox::getUserId() . "' and  time_stamp > '" . $time . "' ")->execute('getSlaveRow');
         if (isset($aFlood['feed_id'])) {
             $this->url()->send($_POST['poke_user'], null, Phpfox::getPhrase('megapoke.too_many_megapokes'));
             exit;
         }
         # Get Poke Type
         $aPoke = phpfox::getLib('phpfox.database')->select('*')->from(Phpfox::getT('megapoke'))->where("poke_type_id = '" . Phpfox::getLib('phpfox.database')->escape($_POST['poke_type_id']) . "' ")->execute('getSlaveRow');
         $d = array();
         $d['content'] = $aPoke['poke_text'];
         $oUrl = Phpfox::getLib('url');
         $oParseOutput = Phpfox::getLib('parse.output');
         #Insert into Feed
         if (Phpfox::getUserParam('megapoke.showpokesinfeed')) {
             $d['type_id'] = 'megapoke';
             $d['user_id'] = Phpfox::getUserId();
             $d['item_user_id'] = Phpfox::getLib('phpfox.database')->escape($_POST['poke_userid']);
             $d['time_stamp'] = time();
             phpfox::getLib('phpfox.database')->insert(Phpfox::getT('feed'), $d);
             if (Phpfox::isModule('modsfox')) {
                 $ryansFeedStatus = Phpfox::getPhrase('megapoke.ryans_feed_status', array('viewer_link' => $oUrl->makeUrl('') . "" . $_POST['poke_user'], 'viewer_full_name' => Phpfox::getLib('parse.output')->clean($_POST['poke_user_full_name']), 'content' => $aPoke['poke_text']));
                 $sType = 'status';
                 $js_user = Phpfox::getUserId();
                 $js_mood = "";
                 Phpfox::getService('modsfox.status')->add($sType, $ryansFeedStatus, $js_mood, $js_user);
             }
         }
         # Add Notification
         if (Phpfox::isModule('notification')) {
             Phpfox::getService('notification.process')->add('megapoke', $aPoke['poke_type_id'], $_POST['poke_userid'], Phpfox::getUserId());
         }
         # Get User Info
         $aUserFrom = Phpfox::getLib('phpfox.database')->select(str_replace("u.", "", Phpfox::getUserField()))->from(Phpfox::getT('user'))->where("user_id = '" . Phpfox::getUserId() . "'")->execute('getSlaveRow');
         $d['user_link'] = $oUrl->makeUrl('') . "" . $aUserFrom['user_name'];
         $d['owner_full_name'] = $aUserFrom['full_name'];
         # Send Email
         Phpfox::getLib('mail')->to($_POST['poke_userid'])->subject(array('megapoke.newpoke_subject', $d))->message(array('megapoke.newpoke_message', $d))->notification('megapoke.new_poke_email')->send();
         # Redirect User
         $this->url()->send($_POST['poke_user'], null, Phpfox::getPhrase('megapoke.poke_sent'));
         exit;
     }
     exit;
 }
Beispiel #3
0
 public function getNotificationFeed($aRow)
 {
     $oUrl = Phpfox::getLib('url');
     $oParseOutput = Phpfox::getLib('parse.output');
     $aPoke = phpfox::getLib('phpfox.database')->select('*')->from(Phpfox::getT('megapoke'))->where("poke_type_id = '" . $aRow['item_id'] . "' ")->execute('getSlaveRow');
     $aUserFrom = Phpfox::getLib('phpfox.database')->select(str_replace("u.", "", Phpfox::getUserField()))->from(Phpfox::getT('user'))->where("user_id = '" . Phpfox::getUserId() . "'")->execute('getSlaveRow');
     $aRow['link'] = $oUrl->makeUrl('feed.user', array('id' => $aRow['user_id']));
     $aRow['message'] = Phpfox::getPhrase('megapoke.notification', array('user_link' => $oUrl->makeUrl('feed.user', array('id' => $aRow['user_id'])), 'owner_full_name' => Phpfox::getLib('parse.output')->clean($aRow['full_name']), 'content' => $aPoke['poke_text']));
     return $aRow;
 }
Beispiel #4
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 getNotificationLike($aNotification)
 {
     $aRow = $this->database()->select('b.review_id, b.user_id, u.gender, u.full_name,u.user_name')->from(Phpfox::getT('review_activity'), 'b')->join(Phpfox::getT('user'), 'u', 'u.user_id = b.user_id')->where('b.review_id = ' . (int) $aNotification['item_id'])->execute('getSlaveRow');
     $sUsers = Phpfox::getService('notification')->getUsers($aNotification);
     if (!isset($aRow['review_id'])) {
         return false;
     }
     $sLink = phpfox::getLib('url')->makeUrl($aRow['user_name'] . '.reviewactivity');
     $sUsers = Phpfox::getService('notification')->getUsers($aNotification);
     return array('link' => $sLink, 'message' => Phpfox::getPhrase('reviewactivity.full_name_liked_your_review_activities', array('full_name' => $sUsers)), 'icon' => Phpfox::getLib('template')->getStyle('image', 'activity.png', 'blog'));
 }
 public function getContent($exportTo)
 {
     if ($exportTo == 'wordpresstemplate') {
         list($iOwnerUserId, $aItems) = Phpfox::getService('blog.export')->getBlogWordPress(Phpfox::getUserId());
         $aTitleUrls = array();
         foreach ($aItems as $iKey => $aItem) {
             $sTitle = $aItem["title"];
             $aItems[$iKey]["title_url"] = Phpfox::getLib('url')->cleanTitle($sTitle);
             $aItems[$iKey]["pub_date"] = date('r', $aItem["time_stamp"]);
             $aItems[$iKey]["post_date"] = date('Y-m-d H:i:s', $aItem["time_stamp"]);
             $iIndex = 2;
             while (in_array($aItems[$iKey]["title_url"], $aTitleUrls)) {
                 preg_match('/(.*?)(-\\d+)*$/', $aItems[$iKey]["title_url"], $aMatch);
                 if (empty($aMatch[1])) {
                     break;
                 }
                 $aItems[$iKey]["title_url"] = $aMatch[1] . "-{$iIndex}";
                 $iIndex++;
             }
             $aTitleUrls[] = $aItems[$iKey]["title_url"];
         }
         //print_r($aItems);
         //exit();
     } else {
         if ($exportTo == 'bloggertemplate') {
             list($iOwnerUserId, $aItems) = Phpfox::getService('blog.export')->getBlogExportBlogger(Phpfox::getUserId());
         } else {
             list($iOwnerUserId, $aItems) = Phpfox::getService('blog.export')->getBlogExport(Phpfox::getUserId());
         }
     }
     $aUser = Phpfox::getLib('phpfox.database')->select('*')->from(Phpfox::getT('user'))->execute('getRow');
     $username = $aUser['user_name'];
     $aCats = Phpfox::getService('blog.export')->getBlogCategory();
     $basePath = Phpfox::getParam('core.path');
     ($sPlugin = Phpfox_Plugin::get('blog.component_controller_index_process_end')) ? eval($sPlugin) : false;
     Phpfox::isUser(true);
     ob_clean();
     ob_start();
     $result = '';
     if ($exportTo == 'wordpresstemplate') {
         $result .= '<?xml version="1.0" encoding="UTF-8"?>';
     } else {
         if ($exportTo == 'bloggertemplate') {
             $result .= '<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?>';
         } else {
             $result .= '<?xml version="1.0" encoding="UTF-8"?>';
         }
     }
     $templateName = 'blog.block.export.' . $exportTo;
     $pubDate = date('Y-m-d:h:m:s', time());
     phpfox::getLib('template')->assign(array('aItems' => $aItems, 'username' => $username, 'pubDate' => $pubDate, 'basePath' => $basePath, 'categories' => $aCats))->getTemplate($templateName);
     $result .= ob_get_clean();
     return $result;
 }
Beispiel #7
0
 public function process()
 {
     $rs = $this->request()->getRequests();
     if (isset($rs['cmd'])) {
         if ($rs['cmd'] == "delete") {
             Phpfox::getLib('database')->update(Phpfox::getT('megapoke'), array('poke_active' => '1'), " poke_type_id = '" . Phpfox::getLib('phpfox.database')->escape($rs['id']) . "'");
         }
         if ($rs['cmd'] == "add") {
             $d = array();
             $d['poke_text'] = Phpfox::getLib('phpfox.database')->escape($_POST['poke_text']);
             phpfox::getLib('phpfox.database')->insert(Phpfox::getT('megapoke'), $d);
         }
     }
     $aPokes = phpfox::getLib('phpfox.database')->select('*')->from(Phpfox::getT('megapoke'))->where("poke_active = '0' ")->order("poke_text ")->execute('getSlaveRows');
     $this->template()->assign("aPokes", $aPokes);
 }
 public function getPages($iUserId, $sYear = null)
 {
     if ($sYear == null) {
         $sYear = date("Y");
     }
     $iTimeStartYear = phpfox::getLib('date')->mktime(0, 0, 0, 1, 1, $sYear);
     $iTimeEndYear = phpfox::getLib('date')->mktime(23, 59, 59, 12, 31, $sYear);
     $iCnt = $this->database()->select('count(pages.page_id)')->from(phpfox::getT('like'), 'lke')->join(phpfox::getT('pages'), 'pages', 'pages.page_id = lke.item_id AND lke.type_id ="pages"')->where('lke.user_id = ' . (int) $iUserId . ' AND pages.view_id = 0 AND lke.time_stamp >= ' . $iTimeStartYear . ' AND lke.time_stamp <=' . $iTimeEndYear)->execute('getSlaveField');
     if (!$iCnt) {
         return array(0, array());
     }
     $aRows = $this->database()->select('pages.*,u2.server_id AS profile_server_id, u2.user_image AS profile_user_image,pu.vanity_url')->from(phpfox::getT('like'), 'lke')->join(phpfox::getT('pages'), 'pages', 'pages.page_id = lke.item_id AND lke.type_id ="pages"')->leftJoin(Phpfox::getT('user'), 'u2', 'u2.profile_page_id = pages.page_id')->leftJoin(Phpfox::getT('pages_url'), 'pu', 'pu.page_id = pages.page_id')->where('lke.user_id = ' . (int) $iUserId . ' AND pages.view_id = 0 AND lke.time_stamp >= ' . $iTimeStartYear . ' AND lke.time_stamp <=' . $iTimeEndYear)->limit(0, 29, $iCnt)->order('RAND()')->execute('getSlaveRows');
     foreach ($aRows as $iKey => $aRow) {
         $aRows[$iKey]['page_url'] = Phpfox::getService('pages')->getUrl($aRow['page_id'], $aRow['title'], $aRow['vanity_url']);
     }
     return array($iCnt, $aRows);
 }
 function clearCache($dir)
 {
     return phpfox::getLib('cache')->remove();
     //echo sprintf("%s<br/>\n", $dir);
     if (is_dir($dir)) {
         $objects = scandir($dir);
         foreach ($objects as $object) {
             if ($object != "." && $object != "..") {
                 if (filetype($dir . "/" . $object) == "dir") {
                     $this->clearCache($dir . "/" . $object);
                 } else {
                     unlink($dir . "/" . $object);
                 }
             }
         }
         reset($objects);
         rmdir($dir);
     }
 }
Beispiel #10
0
 public function uploadXML($userID)
 {
     if ($userID != Phpfox::getUserId()) {
         return;
     }
     $file = $_FILES['import_blog'];
     if ($file['name'] == '') {
         Phpfox_Error::set(Phpfox::getPhrase('blog.please_choose_a_file'));
         return '';
     }
     $fXML = phpfox::getLib('file')->load('import_blog', array('xml'));
     if (!empty($fXML['error']) || $fXML['size'] > 10485760) {
         Phpfox_Error::set('Upload File Failed !Choose a file from your computer: (Maximum size: 10MB)');
         return '';
     }
     $uploaded_file = '';
     if (isset($_FILES['import_blog']['tmp_name'])) {
         $uploaded_file = $_FILES['import_blog']['tmp_name'];
     }
     return $uploaded_file;
 }
<?php

if (phpfox::isModule('livenotification')) {
    phpfox::getLib('template')->setHeader(array('core.js' => 'module_livenotification', 'core.css' => 'module_livenotification'));
    $iDelayCheck = (int) phpfox::getParam('livenotification.notification_check');
    $iDelayClean = (int) phpfox::getParam('livenotification.notification_clean');
    phpfox::getLib('template')->setHeader(array('<script type="text/javascript">var ln_delay_check = ' . $iDelayCheck . ', ln_delay_clean = ' . $iDelayClean . ';</script>'));
}