当前位置: 首页>>代码示例>>PHP>>正文


PHP pnUserGetLang函数代码示例

本文整理汇总了PHP中pnUserGetLang函数的典型用法代码示例。如果您正苦于以下问题:PHP pnUserGetLang函数的具体用法?PHP pnUserGetLang怎么用?PHP pnUserGetLang使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了pnUserGetLang函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: blocks_ephem_block

function blocks_ephem_block($row)
{
    list($dbconn) = pnDBGetConn();
    $pntable = pnDBGetTables();
    $currentlang = pnUserGetLang();
    if (!pnSecAuthAction(0, 'Ephemeridsblock::', "{$row['title']}::", ACCESS_READ)) {
        return;
    }
    if (pnConfigGetVar('multilingual') == 1) {
        $column =& $pntable['ephem_column'];
        $querylang = "AND ({$column['elanguage']}='" . pnVarPrepForStore($currentlang) . "' OR {$column['elanguage']}='')";
    } else {
        $querylang = "";
    }
    $today = getdate();
    $eday = $today['mday'];
    $emonth = $today['mon'];
    $column =& $pntable['ephem_column'];
    $result = $dbconn->Execute("SELECT {$column['yid']}, {$column['content']}\n                              FROM {$pntable['ephem']}\n                              WHERE {$column['did']}='" . pnVarPrepForStore($eday) . "' AND {$column['mid']}='" . pnVarPrepForStore($emonth) . "' {$querylang}");
    $boxstuff = '<span class="pn-normal"><b>' . _ONEDAY . '</b></span><br />';
    while (list($yid, $content) = $result->fields) {
        $result->MoveNext();
        $boxstuff .= '<br /><br />';
        $boxstuff .= '<b>' . pnVarPrepForDisplay($yid) . '</b><br />' . pnVarPrepHTMLDisplay(nl2br($content)) . '';
    }
    if (empty($row['title'])) {
        $row['title'] = _EPHEMERIDS;
    }
    $row['content'] = $boxstuff;
    return themesideblock($row);
}
开发者ID:BackupTheBerlios,项目名称:microbuilder,代码行数:31,代码来源:ephem.php

示例2: blocks_thelang_block

function blocks_thelang_block($row)
{
    $currentlang = pnUserGetLang();
    if (!pnSecAuthAction(0, 'Languageblock::', "{$row['title']}::", ACCESS_OVERVIEW)) {
        return;
    }
    if (!pnConfigGetVar('multilingual')) {
        return;
    }
    $currentURL = $_SERVER['REQUEST_URI'];
    if ($currentURL === "") {
        $currentURL = "index.php";
    }
    $pattern = '/\\?newlang=.../';
    $currentURL = preg_replace($pattern, '', $currentURL);
    $pattern = '/\\&newlang=.../';
    $currentURL = pnVarPrepForDisplay(preg_replace($pattern, '', $currentURL));
    $append = "&amp;";
    if (strpos($currentURL, '?') === false) {
        $append = "?";
    }
    $lang = languagelist();
    $handle = opendir('language');
    while ($f = readdir($handle)) {
        if (is_dir("language/{$f}") && !empty($lang[$f])) {
            $langlist[$f] = $lang[$f];
            $sel_lang[$f] = '';
        }
    }
    asort($langlist);
    $content = '<center><font class="pn-normal">' . _SELECTGUILANG . '</font><br><br>';
    if (pnConfigGetVar('useflags')) {
        $i = 1;
        foreach ($langlist as $k => $v) {
            if ($i > 3) {
                $content .= "<br>\n";
                $i = 1;
            }
            $imgsize = @getimagesize("images/flags/flag-{$k}.png");
            $content .= "<a href=\"{$currentURL}" . $append . "newlang={$k}\"><img src=\"images/flags/flag-{$k}.png\" border=\"0\" alt=\"{$lang[$k]}\" hspace=\"3\" vspace=\"3\" {$imgsize['3']}></a>";
            $i++;
        }
        $content .= '</center>';
    } else {
        $content .= '<form method="post" action="index.php"><select class="pn-text" name="newlanguage" onChange="top.location.href=this.options[this.selectedIndex].value">';
        $sel_lang[$currentlang] = ' selected';
        foreach ($langlist as $k => $v) {
            $content .= "<option value=\"{$currentURL}" . $append . "newlang={$k}\"{$sel_lang[$k]}>{$v}</option>\n";
        }
        $content .= '</select></form></center>';
    }
    if (empty($row['title'])) {
        $row['title'] = _SELECTLANGUAGE;
    }
    $row['content'] = $content;
    return themesideblock($row);
}
开发者ID:BackupTheBerlios,项目名称:microbuilder,代码行数:57,代码来源:thelang.php

示例3: blocks_topic_block

function blocks_topic_block($row)
{
    //global $topic, $catid;
    list($dbconn) = pnDBGetConn();
    $pntable = pnDBGetTables();
    $currentlang = pnUserGetLang();
    if (!pnSecAuthAction(0, 'Topicblock::', "{$row['title']}::", ACCESS_READ)) {
        return;
    }
    $language = pnConfigGetVar('language');
    $topic = "";
    $catid = "";
    if (pnConfigGetVar('multilingual') == 1) {
        $column =& $pntable['stories_column'];
        $querylang = "AND ({$column['alanguage']}='{$currentlang}' OR {$column['alanguage']}='')";
        /* the OR is needed to display stories who are posted to ALL languages */
    } else {
        $querylang = '';
    }
    $column =& $pntable['topics_column'];
    $result = $dbconn->Execute("SELECT {$column['topicid']} AS topicid, {$column['topicname']} as topicname FROM {$pntable['topics']} ORDER BY topicname");
    if ($result->EOF) {
        return;
    } else {
        $boxstuff = '<span class="pn-normal">';
        if ($topic == "") {
            $boxstuff .= "<strong><big>&middot;</big></strong>&nbsp;<b><a href=\"modules.php?op=modload&amp;name=Topics&amp;file=index\">" . _ALL_TOPICS . "</a></b><br>";
        } else {
            $boxstuff .= "<strong><big>&middot;</big></strong>&nbsp;<a href=\"modules.php?op=modload&amp;name=News&amp;file=index&amp;catid={$catid}\">" . _ALL_TOPICS . "</a><br>";
        }
        while (!$result->EOF) {
            $srow = $result->GetRowAssoc(false);
            $result->MoveNext();
            if (pnSecAuthAction(0, 'Topics::Topic', "{$srow['topicname']}::{$srow['topicid']}", ACCESS_READ)) {
                $column =& $pntable['stories_column'];
                $result2 = $dbconn->Execute("SELECT {$column['time']} AS unixtime FROM {$pntable['stories']} WHERE {$column['topic']}={$srow['topicid']} {$querylang} ORDER BY {$column['time']} DESC");
                if (!$result2->EOF) {
                    $story = $result2->GetRowAssoc(false);
                    $story['unixtime'] = $result2->UnixTimeStamp($story['unixtime']);
                    $sdate = ml_ftime(_DATEBRIEF, $story['unixtime']);
                    if ($topic == $srow['topicid']) {
                        $boxstuff .= "<strong><big>&middot;</big></strong>&nbsp;<span class=\"pn-title\"><b>{$srow['topicname']}</b></span> <span class=\"pn-sub\">({$sdate})</span><br>";
                    } else {
                        $boxstuff .= "<strong><big>&middot;</big></strong>&nbsp;<a class=\"pn-normal\" href=\"modules.php?op=modload&amp;name=News&amp;file=index&amp;catid={$catid}&amp;topic={$srow['topicid']}\">{$srow['topicname']}</a> <span class=\"pn-sub\">({$sdate})</span><br>";
                    }
                }
            }
        }
    }
    $boxstuff .= '</span>';
    if (empty($row['title'])) {
        $row['title'] = _TOPICS;
    }
    $row['content'] = $boxstuff;
    return themesideblock($row);
}
开发者ID:BackupTheBerlios,项目名称:microbuilder,代码行数:56,代码来源:topic.php

示例4: blocks_category_block

function blocks_category_block($row)
{
    global $topic, $catid;
    list($dbconn) = pnDBGetConn();
    $pntable = pnDBGetTables();
    if (!pnSecAuthAction(0, 'Categoryblock::', "{$row['title']}::", ACCESS_READ)) {
        return;
    }
    if (pnConfigGetVar('multilingual') == 1) {
        $column =& $pntable['stories_column'];
        $querylang = "AND ({$column['alanguage']}='" . pnVarPrepForStore(pnUserGetLang()) . "' OR {$column['alanguage']}='')";
        /* the OR is needed to display stories who are posted to ALL languages */
    } else {
        $querylang = '';
    }
    $column =& $pntable['stories_cat_column'];
    $result = $dbconn->Execute("SELECT {$column['catid']} as catid, {$column['title']} as title FROM {$pntable['stories_cat']} ORDER BY {$column['title']}");
    if ($result->EOF) {
        return;
    } else {
        $boxstuff = '<span class="pn-normal">';
        if ($catid == "") {
            // $boxstuff .= '<strong><big>&middot;</big></strong>&nbsp;<b>'._ALL_CATEGORIES.'</b><br />';
            $boxstuff .= "";
        } else {
            $boxstuff .= "<strong><big>&middot;</big></strong>&nbsp;<a href=\"modules.php?op=modload&amp;name=News&amp;file=index&amp;topic={$topic}\">" . _ALL_CATEGORIES . "</a><br />";
        }
        for (; !$result->EOF; $result->MoveNext()) {
            $srow = $result->GetRowAssoc(false);
            if (pnSecAuthAction(0, 'Stories::Category', "{$srow['title']}::{$srow['catid']}", ACCESS_READ)) {
                $column =& $pntable['stories_column'];
                $result2 = $dbconn->Execute("SELECT {$column['time']} AS unixtime\n                                           FROM {$pntable['stories']}\n                                           WHERE {$column['catid']}=" . pnVarPrepForStore($srow['catid']) . " {$querylang}\n                                           ORDER BY {$column['time']} DESC");
                if (!$result2->EOF) {
                    $story = $result2->GetRowAssoc(false);
                    $story['unixtime'] = $result2->UnixTimeStamp($story['unixtime']);
                    $sdate = ml_ftime(_DATEBRIEF, $story['unixtime']);
                    if ($catid == $srow['catid']) {
                        $boxstuff .= "<strong><big>&middot;</big></strong>&nbsp;<span class=\"pn-title\"><b>" . pnVarPrepForDisplay($srow['title']) . "</b></span> <span class=\"pn-sub\">(" . pnVarPrepForDisplay($sdate) . ")</span><br />";
                    } else {
                        $boxstuff .= "<strong><big>&middot;</big></strong>&nbsp;<a class=\"pn-normal\" href=\"modules.php?op=modload&amp;name=News&amp;file=index&amp;catid={$srow['catid']}&amp;topic={$topic}\">" . pnVarPrepForDisplay($srow['title']) . "</a> <span class=\"pn-sub\">(" . pnVarPrepForDisplay($sdate) . ")</span><br />";
                    }
                }
            }
        }
    }
    $boxstuff .= '</span>';
    if (empty($row['title'])) {
        $row['title'] = _CATEGORIES;
    }
    $row['content'] = $boxstuff;
    return themesideblock($row);
}
开发者ID:BackupTheBerlios,项目名称:microbuilder,代码行数:52,代码来源:category.php

示例5: modules_adminapi_initialise

