本文整理汇总了PHP中ipsRegistry::dbFunctions方法的典型用法代码示例。如果您正苦于以下问题:PHP ipsRegistry::dbFunctions方法的具体用法?PHP ipsRegistry::dbFunctions怎么用?PHP ipsRegistry::dbFunctions使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ipsRegistry
的用法示例。
在下文中一共展示了ipsRegistry::dbFunctions方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: doExecute
/**
* Main class entry point
*
* @access public
* @param object ipsRegistry reference
*/
public function doExecute(ipsRegistry $registry)
{
/* Require the right driver file */
require_once IPS_ROOT_PATH . 'applications/core/modules_admin/sql/' . strtolower(ipsRegistry::dbFunctions()->getDriverType()) . '.php';
$dbdriver = new admin_core_sql_toolbox_module();
$dbdriver->makeRegistryShortcuts($registry);
$dbdriver->doExecute($registry);
}
示例2: doExecute
/**
* Main class entry point
*
* @param object ipsRegistry reference
*/
public function doExecute(ipsRegistry $registry)
{
/* Require the right driver file */
$classToLoad = IPSLib::loadActionOverloader(IPS_ROOT_PATH . 'applications/core/modules_admin/sql/' . strtolower(ipsRegistry::dbFunctions()->getDriverType()) . '.php', 'admin_core_sql_toolbox_module');
/*noLibHook*/
$dbdriver = new $classToLoad();
$dbdriver->makeRegistryShortcuts($registry);
$dbdriver->doExecute($registry);
}
示例3: trim
<?php
/*
+--------------------------------------------------------------------------
| IP.Board v3.4.5
| ========================================
| by Matthew Mecham
| (c) 2001 - 2009 Invision Power Services
| http://www.invisionpower.com
| ========================================
| Web: http://www.invisionboard.com
| Email: matt@invisionpower.com
| Licence Info: http://www.invisionboard.com/?license
+---------------------------------------------------------------------------
*/
$PRE = trim(ipsRegistry::dbFunctions()->getPrefix());
$DB = ipsRegistry::DB();
$TABLE = 'dnames_change';
$SQL[] = "ALTER TABLE dnames_change CHANGE dname_ip_address dname_ip_address VARCHAR( 46 ) NOT NULL;";
示例4: sqlBasics
/**
* Creates Tables, Runs Inserts, and Indexes
*
* @return @e void
*/
public function sqlBasics()
{
/* INIT */
$vars = $this->getVars();
$output = array();
$errors = array();
$skipped = 0;
$count = 0;
/* Any "extra" configs required for this driver? */
if (is_file(IPS_ROOT_PATH . 'setup/sql/' . strtolower($this->settings['sql_driver']) . '_install.php')) {
require_once IPS_ROOT_PATH . 'setup/sql/' . strtolower($this->settings['sql_driver']) . '_install.php';
/*noLibHook*/
$extra_install = new install_extra($this->registry);
}
//-----------------------------------------
// Tables
//-----------------------------------------
$this->DB->return_die = 1;
if (is_file($this->app_full_path . 'setup/versions/install/sql/' . $vars['app_directory'] . '_' . strtolower(ipsRegistry::dbFunctions()->getDriverType()) . '_tables.php')) {
$TABLE = array();
include $this->app_full_path . 'setup/versions/install/sql/' . $vars['app_directory'] . '_' . strtolower(ipsRegistry::dbFunctions()->getDriverType()) . '_tables.php';
/*noLibHook*/
if (is_array($TABLE) and count($TABLE)) {
foreach ($TABLE as $q) {
//-----------------------------------------
// Is this a create?
//-----------------------------------------
preg_match("/CREATE TABLE\\s+(\\S+)(\\s)?\\(/", str_ireplace('if not exists', '', $q), $match);
if ($match[1] and $vars['dupe_tables'] == 'drop') {
$this->DB->dropTable(str_replace($this->settings['sql_tbl_prefix'], '', $match[1]));
} else {
if ($match[1]) {
if ($this->DB->getTableSchematic($match[1])) {
$skipped++;
continue;
}
}
}
//-----------------------------------------
// Is this an alter?
//-----------------------------------------
preg_match("/ALTER\\s+TABLE\\s+(\\S+)\\s+ADD\\s+(\\S+)\\s+/i", $q, $match);
if ($match[1] and $match[2] and $vars['dupe_tables'] == 'drop') {
$this->DB->dropField(str_replace($this->settings['sql_tbl_prefix'], '', $match[1]), $match[2]);
} else {
if ($match[1] and $match[2]) {
if ($this->DB->checkForField($match[2], $match[1])) {
$skipped++;
continue;
}
}
}
if ($extra_install and method_exists($extra_install, 'process_query_create')) {
$q = $extra_install->process_query_create($q);
}
$this->DB->error = '';
$this->DB->query($q);
if ($this->DB->error) {
$errors[] = $q . "<br /><br />" . $this->DB->error;
} else {
$count++;
}
}
}
$output[] = sprintf($this->lang->words['redir__sql_tables'], $count, $skipped);
}
//---------------------------------------------
// Create the fulltext index...
//---------------------------------------------
if ($this->DB->checkFulltextSupport()) {
if (is_file($this->app_full_path . 'setup/versions/install/sql/' . $vars['app_directory'] . '_' . strtolower(ipsRegistry::dbFunctions()->getDriverType()) . '_fulltext.php')) {
$INDEX = array();
include $this->app_full_path . 'setup/versions/install/sql/' . $vars['app_directory'] . '_' . strtolower(ipsRegistry::dbFunctions()->getDriverType()) . '_fulltext.php';
/*noLibHook*/
$count = 0;
foreach ($INDEX as $q) {
//---------------------------------------------
// Pass to handler
//---------------------------------------------
if ($extra_install and method_exists($extra_install, 'process_query_index')) {
$q = $extra_install->process_query_index($q);
}
//---------------------------------------------
// Pass query
//---------------------------------------------
$this->DB->error = '';
$this->DB->query($q);
if ($this->DB->error) {
$errors[] = $q . "<br /><br />" . $this->DB->error;
} else {
$count++;
}
}
$output[] = sprintf($this->lang->words['redir__sql_indexes'], $count);
}
//.........这里部分代码省略.........
示例5: step_21
function step_21()
{
#$SQL[] = "alter table ".ipsRegistry::dbFunctions()->getPrefix()."posts drop index topic_id;";
$SQL[] = "alter table " . ipsRegistry::dbFunctions()->getPrefix() . "posts drop index author_id;";
#$SQL[] = "alter table ".ipsRegistry::dbFunctions()->getPrefix()."posts add index topic_id (topic_id, queued, pid);";
$SQL[] = "alter table " . ipsRegistry::dbFunctions()->getPrefix() . "posts add index author_id( author_id, topic_id);";
$SQL[] = "ALTER TABLE " . ipsRegistry::dbFunctions()->getPrefix() . "posts DROP INDEX forum_id, ADD INDEX(post_date);";
$this->error = array();
$this->sqlcount = 0;
$output = "";
$this->DB->return_die = 1;
foreach ($SQL as $query) {
$this->DB->allow_sub_select = 1;
$this->DB->error = '';
if (IPSSetUp::getSavedData('man')) {
$output .= preg_replace("/\\sibf_(\\S+?)([\\s\\.,]|\$)/", " " . $this->DB->obj['sql_tbl_prefix'] . "\\1\\2", preg_replace("/\\s{1,}/", " ", $query)) . "\n\n";
} else {
$this->DB->query($query);
if ($this->DB->error) {
$this->registry->output->addError($query . "<br /><br />" . $this->DB->error);
} else {
$this->sqlcount++;
}
}
}
$this->registry->output->addMessage("Optimization completed");
$this->request['workact'] = 'step_22';
if (IPSSetUp::getSavedData('man') and $output) {
$this->_output = $this->registry->output->template()->upgrade_manual_queries($output);
}
unset($this->request['workact']);
unset($this->request['st']);
}
示例6: trim
/*
+--------------------------------------------------------------------------
| IP.Board v3.4.6
| ========================================
| by Matthew Mecham
| (c) 2001 - 2004 Invision Power Services
| http://www.invisionpower.com
| ========================================
| Web: http://www.invisionboard.com
| Email: matt@invisionpower.com
| Licence Info: http://www.invisionboard.com/?license
+---------------------------------------------------------------------------
*/
# Member table updates
# We use backticks on the second table to stop IPSSetUp::addPrefixToQuery() from stripping the prefix
$SQL[] = "UPDATE members m, `" . trim(ipsRegistry::dbFunctions()->getPrefix()) . "members_converge` c SET m.members_pass_hash=c.converge_pass_hash WHERE c.converge_id=m.member_id;";
$SQL[] = "UPDATE members m, `" . trim(ipsRegistry::dbFunctions()->getPrefix()) . "members_converge` c SET m.members_pass_salt=c.converge_pass_salt WHERE c.converge_id=m.member_id;";
# Blank email addresses
$SQL[] = "UPDATE members SET email=CONCAT( member_id, '-', UNIX_TIMESTAMP(), '@fakeemail.com' ) WHERE email='';";
# If we upgraded from 2.1.0ish then we may not have anything in profile_portal so...
$count = ipsRegistry::DB()->buildAndFetch(array('select' => 'count(*) as count', 'from' => 'profile_portal'));
if (!$count['count']) {
ipsRegistry::DB()->allow_sub_select = 1;
$SQL[] = "INSERT INTO profile_portal (pp_member_id,notes,links,bio,ta_size,signature,avatar_location,avatar_size,avatar_type) SELECT id,notes,links,bio,ta_size,signature,avatar_location,avatar_size,avatar_type FROM `" . trim(ipsRegistry::dbFunctions()->getPrefix()) . "member_extra`";
} else {
$SQL[] = "UPDATE profile_portal p, `" . trim(ipsRegistry::dbFunctions()->getPrefix()) . "member_extra` e SET p.notes=e.notes, p.links=e.links, p.bio=e.bio, p.ta_size=e.ta_size, p.signature=e.signature, p.avatar_location=e.avatar_location, p.avatar_size=e.avatar_size, p.avatar_type=e.avatar_type WHERE p.pp_member_id=e.id;";
}
$SQL[] = "UPDATE profile_portal SET pp_setting_count_friends=5 WHERE pp_setting_count_friends=0;";
$SQL[] = "UPDATE profile_portal SET pp_setting_count_comments=10 WHERE pp_setting_count_comments=0;";
$SQL[] = "UPDATE profile_portal SET pp_setting_count_visitors=5 WHERE pp_setting_count_visitors=0;";
示例7: _loadCaches
/**
* Load cache(s)
*
* @param array Array of caches to load: array( 'group_cache', 'forum_cache' )
* @return mixed Loaded Cache
* @access private
* @author MattMecham
*/
private static function _loadCaches($caches = array())
{
if (!is_array($caches) or !count($caches)) {
return NULL;
}
//-----------------------------------------
// Finalize
//-----------------------------------------
$cachelist = "'" . implode("','", $caches) . "'";
//--------------------------------
// Eaccelerator...
//--------------------------------
if (is_object(self::$cacheLib)) {
$temp_cache = array();
$new_cache_array = array();
foreach ($caches as $key) {
$temp_cache[$key] = self::$cacheLib->getFromCache($key);
if (!$temp_cache[$key]) {
$new_cache_array[] = $key;
} else {
if (is_string($temp_cache[$key]) and strstr($temp_cache[$key], "a:") !== false) {
self::instance()->data_store[$key] = unserialize($temp_cache[$key]);
} else {
if ($temp_cache[$key] == "EMPTY") {
self::instance()->data_store[$key] = NULL;
} else {
self::instance()->data_store[$key] = $temp_cache[$key];
}
}
}
}
$cachearray = $new_cache_array;
unset($new_cache_array, $temp_cache);
}
//--------------------------------
// Get from DB...
//--------------------------------
if ($cachelist) {
/* This is here for veeeeeery old 1.0.1 upgrades */
if (!ipsRegistry::DB()->checkForTable('cache_store')) {
ipsRegistry::DB()->query("create table " . ipsRegistry::dbFunctions()->getPrefix() . "cache_store (\r\n\t\t\t\t\t\t cs_key varchar(255) NOT NULL default '',\r\n\t\t\t\t\t\t cs_value text NULL,\r\n\t\t\t\t\t\t cs_extra varchar(255) NOT NULL default '',\r\n\t\t\t\t\t\t PRIMARY KEY(cs_key)\r\n\t\t\t\t\t\t);");
}
ipsRegistry::DB()->build(array('select' => '*', 'from' => 'cache_store', 'where' => "cs_key IN ( {$cachelist} )"));
ipsRegistry::DB()->execute();
$_seenKeys = array();
while ($r = ipsRegistry::DB()->fetch()) {
$_seenKeys[$r['cs_key']] = $r['cs_key'];
self::instance()->debugInfo[$r['cs_key']] = array('size' => IPSLib::strlenToBytes(strlen($r['cs_value'])));
if ($r['cs_array'] or substr($r['cs_value'], 0, 2) == "a:") {
self::instance()->data_store[$r['cs_key']] = unserialize($r['cs_value']);
if (!is_array(self::instance()->data_store[$r['cs_key']])) {
self::instance()->data_store[$r['cs_key']] = array();
}
} else {
self::instance()->data_store[$r['cs_key']] = $r['cs_value'] ? $r['cs_value'] : NULL;
}
if (is_object(self::$cacheLib)) {
if (!$r['cs_value']) {
$r['cs_value'] = "EMPTY";
}
self::$cacheLib->putInCache($r['cs_key'], $r['cs_value']);
}
}
}
//-----------------------------------------
// Make sure each key is in data_store otherwise
// repeated calls will keep trying to load it
//-----------------------------------------
foreach ($caches as $_cache) {
if (!in_array($_cache, $_seenKeys)) {
self::instance()->data_store[$_cache] = NULL;
}
}
}
示例8: applicationRemove
/**
* Remove an application
*
* @return @e void [Outputs to screen]
*/
public function applicationRemove()
{
//--------------------------------------------
// INIT
//--------------------------------------------
$app_id = intval($this->request['app_id']);
//-----------------------------------------
// Got an application?
//-----------------------------------------
$application = $this->DB->buildAndFetch(array('select' => '*', 'from' => 'core_applications', 'where' => 'app_id=' . $app_id));
if (!$application['app_id']) {
$this->registry->output->global_message = $this->lang->words['a_noid'];
$this->applicationsOverview();
return;
}
//-----------------------------------------
// Protected?
//-----------------------------------------
if (!IN_DEV and $application['app_protected']) {
$this->registry->output->global_message = $this->lang->words['a_protectapp'];
$this->applicationsOverview();
return;
}
//-----------------------------------------
// Remove Settings
//-----------------------------------------
$this->DB->build(array('select' => '*', 'from' => 'core_sys_settings_titles', 'where' => "conf_title_app='{$application['app_directory']}'"));
$this->DB->execute();
$conf_title_id = array();
while ($r = $this->DB->fetch()) {
$conf_title_id[] = $r['conf_title_id'];
}
if (count($conf_title_id)) {
$this->DB->delete('core_sys_conf_settings', 'conf_group IN(' . implode(',', $conf_title_id) . ')');
}
$this->DB->delete('core_sys_settings_titles', "conf_title_app='{$application['app_directory']}'");
$settingsFile = IPSLib::getAppDir($application['app_directory']) . '/xml/' . $application['app_directory'] . '_settings.xml';
if (is_file($settingsFile)) {
require_once IPS_KERNEL_PATH . 'classXML.php';
/*noLibHook*/
$xml = new classXML(IPS_DOC_CHAR_SET);
$xml->load($settingsFile);
$keys = array();
foreach ($xml->fetchElements('setting') as $setting) {
$entry = $xml->fetchElementsFromRecord($setting);
if ($entry['conf_is_title']) {
continue;
}
$keys[] = "'{$entry['conf_key']}'";
}
if (!empty($keys)) {
$this->DB->delete('core_sys_conf_settings', 'conf_key IN(' . implode(',', $keys) . ')');
}
}
//-----------------------------------------
// Remove Application Caches
//-----------------------------------------
$_file = IPSLib::getAppDir($application['app_directory']) . '/extensions/coreVariables.php';
if (is_file($_file)) {
$CACHE = array();
require $_file;
/*noLibHook*/
if (is_array($CACHE) and count($CACHE)) {
foreach ($CACHE as $key => $data) {
$this->DB->delete('cache_store', "cs_key='{$key}'");
}
}
}
//-----------------------------------------
// Remove tables
//-----------------------------------------
$_file = IPSLib::getAppDir($application['app_directory']) . '/setup/versions/install/sql/' . $application['app_directory'] . '_' . ipsRegistry::dbFunctions()->getDriverType() . '_tables.php';
if (is_file($_file)) {
$TABLE = array();
require $_file;
/*noLibHook*/
foreach ($TABLE as $q) {
//-----------------------------------------
// Capture create tables first
//-----------------------------------------
preg_match("/CREATE TABLE (\\S+)(\\s)?\\(/", $q, $match);
if ($match[1]) {
$_table = preg_replace('#^' . ipsRegistry::dbFunctions()->getPrefix() . "(\\S+)#", "\\1", $match[1]);
$this->DB->dropTable($_table);
} else {
//-----------------------------------------
// Then capture alter tables
//-----------------------------------------
preg_match("/ALTER TABLE (\\S+)\\sADD\\s(\\S+)\\s/i", $q, $match);
if ($match[1] and $match[2]) {
$_table = preg_replace('#^' . ipsRegistry::dbFunctions()->getPrefix() . "(\\S+)#", "\\1", $match[1]);
$_field = $match[2];
/* check for field */
if ($this->DB->checkForField($_field, $_table)) {
$this->DB->dropField($_table, $_field);
//.........这里部分代码省略.........
示例9: restoreRecentPost
/**
* Restore posts
* @param array $where
*/
public function restoreRecentPost($where)
{
$date = IPS_UNIX_TIME_NOW - 86400;
$PRE = trim(ipsRegistry::dbFunctions()->getPrefix());
$query = array();
$remap = array('post_id' => 'pid', 'post_topic_id' => 'topic_id', 'post_author_id' => 'post_author_id');
foreach (array('post_id', 'post_topic_id', 'post_forum_id', 'post_author_id') as $k) {
if (!empty($where[$k])) {
$query[] = is_array($where[$k]) ? $remap[$k] . ' IN (' . implode(',', $where[$k]) . ')' : $remap[$k] . '=' . intval($where[$k]);
}
}
if (count($query)) {
$this->DB->loadCacheFile(IPSLib::getAppDir('forums') . '/sql/' . ips_DBRegistry::getDriverType() . '_topics_queries.php', 'topics_sql_queries');
$this->DB->buildFromCache('restoreRecentPost', array('query' => $query, 'date' => $date), 'topics_sql_queries');
$this->DB->allow_sub_select = true;
$this->DB->execute();
}
}
示例10: runTask
/**
* Run this task
*
* @return @e void
*/
public function runTask()
{
/* Not needed for mssql as per #23105 bug */
if (ipsRegistry::dbFunctions()->getDriverType() != 'mysql') {
$this->class->unlockTask($this->task);
return;
}
/* Get tables and optimize */
$tables = $this->charlesTables;
$_tables = array();
if (is_array($tables) and count($tables)) {
/* InnoDB is a no-no! :o */
$this->DB->query("SHOW TABLE STATUS");
while ($tbl = $this->DB->fetch()) {
if (!empty($tbl['Name']) && in_array(preg_replace('#^' . ipsRegistry::$settings['sql_tbl_prefix'] . '(.+?)#', "\\1", $tbl['Name']), $tables) && strtolower($tbl['Engine']) != 'innodb') {
$_tables[] = $tbl['Name'];
}
}
/* Was everything a no-no? :( */
if (count($_tables)) {
$PRE = ipsRegistry::dbFunctions()->getPrefix();
foreach ($_tables as $_table) {
$this->DB->query("OPTIMIZE TABLE {$PRE}{$_table}");
$this->DB->query("ANALYZE TABLE {$PRE}{$_table}");
}
}
}
/* Log to log table - modify but dont delete */
$this->registry->getClass('class_localization')->loadLanguageFile(array('public_global'), 'core');
$this->class->appendTaskLog($this->task, sprintf($this->lang->words['task__optimizedtables'], count($_tables)));
/* Unlock Task: DO NOT MODIFY! */
$this->class->unlockTask($this->task);
}
示例11: convertImage
//.........这里部分代码省略.........
} else {
$info['image_category_id'] = ipsRegistry::$settings['gallery_members_album'];
}
$info['image_album_id'] = $albumID;
} else {
$info['image_category_id'] = $this->getLink($info['image_album_id'], 'gallery_categories');
$info['image_album_id'] = 0;
}
//-----------------------------------------
// Set up array
//-----------------------------------------
$imageArray = array('image_member_id' => $this->getLink($info['image_member_id'], 'members', false, $this->useLocalLink), 'image_album_id' => $info['image_album_id'], 'image_category_id' => $info['image_category_id'], 'image_caption' => $info['image_caption'] ? $info['image_caption'] : 'No caption', 'image_description' => $info['image_description'], 'image_directory' => '', 'image_file_name' => $info['image_file_name'], 'image_approved' => $info['image_approved'], 'image_thumbnail' => 0, 'image_views' => intval($info['image_views']), 'image_comments' => intval($info['image_comments']), 'image_date' => intval($info['image_date']), 'image_ratings_total' => intval($info['image_ratings_total']), 'image_ratings_count' => intval($info['image_ratings_count']), 'image_caption_seo' => IPSText::makeSeoTitle($info['image_caption']), 'image_notes' => $info['image_notes'], 'image_rating' => intval($info['image_ratings_total']) > 0 ? intval($info['image_ratings_total']) / intval($info['image_ratings_count']) : 0, 'image_privacy' => $info['image_privacy']);
if (!isset($info['image_file_size'])) {
$imageArray['image_file_size'] = @filesize($path . '/' . $info['image_masked_file_name']);
} else {
$imageArray['image_file_size'] = $info['image_file_size'];
}
// Fields still required = array( 'file_name', 'file_type', 'masked_file_name', 'medium_file_name');
// Fields optional = array( 'file_size', 'pinned', 'media', 'credit_info', 'metadata', 'media_thumb');
$_file = IPSLib::getAppDir('gallery') . '/app_class_gallery.php';
$_name = 'app_class_gallery';
$galleryLibObject = null;
if (file_exists($_file)) {
$classToLoad = IPSLib::loadLibrary($_file, $_name);
$galleryLibObject = new $classToLoad($this->registry);
}
require_once IPS_KERNEL_PATH . 'classUpload.php';
$upload = new classUpload();
$dir = $this->registry->gallery->helper('upload')->createDirectoryName($imageArray['image_album_id'], $imageArray['image_category_id']);
if (!is_dir($this->settings['gallery_images_path'] . DIRECTORY_SEPARATOR . $dir)) {
$this->error('Could not create directory to store images, please check <b>permissions (0777)</b> and <b>ownership</b> on "' . $this->settings['gallery_images_path'] . '/gallery/"');
}
$ext = $upload->_getFileExtension($info['image_file_name']);
$container = $imageArray['image_category_id'];
if ($imageArray['image_album_id']) {
$container = $imageArray['image_album_id'];
}
$new_name = "gallery_{$info['image_member_id']}_" . $container . "_" . time() . '_' . $id . '.' . $ext;
$imageArray['image_masked_file_name'] = $new_name;
$new_file = $this->settings['gallery_images_path'] . '/' . $dir . '/' . $new_name;
// stop image_directory being category_ and album_
if (($imageArray['image_album_id'] != 0 || isset($imageArray['image_album_id']) || !empty($imageArray['image_album_id'])) && ($imageArray['image_category_id'] != 0 || isset($imageArray['image_category_id']) || !empty($imageArray['image_category_id']))) {
// Set directory
$imageArray['image_directory'] = $imageArray['image_album_id'] ? 'gallery/album_' . $imageArray['image_album_id'] : 'gallery/category_' . $imageArray['image_category_id'];
} else {
$imageArray['image_directory'] = '';
}
if ($imageArray['image_directory'] == 'gallery/category_' || $imageArray['image_directory'] == 'gallery/album_') {
$imageArray['image_directory'] = '';
}
// Create the file from the db if that's the case
if ($db) {
$this->createFile($new_name, $info['image_data'], $info['image_file_size'], $this->settings['gallery_images_path'] . '/' . substr($dir, 0, -1));
} else {
// Copy the file to its end IP.Gallery location
if (!@copy($path . '/' . $info['image_masked_file_name'], $new_file)) {
$e = error_get_last();
$this->logError($id, 'Could not move file - attempted to move ' . $path . '/' . $info['image_masked_file_name'] . ' to ' . $new_file . '<br />' . $e['message'] . '<br /><br />');
return false;
}
}
@chmod($new_file, 0777);
if (method_exists($upload, 'check_xss_infile')) {
$upload->saved_upload_name = $new_file;
$upload->check_xss_infile();
if ($upload->error_no == 5) {
$this->logError($id, 'Invalid XSS file: ' . $info['image_file_name'] . '<br /><br />');
return false;
}
}
//-------------------------------------------------------------
// Exif/IPTC support?
//-------------------------------------------------------------
$meta_data = array();
if ($this->settings['gallery_exif']) {
$meta_data = array_merge($meta_data, $this->registry->gallery->helper('image')->extractExif($new_file));
}
if ($this->settings['gallery_iptc']) {
$meta_data = array_merge($meta_data, $this->registry->gallery->helper('image')->extractIptc($new_file));
}
$imageArray['image_metadata'] = serialize($meta_data);
//-------------------------------------------------------------
// Pass to library
//-------------------------------------------------------------
$media = 0;
$imageArray['image_media'] = $this->_isImage($ext) ? 0 : 1;
$imageArray['image_medium_file_name'] = 'med_' . $new_name;
$imageArray['image_file_type'] = $this->registry->gallery->helper('image')->getImageType($new_file);
// Go
$this->DB->insert('gallery_images', $imageArray);
$inserted_id = $this->DB->getInsertId();
// Permissions
$prefix = ipsRegistry::dbFunctions()->getPrefix();
$this->DB->query("UPDATE {$prefix}gallery_images i, {$prefix}permission_index p SET i.image_parent_permission=p.perm_view WHERE p.app='gallery' AND p.perm_type='categories' AND p.perm_type_id=i.image_category_id");
//-----------------------------------------
// Add link
//-----------------------------------------
$this->addLink($inserted_id, $id, 'gallery_images');
return true;
}
示例12: updateThree
public static function updateThree($gender)
{
$DB = ipsRegistry::DB();
$PRE = ipsRegistry::dbFunctions()->getPrefix();
return "UPDATE {$PRE}profile_portal pp, {$PRE}pfields_content pfc SET pfc.field_{$gender['pf_id']}='m' WHERE pp.pp_gender='male' AND pp.pp_member_id=pfc.member_id";
}
示例13: doExecute
/**
* Class entry point
*
* @param object Registry reference
* @return @e void [Outputs to screen]
*/
public function doExecute(ipsRegistry $registry)
{
//-----------------------------------------
// Get supported applications
//-----------------------------------------
$supportedApps = array();
foreach (IPSLib::getEnabledApplications() as $app) {
$file = IPSLib::getAppDir($app['app_directory']) . '/extensions/reputation.php';
if (is_file($file)) {
require_once $file;
/*maybeLibHook*/
if (class_exists('reputation_' . $app['app_directory'])) {
$supportedApps[$app['app_directory']] = $app;
}
}
}
//-----------------------------------------
// Get results
//-----------------------------------------
/* What is it we're getting? */
$app = (is_string($this->request['app_tab']) && !empty($this->request['app_tab']) and isset($supportedApps[$this->request['app_tab']])) ? $this->request['app_tab'] : 'forums';
/* Load our extension class */
$classToLoad = IPSLib::loadLibrary(IPSLib::getAppDir($app) . '/extensions/reputation.php', 'reputation_' . $app, $app);
$reputationClass = new $classToLoad();
/* Get our query */
$_query = $reputationClass->fetch('most');
$PRE = trim(ipsRegistry::dbFunctions()->getPrefix());
/* Got something? */
if ($_query['inner']) {
/* Build inner join */
$this->DB->build($_query['inner']);
$inner = $this->DB->fetchSqlString();
$this->DB->flushQuery();
$this->DB->allow_sub_select = 1;
$this->DB->query('SELECT * FROM ' . $PRE . "reputation_totals WHERE rt_app_type=MD5( CONCAT( '" . $app . "', ';', '" . $_query['type'] . "' ) ) AND rt_type_id IN (" . $inner . ") AND rt_total > 0 GROUP BY rt_key ORDER BY rt_total DESC LIMIT 0," . self::NUMBER_TO_SHOW);
$this->DB->execute();
$typeIds = array();
$results = array();
$index = array();
while ($row = $this->DB->fetch()) {
$typeIds[$row['rt_total'] . '.' . $row['rt_type_id']] = $row['rt_type_id'];
$index[$row['rt_type_id']] = $row['rt_total'] . '.' . $row['rt_type_id'];
}
if (count($typeIds)) {
$this->DB->build(array('select' => 'r.*', 'from' => array('reputation_index' => 'r'), 'where' => "r.app='" . $app . "' AND r.type='" . $_query['type'] . "' AND r.type_id IN (" . implode(',', array_values($typeIds)) . ")", 'group' => 'r.app, r.type, r.type_id', 'add_join' => $_query['joins']));
$e = $this->DB->execute();
while ($row = $this->DB->fetch($e)) {
$results[$index[$row['type_id']]] = $reputationClass->process($row);
}
krsort($results);
}
}
//-----------------------------------------
// Output
//-----------------------------------------
/* Process Results */
$processedResults = count($results) ? $reputationClass->display($results) : '';
$this->lang->loadLanguageFile(array('public_profile'), 'members');
/* Setup page */
$langBit = ipsRegistry::$settings['reputation_point_types'] == 'like' ? 'most_rep_likes' : 'most_rep_rep';
$this->registry->output->setTitle($this->lang->words[$langBit] . ' - ' . IPSLib::getAppTitle($app));
$this->registry->output->addNavigation($this->lang->words[$langBit], NULL);
/* Display processed results */
$this->registry->output->addContent($this->registry->getClass('output')->getTemplate('profile')->reputationPage($langBit, $app, $supportedApps, $processedResults));
$this->registry->output->sendOutput();
}