当前位置: 首页>>代码示例>>PHP>>正文


PHP Jaws_XSS::filter方法代码示例

本文整理汇总了PHP中Jaws_XSS::filter方法的典型用法代码示例。如果您正苦于以下问题:PHP Jaws_XSS::filter方法的具体用法?PHP Jaws_XSS::filter怎么用?PHP Jaws_XSS::filter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Jaws_XSS的用法示例。


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

示例1: ShowNoPermission

 /**
  * Builds the NoPermission UI
  *
  * @access  public
  * @param   string  $user    Username
  * @param   string  $gadget  The Gadget user is requesting
  * @param   string  $action  The 'denied' action
  * @return  string  XHTML content
  */
 function ShowNoPermission($user, $gadget, $action)
 {
     // Load the template
     $tpl = $this->gadget->template->load('NoPermission.html');
     $tpl->SetBlock('NoPermission');
     $tpl->SetVariable('nopermission', _t('USERS_NO_PERMISSION_TITLE'));
     $tpl->SetVariable('description', _t('USERS_NO_PERMISSION_DESC', $gadget, $action));
     $tpl->SetVariable('admin_script', BASE_SCRIPT);
     $tpl->SetVariable('site-name', $this->gadget->registry->fetch('site_name', 'Settings'));
     $tpl->SetVariable('site-slogan', $this->gadget->registry->fetch('site_slogan', 'Settings'));
     $tpl->SetVariable('BASE_URL', $GLOBALS['app']->GetSiteURL('/'));
     $tpl->SetVariable('.dir', _t('GLOBAL_LANG_DIRECTION') == 'rtl' ? '.rtl' : '');
     if ($GLOBALS['app']->Session->Logged()) {
         $tpl->SetBlock('NoPermission/known');
         $logoutLink = $this->gadget->urlMap('Logout');
         $referLink = empty($_SERVER['HTTP_REFERER']) ? $GLOBALS['app']->getSiteURL('/') : Jaws_XSS::filter($_SERVER['HTTP_REFERER']);
         $tpl->SetVariable('known_description', _t('USERS_NO_PERMISSION_KNOWN_DESC', $logoutLink, $referLink));
         $tpl->ParseBlock('NoPermission/known');
     } else {
         $tpl->SetBlock('NoPermission/anon');
         $loginLink = $this->gadget->urlMap('LoginBox', array('referrer' => bin2hex(Jaws_Utils::getRequestURL(false))));
         $referLink = empty($_SERVER['HTTP_REFERER']) ? $GLOBALS['app']->getSiteURL('/') : Jaws_XSS::filter($_SERVER['HTTP_REFERER']);
         $tpl->SetVariable('anon_description', _t('USERS_NO_PERMISSION_ANON_DESC', $loginLink, $referLink));
         $tpl->ParseBlock('NoPermission/anon');
     }
     $tpl->ParseBlock('NoPermission');
     return $tpl->Get();
 }
开发者ID:juniortux,项目名称:jaws,代码行数:37,代码来源:Default.php

示例2: GetDirectory

 /**
  * Creates and returns some data
  *
  * @access  public
  * @param   string  $dir
  * @param   int     $offset
  * @param   int     $order
  * @return  array   directory tree array
  */
 function GetDirectory($dir, $offset, $order)
 {
     $model = $this->gadget->model->load('Directory');
     $files = $model->ReadDir($dir, 15, $offset, $order);
     if (Jaws_Error::IsError($files)) {
         return array();
         //Jaws_Error::Fatal($files->getMessage(), __FILE__, __LINE__);
     }
     $tree = array();
     foreach ($files as $file) {
         $item = array();
         //Icon
         $link =& Piwi::CreateWidget('Image', $file['mini_icon']);
         $item['image'] = $link->Get();
         //Title
         $item['title'] = $file['title'];
         $actions = '';
         if ($file['is_dir']) {
             $link =& Piwi::CreateWidget('Link', $file['filename'], "javascript: cwd('{$file['relative']}');");
             $link->setStyle('float: left;');
             $item['name'] = $link->Get();
             if ($this->gadget->GetPermission('ManageDirectories')) {
                 //edit directory properties
                 $link =& Piwi::CreateWidget('Link', _t('GLOBAL_EDIT'), "javascript: editDir(this, '{$file['filename']}');", STOCK_EDIT);
                 $actions .= $link->Get() . ' ';
                 //delete directory
                 $link =& Piwi::CreateWidget('Link', _t('GLOBAL_DELETE'), "javascript: delDir(this, '{$file['filename']}');", STOCK_DELETE);
                 $actions .= $link->Get() . ' ';
             }
         } else {
             if (empty($file['id'])) {
                 $furl = Jaws_XSS::filter($file['url']);
             } else {
                 $fid = empty($file['fast_url']) ? $file['id'] : Jaws_XSS::filter($file['fast_url']);
                 $furl = $this->gadget->urlMap('Download', array('id' => $fid));
             }
             $link =& Piwi::CreateWidget('Link', $file['filename'], $furl);
             $link->setStyle('float: left;');
             $item['name'] = $link->Get();
             if ($this->gadget->GetPermission('ManageFiles')) {
                 //edit file properties
                 $link =& Piwi::CreateWidget('Link', _t('GLOBAL_EDIT'), "javascript: editFile(this, '{$file['filename']}');", STOCK_EDIT);
                 $actions .= $link->Get() . ' ';
                 //delete file
                 $link =& Piwi::CreateWidget('Link', _t('GLOBAL_DELETE'), "javascript: delFile(this, '{$file['filename']}');", STOCK_DELETE);
                 $actions .= $link->Get() . ' ';
             }
         }
         $item['size'] = $file['size'];
         $item['hits'] = $file['hits'];
         $item['actions'] = $actions;
         $tree[] = $item;
     }
     return $tree;
 }
开发者ID:juniortux,项目名称:jaws,代码行数:64,代码来源:Directory.php

示例3: IsAgentBlocked

 /**
  * Checks the Agent is blocked or not
  *
  * @access  public
  * @param   string  $agent  Agent
  * @return  bool    True if the Agent is blocked
  */
 function IsAgentBlocked($agent)
 {
     $table = Jaws_ORM::getInstance()->table('policy_agentblock');
     $table->select('blocked:boolean');
     $table->where('agent', Jaws_XSS::filter($agent));
     $blocked = $table->fetchOne();
     if (!Jaws_Error::IsError($blocked) && !is_null($blocked)) {
         return $blocked;
     }
     return $this->gadget->registry->fetch('block_undefined_agent') == 'true';
 }
开发者ID:Dulciane,项目名称:jaws,代码行数:18,代码来源:Agent.php

示例4: AssignData

 /**
  * Fetch WWW-Authentication data
  *
  * @access  public
  * @return  void
  */
 function AssignData()
 {
     if (!empty($_SERVER['PHP_AUTH_USER'])) {
         $this->username = Jaws_XSS::filter($_SERVER['PHP_AUTH_USER']);
     }
     if (!empty($_SERVER['PHP_AUTH_PW'])) {
         $this->password = Jaws_XSS::filter($_SERVER['PHP_AUTH_PW']);
     }
     //Try to get authentication information from IIS
     if (empty($this->username) && empty($this->password) && !empty($_SERVER['HTTP_AUTHORIZATION'])) {
         list($this->username, $this->password) = explode(':', base64_decode(substr($this->server['HTTP_AUTHORIZATION'], 6)));
     }
 }
开发者ID:juniortux,项目名称:jaws,代码行数:19,代码来源:HTTPAuth.php

示例5: NewFriend

 /**
  * Create a new Friend
  *
  * @access  public
  * @param   string  $friend Friend name
  * @param   string  $url    Friend's url
  * @return  mixed   True if query is successful, if not, returns Jaws_Error on any error
  */
 function NewFriend($friend, $url)
 {
     $params['friend'] = Jaws_XSS::filter($friend);
     $params['url'] = Jaws_XSS::filter($url);
     $friendTable = Jaws_ORM::getInstance()->table('friend');
     $result = $friendTable->insert($params)->exec();
     if (Jaws_Error::IsError($result)) {
         $GLOBALS['app']->Session->PushLastResponse(_t('FRIENDS_ERROR_NOT_ADDED'), RESPONSE_ERROR);
         return new Jaws_Error(_t('FRIENDS_ERROR_NOT_ADDED'));
     }
     $GLOBALS['app']->Session->PushLastResponse(_t('FRIENDS_ADDED'), RESPONSE_NOTICE);
     return true;
 }
