• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP pnModAPIFunc函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中pnModAPIFunc函数的典型用法代码示例。如果您正苦于以下问题:PHP pnModAPIFunc函数的具体用法?PHP pnModAPIFunc怎么用?PHP pnModAPIFunc使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了pnModAPIFunc函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: mediashare_sourcesapi_scanSources

function mediashare_sourcesapi_scanSources()
{
    // Check access
    if (!SecurityUtil::checkPermission('mediashare::', '::', ACCESS_ADMIN)) {
        return LogUtil::registerPermissionError();
    }
    $dom = ZLanguage::getModuleDomain('mediashare');
    // Clear existing sources table
    if (!DBUtil::truncateTable('mediashare_sources')) {
        return LogUtil::registerError(__f('Error in %1$s: %2$s.', array('sourcesapi.scanSources', __f("Could not clear the '%s' table.", 'sources', $dom)), $dom));
    }
    // Scan for sources APIs
    $files = FileUtil::getFiles('modules/mediashare', false, true, 'php', 'f');
    foreach ($files as $file) {
        if (preg_match('/^pnsource_([-a-zA-Z0-9_]+)api.php$/', $file, $matches)) {
            $sourceName = $matches[1];
            $sourceApi = "source_{$sourceName}";
            // Force load - it is used during pninit
            pnModAPILoad('mediashare', $sourceApi, true);
            if (!($title = pnModAPIFunc('mediashare', $sourceApi, 'getTitle'))) {
                return false;
            }
            if (!pnModAPIFunc('mediashare', 'sources', 'addSource', array('title' => $title, 'name' => $sourceName))) {
                return false;
            }
        }
    }
    return true;
}
开发者ID:ro0f,项目名称:Mediashare,代码行数:29,代码来源:pnsourcesapi.php


示例2: mediashare_external_pasteitem

function mediashare_external_pasteitem($args)
{
    // FIXME access check
    $albumId = mediashareGetIntUrl('aid', $args, 0);
    $mediaId = mediashareGetIntUrl('mid', $args, 0);
    $mode = FormUtil::getPassedValue('mode');
    if (isset($_POST['backButton'])) {
        return pnRedirect(pnModUrl('mediashare', 'external', 'finditem', array('aid' => $albumId, 'mid' => $mediaId, 'mode' => $mode)));
    }
    $mediaItem = pnModAPIFunc('mediashare', 'user', 'getMediaItem', array('mediaId' => $mediaId));
    /*
        if (!($handler = pnModAPIFunc('mediashare', 'mediahandler', 'loadHandler', array('handlerName' => $mediaItem['mediaHandler'])))) {
            return false;
        }
    */
    $render =& pnRender::getInstance('mediashare', false);
    mediashareExternalLoadTheme($render);
    $render->assign('albumId', $albumId);
    $render->assign('mediaId', $mediaId);
    $render->assign('mediaItem', $mediaItem);
    if ($mediaItem['mediaHandler'] != 'extapp') {
        $mediadir = pnModAPIFunc('mediashare', 'user', 'getRelativeMediadir');
        $render->assign('thumbnailUrl', $mediadir . $mediaItem['thumbnailRef']);
        $render->assign('previewUrl', $mediadir . $mediaItem['previewRef']);
        $render->assign('originalUrl', $mediadir . $mediaItem['originalRef']);
    } else {
        $render->assign('thumbnailUrl', "{$mediaItem['thumbnailRef']}");
        $render->assign('previewUrl', "{$mediaItem['previewRef']}");
        $render->assign('originalUrl', "{$mediaItem['originalRef']}");
    }
    $render->assign('mode', $mode);
    echo $render->fetch('mediashare_external_pasteitem.html');
    return true;
}
开发者ID:ro0f,项目名称:Mediashare,代码行数:34,代码来源:pnexternal.php


示例3: mediashare_source_youtubeapi_getUploadInfo

function mediashare_source_youtubeapi_getUploadInfo()
{
    if (!($userInfo = pnModAPIFunc('mediashare', 'edit', 'getUserInfo'))) {
        return false;
    }
    return array('post_max_size' => (int) ($post_max_size / 1000), 'upload_max_filesize' => (int) ($upload_max_filesize / 1000));
}
开发者ID:ro0f,项目名称:Mediashare,代码行数:7,代码来源:pnsource_youtubeapi.php


