Beispiel #1
0
function search_gallery($items, $conn)
{
    global $set, $db, $apx, $user;
    require_once BASEDIR . getmodulepath('gallery') . 'functions.php';
    //Suchstring generieren
    $tagmatches = gallery_match_tags($items);
    foreach ($items as $item) {
        $tagmatch = array_shift($tagmatches);
        $search1[] = "caption LIKE '" . addslashes_like($item) . "'";
        $search2[] = " ( " . iif($tagmatch, " id IN (" . implode(',', $tagmatch) . ") OR ") . " title LIKE '%" . addslashes_like($item) . "%' OR description LIKE '%" . addslashes_like($item) . "%' ) ";
    }
    $searchstring1 = implode($conn, $search1);
    $searchstring2 = implode($conn, $search2);
    //Bilder durchsuchen
    $data = $db->fetch("SELECT galid FROM " . PRE . "_gallery_pics WHERE ( active='1' AND ( " . $searchstring1 . " ) ) GROUP BY galid");
    $galids = get_ids($data, 'galid');
    if (count($galids)) {
        $picres = " id IN (" . @implode(',', $galids) . ") OR ";
    }
    //Ergebnisse
    $data = $db->fetch("SELECT id,title FROM " . PRE . "_gallery WHERE ( searchable='1' AND '" . time() . "' BETWEEN starttime AND endtime " . section_filter() . " AND ( " . $picres . " ( " . $searchstring2 . " ) ) ) ORDER BY title ASC");
    if (count($data)) {
        foreach ($data as $res) {
            ++$i;
            $result[$i]['TITLE'] = strip_tags($res['title']);
            $result[$i]['LINK'] = mklink('gallery.php?id=' . $res['id'], 'gallery,list' . $res['id'] . ',1' . urlformat($res['title']) . '.html');
        }
    }
    return $result;
}
Beispiel #2
0
function misc_productsfeed()
{
    global $set, $db, $apx;
    $apx->tmpl->loaddesign('blank');
    header('Content-type: application/rss+xml');
    $apx->lang->drop('types', 'products');
    $type = $_REQUEST['type'];
    $alltypes = array('normal', 'game', 'software', 'hardware', 'music', 'movie', 'book');
    if (!in_array($type, $alltypes)) {
        $type = '';
    }
    $data = $db->fetch("SELECT * FROM " . PRE . "_products WHERE active='1' " . iif($type, " AND type='" . $type . "'") . " ORDER BY addtime DESC LIMIT 20");
    if (count($data)) {
        foreach ($data as $res) {
            ++$i;
            //Link
            $link = mklink('products.php?id=' . $res['id'], 'products,id' . $res['id'] . urlformat($res['title']) . '.html');
            $tabledata[$i]['ID'] = $res['id'];
            $tabledata[$i]['TITLE'] = rss_replace($res['title']);
            $tabledata[$i]['TIME'] = date('r', $res['starttime']);
            //Kein TIMEDIFF weil Zeitverschiebung mit angegeben!
            $tabledata[$i]['TEXT'] = rss_replace(preg_replace('#{IMAGE\\(([0-9]+)\\)}#s', '', $res['text']));
            $tabledata[$i]['TYPE'] = $res['type'];
            $tabledata[$i]['LINK'] = HTTP_HOST . $link;
        }
    }
    $apx->tmpl->assign('WEBSITENAME', $set['main']['websitename']);
    $apx->tmpl->assign('PRODUCT', $tabledata);
    $apx->tmpl->parse('rss', 'products');
}
Beispiel #3
0
 function toparea_cmp($a, $b)
 {
     if ($a['forumid'] == -1) {
         return -1;
     }
     return iif($a['total'] > $b['total'], -1, iif($a['total'] < $b['total'], 1, iif($a['count'] > $b['count'], -1, iif($a['count'] < $b['count'], 1, 0))));
 }
Beispiel #4
0
function get_product_list($select = 0, $ignore = 0)
{
    global $apx, $db, $set;
    $select = (int) $select;
    //Leeres Feld
    $list = '<option value=""></option>';
    //Sprachplatzhalter dropen
    $apx->lang->drop('type', 'products');
    //Auslesen
    $lasttype = '';
    $data = $db->fetch("SELECT id,type,title FROM " . PRE . "_products WHERE active='1' ORDER BY type ASC,title ASC");
    if (count($data)) {
        foreach ($data as $res) {
            ++$i;
            if ($ignore == $res['id']) {
                continue;
            }
            //Gruppieren
            if ($res['type'] != $lasttype) {
                if ($lasttype) {
                    $list .= '</optgroup>';
                }
                $list .= '<optgroup label="' . $apx->lang->get('PRODTYPE_' . strtoupper($res['type'])) . '">';
            }
            $list .= '<option value="' . $res['id'] . '"' . iif($res['id'] == $select, ' selected="selected"') . '>' . replace($res['title']) . '</option>';
            $lasttype = $res['type'];
        }
        if ($lasttype) {
            $list .= '</optgroup>';
        }
    }
    return $list;
}
Beispiel #5
0
function cache_award_cats($award_cat_id = -1, $depth = 0, $display_award_cat_id = 0)
{
    // returns an array of award cats with correct parenting and depth information
    // see makeforumchooser for an example of usage
    global $db, $award_cat_cache, $count;
    static $fcache, $i;
    if (!is_array($fcache)) {
        // check to see if we have already got the results from the database
        $fcache = array();
        $award_cats = $db->query_read("SELECT * FROM " . TABLE_PREFIX . "award_cat\n\t\t" . iif($display_award_cat_id, "WHERE award_cat_id = {$display_award_cat_id}", '') . "\n\t\t\tORDER BY award_cat_displayorder\n\t\t");
        while ($award_cat = $db->fetch_array($award_cats)) {
            if ($display_award_cat_id) {
                $award_cat[award_cat_parentid] = -1;
            }
            $fcache["{$award_cat['award_cat_parentid']}"]["{$award_cat['award_cat_displayorder']}"]["{$award_cat['award_cat_id']}"] = $award_cat;
        }
    }
    // database has already been queried
    if (is_array($fcache["{$award_cat_id}"])) {
        foreach ($fcache["{$award_cat_id}"] as $holder) {
            foreach ($holder as $award_cat) {
                $award_cat_cache["{$award_cat['award_cat_id']}"] = $award_cat;
                $award_cat_cache["{$award_cat['award_cat_id']}"]['depth'] = $depth;
                unset($fcache["{$award_cat_id}"]);
                cache_award_cats($award_cat['award_cat_id'], $depth + 1, $display_award_cat_id);
            }
            // end foreach ($val1 AS $key2 => $forum)
        }
        // end foreach ($fcache["$forumid"] AS $key1 => $val1)
    }
    // end if (found $fcache["$forumid"])
}
Beispiel #6
0
 function get_catlist($selected = null)
 {
     global $set, $db, $apx;
     if (is_null($selected)) {
         $selected = $_POST['catid'];
     }
     $catlist = '<option></option>';
     if ($set['news']['subcats']) {
         $data = $this->cat->getTree(array('title', 'open', 'forgroup'));
     } else {
         $data = $db->fetch("SELECT id,title,open,forgroup FROM " . PRE . "_news_cat ORDER BY title ASC");
     }
     if (!count($data)) {
         return '';
     }
     foreach ($data as $res) {
         $allowed = unserialize($res['forgroup']);
         if ($res['level']) {
             $space = str_repeat('&nbsp;&nbsp;', $res['level'] - 1);
         }
         if ($res['open'] && ($res['forgroup'] == 'all' || is_array($allowed) && in_array($apx->user->info['groupid'], $allowed))) {
             $catlist .= '<option value="' . $res['id'] . '" ' . iif($selected == $res['id'], ' selected="selected"') . ' style="color:green;">' . $space . replace($res['title']) . '</option>';
         } else {
             $catlist .= '<option value="" disabled="disabled">' . $space . replace($res['title']) . '</option>';
         }
     }
     return $catlist;
 }
