• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

PHP getDefault函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中getDefault函数的典型用法代码示例。如果您正苦于以下问题:PHP getDefault函数的具体用法?PHP getDefault怎么用?PHP getDefault使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: _post_save_vote

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);
    }
}
开发者ID:hcopr,项目名称:Hubbub,代码行数:25,代码来源:post.php


示例2: smarty_lifestream

/**
 * 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;
}
开发者ID:laiello,项目名称:pivotx-sqlite,代码行数:13,代码来源:widget_lifestream.php


示例3: ajax_pingserver

	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><?
      }
    }
  }
开发者ID:hcopr,项目名称:Hubbub,代码行数:35,代码来源:friends.controller.php


示例4: ajax_commiturl

 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());
 }
开发者ID:hcopr,项目名称:Hubbub,代码行数:9,代码来源:settings.controller.php


示例5: ajax_post

 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'));
     }
 }
开发者ID:hcopr,项目名称:Hubbub,代码行数:10,代码来源:msg.controller.php


示例6: trust_sendkey2_receive

/**
 * 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;
}
开发者ID:hcopr,项目名称:Hubbub,代码行数:28,代码来源:trust_sendkey2.php


示例7: returnAllMenuInfo

 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');
 }
开发者ID:adamyWA,项目名称:Menu-CMS,代码行数:45,代码来源:GetMenuItem.php


示例8: setUsername

  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);
	}
开发者ID:hcopr,项目名称:Hubbub,代码行数:20,代码来源:profile.model.php


示例9: tmpl_friendlist

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 
}
开发者ID:hcopr,项目名称:Hubbub,代码行数:39,代码来源:friendlist.php


示例10: trust_sendkey1_receive

/**
 * 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;
}
开发者ID:hcopr,项目名称:Hubbub,代码行数:50,代码来源:trust_sendkey1.php


示例11: getDefault

/**
 * 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)
 */
开发者ID:laiello,项目名称:pivotx-sqlite,代码行数:31,代码来源:lifestream.php


示例12: switch

  $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.'
开发者ID:hcopr,项目名称:Hubbub,代码行数:31,代码来源:exec_do.php


示例13: __init

 function __init()
 {
     $this->invokeModel();
     $srv = getDefault($_SERVER['HTTP_HOST'], l10n('this.server'));
     $this->srvName = strtoupper(substr($srv, 0, 1)) . substr($srv, 1);
 }
开发者ID:hcopr,项目名称:Hubbub,代码行数:6,代码来源:signin.controller.php


示例14: pagem_editcomment

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();
    }
}
开发者ID:laiello,项目名称:pivotx-sqlite,代码行数:53,代码来源:pages.php


示例15: display

 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;
 }
开发者ID:hcopr,项目名称:Hubbub,代码行数:49,代码来源:cq-forms.php


示例16: fputs

        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);
开发者ID:madtomic,项目名称:Fluid-MC-Stats,代码行数:31,代码来源:save-settings.php


示例17: getTracbackKeyJS

/**
 * 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;
}
开发者ID:laiello,项目名称:pivotx-sqlite,代码行数:70,代码来源:module_trackbacks.php


示例18: smarty_fancybox

/**
 * 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;
                    }
                }
//.........这里部分代码省略.........
开发者ID:laiello,项目名称:pivotx-sqlite,代码行数:101,代码来源:snippet_fancybox.php


示例19: unset

  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
  {
开发者ID:hcopr,项目名称:Hubbub,代码行数:31,代码来源:step2_check.php


示例20: ext_fileSelector

 /**
  * 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>";
 }
开发者ID:laiello,项目名称:pivotx-sqlite,代码行数:78,代码来源:ajaxhelper.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP getDefaultLanguage函数代码示例发布时间:2022-05-15
下一篇:
PHP getDefVal函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap