本文整理汇总了PHP中pnVarCleanFromInput函数的典型用法代码示例。如果您正苦于以下问题:PHP pnVarCleanFromInput函数的具体用法?PHP pnVarCleanFromInput怎么用?PHP pnVarCleanFromInput使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pnVarCleanFromInput函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: blocks_rss_update
function blocks_rss_update($row)
{
list($dbconn) = pnDBGetConn();
list($args['rssurl'], $args['maxitems'], $args['showimage'], $args['showsearch'], $args['showdescriptions'], $args['altstyle']) = pnVarCleanFromInput('rssurl', 'maxitems', 'showimage', 'showsearch', 'showdescriptions', 'altstyle');
// Remove old URL if there
unset($row['url']);
// Defaults
if (!isset($args['rssurl'])) {
$args['rssurl'] = '';
}
if (!isset($args['maxitems'])) {
$args['maxitems'] = 5;
}
if (!isset($args['showdescriptions'])) {
$args['showdescriptions'] = 0;
}
if (!isset($args['altstyle'])) {
$args['altstyle'] = 0;
}
if (!isset($args['showimage'])) {
$args['showimage'] = 0;
}
if (!isset($args['showsearch'])) {
$args['showsearch'] = 0;
}
$row['content'] = pnBlockVarsToContent($args);
// Refresh data
$row = blocks_rss_refresh($row, 1);
return $row;
}
示例2: smarty_function_pc_form_nav_close
/**
* $Id$
*
* PostCalendar::PostNuke Events Calendar Module
* Copyright (C) 2002 The PostCalendar Team
* http://postcalendar.tv
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* To read the license please read the docs/license.txt or visit
* http://www.gnu.org/copyleft/gpl.html
*
*/
function smarty_function_pc_form_nav_close($args = array())
{
extract($args);
unset($args);
if (_SETTING_OPEN_NEW_WINDOW || isset($print)) {
$target = 'target="csCalendar"';
} else {
$target = '';
}
if (!defined('_PC_FORM_DATE')) {
$Date = postcalendar_getDate();
echo '<input type="hidden" name="Date" value="' . $Date . '" />';
}
if (!defined('_PC_FORM_VIEW_TYPE')) {
echo '<input type="hidden" name="viewtype" value="' . pnVarCleanFromInput('viewtype') . '" />';
}
if (!defined('_PC_FORM_TEMPLATE')) {
echo '<input type="hidden" name="tplview" value="' . pnVarCleanFromInput('tplview') . '" />';
}
if (!defined('_PC_FORM_USERNAME')) {
echo '<input type="hidden" name="pc_username" value="' . pnVarCleanFromInput('pc_username') . '" />';
}
if (!defined('_PC_FORM_CATEGORY')) {
echo '<input type="hidden" name="pc_category" value="' . pnVarCleanFromInput('pc_category') . '" />';
}
if (!defined('_PC_FORM_TOPIC')) {
echo '<input type="hidden" name="pc_topic" value="' . pnVarCleanFromInput('pc_topic') . '" />';
}
echo '</form>';
}
示例3: smarty_function_pc_view_select
/**
* $Id$
*
* PostCalendar::PostNuke Events Calendar Module
* Copyright (C) 2002 The PostCalendar Team
* http://postcalendar.tv
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* To read the license please read the docs/license.txt or visit
* http://www.gnu.org/copyleft/gpl.html
*
*/
function smarty_function_pc_view_select($args)
{
@define('_PC_FORM_TEMPLATE', true);
$Date = postcalendar_getDate();
if (!isset($y)) {
$y = substr($Date, 0, 4);
}
if (!isset($m)) {
$m = substr($Date, 4, 2);
}
if (!isset($d)) {
$d = substr($Date, 6, 2);
}
$tplview = pnVarCleanFromInput('tplview');
$viewtype = pnVarCleanFromInput('viewtype');
if (!isset($viewtype)) {
$viewtype = _SETTING_DEFAULT_VIEW;
}
$modinfo = pnModGetInfo(pnModGetIDFromName(__POSTCALENDAR__));
$mdir = pnVarPrepForOS($modinfo['directory']);
unset($modinfo);
$pcTemplate = pnVarPrepForOS(_SETTING_TEMPLATE);
if (empty($pcTemplate)) {
$pcTemplate = 'default';
}
$viewlist = array();
$handle = opendir("modules/{$mdir}/pntemplates/{$pcTemplate}/views/{$viewtype}");
$hide_list = array('.', '..', 'CVS', 'index.html');
while ($f = readdir($handle)) {
if (!in_array($f, $hide_list)) {
$viewlist[] = $f;
}
}
closedir($handle);
unset($no_list);
sort($viewlist);
$tcount = count($viewlist);
//$options = "<select id=\"tplview\" name=\"tplview\" class=\"$args[class]\">"; - pennfirm
$options = "<select id=\"tplview\" name=\"viewtype\" class=\"{$args['class']}\">";
$selected = $tplview;
for ($t = 0; $t < $tcount; $t++) {
$id = str_replace('.html', '', $viewlist[$t]);
$sel = $selected == $id ? 'selected' : '';
$options .= "<option value=\"{$id}\" {$sel} class=\"{$args['class']}\">{$id}</option>";
}
$options .= '</select>';
if (!isset($args['label'])) {
$args['label'] = _PC_TPL_VIEW_SUBMIT;
}
$submit = '<input type="submit" valign="middle" name="submit" value="' . $args['label'] . '" class="' . $args['class'] . '" />';
// build the form
if ($t > 1) {
echo $options, $submit;
}
}
示例4: modules_adminapi_update
/**
* update module information
* @param $args['mid'] the id number of the module to update
* @param $args['displayname'] the new display name of the module
* @param $args['description'] the new description of the module
* @returns bool
* @return true on success, false on failure
*/
function modules_adminapi_update($args)
{
// Get arguments from argument array
extract($args);
// Argument check
if (!isset($mid) || !is_numeric($mid) || !isset($displayname) || !isset($description)) {
pnSessionSetVar('errormsg', _MODARGSERROR);
return false;
}
// Security check
if (!pnSecAuthAction(0, 'Modules::', "::{$mid}", ACCESS_ADMIN)) {
pnSessionSetVar('errormsg', _MODULESAPINOAUTH);
return false;
}
// Rename operation
list($dbconn) = pnDBGetConn();
$pntable = pnDBGetTables();
$modulestable = $pntable['modules'];
$modulescolumn =& $pntable['modules_column'];
$query = "UPDATE {$modulestable}\n SET {$modulescolumn['displayname']} = '" . pnVarPrepForStore($displayname) . "',\n {$modulescolumn['description']} = '" . pnVarPrepForStore($description) . "'\n WHERE {$modulescolumn['id']} = " . (int) pnVarPrepForStore($mid);
$dbconn->Execute($query);
if ($dbconn->ErrorNo() != 0) {
pnSessionSetVar('errormsg', _MODULESAPIUPDATEFAILED);
return false;
}
// Hooks
// Get module name
$modinfo = pnModGetInfo($mid);
$hookstable = $pntable['hooks'];
$hookscolumn =& $pntable['hooks_column'];
$sql = "SELECT DISTINCT {$hookscolumn['id']},\n {$hookscolumn['smodule']},\n {$hookscolumn['stype']},\n {$hookscolumn['object']},\n {$hookscolumn['action']},\n {$hookscolumn['tarea']},\n {$hookscolumn['tmodule']},\n {$hookscolumn['ttype']},\n {$hookscolumn['tfunc']}\n FROM {$hookstable}\n WHERE {$hookscolumn['smodule']} IS NULL\n ORDER BY {$hookscolumn['tmodule']},\n {$hookscolumn['smodule']} DESC";
$result = $dbconn->Execute($sql);
$displayed = array();
for (; !$result->EOF; $result->MoveNext()) {
list($hookid, $hooksmodname, $hookstype, $hookobject, $hookaction, $hooktarea, $hooktmodule, $hookttype, $hooktfunc, ) = $result->fields;
// Delete hook regardless
$sql = "DELETE FROM {$hookstable}\n WHERE {$hookscolumn['smodule']} = '" . pnVarPrepForStore($modinfo['name']) . "'\n AND {$hookscolumn['tmodule']} = '" . pnVarPrepForStore($hooktmodule) . "'";
$dbconn->Execute($sql);
// Get selected value of hook
$hookvalue = pnVarCleanFromInput("hooks_{$hooktmodule}");
// See if this is checked and isn't in the database
if (isset($hookvalue) && empty($hooksmodname)) {
// Insert hook if required
$sql = "INSERT INTO {$hookstable} (\n {$hookscolumn['id']},\n {$hookscolumn['object']},\n {$hookscolumn['action']},\n {$hookscolumn['smodule']},\n {$hookscolumn['tarea']},\n {$hookscolumn['tmodule']},\n {$hookscolumn['ttype']},\n {$hookscolumn['tfunc']})\n VALUES (\n " . pnVarPrepForStore($dbconn->GenId($hookstable)) . ",\n '" . pnVarPrepForStore($hookobject) . "',\n '" . pnVarPrepForStore($hookaction) . "',\n '" . pnVarPrepForStore($modinfo['name']) . "',\n '" . pnVarPrepForStore($hooktarea) . "',\n '" . pnVarPrepForStore($hooktmodule) . "',\n '" . pnVarPrepForStore($hookttype) . "',\n '" . pnVarPrepForStore($hooktfunc) . "')";
$dbconn->Execute($sql);
if ($dbconn->ErrorNo() != 0) {
return false;
}
}
}
$result->Close();
return true;
}
示例5: smarty_function_pc_form_nav_open
/**
* $Id$
*
* PostCalendar::PostNuke Events Calendar Module
* Copyright (C) 2002 The PostCalendar Team
* http://postcalendar.tv
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* To read the license please read the docs/license.txt or visit
* http://www.gnu.org/copyleft/gpl.html
*
*/
function smarty_function_pc_form_nav_open($args = array())
{
extract($args);
unset($args);
$viewtype = strtolower(pnVarCleanFromInput('viewtype'));
if (_SETTING_OPEN_NEW_WINDOW && $viewtype == 'details') {
$target = 'target="csCalendar"';
} else {
$target = '';
}
$fstart = '<form action="' . pnModURL(__POSTCALENDAR__, 'user', 'view') . '"' . ' method="post"' . ' enctype="application/x-www-form-urlencoded" ' . $target . '>';
echo $fstart;
}
示例6: pnSecConfirmAuthKey
/**
* confirm an authorisation key is valid
* <br>
* See description of <code>pnSecGenAuthKey</code> for information on
* this function
* @public
* @returns bool
* @return true if the key is valid, false if it is not
*/
function pnSecConfirmAuthKey($preview = false)
{
list($module, $authid) = pnVarCleanFromInput('module', 'authid');
// Regenerate static part of key
$partkey = pnSessionGetVar('rand') . strtolower($module);
if (md5($partkey) == $authid) {
// Match - generate new random number for next key and leave happy
if (!$preview) {
srand((double) microtime() * 1000000);
pnSessionSetVar('rand', rand());
}
return true;
}
// Not found, assume invalid
return false;
}
示例7: postcalendar_user_search
/**
* search events
*/
function postcalendar_user_search()
{
if (!(bool) PC_ACCESS_OVERVIEW) {
return _POSTCALENDARNOAUTH;
}
$tpl = new pcSmarty();
$k = formData("pc_keywords", "R");
//from library/formdata.inc.php
$k_andor = pnVarCleanFromInput('pc_keywords_andor');
$pc_category = pnVarCleanFromInput('pc_category');
$pc_facility = pnVarCleanFromInput('pc_facility');
$pc_topic = pnVarCleanFromInput('pc_topic');
$submit = pnVarCleanFromInput('submit');
$event_dur_hours = pnVarCleanFromInput('event_dur_hours');
$event_dur_minutes = pnVarCleanFromInput('event_dur_minutes');
$start = pnVarCleanFromInput('start');
$end = pnVarCleanFromInput('end');
// get list of categories for the user to choose from
$categories = postcalendar_userapi_getCategories();
$cat_options = '';
foreach ($categories as $category) {
$selected = "";
if ($pc_category == $category[id]) {
$selected = " SELECTED ";
}
//modified 8/09 by BM to allow translation if applicable
$cat_options .= "<option value=\"{$category['id']}\" {$selected}>" . xl_appt_category($category[name]) . "</option>";
}
$tpl->assign_by_ref('CATEGORY_OPTIONS', $cat_options);
$tpl->assign('event_dur_hours', $event_dur_hours);
$tpl->assign('event_dur_minutes', $event_dur_minutes);
// create default start and end dates for the search form
if (isset($start) && $start != "") {
$tpl->assign('DATE_START', $start);
} else {
$tpl->assign('DATE_START', date("m/d/Y"));
}
if (isset($end) && $end != "") {
$tpl->assign('DATE_END', $end);
} else {
$tpl->assign('DATE_END', date("m/d/Y", strtotime("+7 Days", time())));
}
// then override the setting if we have a value from the submitted form
$ProviderID = pnVarCleanFromInput("provider_id");
if (is_numeric($ProviderID)) {
$tpl->assign('ProviderID', $ProviderID);
} elseif ($ProviderID == "_ALL_") {
} else {
$tpl->assign('ProviderID', "");
}
$provinfo = getProviderInfo();
$tpl->assign('providers', $provinfo);
// build a list of provider-options for the select box on the input form -- JRM
$provider_options = "<option value='_ALL_' ";
if ($ProviderID == "_ALL_") {
$provider_options .= " SELECTED ";
}
$provider_options .= ">" . xl('All Providers') . "</option>";
foreach ($provinfo as $provider) {
$selected = "";
// if we don't have a ProviderID chosen, pick the first one from the
// pc_username Session variable
if ($ProviderID == "") {
// that variable stores the 'username' and not the numeric 'id'
if ($_SESSION['pc_username'][0] == $provider['username']) {
$selected = " SELECTED ";
}
} else {
if ($ProviderID == $provider['id']) {
$selected = " SELECTED ";
}
}
$provider_options .= "<option value=\"" . $provider['id'] . "\" " . $selected . ">";
$provider_options .= $provider['lname'] . ", " . $provider['fname'] . "</option>";
}
$tpl->assign_by_ref('PROVIDER_OPTIONS', $provider_options);
// build a list of facility options for the select box on the input form -- JRM
$facilities = getFacilities();
$fac_options = "<option value=''>" . xl('All Facilities') . "</option>";
foreach ($facilities as $facility) {
$selected = "";
if ($facility['id'] == $pc_facility) {
$selected = " SELECTED ";
}
$fac_options .= "<option value=\"" . $facility['id'] . "\" " . $selected . ">";
$fac_options .= $facility['name'] . "</option>";
}
$tpl->assign_by_ref('FACILITY_OPTIONS', $fac_options);
$PatientID = pnVarCleanFromInput("patient_id");
// limit the number of results returned by getPatientPID
// this helps to prevent the server from stalling on a request with
// no PID and thousands of PIDs in the database -- JRM
// the function getPatientPID($pid, $given, $orderby, $limit, $start) <-- defined in library/patient.inc
$plistlimit = 500;
if (is_numeric($PatientID)) {
$tpl->assign('PatientList', getPatientPID(array('pid' => $PatientID, 'limit' => $plistlimit)));
} else {
//.........这里部分代码省略.........
示例8: postcalendar_admin_categoryLimitsUpdate
function postcalendar_admin_categoryLimitsUpdate()
{
if (!PC_ACCESS_ADMIN) {
return _POSTCALENDAR_NOAUTH;
}
$output = new pnHTML();
$output->SetInputMode(_PNH_VERBATIMINPUT);
list($dbconn) = pnDBGetConn();
$pntable = pnDBGetTables();
list($id, $del, $catId, $startTimeH, $startTimeM, $endTimeH, $endTimeM, $limit, $newCatId, $newStartTimeH, $newStartTimeM, $newEndTimeH, $newEndTimeM, $newLimit, ) = pnVarCleanFromInput('id', 'del', 'catid', 'starttimeh', 'starttimem', 'endtimeh', 'endtimem', 'limit', 'newcatid', 'newstarttimeh', 'newstarttimem', 'newendtimeh', 'newendtimem', 'newlimit');
$updates = array();
if (isset($id)) {
foreach ($id as $k => $i) {
$found = false;
if (count($del)) {
foreach ($del as $d) {
if ($i == $d) {
$found = true;
break;
}
}
}
if (!$found) {
$start = date("H:i:s", mktime($startTimeH[$k], $startTimeM[$k], 0));
$end = date("H:i:s", mktime($endTimeH[$k], $endTimeM[$k], 0));
$update_sql = "UPDATE {$pntable['postcalendar_limits']}\n\t\t SET pc_catid='" . pnVarPrepForStore($catId[$k]) . "',\n\t\t pc_starttime='" . pnVarPrepForStore($start) . "',\n\t\t pc_endtime='" . pnVarPrepForStore($end) . "',\n\t\t pc_limit='" . pnVarPrepForStore($limit[$k]) . "'\n\t\t WHERE pc_limitid={$i}";
array_push($updates, $update_sql);
}
}
}
$dels = implode(",", $del);
$delete = "DELETE FROM {$pntable['postcalendar_limits']} WHERE pc_limitid IN ({$dels})";
$e = $msg = '';
if (!pnModAPIFunc(__POSTCALENDAR__, 'admin', 'updateCategoryLimit', array('updates' => $updates))) {
$e .= 'UPDATE FAILED';
}
if (isset($dels)) {
if (!pnModAPIFunc(__POSTCALENDAR__, 'admin', 'deleteCategoryLimit', array('delete' => $delete))) {
$e .= 'DELETE FAILED';
}
}
if (isset($newLimit) && $newLimit > 0) {
$start = date("H:i:s", mktime($newStartTimeH, $newStartTimeM, 0));
$end = date("H:i:s", mktime($newEndTimeH, $newEndTimeM, 0));
if (!pnModAPIFunc(__POSTCALENDAR__, 'admin', 'addCategoryLimit', array('catid' => $newCatId, 'starttime' => $start, 'endtime' => $end, 'limit' => $newLimit))) {
$e .= 'INSERT FAILED';
}
}
if (empty($e)) {
$msg = 'DONE';
}
$output->Text(postcalendar_admin_categoryLimits($msg, $e));
return $output->GetOutput();
}
示例9: postcalendar_userapi_eventDetail
function postcalendar_userapi_eventDetail($args, $admin = false)
{
if (!(bool) PC_ACCESS_READ) {
return _POSTCALENDARNOAUTH;
}
// get the theme globals :: is there a better way to do this?
pnThemeLoad(pnUserGetTheme());
global $bgcolor1, $bgcolor2, $bgcolor3, $bgcolor4, $bgcolor5;
global $textcolor1, $textcolor2;
$popup = pnVarCleanFromInput('popup');
extract($args);
unset($args);
if (!isset($cacheid)) {
$cacheid = null;
}
if (!isset($eid)) {
return false;
}
if (!isset($nopop)) {
$nopop = false;
}
$uid = pnUserGetVar('uid');
//=================================================================
// Find out what Template we're using
//=================================================================
$template_name = _SETTING_TEMPLATE;
if (!isset($template_name)) {
$template_name = 'default';
}
//=================================================================
// Setup Smarty Template Engine
//=================================================================
$tpl = new pcSmarty();
if ($admin) {
$template = $template_name . '/admin/details.html';
$args['cacheid'] = '';
$print = 0;
$Date =& postcalendar_getDate();
$tpl->caching = false;
} else {
$template = $template_name . '/user/details.html';
}
if (!$tpl->is_cached($template, $cacheid)) {
// let's get the DB information
list($dbconn) = pnDBGetConn();
$pntable = pnDBGetTables();
// get the event's information
$event =& postcalendar_userapi_pcGetEventDetails($eid);
// if the above is false, it's a private event for another user
// we should not diplay this - so we just exit gracefully
if ($event === false) {
return false;
}
//=================================================================
// get event's topic information
//=================================================================
$topics_table = $pntable['topics'];
$topics_column = $pntable['topics_column'];
$topicsql = "SELECT {$topics_column['topictext']},{$topics_column['topicimage']}\n FROM {$topics_table}\n WHERE {$topics_column['topicid']} = {$event['topic']}\n LIMIT 1";
$topic_result = $dbconn->Execute($topicsql);
list($event['topictext'], $event['topicimg']) = $topic_result->fields;
$location = unserialize($event['location']);
$event['location'] = $location['event_location'];
$event['street1'] = $location['event_street1'];
$event['street2'] = $location['event_street2'];
$event['city'] = $location['event_city'];
$event['state'] = $location['event_state'];
$event['postal'] = $location['event_postal'];
$event['date'] = str_replace('-', '', $Date);
//=================================================================
// populate the template
//=================================================================
if (!empty($event['location']) || !empty($event['street1']) || !empty($event['street2']) || !empty($event['city']) || !empty($event['state']) || !empty($event['postal'])) {
$tpl->assign('LOCATION_INFO', true);
} else {
$tpl->assign('LOCATION_INFO', false);
}
if (!empty($event['contname']) || !empty($event['contemail']) || !empty($event['conttel']) || !empty($event['website'])) {
$tpl->assign('CONTACT_INFO', true);
} else {
$tpl->assign('CONTACT_INFO', false);
}
$display_type = substr($event['hometext'], 0, 6);
if ($display_type == ':text:') {
$prepFunction = 'pcVarPrepForDisplay';
$event['hometext'] = substr($event['hometext'], 6);
} elseif ($display_type == ':html:') {
$prepFunction = 'pcVarPrepHTMLDisplay';
$event['hometext'] = substr($event['hometext'], 6);
} else {
$prepFunction = 'pcVarPrepHTMLDisplay';
}
unset($display_type);
// prep the vars for output
$event['title'] =& $prepFunction($event['title']);
$event['hometext'] =& $prepFunction($event['hometext']);
$event['desc'] =& $event['hometext'];
$event['conttel'] =& $prepFunction($event['conttel']);
$event['contname'] =& $prepFunction($event['contname']);
$event['contemail'] =& $prepFunction($event['contemail']);
//.........这里部分代码省略.........
示例10: pnModGetName
/**
* get name of current top-level module
* @returns string
* @return the name of the current top-level module, false if not in a module
*/
function pnModGetName()
{
$modname = pnVarCleanFromInput('module');
if (empty($modname)) {
$name = pnVarCleanFromInput('name');
if (empty($name)) {
global $ModName;
if (empty($ModName)) {
return false;
}
$modname = preg_replace('/^NS-/', '', $ModName);
return $modname;
}
return $name;
} else {
$modname = preg_replace('/^NS-/', '', $modname);
return $modname;
}
}
示例11: Lenses_admin_update_company
function Lenses_admin_update_company($args)
{
// Clean input from the form.
$company = pnVarCleanFromInput('company');
// Extract any extra arguments.
extract($args);
// Confirm $authid hidden field from form template.
if (!pnSecConfirmAuthKey()) {
pnSessionSetVar('errormsg', pnVarPrepHTMLDisplay(_BADAUTHKEY));
return pnRedirect(pnModURL('Lenses', 'admin', 'main'));
}
// Attempt to update company.
if (pnModAPIFunc('Lenses', 'admin', 'update_company', array('company' => $company))) {
pnSessionSetVar('statusmsg', pnVarPrepHTMLDisplay(_UPDATESUCCEDED));
}
// No output. Redirect user.
return pnRedirect(pnModURL('Lenses', 'admin', 'viewall_companies'));
}
示例12: pnInit
/**
* Initialise PostNuke
* <br>
* Carries out a number of initialisation tasks to get PostNuke up and
* running.
* @returns void
*/
function pnInit()
{
// proper error_repoting
// e_all for development
// error_reporting(E_ALL);
// without warnings and notices for release
error_reporting(E_ALL & ~E_NOTICE & ~E_WARNING & ~E_DEPRECATED);
// Hack for some weird PHP systems that should have the
// LC_* constants defined, but don't
if (!defined('LC_TIME')) {
define('LC_TIME', 'LC_TIME');
}
// ADODB configuration
define('ADODB_DIR', 'pnadodb');
require 'pnadodb/adodb.inc.php';
// Temporary fix for hacking the hlpfile global
// TODO - remove with pre-0.71 code
global $hlpfile;
$hlpfile = '';
// Initialise and load configuration
global $pnconfig, $pndebug;
$pnconfig = array();
include 'config.php';
// Set up multisites
// added this @define for .71, ugly ?
// i guess the E_ALL stuff.
@define('WHERE_IS_PERSO', '');
// Initialise and load pntables
global $pntable;
$pntable = array();
// if a multisite has its own pntables.
if (file_exists(WHERE_IS_PERSO . 'pntables.php')) {
include WHERE_IS_PERSO . 'pntables.php';
} else {
require 'pntables.php';
}
// Decode encoded DB parameters
if ($pnconfig['encoded']) {
$pnconfig['dbuname'] = base64_decode($pnconfig['dbuname']);
$pnconfig['dbpass'] = base64_decode($pnconfig['dbpass']);
$pnconfig['encoded'] = 0;
}
// Connect to database
if (!pnDBInit()) {
die('Database initialisation failed');
}
// debugger if required
if ($pndebug['debug']) {
include_once 'includes/lensdebug.inc.php';
global $dbg, $debug_sqlcalls;
$dbg = new LensDebug();
$debug_sqlcalls = 0;
}
// Build up old config array
pnConfigInit();
// Set compression on if desired
//
if (pnConfigGetVar('UseCompression') == 1) {
ob_start("ob_gzhandler");
}
// Other includes
include 'includes/pnSession.php';
include 'includes/pnUser.php';
// Start session
if (!pnSessionSetup()) {
die('Session setup failed');
}
if (!pnSessionInit()) {
die('Session initialisation failed');
}
include 'includes/security.php';
// See if a language update is required
$newlang = pnVarCleanFromInput('newlang');
if (!empty($newlang)) {
$lang = $newlang;
pnSessionSetVar('lang', $newlang);
} else {
$lang = pnSessionGetVar('lang');
}
// Load global language defines
if (isset($lang) && file_exists('language/' . pnVarPrepForOS($lang) . '/global.php')) {
$currentlang = $lang;
} else {
$currentlang = pnConfigGetVar('language');
pnSessionSetVar('lang', $currentlang);
}
include 'language/' . pnVarPrepForOS($currentlang) . '/global.php';
include 'modules/NS-Languages/api.php';
// Cross-Site Scripting attack defense - Sent by larsneo
// some syntax checking against injected javascript
$pnAntiCrackerMode = pnConfigGetVar('pnAntiCracker');
if ($pnAntiCrackerMode == 1) {
pnSecureInput();
//.........这里部分代码省略.........
示例13: Lenses_userapi_search_report
function Lenses_userapi_search_report($args)
{
$time = pnVarCleanFromInput('time');
// Permission check.
if (!pnSecAuthAction(0, 'Lenses::', '::', ACCESS_OVERVIEW)) {
return $items_array;
}
extract($args);
$items_array = array();
// Get a reference to the database object.
$dbconn =& pnDBGetConn(true);
// Get a reference to PostNuke's table info.
$pntable =& pnDBGetTables();
$table =& $pntable['lenses_stats'];
$field =& $pntable['lenses_stats_column'];
$lens_table =& $pntable['lenses'];
$lens_field =& $pntable['lenses_column'];
$sql = "SELECT {$field['id']}, {$lens_field['name']}, {$field['this_month']}, {$field['last_month']}, {$field['total']}\n \t\tFROM {$table}, {$lens_table}\n\t\t\t\t\t\tWHERE {$field['id']} = {$lens_field['tid']} \n \t\t\tORDER BY {$field[$time]} DESC LIMIT 0,40";
//print ($sql);
// Execute the SQL query.
$result = $dbconn->Execute($sql);
// Check for any database errors.
if ($dbconn->ErrorNo() != 0) {
pnSessionSetVar('errormsg', _GETFAILED);
return false;
}
// A switch to extract the data from a given result set.
for (; !$result->EOF; $result->MoveNext()) {
list($id, $name, $total, $last_month, $this_month) = $result->fields;
$items_array[] = array('id' => $id, 'name' => $name, 'total' => $total, 'last_month' => $last_month, 'this_month' => $this_month);
}
$result->Close();
//print_r($items_array);
return $items_array;
}
示例14: pnLangLoad
/**
* Load language files for the current language
*
* @return void
*/
function pnLangLoad()
{
// See if a language update is required for ml-enviroments
$newlang = pnVarCleanFromInput('newlang');
if (!empty($newlang) && pnConfigGetVar('multilingual') == 1) {
$langlist = languagelist();
if (file_exists('language/' . pnVarPrepForOS($newlang) . '/global.php') && isset($langlist[$newlang])) {
// newlang is valid and exists
$lang = $newlang;
pnSessionSetVar('lang', $newlang);
} else {
// newlang is either not valid or doesn't exist - restore default values
$lang = pnConfigGetVar('language');
pnSessionSetVar('lang', $lang);
}
} else {
$detectlang = pnConfigGetVar('language_detect');
$defaultlang = pnConfigGetVar('language');
switch ($detectlang) {
case 1:
// Detect Browser Language
$cnvlanguage = cnvlanguagelist();
$currentlang = '';
$langs = split('[,;]', $_SERVER['HTTP_ACCEPT_LANGUAGE']);
foreach ($langs as $lang) {
if (isset($cnvlanguage[$lang]) && file_exists('language/' . pnVarPrepForOS($cnvlanguage[$lang]) . '/global.php')) {
$currentlang = $cnvlanguage[$lang];
break;
}
}
if ($currentlang == '') {
$currentlang = $defaultlang;
}
break;
default:
$currentlang = $defaultlang;
}
$lang = pnSessionGetVar('lang');
}
// Load global language defines
// these are deprecated and will be moved to the relevant modules
// with .8x
if (isset($lang) && file_exists('language/' . pnVarPrepForOS($lang) . '/global.php')) {
$currentlang = $lang;
} else {
$currentlang = pnConfigGetVar('language');
pnSessionSetVar('lang', $currentlang);
}
$oscurrentlang = pnVarPrepForOS($currentlang);
if (file_exists('language/' . $oscurrentlang . '/global.php')) {
include 'language/' . $oscurrentlang . '/global.php';
}
// load the languge language file
if (file_exists('language/languages.php')) {
include 'language/languages.php';
}
// load the core language file
if (file_exists('language/' . $oscurrentlang . '/core.php')) {
include 'language/' . $oscurrentlang . '/core.php';
}
// set the correct locale
// note: windows has different requires for the setlocale funciton to other OS's
// See: http://uk.php.net/setlocale
if (stristr(getenv('OS'), 'windows')) {
// for windows we either use the _LOCALEWIN define or the existing language code
if (defined('_LOCALEWIN')) {
setlocale(LC_ALL, _LOCALEWIN);
} else {
setlocale(LC_ALL, $currentlang);
}
} else {
// for other OS's we use the _LOCALE define
setlocale(LC_ALL, _LOCALE);
}
}
示例15: pnUserGetTheme
/**
* get the user's theme
* @public
* @returns string
* @return the name of the user's theme
*/
function pnUserGetTheme()
{
// Order of theme priority:
// - page-specific
// - user
// - system
// - PostNuke
// Page-specific theme
$pagetheme = pnVarCleanFromInput('theme');
if (!empty($pagetheme)) {
if (@opendir("themes/" . pnVarPrepForOS($pagetheme))) {
return $pagetheme;
}
}
if (pnUserLoggedIn() && !pnConfigGetVar('theme_change')) {
$usertheme = pnUserGetVar('theme');
// modification mouzaia .71
if (!empty($usertheme)) {
if (@opendir(WHERE_IS_PERSO . "themes/" . pnVarPrepForOS($usertheme))) {
return $usertheme;
}
if (@opendir("themes/" . pnVarPrepForOS($usertheme))) {
return $usertheme;
}
}
}
$systemtheme = pnConfigGetVar('Default_Theme');
if (!empty($systemtheme)) {
if (@opendir(WHERE_IS_PERSO . "themes/" . pnVarPrepForOS($systemtheme))) {
return $systemtheme;
}
if (@opendir("themes/" . pnVarPrepForOS($systemtheme))) {
return $systemtheme;
}
}
// why is this hard coded ??????
// $defaulttheme = 'PostNuke';
$defaulttheme = pnConfigGetVar('Default_Theme');
if (@opendir(WHERE_IS_PERSO . "themes/" . pnVarPrepForOS($defaulttheme))) {
return $defaulttheme;
}
if (@opendir("themes/" . pnVarPrepForOS($defaulttheme))) {
return $defaulttheme;
}
return false;
}