Пример #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';
}
Пример #2
0
/**
* Shows all messages sent by users and stored in database
*/
function cm_show_messages()
{
    global $xoopsDB, $xoopsModuleConfig, $xoopsSecurity;
    // Styles
    RMTemplate::get()->add_style('admin.css', 'contact');
    // Pagination
    $page = rmc_server_var($_GET, 'page', 1);
    $page = $page <= 0 ? 1 : $page;
    $result = $xoopsDB->query("SELECT COUNT(*) FROM " . $xoopsDB->prefix("contactme"));
    list($num) = $xoopsDB->fetchRow($result);
    $limit = $xoopsModuleConfig['limit'];
    $tpages = ceil($num / $limit);
    $page = $page > $tpages ? $tpages : $page;
    $start = $num <= 0 ? 0 : ($page - 1) * $limit;
    $nav = new RMPageNav($num, $limit, $page, 5);
    $nav->target_url('index.php?page={PAGE_NUM}');
    // Get messages
    $messages = array();
    $result = $xoopsDB->query("SELECT * FROM " . $xoopsDB->prefix("contactme") . " ORDER BY id_msg DESC LIMIT {$start},{$limit}");
    $time = new RMTimeFormatter(0, __('%M% %d%, %Y%', 'contact'));
    while ($row = $xoopsDB->fetchArray($result)) {
        $msg = new CTMessage();
        $msg->assignVars($row);
        if ($msg->getVar('xuid')) {
            $user = new XoopsUser($msg->getVar('xuid'));
        }
        $messages[] = array('id' => $msg->id(), 'subject' => $msg->getVar('subject'), 'ip' => $msg->getVar('ip'), 'email' => $msg->getVar('email'), 'name' => $msg->getVar('name'), 'company' => $msg->getVar('org'), 'body' => $msg->getVar('body'), 'phone' => $msg->getVar('phone'), 'register' => $msg->getVar('register'), 'xuid' => $msg->getVar('xuid'), 'uname' => $msg->getVar('xuid') > 0 ? $user->uname() : '', 'date' => $time->format($msg->getVar('date')));
    }
    RMTemplate::get()->add_local_script('admin.js', 'contact');
    RMTemplate::get()->add_local_script('jquery.checkboxes.js', 'rmcommon');
    xoops_cp_header();
    include RMTemplate::get()->get_template('admin/ct_dashboard.php', 'module', 'contact');
    xoops_cp_footer();
}
 function get_submitter_info($uid)
 {
     if ($uid <= 0) {
         return _GUESTS;
     }
     $poster = new XoopsUser($uid);
     // check if invalid uid
     if ($poster->uname() == '') {
         return '';
     }
     if ($this->nameoruname == 'uname') {
         $name = $poster->uname();
     } else {
         $name = trim($poster->name());
         if ($name == "") {
             $name = $poster->uname();
         }
     }
     return "<a href='" . XOOPS_URL . "/userinfo.php?uid={$uid}'>{$name}</a>";
 }
Пример #4
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();
}
Пример #5
0
/**
* @desc Almacena la información del usuario en la base de datos
**/
function saveUsers($edit = 0)
{
    global $xoopsSecurity, $mc;
    foreach ($_POST as $k => $v) {
        ${$k} = $v;
    }
    $ruta = "&pag={$page}&search={$search}";
    if (!$xoopsSecurity->check()) {
        redirectMsg('users.php?' . ($edit ? "op=edit&id={$id}&" : '') . $ruta, __('Session token expired!', 'galleries'), 1);
        die;
    }
    $db = XoopsDatabaseFactory::getDatabaseConnection();
    if ($edit) {
        //Verificamos que el usuario sea válido
        if ($id <= 0) {
            redirectMsg('./users.php?' . $ruta, __('User id is not valid!', 'galleries'), 1);
            die;
        }
        //Verificamos que el usuario exista
        $user = new GSUser($id);
        if ($user->isNew()) {
            redirectMsg('./users.php?' . $ruta, __('Specified user does not exists!', 'galleries'), 1);
            die;
        }
        //Verificamos que el usuario no se encuentre registrado
        $sql = "SELECT COUNT(*) FROM " . $db->prefix('gs_users') . " WHERE uid={$uid} AND id_user<>{$id}";
        list($num) = $db->fetchRow($db->query($sql));
        if ($num > 0) {
            redirectMsg('./users.php?' . $ruta, __('This is user has been registered already!', 'galleries'), 1);
            die;
        }
    } else {
        //Verificamos que el usuario no se encuentre registrado
        $sql = "SELECT COUNT(*) FROM " . $db->prefix('gs_users') . " WHERE uid={$uid}";
        list($num) = $db->fetchRow($db->query($sql));
        if ($num > 0) {
            redirectMsg('./users.php?' . $ruta, __('This is user has been registered already!', 'galleries'), 1);
            die;
        }
        $user = new GSUser();
    }
    $user->setUid($uid);
    $xu = new XoopsUser($uid);
    $user->setUname($xu->uname());
    $user->setQuota($quota * 1024 * 1024);
    $user->isNew() ? $user->setDate(time()) : '';
    $user->setBlocked($block);
    if (!$user->save()) {
        redirectMsg('./users.php?' . $ruta, __('Errors ocurred while trying to save this user.', 'galleries') . '<br />' . $user->errors(), 1);
        die;
    } else {
        if ($edit) {
            @mkdir($mc['storedir'] . "/" . $user->uname(), 511);
            @mkdir($mc['storedir'] . "/" . $user->uname() . "/ths", 511);
            @mkdir($mc['storedir'] . "/" . $user->uname() . "/formats", 511);
        } else {
            mkdir($mc['storedir'] . "/" . $user->uname(), 511);
            mkdir($mc['storedir'] . "/" . $user->uname() . "/ths", 511);
            mkdir($mc['storedir'] . "/" . $user->uname() . "/formats", 511);
        }
        redirectMsg('./users.php?' . $ruta, __('User saved successfully!', 'galleries'), 0);
        die;
    }
}
Пример #6
0
         $post->setAuthor($row['uid']);
         $post->setDate($row['created']);
         $post->setModDate($row['published']);
         $post->setText($row['hometext'] . '<br />' . $row['bodytext']);
         $post->setStatus(1);
         $post->setAllowComs(1);
         $post->setAdvance(0);
         $post->addToCatego($cats[$row['topicid']]);
         $post->save();
         $stories[$row['storyid']] = $post->getID();
     }
     // Guardamos los comentarios
     $result = $db->query("SELECT * FROM " . $db->prefix("xoopscomments") . " WHERE com_modid='" . $module->mid() . "'");
     while ($row = $db->fetchArray($result)) {
         $xu = new XoopsUser($row['com_uid']);
         $sql = "INSERT INTO " . $db->prefix("mw_comments") . " (`post`,`nombre`,`email`,`texto`,`xu`,`fecha`,`aprovado`)\n\t\t\t\t\tVALUES ('" . $stories[$row['com_itemid']] . "','" . $xu->uname() . "','" . $xu->email() . "','{$row['com_text']}',\n\t\t\t\t\t'{$row['com_uid']}','{$row['com_created']}','" . ($row['com_status'] == 2 ? 1 : 0) . "')";
         $db->queryF($sql);
         $post = new NPPost($stories[$row['com_itemid']]);
         $post->setComments($post->getComments() + 1);
         $post->update();
     }
     redirect_header('posts.php', 2, _AS_NP_DBOK);
     die;
     break;
 default:
     xoops_cp_header();
     makeAdminNav();
     $hiddens['op'] = 'do';
     $buttons['sbt']['value'] = _SUBMIT;
     $buttons['sbt']['type'] = 'submit';
     $util->msgBox($hiddens, 'import_news.php', sprintf(_AS_NP_CONFIRMIMPORT, 'News'), '../images/question.png', $buttons, true, 400);
