本文整理汇总了PHP中add_image函数的典型用法代码示例。如果您正苦于以下问题:PHP add_image函数的具体用法?PHP add_image怎么用?PHP add_image使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了add_image函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: add_dir
function add_dir($base, $subdir = "")
{
global $page;
if (!is_dir($base)) {
print "Error: {$base} is not a directory\n";
return;
}
print "Adding {$subdir}\n";
$dir = opendir("{$base}/{$subdir}");
while ($filename = readdir($dir)) {
$fullpath = "{$base}/{$subdir}/{$filename}";
if (is_link($fullpath)) {
// ignore
} else {
if (is_dir($fullpath)) {
if ($filename[0] != ".") {
add_dir($base, "{$subdir}/{$filename}");
}
} else {
$tmpfile = $fullpath;
$tags = $subdir;
$tags = str_replace("/", " ", $tags);
$tags = str_replace("__", " ", $tags);
print "{$subdir}/{$filename} (" . str_replace(" ", ",", $tags) . ")... ";
$error = add_image($tmpfile, $filename, $tags);
if (is_null($error)) {
print "ok\n";
} else {
print "failed: {$error}\n";
}
}
}
}
closedir($dir);
}
示例2: setUp
function setUp()
{
parent::setUp();
require_code('galleries');
require_code('galleries2');
$this->glry_id = add_image('', '', '', 'http://www.msn.com', 'images/test.jpg', 0, 0, 0, 0, '', NULL, NULL, NULL, 0, NULL);
$this->assertTrue('http://www.msn.com' == $GLOBALS['SITE_DB']->query_value('images', 'url', array('id' => $this->glry_id)));
}
示例3: filter_input
include 'product_add.php';
break;
case 'ADD PRODUCT':
$category_id = filter_input(INPUT_POST, 'category_id', FILTER_SANITIZE_NUMBER_INT);
$category_id = filter_var($category_id, FILTER_VALIDATE_INT);
$product_name = filter_input(INPUT_POST, 'name', FILTER_SANITIZE_STRING);
$product_price = filter_input(INPUT_POST, 'price', FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
$product_price = filter_var($product_price, FILTER_VALIDATE_FLOAT);
$product_description = filter_input(INPUT_POST, 'description', FILTER_SANITIZE_STRING);
if ($category_id == NULL || $category_id == FALSE || $product_name == NULL || $product_price == NULL || $product_price == FALSE) {
$message = "Invalid product data. Check all fields and try again.";
$categories = get_categories();
include 'product_add.php';
} else {
$product_id = add_product($product_name, $product_price, $product_description, $category_id);
add_image($product_id);
header("Location: .?action=grid_products");
}
break;
case 'edit_product_form':
$categories = get_categories();
$product_id = filter_input(INPUT_GET, 'product_id', FILTER_SANITIZE_NUMBER_INT);
$product_id = filter_var($product_id, FILTER_VALIDATE_INT);
$product = get_product($product_id);
include 'product_edit.php';
break;
case 'UPDATE':
$product_id = filter_input(INPUT_POST, 'product_id', FILTER_SANITIZE_NUMBER_INT);
$product_id = filter_var($product_id, FILTER_VALIDATE_INT);
$category_id = filter_input(INPUT_POST, 'category_id', FILTER_SANITIZE_NUMBER_INT);
$category_id = filter_var($category_id, FILTER_VALIDATE_INT);
示例4: isset
$cmd = isset($_POST["cmd"]) ? $_POST["cmd"] : "";
if (DEBUG) {
$fd = fopen("debug.txt", "a");
fwrite($fd, print_r($_POST, true));
fwrite($fd, print_r($_FILES, true));
fwrite($fd, print_r($debug_msgs, true));
fclose($fd);
}
$response = new response();
switch ($cmd) {
case "login":
login($_POST["uname"], $_POST["password"]);
break;
case "fetch-albums":
list_albums();
break;
case "fetch-album-images":
list_images($_POST["set_albumName"]);
break;
case "add-item":
add_image($_POST["set_albumName"], $_FILES["userfile"]["name"], $_POST["caption"]);
break;
case "new-album":
// there is a title field as well, but since plogger doesn't use it, we drop it
gr_add_album($_POST["set_albumName"], $_POST["newAlbumTitle"], $_POST["newAlbumDesc"]);
break;
default:
$response->set_key("status", GR_STAT_UNKNOWN_CMD);
$response->set_key("status_text", "Unknown command.");
}
$response->write();
示例5: is_csrf_proper
$proper = is_csrf_proper(from($_REQUEST, 'csrf_token'));
$title = from($_REQUEST, 'title');
$image = from($_REQUEST, 'image');
$tag = from($_REQUEST, 'tag');
$url = from($_REQUEST, 'url');
$content = from($_REQUEST, 'content');
$description = from($_REQUEST, 'description');
$user = $_SESSION[config("site.url")]['user'];
$draft = from($_REQUEST, 'draft');
$category = from($_REQUEST, 'category');
if ($proper && !empty($title) && !empty($tag) && !empty($content) && !empty($image)) {
if (!empty($url)) {
add_image($title, $tag, $url, $content, $user, $description, $image, $draft, $category);
} else {
$url = $title;
add_image($title, $tag, $url, $content, $user, $description, $image, $draft, $category);
}
} else {
$message['error'] = '';
if (empty($title)) {
$message['error'] .= '<li>Title field is required.</li>';
}
if (empty($tag)) {
$message['error'] .= '<li>Tag field is required.</li>';
}
if (empty($content)) {
$message['error'] .= '<li>Content field is required.</li>';
}
if (empty($image)) {
$message['error'] .= '<li>Image field is required.</li>';
}
示例6: make_header
$relation_data = 0;
break;
}
if (!file_exists("usecode/{$data}.dat")) {
make_header("Error: File Not Found");
$tpl->assign("TEXT", "File \"usecode/{$data}.dat\" was not found on the server.<br>Please avoid using direct links to this website unless from a bookmarked page.");
$tpl->parse("CONTENT", ".any");
} else {
$ucc = add_tip("UCC", "Usecode C");
$bgimg = add_image("bgsm.png", "[BG]", false);
$siimg = add_image("sism.png", "[SI]", false);
$exultimg = add_image("exultsm.png", "[Exult]", false);
$exultbgimg = add_image("exultbgsm.png", "[Exult: BG]", false);
$exultsiimg = add_image("exultsism.png", "[Exult: SI]", false);
$bgexultimg = add_image("bgexultsm.png", "[BG, Exult]", false);
$siexultimg = add_image("siexultsm.png", "[SI, Exult]", false);
$true = inline_code("true");
$false = inline_code("false");
$exult = add_link("Exult", "http://exult.sourceforge.net/");
make_header($head);
if ($TYPE == 5) {
include "usecode/{$proto}.dat";
}
include "usecode/{$data}.dat";
if (isset($relation_data) && is_array($relation_data) && count($relation_data) > 0) {
$list = array();
foreach ($relation_data as $reldata) {
if (array_key_exists($DATAFILE, $reldata)) {
$list = $reldata[$DATAFILE];
break;
}
示例7: save_section
save_section($connection);
break;
case 8:
save_youtube($connection);
break;
case 9:
save_image($connection);
break;
case 10:
add_section($connection);
break;
case 11:
add_youtube($connection);
break;
case 12:
add_image($connection);
break;
default:
print '[["ERROR"]["Save had an invalid ID"]]';
}
}
/* Navigation items */
// Add items
function add_section_item($id, $is_sub, $content, $connection)
{
$nav_type = $is_sub ? "SUB_NAV_ITEM" : "NAV_ITEM";
$insert_or_update_nits_stmt = insert_or_update_nits_stmt($connection);
$insert_or_update_nits_stmt->bind_param("siss", $nav_type, $id, $content, $content);
catch_execution_error($insert_or_update_nits_stmt->execute(), $connection);
}
function add_link_item($id, $is_sub, $content, $connection)
示例8: site_url
</table>
</div>
<div id="gc_product_photos">
<div class="gc_segment_content">
<iframe src="<?php
echo site_url($this->config->item('admin_folder') . '/products/product_image_form');
?>
" style="height:120px; border:0px;">
</iframe>
<div id="gc_photos">
<span class="error" style="color: red; display: none"></span>
<?php
foreach ($images as $photo_id => $photo_obj) {
if (!empty($photo_obj)) {
$photo = (array) $photo_obj;
add_image($photo_id, $photo['filename'], $photo['alt'], $photo['caption'], isset($photo['primary']));
}
}
?>
</div>
</div>
</div>
</div>
</form>
<?php
function add_image($photo_id, $filename, $alt, $caption, $primary = false)
{
ob_start();
?>
示例9: RenderName
function RenderName($name, $x, $y)
{
global $character_id;
global $im;
global $font;
global $font_size;
global $__database;
global $guild_info_location;
$background = imagecolorallocatealpha($im, 0, 0, 0, 33);
$fontcolor = imagecolorallocate($im, 255, 255, 255);
$startWidth = $x - calculateWidth($name) / 2;
$endWidth = $x + calculateWidth($name) / 2;
DrawNameBox($im, $startWidth, $y - 17, $endWidth - 1, $y - 2, $background);
ImageTTFText($im, $font_size, 0, $startWidth + 3, $y - 5, $fontcolor, $font, $name);
$q = $__database->query("SELECT g.name, g.emblem_bg, g.emblem_bg_color, g.emblem_fg, g.emblem_fg_color FROM guild_members c INNER JOIN guilds g ON g.id = c.guild_id WHERE c.character_id = " . $character_id);
if ($q->num_rows == 1) {
$res = $q->fetch_array();
$name = $res[0];
$hasemblem = $res[1] != 0 || $res[2] != 0 || $res[3] != 0 || $res[4] != 0 ? true : false;
$startWidth = $x - calculateWidth($name) / 2;
$endWidth = $x + calculateWidth($name) / 2;
DrawNameBox($im, $startWidth, $y, $endWidth - 1, $y + 15, $background);
ImageTTFText($im, $font_size, 0, $startWidth + 2, $y + 12, $fontcolor, $font, $name);
ImageTTFText($im, $font_size, 0, $startWidth + 3, $y + 12, $fontcolor, $font, $name);
// Boldness
if ($hasemblem) {
if ($res[1] != 0 || $res[2] != 0) {
add_image($guild_info_location . '/BackGround/0000' . $res[1] . '/' . $res[2] . '.png', $startWidth - 18, $y + 1);
}
if ($res[3] != 0 || $res[4] != 0) {
$name = "";
$sort = floor($res[3] / 1000);
if ($sort == 2) {
$name = "Animal";
} elseif ($sort == 3) {
$name = "Plant";
} elseif ($sort == 4) {
$name = "Pattern";
} elseif ($sort == 5) {
$name = "Letter";
} elseif ($sort == 9) {
$name = "Etc";
}
add_image($guild_info_location . '/Mark/' . $name . '/0000' . $res[3] . '/' . $res[4] . '.png', $startWidth - 17, $y + 2);
}
}
}
}
示例10: saveProfile
/**
* save profile
*
* @return int
*/
function saveProfile()
{
global $app;
$user =& JFactory::getUser();
$logUser = new CofiUser($user->id);
$this->_headline = JText::_('COFI_PROFILE_SAVED');
// redirect link
$redirectLink = JRoute::_("index.php?option=com_discussions&view=profile");
// check if user is logged in - maybe session has timed out
if ($user->guest) {
// if user is not logged in, kick him back to index page
$app->redirect($redirectLink, JText::_('COFI_PROFILE_NOT_SAVED'), "message");
}
$db =& $this->getDBO();
// delete Avatar
if ($this->_delete_avatar == 1) {
del_image($this->_userid, "avatar", JPATH_BASE, $db);
}
// avatar upload
if (isset($_FILES['avatar']) and !$_FILES['avatar']['error']) {
add_image($this->_userid, "avatar", JPATH_BASE, $db);
}
$sql = "UPDATE " . $db->nameQuote('#__discussions_users') . " SET" . " signature = " . $db->Quote($this->_signature) . ", zipcode = " . $db->Quote($this->_zipcode) . ", city = " . $db->Quote($this->_city) . ", country = " . $db->Quote($this->_country) . ", website = " . $db->Quote($this->_website) . ", twitter = " . $db->Quote($this->_twitter) . ", facebook = " . $db->Quote($this->_facebook) . ", flickr = " . $db->Quote($this->_flickr) . ", youtube = " . $db->Quote($this->_youtube) . ", show_online_status = " . $db->Quote($this->_show_online_status) . " WHERE id = '" . $user->id . "'";
$db->setQuery($sql);
$db->query();
$app->redirect($redirectLink, JText::_('COFI_PROFILE_HAS_BEEN_SAVED'), "notice");
return 0;
// save OK
}
示例11: import_downloads_and_categories
/**
* Standard import function.
*
* @param object The DB connection to import from
* @param string The table prefix the target prefix is using
* @param PATH The base directory we are importing from
* @return tempcode Import message
*/
function import_downloads_and_categories($db, $table_prefix, $old_base_dir)
{
require_code('downloads2');
require_code('downloads');
$category_id_remap = array();
$rows = $db->query('SELECT * FROM ' . $table_prefix . 'downloads_categories ORDER BY cid');
$category_id_remap[0] = db_get_first_id();
$orig_parents = array();
foreach ($rows as $row) {
$orig_parents[$row['cid']] = array($row['parentid'], $row['title'], $row['cdescription']);
$id = add_download_category('', 0, '', '', '');
$category_id_remap[$row['cid']] = $id;
$groups = $GLOBALS['FORUM_DRIVER']->get_usergroup_list(false, true);
foreach (array_keys($groups) as $group_id) {
$GLOBALS['SITE_DB']->query_insert('group_category_access', array('module_the_name' => 'downloads', 'category_name' => strval($id), 'group_id' => $group_id));
}
}
foreach ($orig_parents as $cid => $bits) {
list($orig_parent, $category, $description) = $bits;
if ($orig_parent == 0) {
$parent_id = db_get_first_id();
} else {
$parent_id = $category_id_remap[$orig_parent];
}
edit_download_category($category, $parent_id, $description, $category_id_remap[$cid], '', '', '', '');
}
$rows = $db->query('SELECT * FROM ' . $table_prefix . 'downloads_downloads');
foreach ($rows as $i => $row) {
$rows[$i]['validated'] = 1;
$rows[$i]['date'] = $this->mysql_time_to_timestamp($row['date']);
}
$rows2 = $db->query('SELECT * FROM ' . $table_prefix . 'downloads_newdownload');
foreach ($rows2 as $i => $row) {
$rows2[$i]['validated'] = 0;
$rows2[$i]['totalvotes'] = 0;
$rows2[$i]['hits'] = 0;
$rows2[$i]['date'] = time();
$rows2[$i]['screenshot'] = '';
}
$rows = array_merge($rows, $rows2);
foreach ($rows as $row) {
$url_parts = explode('/', $row['url']);
$original_filename = rawurldecode($url_parts[count($url_parts) - 1]);
$url = $row['url'];
if (url_is_local($url)) {
$url = get_custom_base_url() . '/' . $url;
}
$comments = '';
$comments_rows = $db->query('SELECT editorialtext FROM ' . $table_prefix . 'downloads_editorials WHERE downloadid=' . $row['lid']);
if (array_key_exists(0, $comments_rows)) {
$comments = $comments_rows[0]['editorialtext'];
}
$member = $GLOBALS['FORUM_DRIVER']->get_member_from_username($row['submitter']);
if (is_null($member)) {
$member = get_member();
}
$new_id = add_download($category_id_remap[$row['cid']], $row['title'], $url, html_to_comcode($row['description']), $row['name'], html_to_comcode($comments), NULL, $row['validated'], 1, 1, 1, '', $original_filename, $row['filesize'], 0, 0, NULL, $row['date'], $row['hits'], $row['hits'], $member);
if ($row['totalvotes'] != 0) {
$real_rating = $row['downloadratingsummary'];
// Same scale as ocPortal :)
$GLOBALS['SITE_DB']->query_insert('rating', array('rating_for_type' => 'downloads', 'rating_for_id' => strval($new_id), 'rating_member' => get_member(), 'rating_ip' => '127.0.0.1', 'rating_time' => time(), 'rating' => $real_rating));
}
// Homepage->Into author
$test = $GLOBALS['SITE_DB']->query_value_null_ok('authors', 'url', array('author' => $row['name']));
if (is_null($test)) {
require_code('authors');
add_author($row['name'], $row['homepage'], NULL, '', '');
} else {
$GLOBALS['SITE_DB']->query_update('authors', array('url' => $row['homepage']), array('author' => $row['name']));
}
// Image
if ($row['screenshot'] != '' && addon_installed('galleries')) {
$image_url = $row['screenshot'];
if (url_is_local($image_url)) {
$image_url = get_custom_base_url() . '/' . $image_url;
}
$thumb_url = '';
add_image('', 'download_' . strval($new_id), '', $image_url, $thumb_url, $row['validated'], 1, 1, 1, '');
}
}
$out = do_template('IMPORT_MESSAGE', array('_GUID' => 'ff9131c37b9e4fa2cff991e3479ae867', 'MESSAGE' => do_lang_tempcode('IMPORT_REBUILD_CACHE', do_lang('IMAGE_THUMBNAILS'))));
return $out;
}
示例12: do_work
//.........这里部分代码省略.........
ocf_make_post($topic_id, random_line(), random_text(), 0, true, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, false, false);
}
// forum posts in a topic
require_code('ocf_topics_action');
require_code('ocf_posts_action');
$topic_id = ocf_make_topic(db_get_first_id() + 1, '', '', NULL, 1, 0, 0, 0, NULL, NULL, false);
for ($i = intval(floatval($GLOBALS['FORUM_DB']->query_value('f_posts', 'COUNT(*)')) / 3.0); $i < $num_wanted; $i++) {
ocf_make_post($topic_id, random_line(), random_text(), 0, true, 0, 0, NULL, NULL, NULL, mt_rand(db_get_first_id(), $num_wanted - 1), NULL, NULL, NULL, false, false);
}
echo 'done forum stuff' . chr(10);
if (function_exists('gc_collect_cycles')) {
gc_enable();
}
// clubs
require_code('ocf_groups_action');
require_code('ocf_groups');
for ($i = $GLOBALS['FORUM_DB']->query_value('f_groups', 'COUNT(*)'); $i < $num_wanted; $i++) {
ocf_make_group(random_line(), 0, 0, 0, random_line(), '', NULL, NULL, NULL, 5, 0, 70, 50, 100, 100, 30000, 700, 25, 1, 0, 0, 0, $i, 1, 0, 1);
}
echo 'done club stuff' . chr(10);
if (function_exists('gc_collect_cycles')) {
gc_enable();
}
// galleries under a subcategory
require_code('galleries2');
$xsubcat_id = uniqid('', true);
add_gallery($xsubcat_id, random_line(), random_text(), '', '', 'root');
for ($i = $GLOBALS['SITE_DB']->query_value('galleries', 'COUNT(*)'); $i < $num_wanted; $i++) {
add_gallery(uniqid('', true), random_line(), random_text(), '', '', $xsubcat_id);
}
// images
require_code('galleries2');
for ($i = $GLOBALS['SITE_DB']->query_value('images', 'COUNT(*)'); $i < $num_wanted; $i++) {
add_image('', 'root', random_text(), get_logo_url(), get_logo_url(), 1, 1, 1, 1, '');
}
// videos / validation queue
require_code('galleries2');
for ($i = $GLOBALS['SITE_DB']->query_value('videos', 'COUNT(*)'); $i < $num_wanted; $i++) {
add_video('', 'root', random_text(), get_logo_url(), get_logo_url(), 0, 1, 1, 1, '', 0, 0, 0);
}
echo 'done galleries stuff' . chr(10);
if (function_exists('gc_collect_cycles')) {
gc_enable();
}
// newsletter subscribers
require_code('newsletter');
for ($i = $GLOBALS['SITE_DB']->query_value('newsletter', 'COUNT(*)'); $i < $num_wanted; $i++) {
basic_newsletter_join(uniqid('', true) . '@example.com');
}
echo 'done newsletter stuff' . chr(10);
if (function_exists('gc_collect_cycles')) {
gc_enable();
}
// polls (remember to test poll archive)
require_code('polls');
for ($i = $GLOBALS['SITE_DB']->query_value('poll', 'COUNT(*)'); $i < $num_wanted; $i++) {
$poll_id = add_poll(random_line(), random_line(), random_line(), random_line(), random_line(), random_line(), random_line(), random_line(), random_line(), random_line(), random_line(), 10, 0, 0, 0, 0, '');
}
// votes on a poll
$poll_id = db_get_first_id();
for ($j = $GLOBALS['SITE_DB']->query_value('poll_votes', 'COUNT(*)'); $j < $num_wanted; $j++) {
$cast = mt_rand(1, 6);
$ip = uniqid('', true);
$GLOBALS['SITE_DB']->query_insert('poll_votes', array('v_poll_id' => $poll_id, 'v_voter_id' => 2, 'v_voter_ip' => $ip, 'v_vote_for' => $cast));
}
echo 'done polls stuff' . chr(10);
示例13: isset
if ($_REQUEST['config'] == 3) {
/* IMAGES ACTIONS */
if (isset($_REQUEST['save'])) {
$file = isset($_FILES['image']) && $_FILES['image']['name'] != '' ? $_FILES['image'] : NULL;
if (isset($_REQUEST['imageid'])) {
/* UPDATE */
$result = update_image($_REQUEST['imageid'], $_REQUEST['name'], $_REQUEST['imagetype'], $file);
$msg_ok = S_IMAGE_UPDATED;
$msg_fail = S_CANNOT_UPDATE_IMAGE;
$audit_action = 'Image [' . $_REQUEST['name'] . '] updated';
} else {
/* ADD */
if (!count(get_accessible_nodes_by_user($USER_DETAILS, PERM_READ_WRITE, PERM_RES_IDS_ARRAY))) {
access_deny();
}
$result = add_image($_REQUEST['name'], $_REQUEST['imagetype'], $file);
$msg_ok = S_IMAGE_ADDED;
$msg_fail = S_CANNOT_ADD_IMAGE;
$audit_action = 'Image [' . $_REQUEST['name'] . '] added';
}
show_messages($result, $msg_ok, $msg_fail);
if ($result) {
add_audit(AUDIT_ACTION_UPDATE, AUDIT_RESOURCE_IMAGE, $audit_action);
unset($_REQUEST['form']);
}
} else {
if (isset($_REQUEST['delete']) && isset($_REQUEST['imageid'])) {
/* DELETE */
$image = get_image_by_imageid($_REQUEST['imageid']);
$result = delete_image($_REQUEST['imageid']);
show_messages($result, S_IMAGE_DELETED, S_CANNOT_DELETE_IMAGE);
示例14: add_actualisation
/**
* Standard aed_module add actualiser.
*
* @return ID_TEXT The ID of the entry added
*/
function add_actualisation()
{
$cat = post_param('cat');
if (can_submit_to_gallery($cat) === false) {
access_denied('SUBMIT_HERE');
}
make_member_gallery_if_needed($cat);
$this->check_images_allowed($cat);
$title = post_param('title');
$validated = post_param_integer('validated', 0);
$allow_rating = post_param_integer('allow_rating', 0);
$allow_comments = post_param_integer('allow_comments', 0);
$notes = post_param('notes', '');
$allow_trackbacks = post_param_integer('allow_trackbacks', 0);
$this->handle_resizing_and_watermarking();
$urls = get_url('url', 'file', 'uploads/galleries' . (get_value('use_gallery_subdirs') == '1' ? '/' . $cat : ''), 0, OCP_UPLOAD_IMAGE, true, 'thumb_url', 'file2');
if ($urls[0] == '' || $urls[1] == '') {
warn_exit(do_lang_tempcode('IMPROPERLY_FILLED_IN_UPLOAD'));
}
if (substr($urls[0], 0, 8) != 'uploads/' && is_null(http_download_file($urls[0], 0, false)) && !is_null($GLOBALS['HTTP_MESSAGE_B'])) {
attach_message($GLOBALS['HTTP_MESSAGE_B'], 'warn');
}
$comments = post_param('comments');
$this->donext_type = $cat;
$id = add_image($title, $cat, $comments, $urls[0], $urls[1], $validated, $allow_rating, $allow_comments, $allow_trackbacks, $notes);
if ($validated == 1 || !addon_installed('unvalidated')) {
if (has_actual_page_access($GLOBALS['FORUM_DRIVER']->get_guest_id(), 'galleries') && has_category_access($GLOBALS['FORUM_DRIVER']->get_guest_id(), 'galleries', $cat)) {
syndicate_described_activity('galleries:ACTIVITY_ADD_IMAGE', $title == '' ? $urls[2] : $title, '', '', '_SEARCH:galleries:image:' . strval($id), '', '', 'galleries');
}
}
if (has_edit_permission('cat_mid', get_member(), get_member_id_from_gallery_name($cat), 'cms_galleries', array('galleries', $cat)) && post_param_integer('rep_image', 0) == 1) {
$GLOBALS['SITE_DB']->query_update('galleries', array('rep_image' => $urls[1]), array('name' => $cat), '', 1);
}
return strval($id);
}
示例15: get_custom_file_base
$from = get_custom_file_base() . '/exports/mods/' . $file;
$new_file = basename($file, '.tar') . $version_for_name . '.tar';
$to = get_custom_file_base() . "/uploads/downloads/" . $new_file;
@unlink($to);
copy($from, $to);
$addon_path = 'uploads/downloads/' . $new_file;
$fsize = filesize($addon_path);
$test = $GLOBALS['SITE_DB']->query_value_null_ok('download_downloads', 'url', array('url' => $addon_path));
if (is_null($test)) {
require_code('tar');
$tar = tar_open($from, 'rb');
$info_file = tar_get_file($tar, 'mod.inf', true);
$info = better_parse_ini_file(NULL, $info_file['data']);
tar_close($tar);
$name = $info['name'];
$description = str_replace('\\n', "\n", $info['description']);
$author = $info['author'];
$url = "data_custom/addon_screenshots/" . preg_replace('#^theme-#', 'theme__', preg_replace('#\\d+$#', '', basename($file, '.tar'))) . ".png";
if (!file_exists(get_custom_file_base() . '/' . $url)) {
$url = "data_custom/addon_screenshots/" . strtolower(preg_replace('#^theme-#', 'theme__', preg_replace('#\\d+$#', '', basename($file, '.tar')))) . ".png";
}
$downid = add_download($cid, $name, $addon_path, $description, $author, '', NULL, 1, 1, 2, 1, '', $new_file, $fsize, 0, 0, NULL, NULL, 0, 0, $admin);
if (file_exists(get_custom_file_base() . '/' . $url)) {
add_image('', 'download_' . strval($downid), '', str_replace(' ', '%20', $url), '', 1, 0, 0, 0, '', NULL, NULL, NULL, 0);
}
}
}
}
closedir($dh);
echo "All themes have been imported as downloads";
}