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


PHP CUser::getInstance方法代码示例

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


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

示例1: addSubscription

 function addSubscription($params = false)
 {
     $return = false;
     if ($params !== false) {
         if (isset($params['s_email'])) {
             include_once PATH_CLASS . '/CUser.php';
             include_once PATH_CLASS . '/CUserManage.php';
             $us =& CUser::getInstance();
             $usm =& CUserManage::getInstance();
             $otherUser = $us->find(trim($params['s_email']));
             if ($otherUser !== false) {
                 $params['s_userId'] = $otherUser['U_ID'];
                 $params['s_username'] = $otherUser['U_USERNAME'];
                 $usm->addFriend($params['s_userId'], $params['s_u_id']);
             }
         }
         $params['s_key'] = md5(uniqid(rand(), true));
         $params = $this->dbh->asql_safe($params);
         $keys = array_keys($params);
         $sql = 'INSERT INTO user_subscriptions (' . implode(', ', $keys) . ') ' . 'VALUES(' . implode(', ', $params) . ") " . "ON DUPLICATE KEY UPDATE s_status = 'active'";
         $this->dbh->execute($sql);
         $return = true;
     }
     return $return;
 }
开发者ID:jmathai,项目名称:photos,代码行数:25,代码来源:CSubscriptionManage.php

示例2: addComment

 function addComment($element_id = false, $by_user_id = 0, $for_user_id = 0, $comment = false, $type = 'foto', $raw_name = null)
 {
     include_once PATH_INCLUDE . '/functions.php';
     // used to sanitize() comment
     include_once PATH_CLASS . '/CUser.php';
     // use for activity
     include_once PATH_CLASS . '/CUserManage.php';
     // use for activity
     $return = false;
     if ($element_id !== false && $comment !== false) {
         $u =& CUser::getInstance();
         $um =& CUserManage::getInstance();
         $element_id = intval($element_id);
         $comment = $this->dbh->sql_safe(sanitize($comment, array('PRESERVE_ANCHORS' => true)));
         $typeSafe = $this->dbh->sql_safe($type);
         $by_user_id = intval($by_user_id);
         $for_user_id = intval($for_user_id);
         $raw_name = $this->dbh->sql_safe(sanitize($raw_name));
         $sql = 'INSERT INTO comments(c_by_u_id, c_for_u_id, c_element_id, c_name, c_comment, c_type, c_time) ' . 'VALUES(' . $by_user_id . ', ' . $for_user_id . ', ' . $element_id . ', ' . $raw_name . ', ' . $comment . ', ' . $typeSafe . ', ' . NOW . ')';
         $this->dbh->execute($sql);
         $return = $this->dbh->insert_id();
         switch ($type) {
             case 'blog':
                 $element_rep = $element_id;
                 break;
             case 'flix':
                 include_once PATH_CLASS . '/CFlix.php';
                 $f =& CFlix::getInstance();
                 $flixData = $f->search(array('FLIX_ID' => $element_id));
                 $element_rep = $flixData['US_KEY'];
                 break;
             case 'foto':
                 include_once PATH_CLASS . '/CFotobox.php';
                 $fb =& CFotobox::getInstance();
                 $fotoData = $fb->fotoData($element_id);
                 $element_rep = $fotoData['P_KEY'];
                 break;
         }
         $forUserData = $u->find($for_user_id);
         $byUserData = $u->find($by_user_id);
         $um->addActivity($by_user_id, $return, 'newComment', $byUserData['U_USERNAME'], $forUserData['U_USERNAME'], $element_rep, $type);
     }
     return $return;
 }
开发者ID:jmathai,项目名称:photos,代码行数:44,代码来源:CComment.php

示例3: isset

<?php