示例4: smarty_resource_userdb_fetch

/** 
* Smarty plugin 
* ------------------------------------------------------------- 
* Type:     resource 
* Name:     userdb 
* Purpose:  read user maintained source as a template 
*           $tpl_name is parsed as a uri type of string where 
*          the path to the template field is encoded as: 
* 
* table/source_field?field=condtional&field=conditional... 
* 
* results in: 
*    SELECT source_field FROM table WHERE conditions... 
* ------------------------------------------------------------- 
*/
function smarty_resource_userdb_fetch($tpl_name, &$tpl_source, &$smarty, $default = false)
{
    $_url = parse_url($tpl_name);
    // (required) expected syntax: table/source_field
    $_path_items = explode('/', $_url['path']);
    $table = $_path_items[0];
    $source = $_path_items[1];
    // Theme Configuration
    $skinid = pnModAPIFunc('Xanthia', 'user', 'getSkinID', array('skin' => $table));
    $dbconn =& pnDBGetConn(true);
    $pntable =& pnDBGetTables();
    $table = $pntable['theme_tplsource'];
    $column =& $pntable['theme_tplsource_column'];
    $query = "SELECT {$column['tpl_source']}\n\t\t\t\t\tFROM {$table}\n\t\t\t\t\tWHERE {$column['tpl_file_name']}='{$source}'\n\t\t\t\t\tAND {$column['tpl_skin_id']}= '{$skinid}' LIMIT 1";
    $result =& $dbconn->Execute($query);
    if ($result->EOF) {
    } else {
        list($tpl_source) = $result->fields;
    }
    $result->MoveNext();
    $result->Close();
    if ($tpl_source) {
        return true;
    } else {
        return $default;
    }
}
开发者ID:orbitroom,项目名称:EVE-Online-POS-Tracker,代码行数:42,代码来源:resource.userdb.php


示例5: smarty_function_mediashare_breadcrumb

function smarty_function_mediashare_breadcrumb($params, &$smarty)
{
    $dom = ZLanguage::getModuleDomain('mediashare');
    if (!isset($params['albumId'])) {
        $smarty->trigger_error(__f('Missing [%1$s] in \'%2$s\'', array('albumId', 'mediashare_breadcrumb'), $dom));
        return false;
    }
    $mode = isset($params['mode']) ? $params['mode'] : 'view';
    $breadcrumb = pnModAPIFunc('mediashare', 'user', 'getAlbumBreadcrumb', array('albumId' => (int) $params['albumId']));
    if ($breadcrumb === false) {
        $smarty->trigger_error(LogUtil::getErrorMessagesText());
        return false;
    }
    $urlType = $mode == 'edit' ? 'edit' : 'user';
    $url = pnModUrl('mediashare', $urlType, 'view', array('aid' => 0));
    $result = "<div class=\"mediashare-breadcrumb\">";
    $first = true;
    foreach ($breadcrumb as $album) {
        $url = DataUtil::formatForDisplay(pnModUrl('mediashare', $urlType, 'view', array('aid' => $album['id'])));
        $result .= ($first ? '' : ' &raquo; ') . "<a href=\"{$url}\">" . htmlspecialchars($album['title']) . "</a>";
        $first = false;
    }
    $result .= "</div>";
    if (isset($params['assign'])) {
        $smarty->assign($params['assign'], $result);
    }
    return $result;
}
开发者ID:ro0f,项目名称:Mediashare,代码行数:28,代码来源:function.mediashare_breadcrumb.php


示例6: smarty_function_mediashare_mediaUrl

function smarty_function_mediashare_mediaUrl($params, &$smarty)
{
    $result = pnModAPIFunc('mediashare', 'user', 'getMediaUrl', $params);
    if (isset($params['assign'])) {
        $smarty->assign($params['assign'], $result);
    }
    return DataUtil::formatForDisplay($result);
}
开发者ID:ro0f,项目名称:Mediashare,代码行数:8,代码来源:function.mediashare_mediaUrl.php


示例7: mediashare_vfs_db_dump

