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


PHP NewsStory::setHostname方法代码示例

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


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

示例1: newPost

 function newPost()
 {
     if (!$this->_checkUser($this->params[1], $this->params[2])) {
         $this->response->add(new XoopsXmlRpcFault(104));
     } else {
         if (!($fields =& $this->_getPostFields(null, $this->params[0]))) {
             $this->response->add(new XoopsXmlRpcFault(106));
         } else {
             $missing = array();
             foreach ($fields as $tag => $detail) {
                 if (!isset($this->params[3][$tag])) {
                     $data = $this->_getTagCdata($this->params[3]['xoops_text'], $tag, true);
                     if (trim($data) == '') {
                         if ($detail['required']) {
                             $missing[] = $tag;
                         }
                     } else {
                         $post[$tag] =& $data;
                     }
                 } else {
                     $post[$tag] =& $this->params[3][$tag];
                 }
             }
             if (count($missing) > 0) {
                 $msg = '';
                 foreach ($missing as $m) {
                     $msg .= '<' . $m . '> ';
                 }
                 $this->response->add(new XoopsXmlRpcFault(109, $msg));
             } else {
                 // will be removed... don't worry if this looks bad
                 include_once XOOPS_ROOT_PATH . '/modules/news/class/class.newsstory.php';
                 $story = new NewsStory();
                 $error = false;
                 if (intval($this->params[4]) > 0) {
                     if (!$this->_checkAdmin()) {
                         // non admin users cannot publish
                         $error = true;
                         $this->response->add(new XoopsXmlRpcFault(111));
                     } else {
                         $story->setType('admin');
                         $story->setApproved(true);
                         $story->setPublished(time());
                     }
                 } else {
                     if (!$this->_checkAdmin()) {
                         $story->setType('user');
                     } else {
                         $story->setType('admin');
                     }
                 }
                 if (!$error) {
                     if (isset($post['categories']) && !empty($post['categories'][0])) {
                         $story->setTopicId(intval($post['categories'][0]['categoryId']));
                     } else {
                         $story->setTopicId(1);
                     }
                     $story->setTitle(addslashes(trim($post['title'])));
                     if (isset($post['moretext'])) {
                         $story->setBodytext(addslashes(trim($post['moretext'])));
                     }
                     if (!isset($post['hometext'])) {
                         $story->setHometext(addslashes(trim($this->params[3]['xoops_text'])));
                     } else {
                         $story->setHometext(addslashes(trim($post['hometext'])));
                     }
                     $story->setUid($this->user->getVar('uid'));
                     $story->setHostname($_SERVER['REMOTE_ADDR']);
                     if (!$this->_checkAdmin()) {
                         $story->setNohtml(1);
                     } else {
                         $story->setNohtml(0);
                     }
                     $story->setNosmiley(0);
                     $story->setNotifyPub(1);
                     $story->setTopicalign('R');
                     $ret = $story->store();
                     if (!$ret) {
                         $this->response->add(new XoopsXmlRpcFault(106));
                     } else {
                         $this->response->add(new XoopsXmlRpcString($ret));
                     }
                 }
             }
         }
     }
 }
开发者ID:BackupTheBerlios,项目名称:haxoo-svn,代码行数:87,代码来源:xoopsapi.php

