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;
}
Exemple #2
0
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;
}
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");
    }
}
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;
}
 function getApi()
 {
     if ($this->picasaApi == null) {
         $APIKey = pnModGetVar('mediashare', 'picasaAPIKey');
         $this->picasaApi = new Picasa($APIKey);
     }
     return $this->picasaApi;
 }
 function getApi()
 {
     if ($this->smugApi == null) {
         $APIKey = pnModGetVar('mediashare', 'smugmugAPIKey');
         $this->smugApi = new phpSmug(array('APIKey' => $APIKey));
         $this->smugApi->login();
     }
     return $this->smugApi;
 }
Exemple #7
0
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;
}
Exemple #8
0
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;
}
 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;
 }
Exemple #10
0
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;
}
/**
 * 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;
}
/**
 * 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);
}
/**
* 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;
}
Exemple #14
0
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;
}
 /**
 * 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;
 }
Exemple #16
0
/**
 * View latest items
 */
function mediashare_user_latest($args)
{
    $latestMediaItems = pnModAPIFunc('mediashare', 'user', 'getLatestMediaItems');
    if ($latestMediaItems === false) {
        return false;
    }
    $latestAlbums = pnModAPIFunc('mediashare', 'user', 'getLatestAlbums');
    if ($latestAlbums === false) {
        return false;
    }
    $mostActiveUsers = pnModAPIFunc('mediashare', 'user', 'getMostActiveUsers');
    if ($mostActiveUsers === false) {
        return false;
    }
    $mostActiveKeywords = pnModAPIFunc('mediashare', 'user', 'getMostActiveKeywords');
    if ($mostActiveKeywords === false) {
        return false;
    }
    $summary = pnModAPIFunc('mediashare', 'user', 'getSummary');
    if ($summary === false) {
        return false;
    }
    // Build the output
    $render =& pnRender::getInstance('mediashare', false);
    $render->assign('latestMediaItems', $latestMediaItems);
    $render->assign('latestAlbums', $latestAlbums);
    $render->assign('mostActiveUsers', $mostActiveUsers);
    $render->assign('mostActiveKeywords', $mostActiveKeywords);
    $render->assign('summary', $summary);
    $render->assign('thumbnailSize', pnModGetVar('mediashare', 'thumbnailSize'));
    return $render->fetch('mediashare_user_latest.html');
}
/**
 * 123FlashChat Admin main page
 * @return HTML
 */
function FlashChatBridge_admin_flashchatadmin()
{
    // Security check
    if (!SecurityUtil::checkPermission('FlashChatBridge::', '::', ACCESS_ADMIN)) {
        return LogUtil::registerPermissionError();
    }
    $render =& pnRender::getInstance('FlashChatBridge', false);
    $UserVars = pnUserGetVars(SessionUtil::getVar('uid'));
    $settings = pnModGetVar('FlashChatBridge');
    $settings['init_user'] = $UserVars['uname'];
    $settings['init_password'] = $UserVars['pass'];
    if ($settings['autosize'] == 1) {
        $settings['width'] = "100%";
        $settings['height'] = "100%";
    }
    $render->assign('settings', $settings);
    return $render->fetch('flashchatbridge_admin_flashchatadmin.htm');
}
Exemple #18
0
function postcalendar_adminapi_buildAMPMSelect($args)
{
    extract($args);
    $output = new pnHTML();
    $output->SetInputMode(_PNH_VERBATIMINPUT);
    $options = array();
    if (pnModGetVar(__POSTCALENDAR__, 'time24hours')) {
        return false;
    } else {
        $options[0]['id'] = 'AM';
        $options[0]['selected'] = '';
        $options[0]['name'] = 'AM';
        $options[1]['id'] = 'PM';
        $options[1]['selected'] = '';
        $options[1]['name'] = 'PM';
    }
    $output->FormSelectMultiple('pc_ampm', $options);
    return $output->GetOutput();
}
function themesideblock($row)
{
    global $postnuke_theme, $pntheme;
    if (!isset($row['bid'])) {
        $row['bid'] = '';
    }
    if (!isset($row['title'])) {
        $row['title'] = '';
    }
    // check for collapseable menus being enabled.
    if (pnModGetVar('Blocks', 'collapseable') == 1) {
        if (pnUserLoggedIn()) {
            if (checkuserblock($row) == '1') {
                if (!empty($row['title'])) {
                    $row['title'] .= " <a href=\"modules.php?op=modload&amp;name=Blocks&amp;file=index&amp;req=ChangeStatus&amp;bid={$row['bid']}&amp;authid=" . pnSecGenAuthKey() . "\"><img src=\"images/global/upb.gif\" border=\"0\" alt=\"\"></a>";
                }
            } else {
                $row['content'] = '';
                if (!empty($row['title'])) {
                    $row['title'] .= " <a href=\"modules.php?op=modload&amp;name=Blocks&amp;file=index&amp;req=ChangeStatus&amp;bid={$row['bid']}&amp;authid=" . pnSecGenAuthKey() . "\"><img src=\"images/global/downb.gif\" border=\"0\" alt=\"\"></a>";
                }
            }
        }
    }
    // end collapseable menu config
    if ($postnuke_theme || $pntheme['support_blocks2']) {
        return themesidebox($row);
    } else {
        return themesidebox($row['title'], $row['content']);
    }
}
  var theMonth = todays_date.getMonth() + 1;
  theMonth = theMonth < 10 ? "0" + theMonth : theMonth;
  theForm.jumpdate.value = todays_date.getFullYear() + "-" + theMonth + "-" + todays_date.getDate();
  top.restoreSession();
  theForm.submit();
 }

</script>