Пример #7
0
/**
* @desc Almacena información de las secciones
**/
function rd_save_sections($edit = 0)
{
    global $xoopsUser, $xoopsSecurity;
    foreach ($_POST as $k => $v) {
        ${$k} = $v;
    }
    if (!$xoopsSecurity->check()) {
        redirectMsg('./sections.php?op=new&id=' . $id, __('Session token expired!', 'docs'), 1);
        die;
    }
    if ($id <= 0) {
        redirectMsg('resources.php', __('A Document was not specified!', 'docs'), 1);
        die;
    }
    $res = new RDResource($id);
    if ($res->isNew()) {
        redirectMsg('resources.php', __('Specified Document does not exists!', 'docs'), 1);
        die;
    }
    $db = XoopsDatabaseFactory::getDatabaseConnection();
    if ($edit) {
        //Verifica si la sección es válida
        if ($id_sec <= 0) {
            redirectMsg('./sections.php?id=' . $id, __('No section has been specified', 'docs'), 1);
            die;
        }
        //Comprueba si la sección es existente
        $sec = new RDSection($id_sec);
        if ($sec->isNew()) {
            redirectMsg('./sections.php?id=' . $id, __('Section does not exists!', 'docs'), 1);
            die;
        }
        //Comprueba que el título de la sección no exista
        $sql = "SELECT COUNT(*) FROM " . $db->prefix('rd_sections') . " WHERE title='{$title}' AND id_res='{$id}' AND id_sec<>{$id_sec}";
        list($num) = $db->fetchRow($db->queryF($sql));
        if ($num > 0) {
            redirectMsg('./sections.php?op=new&id=' . $id, __('Already exists another section with same title!', 'docs'), 1);
            die;
        }
    } else {
        //Comprueba que el título de la sección no exista
        $sql = "SELECT COUNT(*) FROM " . $db->prefix('rd_sections') . " WHERE title='{$title}' AND id_res='{$id}'";
        list($num) = $db->fetchRow($db->queryF($sql));
        if ($num > 0) {
            redirectMsg('./sections.php?op=new&id=' . $id, __('Already exists another section with same title!', 'docs'), 1);
            die;
        }
        $sec = new RDSection();
    }
    //Genera $nameid Nombre identificador
    $nameid = !isset($nameid) || $nameid == '' ? TextCleaner::getInstance()->sweetstring($title) : $nameid;
    $sec->setVar('title', $title);
    $sec->setVar('content', $content);
    $sec->setVar('order', $order);
    $sec->setVar('id_res', $id);
    $sec->setVar('nameid', $nameid);
    $sec->setVar('parent', $parent);
    if (!isset($uid)) {
        $sec->setVar('uid', $xoopsUser->uid());
        $sec->setVar('uname', $xoopsUser->uname());
    } else {
        $xu = new XoopsUser($uid);
        if ($xu->isNew()) {
            $sec->setVar('uid', $xoopsUser->uid());
            $sec->setVar('uname', $xoopsUser->uname());
        } else {
            $sec->setVar('uid', $uid);
            $sec->setVar('uname', $xu->uname());
        }
    }
    if ($sec->isNew()) {
        $sec->setVar('created', time());
        $sec->setVar('modified', time());
    } else {
        $sec->setVar('modified', time());
    }
    // Metas
    if ($edit) {
        $sec->clear_metas();
    }
    // Clear all metas
    // Initialize metas array if not exists
    if (!isset($metas)) {
        $metas = array();
    }
    // Get meta key if "select" is visible
    if (isset($meta_name_sel) && $meta_name_sel != '') {
        $meta_name = $meta_name_sel;
    }
    // Add meta to metas array
    if (isset($meta_name) && $meta_name != '') {
        array_push($metas, array('key' => $meta_name, 'value' => $meta_value));
    }
    // Assign metas
    foreach ($metas as $value) {
        $sec->add_meta($value['key'], $value['value']);
    }
    RMEvents::get()->run_event('docs.saving.section', $sec);
    if (!$sec->save()) {
        if ($sec->isNew()) {
            redirectMsg('./sections.php?action=new&id=' . $id, __('Database could not be updated!', 'docs') . "<br />" . $sec->errors(), 1);
            die;
        } else {
            redirectMsg('./sections.php?action=edit&id=' . $id . '&sec=' . $id_sec, __('Sections has been saved but some errors ocurred', 'docs') . "<br />" . $sec->errors(), 1);
            die;
        }
    } else {
        $res->setVar('modified', time());
        $res->save();
        RMEvents::get()->run_event('docs.section.saved', $sec);
        if ($return) {
            redirectMsg('./sections.php?action=edit&sec=' . $sec->id() . '&id=' . $id, __('Database updated successfully!', 'docs'), 0);
        } else {
            redirectMsg('./sections.php?id=' . $id, __('Database updated successfully!', 'docs'), 0);
        }
    }
}
Пример #8
0
function get_pic_data($album, &$count, &$album_name, $limit1 = -1, $limit2 = -1, $set_caption = true)
{
    global $USER, $xoopsModuleConfig, $ALBUM_SET, $CURRENT_CAT_NAME, $HTML_SUBST, $THEME_DIR;
    global $GLOBALS;
    global $xoopsDB, $xoopsModule, $xoopsConfig;
    $myts =& MyTextSanitizer::getInstance();
    // MyTextSanitizer object
    $sort_array = array('na' => 'filename ASC', 'nd' => 'filename DESC', 'da' => 'pid ASC', 'dd' => 'pid DESC');
    $sort_code = isset($USER['sort']) ? $USER['sort'] : $xoopsModuleConfig['default_sort_order'];
    $sort_order = isset($sort_array[$sort_code]) ? $sort_array[$sort_code] : $sort_array[$xoopsModuleConfig['default_sort_order']];
    $limit = $limit1 != -1 ? ' LIMIT ' . $limit1 : '';
    $limit .= $limit2 != -1 ? ' ,' . $limit2 : '';
    if ($limit2 == 1) {
        $select_columns = '*';
    } else {
        $select_columns = 'pid, filepath, filename, url_prefix, filesize, pwidth, pheight, ctime';
    }
    // Regular albums
    if (is_numeric($album)) {
        $album_name = get_album_name($album);
        $approved = GALLERY_ADMIN_MODE ? '' : 'AND approved=\'YES\'';
        $result = $xoopsDB->query("SELECT count(*) from " . $xoopsDB->prefix("xcgal_pictures") . " WHERE aid='{$album}' {$approved} {$ALBUM_SET}");
        $nbEnr = $xoopsDB->fetchArray($result);
        $count = $nbEnr['count(*)'];
        $xoopsDB->freeRecordSet($result);
        if ($select_columns != '*') {
            $select_columns .= ', title, caption, owner_id';
        }
        $result = $xoopsDB->query("SELECT {$select_columns} from " . $xoopsDB->prefix("xcgal_pictures") . " WHERE aid='{$album}' {$approved} {$ALBUM_SET} ORDER BY {$sort_order} {$limit}");
        $rowset = db_fetch_rowset($result);
        $xoopsDB->freeRecordSet($result);
        // Set picture caption
        if ($set_caption) {
            foreach ($rowset as $key => $row) {
                $caption = $rowset[$key]['title'] ? "<span class=\"thumb_title\">" . $rowset[$key]['title'] . "</span>" : '';
                if ($xoopsModuleConfig['caption_in_thumbview']) {
                    $caption .= $rowset[$key]['caption'] ? "<span class=\"thumb_caption\">" . $myts->makeTareaData4Show($rowset[$key]['caption'], 0) . "</span>" : '';
                }
                if ($xoopsModuleConfig['display_comment_count']) {
                    $comments_nr = xoops_comment_count($xoopsModule->mid(), $row['pid']);
                    if ($comments_nr > 0) {
                        $caption .= "<span class=\"thumb_num_comments\">" . sprintf(_MD_FUNC_COM, $comments_nr) . "</span>";
                    }
                }
                $rowset[$key]['caption_text'] = $caption;
            }
        }
        return $rowset;
    }
    // Meta albums
    switch ($album) {
        case 'lastcom':
            // Last comments
            if ($ALBUM_SET && $CURRENT_CAT_NAME) {
                $album_name = $album_name = _MD_LASTCOM . ' - ' . $CURRENT_CAT_NAME;
            } else {
                $album_name = _MD_LASTCOM;
            }
            $result = $xoopsDB->query("SELECT count(*) from " . $xoopsDB->prefix("xoopscomments") . ", " . $xoopsDB->prefix("xcgal_pictures") . " WHERE com_modid = " . $xoopsModule->mid() . " AND approved='YES' AND com_itemid = pid {$ALBUM_SET}");
            $nbEnr = $xoopsDB->fetchArray($result);
            $count = $nbEnr['count(*)'];
            $xoopsDB->freeRecordSet($result);
            if ($select_columns != '*') {
                $select_columns = $select_columns . ', com_id, com_uid,com_itemid,com_rootid, com_exparams, com_created, com_title';
            }
            include_once XOOPS_ROOT_PATH . "/include/comment_constants.php";
            $result = $xoopsDB->query("SELECT {$select_columns} FROM " . $xoopsDB->prefix("xoopscomments") . ", " . $xoopsDB->prefix("xcgal_pictures") . " WHERE com_modid = " . $xoopsModule->mid() . " AND approved = 'YES' AND pid = com_itemid AND com_status=" . XOOPS_COMMENT_ACTIVE . " {$ALBUM_SET} ORDER by com_id DESC {$limit}");
            $rowset = db_fetch_rowset($result);
            $xoopsDB->freeRecordSet($result);
            $member_handler =& xoops_gethandler('member');
            $comment_config = $xoopsModule->getInfo('comments');
            if ($set_caption) {
                foreach ($rowset as $key => $row) {
                    if ($row['com_uid'] > 0) {
                        $poster =& $member_handler->getUser($row['com_uid']);
                        if (is_object($poster)) {
                            $posters = '<a href="' . XOOPS_URL . '/userinfo.php?uid=' . $row['com_uid'] . '">' . $poster->getVar('uname') . '</a>';
                        } else {
                            $posters = $GLOBALS['xoopsConfig']['anonymous'];
                        }
                    } else {
                        $posters = $GLOBALS['xoopsConfig']['anonymous'];
                    }
                    $comtitle = '<a href="' . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/' . $comment_config['pageName'] . '?' . $comment_config['itemName'] . '=' . $row['com_itemid'] . '&amp;com_id=' . $row['com_id'] . '&amp;com_rootid=' . $row['com_rootid'] . '&amp;com_mode=flat&amp;' . $row['com_exparams'] . '#comment' . $row['com_id'] . '">' . $row['com_title'] . '</a>';
                    $caption = "<span class=\"thumb_title\">" . $posters . '</span>' . "<span class=\"thumb_caption\">" . formatTimestamp($row['com_created'], 'm') . '</span>' . "<span class=\"thumb_caption\">" . $comtitle . '</span>';
                    $rowset[$key]['caption_text'] = $caption;
                }
            }
            return $rowset;
            break;
        case 'lastup':
            // Last uploads
            if ($ALBUM_SET && $CURRENT_CAT_NAME) {
                $album_name = _MD_LASTUP . ' - ' . $CURRENT_CAT_NAME;
            } else {
                $album_name = _MD_LASTUP;
            }
            $result = $xoopsDB->query("SELECT count(*) from " . $xoopsDB->prefix("xcgal_pictures") . " WHERE approved = 'YES' {$ALBUM_SET}");
            $nbEnr = $xoopsDB->fetchArray($result);
            $count = $nbEnr['count(*)'];
            $xoopsDB->freeRecordSet($result);
            if ($select_columns != '*') {
                $select_columns .= ', owner_id';
            }
            $result = $xoopsDB->query("SELECT {$select_columns} FROM " . $xoopsDB->prefix("xcgal_pictures") . " WHERE approved = 'YES' {$ALBUM_SET} ORDER BY pid DESC {$limit}");
            $rowset = db_fetch_rowset($result);
            $xoopsDB->freeRecordSet($result);
            if ($set_caption) {
                foreach ($rowset as $key => $row) {
                    $user_handler =& xoops_gethandler('member');
                    $pic_owner =& $user_handler->getUser($row['owner_id']);
                    if (is_object($pic_owner)) {
                        $user_link = '<br /><a href ="' . XOOPS_URL . '/userinfo.php?uid=' . $pic_owner->uid() . '">' . $pic_owner->uname() . '</a>';
                    } else {
                        $user_link = '';
                    }
                    $caption = "<span class=\"thumb_caption\">" . formatTimestamp($row['ctime'], 'm') . $user_link . '</span>';
                    $rowset[$key]['caption_text'] = $caption;
                }
            }
            return $rowset;
            break;
        case 'topn':
            // Most viewed pictures
            if ($ALBUM_SET && $CURRENT_CAT_NAME) {
                $album_name = _MD_TOPN . ' - ' . $CURRENT_CAT_NAME;
            } else {
                $album_name = _MD_TOPN;
            }
            $result = $xoopsDB->query("SELECT count(*) from " . $xoopsDB->prefix("xcgal_pictures") . " WHERE approved = 'YES' AND hits > 0  {$ALBUM_SET}");
            $nbEnr = $xoopsDB->fetchArray($result);
            $count = $nbEnr['count(*)'];
            $xoopsDB->freeRecordSet($result);
            if ($select_columns != '*') {
                $select_columns .= ', hits';
            }
            $result = $xoopsDB->query("SELECT {$select_columns} FROM " . $xoopsDB->prefix("xcgal_pictures") . " WHERE approved = 'YES' AND hits > 0 {$ALBUM_SET} ORDER BY hits DESC, ctime, mtime {$limit}");
            $rowset = db_fetch_rowset($result);
            $xoopsDB->freeRecordSet($result);
            if ($set_caption) {
                foreach ($rowset as $key => $row) {
                    $caption = "<span class=\"thumb_caption\">" . sprintf(_MD_FUNC_VIEW, $row['hits']) . '</span>';
                    $rowset[$key]['caption_text'] = $caption;
                }
            }
            return $rowset;
            break;
        case 'toprated':
            // Top rated pictures
            if ($ALBUM_SET && $CURRENT_CAT_NAME) {
                $album_name = _MD_TOPRATED . ' - ' . $CURRENT_CAT_NAME;
            } else {
                $album_name = _MD_TOPRATED;
            }
            $result = $xoopsDB->query("SELECT count(*) from " . $xoopsDB->prefix("xcgal_pictures") . " WHERE approved = 'YES' AND votes >= '{$xoopsModuleConfig['min_votes_for_rating']}' {$ALBUM_SET}");
            $nbEnr = $xoopsDB->fetchArray($result);
            $count = $nbEnr['count(*)'];
            $xoopsDB->freeRecordSet($result);
            if ($select_columns != '*') {
                $select_columns .= ', pic_rating, votes';
            }
            $result = $xoopsDB->query("SELECT {$select_columns} FROM " . $xoopsDB->prefix("xcgal_pictures") . " WHERE approved = 'YES' AND votes >= '{$xoopsModuleConfig['min_votes_for_rating']}' {$ALBUM_SET} ORDER BY ROUND((pic_rating+1)/2000) DESC, votes DESC {$limit}");
            $rowset = db_fetch_rowset($result);
            $xoopsDB->freeRecordSet($result);
            if ($set_caption) {
                foreach ($rowset as $key => $row) {
                    if (defined('THEME_HAS_RATING_GRAPHICS')) {
                        $prefix = $THEME_DIR;
                    } else {
                        $prefix = '';
                    }
                    $caption = "<span class=\"thumb_caption\">" . '<img src="' . $prefix . 'images/rating' . round($row['pic_rating'] / 2000) . '.gif" align="middle" alt=""/>' . '<br />' . sprintf(_MD_FUNC_VOTE, $row['votes']) . '</span>';
                    $rowset[$key]['caption_text'] = $caption;
                }
            }
            return $rowset;
            break;
        case 'lasthits':
            // Last viewed pictures
            if ($ALBUM_SET && $CURRENT_CAT_NAME) {
                $album_name = _MD_LASTHITS . ' - ' . $CURRENT_CAT_NAME;
            } else {
                $album_name = _MD_LASTHITS;
            }
            $result = $xoopsDB->query("SELECT count(*) from " . $xoopsDB->prefix("xcgal_pictures") . " WHERE approved = 'YES' {$ALBUM_SET}");
            $nbEnr = $xoopsDB->fetchArray($result);
            $count = $nbEnr['count(*)'];
            $xoopsDB->freeRecordSet($result);
            if ($select_columns != '*') {
                $select_columns .= ', mtime';
            }
            $result = $xoopsDB->query("SELECT {$select_columns} FROM " . $xoopsDB->prefix("xcgal_pictures") . " WHERE approved = 'YES' {$ALBUM_SET} ORDER BY mtime DESC {$limit}");
            $rowset = db_fetch_rowset($result);
            $xoopsDB->freeRecordSet($result);
            if ($set_caption) {
                foreach ($rowset as $key => $row) {
                    $caption = "<span class=\"thumb_caption\">" . formatTimestamp($row['mtime'], 'm') . '</span>';
                    $rowset[$key]['caption_text'] = $caption;
                }
            }
            return $rowset;
            break;
        case 'random':
            // Random pictures
            if ($ALBUM_SET && $CURRENT_CAT_NAME) {
                $album_name = _MD_RANDOM . ' - ' . $CURRENT_CAT_NAME;
            } else {
                $album_name = _MD_RANDOM;
            }
            $result = $xoopsDB->query("SELECT count(*) from " . $xoopsDB->prefix("xcgal_pictures") . " WHERE approved = 'YES' {$ALBUM_SET}");
            $nbEnr = $xoopsDB->fetchArray($result);
            $pic_count = $nbEnr['count(*)'];
            $xoopsDB->freeRecordSet($result);
            // if we have more than 1000 pictures, we limit the number of picture returned
            // by the SELECT statement as ORDER BY RAND() is time consuming
            if ($pic_count > 1000) {
                $result = $xoopsDB->query("SELECT count(*) from " . $xoopsDB->prefix("xcgal_pictures") . " WHERE approved = 'YES'");
                $nbEnr = $xoopsDB->fetchArray($result);
                $total_count = $nbEnr['count(*)'];
                $xoopsDB->freeRecordSet($result);
                $granularity = floor($total_count / RANDPOS_MAX_PIC);
                $cor_gran = ceil($total_count / $pic_count);
                srand(time());
                for ($i = 1; $i <= $cor_gran; $i++) {
                    $random_num_set = rand(0, $granularity) . ', ';
                }
                $random_num_set = substr($random_num_set, 0, -2);
                $result = $xoopsDB->query("SELECT {$select_columns} FROM " . $xoopsDB->prefix("xcgal_pictures") . " WHERE  randpos IN ({$random_num_set}) AND approved = 'YES' {$ALBUM_SET} ORDER BY RAND() LIMIT {$limit2}");
            } else {
                $result = $xoopsDB->query("SELECT {$select_columns} FROM " . $xoopsDB->prefix("xcgal_pictures") . " WHERE approved = 'YES' {$ALBUM_SET} ORDER BY RAND() LIMIT {$limit2}");
            }
            $rowset = array();
            while ($row = $xoopsDB->fetchArray($result)) {
                $row['caption_text'] = '';
                $rowset[-$row['pid']] = $row;
            }
            $xoopsDB->freeRecordSet($result);
            return $rowset;
            break;
        case 'search':
            // Search results
            if (isset($USER['search'])) {
                $search_string = $USER['search'];
            } else {
                $search_string = '';
            }
            if (substr($search_string, 0, 3) == '###') {
                $query_all = 1;
                $search_string = substr($search_string, 3);
            } else {
                $query_all = 0;
            }
            if ($ALBUM_SET && $CURRENT_CAT_NAME) {
                $album_name = _MD_SEARCH . ' - ' . $CURRENT_CAT_NAME;
            } else {
                $album_name = _MD_SEARCH . ' - "' . $search_string . '"';
            }
            //var_dump(htmlspecialchars($search_string));
            //$search_string = utf8Encode($search_string);
            include 'include/search.inc.php';
            return $rowset;
            break;
        case 'usearch':
            // User pics search results
            if (isset($USER['suid']) && $USER['suid'] > 0) {
                $owner = new XoopsUser($USER['suid']);
                $album_name = _MD_USEARCH . $owner->uname();
            } else {
                $album_name = 'Pics submitted by ' . $xoopsConfig['anonymous'];
            }
            $result = $xoopsDB->query("SELECT count(*) from " . $xoopsDB->prefix("xcgal_pictures") . " WHERE approved = 'YES' AND owner_id = '{$USER['suid']}' {$ALBUM_SET}");
            $nbEnr = $xoopsDB->fetchArray($result);
            $count = $nbEnr['count(*)'];
            $xoopsDB->freeRecordSet($result);
            if ($select_columns != '*') {
                $select_columns .= ', pic_rating, votes';
            }
            $result = $xoopsDB->query("SELECT {$select_columns} FROM " . $xoopsDB->prefix("xcgal_pictures") . " WHERE approved = 'YES' AND owner_id = '{$USER['suid']}' {$ALBUM_SET} ORDER BY ctime DESC {$limit}");
            $rowset = db_fetch_rowset($result);
            $xoopsDB->freeRecordSet($result);
            if ($set_caption) {
                foreach ($rowset as $key => $row) {
                    $caption = "<span class=\"thumb_caption\">" . formatTimestamp($row['ctime'], 'm') . "</span>";
                    $rowset[$key]['caption_text'] = $caption;
                }
            }
            return $rowset;
            break;
        case 'mostsend':
            // Top rated pictures
            if ($ALBUM_SET && $CURRENT_CAT_NAME) {
                $album_name = _MD_MOST_SENT . ' - ' . $CURRENT_CAT_NAME;
            } else {
                $album_name = _MD_MOST_SENT;
            }
            $result = $xoopsDB->query("SELECT count(*) from " . $xoopsDB->prefix("xcgal_pictures") . " WHERE approved = 'YES' AND sent_card > 0 {$ALBUM_SET}");
            $nbEnr = $xoopsDB->fetchArray($result);
            $count = $nbEnr['count(*)'];
            $xoopsDB->freeRecordSet($result);
            if ($select_columns != '*') {
                $select_columns .= ', sent_card';
            }
            $result = $xoopsDB->query("SELECT {$select_columns} FROM " . $xoopsDB->prefix("xcgal_pictures") . " WHERE approved = 'YES' AND sent_card >0 {$ALBUM_SET} ORDER BY sent_card DESC {$limit}");
            $rowset = db_fetch_rowset($result);
            $xoopsDB->freeRecordSet($result);
            if ($set_caption) {
                foreach ($rowset as $key => $row) {
                    $caption = "<span class=\"thumb_caption\">" . sprintf(_MD_FUNC_SEND, $row['sent_card']) . '</span>';
                    $rowset[$key]['caption_text'] = $caption;
                }
            }
            return $rowset;
            break;
        default:
            // Invalid meta album
            redirect_header('index.php', 2, _MD_NON_EXIST_AP);
    }
}
Пример #9
0
/**
* desc Elimina de la base de datos los elementos
**/
function dt_delete_items()
{
    global $xoopsModuleConfig, $xoopsConfig, $xoopsModule, $xoopsSecurity, $rmc_config, $xoopsUser;
    $ids = rmc_server_var($_POST, 'ids', array());
    $page = rmc_server_var($_POST, 'page', 1);
    $search = rmc_server_var($_POST, 'search', '');
    $sort = rmc_server_var($_POST, 'sort', 'id_soft');
    $mode = rmc_server_var($_POST, 'mode', 1);
    $cat = rmc_server_var($_POST, 'cat', 0);
    $type = rmc_server_var($_POST, 'type', '');
    $params = '?pag=' . $page . '&search=' . $search . '&sort=' . $sort . '&mode=' . $mode . '&cat=' . $cat . '&type=' . $type;
    //Verificamos que el software sea válido
    if (!is_array($ids) && $ids <= 0) {
        redirectMsg('items.php' . $params, __('You must select at least one download item to delete!', 'dtransport'), RMMSG_WARN);
    }
    if (!is_array($ids)) {
        $ids = array($ids);
    }
    if (!$xoopsSecurity->check()) {
        redirectMsg('items.php' . $params, __('Session token expired!', 'dtransport'), RMMSG_ERROR);
    }
    $errors = '';
    $mailer = new RMMailer('text/html');
    $etpl = DT_PATH . '/lang/deletion_' . $rmc_config['lang'] . '.php';
    if (!file_exists($etpl)) {
        $etpl = DT_PATH . '/lang/deletion_en.php';
    }
    $mailer->template($etpl);
    $mailer->assign('siteurl', XOOPS_URL);
    $mailer->assign('dturl', $xoopsModuleConfig['permalinks'] ? XOOPS_URL . '/' . trim($xoopsModuleConfig['htbase'], '/') : DT_URL);
    $mailer->assign('downcp', $xoopsModuleConfig['permalinks'] ? XOOPS_URL . '/' . trim($xoopsModuleConfig['htbase'], '/') . '/cp/' : DT_URL . '/?p=cpanel');
    $mailer->assign('dtname', $xoopsModule->name());
    $mailer->assign('sitename', $xoopsConfig['sitename']);
    foreach ($ids as $id) {
        $sw = new DTSoftware($id);
        if ($sw->isNew()) {
            continue;
        }
        if (!$sw->delete()) {
            $errors .= $sw->errors();
            continue;
        }
        $xu = new XoopsUser($sw->getVar('uid'));
        $mailer->add_users(array($xu));
        $mailer->assign('uname', $xu->name() != '' ? $xu->name() : $xu->uname());
        $mailer->assign('download', $sw->getVar('name'));
        $mailer->assign('email', $xu->getVar('email'));
        $mailer->assign('method', $xu->getVar('notify_method'));
        $mailer->set_subject(sprintf(__('Your download %s has been deleted!', 'dtransport'), $sw->getVar('name')));
        if ($xu->getVar('notify_method') == 1) {
            $mailer->set_from_xuser($xoopsUser);
            $mailer->send_pm();
        } else {
            $mailer->send();
        }
    }
    if ($errors != '') {
        redirectMsg('items.php' . $params, __('Errors ocurred while trying to delete selected downloads!', 'dtransport') . '<br />' . $errors, RMMSG_ERROR);
    }
    redirectMsg('items.php' . $params, __('Downloads deleted successfully!', 'dtransport'), RMMSG_SUCCESS);
}
Пример #10
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;
Пример #11
0
     xoops_cp_header();
     echo "<table width='100%' border='0' cellspacing='1' class='outer'><tr><td class=\"even\">";
     //echo $HTTP_POST_VARS['ishtml'];
     echo _AM_NOMAINTEXT . "<br />";
     echo "</td></tr></table>";
     break;
 }
 if ($article->approved && $article->type() != "admin") {
     $article->setPublished(time());
     $isnew = '1';
 }
 $article->store();
 if (!empty($isnew) && $article->notifypub() && $article->uid() != 0) {
     $poster = new XoopsUser($article->uid());
     $subject = _AM_ARTPUBLISHED;
     $message = sprintf(_AM_HELLO, $poster->uname());
     $message .= "\n\n" . _AM_YOURARTPUB . "\n\n";
     $message .= _AM_TITLEC . $article->title() . "\n" . _AM_URLC . XOOPS_URL . "/modules/" . $xoopsModule->dirname() . "/article.php?articleryid=" . $article->storyid() . "\n" . _AM_PUBLISHEDC . formatTimestamp($article->published(), "{$timestanp}", 0) . "\n\n";
     $message .= $xoopsConfig['sitename'] . "\n" . XOOPS_URL . "";
     $xoopsMailer =& getMailer();
     $xoopsMailer->useMail();
     $xoopsMailer->setToEmails($poster->getVar("email"));
     $xoopsMailer->setFromEmail($xoopsConfig['adminmail']);
     $xoopsMailer->setFromName($xoopsConfig['sitename']);
     $xoopsMailer->setSubject($subject);
     $xoopsMailer->setBody($message);
     $xoopsMailer->send();
 }
 redirect_header('allarticles.php', 1, _AM_DBUPDATED);
 exit;
 break;
