コード例 #1
0
ファイル: essence.php プロジェクト: ashliewebb/ashliewebb
/**
 *
 */
function dumpMedia($Media)
{
    if (!$Media) {
        echo "No results.\n";
        return;
    }
    $data = [];
    foreach ($Media as $key => $value) {
        if ($value) {
            $data[$key] = $value;
        }
    }
    dumpArray($data);
}
コード例 #2
0
ファイル: trust_sendkey1.php プロジェクト: hcopr/Hubbub
/**
 * On-receive event handler
 * 
 * Gets called when this server (A) receives a trust_sendkey1 message from another server (B).
 * Usually this means, server (B) wants to establish contact for the first time or it wants
 * to revoke its existing key. In both cases, the key can only be accepted when this server (A)
 * contacts server (B) to confirm the origin of the trust_sendkey1 message.
 * 
 * @param array $data
 * @param object $msg
 * @return boolean
 */
function trust_sendkey1_receive(&$data, &$msg)
{
    $data['mykey'] = trim($data['mykey']);
    $serverUrl = getDefault($data['author']['server']);
    if ($serverUrl == '') {
        $msg->fail('invalid server field in "author" array');
    }
    if ($data['mykey'] == '') {
        $msg->fail('"mykey" field missing');
    } else {
        // accept the new key (it's not confirmed yet)
        $server = new HubbubServer($serverUrl, true);
        $server->ds['s_newkey_out'] = $data['mykey'];
        $server->ds['s_key_in'] = getDefault($server->ds['s_key_in'], randomHashId());
        DB_UpdateField('servers', $server->ds['s_key'], 's_key_in', $server->ds['s_key_in']);
        logError('notrace', 'received temp outbound key: ' . $data['mykey'] . ' /// ' . dumpArray($server->ds));
        // now, get origin confirmation
        $confirmMsg = new HubbubMessage('trust_sendkey2');
        $confirmMsg->author($server->localEntity());
        $confirmMsg->owner($server->entity());
        $confirmMsg->data['mykey'] = $server->ds['s_key_in'];
        $responseData = $confirmMsg->sendtourl($server->ds['s_url'], $server->ds['s_newkey_out']);
        if ($responseData['result'] == 'OK') {
            /* we need to reload, because the server record might have changed in the meantime */
            $server = new HubbubServer($serverUrl, true);
            // okay, the remote server really sent the original message
            $server->ds['s_key_out'] = $server->ds['s_newkey_out'];
            $server->ds['s_status'] = 'OK';
            DB_UpdateField('servers', $server->ds['s_key'], 's_key_out', $data['mykey']);
            $msg->ok();
        } else {
            // this didn't work
            $server->ds['s_newkey_out'] = '';
            $msg->fail('unsuccessful trust_sendkey2: ' . $responseData['reason']);
        }
    }
    return true;
}
コード例 #3
0
ファイル: msg.model.php プロジェクト: hcopr/Hubbub
	function Post($p)
	{
		// posts and comments have the same basic structure: author, owner and text
		// if the author is also the owner, we do not need to send a foreign_post message
		if($p['author']['_key'] == $p['owner']['_key'])
		{
			$msg = $this->makePostMessage('post', $p);
			$msg->broadcast();
		}
		else
		{
      $msg = $this->makePostMessage('foreign_post', $p);
      WriteToFile('log/activity.log', $type.' sending: '.$msg->data['msgid'].' '.dumpArray($msg->data).chr(10));
      $res = $msg->sendToOwner();
      // if the post was accepted right away:
      if(sizeof($res['post']) > 0)
      {
        $msg->delete();
        $msg = new HubbubMessage();
        $msg->receive_single($res['post']);
      }
		}
		return($msg->ds);
	}  
コード例 #4
0
ファイル: genlib.php プロジェクト: hcopr/Hubbub
function logToFile($filename, $content, $clearfile = false)
{
    global $profiler_report, $profiler_time_start, $profiler_last;
    if ($clearfile) {
        @unlink($filename);
    }
    if (is_array($content)) {
        $content = dumpArray($content);
    }
    $uri = $_SERVER['REQUEST_URI'];
    if (stristr($uri, 'password') != '') {
        $uri = '***';
    }
    @WriteToFile($filename, $_SERVER['REMOTE_ADDR'] . ' ' . $_SERVER['HTTP_HOST'] . ' ' . $uri . ' ' . $_SESSION['uid'] . ' ' . session_id() . ' ' . date('Y-m-d H:i:s') . ' ' . profiler_microtime_diff(microtime(), $GLOBALS['profiler_start']) . '  ' . trim($content) . "\r\n");
}
コード例 #5
0
ファイル: exceptions.php プロジェクト: ivladdalvi/racktables
function printGenericException($e)
{
    header("HTTP/1.1 500 Internal Server Error");
    header('Content-Type: text/html; charset=UTF-8');
    echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">' . "\n";
    echo '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">' . "\n";
    echo "<head><title> Exception </title>\n";
    echo "<link rel=stylesheet type='text/css' href='?module=chrome&uri=css/pi.css' />\n";
    echo "<link rel=icon href='?module=chrome&uri=pix/favicon.ico' type='image/x-icon' />\n";
    echo '</head> <body>';
    echo '<h2>Uncaught exception: ' . get_class($e) . '</h2><code>' . $e->getMessage() . '</code> (<code>' . $e->getCode() . '</code>)';
    echo '<p>at file <code>' . $e->getFile() . '</code>, line <code>' . $e->getLine() . '</code></p><pre>';
    echo stringTrace($e->getTrace());
    echo '</pre>';
    echo '<h2>Parameters:</h2>';
    echo '<h3>GET</h3>';
    dumpArray($_GET);
    echo '<h3>POST</h3>';
    dumpArray($_POST);
    echo '<h3>COOKIE</h3>';
    dumpArray($_COOKIE);
    echo '</body></html>';
}
コード例 #6
0
ファイル: errorDetail.php プロジェクト: vallejos/samples
                $celsSupported[] = "{$devUA}";
            } else {
                $celsNotSupported[] = "{$devUA}";
            }
        }
    }
}
switch ($detailType) {
    case "celstigo":
        $title = "LISTA TOTAL DE DEVICES TIGO PARAGUAY";
        $arrayToShow = $uaTigo;
        break;
    case "notfound":
        $title = "LISTA DE DEVICES NO ENCONTRADOS PARA EL CONTENIDO {$gameId}";
        $arrayToShow = $celsNotFound;
        break;
    case "supported":
        $title = "LISTA DE DEVICES ENCONTRADOS Y <b>SOPORTADOS</b> POR EL CONTENIDO {$gameId}";
        $arrayToShow = $celsSupported;
        break;
    case "notsupported":
        $title = "LISTA DE DEVICES ENCONTRADOS Y <b>NO SOPORTADOS</b> POR EL CONTENIDO {$gameId}";
        $arrayToShow = $celsNotSupported;
        break;
    default:
        die("ERROR");
}
echo "<h1>{$title}</h1>";
echo "<hr/>";
dumpArray($arrayToShow);
echo "<hr/>";
コード例 #7
0
ファイル: test.message.php プロジェクト: hcopr/Hubbub
  $fpost->data['text'] = 'This is a text post on someone else\'s profile. Umlauts like üöä should be preserved.';
  $fpost->save();

  $res = $fpost->sendToUrl($fpost->ownerEntity->ds['server']);
  // see if the message was accepted on the "other" end
  tlog($res['result'] == 'OK', 'foreign_post sentToUrl('.$fpost->ownerEntity->ds['url'].')', 'OK ('.$fpost->data['msgid'].')', 'fail ('.$fpost->responseData['reason'].')');
  // this tests whether the message was instantly published (a post record was returned)
  tlog(sizeof($fpost->responseData['post']) > 0, 'foreign_post auto_publish on receive', 'OK ('.$fpost->responseData['post']['msgid'].')', 'fail');
  // is the message text uncorrupted?
  tlog($fpost->responseData['post']['text'] == $fpost->data['text'], 'foreign_post text unicode', 'OK', 'fail');
  tlog($fpost->responseData['post']['msgid'] != $fpost->data['msgid'], 'foreign_post-to-post ID change', 'OK', 'fail');
  // now, this activity should appear on $ne2's profile stream
	$wallPosts1 = $this->msg->getPostList($ne2->key());
	foreach($wallPosts1['list'] as $pds)
	  if($pds['m_id'] == $fpost->responseData['post']['msgid']) $postFound4 = true; 
	tlog($postFound4, 'post found on '.$u2name.'\'s profile', 'OK', 'fail '.dumpArray($wallPosts1));

  tsection('Realtime Updates');

  // if I am the owner of the message, I send it out to my closest friends as a realtime notification!
  $post = new HubbubMessage('post');
	$post->localUserEntity = $ne1->key();
  $post->author($ne2->ds);
  $post->owner($ne1->ds);
  $post->data['text'] = 'This is a realtime message. Umlauts like üöä should be preserved.';
  // if we're the owner, we can send a realtime update to ne2
  $fpost->save();

  // now, we'll update an existing message that has already been committed to DB
  $post->data['text'] = 'This message text has changed now';
  $post->markChanged(time()+$ctr++);
コード例 #8
0
ファイル: lib.php プロジェクト: diedsmiling/busenika
/**
 * @return string
 */
function dumpGet()
{
    $_GET = isset($_GET) ? $_GET : array();
    return '$_GET = ' . dumpArray($_GET);
}
コード例 #9
0
 function replaceMacrosNoHTML($text)
 {
     $this->trace(TC_Session2, 'replaceMacrosNoHTML: ' . strlen($this->fMacroPattern) . ' ' . $text);
     $count = 0;
     $again = ($pos = strpos($text, Macro_Char)) >= 0 && is_int($pos);
     // Mehrfache Durchlaeufe, da Macros selber Macros enthalten koennen:
     if (strpos($text, "<div>Titel:") > 0) {
         $this->trace(TC_Session3, "replaceMacrosNoHTML-1:" . $this->fMacroPattern);
     }
     while ($again) {
         $again = false;
         if (getPos($text, Macro_Char) >= 0) {
             $this->trace(TC_Session3, 'replaceMacrosNoHTML-2: ' . $text);
             $old_text = $text;
             $text = '';
             // $this->fMacroPattern = '/^((\s|.)*?)\[(macro1|...macroX)\]/';
             $no_found = 0;
             $time = microtime();
             while (strlen($old_text) > 2 && preg_match($this->fMacroPattern, $old_text, $match)) {
                 if (microtime() - $time > 0.2) {
                     $this->trace(TC_Session3, 'replaceMacrosNoHTML-X2: ' . $this->fMacroPattern . " OldText: " . $old_text);
                 }
                 $time = microtime();
                 $this->trace(TC_Session3, 'replaceMacrosNoHTML-3: ' . dumpArray($match, 'match', 1));
                 $again = true;
                 $text .= $match[1] . $this->getMacro($match[3]);
                 $this->trace(TC_Session3, 'replaceMacrosNoHTML-4: ' . $old_text);
                 $old_text = substr($old_text, strlen($match[1]) + strlen($match[3]) + 2);
                 if (++$no_found > 20) {
                     $this->trace(TC_WARNING, "mehr als 20 Makros");
                     $again = false;
                     break;
                 }
             }
             // while strlen() > 2...
             if (microtime() - $time > 0.2) {
                 $this->trace(TC_Session3, 'replaceMacrosNoHTML-X3: ' . $this->fMacroPattern . " OldText: " . $old_text);
             }
             $this->trace(TC_Session3, 'replaceMacrosNoHTML-5: ' . $no_found . " #: " . count($match));
             $text .= $old_text;
             if (++$count > 6) {
                 $this->trace(TC_Session3, 'replaceMacrosNoHTML-6: ');
                 $macroname = substr($text, $pos, 20);
                 $this->trace(TC_Error, 'replaceMacrosNoHTML: zu verschachtelt (6): Pos: ' . $pos . " Macro: {$macroname} Text: {$text}");
                 break;
             }
             $this->trace(TC_Session3, 'replaceMacrosNoHTML-7: ');
         }
         // getPos (MACRO_CHAR) > 0
         $this->trace(TC_Session3, 'replaceMacrosNoHTML-8: ');
     }
     // while $again
     $this->trace(TC_Session2, 'replaceMacrosNoHTML-e: ' . $text);
     return $text;
 }
コード例 #10
0
ファイル: render.php プロジェクト: ambagasdowa/projections
    $Config["CaptionMargin"] = 10;
    $Config["CaptionWidth"] = 10;
    if ($sl_shaded == "true") {
        $Config["ShadedSlopeBox"] = TRUE;
    }
    if ($sl_caption_enabled != "true") {
        $Config["Caption"] = FALSE;
    }
    if ($sl_caption_line == "true") {
        $Config["CaptionLine"] = TRUE;
    }
    if ($Mode == "Render") {
        $myPicture->drawDerivative($Config);
    } else {
        echo "\r\n";
        echo dumpArray("Config", $Config);
        echo '$myPicture->drawDerivative($Config);' . "\r\n";
    }
}
if ($Mode == "Render") {
    $myPicture->stroke();
} else {
    echo "\r\n" . '$myPicture->stroke();' . "\r\n?>";
}
function extractColors($Hexa)
{
    if (strlen($Hexa) != 6) {
        return array(0, 0, 0);
    }
    $R = hexdec(left($Hexa, 2));
    $G = hexdec(mid($Hexa, 3, 2));