开发者ID:juniortux,项目名称:jaws,代码行数:21,代码来源:Friends.php

示例6: InsertLog

 /**
  * Inserts a Log
  *
  * @access  public
  * @param   string  $gadget     Gadget name
  * @param   string  $action     Action name
  * @param   int     $priority   Priority of log
  * @param   array   $params     Action parameters
  * @param   int     $status     Status code
  * @return  mixed   Log identity or Jaws_Error on failure
  */
 function InsertLog($user, $gadget, $action, $priority = 0, $params = null, $status = 200)
 {
     // ip address
     $ip = 0;
     if (preg_match('/\\b(?:\\d{1,3}\\.){3}\\d{1,3}\\b/', $_SERVER['REMOTE_ADDR'])) {
         $ip = ip2long($_SERVER['REMOTE_ADDR']);
         $ip = $ip < 0 ? $ip + 0xffffffff + 1 : $ip;
     }
     // agent
     $agent = substr(Jaws_XSS::filter($_SERVER['HTTP_USER_AGENT']), 0, 252);
     $logsTable = Jaws_ORM::getInstance()->table('logs');
     $logsTable->insert(array('user' => (int) $user, 'gadget' => $gadget, 'action' => $action, 'priority' => $priority, 'params' => $params, 'apptype' => JAWS_APPTYPE, 'backend' => JAWS_SCRIPT == 'admin', 'ip' => $ip, 'agent' => $agent, 'status' => (int) $status, 'insert_time' => time()));
     return $logsTable->exec();
 }
开发者ID:Dulciane,项目名称:jaws,代码行数:25,代码来源:Logs.php

示例7: Display

 /**
  * Creates and prints the template of Friends
  *
  * @access  public
  * @return  string  XHTML template content
  */
 function Display()
 {
     $tpl = $this->gadget->template->load('Friends.html');
     $model = $this->gadget->model->load('Friends');
     $friends = $model->GetRandomFriends();
     if (!Jaws_Error::IsError($friends)) {
         $tpl->SetBlock('friends');
         $tpl->SetVariable('title', $this->gadget->title);
         foreach ($friends as $friend) {
             $tpl->SetBlock('friends/friend');
             $tpl->SetVariable('name', Jaws_XSS::filter($friend['friend']));
             $tpl->SetVariable('url', Jaws_XSS::filter($friend['url']));
             $tpl->ParseBlock('friends/friend');
         }
     }
     $tpl->ParseBlock('friends');
     return $tpl->Get();
 }
开发者ID:juniortux,项目名称:jaws,代码行数:24,代码来源:Friends.php

示例8: InitialFolder

 /**
  * Prints all the files with their titles and contents of initial folder
  *
  * @access  public
  * @param   string  $path
  * @return  string  XHTML template content with titles and contents
  */
 function InitialFolder($path = '')
 {
     if (!$this->gadget->GetPermission('OutputAccess')) {
         return false;
     }
     if ($this->gadget->registry->fetch('frontend_avail') != 'true') {
         return false;
     }
     $tpl = $this->gadget->template->load('FileBrowser.html');
     $tpl->SetBlock('initial_folder');
     $tpl->SetVariable('title', $this->gadget->title);
     $model = $this->gadget->model->load('Directory');
     $items = $model->ReadDir($path);
     if (!Jaws_Error::IsError($items)) {
         foreach ($items as $item) {
             $tpl->SetBlock('initial_folder/item');
             $tpl->SetVariable('icon', $item['mini_icon']);
             $tpl->SetVariable('name', Jaws_XSS::filter($item['filename']));
             $tpl->SetVariable('title', Jaws_XSS::filter($item['title']));
             if ($item['is_dir']) {
                 $relative = Jaws_XSS::filter($item['relative']) . '/';
                 $url = $this->gadget->urlMap('Display', array('path' => $relative));
             } else {
                 if (empty($item['id'])) {
                     $url = Jaws_XSS::filter($item['url']);
                 } else {
                     $fid = empty($item['fast_url']) ? $item['id'] : Jaws_XSS::filter($item['fast_url']);
                     $url = $this->gadget->urlMap('Download', array('id' => $fid));
                 }
             }
             $tpl->SetVariable('url', $url);
             $tpl->ParseBlock('initial_folder/item');
         }
     }
     $tpl->ParseBlock('initial_folder');
     return $tpl->Get();
 }
