本文整理汇总了PHP中pnModGetVar函数的典型用法代码示例。如果您正苦于以下问题:PHP pnModGetVar函数的具体用法?PHP pnModGetVar怎么用?PHP pnModGetVar使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pnModGetVar函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: FlashChatBridge_userapi_getChatterList
function FlashChatBridge_userapi_getChatterList()
{
$chat_data_path = pnModGetVar('FlashChatBridge', 'server_data_path') . 'default/';
$userList = array();
$d = dir($chat_data_path);
while (false !== ($entry = $d->read())) {
//$rest = substr ( $entry, 0, 5 );
//if ($rest == "room_") {
$rest = substr($entry, 0, 6);
if ($rest == "room_1") {
if (file_exists($chat_data_path . $entry)) {
$f_users = file($chat_data_path . $entry);
for ($i = 0; $i < count($f_users); $i++) {
$f_line = trim($f_users[$i]);
if ($f_line != "") {
$userList[] = $f_line;
}
}
}
}
}
$d->close();
/*
if (count($userList) == 0) {
$userList[] = __("keiner");
}
*/
return $userList;
}
示例2: mediashareSourceYoutubeAdd
function mediashareSourceYoutubeAdd($videoytcode, $args)
{
$dom = ZLanguage::getModuleDomain('mediashare');
// Create tmp. file and copy image data into it
$tmpdir = pnModGetVar('mediashare', 'tmpDirName');
$tmpfilename = tempnam($tmpdir, 'YOUT');
if (!($f = fopen($tmpfilename, 'wb'))) {
@unlink($tmpfilename);
return false;
}
//text to save
fwrite($f, $videoytcode);
fclose($f);
$ytvideoinfo = mediashareSourceYoutubeXmlInfo($videoytcode);
$args['mimeType'] = 'video/youtubecode';
$args['uploadFilename'] = $tmpfilename;
$args['fileSize'] = 102;
$args['filename'] = "youtubee.you";
$args['keywords'] = null;
$args['description'] = $ytvideoinfo['description'];
$args['title'] = $ytvideoinfo['title'];
// Create image
$result = pnModAPIFunc('mediashare', 'source_youtube', 'addMediaItem', $args);
if ($result === false) {
$status = array('ok' => false, 'message' => LogUtil::getErrorMessagesText());
} else {
$status = array('ok' => true, 'message' => $result['message'], 'mediaId' => $result['mediaId']);
}
return $status;
}
示例3: FlashChatBridge_user_showChat
function FlashChatBridge_user_showChat()
{
// perform permission check
if (!SecurityUtil::checkPermission('FlashChatBridge::', '::', ACCESS_READ)) {
return LogUtil::registerPermissionError();
}
$popup = FormUtil::getPassedValue('popup', false);
// Security check
$render =& pnRender::getInstance('FlashChatBridge', false);
$UserVars = pnUserGetVars(SessionUtil::getVar('uid'));
$client_type = FormUtil::getPassedValue('client_type', 'standard');
$settings = pnModGetVar('FlashChatBridge');
$settings['init_user'] = $UserVars['uname'];
$settings['init_password'] = $UserVars['pass'];
if ($settings['autosize'] == 1) {
$settings['width'] = "100%";
$settings['height'] = "100%";
}
if ($popup) {
$settings['width'] = "100%";
$settings['height'] = "100%";
$render->assign('settings', $settings);
$chat = $render->fetch("flashchatbridge_user_chat_{$client_type}.htm");
$render->assign('chat', $chat);
echo $render->fetch('flashchatbridge_user_popup.htm');
exit;
} else {
$render->assign('settings', $settings);
return $render->fetch("flashchatbridge_user_chat_{$client_type}.htm");
}
}
示例4: mediashare_source_browserapi_addMediaItem
function mediashare_source_browserapi_addMediaItem($args)
{
$dom = ZLanguage::getModuleDomain('mediashare');
if (!isset($args['albumId'])) {
return LogUtil::registerError(__f('Missing [%1$s] in \'%2$s\'', array('albumId', 'source_browserapi.addMediaItem'), $dom));
}
$uploadFilename = $args['uploadFilename'];
// FIXME Required because the globals??
//pnModAPILoad('mediashare', 'edit');
// For OPEN_BASEDIR reasons we move the uploaded file as fast as possible to an accessible place
// MUST remember to remove it afterwards!!!
// Create and check tmpfilename
$tmpDir = pnModGetVar('mediashare', 'tmpDirName');
if (($tmpFilename = tempnam($tmpDir, 'Upload_')) === false) {
return LogUtil::registerError(__f("Unable to create a temporary file in '%s'", $tmpDir, $dom) . ' - ' . __('(uploading image)', $dom));
}
if (is_uploaded_file($uploadFilename)) {
if (move_uploaded_file($uploadFilename, $tmpFilename) === false) {
unlink($tmpFilename);
return LogUtil::registerError(__f('Unable to move uploaded file from \'%1$s\' to \'%2$s\'', array($uploadFilename, $tmpFilename), $dom) . ' - ' . __('(uploading image)', $dom));
}
} else {
if (!copy($uploadFilename, $tmpFilename)) {
unlink($tmpFilename);
return LogUtil::registerError(__f('Unable to copy the file from \'%1$s\' to \'%2$s\'', array($uploadFilename, $tmpFilename), $dom) . ' - ' . __('(adding image)', $dom));
}
}
$args['mediaFilename'] = $tmpFilename;
$result = pnModAPIFunc('mediashare', 'edit', 'addMediaItem', $args);
unlink($tmpFilename);
return $result;
}
示例5: getApi
function getApi()
{
if ($this->picasaApi == null) {
$APIKey = pnModGetVar('mediashare', 'picasaAPIKey');
$this->picasaApi = new Picasa($APIKey);
}
return $this->picasaApi;
}
示例6: getApi
function getApi()
{
if ($this->smugApi == null) {
$APIKey = pnModGetVar('mediashare', 'smugmugAPIKey');
$this->smugApi = new phpSmug(array('APIKey' => $APIKey));
$this->smugApi->login();
}
return $this->smugApi;
}
示例7: mediashareSourceZipAddFile
function mediashareSourceZipAddFile(&$zip, &$zipEntry, &$args)
{
$dom = ZLanguage::getModuleDomain('mediashare');
// Read zip info and file data into buffer
$zipSize = zip_entry_filesize($zipEntry);
$zipName = zip_entry_name($zipEntry);
if (!zip_entry_open($zip, $zipEntry, 'rb')) {
return array(array('ok' => false, 'message' => __f('Could not open the ZIP: %s', "{$zipName}", $dom)));
}
$buffer = zip_entry_read($zipEntry, $zipSize);
zip_entry_close($zipEntry);
// Ensure sub-folder exists
// Split name by slashes into folders and filename and create/verify the folders recursively
$folders = explode('/', $zipName);
$albumId = $args['albumId'];
if (!($subFolderID = mediashareEnsureFolderExists($albumId, $folders, 0))) {
return false;
}
$args['albumId'] = $subFolderID;
// Get actual filename from folderlist (last item in the array)
$imageName = $folders[sizeof($folders) - 1];
// Create tmp. file and copy image data into it
$tmpdir = pnModGetVar('mediashare', 'tmpDirName');
$tmpfilename = tempnam($tmpdir, 'IMG');
if (!($f = fopen($tmpfilename, 'wb'))) {
@unlink($tmpfilename);
return false;
}
fwrite($f, $buffer);
fclose($f);
$args['mimeType'] = '';
if (function_exists('mime_content_type')) {
$args['mimeType'] = mime_content_type($tmpfilename);
if (empty($args['mimeType'])) {
$args['mimeType'] = mime_content_type($imageName);
}
}
if (empty($args['mimeType'])) {
$args['mimeType'] = mediashareGetMimeType($imageName);
}
$args['uploadFilename'] = $tmpfilename;
$args['fileSize'] = $zipSize;
$args['filename'] = $imageName;
$args['keywords'] = null;
$args['description'] = null;
// Create image (or add recursively zip archive)
$result = pnModAPIFunc('mediashare', 'source_zip', 'addMediaItem', $args);
if ($result === false) {
$status = array('ok' => false, 'message' => LogUtil::getErrorMessagesText());
} else {
$status = array('ok' => true, 'message' => $result['message'], 'mediaId' => $result['mediaId']);
}
$args['albumId'] = $albumId;
return $status;
}
示例8: mediashare_remote_albumproperties
function mediashare_remote_albumproperties()
{
$albumId = $_POST['set_albumName'];
if (!mediashareAccessAlbum($albumId, mediashareAccessRequirementViewSomething)) {
return LogUtil::registerPermissionError();
}
if (!($album = pnModAPIFunc('mediashare', 'user', 'getAlbum', array('albumId' => $albumId)))) {
return mediashareErrorAPIRemote();
}
$size = (int) pnModGetVar('mediashare', 'previewSize');
echo "__#GR2PROTO__\nstatus=0\nstatus_text=ok\nauto_resize={$size}\nmax_size=999999\nadd_to_beginning=no";
return true;
}
示例9: createPreviews
function createPreviews($args, $previews)
{
$mediaFilename = $args['mediaFilename'];
$mimeType = $args['mimeType'];
$mediaFileType = $args['fileType'];
$v = getyoutubevideocode($mediaFilename);
$url = mediasharemediaYoutubeXmlInfo($v);
// Create tmp. file and copy image data into it
$tmpdir = pnModGetVar('mediashare', 'tmpDirName');
$tmpfilename = tempnam($tmpdir, 'xxx');
if (!($in = fopen($url['thumbnail'], "rb"))) {
}
$out = fopen($tmpfilename, "wb");
while ($chunk = fread($in, 8192)) {
fwrite($out, $chunk, 8192);
}
fclose($in);
fclose($out);
$result = array();
foreach ($previews as $preview) {
if ($preview['isThumbnail']) {
copy($tmpfilename, $preview['outputFilename']);
$imPreview = @imagecreatefromjpeg($preview['outputFilename']);
$result[] = array('fileType' => 'png', 'mimeType' => 'image/png', 'width' => imagesx($imPreview), 'height' => imagesy($imPreview), 'bytes' => filesize($preview['outputFilename']));
imagedestroy($imPreview);
} else {
$width = $preview['imageSize'];
$height = $preview['imageSize'];
if (isset($args['width']) && (int) $args['width'] > 0 && isset($args['height']) && (int) $args['height'] > 0) {
$w = (int) $args['width'];
$h = (int) $args['height'];
if ($w < $width || $h < $height) {
$width = $w;
$height = $h;
} else {
if ($w > $h) {
$height = $h / $w * $height;
} else {
$width = $w / $h * $width;
}
}
}
$result[] = array('fileType' => $mediaFileType, 'mimeType' => $mimeType, 'width' => $width, 'height' => $height, 'useOriginal' => true, 'bytes' => filesize($preview['outputFilename']));
}
}
unlink($tmpFilename);
$width = isset($args['width']) && (int) $args['width'] > 0 ? (int) $args['width'] : $preview['imageSize'];
$height = isset($args['height']) && (int) $args['height'] > 0 ? (int) $args['height'] : $preview['imageSize'];
$result[] = array('fileType' => $mediaFileType, 'mimeType' => $mimeType, 'width' => $width, 'height' => $height, 'bytes' => filesize($mediaFilename));
return $result;
}
示例10: dplink_user_main
function dplink_user_main()
{
$url = trim(pnModGetVar('dplink', 'url'));
$window = pnModGetVar('dplink', 'use_window');
$wrap = pnModGetVar('dplink', 'use_postwrap');
$user_data = array();
$home = pnGetBaseURL();
$home .= 'user.php?op=loginscreen&module=NS-User';
if (!pnUserLoggedIn()) {
pnRedirect($home);
}
// We need to get the user password string from the database
$uid = pnUserGetVar('uid');
list($dbconn) = pnDBGetConn();
$pntables = pnDBGetTables();
$usertable = $pntables['users'];
$usercol =& $pntables['users_column'];
$sql = "SELECT {$usercol['uname']}, {$usercol['pass']}, {$usercol['name']}, {$usercol['email']} " . "FROM {$usertable} WHERE {$usercol['uid']} = {$uid}";
$result = $dbconn->Execute($sql);
if ($dbconn->ErrorNo() != 0) {
die('Could not get user details');
}
if ($result->EOF) {
die('Could not get user detail');
}
list($uname, $password, $user_name, $user_email) = $result->fields;
$result->Close();
$user_data['login'] = $uname;
$user_data['passwd'] = $password;
$user_data['name'] = $user_name;
$user_data['email'] = $user_email;
$parm = serialize($user_data);
$check = md5($parm);
$cparm = gzcompress($parm);
$bparm = urlencode(base64_encode($cparm));
if ($window) {
$url .= '/index.php?login=pn&userdata=' . $bparm . '&check=' . $check;
header('Location: ' . $url);
} else {
$url .= '/index.php?login=pn%26userdata=' . $bparm . '%26check=' . $check;
if ($wrap) {
header('Location: modules.php?op=modload&name=PostWrap&file=index&page=' . $url);
} else {
header('Location: modules.php?op=modload&name=dplink&file=index&url=' . $url);
}
}
exit;
}
示例11: pnModVarExists
/**
* pnModVarExists - check to see if a module variable is set
* @author Chris Miller
* @param 'modname' the name of the module
* @param 'name' the name of the variable
* @return true if the variable exists in the database, false if not
*/
function pnModVarExists($modname, $name)
{
// define input, all numbers and booleans to strings
$modname = isset($modname) ? (string) $modname : '';
$name = isset($name) ? (string) $name : '';
// make sure we have the necessary parameters
if (!pnVarValidate($modname, 'mod') || !pnVarValidate($name, 'modvar')) {
return false;
}
// get all module vars for this module
$modvars = pnModGetVar($modname);
if (array_key_exists($name, $modvars)) {
// if $name is set
return true;
}
return false;
}
示例12: FlashChatBridge_Bannerchatblock_display
/**
* display block
*
* @param array $blockinfo a blockinfo structure
* @return output the rendered bock
*/
function FlashChatBridge_Bannerchatblock_display($blockinfo)
{
if (!SecurityUtil::checkPermission('FlashChatBridge:Bannerchatblock:', "::", ACCESS_READ)) {
return false;
}
if (!pnModAvailable('FlashChatBridge') || !pnUserLoggedIn()) {
return false;
}
$render = pnRender::getInstance('FlashChatBridge', false);
$UserVars = pnUserGetVars(SessionUtil::getVar('uid'));
$settings = pnModGetVar('FlashChatBridge');
$settings['init_user'] = $UserVars['uname'];
$settings['init_password'] = $UserVars['pass'];
$settings['width'] = "100%";
$settings['height'] = "150";
$render->assign('settings', $settings);
$blockinfo['content'] = $render->fetch('flashchatbridge_user_chat_banner.htm');
return pnBlockThemeBlock($blockinfo);
}
示例13: pnConfigGetVar
/**
* get a configuration variable
*
* @param name $ the name of the variable
* @return mixed value of the variable, or false on failure
*/
function pnConfigGetVar($name)
{
if (!isset($name)) {
return null;
}
if (isset($GLOBALS['pnconfig'][$name])) {
$result = $GLOBALS['pnconfig'][$name];
} else {
$mod_var = pnModGetVar(_PN_CONFIG_MODULE, $name);
if (is_string($mod_var)) {
$result = @unserialize($mod_var);
// Some caching
$GLOBALS['pnconfig'][$name] = $result;
}
}
if (!isset($result)) {
return null;
}
return $result;
}
示例14: pnModSetVar
function pnModSetVar($modname, $name, $value)
{
if (empty($modname) || empty($name)) {
return false;
}
list($dbconn) = pnDBGetConn();
$pntable = pnDBGetTables();
$curvar = pnModGetVar($modname, $name);
$modulevarstable = $pntable['module_vars'];
$modulevarscolumn =& $pntable['module_vars_column'];
if (!isset($curvar)) {
$query = "INSERT INTO {$modulevarstable}\n ({$modulevarscolumn['modname']},\n {$modulevarscolumn['name']},\n {$modulevarscolumn['value']})\n VALUES\n ('" . pnVarPrepForStore($modname) . "',\n '" . pnVarPrepForStore($name) . "',\n '" . pnVarPrepForStore($value) . "');";
} else {
$query = "UPDATE {$modulevarstable}\n SET {$modulevarscolumn['value']} = '" . pnVarPrepForStore($value) . "'\n WHERE {$modulevarscolumn['modname']} = '" . pnVarPrepForStore($modname) . "'\n AND {$modulevarscolumn['name']} = '" . pnVarPrepForStore($name) . "'";
}
$dbconn->Execute($query);
if ($dbconn->ErrorNo() != 0) {
return;
}
global $pnmodvar;
$pnmodvar[$modname][$name] = $value;
return true;
}
示例15: add_core_data
/**
* add core data to the template
*
* This function adds some basic data to the template depending on the
* current user and the PN settings.
*
* @param list of module names. all mod vars of these modules will be included too
The mod vars of the current module will always be included
* @return boolean true if ok, otherwise false
* @access public
*/
function add_core_data()
{
$pncore = array();
$pncore['version_num'] = _PN_VERSION_NUM;
$pncore['version_id'] = _PN_VERSION_ID;
$pncore['version_sub'] = _PN_VERSION_SUB;
$pncore['logged_in'] = pnUserLoggedIn();
$pncore['language'] = pnUserGetLang();
$pncore['themeinfo'] = pnThemeInfo(pnUserGetTheme());
pnThemeLoad($pncore['themeinfo']['name']);
$colors = array();
$colors['bgcolor1'] = pnThemeGetVar('bgcolor1');
$colors['bgcolor2'] = pnThemeGetVar('bgcolor2');
$colors['bgcolor3'] = pnThemeGetVar('bgcolor3');
$colors['bgcolor4'] = pnThemeGetVar('bgcolor4');
$colors['bgcolor5'] = pnThemeGetVar('bgcolor5');
$colors['sepcolor'] = pnThemeGetVar('sepcolor');
$colors['textcolor1'] = pnThemeGetVar('textcolor1');
$colors['textcolor2'] = pnThemeGetVar('textcolor2');
// add userdata
$pncore['user'] = pnUserGetVars(pnSessionGetVar('uid'));
// add modvars of current module
$pncore[$this->module] = pnModGetVar($this->module);
// add mod vars of all modules supplied as parameter
foreach (func_get_args() as $modulename) {
// if the modulename is empty do nothing
if (!empty($modulename) && !is_array($modulename) && $modulename != $this->module) {
// check if user wants to have /PNConfig
if ($modulename == _PN_CONFIG_MODULE) {
$pnconfig = pnModGetVar(_PN_CONFIG_MODULE);
foreach ($pnconfig as $key => $value) {
// unserialize all config vars
$pncore['pnconfig'][$key] = @unserialize($value);
}
} else {
$pncore[$modulename] = pnModGetVar($modulename);
}
}
}
$this->assign('pncore', $pncore);
$this->assign($colors);
return true;
}