function mediashare_vfs_db_dump()
{
    $fileref = $_GET['ref'];
    // Retrieve image information
    if (!($media = pnModAPIFunc('mediashare', 'vfs_db', 'getMedia', array('fileref' => $fileref)))) {
        return false;
    }
    // Check access
    if (!mediashareAccessAlbum($media['albumId'], mediashareAccessRequirementView, null)) {
        return LogUtil::registerPermissionError();
    }
    // Some Mediashare users have reported this to make their setup work. The buffer may contain something
    // due to a buggy template or block
    while (@ob_end_clean()) {
    }
    if (pnConfigGetVar('UseCompression') == 1) {
        // With the "while (@ob_end_clean());" stuff above we are guranteed that no z-buffering is done
        // But(!) the "ob_start("ob_gzhandler");" made by pnAPI.php means a "Content-Encoding: gzip" is set.
        // So we need to reset this header since no compression is done
        header("Content-Encoding: identity");
    }
    // Check cached versus modified date
    $lastModifiedDate = date('D, d M Y H:i:s T', $media['modifiedDate']);
    $currentETag = $media['modifiedDate'];
    global $HTTP_SERVER_VARS;
    $cachedDate = isset($HTTP_SERVER_VARS['HTTP_IF_MODIFIED_SINCE']) ? $HTTP_SERVER_VARS['HTTP_IF_MODIFIED_SINCE'] : null;
    $cachedETag = isset($HTTP_SERVER_VARS['HTTP_IF_NONE_MATCH']) ? $HTTP_SERVER_VARS['HTTP_IF_NONE_MATCH'] : null;
    // If magic quotes are on then all query/post variables are escaped - so strip slashes to make a compare possible
    // - only cachedETag is expected to contain quotes
    if (get_magic_quotes_gpc()) {
        $cachedETag = stripslashes($cachedETag);
    }
    if ((empty($cachedDate) || $lastModifiedDate == $cachedDate) && '"' . $currentETag . '"' == $cachedETag) {
        header("HTTP/1.1 304 Not Modified");
        header("Status: 304 Not Modified");
        header("Expires: " . date('D, d M Y H:i:s T', time() + 180 * 24 * 3600));
        // My PHP insists on Expires in 1981 as default!
        header('Pragma: cache');
        // My PHP insists on putting a pragma "no-cache", so this is an attempt to avoid that
        header('Cache-Control: public');
        header("ETag: \"{$media['modifiedDate']}\"");
        return true;
    }
    header("Expires: " . date('D, d M Y H:i:s T', time() + 180 * 24 * 3600));
    // My PHP insists on Expires in 1981 as default!
    header('Pragma: cache');
    // My PHP insists on putting a pragma "no-cache", so this is an attempt to avoid that
    header('Cache-Control: public');
    header("ETag: \"{$media['modifiedDate']}\"");
    // Ensure correct content-type and a filename for eventual download
    header("Content-Type: {$media['mimeType']}");
    header("Content-Disposition: inline; filename=\"{$media['title']}\"");
    header("Last-Modified: {$lastModifiedDate}");
    header("Content-Length: " . strlen($media['data']));
    echo $media['data'];
    return true;
}
开发者ID:ro0f,项目名称:Mediashare,代码行数:57,代码来源:pnvfs_db.php


示例8: mediashare_adminapi_scanAllPlugins

/**
 * Scan for all media
 */
function mediashare_adminapi_scanAllPlugins()
{
    // Force load - it is used during pninit
    pnModAPILoad('mediashare', 'mediahandler', true);
    if (!pnModAPIFunc('mediashare', 'mediahandler', 'scanMediaHandlers')) {
        return false;
    }
    // Force load - it is used during pninit
    pnModAPILoad('mediashare', 'sources', true);
    return pnModAPIFunc('mediashare', 'sources', 'scanSources');
}
开发者ID:ro0f,项目名称:Mediashare,代码行数:14,代码来源:pnadminapi.php