/**
 * initialise a module
 */
function modules_adminapi_initialise($args)
{
    // Get arguments from argument array
    extract($args);
    // Argument check
    if (!isset($mid) || !is_numeric($mid)) {
        pnSessionSetVar('errormsg', _MODARGSERROR);
        return false;
    }
    // Get module information
    $modinfo = pnModGetInfo($mid);
    if (empty($modinfo)) {
        pnSessionSetVar('errormsg', _MODNOSUCHMOD);
        return false;
    }
    // Get module database info
    pnModDBInfoLoad($modinfo['name'], $modinfo['directory']);
    // Module initialisation function
    $osdir = pnVarPrepForOS($modinfo['directory']);
    @(include "modules/{$osdir}/pninit.php");
    @(include "modules/{$osdir}/pnlang/" . pnVarPrepForOS(pnUserGetLang()) . "/init.php");
    $func = $modinfo['name'] . '_init';
    if (function_exists($func)) {
        if ($func() != true) {
            return false;
        }
    }
    // Update state of module
    if (!modules_adminapi_setstate(array('mid' => $mid, 'state' => _PNMODULE_STATE_INACTIVE))) {
        pnSessionSetVar('errormsg', _MODCHANGESTATEFAILED);
        return false;
    }
    // Success
    return true;
}
开发者ID:BackupTheBerlios,项目名称:microbuilder,代码行数:38,代码来源:pnadminapi.php

示例6: draw_menu

 function draw_menu()
 {
     global $hlpfile;
     $currentlang = pnVarCleanFromInput('currentlang');
     OpenTable();
     echo '<center>' . "\n";
     if (count($this->options) == 0) {
         $this->title_file = '';
     }
     if ($this->title_file != '') {
         echo '<a href="' . $this->title_file . '" class="pn-title">';
     }
     echo '<font class="pn-title"><b>' . pnVarPrepForDisplay($this->title_text) . '</b></font>';
     if ($this->title_file != '') {
         echo '</a></center>';
     }
     echo "\n" . '<br>' . "\n";
     //    if (($this->detail_menu) or ($GLOBALS['module']=='oldway'))
     //   {
     // if (isset($this->help_file))
     // {
     $currentlang = pnUserGetLang();
     // fixed bug [ #357 ] empty pop up window
     if (file_exists($file = "modules/" . $GLOBALS['module'] . "/lang/" . pnVarPrepForOS($currentlang) . "/manual.html")) {
         $hlpfile = $file;
         echo '<center>[ <a href="javascript:openwindow(' . ')" class="pn-normal">' . _ONLINEMANUAL . '</a> ]' . "</center>\n";
     }
     //  }
     //    }
     if ($this->detail_menu) {
         if (count($this->options) == 0) {
             echo _ADMIN_NO_OPTION . "\n";
         } else {
             echo '<br><br>' . "\n" . '<table border="0" width="100%" cellspacing="1">' . "\n";
             if ($this->graphic_menu) {
                 $this->draw_options_graphic();
             } else {
                 $this->draw_options();
             }
             echo '</table>' . "\n";
         }
     }
     CloseTable();
 }
开发者ID:BackupTheBerlios,项目名称:microbuilder,代码行数:44,代码来源:menu.php

示例7: search_reviews

function search_reviews()
{
    list($active_reviews, $startnum, $total, $bool, $q) = pnVarCleanFromInput('active_reviews', 'startnum', 'total', 'bool', 'q');
    if (empty($active_reviews)) {
        return;
    }
    list($dbconn) = pnDBGetConn();
    $pntable = pnDBGetTables();
    $output = new pnHTML();
    $output->SetInputMode(_PNH_VERBATIMINPUT);
    if (!isset($startnum) || !is_numeric($startnum)) {
        $startnum = 1;
    }
    if (isset($total) && !is_numeric($total)) {
        unset($total);
    }
    $w = search_split_query($q);
    $flag = false;
    $revcol =& $pntable['reviews_column'];
    $comcol =& $pntable['reviews_comments_column'];
    $query = "SELECT DISTINCT {$revcol['id']} as id, {$revcol['title']} as title, {$revcol['score']} as score, {$revcol['hits']} as hits, {$revcol['reviewer']} as reviewer, {$revcol['date']} AS fdate\n              FROM {$pntable['reviews']} LEFT JOIN {$pntable['reviews_comments']} ON {$comcol['rid']}={$revcol['id']}\n              WHERE \n";
    foreach ($w as $word) {
        if ($flag) {
            switch ($bool) {
                case 'AND':
                    $query .= ' AND ';
                    break;
                case 'OR':
                default:
                    $query .= ' OR ';
                    break;
            }
        }
        $query .= '(';
        // reviews
        $query .= "{$revcol['title']} LIKE '{$word}' OR \n";
        $query .= "{$revcol['text']} LIKE '{$word}' OR \n";
        $query .= "{$revcol['reviewer']} LIKE '{$word}' OR \n";
        $query .= "{$revcol['cover']} LIKE '{$word}' OR \n";
        $query .= "{$revcol['url']} LIKE '{$word}' OR \n";
        $query .= "{$revcol['url_title']} LIKE '{$word}' OR \n";
        // reviews_comments
        $query .= "{$comcol['comments']} LIKE '{$word}'\n";
        $query .= ')';
        $flag = true;
    }
    if (pnConfigGetVar('multilingual') == 1) {
        $query .= " AND ({$revcol['rlanguage']}='" . pnVarPrepForStore(pnUserGetLang()) . "' OR {$revcol['rlanguage']}='')";
    }
    $query .= " ORDER BY {$revcol['date']}";
    // get the total count with permissions!
    if (empty($total)) {
        $total = 0;
        $countres = $dbconn->Execute($query);
        while (!$countres->EOF) {
            $row = $countres->GetRowAssoc(false);
            if (pnSecAuthAction(0, "Reviews::", "{$row['title']}::{$row['id']}", ACCESS_READ)) {
                $total++;
            }
            $countres->MoveNext();
        }
    }
    $result = $dbconn->SelectLimit($query, 10, $startnum - 1);
    if (!$result->EOF) {
        $output->Text(_REVIEWS . ': ' . $total . ' ' . _SEARCHRESULTS);
        $output->SetInputMode(_PNH_VERBATIMINPUT);
        // Rebuild the search string from previous information
        $url = "modules.php?op=modload&amp;name=Search&amp;file=index&amp;action=search&amp;active_reviews=1&amp;bool={$bool}&amp;q={$q}";
        $output->Text("<ul>");
        while (!$result->EOF) {
            $row = $result->GetRowAssoc(false);
            $row['fdate'] = ml_ftime(_DATELONG, $result->UnixTimeStamp($row['fdate']));
            if (pnSecAuthAction(0, "Reviews::", "{$row['title']}::{$row['id']}", ACCESS_READ)) {
                $output->Text("<li><a class=\"pn-normal\" href=\"modules.php?op=modload&amp;name=Reviews&amp;file=index&amp;req=showcontent&id={$row['id']}\">{$row['title']}</a> <font class=\"pn-sub\">(score: {$row['score']} - hits: {$row['hits']})</font><br>{$row['reviewer']}<br>{$row['fdate']}</li>");
            }
            $result->MoveNext();
        }
        $output->Text("</ul>");
        // Munge URL for template
        $urltemplate = $url . "&amp;startnum=%%&amp;total={$total}";
        $output->Pager($startnum, $total, $urltemplate, 10);
    } else {
        $output->SetInputMode(_PNH_VERBATIMINPUT);
        $output->Text('<font class="pn-normal">' . _SEARCH_NO_REVIEWS . '</font>');
        $output->SetInputMode(_PNH_PARSEINPUT);
    }
    $output->Linebreak(3);
    return $output->GetOutput();
}
开发者ID:BackupTheBerlios,项目名称:microbuilder,代码行数:89,代码来源:reviews.php