Beispiel #7
0
function forum_threads_updated($count = 5, $inforumid = 0, $notforumid = 0, $template = 'updated')
{
    require_once BASEDIR . getmodulepath('forum') . 'functions.php';
    global $set, $apx, $db;
    $count = (int) $count;
    //Erlaubte Foren
    if (is_int($forumid)) {
        $inforum = array($inforumid);
    } else {
        $inforum = intlist($inforumid);
    }
    if (is_int($notforumid)) {
        $notforum = array($notforumid);
    } else {
        $notforum = intlist($notforumid);
    }
    $forumids = forum_allowed_forums($inforum, $notforum);
    //Daten auslesen
    $fields = implode(',', array('threadid', 'prefix', 'title', 'opener_userid', 'opener', 'opentime', 'lastposter_userid', 'lastposter', 'lastposttime', 'posts', 'views'));
    if (count($forumids)) {
        $data = $db->fetch("SELECT " . $fields . " FROM " . PRE . "_forum_threads WHERE ( del=0 AND moved=0 AND forumid IN (" . implode(',', $forumids) . ") ) ORDER BY lastposttime DESC " . iif($count, "LIMIT " . $count));
    } else {
        $data = array();
    }
    forum_threads_print($data, $template, 'lastposttime');
}
 private function contact()
 {
     $isSent = Request::get(0, VAR_URI) == 'send';
     $options = array('name' => array(Validator::MESSAGE => 'Der Name muss mindestens 5 und darf maximal 150 Zeichen lang sein.', Validator::MIN_LENGTH => 5, Validator::MAX_LENGTH => 150), 'email' => array(Validator::MESSAGE => 'Die E-Mail-Adresse ist nicht korrekt.', Validator::CALLBACK => Validator::CB_MAIL), 'message' => array(Validator::MESSAGE => 'Die Nachricht entspricht nicht den Vorgaben (mindestens 10 Zeichen, maximal 1000 Zeichen).', Validator::MIN_LENGTH => 10, Validator::MAX_LENGTH => 1000), 'title' => array(Validator::MESSAGE => 'Der Titel entspricht nicht den Vorgaben (mindestens 5 Zeichen, maximal 100 Zeichen).', Validator::MIN_LENGTH => 5, Validator::MAX_LENGTH => 100));
     $this->enableClientFormValidation($options);
     // Don't validate the captcha via ajax as the session would end
     if (Config::get('captcha.enable')) {
         Core::loadClass('Core.Security.ReCaptcha');
         $options['recaptcha_response_field'] = array(Validator::MESSAGE => 'Der Sicherheitscode wurde nicht korrekt eingegeben.', Validator::CALLBACK => 'cb_captcha_check');
     }
     $data = array_fill_keys(array_keys($options), '');
     $data['name'] = iif(Me::get()->loggedIn(), Me::get()->getName());
     $data['email'] = iif(Me::get()->loggedIn(), Me::get()->getEmail());
     $this->breadcrumb->add('Kontakt');
     $this->header();
     if ($isSent) {
         extract(Validator::checkRequest($options));
         if (count($error) > 0) {
             CmsPage::error($error);
         } else {
             CmsTools::sendMail(Config::get('general.email'), $data['title'], $data['message'], $data['email'], $data['name']);
             CmsPage::ok('Die Anfrage wurde erfolgreich verschickt. Vielen Dank!');
             $data['title'] = '';
             $data['message'] = '';
         }
     }
     $tpl = Response::getObject()->appendTemplate('Cms/contact/contact');
     $tpl->assign('data', $data);
     if (Config::get('captcha.enable')) {
         $tpl->assign('captcha', recaptcha_get_html(Config::get('captcha.public_key')), false);
     }
     $tpl->output();
     $this->footer();
 }
Beispiel #9
0
 function get_catlist($selected = null)
 {
     global $set, $db, $apx;
     if (is_null($selected)) {
         $selected = $_POST['catid'];
     }
     //Neue Kategorie erstellen
     if ($apx->user->has_right('links.catadd')) {
         $catlist = '<option value=""></option>';
     }
     $data = $this->cat->getTree(array('title', 'open'));
     if (!count($data)) {
         return '';
     }
     foreach ($data as $res) {
         if ($res['level']) {
             $space = str_repeat('&nbsp;&nbsp;', $res['level'] - 1);
         }
         if ($res['open']) {
             $catlist .= '<option value="' . $res['id'] . '" ' . iif($selected == $res['id'], ' selected="selected"') . ' style="color:green;">' . $space . replace($res['title']) . '</option>';
         } else {
             $catlist .= '<option value="" disabled="disabled">' . $space . replace($res['title']) . '</option>';
         }
     }
     return $catlist;
 }
