示例#1
0
 function onOpenIDLogin(&$openid)
 {
     $ids = DB_GetDataset('idaccounts', $openid->identity, 'ia_url');
     if (sizeof($ids) > 0) {
     } else {
         // new account
         $uds = array('u_name' => '');
         $ukey = DB_UpdateDataset('users', $uds);
         $ids = array('ia_type' => 'openid', 'ia_url' => $openid->identity, 'ia_user' => $this->user->id);
         DB_UpdateDataset('idaccounts', $ids);
     }
     $this->redirect('auth');
 }
示例#2
0
 function reset()
 {
     require_once 'lib/cq-forms.php';
     require_once 'lib/special-io.php';
     $this->uds = DB_GetDataset('idaccounts', $_REQUEST['i'], 'ia_recovery');
     $this->userFound = $this->uds['ia_user'] > 0;
     if ($this->userFound) {
         $this->usr = DB_GetDataset('users', $this->uds['ia_user']);
     } else {
         $this->skipView = true;
         print '<br/><br/>' . h2_uibanner(l10n('email.recovery.failload')) . '<br/>&gt; 
     <a href="' . actionUrl('index', 'signin') . '">' . l10n('cancel') . '</a>';
     }
 }
示例#3
0
 function ajax_comment()
 {
     access_policy('write');
     if (trim($_REQUEST['text']) != '' && $_REQUEST['pid'] > 0) {
         $parentMessage = DB_GetDataset('messages', $_REQUEST['pid']);
         $ds = $this->model->post(array('owner' => array('_key' => $parentMessage['m_owner']), 'author' => array('_key' => $this->user->entity), 'text' => $_REQUEST['text'], 'parent' => $parentMessage['m_id']));
         $comments = array('list' => array($ds));
         if (substr($_REQUEST['text'], 0, 1) != '#') {
             ob_start();
             tmpl_commentlist($parentMessage, $comments, false);
             $comment = ob_get_clean();
         }
         print json_encode(array('result' => 'OK', 'post' => $comment));
     }
 }
示例#4
0
<?

$ds = DB_GetDataset('messages', $_REQUEST['id']);
$data = HubbubMessage::unpackData($ds);

$data['created'] = $data['created'].' ('.gmdate('Y-m-d H:i:s', $data['created']).')';
$data['changed'] = $data['changed'].' ('.gmdate('Y-m-d H:i:s', $data['changed']).')';

?>
<h2>Inspect Message <?php 
echo $_REQUEST['id'];
?>
</h2>
<pre><?
  print('Message Data '); print_r($data);
  $ds['m_data'] = strlen($ds['m_data']).' bytes';
  print('Local Storage '); print_r($ds);
  ?></pre>
示例#5
0
  $post->save();

  tlog($post->ds['m_key'] > 0, 'post saved locally', 'OK (#'.$post->ds['m_id'].')', 'fail');  

	$streamPosts1 = $this->msg->getStream($ne2->key());
  foreach($streamPosts1['list'] as $pds)
    if($pds['m_id'] == $post->data['msgid']) $matchDS7 = $pds;
  tlog(is_array($matchDS7), 'post in stream', 'OK (#'.$post->ds['m_key'].')', 'fail');  
  $textData = HubbubMessage::unpackData($matchDS);
  tlog($matchDS7['text'] == $textData['text'], 'post in stream is valid', 'OK (#'.$post->ds['m_key'].')', 'fail');  

  $post->markChanged(time()+$ctr++);
  $post->executeHandler('delete');
  
  tlog($post->data['deleted'] == 'yes', '"deleted" property set', 'OK', 'fail');  
  $mds = DB_GetDataset('messages', $post->ds['m_key']);
  $textData = HubbubMessage::unpackData($mds);
  tlog($mds['m_deleted'] == 'Y', 'm_deleted in DB', 'OK (#'.$mds['m_key'].')', 'fail');  
  tlog($textData['deleted'] == 'yes', 'deleted in record', 'OK (#'.$mds['m_key'].')', 'fail');  
  
	$streamPosts1 = $this->msg->getStream($ne2->key());
	$wallPosts1 = $this->msg->getPostList($ne1->key());
  $postFound9 = -1; $postFound10 = -1;
  foreach($streamPosts1['list'] as $pds)
    if($pds['m_id'] == $post->data['msgid']) $postFound9 = $pds['m_id']; 
  tlog($postFound9 == -1, 'Message gone from author stream', 'OK', 'fail (#'.$postFound9.')');
	foreach($wallPosts1['list'] as $pds)
	  if($pds['m_id'] == $post->data['msgid']) $postFound10 = $pds['m_id']; 
	tlog($postFound10 == -1, 'Message gone from owner profile', 'OK', 'fail ('.$postFound10.')');  

  $post = new HubbubMessage('post');
