Browse Source

Remove webchatdeny.php

Angel Fernando Quiroz Campos 8 years ago
parent
commit
f64e6b89f7

+ 36 - 0
app/Migrations/Schema/V111/Version20160623143200.php

@@ -0,0 +1,36 @@
+<?php
+/* For licensing terms, see /license.txt */
+
+namespace Application\Migrations\Schema\V111;
+
+use Application\Migrations\AbstractMigrationChamilo;
+use Doctrine\DBAL\Schema\Schema;
+use Doctrine\DBAL\Types\Type;
+
+/**
+ * Class Version20160623143200
+ * Remove chatcall_date, chatcall_text, chatcall_user_id from User table
+ * @package Application\Migrations\Schema\V111
+ */
+class Version20160623143200 extends AbstractMigrationChamilo
+{
+    /**
+     * @param Schema $schema
+     * @throws \Doctrine\DBAL\Schema\SchemaException
+     */
+    public function up(Schema $schema)
+    {
+        $schema
+            ->getTable('user')
+            ->dropColumn('chatcall_user_id')
+            ->dropColumn('chatcall_date')
+            ->dropColumn('chatcall_text');
+    }
+
+    /**
+     * @param Schema $schema
+     */
+    public function down(Schema $schema)
+    {
+    }
+}

+ 1 - 4
main/auth/shibboleth/app/model/scaffold/user.class.php

@@ -57,10 +57,7 @@ class _User
     public $diplomas = null;    
     public $openarea = null;    
     public $teach = null;    
-    public $productions = null;    
-    public $chatcall_user_id = null;    
-    public $chatcall_date = null;    
-    public $chatcall_text = null;    
+    public $productions = null;
     public $language = null;    
     public $registration_date = null;    
     public $expiration_date = null;    

+ 0 - 1
main/inc/ajax/course_chat.ajax.php

