当前位置: 首页>>代码示例>>PHP>>正文


PHP Timestamp::getUNIXtime方法代码示例

本文整理汇总了PHP中Timestamp::getUNIXtime方法的典型用法代码示例。如果您正苦于以下问题:PHP Timestamp::getUNIXtime方法的具体用法?PHP Timestamp::getUNIXtime怎么用?PHP Timestamp::getUNIXtime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Timestamp的用法示例。


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

示例1: FAS_Call

function FAS_Call($type, $name, $title, $url, $content)
{
    $context = Model_Context::getInstance();
    $pool = DBModel::getInstance();
    $blogstr = $context->getProperty('uri.host') . $context->getProperty('uri.blog');
    $DDosTimeWindowSize = 300;
    $rpc = new XMLRPC();
    $rpc->url = 'http://antispam.textcube.org/RPC/';
    if ($rpc->call('checkSpam', $blogstr, $type, $name, $title, $url, $content, $_SERVER['REMOTE_ADDR']) == false) {
        // call fail
        // Do Local spam check with "Thief-cat algorithm"
        $count = 0;
        if ($type == 2) {
            $storage = "RemoteResponses";
            $pool->reset($storage);
            $pool->setQualifier("url", "eq", $url, true);
            $pool->setQualifier("isfiltered", ">", 0);
            if ($cnt = $pool->getCount("id")) {
                $count += $cnt;
            }
        } else {
            // Comment Case
            $storage = "Comments";
            $pool->reset($storage);
            $pool->setQualifier("comment", "eq", ${$content}, true);
            $pool->setQualifier("name", "eq", $name, true);
            $pool->setQualifier("homepage", "eq", $url, true);
            $pool->setQualifier("isfiltered", ">", 0);
            if ($cnt = $pool->getCount("id")) {
                $count += $cnt;
            }
        }
        // Check IP
        $pool->reset($storage);
        $pool->setQualifier("ip", "eq", $_SERVER['REMOTE_ADDR'], true);
        $pool->setQualifier("written", ">", Timestamp::getUNIXtime() - $DDosTimeWindowSize);
        if ($cnt = $pool->getCount("id")) {
            $count += $cnt;
        }
        if ($count >= 10) {
            return false;
        }
        return true;
    }
    if (!is_null($rpc->fault)) {
        // FAS has some problem
        return true;
    }
    if ($rpc->result['result'] == true) {
        return false;
        // it's spam
    }
    return true;
}
开发者ID:Avantians,项目名称:Textcube,代码行数:54,代码来源:index.php

示例2: dumbCronScheduler

function dumbCronScheduler($checkOnly = true)
{
    $context = Model_Context::getInstance();
    $now = Timestamp::getUNIXtime();
    $dumbCronStamps = Setting::getServiceSetting('dumbCronStamps', serialize(array('1m' => 0, '5m' => 0, '30m' => 0, '1h' => 0, '2h' => 0, '6h' => 0, '12h' => 0, '24h' => 0, 'Daily' => 0)), true);
    $dumbCronStamps = unserialize($dumbCronStamps);
    $schedules = array('1m' => 60, '5m' => 60 * 5, '10m' => 60 * 10, '30m' => 60 * 30, '1h' => 60 * 60, '2h' => 60 * 60 * 2, '6h' => 60 * 60 * 6, '12h' => 60 * 60 * 12, '24h' => 60 * 60 * 24, 'Daily' => 60 * 60 * 24, '1w' => 60 * 60 * 24 * 7);
    /* Events: Cron1m, Cron5m, Cron30m, Cron1h, Cron2h, Cron6h, Cron12h */
    $log_file = __TEXTCUBE_CACHE_DIR__ . '/cronlog.txt';
    $log = fopen($log_file, "a");
    foreach ($schedules as $d => $diff) {
        if (!isset($dumbCronStamps[$d])) {
            $dumbCronStamps[$d] = 0;
        }
        if ($now > $diff + $dumbCronStamps[$d]) {
            if ($checkOnly && eventExists("Cron{$d}")) {
                fclose($log);
                return true;
            }
            fireEvent("Cron{$d}", null, $now);
            if ($d == '6h') {
                importlib('model.blog.trash');
                trashVan();
            }
            fwrite($log, date('Y-m-d H:i:s') . ' ' . $context->getProperty('blog.name') . " Cron{$d} executed ({$_SERVER['REQUEST_URI']})\r\n");
            $dumbCronStamps[$d] = $now;
        }
    }
    fclose($log);
    /* Keep just 1000 lines */
    $logcontent = explode("\r\n", file_get_contents($log_file));
    $logcontent = implode("\r\n", array_slice($logcontent, -1000));
    $log = fopen($log_file, "w");
    fwrite($log, $logcontent);
    fclose($log);
    Setting::setServiceSetting('dumbCronStamps', serialize($dumbCronStamps), true);
    return false;
}
开发者ID:Avantians,项目名称:Textcube,代码行数:38,代码来源:cron.php