示例8: pnInit

//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// To read the license please visit http://www.gnu.org/copyleft/gpl.html
// ----------------------------------------------------------------------
include 'includes/pnAPI.php';
pnInit();
// Get all parameters from input space
list($stop, $minage, $module, $op) = pnVarCleanFromInput('stop', 'minage', 'module', 'op');
// treat all user.php functions as a module for later checks - markwest
define('LOADED_AS_MODULE', '1');
// load languages
if (file_exists($currentlangfile = 'language/' . pnVarPrepForOS(pnUserGetLang()) . '/user.php')) {
    include $currentlangfile;
} elseif (file_exists($defaultlangfile = 'language/' . pnVarPrepForOS(pnConfigGetVar('language')) . '/user.php')) {
    include $defaultlangfile;
}
// set module and op respective to the different cases
if (!pnUserLoggedIn() && empty($op)) {
    $module = 'User';
    $op = 'getlogin';
}
if (isset($op) && $op == 'userinfo') {
    $module = 'User';
}
if (pnUserLoggedIn() and (empty($op) or $op == 'adminMain')) {
    $module = 'User';
    $op = 'main';
开发者ID:BackupTheBerlios,项目名称:freshwind-svn,代码行数:31,代码来源:user.php

示例9: admin_messages_messagesblock_display

/**
 * display block
 */
function admin_messages_messagesblock_display($row)
{
    list($dbconn) = pnDBGetConn();
    $pntable = pnDBGetTables();
    if (!isset($row['title'])) {
        $row['title'] = '';
    }
    if (!pnSecAuthAction(0, 'Admin Messages:Messagesblock:', "{$row['title']}::", ACCESS_READ)) {
        return;
    }
    $messagestable = $pntable['message'];
    $messagescolumn =& $pntable['message_column'];
    if (pnConfigGetVar('multilingual') == 1) {
        $currentlang = pnUserGetLang();
        $querylang = "AND ({$messagescolumn['mlanguage']}='{$currentlang}' OR {$messagescolumn['mlanguage']}='')";
    } else {
        $querylang = '';
    }
    $sql = "SELECT {$messagescolumn['mid']},\n                   {$messagescolumn['title']},\n                   {$messagescolumn['content']},\n                   {$messagescolumn['date']},\n                   {$messagescolumn['view']}\n            FROM {$messagestable}\n            WHERE {$messagescolumn['active']} = 1 \n            AND  ( {$messagescolumn['expire']} > unix_timestamp(now())\n                  OR {$messagescolumn['expire']} = 0)\n            {$querylang}\n            ORDER by {$messagescolumn['mid']} DESC";
    $result = $dbconn->Execute($sql);
    if ($dbconn->ErrorNo() != 0) {
        return;
    }
    $output = new pnHTML();
    while (list($mid, $title, $content, $date, $view) = $result->fields) {
        $result->MoveNext();
        $show = 0;
        if (pnSecAuthAction(0, 'Admin Messages:Messagesblock:', "{$row['title']}::{$mid}", ACCESS_READ)) {
            switch ($view) {
                case 1:
                    // Message for everyone
                    $show = 1;
                    break;
                case 2:
                    // Message for users
                    if (pnUserLoggedIn()) {
                        $show = 1;
                    }
                    break;
                case 3:
                    // Messages for non-users
                    if (!pnUserLoggedIn()) {
                        $show = 1;
                    }
                    break;
                case 4:
                    // Messages for administrators of any description
                    if (pnSecAuthAction(0, '::', '::', ACCESS_ADMIN)) {
                        $show = 1;
                    }
                    break;
            }
        }
        if ($show) {
            list($title, $content) = pnModCallHooks('item', 'transform', '', array($title, $content));
            $output->TableStart('', '', 0);
            $output->SetInputMode(_PNH_VERBATIMINPUT);
            $output->SetOutputMode(_PNH_RETURNOUTPUT);
            $ttitle = $output->Linebreak();
            $ttitle .= $output->Text($title);
            $ttitle .= $output->Linebreak(2);
            $output->SetOutputMode(_PNH_KEEPOUTPUT);
            $output->TableAddRow(array("<font class=\"pn-title\">" . pnVarPrepHTMLDisplay($ttitle) . "</font>"), 'center');
            $output->TableAddRow(array("<font class=\"pn-normal\">" . pnVarPrepHTMLDisplay($content) . "</font>"), 'left');
            $output->SetInputMode(_PNH_PARSEINPUT);
            $output->TableEnd();
        }
    }
    if ($output->output != "") {
        // Don't want a title
        $row['title'] = '';
        $row['content'] = $output->GetOutput();
        return themesideblock($row);
    }
}
开发者ID:BackupTheBerlios,项目名称:microbuilder,代码行数:78,代码来源:messages.php

示例10: search_faqs

function search_faqs()
{
    list($q, $bool, $startnum, $total, $active_faqs) = pnVarCleanFromInput('q', 'bool', 'startnum', 'total', 'active_faqs');
    if (empty($active_faqs)) {
        return;
    }
    list($dbconn) = pnDBGetConn();
    $pntable = pnDBGetTables();
    $output = new pnHTML();
    $output->SetInputMode(_PNH_VERBATIMINPUT);
    if (!isset($startnum) || !is_numeric($startnum)) {
        $startnum = 1;
    }
    if (isset($total) && !is_numeric($total)) {
        unset($total);
    }
    $w = search_split_query($q);
    $flag = false;
    $column =& $pntable['faqanswer_column'];
    $faqcatcol =& $pntable['faqcategories_column'];
    $query = "SELECT {$column['id_cat']} as id_cat, \n    \t\t\t\t{$column['question']} as question, \n    \t\t\t\t{$column['answer']} as answer,\n    \t\t\t\t{$faqcatcol['categories']} as categories\n              FROM {$pntable['faqanswer']} \n              LEFT JOIN {$pntable['faqcategories']} ON {$column['id_cat']}={$faqcatcol['id_cat']}\n              WHERE \n";
    foreach ($w as $word) {
        if ($flag) {
            switch ($bool) {
                case 'AND':
                    $query .= ' AND ';
                    break;
                case 'OR':
                default:
                    $query .= ' OR ';
                    break;
            }
        }
        $query .= '(';
        // faqs
        $query .= "{$column['question']} LIKE '{$word}' OR \n";
        $query .= "{$column['answer']} LIKE '{$word}'\n";
        $query .= ')';
        $flag = true;
    }
    if (pnConfigGetVar('multilingual') == 1) {
        $query .= " AND ({$faqcatcol['flanguage']}='" . pnVarPrepForStore(pnUserGetLang()) . "' OR {$faqcatcol['flanguage']}='')";
    }
    $query .= " ORDER BY {$column['id']}";
    // get the total count with permissions!
    if (empty($total)) {
        $total = 0;
        $countres = $dbconn->Execute($query);
        while (!$countres->EOF) {
            $row = $countres->GetRowAssoc(false);
            if (pnSecAuthAction(0, "FAQ::", "{$row['categories']}::{$row['id_cat']}", ACCESS_READ)) {
                $total++;
            }
            $countres->MoveNext();
        }
    }
    $result = $dbconn->SelectLimit($query, 10, $startnum - 1);
    if (!$result->EOF) {
        $output->Text(_FAQ . ': ' . $total . ' ' . _SEARCHRESULTS);
        $output->SetInputMode(_PNH_VERBATIMINPUT);
        // Rebuild the search string from previous information
        $url = "modules.php?op=modload&amp;name=Search&amp;file=index&amp;action=search&amp;active_faqs=1&amp;bool={$bool}&amp;q={$q}";
        $output->Text("<ul>");
        while (!$result->EOF) {
            $row = $result->GetRowAssoc(false);
            if (pnSecAuthAction(0, "FAQ::", "{$row['categories']}::{$row['id_cat']}", ACCESS_READ)) {
                $output->Text("<li><a class=\"pn-normal\" href=\"modules.php?op=modload&amp;name=FAQ&amp;file=index&amp;myfaq=yes&id_cat={$row['id_cat']}\">{$row['question']}</a><br>Answer: " . nl2br($row[answer]) . "</li>");
            }
            $result->MoveNext();
        }
        $output->Text('</ul>');
        // Munge URL for template
        $urltemplate = $url . "&amp;startnum=%%&amp;total={$total}";
        $output->Pager($startnum, $total, $urltemplate, 10);
    } else {
        $output->SetInputMode(_PNH_VERBATIMINPUT);
        $output->Text('<font class="pn-normal">' . _SEARCH_NO_FAQS . '</font>');
        $output->SetInputMode(_PNH_PARSEINPUT);
    }
    $output->Linebreak(3);
    return $output->GetOutput();
}
开发者ID:BackupTheBerlios,项目名称:microbuilder,代码行数:82,代码来源:faq.php

示例11: pnInit

 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 * 
 *  To read the license please visit http://www.gnu.org/copyleft/gpl.html
 *  ----------------------------------------------------------------------
 *  Original Author of file: larsneo
 *  Purpose of file: Error Handling
 *  Usage: Set up the redirection in your .htaccess with
 *  ErrorDocument 404 http://www.yoursite.com/error.php
 *  Note: REDIRECT_URL won't be available but
 *  due to subfolders one can't use a relative path :-/
 *  ----------------------------------------------------------------------
 **/
include_once 'includes/pnAPI.php';
pnInit();
$currentlang = pnUserGetLang();
$currentlang = pnVarPrepForOS($currentlang);
if (file_exists("language/{$currentlang}/error.php")) {
    include "language/{$currentlang}/error.php";
} elseif (file_exists("language/eng/error.php")) {
    include "language/eng/error.php";
}
$reportlevel = pnConfigGetVar('reportlevel');
$funtext = pnConfigGetVar('funtext');
header('HTTP/1.1 404 Not Found');
include 'header.php';
if ($funtext == 0) {
    echo "<h2>" . _ERROR404_HEAD . "</h2>\n" . "<br /><br />\n" . "<strong>" . _ERROR404_TRY . "</strong><br />\n" . _ERROR404_TRY1 . "<br />\n" . "<a href=\"index.php\">" . _ERROR404_TRY2 . "</a><br />\n" . _ERROR404_TRY3 . "<br />\n" . _ERROR404_TRY4 . "\n";
    if (pnModAvailable('Search')) {
        echo '<br /><a href="' . pnVarPrepForDisplay(pnModURL('Search')) . '">' . _ERROR404_TRY5 . "</a>\n";
    }
开发者ID:BackupTheBerlios,项目名称:freshwind-svn,代码行数:31,代码来源:error.php

示例12: pnBlockLoad

/**
 * load a block
 * @param the module name
 * @param the name of the block
 */
function pnBlockLoad($modname, $block)
{
    global $blocks_modules;
    static $loaded = array();
    if (isset($loaded["{$modname}{$block}"])) {
        return true;
    }
    if (empty($modname) || $modname == 'Core') {
        $modname = 'Core';
        $moddir = 'includes/blocks';
        $langdir = 'includes/language/blocks';
    } else {
        $modinfo = pnModGetInfo(pnModGetIdFromName($modname));
        $moddir = 'modules/' . pnVarPrepForOS($modinfo['directory']) . '/pnblocks';
        $langdir = 'modules/' . pnVarPrepForOS($modinfo['directory']) . '/pnlang';
    }
    // Load the block
    $incfile = $block . ".php";
    $filepath = $moddir . '/' . pnVarPrepForOS($incfile);
    if (!file_exists($filepath)) {
        return false;
    }
    include_once $filepath;
    $loaded["{$modname}{$block}"] = 1;
    // Load the block language files
    $currentlangfile = $langdir . '/' . pnVarPrepForOS(pnUserGetLang()) . '/' . pnVarPrepForOS($incfile);
    $defaultlangfile = $langdir . '/' . pnVarPrepForOS(pnConfigGetVar('language')) . '/' . pnVarPrepForOS($incfile);
    if (file_exists($currentlangfile)) {
        include $currentlangfile;
    } elseif (file_exists($defaultlangfile)) {
        include "{$defaultlangfile}";
    }
    // Initialise block if required (new-style)
    $initfunc = "{$modname}_{$block}block_init";
    if (function_exists($initfunc)) {
        $initfunc();
    }
    return true;
}
开发者ID:BackupTheBerlios,项目名称:microbuilder,代码行数:44,代码来源:advblocks.php

示例13: pollList

function pollList()
{
    if (!pnSecAuthAction(0, 'Polls::', "::", ACCESS_OVERVIEW)) {
        return;
    }
    list($dbconn) = pnDBGetConn();
    $pntable = pnDBGetTables();
    $currentlang = pnUserGetLang();
    $commentoptions = pnUserGetCommentOptions();
    if (pnConfigGetVar('multilingual') == 1) {
        $column =& $pntable['poll_desc_column'];
        $querylang = "WHERE ({$column['planguage']}='" . pnVarPrepForStore($currentlang) . "' OR {$column['planguage']}='')";
    } else {
        $querylang = "";
    }
    $column =& $pntable['poll_desc_column'];
    $result = $dbconn->Execute("SELECT {$column['pollid']}, {$column['polltitle']}, {$column['timestamp']}, {$column['voters']} FROM {$pntable['poll_desc']} {$querylang} ORDER BY {$column['timestamp']}");
    OpenTable();
    OpenTable();
    echo "<p style=\"text-align:center\"><span class=\"pn-title\"><b>" . _PASTSURVEYS . "</b></span></p>";
    CloseTable();
    echo "<table border=\"0\" cellpadding=\"8\"><tr><td>";
    echo "<span class=\"pn-normal\">";
    $counter = 0;
    $resultArray = array();
    while ($thisresult = $result->fields) {
        $result->MoveNext();
        $resultArray[$counter] = $thisresult;
        $counter++;
    }
    for ($count = 0; $count < count($resultArray); $count++) {
        $id = $resultArray[$count][0];
        $pollTitle = $resultArray[$count][1];
        $voters = $resultArray[$count][3];
        $column =& $pntable['poll_data_column'];
        $result2 = $dbconn->Execute("SELECT SUM({$column['optioncount']}) AS sum FROM {$pntable['poll_data']} WHERE {$column['pollid']}=" . pnVarPrepForStore($id) . "");
        list($sum) = $result2->fields;
        echo "<strong><big>&middot;</big></strong>&nbsp;<a class=\"pn-normal\" href=\"modules.php?op=modload&amp;name=NS-Polls&amp;file=index&amp;pollID={$id}\">" . pnVarPrepForDisplay(stripslashes($pollTitle)) . "</a> ";
        echo "(<a class=\"pn-normal\" href=\"modules.php?op=modload&amp;name=NS-Polls&amp;file=index&amp;req=results&amp;pollID={$id}&amp;{$commentoptions}\">" . _RESULTS . "</a> - {$sum} " . _LVOTES . ")<br />\n";
    }
    echo '</span></td></tr></table>';
    CloseTable();
}
开发者ID:BackupTheBerlios,项目名称:microbuilder,代码行数:43,代码来源:poll.php

示例14: user_dynamic_data

function user_dynamic_data()
{
    list($dbconn) = pnDBGetConn();
    $pntable = pnDBGetTables();
    $currentlangfile = 'language/' . pnVarPrepForOS(pnUserGetLang()) . '/user.php';
    $defaultlangfile = 'language/' . pnVarPrepForOS(pnConfigGetVar('language')) . '/user.php';
    if (file_exists($currentlangfile)) {
        include $currentlangfile;
    } elseif (file_exists($defaultlangfile)) {
        include $defaultlangfile;
    }
    include "header.php";
    GraphicAdmin();
    OpenTable();
    echo "<center><font class=\"pn-title\"><b>" . _USERADMIN . "</b></font></center>";
    CloseTable();
    // This section displays the dynamic fields
    // and the order in which they are displayed
    OpenTable();
    print '<center><font size="3" class="pn-title"><b>' . _DYNAMICDATA . '</b></font></center><br>' . '<table class=\'pn-normal\' border=\'1\' width=\'100%\'>' . '<tr>' . '<th>' . _FIELDACTIVE . '</th>' . '<th colspan=\'2\'>' . _FIELDLABEL . '</th>' . '<th>' . _FIELDWEIGHT . '</th>' . '<th>' . _FIELDTYPE . '</th>' . '<th>' . _FIELDLENGTH . '</th>' . '<th>' . _DELETE . '</th>' . '</tr>';
    $column =& $pntable['user_property_column'];
    $result = $dbconn->Execute("SELECT {$column['prop_id']}, {$column['prop_label']},{$column['prop_dtype']},\n                              {$column['prop_length']}, {$column['prop_weight']}, {$column['prop_validation']}\n                              FROM {$pntable['user_property']} ORDER BY {$column['prop_weight']}");
    if ($dbconn->ErrorNo() != 0) {
        echo $dbconn->ErrorNo() . "List User Properties: " . $dbconn->ErrorMsg() . "<br>";
        error_log($dbconn->ErrorNo() . "List User Properties: " . $dbconn->ErrorMsg() . "<br>");
        return;
    }
    $active_count = 0;
    $true_count = 0;
    $total_count = $result->PO_RecordCount();
    $prop_weight = 0;
    while (list($prop_id, $prop_label, $prop_dtype, $prop_length, $prop_weight, $prop_validation) = $result->fields) {
        $result->MoveNext();
        $true_count++;
        if ($prop_weight != 0) {
            $active_count++;
            $next_prop_weight = $active_count + 1;
        }
        $eval_cmd = "\$prop_label_text={$prop_label};";
        @eval($eval_cmd);
        // display the proper icom and link to enable or disable the field
        switch (true) {
            // Mandatory Images can't be disabled
            case $prop_dtype == _UDCONST_MANDATORY:
                $img_cmd = '<img src="images/global/green_dot.gif" border=0 ALT="' . _FIELD_REQUIRED . '">';
                break;
            case $prop_weight != 0:
                $img_cmd = "<a href=\"admin.php?module=" . $GLOBALS['module'] . "&amp;op=deactivate_property&amp;property={$prop_id}&amp;weight={$prop_weight}\">" . '<img src="images/global/green_dot.gif" border=0 ALT="' . _FIELD_DEACTIVATE . '">' . '</a>';
                break;
            default:
                $img_cmd = "<a href=\"admin.php?module=" . $GLOBALS['module'] . "&amp;op=activate_property&amp;property={$prop_id}&amp;weight={$prop_weight}\">" . '<img src="images/global/red_dot.gif" border=0 ALT="' . _FIELD_ACTIVATE . '">' . '</a>';
        }
        switch ($prop_dtype) {
            case _UDCONST_MANDATORY:
                $data_type_text = _UDT_MANDATORY;
                $data_length_text = _FIELD_NA;
                break;
            case _UDCONST_CORE:
                $data_type_text = _UDT_CORE;
                $data_length_text = _FIELD_NA;
                break;
            case _UDCONST_STRING:
                $data_type_text = _UDT_STRING;
                $data_length_text = $prop_length;
                break;
            case _UDCONST_TEXT:
                $data_type_text = _UDT_TEXT;
                $data_length_text = _FIELD_NA;
                break;
            case _UDCONST_FLOAT:
                $data_type_text = _UDT_FLOAT;
                $data_length_text = _FIELD_NA;
                break;
            case _UDCONST_INTEGER:
                $data_type_text = _UDT_INTEGER;
                $data_length_text = _FIELD_NA;
                break;
            default:
                $data_length_text = "";
                $data_type_text = "";
        }
        switch (true) {
            case $active_count == 0:
                $arrows = "&nbsp";
                break;
            case $active_count == 1:
                $arrows = "<a href=\"admin.php?module=" . $GLOBALS['module'] . "&amp;op=increase_weight&amp;property={$prop_id}&amp;weight={$prop_weight}\">" . '<img src="images/global/down.gif" alt="' . _DOWN . '" border="0">' . '</a>';
                break;
            case $true_count == $total_count:
                $arrows = "<a href=\"admin.php?module=" . $GLOBALS['module'] . "&amp;op=decrease_weight&amp;property={$prop_id}&amp;weight={$prop_weight}\">" . '<img src="images/global/up.gif" alt="' . _UP . '" border="0">' . '</a>';
                break;
            default:
                $arrows = '<img src="images/global/up.gif" alt="' . _UP . '">&nbsp;<img src="images/global/down.gif" alt="' . _DOWN . '">';
                $arrows = "<a href=\"admin.php?module=" . $GLOBALS['module'] . "&amp;op=decrease_weight&amp;property={$prop_id}&amp;weight={$prop_weight}\">" . '<img src="images/global/up.gif" border="0" alt="' . _UP . '">' . '</a>&nbsp;' . "<a href=\"admin.php?module=" . $GLOBALS['module'] . "&amp;op=increase_weight&amp;property={$prop_id}&amp;weight={$prop_weight}\">" . '<img src="images/global/down.gif" border="0" alt="' . _DOWN . '">' . '</a>';
        }
        if ($prop_dtype == _UDCONST_MANDATORY || $prop_dtype == _UDCONST_CORE) {
            $del_text = _FIELD_NA;
        } else {
            $del_text = "<a href=\"admin.php?module=" . $GLOBALS['module'] . "&amp;op=delete_property&amp;property={$prop_id}\">" . _DELETE . '</a>';
        }
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:microbuilder,代码行数:101,代码来源:admin.php

示例15: blocks_stories_block

function blocks_stories_block($row)
{
    list($dbconn) = pnDBGetConn();
    $pntable = pnDBGetTables();
    $currentlang = pnUserGetLang();
    if (!pnSecAuthAction(0, 'Storiesblock::', "{$row['title']}::", ACCESS_READ)) {
        return;
    }
    // Break out options from our content field
    $vars = pnBlockVarsFromContent($row['content']);
    // Defaults
    if (!isset($vars['storiestype'])) {
        $vars['storiestype'] = 2;
    }
    if (!isset($vars['topic'])) {
        $vars['topic'] = -1;
    }
    if (!isset($vars['category'])) {
        $vars['category'] = -1;
    }
    if (!isset($vars['limit'])) {
        $vars['limit'] = 10;
    }
    $row['content'] = "";
    $query_started = false;
    // Base query
    $storiescolumn = $pntable['stories_column'];
    $storiescatcolumn = $pntable['stories_cat_column'];
    $topicscolumn = $pntable['topics_column'];
    $query = "SELECT {$storiescolumn['aid']} AS \"aid\",\n                    {$storiescolumn['catid']} AS \"cid\",\n                    {$storiescatcolumn['title']} AS \"cattitle\",\n                    {$storiescolumn['sid']} AS \"sid\",\n                    {$topicscolumn['topicid']} AS \"tid\",\n                    {$storiescolumn['time']} AS \"time\",\n                    {$storiescolumn['title']} AS \"title\",\n                    {$topicscolumn['topicname']} AS \"topicname\"\n\t\t\tFROM \t{$pntable['stories']}";
    // Assume mysql start
    $query .= " LEFT JOIN {$pntable['stories_cat']} ON {$storiescolumn['catid']} = {$storiescatcolumn['catid']}\n\t\t\t\tLEFT JOIN {$pntable['topics']} ON {$storiescolumn['topic']} = {$topicscolumn['topicid']}";
    // Assume mysql end
    //	$query .= " WHERE";
    $wherearray = array();
    // check language
    if (pnConfigGetVar('multilingual') == 1) {
        //		$query_started = true;
        //		$query .= " ($storiescolumn[alanguage]='" . pnUserGetLang() . "' OR $storiescolumn[alanguage]='')";
        $wherearray[] = " ({$storiescolumn['alanguage']}='" . pnUserGetLang() . "' OR {$storiescolumn['alanguage']}='')";
    }
    // Qualifier for front-page/not front-page news
    // storiestype = 3 - front-page news
    // storiestype = 1 - not front-page news
    // storiestype = 2 - all news
    if ($vars['storiestype'] == '1') {
        // where clause already started?
        //    	if ($query_started == true) {
        //    		$query .= " AND";
        //    	}
        //    	$query_started = true;
        //        $query .= " $storiescolumn[ihome]=1";
        $wherearray[] = " {$storiescolumn['ihome']}=1";
    }
    if ($vars['storiestype'] == '3') {
        // where clause already started?
        //    	if ($query_started == true) {
        //    		$query .= " AND";
        //    	}
        //    	$query_started = true;
        //        $query .= " $storiescolumn[ihome]=0";
        $wherearray[] = " {$storiescolumn['ihome']}=0";
    }
    // Qualifier for particular topic
    // topic = -1 - all topics?
    if ($vars['topic'] != -1) {
        // where clause already started?
        //    	if ($query_started == true) {
        //    		$query .= " AND";
        //    	}
        //    	$query_started = true;
        //        $query .= " $storiescolumn[topic]=" . pnVarPrepForStore($vars['topic']);
        $wherearray[] = " {$storiescolumn['topic']}=" . pnVarPrepForStore($vars['topic']);
    }
    // Qualifier for particular category
    // category = -1 - all categories
    if ($vars['category'] != -1) {
        // where clause already started?
        //    	if ($query_started = true) {
        //    		$query .= " AND";
        //    	}
        //        $query .= " $storiescolumn[cid]=" . pnVarPrepForStore($vars['category']);
        $wherearray[] = " {$storiescolumn['cid']}=" . pnVarPrepForStore($vars['category']);
    }
    if ($wherearray) {
        $query .= " WHERE " . implode(" AND ", $wherearray);
    }
    // Qualifier for how many stories
    $query .= " ORDER BY {$storiescolumn['time']} DESC";
    // we can't use a limit query since permissions might take effect...
    //$result = $dbconn->SelectLimit($query, pnVarPrepForStore($vars['limit']));
    $result = $dbconn->Execute($query);
    // Error checking -- jn
    if ($dbconn->ErrorNo() != 0) {
        return false;
    }
    $shown_results = 0;
    $postmax = $vars['limit'];
    while ((list($aid, $cid, $cattitle, $sid, $tid, $time, $title, $topicname) = $result->FetchRow()) && $shown_results < $postmax) {
        $time = $result->UnixTimeStamp($time);
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:microbuilder,代码行数:101,代码来源:stories.php


注:本文中的pnUserGetLang函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。