Skip to content

Commit

Permalink
Merge pull request #64 from DanielnetoDotCom/master
Browse files Browse the repository at this point in the history
update unstable
  • Loading branch information
Vinzenz Hersche authored May 4, 2018
2 parents 88dca07 + 426d0fa commit 82f865d
Show file tree
Hide file tree
Showing 27 changed files with 1,619 additions and 1,433 deletions.
2 changes: 1 addition & 1 deletion install/database.sql
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ CREATE TABLE IF NOT EXISTS `users` (
`canStream` TINYINT(1) NULL,
`canUpload` TINYINT(1) NULL,
`about` TEXT NULL,
`channelName` VARCHAR(45) NOT NULL,
`channelName` VARCHAR(45) NULL,
`emailVerified` TINYINT(1) NOT NULL DEFAULT 0,
PRIMARY KEY (`id`),
UNIQUE INDEX `user_UNIQUE` (`user` ASC))
Expand Down
1 change: 1 addition & 0 deletions objects/categories.json.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php
error_reporting(0);
require_once 'category.php';
header('Access-Control-Allow-Origin: *');
header('Content-Type: application/json');
$categories = Category::getAllCategories();
$total = Category::getTotalCategories();
Expand Down
2 changes: 1 addition & 1 deletion objects/login.json.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
//header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Origin: *');
header("Access-Control-Allow-Headers: Content-Type");
header('Content-Type: application/json');
if (empty($global['systemRootPath'])) {
Expand Down
2 changes: 1 addition & 1 deletion objects/status.json.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
if (empty($global['systemRootPath'])) {
$global['systemRootPath'] = '../';
}
//header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Origin: *');
require_once $global['systemRootPath'] . 'videos/configuration.php';
require_once $global['systemRootPath'] . 'plugin/MobileManager/MobileManager.php';
require_once 'functions.php';
Expand Down
3 changes: 2 additions & 1 deletion objects/user.php
Original file line number Diff line number Diff line change
Expand Up @@ -793,6 +793,7 @@ function getEmailVerified() {
* @return boolean return true is is unique
*/
function setChannelName($channelName) {
$channelName = trim(preg_replace("/[^0-9A-Z_ -]/i", "", $channelName));
$user = static::getChannelOwner($channelName);
if(!empty($user)){ // if the channel name exists and it is not from this user, rename the channel name
if(empty($this->id) || $user['id']!=$this->id){
Expand Down Expand Up @@ -821,7 +822,7 @@ static function getChannelLink($users_id=0){
}else{
$name = $user->getChannelName();
}
$link = "{$global['webSiteRootURL']}channel/{$name}";
$link = "{$global['webSiteRootURL']}channel/".urlencode($name);
return $link;

}
Expand Down
2 changes: 1 addition & 1 deletion objects/userAddNew.json.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
$user->setCanUpload($_POST['canUpload']);
$user->setStatus($_POST['status']);
$unique = $user->setChannelName($_POST['channelName']);
if(!$unique){
if(!empty($_POST['channelName']) && !$unique){
echo '{"error":"'.__("Channel name already exists").'"}';
exit;
}
Expand Down
Loading

0 comments on commit 82f865d

Please sign in to comment.