Пример #1
0
 function ajax_loadeditor()
 {
     $attachment_types = array();
     h2_execute_event('publish_attachments_register', $attachment_types);
     foreach ($attachment_types as $att) {
         $id = md5($att['editor']);
         if ($_REQUEST['id'] == $id) {
             $editorFile = 'plugins/' . $att['editor'];
             if (file_exists($editorFile)) {
                 include $editorFile;
             } else {
                 print h2_uibanner('Editor not found: ' . $att['caption']);
             }
         }
     }
 }
Пример #2
0
  function setUsername($username)
	{
	  $userObj = object('user');
	  
	  $userObj->isNewUser = $this->ds['u_entity'] == 0;
	  $userObj->server = new HubbubServer(cfg('service/server'), true);
		$userObj->loadEntity();
		
		$userObj->entityDS['user'] = safename($username);
		$userObj->entityDS['url'] = getDefault($userObj->entityDS['url'], cfg('service/server').'/'.(cfg('service/url_rewrite') ? '' : '?').$username);
		$userObj->entityDS['_local'] = 'Y';
		$userObj->entityDS['_serverkey'] = $userObj->server->ds['s_key'];
		$userObj->entityDS['server'] = cfg('service/server');
		
		if(trim($userObj->entityDS['user']) != '') $ekey = DB_UpdateDataset('entities', $userObj->entityDS);
		$userObj->ds['u_entity'] = $ekey;
		
		if(trim($userObj->ds['u_name']) != '') DB_UpdateDataset('users', $userObj->ds);
    if($userObj->isNewUser) h2_execute_event('user_new', $userObj->entityDS, $userObj->ds);
	}
Пример #3
0
 /**
  * Execute message event handler
  * @param string $event
  * @param array $opt [optional]
  * @return false if not handled
  */
 function executeHandler($event, $opt = array())
 {
     $result = false;
     $handlerFile = 'msg/' . $this->type . '.php';
     $handlerFunc = $this->type . '_' . $event;
     h2_execute_event($this->type . '_' . $event . '_init', $this->data, $this, $result);
     if (!is_callable($handlerFunc) && file_exists($handlerFile)) {
         include_once $handlerFile;
     }
     if (is_callable($handlerFunc)) {
         $result = $handlerFunc($this->data, $this, $opt);
     }
     h2_execute_event($this->type . '_' . $event, $this->data, $this, $result);
     return $result;
 }
Пример #4
0
<?

$attachment_types = array();
h2_execute_event('publish_attachments_register', $attachment_types);

?>
<div id="publisher">
	
	<table width="100%">
		<tr>
      <td rowspan="2" valign="top" width="500">
        <textarea style="width: 500px;" id="publish_text"></textarea>      	
      </td>
      <td valign="top" width="*" colspan="2">
        <input type="button" value="Share" onclick="do_publish();"/>
        <? if(sizeof($attachment_types) > 0) { ?>
        <select style="padding: 4px;" onchange="loadAttachmentEditor($(this).val());">
          <option value="">▼ Attachment</option>
          <?
          foreach($attachment_types as $att)
          {
            ?><option value="<?php 
echo md5($att['editor']);
?>
"><?php 
echo htmlspecialchars($att['caption']);
?>
</option><? 
          }          
          ?>
        </select>
Пример #5
0
function tmpl_postlist($list, $withContainer = false)
{
  if($withContainer) { ?><div id="postlist"><? 
    #$GLOBALS['subcat']['view.opt'][] = array('caption' => l10n('post.pile-up'), 'url' => actionUrl($_REQUEST['action'], $_REQUEST['controller'], array('view' => 'pileup'))); 
    #$GLOBALS['subcat']['view.opt'][] = array('caption' => l10n('post.list'), 'url' => actionUrl($_REQUEST['action'], $_REQUEST['controller'], array('view' => 'list'))); 
  }

  if(sizeof($list['list'])>0) foreach($list['list'] as $ds)
	{
		$data = HubbubMessage::unpackData($ds);
		$typeFunction = 'dyn_type_'.$ds['m_type'];
		if(!is_callable($typeFunction)) $typeFunction = 'tmpl_type_notsupported';
		if($list['blurp_entity'] && $ds['m_owner'] != $list['blurp_entity']) $typeFunction = 'dyn_foreign_post_blurp';
		ob_start();
    if(!is_callable($typeFunction)) 
    {
      if(isset($GLOBALS['config']['plugins']['show_'.$ds['m_type']]))
      {
        ?><div class="post msg_<?php 
echo $ds['m_type'];
?>
" id="post_<?php 
echo $ds['m_key'];
?>
"><?
        h2_execute_event('show_'.$ds['m_type'], $data, $ds);
        ?></div><?
      }
      else print('<div class="banner">Cannot display message type: '.$ds['m_type'].'</div>');
    }
    else 
    {
      $flags = array();
      if(isset($GLOBALS['config']['plugins']['display_'.$ds['m_type']]))
        h2_execute_event('display_'.$ds['m_type'], $data, $ds, $flags);
      $typeFunction($data, $ds, $flags);
    }
    $content = ob_get_clean();
    if(trim($content) != '') print('<div class="dynamic_box post_item post_type_'.$ds['m_type'].'">'.$content.'</div>');
	}

  if($withContainer) { ?></div><script>
    $(window).load(function(){
      $('#postlist').masonry({
        animate: true,
        columnWidth: <?php 
echo CSS_COL_QUANTUM;
?>
,
      });
    });
    
    function post_reflow()
    {
      $('#postlist').masonry({
        animate: true,
      }).masonry({
        animate: true,
        columnWidth: <?php 
echo CSS_COL_QUANTUM;
?>
,
      });
    }
  </script><? }
}