开发者ID:Dulciane,项目名称:jaws,代码行数:44,代码来源:Directory.php

示例9: Prepare

 /**
  * The preg_replace call back function
  *
  * @access  private
  * @param   string  $matches    Matched strings from preg_replace_callback
  * @return  string  Gadget action output
  */
 function Prepare($matches)
 {
     $matches[1] = Jaws_XSS::filter($matches[1]);
     $gadget = ucfirst(strtolower($matches[1]));
     if ($gadget == 'Staticpage' || $gadget == 'Page') {
         $gadget = 'StaticPage';
     }
     $link = Jaws_XSS::filter($matches[2]);
     $linkText = isset($matches[3]) ? $matches[3] : $linkText;
     switch ($gadget) {
         case 'Blog':
             $mapURL = $GLOBALS['app']->Map->GetURLFor('Blog', 'SingleView', array('id' => $link));
             break;
         case 'Phoo':
             $mapURL = $GLOBALS['app']->Map->GetURLFor('Phoo', 'ViewAlbum', array('id' => $link));
             break;
         case 'StaticPage':
             $mapURL = $GLOBALS['app']->Map->GetURLFor('StaticPage', 'Page', array('id' => $link));
             break;
     }
     $text = '<a href="' . $mapURL . '">' . $linkText . '</a>';
     return $text;
 }
开发者ID:juniortux,项目名称:jaws,代码行数:30,代码来源:Plugin.php

示例10: metaWeblog_getCategories

/**
 * metaWeblog.getCategories
 *
 * @access  public
 * @param   array   $params     array of params
 * @return  XML_RPC_Response object
 */
function metaWeblog_getCategories($params)
{
    $blog = getScalarValue($params, 0);
    // blog gadget only supports 1 blog, so this parameter is not used.
    $user = getScalarValue($params, 1);
    $password = getScalarValue($params, 2);
    $userInfo = userAuthentication($user, $password);
    if (Jaws_Error::IsError($userInfo)) {
        return new XML_RPC_Response(0, $GLOBALS['XML_RPC_erruser'] + 4, _t('GLOBAL_ERROR_LOGIN_WRONG'));
    }
    if (!GetBlogPermission($user, 'default_admin')) {
        return new XML_RPC_Response(0, $GLOBALS['XML_RPC_erruser'] + 3, $categories->GetMessage());
    }
    $model = Jaws_Gadget::getInstance('Blog')->model->load('Categories');
    if (Jaws_Error::isError($model)) {
        return new XML_RPC_Response(0, $GLOBALS['XML_RPC_erruser'] + 2, $model->GetMessage());
    }
    $categories = $model->GetCategories();
    if (Jaws_Error::IsError($categories)) {
        return new XML_RPC_Response(0, $GLOBALS['XML_RPC_erruser'] + 2, $categories->GetMessage());
    }
    $struct = array();
    foreach ($categories as $category) {
        $cid = empty($category['fast_url']) ? $category['id'] : Jaws_XSS::filter($category['fast_url']);
        $htmlurl = $GLOBALS['app']->Map->GetURLFor('Blog', 'ShowCategory', array('id' => $cid));
        $rssurl = $GLOBALS['app']->Map->GetURLFor('Blog', 'ShowRSSCategory', array('id' => $category['id']));
        $data = array('categoryId' => new XML_RPC_Value($category['id']), 'categoryName' => new XML_RPC_Value($category['name']), 'title' => new XML_RPC_Value($category['name']), 'description' => new XML_RPC_Value($category['description']), 'htmlUrl' => new XML_RPC_Value($htmlurl), 'rssUrl' => new XML_RPC_Value($rssurl));
        $struct[] = new XML_RPC_Value($data, 'struct');
    }
    $val = new XML_RPC_Value($struct, 'array');
    return new XML_RPC_Response($val);
}
开发者ID:juniortux,项目名称:jaws,代码行数:39,代码来源:XmlRpc.php