@@ -33,7 +33,6 @@ switch ($_REQUEST['action']) {
         $json = [
             'status' => true,
             'data' => [
-                'chatIsDenied' => $courseChatUtils->isChatDenied(),
                 'oldFileSize' => file_exists($filePath) ? filesize($filePath) : 0,
                 'history' => $newFileSize !== $oldFileSize ? $courseChatUtils->readMessages(false, $friend) : null,
                 'usersOnline' => $newUsersOnline,

+ 0 - 52
main/inc/lib/CourseChatUtils.php

@@ -333,43 +333,6 @@ class CourseChatUtils
         $em->flush();
     }
 
-    /**
-     * Check if the connection is denied for chat
-     * @return bool
-     * @throws \Doctrine\ORM\ORMException
-     * @throws \Doctrine\ORM\OptimisticLockException
-     * @throws \Doctrine\ORM\TransactionRequiredException
-     */
-    public function isChatDenied()
-    {
-        if (ChamiloSession::read('origin', null) !== 'whoisonline') {
-            return false;
-        }
-
-        $talkTo = ChamiloSession::read('target', 0);
-
-        if (!$talkTo) {
-            return true;
-        }
-
-        $em = Database::getManager();
-        $user = $em->find('ChamiloUserBundle:User', $talkTo);
-
-        if ($user->getChatcallText() === 'DENIED') {
-            $user
-                ->setChatcallDate(null)
-                ->setChatcallUserId(null)
-                ->setChatcallText(null);
-
-            $em->merge($user);
-            $em->flush();
-
-            return true;
-        }
-
-        return false;
-    }
-
     /**
      * Get the emoji allowed on course chat
      * @return array
@@ -1712,21 +1675,6 @@ class CourseChatUtils
 
         array_splice($content, 0, $remove);
 
-        if (isset($_GET['origin']) && $_GET['origin'] == 'whoisonline') {
-            //the caller
-            $content[0] = get_lang('CallSent') . '<br />' . $content[0];
-        }
-        if (isset($_GET['origin']) && $_GET['origin'] == 'whoisonlinejoin') {
-            //the joiner (we have to delete the chat request to him when he joins the chat)
-            Database::getManager()
-                ->createQuery('
-                    UPDATE ChamiloUserBundle:User u
-                    SET u.chatcallUserId = NULL, u.chatcallDate = NULL, u.chatcallText = NULL
-                    WHERE u.id = :user
-                ')
-                ->execute(['user' => $this->userId]);
-        }
-
         $history = '<div id="content-chat">';
 
         foreach ($content as $this_line) {

+ 0 - 51
main/inc/lib/online.inc.php

@@ -471,54 +471,3 @@ function GetFullUserName($uid) {
 		}
 	}
 }
-
-/**
- * Gets a list of chat calls made by others to the current user (info kept in main.user table)
- * @param   none - taken from global space
- * @return  string  An HTML-formatted message
- */
-function chatcall() {
-    $_cid = api_get_course_id();
-    $_user = api_get_user_info();
-
-	if (!$_user['user_id']) {
-		return (false);
-	}
-    $userId = intval($_user['user_id']);
-	$track_user_table = Database::get_main_table(TABLE_MAIN_USER);
-	$sql="SELECT chatcall_user_id, chatcall_date FROM $track_user_table
-	      WHERE ( id = $userId )";
-	$result=Database::query($sql);
-	$row=Database::fetch_array($result);
-
-	$login_date=$row['chatcall_date'];
-	$hour = substr($login_date,11,2);
-	$minute = substr($login_date,14,2);
-	$second = substr($login_date,17,2);
-	$month = substr($login_date,5,2);
-	$day = substr($login_date,8,2);
-	$year = substr($login_date,0,4);
-	$calltime = mktime($hour,$minute,$second,$month,$day,$year);
-
-	$time = api_get_utc_datetime();
-	$minute_passed=5;  //within this limit, the chat call request is valid
-	$limittime = mktime(date("H"),date("i")-$minute_passed,date("s"),date("m"),date("d"),date("Y"));
-
-	if (($row['chatcall_user_id']) and ($calltime>$limittime)) {
-		$webpath=api_get_path(WEB_CODE_PATH);
-		$message=get_lang('YouWereCalled').' : '.GetFullUserName($row['chatcall_user_id'],'').'<br>'.get_lang('DoYouAccept')
-							."<p>"
-				."<a href=\"".$webpath."chat/chat.php?cidReq=".$_cid."&origin=whoisonlinejoin\">"
-				. get_lang("Yes")
-				."</a>"
-				."&nbsp;&nbsp;|&nbsp;&nbsp;"
-				."<a href=\"".api_get_path(WEB_PATH)."webchatdeny.php\">"
-				. get_lang("No")
-				."</a>"
-				."</p>";
-
-		return($message);
-	} else {
-		return false;
-	}
-}

+ 1 - 1
main/inc/lib/userportal.lib.php

@@ -1520,7 +1520,7 @@ class IndexManager
         $listCoursesInfo = array();
         if (!isset($_GET['history'])) {
             // Display special courses
-            $specialCoursesResult = CourseManager::display_special_courses(
+            $specialCoursesResult = CourseManager::returnSpecialCourses(
                 $user_id,
                 $loadDirs
             );

+ 1 - 3
main/template/default/chat/chat.tpl

@@ -78,9 +78,7 @@
                             friend: ChChat.currentFriend
                         })
                         .done(function (response) {
-                            if (response.data.chatIsDenied) {
-                                alert("{{ 'ChatDenied'|get_lang }}");
-
+                            if (!response.data) {
                                 return;
                             }
 

+ 0 - 1
robots.txt

@@ -29,6 +29,5 @@ Disallow: /tests/
 # Files
 Disallow: /license.txt
 Disallow: /README.txt
-Disallow: /webchatdeny.php
 Disallow: /whoisonline.php
 Disallow: /whoisonlinesession.php

+ 0 - 91
src/Chamilo/PageBundle/Entity/User.php

@@ -212,27 +212,6 @@ class User extends BaseUser
      */
     private $productions;
 
-    /**
-     * @var integer
-     *
-     * @ORM\Column(name="chatcall_user_id", type="integer", nullable=true, unique=false)
-     */
-    private $chatcallUserId;
-
-    /**
-     * @var \DateTime
-     *
-     * @ORM\Column(name="chatcall_date", type="datetime", nullable=true, unique=false)
-     */
-    private $chatcallDate;
-
-    /**
-     * @var string
-     *
-     * @ORM\Column(name="chatcall_text", type="string", length=50, nullable=true, unique=false)
-     */
-    private $chatcallText;
-
     /**
      * @var string
      *
@@ -407,7 +386,6 @@ class User extends BaseUser
         $this->portals = new ArrayCollection();
         $this->dropBoxSentFiles = new ArrayCollection();
         $this->dropBoxReceivedFiles = new ArrayCollection();
-        $this->chatcallUserId = 0;
         //$this->extraFields = new ArrayCollection();
         //$this->userId = 0;
         //$this->createdAt = new \DateTime();
@@ -1064,75 +1042,6 @@ class User extends BaseUser
         return $this->productions;
     }
 
-    /**
-     * Set chatcallUserId
-     *
-     * @param integer $chatcallUserId
-     * @return User
-     */
-    public function setChatcallUserId($chatcallUserId)
-    {
-        $this->chatcallUserId = $chatcallUserId;
-
-        return $this;
-    }
-
-    /**
-     * Get chatcallUserId
-     *
-     * @return integer
-     */
-    public function getChatcallUserId()
-    {
-        return $this->chatcallUserId;
-    }
-
-    /**
-     * Set chatcallDate
-     *
-     * @param \DateTime $chatcallDate
-     * @return User
-     */
-    public function setChatcallDate($chatcallDate)
-    {
-        $this->chatcallDate = $chatcallDate;
-
-        return $this;
-    }
-
-    /**
-     * Get chatcallDate
-     *
-     * @return \DateTime
-     */
-    public function getChatcallDate()
-    {
-        return $this->chatcallDate;
-    }
-
-    /**
-     * Set chatcallText
-     *
-     * @param string $chatcallText
-     * @return User
-     */
-    public function setChatcallText($chatcallText)
-    {
-        $this->chatcallText = $chatcallText;
-
-        return $this;
-    }
-
-    /**
-     * Get chatcallText
-     *
-     * @return string
-     */
-    public function getChatcallText()
-    {
-        return $this->chatcallText;
-    }
-
     /**
      * Set language
      *

+ 0 - 91
src/Chamilo/UserBundle/Entity/User.php

@@ -251,27 +251,6 @@ class User implements UserInterface //implements ParticipantInterface, ThemeUser
      */
     private $productions;
 
-    /**
-     * @var integer
-     *
-     * @ORM\Column(name="chatcall_user_id", type="integer", nullable=true, unique=false)
-     */
-    private $chatcallUserId;
-
-    /**
-     * @var \DateTime
-     *
-     * @ORM\Column(name="chatcall_date", type="datetime", nullable=true, unique=false)
-     */
-    private $chatcallDate;
-
-    /**
-     * @var string
-     *
-     * @ORM\Column(name="chatcall_text", type="string", length=50, nullable=true, unique=false)
-     */
-    private $chatcallText;
-
     /**
      * @var string
      *
@@ -474,7 +453,6 @@ class User implements UserInterface //implements ParticipantInterface, ThemeUser
         $this->portals = new ArrayCollection();
         $this->dropBoxSentFiles = new ArrayCollection();
         $this->dropBoxReceivedFiles = new ArrayCollection();
-        $this->chatcallUserId = 0;
         //$this->extraFields = new ArrayCollection();
         //$this->userId = 0;
         //$this->createdAt = new \DateTime();
@@ -1162,75 +1140,6 @@ class User implements UserInterface //implements ParticipantInterface, ThemeUser
         return $this->productions;
     }
 
-    /**
-     * Set chatcallUserId
-     *
-     * @param integer $chatcallUserId
-     * @return User
-     */
-    public function setChatcallUserId($chatcallUserId)
-    {
-        $this->chatcallUserId = $chatcallUserId;
-
-        return $this;
-    }
-
-    /**
-     * Get chatcallUserId
-     *
-     * @return integer
-     */
-    public function getChatcallUserId()
-    {
-        return $this->chatcallUserId;
-    }
-
-    /**
-     * Set chatcallDate
-     *
-     * @param \DateTime $chatcallDate
-     * @return User
-     */
-    public function setChatcallDate($chatcallDate)
-    {
-        $this->chatcallDate = $chatcallDate;
-
-        return $this;
-    }
-
-    /**
-     * Get chatcallDate
-     *
-     * @return \DateTime
-     */
-    public function getChatcallDate()
-    {
-        return $this->chatcallDate;
-    }
-
-    /**
-     * Set chatcallText
-     *
-     * @param string $chatcallText
-     * @return User
-     */
-    public function setChatcallText($chatcallText)
-    {
-        $this->chatcallText = $chatcallText;
-
-        return $this;
-    }
-
-    /**
-     * Get chatcallText
-     *
-     * @return string
-     */
-    public function getChatcallText()
-    {
-        return $this->chatcallText;
-    }
-
     /**
      * Set language
      *

+ 0 - 30
webchatdeny.php

@@ -1,30 +0,0 @@
-<?php
-/* For licensing terms, see /license.txt */
-
-/**
- * @todo can't this be moved to a different file so that we can delete this file?
- * 		 Is this still in use? If not, then it should be removed or maybe offered as an extension
- */
-/**
-* Deletes the web-chat request form the user table
-*/
-
-// including necessary files
-include_once './main/inc/global.inc.php';
-
-// table definitions
-$track_user_table = Database::get_main_table(TABLE_MAIN_USER);
-if (isset($_user['user_id']) && $_user['user_id'] != '') {
-	$_user['user_id'] = intval($_user['user_id']);
-	$sql = "update $track_user_table set chatcall_user_id = '', chatcall_date = '', chatcall_text='DENIED' where (user_id = ".$_user['user_id'].")";
-	$result = Database::query($sql);
-}
-
-Display::display_header();
-
-$message = get_lang('RequestDenied').'<br /><br /><a href="javascript: history.back();">'.get_lang('Back').'</a>';
-Display::display_normal_message($message);
-
-/*	FOOTER	*/
-
-Display::display_footer();

+ 0 - 15
whoisonline.php

@@ -18,26 +18,11 @@ if (isset($_GET['cidReq']) && strlen($_GET['cidReq']) > 0) {
 $_SESSION['who_is_online_counter'] = 2;
 $this_section = SECTION_SOCIAL;
 // table definitions
-$track_user_table = Database::get_main_table(TABLE_MAIN_USER);
 
 $social_right_content = null;
 $whoisonline_list = null;
 $social_search = '';
 
-/* if (isset($_GET['chatid'])) {
-    //send out call request
-    $time = time();
-    $time = date("Y-m-d H:i:s", $time);
-    $chatid = intval($_GET['chatid']);
-    if ($_GET['chatid'] == strval(intval($_GET['chatid']))) {
-        $sql = "update $track_user_table set chatcall_user_id = ".intval($_user['user_id']).", chatcall_date = '".Database::escape_string($time)."', chatcall_text = '' where (user_id = ".(int)Database::escape_string($chatid).")";
-        $result = Database::query($sql);
-        //redirect caller to chat
-        header("Location: ".api_get_path(WEB_CODE_PATH)."chat/chat.php?".api_get_cidreq()."&origin=whoisonline&target=".Security::remove_XSS($chatid));
-        exit;
-    }
-}
-*/
 // This if statement prevents users accessing the who's online feature when it has been disabled.
 if ((api_get_setting('showonline', 'world') == 'true' && !$_user['user_id']) ||
     ((api_get_setting('showonline', 'users') == 'true' || api_get_setting('showonline', 'course') == 'true') && $_user['user_id'])