Ejemplo n.º 1
0
/**
* @desc Visualiza la lista de amigos del usuario
**/
function showFriends()
{
    global $xoopsOption, $tpl, $db, $xoopsUser, $xoopsModuleConfig, $pag, $xoopsConfig;
    $xoopsOption['template_main'] = 'gs_panel_friends.html';
    include 'header.php';
    $mc =& $xoopsModuleConfig;
    GSFunctions::makeHeader();
    //Barra de Navegación
    $sql = "SELECT COUNT(*) FROM " . $db->prefix('gs_friends') . " WHERE gsuser='******'";
    $page = isset($pag) ? $pag : '';
    $limit = 30;
    list($num) = $db->fetchRow($db->query($sql));
    if ($page > 0) {
        $page -= 1;
    }
    $start = $page * $limit;
    $tpages = (int) ($num / $limit);
    if ($num % $limit > 0) {
        $tpages++;
    }
    $pactual = $page + 1;
    if ($pactual > $tpages) {
        $rest = $pactual - $tpages;
        $pactual = $pactual - $rest + 1;
        $start = ($pactual - 1) * $limit;
    }
    if ($tpages > 1) {
        if ($mc['urlmode']) {
            $urlnav = 'cpanel/friends';
        } else {
            $urlnav = 'cpanel.php?by=cpanel/friends';
        }
        $nav = new GsPageNav($num, $limit, $start, 'pag', $urlnav, 0);
        $tpl->assign('friendsNavPage', $nav->renderNav(4, 1));
    }
    $showmax = $start + $limit;
    $showmax = $showmax > $num ? $num : $showmax;
    $tpl->assign('lang_showing', sprintf(__('Sowing friends %u to %u from %u.', 'galleries'), $start + 1, $showmax, $num));
    $tpl->assign('limit', $limit);
    $tpl->assign('pag', $pactual);
    //Fin de barra de navegación
    $sql = "SELECT * FROM " . $db->prefix('gs_friends') . " WHERE gsuser='******'";
    $sql .= " LIMIT {$start},{$limit}";
    $result = $db->query($sql);
    while ($row = $db->fetchArray($result)) {
        $xu = new XoopsUser($row['uid']);
        $tpl->append('users', array('uid' => $xu->uid(), 'uname' => $xu->uname(), 'link' => XOOPS_URL . "/modules/galleries/" . ($mc['urlmode'] ? "usr/" . $xu->uname() . "/" : "user.php?id=usr/" . $xu->uname()), 'avatar' => RMEvents::get()->run_event('rmcommon.get.avatar', $xu->email(), 0, $xu->user_avatar() != '' ? XOOPS_URL . '/uploads/avatars/' . $xu->user_avatar() : GS_URL . '/images/avatar.png')));
    }
    $tpl->assign('lang_uname', __('User name', 'galleries'));
    $tpl->assign('lang_newfriend', __('New Friend', 'galleries'));
    $tpl->assign('lang_del', __('Delete', 'galleries'));
    $tpl->assign('lang_confirm', __('Do you really wish to delete specified friend?', 'galleries'));
    $tpl->assign('lang_confirms', __('Do you really wish to delete selected friends?', 'galleries'));
    $tpl->assign('form_action_add', GSFunctions::get_url() . ($mc['urlmode'] ? 'cp/add/' : '?cp=add'));
    $tpl->assign('form_action_del', GSFunctions::get_url() . ($mc['urlmode'] ? 'cp/delete/' : '?cp=delete'));
    $tpl->assign('delete_link', GSFunctions::get_url() . ($mc['urlmode'] ? 'cp/deletefriend/pag/' . $pactual . '/id/' : '?cp=deletefriend&page=' . $pactual . '&id='));
    RMTemplate::get()->add_style('panel.css', 'galleries');
    createLinks();
    include 'footer.php';
}
Ejemplo n.º 2
0
function showReports()
{
    global $xoopsModule, $xoopsConfig, $xoopsSecurity;
    //Indica la lista a mostrar
    $show = isset($_REQUEST['show']) ? intval($_REQUEST['show']) : '0';
    //$show = 0 Muestra todos los reportes
    //$show = 1 Muestra los reportes revisados
    //$show = 2 Muestra los reportes no revisados
    define('RMCSUBLOCATION', $show == 0 ? 'allreps' : ($show == 1 ? 'reviews' : 'noreviewd'));
    $db = XoopsDatabaseFactory::getDatabaseConnection();
    //Lista de Todos los reportes
    $sql = "SELECT * FROM " . $db->prefix('mod_bxpress_report') . ($show ? $show == 1 ? " WHERE zapped=1" : " WHERE zapped=0 " : '') . " ORDER BY report_time DESC";
    $result = $db->queryF($sql);
    $reports = array();
    $tf = new RMTimeFormatter(0, '%T% %d%, %Y% %h%:%i%:%s%');
    while ($rows = $db->fetchArray($result)) {
        $report = new bXReport();
        $report->assignVars($rows);
        $user = new XoopsUser($report->user());
        $post = new bXPost($report->post());
        $topic = new bXTopic($post->topic());
        $forum = new bXForum($post->forum());
        if ($report->zappedBy() > 0) {
            $zuser = new XoopsUser($report->zappedBy());
        }
        $reports[] = array('id' => $report->id(), 'post' => array('link' => $post->permalink(), 'id' => $report->post()), 'user' => $user->uname(), 'uid' => $user->uid(), 'date' => $tf->format($report->time()), 'report' => $report->report(), 'forum' => array('link' => $forum->permalink(), 'name' => $forum->name()), 'topic' => array('link' => $topic->permalink(), 'title' => $topic->title()), 'zapped' => $report->zapped(), 'zappedby' => $report->zappedby() > 0 ? array('uid' => $zuser->uid(), 'name' => $zuser->uname()) : '', 'zappedtime' => $report->zappedtime() > 0 ? $tf->format($report->zappedtime()) : '');
    }
    RMTemplate::get()->add_local_script('jquery.checkboxes.js', 'rmcommon', 'include');
    RMTemplate::get()->add_local_script('admin.js', 'bxpress');
    RMTemplate::get()->set_help('http://www.redmexico.com.mx/docs/bxpress-forums/introduccion/standalone/1/');
    RMTemplate::get()->assign('xoops_pagetitle', __('Reports Management', 'bxpress'));
    $bc = RMBreadCrumb::get();
    $bc->add_crumb(__('Reports management', 'bxpress'));
    xoops_cp_header();
    include RMTemplate::get()->get_template('admin/forums-reports.php', 'module', 'bxpress');
    xoops_cp_footer();
}
Ejemplo n.º 3
0
 if ($d_sortby != $sortby) {
     $pagenav_args .= '&sortby=' . $sortby;
 }
 $num_users = $xoopsDB->getRowsNum($result);
 //number of users per sorted and limit query
 if ($totalcount > 0) {
     while ($userinfo = $xoopsDB->fetchArray($result)) {
         $userinfo = new XoopsUser($userinfo['uid']);
         $user = array();
         $avatar = $userinfo->user_avatar();
         if ($avatar == 'blank.gif' && $xoopsModuleConfig['defaultavatar']) {
             $user['avatar'] = "<img src='" . XOOPS_URL . "/modules/membership/images/davatar.gif' alt='' width='64' height='64' />";
         } else {
             $user['avatar'] = "<img src='" . XOOPS_URL . "/uploads/" . $userinfo->user_avatar() . "' alt='' width='64' height='64' />";
         }
         $user['nickname'] = "<a href='" . XOOPS_URL . "/userinfo.php?uid=" . $userinfo->uid() . "'>" . $userinfo->uname("E") . "</a>";
         $user['regdate'] = formatTimeStamp($userinfo->user_regdate(), "m");
         $showmail = 0;
         if ($userinfo->user_viewemail()) {
             $showmail = 1;
         } else {
             if ($is_admin) {
                 $showmail = 1;
             }
         }
         if ($showmail) {
             $user['email'] = "<a href='mailto:" . $userinfo->email("E") . "'>";
             $user['email'] .= "<img src='" . XOOPS_URL . "/images/icons/email.gif' border='0' alt='" . sprintf(_SENDEMAILTO, $userinfo->uname("E")) . "' /></a>";
         } else {
             $user['email'] = "";
         }
Ejemplo n.º 4
0
function saveBulkImages()
{
    $mc = RMUtilities::module_config('galleries');
    XoopsLogger::getInstance()->activated = false;
    XoopsLogger::getInstance()->renderingEnabled = false;
    set_time_limit(0);
    $security = TextCleaner::getInstance()->decrypt(rmc_server_var($_POST, 'rmsecurity', 0), true);
    $data = explode("|", $security);
    $xoopsUser = new XoopsUser($data[1]);
    if (!isset($data[1]) || $data[1] != XOOPS_URL . '/modules/galleries/admin/images.php') {
        send_error(__('You are not allowed to do this action', 'galleries'));
    }
    foreach ($_POST as $k => $v) {
        ${$k} = $v;
    }
    $ruta = "page={$page}&search={$search}&owner={$uid}&sort={$sort}&mode={$mode}";
    if ($xoopsUser->uid() == $uid) {
        $xu = $xoopsUser;
    } else {
        $xu = new XoopsUser($uid);
    }
    //Verificamos si el usuario se encuentra registrado
    $user = new GSUser($xu->uname());
    if ($user->isNew()) {
        //Insertamos información del usuario
        $user->setUid($uid);
        $user->setUname($xu->uname());
        $user->setQuota($mc['quota'] * 1024 * 1024);
        $user->setDate(time());
        if (!$user->save()) {
            send_error(__('User owner could not be created!', 'galleries') . "<br />" . $user->errors());
            die;
        } else {
            mkdir($mc['storedir'] . "/" . $user->uname());
            mkdir($mc['storedir'] . "/" . $user->uname() . "/ths");
            mkdir($mc['storedir'] . "/" . $user->uname() . "/formats");
        }
    } else {
        @mkdir($mc['storedir'] . "/" . $user->uname());
        @mkdir($mc['storedir'] . "/" . $user->uname() . "/ths");
        @mkdir($mc['storedir'] . "/" . $user->uname() . "/formats");
    }
    // Insertamos las etiquetas
    $tgs = explode(",", $tags);
    /**
     * @desc Almacena los ids de las etiquetas que se asignarán a la imágen
     */
    $ret = array();
    foreach ($tgs as $k) {
        $k = trim($k);
        if ($k == '') {
            continue;
        }
        // Comprobamos que la palabra tenga la longitud permitida
        if (strlen($k) < $mc['min_tag'] || strlen($k) > $mc['max_tag']) {
            continue;
        }
        // Creamos la etiqueta
        $tag = new GSTag(TextCleaner::getInstance()->sweetstring($k));
        if (!$tag->isNew()) {
            // Si ya existe nos saltamos
            $ret[] = $tag->id();
            continue;
        }
        $tag->setTag($k);
        if ($tag->save()) {
            $ret[] = $tag->id();
        }
    }
    $errors = '';
    $k = 1;
    include_once RMCPATH . '/class/uploader.php';
    $updir = $mc['storedir'] . "/" . $xu->uname();
    $upths = $mc['storedir'] . "/" . $xu->uname() . "/ths";
    // Cargamos la imágen
    if (!file_exists($updir)) {
        mkdir($updir, 511);
    }
    if (!file_exists($upths)) {
        mkdir($upths, 511);
    }
    $uploader = new RMFileUploader($updir, $mc['size_image'] * 1024, array('gif', 'jpg', 'jpeg', 'png'));
    $err = array();
    if (!$uploader->fetchMedia('Filedata')) {
        send_error($uploader->getErrors());
    }
    if (!$uploader->upload()) {
        send_error($uploader->getErrors());
    }
    // Insertamos el archivo en la base de datos
    $img = new GSImage();
    $img->setTitle($uploader->savedFileName);
    $img->setOwner($uid);
    $img->setPublic(2);
    $img->setCreated(time());
    $img->setImage($uploader->getSavedFileName());
    if (!$img->save()) {
        unlink($uploader->savedDestination);
        send_error(__('File could not be inserted to database!', 'galleries'));
    }
    $user->addPic();
    $img->setTags($ret);
    //Albumes
    $sets = explode(",", $sets);
    if (!empty($sets)) {
        foreach ($sets as $k => $v) {
            $album = new GSSet($v);
            $album->addPic($img->id());
        }
    }
    $ret['message'] = '1';
    $ret['id'] = $img->id();
    echo json_encode($ret);
    die;
}
Ejemplo n.º 5
0
 $n = 0;
 echo "<form method='post'>\n";
 if ($count > $max) {
     echo "<div>" . $nav->renderNav() . "</div>";
 }
 echo "<table class='outer'>\n";
 echo "<tr><th>" . _AM_RESERVATION . "</th><th>" . _AM_EVENT_DAY . "</th><th>" . _AM_TITLE . "</th>";
 echo "<th>" . _AM_POSTER . "</th><th>" . _AM_DISP_STATUS . "</th>";
 echo "<th>" . _AM_OPERATION . "</th></tr>\n";
 while ($data = $xoopsDB->fetchArray($result)) {
     $bg = $tags[$n++ % 2];
     $eid = $data['eid'];
     $date = eventdate($data['edate']);
     $title = "<a href='../event.php?eid={$eid}'>" . $data['title'] . "</a>";
     $poster = new XoopsUser($data['uid']);
     $u = "<a href='" . XOOPS_URL . "/userinfo.php?uid=" . $poster->uid() . "'>" . $poster->uname() . "</a>";
     $s = $data['status'];
     $sn = $ev_stats[$data['status']];
     if ($s == STAT_DELETED) {
         $sn = "<a href='../admin.php?op=delete&eid={$eid}' class='deleted'>{$sn}</a>";
     } elseif ($s == STAT_POST) {
         $sn = "<strong>{$sn}</strong>";
     }
     $ors = $xoopsDB->query("SELECT reservation FROM " . OPTBL . " WHERE eid={$eid}");
     if ($xoopsDB->getRowsNum($ors)) {
         list($resv) = $xoopsDB->fetchRow($ors);
         $mk = "<input type='hidden' name='rv[{$eid}]' value='on' />";
         $mk .= "<input type='checkbox' name='ck[{$eid}]' " . ($resv ? " checked" : "") . " />";
     } else {
         $mk = "&nbsp;";
     }
Ejemplo n.º 6
0
     $answer = str_replace("\r\n", "<br>", $answer);
     $answer = str_replace("\n", "<br>", $answer);
     $faqsa['answer'] = $answer;
     $faqsa['datesub'] = formatTimestamp($datesub, "D, d-M-Y, H:i");
     $faqsa['counter'] = $counter;
     $faqsa['question'] = $question;
     //$faqsa['printer'] = "index.php?op=print&t=".$t;
     //$faqsa['cjump'] = generatecjump();
     $faqsa['catlink'] = "<a href='javascript:history.go(-1)'>" . _MD_BACK2CAT . "</a><b> | </b><a href='./index.php'>" . _MD_RETURN2INDEX . "</a>";
     if ($uid == 0) {
         $faqsa['poster'] = "Guest";
     } else {
         $thisUser = new XoopsUser($uid);
         $thisUser->getVar("uname");
         $thisUser->getVar("uid");
         $faqsa['poster'] = "<a href='" . XOOPS_URL . "/userinfo.php?uid=" . $thisUser->uid() . "'>" . $thisUser->uname() . "</a>";
         //$thisUser->getVar("uname");
     }
     $xoopsTpl->assign('faqpage', $faqsa);
     $xoopsTpl->assign(array('lang_faq' => _MD_FAQ, 'lang_publish' => _MD_PUBLISH, 'lang_posted' => _MD_POSTED, 'lang_read' => _MD_READ, 'lang_times' => _MD_TIMES, 'lang_articleheading' => '<h4>' . $question . '</h4>'));
     break;
 case "default":
 default:
     global $xoopsUser, $xoopsConfig, $xoopsDB;
     $index = array();
     $xoopsOption['template_main'] = 'wffaq_index.html';
     $result = $xoopsDB->query("SELECT * FROM " . $xoopsDB->prefix("faqcategories") . " ORDER BY name");
     $total = $xoopsDB->getRowsNum($result);
     if ($total == 0) {
         redirect_header("javascript:history.go(-1)", 1, _MD_MAINNOCATADDED);
         exit;
Ejemplo n.º 7
0
    $data['features'][] = array('id' => $feature->id(), 'title' => $feature->title(), 'updated' => $updated, 'nameid' => $feature->nameid(), 'content' => $feature->content(), 'link' => $feature->permalink(), 'metas' => $dtfunc->get_metas('feat', $feature->id()));
}
unset($chars, $feature);
// Logs
$logs = $item->logs(true);
$data['logs'] = array();
foreach ($logs as $log) {
    $data['logs'][] = array('id' => $log->id(), 'title' => $log->title(), 'content' => $log->log(), 'date' => formatTimestamp($log->date(), 's'));
}
unset($logs, $log);
$data['metas'] = $dtfunc->get_metas('down', $item->id());
$data['approved'] = $item->getVar('approved');
$xoopsTpl->assign('item', $data);
// Usuario
$dtUser = new XoopsUser($item->getVar('uid'));
$xoopsTpl->assign('dtUser', array('id' => $dtUser->uid(), 'uname' => $dtUser->uname(), 'avatar' => $dtUser->getVar('user_avatar')));
if ($mc['daydownload']) {
    $xoopsTpl->assign('daily_items', $dtfunc->get_items(0, 'daily', $mc['limit_daydownload']));
    $xoopsTpl->assign('daily_width', floor(100 / $mc['limit_daydownload']));
    $xoopsTpl->assign('lang_daydown', __('<strong>Day</strong> Downloads', 'dtransport'));
}
// Desargas relacionadas
if ($mc['active_relatsoft']) {
    $xoopsTpl->assign('lang_related', __('<strong>Related</strong> Downloads', 'dtransport'));
    $xoopsTpl->assign('related_items', $dtfunc->items_by($relatedTags, 'tags', $item->id(), 'RAND()', 0, $mc['limit_relatsoft']));
}
if (!$item->getVar('approved')) {
    $xoopsTpl->assign('lang_noapproved', __('This item has not been approved yet! You can view this information but other users can not.', 'dtransport'));
}
// Lenguaje
$xoopsTpl->assign('lang_new', __('New', 'dtransport'));