Exemple #1
0
 public function __construct()
 {
     $this->session = Session::getInstance();
     $this->user = User::getInstance();
     $this->webDBUtils = WebDBUtils::getInstance();
     $this->log = Log::getInstance();
 }
Exemple #2
0
 public static function getInstance()
 {
     if (null == self::$instance) {
         self::$instance = new WebDBUtils();
     }
     return self::$instance;
 }
Exemple #3
0
 public function __construct()
 {
     $this->session = Session::getInstance();
     $this->webDBUtils = WebDBUtils::getInstance();
     $this->roleUtils = RoleUtils::getInstance();
     $this->user = User::getInstance();
     $this->pwUtils = PWUtils::getInstance();
 }
Exemple #4
0
 public function __construct()
 {
     $this->session = Session::getInstance();
     $this->user = User::getInstance();
     $this->user->auth('*****@*****.**', 'tenant');
     $this->playlistUtils = PlaylistUtils::getInstance();
     $this->webDBUtils = WebDBUtils::getInstance();
 }
Exemple #5
0
 public function __construct($uid = null)
 {
     $this->session = Session::getInstance();
     $this->roleUtils = RoleUtils::getInstance();
     $this->db = WebDBUtils::getInstance();
     $this->pwUtils = PWUtils::getInstance();
     $this->load($uid);
 }
Exemple #6
0
 public function __construct()
 {
     $this->session = Session::getInstance();
     $this->log = Log::getInstance();
     $this->user = User::getInstance();
     $this->storage = Storage::getInstance();
     $this->webDBUtils = WebDBUtils::getInstance();
     $this->dpUtils = DataProviderUtils::getInstance();
     $this->screen = false;
     $this->availableFeatures = false;
 }
Exemple #7
0
function addUser($app, $role)
{
    $webDBUtils = WebDBUtils::getInstance();
    $utils = Utils::getInstance();
    $user = User::getInstance();
    $pwUtils = PWUtils::getInstance();
    $session = Session::getInstance();
    $roleUtils = RoleUtils::getInstance();
    $mail = $utils->iStr($app->request()->post('mail'), 64);
    $pass = $utils->iStr($app->request()->post('pass'), 64);
    $ierr = false;
    if (false == filter_var($mail, FILTER_VALIDATE_EMAIL)) {
        $session->addError(L::__('No Email'));
        $ierr = true;
    }
    if (4 > strlen($pass)) {
        $session->addError(L::__('No Password'));
        $ierr = true;
    }
    if (false != $ierr) {
        $app->response->redirect(Settings::baseRef . '/tenant-add-user', 303);
        return;
    }
    // rid
    $rid = $user->getRadioId();
    // sets up user data
    $hash = $pwUtils->generateHash($pass);
    $targetUser = array('email' => $mail, 'password_hash' => $hash, 'radio_id' => $rid);
    // adds the user
    $uid = $webDBUtils->addUser($targetUser);
    if (false == $uid) {
        return;
    }
    // links the user into the group (RoleUtils::TENANT)
    $targetUser = new User($uid);
    switch ($role) {
        case RoleUtils::TENANT:
            $res = $targetUser->linkRoleId($roleUtils->getRoleId(RoleUtils::TENANT));
            break;
        case RoleUtils::ADMIN:
            $res = $targetUser->linkRoleId($roleUtils->getRoleId(RoleUtils::ADMIN));
            break;
    }
    // registers a stream (radio channel, an icecast mountpoint)
    $res = $targetUser->registerStream();
    // -->
    return $res;
}
Exemple #8
0
 public function __construct()
 {
     $this->session = Session::getInstance();
     $this->webDBUtils = WebDBUtils::getInstance();
     $this->rootDBUtils = RootDBUtils::getInstance();
 }
Exemple #9
0
 public function updateAd($ad)
 {
     /*
     $phpdate = strtotime($mysqldate);
     $mysqldate = date('Y-m-d H:i:s', $phpdate);
     */
     // folder
     $aid = $ad['id'];
     $p = Settings::absAdsPath . '/' . $aid;
     $res = @mkdir($p);
     // templates
     $src = $ad['templatePath'];
     $dtt = @file_get_contents($src);
     // bgImage
     /*
     $xpr = '/\[RS_(.*?)\]/';
     preg_match_all($xpr, $dtt, $res, PREG_OFFSET_CAPTURE);
     $res = $res[0];
     foreach($res as $match){
     	if('[RS_bgImg]' == $match[0]){
     		$path = $ad['uploadedImages'][0]['path'];
     		$dtt = str_replace('[RS_bgImg]', $path, $dtt);		
     	}
     }
     */
     // bgImage
     if (isset($ad['uploadedImages'])) {
         $pth = $ad['uploadedImages'][0]['path'];
         $dtt = str_replace('[RS_bgImg]', $pth, $dtt);
     }
     // title
     // $xpr = '/\[RS_title\]/';
     // preg_match_all($xpr, $dtt, $res, PREG_OFFSET_CAPTURE);
     // dyn text fields
     if (isset($ad['txt'])) {
         // title
         $title = $this->getDynVal($ad['txt'], 'title');
         if (false != $title) {
             $dtt = str_replace('[RS_title]', $title, $dtt);
         }
         // subtitle
         $subTitle = $this->getDynVal($ad['txt'], 'subTitle');
         if (false != $subTitle) {
             $dtt = str_replace('[RS_subTitle]', $subTitle, $dtt);
         }
     }
     // db
     $ad['url'] = Settings::absRef . '/' . $ad['id'] . '/index.html';
     $res = WebDBUtils::getInstance()->updateAd($ad);
     // dyn images
     // ad HTML template might or not contain n uploaded images
     if (isset($ad['uploadedImages'])) {
         if (null != $ad['uploadedImages']) {
             if (count($ad['uploadedImages']) > 0) {
                 $i = 0;
                 foreach ($ad['uploadedImages'] as $img) {
                     if (isset($img['path'])) {
                         $pth = $img['path'];
                         $idx = '[RS_Image' . $i . ']';
                         $dtt = str_replace($idx, $pth, $dtt);
                     }
                     $i++;
                 }
             }
         }
     }
     // dyn videos
     if (isset($ad['uploadedVideos'])) {
         if (null != $ad['uploadedVideos']) {
             if (count($ad['uploadedVideos']) >= 0) {
                 $i = 0;
                 foreach ($ad['uploadedVideos'] as $video) {
                     if (isset($video['path'])) {
                         $pth = $video['path'];
                         // $idx = '[RS_video'.$i.']';
                         $idx = '[RS_video]';
                         $dtt = str_replace($idx, $pth, $dtt);
                     }
                     $i++;
                 }
             }
         }
     }
     //
     $dst = Settings::absAdsPath . '/' . $aid . '/index.html';
     $res = @file_put_contents($dst, $dtt);
     //
     return $res;
 }
Exemple #10
0
 public function __construct()
 {
     $this->user = User::getInstance();
     $this->storage = Storage::getInstance();
     $this->webDBUtils = WebDBUtils::getInstance();
 }
Exemple #11
0
 public function __construct()
 {
     $this->session = Session::getInstance();
     $this->webDBUtils = WebDBUtils::getInstance();
     $this->sitmarkUtils = SitmarkUtils::getInstance();
 }