Beispiel #10
0
function get_gallery_list($selected = 0)
{
    global $set, $db, $apx;
    $list = '<option value=""></option>';
    if ($set['gallery']['subgals']) {
        require_once BASEDIR . 'lib/class.recursivetree.php';
        $tree = new RecursiveTree(PRE . '_gallery', 'id');
        $data = $tree->getTree(array('title'), null, "'" . time() . "' BETWEEN starttime AND endtime " . section_filter(true, 'secid'));
        if (!count($data)) {
            return '';
        }
        foreach ($data as $res) {
            $list .= '<option value="' . $res['id'] . '"' . iif($selected == $res['id'], ' selected="selected"') . '>' . str_repeat('&nbsp;&nbsp;', $res['level'] - 1) . replace(strip_tags($res['title'])) . '</option>';
        }
    } else {
        $data = $db->fetch("SELECT id,title FROM " . PRE . "_gallery WHERE '" . time() . "' BETWEEN starttime AND endtime " . section_filter(true, 'secid') . " ORDER BY title ASC");
        if (!count($data)) {
            return '';
        }
        foreach ($data as $res) {
            $list .= '<option value="' . $res['id'] . '"' . iif($selected == $res['id'], ' selected="selected"') . '>' . replace(strip_tags($res['title'])) . '</option>';
        }
    }
    return $list;
}
 function current()
 {
     $temp = parent::current();
     $temp['posticon'] = @$temp['posticon'] != '' ? iif(file_exists(BB_BASE_DIR . '/tmp/upload/posticons/' . @$temp['posticon']), @$temp['posticon'], 'clear.gif') : 'clear.gif';
     if ($temp['poster_id'] > 0) {
         $user = $this->dba->getRow("SELECT " . $this->qp['user'] . $this->qp['userinfo'] . " FROM " . K4USERS . " u LEFT JOIN " . K4USERINFO . " ui ON u.id=ui.user_id WHERE u.id=" . intval($temp['poster_id']));
         $group = get_user_max_group($user, $this->groups);
         $user['group_color'] = !isset($group['color']) || $group['color'] == '' ? '000000' : $group['color'];
         $user['group_nicename'] = $group['nicename'];
         $user['group_avatar'] = $group['avatar'];
         foreach ($user as $key => $val) {
             $temp['post_user_' . $key] = $val;
         }
         /* This array holds all of the userinfo for users that post to this topic */
         $this->users[$user['id']] = $user;
     }
     /* Do we have any replies? */
     //$num_replies					= @(($temp['row_right'] - $temp['row_left'] - 1) / 2);
     //$bbcode							= &new BBCodex($this->dba, $this->user, $temp['body_text'], $temp['forum_id'], TRUE, TRUE, TRUE, TRUE);
     if ($temp['num_replies'] > 0) {
         $temp['replies'] =& new RepliesReviewIterator($this->result, $this->qp, $this->dba, $this->users, $this->groups, $this->user, $this->url, $this->poll_text);
     }
     //$temp['reverted_body_text']		= $bbcode->revert();
     if ($temp['is_poll'] == 1) {
         do_post_poll_urls($temp['reverted_body_text'], $this->dba, $this->url, $this->poll_text);
     }
     do_post_polls($temp, $this->dba, $this->url, $this->poll_text);
     unset($user, $group);
     return $temp;
 }
Beispiel #12
0
function user_assign_visitors($object, $id, &$tmpl)
{
    global $apx, $set, $db, $user;
    $userdata = array();
    $data = $db->fetch("SELECT u.userid,u.username,u.groupid,u.realname,u.gender,u.city,u.plz,u.country,u.city,u.lastactive,u.pub_invisible,u.avatar,u.avatar_title,u.custom1,u.custom2,u.custom3,u.custom4,u.custom5,u.custom6,u.custom7,u.custom8,u.custom9,u.custom10 FROM " . PRE . "_user_visits AS v LEFT JOIN " . PRE . "_user AS u USING(userid) WHERE v.object='" . addslashes($object) . "' AND v.id='" . intval($id) . "' AND v.time>='" . (time() - 24 * 3600) . "' ORDER BY u.username ASC");
    if (count($data)) {
        foreach ($data as $res) {
            ++$i;
            $userdata[$i]['ID'] = $res['userid'];
            $userdata[$i]['USERID'] = $res['userid'];
            $userdata[$i]['USERNAME'] = replace($res['username']);
            $userdata[$i]['GROUPID'] = $res['groupid'];
            $userdata[$i]['ONLINE'] = iif(!$res['pub_invisible'] && $res['lastactive'] + $set['user']['timeout'] * 60 >= time(), 1, 0);
            $userdata[$i]['REALNAME'] = replace($res['realname']);
            $userdata[$i]['GENDER'] = $res['gender'];
            $userdata[$i]['CITY'] = replace($res['city']);
            $userdata[$i]['PLZ'] = replace($res['plz']);
            $userdata[$i]['COUNTRY'] = $res['country'];
            $userdata[$i]['LASTACTIVE'] = $res['lastactive'];
            $userdata[$i]['AVATAR'] = $user->mkavatar($res);
            $userdata[$i]['AVATAR_TITLE'] = $user->mkavtitle($res);
            //Custom-Felder
            for ($ii = 1; $ii <= 10; $ii++) {
                $tabledata[$i]['CUSTOM' . $ii . '_NAME'] = $set['user']['cusfield_names'][$ii - 1];
                $tabledata[$i]['CUSTOM' . $ii] = compatible_hsc($res['custom' . $ii]);
            }
        }
    }
    $tmpl->assign('VISITOR', $userdata);
}
 function init($dir = null)
 {
     if ($dir != null) {
         $this->setdir($dir);
     }
     $this->group('settings');
     $this->group('global');
     $this->group('modules');
     $this->group('custom');
     @ini_set('default_charset', '');
     if (!headers_sent()) {
         viscacha_header('Content-type: text/html; charset=' . $this->charset());
     }
     global $slog;
     if (isset($slog) && is_object($slog) && method_exists($slog, 'setlang')) {
         $slog->setlang($this->phrase('fallback_no_username'), $this->phrase('timezone_summer'));
     }
     global $config, $breadcrumb;
     if (isset($breadcrumb)) {
         $isforum = array('addreply', 'attachments', 'edit', 'forum', 'manageforum', 'managetopic', 'misc', 'newtopic', 'pdf', 'search', 'showforum', 'showtopic');
         if ($config['indexpage'] != 'forum' && in_array(SCRIPTNAME, $isforum)) {
             $breadcrumb->Add($this->phrase('forumname'), iif(SCRIPTNAME != 'forum', 'forum.php'));
         }
     }
 }