Пример #12
0
function SaveTutorial()
{
    global $db, $xoopsConfig, $xoopsUser, $HTTP_POST_VARS, $myts, $eh;
    if ($HTTP_POST_VARS['tid']) {
        $tid = $HTTP_POST_VARS['tid'];
    } else {
        $tid = 0;
    }
    $cid = $HTTP_POST_VARS["cid"];
    $smiley = intval($HTTP_POST_VARS["xsmiley"]);
    $html = intval($HTTP_POST_VARS["xhtml"]);
    $status = $HTTP_POST_VARS["status"];
    $dir = $HTTP_POST_VARS["dir"];
    $time = $HTTP_POST_VARS["time"];
    $hits = $HTTP_POST_VARS["hits"];
    $rating = $HTTP_POST_VARS["rating"];
    $votes = $HTTP_POST_VARS["votes"];
    $framebrowse = $HTTP_POST_VARS["framebrowse"];
    if ($html == 0 && $smiley == 0) {
        $codes = 0;
    } elseif ($html == 1 && $smiley == 0) {
        $codes = 1;
    } elseif ($html == 0 && $smiley == 1) {
        $codes = 2;
    } else {
        $codes = 3;
    }
    if ($framebrowse == 1) {
        $codes += 10;
    }
    if ($HTTP_POST_VARS["gid"]) {
        $gid = $HTTP_POST_VARS["gid"];
    } else {
        $gid = 0;
    }
    $tname = $myts->makeTboxData4Save($HTTP_POST_VARS["tname"]);
    $tauthor = $myts->makeTboxData4Save($HTTP_POST_VARS["tauthor"]);
    $timg = $myts->makeTboxData4Save($HTTP_POST_VARS["timg"]);
    if (ereg("http://", $timg) || $timg == "") {
        $timgwidth = 0;
        $timgheight = 0;
    } else {
        $timgwidth = $HTTP_POST_VARS["timgwidth"];
        $timgheight = $HTTP_POST_VARS["timgheight"];
    }
    $tdesc = $myts->makeTboxData4Save($HTTP_POST_VARS["tdesc"]);
    $tcont = $myts->makeTareaData4Save($HTTP_POST_VARS["tcont"], $html, $smiley, 1);
    $submitter = $HTTP_POST_VARS["submitter"];
    $message = "";
    if (!empty($HTTP_POST_VARS["tlink"])) {
        $tlink = $myts->makeTboxData4Save($HTTP_POST_VARS["tlink"]);
    }
    // Check if Title exist
    if ($tname == "") {
        $message .= "<h4><font color=\"#ff0000\">";
        $message .= _MD_ERRORNAME . "</font></h4><br>";
        $error = 1;
    }
    // Check if Description exist
    if ($tdesc == "") {
        $message .= "<h4><font color=\"#ff0000\">";
        $message .= _MD_ERRORDESC . "</font></h4><br>";
        $error = 1;
    }
    // Check if Content exist
    if ($tcont == "" && $tlink == "") {
        $message .= "<h4><font color=\"#ff0000\">";
        $message .= _MD_ERRORCONT . "</font></h4><br>";
        $error = 1;
    }
    if ($error == 1) {
        xoops_cp_header();
        OpenTable();
        echo $message;
        echo "<center><input type=\"button\" value=\"" . _MD_GOBACK . "\" onclick=\"javascript:history.go(-1)\"></center>";
        CloseTable();
        xoops_cp_footer();
        exit;
    }
    if ($tid == 0) {
        $newid = $db->genId("tutorials_tid_seq");
        $db->query("INSERT INTO " . $db->prefix("tutorials") . " (tid, cid, gid, tname, tdesc, timg, tcont, tlink, tauthor, status, codes, hits, rating, votes, date, submitter, dir, timgwidth, timgheight) VALUES ({$newid}, {$cid}, {$gid}, '{$tname}', '{$tdesc}', '{$timg}', '{$tcont}', '{$tlink}', '{$tauthor}', {$status}, {$codes}, 0, 0, 0, {$time}, {$submitter}, {$dir}, {$timgwidth}, {$timgheight})") or $eh->show("0013");
    } elseif ($status == 0) {
        $db->query("UPDATE " . $db->prefix("tutorials") . " set tid={$tid}, cid={$cid}, gid={$gid}, tname='{$tname}', tdesc='{$tdesc}', timg='{$timg}', tcont='{$tcont}', tlink='{$tlink}', tauthor='{$tauthor}', status={$status}, codes={$codes}, hits=0, rating=0, votes=0, date={$time}, timgwidth={$timgwidth}, timgheight={$timgheight} where tid={$tid}") or $eh->show("0013");
    } elseif ($tid > 0 && $status == 3) {
        $result = $db->query("SELECT status, date FROM " . $db->prefix("tutorials") . " WHERE tid={$tid}");
        list($statusdb, $date) = $db->fetch_row($result);
        if ($statusdb != 2) {
            $time = time();
        }
        $date = $time;
        $db->query("UPDATE " . $db->prefix("tutorials") . " set tid={$tid}, cid={$cid}, gid={$gid}, tname='{$tname}', tdesc='{$tdesc}', timg='{$timg}', tcont='{$tcont}', tlink='{$tlink}', tauthor='{$tauthor}', status={$status}, codes={$codes}, date={$date}, timgwidth={$timgwidth}, timgheight={$timgheight} where tid={$tid}") or $eh->show("0013");
    } else {
        $date = time();
        $db->query("UPDATE " . $db->prefix("tutorials") . " set tid={$tid}, cid={$cid}, gid={$gid}, tname='{$tname}', tdesc='{$tdesc}', timg='{$timg}', tcont='{$tcont}', tlink='{$tlink}', tauthor='{$tauthor}', status={$status}, codes={$codes}, date={$date}, timgwidth={$timgwidth}, timgheight={$timgheight} where tid={$tid}") or $eh->show("0013");
    }
    if ($status == 1 || $status == 3) {
        $result = $db->query("SELECT submitter FROM " . $db->prefix("tutorials") . " WHERE tid={$tid}");
        list($submitter) = $db->fetch_row($result);
        if ($xoopsUser->uid() != $submitter) {
            $submitter = new XoopsUser($submitter);
            $subject = sprintf(_MD_YOURFILEAT, $xoopsConfig['sitename']);
            $message = sprintf(_MD_HELLO, $submitter->uname());
            if ($status == 1) {
                $message .= "\n\n" . _MD_WEAPPROVED . "\n\n";
            }
            if ($status == 3) {
                $message .= "\n\n" . _MD_WEAPPROVEDMOD . "\n\n";
            }
            $siteurl = XOOPS_URL . "/modules/tutorials/";
            $message .= sprintf(_MD_VISITAT, $siteurl);
            $message .= "\n\n" . _MD_THANKSSUBMIT . "\n\n" . $xoopsConfig['sitename'] . "\n" . XOOPS_URL . "\n" . $xoopsConfig['adminmail'] . "";
            $xoopsMailer =& getMailer();
            $xoopsMailer->useMail();
            $xoopsMailer->setToEmails($submitter->getVar("email"));
            $xoopsMailer->setFromEmail($xoopsConfig['adminmail']);
            $xoopsMailer->setFromName($xoopsConfig['sitename']);
            $xoopsMailer->setSubject($subject);
            $xoopsMailer->setBody($message);
            $xoopsMailer->send();
        }
    }
    redirect_header("index.php", 1, _MD_DBUPDATED);
    exit;
}
Пример #13
0
/**
* @desc Almacena la información del grupo de imágenes
**/
function saveBulkImages()
{
    global $util, $mc, $xoopsUser;
    XoopsLogger::getInstance()->activated = false;
    XoopsLogger::getInstance()->renderingEnabled = false;
    set_time_limit(0);
    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($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 (!$image->save()) {
        unlink($uploader->savedDestination);
        send_error(__('File could not be inserted to database!', 'galleries'));
    }
    $ret['message'] = '1';
    $ret['id'] = $image->id();
    echo json_encode($ret);
    die;
}
Пример #14
0
function sendChat() {
    global $xoopsDB, $xoopsUser;
	$from = $_SESSION['xoopsUserId'];
    $to = $_POST['to'];
    $message = $_POST['message'];
    $user = new XoopsUser($from);
    $uname = $user->uname();
	$avatar =$user->user_avatar();
	if ($avatar!='blank.gif') {
	    $avatarURL = XOOPS_URL."/uploads/".$avatar;
	} else {
	    $avatarURL = XOOPS_URL."/modules/xim/images/default_avatar.png";
	}
    $_SESSION['openChatBoxes'][$_POST['to']] = date('Y-m-d H:i:s', time());
	
	$config = im_Getconfig($user);
	$soundUrl = XOOPS_URL.'/modules/xim/media/0.mp3';
	$status = $config['status'];
    
    $messagesan = sanitize($message);
    header('Content-type: application/json');
    echo '{"message":"'.$messagesan.'"}'; 
    if (!isset($_SESSION['chatHistory'][$_POST['to']])) {
        $_SESSION['chatHistory'][$_POST['to']] = '';
    }
    
    $_SESSION['chatHistory'][$_POST['to']] .= <<<EOD
{"s":"1","n":"{$uname}","a":"$avatarURL","f":"{$to}","m":"{$messagesan}","q":"$soundUrl","p":"$status"},

EOD;
    
    unset($_SESSION['tsChatBoxes'][$_POST['to']]);
    
    $sql = "insert into ".$xoopsDB->prefix(xim_chat)." (".$xoopsDB->prefix(xim_chat).".from,".$xoopsDB->prefix(xim_chat).".to,message,sent) values ('".mysql_real_escape_string($from)."', '".mysql_real_escape_string($to)."','".mysql_real_escape_string($message)."',NOW())";
    $query = $xoopsDB->query($sql);
    //echo "1";
    exit(0);
}
Пример #15
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;";
     }
