本文整理汇总了PHP中uploader::getFiles方法的典型用法代码示例。如果您正苦于以下问题:PHP uploader::getFiles方法的具体用法?PHP uploader::getFiles怎么用?PHP uploader::getFiles使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类uploader
的用法示例。
在下文中一共展示了uploader::getFiles方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: foreach
foreach ($attachedfiles_tmpdraft_files as $attachedfiles_draft_file) {
$attachedfiles_draft_files[] = $attachedfiles_draft_file;
}
$uploader->setFiles($attachedfiles_draft_files, uploader::STATUS_ADDED);
}
} else {
$attachedfiles_tmpprj_files = $tmpPrj->getAttach();
if ($attachedfiles_tmpprj_files) {
$attachedfiles_prj_files = array();
foreach ($attachedfiles_tmpprj_files as $attachedfiles_prj_file) {
$attachedfiles_prj_files[] = $attachedfiles_prj_file['file_id'];
}
$set = $uploader->setFiles($attachedfiles_prj_files, $draft_id ? uploader::STATUS_ADDED : uploader::STATUS_CREATE);
}
}
$attachedfiles_files = $uploader->getFiles();
$content = "new/tpl.step_1.php";
break;
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
case 0:
default:
header_location_exit('/public/?step=1&kind=1');
break;
}
// Все изменения $tmpPrj->_project переносим в переменную.
$project = $tmpPrj->getProject();
if (trim($project['contacts']) != '') {
$contacts = unserialize($project['contacts']) ? unserialize($project['contacts']) : $contacts;
}
if ($project['country']) {
示例2: SaveProjectNew
/**
* Сохранение проекта в черновики (новый шаблон)
*
* @param array $prj Информация о проекте
* @return array ['id'] - ID черновика, ['date'] - дата сохранения черновика
*/
function SaveProjectNew($prj, $attachedfiles_files = false)
{
global $DB;
require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/attachedfiles.php";
$categories = "";
$check = array();
for ($i = 0; $i <= 2; $i++) {
$catID = __paramValue('int', $prj['project_profession' . $i . '_columns'][0]);
$subcatID = __paramValue('int', $prj['project_profession' . $i . '_spec_columns'][0]);
if ($catID || $subcatID) {
$categories .= $catID . '|' . $subcatID . ',';
}
}
$categories = preg_replace("/,\$/", "", $categories);
if ($prj['name'] === false) {
$prj['name'] = '';
}
if ($prj['descr'] === false) {
$prj['descr'] = '';
}
if (!$prj['end_date']) {
$prj['end_date'] = NULL;
}
if (!$prj['win_date']) {
$prj['win_date'] = NULL;
}
$prj['budget_type'] = intval($prj['budget_type']);
if (!intval($prj['draft_prj_id'])) {
$prj['prj_id'] = NULL;
} else {
$prj['prj_id'] = $prj['draft_prj_id'];
}
$prj['draft_id'] = intval($prj['draft_id']);
if (!isset($prj['kind'])) {
$prj['kind'] = 7;
}
$prj['cost'] = $prj['agreement'] ? 0 : floatval($prj['cost']);
$date = date("Y-m-d H:i:s");
$prj['strong_top'] = hasPermissions('projects') ? (int) $prj['strong_top'] : 0;
$prj['verify_only'] = (bool) $prj['verify_only'];
// платные опции
$prj['urgent'] = (bool) $prj['urgent'];
$prj['hide'] = (bool) $prj['hide'];
$topDays = $prj['top_ok'] ? $prj['top_days'] : 0;
if ($prj['logo_ok']) {
$logoAttach = new attachedfiles($prj['logo_attachedfiles_session']);
$logoFiles = $logoAttach->getFiles();
if (is_array($logoFiles) && count($logoFiles)) {
$logoFile = array_pop($logoFiles);
// файлов может быть несколько, берем последний
$logoAttach->setStatusTo3($logoFile['id']);
$logoFileID = $logoFile['id'];
} elseif ($prj['logo_file_id']) {
$logoFileID = $prj['logo_file_id'];
}
$logoLink = $prj['link'];
}
if (self::isDraftExists($prj['draft_id'], $prj['uid'], 1, $prj['prj_id'])) {
$sql = "UPDATE draft_projects SET \n name = ?u,\n descr = ?u,\n cost = ?,\n currency = ?i,\n kind = ?i,\n pro_only = ?,\n strong_top = ?i,\n end_date = ?,\n win_date = ?,\n country = ?i,\n city = ?i,\n categories = ?,\n date = ?,\n prj_id = ?,\n priceby = ?i,\n prefer_sbr = ?,\n budget_type = ?i,\n verify_only = ?,\n urgent = ?,\n hide = ?,\n top_days = ?i,\n logo_id = ?,\n logo_link = ?,\n contacts = ?\n WHERE (id=? OR prj_id=?)AND uid=?i";
$DB->query($sql, $prj['name'], $prj['descr'], $prj['cost'], $prj['currency_db_id'], $prj['kind'], $prj['pro_only'] == 1 ? 't' : 'f', $prj['strong_top'], $prj['end_date'], $prj['win_date'], (int) $prj['project_location_columns'][0], (int) $prj['project_location_columns'][1], $categories, $date, $prj['prj_id'], intval($prj['priceby_db_id']), $prj['prefer_sbr'] == 1 ? 't' : 'f', $prj['budget_type'], $prj['verify_only'], $prj['urgent'], $prj['hide'], $topDays, $logoFileID, $logoLink, $prj['contacts'], $prj['draft_id'], $prj['prj_id'], $prj['uid']);
$id = $prj['draft_id'];
} else {
$new_draft = true;
$sql = "INSERT INTO draft_projects (\n name,\n descr,\n cost,\n currency,\n kind,\n pro_only,\n end_date,\n win_date,\n country,\n city,\n categories,\n date,\n uid,\n prj_id,\n priceby,\n prefer_sbr,\n budget_type,\n strong_top,\n verify_only,\n urgent,\n hide, \n top_days,\n logo_id,\n logo_link,\n contacts\n ) VALUES (\n ?u,\n ?u,\n ?,\n ?i,\n ?i,\n ?,\n ?,\n ?,\n ?i,\n ?i,\n ?,\n ?,\n ?i,\n ?,\n ?i,\n ?,\n ?i,\n ?i,\n ?,\n ?,\n ?,\n ?i,\n ?,\n ?,\n ?\n ) RETURNING id;";
$id = $DB->val($sql, $prj['name'], $prj['descr'], $prj['cost'], $prj['currency_db_id'], $prj['kind'], $prj['pro_only'] == 1 ? 't' : 'f', $prj['end_date'], $prj['win_date'], (int) $prj['project_location_columns'][0], (int) $prj['project_location_columns'][1], $categories, $date, $prj['uid'], $prj['prj_id'], intval($prj['priceby_db_id']), $prj['prefer_sbr'] == 1 ? 't' : 'f', $prj['budget_type'], (int) $prj['strong_top'], $prj['verify_only'], $prj['urgent'], $prj['hide'], $topDays, $logoFileID, $logoLink, $prj['contacts']);
}
// - BEGIN атачи
if (!$attachedfiles_files) {
require_once $_SERVER['DOCUMENT_ROOT'] . "/classes//uploader/uploader.php";
$mask_files = array(1, 3);
$uploader = new uploader(current($prj['IDResource']));
$attachedfiles_files = $uploader->getFiles($mask_files);
}
$file_id = array();
// массив с ID файлов которые не надо удалять
$noDeletedFiles = array();
foreach ($attachedfiles_files as $attachedfiles_file) {
$noDeletedFiles[] = $attachedfiles_file['id'];
// старые файлы не трогаем
if ($attachedfiles_file['status'] == 3) {
continue;
}
if (in_array($f->id, $file_id)) {
continue;
}
// Чтобы не было дублей
$file_id[] = $f->id;
$f = new CFile($attachedfiles_file['id']);
$f->table = 'file';
$f->makeLink();
$sql = "INSERT INTO draft_attaches(draft_id, draft_type, file_id) VALUES(?i, 4, ?i)";
$DB->hold()->query($sql, $id, $f->id);
}
if ($DB->sqls) {
//.........这里部分代码省略.........
示例3: doActivation
public function doActivation($code)
{
$activation_data = $this->getActivation($code);
if (!$activation_data) {
return false;
}
$this->deleteActivation($code);
$current_uid = get_uid(false);
if ($current_uid) {
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/employer.php';
$user = new employer();
$user->GetUserByUID($current_uid);
$status = 1;
} else {
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/registration.php';
$registration = new registration();
$user_data = $registration->autoRegistationAndLogin(array('uid' => $activation_data['user_id'], 'role' => 1, 'email' => $activation_data['email'], 'uname' => $activation_data['uname'], 'usurname' => $activation_data['usurname']));
if (!$user_data || !$user_data['ret']) {
return self::REDIRECT_AUTH_FAIL;
}
$status = $user_data['ret'];
$user = $user_data['user'];
}
$uid = $user->uid;
$redirect = false;
$data = $activation_data['data'];
switch ($activation_data['type']) {
case GuestConst::TYPE_PERSONAL_ORDER:
$data['emp_id'] = $uid;
require_once $_SERVER['DOCUMENT_ROOT'] . '/tu/models/TServiceOrderModel.php';
$orderModel = TServiceOrderModel::model();
if ($order = $orderModel->createPersonal($data)) {
$tservices_smail = new tservices_smail();
$tservices_smail->newOrder($order);
$redirect = sprintf(tservices_helper::url('order_card_url'), $order['id']);
}
break;
case GuestConst::TYPE_VACANCY:
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/projects.php';
$data['state'] = projects::STATE_MOVED_TO_VACANCY;
$date_public = null;
$redirect_layout = '/public/?step=1&kind=4&public=%s&popup=1';
case GuestConst::TYPE_PROJECT:
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/projects.php';
$key = md5(uniqid($uid));
$tmpPrj = new tmp_project($key);
$tmpPrj->initForUser($user);
if (isset($data['IDResource']) && !empty($data['IDResource'])) {
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/uploader/uploader.php';
$uploader = new uploader($data['IDResource']);
$attachedfiles_files = $uploader->getFiles();
$tmpPrj->clearAttaches();
$tmpPrj->addAttachedFiles($attachedfiles_files, false);
$uploader->clear();
}
if ($prj = $tmpPrj->addSimpleProject($data)) {
$_SESSION['new_public'] = 1;
$redirect = getFriendlyURL('project', $prj);
if (isset($redirect_layout)) {
$redirect = sprintf($redirect_layout, $prj['id']);
}
$src_id = $prj['id'];
//Если проект был создан при переходе с лендинга
//то привязываем его для статистики
if (isset($data['landingProjectId'])) {
require_once ABS_PATH . '/classes/LandingProjects.php';
LandingProjects::model()->linkWithProject($data['landingProjectId'], $src_id, !$activation_data['user_id']);
}
}
break;
}
//Обновляем приглашение
if (isset($activation_data['invite_id']) && $activation_data['invite_id'] > 0) {
$guestInviteModel = new GuestInviteModel();
$guestInviteModel->updateDateComeInvite($activation_data['invite_id'], array('src_id' => isset($src_id) ? $src_id : null, 'date_public' => isset($date_public) ? $date_public : null));
}
//Мессага с паролями для новеньких
if (!$activation_data['user_id'] && !$current_uid) {
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/Helpers/SubBarNotificationHelper.php';
SubBarNotificationHelper::getInstance()->setMessage($activation_data['type'], array('login' => $user->login, 'password' => $user->passwd), $user->uid);
} elseif ($status == users::AUTH_STATUS_2FA) {
$_SESSION['ref_uri'] = $redirect;
$redirect = '/auth/second/';
}
return $redirect;
}