本文整理汇总了PHP中iaUsers::hasIdentity方法的典型用法代码示例。如果您正苦于以下问题:PHP iaUsers::hasIdentity方法的具体用法?PHP iaUsers::hasIdentity怎么用?PHP iaUsers::hasIdentity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类iaUsers
的用法示例。
在下文中一共展示了iaUsers::hasIdentity方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: create
public function create($planId)
{
$entry = array('plan_id' => (int) $planId, 'member_id' => iaUsers::hasIdentity() ? iaUsers::getIdentity()->id : 0, 'status' => self::PENDING);
if ($id = $this->iaDb->insert($entry, array('date_created' => iaDb::FUNCTION_NOW), self::getTable())) {
$entry['id'] = $id;
return $entry;
}
return false;
}
示例2: validate
public function validate()
{
if (iaUsers::hasIdentity()) {
return true;
}
$sc1 = isset($_POST['security_code']) ? $_POST['security_code'] : (isset($_GET['security_code']) ? $_GET['security_code'] : '');
$sc2 = $_SESSION['pass'];
$functionName = $this->iaCore->get('captcha_case_sensitive') ? 'strcmp' : 'strcasecmp';
if (empty($_SESSION['pass']) || $functionName($sc1, $sc2) !== 0) {
return false;
}
$_SESSION['pass'] = '';
return true;
}
示例3: _debugInfo
protected function _debugInfo()
{
$iaCore = iaCore::instance();
$iaCore->factory('users');
self::dump(iaCore::ACCESS_FRONT == $iaCore->getAccessType() ? iaCore::FRONT : iaCore::ADMIN, 'Access Type');
self::dump($iaCore->iaView->getParams(), 'Page', 'info');
self::dump($iaCore->iaView->get('action'), 'Action', 'info');
self::dump($iaCore->iaView->get('filename'), 'Module');
self::dump($iaCore->iaView->language, 'Language');
self::dump(iaUsers::hasIdentity() ? iaUsers::getIdentity(true) : null, 'Identity');
self::dump();
// process blocks
$blocks = array();
if ($blocksData = $iaCore->iaView->blocks) {
foreach ($blocksData as $position => $blocksList) {
$blocks[$position] = array();
foreach ($blocksList as $block) {
$blocks[$position][] = $block['name'];
}
}
}
// process constants
$constantsList = get_defined_constants(true);
foreach ($constantsList['user'] as $key => $value) {
if (strpos($key, 'IA_') === 0 && 'IA_SALT' != $key) {
$constants[$key] = $value;
}
}
self::dump($iaCore->requestPath, 'URL Params');
self::dump($blocks, 'Blocks List');
self::dump($iaCore->packagesData, 'Installed Packages');
self::dump($iaCore->getConfig(), 'Configuration Params');
self::dump($constants, 'Constants List');
if (!empty(self::$_data['info'])) {
foreach (self::$_data['info'] as $key => $val) {
self::dump($val, !is_int($key) ? $key : '');
}
}
self::dump();
self::dump($_POST, '$_POST');
self::dump($_FILES, '$_FILES');
self::dump($_GET, '$_GET');
self::dump();
self::dump(PHP_VERSION, 'PHP version');
self::dump($_SERVER, '$_SERVER');
self::dump($_SESSION, '$_SESSION');
self::dump($_COOKIE, '$_COOKIE');
return '[' . $iaCore->iaView->name() . ']';
}
示例4: write
public function write($actionCode, $params = null, $pluginName = null)
{
if (!in_array($actionCode, $this->_validActions)) {
return false;
}
if (iaUsers::hasIdentity()) {
$params['user'] = iaUsers::getIdentity()->fullname;
}
empty($params['title']) || ($params['title'] = iaSanitize::html($params['title']));
$row = array('date' => date(iaDb::DATETIME_FORMAT), 'action' => $actionCode, 'user_id' => iaUsers::hasIdentity() ? iaUsers::getIdentity()->id : null, 'params' => serialize($params));
if ($pluginName) {
$row['extras'] = $pluginName;
} else {
$iaView =& iaCore::instance()->iaView;
if ($value = $iaView->get('extras')) {
$row['extras'] = $value;
}
}
return (bool) $this->iaDb->insert($row, null, self::getTable());
}
示例5: getCustomConfig
/**
* Get the list of user/group specific configuration values
*
* @param null $user user id
* @param null $group group id
*
* @return array
*/
public function getCustomConfig($user = null, $group = null)
{
$local = false;
if (is_null($user) && is_null($group)) {
$this->factory('users');
$local = true;
if (iaUsers::hasIdentity()) {
$user = iaUsers::getIdentity()->id;
$group = iaUsers::getIdentity()->usergroup_id;
} else {
$user = 0;
$group = iaUsers::MEMBERSHIP_GUEST;
}
}
if ($local && !is_null($this->_customConfig)) {
return $this->_customConfig;
}
$result = array();
$stmt = array();
if ($user) {
$stmt[] = "(`type` = 'user' AND `type_id` = {$user}) ";
}
if ($group) {
$stmt[] = "(`type` = 'group' AND `type_id` = {$group}) ";
}
$rows = $this->iaDb->all(array('type', 'name', 'value'), implode(' OR ', $stmt), null, null, self::getCustomConfigTable());
if (empty($rows)) {
return $result;
}
$result = array('group' => array(), 'user' => array(), 'plan' => array());
foreach ($rows as $row) {
$result[$row['type']][$row['name']] = $row['value'];
}
$result = array_merge($result['group'], $result['user'], $result['plan']);
if ($local) {
$this->_customConfig = $result;
}
return $result;
}
示例6: array
if (empty($member)) {
$member = $iaUsers->getInfo((int) $iaCore->requestPath[0]);
}
if (empty($member)) {
return iaView::errorPage(iaView::ERROR_NOT_FOUND);
}
$iaCore->factory('util');
$iaPage = $iaCore->factory('page', iaCore::FRONT);
$member['item'] = $iaUsers->getItemName();
$iaCore->startHook('phpViewListingBeforeStart', array('listing' => $member['id'], 'item' => $member['item'], 'title' => $member['fullname'], 'url' => $iaView->iaSmarty->ia_url(array('data' => $member, 'item' => $member['item'], 'type' => 'url')), 'desc' => $member['fullname']));
$iaItem = $iaCore->factory('item');
$iaCore->set('num_items_perpage', 20);
$page = !empty($_GET['page']) ? (int) $_GET['page'] : 1;
$page = $page < 1 ? 1 : $page;
$start = ($page - 1) * $iaCore->get('num_items_perpage');
if (iaUsers::hasIdentity() && iaUsers::getIdentity()->id == $member['id']) {
$iaItem->setItemTools(array('title' => iaLanguage::get('edit'), 'url' => $iaPage->getUrlByName('profile')));
}
$member = array_shift($iaItem->updateItemsFavorites(array($member), $member['item']));
$member['items'] = array();
// get fieldgroups
$iaField = $iaCore->factory('field');
list($sections, ) = $iaField->generateTabs($iaField->filterByGroup($member, $member['item']));
// get all items added by this account
$itemsList = $iaItem->getPackageItems();
$itemsFlat = array();
if ($array = $iaItem->getItemsInfo(true)) {
foreach ($array as $itemData) {
if ($itemData['item'] != $member['item'] && $iaItem->isExtrasExist($itemsList[$itemData['item']])) {
$itemsFlat[] = $itemData['item'];
}
示例7: foreach
}
if (isset($search['terms']['items'][$v['name']])) {
foreach ($search['terms']['items'][$v['name']] as $key => $val) {
$v['items'][$key] = $val;
}
}
if (count($v['items']) > 0) {
$rows = $iaDb->all(iaDb::ALL_COLUMNS_SELECTION, '(' . searchMatch($v['items']) . ') ' . $v['where'], 0, 10, $v['db']);
if ($v['name'] != 'pages') {
$fieldsList = iaField::getAcoFieldsList($v['fields'], $v['type'], null, true);
}
if ($rows) {
$iaView->iaSmarty->assign('all_items', $rows);
$iaView->iaSmarty->assign('all_item_fields', $fieldsList);
$iaView->iaSmarty->assign('all_item_type', $v['type']);
$iaView->iaSmarty->assign('member', iaUsers::hasIdentity() ? iaUsers::getIdentity(true) : array());
$results['num'] += 1;
$results['html'][$v['name']] = $iaView->iaSmarty->fetch('all-items-page.tpl');
}
}
}
}
/* Package and plugin: read search.inc.php */
if (!empty($search['terms']['items'])) {
foreach ($search['terms']['items'] as $i => $flds) {
// in case there is no such item, skip to next iteration
if (!array_key_exists($i, $items)) {
continue;
}
if (iaCore::CORE != $items[$i]['type']) {
$search_file = ('package' == $items[$i]['type'] ? 'packages/' : 'plugins/') . $items[$i]['extras'] . '/includes/search.inc.php';
示例8: get
public function get()
{
if (iaUsers::hasIdentity()) {
$stmt = '`member_id` = :member ORDER BY `date` DESC';
$this->iaDb->bind($stmt, array('member' => (int) iaUsers::getIdentity()->id));
return $this->iaDb->all(iaDb::ALL_COLUMNS_SELECTION, $stmt, null, null, self::getTable());
}
return false;
}
示例9: session_id
$entry['member_id'] = iaUsers::hasIdentity() ? iaUsers::getIdentity()->id : 0;
$entry['sess_id'] = session_id();
$entry['ip'] = $iaCore->util()->getIp();
$entry['status'] = $iaCore->get('gb_auto_approval') ? iaCore::STATUS_ACTIVE : iaCore::STATUS_INACTIVE;
$id = $iaDb->insert($entry, array('date' => iaDb::FUNCTION_NOW));
unset($entry);
if ($id) {
$iaCore->factory('log')->write(iaLog::ACTION_CREATE, array('item' => '', 'name' => iaLanguage::get('guestbook_message'), 'id' => $id, 'path' => 'guestbook'));
}
$messages[] = iaLanguage::get('message_added') . (!$iaCore->get('gb_auto_approval') ? ' ' . iaLanguage::get('message_approval') : '');
}
}
$iaView->setMessages($messages, $error ? iaView::ERROR : iaView::SUCCESS);
}
$total = $iaDb->one(iaDb::STMT_COUNT_ROWS, "`status`='active'");
$page = isset($_GET['page']) ? $_GET['page'] : 1;
$limit = $iaCore->get('gb_messages_per_page');
if ($page > $total / $limit && $page < 0 || !is_numeric($page)) {
$page = 1;
}
$start = ($page - 1) * $limit;
$sql = "SELECT g.*, IF (g.`member_id` > 0, if (a.`fullname` != '', a.`fullname`, a.`username`), g.`author_name`) author, a.`username` username, a.`avatar` m_avatar, a.`email`\n\t\t\tFROM `" . $iaCore->iaDb->prefix . "guestbook` g\n\t\t\tLEFT JOIN `" . $iaCore->iaDb->prefix . "members` a ON (g.`member_id` = a.`id`)\n\t\tWHERE g.`status` = 'active' " . (iaUsers::hasIdentity() ? "OR g.`status` = '" . iaCore::STATUS_INACTIVE . "' AND g.`member_id` = '" . iaUsers::getIdentity()->id . "'" : '') . "OR g.`status` = '" . iaCore::STATUS_INACTIVE . "' AND g.`sess_id` = '" . session_id() . "'\n\t\tORDER BY g.`date` DESC" . ($limit ? " LIMIT {$start}, {$limit}" : '');
$messages = $iaDb->getAll($sql);
$iaView->assign('aTemplate', IA_URL . 'guestbook/?page={page}');
$iaView->assign('body', isset($entry['body']) ? $entry['body'] : '');
$iaView->assign('guestbook', $messages);
$iaView->assign('sess_id', session_id());
$iaView->assign('total_messages', $total);
$iaView->display('index');
$iaDb->resetTable();
}
示例10: array
$output = array();
$iaCore->startHook('phpActionsJsonHandle', array('action' => $_POST['action'], 'output' => &$output));
}
$iaView->assign($output);
}
if (isset($_GET) && isset($_GET['action'])) {
switch ($_GET['action']) {
case 'ckeditor_upload':
$iaView->disableLayout();
$iaView->set('nodebug', 1);
$err = 0;
if (isset($_GET['Type']) && 'Image' == $_GET['Type'] && isset($_FILES['upload'])) {
$oFile = $_FILES['upload'];
$sErrorNumber = '0';
$imgTypes = array('image/gif' => 'gif', 'image/jpeg' => 'jpg', 'image/pjpeg' => 'jpg', 'image/png' => 'png');
$_user = iaUsers::hasIdentity() ? iaUsers::getIdentity()->username : false;
$sFileUrl = 'uploads/' . iaUtil::getAccountDir($_user);
$ext = array_key_exists($oFile['type'], $imgTypes) ? $imgTypes[$oFile['type']] : false;
if (!$ext) {
$err = '202 error';
}
$tok = iaUtil::generateToken();
$fname = $tok . '.' . $ext;
if (!$err) {
move_uploaded_file($oFile['tmp_name'], IA_HOME . $sFileUrl . $fname);
chmod(IA_HOME . $sFileUrl . $fname, 0777);
}
// fix windows URLs
$fileUrl = $sFileUrl . $fname;
$fileUrl = str_replace('\\', '/', $fileUrl);
$callback = (int) $_GET['CKEditorFuncNum'];
示例11: getAccountDir
public static function getAccountDir($userName = '')
{
if (empty($userName)) {
$userName = iaUsers::hasIdentity() ? iaUsers::getIdentity()->username : false;
}
$serverDirectory = '';
umask(0);
if (empty($userName)) {
$serverDirectory .= '_notregistered' . IA_DS;
if (!is_dir(IA_UPLOADS . $serverDirectory)) {
mkdir(IA_UPLOADS . $serverDirectory);
}
} else {
$subFolders = array();
$subFolders[] = strtolower(substr($userName, 0, 1)) . IA_DS;
$subFolders[] = $userName . IA_DS;
foreach ($subFolders as $folderName) {
$serverDirectory .= $folderName;
is_dir(IA_UPLOADS . $serverDirectory) || mkdir(IA_UPLOADS . $serverDirectory);
}
}
return $serverDirectory;
}
示例12: getCustomConfig
public function getCustomConfig($user = false, $group = false)
{
$where = array();
$config = array();
$local = false;
if ($user === false && $group === false) {
$this->factory('users');
$local = true;
if (iaUsers::hasIdentity()) {
$user = iaUsers::getIdentity()->id;
$group = iaUsers::getIdentity()->usergroup_id;
} else {
$user = 0;
$group = iaUsers::MEMBERSHIP_GUEST;
}
}
if ($user !== false) {
$where[] = "(`type` = 'user' AND `type_id` = {$user}) ";
}
if ($group !== false) {
$where[] = "(`type` = 'group' AND `type_id` = {$group}) ";
}
$rows = $this->iaDb->all(iaDb::ALL_COLUMNS_SELECTION, implode(' OR ', $where), null, null, 'config_custom');
if (empty($rows)) {
return $config;
}
$config['plan'] = array();
$config['user'] = array();
$config['group'] = array();
foreach ($rows as $row) {
$config[$row['type']][$row['name']] = $row['value'];
}
$config = array_merge($config['group'], $config['user'], $config['plan']);
if ($local) {
$this->_customConfig = $config;
}
return $config;
}
示例13: extractFunds
/**
* Write funds off from member balance.
*
* @param array $transactionData data about transaction
*
* @return bool true on success
*/
public function extractFunds(array $transactionData)
{
if (!iaUsers::hasIdentity()) {
return false;
}
$iaUsers = $this->iaCore->factory('users');
$iaTransaction = $this->iaCore->factory('transaction');
$userInfo = $iaUsers->getInfo(iaUsers::getIdentity()->id);
$remainingBalance = $userInfo['funds'] - $transactionData['amount'];
if ($remainingBalance >= 0) {
$result = (bool) $iaUsers->update(array('funds' => $remainingBalance), iaDb::convertIds(iaUsers::getIdentity()->id));
if ($result) {
iaUsers::reloadIdentity();
$updatedValues = array('status' => iaTransaction::PASSED, 'gateway' => iaTransaction::TRANSACTION_MEMBER_BALANCE, 'reference_id' => date('YmdHis'), 'member_id' => iaUsers::getIdentity()->id);
$iaTransaction->update($updatedValues, $transactionData['id']);
}
return $result;
}
return false;
}
示例14: define
* Subrion is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Subrion. If not, see <http://www.gnu.org/licenses/>.
*
*
* @link http://www.subrion.org/
*
******************************************************************************/
define('IA_VER', '330');
$iaOutput->layout()->title = 'Installation Wizard';
$iaOutput->steps = array('check' => 'Pre-Installation Check', 'license' => 'Subrion License', 'configuration' => 'Configuration', 'finish' => 'Script Installation', 'plugins' => 'Plugins Installation');
if (iaHelper::isScriptInstalled() && (!iaUsers::hasIdentity() || iaUsers::MEMBERSHIP_ADMINISTRATOR != iaUsers::getIdentity()->usergroup_id)) {
$iaOutput->errorCode = 'authorization';
return false;
}
$error = false;
$message = '';
$builtinPlugins = array('kcaptcha', 'fancybox', 'personal_blog');
switch ($step) {
case 'check':
$checks = array('server' => array());
$sections = array('server' => array('title' => 'Server Configuration', 'desc' => 'If any of these items are highlighted in red then please take actions to correct them. Failure to do so could lead to your installation not functioning correctly.'), 'recommended' => array('title' => 'Recommended Settings', 'desc' => 'These settings are recommended for PHP in order to ensure full compatibility with Subrion CMS. However, Subrion CMS will still operate if your settings do not quite match the recommended.'), 'directory' => array('title' => 'Directory & File Permissions', 'desc' => 'In order for Subrion CMS to function correctly it needs to be able to access or write to certain files or directories. If you see "Unwritable" you need to change the permissions on the file or directory to allow Subrion CMS to write to it.'));
$checks['server']['mysql_version'] = array('required' => function_exists('mysql_connect'), 'class' => true, 'name' => 'Mysql version', 'value' => function_exists('mysql_connect') ? '<td class="success">' . substr(mysql_get_client_info(), 0, false === ($pos = strpos(mysql_get_client_info(), '-')) ? 10 : $pos) . '</td>' : '<td class="danger">MySQL 5.x or upper required</td>');
$checks['server']['php_version'] = array('required' => version_compare('5.0', PHP_VERSION, '<'), 'class' => true, 'name' => 'PHP version', 'value' => version_compare('5.0', PHP_VERSION, '<') ? '<td class="success">' . PHP_VERSION . '</td>' : '<td class="danger">PHP version is not compatible. PHP 5.x needed. (Current version ' . PHP_VERSION . ')</td>');
$checks['server']['remote'] = array('name' => 'Remote files access support', 'value' => iaHelper::hasAccessToRemote() ? '<td class="success">Available</td>' : '<td class="danger">Unavailable (highly recommended to enable "CURL" extension or "allow_url_fopen")</td>');
$checks['server']['xml'] = array('name' => 'XML support', 'value' => extension_loaded('xml') ? '<td class="success">Available</td>' : '<td class="danger">Unavailable (recommended)</td>');
$checks['server']['mysql_support'] = array('name' => 'MySQL support', 'value' => function_exists('mysql_connect') ? '<td class="success">Available</td>' : '<td class="danger">Unavailable (required)</td>');
示例15: array
******************************************************************************/
if (!empty($item) && !empty($listing)) {
$disabledItems = array('members');
if (in_array($item, $disabledItems)) {
return;
}
$iaItem = $iaCore->factory('item');
// check for ownership key
if (isset($_GET['ownership-key'])) {
$iaDb->setTable('claim_pending_email_keys');
$key = $iaDb->row_bind(iaDb::ALL_COLUMNS_SELECTION, '`item` = :item AND `item_id` = :id AND `key` = :key', array('item' => $item, 'id' => $listing, 'key' => $_GET['ownership-key']));
if ($key) {
$tableName = $iaItem->getItemTable($item);
$iaDb->update(array('member_id' => $key['member_id']), iaDb::convertIds($listing), null, $tableName);
$iaDb->delete(iaDb::convertIds($key['key'], 'key'));
$iaView->setMessages(iaLanguage::get('ownership_changed'), iaView::SUCCESS);
iaUtil::reload();
}
$iaDb->resetTable();
}
$itemTable = $iaItem->getItemTable($item);
$itemData = $iaDb->row(iaDb::ALL_COLUMNS_SELECTION, iaDb::convertIds($listing), $itemTable);
// check the current owner of the listing, if possible
if (iaUsers::hasIdentity() && isset($itemData['member_id']) && iaUsers::getIdentity()->id == $itemData['member_id']) {
return;
}
$actionsForGuest = array('id' => 'claim-listing', 'title' => iaLanguage::get('claim_listing'), 'attributes' => array('class' => 'btn btn-sm btn-default', 'href' => IA_URL . 'claim/' . $item . '/' . $listing . '.json', 'id' => 'js-cmd-claim', 'data-toggle' => 'modal', 'data-target' => '#js-claim-modal'));
$actionsForMember = array('id' => 'claim-listing', 'title' => iaLanguage::get('claim_listing'), 'attributes' => array('class' => 'btn btn-sm btn-default', 'href' => '#', 'onclick' => 'intelli.notifFloatBox({msg:\'' . iaSanitize::html(iaLanguage::get('sign_in_to_use_this_feature')) . '\',autohide:true}); return false;'));
$actionClaimListing = iaUsers::hasIdentity() ? $actionsForGuest : $actionsForMember;
$iaView->assign('actionClaimListing', $actionClaimListing);
}