コード例 #1
0
ファイル: post.php プロジェクト: hcopr/Hubbub
function _post_save_vote(&$data, &$msg)
{
    $msg->voteHash = md5(strtolower(substr($data['text'], 1)));
    // but if this person already voted, we need to unregister these previous votes
    DB_Update('UPDATE ' . getTableName('messages') . ' SET m_votehash = "", m_deleted = "Y" WHERE m_parent = ? AND m_author = ?', array($msg->parentKey, $msg->authorEntity->key()));
    DB_Update('DELETE FROM ' . getTableName('votes') . ' WHERE v_msg = ?', array($msg->parentKey));
    // update the vote summary
    foreach (DB_GetList('SELECT COUNT(*) as votecount,m_data,m_id,m_votehash as count FROM ' . getTableName('messages') . '
    WHERE m_parent = ? AND m_deleted = "N" AND m_type="post" AND m_votehash != ""
    GROUP BY m_votehash') as $vds) {
        $msgData = HubbubMessage::unpackData($vds);
        // get the some exemplary votes for this
        $voterList = array();
        foreach (DB_GetList('SELECT m_author FROM ' . getTableName('messages') . ' WHERE m_parent = ? AND m_votehash = ? ORDER BY m_created DESC LIMIT 3', array($msg->parentKey, $vds['m_votehash'])) as $vex) {
            $voterList[] = $vex;
        }
        // if this is also what this message votes for, add it to the list
        if ($this->{$msg}->voteHash == $vds['m_votehash']) {
            $voterList[] = getDefault($msg->authorKey, $msg->ownerKey);
        }
        // make the vote summary dataset
        $voteDS = array('v_msg' => $msg->parentKey, 'v_choice' => $vds['m_votehash'], 'v_text' => $msgData['text'], 'v_voters' => implode(',', $voterList), 'v_count' => $vds['votecount']);
        DB_UpdateDataset('votes', $voteDS);
    }
}
コード例 #2
0
/**
 * Output a lifestream feed
 *
 * @param array $params
 * @return string
 */
function smarty_lifestream($params)
{
    global $lifestream_config, $PIVOTX;
    $style = getDefault($PIVOTX['config']->get('lifestream_style'), $lifestream_config['lifestream_style']);
    $output = $PIVOTX['extensions']->getLoadCode('defer_file', 'lifestream/lifestream.php', $style);
    return $output;
}
コード例 #3
0
ファイル: friends.controller.php プロジェクト: hcopr/Hubbub
	function ajax_pingserver()
	{
	  $server = new HubbubServer($_REQUEST['server'], true);
	  $reload = '<script>
	      setTimeout("reload_'.md5($_REQUEST['server']).'()", 2000);
	    </script>';
	  if($server->isTrusted())
	  {
	    ?><span class="green">
        <?= htmlspecialchars($_REQUEST['url']) ?>
      </span><? 
    } 
    else if($server->isWaitingForKey())
    {
      ?><?= htmlspecialchars($_REQUEST['url']) ?><div class="gray">
        waiting for response...
      </div><?= $reload ?><?
    }
    else
    {
      $res = $server->msg_trust_sendkey1();
      if($res['result'] == 'OK')
      {
        ?><?= htmlspecialchars($_REQUEST['url']) ?><div class="gray">
          exchanging credentials...
        </div><?= $reload ?><?
      }
      else
      {
        ?><div class="red">
          ✘ <a class="red" title="<?= htmlspecialchars(getDefault($res['reason'], 'no connection')) ?>"><?= htmlspecialchars($_REQUEST['url']) ?></a>
        </div><?
      }
    }
  }
コード例 #4
0
ファイル: settings.controller.php プロジェクト: hcopr/Hubbub
 function ajax_commiturl()
 {
     access_policy('write');
     $this->skipView = false;
     if ($_REQUEST['newurl']) {
         $this->changeResult = $this->model->changeMyUrl($_REQUEST['newurl']);
     }
     $this->myNewUrl = getDefault($_REQUEST['newurl'], $this->user->getUrl());
 }
コード例 #5
0
ファイル: msg.controller.php プロジェクト: hcopr/Hubbub
 function ajax_post()
 {
     access_policy('write');
     if (trim($_REQUEST['text']) != '') {
         $ds = $this->model->post(array('text' => $_REQUEST['text'], 'author' => array('_key' => $this->user->entity), 'owner' => array('_key' => getDefault($_REQUEST['to'], $this->user->entity))));
         ob_start();
         tmpl_postlist(array('list' => array($ds)), false);
         print json_encode(array('post' => ob_get_clean(), 'result' => 'OK'));
     }
 }
コード例 #6
0
ファイル: trust_sendkey2.php プロジェクト: hcopr/Hubbub
/**
 * On-receive event handler
 * 
 * This handler gets called when server (B) receives a trust_sendkey2 message from server (A),
 * and it generally happens to determine whether server (A) did send a corresponding trust_sendkey1
 * before. It is also used to send server (B)'s key.
 * 
 * @param array $data
 * @param object $msg
 * @return boolean
 */
function trust_sendkey2_receive(&$data, &$msg)
{
    $serverUrl = getDefault($data['author']['server']);
    if ($serverUrl == '') {
        $msg->fail('invalid server field in "from" array');
    } else {
        // does it really originate from server (A)?
        if (!$msg->validateSignature()) {
            return true;
        }
        // accept this server (A)'s key for future data
        $msg->fromServer->ds['s_key_out'] = $msg->data['mykey'];
        DB_UpdateField('servers', $msg->fromServer->ds['s_key'], 's_key_out', $msg->data['mykey']);
        $msg->ok();
    }
    return true;
}
コード例 #7
0
ファイル: GetMenuItem.php プロジェクト: adamyWA/Menu-CMS
 public function returnAllMenuInfo($slug)
 {
     $results = \MenuItem::where('menu_item_slug', '=', $slug)->get(array('menu_item_description', 'menu_item_picture_uri', 'menu_item_name', 'menu_item_slug', 'menu_item_id', 'menu_item_category_fk', 'menu_item_short', 'menu_item_price'));
     foreach ($results as $result) {
         $menu_item_description = $result->menu_item_description;
         $menu_item_name = $result->menu_item_name;
         $menu_item_picture_uri = $result->menu_item_picture_uri;
         $menu_item_id = $result->menu_item_id;
         $slug = $result->menu_item_slug;
         $menu_item_category_fk = $result->menu_item_category_fk;
         $menu_item_short = $result->menu_item_short;
         $menu_item_price = $result->menu_item_price;
     }
     function getCategories()
     {
         $category = array();
         $categories = \MenuCategory::get();
         foreach ($categories as $cat) {
             $cat_name = $cat->menu_category_name;
             $cat_id = $cat->menu_category_id;
             $category[$cat_id] = $cat_name;
         }
         return $category;
     }
     function getDefault($menu_item_category_fk)
     {
         $results = \MenuCategory::where('menu_category_id', '=', $menu_item_category_fk)->get(array('menu_category_id'));
         foreach ($results as $result) {
             $category = $result->menu_category_id;
         }
         return $category;
     }
     $categories = getCategories();
     $default = "";
     if (isset($menu_item_category_fk)) {
         $default = getDefault($menu_item_category_fk);
     }
     if (\Auth::check()) {
         if (!isset($menu_item_description)) {
             return \Redirect::to('admin');
         }
         return \View::make('menu-items.edit')->withMenuItemDescription($menu_item_description)->withMenuItemPictureUri($menu_item_picture_uri)->withMenuItemName($menu_item_name)->withMenuItemShort($menu_item_short)->withSlug($slug)->withCategories($categories)->withDefault($default)->withMenuItemPrice($menu_item_price);
     }
     return \Redirect::to('admin');
 }
コード例 #8
0
ファイル: profile.model.php プロジェクト: hcopr/Hubbub
  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);
	}
コード例 #9
0
ファイル: friendlist.php プロジェクト: hcopr/Hubbub
function tmpl_friendlist($list, $rowCallback2 = '')
{
    ?>
<table width="100%"><?php 
    foreach ($list as $ds) {
        ?>
<tr class="drow_<?php 
        echo $ds['_key'];
        ?>
">
      <td colspan="10"><div style="width: 100%; border-top: 1px solid #aaa;"></div></td>
    </tr class="drow_<?php 
        echo $ds['_key'];
        ?>
"><tr>
      <td valign="top" width="60"><img src="<?php 
        echo getDefault($ds['pic'], 'img/anonymous.png');
        ?>
" width="48" style="max-height: 48px"/></td>
      <td valign="top" width="50%">
        <div><?php 
        echo HubbubEntity::link($ds);
        ?>
</div>
        <div class="smalltext"><?php 
        echo htmlspecialchars($ds['url']);
        ?>
</div>
      </td>
			<td valign="top">
				<?
				if($rowCallback2 != '') $rowCallback2($ds);
				?>
			</td>
    </tr><?php 
    }
    ?>
</table><?php 
}
コード例 #10
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;
}
コード例 #11
0
ファイル: lifestream.php プロジェクト: laiello/pivotx-sqlite
/**
 * Getting some variables from config. If they are not set, revert to the defaults
 * from widget_lifestream.php
 *
 */
$twittername = getDefault($PIVOTX['config']->get('lifestream_twitterusername'), $lifestream_config['lifestream_twitterusername']);
$twitterpass = getDefault($PIVOTX['config']->get('lifestream_twitterpassword'), $lifestream_config['lifestream_twitterpassword']);
$summize = getDefault($PIVOTX['config']->get('lifestream_summize'), $lifestream_config['lifestream_summize']);
$tumblrname = getDefault($PIVOTX['config']->get('lifestream_tumblrusername'), $lifestream_config['lifestream_tumblrusername']);
$flickrfeed = getDefault($PIVOTX['config']->get('lifestream_flickrfeed'), $lifestream_config['lifestream_flickrfeed']);
$lastfmname = getDefault($PIVOTX['config']->get('lifestream_lastfmusername'), $lifestream_config['lifestream_lastfmusername']);
$max = getDefault($PIVOTX['config']->get('lifestream_max_items'), $lifestream_config['lifestream_max_items']);
$maxperfeed = getDefault($PIVOTX['config']->get('lifestream_max_perfeed'), $lifestream_config['lifestream_max_perfeed']);
$header = getDefault($PIVOTX['config']->get('lifestream_header'), $lifestream_config['lifestream_header']);
$format = getDefault($PIVOTX['config']->get('lifestream_format'), $lifestream_config['lifestream_format']);
$footer = getDefault($PIVOTX['config']->get('lifestream_footer'), $lifestream_config['lifestream_footer']);
if (empty($twittername) && empty($summize) && empty($tumblrname) && empty($flickrfeed) && empty($lastfmname)) {
    $text = "At least one username must be entered in the Lifestream configuration.";
    echo $text;
    debug($text);
    die;
}
define("MAGPIE_CACHE_AGE", 600);
include_once $PIVOTX['paths']['pivotx_path'] . 'includes/magpie/rss_fetch.inc';
$iconpath = sprintf("%slifestream/%s", $PIVOTX['paths']['extensions_url'], '%icon%');
$items = array();
$count = 0;
/**
 * First get updates from Summize.. (because these will weigh least heavy, when
 * ordering later on)
 */
コード例 #12
0
ファイル: exec_do.php プロジェクト: hcopr/Hubbub
  $msg .= '<div class="red">✘ &nbsp; please install JSON support</div>';
  
$c = $_SESSION['installer'];

