Exemplo n.º 1
0
function getFile($id)
{
    $thisMedia = new media("files");
    $thisMedia->idMedia = $id;
    $media = $thisMedia->get();
    return current($media);
}
Exemplo n.º 2
0
 public static function saveFile($file, $form)
 {
     if (!is_uploaded_file($file['tmp_name'])) {
         return $form;
     }
     $fileName = mediaUtils::fixFileName($file['name']);
     $fileDir = dir::media($fileName);
     $extension = substr(strrchr($fileName, '.'), 1);
     // z.B. jpg
     $badExtensions = dyn::get('addons')['badExtensions'];
     // Wenn die Datei eine "verbotene" Datei ist
     if (in_array($extension, $badExtensions)) {
         $form->setSave(false);
         $form->setErrorMessage(sprintf(lang::get('media_error_bad_extension'), $file['name']));
         return $form;
     }
     if ($form->isEditMode()) {
         $media = new media(type::super('id', 'int', 0));
     }
     // Wenn Datei nicht Existiert
     // Oder man möchte sie überspeichern
     if ($form->isEditMode() && $media->get('filename') != $fileName || !$form->isEditMode() && file_exists($fileDir)) {
         $form->setSave(false);
         $form->setErrorMessage(sprintf(lang::get('media_error_already_exist'), $file['name']));
         return $form;
     }
     if (!move_uploaded_file($file['tmp_name'], $fileDir)) {
         $form->setSave(false);
         $form->setErrorMessage(sprintf(lang::get('media_error_move'), $file['name']));
         return $form;
     }
     $form->addPost('filename', $fileName);
     $form->addPost('size', filesize($fileDir));
     return $form;
 }
Exemplo n.º 3
0
 public function query($debug = "")
 {
     global $thisSite;
     $mySelect = new mySelect(__FILE__);
     $mySelect->tables = $thisSite->PREFIXE_TBL_GEN . "articles";
     if ($this->fields == "") {
         $mySelect->fields = "*";
     } else {
         $mySelect->fields = $this->fields;
     }
     $mySelect->where = "actif=1 AND art = '" . $this->article . "'";
     if ($this->lg != "" && $this->lg != "all") {
         // si une langue est indiqué on l'utilise
         $mySelect->where .= " AND lg='" . $this->lg . "'";
     } else {
         if ($this->lg == "") {
             $mySelect->where .= " AND lg='" . $thisSite->current_lang . "'";
         }
     }
     if ($this->id != "") {
         $mySelect->where .= " AND id=" . $this->id;
     }
     if ($this->where != "") {
         $mySelect->where .= " AND " . $this->where;
     }
     if ($this->orderby == "") {
         $mySelect->orderby = "id ASC";
     } else {
         $mySelect->orderby = $this->orderby;
     }
     if ($this->limit != "") {
         $mySelect->limit = $this->limit;
     }
     $result = $mySelect->query($debug);
     // on ajoute les médias si demandé
     $whatMedias = explode(",", $this->medias);
     if (count($whatMedias) > 0) {
         foreach ($result as $x => $row) {
             foreach ($whatMedias as $media) {
                 $thisMedia = new media($this->article . "_" . $media);
                 $thisMedia->idParent = $row["id"];
                 $dataMedias = $thisMedia->get();
                 $result[$x][$media] = $dataMedias;
             }
         }
     }
     return $result;
 }
Exemplo n.º 4
0
 public static function getInstance()
 {
     if (is_null(media::$instance)) {
         if (!isset($_GET) || !is_array($_GET)) {
             return null;
         }
         foreach ($_GET as $name => $value) {
             if ($name != 'p') {
                 $data[$name] = $value;
             }
         }
         if (isset($_GET['p'])) {
             $param = unserialize(base64_decode($_GET['p']));
             foreach ($param as $name => $value) {
                 $data[$name] = $value;
             }
         }
         if (!isset($data['mode'])) {
             $mode = media::detectType();
         } else {
             $mode = $data['mode'];
         }
         if (file_exists(LOCAL_PATH . LOCAL_DIR . 'include/class/media/' . $mode . '.php')) {
             require_once 'include/class/media/' . $mode . '.php';
         }
         $class = 'media_' . $mode;
         $class = new $class($data);
         media::$instance = $class;
     }
     return media::$instance;
 }
Exemplo n.º 5
0
 public static function set($autoattendant)
 {
     $xml = FreeSwitch::setSection('autoattendant', $autoattendant['auto_attendant_id']);
     media::generateConfig($autoattendant, $xml);
     if (!empty($autoattendant['extension_context_id'])) {
         $xml->setAttributeValue('', 'digit-len', $autoattendant['extension_digits']);
     }
     $xml->setAttributeValue('', 'timeout', $autoattendant['timeout'] * 1000);
     $xml->setAttributeValue('', 'inter-digit-timeout', $autoattendant['digit_timeout'] * 1000);
     if (!empty($autoattendant['registry']['max-failures'])) {
         $xml->setAttributeValue('', 'max-failures', $autoattendant['registry']['max-failures']);
     } else {
         $xml->setAttributeValue('', 'max-failures', '3');
     }
     $xml->deleteChildren();
     if (!empty($autoattendant['extension_context_id'])) {
         $xml->update(sprintf('/entry[@action="menu-exec-app"][@name="catch_all"][@digits="\\/^([0-9]{%s})$\\/"][@param="execute_extension $1 XML context_%s"]', $autoattendant['extension_digits'], $autoattendant['extension_context_id']));
     }
     foreach ($autoattendant['keys'] as $key) {
         if (!isset($key['digits'])) {
             continue;
         }
         if (!($transferString = fs::getTransferToNumber($key['number_id']))) {
             continue;
         }
         $xml->update(sprintf('/entry[@action="menu-exec-app"][@digits="%s"][@param="transfer %s"]', $key['digits'], $transferString));
     }
 }