$u =& CUser::getInstance();
$fl =& CFlix::getInstance();
$fb =& CFotobox::getInstance();
$sort = isset($_GET['ORDER']) ? $_GET['ORDER'] : false;
if (!isset($_GET['tags'])) {
    $flix_array = $fl->search(array('MODE' => 'USER', 'USER_ID' => $_USER_ID, 'TYPE' => 'slideshow', 'ORDER_BY' => $sort));
} else {
    $tags = (array) explode(',', $_GET['tags']);
    $flix_array = $fl->search(array('MODE' => 'USER', 'USER_ID' => $_USER_ID, 'TAGS' => $tags, 'TYPE' => 'slideshow', 'ORDER_BY' => $sort));
}
$user_data = $u->find($_USER_ID);
$cnt_flix_array = $flix_array[0]['ROWS'];
$page = isset($_GET['page']) ? intval($_GET['page']) : 1;
$per_page = 12;
$total_pages = ceil($cnt_flix_array / $per_page);
$offset = $page * $per_page - $per_page;
$p =& new CPaging($page, 10, $total_pages, 'page', '/', $_SERVER['QUERY_STRING']);
if ($cnt_flix_array > 0 || isset($_GET['tags'])) {
    if ($cnt_flix_array > 0) {
        echo '<div style="overflow:hidden; padding-top:5px; padding-right:5px; padding-bottom:5px;">';
        echo '<form method="GET" action="">';
        echo '<input type="hidden" name="action" value="flix.flix_list" />';
        if ($sort !== false) {
            echo '<input type="hidden" name="ORDER" value="' . $sort . '" />';
        }
        echo '<div style="float:left; width:114px; padding-right:4px; padding-left:15px;"><input onfocus="this.select();" type="text" value="' . (isset($_GET['tags']) ? $_GET['tags'] : "tag search") . '" id="tags" name="tags" class="formfield" style="width:110px;" onblur="tagSearch()" /></div>';
        echo '<div style="float:left; width:29px; padding-right:4px;"><input type="image" src="images/buttons/go.gif" width="25" height="17" border="0" /></div>';
        echo '</form>';
        echo '<div style="float:right; padding-right:50px;">';
开发者ID:jmathai,项目名称:photos,代码行数:31,代码来源:flix_list.dsp.php

示例4: isset

<?php

$board = CBoard::getInstance();
$user = CUser::getInstance();
if ($_GET['post_id'] == '') {
    echo 'Error';
    exit;
}
$pID = $_GET['post_id'];
// paging info
$currentPage = isset($_GET['page']) ? intval($_GET['page']) : 1;
$limit = 10;
$postData = $board->postByPage($pID, ($currentPage - 1) * $limit, $limit);
$totalRows = $GLOBALS['dbh']->found_rows();
$pagesToDisplay = 6;
$totalPages = ceil($totalRows / $limit);
$page =& new CPaging($currentPage, $pagesToDisplay, $totalPages, 'page', '/', $_SERVER['QUERY_STRING']);
$pages = $page->getPages();
$firstPage = $page->getFirstPage('First');
$lastPage = $page->getLastPage('Last');
$nextPage = $page->getNextPage('Next');
$prevPage = $page->getPrevPage('Previous');
// data for the board this post resides in
$boardData = $board->board($postData[0]['BP_BID']);
// first post to get title
$originalPost = $board->singlePost($pID);
// add a view in the db
$data = array();
$data['bv_bp_id'] = $pID;
$data['bv_u_id'] = $_USER_ID;
$board->addView($data);
开发者ID:jmathai,项目名称:photos,代码行数:31,代码来源:board_post.dsp.php

示例5: setPrivacy

 function setPrivacy($params)
 {
     if (isset($params['FLIX_ID']) && isset($params['USER_ID']) && isset($params['PRIVACY'])) {
         include_once PATH_CLASS . '/CFlix.php';
         include_once PATH_CLASS . '/CUser.php';
         include_once PATH_CLASS . '/CUserManage.php';
         $fl =& CFlix::getInstance();
         $u =& CUser::getInstance();
         $um =& CUserManage::getInstance();
         $params['FLIX_ID_SAFE'] = $this->dbh->sql_safe($params['FLIX_ID']);
         $params['USER_ID_SAFE'] = $this->dbh->sql_safe($params['USER_ID']);
         $params['PRIVACY_SAFE'] = intval($params['PRIVACY']);
         $rs = $this->dbh->query_first($sql);
         $sql = 'UPDATE user_slideshows ' . 'SET us_privacy = ' . $params['PRIVACY_SAFE'] . ' ' . 'WHERE us_id = ' . $params['FLIX_ID_SAFE'] . ' ' . 'AND us_u_id = ' . $params['USER_ID_SAFE'] . ' ';
         if ($params['PRIVACY'] == PERM_SLIDESHOW_PRIVATE) {
             $um->deleteActivity($params['USER_ID'], $params['FLIX_ID'], 'newSlideshow');
         } else {
             $userData = $u->find($params['USER_ID']);
             $flixData = $fl->search(array('FLIX_ID' => $params['FLIX_ID'], 'USER_ID' => $params['USER_ID']));
             $firstPhoto = $fl->firstPhoto($flixData['US_ELEMENTS']);
             $um->addActivity($params['USER_ID'], $params['FLIX_ID'], 'newSlideshow', $userData['U_USERNAME'], $firstPhoto['thumbnailPath_str'], $flixData['US_KEY']);
         }
         $this->dbh->execute($sql);
         return true;
     } else {
         return false;
     }
 }
开发者ID:jmathai,项目名称:photos,代码行数:28,代码来源:CFlixManage.php

示例6: add

 function add($data)
 {
     $retval = 0;
     if (is_array($data)) {
         include_once PATH_CLASS . '/CUser.php';
         include_once PATH_CLASS . '/CUserManage.php';
         $u =& CUser::getInstance();
         $um =& CUserManage::getInstance();
         $key = $data['v_key'];
         $userId = intval($data['uv_u_id']);
         $thumb1 = $data['v_screen115x50'];
         $thumb2 = $data['v_screen150x100'];
         if (!empty($data['uv_tags'])) {
             $data['uv_tags'] = array_filter((array) $data['uv_tags'], 'tagtrim');
             array_walk($data['uv_tags'], 'tagwalk');
         }
         $dataSafe = $this->dbh->asql_safe($data);
         $sql = 'INSERT INTO user_videos(' . implode(',', array_keys($dataSafe)) . ', v_dateCreated) ' . 'VALUES(' . implode(',', $dataSafe) . ', NOW())';
         $this->dbh->execute($sql);
         $retval = $this->dbh->insert_id();
         $userData = $u->find($userId);
         // add activity
         $um->addActivity($data['uv_u_id'], $retval, 'newVideo', $userData['U_USENAME'], $thumb1, $key);
     }
     return $retval;
 }
开发者ID:jmathai,项目名称:photos,代码行数:26,代码来源:CVideo.php

示例7: trackSignup

function trackSignup($userId)
{
    $retval = '';
    include_once PATH_CLASS . '/CUser.php';
    include_once PATH_CLASS . '/CUserManage.php';
    $u =& CUser::getInstance();
    $um =& CUserManage::getInstance();
    $prefs = $u->prefs($userId);
    // enter shareasale and google tracking if user has uploaded photos
    if (intval($prefs['HAS_UPLOADED']) > 0 && empty($prefs['SIGNUP_TRACKED'])) {
        $retval = '
                  <!-- Google Code for signup Conversion Page -->
                  <script language="JavaScript" type="text/javascript">
                  <!--
                  var google_conversion_id = 1061541346;
                  var google_conversion_language = "en_US";
                  var google_conversion_format = "1";
                  var google_conversion_color = "FFFFFF";
                  if (1) {
                    var google_conversion_value = 1;
                  }
                  var google_conversion_label = "signup";
                  //-->
                  </script>
                  <script language="JavaScript" src="http://www.googleadservices.com/pagead/conversion.js">
                  </script>
                  <noscript>
                  <img height=1 width=1 border=0 src="http://www.googleadservices.com/pagead/conversion/1061541346/imp.gif?value=1&label=signup&script=0">
                  </noscript>
                  
                  <!-- shareasale conversion tracking code -->
                  <img src="https://shareasale.com/sale.cfm?amount=0.00&tracking=' . $_USER_ID . '&transtype=LEAD&merchantID=12918" width="1" height="1" />
      ';
        $um->setPrefs($userId, array('SIGNUP_TRACKED' => 1));
    }
    return $retval;
}
开发者ID:jmathai,项目名称:photos,代码行数:37,代码来源:functions.php

示例8: uploadMp3

 function uploadMp3($src = false, $dest = false, $data = false)
 {
     if ($src !== false && $dest !== false && $data !== false) {
         if (is_file($src)) {
             $copy_status = copy($src, $dest);
             if ($copy_status === true) {
                 include_once PATH_CLASS . '/CMp3.php';
                 include_once PATH_CLASS . '/CUser.php';
                 include_once PATH_CLASS . '/CUserManage.php';
                 include_once PATH_INCLUDE . '/functions.php';
                 if (isset($data['um_name'])) {
                     $data['um_name'] = sanitize($data['um_name']);
                 }
                 $m =& new CMp3();
                 $u =& CUser::getInstance();
                 $um =& CUserManage::getInstance();
                 $m->load($dest);
                 $length = $m->length();
                 $user_data = $u->find($data['um_u_id']);
                 $um->update(array('u_id' => $data['um_u_id'], 'u_spaceUsed' => intval($data['um_size'] + $user_data['U_SPACEUSED'])));
                 $data['um_length'] = $length;
                 $data = $this->dbh->asql_safe($data);
                 $keys = array_keys($data);
                 $sql = 'INSERT INTO user_mp3s( ' . implode(',', $keys) . ', um_created_at ) ' . 'VALUES( ' . implode(',', $data) . ', NOW() )';
                 $this->dbh->execute($sql);
                 unlink($src);
                 return true;
             }
         }
     }
     return false;
 }
开发者ID:jmathai,项目名称:photos,代码行数:32,代码来源:CFotoboxManage.php

示例9: members

 function members($params)
 {
     include_once PATH_CLASS . '/CUser.php';
     $u =& CUser::getInstance();
     return $u->groupMembers($params);
 }
开发者ID:jmathai,项目名称:photos,代码行数:6,代码来源:CGroup.php

示例10: array

 static function &getInstance()
 {
     static $inst = null;
     $class = __CLASS__;
     if ($inst === null) {
         include_once PATH_CLASS . '/CUser.php';
         $inst = new $class();
         $inst->dbh =& $GLOBALS['dbh'];
         $inst->user =& CUser::getInstance();
         $inst->error = array();
     }
     return $inst;
 }
开发者ID:jmathai,项目名称:photos,代码行数:13,代码来源:CUserManage.php


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