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


PHP ThemeUtil::getUserIP方法代码示例

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


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

示例1: handleComment

 function handleComment()
 {
     global $_zp_current_image, $_zp_current_album, $_zp_comment_stored, $_zp_current_zenpage_news, $_zp_current_zenpage_page;
     $activeImage = false;
     $comment_error = 0;
     $cookie = zp_getCookie('zenphoto');
     if (isset($_POST['comment'])) {
         if (in_context(ZP_ALBUM) || in_context(ZP_ZENPAGE_NEWS_ARTICLE) || in_context(ZP_ZENPAGE_PAGE)) {
             if (isset($_POST['name'])) {
                 $p_name = sanitize($_POST['name'], 3);
             } else {
                 $p_name = '';
             }
             if (isset($_POST['email'])) {
                 $p_email = sanitize($_POST['email'], 3);
             } else {
                 $p_email = "";
             }
             if (isset($_POST['website'])) {
                 $p_website = sanitize($_POST['website'], 3);
             } else {
                 $p_website = "";
             }
             if (isset($_POST['comment'])) {
                 $p_comment = sanitize($_POST['comment'], 1);
             } else {
                 $p_comment = '';
             }
             $p_server = ThemeUtil::getUserIP();
             if (isset($_POST['code'])) {
                 $code1 = sanitize($_POST['code'], 3);
                 $code2 = sanitize($_POST['code_h'], 3);
             } else {
                 $code1 = '';
                 $code2 = '';
             }
             $p_private = isset($_POST['private']);
             $p_anon = isset($_POST['anon']);
             if (isset($_POST['imageid'])) {
                 //used (only?) by the tricasa hack to know which image the client is working with.
                 $activeImage = zp_load_image_from_id(sanitize_numeric($_POST['imageid']));
                 if ($activeImage !== false) {
                     $commentadded = $activeImage->addComment($p_name, $p_email, $p_website, $p_comment, $code1, $code2, $p_server, $p_private, $p_anon);
                     $redirectTo = $activeImage->getLink();
                 }
             } else {
                 if (in_context(ZP_IMAGE) and in_context(ZP_ALBUM)) {
                     $commentobject = $_zp_current_image;
                     $redirectTo = $_zp_current_image->getLink();
                 } else {
                     if (!in_context(ZP_IMAGE) and in_context(ZP_ALBUM)) {
                         $commentobject = $_zp_current_album;
                         $redirectTo = $_zp_current_album->getAlbumLink();
                     } else {
                         if (in_context(ZP_ZENPAGE_NEWS_ARTICLE)) {
                             $commentobject = $_zp_current_zenpage_news;
                             $redirectTo = FULLWEBPATH . '/index.php?p=' . ZENPAGE_NEWS . '&title=' . $_zp_current_zenpage_news->getTitlelink();
                         } else {
                             if (in_context(ZP_ZENPAGE_PAGE)) {
                                 $commentobject = $_zp_current_zenpage_page;
                                 $redirectTo = FULLWEBPATH . '/index.php?p=' . ZENPAGE_PAGES . '&title=' . $_zp_current_zenpage_page->getTitlelink();
                             }
                         }
                     }
                 }
                 $commentadded = $commentobject->addComment($p_name, $p_email, $p_website, $p_comment, $code1, $code2, $p_server, $p_private, $p_anon);
             }
             $comment_error = $commentadded->getInModeration();
             $_zp_comment_stored = array($commentadded->getName(), $commentadded->getEmail(), $commentadded->getWebsite(), $commentadded->getComment(), false, $commentadded->getPrivate(), $commentadded->getAnon(), $commentadded->getCustomData());
             if (isset($_POST['remember'])) {
                 $_zp_comment_stored[4] = true;
             }
             if (!$comment_error) {
                 if (isset($_POST['remember'])) {
                     // Should always re-cookie to update info in case it's changed...
                     $_zp_comment_stored[3] = '';
                     // clear the comment itself
                     zp_setcookie('zenphoto', implode('|~*~|', $_zp_comment_stored), time() + COOKIE_PESISTENCE, '/');
                 } else {
                     zp_setcookie('zenphoto', '', time() - 368000, '/');
                 }
                 return COMMENT_SUCCESS;
             } else {
                 $comment_error++;
                 if ($activeImage !== false and !in_context(ZP_ZENPAGE_NEWS_ARTICLE) and !in_context(ZP_ZENPAGE_PAGE)) {
                     // tricasa hack? Set the context to the image on which the comment was posted
                     $_zp_current_image = $activeImage;
                     $_zp_current_album = $activeImage->getAlbum();
                     set_context(ZP_IMAGE | ZP_ALBUM | ZP_INDEX);
                 }
             }
         }
     } else {
         if (!empty($cookie)) {
             // Comment form was not submitted; get the saved info from the cookie.
             $_zp_comment_stored = explode('|~*~|', stripslashes($cookie));
             $_zp_comment_stored[4] = true;
             if (!isset($_zp_comment_stored[5])) {
                 $_zp_comment_stored[5] = false;
             }
//.........这里部分代码省略.........
开发者ID:Imagenomad,项目名称:Unsupported,代码行数:101,代码来源:PluginOverrides.php


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