function foot() { themefooter(); if (!isset($GLOBALS['xanthia_theme']) && pnModLoad('Header_Footer', 'user', true)) { pnModFunc('Header_Footer', 'user', 'render'); } }
function smarty_function_mediashare_mediaItem($params, &$smarty) { $dom = ZLanguage::getModuleDomain('mediashare'); pnModLoad('mediashare', 'user'); $mediaBase = pnModAPIFunc('mediashare', 'user', 'getRelativeMediadir'); // Check for absolute URLs returned by external apps. $src = substr($params['src'], 0, 4) == 'http' ? $params['src'] : $mediaBase . htmlspecialchars($params['src']); $title = isset($params['title']) ? $params['title'] : ''; $id = isset($params['id']) ? $params['id'] : null; $isThumbnail = isset($params['isThumbnail']) ? (bool) $params['isThumbnail'] : false; $width = isset($params['width']) ? $params['width'] : null; $height = isset($params['height']) ? $params['height'] : null; $class = isset($params['class']) ? $params['class'] : null; $style = isset($params['style']) ? $params['style'] : null; $onclick = isset($params['onclick']) ? $params['onclick'] : null; $onmousedown = isset($params['onmousedown']) ? $params['onmousedown'] : null; if ($params['src'] == '') { $result = __('No media item found in this album', $dom); } else { if ($isThumbnail) { $onclickHtml = $onclick != null ? " onclick=\"{$onclick}\"" : ''; $onmousedownHtml = $onmousedown != null ? " onmousedown=\"{$onmousedown}\"" : ''; $widthHtml = $width == null ? '' : " width=\"{$width}\""; $heightHtml = $height == null ? '' : " height=\"{$height}\""; $classHtml = $class == null ? '' : " class=\"{$class}\""; $styleHtml = $style == null ? '' : " style=\"{$style}\""; $idHtml = isset($params['id']) ? " id=\"{$params['id']}\"" : ''; $result = "<img src=\"{$src}\" alt=\"" . htmlspecialchars($title) . "\"{$idHtml}{$widthHtml}{$heightHtml}{$classHtml}{$styleHtml}{$onclickHtml}{$onmousedownHtml}/>"; } else { $handler = pnModAPIFunc('mediashare', 'mediahandler', 'loadHandler', array('handlerName' => $params['mediaHandler'])); if ($handler === false) { return false; } $result = $handler->getMediaDisplayHtml($src, $width, $height, $id, array('title' => $title, 'onclick' => $onclick, 'onmousedown' => $onmousedown, 'class' => $class, 'style' => $style)); } } if (isset($params['assign'])) { $smarty->assign($params['assign'], $result); } return $result; }
$module = $name; } } // 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();
/** * 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; } }
/** * 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'); }
} if (!isset($arguments)) { $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>")';
/** * 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; } }