Beispiel #14
0
 function getItemTypeExtraInfo($itemtypedata)
 {
     global $vbphrase;
     $return = array();
     $itemtypes = array();
     $itemtypeids = explode(',', $itemtypedata['options']['itemtypeids']);
     if (count($itemtypeids)) {
         foreach ($itemtypeids as $itemtypeid) {
             if (!isset($itemtypes[$itemtypeid])) {
                 $itemtypes[$itemtypeid] = array('itemtype' => newItemType($itemtypeid), 'count' => 1);
             } else {
                 $itemtypes[$itemtypeid]['count']++;
             }
         }
         foreach ($itemtypes as $itemtypeid => $info) {
             $itemtype_obj =& $info['itemtype'];
             if ($itemtype_obj) {
                 $itemtype_obj->getExtraInfo();
                 $itemtype = $itemtype_obj->data;
                 $return[] = "<strong>{$itemtype['name']}</strong>" . iif($info['count'] > 1, " x<strong style=\"color:red;\">{$info['count']}</strong>") . iif($itemtype['options_processed_list'], "<ul>{$itemtype['options_processed_list']}</ul>");
             }
         }
     }
     return $return;
 }
 /**
  * Constructor for this class.
  *
  * This class manages the user-permissions, login and logout.
  * This function does some initial work: caching search engine user agents, detects the spiders and gets the ip of the user.
  */
 function slog()
 {
     global $config, $scache;
     $this->statusdata = array();
     $this->ip = getip();
     $this->user_agent = iif(isset($_SERVER['HTTP_USER_AGENT']), $_SERVER['HTTP_USER_AGENT'], getenv('HTTP_USER_AGENT'));
     $spiders = $scache->load('spiders');
     $this->bots = $spiders->get();
     $this->sid = '';
     $this->cookies = false;
     $this->cookiedata = array(0, '');
     $this->cookielastvisit = 0;
     $this->defineGID();
     $this->gFields = array('downloadfiles', 'forum', 'posttopics', 'postreplies', 'addvotes', 'attachments', 'edit', 'voting', 'admin', 'gmod', 'guest', 'members', 'profile', 'pdf', 'pm', 'wwo', 'search', 'team', 'usepic', 'useabout', 'usesignature', 'docs');
     $this->fFields = array('f_downloadfiles', 'f_forum', 'f_posttopics', 'f_postreplies', 'f_addvotes', 'f_attachments', 'f_edit', 'f_voting');
     $this->minFields = array('flood');
     $this->maxFields = array();
     $this->groups = array();
     $this->permissions = array();
     $this->querysid = true;
     $this->positive = array();
     $this->negative = array();
     $this->boards = array();
     $this->sidload = false;
 }
Beispiel #16
0
/**
* Prints a row containing a <select> showing forums the user has permission to moderate
*
* @param	string	name for the <select>
* @param	mixed	selected <option>
* @param	string	text given to the -1 option
* @param	string	title for the row
* @param	boolean	Display the -1 option or not
* @param	boolean	Allow a multiple <select> or not
* @param	boolean	Display a 'select forum' option or not
* @param	string	If specified, check this permission for each forum
*/
function print_moderator_forum_chooser($name = 'forumid', $selectedid = -1, $topname = NULL, $title = NULL, $displaytop = true, $multiple = false, $displayselectforum = false, $permcheck = '')
{
    if ($title === NULL) {
        $title = $vbphrase['parent_forum'];
    }
    $select_options = fetch_moderator_forum_options($topname, $displaytop, $displayselectforum, $permcheck);
    print_select_row($title, $name, $select_options, $selectedid, 0, iif($multiple, 10, 0), $multiple);
}
 public function write()
 {
     $id = Request::get(1, VAR_INT);
     $this->breadcrumb->add(iif($id > 0, "Bearbeiten", "Hinzufügen"));
     $this->header();
     $this->page->write(false, $this->getTemplateFile('/Cms/admin/data_categories_write'));
     $this->footer();
 }
 function format_ot($overtime)
 {
     // Prevent div by zero error.
     if (intval($overtime) != 0) {
         return sprintf('%.2f', iif($overtime / 60 > 5, ($overtime - 60) / 60, $overtime / 60));
     } else {
         return sprintf('%.2f', $overtime);
     }
 }