Exemplo n.º 6
0
 public function getOutValue($sql)
 {
     $this->getDynValue($sql);
     foreach ($this->outVars[1] as $key => $type) {
         if (!$this->isType($type, $this->outVars[2][$key])) {
             continue;
         }
         $sqlEntry = strtolower($this->DynType) . $this->outVars[2][$key];
         $sqlEntry = $sql->get($sqlEntry);
         //DYN_MEDIA_ID bleibt unberührt
         if ($type == $this->DynType . '_ID') {
             //nothing
         } else {
             $class = new media($sqlEntry);
             $sqlEntry = $class->get('filename');
         }
         $this->content = str_replace($this->outVars[0][$key], $sqlEntry, $this->content);
     }
     return $this;
 }
Exemplo n.º 7
0
Arquivo: media.php Projeto: rigidus/ea
 function load($file)
 {
     load::ext('getid3');
     // Initialize getID3 engine
     $getid3 = new getID3();
     $getid3->encoding = 'UTF-8';
     // Analyze file
     $info = $getid3->analyze($file);
     if (!isset($info['video'])) {
         self::$tags = array('time' => @$info['playtime_string'], 'bitrate' => round(@$info['bitrate'] / 1000), 'title' => self::getAudioTag(&$info, 'title'), 'artist' => self::getAudioTag(&$info, 'artist'), 'album' => self::getAudioTag(&$info, 'album'), 'year' => self::getAudioTag(&$info, 'year'), 'genre' => self::getAudioTag(&$info, 'genre'), 'mime_type' => @$info['mime_type'], 'filesize' => @$info['filesize']);
     } else {
         self::$tags = array('time' => @$info['playtime_string'], 'bitrate' => round(@$info['bitrate'] / 1000), 'x' => @$info['video']['resolution_x'], 'y' => @$info['video']['resolution_y'], 'mime_type' => @$info['mime_type'], 'filesize' => @$info['filesize']);
     }
 }
Exemplo n.º 8
0
 public static function updateUser($pack)
 {
     $pack->auth->permission = "read_write";
     if (!users::authenticateUser($pack->auth)) {
         return new return_package(6, NULL, "Failed Authentication");
     }
     if ($pack->media) {
         $pack->media->auth = $pack->auth;
         $pack->media->user_id = $pack->user_id;
         $pack->media_id = media::createMedia($pack->media)->data->media_id;
     }
     dbconnection::query("UPDATE users SET " . (isset($pack->display_name) ? "display_name = '" . addslashes($pack->display_name) . "'," : "") . (isset($pack->email) ? "email        = '" . addslashes($pack->email) . "'," : "") . (isset($pack->media_id) ? "media_id     = '" . addslashes($pack->media_id) . "'," : "") . "last_active = CURRENT_TIMESTAMP " . "WHERE user_id = '{$pack->user_id}'");
     return users::logIn($pack);
 }
Exemplo n.º 9
0
 private static function tagObjectFromSQL($sql_tag)
 {
     if (!$sql_tag) {
         return $sql_tag;
     }
     $tag = new stdClass();
     $tag->tag_id = $sql_tag->tag_id;
     $tag->game_id = $sql_tag->game_id;
     $tag->tag = $sql_tag->tag;
     $tag->media_id = $sql_tag->media_id;
     if ($sql_tag->media_id) {
         $tag->media = media::getMedia($sql_tag);
     }
     $tag->visible = $sql_tag->visible;
     $tag->curated = $sql_tag->curated;
     $tag->sort_index = $sql_tag->sort_index;
     return $tag;
 }
Exemplo n.º 10
0
    public function get()
    {
        if ($this->value != '') {
            $media = media::factory($this->value);
            $this->addAttribute('value', $media->get('filename'));
        }
        $this->addAttribute('disabled', 'disabled');
        $this->addAttribute('name', $this->name);
        $this->addAttribute('type', 'text');
        $this->addAttribute('placeholder', lang::get('select_media') . '...');
        $this->addClass('form-control');
        return '
		<div class="input-group dyn-media">
			<span class="input-group-addon"><i class="fa fa-bars dyn-media-add" title="' . lang::get('select_media') . '"></i></span>
			<input type="hidden" name="' . $this->name . '_id" value="' . $this->value . '">
			<input' . $this->convertAttr() . '>
			<span class="input-group-addon"><i class="fa fa-minus-square-o  dyn-media-del" title="' . lang::get('field_set_empty') . '"></i></span>
		</div>';
    }
Exemplo n.º 11
0
 public static function getFullGame($pack)
 {
     $pack->auth->permission = "read_write";
     if (!users::authenticateUser($pack->auth)) {
         return new return_package(6, NULL, "Failed Authentication");
     }
     $sql_game = dbconnection::queryObject("SELECT * FROM games WHERE game_id = '{$pack->game_id}' LIMIT 1");
     if (!$sql_game) {
         return new return_package(2, NULL, "The game you've requested does not exist");
     }
     $game = games::getGame($pack)->data;
     $game->authors = users::getUsersForGame($pack)->data;
     //pack already has auth and game_id
     //heres where we just hack the pack for use in other requests without overhead of creating new packs
     $pack->media_id = $game->media_id;
     $game->media = media::getMedia($pack)->data;
     $pack->media_id = $game->icon_media_id;
     $game->icon_media = media::getMedia($pack)->data;
     return new return_package(0, $game);
 }
Exemplo n.º 12
0
<fieldset>
	<legend>Mediabox Thumbnail Image (optional)</legend>
	<div class = "has-floats" id = "images_tnail">
		<input type = "hidden" name = "blog_media_type" class = "blog_media_type" value = "<?php 
echo $type;
?>
"/>
<?php 
$rs = aql::select($aql);
include INCPATH . '/../images/container.php';
?>
		<div id="blog-post-images_tnail" class="has-floats float-left blog-post-images">
<?php 
if ($rs) {
    foreach ($rs as $media_item) {
        $img = media::get_item($media_item['media_item_id'], 100, 100);
        include INCPATH . '/../images/item.php';
    }
} else {
    echo 'No media uploaded.';
}
?>
			<!--ajax goes here: blog image library-->
		</div>
	</div>