示例#6
0
    </div>
    <br/>
    
    <?
    
    $form = new CQForm('pwrecovery', array('auto-focus' => true));
    $form
      ->add('password', 'new_pwd', array('onvalidate' => function($value, $e, $form) { 
          $form->pwd = trim($value);
          if(strlen($form->pwd) < 5) return(l10n('email.password.tooshort')); else return(true);
        }))
      ->add('param', 'i', $_REQUEST['i'])
      ->add('submit', 'reset_pwd')
      ->ds($_REQUEST)
      ->receive(function($data, $form) {
          $uds = DB_GetDataset('idaccounts', $_REQUEST['i'], 'ia_recovery');
          $uds['ia_password'] = md5($uds['ia_url'].$form->pwd);
          $uds['ia_recovery'] = '';
          DB_UpdateDataset('idaccounts', $uds);
          object('user')->loginWithId($uds['ia_user']);
          print(l10n('email.password.reset').'<br/><br/><a href="'.actionUrl('index', 'home').'" class="btn">&gt; OK</a>');
          $form->hidden = true;
          })
      ->display();
        
    ?>
    
    </td>
  </tr>
</table>
示例#7
0
</a></h2>
    
    <br/>
    <div class="balloon">
      <?php 
echo l10n('email.recovery.balloon');
?>
    </div>
    <br/>
    
    <?
    
    $form = new CQForm('pwrecovery', array('auto-focus' => true));
    $form
      ->add('string', 'email_address', array('validate' => 'email', 'onvalidate' => function($data, $e, $form) { 
          $form->ads = DB_GetDataset('idaccounts', trim($data), 'ia_url');
          if($form->ads['ia_user'] > 0) 
            return(true); else return(l10n('email.notindb')); 
        }))
      ->add('submit', 'email_recover_instructions')
      ->ds($_REQUEST)
      ->receive(function($data, $form) {
          $form->hidden = true;
          send_mail($form->ads['ia_url'], 'email.recovery.php', $form->ads);
          print('<div class="banner">'.l10n('email.recovery.sent').'</div>');
        })
      ->display();
        
    ?>
    
    </td>
示例#8
0
文件: database.php 项目: hcopr/Hubbub
function DB_GetDataSetCached($tablename, $keyvalue, $keyname = '', $options = array())
{
    return cache_data($tablename . ':' . $keyvalue . ':' . $keyname, function () use($tablename, $keyvalue, $keyname, $options) {
        return DB_GetDataset($tablename, $keyvalue, $keyname, $options);
    });
}
示例#9
0
文件: hubbub2.php 项目: hcopr/Hubbub
 function __construct($serverUrl, $createIfNotExistant = false)
 {
     $this->url = trim(strtolower($serverUrl));
     $this->ds = DB_GetDataset('servers', $this->url, 's_url');
     if ($createIfNotExistant == true) {
         if (sizeof($this->ds) == 0) {
             $this->ds['s_url'] = $this->url;
             $this->ds['s_name'] = $this->url;
             $this->save();
         }
     }
 }