function construct_threaded_post_link($post, $imageString, $depth, $haschildren, $highlightpost = false)
{
    global $vbulletin, $bgclass, $curpostid, $parent_postids, $morereplies, $threadedmode, $vbphrase, $postattach;
    global $threadinfo;
    // ugly
    static $lasttitle;
    //print_array($post);
    if ($threadedmode == 2 and $highlightpost) {
        $highlightpost = 1;
    } else {
        $highlightpost = 0;
    }
    $pageinfo = array('p' => $post['postid']);
    if ($vbulletin->GPC['highlight']) {
        $pageinfo['highlight'] = urlencode($vbulletin->GPC['highlight']);
    }
    // write 'more replies below' link
    if ($vbulletin->options['threaded_listdepth'] != 0 and $depth == $vbulletin->options['threaded_listdepth'] and $post['postid'] != $curpostid and $haschildren and ($vbulletin->options['threaded_listdepth'] != 0 and $depth == $vbulletin->options['threaded_listdepth'] and !strpos(' ,' . $curpostid . $parent_postids . ',', ',' . $post['postid'] . ','))) {
        $morereplies[$post['postid']] = 1;
        return "writeLink({$post['postid']}, " . fetch_statusicon_from_child_posts($post['postid']) . ", 0, 0, \"{$imageString}\", \"\", \"more\", \"\", {$highlightpost}, \"" . addslashes_js(fetch_seo_url('thread|js', $threadinfo, $pageinfo) . "#post{$post['postid']}") . "\");\n";
    }
    // get time fields
    $post['date'] = vbdate($vbulletin->options['dateformat'], $post['dateline'], 1);
    $post['time'] = vbdate($vbulletin->options['timeformat'], $post['dateline']);
    // get status icon and paperclip
    $post['statusicon'] = iif($post['dateline'] > $threadinfo['threadview'], 1, 0);
    // get paperclip
    $post['paperclip'] = 0;
    if (is_array($postattach["{$post['postid']}"])) {
        foreach ($postattach["{$post['postid']}"] as $attachment) {
            if ($attachment['visible']) {
                $post['paperclip'] = 1;
                break;
            }
        }
    }
    // echo some text from the post if no title
    if ($post['isdeleted']) {
        $post['title'] = $vbphrase['post_deleted'];
    } else {
        if (empty($post['title'])) {
            $pagetext = htmlspecialchars_uni($post['pagetext']);
            $pagetext = strip_bbcode($pagetext, 1);
            if (trim($pagetext) == '') {
                $post['title'] = $vbphrase['reply_prefix'] . ' ' . fetch_trimmed_title($lasttitle, $vbulletin->options['threaded_trimtitle']);
            } else {
                $post['title'] = '<i>' . fetch_trimmed_title($pagetext, $vbulletin->options['threaded_trimtitle']) . '</i>';
            }
        } else {
            $lasttitle = $post['title'];
            $post['title'] = fetch_trimmed_title($post['title'], $vbulletin->options['threaded_trimtitle']);
        }
    }
    ($hook = vBulletinHook::fetch_hook('showthread_threaded_construct_link')) ? eval($hook) : false;
    return "writeLink({$post['postid']}, {$post['statusicon']}, {$post['paperclip']}, " . intval($post['userid']) . ", \"{$imageString}\", \"" . addslashes_js($post['title'], '"') . "\", \"" . addslashes_js($post['date'], '"') . "\", \"" . addslashes_js($post['time'], '"') . "\", {$highlightpost}, \"" . addslashes_js(fetch_seo_url('thread|js', $threadinfo, $pageinfo) . "#post{$post['postid']}") . "\");\n";
}
function newCAPTCHA($place = null)
{
    global $config;
    $place = 'botgfxtest' . iif(!empty($place), '_' . $place);
    $type = constant('CAPTCHA_TYPE_' . $config[$place]);
    $filename = strtolower($type);
    require_once "classes/graphic/class.{$filename}.php";
    $obj = new $type();
    return $obj;
}
function fetch_reppower(&$userinfo, &$perms, $reputation = 'pos')
{
	global $vbulletin;

	// User does not have permission to leave negative reputation
	if (!($perms['genericpermissions'] & $vbulletin->bf_ugp_genericpermissions['cannegativerep']))
	{
		$reputation = 'pos';
	}

	if (!($perms['genericpermissions'] & $vbulletin->bf_ugp_genericpermissions['canuserep']))
	{
		$reppower = 0;
	}
	else if ($perms['adminpermissions'] & $vbulletin->bf_ugp_adminpermissions['cancontrolpanel'] AND $vbulletin->options['adminpower'])
	{
		$reppower = iif($reputation != 'pos', $vbulletin->options['adminpower'] * -1, $vbulletin->options['adminpower']);
	}
	else if (($userinfo['posts'] < $vbulletin->options['minreputationpost']) OR ($userinfo['reputation'] < $vbulletin->options['minreputationcount']))
	{
		$reppower = 0;
	}
	else
	{
		$reppower = 1;

		if ($vbulletin->options['pcpower'])
		{
			$reppower += intval($userinfo['posts'] / $vbulletin->options['pcpower']);
		}
		if ($vbulletin->options['kppower'])
		{
			$reppower += intval($userinfo['reputation'] / $vbulletin->options['kppower']);
		}
		if ($vbulletin->options['rdpower'])
		{
			$reppower += intval(intval((TIMENOW - $userinfo['joindate']) / 86400) / $vbulletin->options['rdpower']);
		}

		if ($reputation != 'pos')
		{
			// make negative reputation worth half of positive, but at least 1
			$reppower = intval($reppower / 2);
			if ($reppower < 1)
			{
				$reppower = 1;
			}
			$reppower *= -1;
		}
	}

	($hook = vBulletinHook::fetch_hook('reputation_power')) ? eval($hook) : false;

	return $reppower;
}
function print_channel_permission_rows($customword, $channelpermission = array(), $extra = '')
{
    global $vbphrase;
    print_label_row("<b>{$customword}</b>", '
		<input type="button" class="button" value="' . $vbphrase['all_yes'] . '" onclick="' . iif($extra != '', 'if (js_set_custom()) { ') . ' js_check_all_option(this.form, 1);' . iif($extra != '', ' }') . '" class="button" />
		<input type="button" class="button" value=" ' . $vbphrase['all_no'] . ' " onclick="' . iif($extra != '', 'if (js_set_custom()) { ') . ' js_check_all_option(this.form, 0);' . iif($extra != '', ' }') . '" class="button" />
		<!--<input type="submit" class="button" value="Okay" class="button" />-->
	', 'tcat', 'middle');
    // Load permissions
    require_once DIR . '/includes/class_bitfield_builder.php';
    $bitvalues = array('forumpermissions', 'forumpermissions2', 'moderatorpermissions', 'createpermissions');
    $permFields = vB_ChannelPermission::fetchPermFields();
    $permPhrases = vB_ChannelPermission::fetchPermPhrases();
    if (empty($channelpermission)) {
        // we need the defaults to be displayed
        $channelpermission = vB_ChannelPermission::instance()->fetchPermissions(1);
        $channelpermission = current($channelpermission);
    }
    foreach ($permFields as $permField => $type) {
        //Do the non-bitmap fields first.
        switch ($type) {
            case vB_ChannelPermission::TYPE_HOURS:
            case vB_ChannelPermission::TYPE_COUNT:
                $permvalue = $channelpermission[$permField];
                print_input_row($vbphrase[$permPhrases[$permField]], $permField, $permvalue, true, 35, 0, '', false, 'channelPerm_' . $permField);
                break;
            case vB_ChannelPermission::TYPE_BOOL:
                $permvalue =& $channelpermission[$permField];
                print_yes_no_row($vbphrase[$permPhrases[$permField]], $permField, $permvalue, $extra);
                break;
        }
    }
    //now do the bitmaps
    foreach ($permFields as $permField => $type) {
        if ($type == vB_ChannelPermission::TYPE_BITMAP) {
            if ($permField !== 'forumpermissions2') {
                print_table_header($vbphrase[$permPhrases[$permField]]);
            }
            foreach ($channelpermission['bitfields'][$permField] as $permBit) {
                if ($permBit['used']) {
                    if (empty($permBit['phrase']) and $permField == 'moderatorpermissions') {
                        $permBit['phrase'] = "moderator_add_edit_" . $permBit['name'] . "_title";
                    }
                    if ($permField == 'moderatorpermissions' and $permBit['name'] == 'canopenclose') {
                        $helpOptions = array('prefix' => $permField);
                    } else {
                        $helpOptions = array();
                    }
                    print_yes_no_row(isset($vbphrase[$permBit['phrase']]) ? $vbphrase[$permBit['phrase']] : $permBit['phrase'], $permField . '[' . $permBit['name'] . ']', $permBit['set'], $extra, $helpOptions);
                }
            }
        }
    }
    // Legacy Hook 'admin_nperms_form' Removed //
}
function print_comments_table($fileid){
        global $phrases,$member_data,$id,$content,$op_comment,$sec_img,$sec_string,$settings,$admin_path;
  if($settings['files_comments_enable']){
    //-------- send comment command ---------
        if($op_comment=="send_comment"){
        if(check_member_login()){

          if($sec_img->verify_string($sec_string)){

       $content = htmlspecialchars($content);
    $memberid =  $member_data['id'] ;

            db_query("insert into mobile_files_comments (memberid,content,fileid,date) values('$memberid','$content','$id',now())");

            open_table();
            print "<center>$phrases[your_comment_sent_successfully]</center>";
            close_table();


       $content="";

            }else{
            open_table();
            print  "<center>$phrases[err_sec_code_not_valid]</center>";
            close_table();
                }

                }else{
                open_table();
                print "<center> $phrases[please_login_first] </center>";
                close_table();
                }
            }

 $qr = db_query("select * from mobile_files_comments where fileid='$fileid'");
  if(db_num($qr)){
          open_table("$phrases[the_comments]");
          print "<hr size=1 class=separate_line>";
          while($data = db_fetch($qr)){


             $dx = db_qr_fetch("select ".members_fields_replace('username').",".members_fields_replace('email')." from ".members_table_replace('mobile_members')." where ".members_fields_replace('id')."='$data[memberid]'",MEMBER_SQL);

          print "<table width=100% border=0><tr><td width=50%><b>$dx[username]</b></td><td align=left>$data[date]</td></tr>";

          print "<tr><td colspan=2>$data[content] &nbsp; <a href=\"javascript:report($id,$data[id]);\"><font color='red'>ΚΘανΫ</font></a>";
          if(check_login_cookies()){
          print " &nbsp;[<a href='".iif($admin_path,$admin_path,"admin")."/index.php?action=comment_del&id=$data[id]&cat=$id'>$phrases[delete]</a>]";
              }
          print "<br><hr size=1 class=separate_line></td></tr></table>";
                  }
          close_table();
          }
  }
}
function fetch_faq_parents($faqname)
{
    global $ifaqcache, $faqcache, $parents, $vbulletin;
    static $i = 0;
    $faq = $faqcache["{$faqname}"];
    if (is_array($ifaqcache["{$faq['faqparent']}"])) {
        $key = iif($i++, 'faq.php?' . vB::getCurrentSession()->get('sessionurl') . "faq={$faq['faqname']}");
        $parents["{$key}"] = $faq['title'];
        fetch_faq_parents($faq['faqparent']);
    }
}
Beispiel #25
0
/**
* Sends the reply notification to users subscribed to this issue.
*
* @param	array	Info about this issue
* @param	array	Info about this note (including text)
*/
function send_issue_reply_notification($issue, $issuenote)
{
    global $vbulletin, $db, $vbphrase;
    if ($issuenote['type'] != 'user' and $issuenote['type'] != 'petition') {
        // only send if the note is a "normal" note type
        return;
    }
    $project = fetch_project_info($issue['projectid']);
    $previousnote = $db->query_first("\r\n\t\tSELECT MAX(dateline) AS dateline\r\n\t\tFROM " . TABLE_PREFIX . "pt_issuenote AS issuenote\r\n\t\tWHERE issuenote.issueid = {$issue['issueid']}\r\n\t\t\tAND issuenote.dateline < {$issuenote['dateline']}\r\n\t\t\tAND issuenote.visible = 'visible'\r\n\t\t\tAND issuenote.type IN ('user', 'petition')\r\n\t");
    $notifications = $db->query_read_slave("\r\n\t\tSELECT user.*\r\n\t\tFROM " . TABLE_PREFIX . "pt_issuesubscribe AS issuesubscribe\r\n\t\tINNER JOIN " . TABLE_PREFIX . "user AS user ON (issuesubscribe.userid = user.userid)\r\n\t\tLEFT JOIN " . TABLE_PREFIX . "usergroup AS usergroup ON (usergroup.usergroupid = user.usergroupid)\r\n\t\tLEFT JOIN " . TABLE_PREFIX . "usertextfield AS usertextfield ON (usertextfield.userid = user.userid)\r\n\t\tWHERE issuesubscribe.issueid = {$issue['issueid']}\r\n\t\t\tAND issuesubscribe.subscribetype = 'instant'\r\n\t\t\tAND (usergroup.genericoptions & " . $vbulletin->bf_ugp_genericoptions['isnotbannedgroup'] . ")\r\n\t\t\t" . ($issuenote['userid'] ? "AND CONCAT(' ', IF(usertextfield.ignorelist IS NULL, '', usertextfield.ignorelist), ' ') NOT LIKE ' " . intval($issuenote['userid']) . " '" : '') . "\r\n\t\t\tAND user.userid <> {$issuenote['userid']}\r\n\t\t\tAND user.lastactivity >= " . intval($previousnote['dateline']) . "\r\n\t");
    if ($db->num_rows($notifications) == 0) {
        return;
    }
    require_once DIR . '/includes/functions_misc.php';
    require_once DIR . '/includes/class_bbcode_alt.php';
    $plaintext_parser =& new vB_BbCodeParser_PlainText($vbulletin, fetch_tag_list());
    $pagetext_cache = array();
    // used to cache the results per languageid for speed
    $evalemail = array();
    $email_texts = $vbulletin->db->query_read_slave("\r\n\t\tSELECT text, languageid, fieldname\r\n\t\tFROM " . TABLE_PREFIX . "phrase\r\n\t\tWHERE fieldname IN ('emailsubject', 'emailbody') AND varname = 'notify_pt'\r\n\t");
    while ($email_text = $vbulletin->db->fetch_array($email_texts)) {
        $emails["{$email_text['languageid']}"]["{$email_text['fieldname']}"] = $email_text['text'];
    }
    foreach ($emails as $languageid => $email_text) {
        // lets cycle through our array of notify phrases
        $text_message = str_replace("\\'", "'", addslashes(iif(empty($email_text['emailbody']), $emails['-1']['emailbody'], $email_text['emailbody'])));
        $text_message = replace_template_variables($text_message);
        $text_subject = str_replace("\\'", "'", addslashes(iif(empty($email_text['emailsubject']), $emails['-1']['emailsubject'], $email_text['emailsubject'])));
        $text_subject = replace_template_variables($text_subject);
        $evalemail["{$languageid}"] = '
			$message = "' . $text_message . '";
			$subject = "' . $text_subject . '";
		';
    }
    vbmail_start();
    while ($notification = $vbulletin->db->fetch_array($notifications)) {
        // check that this user has the correct permissions to view
        if (verify_issue_perms($issue, $notification) === false or verify_issue_note_perms($issue, $issuenote, $notification) === false) {
            continue;
        }
        $notification['username'] = unhtmlspecialchars($notification['username']);
        $notification['languageid'] = iif($notification['languageid'] == 0, $vbulletin->options['languageid'], $notification['languageid']);
        // parse the page text into plain text, taking selected language into account
        if (!isset($pagetext_cache["{$notification['languageid']}"])) {
            $plaintext_parser->set_parsing_language($notification['languageid']);
            $pagetext_cache["{$notification['languageid']}"] = $plaintext_parser->parse($issuenote['pagetext'], 'pt');
        }
        $pagetext = $pagetext_cache["{$notification['languageid']}"];
        eval(empty($evalemail["{$notification['languageid']}"]) ? $evalemail["-1"] : $evalemail["{$notification['languageid']}"]);
        vbmail($notification['email'], $subject, $message);
    }
    unset($plaintext_parser, $pagetext_cache);
    vbmail_end();
}
Beispiel #26
0
 function getOpen(&$element)
 {
     $this->attribs = array('eq' => '==', 'noteq' => '!=', 'modulo' => '%', 'greater' => '>', 'geq' => '>=', 'less' => '<', 'lesseq' => '<=');
     $this->keys = array_keys($element->attribs);
     if (isset($element->attribs['var']) && array_key_exists($this->keys[1], $this->attribs)) {
         preg_match('/{\\@([a-zA-Z_\\.]+?)}/', $element->attribs[$this->keys[1]], $matches);
         return "<?php elseif(\$context->getVar('" . $element->attribs['var'] . "') " . $this->attribs[$this->keys[1]] . " " . iif(count($matches) > 1, $element->attribs[$this->keys[1]], iif(ctype_digit($element->attribs[$this->keys[1]]) && $element->attribs[$this->keys[1]] != '', $element->attribs[$this->keys[1]], "'" . $element->attribs[$this->keys[1]] . "'")) . "): ?>";
         return "<h1>Missing EQ or NOTEQ, MODULO, GREATER, GEQ, LESS OR LESSEQ for conditional ELSEIF statement.</h1>";
     }
     return "<h1>Missing VAR, EQ or NOTEQ, MODULO, GREATER, GEQ, LESS OR LESSEQ for conditional ELSEIF statement.</h1>";
 }
Beispiel #27
0
function createTeamData($res, $parse)
{
    global $apx, $db, $set, $user;
    $userdata = array();
    if ($res['birthday']) {
        $bd = explode('-', $res['birthday']);
        $birthday = intval($bd[0]) . '. ' . getcalmonth($bd[1]) . iif($bd[2], ' ' . $bd[2]);
        if ($bd[2]) {
            $age = date('Y') - $bd[2];
            if (intval(sprintf('%02d%02d', $bd[1], $bd[0])) > intval(date('md'))) {
                $age -= 1;
            }
        }
    }
    $userdata['ID'] = $res['userid'];
    $userdata['USERID'] = $res['userid'];
    $userdata['NAME'] = replace($res['username']);
    $userdata['USERNAME'] = replace($res['username']);
    $userdata['GROUPID'] = $res['groupid'];
    $userdata['EMAIL'] = replace(iif(!$res['pub_hidemail'], $res['email']));
    $userdata['EMAIL_ENCRYPTED'] = replace(iif(!$res['pub_hidemail'], cryptMail($res['email'])));
    $userdata['ONLINE'] = iif(!$res['pub_invisible'] && $res['lastactive'] + $set['user']['timeout'] * 60 >= time(), 1, 0);
    $userdata['ISONLINE'] = $userdata['ONLINE'];
    $userdata['REALNAME'] = replace($res['realname']);
    $userdata['GENDER'] = $res['gender'];
    $userdata['CITY'] = replace($res['city']);
    $userdata['PLZ'] = replace($res['plz']);
    $userdata['COUNTRY'] = $res['country'];
    $userdata['REGTIME'] = $res['reg_time'];
    $userdata['REGDAYS'] = floor((time() - $res['reg_time']) / (24 * 3600));
    $userdata['LASTACTIVE'] = $res['lastactive'];
    $userdata['AVATAR'] = $user->mkavatar($res);
    $userdata['AVATAR_TITLE'] = $user->mkavtitle($res);
    $userdata['BIRTHDAY'] = $birthday;
    $userdata['AGE'] = $age;
    if (in_array($varname . '.ISBUDDY', $parse)) {
        $userdata['ISBUDDY'] = $user->is_buddy($res['userid']);
    }
    //Custom-Felder
    for ($ii = 1; $ii <= 10; $ii++) {
        $userdata['CUSTOM' . $ii . '_NAME'] = $set['user']['cusfield_names'][$ii - 1];
        $userdata['CUSTOM' . $ii] = compatible_hsc($res['custom' . $ii]);
    }
    //Interaktions-Links
    if ($user->info['userid']) {
        $userdata['LINK_SENDPM'] = mklink('user.php?action=newpm&amp;touser='******'userid'], 'user,newpm,' . $res['userid'] . '.html');
        $userdata['LINK_SENDEMAIL'] = mklink('user.php?action=newmail&amp;touser='******'userid'], 'user,newmail,' . $res['userid'] . '.html');
        if (in_array($varname . '.LINK_BUDDY', $parse) && !$user->is_buddy($res['userid'])) {
            $userdata['LINK_BUDDY'] = mklink('user.php?action=addbuddy&amp;id=' . $res['userid'], 'user,addbuddy,' . $res['userid'] . '.html');
        }
    }
    return $userdata;
}
 protected function show()
 {
     $db = Database::getObject();
     $tpl = Response::getObject()->appendTemplate("Airlines/admin/airports");
     $country = Request::get('country', VAR_NONE, 'Schweiz');
     $tpl->assign('country', $country);
     $db->query("SELECT * FROM <p>airports " . iif(!empty($country), "WHERE land = <country>") . " ORDER BY land, stadt, flughafen", compact("country"));
     $tpl->assign('data', $db->fetchAll());
     $db->query("SELECT DISTINCT land FROM <p>airports ORDER BY land");
     $tpl->assign('countries', $db->fetchAll(null, null, 'land'));
     $tpl->output();
 }
Beispiel #29
0
 function get_subtree($dir)
 {
     $dirs = readout_dir($dir);
     $numdirs = count($dirs);
     $dirdata = array();
     $i = 0;
     foreach ($dirs as $dirname) {
         ++$i;
         $dirdata[] = array('NAME' => compatible_hsc($dirname), 'PATH' => iif($dir, $dir . '/') . $dirname, 'LAST' => $i == $numdirs);
     }
     return $dirdata;
 }
Beispiel #30
0
function glossar_highlight($text, $module = false, $ignore = false)
{
    global $apx, $db, $set;
    static $highlights;
    $ignore = (int) $ignore;
    if (!$set['glossar']['highlight'] || !$text) {
        return $text;
    }
    $apx->lang->drop('highlights', 'glossar');
    $classname_word = 'glossar_highlight';
    $classname_title = 'glossar_info_title';
    $classname_text = 'glossar_info_text';
    $classname_readmore = 'glossar_info_readmore';
    //Daten auslesen
    if (!isset($highlights)) {
        $highlights = array();
        $data = $db->fetch("SELECT id,title,spelling,text FROM " . PRE . "_glossar WHERE starttime!=0" . iif($ignore, " AND id!='" . $ignore . "'"));
        if (count($data)) {
            foreach ($data as $res) {
                $words = array();
                if ($res['spelling']) {
                    $words = explode(',', strtolower($res['spelling']));
                }
                $words[] = strtolower($res['title']);
                $words = array_unique(array_map('trim', $words));
                $link = mklink('glossar.php?id=' . $res['id'], 'glossar,id' . $res['id'] . urlformat($res['title']) . '.html');
                $content = '<div class="' . $classname_title . '"><a href="' . $link . '">' . $res['title'] . '</a></div><div class="' . $classname_text . '">' . shorttext($res['text'], 200) . '</div><div class="' . $classname_readmore . '"><a href="' . $link . '">' . $apx->lang->get('READMORE') . '</a></div>';
                $content = strtr(compatible_hsc($content), array("\n" => ' ', "\r" => '', '\'' => '\\\'', '\\' => '\\\\'));
                $highlights[] = array('words' => $words, 'content' => $content);
            }
        }
    }
    //Text nach Highlights durchsuchen
    $lowertext = strtolower($text);
    foreach ($highlights as $element) {
        $words = $element['words'];
        foreach ($words as $wkey => $word) {
            if (strpos($lowertext, strtolower($word)) === false) {
                unset($words[$wkey]);
            }
        }
        if (!count($words)) {
            continue;
        }
        $words = array_map('preg_quote', $words);
        $searchfor = implode('|', $words);
        $hover = 'Tip(\'' . $element['content'] . '\')';
        $text = preg_replace('#((<[^>]*)|($|[\\s<>,.:;_!-])(' . $searchfor . ')([\\s<>,.:;_!-]|$))#ie', '"\\2"=="\\1" ? glossar_stripslashes("\\1") : glossar_stripslashes("\\3")."<span class=\\"' . $classname_word . '\\" onmouseover=\\"' . strtr($hover, array('\\' => '\\\\')) . '\\">".glossar_stripslashes("\\4")."</span>".glossar_stripslashes("\\5")', $text);
        //$text=preg_replace('#((<[^>]*)|('.$searchfor.'))#ie', '"\2"=="\1" ? glossar_stripslashes("\1") : "<span class=\"'.$classname_word.'\" onmouseover=\"'.$hover.'\">".glossar_stripslashes("\3")."</span>"', $text);
    }
    return $text;
}