本文整理匯總了PHP中IPSText::mbstrtolower方法的典型用法代碼示例。如果您正苦於以下問題:PHP IPSText::mbstrtolower方法的具體用法?PHP IPSText::mbstrtolower怎麽用?PHP IPSText::mbstrtolower使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類IPSText
的用法示例。
在下文中一共展示了IPSText::mbstrtolower方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: return_html_block
/**
* Feturn HTML block
*
* @param array Member information
* @return string HTML block
*/
public function return_html_block($member = array())
{
//-----------------------------------------
// Got a member?
//-----------------------------------------
if (!is_array($member) or !count($member)) {
return $this->registry->getClass('output')->getTemplate('profile')->tabNoContent('err_no_aboutme_to_show');
}
$friends = array();
//-----------------------------------------
// Grab the friends
//-----------------------------------------
/* How many friends do we have? */
$count = $this->DB->buildAndFetch(array('select' => 'count(*) as dracula', 'from' => 'profile_friends', 'where' => 'friends_member_id=' . $member['member_id'] . ' AND friends_approved=1'));
/* Sort out pagination */
$st = intval($this->request['st']) >= 0 ? intval($this->request['st']) : 0;
$pagination = $this->registry->output->generatePagination(array('totalItems' => $count['dracula'], 'itemsPerPage' => self::FRIENDS_PER_PAGE, 'currentStartValue' => $st, 'baseUrl' => "showuser={$member['member_id']}&tab=friends", 'seoTemplate' => 'showuser', 'seoTitle' => $member['members_seo_name']));
/* Get em! */
$queryData = array('select' => 'f.*', 'from' => array('profile_friends' => 'f'), 'where' => 'f.friends_member_id=' . $member['member_id'] . ' AND f.friends_approved=1 AND m.member_banned=0 AND ( ! ' . IPSBWOptions::sql('bw_is_spammer', 'members_bitoptions', 'members', 'global', 'has') . ')', 'add_join' => array(1 => array('select' => 'pp.*', 'from' => array('profile_portal' => 'pp'), 'where' => 'pp.pp_member_id=f.friends_friend_id', 'type' => 'left'), 2 => array('select' => 'm.*', 'from' => array('members' => 'm'), 'where' => 'm.member_id=f.friends_friend_id', 'type' => 'left')));
// Ordering is bad because it causes a filesort, but if they have more than 100 members, we're going to have
// to order so we can paginate
if ($count['dracula'] > self::FRIENDS_PER_PAGE) {
$queryData['order'] = 'm.members_display_name';
$queryData['limit'] = array($st, self::FRIENDS_PER_PAGE);
}
$this->DB->build($queryData);
$outer = $this->DB->execute();
//-----------------------------------------
// Get and store...
//-----------------------------------------
while ($row = $this->DB->fetch($outer)) {
if ($row['member_id']) {
$friends[IPSText::mbstrtolower($row['members_display_name'])] = IPSMember::buildDisplayData($row, 0);
}
}
ksort($friends);
$content = $this->registry->getClass('output')->getTemplate('profile')->tabFriends($friends, $member, $pagination);
//-----------------------------------------
// Macros...
//-----------------------------------------
$content = $this->registry->output->replaceMacros($content);
//-----------------------------------------
// Return content..
//-----------------------------------------
return $content ? $content : $this->registry->getClass('output')->getTemplate('profile')->tabNoContent('err_no_aboutme_to_show');
}
示例2: show_apps
/**
* Display the list of apps (board, gallery, etc)
*
* @access private
* @return void
*/
private function show_apps()
{
foreach (ipsRegistry::$applications as $app_dir => $application) {
if ($app_dir == 'core') {
$app_dir = 'board';
}
if (isset(_interface::$software[$app_dir])) {
_interface::$software[$app_dir]['enabled'] = true;
_interface::$software[$app_dir]['software'] = array();
// Get options
foreach (glob(IPSLib::getAppDir('convert') . '/modules_admin/' . $app_dir . '/*.php') as $file) {
require_once $file;
_interface::$software[$app_dir]['software'][$info['key']] = $info['name'];
}
} else {
if ($application['app_location'] == 'other' && is_dir(IPSLib::getAppDir('convert') . '/modules_admin/' . $application['app_directory']) or $application['app_location'] == 'other' && is_dir(IPSLib::getAppDir(IPSText::mbstrtolower($application['app_title'])) . '/extensions/convert/' . $application['app_directory'])) {
_interface::$software[$app_dir] = array('title' => $application['app_title'], 'enabled' => true, 'third_party' => true);
}
}
}
$this->registry->output->html .= $this->html->convertShowSoftware(_interface::$software);
}
示例3: convert_gallery_images
/**
* Convert Images
*
* @access private
* @return void
**/
private function convert_gallery_images()
{
//-----------------------------------------
// Were we given more info?
//-----------------------------------------
$this->lib->saveMoreInfo('gallery_images', array('gallery_path'));
//---------------------------
// Set up
//---------------------------
$main = array('select' => 'p.*', 'from' => array('picture' => 'p'), 'add_join' => array(array('select' => 'l.*', 'from' => array('albumpicture' => 'l'), 'where' => "p.pictureid=l.pictureid", 'type' => 'left')), 'order' => 'p.pictureid ASC');
$loop = $this->lib->load('gallery_images', $main);
//-----------------------------------------
// Check all is well
//-----------------------------------------
if (!is_writable($this->settings['gallery_images_path'])) {
$this->lib->error('Your IP.Gallery upload path is not writeable. ' . $this->settings['gallery_images_path']);
}
//-----------------------------------------
// We need to know the path
//-----------------------------------------
$this->lib->getMoreInfo('gallery_images', $loop, array('gallery_path' => array('type' => 'text', 'label' => 'The path to the folder where gallery images are saved (no trailing slash - if using database storage, enter "."):')), 'path');
$get = unserialize($this->settings['conv_extra']);
$us = $get[$this->lib->app['name']];
$path = $us['gallery_path'];
//---------------------------
// Loop
//---------------------------
while ($row = ipsRegistry::DB('hb')->fetch($this->lib->queryRes)) {
// Have a stab at the mimetype
$ext = IPSText::mbstrtolower($row['extension']);
$ext = $ext == 'jpg' ? 'jpeg' : $ext;
$mime = "image/{$ext}";
// What's the mimetype?
//$type = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'attachments_type', 'where' => "atype_extension='{$row['extension']}'" ) );
$save = array('image_member_id' => $row['userid'], 'image_album_id' => $row['albumid'] ? $row['albumid'] : $us['orphans'], 'image_directory' => floor($row['pictureid'] / 1000), 'image_caption' => $row['caption'], 'image_file_name' => $row['pictureid'] . '.' . $row['extension'], 'image_file_size' => $row['filesize'], 'image_file_type' => $mime, 'image_approved' => $row['state'] == 'visible' ? 1 : 0, 'image_date' => $row['dateline'], 'image_caption_seo' => IPSText::makeSeoTitle($row['caption']), 'image_feature_flag' => $us['feature_all']);
//-----------------------------------------
// Database
//-----------------------------------------
if ($row['filedata']) {
$save['data'] = $row['filedata'];
$this->lib->convertImage($row['pictureid'], $save, '', true);
} else {
if ($path == '.') {
$this->lib->error('You entered "." for the path but you have some attachments in the file system');
}
$save['masked_file_name'] = floor($row['pictureid'] / 1000);
//*sigh* More weird stuff.
$save['masked_file_name'] .= '/' . $row['pictureid'] . '.picture';
$this->lib->convertImage($row['pictureid'], $save, $us['gallery_path'], false);
}
}
$this->lib->next();
}
示例4: convert_members
/**
* Convert members
*
* @access private
* @return void
**/
private function convert_members()
{
//-----------------------------------------
// Were we given more info?
//-----------------------------------------
$pcpf = array('icqIM' => 'ICQ Number', 'aolIM' => 'AIM ID', 'yahooIM' => 'Yahoo ID', 'msnIM' => 'MSN ID', 'webAddress' => 'Website', 'occupation' => 'Occupation', 'interests' => 'Interests', 'webGallery' => 'Web Gallery', 'webLog' => 'Web Blog');
$this->lib->saveMoreInfo('members', array_keys($pcpf));
//---------------------------
// Set up
//---------------------------
$main = array('select' => 'u.UserID, u.LastActivity, CAST(u.MembershipID AS CHAR(36)) as MembershipID', 'from' => array('cs_users' => 'u'), 'add_join' => array(array('select' => 'm.Email,m.CreateDate,m.LastLoginDate, m.Password, m.PasswordSalt', 'from' => array('aspnet_Membership' => 'm'), 'where' => 'u.MembershipID = m.UserId', 'type' => 'left'), array('select' => 'CAST(ap.PropertyNames AS text) as PropertyNames, CAST(ap.PropertyValuesString AS text) as PropertyValuesString', 'from' => array('aspnet_Profile' => 'ap'), 'where' => 'u.MembershipID = ap.UserId', 'type' => 'left'), array('select' => 'CAST(a.UserName AS varchar) as UserName', 'from' => array('aspnet_Users' => 'a'), 'where' => 'u.MembershipID = a.UserId', 'type' => 'left'), array('select' => 'p.TotalPosts, p.TimeZone', 'from' => array('cs_UserProfile' => 'p'), 'where' => 'u.UserID = p.UserID', 'type' => 'left')), 'order' => 'u.UserID ASC');
$loop = $this->lib->load('members', $main);
//-----------------------------------------
// Tell me what you know!
//-----------------------------------------
$get = unserialize($this->settings['conv_extra']);
$us = $get[$this->lib->app['name']];
$ask = array();
// And those custom profile fields
$options = array('x' => '-Skip-');
$this->DB->build(array('select' => '*', 'from' => 'pfields_data'));
$this->DB->execute();
while ($row = $this->DB->fetch()) {
$options[$row['pf_id']] = $row['pf_title'];
}
foreach ($pcpf as $id => $name) {
$ask[$id] = array('type' => 'dropdown', 'label' => 'Custom profile field to store ' . $name . ': ', 'options' => $options, 'extra' => $extra);
}
$this->lib->getMoreInfo('members', $loop, $ask, 'path');
//---------------------------
// Loop
//---------------------------
while ($row = ipsRegistry::DB('hb')->fetch($this->lib->queryRes)) {
$propertyNamesArray = explode(':', $row['PropertyNames']);
// Ditch extra empty cell
array_pop($propertyNamesArray);
for ($i = 0; $i < count($propertyNamesArray) - 1; $i += 4) {
$row[$propertyNamesArray[$i]] = substr($row['PropertyValuesString'], $propertyNamesArray[$i + 2], $propertyNamesArray[$i + 3]);
}
unset($propertyNamesArray);
ipsRegistry::DB('hb')->build(array('select' => 'RoleId', 'from' => 'aspnet_UsersInRoles', 'where' => "UserId='{$row['MembershipID']}'"));
$groupRes = ipsRegistry::DB('hb')->execute();
$groups = array();
while ($group = ipsRegistry::DB('hb')->fetch($groupRes)) {
$groups[] = $group['RoleId'];
}
$primaryGroup = count($groups) > 0 ? array_shift($groups) : null;
//-----------------------------------------
// Set info
//-----------------------------------------
// Basic info
$info = array('id' => $row['UserID'], 'group' => $primaryGroup, 'secondary_groups' => implode(', ', $groups), 'joined' => $this->lib->myStrToTime($row['CreateDate']), 'username' => $row['UserName'], 'email' => $row['Email'], 'password' => $row['Password']);
// Member info
preg_match("/([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})/", $time, $birthday);
$members = array('ip_address' => '127.0.0.1', 'posts' => $row['TotalPosts'], 'allow_admin_mails' => 1, 'time_offset' => intval($row['TimeZone']), 'bday_day' => $birthday && $birthday[1] != '0001' ? $birthday[3] : '', 'bday_month' => $birthday && $birthday[1] != '0001' ? $birthday[2] : '', 'bday_year' => $birthday && $birthday[1] != '0001' ? $birthday[1] : '', 'hide_email' => 1, 'email_pm' => 0, 'view_sigs' => 1, 'view_avs' => 1, 'msg_show_notification' => 1, 'last_visit' => $this->lib->myStrToTime($row['LastLoginDate']), 'last_activity' => $this->lib->myStrToTime($row['LastLoginDate']), 'dst_in_use' => 0, 'coppa_user' => 0, 'misc' => $row['PasswordSalt']);
// Profile
$profile = array('signature' => $this->fixPostData($row['signature']));
//-----------------------------------------
// Avatars and profile pictures
//-----------------------------------------
$avatar = ipsRegistry::DB('hb')->buildAndFetch(array('select' => 'Length, ContentType, Content', 'from' => 'cs_UserAvatar', 'where' => "UserId='{$row['UserID']}'"));
if ($avatar != '') {
$profile['photo_type'] = 'custom';
$profile['photo_location'] = str_replace('/', '.', IPSText::mbstrtolower($avatar['ContentType']));
$profile['photo_data'] = $avatar['Content'];
$profile['photo_filesize'] = $avatar['Length'];
}
//-----------------------------------------
// Custom Profile fields
//-----------------------------------------
// Pseudo
foreach ($pcpf as $id => $name) {
if ($us[$id] != 'x') {
$custom['field_' . $us[$id]] = $row['PropertyNames'][$id];
}
}
//-----------------------------------------
// And go!
//-----------------------------------------
$this->lib->convertMember($info, $members, $profile, array());
}
$this->lib->next();
}
示例5: convertDatabase
/**
* Convert a Database
*
* @access public
* @param integer Foreign ID number
* @param array Data to insert to table
* @return boolean Success or fail
**/
public function convertDatabase($id, $info)
{
//-----------------------------------------
// Make sure we have everything we need
//-----------------------------------------
if (!$id) {
$this->logError($id, 'No ID number provided');
return false;
}
//-----------------------------------------
// Just merging?
//-----------------------------------------
$us = unserialize($this->settings['conv_extra']);
$extra = $us[$this->app['name']];
if ($extra['ccs_databases'][$id] != 'x') {
$this->addLink($extra['ccs_databases'][$id], $id, 'ccs_databases', 1);
} else {
if (!$info['database_name']) {
$this->logError($id, 'No name provided');
return false;
}
if (!$info['database_key']) {
$this->logError($id, 'No key provided');
return false;
}
$_key = $this->DB->buildAndFetch(array('select' => 'database_id', 'from' => 'ccs_databases', 'where' => "database_key='{$info['database_key']}'"));
if ($_key['database_id']) {
$key = $info['database_key'] . time();
$this->logError($info['id'], "Database key {$info['database_key']} was already in use. Database was created with key {$key}");
$info['database_key'] = $key;
}
//unset($info['database_comment_approve']);
//-----------------------------------------
// Insert
//-----------------------------------------
$this->DB->insert('ccs_databases', $info);
$inserted_id = $this->DB->getInsertId();
//-----------------------------------------
// Add link
//-----------------------------------------
$this->addLink($inserted_id, $id, 'ccs_databases');
//-----------------------------------------
// Create new table
//-----------------------------------------
require_once IPSLib::getAppDir('ccs') . '/sources/databases/' . IPSText::mbstrtolower($this->settings['sql_driver']) . '.php';
$_dbAbstraction = new ccs_database_abstraction($this->registry);
$_dbAbstraction->createTable($this->settings['sql_tbl_prefix'] . 'ccs_custom_database_' . $inserted_id);
$this->DB->update('ccs_databases', array('database_database' => 'ccs_custom_database_' . $inserted_id), 'database_id=' . $inserted_id);
$this->databaseAddField(array('field_database_id' => $inserted_id, 'field_name' => 'Title', 'field_key' => 'article_title', 'field_type' => 'input', 'field_required' => '1', 'field_user_editable' => '1', 'field_max_length' => '500', 'field_truncate' => '50'));
$this->databaseAddField(array('field_database_id' => $inserted_id, 'field_name' => 'Body', 'field_key' => 'article_body', 'field_type' => 'editor', 'field_required' => '1', 'field_user_editable' => '1', 'field_extra' => 'short'));
$this->databaseAddField(array('field_database_id' => $inserted_id, 'field_name' => 'Public Date', 'field_key' => 'article_date', 'field_type' => 'date', 'field_required' => '1', 'field_user_editable' => '1', 'field_extra' => 'short', 'field_default_value' => 'Today'));
}
//-----------------------------------------
// Rebuild cache
//-----------------------------------------
//$this->rebuildCache();
return true;
}
示例6: checkDisplayName
/**
* Check the name or display name
*
* @return @e void [Outputs to screen]
*/
public function checkDisplayName($field = 'members_display_name')
{
//-----------------------------------------
// INIT
//-----------------------------------------
$this->registry->class_localization->loadLanguageFile(array('public_register'));
$name = '';
$member = array();
if (is_string($_POST['name'])) {
$name = trim(rawurldecode($_POST['name']));
$name = IPSText::mbstrtolower($name);
}
if (!$name) {
$this->returnString(sprintf(ipsRegistry::getClass('class_localization')->words['reg_error_no_name'], ipsRegistry::$settings['max_user_name_length']));
}
/* Bug where Twitter sets a username but you can't use it when you try and sign up with a new account using username as display name */
if (!$this->memberData['member_id'] and $this->request['mpid']) {
$reg = $this->DB->buildAndFetch(array('select' => '*', 'from' => 'members_partial', 'where' => "partial_member_id=" . intval($this->request['mpid'])));
if ($reg['partial_member_id']) {
$member = IPSMember::load($reg['partial_member_id'], 'all');
}
}
/* Check the username */
$user_check = IPSMember::getFunction()->cleanAndCheckName($name, $member, $field);
$errorField = $field == 'members_display_name' ? 'dname' : 'username';
$nameField = $field == 'members_display_name' ? 'members_display_name' : 'username';
if (is_array($user_check['errors'][$errorField]) && count($user_check['errors'][$errorField])) {
$this->returnString(ipsRegistry::getClass('class_localization')->words[$user_check['errors'][$errorField][0]] ? ipsRegistry::getClass('class_localization')->words[$user_check['errors'][$errorField][0]] : $user_check['errors'][$errorField][0]);
return;
} else {
if ($user_check['errors'][$errorField]) {
$this->returnString(ipsRegistry::getClass('class_localization')->words[$user_check['errors'][$errorField]] ? ipsRegistry::getClass('class_localization')->words[$user_check['errors'][$errorField]] : $user_check['errors'][$errorField]);
} else {
$this->returnString('notfound');
}
}
}
示例7: convert_gallery_images
/**
* Convert Images
*
* @access private
* @return void
**/
private function convert_gallery_images()
{
//-----------------------------------------
// Were we given more info?
//-----------------------------------------
$this->lib->saveMoreInfo('gallery_images', array('gallery_path'));
//---------------------------
// Set up
//---------------------------
$main = array('select' => '*', 'from' => 'photos', 'order' => 'id ASC');
$loop = $this->lib->load('gallery_images', $main);
//-----------------------------------------
// We need to know the path
//-----------------------------------------
$this->lib->getMoreInfo('gallery_images', $loop, array('gallery_path' => array('type' => 'text', 'label' => 'The path to the folder where images are saved (no trailing slash - usually path_to_photopost/data):')), 'path');
$get = unserialize($this->settings['conv_extra']);
$us = $get[$this->lib->app['name']];
$path = $us['gallery_path'];
//-----------------------------------------
// Check all is well
//-----------------------------------------
if (!is_writable($this->settings['gallery_images_path'])) {
$this->lib->error('Your IP.Gallery upload path is not writeable. ' . $this->settings['gallery_images_path']);
}
if (!is_readable($path)) {
$this->lib->error('Your remote upload path is not readable.');
}
//---------------------------
// Loop
//---------------------------
while ($row = ipsRegistry::DB('hb')->fetch($this->lib->queryRes)) {
//-----------------------------------------
// Do the image
//-----------------------------------------
// Have a stab at the mimetype
$explode = explode('.', $row['filename']);
$ext = IPSText::mbstrtolower(array_pop($explode));
$ext = $ext == 'jpg' ? 'jpeg' : $ext;
$mime = "image/{$ext}";
// Basic info
$save = array('member_id' => $row['userid'], 'img_album_id' => $row['cat'], 'caption' => $row['title'], 'description' => $row['description'], 'directory' => $row['cat'], 'file_name' => $row['bigimage'], 'file_size' => $row['filesize'], 'file_type' => $mime, 'approved' => $row['approved'], 'views' => $row['views'], 'comments' => $row['numcom'], 'idate' => $row['date'], 'ratings_total' => $row['rating'] * $row['votes'], 'ratings_count' => $row['votes'], 'rating' => $row['rating']);
//Photopost 8?
$this->lib->convertImage($row['id'], $save, $path . '/' . $row['cat'], false, true);
}
$this->lib->next();
}
示例8: _getEncryptedFilename
/**
* Works out the SMF-style encrypted filename
*
* @access private
* @param string The file name
* @param int The file ID (foreign)
* @return void
**/
private function _getEncryptedFilename($name, $id)
{
$clean_name = preg_replace(array('/\\s/', '/[^\\w_\\.-]/'), array('_', ''), $name);
$e = explode('.', $name);
$ext = array_pop($e);
$enc_name = $id . '_' . strtr($clean_name, '.', '_') . md5($clean_name) . '_ext' . IPSText::mbstrtolower($ext);
$clean_name = preg_replace('~\\.[\\.]+~', '.', $clean_name);
return $enc_name;
}
示例9: convert_groups
/**
* Convert groups
*
* @access private
* @return void
**/
private function convert_groups()
{
$this->lib->useKey('groupid');
//-----------------------------------------
// Were we given more info?
//-----------------------------------------
$this->lib->saveMoreInfo('groups', 'map');
//---------------------------
// Set up
//---------------------------
$main = array('select' => '*', 'from' => 'common_usergroup', 'order' => 'groupid ASC');
$loop = $this->lib->load('groups', $main, array(), array(), TRUE);
//-----------------------------------------
// We need to know how to map these
//-----------------------------------------
$this->lib->getMoreInfo('groups', $loop, array('new' => '--Create new group--', 'ot' => 'Old group', 'nt' => 'New group'), '', array('idf' => 'groupid', 'nf' => 'grouptitle'));
//---------------------------
// Loop
//---------------------------
foreach ($loop as $row) {
$prefix = '';
$suffix = '';
if ($row['color']) {
$prefix = "<span style='color:" . IPSText::mbstrtolower($row['color']) . "'>";
$suffix = '</span>';
}
$save = array('g_title' => $row['grouptitle'], 'g_perm_id' => $row['groupid'], 'prefix' => $prefix, 'suffix' => $suffix);
$this->lib->convertGroup($row['groupid'], $save);
$this->lib->setLastKeyValue($row['groupid']);
}
$this->lib->next();
}
示例10: convert_gallery_images
/**
* Convert Images
*
* @access private
* @return void
**/
private function convert_gallery_images()
{
//-----------------------------------------
// Were we given more info?
//-----------------------------------------
$this->lib->saveMoreInfo('gallery_images', array('gallery_path'));
//---------------------------
// Set up
//---------------------------
$main = array('select' => '*', 'from' => 'photos', 'order' => 'id ASC');
$loop = $this->lib->load('gallery_images', $main);
$cats = array();
$this->DB->build(array('select' => '*', 'from' => 'gallery_categories', 'category_type=2'));
// fetch all Images Only Categories
$this->DB->execute();
while ($r = $this->DB->fetch()) {
$cats[$r['category_id']] = $r['category_name'];
}
//-----------------------------------------
// We need to know the path
//-----------------------------------------
$featuredOpts['1'] = 'Yes';
$featuredOpts['0'] = 'No';
$this->lib->getMoreInfo('gallery_images', $loop, array('gallery_path' => array('type' => 'text', 'label' => 'The path to the folder where images are saved (no trailing slash - usually path_to_photopost/data):'), 'orphans' => array('type' => 'dropdown', 'label' => 'Where do you want to put orphaned images?', 'options' => $cats), 'feature_all' => array('type' => 'dropdown', 'label' => 'Feature All Images?', 'options' => $featuredOpts)), 'path');
$get = unserialize($this->settings['conv_extra']);
$us = $get[$this->lib->app['name']];
$path = $us['gallery_path'];
//-----------------------------------------
// Check all is well
//-----------------------------------------
if (!is_writable($this->settings['gallery_images_path'])) {
$this->lib->error('Your IP.Gallery upload path is not writeable. ' . $this->settings['gallery_images_path']);
}
if (!is_readable($path)) {
$this->lib->error('Your remote upload path is not readable.');
}
//---------------------------
// Loop
//---------------------------
while ($row = ipsRegistry::DB('hb')->fetch($this->lib->queryRes)) {
//-----------------------------------------
// Do the image
//-----------------------------------------
// Have a stab at the mimetype
$explode = explode('.', $row['bigimage']);
$ext = IPSText::mbstrtolower(array_pop($explode));
$ext = $ext == 'jpg' ? 'jpeg' : $ext;
$mime = "image/{$ext}";
// Basic info
$save = array('image_member_id' => $row['userid'], 'image_category_id' => $row['cat'] ? $row['cat'] : $us['orphans'], 'image_album_id' => $row['cat'] ? $row['cat'] : $us['orphans'], 'image_directory' => $row['cat'], 'image_caption' => $row['title'], 'image_description' => $row['description'], 'image_file_name' => $row['bigimage'], 'image_file_size' => $row['filesize'], 'image_file_type' => $mime, 'image_approved' => $row['approved'], 'image_views' => $row['views'], 'image_comments' => $row['numcom'], 'image_date' => $row['date'], 'image_rating' => $row['rating'], 'image_last_comment' => $row['lastpost'], 'image_caption_seo' => IPSText::makeSeoTitle($row['title']), 'image_feature_flag' => $us['feature_all']);
// I'm 98% sure I'm doing it wrong here - feel free to point it out.
$app = $this->DB->buildAndFetch(array('select' => '*', 'from' => 'conv_apps', 'where' => "name='{$this->settings['conv_current']}'"));
// Go!
$this->lib->convertImage($row['id'], $save, $path, false, $app['parent']);
}
$this->lib->next();
}
示例11: convert_members
/**
* Convert members
*
* @access private
* @return void
**/
private function convert_members()
{
//-----------------------------------------
// Were we given more info?
//-----------------------------------------
$pcpf = array('Location' => 'Location', 'Occupation' => 'Occupation', 'Interests' => 'Interests', 'RealName' => 'Real Name', 'HomePage' => 'Website URL', 'ICQ' => 'ICQ', 'AIM' => 'AIM', 'YIM' => 'YIM', 'MSN' => 'MSN');
$this->lib->saveMoreInfo('members', array_keys($pcpf));
//---------------------------
// Set up
//---------------------------
$main = array('select' => 'u.*', 'from' => array('User' => 'u'), 'order' => 'u.UserID ASC');
$loop = $this->lib->load('members', $main);
//-----------------------------------------
// Tell me what you know!
//-----------------------------------------
$get = unserialize($this->settings['conv_extra']);
$us = $get[$this->lib->app['name']];
$ask = array();
// And those custom profile fields
$options = array('x' => '-Skip-');
$this->DB->build(array('select' => '*', 'from' => 'pfields_data'));
$this->DB->execute();
while ($row = $this->DB->fetch()) {
$options[$row['pf_id']] = $row['pf_title'];
}
foreach ($pcpf as $id => $name) {
$ask[$id] = array('type' => 'dropdown', 'label' => 'Custom profile field to store ' . $name . ': ', 'options' => $options);
}
$this->lib->getMoreInfo('members', $loop, $ask, 'path');
//-----------------------------------------
// Get our custom profile fields
//-----------------------------------------
if (isset($us['pfield_group'])) {
$this->DB->build(array('select' => '*', 'from' => 'pfields_data', 'where' => 'pf_group_id=' . $us['pfield_group']));
$this->DB->execute();
$pfields = array();
while ($row = $this->DB->fetch()) {
$pfields[] = $row;
}
} else {
$pfields = array();
}
//---------------------------
// Loop
//---------------------------
while ($row = ipsRegistry::DB('hb')->fetch($this->lib->queryRes)) {
//-----------------------------------------
// Set info
//-----------------------------------------
// Secondary groups
ipsRegistry::DB('hb')->build(array('select' => '*', 'from' => 'UserGroup', 'where' => "UserID='{$row['UserID']}'"));
ipsRegistry::DB('hb')->execute();
$sgroups = array();
while ($group = ipsRegistry::DB('hb')->fetch()) {
$sgroups[] = $group['GroupID'];
}
$group = array_shift($sgroups);
// Basic info
$info = array('id' => $row['UserID'], 'username' => $row['Name'], 'email' => $row['Email'], 'md5pass' => IPSText::mbstrtolower($row['Password']), 'joined' => $this->_fixTime($row['Joined']), 'secondary_groups' => implode(',', $sgroups), 'group' => $group);
// Member info
$members = array('ip_address' => $row['IP'], 'last_activity' => $this->_fixTime($row['LastVisit']), 'last_visit' => $this->_fixTime($row['LastVisit']), 'posts' => $row['NumPosts'], 'view_sigs' => 1, 'hide_email' => 1);
// Profile
$profile = array('signature' => $this->fixPostData($row['Signature']), 'photo_type' => $row['Avatar'] ? 'url' : '', 'photo_location' => $row['Avatar'] ? $row['Avatar'] : '');
//-----------------------------------------
// Avatars
//-----------------------------------------
if ($row['Avatar']) {
$profile['photo_type'] = 'url';
$profile['photo_location'] = $row['Avatar'];
} elseif ($row['AvatarImage']) {
$profile['photo_type'] = 'custom';
$profile['photo_location'] = 'av-conv-' . $row['UserID'] . '.' . str_ireplace('image/', '', $row['AvatarImageType']);
$profile['photo_data'] = $row['AvatarImage'];
$profile['photo_filesize'] = strlen($row['AvatarImage']);
//$profile['avatar_size'] = $customavatar['width'].'x'.$customavatar['height'];
}
//-----------------------------------------
// Custom Profile fields
//-----------------------------------------
// Pseudo
foreach ($pcpf as $id => $name) {
if ($us[$id] != 'x') {
$custom['field_' . $us[$id]] = $row[$id];
}
}
// Actual
foreach ($pfields as $field) {
$custom['field_' . $field['pf_id']] = $row[$field['pf_key']];
}
//-----------------------------------------
// And go!
//-----------------------------------------
$this->lib->convertMember($info, $members, $profile, array());
}
//.........這裏部分代碼省略.........
示例12: convert_gallery_images
/**
* Convert Images
*
* @access private
* @return void
**/
private function convert_gallery_images()
{
//-----------------------------------------
// Were we given more info?
//-----------------------------------------
$this->lib->saveMoreInfo('gallery_images', array('gallery_path'));
//---------------------------
// Set up
//---------------------------
$main = array('select' => '*', 'from' => 'fileuploads', 'order' => 'fileid ASC');
$loop = $this->lib->load('gallery_images', $main);
//-----------------------------------------
// We need to know the path
//-----------------------------------------
$this->lib->getMoreInfo('gallery_images', $loop, array('gallery_path' => array('type' => 'text', 'label' => 'The path to the folder where images are saved (no trailing slash - usually path_to_photoplog/images):')), 'path');
$get = unserialize($this->settings['conv_extra']);
$us = $get[$this->lib->app['name']];
$path = $us['gallery_path'];
//-----------------------------------------
// Check all is well
//-----------------------------------------
if (!is_writable($this->settings['gallery_images_path'])) {
$this->lib->error('Your IP.Gallery upload path is not writeable. ' . $this->settings['gallery_images_path']);
}
if (!is_readable($path)) {
$this->lib->error('Your remote upload path is not readable.');
}
//---------------------------
// Loop
//---------------------------
while ($row = ipsRegistry::DB('hb')->fetch($this->lib->queryRes)) {
//-----------------------------------------
// Do the image
//-----------------------------------------
// Have a stab at the mimetype
$explode = explode('.', $row['filename']);
$ext = IPSText::mbstrtolower(array_pop($explode));
$ext = $ext == 'jpg' ? 'jpeg' : $ext;
$mime = "image/{$ext}";
// Do we have an image set?
$set = $this->lib->getLink('s' . $row['setid'], 'gallery_albums', true);
if (!$set && $row['catid'] && $row['userid']) {
// Attempt to see if we already have one in database
$cat = $this->DB->buildAndFetch(array('select' => 'a.album_id', 'from' => array('gallery_albums' => 'a'), 'add_join' => array(array('select' => 'cl.foreign_id', 'from' => array('conv_link' => 'cl'), 'where' => "cl.ipb_id=a.album_id AND cl.type='gallery_albums'", 'type' => 'left')), 'where' => 'a.album_category_id=' . $this->lib->getLink($row['catid'], 'gallery_categories') . ' AND a.album_owner_id=' . $this->lib->getLink($row['userid'], 'members', false, true) . " AND cl.foreign_id='s" . $row['setid'] . "'"));
// We have a category
if ($cat['foreign_id']) {
$row['setid'] = str_replace('s', '', $cat['foreign_id']);
} else {
// Grab child albums
$save = array('album_owner_id' => $row['userid'], 'album_category_id' => $row['catid'], 'album_name' => $row['title'], 'album_description' => '', 'album_type' => 1);
$this->lib->convertAlbum('s' . $row['setid'], $save, array());
}
}
// Basic info
$save = array('member_id' => $row['userid'], 'image_category_id' => $row['catid'], 'image_album_id' => 's' . $row['setid'], 'image_caption' => $row['title'], 'image_description' => $row['description'], 'image_directory' => $row['userid'], 'image_file_name' => $row['filename'], 'image_file_size' => $row['filesize'], 'image_file_type' => $mime, 'image_approved' => $row['moderate'] == 1 ? 0 : 1, 'image_views' => $row['views'], 'image_comments' => $row['num_comments0'] + $row['num_comments1'], 'image_date' => $row['dateline'], 'image_ratings_total' => $row['sum_ratings1'], 'image_ratings_count' => $row['num_ratings1'], 'image_rating' => $row['num_ratings1'] > 0 ? intval($row['sum_ratings1'] / $row['num_ratings1']) : 0);
// Go!
$this->lib->convertImage($row['fileid'], $save, $path);
//-----------------------------------------
// Ratings
//-----------------------------------------
$rates = array('select' => '*', 'from' => 'ratecomment', 'order' => 'commentid ASC', 'where' => 'fileid=' . $row['fileid'] . ' AND rating=0');
ipsRegistry::DB('hb')->build($rates);
ipsRegistry::DB('hb')->execute();
while ($rate = ipsRegistry::DB('hb')->fetch()) {
$this->lib->convertRating($rate['commentid'], array('member_id' => $row['userid'], 'img_id' => $row['fileid'], 'date' => $row['dateline'], 'rate' => $row['rating']));
}
}
$this->lib->next();
}
示例13: convert_subscriptions
/**
* Convert Packages
*
* @access private
* @return void
**/
private function convert_subscriptions()
{
//---------------------------
// Set up
//---------------------------
$main = array('select' => '*', 'from' => 'subscription', 'order' => 'subscriptionid ASC');
$loop = $this->lib->load('subscriptions', $main);
//---------------------------
// Loop
//---------------------------
while ($row = ipsRegistry::DB('hb')->fetch($this->lib->queryRes)) {
// Get local stuff
$default_currency = $this->DB->buildAndFetch(array('select' => 'subcurrency_code', 'from' => 'subscription_currency', 'where' => "subcurrency_default=1"));
$tco = $this->DB->buildAndFetch(array('select' => 'submethod_id', 'from' => 'subscription_methods', 'where' => "submethod_name='2checkout'"));
// Get remote stuff
$title = ipsRegistry::DB('hb')->buildAndFetch(array('select' => 'text', 'from' => 'phrase', 'where' => "varname = 'sub{$row['subscriptionid']}_title'"));
$desc = ipsRegistry::DB('hb')->buildAndFetch(array('select' => 'text', 'from' => 'phrase', 'where' => "varname = 'sub{$row['subscriptionid']}_desc'"));
// Loop through costs
$costs = unserialize($row['cost']);
foreach ($costs as $cost) {
// Check we have a matching currency
if (!in_array(IPSText::mbstrtolower($default_currency['subcurrency_code']), array_keys($cost['cost']))) {
$this->lib->logError($row['subscriptionid'], "No price for default currnecy ({$default_currency['subcurrency_code']})");
continue 2;
}
// Save to subscriptions
$save = array('sub_title' => $title['text'], 'sub_desc' => $desc['text'], 'sub_new_group' => $row['nusergroupid'], 'sub_length' => $cost['length'], 'sub_unit' => IPSText::mbstrtolower($cost['units']), 'sub_cost' => $cost['cost'][IPSText::mbstrtolower($default_currency['subcurrency_code'])]);
$this->lib->convertPackage($row['subscriptionid'], $save);
// 2CO Product ID?
if ($cost['twocheckout_prodid'] and $tco) {
$extra = array('subextra_sub_id' => $row['subscriptionid'], 'subextra_method_id' => $tco['submethod_id'], 'subextra_product_id' => $cost['twocheckout_prodid']);
$this->lib->convertPackageExtra($row['subscriptionid'], $extra);
}
}
}
$this->lib->next();
}
示例14: fixFrenchDate
public function fixFrenchDate($date)
{
// Make the months lowercase
$date = IPSText::mbstrtolower($date);
// Check if strtotime can create a unix timestamp.
if (strtotime($date) !== FALSE) {
return $date;
}
// Add seconds to the timestamp
$date .= ':00';
// Check again if strtotime can create a unix timestamp.
if (strtotime($date) !== FALSE) {
return $date;
}
$shortMonthTranslations = array('fév' => 'feb', 'fev' => 'feb', 'mars' => 'mar', 'avr' => 'apr', 'mai' => 'may', 'juin' => 'june', 'jui' => 'jul', 'aoû' => 'aug', 'aou' => 'aug', 'déc' => 'dec');
// Time to replace all french months with english
foreach ($shortMonthTranslations as $toFix => $theFix) {
$date = str_replace($toFix, $theFix, $date);
}
// Replace slashes with spaces.
$date = str_replace('/', ' ', $date);
// Check again if strtotime can create a unix timestamp.
if (strtotime($date) !== FALSE) {
return $date;
}
print 'Error: ' . $date;
exit;
}
示例15: _cleanTags
/**
* Cleans incoming tags
* @param String or Array Comma delim string or array of tags
* @param Bool If TRUE, will check minimum and maximum amounts of tags - not necessary for searching
* @return Array Array of cleaned tags
*/
private function _cleanTags($tags, $checkForMinimumAndMaximum = TRUE)
{
/* Sort out tags */
if (!is_array($tags)) {
if (strstr($tags, ',')) {
$_tags = explode(',', IPSText::cleanPermString($tags));
$tags = array();
foreach ($_tags as $t) {
if ($t) {
$tags[] = $this->_stripHtml(trim($this->_forceLower() ? IPSText::mbstrtolower($t) : $t));
}
}
} else {
if (!strlen($tags)) {
return false;
}
$tags = array($this->_stripHtml($this->_forceLower() ? IPSText::mbstrtolower($tags) : $tags));
}
}
/* So.. got tags to parse? */
if (count($tags)) {
/* Make sure they are all unique */
$tags = array_unique($tags);
/* Check for min/max string length */
if ($checkForMinimumAndMaximum and ($this->_getMaxLen() or $this->_getMinLen())) {
$_tags = $tags;
$tags = array();
foreach ($_tags as $tag) {
if ($this->_getMaxLen()) {
if (IPSText::mbstrlen($tag) > $this->_getMaxLen()) {
continue;
}
}
if ($this->_getMinLen()) {
if (IPSText::mbstrlen($tag) < $this->_getMinLen()) {
continue;
}
}
$tags[] = $tag;
}
}
/* removes any bad words */
$badwords = $this->cache->getCache('badwords');
if ($this->_mustCleanWords() and is_array($badwords) && count($badwords)) {
$_tags = $tags;
$tags = array();
foreach ($_tags as $tag) {
$_bad = false;
foreach ($badwords as $badword) {
if (strtolower($tag) == strtolower($badword['type'])) {
$_bad = true;
break;
}
}
if (!$_bad) {
$tags[] = $tag;
}
}
}
}
/* Now, do we have a sufficient number of tags? */
if ($checkForMinimumAndMaximum && $this->_getMaxTags() && count($tags) > $this->_getMaxTags()) {
$this->setErrorMsg('too_many_tags');
return false;
}
/* Perhaps not enough? */
if ($checkForMinimumAndMaximum && $this->_getMinTags() && count($tags) < $this->_getMinTags()) {
$this->setErrorMsg('too_few_tags');
return false;
}
/* Generic catch all in case min/max tags aren't set up. */
if (!count($tags)) {
$this->setErrorMsg('no_good_tags');
return false;
}
/* Phew. */
return $tags;
}