示例9: update

 function update($force)
 {
     if ($force || count($this->items) == 0) {
         $albums = pnModAPIFunc('mediashare', 'user', 'getAllAlbums', array('albumId' => 1, 'access' => $this->access, 'onlyMine' => $this->onlyMine));
         if ($albums === false) {
             pn_exit(LogUtil::getErrorMessagesText());
         }
         foreach ($albums as $album) {
             $this->addItem($album['title'], $album['id']);
         }
     }
 }
开发者ID:ro0f,项目名称:Mediashare,代码行数:12,代码来源:function.mediasharealbumselector.php


示例10: mediashare_ajax_getitems

/**
 * Mediashare AJAX handler
 *
 * @copyright (C) 2007, Jorn Wildt
 * @link http://www.elfisk.dk
 * @version $Id$
 * @license See license.txt
 */
function mediashare_ajax_getitems($args)
{
    $items = pnModAPIFunc('mediashare', 'user', 'getMediaItems', array('albumId' => FormUtil::getPassedValue('aid')));
    if ($items === false) {
        AjaxUtil::error(LogUtil::getErrorMessagesText(' - '), '403 Forbidden');
    }
    $mediaItems = array();
    foreach ($items as $item) {
        $mediaItems[] = array('id' => $item['id'], 'isExternal' => $item['mediaHandler'] == 'extapp', 'thumbnailRef' => $item['thumbnailRef'], 'previewRef' => $item['previewRef'], 'title' => $item['title']);
    }
    return array('mediaItems' => $mediaItems);
}
开发者ID:ro0f,项目名称:Mediashare,代码行数:20,代码来源:pnajax.php


示例11: smarty_function_mediashare_albumSelector

function smarty_function_mediashare_albumSelector($params, &$smarty)
{
    $dom = ZLanguage::getModuleDomain('mediashare');
    if (!isset($params['albumId'])) {
        $smarty->trigger_error(__f('Missing [%1$s] in \'%2$s\'', array('albumId', 'mediashare_albumSelector'), $dom));
        return false;
    }
    $albumId = $params['albumId'];
    $id = isset($params['id']) ? $params['id'] : 'album';
    $name = isset($params['name']) ? $params['name'] : $id;
    $excludeAlbumId = isset($params['excludeAlbumId']) ? $params['excludeAlbumId'] : null;
    $onlyMine = isset($params['onlyMine']) ? $params['onlyMine'] : false;
    $access = isset($params['access']) ? constant($params['access']) : 0xff;
    $albums = pnModAPIFunc('mediashare', 'user', 'getAllAlbums', array('albumId' => 1, 'excludeAlbumId' => $excludeAlbumId, 'access' => $access, 'onlyMine' => $onlyMine));
    if ($albums === false) {
        $smarty->trigger_error(LogUtil::getErrorMessagesText());
        return false;
    }
    if (isset($params['onchange'])) {
        $onChangeHtml = " onchange=\"{$params['onchange']}\"";
    } else {
        $onChangeHtml = '';
    }
    if (isset($params['id'])) {
        $idHtml = " id=\"{$id}\"";
    } else {
        $idHtml = '';
    }
    $html = "<select name=\"{$name}\"{$onChangeHtml}{$idHtml}>\n";
    foreach ($albums as $album) {
        $title = $album['title'];
        $id = (int) $album['id'];
        $level = $album['nestedSetLevel'] - 1;
        $indent = '';
        for ($i = 0; $i < $level; ++$i) {
            $indent .= '+ ';
        }
        $selectedHtml = $id == $albumId ? ' selected="selected"' : '';
        $html .= "<option value=\"{$id}\"{$selectedHtml}>{$indent}{$title}</option>\n";
    }
    $html .= "</select>";
    if (isset($params['assign'])) {
        $smarty->assign($params['assign'], $html);
    }
    return $html;
}
开发者ID:ro0f,项目名称:Mediashare,代码行数:46,代码来源:function.mediashare_albumSelector.php


示例12: FlashChatBridge_Onlineblock_display

/**
 * display block
 *
 * @param        array       $blockinfo     a blockinfo structure
 * @return       output      the rendered bock
 */
function FlashChatBridge_Onlineblock_display($blockinfo)
{
    if (!SecurityUtil::checkPermission('FlashChatBridge:Onlineblock:', "::", ACCESS_READ)) {
        return false;
    }
    if (!pnModAvailable('FlashChatBridge') || !pnUserLoggedIn()) {
        return false;
    }
    //pnModLoad("FlashChatBridge");
    $Users = pnModAPIFunc('FlashChatBridge', 'user', 'getChatterList');
    $count = count($Users);
    $render = pnRender::getInstance('FlashChatBridge', false);
    $render->assign('Users', $Users);
    $render->assign('Count', $count);
    $blockinfo['content'] = $render->fetch('flashchatbridge_block_online.htm');
    return pnBlockThemeBlock($blockinfo);
}
开发者ID:tempbottle,项目名称:FlashChatBridge,代码行数:23,代码来源:Online.php


示例13: smarty_function_mediashare_userinfo

function smarty_function_mediashare_userinfo($params, $smarty)
{
    if (!($userInfo = pnModAPIFunc('mediashare', 'edit', 'getUserInfo'))) {
        return false;
    }
    $dom = ZLanguage::getModuleDomain('mediashare');
    $maxSize = $userInfo['mediaSizeLimitTotal'];
    $size = $userInfo['totalCapacityUsed'];
    $imageDir = 'modules/mediashare/pnimages';
    $leftSize = intval($maxSize > $size ? $size * 100 / $maxSize : 100);
    $rightSize = intval($maxSize > $size ? 100 - $leftSize : 0);
    $scale = 1000000;
    $unitTitle = 'Mb';
    $str = sprintf("%.2f %s %.2f %s", $size / $scale, __('of', $dom), $maxSize / $scale, $unitTitle);
    $result = "<div class=\"mediashare-userinfo\"><img src=\"{$imageDir}/bar_left.gif\" height=\"5\" width=\"{$leftSize}\" alt=\"\" />" . "<img src=\"{$imageDir}/bar_right.gif\" height=\"5\" width=\"{$rightSize}\" alt=\"\" />" . " {$leftSize}% ({$str})</div>";
    return $result;
}
开发者ID:ro0f,项目名称:Mediashare,代码行数:17,代码来源:function.mediashare_userinfo.php


示例14: mediashare_source_zipapi_getUploadInfo

function mediashare_source_zipapi_getUploadInfo()
{
    if (!($userInfo = pnModAPIFunc('mediashare', 'edit', 'getUserInfo'))) {
        return false;
    }
    $upload_max_filesize = mediashareSourceZipParseIni(ini_get('upload_max_filesize'));
    if ($userInfo['totalCapacityLeft'] < $upload_max_filesize) {
        $upload_max_filesize = $userInfo['totalCapacityLeft'];
    }
    if ($userInfo['mediaSizeLimitSingle'] < $upload_max_filesize) {
        $upload_max_filesize = $userInfo['mediaSizeLimitSingle'];
    }
    $post_max_size = mediashareSourceZipParseIni(ini_get('post_max_size'));
    if ($userInfo['totalCapacityLeft'] < $post_max_size) {
        $post_max_size = $userInfo['totalCapacityLeft'];
    }
    return array('post_max_size' => (int) ($post_max_size / 1000), 'upload_max_filesize' => (int) ($upload_max_filesize / 1000));
}
开发者ID:ro0f,项目名称:Mediashare,代码行数:18,代码来源:pnsource_zipapi.php


示例15: smarty_function_mediashare_mediaItem

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;
}
开发者ID:ro0f,项目名称:Mediashare,代码行数:41,代码来源:function.mediashare_mediaItem.php


示例16: FlashChatBridge_user_main

/**
 * User main page
 * @return HTML
 */
function FlashChatBridge_user_main()
{
    // perform permission check
    if (!SecurityUtil::checkPermission('FlashChatBridge::', '::', ACCESS_READ)) {
        return LogUtil::registerPermissionError();
    }
    $render =& pnRender::getInstance('FlashChatBridge', false);
    $UserVars = pnUserGetVars(SessionUtil::getVar('uid'));
    $Users = pnModAPIFunc('FlashChatBridge', 'user', 'getChatterList');
    $count = count($Users);
    $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);
    $render->assign('Users', $Users);
    $render->assign('Count', $count);
    return $render->fetch('flashchatbridge_user_main.htm');
}
开发者ID:tempbottle,项目名称:FlashChatBridge,代码行数:26,代码来源:pnuser.php