示例3: publishEntries

function publishEntries()
{
    $ctx = Model_Context::getInstance();
    $pool = DBModel::getInstance();
    $blogid = getBlogId();
    $closestReservedTime = Setting::getBlogSettingGlobal('closestReservedPostTime', INT_MAX);
    if ($closestReservedTime < Timestamp::getUNIXtime()) {
        $pool->init("Entries");
        $pool->setQualifier("blogid", "eq", $blogid);
        $pool->setQualifier("draft", "eq", 0);
        $pool->setQualifier("visibility", "<", 0);
        $pool->setQualifier("published", "<", Timestamp::getUNIXtime());
        $entries = $pool->getAll("id, visibility, category");
        if (count($entries) == 0) {
            return;
        }
        foreach ($entries as $entry) {
            $pool->init("Entries");
            $pool->setQualifier("blogid", "eq", $blogid);
            $pool->setQualifier("draft", "eq", 0);
            $pool->setQualifier("id", "eq", $entry['id']);
            $pool->setAttribute("visibility", 0);
            $result = $pool->update();
            if ($entry['visibility'] == -3) {
                if ($result && setEntryVisibility($entry['id'], 2)) {
                    $updatedEntry = getEntry($blogid, $entry['id']);
                    if (!is_null($updatedEntry)) {
                        fireEvent('UpdatePost', $entry['id'], $updatedEntry);
                        setEntryVisibility($entry['id'], 3);
                    }
                }
            } else {
                if ($result) {
                    setEntryVisibility($entry['id'], abs($entry['visibility']));
                    $updatedEntry = getEntry($blogid, $entry['id']);
                    if (!is_null($updatedEntry)) {
                        fireEvent('UpdatePost', $entry['id'], $updatedEntry);
                    }
                }
            }
        }
        $pool->init("Entries");
        $pool->setQualifier("blogid", "eq", $blogid);
        $pool->setQualifier("draft", "eq", 0);
        $pool->setQualifier("visibility", "<", 0);
        $pool->setQualifier("published", ">", Timestamp::getUNIXtime());
        $newClosestTime = $pool->getCell("min(published)");
        if (!empty($newClosestTime)) {
            Setting::setBlogSettingGlobal('closestReservedPostTime', $newClosestTime);
        } else {
            Setting::setBlogSettingGlobal('closestReservedPostTime', INT_MAX);
        }
    }
}
开发者ID:ni5am,项目名称:Textcube,代码行数:54,代码来源:entry.php

示例4: api_addAttachment