示例11: QuotesByGroup

 /**
  * Displays quotes by group in standalone mode
  *
  * @access  public
  * @return  XHTML template content
  */
 function QuotesByGroup()
 {
     header(Jaws_XSS::filter($_SERVER['SERVER_PROTOCOL']) . " 200 OK");
     $action = $this->gadget->action->load('Groups');
     return $action->ViewGroupQuotes();
 }
开发者ID:Dulciane,项目名称:jaws,代码行数:12,代码来源:Quotes.php

示例12: insert

 /**
  * insert new session
  *
  * @access  public
  * @return  mixed   Session ID if success, otherwise Jaws_Error or false
  */
 function insert()
 {
     $max_active_sessions = (int) $GLOBALS['app']->Registry->fetch('max_active_sessions', 'Policy');
     if (!empty($max_active_sessions)) {
         $activeSessions = $this->GetSessionsCount(true);
         if ($activeSessions >= $max_active_sessions) {
             // remove expired session
             $this->DeleteExpiredSessions();
             $GLOBALS['app']->Session->Logout();
             Jaws_Error::Fatal(_t('GLOBAL_HTTP_ERROR_CONTENT_503_OVERLOAD'), 0, 503);
         }
     }
     // agent
     $agent = substr(Jaws_XSS::filter($_SERVER['HTTP_USER_AGENT']), 0, 252);
     // ip
     $ip = 0;
     if (preg_match('/\\b(?:\\d{1,3}\\.){3}\\d{1,3}\\b/', $_SERVER['REMOTE_ADDR'])) {
         $ip = ip2long($_SERVER['REMOTE_ADDR']);
         $ip = $ip < 0 ? $ip + 0xffffffff + 1 : $ip;
     }
     // referrer
     $referrer = Jaws_Utils::getHostReferrer();
     $sessTable = Jaws_ORM::getInstance()->table('session', '', 'sid');
     if (!empty($GLOBALS['app']->Session->_Attributes)) {
         //A new session, we insert it to the DB
         $updatetime = time();
         $user = $GLOBALS['app']->Session->GetAttribute('user');
         $serialized = serialize($GLOBALS['app']->Session->_Attributes);
         $sessTable->insert(array('user' => $user, 'type' => JAWS_APPTYPE, 'longevity' => $GLOBALS['app']->Session->GetAttribute('longevity'), 'data' => $serialized, 'referrer' => md5($referrer), 'checksum' => md5($user . $serialized), 'ip' => $ip, 'agent' => $agent, 'createtime' => $updatetime, 'updatetime' => $updatetime));
         $result = $sessTable->exec();
         if (!Jaws_Error::IsError($result)) {
             return $result;
         }
     }
     return false;
 }
开发者ID:juniortux,项目名称:jaws,代码行数:42,代码来源:Session.php