<?php 
// this is my proposed setting in the globals config file so we don't
// need to mess with altering the pn database AND the config file
//pnModSetVar(__POSTCALENDAR__, 'pcFirstDayOfWeek', $GLOBALS['schedule_dow_start']);
// build a day-of-week (DOW) list so we may properly build the calendars later in this code
$DOWlist = array();
$tmpDOW = pnModGetVar(__POSTCALENDAR__, 'pcFirstDayOfWeek');
// bound check and auto-correction
if ($tmpDOW < 0 || $tmpDOW > 6) {
    pnModSetVar(__POSTCALENDAR__, 'pcFirstDayOfWeek', '0');
    $tmpDOW = 0;
}
while (count($DOWlist) < 7) {
    array_push($DOWlist, $tmpDOW);
    $tmpDOW++;
    if ($tmpDOW > 6) {
        $tmpDOW = 0;
    }
}
// A_CATEGORY is an ordered array of associative-array categories.
// Keys of interest are: id, name, color, desc, event_duration.
//
Exemple #21
0
function postcalendar_admin_categoryLimits($msg = '', $e = '', $args)
{
    if (!PC_ACCESS_ADD) {
        return _POSTCALENDARNOAUTH;
    }
    extract($args);
    unset($args);
    $output = new pnHTML();
    $output->SetInputMode(_PNH_VERBATIMINPUT);
    // set up Smarty
    $tpl = new pcSmarty();
    $tpl->caching = false;
    $template_name = pnModGetVar(__POSTCALENDAR__, 'pcTemplate');
    if (!isset($template_name)) {
        $template_name = 'default';
    }
    if (!empty($e)) {
        $output->Text('<div style="padding:5px; border:1px solid red; background-color: pink;">');
        $output->Text('<center><b>' . $e . '</b></center>');
        $output->Text('</div><br />');
    }
    if (!empty($msg)) {
        $output->Text('<div style="padding:5px; border:1px solid green; background-color: lightgreen;">');
        $output->Text('<center><b>' . $msg . '</b></center>');
        $output->Text('</div><br />');
    }
    //=================================================================
    //  Setup the correct config file path for the templates
    //=================================================================
    $modinfo = pnModGetInfo(pnModGetIDFromName(__POSTCALENDAR__));
    $modir = pnVarPrepForOS($modinfo['directory']);
    $modname = $modinfo['displayname'];
    //print_r($all_categories);
    unset($modinfo);
    $tpl->assign('action', pnModURL(__POSTCALENDAR__, 'admin', 'categoryLimitsUpdate'));
    //===============================================================
    //  Setup titles for smarty
    //===============================================================
    $tpl->assign('_PC_LIMIT_TITLE', _PC_LIMIT_TITLE);
    $tpl->assign('StartTimeTitle', _PC_LIMIT_START_TIME);
    $tpl->assign('EndTimeTile', _PC_LIMIT_END_TIME);
    $tpl->assign('LimitHoursTitle', _PC_TIMED_DURATION_HOURS);
    $tpl->assign('LimitMinutesTitle', _PC_TIMED_DURATION_MINUTES);
    //=============================================================
    // Setup Vars for smarty
    //============================================================
    $tpl->assign('mer_title', 'mer');
    $mer = array('am', 'pm');
    $tpl->assign_by_ref('mer', $mer);
    $tpl->assign('starttimeh', 'starttimeh');
    $tpl->assign('starttimem', 'starttimem');
    $tpl->assign('endtimeh', 'endtimeh');
    $tpl->assign('endtimem', 'endtimem');
    $tpl->assign('InputLimit', 'limit');
    $tpl->assign('LimitTitle', _PC_LIMIT_TITLE);
    $tpl->assign('_PC_NEW_LIMIT_TITLE', _PC_NEW_LIMIT_TITLE);
    $tpl->assign('_PC_CAT_DELETE', _PC_CAT_DELETE);
    $tpl->assign('EndTimeTitle', _PC_LIMIT_END_TIME);
    $hour_array = array('00', '01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '21', '21', '22', '23');
    $min_array = array('00', '05', '10', '15', '20', '25', '30', '35', '40', '45', '50', '55');
    $tpl->assign_by_ref('hour_array', $hour_array);
    $tpl->assign_by_ref('min_array', $min_array);
    $categories = pnModAPIFunc(__POSTCALENDAR__, 'user', 'getCategories');
    // create translations of category names if applicable
    $sizeAllCat = count($categories);
    for ($m = 0; $m < $sizeAllCat; $m++) {
        $tempCategory = $categories[$m]["name"];
        $categories[$m]["name"] = xl_appt_category($tempCategory);
    }
    $tpl->assign_by_ref('categories', $categories);
    $limits = pnModAPIFunc(__POSTCALENDAR__, 'user', 'getCategoryLimits');
    $tpl->assign_by_ref('limits', $limits);
    $tpl->assign('BGCOLOR2', $GLOBALS['style']['BGCOLOR2']);
    $tpl->assign("catTitle", _PC_REP_CAT_TITLE_S);
    $tpl->assign("catid", "catid");
    $form_submit = '<input type=hidden name="form_action" value="commit"/>
				   ' . $authkey . '<input type="submit" name="submit" value="' . xl('go') . '">';
    $tpl->assign('FormSubmit', $form_submit);
    $output->Text($tpl->fetch($template_name . '/admin/submit_category_limit.html'));
    $output->Text(postcalendar_footer());
    return $output->GetOutput();
}
Exemple #22
0
 function mediashare_vfsHandlerFSDirect()
 {
     $this->storageDir = pnModGetVar('mediashare', 'mediaDirName');
 }
Exemple #23
0
function mediashare_userapi_getRelativeMediadir()
{
    $zkroot = substr(pnServerGetVar('DOCUMENT_ROOT'), 0, -1) . pnGetBaseURI();
    $mediaBase = substr(str_replace('\\', '/', realpath(pnModGetVar('mediashare', 'mediaDirName', 'mediashare'))), strlen($zkroot) + 1);
    return $mediaBase . '/';
}
// some default vars
static $mostrecentdate;
$headline_limit = 25;
// Maximum value for Select
$shown_results = 0;
$body = '';
$mostrecentdate = 0;
// Get $charset (atamyrat@gmail.com)
if (defined('_CHARSET') && _CHARSET != '') {
    $charset = _CHARSET;
} else {
    $charset = 'ISO-8859-1';
}
// get the short urls extensions
$urlsok = pnModGetVar('Xanthia', 'shorturlsok');
$urlextension = pnModGetVar('Xanthia', 'shorturlsextension');
$baseurl = pnGetBaseURL();
// get the language
$newlang = pnVarCleanFromInput('newlang');
$backendlang = pnConfigGetVar('backend_language');
$backendlangs = cnvlanguagelist();
if ((!isset($newlang) || empty($newlang)) && isset($backendlangs[$backendlang])) {
    $lang = $backendlangs[$backendlang];
} else {
    $lang = $newlang;
}
// get any filters
$topicid = pnVarCleanFromInput('topicid');
$catid = pnVarCleanFromInput('catid');
// Base query
$storiescolumn = $pntable['stories_column'];
Exemple #25
0
/**
 *    postcalendar_userapi_buildSubmitForm()
 *    create event submit form
 */
function postcalendar_userapi_buildSubmitForm($args, $admin = false)
{
    $_SESSION['category'] = "";
    if (!PC_ACCESS_ADD) {
        return _POSTCALENDARNOAUTH;
    }
    extract($args);
    unset($args);
    //since we seem to clobber category
    $cat = $category;
    $output = new pnHTML();
    $output->SetInputMode(_PNH_VERBATIMINPUT);
    // set up Smarty
    $tpl = new pcSmarty();
    $tpl->caching = false;
    $template_name = pnModGetVar(__POSTCALENDAR__, 'pcTemplate');
    if (!isset($template_name)) {
        $template_name = 'default';
    }
    //=================================================================
    //  Setup the correct config file path for the templates
    //=================================================================
    $modinfo = pnModGetInfo(pnModGetIDFromName(__POSTCALENDAR__));
    $modir = pnVarPrepForOS($modinfo['directory']);
    $modname = $modinfo['displayname'];
    $all_categories =& pnModAPIFunc(__POSTCALENDAR__, 'user', 'getCategories');
    //print_r($all_categories);
    unset($modinfo);
    $tpl->config_dir = "modules/{$modir}/pntemplates/{$template_name}/config/";
    //=================================================================
    //  PARSE MAIN
    //=================================================================
    $tpl->assign('webroot', $GLOBALS['web_root']);
    $tpl->assign_by_ref('TPL_NAME', $template_name);
    $tpl->assign('FUNCTION', pnVarCleanFromInput('func'));
    $tpl->assign_by_ref('ModuleName', $modname);
    $tpl->assign_by_ref('ModuleDirectory', $modir);
    $tpl->assign_by_ref('category', $all_categories);
    $tpl->assign('NewEventHeader', _PC_NEW_EVENT_HEADER);
    $tpl->assign('EventTitle', _PC_EVENT_TITLE);
    $tpl->assign('Required', _PC_REQUIRED);
    $tpl->assign('DateTimeTitle', _PC_DATE_TIME);
    $tpl->assign('AlldayEventTitle', _PC_ALLDAY_EVENT);
    $tpl->assign('TimedEventTitle', _PC_TIMED_EVENT);
    $tpl->assign('TimedDurationTitle', _PC_TIMED_DURATION);
    $tpl->assign('TimedDurationHoursTitle', _PC_TIMED_DURATION_HOURS);
    $tpl->assign('TimedDurationMinutesTitle', _PC_TIMED_DURATION_MINUTES);
    $tpl->assign('EventDescTitle', _PC_EVENT_DESC);
    //the double book variable comes from the eventdata array that is
    //passed here and extracted, injection is not an issue here
    if (is_numeric($double_book)) {
        $tpl->assign('double_book', $double_book);
    }
    //pennfirm begin patient info handling
    $ProviderID = pnVarCleanFromInput("provider_id");
    if (is_numeric($ProviderID)) {
        $tpl->assign('ProviderID', $ProviderID);
        $tpl->assign('provider_id', $ProviderID);
    } elseif (is_numeric($event_userid) && $event_userid != 0) {
        $tpl->assign('ProviderID', $event_userid);
        $tpl->assign('provider_id', $event_userid);
    } else {
        if ($_SESSION['userauthorized'] == 1) {
            $tpl->assign('ProviderID', $_SESSION['authUserID']);
        } else {
            $tpl->assign('ProviderID', "");
        }
    }
    $provinfo = getProviderInfo();
    $tpl->assign('providers', $provinfo);
    $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)));
    } elseif (is_numeric($event_pid)) {
        $tpl->assign('PatientList', getPatientPID(array('pid' => $event_pid, 'limit' => $plistlimit)));
    } else {
        $tpl->assign('PatientList', getPatientPID(array('limit' => $plistlimit)));
    }
    $tpl->assign('event_pid', $event_pid);
    $tpl->assign('event_aid', $event_aid);
    $tpl->assign('event_category', pnVarCleanFromInput("event_category"));
    if (empty($event_patient_name)) {
        $patient_data = getPatientData($event_pid, $given = "lname, fname");
        $event_patient_name = $patient_data['lname'] . ", " . $patient_data['fname'];
    }
    $tpl->assign('patient_value', $event_patient_name);
    //=================================================================
    //  PARSE INPUT_EVENT_TITLE
    //=================================================================
    $tpl->assign('InputEventTitle', 'event_subject');
    $tpl->assign('ValueEventTitle', pnVarPrepForDisplay($event_subject));
    //=================================================================
    //  PARSE SELECT_DATE_TIME
    //=================================================================
    // It seems that with Mozilla at least, <select> fields that are disabled
    // do not get passed as form data.  Therefore we ignore $double_book so
    // that the fields will not be disabled.  -- Rod 2005-03-22
    $output->SetOutputMode(_PNH_RETURNOUTPUT);
    if (_SETTING_USE_INT_DATES) {
        $sel_data = pnModAPIFunc(__POSTCALENDAR__, 'user', 'buildDaySelect', array('pc_day' => $day, 'selected' => $event_startday));
        $formdata = $output->FormSelectMultiple('event_startday', $sel_data, 0, 1, "", "", false, '');
        $sel_data = pnModAPIFunc(__POSTCALENDAR__, 'user', 'buildMonthSelect', array('pc_month' => $month, 'selected' => $event_startmonth));
        $formdata .= $output->FormSelectMultiple('event_startmonth', $sel_data, 0, 1, "", "", false, '');
    } else {
        $sel_data = pnModAPIFunc(__POSTCALENDAR__, 'user', 'buildMonthSelect', array('pc_month' => $month, 'selected' => $event_startmonth));
        $formdata = $output->FormSelectMultiple('event_startmonth', $sel_data, 0, 1, "", "", false, '');
        $sel_data = pnModAPIFunc(__POSTCALENDAR__, 'user', 'buildDaySelect', array('pc_day' => $day, 'selected' => $event_startday));
        $formdata .= $output->FormSelectMultiple('event_startday', $sel_data, 0, 1, "", "", false, '');
    }
    $sel_data = pnModAPIFunc(__POSTCALENDAR__, 'user', 'buildYearSelect', array('pc_year' => $year, 'selected' => $event_startyear));
    $formdata .= $output->FormSelectMultiple('event_startyear', $sel_data, 0, 1, "", "", false, '');
    $output->SetOutputMode(_PNH_KEEPOUTPUT);
    $tpl->assign('SelectDateTime', $formdata);
    $tpl->assign('InputAllday', 'event_allday');
    $tpl->assign('ValueAllday', '1');
    $tpl->assign('SelectedAllday', $event_allday == 1 ? 'checked' : '');
    $tpl->assign('InputTimed', 'event_allday');
    $tpl->assign('ValueTimed', '0');
    $tpl->assign('SelectedTimed', $event_allday == 0 ? 'checked' : '');
    $tpl->assign('STYLE', $GLOBALS['style']);
    //=================================================================
    //  PARSE SELECT_END_DATE_TIME
    //=================================================================
    $output->SetOutputMode(_PNH_RETURNOUTPUT);
    //if there is no end date we want the box to read todays date instead of jan 01 1994 :)
    if ($event_endmonth == 0 && $event_endday == 0 && $event_endyear == 0) {
        $event_endmonth = $month;
        $event_endday = $day;
        $event_endyear = $year;
    }
    if (_SETTING_USE_INT_DATES) {
        $sel_data = pnModAPIFunc(__POSTCALENDAR__, 'user', 'buildDaySelect', array('pc_day' => $day, 'selected' => $event_endday));
        $formdata = $output->FormSelectMultiple('event_endday', $sel_data, 0, 1, "", "", false, '');
        $sel_data = pnModAPIFunc(__POSTCALENDAR__, 'user', 'buildMonthSelect', array('pc_month' => $month, 'selected' => $event_endmonth));
        $formdata .= $output->FormSelectMultiple('event_endmonth', $sel_data, 0, 1, "", "", false, '');
    } else {
        $sel_data = pnModAPIFunc(__POSTCALENDAR__, 'user', 'buildMonthSelect', array('pc_month' => $month, 'selected' => $event_endmonth));
        $formdata = $output->FormSelectMultiple('event_endmonth', $sel_data, 0, 1, "", "", false, '');
        $sel_data = pnModAPIFunc(__POSTCALENDAR__, 'user', 'buildDaySelect', array('pc_day' => $day, 'selected' => $event_endday));
        $formdata .= $output->FormSelectMultiple('event_endday', $sel_data, 0, 1, "", "", false, '');
    }
    $sel_data = pnModAPIFunc(__POSTCALENDAR__, 'user', 'buildYearSelect', array('pc_year' => $year, 'selected' => $event_endyear));
    $formdata .= $output->FormSelectMultiple('event_endyear', $sel_data, 0, 1, "", "", false, '');
    $output->SetOutputMode(_PNH_KEEPOUTPUT);
    $tpl->assign('SelectEndDate', $formdata);
    //=================================================================
    //  PARSE SELECT_TIMED_EVENT
    //=================================================================
    $stimes = pnModAPIFunc(__POSTCALENDAR__, 'user', 'buildTimeSelect', array('hselected' => $event_starttimeh, 'mselected' => $event_starttimem));
    $output->SetOutputMode(_PNH_RETURNOUTPUT);
    $timed_hours = $output->FormSelectMultiple('event_starttimeh', $stimes['h'], 0, 1, "", "", false, '');
    $timed_minutes = $output->FormSelectMultiple('event_starttimem', $stimes['m'], 0, 1, "", "", false, '');
    if (!_SETTING_TIME_24HOUR) {
        $ampm = array();
        $ampm[0]['id'] = pnVarPrepForStore(_AM_VAL);
        $ampm[0]['name'] = pnVarPrepForDisplay(_PC_AM);
        $ampm[1]['id'] = pnVarPrepForStore(_PM_VAL);
        $ampm[1]['name'] = pnVarPrepForDisplay(_PC_PM);
        if ($event_startampm == "AM" || $event_startampm == _AM_VAL) {
            $ampm[0]['selected'] = 1;
        } else {
            $ampm[1]['selected'] = 1;
        }
        $timed_ampm = $output->FormSelectMultiple('event_startampm', $ampm, 0, 1, "", "", false, '');
    } else {
        $timed_ampm = '';
    }
    $output->SetOutputMode(_PNH_KEEPOUTPUT);
    $tpl->assign('SelectTimedHours', $timed_hours);
    $tpl->assign('SelectTimedMinutes', $timed_minutes);
    $tpl->assign('SelectTimedAMPM', $timed_ampm);
    $tpl->assign('event_startday', $event_startday);
    $tpl->assign('event_startmonth', $event_startmonth);
    $tpl->assign('event_startyear', $event_startyear);
    $tpl->assign('event_starttimeh', $event_starttimeh);
    $tpl->assign('event_starttimem', $event_starttimem);
    $tpl->assign('event_startampm', $event_startampm);
    $tpl->assign('event_dur_hours', $event_dur_hours);
    $tpl->assign('event_dur_minutes', $event_dur_minutes);
    //=================================================================
    //  PARSE SELECT_DURATION
    //=================================================================
    $event_dur_hours = (int) $event_dur_hours;
    for ($i = 0; $i <= 24; $i += 1) {
        $TimedDurationHours[$i] = array('value' => $i, 'selected' => $event_dur_hours == $i ? 'selected' : '', 'name' => sprintf('%02d', $i));
    }
    $tpl->assign('TimedDurationHours', $TimedDurationHours);
    $tpl->assign('InputTimedDurationHours', 'event_dur_hours');
    $found_time = false;
    for ($i = 0; $i < 60; $i += _SETTING_TIME_INCREMENT) {
        $TimedDurationMinutes[$i] = array('value' => $i, 'selected' => $event_dur_minutes == $i ? 'selected' : '', 'name' => sprintf('%02d', $i));
        if ($TimedDurationMinutes[$i]['selected'] == 'selected') {
            $found_time = true;
        }
    }
    if (!$found_time) {
        $TimedDurationMinutes[$i] = array('value' => $event_dur_minutes, 'selected' => 'selected', 'name' => sprintf('%02d', $event_dur_minutes));
    }
    $tpl->assign('TimedDurationMinutes', $TimedDurationMinutes);
    $tpl->assign('hidden_event_dur_minutes', $event_dur_minutes);
    $tpl->assign('InputTimedDurationMinutes', 'event_dur_minutes');
    //=================================================================
    //  PARSE INPUT_EVENT_DESC
    //=================================================================
    $tpl->assign('InputEventDesc', 'event_desc');
    if (empty($pc_html_or_text)) {
        $display_type = substr($event_desc, 0, 6);
        if ($display_type == ':text:') {
            $pc_html_or_text = 'text';
            $event_desc = substr($event_desc, 6);
        } elseif ($display_type == ':html:') {
            $pc_html_or_text = 'html';
            $event_desc = substr($event_desc, 6);
        } else {
            $pc_html_or_text = 'text';
        }
        unset($display_type);
    }
    $tpl->assign('ValueEventDesc', pnVarPrepForDisplay($event_desc));
    $eventHTMLorText = "<select name=\"pc_html_or_text\">";
    if ($pc_html_or_text == 'text') {
        $eventHTMLorText .= "<option value=\"text\" selected=\"selected\">" . _PC_SUBMIT_TEXT . "</option>";
    } else {
        $eventHTMLorText .= "<option value=\"text\">" . _PC_SUBMIT_TEXT . "</option>";
    }
    if ($pc_html_or_text == 'html') {
        $eventHTMLorText .= "<option value=\"html\" selected=\"selected\">" . _PC_SUBMIT_HTML . "</option>";
    } else {
        $eventHTMLorText .= "<option value=\"html\">" . _PC_SUBMIT_HTML . "</option>";
    }
    $eventHTMLorText .= "</select>";
    $tpl->assign('EventHTMLorText', $eventHTMLorText);
    //=================================================================
    //  PARSE select_event_topic_block
    //=================================================================
    $tpl->assign('displayTopics', _SETTING_DISPLAY_TOPICS);
    if ((bool) _SETTING_DISPLAY_TOPICS) {
        $a_topics =& postcalendar_userapi_getTopics();
        $topics = array();
        foreach ($a_topics as $topic) {
            array_push($topics, array('value' => $topic['id'], 'selected' => $topic['id'] == $event_topic ? 'selected' : '', 'name' => $topic['text']));
        }
        unset($a_topics);
        // only show this if we have topics to show
        if (count($topics) > 0) {
            $tpl->assign('topics', $topics);
            $tpl->assign('EventTopicTitle', _PC_EVENT_TOPIC);
            $tpl->assign('InputEventTopic', 'event_topic');
        }
    }
    //=================================================================
    //  PARSE select_event_type_block
    //=================================================================
    $categories = array();
    foreach ($all_categories as $category) {
        array_push($categories, array('value' => $category['id'], 'selected' => $category['id'] == $event_category ? 'selected' : '', 'name' => $category['name'], 'color' => $category['color'], 'desc' => $category['desc']));
    }
    // only show this if we have categories to show
    // you should ALWAYS have at least one valid category
    if (count($categories) > 0) {
        $tpl->assign('categories', $categories);
        $tpl->assign('EventCategoriesTitle', _PC_EVENT_CATEGORY);
        $tpl->assign('InputEventCategory', 'event_category');
        $tpl->assign('hidden_event_category', $event_category);
    }
    //=================================================================
    //  PARSE event_sharing_block
    //=================================================================
    $data = array();
    if (_SETTING_ALLOW_USER_CAL) {
        array_push($data, array(SHARING_PRIVATE, _PC_SHARE_PRIVATE));
        array_push($data, array(SHARING_PUBLIC, _PC_SHARE_PUBLIC));
        array_push($data, array(SHARING_BUSY, _PC_SHARE_SHOWBUSY));
    }
    if (pnSecAuthAction(0, 'PostCalendar::', '::', ACCESS_ADMIN) || _SETTING_ALLOW_GLOBAL || !_SETTING_ALLOW_USER_CAL) {
        array_push($data, array(SHARING_GLOBAL, _PC_SHARE_GLOBAL));
    }
    $sharing = array();
    foreach ($data as $cell) {
        array_push($sharing, array('value' => $cell[0], 'selected' => (int) $event_sharing == $cell[0] ? 'selected' : '', 'name' => $cell[1]));
    }
    //pennfirm get list of providers from openemr code in calendar.inc
    $tpl->assign("user", getCalendarProviderInfo());
    $tpl->assign('sharing', $sharing);
    $tpl->assign('EventSharingTitle', _PC_SHARING);
    $tpl->assign('InputEventSharing', 'event_sharing');
    //=================================================================
    //  location information
    //=================================================================
    $tpl->assign('EventLocationTitle', _PC_EVENT_LOCATION);
    $tpl->assign('InputLocation', 'event_location');
    $tpl->assign('ValueLocation', pnVarPrepForDisplay($event_location));
    $tpl->assign('EventStreetTitle', _PC_EVENT_STREET);
    $tpl->assign('InputStreet1', 'event_street1');
    $tpl->assign('ValueStreet1', pnVarPrepForDisplay($event_street1));
    $tpl->assign('InputStreet2', 'event_street2');
    $tpl->assign('ValueStreet2', pnVarPrepForDisplay($event_street2));
    $tpl->assign('EventCityTitle', _PC_EVENT_CITY);
    $tpl->assign('InputCity', 'event_city');
    $tpl->assign('ValueCity', pnVarPrepForDisplay($event_city));
    $tpl->assign('EventStateTitle', _PC_EVENT_STATE);
    $tpl->assign('InputState', 'event_state');
    $tpl->assign('ValueState', pnVarPrepForDisplay($event_state));
    $tpl->assign('EventPostalTitle', _PC_EVENT_POSTAL);
    $tpl->assign('InputPostal', 'event_postal');
    $tpl->assign('ValuePostal', pnVarPrepForDisplay($event_postal));
    //=================================================================
    //  contact information
    //=================================================================
    $tpl->assign('EventContactTitle', _PC_EVENT_CONTACT);
    $tpl->assign('InputContact', 'event_contname');
    $tpl->assign('ValueContact', pnVarPrepForDisplay($event_contname));
    $tpl->assign('EventPhoneTitle', _PC_EVENT_PHONE);
    $tpl->assign('InputPhone', 'event_conttel');
    $tpl->assign('ValuePhone', pnVarPrepForDisplay($event_conttel));
    $tpl->assign('EventEmailTitle', _PC_EVENT_EMAIL);
    $tpl->assign('InputEmail', 'event_contemail');
    $tpl->assign('ValueEmail', pnVarPrepForDisplay($event_contemail));
    $tpl->assign('EventWebsiteTitle', _PC_EVENT_WEBSITE);
    $tpl->assign('InputWebsite', 'event_website');
    $tpl->assign('ValueWebsite', pnVarPrepForDisplay($event_website));
    $tpl->assign('EventFeeTitle', _PC_EVENT_FEE);
    $tpl->assign('InputFee', 'event_fee');
    $tpl->assign('ValueFee', pnVarPrepForDisplay($event_fee));
    //=================================================================
    //  Repeating Information
    //=================================================================
    $tpl->assign('RepeatingHeader', _PC_REPEATING_HEADER);
    $tpl->assign('NoRepeatTitle', _PC_NO_REPEAT);
    $tpl->assign('RepeatTitle', _PC_REPEAT);
    $tpl->assign('RepeatOnTitle', _PC_REPEAT_ON);
    $tpl->assign('OfTheMonthTitle', _PC_OF_THE_MONTH);
    $tpl->assign('EndDateTitle', _PC_END_DATE);
    $tpl->assign('NoEndDateTitle', _PC_NO_END);
    $tpl->assign('InputNoRepeat', 'event_repeat');
    $tpl->assign('ValueNoRepeat', '0');
    $tpl->assign('SelectedNoRepeat', (int) $event_repeat == 0 ? 'checked' : '');
    $tpl->assign('InputRepeat', 'event_repeat');
    $tpl->assign('ValueRepeat', '1');
    $tpl->assign('SelectedRepeat', (int) $event_repeat == 1 ? 'checked' : '');
    unset($in);
    $in = array(_PC_EVERY, _PC_EVERY_OTHER, _PC_EVERY_THIRD, _PC_EVERY_FOURTH);
    $keys = array(REPEAT_EVERY, REPEAT_EVERY_OTHER, REPEAT_EVERY_THIRD, REPEAT_EVERY_FOURTH);
    $repeat_freq = array();
    foreach ($in as $k => $v) {
        array_push($repeat_freq, array('value' => $keys[$k], 'selected' => $keys[$k] == $event_repeat_freq ? 'selected' : '', 'name' => $v));
    }
    $tpl->assign('InputRepeatFreq', 'event_repeat_freq');
    if (empty($event_repeat_freq) || $event_repeat_freq < 1) {
        $event_repeat_freq = 1;
    }
    $tpl->assign('InputRepeatFreqVal', $event_repeat_freq);
    $tpl->assign('repeat_freq', $repeat_freq);
    unset($in);
    $in = array(_PC_EVERY_DAY, _PC_EVERY_WORKDAY, _PC_EVERY_WEEK, _PC_EVERY_MONTH, _PC_EVERY_YEAR);
    $keys = array(REPEAT_EVERY_DAY, REPEAT_EVERY_WORK_DAY, REPEAT_EVERY_WEEK, REPEAT_EVERY_MONTH, REPEAT_EVERY_YEAR);
    $repeat_freq_type = array();
    foreach ($in as $k => $v) {
        array_push($repeat_freq_type, array('value' => $keys[$k], 'selected' => $keys[$k] == $event_repeat_freq_type ? 'selected' : '', 'name' => $v));
    }
    $tpl->assign('InputRepeatFreqType', 'event_repeat_freq_type');
    $tpl->assign('repeat_freq_type', $repeat_freq_type);
    $tpl->assign('InputRepeatOn', 'event_repeat');
    $tpl->assign('ValueRepeatOn', '2');
    $tpl->assign('SelectedRepeatOn', (int) $event_repeat == 2 ? 'checked' : '');
    unset($in);
    $in = array(_PC_EVERY_1ST, _PC_EVERY_2ND, _PC_EVERY_3RD, _PC_EVERY_4TH, _PC_EVERY_LAST);
    $keys = array(REPEAT_ON_1ST, REPEAT_ON_2ND, REPEAT_ON_3RD, REPEAT_ON_4TH, REPEAT_ON_LAST);
    $repeat_on_num = array();
    foreach ($in as $k => $v) {
        array_push($repeat_on_num, array('value' => $keys[$k], 'selected' => $keys[$k] == $event_repeat_on_num ? 'selected' : '', 'name' => $v));
    }
    $tpl->assign('InputRepeatOnNum', 'event_repeat_on_num');
    $tpl->assign('repeat_on_num', $repeat_on_num);
    unset($in);
    $in = array(_PC_EVERY_SUN, _PC_EVERY_MON, _PC_EVERY_TUE, _PC_EVERY_WED, _PC_EVERY_THU, _PC_EVERY_FRI, _PC_EVERY_SAT);
    $keys = array(REPEAT_ON_SUN, REPEAT_ON_MON, REPEAT_ON_TUE, REPEAT_ON_WED, REPEAT_ON_THU, REPEAT_ON_FRI, REPEAT_ON_SAT);
    $repeat_on_day = array();
    foreach ($in as $k => $v) {
        array_push($repeat_on_day, array('value' => $keys[$k], 'selected' => $keys[$k] == $event_repeat_on_day ? 'selected' : '', 'name' => $v));
    }
    $tpl->assign('InputRepeatOnDay', 'event_repeat_on_day');
    $tpl->assign('repeat_on_day', $repeat_on_day);
    unset($in);
    $in = array(_PC_OF_EVERY_MONTH, _PC_OF_EVERY_2MONTH, _PC_OF_EVERY_3MONTH, _PC_OF_EVERY_4MONTH, _PC_OF_EVERY_6MONTH, _PC_OF_EVERY_YEAR);
    $keys = array(REPEAT_ON_MONTH, REPEAT_ON_2MONTH, REPEAT_ON_3MONTH, REPEAT_ON_4MONTH, REPEAT_ON_6MONTH, REPEAT_ON_YEAR);
    $repeat_on_freq = array();
    foreach ($in as $k => $v) {
        array_push($repeat_on_freq, array('value' => $keys[$k], 'selected' => $keys[$k] == $event_repeat_on_freq ? 'selected' : '', 'name' => $v));
    }
    $tpl->assign('InputRepeatOnFreq', 'event_repeat_on_freq');
    if (empty($event_repeat_on_freq) || $event_repeat_on_freq < 1) {
        $event_repeat_on_freq = 1;
    }
    $tpl->assign('InputRepeatOnFreqVal', $event_repeat_on_freq);
    $tpl->assign('repeat_on_freq', $repeat_on_freq);
    $tpl->assign('MonthsTitle', _PC_MONTHS);
    //=================================================================
    //  PARSE INPUT_END_DATE
    //=================================================================
    $tpl->assign('InputEndOn', 'event_endtype');
    $tpl->assign('ValueEndOn', '1');
    $tpl->assign('SelectedEndOn', (int) $event_endtype == 1 ? 'checked' : '');
    //=================================================================
    //  PARSE INPUT_NO_END
    //=================================================================
    $tpl->assign('InputNoEnd', 'event_endtype');
    $tpl->assign('ValueNoEnd', '0');
    $tpl->assign('SelectedNoEnd', (int) $event_endtype == 0 ? 'checked' : '');
    $qstring = preg_replace("/provider_id=[0-9]*[&]{0,1}/", "", $_SERVER['QUERY_STRING']);
    $tpl->assign('qstring', $qstring);
    $output->SetOutputMode(_PNH_RETURNOUTPUT);
    $authkey = $output->FormHidden('authid', pnSecGenAuthKey());
    $output->SetOutputMode(_PNH_KEEPOUTPUT);
    $form_hidden = "<input type=\"hidden\" name=\"is_update\" value=\"{$is_update}\" />";
    $form_hidden .= "<input type=\"hidden\" name=\"pc_event_id\" value=\"{$pc_event_id}\" />";
    $form_hidden .= "<input type=\"hidden\" name=\"category\" value=\"{$cat}\" />";
    if (isset($data_loaded)) {
        $form_hidden .= "<input type=\"hidden\" name=\"data_loaded\" value=\"{$data_loaded}\" />";
        $tpl->assign('FormHidden', $form_hidden);
    }
    $form_submit = '<input type=hidden name="form_action" value="commit"/>
                   ' . $authkey . '<input type="submit" name="submit" value="go">';
    $tpl->assign('FormSubmit', $form_submit);
    // do not cache this page
    if ($admin) {
        $output->Text($tpl->fetch($template_name . '/admin/submit.html'));
    } elseif (pnVarCleanFromInput("no_nav") == 1) {
        $output->Text($tpl->fetch($template_name . '/user/submit_no_nav.html'));
    } else {
        $output->Text($tpl->fetch($template_name . '/user/submit.html'));
    }
    $output->Text(postcalendar_footer());
    return $output->GetOutput();
}
Exemple #26
0
function mediashare_edit_multimovemedia($args)
{
    if (!SecurityUtil::checkPermission('mediashare::', '::', ACCESS_EDIT)) {
        return LogUtil::registerPermissionError();
    }
    $albumId = mediashareGetIntUrl('aid', $args, 1);
    $mediaIdStr = FormUtil::getPassedValue('mid');
    $mediaIdList = explode(',', $mediaIdStr);
    if (isset($_POST['cancelButton'])) {
        return pnRedirect(pnModURL('mediashare', 'edit', 'view', array('aid' => $albumId)));
    }
    if (isset($_POST['saveButton'])) {
        return mediashareMultiMoveMedia();
    }
    if (($items = pnModAPIFunc('mediashare', 'user', 'getMediaItems', array('mediaIdList' => $mediaIdList, 'access' => mediashareAccessRequirementEditMedia))) === false) {
        return false;
    }
    // Build the output
    $render =& pnRender::getInstance('mediashare', false);
    $render->assign('items', $items);
    $render->assign('albumId', $albumId);
    $render->assign('thumbnailSize', pnModGetVar('mediashare', 'thumbnailSize'));
    return $render->fetch('mediashare_edit_multimovemedia.html');
}
/**
 * Display a block based on the current theme
 *
 */
function themesideblock($row)
{
    if (!isset($row['bid'])) {
        $row['bid'] = '';
    }
    if (!isset($row['title'])) {
        $row['title'] = '';
    }
    // check for collapsable menus being enabled, and setup the collapsable menu image.
    if (file_exists('themes/' . pnVarPrepForOS(pnUserGetTheme()) . '/images/upb.gif')) {
        $upb = '<img src="themes/' . pnVarPrepForOS(pnUserGetTheme()) . '/images/upb.gif" alt="" />';
    } else {
        $upb = '<img src="images/global/upb.gif" alt="" />';
    }
    if (file_exists('themes/' . pnVarPrepForOS(pnUserGetTheme()) . '/images/downb.gif')) {
        $downb = '<img src="themes/' . pnVarPrepForOS(pnUserGetTheme()) . '/images/downb.gif" alt="" />';
    } else {
        $downb = '<img src="images/global/downb.gif" alt="" />';
    }
    if (pnUserLoggedIn() && pnModGetVar('Blocks', 'collapseable') == 1 && isset($row['collapsable']) && $row['collapsable'] == '1') {
        if (pnCheckUserBlock($row) == '1') {
            if (!empty($row['title'])) {
                $row['minbox'] = '<a href="' . pnVarPrepForDisplay(pnModURL('Blocks', 'user', 'changestatus', array('bid' => $row['bid'], 'authid' => pnSecGenAuthKey()))) . '">' . $upb . '</a>';
            }
        } else {
            $row['content'] = '';
            if (!empty($row['title'])) {
                $row['minbox'] = '<a href="' . pnVarPrepForDisplay(pnModURL('Blocks', 'user', 'changestatus', array('bid' => $row['bid'], 'authid' => pnSecGenAuthKey()))) . '">' . $downb . '</a>';
            }
        }
    } else {
        $row['minbox'] = '';
    }
    // end collapseable menu config
    return themesidebox($row);
}
Exemple #28
0
function dplink_adminmenu()
{
    $theme = pnUserGetTheme();
    pnThemeLoad($theme);
    // Create output object
    $output = new pnHTML();
    // Security check
    if (!pnSecAuthAction(0, 'dplink::', '::', ACCESS_ADMIN)) {
        $output->Text(pnVarPrepHTMLDisplay(_SHIMLINKNOAUTH));
        return $output->GetOutput();
    }
    //Title
    ob_start();
    OpenTable();
    $oTable = ob_get_contents();
    ob_end_clean();
    $output->SetInputMode(_PNH_VERBATIMINPUT);
    $output->Text($oTable);
    $output->Title(pnVarPrepHTMLDisplay('<b>' . _SHIMLINK . '</b>'));
    $output->Text(pnVarPrepHTMLDisplay(_SHIMLINKMODIFYCONFIG));
    ob_start();
    CloseTable();
    $cTable = ob_get_contents();
    ob_end_clean();
    $output->SetInputMode(_PNH_VERBATIMINPUT);
    $output->Text($cTable);
    // Start form
    $output->FormStart(pnModURL('dplink', 'admin', 'updateconfig'));
    // Add an authorisation ID
    $output->FormHidden('authid', pnSecGenAuthKey());
    // Start the table that holds the information to be modified.
    ob_start();
    OpenTable();
    $oTable = ob_get_contents();
    ob_end_clean();
    $output->SetInputMode(_PNH_VERBATIMINPUT);
    $output->Text($oTable);
    $output->TableStart();
    // dplink location
    $row = array();
    $output->SetOutputMode(_PNH_RETURNOUTPUT);
    $row[] = $output->Text(pnVarPrepHTMLDisplay(_MODSUBJECT));
    $row[] = $output->FormText('url', pnModGetVar('dplink', 'url'), 50, 50);
    $output->SetOutputMode(_PNH_KEEPOUTPUT);
    $output->SetInputMode(_PNH_VERBATIMINPUT);
    $output->TableAddrow($row, 'left');
    // Warning
    $row = array();
    $output->SetOutputMode(_PNH_RETURNOUTPUT);
    $row[] = $output->Text(pnVarPrepHTMLDisplay(_MODWARNING));
    $output->SetOutputMode(_PNH_KEEPOUTPUT);
    $output->SetInputMode(_PNH_VERBATIMINPUT);
    $output->TableAddrow($row, 'left');
    // Use I-frame
    $row = array();
    $output->SetOutputMode(_PNH_RETURNOUTPUT);
    $row[] = $output->Text(pnVarPrepHTMLDisplay(_MODWRAP));
    $row[] = $output->FormCheckbox('use_wrap', pnModGetVar('dplink', 'use_wrap'));
    $output->SetOutputMode(_PNH_KEEPOUTPUT);
    $output->SetInputMode(_PNH_VERBATIMINPUT);
    $output->TableAddrow($row, 'left');
    // Open in New >Window
    $row = array();
    $output->SetOutputMode(_PNH_RETURNOUTPUT);
    $row[] = $output->Text(pnVarPrepHTMLDisplay(_MODWINDOW));
    $row[] = $output->FormCheckbox('use_window', pnModGetVar('dplink', 'use_window'));
    $output->SetOutputMode(_PNH_KEEPOUTPUT);
    $output->SetInputMode(_PNH_VERBATIMINPUT);
    $output->TableAddrow($row, 'left');
    $output->TableEnd();
    ob_start();
    CloseTable();
    $cTable = ob_get_contents();
    ob_end_clean();
    $output->SetInputMode(_PNH_VERBATIMINPUT);
    $output->Text($cTable);
    // End form
    //$output->Linebreak(1);
    ob_start();
    OpenTable();
    $oTable = ob_get_contents();
    ob_end_clean();
    $output->SetInputMode(_PNH_VERBATIMINPUT);
    $output->Text($oTable);
    $output->Text('<div align="center"><br>');
    $output->FormSubmit(pnVarPrepHTMLDisplay(_SHIMLINKUPDATE));
    $output->Text('<br><br></div>');
    ob_start();
    CloseTable();
    $cTable = ob_get_contents();
    ob_end_clean();
    $output->SetInputMode(_PNH_VERBATIMINPUT);
    $output->Text($cTable);
    $output->FormEnd();
    // Return the output that has been generated by this function
    $output->SetOutputMode(_PNH_KEEPOUTPUT);
    return $output->GetOutput();
}
 function render(&$render)
 {
     $dom = ZLanguage::getModuleDomain('mediashare');
     PageUtil::AddVar('javascript', 'javascript/ajax/prototype.js');
     PageUtil::AddVar('javascript', 'javascript/ajax/scriptaculous.js');
     PageUtil::AddVar('javascript', 'javascript/ajax/pnajax.js');
     PageUtil::AddVar('javascript', 'javascript/ajax/lightbox.js');
     PageUtil::AddVar('stylesheet', 'javascript/ajax/lightbox/lightbox.css');
     PageUtil::AddVar('javascript', 'modules/mediashare/pnjavascript/finditem.js');
     PageUtil::AddVar('stylesheet', ThemeUtil::getModuleStylesheet('mediashare'));
     $thumbnailSize = (int) pnModGetVar('mediashare', 'thumbnailSize') + 10;
     $html = "<div class=\"mediashareItemSelector\">\n<table><tr>\n";
     $mediadir = pnModAPIFunc('mediashare', 'user', 'getRelativeMediadir');
     if (!($albums = pnModAPIFunc('mediashare', 'user', 'getAllAlbums', array('albumId' => 1)))) {
         return false;
     }
     if ($this->selectedItemId != null) {
         $mediaItem = pnModAPIFunc('mediashare', 'user', 'getMediaItem', array('mediaId' => $this->selectedItemId));
         if ($mediaItem === false) {
             return false;
         }
         $selectedMediaId = $mediaItem['id'];
         $selectedAlbumId = $mediaItem['parentAlbumId'];
     } else {
         $mediaItem = null;
         $selectedMediaId = null;
         $selectedAlbumId = count($albums) > 0 ? $albums[0]['id'] : null;
     }
     $imgSrc = null;
     $itemOptionsHtml = '';
     if ($selectedAlbumId != null) {
         $items = pnModAPIFunc('mediashare', 'user', 'getMediaItems', array('albumId' => $selectedAlbumId));
         foreach ($items as $item) {
             if ($selectedMediaId == null) {
                 $selectedMediaId = $item['id'];
             }
             if ($selectedMediaId == $item['id']) {
                 $imgSrc = $mediadir . $item['thumbnailRef'];
                 $selected = ' selected="selected"';
             } else {
                 $selected = '';
             }
             $itemOptionsHtml .= "<option value=\"{$item['id']}\"{$selected}>" . DataUtil::formatForDisplay($item['title']) . "</option>\n";
         }
     }
     $html .= "<td class=\"img\" style=\"height: {$thumbnailSize}px; width: {$thumbnailSize}px;\">\n";
     if ($imgSrc != null) {
         $imgStyle = '';
     } else {
         $imgStyle = ' style="display: none"';
     }
     $html .= "<img id=\"{$this->id}_img\" src=\"{$imgSrc}\" alt=\"\"{$imgStyle}/><br/>\n";
     $html .= "</td>\n";
     $html .= "<td class=\"selector\">\n";
     $html .= "<label for=\"{$this->id}_album\">" . __('Album', $dom) . "</label><br/>";
     $html .= "<select id=\"{$this->id}_album\" name=\"{$this->inputName}_album\" onchange=\"mediashare.itemSelector.albumChanged(this,'{$this->id}', '" . $mediadir . "')\">\n";
     foreach ($albums as $album) {
         $title = '';
         for ($i = 1, $cou = (int) $album['nestedSetLevel']; $i < $cou; ++$i) {
             $title .= '+ ';
         }
         if ($selectedAlbumId == $album['id']) {
             $selected = ' selected="selected"';
         } else {
             $selected = '';
         }
         $html .= "<option value=\"{$album['id']}\"{$selected}>" . $title . DataUtil::formatForDisplay($album['title']) . "</option>\n";
     }
     $html .= "</select><br/>\n";
     $html .= "<label for=\"{$this->id}_item\">" . __('Media item', $dom) . "</label><br/> ";
     $html .= "<select id=\"{$this->id}_item\" name=\"{$this->inputName}\" onchange=\"mediashare.itemSelector.itemChanged(this,'{$this->id}', '" . $mediadir . "')\">\n";
     if ($selectedAlbumId != null) {
         $items = pnModAPIFunc('mediashare', 'user', 'getMediaItems', array('albumId' => $selectedAlbumId));
         $html .= $itemOptionsHtml;
     }
     $html .= "</select>";
     $html .= "</td></tr>\n";
     if ($this->enableUpload) {
         $html .= "<tr><td colspan=\"2\"><a href=\"javascript:void(0)\" id=\"mediashare_upload_collapse\">" . __('Upload', $dom) . "</a><div id=\"mediashare_upload\">\n";
         $html .= __('Select an item or upload a file directly', $dom) . '<br/>';
         $html .= "<label for=\"{$this->id}_upload\">" . __('Upload', $dom) . "</label>\n";
         $html .= "<input type=\"file\" id=\"{$this->id}_upload\" name=\"{$this->inputName}_upload\" class=\"file\"/>\n";
         if ($this->enableAddAlbum) {
             $html .= '<br/>' . __('Optional name of a new album to place the upload in', $dom) . '<br/>';
             $html .= "<label for=\"{$this->id}_newalbum\">" . __('Album', $dom) . "</label>\n";
             $html .= "<input type=\"text\" id=\"{$this->id}_newalbum\" name=\"{$this->inputName}_newalbum\"/>\n";
         }
         $html .= "</div></td></tr>\n";
     }
     $html .= "</table>\n";
     $html .= "<script type=\"text/javascript\">Event.observe(window,'load',function(){mediashare.itemSelector.onLoad('{$this->id}');});\n</script>\n";
     $html .= "</div>\n";
     return $html;
 }
Exemple #30
0
function mediashare_editapi_setDefaultAccess($args)
{
    $albumId = (int) $args['albumId'];
    $usersMayAddAlbum = (bool) isset($args['usersMayAddAlbum']) ? isset($args['usersMayAddAlbum']) : false;
    $access = array(array('groupId' => -1, 'accessView' => true, 'accessEditAlbum' => false, 'accessEditMedia' => false, 'accessAddAlbum' => false, 'accessAddMedia' => false), array('groupId' => pnModGetVar('Groups', 'defaultgroup', 1), 'accessView' => false, 'accessEditAlbum' => false, 'accessEditMedia' => false, 'accessAddAlbum' => $usersMayAddAlbum, 'accessAddMedia' => false));
    if (!pnModAPIFunc('mediashare', 'edit', 'updateAccessSettings', array('albumId' => $albumId, 'access' => $access))) {
        return false;
    }
    return true;
}