Пример #16
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'] = "";
         }
Пример #17
0
function saveEdit()
{
    global $db, $util, $xoopsUser;
    foreach ($_POST as $k => $v) {
        ${$k} = $v;
    }
    if (!$util->validateToken()) {
        redirectMsg('edits.php?op=edit&id=' . $id, _AS_AH_SESSINVALID, 1);
        die;
    }
    if ($id <= 0) {
        redirectMsg('./edits.php', _AS_AH_NOID, 1);
        die;
    }
    $edit = new AHEdit($id);
    if ($edit->isNew()) {
        redirectMsg('./edits.php', _AS_AH_NOTEXISTS, 1);
        die;
    }
    $sec = new AHSection($edit->section());
    if ($sec->isNew()) {
        redirectMsg('./edits.php', _AS_AH_NOTEXISTSSEC, 1);
        die;
    }
    //Comprueba que el título de la sección no exista
    $sql = "SELECT COUNT(*) FROM " . $db->prefix('pa_sections') . " WHERE title='{$title}' AND id_res='" . $sec->resource() . "' AND id_sec<>'" . $sec->id() . "'";
    list($num) = $db->fetchRow($db->queryF($sql));
    if ($num > 0) {
        redirectMsg('./edits.php?op=edit&id=' . $edit->id(), _AS_AH_ERRTITLE, 1);
        die;
    }
    //Genera $nameid Nombre identificador
    $found = false;
    $i = 0;
    do {
        $nameid = $util->sweetstring($title) . ($found ? $i : '');
        $sql = "SELECT COUNT(*) FROM " . $db->prefix('pa_sections') . " WHERE nameid = '{$nameid}'";
        list($num) = $db->fetchRow($db->queryF($sql));
        if ($num > 0) {
            $found = true;
            $i++;
        } else {
            $found = false;
        }
    } while ($found == true);
    $sec->setTitle($title);
    $sec->setContent($content);
    $sec->setOrder($order);
    $sec->setNameId($nameid);
    $sec->setParent($parent);
    $sec->setVar('dohtml', isset($dohtml) ? 1 : 0);
    $sec->setVar('doxcode', isset($doxcode) ? 1 : 0);
    $sec->setVar('dobr', isset($dobr) ? 1 : 0);
    $sec->setVar('dosmiley', isset($dosmiley) ? 1 : 0);
    $sec->setVar('doimage', isset($dosmiley) ? 1 : 0);
    if (!isset($uid)) {
        $sec->setUid($xoopsUser->uid());
        $sec->setUname($xoopsUser->uname());
    } else {
        $xu = new XoopsUser($uid);
        if ($xu->isNew()) {
            $sec->setUid($xoopsUser->uid());
            $sec->setUname($xoopsUser->uname());
        } else {
            $sec->setUid($uid);
            $sec->setUname($xu->uname());
        }
    }
    $sec->setModified(time());
    if (!$sec->save()) {
        redirectMsg('edits.php', _AS_AH_DBERROR . '<br />' . $sec->errors(), 1);
        die;
    }
    $edit->delete();
    redirectMsg('edits.php', _AS_AH_DBOK, 0);
}
Пример #18
0
/**
* This function deletes all image formats, except thumbnails, for specified albums.
* This is useful when you need to regenerate images
*/
function delete_formats()
{
    global $xoopsModuleConfig;
    $id = rmc_server_var($_GET, 'id', 0);
    $page = rmc_server_var($_GET, 'page', 1);
    if ($id <= 0) {
        redirectMsg("sets.php?page={$page}", __('Sorry, this is not a valid album!', 'galleries'), 1);
        die;
    }
    $set = new GSSet($id);
    if ($set->isNew()) {
        redirectMsg("sets.php?page={$page}", __('Specified Album does not exists!', 'galleries'), 1);
        die;
    }
    $db = Database::getInstance();
    $t1 = $db->prefix("gs_images");
    $t2 = $db->prefix("gs_setsimages");
    $sql = "SELECT a.image FROM {$t1} a, {$t2} b WHERE b.id_set={$id} AND a.id_image=b.id_image";
    $result = $db->query($sql);
    $dir = rtrim($xoopsModuleConfig['storedir'], '/');
    if ($set->uname() == '') {
        $user = new XoopsUser($set->owner());
        $uname = $user->uname();
    } else {
        $uname = $set->uname();
    }
    if ($uname == '') {
        redirectMsg('sets.php?page=' . $page, __('Sorry, we were unable to find the album owner!', 'galleries'), 1);
        break;
    }
    $dir .= '/' . $uname . '/formats';
    if (!is_dir($dir)) {
        redirectMsg('sets.php?page=' . $page, __('There are not image formats for this album.', 'galleries'), 0);
        die;
    }
    while (list($image) = $db->fetchRow($result)) {
        @unlink($dir . '/bigset_' . $image);
        @unlink($dir . '/set_' . $image);
        @unlink($dir . '/user_' . $image);
        @unlink($dir . '/srh_' . $image);
    }
    $pics = $set->getPics();
    $sql = "UPDATE {$t1} SET user_format=0, set_format=0, bigset_format=0, search_format=0 WHERE id_image IN (" . implode(",", $pics) . ")";
    $db->queryF($sql);
    redirectMsg('sets.php?page=' . $page, __('Image formats deleted!', 'galleries'), 0);
}
Пример #19
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'));