function foot() { themefooter(); if (!isset($GLOBALS['xanthia_theme']) && pnModLoad('Header_Footer', 'user', true)) { pnModFunc('Header_Footer', 'user', 'render'); } }
function displayEditing() { $dom = ZLanguage::getModuleDomain('mediashare'); if (!empty($this->mediaItemId)) { return pnModFunc('mediashare', 'user', 'simpledisplay', array('mid' => $this->mediaItemId, 'showAlbumLink' => $this->showAlbumLink, 'text' => $this->text, 'containerWidth' => $this->styleWidth)); } return __('No media item selected', $dom); }
function mediashare_remote_main() { $cmd = str_replace('-', '', $_POST['cmd']); ob_start(); pnModFunc('mediashare', 'remote', $cmd); $txt = "\n" . ob_get_clean(); /* DEBUG $f = fopen('c:/tmp/gallery.txt', 'a'); fwrite($f, $txt); fclose($f); //*/ echo $txt; return true; }
} // get module information $modinfo = pnModGetInfo(pnModGetIDFromName($module)); if ($modinfo['type'] == 2) { // New-new style of loading modules if (empty($type)) { $type = 'user'; } if (empty($func)) { $func = "main"; } // it should be $module not $name [class007] if (pnModAvailable($module)) { if (pnModLoad($module, $type)) { // Run the function $return = pnModFunc($module, $type, $func); } else { $return = false; } } else { $return = false; } // Sort out return of function. Can be // true - finished // false - display error msg // text - return information if (empty($return) || $return == false) { // Failed to load the module $output = new pnHTML(); $output->StartPage(); $output->Text('Failed to load module ' . $module . ' ( At function: "' . $func . '" )');
/** * carry out hook operations for module * @param hookobject the object the hook is called for - either 'item' or 'category' * @param hookaction the action the hook is called for - one of 'create', 'delete', 'transform', or 'display' * @param hookid the id of the object the hook is called for (module-specific) * @param extrainfo extra information for the hook, dependent on hookaction * @returns string * @return output from hooks */ function pnModCallHooks($hookobject, $hookaction, $hookid, $extrainfo) { // Get database info list($dbconn) = pnDBGetConn(); $pntable = pnDBGetTables(); $hookstable = $pntable['hooks']; $hookscolumn =& $pntable['hooks_column']; // Get applicable hooks $sql = "SELECT {$hookscolumn['tarea']},\n {$hookscolumn['tmodule']},\n {$hookscolumn['ttype']},\n {$hookscolumn['tfunc']}\n FROM {$hookstable}\n WHERE {$hookscolumn['smodule']} = '" . pnVarPrepForStore(pnModGetName()) . "'\n AND {$hookscolumn['object']} = '" . pnVarPrepForStore($hookobject) . "'\n AND {$hookscolumn['action']} = '" . pnVarPrepForStore($hookaction) . "'"; $result = $dbconn->Execute($sql); if ($dbconn->ErrorNo() != 0) { return null; } $output = ''; // Call each hook for (; !$result->EOF; $result->MoveNext()) { list($hookarea, $hookmodule, $hooktype, $hookfunc) = $result->fields; if ($hookarea == 'GUI') { if (pnModAvailable($hookmodule, $hooktype) && pnModLoad($hookmodule, $hooktype)) { $output .= pnModFunc($hookmodule, $hooktype, $hookfunc, array('objectid' => $hookid, 'extrainfo' => $extrainfo)); } } else { if (pnModAvailable($hookmodule, $hooktype) && pnModAPILoad($hookmodule, $hooktype)) { $extrainfo = pnModAPIFunc($hookmodule, $hooktype, $hookfunc, array('objectid' => $hookid, 'extrainfo' => $extrainfo)); } } } if ($hookaction == 'display') { return $output; } else { return $extrainfo; } }
function mediashare_user_slideshowcenter($args) { return pnModFunc('mediashare', 'user', 'slideshow', array('center' => true)); }
function display() { $csssrc = ThemeUtil::getModuleStylesheet('mediashare'); PageUtil::addVar('stylesheet', $csssrc); return pnModFunc('mediashare', 'user', 'simplethumbnails', array('aid' => $this->albumId, 'template' => $this->template, 'count' => $this->itemCount)); }
/** * Add / edit media items */ function mediashare_edit_addmedia($args) { $albumId = mediashareGetIntUrl('aid', $args, 1); $sourceName = mediashareGetStringUrl('source', $args); // Check access if (!mediashareAccessAlbum($albumId, mediashareAccessRequirementAddMedia, '')) { return LogUtil::registerPermissionError(); } $dom = ZLanguage::getModuleDomain('mediashare'); // Get parent album info (ignore unknown parent => this means we add to a top most album) if (!($album = pnModAPIFunc('mediashare', 'user', 'getAlbum', array('albumId' => $albumId)))) { return false; } // Get media sources if (($sources = pnModAPIFunc('mediashare', 'sources', 'getSources', array('active' => 1))) === false) { return false; } if (count($sources) == 0) { return LogUtil::registerError(__('No media sources found. You need to go to the admin panel and perform a scan for media sources.', $dom)); } if ($sourceName == '') { $sourceName = $sources[0]['name']; } // Find current source $source = null; foreach ($sources as $s) { if ($s['name'] == $sourceName) { $source = $s; } } $selectedSourceFile = DataUtil::formatForStore("source_{$sourceName}"); if (!pnModLoad('mediashare', $selectedSourceFile)) { return LogUtil::registerError("Failed to load Mediashare {$selectedSourceFile} file"); } $sourceHtml = pnModFunc('mediashare', $selectedSourceFile, 'view'); if ($sourceHtml === false || $sourceHtml === true) { return $sourceHtml; } // Build the output $render =& pnRender::getInstance('mediashare', false); $render->assign('album', $album); $render->assign('sources', $sources); $render->assign('selectedSource', $source); $render->assign('selectedSourceName', $sourceName); $render->assign('selectedSourceFile', $selectedSourceFile); $render->assign('sourceHtml', $sourceHtml); return $render->fetch('mediashare_edit_addmedia.html'); }
function Lenses_user_display($args) { //Permission check. if (!pnSecAuthAction(0, 'Lenses::', '::', ACCESS_READ)) { return pnVarPrepHTMLDisplay(_MODULENOAUTH); } // Clean $tid from input. $tid = pnVarCleanFromInput('tid'); extract($args); // Ensure valid values were passed in. if (empty($tid) || !is_numeric($tid)) { //echo 'TID: $tid<br />'; pnSessionSetVar('errormsg', _MODARGSERROR); return false; } // Start a new output object. $pnRender =& new pnRender('Lenses'); // Call API function to get all lens data. $lens_data = pnModAPIFunc('Lenses', 'user', 'get', array('item_type' => 'lens', 'item_id' => $tid)); //the image field will be a comma-separated string. Explode it. The first element will be placed into the "image1" field and the rest will be kept in the images field $lens_data[images] = explode(",", $lens_data[image]); //record lens ID as a session variable so it can be used to provide an option to compare recently searched lenses $saved_lens_array = array(); $saved_lens_array = pnSessionGetVar('saved_lens_array'); $saved_lens_array[$lens_data[name]] = $tid; pnSessionSetVar('saved_lens_array', array_unique($saved_lens_array)); //count how many recently searched lenses are now saved as a session variable. $saved_lens_count = count($saved_lens_array); //create text for company popups: $lens_data['comp_info'] = pnModFunc('Lenses', 'user', 'company_popup', array('comp_id' => $lens_data['comp_id'])); //create popup text for FDA groups: $fda_desc = pnModAPIFunc('Lenses', 'user', 'fda_descriptions'); $lens_data['fda_grp_desc'] = $fda_desc[$lens_data['fda_grp']]; //if possible, create dk/t value if ($lens_data['dk'] > 0 && $lens_data['ct'] > 0) { $lens_data['dkt'] = $lens_data['dk'] / $lens_data['ct'] / 10; } // Let any hooks know that we are displaying an item. As this is a display // hook we're passing a URL as the extra info, which is the URL that any // hooks will show after they have finished their own work. It is normal // for that URL to bring the user back to this function $pnRender->assign('hooks', pnModCallHooks('item', 'display', $tid, pnModURL('Lenses', 'user', 'display', array('tid' => $tid)))); //if user is allowed to edit, allow them to go to the edit page for the lens they're veiwing if (pnSecAuthAction(0, 'Lenses::', '::', ACCESS_EDIT)) { $pnRender->assign('edit_lens', true); } //only enable those with comment access (users) to see wholesale prices if (!pnSecAuthAction(0, 'Lenses::', '::', ACCESS_COMMENT)) { $lens_data['price'] = ""; } // Assign $lenses to template. $pnRender->assign('lens_data', $lens_data); $pnRender->assign('saved_lens_count', $saved_lens_count); // return templated output. return $pnRender->fetch('lenses_user_display.htm'); }
function Meds_user_display($args) { // Permission check. if (!pnSecAuthAction(0, 'Meds::', '::', ACCESS_READ)) { return pnVarPrepHTMLDisplay(_MODULENOTSUBSCRIBED); } // This is a flag to use in the template for // the purpose of displaying a go-back link. // This flag is needed because the go back link // is not needed when the user dialed in a med // and displayed it directly (ie, non-search) $search = pnVarCleanFromInput('search'); // Get the object type and start number. $med_id = pnVarCleanFromInput('med_id'); // Get medication from database. $med = pnModAPIFunc('Meds', 'user', 'get', array('object' => 'med', 'med_id' => $med_id)); // Check if medication could not be obtained. if (!$med) { return pnVarPrepHTMLDisplay(_NOSUCHITEM); } if (strpos($med['rxInfo'], "pdf/") === 0) { $med['rxInfo'] = "modules/Meds/pn" . $med['rxInfo']; } //print (strpos($med['rxInfo'], "pdf/")); //information used for popup windows. I'm sure there's a better way to do this but... $pregnancy = pnModAPIFunc('Meds', 'user', 'preg_descriptions'); $schedules = pnModAPIFunc('Meds', 'user', 'sched_descriptions'); if ($med['pres_id1']) { $pres_info1 = pnModAPIFunc('Meds', 'user', 'get', array('object' => 'preserve', 'pres_id' => $med['pres_id1'])); } if ($med['pres_id2']) { $pres_info2 = pnModAPIFunc('Meds', 'user', 'get', array('object' => 'preserve', 'pres_id' => $med['pres_id2'])); } $comp_info = pnModAPIFunc('Meds', 'user', 'get', array('object' => 'company', 'comp_id' => $med['comp_id'])); $comp_text = pnModFunc('Meds', 'user', 'company_popup', array('comp_info' => $comp_info)); if ($med['moa_id1']) { $moa_info1 = pnModAPIFunc('Meds', 'user', 'get', array('object' => 'moa', 'moa_id' => $med['moa_id1'])); } if ($med['moa_id2']) { $moa_info2 = pnModAPIFunc('Meds', 'user', 'get', array('object' => 'moa', 'moa_id' => $med['moa_id2'])); } if ($med['moa_id3']) { $moa_info3 = pnModAPIFunc('Meds', 'user', 'get', array('object' => 'moa', 'moa_id' => $med['moa_id3'])); } if ($med['moa_id4']) { $moa_info4 = pnModAPIFunc('Meds', 'user', 'get', array('object' => 'moa', 'moa_id' => $med['moa_id4'])); } // Start a new output object. $pnRender =& new pnRender('Meds'); // Assign medication's data to template. $pnRender->assign('med', $med); //assign popup info to templates $pnRender->assign('preg', $pregnancy[$med['preg']]); $pnRender->assign('sched', $schedules[$med['schedule']]); $pnRender->assign('comp_text', $comp_text); $pnRender->assign('preserve_info1', $pres_info1['comments']); $pnRender->assign('preserve_info2', $pres_info2['comments']); $pnRender->assign('moa_info1', $moa_info1['comments']); $pnRender->assign('moa_info2', $moa_info2['comments']); $pnRender->assign('moa_info3', $moa_info3['comments']); $pnRender->assign('moa_info4', $moa_info4['comments']); // Assign flag to template; for search back-links. if (!empty($search)) { $pnRender->assign('search', $search); } // Assign flag for admin permission capacity. $pnRender->assign('is_admin', pnSecAuthAction(0, 'Meds::', '::', ACCESS_ADMIN)); // Let any hooks know that we are displaying an item. As this is a display // hook we're passing a URL as the extra info, which is the URL that any // hooks will show after they have finished their own work. It is normal // for that URL to bring the user back to this function $pnRender->assign('hooks', pnModCallHooks('item', 'display', $med_id, pnModURL('Meds', 'user', 'display', array('med_id' => $med_id)))); // Get options for all dropdowns. These are not used // for dropdowns here, but rather are used to help convert // the med's various ids back into meaning texts. $pnRender->assign(pnModAPIFunc('Meds', 'user', 'getall_selects')); // Return templated output. return $pnRender->fetch('meds_user_display.htm'); }
$arguments = array(); } // temporary additional security check..... if ($type == 'admin' && $func == 'updateconfig' && !pnSecAuthAction(0, "{$modinfo['name']}::", '::', ACCESS_ADMIN)) { header('HTTP/1.0 403 Access Denied'); include 'header.php'; echo _MODULENOAUTH; include 'footer.php'; exit; } // we need to force the mod load if we want to call a modules interactive init // function because the modules is not active right now $force_modload = $type == 'init' ? true : false; if (pnModLoad($modinfo['name'], $type, $force_modload)) { // Run the function $return = pnModFunc($modinfo['name'], $type, $func, $arguments); } else { $return = false; } // Sort out return of function. Can be // true - finished // false - display error msg // text - return information if ($return !== true) { include_once 'header.php'; if ($return === false) { // Failed to load the module header('HTTP/1.0 404 Not Found'); echo 'Failed to load module <strong>' . pnVarPrepForDisplay($module) . '</strong> (at function: "<strong>' . pnVarPrepForDisplay($func) . '</strong>")'; } elseif (is_string($return) && strlen($return) > 0) { // Text
/** * carry out hook operations for module * @author Jim McDonald <*****@*****.**> * @link http://www.mcdee.net * @param 'hookobject' the object the hook is called for - one of 'item', 'category' or 'module' * @param 'hookaction' the action the hook is called for - one of 'new', 'create', 'modify', 'update', 'delete', 'transform', 'display', 'modifyconfig', 'updateconfig' * @param 'hookid' the id of the object the hook is called for (module-specific) * @param 'extrainfo' extra information for the hook, dependent on hookaction * @param 'implode' implode collapses all display hooks into a single string - default to true for compatability with .7x * @return mixed string output from GUI hooks, extrainfo array for API hooks */ function pnModCallHooks($hookobject, $hookaction, $hookid, $extrainfo = array(), $implode = true) { static $modulehooks; if (!isset($hookaction)) { return null; } if (isset($extrainfo['module']) && (pnModAvailable($extrainfo['module']) || strtolower($hookobject) == 'module')) { $modname = $extrainfo['module']; } else { $modname = pnModGetName(); } if (!isset($modulehooks[strtolower($modname)])) { // Get database info $dbconn =& pnDBGetConn(true); $pntable =& pnDBGetTables(); $hookstable = $pntable['hooks']; $hookscolumn =& $pntable['hooks_column']; // Get applicable hooks $sql = "SELECT {$hookscolumn['tarea']},\n\t\t\t\t\t {$hookscolumn['tmodule']},\n\t\t\t\t\t {$hookscolumn['ttype']},\n\t\t\t\t\t {$hookscolumn['tfunc']},\n\t\t\t\t\t {$hookscolumn['action']},\n\t\t\t\t\t {$hookscolumn['object']}\n\t\t\t\tFROM {$hookstable}\n\t\t\t\tWHERE {$hookscolumn['smodule']} = '" . pnVarPrepForStore($modname) . "'"; $result =& $dbconn->Execute($sql); if ($dbconn->ErrorNo() != 0) { return null; } $hooks = array(); for (; !$result->EOF; $result->MoveNext()) { list($area, $module, $type, $func, $action, $object) = $result->fields; $hooks[] = array('area' => $area, 'module' => $module, 'type' => $type, 'func' => $func, 'action' => $action, 'object' => $object); } $modulehooks[strtolower($modname)] = $hooks; } $gui = false; $output = array(); // Call each hook foreach ($modulehooks[strtolower($modname)] as $modulehook) { if ($modulehook['action'] == $hookaction && $modulehook['object'] == $hookobject) { if ($modulehook['area'] == 'GUI') { $gui = true; if (pnModAvailable($modulehook['module'], $modulehook['type']) && pnModLoad($modulehook['module'], $modulehook['type'])) { $output[$modulehook['module']] = pnModFunc($modulehook['module'], $modulehook['type'], $modulehook['func'], array('objectid' => $hookid, 'extrainfo' => $extrainfo)); } } else { if (pnModAvailable($modulehook['module'], $modulehook['type']) && pnModAPILoad($modulehook['module'], $modulehook['type'])) { $extrainfo = pnModAPIFunc($modulehook['module'], $modulehook['type'], $modulehook['func'], array('objectid' => $hookid, 'extrainfo' => $extrainfo)); } } } } // check what type of information we need to return // credit to the xaraya team for the eregi check // itevo if ($gui || strtolower($hookaction) == 'display' || strtolower($hookaction) == 'new' || strtolower($hookaction) == 'modify' || strtolower($hookaction) == 'modifyconfig') { if ($implode || empty($output)) { $output = implode("\n", $output); } return $output; } else { return $extrainfo; } }