function api_addAttachment($blogid, $parent, $file)
{
    $pool = DBModel::getInstance();
    $attachment = array();
    $attachment['parent'] = $parent ? $parent : 0;
    $attachment['label'] = Path::getBaseName($file['name']);
    $label = Utils_Unicode::lessenAsEncoding($attachment['label'], 64);
    $attachment['size'] = $file['size'];
    $extension = Path::getExtension($attachment['label']);
    switch (strtolower($extension)) {
        case '.exe':
        case '.php':
        case '.sh':
        case '.com':
        case '.bat':
            $extension = '.xxx';
            break;
    }
    /* Create directory for owner */
    $path = __TEXTCUBE_ATTACH_DIR__ . "/{$blogid}";
    if (!is_dir($path)) {
        mkdir($path);
        if (!is_dir($path)) {
            return false;
        }
        @chmod($path, 0777);
    }
    $pool->reset('Attachments');
    $pool->setQualifier('blogid', 'eq', $blogid);
    $pool->setQualifier('parent', 'eq', $parent);
    $pool->setQualifier('label', 'eq', $label, true);
    $oldFile = $pool->getCell('name');
    if ($oldFile !== null) {
        $attachment['name'] = $oldFile;
    } else {
        $attachment['name'] = rand(1000000000, 9999999999) . $extension;
        while (Attachment::doesExist($attachment['name'])) {
            $attachment['name'] = rand(1000000000, 9999999999) . $extension;
        }
    }
    $attachment['path'] = "{$path}/{$attachment['name']}";
    deleteAttachment($blogid, -1, $attachment['name']);
    if ($file['content']) {
        $f = fopen($attachment['path'], "w");
        if (!$f) {
            return false;
        }
        $attachment['size'] = fwrite($f, $file['content']);
        fclose($f);
        $file['tmp_name'] = $attachment['path'];
    }
    if ($imageAttributes = @getimagesize($file['tmp_name'])) {
        $attachment['mime'] = $imageAttributes['mime'];
        $attachment['width'] = $imageAttributes[0];
        $attachment['height'] = $imageAttributes[1];
    } else {
        $attachment['mime'] = Utils_Misc::getMIMEType($extension);
        $attachment['width'] = 0;
        $attachment['height'] = 0;
    }
    $attachment['mime'] = Utils_Unicode::lessenAsEncoding($attachment['mime'], 32);
    @chmod($attachment['path'], 0666);
    $pool->reset('Attachments');
    $pool->setAttribute('blogid', $blogid);
    $pool->setAttribute('parent', $attachment['parent']);
    $pool->setAttribute('name', $attachment['name'], true);
    $pool->setAttribute('label', $label, true);
    $pool->setAttribute('mime', $attachment['mime'], true);
    $pool->setAttribute('size', $attachment['size'], true);
    $pool->setAttribute('width', $attachment['width']);
    $pool->setAttribute('height', $attachment['height']);
    $pool->setAttribute('attached', Timestamp::getUNIXtime());
    $pool->setAttribute('downloads', 0);
    $pool->setAttribute('enclosure', 0);
    $result = $pool->insert();
    if (!$result) {
        @unlink($attachment['path']);
        return false;
    }
    return $attachment;
}
开发者ID:Avantians,项目名称:Textcube,代码行数:81,代码来源:api.php

示例5: getHumanReadable

 static function getHumanReadable($time = null, $from = null)
 {
     if (is_null($from)) {
         $deviation = Timestamp::getUNIXtime() - Timestamp::getUNIXtime($time);
     } else {
         $deviation = Timestamp::getUNIXtime($from) - Timestamp::getUNIXtime($time);
     }
     if ($deviation > 0) {
         // Past.
         if ($deviation < 60) {
             return _f('%1초 전', $deviation);
         } else {
             if ($deviation < 3600) {
                 return _f('%1분 전', intval($deviation / 60));
             } else {
                 if ($deviation < 86400) {
                     return _f('%1시간 전', intval($deviation / 3600));
                 } else {
                     if ($deviation < 604800) {
                         return _f('%1일 전', intval($deviation / 86400));
                     } else {
                         return _f('%1주 전', intval($deviation / 604800));
                     }
                 }
             }
         }
     } else {
         $deviation = abs($deviation);
         if ($deviation < 60) {
             return _f('%1초 후', $deviation);
         } else {
             if ($deviation < 3600) {
                 return _f('%1분 후', intval($deviation / 60));
             } else {
                 if ($deviation < 86400) {
                     return _f('%1시간 후', intval($deviation / 3600));
                 } else {
                     if ($deviation < 604800) {
                         return _f('%1일 후', intval($deviation / 86400));
                     } else {
                         return _f('%1주 후', intval($deviation / 604800));
                     }
                 }
             }
         }
     }
 }
开发者ID:mclkim,项目名称:kaiser,代码行数:47,代码来源:Timer.php

示例6: addBlog