示例2: mktime

         $offset = $xoopsUser->timezone() - $xoopsConfig['server_TZ'];
         $pubdate = $pubdate - $offset * 3600;
         $story->setPublished($pubdate);
     } else {
         $story->setPublished(time());
     }
     if (!empty($_POST['autoexpdate'])) {
         $expdate = mktime($_POST['autoexphour'], $_POST['autoexpmin'], 0, $_POST['autoexpmonth'], $_POST['autoexpday'], $_POST['autoexpyear']);
         $offset = $xoopsUser->timezone() - $xoopsConfig['server_TZ'];
         $expdate = $expdate - $offset * 3600;
         $story->setExpired($expdate);
     } else {
         $story->setExpired(0);
     }
     $story->setType($_POST['type']);
     $story->setHostname(getenv("REMOTE_ADDR"));
     // $story->setNotifyPub($notifypub);
 } else {
     $story = new NewsStory($storyid);
     if (!empty($_POST['autodate'])) {
         $pubdate = mktime($_POST['autohour'], $_POST['automin'], 0, $_POST['automonth'], $_POST['autoday'], $_POST['autoyear']);
         $offset = $xoopsUser->timezone();
         $offset = $offset - $xoopsConfig['server_TZ'];
         $pubdate = $pubdate - $offset * 3600;
         $story->setPublished($pubdate);
     } elseif ($story->published() == 0 && !empty($_POST['approve'])) {
         $story->setPublished(time());
         $isnew = 1;
     } else {
         if (!empty($_POST['movetotop'])) {
             $story->setPublished(time());
开发者ID:koki-h,项目名称:xoops_utf8,代码行数:31,代码来源:index.php

示例3: empty

         $nohtml_db = empty($nohtml) ? 0 : 1;
     }
 } else {
     if ($xoopsModuleConfig['anonpost'] == 1) {
         $uid = 0;
     } else {
         redirect_header("index.php", 3, _NOPERM);
         exit;
     }
 }
 $story = new NewsStory();
 $story->setTitle($subject);
 $story->setHometext($message);
 $story->setUid($uid);
 $story->setTopicId($topic_id);
 $story->setHostname(xoops_getenv('REMOTE_ADDR'));
 $story->setNohtml($nohtml_db);
 $nosmiley = isset($nosmiley) ? intval($nosmiley) : 0;
 $notifypub = isset($notifypub) ? intval($notifypub) : 0;
 $story->setNosmiley($nosmiley);
 $story->setNotifyPub($notifypub);
 $story->setType('user');
 if ($xoopsModuleConfig['autoapprove'] == 1) {
     $approve = 1;
     $story->setApproved($approve);
     $story->setPublished(time());
     $story->setExpired(0);
     $story->setTopicalign('R');
 }
 $result = $story->store();
 if ($result) {
开发者ID:amjadtbssm,项目名称:website,代码行数:31,代码来源:submit.php

示例4: NewsStory

         $links .= _AMS_NW_EXTERNALLINK . ' [url=' . $link['link_link'] . ']' . $link['link_title'] . '[/url]' . "\n";
     }
 }
 // The forum
 $forum = '';
 if ($use_forum && $one_amstopic['forum_id'] != 0) {
     $forum = "\n\n" . '[url=' . XOOPS_URL . '/modules/newbb/viewforum.php?forum=' . $one_amstopic['forum_id'] . ']' . _AMS_AM_LINKEDFORUM . '[/url]' . "\n";
 }
 // We create the story
 $news = new NewsStory();
 $news->setUid($text_lastversion['uid']);
 $news->setTitle($article['title']);
 $news->created = $article['created'];
 $news->setPublished($article['published']);
 $news->setExpired($article['expired']);
 $news->setHostname($article['hostname']);
 $news->setNohtml($article['nohtml']);
 $news->setNosmiley($article['nosmiley']);
 $news->setHometext($text_lastversion['hometext']);
 $news->setBodytext($text_lastversion['bodytext'] . $links . $forum);
 $news->Setkeywords('');
 $news->Setdescription('');
 $news->counter = $article['counter'];
 $news->setTopicId($news_topicid);
 $news->setIhome($article['ihome']);
 $news->setNotifyPub($article['notifypub']);
 $news->story_type = $article['story_type'];
 $news->setTopicdisplay($article['topicdisplay']);
 $news->setTopicalign($article['topicalign']);
 $news->setComments($article['comments']);
 $news->rating = $article['rating'];
开发者ID:BackupTheBerlios,项目名称:haxoo-svn,代码行数:31,代码来源:amsimport.php


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