示例17: smarty_function_mediashare_templateSelector

function smarty_function_mediashare_templateSelector($params, &$smarty)
{
    $id = isset($params['id']) ? $params['id'] : 'album';
    $selectedTemplate = $smarty->get_template_vars($id);
    $name = isset($params['name']) ? $params['name'] : $id;
    $templates = pnModAPIFunc('mediashare', 'user', 'getAllTemplates');
    if ($templates === false) {
        $smarty->trigger_error(LogUtil::getErrorMessagesText());
        return false;
    }
    if (isset($params['onchange']) && $params['onchange']) {
        $onChangeHtml = ' onchange="' . $params['onchange'] . '"';
    } else {
        $onChangeHtml = '';
    }
    if (isset($params['readonly']) && $params['readonly']) {
        $readonlyHtml = ' disabled="disabled"';
    } else {
        $readonlyHtml = '';
    }
    if (isset($params['id']) && $params['id']) {
        $idHtml = " id=\"{$id}\"";
    } else {
        $idHtml = '';
    }
    $html = "<select name=\"{$name}\"{$onChangeHtml}{$idHtml}{$readonlyHtml}>\n";
    foreach ($templates as $template) {
        $title = DataUtil::formatForDisplay($template['title']);
        $value = $template['title'];
        $selectedHtml = strcasecmp($value, $selectedTemplate) == 0 ? ' selected="selected"' : '';
        $html .= "<option value=\"{$value}\"{$selectedHtml}>{$title}</option>\n";
    }
    $html .= "</select>";
    if (isset($params['assign'])) {
        $smarty->assign($params['assign'], $html);
    }
    return $html;
}
开发者ID:ro0f,项目名称:Mediashare,代码行数:38,代码来源:function.mediashare_templateSelector.php


示例18: mediashare_searchapi_search

function mediashare_searchapi_search($args)
{
    $dom = ZLanguage::getModuleDomain('mediashare');
    pnModDBInfoLoad('mediashare');
    pnModDBInfoLoad('Search');
    $pntable = pnDBGetTables();
    $mediaTable = $pntable['mediashare_media'];
    $mediaColumn = $pntable['mediashare_media_column'];
    $albumsTable = $pntable['mediashare_albums'];
    $albumsColumn = $pntable['mediashare_albums_column'];
    $searchTable = $pntable['search_result'];
    $searchColumn = $pntable['search_result_column'];
    $sessionId = session_id();
    // Find accessible albums
    $accessibleAlbumSql = pnModAPIFunc('mediashare', 'user', 'getAccessibleAlbumsSql', array('access' => mediashareAccessRequirementViewSomething, 'field' => "media.{$mediaColumn['parentAlbumId']}"));
    $albumText = __('Multimedia file in album: ', $dom);
    $sql = "\nINSERT INTO {$searchTable}\n  ({$searchColumn['title']},\n   {$searchColumn['text']},\n   {$searchColumn['module']},\n   {$searchColumn['extra']},\n   {$searchColumn['created']},\n   {$searchColumn['session']})\nSELECT CONCAT(media.{$mediaColumn['title']}, ' [{$albumText}', album.{$albumsColumn['title']}, ']'),\n       media.{$mediaColumn['description']},\n       'mediashare',\n       CONCAT(album.{$albumsColumn['id']}, ':', media.{$mediaColumn['id']}),\n       media.{$mediaColumn['createdDate']},\n       '{$sessionId}'\nFROM {$mediaTable} media\nINNER JOIN {$albumsTable} album\n      ON album.{$albumsColumn['id']} = media.{$mediaColumn['parentAlbumId']}\nWHERE ({$accessibleAlbumSql}) AND ";
    $sql .= search_construct_where($args, array("media.{$mediaColumn['title']}", "media.{$mediaColumn['description']}", "media.{$mediaColumn['keywords']}"));
    $dbresult = DBUtil::executeSQL($sql);
    if (!$dbresult) {
        return LogUtil::registerError(__('Error! Could not load items.', $dom));
    }
    return true;
}
开发者ID:ro0f,项目名称:Mediashare,代码行数:24,代码来源:pnsearchapi.php


示例19: smarty_function_mediashare_itemSelector

function smarty_function_mediashare_itemSelector($params, &$smarty)
{
    $dom = ZLanguage::getModuleDomain('mediashare');
    if (!isset($params['albumId'])) {
        $smarty->trigger_error(__f('Missing [%1$s] in \'%2$s\'', array('albumId', 'mediashare_albumSelector'), $dom));
        return false;
    }
    $albumId = $params['albumId'];
    $mediaId = $params['mediaId'];
    $items = pnModAPIFunc('mediashare', 'user', 'getMediaItems', array('albumId' => $albumId));
    if ($items === false) {
        return false;
    }
    if ($mediaId == 0 && count($items) > 0 && isset($params['fetchSelectedInto'])) {
        $mediaId = $items[0]['id'];
        $mediaItem = pnModAPIFunc('mediashare', 'user', 'getMediaItem', array('mediaId' => $mediaId));
        $smarty->assign($params['fetchSelectedInto'], $mediaItem);
    }
    if (isset($params['onchange'])) {
        $onChangeHtml = " onchange=\"{$params['onchange']}\"";
    } else {
        $onChangeHtml = '';
    }
    $html = "<select name=\"mid\"{$onChangeHtml}>\n";
    foreach ($items as $item) {
        $title = $item['title'];
        $id = (int) $item['id'];
        $selectedHtml = $id == $mediaId ? ' selected="selected"' : '';
        $html .= "<option value=\"{$id}\"{$selectedHtml}>{$title}</option>\n";
    }
    $html .= "</select>";
    if (isset($params['assign'])) {
        $smarty->assign($params['assign'], $html);
    }
    return $html;
}
开发者ID:ro0f,项目名称:Mediashare,代码行数:36,代码来源:function.mediashare_itemSelector.php


示例20: decode

 function decode(&$render)
 {
     $dom = ZLanguage::getModuleDomain('mediashare');
     $this->clearValidation($render);
     $value = FormUtil::getPassedValue($this->inputName, null, 'POST');
     $albumId = FormUtil::getPassedValue("{$this->inputName}_album", null, 'POST');
     $newAlbum = FormUtil::getPassedValue("{$this->inputName}_newalbum", null, 'POST');
     if (!empty($newAlbum)) {
         if (mediashareAccessAlbum($albumId, mediashareAccessRequirementAddAlbum, '')) {
             $newAlbumID = pnModAPIFunc('mediashare', 'edit', 'addAlbum', array('title' => $newAlbum, 'keywords' => '', 'summary' => '', 'description' => '', 'template' => null, 'parentAlbumId' => $albumId));
             if ($newAlbumID === false) {
                 $this->setError(LogUtil::getErrorMessagesText());
             } else {
                 $albumId = $newAlbumID;
             }
         } else {
             $this->setError(__('You do not have access to this feature', $dom));
         }
     }
     $file = isset($_FILES["{$this->inputName}_upload"]) ? $_FILES["{$this->inputName}_upload"] : null;
     if (!empty($file) && $file['error'] == 0) {
         if (mediashareAccessAlbum($albumId, mediashareAccessRequirementAddMedia, '')) {
             $result = pnModAPIFunc('mediashare', 'source_browser', 'addMediaItem', array('albumId' => $albumId, 'uploadFilename' => $file['tmp_name'], 'fileSize' => $file['size'], 'filename' => $file['name'], 'mimeType' => $file['type'], 'title' => null, 'keywords' => null, 'description' => null, 'width' => 0, 'height' => 0));
             if ($result === false) {
                 $this->setError(LogUtil::getErrorMessagesText());
             } else {
                 $value = $result['mediaId'];
             }
         } else {
             $this->setError(__('You do not have access to this feature', $dom));
         }
     }
     $this->selectedItemId = $value;
 }
开发者ID:ro0f,项目名称:Mediashare,代码行数:34,代码来源:function.mediashareitemselector.php



注:本文中的pnModAPIFunc函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP pnModGetIDFromName函数代码示例发布时间:2022-05-15
下一篇:
PHP pnDBGetTables函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap