function get_license($r1, $r2, $r3)
{
    require_once "lib/persistentObj/PersistentObjectController.php";
    $controller = new PersistentObjectController("License");
    $objResponse = new xajaxResponse();
    $answer = $r1 . $r2;
    if ($r3 != '-1') {
        $answer .= $r3;
    }
    $licenca = $controller->noStructureFindAll(array("answer" => $answer));
    $licenca =& $licenca[0];
    $objResponse->assign('ajax-licenseImg', 'src', 'styles/estudiolivre/h_' . $licenca['imageName'] . '?rand=' . rand());
    $objResponse->assign('ajax-licenseDesc', 'innerHTML', $licenca['description']);
    $objResponse->script("show('ajax-licenseCont');");
    return $objResponse;
}
function get_files($tipos, $offset, $maxRecords, $sort_mode, $userName = '', $find = '', $filters = array())
{
    global $smarty, $user, $tikilib;
    $objResponse = new xajaxResponse();
    $actualClass = array("Video" => "VideoPublication", "Audio" => "AudioPublication", "Imagem" => "ImagePublication", "Texto" => "TextPublication", "Outro" => "OtherPublication");
    $filters = array("actualClass" => array());
    foreach ($tipos as $tipo) {
        $filters["actualClass"][] = $actualClass[$tipo];
    }
    if ($userName) {
        $filters["user"] = $userName;
    }
    if ($find) {
        $smarty->load_filter('output', 'highlight');
        $_REQUEST['highlight'] = $find;
        require_once "lib/elgal/model/Find.php";
        $key = new Find(array("title", "description"));
        $filters[$find] = $key;
    }
    $filters["publishDate"] = true;
    $controller = new PersistentObjectController("Publication");
    $files = $controller->findAll($filters, $offset, $maxRecords, $sort_mode);
    $total = $controller->countAll($filters);
    $smarty->assign_by_ref('arquivos', $files);
    $smarty->assign('maxRecords', $maxRecords);
    $smarty->assign('offset', $offset);
    $smarty->assign('sort_mode', $sort_mode);
    $smarty->assign('total', $total);
    $smarty->assign('userName', $userName);
    $smarty->assign('find', $find);
    $smarty->assign('filters', $filters);
    $smarty->assign('currentPage', $offset / $maxRecords + 1);
    $smarty->assign('lastPage', ceil($total / $maxRecords));
    $smarty->assign('dontAskDelete', $tikilib->get_user_preference($user, 'el_dont_check_delete', 0));
    $objResponse->assign("ajax-listNav", "innerHTML", $smarty->fetch("el-gallery_pagination.tpl"));
    $objResponse->assign("ajax-navBottom", "innerHTML", $smarty->fetch("el-gallery_pagination.tpl"));
    $objResponse->assign("ajax-gListCont", "innerHTML", $smarty->fetch("el-gallery_section.tpl"));
    $objResponse->script("nd()");
    return $objResponse;
}
}
$smarty->assign('tipos', $tipos);
$actualClass = array("Video" => "VideoPublication", "Audio" => "AudioPublication", "Imagem" => "ImagePublication", "Texto" => "TextPublication", "Outro" => "OtherPublication");
$filters = array("actualClass" => array());
foreach ($tipos as $tipo) {
    $filters["actualClass"][] = $actualClass[$tipo];
}
if (isset($_REQUEST['highlight'])) {
    $find = $_REQUEST['highlight'];
} else {
    $find = '';
}
if ($find) {
    require_once "lib/elgal/model/Find.php";
    $key = new Find(array("title", "description"));
    $filters[$find] = $key;
}
$filters["publishDate"] = true;
$controller = new PersistentObjectController("Publication");
$files = $controller->findAll($filters, 0, 10, $sort_mode);
$total = $controller->countAll($filters);
$smarty->assign('maxRecords', 10);
$smarty->assign('offset', 0);
$smarty->assign('total', $total);
$smarty->assign('find', $find);
$smarty->assign('currentPage', 1);
$smarty->assign('lastPage', ceil($total / 10));
$smarty->assign_by_ref('arquivos', $files);
$smarty->assign('dontAskDelete', $tikilib->get_user_preference($user, 'el_dont_check_delete', 0));
$smarty->assign('mid', 'el-gallery_home.tpl');
$smarty->display('tiki.tpl');
if (!isset($_REQUEST['tag']) && isset($_REQUEST['tags'])) {
    $_REQUEST['tag'] = $_REQUEST['tags'];
}
$files = array();
if (isset($_REQUEST['tag']) && $_REQUEST['tag']) {
    $tagArray = split(",", $_REQUEST['tag']);
    $title .= " - Tags: " . $_REQUEST['tag'];
    $objects = $freetaglib->get_objects_with_tag_combo($tagArray, 'gallery', $userName);
    foreach ($objects['data'] as $object) {
        $arquivo = PersistentObjectFactory::createObject("Publication", (int) $object['itemId']);
        if (in_array($arquivo->type, $type)) {
            $files[] = $arquivo;
        }
    }
} else {
    $controller = new PersistentObjectController("Publication");
    $files = $controller->findAll($filters, 0, $maxRecords, $dateId . '_desc');
}
$uniqueid = $feed . $userName . $maxRecords . implode('', $type);
$changes = array();
$changes["data"] = array();
for ($i = 0; $i < sizeof($files); $i++) {
    if (sizeof($files[$i]->filereferences)) {
        $arquivo = array();
        $file =& $files[$i]->filereferences[0];
        // TODO: devem haver outros casos de nome de arquivo invalido alem de
        // 		 nomes de arquivo com espacos
        $arquivo["sefurl"] = str_replace(' ', '+', $file->fullPath());
        $arquivo["filesize"] = $file->size;
        $arquivo["filetype"] = $file->mimeType;
        $arquivo[$descId] = $tikilib->parse_data($files[$i]->{$descId});
<?php

/*
 * Created on May 5, 2007
 *
 * by: nano
 */
require_once "lib/persistentObj/PersistentObjectController.php";
global $userHasPermOnFile, $arquivoId, $arquivo, $tiki_p_el_admin_gallery;
$arquivoId = false;
if (isset($_REQUEST['arquivoId'])) {
    $arquivoId = $_REQUEST['arquivoId'];
    $controller = new PersistentObjectController("Publication");
    $arquivo = $controller->findOne(array("id" => $_REQUEST['arquivoId']));
    if ($arquivo) {
        if ($arquivo->user == $user || $tiki_p_el_admin_gallery == 'y') {
            $userHasPermOnFile = true;
        } else {
            $userHasPermOnFile = false;
        }
    }
}
Example #6
0
$smarty->assign_by_ref('arquivos', $uploads);
$total = $controller->countAll($filters);
$smarty->assign('dontAskDelete', $tikilib->get_user_preference($user, 'el_dont_check_delete', 0));
$smarty->assign('permission', $permission);
$smarty->assign('userName', $view_user);
$smarty->assign('maxRecords', 5);
$smarty->assign('offset', 0);
$smarty->assign('sort_mode', $sort_mode);
$smarty->assign('total', $total);
$smarty->assign('find', '');
$smarty->assign('filters', array());
$smarty->assign('currentPage', 1);
$smarty->assign('lastPage', ceil($total / 5));
// licenca padrao
if ($licencaId = $tikilib->get_user_preference($view_user, 'licencaPadrao')) {
    $lController = new PersistentObjectController("License");
    $licenca = $lController->noStructureFindAll(array("id" => $licencaId));
    $smarty->assign('licenca', $licenca[0]);
}
$userPosts = $bloglib->list_user_posts($view_user, 0, 5);
for ($i = 0; $i < sizeof($userPosts['data']); $i++) {
    $userPosts['data'][$i]['commentsCount'] = $commentslib->count_comments('post:' . $userPosts['data'][$i]['postId']);
}
$smarty->assign('userPosts', $userPosts);
$liveChannels = array();
$result = $tikilib->query('select * from el_ice where user = ?', array($view_user));
while ($row = $result->fetchRow()) {
    $liveChannels[] = $row;
}
$smarty->assign('liveChannels', $liveChannels);
$userMessages = $messulib->list_user_messages($view_user, 0, 5, 'date_desc', '', '', '', '', 'messages');
    die;
}
$smarty->assign('headtitle', "subir arquivo");
$smarty->assign('category', 'gallery');
$smarty->assign('tag_suggestion', $freetaglib->get_distinct_tag_suggestion('', 0, 10));
$smarty->assign('moreTagsOffset', 10);
//isto eh uma conveniencia, so pra bloquear a mudanca de campo no cliente
//nao garante seguranca
$smarty->assign('permission', $tiki_p_el_upload_files == 'y');
// licenca padrao
if ($licencaId = $tikilib->get_user_preference($user, 'licencaPadrao')) {
    $lController = new PersistentObjectController("License");
    $licenca = $lController->noStructureFindAll(array("id" => $licencaId));
    $smarty->assign('licenca', $licenca[0]);
}
$controller = new PersistentObjectController("Publication");
$pending = $controller->findAll(array('user' => $user, 'publishDate' => false));
$smarty->assign('pending', $pending);
if (isset($arquivo) && $arquivo->user == $user) {
    $tagString = '';
    foreach ($arquivo->tags as $t) {
        $tagString .= $t['tag'] . ", ";
    }
    $tagString = substr($tagString, 0, strlen($tagString) - 2);
    $arquivo->tagString = $tagString;
    $smarty->assign_by_ref("arquivo", $arquivo);
    if (isset($arquivo->license)) {
        $license = array();
        $license["imageName"] = $arquivo->license->imageName;
        $smarty->assign("licenca", $license);
    } else {
function set_licenca($r1, $r2, $r3)
{
    require_once "lib/persistentObj/PersistentObjectController.php";
    global $userlib, $tikilib;
    $controller = new PersistentObjectController("License");
    $objResponse = new xajaxResponse();
    $answer = $r1 . $r2;
    if ($r3 != '-1') {
        $answer .= $r3;
    }
    $licenca = $controller->noStructureFindAll(array("answer" => $answer));
    $licenca =& $licenca[0];
    $result = $userlib->set_user_field('licencaPadrao', $licenca["id"]);
    if (!$result) {
        $objResponse->alert("nao foi possivel definir a licença padrao");
    } else {
        $objResponse->assign('ajax-uLicence', 'src', 'styles/estudiolivre/h_' . $licenca['imageName'] . '?rand=' . rand());
    }
    return $objResponse;
}
function set_arquivo_licenca($r1, $r2, $r3, $padrao = false)
{
    global $userlib, $arquivo, $style;
    require_once "lib/persistentObj/PersistentObjectController.php";
    $controller = new PersistentObjectController("License");
    $objResponse = new xajaxResponse();
    $answer = $r1 . $r2;
    if ($r3 != '-1') {
        $answer .= $r3;
    }
    $licenca = $controller->noStructureFindAll(array("answer" => $answer));
    $licenca =& $licenca[0];
    if ($padrao) {
        $result = $userlib->set_user_field('licencaPadrao', $licenca["id"]);
        if (!$result) {
            $objResponse->alert("Não foi possivel editar o campo licencaPadrao");
        }
    }
    if (!$arquivo->update(array("licenseId" => $licenca["id"]))) {
        $objResponse->alert("Não foi possivel editar o campo licencaId");
    } else {
        $objResponse->assign('ajax-uImagemLicenca', 'src', 'styles/' . preg_replace('/\\.css/', '', $style) . '/img/h_' . $licenca["imageName"] . '?rand=' . rand());
    }
    return $objResponse;
}