</fieldset>
<?php 
if ($media_item) {
    $aql = "blog_article{\n\t\t\t\ttitle,\n\t\t\t\tintroduction,\n\t\t\t\tmedia_item_id as article__media_item_id\n\t\t\t}\n\t\t\tblog_media\t{\n\t\t\t\t\t\t\tmedia_item_id as blog_media__media_item_id\n\t\t\t\t\t\t}\n\t\t\tblog_article_tag{\n\t\t\t\tname\n\t\t\t\twhere blog_media.blog_article_id = {$blog_article_id}\n\t\t\t\t\tand blog_media.type = 'mebox'\n\t\t\t\torder by iorder asc\n\t\t\t\tlimit 1\n\t\t\t}";
    $rs = aql::select($aql);
}
Exemplo n.º 13
0
$c = count($vf['items']);
$vf = media::get_vfolder($vfolder_path, $limit, $offset, 'mod_time desc');
if ($c) {
    foreach ($vf['items'] as $image) {
        $orig = media::get_item($image['id']);
        $aspect_ratio = $orig['width'] / $orig['height'];
        $thumb = media::get_item($image['id'], 70, 70, true);
        $full_size_img = media::get_item($image['id']);
        if ($orig['width'] >= 600 && $aspect_ratio >= 1) {
            $img = media::get_item($image['id'], 600, 400, true);
        } else {
            if ($orig['width'] >= 250 || true) {
                if ($aspect_ratio >= 0.5) {
                    $img = media::get_item($image['id'], 250);
                } else {
                    $img = media::get_item($image['id'], 250, 500, true);
                }
            } else {
                if ($orig['width'] < 250) {
                    //image not wide enough
                    $img['src'] = 'alert';
                }
            }
        }
        ?>
		<div class="img-item">
			<a href="javascript:void(0);" onclick="imageInsert('<?php 
        echo $img['src'];
        ?>
','<?php 
        echo $img['width'];
Exemplo n.º 14
0
 public function get_page_by_url()
 {
     global $sql, $smarty, $user;
     $url_temp = substr($_SERVER['REQUEST_URI'], 15);
     //ez csak localhost-on kell, mert ott bent van az easyaccessblog könyvtárban minden
     //die($url_temp);
     //die($_SERVER['REQUEST_URI']);
     if (substr_count($url_temp, '/') == 2) {
         $endpos = strpos($url_temp, '/', 1);
         $this->dir = substr($url_temp, 1, $endpos - 1);
         if ($this->dir == 'admin') {
             $this->admin = true;
         }
     } else {
         $this->dir = null;
     }
     if (strstr($url_temp, "?p=")) {
         $this->action = substr($url_temp, strpos($url_temp, "?p=") + 3);
         //ellenőrizzük van-e egyéb paraméter, mert akkor azt levágjuk
         if (strstr($this->action, '&')) {
             $endpos = strpos($this->action, '&', 1);
             $this->action = substr($this->action, 0, $endpos);
         }
     } else {
         //load simple index.php site
         if (!$this->is_admin()) {
             $this->action = 'default';
         } else {
             $this->action = 'default_admin';
         }
     }
     $this->file = $this->action;
     // login.php
     /*
     if (substr_count($_SERVER['REQUEST_URI'],'/')==2) {
     	$endpos = strpos($_SERVER['REQUEST_URI'], '/', 1);
     	$dir = substr($_SERVER['REQUEST_URI'], 1, $endpos-1);
     }
     */
     //$assoc_array = $sql->get_page($this->file, $this->dir);
     //die($this->dir . "h");
     if ($this->dir) {
         $this->p_user = new user();
         $this->p_user->set_user_data_by_name($this->dir);
     }
     $this->url = $this->action . '.tpl';
     //itt most lekérünk egyéb smarty adatokat -------------------------------------------------
     //default.tpl adatai (főoldali bejegyzések)
     //le kell kérni a userhez tartozó össszes (type=1) postot, dátum szerint csökkenő sorrendben
     //és ezeket átadni tömbben (a tömbben post objektumok legyenek)
     if ($this->action == 'default' && !$this->is_admin() && $this->p_user != null) {
         $post_list = $sql->assoc_array('select * from post where post_type = 1 and post_status = 2 and post_author = ' . $this->p_user->get_user_id() . (isset($_GET['tag']) ? ' and post_id in (select tp_post_id from tag_post where tp_tag_id = ' . $_GET['tag'] . ')' : '') . (isset($_GET['category']) ? ' and post_cat_id  = ' . $_GET['category'] : '') . ' order by post_date desc;');
         $post_array = array();
         foreach ($post_list as $key => $post_obj) {
             $new_post = new post();
             $new_post->set_post_data_by_id($post_obj['post_id']);
             $new_post->decode_content();
             $post_array[] = $new_post;
             //var_dump($post_obj);
         }
         $smarty->assign('post_list', $post_array);
     }
     //defaul.tpl vége
     //default.tpl admin esetén
     if ($this->action == 'default' && $this->is_admin()) {
         //do smthng
     }
     //default vége admin esetén
     //önálló bejegyzés megtekintése
     if ($this->action == 'view_post') {
         //ez azért kell mert ebben benne van a user ellenőrzés is; ha nem lenne, akkor bármelyik felhasználó blogjából meghívhatnánk bármelyik bejegyzést
         $post_id = $sql->single_variable("select post_id from post where post_id = " . $_GET['id'] . " and post_author = " . $this->p_user->get_user_id() . ";");
         $new_post = new post();
         $new_post->set_post_data_by_id($post_id);
         $new_post->decode_content();
         $smarty->assign('post', $new_post);
         //lekérjük a  bejegyzéshez tartozó kommenteket
         $comments = $sql->assoc_array('select com_id from comment where com_post = ' . $_GET['id'] . ' order by com_date desc;');
         $comment_array = array();
         foreach ($comments as $key => $com_obj) {
             $comment = new comment();
             $comment->set_com_data_by_id($com_obj['com_id']);
             $comment_array[] = $comment;
         }
         $smarty->assign('comment_list', $comment_array);
     }
     //bejegyzés megtekintésének vége
     //új bejegyzés létrehozása
     if ($this->action == 'edit_post') {
         //kategóriák lekérése
         $category_list = $sql->assoc_array('select * from category where cat_author = ' . $user->get_user_id());
         $category_array = array();
         foreach ($category_list as $key => $val) {
             $category = new category();
             foreach ($val as $key_inner => $value_inner) {
                 if ($key_inner == "cat_id") {
                     $category->set_cat_id($value_inner);
                 } elseif ($key_inner == "cat_name") {
                     $category->set_cat_name($value_inner);
                 } elseif ($key_inner == "cat_author") {
                     $category->set_cat_author($value_inner);
                 }
             }
             $category_array[] = $category;
         }
         $smarty->assign('category_list', $category_array);
         //kategóriák vége
     }
     //új bejegyzés vége
     //új oldal
     if ($this->action == 'edit_page') {
         //do nothing
     }
     //új oldal vége
     //meglévő bejegyzés szerkesztése
     if ($this->action == 'edit_post' && isset($_GET['id']) && !empty($_GET['id'])) {
         //lekérjük az összes post adatot
         $post_data = $sql->assoc_array('select * from post where post_id = ' . $_GET['id'] . ' and post_type = 1');
         foreach ($post_data[0] as $key => $data) {
             if ($key == 'post_content') {
                 $data = html_entity_decode($data);
             }
             $smarty->assign($key, $data);
         }
         //címkék lekérése
         $tag_array = $sql->assoc_array("select * from tag_post where tp_post_id = " . $_GET['id']);
         $tag_list = array();
         foreach ($tag_array as $key => $tag_obj) {
             $tag = new tag();
             foreach ($tag_obj as $_key => $value) {
                 if ($_key == 'tp_tag_id') {
                     $tag->set_tag_data_by_id($value);
                 }
             }
             $tag_list[] = $tag;
         }
         $smarty->assign('tag_list', $tag_list);
         //címkék vége
     }
     //meglévő bejegyzés szerkesztés vége
     //meglévő oldal szerkesztése
     if ($this->action == 'edit_page' && isset($_GET['id']) && !empty($_GET['id'])) {
         $page_data = $sql->assoc_array('select * from post where post_id = ' . $_GET['id']);
         foreach ($page_data[0] as $key => $data) {
             if ($key == 'post_content') {
                 $data = html_entity_decode($data);
             }
             $smarty->assign($key, $data);
         }
     }
     //meglévő oldal szerkesztése
     //korábbi bejegyzések --archive
     if ($this->action == "archive") {
         $archive_array = $sql->assoc_array('select * from post where post_type = 1 and post_author = ' . $user->get_user_id() . " order by post_date desc;");
         $post_list = array();
         foreach ($archive_array as $key => $post_obj) {
             $new_post = new post();
             foreach ($post_obj as $field => $obj_val) {
                 if ($field == "post_id") {
                     $new_post->set_post_data_by_id($obj_val);
                 }
             }
             $post_list[] = $new_post;
         }
         $smarty->assign('post_list', $post_list);
     }
     //korábbi bejegyzések vége
     //oldalak szerkesztése - pages
     if ($this->action == "pages") {
         $archive_array = $sql->assoc_array('select * from post where post_author = ' . $user->get_user_id() . " and post_type = 2 order by post_id asc;");
         $post_list = array();
         foreach ($archive_array as $key => $post_obj) {
             $new_post = new post();
             foreach ($post_obj as $field => $obj_val) {
                 if ($field == "post_id") {
                     $new_post->set_post_data_by_id($obj_val);
                 }
             }
             $post_list[] = $new_post;
         }
         $smarty->assign('post_list', $post_list);
     }
     //oldalak szerkesztése - vége
     //kategóriák
     if ($this->action == "category") {
         $category_array = $sql->assoc_array('select * from category where cat_author = ' . $user->get_user_id() . " order by cat_name asc;");
         $cat_list = array();
         foreach ($category_array as $key => $cat_obj) {
             $new_cat = new category();
             foreach ($cat_obj as $field => $obj_val) {
                 if ($field == "cat_id") {
                     $new_cat->set_cat_data_by_id($obj_val);
                 }
             }
             $cat_list[] = $new_cat;
         }
         $smarty->assign('cat_list', $cat_list);
     }
     //kategóriák vége
     //admin oldali kommentkezelés
     if ($this->action == "comment") {
         //le kell kérni az összes olyan bejegyzést, amihez tartozik komment, időrendben a bejegyzések, azon belül időrendben a kommentek
         $comments = $sql->assoc_array('SELECT post_id, com_id FROM `post` join `comment` on post_id = com_post WHERE post_author = 1 order by com_date desc');
         $comment_array = array();
         foreach ($comments as $key_obj => $com_obj) {
             foreach ($com_obj as $key => $value) {
                 //át kell adni smarty-ban  a post-ot, meg a commentet is
                 //ötlet: a com_post-ba rakjuk bele a post objektumot!
                 //sorrend: post_id, com_id
                 if ($key == "post_id") {
                     //itt állítjuk be a post objektumot
                     $post = new post();
                     $post->set_post_data_by_id($value);
                 } elseif ($key = "com_id") {
                     //itt hozzuk létre a komment objektumot, és belepakoljuk a post-ot, ami már létezik elvileg
                     $comment = new comment();
                     $comment->set_com_data_by_id($value);
                     //ez állítja be az előbb létrehozott postot
                     $comment->set_com_post($post);
                 }
             }
             $comment_array[] = $comment;
         }
         $smarty->assign('comment_list', $comment_array);
     }
     //admin oldali kommentkezelés vége
     //media
     if ($this->action == "images") {
         //lekéri a felhasználó összes media bejegyzését
         //dátum szerint csökkenő sorrendben
         //TODO: lehetne egy check() fv. ami lecsekkolja mi van a mappában, és updateli az adatbázist
         $media_array = $sql->assoc_array('SELECT * FROM media WHERE media_author = ' . $user->get_user_id() . ' ORDER BY media_date DESC;');
         $media_list = array();
         foreach ($media_array as $key => $media_obj) {
             $new_media = new media();
             $new_media->set_media_data_by_id($media_obj['media_id']);
             $media_list[] = $new_media;
         }
         $smarty->assign('media_list', $media_list);
     }
     //media end
     //közösségi oldalak beállítása
     if ($this->action == "social_media") {
         //hozzáadás: legördülő menüből a típus, value
         //felvettek megjelenítése: mindkettő szerkeszthető
         $sm_list = array();
         //bepakoljuk a tömbbe a meglévőket
         $sm_assoc_array = $sql->assoc_array('select * from social_media where sm_user = '******' order by sm_type asc;');
         foreach ($sm_assoc_array as $key => $value) {
             $sm_obj = new social_media();
             $sm_obj->set_sm_data_by_id($value['sm_id']);
             $sm_list[] = $sm_obj;
         }
         $smarty->assign('sm_list', $sm_list);
     }
     //közösségi oldal end
     //profil módosítás
     if ($this->action == "profile" || $this->action == "password") {
         $smarty->assign('user', $user);
     }
     //profil módosítás vége
     //menüszerkesztés
     if ($this->action == "menu") {
         $smarty->assign('user', $user);
         $menublocks_assoc_array = $sql->assoc_array('select * from menublock where mb_type in (1,2,3,4) and mb_user = '******' order by mb_type asc;');
         $mb_list = array();
         foreach ($menublocks_assoc_array as $mb_array) {
             $new_mb = new menublock($mb_array['mb_title'], $mb_array['mb_type'], $mb_array['mb_limit'], $user->get_user_id());
             $mb_list[] = $new_mb;
         }
         $text_array = array('Korábbi bejegyzéseket tartalmazó menü', 'Kommenteket tartalmazó blokk', 'Közösségi oldalakat tartalmazó blokk', 'Címkéket tartalmazó blokk');
         $limits = array(true, true, false, false);
         $smarty->assign('mb_list', $mb_list);
         $smarty->assign('text_array', $text_array);
         $smarty->assign('limits', $limits);
     }
     //menüszerkesztés vége
     //smarty adatok betöltésének vége ---------------------------------------------------------
 }
Exemplo n.º 15
0
function handleCleanAnnotations()
{
    global $classID, $className, $classes, $configFolderName, $dbConnection;
    global $session, $department, $courseNo, $sectionNo, $season;
    global $yteststudent_hashed_id, $iteststu_guest_id, $bteststu_basic_id;
    global $command, $commandState;
    // get the command itself
    $command = Commands::CleanAnnotations;
    // get the state of the command
    if (array_key_exists("execute", $_POST)) {
        $commandState = CommandStates::Execute;
    } else {
        if (array_key_exists("previewThenExecute", $_POST)) {
            $commandState = CommandStates::PreviewThenExecute;
        } else {
            $commandState = CommandStates::Preview;
        }
    }
    printOutputPageHeading($commandState);
    if (!empty($_POST)) {
        // reading and checking params for the command
        if (!(array_key_exists('session', $_POST) && array_key_exists('season', $_POST))) {
            $errors .= "Fatal Error: Session Year or Season is empty. This may be a bug<br/><br/>";
        } else {
            $session = $_POST['session'];
            $season = $_POST['season'];
        }
        populateCourseInfoFromPOST();
        printCourseInfo($commandState, $className, $configFolderName, $session, $department, $courseNo, $sectionNo, $season);
        $media = new media();
        $annotationsDB = new annotationsDB();
        $nothingToDo = false;
        $oldAnnotationsAndComments = array();
        $videosInCourse = $media->getVideosByClassID($classID);
        if (!empty($videosInCourse)) {
            $videosInCourseCount = count($videosInCourse);
            foreach ($videosInCourse as $video) {
                $videosInCourseText[] = "ID:" . $video['video_id'] . " Title:\"" . $video['title'] . "\" Length:" . $video['duration'] . "\n";
                $oldAnnotationCollections[] = $annotationsDB->getAnnotations($video['video_id'], null, true, ALL);
            }
            foreach ($oldAnnotationCollections as $annotationCollection) {
                if (!empty($annotationCollection)) {
                    foreach ($annotationCollection as $annotation) {
                        $oldAnnotationsAndComments[] = $annotation;
                    }
                }
            }
            if ($commandState == CommandStates::Preview) {
                print "<br/><b>There are {$videosInCourseCount} videos in course {$className}.</b><br/>";
                DEBUG_printSimpleArray($videosInCourseText, 8, 70, "\n");
                print "<br/>";
            }
            print "<br/>";
            if (empty($oldAnnotationsAndComments)) {
                print "<b>There is no active annotations and general comments in this course. Nothing to do.</b><br/><br/>";
                $nothingToDo = true;
            } else {
                $oldAnnotationsAndCommentsCount = count($oldAnnotationsAndComments);
                if ($commandState == CommandStates::Preview) {
                    print "<b>There are {$oldAnnotationsAndCommentsCount} annotations and general comments\r\n\t\t\t\t\tfor {$videosInCourseCount} VIDEOs in course {$className}. Please verify before deleting.</b><br/>";
                    print "<div style=\"min-width:1024px;text-align:center;font-size:75%\">";
                    print "<div style=\"margin-left:auto;margin-right:auto;border:1px solid gray;height:200px;width:1030px;white-space:pre-wrap;overflow:scroll;\">";
                    foreach ($oldAnnotationsAndComments as $annotation) {
                        if (!is_null($annotation)) {
                            if ($annotation['is_private'] == 0) {
                                print "Annotation ID " . $annotation['annotation_id'] . " User " . $annotation['user_name'] . " Date " . $annotation['creation_date'] . " Content '" . $annotation['description'] . "' Tags '" . $annotation['tags'];
                            }
                        } else {
                            print "<span style=\"color:red\">null entry. Could be a bug.</span>";
                        }
                        print "<br/>";
                    }
                    print "</div></div>";
                }
            }
        } else {
            print "<b>There is no videos in this course yet. Nothing to do.</b><br/><br/>";
            $nothingToDo = true;
        }
        if (empty($errors)) {
            if (!$nothingToDo) {
                if ($commandState == CommandStates::Execute || $commandState == CommandStates::PreviewThenExecute) {
                    print "<div style=\"min-width:1024px;text-align:center;font-size:75%\">";
                    print "<div style=\"margin-left:auto;margin-right:auto;border:1px solid gray;height:200px;width:1030px;white-space:pre-wrap;overflow:scroll;\">";
                    foreach ($oldAnnotationsAndComments as $annotation) {
                        $annotationID = $annotation['annotation_id'];
                        $result = $annotationsDB->deleteAnnotation($annotationID);
                        UTIL_printQueryResultNicely("delete annotation " . $annotationID, $result, $dbConnection);
                    }
                    if (empty($oldAnnotationsAndComments)) {
                        print "???";
                    }
                    print "</div></div>";
                    print "<br/><b>STOP! Please check the database query outputs to make sure that everything is\r\n\t\t\t\t\t\t\t<span style=\"color:green;\">green</span>\r\n\t\t\t\t\t\t\tbefore finishing.\r\n\t\t\t\t\t\t\t</b><br/>";
                    print "<br/><span style=\"color:blue;font-weight:bold;\">\r\n\t\t\t\t\t\t\tIf you are cleaning annotations for a new term (so that you can reuse the same videos in a course)<br/>\r\n\t\t\t\t\t\t\tYou might also want to update the enrollment list afterward.\r\n\t\t\t\t\t\t\t</span>\r\n\t\t\t\t\t\t\t<br/><br/>";
                    printOutputPageFooting(CommandStates::Execute, $className);
                } else {
                    if ($commandState == CommandStates::Preview) {
                        printExecuteRemoveAnnotationsForm($classID, $session, $season, "Go Ahead and Execute the Annotations Removal");
                        printOutputPageFooting(CommandStates::Preview, $className);
                    }
                }
            } else {
                printOutputPageFooting(CommandStates::Preview, $className);
            }
        } else {
            print "{$errors}";
            printOutputPageFooting(CommandStates::Error, $className);
        }
        $media->close();
        $annotationsDB->close();
    } else {
        print "<br/><span style=\"color:red;font-weight:bold\">\r\n\t\t\t\tFATAL ERROR! POST parameter list empty. You may have found a bug.<br/>\r\n\t\t\t\tPlease email thomas.dang@ubc.ca with as much info as possible of the context when this error appears.<br/>\r\n\t\t\t\t</span>\r\n\t\t\t\t<br/>";
        printOutputPageFooting(CommandStates::Error, $className);
    }
}
Exemplo n.º 16
0
	private function _getData()
	{
		if(count($_POST))
		{
			$this->post=$_POST;
			$acts=explode(",",$this->post("render-".$this->config("","elNameAction")));
			foreach($acts as $key=>$value)if($value)$this->actions[]=trim($value);
		}
		media::check();
	}
Exemplo n.º 17
0
 /**
  * Response when updating role succeed.
  *
  * @param  \Orchestra\Model\Role  $role
  *
  * @return mixed
  */
 public function destroySucceed(media $media)
 {
     $message = trans('orchestra/control::response.roles.delete', ['name' => $media->getAttribute('name')]);
     return $this->redirectWithMessage(handles('orchestra::media'), $message);
 }
Exemplo n.º 18
0
 *  Copyright (C) 2014  An Zhao, University of South Australia, Australia
 *  Copyright (C) 2014  Dragan Gasevic, University of Edinburgh, United Kingdom
 *  Copyright (C) 2014  Negin Mirriahi, University of New South Wales, Australia
 *  Copyright (C) 2014  Abelardo Pardo, University of Sydney, Australia
 *  Copyright (C) 2014  Alan Kingstone, University of British Columbia, Canada
 *  Copyright (C) 2014  Thomas Dang, , University of British Columbia, Canada
 *  Copyright (C) 2014 John Bratlien, University of British Columbia, Canada 
 *
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by 
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>
 */
require_once dirname(__FILE__) . "/../includes/common.inc.php";
require_once dirname(__FILE__) . "/../database/media.php";
startSession();
// TODO: validate input
$videoID = $_GET['video_id'];
$media = new media();
//print "videoID: $videoID";
$groupID = $media->getVideoGroup($videoID);
$media->close();
print json_encode($groupID);
Exemplo n.º 19
0
    exit('success');
} elseif ($func == 'insert_image') {
    $caption = $_POST['caption'];
    $credits = $_POST['credits'];
    $fields = array('caption' => $caption, 'credits' => $credits, 'mod_time' => 'now()');
    aql::update('media_item', $fields, $media_item_id);
    if ($_POST['tab'] == 'slideshow') {
        $aql = "blog_article{\n\t\t\t\t\t\t\t\twhere blog_article.ide = {$blog_article_ide} \n\t\t\t\t\t\t\t\tand media_item_ide = {$media_item_ide}\n\t\t\t\t\t\t\t}";
        $rs = aql::select($aql);
        if (!$rs) {
            $vfolder_path = '/blog/blog_article/' . $blog_article_id . '/images';
            $img = media::get_item($media_item_ide);
            media::new_item($img['local_path'], $vfolder_path, $fields);
        }
    }
    $img = media::get_item($media_item_id, $_POST['width'], $_POST['height'], $_POST['crop']);
    /*
    ?>
    	<div class="article_image">
    <?
    */
    ?>
		<img class="article_image" src="<?php 
    echo $blog_img_absolute ? 'http://' . $_SERVER['SERVER_NAME'] : '';
    echo $img['src'];
    ?>
" border="0" alt="" width="<?php 
    echo $img['width'];
    ?>
" height="<?php 
    echo $img['height'];
Exemplo n.º 20
0
		<div class="field">
			<?php 
$field = 'quality';
?>
			<label class="label" for="<?php 
echo $field;
?>
">Quality (affects entire image folder/album)</label>
			<?php 
$params = array('name' => 'quality', 'selected_value' => $r['quality'] ? $r['quality'] : $default_image_quality, 'null_option' => false);
snippet::dropdown($quality, $params);
?>
		</div>	
	</div>
	<div class = "col float-left">
		<div class = "properties-image">
<?php 
$img = media::get_item($r['media_item_ide']);
?>
	<img src="/media/<?php 
echo $img['media_instance_ide'];
?>
" width="200" />
			<div class = "filename"><?php 
echo $img['filename'];
?>
</div>
		</div>
	</div>
</div>
<div class = "clear"></div>
Exemplo n.º 21
0
    switch ($_GET["a"]) {
        case 'logout':
            unset($_COOKIE['ea_user']);
            setcookie('ea_user', null, -1, '/');
            break;
        case 'delete_post':
            post::delete_post($_GET['id']);
            header("Location: index.php?p=" . (isset($_GET["is_page"]) ? "pages" : "archive"));
            break;
        case 'delete_category':
            category::delete_category($_GET['id']);
            header("Location: index.php?p=category");
            break;
        case 'delete_comment':
            comment::delete_comment($_GET['id']);
            header("Location: index.php?p=comment");
            break;
        case 'delete_image':
            media::delete_media($_GET['id']);
            header("Location: index.php?p=images");
            break;
        case 'delete_sm':
            social_media::delete_social_media($_GET['id']);
            header("Location: index.php?p=social_media");
            break;
        default:
            # code...
            break;
    }
}
ob_end_flush();
Exemplo n.º 22
0
 public static function getExtensionList()
 {
     if (is_null(self::$extension)) {
         self::$extension = dyn::get('addons')['mediamanager']['extensions'];
     }
 }
Exemplo n.º 23
0
 public static function searchNotes($pack)
 {
     if (isset($pack->auth)) {
         $pack->auth->game_id = $pack->game_id;
         $pack->auth->permission = "read_write";
         $auth_user = users::authenticateUser($pack->auth);
         $auth_editor = editors::authenticateGameEditor($pack->auth);
     } else {
         $auth_user = false;
         $auth_editor = false;
     }
     $game_id = intval($pack->game_id);
     $search_terms = isset($pack->search_terms) ? $pack->search_terms : array();
     $note_count = intval($pack->note_count);
     $user_id = $auth_user ? intval($pack->auth->user_id) : 0;
     $order_by = $pack->order_by;
     $filter_by = $pack->filter_by;
     $tag_ids = isset($pack->tag_ids) ? array_map('intval', $pack->tag_ids) : array();
     $note_id = intval($pack->note_id);
     $lines = array();
     $selects = array("notes.*", "users.user_name", "users.display_name", "object_tags.tag_id", "tags.tag", "COUNT(all_likes.note_like_id) AS note_likes", "COUNT(my_likes.note_like_id) > 0 AS player_liked", "triggers.latitude", "triggers.longitude", "media.name AS media_name", "media.file_name AS media_file_name", "media.file_folder AS media_file_folder");
     $lines[] = "SELECT " . implode(", ", $selects);
     $lines[] = "FROM notes";
     $lines[] = "JOIN users ON notes.user_id = users.user_id";
     if ($order_by === 'popular' || !empty($search_terms)) {
         $lines[] = "LEFT JOIN note_comments ON notes.note_id = note_comments.note_id";
     }
     $lines[] = "LEFT JOIN object_tags ON object_tags.object_type = 'NOTE' AND notes.note_id = object_tags.object_id";
     $lines[] = "LEFT JOIN tags ON object_tags.tag_id = tags.tag_id";
     $lines[] = "LEFT JOIN note_likes AS all_likes ON notes.note_id = all_likes.note_id";
     $lines[] = "LEFT JOIN note_likes AS my_likes ON notes.note_id = my_likes.note_id AND my_likes.user_id = '{$user_id}'";
     $lines[] = "LEFT JOIN instances ON instances.object_type = 'NOTE' AND notes.note_id = instances.object_id";
     $lines[] = "LEFT JOIN triggers ON triggers.instance_id = instances.instance_id AND triggers.type = 'LOCATION'";
     $lines[] = "LEFT JOIN media ON media.media_id = notes.media_id";
     $lines[] = "WHERE 1=1";
     $lines[] = "AND notes.game_id = '{$game_id}'";
     $searchables = array('notes.name', 'notes.description', 'users.user_name', 'users.display_name', 'note_comments.description');
     foreach ($search_terms as $term) {
         $matches = array();
         $term = addslashes($term);
         foreach ($searchables as $key) {
             $matches[] = "({$key} LIKE '%{$term}%')";
         }
         $lines[] = 'AND (' . implode(' OR ', $matches) . ')';
     }
     if ($user_id && $filter_by === 'mine') {
         $lines[] = "AND notes.user_id = '{$user_id}'";
     }
     if (!empty($tag_ids)) {
         $tag_list = implode(',', $tag_ids);
         $lines[] = "AND object_tags.tag_id IN ({$tag_list})";
     }
     if ($note_id) {
         $lines[] = "AND notes.note_id = '{$note_id}'";
     }
     if (!$auth_editor) {
         if ($auth_user) {
             $lines[] = "AND (notes.published != 'PENDING' OR notes.user_id = '{$user_id}')";
         } else {
             $lines[] = "AND notes.published != 'PENDING'";
         }
     }
     $lines[] = "GROUP BY notes.note_id";
     if ($order_by === 'popular') {
         $lines[] = "ORDER BY (COUNT(all_likes.note_id) + COUNT(note_comments.note_id)) DESC";
     } else {
         if ($order_by === 'recent') {
             $lines[] = "ORDER BY notes.created DESC";
         }
     }
     if ($note_count) {
         $lines[] = "LIMIT {$note_count}";
     }
     $query = implode(' ', $lines);
     $sql_notes = dbconnection::queryArray($query);
     $notes = array();
     for ($i = 0; $i < count($sql_notes); $i++) {
         $ob = notes::noteObjectFromSQL($sql_notes[$i]);
         if (!$ob) {
             continue;
         }
         foreach (array('tag_id', 'note_likes', 'tag', 'latitude', 'longitude', 'user_name', 'display_name', 'player_liked') as $field) {
             $ob->{$field} = $sql_notes[$i]->{$field};
         }
         $sql_media = $sql_notes[$i];
         $sql_media->name = $sql_media->media_name;
         $sql_media->file_name = $sql_media->media_file_name;
         $sql_media->file_folder = $sql_media->media_file_folder;
         $ob->media = new return_package(0, media::mediaObjectFromSQL($sql_media));
         $ob->comments = note_comments::getNoteCommentsForNote((object) array('game_id' => $ob->game_id, 'note_id' => $ob->note_id));
         $notes[] = $ob;
     }
     return new return_package(0, $notes);
 }
Exemplo n.º 24
0
<?php

require_once dirname(__FILE__) . "/includes/global_deploy_config.php";
require_once dirname(__FILE__) . '/includes/kaltura/kaltura_functions.php';
require_once dirname(__FILE__) . "/includes/common.inc.php";
require_once dirname(__FILE__) . "/includes/auth.inc.php";
require_once dirname(__FILE__) . '/database/users.php';
require_once dirname(__FILE__) . '/database/media.php';
startSession();
$userName = $_SESSION['name'];
$userID = $_SESSION['user_id'];
//print "role:{$_SESSION['role']}<br />";
if (!isAdmin($_SESSION['role'])) {
    die($adminPrivRequiredMsg);
}
$media = new media();
$msg = "<p id=\"message\" style=\"font-weight:bold;font-size:90%\">\n\t\t</p>";
if (isset($_POST['submit'])) {
    global $media;
    $count = 1;
    $msg = "<p id=\"message\" class=\"upload-complete\" style=\"font-weight:bold;font-size:90%\">";
    //   foreach ($_FILES as $key=>$fileInfo) {
    // if no file uploaded, get out of this loop and do nothing
    print_r($fileInfo);
    $file = date("H:i:s__") . basename($fileInfo['name']);
    $path = $uploadPath . $file;
    // this is the full file name & path
    //  if (move_uploaded_file($fileInfo['tmp_name'], $path)) {
    // Check for audio files and auto convert to video first
    $inFile = $path;
    $outFile = $path . ".mov";
Exemplo n.º 25
0
         $alpha = $_GET['alpha'];
         $location = $_GET['location'];
         require_once PATH_FACEBOOK . "/classes/media.class.php";
         $mObj = new media($db);
         $mObj->setAppLink($app);
         $code = $mObj->ajaxRefreshPreview($userid, $imageIndex, $alpha, $location);
     } else {
         $error = true;
         $errorMsg = 'Invalid call';
     }
     break;
 case 'mediaRefreshProfileForm':
     if (isset($_GET['imageIndex'])) {
         $imageIndex = $_GET['imageIndex'];
         require_once PATH_FACEBOOK . "/classes/media.class.php";
         $mObj = new media($db);
         $mObj->setAppLink($app);
         $code = $mObj->ajaxBuildProfileForm($imageIndex, '', true);
     } else {
         $error = true;
         $errorMsg = 'Invalid call';
     }
     break;
 case 'stuffSetStatus':
     if (isset($_GET['id'])) {
         $id = $_GET['id'];
         $newStatus = $_GET['newStatus'];
         require_once PATH_FACEBOOK . "/classes/stuff.class.php";
         $sObj = new stuff($db);
         $code = $sObj->ajaxSetStatus($id, $newStatus);
     }
Exemplo n.º 26
0
<?php

require_once dirname(__FILE__) . '/../includes/common.inc.php';
require_once dirname(__FILE__) . "/../database/media.php";
startSession();
$userID = $_SESSION['user_id'];
$userName = $_SESSION['name'];
//print "hello";
//print_r($_POST);
$videoID = $_POST['video_id'];
$playbackPosition = $_POST['playback_position'];
//$inPlayback         = (bool) intval($_POST['in_playback']);
$playbackStart = (bool) intval($_POST['playback_start']);
$media = new media();
if ($playbackStart) {
    $media->playbackStarted($userID, $videoID, $playbackPosition);
} else {
    $media->playbackEnded($userID, $videoID, $playbackPosition);
}
$media->close();
Exemplo n.º 27
0
// TODO: validate input
$videoID = $_POST['video_id'];
echo "videoID is: " . $videoID;
$userID = $_SESSION['user_id'];
echo "userID is: " . $userID;
$title = $_POST['title'];
echo "title is: " . $title;
$url = $_POST['url'];
echo "url is: " . $url;
$description = $_POST['description'];
echo "description is: " . $description;
$dur = "";
$point1 = $_POST['point_one'];
$point2 = $_POST['point_two'];
$point3 = $_POST['point_three'];
$media = new media();
// delete hosted video as well if the deleting user is the one uploaded
// the kaltura deletion must happen before the OVAL database deletion for owner check to work
if ($media->userOwnsMedia($videoID, $userID)) {
    // TODO: this was commented out so that OVAL deletions becomes "soft delete"
    // implement more comprehensive soft deletion later, where deleted videos are
    // marked as deleted within OVAL, and get reassigned to the system-admin group.
    //
    // The system admin group will then have a "hard delete" command in video
    // management. This arrangement allow departments who administer their own
    // OVAL instance to do their own video management.
    //
    // deleteVideoOnKaltura($videoID);
}
?>
Exemplo n.º 28
0
<?php

$blog_article_ide = $blog_article_ide ? $blog_article_ide : IDE;
$blog_article_id = $blog_article_id ? $blog_article_id : decrypt($blog_article_ide, 'blog_article');
$vfolder_path = '/blog/blog_article/' . $blog_article_id . '/images';
$media_upload['vfolder_path'] = $vfolder_path;
$vfolder = media::get_vfolder($media_upload['vfolder_path']);
if (!$blog_article) {
    $blog_article = aql::profile('blog_article', $blog_article_ide);
}
?>

<div class = "has-floats" id = "images">
	<input type = "hidden" name = "vfolder_path" id = "vfolder_path" value = "<?php 
echo $vfolder_path;
?>
"/>
	<input type = "hidden" name = "session_id" id = "session_id" value = "<?php 
echo session_id();
?>
"/>
<?php 
include 'container.php';
?>
	<div id="blog-post-images" class="float-left blog-post-images">
<?php 
include 'items.php';
?>
		<!--ajax goes here: blog image library-->
	</div>
</div>
Exemplo n.º 29
0
<?php

require_once dirname(__FILE__) . '/../includes/common.inc.php';
require_once dirname(__FILE__) . "/../database/media.php";
startSession();
$userID = $_SESSION['user_id'];
$userName = $_SESSION['name'];
//print "hello";
//print_r($_POST);
$videoID = $_POST['video_id'];
$media = new media();
$media->updateTotalViews($userID, $videoID);
$media->close();
Exemplo n.º 30
0
 public static function getMediaForGame($pack)
 {
     $sql_medias = dbconnection::queryArray("SELECT * FROM media WHERE (game_id = '{$pack->game_id}' OR (game_id = 0 AND user_id = 0))");
     $medias = array();
     for ($i = 0; $i < count($sql_medias); $i++) {
         if ($ob = media::mediaObjectFromSQL($sql_medias[$i])) {
             $medias[] = $ob;
         }
     }
     return new return_package(0, $medias);
 }