示例13: GetCategoryAtomStruct

 /**
  * Create ATOM struct of a given category
  *
  * @access  public
  * @param   int     $category   Category ID
  * @param   string  $feed_type  OPTIONAL feed type
  * @return  mixed   Can return the Atom Object or Jaws_Error on error
  */
 function GetCategoryAtomStruct($category, $feed_type = 'atom')
 {
     $model = $this->gadget->model->load('Categories');
     $catInfo = $model->GetCategory($category);
     if (Jaws_Error::IsError($catInfo)) {
         return new Jaws_Error(_t('BLOG_ERROR_GETTING_CATEGORIES_ATOMSTRUCT'));
     }
     $now = Jaws_DB::getInstance()->date();
     $blogTable = Jaws_ORM::getInstance()->table('blog');
     $blogTable->select('blog.id:integer', 'user_id:integer', 'blog_entrycat.category_id:integer', 'username', 'email', 'nickname', 'title', 'fast_url', 'summary', 'text', 'blog.publishtime', 'blog.updatetime', 'clicks:integer', 'comments:integer', 'allow_comments:boolean', 'published:boolean')->join('users', 'blog.user_id', 'users.id')->join('blog_entrycat', 'blog.id', 'blog_entrycat.entry_id');
     $blogTable->where('published', true)->and()->where('blog.publishtime', $now, '<=');
     $blogTable->and()->where('blog_entrycat.category_id', $catInfo['id']);
     $result = $blogTable->orderby('blog.publishtime desc')->fetchAll();
     if (Jaws_Error::IsError($result)) {
         return new Jaws_Error(_t('BLOG_ERROR_GETTING_CATEGORIES_ATOMSTRUCT'));
     }
     $cid = empty($catInfo['fast_url']) ? $catInfo['id'] : Jaws_XSS::filter($catInfo['fast_url']);
     $categoryAtom = new Jaws_AtomFeed();
     $siteURL = $GLOBALS['app']->GetSiteURL('/');
     $url = $this->gadget->urlMap($feed_type == 'atom' ? 'ShowAtomCategory' : 'ShowRSSCategory', array('id' => $cid), true);
     $categoryAtom->SetTitle($this->gadget->registry->fetch('site_name', 'Settings'));
     $categoryAtom->SetLink($url);
     $categoryAtom->SetId($siteURL);
     $categoryAtom->SetTagLine($catInfo['name']);
     $categoryAtom->SetAuthor($this->gadget->registry->fetch('site_author', 'Settings'), $siteURL, $this->gadget->registry->fetch('gate_email', 'Settings'));
     $categoryAtom->SetGenerator('JAWS ' . $GLOBALS['app']->Registry->fetch('version'));
     $categoryAtom->SetCopyright($this->gadget->registry->fetch('site_copyright', 'Settings'));
     $objDate = Jaws_Date::getInstance();
     foreach ($result as $r) {
         $entry = new AtomEntry();
         $entry->SetTitle($r['title']);
         $post_id = empty($r['fast_url']) ? $r['id'] : $r['fast_url'];
         $url = $this->gadget->urlMap('SingleView', array('id' => $post_id), true);
         $entry->SetLink($url);
         $entry->SetId($url);
         $summary = $r['summary'];
         $text = $r['text'];
         // for compatibility with old versions
         $more_pos = Jaws_UTF8::strpos($text, '[more]');
         if ($more_pos !== false) {
             $summary = Jaws_UTF8::substr($text, 0, $more_pos);
             $text = Jaws_UTF8::str_replace('[more]', '', $text);
             // Update this entry to split summary and body of post
             $model = $this->gadget->model->load('Posts');
             $model->SplitEntry($r['id'], $summary, $text);
         }
         $summary = empty($summary) ? $text : $summary;
         $summary = $this->gadget->ParseText($summary);
         $text = $this->gadget->ParseText($text);
         $entry->SetSummary($summary, 'html');
         $entry->SetContent($text, 'html');
         $email = $r['email'];
         $entry->SetAuthor($r['nickname'], $categoryAtom->Link->HRef, $email);
         $entry->SetPublished($objDate->ToISO($r['publishtime']));
         $entry->SetUpdated($objDate->ToISO($r['updatetime']));
         $categoryAtom->AddEntry($entry);
         if (!isset($last_modified)) {
             $last_modified = $r['updatetime'];
         }
     }
     if (isset($last_modified)) {
         $categoryAtom->SetUpdated($objDate->ToISO($last_modified));
     } else {
         $categoryAtom->SetUpdated($objDate->ToISO(date('Y-m-d H:i:s')));
     }
     return $categoryAtom;
 }
开发者ID:juniortux,项目名称:jaws,代码行数:75,代码来源:Feeds.php