function addBlog($blogid, $userid, $identify)
{
    $ctx = Model_Context::getInstance();
    $pool = DBModel::getInstance();
    if (empty($userid)) {
        $userid = 1;
        // If no userid, choose the service administrator.
    } else {
        $pool->reset('Users');
        $pool->setQualirifer('userid', 'eq', $userid);
        if (!$pool->doesExist('userid')) {
            return 3;
        }
        // 3: No user exists with specific userid
    }
    if (!empty($blogid)) {
        // If blogid,
        $pool->reset('BlogSettings');
        $pool->setQualirifer('blogid', 'eq', $blogid);
        if (!$pool->doesExist('blogid')) {
            return 2;
        }
        // 2: No blog exists with specific blogid
        // Thus, blog and user exists. Now combine both.
        $pool->reset('Privileges');
        $pool->setAttribute('blogid', $blogid);
        $pool->setAttribute('userid', $userid);
        $pool->setAttribute('acl', 0);
        $pool->setAttribute('created', Timestamp::getUNIXtime());
        $pool->setAttribute('lastlogin', 0);
        $result = $pool->insert();
        return $result;
    } else {
        // If no blogid, create a new blog.
        if (!preg_match('/^[a-zA-Z0-9]+$/', $identify)) {
            return 4;
        }
        // Wrong Blog name
        $identify = POD::escapeString(Utils_Unicode::lessenAsEncoding($identify, 32));
        $blogName = $identify;
        $pool->reset('ReservedWords');
        $pool->setQualifier('word', 'eq', $blogName, true);
        $result = $pool->getCount();
        if ($result && $result > 0) {
            return 60;
            // Reserved blog name.
        }
        $pool->reset('BlogSettings');
        $pool->setQualifier('name', 'eq', 'name', true);
        $pool->setQualifier('value', 'eq', $blogName, true);
        $result = $pool->getCount('value');
        if ($result && $result > 0) {
            return 61;
            // Same blogname is already exists.
        }
        $pool->reset('BlogSettings');
        $blogid = $pool->getCell('max(blogid)') + 1;
        $basicInformation = array('name' => $identify, 'defaultDomain' => 0, 'title' => '', 'description' => '', 'logo' => '', 'logoLabel' => '', 'logoWidth' => 0, 'logoHeight' => 0, 'useFeedViewOnCategory' => 1, 'useSloganOnPost' => 1, 'useSloganOnCategory' => 1, 'useSloganOnTag' => 1, 'entriesOnPage' => 10, 'entriesOnList' => 10, 'entriesOnRSS' => 10, 'commentsOnRSS' => 10, 'publishWholeOnRSS' => 1, 'publishEolinSyncOnRSS' => 1, 'allowWriteOnGuestbook' => 1, 'allowWriteDblCommentOnGuestbook' => 1, 'visibility' => 2, 'language' => $ctx->getProperty('service.language'), 'blogLanguage' => $ctx->getProperty('service.language'), 'timezone' => $ctx->getProperty('service.timezone'));
        $isFalse = false;
        foreach ($basicInformation as $fieldname => $fieldvalue) {
            if (Setting::setBlogSettingDefault($fieldname, $fieldvalue, $blogid) === false) {
                $isFalse = true;
            }
        }
        if ($isFalse == true) {
            $pool->reset('BlogSettings');
            $pool->setQualifier('blogid', 'eq', $blogid);
            $pool->delete();
            return 12;
        }
        $pool->reset('SkinSettings');
        $pool->setAttribute('blogid', $blogid);
        $pool->setAttribute('name', 'skin', true);
        $pool->setAttribute('value', $ctx->getProperty('service.skin'), true);
        if (!$pool->insert()) {
            deleteBlog($blogid);
            return 13;
        }
        $pool->reset('FeedSettings');
        $pool->setAttribute('blogid', $blogid);
        if (!$pool->insert()) {
            deleteBlog($blogid);
            return 62;
        }
        $pool->reset('FeedGroups');
        $pool->setAttribute('blogid', $blogid);
        $pool->setAttribute('id', 0);
        if (!$pool->insert()) {
            deleteBlog($blogid);
            return 62;
        }
        Setting::setBlogSettingGlobal('defaultEditor', 'modern', $blogid);
        Setting::setBlogSettingGlobal('defaultFormatter', 'ttml', $blogid);
        //Combine user and blog.
        $pool->reset('Privileges');
        $pool->setAttribute('blogid', $blogid);
        $pool->setAttribute('userid', $userid);
        $pool->setAttribute('acl', 16);
        $pool->setAttribute('created', Timestamp::getUNIXtime());
        $pool->setAttribute('lastlogin', 0);
//.........这里部分代码省略.........
开发者ID:ragi79,项目名称:Textcube,代码行数:101,代码来源:blog.blogSetting.php

示例7: array

/// Copyright (c) 2004-2016, Needlworks  / Tatter Network Foundation
/// All rights reserved. Licensed under the GPL.
/// See the GNU General Public License for more details. (/documents/LICENSE, /documents/COPYRIGHT)
require ROOT . '/library/preprocessor.php';
$IV = array('GET' => array('user' => array('email'), 'blogid' => array('id')));
requireStrictRoute();
requirePrivilege('group.creators');
$userid = User::getUserIdByEmail($_GET['user']);
$bid = $_GET['blogid'];
if (empty($userid)) {
    Respond::ResultPage(array(-1, "존재하지 않는 사용자"));
}
$pool = DBModel::getInstance();
$pool->init("Privileges");
$pool->setQualifier("blogid", "eq", $bid);
$pool->setQualifier("userid", "eq", $userid);
$acl = $pool->getCell("acl");
if ($acl === null) {
    // If there is no ACL, add user into the blog.
    $pool->init("Privileges");
    $pool->setAttribute("blogid", $bid);
    $pool->setAttribute("userid", $userid);
    $pool->setAttribute("acl", 0);
    $pool->setAttribute("created", Timestamp::getUNIXtime());
    $pool->setAttribute("lastlogin", 0);
    $pool->insert();
    Respond::ResultPage(0);
} else {
    Respond::ResultPage(array(-2, "이미 참여중인 사용자"));
}
开发者ID:webhacking,项目名称:Textcube,代码行数:30,代码来源:index.php

示例8: initializeRSSchannel

function initializeRSSchannel($blogid = null)
{
    global $serviceURL, $defaultURL, $blogURL, $blog;
    if (empty($blogid)) {
        $blogid = getBlogId();
    }
    $channel = array();
    $channel['title'] = RSSMessage($blog['title']);
    $channel['link'] = "{$defaultURL}/";
    $channel['description'] = RSSMessage($blog['description']);
    $channel['language'] = $blog['language'];
    $channel['pubDate'] = Timestamp::getUNIXtime();
    $channel['generator'] = TEXTCUBE_NAME . ' ' . TEXTCUBE_VERSION;
    if (Setting::getBlogSettingGlobal('visibility', 2) == 2 && !empty($blog['logo']) && file_exists(ROOT . "/attach/{$blogid}/{$blog['logo']}")) {
        $logoInfo = getimagesize(ROOT . "/attach/{$blogid}/{$blog['logo']}");
        $channel['url'] = $serviceURL . "/attach/" . $blogid . "/" . $blog['logo'];
        $channel['width'] = $logoInfo[0];
        $channel['height'] = $logoInfo[1];
    }
    return $channel;
}
开发者ID:hinablue,项目名称:TextCube,代码行数:21,代码来源:blog.feed.php

示例9: MT_Cover_getRecentEntries

function MT_Cover_getRecentEntries($parameters)
{
    global $database, $blog, $service, $serviceURL, $suri, $configVal, $defaultURL, $skin;
    requireModel("blog.entry");
    requireModel("blog.tag");
    $data = Setting::fetchConfigVal($configVal);
    $data['coverMode'] = !isset($data['coverMode']) ? 1 : $data['coverMode'];
    if (Misc::isMetaBlog() != true) {
        $data['coverMode'] = 1;
    }
    $data['screenshot'] = !isset($data['screenshot']) ? 1 : $data['screenshot'];
    $data['screenshotSize'] = !isset($data['screenshotSize']) ? 90 : $data['screenshotSize'];
    $data['paging'] = !isset($data['paging']) ? '2' : $data['paging'];
    $data['contentLength'] = !isset($data['contentLength']) ? 250 : $data['contentLength'];
    if (isset($parameters['preview'])) {
        // preview mode
        $retval = '표지에 최신 글 목록을 추가합니다.';
        return htmlspecialchars($retval);
    }
    $entryLength = isset($parameters['entryLength']) ? $parameters['entryLength'] : 10;
    if (!is_dir(__TEXTCUBE_CACHE_DIR__ . "/thumbnail")) {
        @mkdir(__TEXTCUBE_CACHE_DIR__ . "/thumbnail");
        @chmod(__TEXTCUBE_CACHE_DIR__ . "/thumbnail", 0777);
    }
    if (!is_dir(__TEXTCUBE_CACHE_DIR__ . "/thumbnail/" . getBlogId())) {
        @mkdir(__TEXTCUBE_CACHE_DIR__ . "/thumbnail/" . getBlogId());
        @chmod(__TEXTCUBE_CACHE_DIR__ . "/thumbnail/" . getBlogId(), 0777);
    }
    if (!is_dir(__TEXTCUBE_CACHE_DIR__ . "/thumbnail/" . getBlogId() . "/coverPostThumbnail/")) {
        @mkdir(__TEXTCUBE_CACHE_DIR__ . "/thumbnail/" . getBlogId() . "/coverPostThumbnail/");
        @chmod(__TEXTCUBE_CACHE_DIR__ . "/thumbnail/" . getBlogId() . "/coverPostThumbnail/", 0777);
    }
    $page = $data['paging'] == '1' && !empty($_GET['page']) ? intval($_GET['page']) : 1;
    $cache = new PageCache();
    $cache->name = 'MT_Cover_RecentPS';
    if ($cache->load()) {
        //If successful loads
        $cache->contents = unserialize($cache->contents);
        // If coverpage is single mode OR coverpage is coverblog and cache is not expired, return cache contents.
        if (($data['coverMode'] == 1 || $data['coverMode'] == 2) && array_key_exists($page, $cache->contents) && Timestamp::getUNIXtime() - $cache->dbContents < 300) {
            return $cache->contents[$page];
        }
    }
    if (Misc::isMetaBlog() == true && doesHaveOwnership() && $service['type'] != 'single') {
        $visibility = 'AND e.visibility > 1 AND (c.visibility > 1 OR e.category = 0)';
    } else {
        $visibility = doesHaveOwnership() ? '' : 'AND e.visibility > 1 AND (c.visibility > 1 OR e.category = 0)';
    }
    $multiple = $data['coverMode'] == 2 ? '' : 'e.blogid = ' . getBlogId() . ' AND';
    $privateBlogId = POD::queryColumn("SELECT blogid \n\t\tFROM {$database['prefix']}BlogSettings\n\t\tWHERE name = 'visibility'\n\t\tAND value < 2");
    if (!empty($privateBlogId)) {
        $privateBlogs = ' AND e.blogid NOT IN (' . implode(',', $privateBlogId) . ')';
    } else {
        $privateBlogs = '';
    }
    list($entries, $paging) = Paging::fetch("SELECT e.blogid, e.id, e.userid, e.title, e.content, e.slogan, e.category, e.published, e.contentformatter, c.label\n\t\tFROM {$database['prefix']}Entries e\n\t\tLEFT JOIN {$database['prefix']}Categories c ON e.blogid = c.blogid AND e.category = c.id\n\t\tWHERE {$multiple} e.draft = 0 {$visibility} AND e.category >= 0 {$privateBlogs}\n\t\tORDER BY published DESC", $page, $entryLength);
    $html = '';
    foreach ((array) $entries as $entry) {
        $tagLabelView = "";
        $blogid = $data['coverMode'] == 2 ? $entry['blogid'] : getBlogId();
        $entryTags = getTags($blogid, $entry['id']);
        $defaultURL = getDefaultURL($blogid);
        if (sizeof($entryTags) > 0) {
            $tags = array();
            foreach ($entryTags as $entryTag) {
                $tags[$entryTag['name']] = "<a href=\"{$defaultURL}/tag/" . (Setting::getBlogSettingGlobal('useSloganOnTag', true) ? URL::encode($entryTag['name'], $service['useEncodedURL']) : $entryTag['id']) . '">' . htmlspecialchars($entryTag['name']) . '</a>';
            }
            $tagLabelView = "<div class=\"post_tags\"><span>TAG : </span>" . implode(",\r\n", array_values($tags)) . "</div>";
        }
        if (empty($entry['category'])) {
            $entry['label'] = _text('분류없음');
            $entry['link'] = "{$defaultURL}/category";
        } else {
            $entry['link'] = "{$defaultURL}/category/" . (Setting::getBlogSettingGlobal('useSloganOnCategory', true) ? URL::encode($entry['label'], $service['useEncodedURL']) : $entry['category']);
        }
        $permalink = "{$defaultURL}/" . (Setting::getBlogSettingGlobal('useSloganOnPost', true) ? "entry/" . URL::encode($entry['slogan'], $service['useEncodedURL']) : $entry['id']);
        $html .= '<div class="coverpost">' . CRLF;
        if ($imageName = MT_Cover_getAttachmentExtract($entry['content'])) {
            if (($tempImageSrc = MT_Cover_getImageResizer($blogid, $imageName, $data['screenshotSize'])) && $data['screenshot'] == 1) {
                $html .= '<div class="img_preview"><a href="' . $permalink . '"><img src="' . $tempImageSrc . '" alt="" /></a></div>' . CRLF;
            }
        }
        $html .= '	<div class="content_box">';
        $html .= '		<h2><a href="' . $permalink . '">' . htmlspecialchars($entry['title']) . '</a></h2>' . CRLF;
        $html .= '		<div class="post_info">' . CRLF;
        $html .= '			<span class="category"><a href="' . htmlspecialchars($entry['link']) . '">' . htmlspecialchars($entry['label']) . '</a></span>' . CRLF;
        $html .= '			<span class="date">' . Timestamp::format5($entry['published']) . '</span>' . CRLF;
        $html .= '			<span class="author"><span class="preposition">by </span>' . User::getName($entry['userid']) . '</span>' . CRLF;
        $html .= '		</div>' . CRLF;
        $html .= '		<div class="post_content">' . htmlspecialchars(Utils_Unicode::lessenAsEm(removeAllTags(stripHTML($entry['content'])), $data['contentLength'])) . '</div>' . CRLF;
        $html .= $tagLabelView;
        $html .= '		<div class="clear"></div>' . CRLF;
        $html .= '	</div>';
        $html .= '</div>' . CRLF;
    }
    if ($data['paging'] == '1') {
        $paging['page'] = $page;
        $paging['total'] = POD::queryCell("SELECT COUNT(*) FROM {$database['prefix']}Entries e WHERE {$multiple} e.draft = 0 {$visibility} AND e.category >= 0");
        $html .= getPagingView($paging, $skin->paging, $skin->pagingItem) . CRLF;
        $html .= '<script type="text/javascript">' . CRLF;
//.........这里部分代码省略.........
开发者ID:ragi79,项目名称:Textcube,代码行数:101,代码来源:index.php

示例10: initializeRSSchannel

function initializeRSSchannel($blogid = null)
{
    $context = Model_Context::getInstance();
    if (empty($blogid)) {
        $blogid = getBlogId();
    }
    $channel = array();
    $channel['title'] = RSSMessage($context->getProperty('blog.title'));
    $channel['link'] = $context->getProperty('uri.default') . "/";
    $channel['description'] = RSSMessage($context->getProperty('blog.description'));
    $channel['language'] = $context->getProperty('blog.language');
    $channel['pubDate'] = Timestamp::getUNIXtime();
    $channel['generator'] = TEXTCUBE_NAME . ' ' . TEXTCUBE_VERSION;
    if (Setting::getBlogSettingGlobal('visibility', 2) == 2 && $context->getProperty('blog.logo') && file_exists(__TEXTCUBE_ATTACH_DIR__ . "/{$blogid}/" . $context->getProperty('blog.logo'))) {
        $logoInfo = getimagesize(__TEXTCUBE_ATTACH_DIR__ . "/{$blogid}/" . $context->getProperty('blog.logo'));
        $channel['url'] = $context->getProperty('uri.service') . "/attach/" . $blogid . "/" . $context->getProperty('blog.logo');
        $channel['width'] = $logoInfo[0];
        $channel['height'] = $logoInfo[1];
    }
    return $channel;
}
开发者ID:Avantians,项目名称:Textcube,代码行数:21,代码来源:feed.php

示例11: trashVan

function trashVan()
{
    global $database;
    requireModel('common.setting');
    if (Timestamp::getUNIXtime() - Setting::getServiceSetting('lastTrashSweep', 0, true) > 86400) {
        //		var_dump(Timestamp::getUNIXtime());
        //		var_dump(Setting::getServiceSetting('lastTrashSweep',0, true));
        POD::execute("DELETE FROM {$database['prefix']}Comments where isfiltered < " . Timestamp::getUNIXtime() . " - 1296000 AND isfiltered > 0");
        POD::execute("DELETE FROM {$database['prefix']}RemoteResponses where isfiltered < " . Timestamp::getUNIXtime() . " - 1296000 AND isfiltered > 0");
        POD::execute("DELETE FROM {$database['prefix']}RefererLogs WHERE referred < " . Timestamp::getUNIXtime() . " - 604800");
        Setting::setServiceSetting('lastTrashSweep', Timestamp::getUNIXtime(), true);
    }
    if (Timestamp::getUNIXtime() - Setting::getServiceSetting('lastNoticeRead', 0, true) > 43200) {
        Setting::removeServiceSetting('TextcubeNotice', true);
        Setting::setServiceSetting('lastNoticeRead', Timestamp::getUNIXtime(), true);
    }
}
开发者ID:hinablue,项目名称:TextCube,代码行数:17,代码来源:blog.trash.php

示例12: add

 function add()
 {
     //		unset($this->id);
     $this->id = $this->getNextLinkId();
     $this->pid = $this->getNextLinkPid();
     if (!isset($this->url)) {
         return $this->_error('url');
     }
     if (!isset($this->title)) {
         return $this->_error('title');
     }
     if (!($query = $this->_buildQuery())) {
         return false;
     }
     if (!isset($this->registered)) {
         $query->setAttribute('written', Timestamp::getUNIXtime());
     }
     if (!$query->insert()) {
         return $this->_error('insert');
     }
     //		$this->id = $query->id;
     return true;
 }
开发者ID:Avantians,项目名称:Textcube,代码行数:23,代码来源:Textcube.Data.Link.php

示例13: add

 function add()
 {
     global $database;
     if (!isset($this->id)) {
         $this->id = $this->nextId();
     } else {
         $this->id = $this->nextId($this->id);
     }
     if (!isset($this->entry)) {
         return $this->_error('entry');
     }
     if (!isset($this->commenter) && !isset($this->name)) {
         return $this->_error('commenter');
     }
     if (!isset($this->content)) {
         return $this->_error('content');
     }
     if (!isset($this->ip)) {
         $this->ip = $_SERVER['REMOTE_ADDR'];
     }
     if (!isset($this->isfiltered)) {
         $this->isfiltered = 0;
     }
     // legacy
     if (isset($this->commenter)) {
         $this->replier = $this->commenter;
         /*unset($this->commenter);*/
     }
     if (!($query = $this->_buildQuery())) {
         return false;
     }
     if (!$query->hasAttribute('written')) {
         $query->setAttribute('written', Timestamp::getUNIXtime());
     }
     if (!$query->insert()) {
         return $this->_error('insert');
     }
     if (isset($this->parent)) {
         $this->entry = Comment::getEntry($this->parent);
     }
     if (isset($this->entry) && $this->isfiltered == 0) {
         POD::execute("UPDATE {$database['prefix']}Entries SET comments = comments + 1 WHERE blogid = " . getBlogId() . " AND id = {$this->entry}");
     }
     return true;
 }
开发者ID:Avantians,项目名称:Textcube,代码行数:45,代码来源:Textcube.Data.Comment.php

示例14: updateXfn

function updateXfn($blogid, $links)
{
    $pool = DBModel::getInstance();
    $ids = array();
    foreach ($links as $k => $v) {
        if (substr($k, 0, 3) == 'xfn') {
            $id = substr($k, 3);
            $xfn = $v;
            $pool->init("Links");
            $pool->setAttribute("xfn", $xfn, true);
            $pool->setAttribute("written", Timestamp::getUNIXtime());
            $pool->setQualifier("blogid", "eq", $blogid);
            $pool->setQualifier("id", "eq", $id);
            $pool->update();
        }
    }
}
开发者ID:webhacking,项目名称:Textcube,代码行数:17,代码来源:link.php

示例15: authorize

 public static function authorize($blogid, $userid)
 {
     if (is_null(self::$mc)) {
         self::initialize();
     }
     $blogid = intval($blogid);
     $userid = intval($userid);
     $session_cookie_path = "/";
     if (!is_null(self::$context->getProperty('service.session_cookie_path'))) {
         $session_cookie_path = self::$context->getProperty('service.session_cookie_path');
     }
     if (!is_numeric($userid)) {
         return false;
     }
     $current = Timestamp::getUNIXtime();
     if (is_null($expires)) {
         $expires = $current + self::$context->getProperty('service.timeout');
     }
     if ($userid != SESSION_OPENID_USERID) {
         /* OpenID session : -1 */
         $_SESSION['userid'] = $userid;
         $id = session_id();
         if (self::isGuestOpenIDSession($id)) {
             //$result = self::$mc->set(self::$context->getProperty('service.domain')."/authorizedSession/{$id}/{$_SERVER['REMOTE_ADDR']}",$userid,0,self::$context->getProperty('service.timeout'));
             $result = self::$mc->set(self::$context->getProperty('service.domain') . "/authorizedSession/{$id}", $userid, 0, $expires);
             if ($result) {
                 return true;
             }
         }
     }
     if (self::isAuthorized(session_id())) {
         return true;
     }
     for ($i = 0; $i < 3; $i++) {
         $id = dechex(rand(0x10000000, 0x7fffffff)) . dechex(rand(0x10000000, 0x7fffffff)) . dechex(rand(0x10000000, 0x7fffffff)) . dechex(rand(0x10000000, 0x7fffffff));
         //$result = self::$mc->set(self::$context->getProperty('service.domain')."/authorizedSession/{$id}/{$_SERVER['REMOTE_ADDR']}",$userid,0,self::$context->getProperty('service.timeout'));
         $result = self::$mc->set(self::$context->getProperty('service.domain') . "/authorizedSession/{$id}", $userid, 0, self::$context->getProperty('service.timeout'));
         if ($result) {
             @session_id($id);
             setcookie(self::getName(), $id, 0, $session_cookie_path, self::$context->getProperty('service.session_cookie_domain'));
             return true;
         }
     }
     return false;
 }
开发者ID:webhacking,项目名称:Textcube,代码行数:45,代码来源:Textcube.Control.Session.Memcached.php


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