switch($_REQUEST['part'])
{
  case(0): {
    $msg .= '<div class="green">✔ &nbsp; Installing...</div>';
    break;
  }
  case(1): {
    $cv = array();
    include_once('lib/special-io.php');
    $_SESSION['installer']['cfg']['service']['salt'] = randomHashId();
    $myUserName = trim(shell_exec('whoami'));
    $myUserName = getDefault($myUserName, 'root');
    
    $tmplFile = '<? $GLOBALS[$cfgCategory] = json_decode(\''.json_format(json_encode($_SESSION['installer']['cfg'])).'\', true); ?>';
    $cfgFileName = 'conf/default.php';
    if(!file_exists($cfgFileName))
    {      
      @chmod('conf', 0777);
      WriteToFile($cfgFileName, $tmplFile);
      $cfgWritable = trim(file_get_contents($cfgFileName)) == trim($tmplFile);
      if(!$_SESSION['installer']['cfg']['ping']['remote']) $cronInfo = l10n('cron.setup').'
          <pre>* * * * * '.$myUserName.' php -f '.$GLOBALS['APP.BASEDIR'].'/cron.php > /dev/null 2>&1</pre>
          <a href="ext/installer/cronhelp.php" target="_blank">&gt; More information / help</a><br/>';
      if($cfgWritable)
        $msg .= '<div class="green">✔ &nbsp; Config file written</div>
          <br/>
          '.$cronInfo.'
コード例 #13
0
ファイル: signin.controller.php プロジェクト: hcopr/Hubbub
 function __init()
 {
     $this->invokeModel();
     $srv = getDefault($_SERVER['HTTP_HOST'], l10n('this.server'));
     $this->srvName = strtoupper(substr($srv, 0, 1)) . substr($srv, 1);
 }
コード例 #14
0
ファイル: pages.php プロジェクト: laiello/pivotx-sqlite
function pagem_editcomment()
{
    global $PIVOTX;
    require_once dirname(__FILE__) . '/modules/module_comments.php';
    $PIVOTX['session']->minLevel(PIVOTX_UL_NORMAL);
    // uid should be numeric. (If it's not, someone is hacking ...)
    if (!is_numeric($_GET['uid'])) {
        echo "uid must be numeric";
        die;
    }
    $entry = $PIVOTX['db']->read_entry(intval($_GET['uid']));
    // Check if the user is allowed to edit this entry. It should either be his/her own
    // Entry, or the userlevel should be advanced.
    if ($PIVOTX['session']->currentUsername() != $entry['user']) {
        $PIVOTX['session']->minLevel(PIVOTX_UL_ADVANCED);
    }
    if (isset($entry['comments'][$_GET['key']])) {
        $comment = $entry['comments'][$_GET['key']];
    } else {
        // This should only happen for non-SQL db when editing a comment from
        // the latest comments screen (or similar functions) which uses fake UIDs.
        foreach ($entry['comments'] as $key => $value) {
            if ($_GET['key'] == makeCommentUID($value)) {
                $comment = $value;
                // Setting the key to the array key
                $_GET['key'] = $key;
                break;
            }
        }
    }
    if (count($_POST) < 4) {
        $PIVOTX['template']->assign('uid', $_GET['uid']);
        $PIVOTX['template']->assign('comment', $comment);
        $PIVOTX['template']->assign('pivotxsession', $PIVOTX['session']->getCSRF());
        $PIVOTX['template']->assign("title", __('Edit Comment'));
        $PIVOTX['template']->assign("active", "comments");
        renderTemplate('mobile/editcomment.tpl');
    } else {
        // Make sure the current user is properly logged in, and that the request is legitimate
        $PIVOTX['session']->checkCSRF($_POST['pivotxsession']);
        // Make sure 'moderate' is set..
        $_POST['moderate'] = getDefault($_POST['moderate'], 0);
        // Merge the $_POST into the comment..
        foreach ($comment as $key => $value) {
            if (isset($_POST[$key])) {
                $comment[$key] = $_POST[$key];
            }
        }
        editComment($entry, $_GET['key'], $comment);
        $PIVOTX['messages']->addMessage(__('The Comment was saved!'));
        pagem_comments();
    }
}
コード例 #15
0
ファイル: cq-forms.php プロジェクト: hcopr/Hubbub
 function display($opt = array())
 {
     if ($this->getDataOnDisplay) {
         $this->getData();
     }
     if ($this->hidden) {
         return;
     }
     if ($this->formClosed != true) {
         $this->params['formsubmit'] = $this->name;
         $this->add('end', $name, $name, array('params' => $this->params));
         $this->formClosed = true;
     }
     include_once $this->presentationDir . $this->presentationName . '.php';
     $templateInitFunction = $this->presentationName . '_init';
     if (is_callable($templateInitFunction)) {
         $templateInitFunction($this);
     }
     foreach ($this->elements as $e) {
         $sessionFieldName = $this->name . '-' . $e['name'];
         $e['pure-caption'] = $e['caption'];
         $e['caption'] .= $this->packCaption;
         if ($e['validate'] == 'notempty' && isset($this->mandatoryMarker)) {
             $e['caption'] = $e['caption'] . $this->mandatoryMarker;
         }
         if (trim($e['info']) != '') {
             $e['infomarker'] = str_replace('$', $e['info'], $this->infoMarker);
         }
         print $this->packStart;
         print getDefault($opt['field-start']);
         $dFunction = $this->presentationName . '_' . $e['type'];
         if ($e['sessiondefault'] == true) {
             $e['default'] = getDefault($_SESSION[$sessionFieldName], $e['default']);
         }
         $e['value'] = getDefault(getValueFromArray($this->ds, $e['name']), $e['default']);
         if ($e['sessiondefault'] == true) {
             $_SESSION[$sessionFieldName] = $e['value'];
         }
         $e['error'] = $this->errors[$e['name']];
         if (is_callable($dFunction)) {
             $dFunction($e, $this);
         } else {
             logError('form', 'CQForm: unknown form element type "' . $e['type'] . '"');
         }
         print getDefault($opt['field-end']);
         print $this->packEnd;
     }
     return $this;
 }
コード例 #16
0
        fputs($writing, $line);
        writeCustoms($writing);
    }
    if ($inArray && !stristr($line, ");")) {
        continue;
        //skip old values for array
    }
    if ($inArray) {
        fputs($writing, $line);
        $inArray = false;
        continue;
    }
    foreach ($_POST as $key => $value) {
        if (stristr($line, $key)) {
            if ($value == "") {
                $value = getDefault($key);
                if (!$value) {
                    $value = "";
                }
            }
            if ($key == "fa_icon") {
                $value = "fa-" . $value;
            }
            $line = "\$" . $key . " = \"" . $value . '";' . PHP_EOL;
            $replaced = true;
        }
    }
    fputs($writing, $line);
}
fclose($reading);
fclose($writing);
コード例 #17
0
/**
 * Returns the Javascript code and creates the key for hardened trackbacks.
 */
function getTracbackKeyJS($uri, $date)
{
    global $PIVOTX;
    // Abort immediately if hardened trackbacks isn't enabled.
    if ($PIVOTX['config']->get('hardened_trackback') != 1) {
        exit;
    }
    // Get the entry from the DB..
    $entry = $PIVOTX['db']->read_entry($uri, $date);
    // Exit if non-existing ID supplied
    if (empty($entry['code'])) {
        debug('Entry not found');
    } else {
        $id = intval($entry['code']);
    }
    $keydir = $PIVOTX['paths']["db_path"] . "tbkeys/";
    $tburl = $PIVOTX['paths']['host'] . makeFileLink($entry['code'], '', '');
    $trackback = getDefault($PIVOTX['config']->get('localised_trackback_name'), "trackback");
    if ($PIVOTX['config']->get('mod_rewrite') == 0) {
        $tburl .= "&amp;{$trackback}&amp;key=";
    } else {
        $tburl .= "/{$trackback}/?key=";
    }
    if (!strstr($_SERVER["HTTP_REFERER"], $_SERVER["SERVER_NAME"])) {
        // Creating a bogus key
        $tbkey = md5(microtime());
        debug("hardened trackbacks: illegal request - creating bogus key");
    } else {
        makeDir($keydir);
        $tbkey = md5($PIVOTX['config']->get('server_spam_key') . $_SERVER["REMOTE_ADDR"] . $id . time());
        if (!touch($keydir . $tbkey)) {
            debug("hardened trackbacks: directory {$keydir} isn't writable - can't create key");
        } else {
            chmodFile($keydir . $tbkey);
        }
    }
    // Getting the time offset between the web and file server (if there is any)
    $offset = timeDiffWebFile($tbkey_debug);
    // delete keys older than 15 minutes
    $nNow = time();
    $handle = opendir($keydir);
    while (false !== ($file = readdir($handle))) {
        $filepath = $keydir . $file;
        if (!is_dir($filepath) && $file != "index.html") {
            $Diff = $nNow - filectime($filepath);
            if ($Diff > 60 * 15 + $offset) {
                unlink($filepath);
            }
        }
    }
    closedir($handle);
    header('Content-Type: text/javascript');
    echo <<<EOM

function showTBURL_{$entry['code']}(element_id)  {
    var element = document.getElementById(element_id);
    element.innerHTML = '<br />{$tburl}' + '{$tbkey}';
}

function showTBURLgen_{$entry['code']}(element_id, tburl_gen)  {
    var element = document.getElementById(element_id);
    element.innerHTML = tburl_gen;
}

EOM;
    exit;
}
コード例 #18
0
/**
 * Outputs the Fancybox popup code.
 *
 * @param array $params
 * @param object $smarty
 * @return string
 */
function smarty_fancybox($params, &$smarty)
{
    global $PIVOTX;
    // If we've set the hidden config option for 'never_jquery', just return without doing anything.
    if ($PIVOTX['config']->get('never_jquery') == 1) {
        debug("JQuery is disabled by the 'never_jquery' config option. FancyBox won't work.");
        return;
    }
    $params = cleanParams($params);
    $filename = $params['file'];
    $thumbname = getDefault($params['description'], "(thumbnail)");
    $org_thumbname = $thumbname;
    $alt = $params['alt'];
    $title = $params['title'];
    $align = getDefault($params['align'], "center");
    // rel_id can be used to specify your own prefix; all fancybox images with the same prefix will become a gallery
    $rel_id = getDefault($params['rel_id'], "entry-");
    // fb_type can be used to specify the type of the fancybox
    // image (default) - selfexplanatory
    // youtube - creates an embedded object with the youtube link (use url for that)
    $fb_type = getDefault($params['fb_type'], "image");
    $width = getDefault($params['width'], "560");
    $height = getDefault($params['height'], "340");
    $objwidth = getDefault($params['objwidth'], "0");
    $objheight = getDefault($params['objheight'], "0");
    $maxthumb = getDefault($params['specthumbmax'], "0");
    $txtcol = getDefault($params['txtcol'], "black");
    $txtcolbg = getDefault($params['txtcolbg'], "white");
    $txtcls = getDefault($params['txtcls'], "pivotx-popupimage");
    // this one can be used together with fb_type="youtube" and "vimeo"
    // !! structure should be like explained on youtube e.g. http://www.youtube.com/v/MOVID
    // or for vimeo: http://www.vimeo.com/moogaloop.swf?clip_id=CLIPID
    // it's better to just use movid to specify youtube or clipid for vimeo
    // url can also be used for fb type="iframe" or "flash"
    $url = $params['url'];
    $url = strip_tags($url);
    $movid = $params['movid'];
    $text = getDefault($params['text'], "Specify your text in parm 'text'.");
    // $border = getDefault($params['border'], 0);
    $imgw = getDefault($PIVOTX['config']->get('upload_thumb_width'), 200);
    $imgh = getDefault($PIVOTX['config']->get('upload_thumb_height'), 200);
    $uplbasepath = $PIVOTX['paths']['upload_base_path'];
    // Config option 'fancybox_thumbnail' can be added and used as default for thumbnail behaviour
    // 1 = always make sure the dimensions of the img tag are the same irrelevant of current thumbnail size
    //     (this means that when thumbnail gets created the upload width/height settings are used)
    // 2 = if thumbnail already exists always use its dimensions for the img tag (default)
    // 3 = if thumbnail exists and doesn't adhere to current width/height setting recreate it
    $fbthumb = getDefault($PIVOTX['config']->get('fancybox_thumbnail'), 2);
    $fbthumb = getDefault($params['thumbbehav'], $fbthumb);
    // debug("fb info: '$filename'-'$thumbname'-'$title'-'$alt'-'$align'-'$fb_type'");
    if ($align == 'center' || $align == 'inline') {
        $fbclass = 'pivotx-popupimage';
        $txclass = 'pivotx-popuptext';
    } else {
        $fbclass = 'pivotx-popupimage align-' . $align;
        $txclass = 'pivotx-popuptext align-' . $align;
    }
    // Get the UID for the page or entry
    $vars = $smarty->get_template_vars();
    $uid = intval($vars['uid']);
    if (empty($alt)) {
        $alt = $filename;
    }
    if ($objwidth == "0") {
        $objwidth = $width;
    }
    if ($objheight == "0") {
        $objheight = $height;
    }
    // Fix Thumbname, perhaps use a thumbname, instead of textual link
    // and try to fill both alt and title if still empty
    if ($thumbname == "(thumbnail)") {
        if (empty($filename)) {
            debug("No filename specified for thumbnail to process");
        } else {
            $thumbname = makeThumbname($filename);
            // If thumbnail exists and option 3 is chosen then check the dimensions for possible recreation
            $recreate = 0;
            if (file_exists($PIVOTX['paths']['upload_base_path'] . $thumbname) && $fbthumb == 3) {
                list($thumbw, $thumbh) = getimagesize($uplbasepath . $thumbname);
                //debug("dimensions of thumbnail: " . $thumbw . "/" . $thumbh);
                //debug("imgw/h: " . $imgw . "/" . $imgh);
                //debug("maxthumb: " . $maxthumb);
                if ($maxthumb > 0) {
                    // specthumbmax specified: calculate the right values (useful for vertical images)
                    if ($thumbw > $thumbh) {
                        $imgh = round($thumbh * ($maxthumb / $thumbw));
                        $imgw = $maxthumb;
                    } else {
                        $imgw = round($thumbw * ($maxthumb / $thumbh));
                        $imgh = $maxthumb;
                    }
                }
                if ($thumbw != $imgw || $thumbh != $imgh) {
                    $recreate = 1;
                    //debug("thumb will be recreated");
                }
            }
            // If the thumbnail does not exist and extension is jpg or png then try to create it
            // gif could be problematic so don't try it here......
            // filename could contain a subdir! this part is removed by auto_thumbnail
            // so save it through specifying a folder var
            if (!file_exists($PIVOTX['paths']['upload_base_path'] . $thumbname) || $recreate == 1) {
                $ext = strtolower(getExtension($filename));
                if ($ext == "jpeg" || $ext == "jpg" || $ext == "png") {
                    require_once $PIVOTX['paths']['pivotx_path'] . 'modules/module_imagefunctions.php';
                    $folder = $PIVOTX['paths']['upload_base_path'];
                    $dirpart = dirname($filename);
                    $basename = basename($filename);
                    $action = "Fancybox";
                    if ($dirpart != "" && $dirpart != ".") {
                        $folder = $folder . $dirpart . "/";
                    }
                    if (!auto_thumbnail($basename, $folder, $action, $maxthumb)) {
                        debug("Failed to create thumbnail for " . $filename);
                    }
                } else {
                    debug("Unable to create thumbnail for this extension " . $filename);
                }
            }
        }
    }
    if (empty($alt)) {
        $alt = $thumbname;
    }
    if (empty($title)) {
        $title = $alt;
    }
    // special string "null" to get rid of any title/alt
    if ($title == "null" || $alt == "null") {
        $title = "";
        $alt = "";
    }
    // Clean title and alternative text before using in generated html
    $title = cleanAttributes($title);
    $alt = cleanAttributes($alt);
    // If the thumbnail exists, make the HTML for it, else just use the text for a link.
    // use the current settings for uploadwidth/height because thumb can have diff.size
    if (file_exists($PIVOTX['paths']['upload_base_path'] . $thumbname)) {
        $ext = strtolower(getExtension($thumbname));
        if ($ext == "jpg" || $ext == "jpeg" || $ext == "gif" || $ext == "png") {
            // get image dimensions
            list($thumbw, $thumbh) = getimagesize($uplbasepath . $thumbname);
            if ($maxthumb > 0) {
                // specthumbmax specified: calculate the right values (useful for vertical images)
                if ($thumbw > $thumbh) {
                    $imgh = round($thumbh * ($maxthumb / $thumbw));
                    $imgw = $maxthumb;
                } else {
                    $imgw = round($thumbw * ($maxthumb / $thumbh));
                    $imgh = $maxthumb;
                }
            }
            // thumbnail behaviour 2: always use the dimensions of the found thumbnail
            if ($fbthumb == 2) {
                $imgw = $thumbw;
                $imgh = $thumbh;
                //debug("dimensions of found thumb used: " . $thumbw . "/" . $thumbh);
            }
            // if parms width or height have been specified they should be used!
            if (isset($params['width'])) {
                $imgw = $width;
            }
            if (isset($params['height'])) {
                $imgh = $height;
            }
            $thumbname = sprintf("<img src=\"%s%s\" alt=\"%s\" title=\"%s\" class=\"%s\" width=\"%s\" height=\"%s\" />", $PIVOTX['paths']['upload_base_url'], $thumbname, $alt, $title, $fbclass, $imgw, $imgh);
        } else {
            $thumbname = $org_thumbname;
        }
    } else {
        $thumbname = $org_thumbname;
    }
    // pack text in aligned paragraph (thumbname has been unchanged by the above)
    if ($thumbname == $org_thumbname) {
        if (strlen($org_thumbname) < 2) {
            $org_thumbname = "popup";
        }
        $thumbname = sprintf("<span class=\"%s\">%s</span>", $txclass, $org_thumbname);
    }
    // Prepare the HMTL for the link to the popup..
    // fb_type image
    if ($fb_type == 'image') {
        if (file_exists($PIVOTX['paths']['upload_base_path'] . $filename)) {
            $filename = $PIVOTX['paths']['upload_base_url'] . $filename;
            $code = sprintf("<a href=\"%s\" class=\"fancybox\" title=\"%s\" rel=\"%s%s\" >%s</a>", $filename, $title, $rel_id, $uid, $thumbname);
            if ('center' == $align) {
                $code = '<p class="pivotx-wrapper">' . $code . '</p>';
            }
        } else {
            debug("Rendering error: could not popup '{$filename}'. File does not exist.");
            $code = "<!-- Rendering error: could not popup '{$filename}'. File does not exist. -->";
        }
    } else {
        if ($fb_type == 'youtube' || $fb_type == "vimeo") {
            // filename is not mandatory so fix an empty one with dummy string so code gets returned
            if (empty($filename)) {
                $filename = '==fbdummy==';
            }
            // use random number to be fairly sure that constructed href will be unique
            // if by chance the number is the same then movie shown (when clicked) will be the first one
            // this is because a gallery of movies is not possible yet
            // uploadwidth/height is not used here because default youtube images are smaller
            $randnum = rand();
            if (empty($movid) && empty($url)) {
                debug("Popup type youtube/vimeo needs either a 'movid' or a fully qualified 'url' parm!");
            }
            $movstart = 0;
            if (empty($movid)) {
                $movthumb = formatFilename($url);
                $movthumb = str_replace('watch?v=', '', $movthumb);
                $movtime = '';
                // link contains time parm? &t=
                if (strpos($movthumb, "&t=")) {
                    $timepos = strpos($movthumb, "&t=");
                    $movtime = substr($movthumb, $timepos + 3);
                    $movthumb = substr($movthumb, 0, $timepos);
                }
                // short link supplied with time parm?
                if (strpos($movthumb, "?t=")) {
                    $timepos = strpos($movthumb, "?t=");
                    $movtime = substr($movthumb, $timepos + 3);
                    $movthumb = substr($movthumb, 0, $timepos);
                }
                // calculate the amount of seconds to supply to the player
                if ($movtime != '') {
                    $movh = 0;
                    $movm = 0;
                    $movs = 0;
                    $hpos = strpos($movtime, "h");
                    if ($hpos) {
                        $movh = substr($movtime, 0, $hpos);
                        $movtime = substr($movtime, $hpos + 1);
                    }
                    $mpos = strpos($movtime, "m");
                    if ($mpos) {
                        $movm = substr($movtime, 0, $mpos);
                        $movtime = substr($movtime, $mpos + 1);
                    }
                    $spos = strpos($movtime, "s");
                    if ($spos) {
                        $movs = substr($movtime, 0, $spos);
                        $movtime = substr($movtime, $spos + 1);
                    }
                    if (is_numeric($movh)) {
                        $movstart = $movh * 3600;
                    }
                    if (is_numeric($movm)) {
                        $movstart = $movstart + $movm * 60;
                    }
                    if (is_numeric($movs)) {
                        $movstart = $movstart + $movs;
                    }
                }
                // formatFilename replaces underscore by space -- undo this
                $movthumb = str_replace(' ', '_', $movthumb);
                if ($fb_type == "vimeo") {
                    // possible formats: http://www.vimeo.com/moogaloop.swf?clip_id=6566857
                    //                   http://www.vimeo.com/5324878
                    $pos = strpos($url, "clip_id=");
                    if ($pos !== false) {
                        $pos = $pos + 8;
                        $movthumb = substr($url, $pos);
                    } else {
                        $pos = strpos($url, "vimeo.com/");
                        if ($pos !== false) {
                            $pos = $pos + 10;
                            $movthumb = substr($url, $pos);
                            // if this format is received rewrite it to embed format
                            $url = "http://www.vimeo.com/moogaloop.swf?clip_id=" . $movthumb;
                        }
                    }
                }
            } else {
                $movthumb = $movid;
            }
            if ($fb_type == "youtube") {
                $urlthumb = "http://i2.ytimg.com/vi/" . $movthumb . "/default.jpg";
            } else {
                if ($fb_type == "vimeo") {
                    $urlvimphp = "http://vimeo.com/api/v2/video/" . $movthumb . ".php";
                    $vimeocontents = @file_get_contents($urlvimphp);
                    $thumbcontents = @unserialize(trim($vimeocontents));
                    $urlthumb = $thumbcontents[0][thumbnail_small];
                    if (empty($urlthumb)) {
                        $urlthumb = $thumbcontents[0][user_thumbnail_small];
                    }
                }
            }
            $code = sprintf("<a href=\"#%s%s\" class=\"fancytube\" title=\"%s\" rel=\"%s%s\" ><img src=\"%s\" class=\"%s\" alt=\"%s\" /></a>", $rel_id, $randnum, $title, $rel_id, $uid, $urlthumb, $fbclass, $alt);
            // some extra options for youtube (end with ampersand)
            // for explanation see http://code.google.com/intl/nl/apis/youtube/player_parameters.html
            // hl = language
            // autoplay: 1 = autoplay; 0 = click to play
            // rel = play related videos (0 = no)
            // fs = fullscreen allowed
            // options for vimeo just found by browsing through Google
            if (empty($movid)) {
                $urlmain = str_replace('watch?v=', 'v/', $url);
                $urlmain = str_replace('/embed/', '/v/', $urlmain);
                // convert a short link to a long one otherwise it won't work (if parms were in link they are now gone)
                // also if time parm was found the link needs to be reformatted to obligatory format
                if (strpos($urlmain, "//youtu.be/") || $movstart != 0) {
                    $urlmain = "http://www.youtube.com/v/" . $movthumb;
                }
                $urlid = "";
            } else {
                if ($fb_type == "youtube") {
                    $urlmain = "http://www.youtube.com/v/";
                    $urlid = $movid;
                } else {
                    if ($fb_type == "vimeo") {
                        $urlmain = "http://www.vimeo.com/moogaloop.swf?clip_id=";
                        $urlid = $movid;
                    }
                }
            }
            if ($fb_type == "youtube") {
                $urlextra = "&amp;hl=en&amp;autoplay=1&amp;rel=0&amp;fs=1&amp;start=" . $movstart;
            } else {
                if ($fb_type == "vimeo") {
                    $urlextra = "&amp;server=vimeo.com&amp;autoplay=1&amp;fullscreen=1&amp;show_title=1&amp;show_byline=0&amp;show_portrait=0";
                }
            }
            $anchor_obj = sprintf("<span style=\"display: none\"><span id=\"%s%s\" ><object type=\"application/x-shockwave-flash\" data=\"%s%s%s\" width=\"%s\" height=\"%s\"><param name=\"movie\" value=\"%s%s%s\"></param><param name=\"allowFullScreen\" value=\"true\"></param><param name=\"allowscriptaccess\" value=\"always\"></param></object></span></span>", $rel_id, $randnum, $urlmain, $urlid, $urlextra, $objwidth, $objheight, $urlmain, $urlid, $urlextra);
            $code = $code . $anchor_obj;
            if ('center' == $align) {
                $code = '<p class="pivotx-wrapper">' . $code . '</p>';
            }
        } else {
            if ($fb_type == 'text') {
                // filename is not mandatory so fix an empty one with dummy string so code gets returned
                if (empty($filename)) {
                    $filename = '==fbdummy==';
                }
                // use random number to be fairly sure that constructed href will be unique
                // if by chance the number is the same then text shown (when clicked) will be the first one
                // also use this random number to construct a unique rel because grouping results
                // in array-reverse errors and crashing of the webpage when scrolling with the mouse!
                $randnum = rand();
                $code = sprintf("<a href=\"#%s%s\" class=\"fancytext\" title=\"%s\" rel=\"%s%s%s\" >%s</a>", $rel_id, $randnum, $title, $rel_id, $uid, $randnum, $thumbname);
                $textbegin = substr($text, 0, 5);
                $textrest = substr($text, 5);
                if ($textbegin !== "file:") {
                    $lines = $text;
                } else {
                    $docfile = $PIVOTX['paths']['pivotx_path'] . "docs/" . $textrest;
                    if (file_exists($docfile) && is_readable($docfile) && ($handle = fopen($docfile, 'r'))) {
                        $lines = fread($handle, filesize($docfile));
                        fclose($handle);
                    } else {
                        debug("Specified file cannot be found or read:'{$docfile}'");
                    }
                }
                // check whether the lines contain html.
                // If there are the popup will still function but with visible elements
                // better use iframe for text with html
                if (strlen($lines) != strlen(strip_tags($lines))) {
                    debug("Popup: '{$rel_id}{$randnum}' contains HTML elements.");
                    debug("A text popup should only contain plain text.");
                    debug("Try using fb_type iframe with an url pointing to a saved file instead.");
                }
                // couldn't get it to work correctly with an object (kept on forcing its own default size)
                // just specifying a span had the same result; can't use div and so on because pop-up
                // can be within an open paragraph
                // so switched to textarea (which is more customisable anyway); cols and rows are there for valid html
                $anchor_obj = sprintf("<span style=\"display: none\"><span id=\"%s%s\"><textarea class=\"%s\" style=\"width: %s; height: %s; overflow: auto; color: %s; background-color: %s\" readonly=\"readonly\" cols=\"\" rows=\"\">%s</textarea></span></span>", $rel_id, $randnum, $txtcls, $objwidth, $objheight, $txtcol, $txtcolbg, $lines);
                $code = $code . $anchor_obj;
                if ('center' == $align) {
                    $code = '<p class="pivotx-wrapper">' . $code . '</p>';
                }
            } else {
                if ($fb_type == 'iframe') {
                    // filename is not mandatory so fix an empty one with dummy string so code gets returned
                    if (empty($filename)) {
                        $filename = '==fbdummy==';
                    }
                    // use random number to be fairly sure that constructed rel will be unique
                    // if by chance the number is the same then iframe will open but clicking
                    // in the frame itself will be impossible
                    $randnum = rand();
                    $code = sprintf("<a href=\"%s\" class=\"fancyframe\" title=\"%s\" rel=\"%s%s%s\" >%s</a>", $url, $title, $rel_id, $uid, $randnum, $thumbname);
                    if ('center' == $align) {
                        $code = '<p class="pivotx-wrapper">' . $code . '</p>';
                    }
                } else {
                    if ($fb_type == 'flash') {
                        // filename is not mandatory so fix an empty one with dummy string so code gets returned
                        if (empty($filename)) {
                            $filename = '==fbdummy==';
                        }
                        // use random number to be fairly sure that constructed rel will be unique
                        // if by chance the number is the same then flash will open but clicking
                        // in the window itself will be impossible
                        $randnum = rand();
                        $code = sprintf("<a href=\"%s\" class=\"fancyflash\" title=\"%s\" rel=\"%s%s%s\" >%s</a>", $url, $title, $rel_id, $uid, $randnum, $thumbname);
                        if ('center' == $align) {
                            $code = '<p class="pivotx-wrapper">' . $code . '</p>';
                        }
                    }
                }
            }
        }
    }
    $PIVOTX['extensions']->addHook('after_parse', 'callback', 'fancyboxIncludeCallback');
    // not every type uses parm file so var filename gets a dummy value in those types
    if (!empty($filename)) {
        return $code;
    } else {
        return "";
    }
}
コード例 #19
0
ファイル: step2_check.php プロジェクト: hcopr/Hubbub
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule . index.php [L]
</IfModule>

AddHandler php5-script .php');

$_SESSION['installer']['server_base'] = $_REQUEST['serverurl'];
$_SESSION['installer']['admin_password'] = $_REQUEST['adminpw'];
$_SESSION['installer']['remote_cron_svc'] = $_REQUEST['pingsvc'];

$_SESSION['installer']['cfg']['service']['server'] = $_REQUEST['serverurl'];
$_SESSION['installer']['cfg']['service']['adminpw'] = $_REQUEST['adminpw'];
unset($_SESSION['installer']['cfg']['cron']);
$_SESSION['installer']['cfg']['ping']['remote'] = $_REQUEST['pingsvc'] == 'Y';
$_SESSION['installer']['cfg']['ping']['password'] = getDefault($_SESSION['installer']['cfg']['ping']['password'], randomHashId());
$_SESSION['installer']['cfg']['ping']['server'] = getDefault($_SESSION['installer']['cfg']['ping']['server'], 'http://ping.openfu.net');

if($_REQUEST['pingsvc'] == 'Y')
{
  newFile('conf/pingpassword', $_SESSION['installer']['cfg']['ping']['password']);
  $pingRequest = cqrequest($_SESSION['installer']['cfg']['ping']['server'], array('origin' => 'http://'.$_SESSION['installer']['server_base'].'/cron.php', 'request' => 'activate', 
    'password' => $_SESSION['installer']['cfg']['ping']['password']), 2);   
  unlink('conf/pingpassword');
  if($pingRequest['data']['result'] == 'OK')
  {
    $msg .= '<div class="green">✔ &nbsp; Joined remote ping service ('.$_SESSION['installer']['cfg']['ping']['server'].')</div>';
    $pingStatus = $pingRequest['data'];
    $pingStatus['server'] = $pingServer;
  }
  else
  {
コード例 #20
0
ファイル: ajaxhelper.php プロジェクト: laiello/pivotx-sqlite
 /**
  * Ajax helper function to facilitate the selection of files from the images/
  * folder.
  *
  */
 public static function ext_fileSelector()
 {
     global $PIVOTX;
     $PIVOTX['session']->minLevel(PIVOTX_UL_NORMAL);
     $path = $PIVOTX['paths']['upload_base_path'];
     $url = $PIVOTX['paths']['upload_base_url'];
     if (empty($path) || empty($url)) {
         echo "Can't continue: paths not set..";
         die;
     }
     $breadcrumbs = array("<a href='#' onclick=\"fileSelectorChangefolder('')\">" . basename($path) . "</a>");
     if (!empty($_POST['folder'])) {
         $folder = fixPath($_POST['folder']) . "/";
         $path .= $folder;
         $url .= $folder;
         $incrementalpath = "";
         foreach (explode("/", $folder) as $item) {
             if (!empty($item)) {
                 $incrementalpath = $incrementalpath . $item . "/";
                 $breadcrumbs[] = sprintf("<a href='#' onclick=\"fileSelectorChangefolder('%s')\">%s</a>", $incrementalpath, $item);
             }
         }
     }
     $breadcrumbs = implode(" &raquo; ", $breadcrumbs);
     $files = array();
     $folders = array();
     $d = dir($path);
     while (false !== ($filename = $d->read())) {
         if (strpos($filename, '.thumb.') !== false || strpos($filename, '._') !== false || $filename == ".DS_Store" || $filename == "Thumbs.db" || $filename == "." || $filename == ".." || $filename == ".svn") {
             // Skip this one..
             continue;
         }
         if (is_file($path . $filename)) {
             $files[$filename]['link'] = $url . urlencode($filename);
             $files[$filename]['name'] = trimText($filename, 50);
             $ext = strtolower(getExtension($filename));
             $files[$filename]['ext'] = $ext;
             $files[$filename]['bytesize'] = filesize($path . "/" . $filename);
             $files[$filename]['size'] = formatFilesize($files[$filename]['bytesize']);
             if (in_array($ext, array('gif', 'jpg', 'jpeg', 'png'))) {
                 $dim = getimagesize($path . "/" . $filename);
                 $files[$filename]['dimension'] = sprintf('%s &#215; %s', $dim[0], $dim[1]);
                 $files[$filename]['image_type'] = $ext;
             }
             $files[$filename]['path'] = $folder . $filename;
         }
         if (is_dir($path . $filename)) {
             $folders[$filename] = array('link' => $url . urlencode($filename), 'name' => trimText($filename, 50), 'path' => $folder . $filename);
         }
     }
     $d->close();
     ksort($folders);
     ksort($files);
     echo "<div id='fileselector'>";
     printf("<p><strong>%s:</strong> %s </p>", __("Current path"), $breadcrumbs);
     foreach ($folders as $folder) {
         printf("<div class='folder'><a href='#' onclick=\"fileSelectorChangefolder('%s'); return false;\">%s</a></div>", addslashes($folder['path']), $folder['name']);
     }
     foreach ($files as $file) {
         if ($PIVOTX['config']->get('fileselector_thumbs') && !empty($file['image_type'])) {
             $height = getDefault($PIVOTX['config']->get('fileselector_thumbs_height'), 40);
             $link_text = sprintf("<img src='%sincludes/timthumb.php?h=%s&amp;src=%s' alt='%s' title='%s'>", $PIVOTX['paths']['pivotx_url'], $height, $file['path'], $file['name'], $file['name']);
             $extra_style = "style='height: {$height}px; margin-bottom: 5px;'";
         } else {
             $link_text = $file['name'];
             $extra_style = "";
         }
         printf("<div class='file' {$extra_style}><a href='#' onclick=\"fileSelectorChoose('%s'); return false;\">%s</a> <span>(%s%s)</span></div>", addslashes($file['path']), $link_text, $file['size'], !empty($file['dimension']) ? " - " . $file['dimension'] . " px" : "");
     }
     echo "</div>";
     //echo "<pre>\n"; print_r($folders); echo "</pre>";
     //echo "<pre>\n"; print_r($files); echo "</pre>";
 }
コード例 #21
0
ファイル: signin.widget.php プロジェクト: hcopr/Hubbub
?>
  <div class="paragraph padded_extra" style="width: 550px">      
    <? 
      /* fixme: Twitter Signin is broken 
      if($GLOBALS['config']['twitter']['enabled'] === true) $signInLinks[] = '<a class="btn" href="'.actionUrl('twitter', 'signin').'">Twitter</a>';
      */
      if($GLOBALS['config']['facebook']['enabled'] === true) $signInLinks[] = '<a class="btn" href="'.actionUrl('fb', 'signin').'">Facebook</a>';
      $signInLinks[] = '<a class="btn" href="'.actionUrl('google', 'signin').'">Google</a>';
      $signInLinks[] = '<a class="btn" href="'.actionUrl('yahoo', 'signin').'">Yahoo</a>';
      $signInLinks[] = '<a class="btn" onclick="$(\'#signinform\').html($(\'#signinform_openid\').html());">OpenID</a>';
      $signInLinks[] = '<a class="btn" onclick="$(\'#signinform\').html($(\'#signinform_email\').html());">Email</a>';
      print(implode(' ', $signInLinks));
    ?><br/><br/>
    <div id="signinform">
      <? include('mvc/signin/signin.ajax_'.getDefault($_SESSION['load_signin'], 'email').'form.php'); ?>
    </div>
    <div id="signinform_email" style="display:none">
      <? include('mvc/signin/signin.ajax_emailform.php'); ?>
    </div>
    <div id="signinform_openid" style="display:none">
      <? include('mvc/signin/signin.ajax_openidform.php'); ?>
    </div>
    <div style="margin-bottom: 8px; margin-top: 4px;">
    <?
    if($_REQUEST['controller'] == 'signin')
    {
    ?>
      <input type="radio" name="signin_mode" value="existing" id="mode_existing" checked="true"/> <label for="mode_existing"><?php 
echo l10n('mode.signin');
?>
コード例 #22
0
/**
 * Inserts a linked list to the the different weblogs.
 *
 * @param array $params
 * @param object $smarty
 * @return string
 */
function smarty_weblog_list($params, &$smarty)
{
    global $PIVOTX;
    $params = cleanParams($params);
    $aExclude = array();
    if (!empty($params['exclude'])) {
        $aExclude = explode(",", $params['exclude']);
        $aExclude = array_map("trim", $aExclude);
        $aExclude = array_map("safe_string", $aExclude);
    }
    $Current_weblog = $PIVOTX['weblogs']->getCurrent();
    $format = getDefault($params['format'], "<li %active%><a href='%link%' title='%payoff%'>%display%</a></li>");
    $active = getDefault($params['current'], "class='activepage'");
    $output = array();
    $weblogs = $PIVOTX['weblogs']->getWeblogs();
    //echo "<pre>\n"; print_r($weblogs); echo "</pre>";
    foreach ($weblogs as $key => $weblog) {
        if (in_array(safeString($weblog['name']), $aExclude)) {
            continue;
        }
        $this_output = $format;
        $this_output = str_replace("%link%", $weblog['link'], $this_output);
        $this_output = str_replace("%name%", $weblog['name'], $this_output);
        $this_output = str_replace("%display%", $weblog['name'], $this_output);
        $this_output = str_replace("%payoff%", cleanAttributes($weblog['payoff']), $this_output);
        $this_output = str_replace("%internal%", $key, $this_output);
        if ($Current_weblog == $key) {
            $this_output = str_replace("%active%", $active, $this_output);
        } else {
            $this_output = str_replace("%active%", "", $this_output);
        }
        $output[$weblog['name']] .= $this_output;
    }
    if ($params['sort'] == "title") {
        ksort($output);
    }
    return stripslashes(implode("\n", $output));
}
コード例 #23
0
/**
 * Output a slideshow feed as a template
 *
 * @param array $params
 * @return string
 */
function smarty_slideshow($params)
{
    global $PIVOTX, $slideshow_config;
    static $slideshowcount = 0;
    $js_insert = <<<EOF
<script type="text/javascript">
jQuery(window).bind("load", function(){
    jQuery("div#pivotx-slideshow-%count%").slideView(%parms%);
    setTimeout('slideNext_%count%()', %timeout%);
});

function slideNext_%count%() {

    if( typeof slideNext_%count%.currentslide == 'undefined' ) {
        slideNext_%count%.currentslide = 0;
    }

    var slidewidth = jQuery("div#pivotx-slideshow-%count%").find("li").find("img").width();
    var amountofslides = %amount% - 1; 

    if (amountofslides > slideNext_%count%.currentslide) {
        slideNext_%count%.currentslide++;
    } else {
        slideNext_%count%.currentslide = 0;
    }

    var xpos = (-slidewidth * slideNext_%count%.currentslide);
    jQuery("div#pivotx-slideshow-%count%").find("ul").animate({ left: xpos}, 1200, "easeInOutExpo");  

    setTimeout('slideNext_%count%()', %timeout%);

}
</script>
EOF;
    $params = clean_params($params);
    foreach (array('timeout', 'folder', 'width', 'height', 'limit', 'orderby', 'popup', 'recursion', 'nicenamewithdirs', 'iptcindex', 'iptcencoding') as $key) {
        if (isset($params[$key])) {
            ${$key} = $params[$key];
        } else {
            ${$key} = getDefault($PIVOTX['config']->get('slideshow_' . $key), $slideshow_config['slideshow_' . $key]);
        }
    }
    $imagefolder = addTrailingSlash($PIVOTX['paths']['upload_base_path'] . $folder);
    $ok_extensions = explode(",", "jpg,jpeg,png,gif");
    if (!file_exists($imagefolder) || !is_dir($imagefolder)) {
        debug("Image folder {$imagefolder} does not exist.");
        echo "Image folder {$imagefolder} does not exist.";
        return "";
    } else {
        if (!is_readable($imagefolder)) {
            debug("Image folder {$imagefolder} is not readable.");
            echo "Image folder {$imagefolder} is not readable.";
            return "";
        }
    }
    $images = array();
    $key = "";
    if ($recursion == 'no') {
        $dirs = array($imagefolder);
    } else {
        $dirs = slideshowGetDirs($imagefolder, $recursion);
        if ($recursion == 'all') {
            array_unshift($dirs, $imagefolder);
        }
    }
    foreach ($dirs as $folder) {
        $dir = dir($folder);
        while (false !== ($entry = $dir->read())) {
            if (in_array(strtolower(getExtension($entry)), $ok_extensions)) {
                if (strpos($entry, ".thumb.") > 0) {
                    continue;
                }
                $entry = $folder . $entry;
                if ($orderby == 'date_asc' || $orderby == 'date_desc') {
                    $key = filemtime($entry) . rand(10000, 99999);
                    $images[$key] = $entry;
                } else {
                    $images[] = $entry;
                }
            }
        }
        $dir->close();
    }
    if ($orderby == 'date_asc') {
        ksort($images);
    } else {
        if ($orderby == 'date_desc') {
            ksort($images);
            $images = array_reverse($images);
        } else {
            if ($orderby == 'alphabet') {
                natcasesort($images);
            } else {
                shuffle($images);
            }
        }
    }
    // Cut it to the desired length..
    $images = array_slice($images, 0, $limit);
    // Built the parms
    $tooltip = getDefault($PIVOTX['config']->get('slideshow_tooltip'), $slideshow_config['slideshow_tooltip']);
    $ttopacity = getDefault($PIVOTX['config']->get('slideshow_ttopacity'), $slideshow_config['slideshow_ttopacity']);
    $uibefore = getDefault($PIVOTX['config']->get('slideshow_uibefore'), $slideshow_config['slideshow_uibefore']);
    $zc = getDefault($PIVOTX['config']->get('slideshow_zc'), $slideshow_config['slideshow_zc']);
    $zcimg = '';
    if (isset($zc)) {
        $zcimg = '&amp;zc=' . $zc;
    }
    if ($tooltip == 1) {
        $parms = "{toolTip: true";
    } else {
        $parms = "{toolTip: false";
    }
    $parms .= ", ttOpacity: " . $ttopacity;
    if ($uibefore == 1) {
        $parms .= ", uiBefore: true}";
    } else {
        $parms .= ", uiBefore: false}";
    }
    $js_insert = str_replace('%timeout%', $timeout, $js_insert);
    $js_insert = str_replace('%count%', $slideshowcount, $js_insert);
    $js_insert = str_replace('%amount%', count($images), $js_insert);
    $js_insert = str_replace('%parms%', $parms, $js_insert);
    $PIVOTX['extensions']->addHook('after_parse', 'insert_before_close_head', $js_insert);
    // If a specific popup type is selected execute the callback.
    if ($popup != 'no') {
        $callback = $popup . "IncludeCallback";
        if (function_exists($callback)) {
            $PIVOTX['extensions']->addHook('after_parse', 'callback', $callback);
        } else {
            debug("There is no function '{$callback}' - the popups won't work.");
        }
    }
    $output = "\n<div id=\"pivotx-slideshow-{$slideshowcount}\" class=\"svw\">\n<ul>\n";
    foreach ($images as $image) {
        $file = $image;
        $image = str_replace($PIVOTX['paths']['upload_base_path'], '', $image);
        $image = str_replace(DIRECTORY_SEPARATOR, '/', $image);
        $nicefilename = formatFilename($image, $nicenamewithdirs);
        $title = false;
        if ($iptcindex) {
            getimagesize($file, $iptc);
            if (is_array($iptc) && $iptc['APP13']) {
                $iptc = iptcparse($iptc['APP13']);
                $title = $iptc[$iptcindex][0];
                if ($iptcencoding) {
                    $title = iconv($iptcencoding, 'UTF-8', $title);
                }
                $title = cleanAttributes($title);
            }
        }
        if (!$title) {
            $title = $nicefilename;
        }
        $line = "<li>\n";
        if ($popup != 'no') {
            $line .= sprintf("<a href=\"%s%s\" class=\"{$popup}\" rel=\"slideshow\" title=\"%s\">\n", $PIVOTX['paths']['upload_base_url'], $image, $title);
        }
        $line .= sprintf("<img src=\"%sincludes/timthumb.php?src=%s&amp;w=%s&amp;h=%s%s\" " . "alt=\"%s\" width=\"%s\" height=\"%s\" />\n", $PIVOTX['paths']['pivotx_url'], rawurlencode($image), $width, $height, $zcimg, $title, $width, $height);
        if ($popup != 'no') {
            $line .= "</a>";
        }
        $line .= "</li>\n";
        $output .= $line;
    }
    $output .= "</ul>\n</div>\n";
    $slideshowcount++;
    return $output;
}
コード例 #24
0
/**
 * Enter description here...
 *
 */
function handlePostComment()
{
    global $weblogmessage, $PIVOTX, $temp_comment;
    $entry = $PIVOTX['db']->read_entry($_POST['piv_code']);
    // Check if we're allowed to comment on this entry. 'isset' is needed, because old entries
    // might not have 'allow comments' set to either choice.
    if (isset($entry['allow_comments']) && $entry['allow_comments'] == 0) {
        echo "Spam is not appreciated.";
        logspammer($_POST['piv_comment'], "closedcomments");
        die;
    }
    // execute a hook here before a comment is processed
    $PIVOTX['extensions']->executeHook('comment_before_processing', $entry);
    $registered = 0;
    // check if the current poster is a (logged in) registered visitor.
    require_once $PIVOTX['paths']['pivotx_path'] . 'modules/module_userreg.php';
    $visitors = new Visitors();
    if ($visitor = $visitors->isLoggedIn()) {
        if ($visitor['name'] == $_POST['piv_name']) {
            $registered = 1;
        }
    }
    // Strip out HTML from input..
    $_POST['piv_name'] = strip_tags($_POST['piv_name']);
    $_POST['piv_email'] = strip_tags($_POST['piv_email']);
    $_POST['piv_url'] = strip_tags($_POST['piv_url']);
    if ($PIVOTX['config']->get('allow_html_in_comments') == 1) {
        $_POST['piv_comment'] = stripTagsAttributes($_POST['piv_comment'], "*");
    } else {
        $_POST['piv_comment'] = stripTagsAttributes($_POST['piv_comment'], "<b><em><i><strong>");
    }
    // Do some more processing on the comment itself: trimming, standardizing line-breaks.
    $comment_text = stripTrailingSpace($_POST['piv_comment']);
    $comment_text = str_replace("\r\n", "\n", $comment_text);
    // CRLF(Win) to LF
    $comment_text = str_replace("\r", "\n", $comment_text);
    // CR(Mac) to LF
    $temp_comment = array('entry_uid' => intval($_POST['piv_code']), 'name' => encodeText($_POST['piv_name']), 'email' => encodeText($_POST['piv_email']), 'url' => encodeText($_POST['piv_url']), 'ip' => $_SERVER['REMOTE_ADDR'], 'useragent' => $_SERVER['HTTP_USER_AGENT'], 'date' => formatDate("", "%year%-%month%-%day%-%hour24%-%minute%"), 'comment' => $comment_text, 'registered' => $registered, 'notify' => intval($_POST['piv_notify']), 'discreet' => intval($_POST['piv_discreet']), 'rememberinfo' => intval($_POST['piv_rememberinfo']), 'moderate' => $PIVOTX['config']->get('moderate_comments'), 'spamscore' => 0);
    if ($temp_comment['rememberinfo'] == 1) {
        rememberCommentInfo($temp_comment);
    }
    //here we do a check to prevent double entries...
    $duplicate = FALSE;
    if (isset($entry['comments']) && count($entry['comments']) > 0) {
        foreach ($entry['comments'] as $loop_comment) {
            $diff = 1 / (min(strlen($loop_comment['comment']), 200) / (levenshtein(substr($loop_comment['comment'], 0, 200), substr($temp_comment['comment'], 0, 200)) + 1));
            if ($diff < 0.25 && $loop_comment['ip'] == $temp_comment['ip']) {
                $duplicate = TRUE;
                break;
            }
        }
    }
    // Check for Hashcash violations..
    if ($PIVOTX['config']->get('hashcash') == 1 && !hashcash_check_hidden_tag()) {
        $weblogmessage = getDefault($PIVOTX['config']->get('hashcash_message'), __('The Hashcash code was not valid, so this comment could not be posted. If you believe this is an error, please make sure you have a modern browser, and that Javascript is enabled. If it still doesn\'t work, contact the maintainer of this website.'));
        unset($_POST['post']);
        $_POST['preview'] = true;
        $spammessage = substr(implode(", ", $temp_comment), 0, 250);
        logspammer($_SERVER["REMOTE_ADDR"], "hashcash", "pom pom pom", $spammessage);
    }
    // Check for SpamQuiz violations, but not when previewing..
    if ($PIVOTX['config']->get('spamquiz') == 1 && !isset($_POST['preview'])) {
        // Is the entry old enough?
        $entryDate = substr($PIVOTX['db']->entry['date'], 0, 10);
        $then = strtotime($entryDate);
        $secsPerDay = 60 * 60 * 24;
        $now = strtotime('now');
        $diff = $now - $then;
        $dayDiff = $diff / $secsPerDay;
        $numDaysOld = (int) $dayDiff;
        if ($numDaysOld > $PIVOTX['config']->get("spamquiz_age")) {
            if (strtolower($_POST['spamquiz_answer']) != strtolower($PIVOTX['config']->get("spamquiz_answer"))) {
                $weblogmessage = __('The Spamquiz answer was not correct, so this comment could not be posted. If you believe this is an error, please try again. If it still doesn\'t work, contact the maintainer of this website.');
                unset($_POST['post']);
                $_POST['preview'] = true;
                logspammer($_SERVER["REMOTE_ADDR"], "spamquiz");
            } else {
                // Store the correct answer in a cookie.
                $sess = $PIVOTX['session'];
                setcookie("spamquiz_answer", $_POST["spamquiz_answer"], time() + $sess->cookie_lifespan, $sess->cookie_path, $sess->cookie_domain);
            }
        }
    }
    // set the message and take proper action:
    if (isset($_POST['preview'])) {
        // Add a 'show in preview' flag to $temp_comment, otherwise it would be suppressed on display
        $temp_comment['showpreview'] = 1;
        // update the current entry
        $entry['comments'][] = $temp_comment;
        if (empty($weblogmessage)) {
            $weblogmessage = __('You are previewing your comment. Be sure to click on "Post Comment" to store it.');
        }
        unset($_POST['post']);
        $_POST['preview'] = TRUE;
    } else {
        if ($temp_comment['spamscore'] > $PIVOTX['config']->get('spamthreshold')) {
            // Add a 'show in preview' flag to $temp_comment, otherwise it would be suppressed on display
            $temp_comment['showpreview'] = 1;
            $weblogmessage = __('Your comment has not been stored, because it seems to be spam.');
            unset($_POST['post']);
            $_POST['preview'] = TRUE;
        } else {
            if ($duplicate) {
                $temp_comment['duplicate'] = true;
                // Add a 'show in preview' flag to $temp_comment, otherwise it would be suppressed on display
                $temp_comment['showpreview'] = 1;
                $weblogmessage = __('Your comment has not been stored, because it seems to be a duplicate of a previous entry.');
                unset($_POST['post']);
                $_POST['preview'] = TRUE;
            } else {
                if ($PIVOTX['config']->get('moderate_comments') == 1) {
                    // update the current entry
                    $entry['comments'][] = $temp_comment;
                    $weblogmessage = __('Your comment has been stored. Because comment moderation is enabled, it is now waiting for approval by an editor.');
                    $_POST['post'] = TRUE;
                } else {
                    // update the current entry
                    $entry['comments'][] = $temp_comment;
                    $weblogmessage = __('Your comment has been stored.');
                    $_POST['post'] = TRUE;
                }
            }
        }
    }
    // if comment or name is missing, give a notice, and show the form again..
    if (strlen($temp_comment['name']) < 2) {
        $weblogmessage = __('You should type your name (or an alias) in the "name"-field. Be sure to click on "Post Comment" to store it permanently.');
        unset($_POST['post']);
        $_POST['preview'] = TRUE;
    }
    if (strlen($temp_comment['comment']) < 3) {
        $weblogmessage = __('You should type something in the "comment"-field. Be sure to click on "Post Comment" to store it permanently.');
        unset($_POST['post']);
        $_POST['preview'] = TRUE;
    }
    if ($PIVOTX['config']->get('maxhrefs') > 0) {
        $low_comment = strtolower($temp_comment['comment']);
        $low_comment_formatted = strtolower(commentFormat($temp_comment['comment']));
        if (substr_count($low_comment, "href=") > $PIVOTX['config']->get('maxhrefs') || substr_count($low_comment_formatted, "href=") > $PIVOTX['config']->get('maxhrefs')) {
            $weblogmessage = __('The maximum number of hyperlinks was exceeded. Stop spamming.');
            unset($_POST['post']);
            $_POST['preview'] = TRUE;
        }
    }
    // execute a hook here after a comment is processed but before that comment is saved
    $PIVOTX['extensions']->executeHook('comment_before_save', $entry);
    if (isset($_POST['post'])) {
        $PIVOTX['db']->set_entry($entry);
        $PIVOTX['db']->save_entry(FALSE);
        // do not update the index.
        // Remove the compiled/parsed pages from the cache.
        if ($PIVOTX['config']->get('smarty_cache')) {
            $PIVOTX['template']->clear_cache();
        }
        //update the 'latest comments' file
        if (isset($temp_comment)) {
            if ($PIVOTX['config']->get('moderate_comments') != 1) {
                generateLatestComments($temp_comment);
                debug("comment from '" . $_POST['piv_name'] . "' added.");
            } else {
                generateModerationQueue($temp_comment);
                debug("comment from '" . $_POST['piv_name'] . "' added to moderation queue.");
            }
        }
        // Handle the users that want to be notified via email..
        if ($PIVOTX['config']->get('dont_send_mail_notification') != 1) {
            $notifications = sendMailNotification('comment', array($PIVOTX['db']->entry, $temp_comment, $PIVOTX['config']->get('moderate_comments')));
        }
        // send mail..
        sendMailComment($temp_comment, $notifications);
        // Don't display the 'preview' of the comment after posting.
        $temp_comment = array();
        unset($_POST);
        // Clean the simple cache..
        $PIVOTX['cache']->clear();
        // Remove the compiled/parsed pages from the cache.
        if ($PIVOTX['config']->get('smarty_cache')) {
            $PIVOTX['template']->clear_cache();
        }
        // Redirect to the entrypage from which we came. (prevents reload-resubmit)
        $uri = $_SERVER['REQUEST_URI'];
        if (strpos($uri, "?") > 0) {
            $uri .= "&weblogmessage=" . urlencode($weblogmessage);
        } else {
            $uri .= "?weblogmessage=" . urlencode($weblogmessage);
        }
        header('Location: ' . $uri);
        exit;
    }
    // Set the 'you are previewing' message..
    if (isset($_POST['preview']) && empty($weblogmessage)) {
        $weblogmessage = __('You are previewing your comment. Be sure to click on "Post Comment" to store it.');
    }
    // execute a hook here after a comment is saved and the mails are sent
    $PIVOTX['extensions']->executeHook('comment_after_save', $entry);
    // After messing about with the comments, clear the cache.
    $PIVOTX['cache']->cache['entries'] = array();
}
コード例 #25
0
ファイル: signin.reset.php プロジェクト: hcopr/Hubbub
<table width="900" align="center">
  <tr>
    <td>
    
    <h2><?php 
echo l10n('email.recovery');
?>
 <a href="./"><?php 
echo $this->srvName;
?>
</a></h2>
    
    <br/>
    <div class="balloon">
      <b>Welcome, <?php 
echo getDefault($this->usr['u_name'], $this->uds['ia_url']);
?>
</b>
    </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')
コード例 #26
0
ファイル: objects.php プロジェクト: laiello/pivotx-sqlite
 function Events()
 {
     global $PIVOTX;
     $this->filename = "ser_events.php";
     $this->edittimeout = 60;
     $this->maxevents = getDefault($PIVOTX['config']->get('eventlog_length'), 200);
     $this->data = loadSerialize($PIVOTX['paths']['db_path'] . $this->filename, true);
     // Make sure we have a proper $this->maxevents..
     if (intval($this->maxevents) < 10) {
         $this->maxevents = 200;
     }
     // Make sure $this->data is set.
     if (empty($this->data) || !is_array($this->data)) {
         $this->data = array();
     }
 }
コード例 #27
0
ファイル: genlib.php プロジェクト: hcopr/Hubbub
function ageToString($unixDate, $new = 'new', $ago = 'ago')
{
    if ($unixDate == 0) {
        return '-';
    }
    $result = '';
    $oneMinute = 60;
    $oneHour = $oneMinute * 60;
    $oneDay = $oneHour * 24;
    $difference = time() - $unixDate;
    if ($difference < $oneMinute) {
        $result = $new;
    } else {
        if ($difference < $oneHour) {
            $result = round($difference / $oneMinute) . ' min ' . $ago;
        } else {
            if ($difference < $oneDay) {
                $result = floor($difference / $oneHour) . ' h ' . $ago;
            } else {
                if ($difference < $oneDay * 5) {
                    $result = gmdate(getDefault(cfg('service/dateformat-week'), 'l · H:i'), $unixDate);
                } else {
                    if ($difference < $oneDay * 365) {
                        $result = gmdate(getDefault(cfg('service/dateformat-year'), 'M dS · H:i'), $unixDate);
                    } else {
                        $result = date(getDefault(cfg('service/dateformat'), 'd. M Y · H:i'), $unixDate);
                    }
                }
            }
        }
    }
    return $result;
}
コード例 #28
0
ファイル: module_tags.php プロジェクト: laiello/pivotx-sqlite
/**
 * Make a link to any given $tag.
 *
 * @param string $tag
 * @param string $template
 * @return string
 */
function tagLink($tag, $template = "")
{
    global $PIVOTX;
    $Current_weblog = $PIVOTX['weblogs']->getCurrent();
    $tag = normalizeTag($tag);
    $site_url = getDefault($PIVOTX['weblogs']->get($Current_weblog, 'site_url'), $PIVOTX['paths']['site_url']);
    if ($PIVOTX['config']->get('mod_rewrite') == 0) {
        $link = $site_url . "?t=" . urlencode($tag);
        if (paraWeblogNeeded($Current_weblog)) {
            $link .= "&amp;w=" . para_weblog($Current_weblog);
        }
        if ($template != "") {
            $link .= "&amp;t={$template}";
        }
    } else {
        $prefix = getDefault($PIVOTX['config']->get('localised_tag_prefix'), 'tag');
        $link = $site_url . makeURI($prefix) . '/' . urlencode($tag);
        if (paraWeblogNeeded($Current_weblog)) {
            $link .= "/" . para_weblog($Current_weblog);
        }
        if ($template != "") {
            $link .= "/?t={$template}";
        }
    }
    // Check if there's a hook set, and if so call it.
    if ($PIVOTX['extensions'] && $PIVOTX['extensions']->hasHook('make_link#tag')) {
        $PIVOTX['extensions']->executeHook('make_link#tag', $link, array('tag' => $tag, 'w' => $Current_weblog));
    }
    return $link;
}
コード例 #29
0
ファイル: index.php プロジェクト: hcopr/Hubbub
ob_start();
chdir($GLOBALS['APP.BASEDIR']);
require 'lib/genlib.php';
require 'lib/hubbub2.php';
require 'lib/database.php';
profile_point('classes ready');
require 'lib/config.php';
profile_point('config loaded');
h2_init_hubbub_environment();
// if there was output up to this point, it has to be an error message
$GLOBALS['content.startuperrors'] = trim(ob_get_clean());
// enable gzip compression by default
profile_point('environment ready');
WriteToFile('log/activity.log', 'call ' . $_REQUEST['controller'] . '-' . $_REQUEST['action'] . "\n");
// instantiate controller, invoke action, render view
$_REQUEST['controller'] = getDefault($_REQUEST['controller'], cfg('service/defaultcontroller'));
$baseCtr = h2_getController($_REQUEST['controller']);
profile_point('controller invoked');
h2_invokeAction($baseCtr, $_REQUEST['action']);
profile_point('action executed');
$GLOBALS['content']['main'] = h2_invokeView($baseCtr, $_REQUEST['action']);
profile_point('view executed');
// output through page template
$templateName = cfg('page/template', 'default');
switch ($templateName) {
    case 'blank':
        print $GLOBALS['content']['main'];
        break;
    default:
        header('content-type: text/html;charset=UTF-8');
        require 'themes/' . cfg('theme/name', 'default') . '/' . $templateName . '.php';
コード例 #30
0
ファイル: server.status.php プロジェクト: hcopr/Hubbub
  {
    $pingRequest = cqrequest($pingServer, array('origin' => 'http://'.cfg('service/server').'/cron.php', 'request' => 'activate', 'password' => cfg('ping/password')), 2);   
    if($pingRequest['data']['result'] == 'OK')
    {
      $btype = 'win';
      $lastPingText = 'Connection with ping server established, waiting for ping from '.$pingServer.'...';
      $pingStatus = $pingRequest['data'];
      $pingStatus['server'] = $pingServer;
      h2_nv_store('ping/status', $pingStatus);
      @unlink('log/cron.last.log');
    }
    else
    {
      $btype = 'fail';
      $reason = $pingRequest['data']['reason'];
      $lastPingText = 'Could not establish connection with ping server. Reason: '.getDefault($reason, 'server not found');
    }
  }
}
?><div class="banner <?php 
echo $btype;
?>
">
  <?php 
echo $lastPingText;
?>
</div><?
$ping_status = ob_get_clean();


ob_start();