示例14: Banners

 /**
  * Displays banners(all-time visibles and random ones)
  *
  * @access  public
  * @param   int     $gid    Group ID
  * @return  string  XHTML template content
  */
 function Banners($gid = 0)
 {
     $id = (int) $this->gadget->request->fetch('id', 'get');
     $abs_url = false;
     if (!empty($id)) {
         $gid = $id;
         header(Jaws_XSS::filter($_SERVER['SERVER_PROTOCOL']) . " 200 OK");
         $abs_url = true;
     }
     $groupModel = $this->gadget->model->load('Groups');
     $group = $groupModel->GetGroup($gid);
     if (Jaws_Error::IsError($group) || empty($group) || !$group['published']) {
         return false;
     }
     $bannerModel = $this->gadget->model->load('Banners');
     $banners = $bannerModel->GetVisibleBanners($gid, $group['limit_count']);
     if (Jaws_Error::IsError($banners) || empty($banners)) {
         return false;
     }
     $tpl = $this->gadget->template->load('Banners.html');
     switch ($group['show_type']) {
         case 1:
         case 2:
             $type_block = 'banners_type_' . $group['show_type'];
             break;
         default:
             $type_block = 'banners';
     }
     $tpl->SetBlock($type_block);
     $tpl->SetVariable('gid', $gid);
     if ($group['show_title']) {
         $tpl->SetBlock("{$type_block}/title");
         $tpl->SetVariable('title', _t('BANNER_ACTIONS_BANNERS_TITLE', $group['title']));
         $tpl->ParseBlock("{$type_block}/title");
     }
     foreach ($banners as $banner) {
         $tpl->SetBlock("{$type_block}/banner");
         $tpl_template = new Jaws_Template();
         $tpl_template->LoadFromString('<!-- BEGIN x -->' . $banner['template'] . '<!-- END x -->');
         $tpl_template->SetBlock('x');
         $tpl_template->SetVariable('title', $banner['title']);
         if (file_exists(JAWS_DATA . $this->gadget->DataDirectory . $banner['banner'])) {
             $tpl_template->SetVariable('banner', $GLOBALS['app']->getDataURL($this->gadget->DataDirectory . $banner['banner']));
         } else {
             $tpl_template->SetVariable('banner', $banner['banner']);
         }
         if (empty($banner['url'])) {
             $tpl_template->SetVariable('link', 'javascript:void(0);');
             $tpl_template->SetVariable('target', '_self');
         } else {
             $tpl_template->SetVariable('link', $this->gadget->urlMap('Click', array('id' => $banner['id']), $abs_url));
             $tpl_template->SetVariable('target', '_blank');
         }
         $tpl_template->ParseBlock('x');
         $tpl->SetVariable('template', $tpl_template->Get());
         unset($tpl_template);
         $tpl->ParseBlock("{$type_block}/banner");
         $bannerModel->ViewBanner($banner['id']);
     }
     $tpl->ParseBlock($type_block);
     return $tpl->Get();
 }
开发者ID:Dulciane,项目名称:jaws,代码行数:69,代码来源:Banners.php

示例15: GetAlbumCover

 /**
  * Search callback for the album
  *
  * @access  public
  * @param   array   $data   Album data(artist and album)
  * @return  string  XHTML album image
  */
 function GetAlbumCover($data)
 {
     $albumDir = JAWS_DATA . 'AlbumCover/';
     if (!isset($data[1]) || !isset($data[2]) || empty($data[1]) || empty($data[2])) {
         return '';
     }
     $Artist = $data[1];
     $Album = $data[2];
     $img = strtolower(str_replace(' ', '', $Artist)) . '_' . strtolower(str_replace(' ', '', $Album)) . '.jpg';
     ///FIXME needs error checking
     if (!($rs = is_file($albumDir . $img))) {
         $amazonImg = $this->GetAlbumCoverFromAmazon($Artist, $Album);
         if (empty($amazonImg)) {
             $img = 'images/unknown.png';
         } elseif (!@copy($amazonImg, $albumDir . $img)) {
             //FIXME: Notify that can't copy image to cache...
             $img = Jaws_XSS::filter($amazonImg);
         } else {
             $img = JAWS_DATA . 'AlbumCover/' . $img;
         }
     } else {
         $img = JAWS_DATA . 'AlbumCover/' . $img;
     }
     $text = $Artist . ' - ' . $Album;
     return '<img src="' . $img . '" alt="' . $text . '" title="' . $text . '" />';
 }
开发者ID:Dulciane,项目名称:jaws,代码行数:33,代码来源:Plugin.php


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