本文整理汇总了PHP中iaUsers类的典型用法代码示例。如果您正苦于以下问题:PHP iaUsers类的具体用法?PHP iaUsers怎么用?PHP iaUsers使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了iaUsers类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isScriptInstalled
public static function isScriptInstalled()
{
if (!file_exists(IA_HOME . 'includes' . IA_DS . self::CONFIGURATION_FILE)) {
return false;
}
self::loadCoreClass('users', 'core');
return iaCore::instance()->iaDb->one_bind(iaDb::STMT_COUNT_ROWS, '`usergroup_id` = :group AND `date_logged` IS NOT NULL', array('group' => iaUsers::MEMBERSHIP_ADMINISTRATOR), iaUsers::getTable()) > 0;
}
示例2: 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;
}
示例3: _gridQuery
protected function _gridQuery($columns, $where, $order, $start, $limit)
{
$sql = 'SELECT u.*, IF(u.`id` = 1, 0, u.`id`) `permissions`, u.`id` `config`, IF(u.`system` = 1, 0, 1) `delete` ' . ', IF(u.`id` = 1, 1, p.`access`) `admin` ' . ',(SELECT GROUP_CONCAT(m.`fullname` SEPARATOR \', \') FROM `' . iaUsers::getTable(true) . '` m WHERE m.`usergroup_id` = u.`id` GROUP BY m.`usergroup_id` LIMIT 10) `members` ' . ',(SELECT COUNT(m.`id`) FROM `' . iaUsers::getTable(true) . '` m WHERE m.`usergroup_id` = u.`id` GROUP BY m.`usergroup_id`) `count`' . 'FROM `' . $this->_iaDb->prefix . $this->getTable() . '` u ' . 'LEFT JOIN `' . $this->_iaDb->prefix . 'acl_privileges` p ' . "ON (p.`type` = 'group' " . 'AND p.`type_id` = u.`id` ' . "AND `object` = 'admin_access' " . "AND `action` = 'read' " . ')' . $order . ' ' . 'LIMIT ' . $start . ', ' . $limit;
$usergroups = $this->_iaDb->getAll($sql);
foreach ($usergroups as &$usergroup) {
$usergroup['title'] = iaLanguage::get('usergroup_' . $usergroup['name']);
}
return $usergroups;
}
示例4: _deleteFile
private function _deleteFile($params)
{
$result = array('error' => true, 'message' => iaLanguage::get('invalid_parameters'));
$item = isset($params['item']) ? iaSanitize::sql($params['item']) : null;
$field = isset($params['field']) ? iaSanitize::sql($params['field']) : null;
$path = isset($params['path']) ? iaSanitize::sql($params['path']) : null;
$itemId = isset($params['itemid']) ? (int) $params['itemid'] : null;
if ($itemId && $item && $field && $path) {
$tableName = $this->_iaCore->factory('item')->getItemTable($item);
$itemValue = $this->_iaDb->one($field, iaDb::convertIds($itemId), $tableName);
$iaAcl = $this->_iaCore->factory('acl');
if ($iaAcl->isAdmin() && $itemValue) {
$pictures = $itemValue[1] == ':' ? unserialize($itemValue) : $itemValue;
$key = null;
if (is_array($pictures)) {
if ($primitive = !is_array($pictures[key($pictures)])) {
$pictures = array($pictures);
}
foreach ($pictures as $k => $v) {
if ($path == $v['path']) {
$key = $k;
break;
}
}
if (!is_null($key)) {
unset($pictures[$key]);
}
$newItemValue = $primitive ? '' : serialize($pictures);
} else {
// single image
$newItemValue = '';
if ($pictures == $path) {
$key = true;
}
}
if (!is_null($key)) {
if ($this->_iaCore->factory('picture')->delete($path)) {
if ($this->_iaDb->update(array($field => $newItemValue), iaDb::convertIds($itemId), null, $tableName)) {
if (iaUsers::getItemName() == $item) {
// update current profile data
if ($itemId == iaUsers::getIdentity()->id) {
iaUsers::reloadIdentity();
}
}
}
$result['error'] = false;
$result['message'] = iaLanguage::get('deleted');
} else {
$result['message'] = iaLanguage::get('error');
}
}
}
}
return $result;
}
示例5: _gridQuery
protected function _gridQuery($columns, $where, $order, $start, $limit)
{
foreach (array('amount', 'gateway', 'status') as $joinedColumnName) {
if (false !== stripos($order, $joinedColumnName)) {
$order = str_replace(' i.`', ' t.`', $order);
break;
}
}
$sql = 'SELECT SQL_CALC_FOUND_ROWS ' . 'i.`id`, i.`date_created`, i.`fullname`, ' . 't.`plan_id`, t.`operation`, ' . 't.`status`, CONCAT(t.`amount`, " ", t.`currency`) `amount`, t.`currency`, t.`gateway`, ' . "1 `pdf`, 1 `update`, IF(t.`status` != 'passed', 1, 0) `delete` " . 'FROM `:prefix:table_invoices` i ' . 'LEFT JOIN `:prefix:table_transactions` t ON (t.`id` = i.`transaction_id`) ' . 'LEFT JOIN `:prefix:table_members` m ON (m.`id` = t.`member_id`) ' . ($where ? 'WHERE ' . $where . ' ' : '') . $order . ' ' . 'LIMIT :start, :limit';
$sql = iaDb::printf($sql, array('prefix' => $this->_iaDb->prefix, 'table_invoices' => self::getTable(), 'table_members' => iaUsers::getTable(), 'table_transactions' => 'payment_transactions', 'start' => $start, 'limit' => $limit));
return $this->_iaDb->getAll($sql);
}
示例6: getAddress
public function getAddress($transactionId)
{
$invoice = $this->getBy('transaction_id', $transactionId);
if ($invoice && $invoice['address1']) {
return $invoice;
}
// else return an address of the latest populated transaction
$iaTransaction = $this->iaCore->factory('transaction');
$sql = 'SELECT SQL_CALC_FOUND_ROWS i.`address1`, i.`address2`, i.`zip`, i.`country` ' . 'FROM `:prefix:table_transactions` t ' . 'LEFT JOIN `:prefix:table_invoices` i ON (i.`transaction_id` = t.`id`) ' . 'WHERE t.`member_id` = :member AND i.`address1` != "" ' . 'ORDER BY t.`date` DESC ' . 'LIMIT 1';
$sql = iaDb::printf($sql, array('prefix' => $this->iaDb->prefix, 'table_transactions' => $iaTransaction::getTable(), 'table_invoices' => self::getTable(), 'member' => iaUsers::getIdentity()->id));
$row = $this->iaDb->getRow($sql);
return $row ? $row : array('address1' => '', 'address2' => '', 'zip' => '', 'country' => '');
}
示例7: 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;
}
示例8: _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() . ']';
}
示例9: array
$itemData['password'] = '';
}
} else {
iaField::keepValues($itemData, $fields);
$iaView->setMessages($messages);
}
if (!$error) {
$memberId = $iaUsers->register($itemData);
if ($memberId) {
$iaCore->factory('log')->write(iaLog::ACTION_CREATE, array('item' => 'member', 'name' => $itemData['fullname'], 'id' => $memberId, 'type' => iaCore::FRONT));
}
// process sponsored plan
if ($memberId && isset($_POST['plan_id']) && is_numeric($_POST['plan_id'])) {
$plan = $iaPlan->getById($_POST['plan_id']);
$usergroup = $plan['usergroup'] ? $plan['usergroup'] : iaUsers::MEMBERSHIP_REGULAR;
$iaDb->update(array('id' => $memberId, 'usergroup_id' => $usergroup), 0, 0, iaUsers::getTable());
if ($plan['cost'] > 0) {
$itemData['id'] = $memberId;
$itemData['member_id'] = $memberId;
if ($url = $iaPlan->prePayment($iaUsers->getItemName(), $itemData, $plan['id'])) {
iaUtil::redirect(iaLanguage::get('thanks'), iaLanguage::get('member_created'), $url);
}
}
}
}
} elseif ('register_confirm' == $iaView->name()) {
if (!isset($_GET['email']) || !isset($_GET['key'])) {
return iaView::accessDenied();
}
$error = true;
if ($iaUsers->confirmation($_GET['email'], $_GET['key'])) {
示例10: 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;
}
示例11: _resetPage
private function _resetPage(&$iaView)
{
if (isset($_POST['reset'])) {
if ($options = iaUtil::checkPostParam('options', array())) {
if (in_array(iaUsers::getItemName(), $options)) {
$iaUsers = $this->_iaCore->factory('users');
$currentMember = $this->_iaDb->row(iaDb::ALL_COLUMNS_SELECTION, iaDb::convertIds(iaUsers::getIdentity()->id), iaUsers::getTable());
$this->getHelper()->truncate(iaUsers::getTable());
$this->_iaDb->insert($currentMember, null, iaUsers::getTable());
$options = array_diff($options, array($iaUsers->getItemName()));
}
foreach ($options as $option) {
$this->_iaCore->startHook('phpDbControlBeforeReset', array('option' => $option));
}
$this->addMessage('reset_success');
} else {
$this->_error = true;
$this->addMessage('reset_choose_table');
}
} else {
$iaView->setMessages(iaLanguage::get('reset_backup_alert'), iaView::ALERT);
}
$resetOptions = array('members' => iaLanguage::get('reset') . ' ' . iaLanguage::get('members'));
$this->_iaCore->startHook('phpAdminDatabaseBeforeAll', array('reset_options' => &$resetOptions));
$iaView->assign('options', $resetOptions);
}
示例12: _setActions
private function _setActions()
{
$result = array();
if (self::REQUEST_HTML != $this->getRequestType()) {
return $result;
}
$iaCore =& $this->iaCore;
if (false !== strpos($iaCore->iaView->name(), 'view')) {
$iaItem = $iaCore->factory('item');
$iaCore->startHook('smartyItemTools');
$iaItem->setItemTools(array('id' => 'action-print', 'title' => iaLanguage::get('print_preview'), 'attributes' => array('href' => '#', 'class' => 'js-print-page')));
$itemData = $iaCore->iaView->iaSmarty->getTemplateVars('item');
if (iaUsers::hasIdentity() && $itemData) {
if (iaUsers::getItemName() != $itemData['item'] && isset($itemData['member_id']) && iaUsers::getIdentity()->id != $itemData['member_id'] || $itemData['item'] == iaUsers::getItemName() && iaUsers::getIdentity()->id != $itemData['id']) {
$isAlreadyFavorited = isset($itemData['favorite']) && $itemData['favorite'] == 1;
$iaItem->setItemTools(array('id' => 'action-favorites', 'title' => iaLanguage::get($isAlreadyFavorited ? 'favorites_action_delete' : 'favorites_action_add'), 'attributes' => array('href' => '#', 'class' => 'js-favorites', 'data-id' => $itemData['id'], 'data-item' => $itemData['item'], 'data-action' => $isAlreadyFavorited ? iaCore::ACTION_DELETE : iaCore::ACTION_ADD)));
}
}
$result = $iaItem->setItemTools();
}
return $result;
}
示例13: _getItemsStatuses
private function _getItemsStatuses()
{
$result = array();
$iaItem = $this->_iaCore->factory('item');
foreach ($this->_items as $itemName) {
$statuses = array();
$className = ucfirst(substr($itemName, 0, -1));
$itemClassInstance = iaUsers::getItemName() == $itemName ? $this->_iaCore->factory('users') : $this->_iaCore->factoryPackage($className, $iaItem->getPackageByItem($itemName));
if ($itemClassInstance && method_exists($itemClassInstance, 'getStatuses')) {
$statuses = $itemClassInstance->getStatuses();
}
$result[$itemName] = implode(',', $statuses);
}
return $result;
}
示例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
$messages = array();
iaCore::util();
if ($fields) {
list($data, $error, $messages, $errorFields) = iaField::parsePost($fields, $item, true);
}
// validate account
if (isset($_POST['account']) && !empty($_POST['account'])) {
$member_id = $iaDb->one('id', "`username` = '{$_POST['account']}' ", iaUsers::getTable());
if (!$member_id) {
$error = true;
$messages[] = iaLanguage::get('album_incorrect_account');
} else {
$data['member_id'] = $member_id;
}
} else {
$data['member_id'] = iaUsers::getIdentity()->id;
}
if (!defined('IA_NOUTF')) {
iaUtf8::loadUTF8Core();
iaUtf8::loadUTF8Util('ascii', 'validation', 'bad', 'utf8_to_ascii');
}
// validate title_alias
$data['title_alias'] = !empty($_POST['title_alias']) ? $_POST['title_alias'] : $_POST['title'];
if (!utf8_is_ascii($data['title_alias'])) {
$data['title_alias'] = utf8_to_ascii($data['title_alias']);
}
$data['title_alias'] = iaSanitize::convertStr($data['title_alias']);
// check for duplicate title_alias in case a new album is added or title_alias has been updated
if (!isset($item['title_alias']) || isset($item['title_alias']) && $data['title_alias'] != $item['title_alias']) {
if ($iaAlbum->existsAlias($data['title_alias'])) {
$error = true;