Exemple #1
0
 /**
  * Выводит икону и задданный внешний URL для определенного файла
  *
  * @param string  $ulogin   	Логин пользователя
  * @param string  $filename 	Имя файла 
  * @param string  $dir      	Папка файла
  * @param string  $url		 	Ссылка на файл
  * @param integer $bigtext  	Вместо иконкки будет большой текст расширения файла(TXT, PDF, etc...) если переменная принимает значение 1
  * @return string HTML-code
  */
 function viewattachExternal($ulogin, $filename, $dir, $url, $bigtext = 0)
 {
     $l_dir = substr($ulogin, 0, 2) . "/" . $ulogin;
     $cfile = new CFile("users/{$l_dir}/" . $dir . "/" . $filename);
     if (!$cfile->size) {
         return "";
     }
     $ext = $cfile->getext($filename);
     $ico = getICOFile($ext, true);
     echo $ico;
     $fsize = ConvertBtoMB($cfile->size);
     return '<p><img src="/pda/images/mime/' . $ico . '.png" alt="' . $ext . '" width="18" height="16"> <a href="' . $url . '" target="_blank">Скачать</a> | ' . ucfirst($ext) . ', ' . $fsize . ' </p>';
 }
Exemple #2
0
function JS_Obj($login, $files)
{
    $CFile = new CFile();
    $result = '';
    if (is_array($files)) {
        for ($i = 0; $i < count($files); $i++) {
            $CFile->GetInfo('users/' . substr($login, 0, 2) . '/' . $login . '/upload/' . $files[$i]['fname']);
            $result .= ',{name: "' . addslashes($CFile->fname) . '", path: "' . addslashes($CFile->path) . '", user: "******", size: ' . $CFile->size . ', mb_size: "' . ConvertBtoMB($CFile->size) . '", ';
            $result .= 'ftype: "' . addslashes($CFile->getext()) . '", id: ' . intval($files[$i]['id']) . ' }';
        }
    } elseif ($files) {
        $CFile->GetInfo('users/' . substr($login, 0, 2) . '/' . $login . '/upload/' . $files);
        $result .= ',{name: "' . addslashes($CFile->fname) . '", path: "' . addslashes($CFile->path) . '", user: "******", size: ' . $CFile->size . ', mb_size: "' . ConvertBtoMB($CFile->size) . '", ';
        $result .= 'ftype: "' . addslashes($CFile->getext()) . '", id: ' . intval($CFile->id) . ' }';
    }
    return $result ? '[' . substr($result, 1) . ']' : '[]';
}
Exemple #3
0
/**
 * Возвращает яваскрипт код для инициализации прикрепленных файлов
 * 
 * @param  array $tmp_files массив прикрепленных файлов
 * @param  int $max_files максимально возможное количество прикрепленных файлов
 * @param  int $max_file_size максимальный размер каждого из прикрепленных файлов
 * @param  string $kind тип записи (contacts, blog и т.д)
 * @param  string $tag_id id html тэга для инициализации прикрепленных файлов
 * @return string 
 */
function getAttachedFilesJs($tmp_files = array(), $max_files = 0, $max_file_size = 0, $kind = '', $tag_id = 'adm_edit_attachedfiles')
{
    require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/attachedfiles.php';
    $sAttach = 'attachedfiles_list = new Array();';
    $attachedfiles = new attachedfiles('', true);
    $attachedfiles_session = $attachedfiles->createSessionID();
    $attachedfiles->addNewSession($attachedfiles_session);
    if ($tmp_files) {
        $attachedfiles_files = array();
        foreach ($tmp_files as $attachedfiles_file) {
            if ($kind == 'contacts' || $kind == 'project') {
                $sId = $kind == 'contacts' ? 'id' : 'file_id';
                $attachedfiles_files[] = $attachedfiles_file[$sId];
            } else {
                $attachedfiles_files[] = $attachedfiles_file;
            }
        }
        $attachedfiles->setFiles($attachedfiles_files);
    }
    $files = $attachedfiles->getFiles();
    if ($files) {
        $n = 0;
        foreach ($files as $attachedfiles_file) {
            $sAttach .= "attachedfiles_list[{$n}] = new Object;\n";
            $sAttach .= "attachedfiles_list[{$n}].id = '" . md5($attachedfiles_file['id']) . "';\n";
            $sAttach .= "attachedfiles_list[{$n}].name = '{$attachedfiles_file['orig_name']}';\n";
            $sAttach .= "attachedfiles_list[{$n}].path = '" . WDCPREFIX . "/{$attachedfiles_file['path']}{$attachedfiles_file['name']}';\n";
            $sAttach .= "attachedfiles_list[{$n}].size = '" . ConvertBtoMB($attachedfiles_file['size']) . "';\n";
            $sAttach .= "attachedfiles_list[{$n}].type = '{$attachedfiles_file['type']}';\n";
            $n++;
        }
    }
    $sAttach .= "attachedFiles.init('adm_edit_attachedfiles', '{$attachedfiles_session}', attachedfiles_list, \n        '{$max_files}', '{$max_file_size}', '" . implode(', ', $GLOBALS['disallowed_array']) . "',\n        '{$kind}', " . get_uid(false) . "\n        );";
    return $sAttach;
}
<?php
if($attach=$projects->GetAllAttach($prj['id'])) {          
              foreach ($attach as $a) 
              {?>
               <? if ($a["virus"][3] != 1)  {?>
              		<div class="flw_offer_attach">
              			<div style="width:250px; float:left">
	              			<a href="<?=WDCPREFIX.'/'.$a['path'].$a['name']?>" target="_blank">Загрузить</a> 
	              			(<?=$a['ftype']?>; <?=ConvertBtoMB($a['size'])?> )
	              		</div>
	              			
              			<? 
              			switch ($a["virus"]) { 
							 case "":?> <span title="Антивирусом проверяются файлы, загруженные после 1 июня 2011 года" class="avs-nocheck">Файл не проверен антивирусом</span> <?
              				 break;
              				
              				 case "0000":?> <span title="Антивирусом проверяются файлы, загруженные после 1 июня 2011 года" class="avs-ok">Проверено антивирусом</span> <?
              				 break;
              				 
              				 case "0010":?> <span title="Антивирусом проверяются файлы, загруженные после 1 июня 2011 года" class="avs-errcheck">Невозможно проверить</span> <?
              				 break;              				 
              			}
              			?>
              		</div>
              	<? }?>
            <?}
 }
            ?>
</div><?php 
            $attach = $projects->GetAllAttach;
            for ($i = 0; $i < count($attach); $i++) {
                ?>
<div class="flw_offer_attach"><a href="/users/<?php 
                echo $dir;
                ?>
/upload/<?php 
                echo $attach[$i]['name'];
                ?>
" target="_blank">Загрузить</a> (<?php 
                echo $attach[$i]['ftype'];
                ?>
; <?php 
                echo ConvertBtoMB($attach[$i]['size']);
                ?>
 )</div><?php 
            }
            ?>
<br><div class="fl2_offer_meta">Прошло времени с момента публикации: <?php 
            echo ago_pub_x(strtotimeEx($prj['post_date']));
            ?>
<br />Автор: <a href="/users/<?php 
            echo $name["login"];
            ?>
"><?php 
            print $name["uname"] . " ";
            print $name["usurname"];
            ?>
 [<?php 
            ?>
                        <tr class="b-layout__tr">
                            <td class="b-layout__middle b-layout__middle_padbot_5">
                                <div class="b-layout__txt">
                                    <i class="b-icon b-icon_attach_<?php 
            echo $aData['class_ico'] === 'unknown' ? 'unknown' : $a['ftype'];
            ?>
"></i> 
                                    <a href="<?php 
            echo WDCPREFIX . '/' . $a['path'] . $a['name'];
            ?>
" class="b-layout__link" target="_blank"><?php 
            echo reformat($a['orig_name'], 30);
            ?>
</a>, <?php 
            echo ConvertBtoMB($a['size']);
            ?>
                                </div>
                            </td>
                            <td class="b-layout__right b-layout__right_padleft_20 b-layout__right_padbot_5">
                                <div class="b-layout__txt"><a href="<?php 
            echo WDCPREFIX . '/' . $a['path'] . $a['name'];
            ?>
" class="b-layout__link" target="_blank">Скачать</a></div>
                            </td>
                        </tr>
                        <?php 
        }
        //foreach
        ?>
                    </tbody>
function CreateCommentForm($backto, $top_id, $message_id, $commune_id, $om, $page = 0, $action = 'Create.post', $mod, $adv = 0, $draft_id = 0, $attachedfiles_session = '')
{
    global $session;
    session_start();
    commune::RestoreMarkedAttach($message_id);
    $objResponse = new xajaxResponse();
    if ($action == 'Create.post') {
        // Комментируем сообщение.
        $objResponse->assign($backto, 'style.position', 'static');
        $objResponse->assign($backto, 'innerHTML', __commPrntCommentForm($commune_id, $om, $page, $action, $top_id, NULL, $message_id, NULL, NULL, !$page ? 'Topic' : NULL, $mod));
    } else {
        // Выводим форму с атрибутами сообщения.
        $objResponse->assign($backto, 'style.position', 'static');
        $objResponse->assign($backto, 'innerHTML', __commPrntCommentForm($commune_id, $om, $page, $action, $top_id, $message_id, NULL, NULL, NULL, !$page ? 'Topic' : NULL, $mod, 0, $draft_id));
    }
    $objResponse->script(" var editMsg = document.getElementById('{$backto}');\n    if(__commLastOpenedForm!=editMsg) {\n      try { \n        if(!__commLastOpenedForm) {\n          var ___acf = document.getElementById('idAlertedCommentForm');\n          if(___acf && ___acf.parentNode)\n            __commLastOpenedForm = ___acf.parentNode;\n        }\n        __commLastOpenedForm.innerHTML = ''; __commLastOpenedForm.style.position='absolute'; \n      } catch(e) {}\n    }\n    __commLastOpenedForm  = editMsg;\n    __commLastOpenedForm.action = '{$action}';\n\t\n\tpoll.init('Commune', document.getElementById('" . $backto . "'), " . commune::POLL_ANSWERS_MAX . ", '" . $_SESSION['CommunePoll_Sess'] . "');\n\tif (document.getElementById('question')) maxChars('question', 'polls_error', " . commune::POLL_QUESTION_CHARS_MAX . ");\n\teditMsg.scrollIntoView(true);\n\t//new mAttach(document.getElementById('files_block'), " . (commune::MAX_FILES - $adv) . ");\n        //mA = new mAttach2(document.getElementById('files_block'), " . (commune::MAX_FILES - $adv) . ", {p:'btn-add', m:'btn-del', nv:true});\n  ");
    $js = "var attachedfiles_list = new Array();\n";
    require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/attachedfiles.php';
    $attachedfiles = new attachedfiles($attachedfiles_session);
    $attachedfiles_tmpcomm_files = commune::getAttachedFiles($message_id);
    if ($attachedfiles_tmpcomm_files) {
        $attachedfiles_comm_files = array();
        foreach ($attachedfiles_tmpcomm_files as $attachedfiles_comm_file) {
            $attachedfiles_comm_files[] = $attachedfiles_comm_file;
        }
        $attachedfiles->setFiles($attachedfiles_comm_files);
    }
    $attachedfiles_files = $attachedfiles->getFiles();
    if ($attachedfiles_files) {
        $n = 0;
        foreach ($attachedfiles_files as $attachedfiles_file) {
            $js .= "attachedfiles_list[{$n}] = new Object;\n";
            $js .= "attachedfiles_list[{$n}].id = '" . md5($attachedfiles_file['id']) . "';\n";
            $js .= "attachedfiles_list[{$n}].name = '{$attachedfiles_file['orig_name']}';\n";
            $js .= "attachedfiles_list[{$n}].path = '" . WDCPREFIX . "/{$attachedfiles_file['path']}{$attachedfiles_file['name']}';\n";
            $js .= "attachedfiles_list[{$n}].size = '" . ConvertBtoMB($attachedfiles_file['size']) . "';\n";
            $js .= "attachedfiles_list[{$n}].type = '{$attachedfiles_file['type']}';\n";
            ++$n;
        }
    }
    $js .= "attachedFiles.init('attachedfiles', \n                               '" . $attachedfiles->getSession() . "',\n                               attachedfiles_list, \n                               '" . commune::MAX_FILES . "',\n                               '" . commune::MAX_FILE_SIZE . "',\n                               '" . implode(', ', $GLOBALS['disallowed_array']) . "',\n                               'commune',\n                               '" . get_uid(false) . "'\n                            );";
    $objResponse->script($js);
    $objResponse->call('initWysiwyg');
    $objResponse->call('tawlTextareaInit');
    if ($action != 'Create.post') {
        $objResponse->script('DraftInit(4);');
    }
    return $objResponse;
}
                            <?php 
if ($action == 'create_project') {
    $attachedfiles = new attachedfiles($attachedfiles_session);
    $attachedfiles_files = $attachedfiles->getFiles();
} else {
    $attachedfiles = new attachedfiles();
    $attachedfiles_files = $attachedfiles->getFilesForWizard($existPrjID);
}
if ($attachedfiles_files) {
    $n = 0;
    foreach ($attachedfiles_files as $attachedfiles_file) {
        echo "attachedfiles_list[{$n}] = new Object;\n";
        echo "attachedfiles_list[{$n}].id = '" . md5($attachedfiles_file['id']) . "';\n";
        echo "attachedfiles_list[{$n}].name = '{$attachedfiles_file['orig_name']}';\n";
        echo "attachedfiles_list[{$n}].path = '" . WDCPREFIX . "/{$attachedfiles_file['path']}{$attachedfiles_file['name']}';\n";
        echo "attachedfiles_list[{$n}].size = '" . ConvertBtoMB($attachedfiles_file['size']) . "';\n";
        echo "attachedfiles_list[{$n}].type = '{$attachedfiles_file['type']}';\n";
        ++$n;
    }
}
?>
                            
                            attachedFiles.initComm('attachedfiles', 
                                               '<?php 
echo $attachedfiles->getSession();
?>
',
                                               attachedfiles_list, 
                                               '<?php 
echo wizard::MAX_FILE_COUNT;
?>
function quickprjedit_get_prj($prj_id)
{
    $objResponse = new xajaxResponse();
    if (hasPermissions('projects')) {
        require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/projects.php';
        require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/professions.php';
        require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/country.php';
        require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/city.php';
        $categories = professions::GetAllGroupsLite();
        $professions = professions::GetAllProfessions();
        array_group($professions, 'groupid');
        $professions[0] = array();
        $oprj = new new_projects();
        $project = $oprj->getPrj($prj_id);
        if ($project['id']) {
            $project_categories = $oprj->getSpecs($project['id']);
            if (empty($project_categories)) {
                $project_categories[] = array('category_id' => 0, 'subcategory_id' => 0);
            }
            $html_categories = '';
            foreach ($project_categories as $project_category) {
                $html_categories .= "<div id='category_line'>\n                                        <select name='categories[]' class='b-select__select b-select__select_width_180' onchange='popupQEditPrjRefreshSubCategory(this);'>\n                                            <option value='0'>Выберите раздел</option>\n                                     ";
                foreach ($categories as $cat) {
                    if ($cat['id'] <= 0) {
                        continue;
                    }
                    $html_categories .= "<option value='{$cat['id']}' " . ($project_category['category_id'] == $cat['id'] ? ' selected' : '') . ">{$cat['name']}</option>";
                }
                $html_categories .= "</select>\n                                        <select name='subcategories[]' class='b-select__select b-select__select_width_180'>\n                                    ";
                $categories_specs = $professions[$project_category['category_id']];
                for ($i = 0; $i < sizeof($categories_specs); ++$i) {
                    $html_categories .= "<option value='{$categories_specs[$i]['id']}'" . ($categories_specs[$i]['id'] == $project_category['subcategory_id'] ? ' selected' : '') . ">{$categories_specs[$i]['profname']}</option>";
                }
                $html_categories .= "      <option value='0' " . ($project_category['subcategory_id'] == 0 ? ' selected' : '') . '>Все специализации</option>
                                        </select>
                                     </div>
                                     ';
            }
            $countries = country::GetCountries();
            if ($project['country']) {
                $cities = city::GetCities($project['country']);
            }
            $html_location = '';
            $html_location .= "<div><select id='popup_qedit_prj_fld_country' name='country' onChange='popupQEditPrjCityUpd(this.value);'><option value='0'>Страна</option>";
            foreach ($countries as $country_id => $country) {
                $html_location .= "<option value='{$country_id}' " . ($country_id == $project['country'] ? 'selected' : '') . ">{$country}</option>";
            }
            $html_location .= '</select></div>';
            $html_location .= "<div id='frm_city'><select name='city'><option value='0'>Город</option>";
            if ($cities) {
                foreach ($cities as $city_id => $city) {
                    $html_location .= "<option value='{$city_id}' " . ($city_id == $project['city'] ? 'selected' : '') . ">{$city}</option>";
                }
            }
            $html_location .= '</select>';
            $objResponse->assign('popup_qedit_prj_fld_id', 'value', $project['id']);
            $objResponse->assign('popup_qedit_prj_fld_name', 'value', htmlspecialchars_decode($project['name'], ENT_QUOTES));
            $objResponse->assign('popup_qedit_prj_fld_descr', 'value', htmlspecialchars_decode($project['descr'], ENT_QUOTES));
            $objResponse->assign('popup_qedit_prj_fld_categories', 'innerHTML', $html_categories);
            $objResponse->assign('popup_qedit_prj_fld_location', 'innerHTML', $html_location);
            $objResponse->script('$("popup_qedit_prj_fld_kind_1").set("checked", false);');
            switch ($project['kind']) {
                case 1:
                    $objResponse->script('$("popup_qedit_prj_cal1").setStyle("display", "none");');
                    $objResponse->script('$("popup_qedit_prj_cal2").setStyle("display", "none");');
                    $objResponse->script('$("popup_qedit_prj_kind").setStyle("display", "block");');
                    $objResponse->script('$("popup_qedit_prj_fld_kind_1").set("checked", true);');
                    $objResponse->script('$("popup_qedit_prj_fld_location").setStyle("display", "none");');
                    break;
                case 2:
                    //$objResponse->script('$("sbr_text_block").setStyle("display", "none");');
                    break;
                case 4:
                    $objResponse->script('$("popup_qedit_prj_cal1").setStyle("display", "none");');
                    $objResponse->script('$("popup_qedit_prj_cal2").setStyle("display", "none");');
                    $objResponse->script('$("popup_qedit_prj_kind").setStyle("display", "block");');
                    $objResponse->script('$("popup_qedit_prj_fld_kind_2").set("checked", true);');
                    $objResponse->script('$("popup_qedit_prj_fld_location").setStyle("display", "block");');
                    break;
                case 7:
                    $objResponse->script('$("popup_qedit_prj_cal1").setStyle("display", "block");');
                    $objResponse->script('$("popup_qedit_prj_cal2").setStyle("display", "block");');
                    $objResponse->script('$("popup_qedit_prj_kind").setStyle("display", "none");');
                    $objResponse->script('$("popup_qedit_prj_fld_location").setStyle("display", "none");');
                    $objResponse->script('$("popup_qedit_prj_fld_end_date").set("value", "' . date('d-m-Y', strtotime($project['end_date'])) . '");');
                    $objResponse->script('$("popup_qedit_prj_fld_win_date").set("value", "' . date('d-m-Y', strtotime($project['win_date'])) . '");');
                    break;
            }
            if ($project['pro_only'] == 't') {
                $objResponse->script('$("popup_qedit_prj_fld_pro_only").set("checked", true);');
            } else {
                $objResponse->script('$("popup_qedit_prj_fld_pro_only").set("checked", false);');
            }
            if ($project['verify_only'] == 't') {
                $objResponse->script('$("popup_qedit_prj_fld_verify_only").set("checked", true);');
            } else {
                $objResponse->script('$("popup_qedit_prj_fld_verify_only").set("checked", false);');
            }
            if ($project['prefer_sbr'] == 't') {
                $objResponse->script('$("popup_qedit_prj_fld_prefer_sbr").set("checked", true);');
            } else {
                $objResponse->script('$("popup_qedit_prj_fld_prefer_sbr").set("checked", false);');
            }
            if ($project['strong_top'] == 1) {
                $objResponse->script('$("popup_qedit_prj_fld_strong_top").set("checked", true);');
            } else {
                $objResponse->script('$("popup_qedit_prj_fld_strong_top").set("checked", false);');
            }
            /*if($project['prefer_sbr']=='t') {
                  $objResponse->script('$("popup_qedit_prj_fld_prefer_sbr").set("checked", true);');
              } else {
                  $objResponse->script('$("popup_qedit_prj_fld_prefer_sbr").set("checked", false);');
              }*/
            $objResponse->script("var mx = new MultiInput('popup_qedit_prj_fld_categories','category_line', " . (int) ($project['is_pro'] === 't') . '); mx.init();');
            require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/attachedfiles.php';
            $attchedfiles = new attachedfiles($attachedfiles_session);
            $attachedfiles_tmpprj_files = $oprj->GetAllAttach($project['id']);
            if ($attachedfiles_tmpprj_files) {
                $attachedfiles_prj_files = array();
                foreach ($attachedfiles_tmpprj_files as $attachedfiles_prj_file) {
                    $attachedfiles_prj_files[] = $attachedfiles_prj_file['file_id'];
                }
                $attchedfiles->setFiles($attachedfiles_prj_files);
            }
            $attachedfiles_files = $attchedfiles->getFiles();
            $js_attachedfiles = 'attachedfiles_list = [];';
            if ($attachedfiles_files) {
                $n = 0;
                foreach ($attachedfiles_files as $attachedfiles_file) {
                    $js_attachedfiles .= "attachedfiles_list[{$n}] = new Object;\n";
                    $js_attachedfiles .= "attachedfiles_list[{$n}].id = '" . md5($attachedfiles_file['id']) . "';\n";
                    $js_attachedfiles .= "attachedfiles_list[{$n}].name = '{$attachedfiles_file['orig_name']}';\n";
                    $js_attachedfiles .= "attachedfiles_list[{$n}].path = '" . WDCPREFIX . "/{$attachedfiles_file['path']}{$attachedfiles_file['name']}';\n";
                    $js_attachedfiles .= "attachedfiles_list[{$n}].size = '" . ConvertBtoMB($attachedfiles_file['size']) . "';\n";
                    $js_attachedfiles .= "attachedfiles_list[{$n}].type = '{$attachedfiles_file['type']}';\n";
                    ++$n;
                }
            }
            $objResponse->script($js_attachedfiles);
            $objResponse->script("attachedFiles.init('popup_qedit_prj_attachedfiles', '" . $attchedfiles->getSession() . "', attachedfiles_list, " . tmp_project::MAX_FILE_COUNT . ', ' . tmp_project::MAX_FILE_SIZE . ",'" . implode(', ', $GLOBALS['disallowed_array']) . "', 'project', " . get_uid(false) . ');');
            if ($project['is_color'] == 't') {
                $objResponse->script("\$('popup_qedit_prj_is_color').set('checked', true); popupQEditPrjToggleIsColor();");
            } else {
                $objResponse->script("\$('popup_qedit_prj_is_color').set('checked', false); popupQEditPrjToggleIsColor();");
            }
            if ($project['is_bold'] == 't') {
                $objResponse->script("\$('popup_qedit_prj_is_bold').set('checked', true); popupQEditPrjToggleIsBold();");
            } else {
                $objResponse->script("\$('popup_qedit_prj_is_bold').set('checked', false); popupQEditPrjToggleIsBold();");
            }
            if ($project['hide'] == 't') {
                $objResponse->script("\$('popup_qedit_prj_is_hide').set('checked', true); ");
            } else {
                $objResponse->script("\$('popup_qedit_prj_is_hide').set('checked', false); ");
            }
            if ($project['urgent'] == 't') {
                $objResponse->script("\$('popup_qedit_prj_is_urgent').set('checked', true); ");
            } else {
                $objResponse->script("\$('popup_qedit_prj_is_urgent').set('checked', false); ");
            }
            $objResponse->assign('popup_qedit_prj_logolink', 'value', $project['link']);
            $key = md5(uniqid($uid));
            $tmpPrj = new tmp_project($key);
            $tmpPrj->init(1, $project['id']);
            $remTPeriod = $tmpPrj->getRemainingTopPeriod($remTD, $remTH, $remTM, $remtverb);
            $addedTD = $tmpPrj->getAddedTopDays();
            $objResponse->assign('popup_qedit_prj_fld_tmpid', 'value', $key);
            if ($remTPeriod || $addedTD) {
                $objResponse->script('$("popup_qedit_prj_top_ok").set("checked", true);');
                $objResponse->script('$("popup_qedit_prj_top_ok").set("disabled", true);');
                $objResponse->script('$("popup_qedit_prj_top_ok_tab1_days").set("value", "1");');
                $objResponse->script('$("popup_qedit_prj_top_ok_icon").setStyle("display", "block");');
                $objResponse->script('$("popup_qedit_prj_top_ok_tab1").setStyle("display", "none");');
                $objResponse->script('$("popup_qedit_prj_top_ok_tab2").setStyle("display", "block");');
                $objResponse->script('$("popup_qedit_prj_top_ok_tab1_days").set("disabled", true);');
                $objResponse->script('$("popup_qedit_prj_top_ok_tab2_c").set("checked", false);');
                $objResponse->script('$("popup_qedit_prj_top_ok_tab2_c").set("disabled", false);');
                $objResponse->script('$("popup_qedit_prj_top_ok_tab2_days").set("disabled", false);');
                $objResponse->script('$("popup_qedit_prj_top_ok_tab2_days").set("value", "1");');
                $objResponse->script('$("popup_qedit_prj_top_ok_tab2_left").set("html", "' . $remtverb . ' ' . $remTPeriod . '");');
            } else {
                $objResponse->script('$("popup_qedit_prj_top_ok").set("checked", false);');
                $objResponse->script('$("popup_qedit_prj_top_ok").set("disabled", false);');
                $objResponse->script('$("popup_qedit_prj_top_ok_tab1_days").set("value", "1");');
                $objResponse->script('$("popup_qedit_prj_top_ok_icon").setStyle("display", "none");');
                $objResponse->script('$("popup_qedit_prj_top_ok_tab1").setStyle("display", "none");');
                $objResponse->script('$("popup_qedit_prj_top_ok_tab2").setStyle("display", "none");');
                $objResponse->script('$("popup_qedit_prj_top_ok_tab1_days").set("disabled", false);');
                $objResponse->script('$("popup_qedit_prj_top_ok_tab2_c").set("checked", false);');
                $objResponse->script('$("popup_qedit_prj_top_ok_tab2_c").set("disabled", true);');
                $objResponse->script('$("popup_qedit_prj_top_ok_tab2_days").set("disabled", true);');
            }
            if ($project['logo_id']) {
                $logo = $tmpPrj->getLogo();
                $objResponse->script('$("popup_qedit_prj_use_logo_src").set("href", "' . WDCPREFIX . '/' . $logo['path'] . $logo['name'] . '");');
                $objResponse->script('$("popup_qedit_prj_use_logo").set("checked", true);');
                $objResponse->script('$("popup_qedit_prj_use_logo").set("disabled", true);');
                $objResponse->script('$("popup_qedit_prj_use_logo_tab").setStyle("display", "block");');
                $objResponse->script('$("popup_qedit_prj_use_logo_tab2").setStyle("display", "none");');
            } else {
                $objResponse->script('$("popup_qedit_prj_use_logo").set("checked", false);');
                $objResponse->script('$("popup_qedit_prj_use_logo").set("disabled", false);');
                $objResponse->script('$("popup_qedit_prj_use_logo_tab").setStyle("display", "none");');
                $objResponse->script('$("popup_qedit_prj_use_logo_tab2").setStyle("display", "none");');
            }
            $tmpPrj->fix();
            $objResponse->call('center_popup', '.b-shadow_center-quick');
        }
    }
    return $objResponse;
}
    if ($doc_file) {
        ?>
                        <table cellspacing="0" cellpadding="0" border="0" class="b-layout__table">
                            <tbody>
                                <tr class="b-layout__tr">
                                    <td class="b-layout__middle b-layout__middle_padbot_5"><div class="b-layout__txt"><i class="b-icon b-icon_attach_pdf"></i> <a class="b-layout__link" href="<?php 
        echo WDCPREFIX;
        ?>
/<?php 
        echo $doc_file->path . $doc_file->name;
        ?>
"><?php 
        echo $doc_file->original_name;
        ?>
</a>, <?php 
        echo ConvertBtoMB($doc_file->size);
        ?>
</div></td>
                                    <td class="b-layout__right b-layout__right_padleft_20 b-layout__right_padbot_5"><div class="b-layout__txt"><a class="b-layout__link" href="<?php 
        echo WDCPREFIX;
        ?>
/<?php 
        echo $doc_file->path . $doc_file->name;
        ?>
">Скачать файл</a></div></td>
                                </tr>
                            </tbody>
                        </table>
                        <?php 
    }
    //if
Exemple #11
0
 $stages_files = array($attachedfiles_files);
 if (!$_POST['attachedfiles_session']) {
     $stage_files = array();
     // $k - выступает как ключ к сессии файлов
     foreach ($sbr->stages as $k => $stage) {
         if ($stage->data['attach']) {
             if ($k > 0) {
                 $attachedfiles->addNewSession();
             }
             // Первая сессия у нас генерируется вверху
             $stage_files = $attachedfiles_files = array();
             foreach ($stage->data['attach'] as $i => $v) {
                 $stage_files[] = $v['file_id'];
                 $v['id'] = md5($v['file_id']);
                 $v['type'] = $v['ftype'];
                 $v['tsize'] = ConvertBtoMB($v['size']);
                 $v['status'] = 3;
                 $attachedfiles_files[] = $v;
             }
             $attachedfiles->setFiles($stage_files, 3, $k);
             $stages_files[$k] = $attachedfiles_files;
         }
     }
 }
 // Подготовка данных для JSON
 if ($stages_files) {
     $stages_files = attachedfiles::getInitJSONContentSBRFiles($stages_files);
 }
 $sbr_schemes = $sbr->getSchemes();
 $rt_checked = true;
 $rt_disabled = $sbr->reserved_id || $sbr->checkChangeRT();
Exemple #12
0
 /**
  * подготавливает файлы для страницы финансы
  * @param array $attach список файлов полученный из account::getAllAttach()
  * 
  * возвращает массив со слдующими ключами
  * @key attachedfiles $attachedFilesDoc сюда запишется объект класса attachedfilec для сканов документа
  * @key array $attachDoc сюда запишется список файлов - сканов документа
  * @key attachedfiles $attachedFilesOther сюда запишется объект класса attachedfilec для сканов страхового свидетельства
  * @key array $attachOther сюда запишется список файлов - сканов свидетельства
  */
 function prepareFinanceFiles($attach, $login = null)
 {
     if (!$attach) {
         $attach = array();
     }
     // разделяем файлы на группы (сканы документа и сканы свидетельства) и подготавливаем для вывода через attachedfiles2.js
     $attachDoc = array();
     $attachOther = array();
     $cfile = new CFile();
     $attachedFilesDoc = new attachedfiles();
     // файлы документа
     $attachedFilesOther = new attachedfiles();
     // страховое свидетельство
     foreach ($attach as $key => $file) {
         $file['type'] = $cfile->getext($file['name']);
         $file['tsize'] = iconv("CP1251", "UTF-8", ConvertBtoMB($file['size']));
         $file['orig_name'] = iconv("CP1251", "UTF-8", $file['orig_name']);
         $file['id'] = md5($file['file_id']);
         if (preg_match('/finance_other\\/$/', $file['path'])) {
             $attachOther[] = $file;
             $attachedFilesOther->setFiles(array($file['file_id']));
             // добавляем файл в сессию
         } else {
             $attachDoc[] = $file;
             $attachedFilesDoc->setFiles(array($file['file_id']));
             // добавляем файл в сессию
         }
     }
     return array('attachDoc' => $attachDoc, 'attachOther' => $attachOther, 'attachedFilesDoc' => $attachedFilesDoc, 'attachedFilesOther' => $attachedFilesOther);
 }
Exemple #13
0
</div>
                    </div>
                    <?php 
        }
        ?>
                    <div class="b-filter">
                        <div class="b-filter__body b-filter__body_padtop_10">
                            <a href="javascript:void(0)" class="b-filter__link b-filter__link_fontsize_11 b-filter__link_dot_41 b-fileinfo">Требования к файлам</a>
                        </div>
                        <div id="attachedfiles_info" class="b-shadow b-filter__toggle b-shadow_hide b-shadow_top_30 b-shadow_zindex_110 b-fileinfo-shadow" style="z-index:110">
                                            <div class="b-shadow__body b-shadow__body_pad_15 b-shadow_width_270 b-shadow__body_bg_fff">
                                                <div class="b-shadow__txt b-shadow__txt_fontsize_11 b-shadow__txt_padbot_5">Разрешается добавлять не более <span class="b-shadow__txt b-shadow__txt_bold"><?php 
        echo $params['maxfiles'] . ending($params['maxfiles'], ' файла', ' файлов', ' файлов');
        ?>
</span> объемом не более <?php 
        echo ConvertBtoMB($params['maxsize']);
        ?>
.</div>
                                                <?php 
        if ($params['graph_hint']) {
            ?>
                                                    <div class="b-shadow__txt b-shadow__txt_fontsize_11 b-shadow__txt_padbot_5">jpg и gif размером <span class="b-shadow__txt b-shadow__txt_bold">600х1000 пикс.</span> и весом не более 300 КБ будут вставлены в текст поста, остальные файлы будут приложены к нему.</div>
                                                <?php 
        } elseif ($params['graph_carusel']) {
            ?>
                                                    <div class="b-shadow__txt b-shadow__txt_fontsize_11 b-shadow__txt_padbot_5">Разрешенные форматы: jpg, png, размером не более <span class="b-shadow__txt b-shadow__txt_bold">1000х1000 пикс.</span></div>
                                                <?php 
        } elseif ($params['graph_userpic']) {
            ?>
                                                    <div class="b-shadow__txt b-shadow__txt_fontsize_11 b-shadow__txt_padbot_5">Разрешенные форматы: jpg, png, размером не более <span class="b-shadow__txt b-shadow__txt_bold">100х100 пикс.</span></div>
                                                <?php 
Exemple #14
0
/**
 * Генерирует список файлов с иконками для комментариев (новая версия)
 *
 * @param array $attaches Массив с информацией о файле/файлах (напр. результат выборки из таблицы file)
 * @return string HTML код
 */
function viewattachListNew($attaches)
{
    if (!$attaches || !count($attaches)) {
        return '';
    }
    $thumbs = '';
    $list = '';
    if (isset($attaches['id'])) {
        $attaches = array($attaches);
    }
    foreach ($attaches as $attach) {
        $cfile = new CFile();
        $ext = $cfile->getext($attach['fname']);
        $ico = getICOFile($ext);
        $fsize = ConvertBtoMB($attach['size']);
        $path = WDCPREFIX . "/{$attach['path']}{$attach['fname']}";
        if ($attach['size'] < 300 * 1024 && in_array($ext, $GLOBALS['graf_array']) && $ext != 'swf') {
            $path_th = WDCPREFIX . "/{$attach['path']}sm_{$attach['fname']}";
            $th = new CFile("{$attach['path']}sm_{$attach['fname']}");
            if (!$th->id) {
                $path_th = $path;
            }
            $thumbs .= "<li class='afl-img c'><a href='{$path}' title='{$ext}, {$fsize}'><img src='{$path_th}' alt='{$ext}, {$fsize}' /></a></li>\n";
        } else {
            $list .= "<li class='{$ico}'><a href='{$path}'>{$ext}, {$fsize}</a></li>\n";
        }
    }
    return "<ul class='added-files-list c'>{$thumbs}{$list}</ul>";
}
Exemple #15
0
require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/CFile.php";
require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/uploader/uploader.php";
session_start();
$resource = __paramInit('string', null, 'resource');
$action = __paramInit('string', null, 'action');
if ($resource) {
    switch ($action) {
        case 'create':
            if (is_array($_FILES['qqfile']) && !$_FILES['qqfile']['error']) {
                $result = uploader::listener($resource);
            } else {
                $result['success'] = false;
                switch ($_FILES['attachedfiles_file']['error']) {
                    case UPLOAD_ERR_FORM_SIZE:
                    case UPLOAD_ERR_INI_SIZE:
                        $result['error'] = "Максимальный объем файлов: " . ConvertBtoMB($max_files_size);
                        break;
                    default:
                        $result['error'] = "Ошибка загрузки файла.";
                        break;
                }
            }
            break;
        case 'remove':
            $files = __paramInit('array_int', null, 'files');
            uploader::sremoveFiles($resource, $files);
            $result['onComplete'] = uploader::getRemoveCallback(uploader::sgetTypeUpload($resource));
            $result['success'] = true;
            break;
        default:
            $result['success'] = false;
                        </div>
                        <div id="flt-masss-files" class="flt-cnt-masssend с" >
                            <div class="cl-form-files c"> 
                                <ul id="mf-files-list" class="form-files-added"></ul> 
                                <ul class="form-files-list">
                                    <li id="c">
                                        <input id="mf-file" name="attach" type="file" />
                                        &nbsp;&nbsp;<img id="mf-load" src="/images/loader-gray.gif" style="display: none"  alt=""/>
                                    </li>
                                </ul>
                                <div class="masss-files-inf">
                                    <p><strong>Вы можете прикрепить до <?php 
echo masssending::MAX_FILES;
?>
 файлов общим объемом не более <?php 
echo ConvertBtoMB(masssending::MAX_FILE_SIZE);
?>
.</strong><br />
                                    Файлы следующих форматов запрещены к загрузке: <?php 
echo implode(', ', $GLOBALS['disallowed_array']);
?>
                                    </p>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <b class="b2"></b>
        <b class="b1"></b>
                if (in_array($cFile->getext(), $GLOBALS['disallowed_array'])) {
                    $file['error'] = 'Недопустимый формат файла';
                }
                if ($file['error']) {
                    $cFile->Delete($cFile->id);
                } else {
                    $fileinfo = $attachedfiles->add($cFile);
                    $file['id'] = md5($fileinfo['id']);
                    $file['name'] = $fileinfo['name'];
                    $file['path'] = WDCPREFIX . '/' . $fileinfo['path'];
                    $file['size'] = ConvertBtoMB($fileinfo['size']);
                    $file['type'] = $fileinfo['type'];
                }
            } else {
                if ($_FILES['attachedfiles_file']['size'] > $max_files_size) {
                    $file['error'] = 'Максимальный объем файлов: ' . ConvertBtoMB($max_files_size);
                } else {
                    $file['error'] = 'Ошибка загрузки файла';
                }
            }
        }
        break;
    case 'delete':
        $attachedfiles = new attachedfiles($sess);
        $attachedfiles->delete($_POST['attachedfiles_delete']);
        break;
}
?>

<script type="text/javascript">
    window.parent.attachedFiles.clearFileField();
Exemple #18
0
/**
 * Редактирование документа.
 *
 * @param int $id ID документа
 *
 * @return object xajaxResponse
 */
function editDoc($id)
{
    global $objLetters;
    $objResponse = new xajaxResponse();
    if (hasPermissions('letters') && hasPermissions('adm')) {
        $doc = $objLetters->getDocument($id);
        if ($doc) {
            if (!$doc['user_status_1']) {
                $doc['user_status_1'] = null;
            }
            if (!$doc['user_status_2']) {
                $doc['user_status_2'] = null;
            }
            if (!$doc['user_status_3']) {
                $doc['user_status_3'] = null;
            }
            $objResponse->assign('letters_doc_frm_title', 'value', $doc['title']);
            $objResponse->script("\n                                \$('letters_doc_frm_delivery_cost').set('value', '');\n                                \$('letters_doc_frm_comment').set('value', '');\n                                ComboboxManager.getInput('letters_doc_frm_group').clear();\n                                ComboboxManager.getInput('letters_doc_frm_delivery').clear();\n                                ComboboxManager.getInput('letters_doc_frm_user_1').clear();\n                                ComboboxManager.getInput('letters_doc_frm_user_2').clear();\n                                ComboboxManager.getInput('letters_doc_frm_user_3').clear();\n                                ComboboxManager.getInput('letters_doc_frm_parent').clear();\n                                \$('letters_doc_frm_user1_status_data').set('value', 0);\n                                \$('letters_doc_frm_user1_status_date_data').set('value', '');\n                                \$('letters_doc_frm_user_1_status_change_lnk').set('html', statuses_list[0]);\n                                \$('letters_doc_frm_user2_status_data').set('value', 0);\n                                \$('letters_doc_frm_user2_status_date_data').set('value', '');\n                                \$('letters_doc_frm_user_2_status_change_lnk').set('html', statuses_list[0]);\n                                \$('letters_doc_frm_user3_status_data').set('value', 0);\n                                \$('letters_doc_frm_user3_status_date_data').set('value', '');\n                                \$('letters_doc_frm_user_3_status_change_lnk').set('html', statuses_list[0]);\n                                if(\$('letters_doc_frm_user_3_div').getStyle('display')=='block') {\n                                    letters.toggleUser3();\n                                }\n                            ");
            if ($doc['user_3']) {
                $objResponse->script('letters.toggleUser3();');
                $objResponse->script('ComboboxManager.getInput("letters_doc_frm_user_3").loadRecord(' . $doc['user_3'] . ', "get_user_or_company_info", "type=' . ($doc['is_user_3_company'] == 't' ? 'company' : 'user') . '");');
            }
            if ($doc['withoutourdoc'] == 't') {
                $objResponse->script('$("letters_doc_frm_withoutourdoc").set("checked", true);');
            }
            if ($doc['user_status_1'] == 2 || $doc['user_status_1'] == 3) {
                $add_status1 = ' ' . dateFormat('d.m.Y', $doc['user_status_date_1']);
            }
            if ($doc['user_status_2'] == 2 || $doc['user_status_2'] == 3) {
                $add_status2 = ' ' . dateFormat('d.m.Y', $doc['user_status_date_2']);
            }
            if ($doc['user_status_3'] == 2 || $doc['user_status_1'] == 3) {
                $add_status3 = ' ' . dateFormat('d.m.Y', $doc['user_status_date_3']);
            }
            $objResponse->script("\$('letters_doc_frm_user_1_status_change_lnk').set('html', statuses_list[" . intval($doc['user_status_1']) . "]+'{$add_status1}')");
            $objResponse->script("\$('letters_doc_frm_user_2_status_change_lnk').set('html', statuses_list[" . intval($doc['user_status_2']) . "]+'{$add_status2}')");
            $objResponse->script("\$('letters_doc_frm_user_3_status_change_lnk').set('html', statuses_list[" . intval($doc['user_status_3']) . "]+'{$add_status3}')");
            $objResponse->assign('letters_doc_frm_user1_status_data', 'value', intval($doc['user_status_1']));
            $objResponse->assign('letters_doc_frm_user2_status_data', 'value', intval($doc['user_status_2']));
            $objResponse->assign('letters_doc_frm_user3_status_data', 'value', intval($doc['user_status_3']));
            $objResponse->assign('letters_doc_frm_user1_status_date_data', 'value', $doc['user_status_date_1'] ? dateFormat('Y-m-d', $doc['user_status_date_1']) : '');
            $objResponse->assign('letters_doc_frm_user2_status_date_data', 'value', $doc['user_status_date_2'] ? dateFormat('Y-m-d', $doc['user_status_date_2']) : '');
            $objResponse->assign('letters_doc_frm_user3_status_date_data', 'value', $doc['user_status_date_3'] ? dateFormat('Y-m-d', $doc['user_status_date_3']) : '');
            if ($doc['group_id']) {
                $objResponse->script('ComboboxManager.getInput("letters_doc_frm_group").loadRecord(' . $doc['group_id'] . ', "getlettergroupinfo");');
            }
            $objResponse->script('ComboboxManager.getInput("letters_doc_frm_user_1").loadRecord(' . $doc['user_1'] . ', "get_user_or_company_info", "type=' . ($doc['is_user_1_company'] == 't' ? 'company' : 'user') . '");');
            $objResponse->script('ComboboxManager.getInput("letters_doc_frm_user_2").loadRecord(' . $doc['user_2'] . ', "get_user_or_company_info", "type=' . ($doc['is_user_2_company'] == 't' ? 'company' : 'user') . '");');
            if ($doc['parent']) {
                $objResponse->script('ComboboxManager.getInput("letters_doc_frm_parent").loadRecord(' . $doc['parent'] . ', "getletterdocinfo");');
            }
            if ($doc['date_add']) {
                $objResponse->script('ComboboxManager.getInput("letters_doc_frm_dateadd").setDate("' . preg_replace('/ .*$/', '', $doc['date_add']) . '");');
            }
            if ($doc['file_id']) {
                $cFile = new CFIle();
                $cFile->table = 'file';
                $cFile->GetInfoById($doc['file_id']);
                require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/attachedfiles.php';
                $attachedfiles = new attachedfiles('', true);
                $asid = $attachedfiles->createSessionID();
                $attachedfiles->addNewSession($asid);
                $attachedfiles->setFiles(array($cFile->id));
                $p_name = preg_replace("/\\..*\$/", '', $cFile->name);
                ob_start();
                echo '<div id="attachedfiles">';
                require_once $_SERVER['DOCUMENT_ROOT'] . '/siteadmin/letters/tpl.attachedfiles.php';
                echo '</div>';
                echo "<input type='hidden' id='attachedfiles_uid' name='attachedfiles_uid' value='" . get_uid(false) . "'>";
                echo "<input type='hidden' id='attachedfiles_action' name='attachedfiles_action' value=''>";
                echo "<input type='hidden' id='attachedfiles_delete' name='attachedfiles_delete' value=''>";
                echo "<input type='hidden' id='attachedfiles_type' name='attachedfiles_type' value='letters'>";
                echo "<input type='hidden' id='attachedfiles_session' name='attachedfiles_session' value='" . $asid . "'>";
                echo "<iframe id='attachedfiles_hiddenframe' name='attachedfiles_hiddenframe' style='display:none;'></iframe>";
                $html = ob_get_contents();
                ob_end_clean();
                $objResponse->assign('letters_div_attach', 'innerHTML', $html);
                $objResponse->script("(function () {\n\n                                    var attachedfiles_list = new Array();\n\n                                    attachedfiles_list[0] = new Object;\n                                    attachedfiles_list[0].id = '" . md5($cFile->id) . "';\n                                    attachedfiles_list[0].name = '" . $cFile->original_name . "';\n                                    attachedfiles_list[0].path = '" . WDCPREFIX . '/' . $cFile->path . $cFile->name . "';\n                                    attachedfiles_list[0].size = '" . ConvertBtoMB($cFile->size) . "';\n                                    attachedfiles_list[0].type = '" . $cFile->getExt() . "';\n\n                                    attachedFiles.initComm( 'attachedfiles', \n                                                            '{$attachedfiles->getSession()}',\n                                                            attachedfiles_list, \n                                                            '1',\n                                                            '" . letters::MAX_FILE_SIZE . "',\n                                                            '" . implode(', ', $GLOBALS['disallowed_array']) . "',\n                                                            'letters',\n                                                            '" . get_uid(false) . "'\n                                                            );\n                                    attachedFiles.newFile(attachedfiles_list[0].id, attachedfiles_list[0].name, attachedfiles_list[0].path, attachedfiles_list[0].size, attachedfiles_list[0].type);\n                                })();\n                                \$('wd_file_add').setStyle('display', 'none');\n                                ");
                $objResponse->assign('attachedfiles_uid', 'value', get_uid(false));
                $objResponse->assign('attachedfiles_session', 'value', $attachedfiles->getSession());
                $objResponse->script("\$('f_button_actionwork').removeClass('b-button_rectangle_color_disable');");
            }
            $objResponse->script('status_can_submit = true;');
            $objResponse->script("\$('letters_add_div').getChildren('div').removeClass('b-shadow_hide');");
        }
        $objResponse->script('letters.spinner.hide();');
    }
    return $objResponse;
}
Exemple #19
0
        echo $prj['name'];
        ?>
</strong><?php 
    }
    ?>
<br>
	<?php 
    echo reformat($prj['descr'], 96);
    ?>
<br><br>
	<?php 
    $projects = new projects();
    $attach = $projects->GetAllAttach($prj['id']);
    for ($j = 0; $j < count($attach); ++$j) {
        if ($attach[$j]['name']) {
            print '<div class="flw_offer_attach"><a href="/users/' . $prj['login'] . '/upload/' . $attach[$j]['name'] . '" target="_blank">Загрузить</a> (' . $attach[$j]['ftype'] . '; ' . ConvertBtoMB($attach[$j]['size']) . ' )</div>';
        }
    }
    ?>
	<?php 
    if ($uid != $_SESSION['uid'] && $prj['closed'] == 'f') {
        ?>
<form action="/contacts/?from=<?php 
        echo $user->login;
        ?>
#form" method="post"><input type="hidden" name="prjname" value="<?php 
        echo $prj['name'] ? $prj['name'] : 'заголовок отсутствует';
        ?>
"><input type="submit" name="btn" class="btn" value="Оговорить детали"></form><?php 
    }
    ?>
Exemple #20
0
 /**
  * Уведомление для подряда о подписанных документах
  * 
  */
 function SbrStageCompleted($events)
 {
     $ev0 = $events[0];
     $url = $GLOBALS['host'] . '/' . sbr::NEW_TEMPLATE_SBR . '/';
     require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/sbr.php';
     $sbr = sbr_meta::getInstanceLocal($ev0['f_uid']);
     $stage = $sbr->initFromStage($ev0['stage_id']);
     if (($stage->sbr->scheme_type == sbr::SCHEME_PDRD || $stage->sbr->scheme_type == sbr::SCHEME_PDRD2) && $ev0['own_role'] == sbr::EVROLE_FRL && $stage->status == sbr_stages::STATUS_COMPLETED) {
         $sbr->getDocs();
         $r = 'f_';
         $this->subject = "Необходимо прислать подписанные документы (проект «{$ev0['sbr_name']}»)";
         foreach ($stage->sbr->docs as $hdoc) {
             if ($hdoc['type'] == sbr::DOCS_TYPE_ACT || $hdoc['type'] == sbr::DOCS_TYPE_FM_APPL || $hdoc['type'] == sbr::DOCS_TYPE_WM_APPL || $hdoc['type'] == sbr::DOCS_TYPE_YM_APPL || $hdoc['type'] == sbr::DOCS_TYPE_TZ_PDRD) {
                 $head_docs[] = $hdoc;
             }
         }
         $hdoc_cnt = count($head_docs);
         $stage_name = sbr_meta::getNameForMail($ev0);
         $msg = "Вы успешно завершили Сделку «<a href='{$url}?site=Stage&id={$ev0['stage_id']}{$this->_addUrlParams('f', '&')}'>{$stage_name}</a>».<br/><br/>";
         $msg .= "Для получения оплаты Вам необходимо скачать, распечатать в двух экземплярах и подписать данные " . ending($hdoc_cnt, 'документ', 'документы', 'документы') . ":<br/>";
         foreach ($head_docs as $hdoc) {
             $msg .= "<a href='" . WDCPREFIX . "/{$hdoc['file_path']} {$hdoc['file_name']}' class='b-layout__link'> {$hdoc['name']}</a>, " . ConvertBtoMB($hdoc['file_size']);
         }
         $msg .= "<br/><br/>";
         $msg .= "Подписанные документы необходимо в оригиналах отправить на любой удобный вам адрес из списка:<br/>";
         $msg .= "- 129223, Москва, а/я 33;<br/>";
         $msg .= "- 190031, Санкт-Петербург, Сенная пл., д.13/52, а/я 427;<br/>";
         $msg .= "- 420032, Казань, а/я 624;<br/>";
         $msg .= "- 454014, Челябинск - 14, а/я 2710.<br/><br/>";
         $msg .= "Обязательно укажите наименование организации-получателя в поле «Кому» на конверте - ООО \"ВААН\".<br/><br/>";
         $msg .= "Время доставки документов зависит от работы выбранной Вами почтовой службы и Вашей удаленности от адреса доставки. При значительной задержке в доставки рекомендуем Вам обратиться в <a href='https://feedback.fl.ru/'>службу поддержки</a>.";
         $this->message = $this->splitMessage($this->GetHtml($ev0[$r . 'uname'], $msg, array('header' => 'simple', 'footer' => 'norisk_robot')));
         $this->recipient = $ev0[$r . 'uname'] . " " . $ev0[$r . 'usurname'] . " [" . $ev0[$r . 'login'] . "] <" . $ev0[$r . 'email'] . ">";
         $this->SmtpMail('text/html');
     } else {
         if (($stage->sbr->scheme_type == sbr::SCHEME_PDRD || $stage->sbr->scheme_type == sbr::SCHEME_PDRD2) && $ev0['own_role'] == sbr::EVROLE_FRL && $stage->status == sbr_stages::STATUS_ARBITRAGED) {
             $sbr->getDocs();
             $r = 'f_';
             $this->subject = "Необходимо прислать подписанные документы (проект «{$ev0['sbr_name']}»)";
             foreach ($stage->sbr->docs as $hdoc) {
                 if ($hdoc['type'] == sbr::DOCS_TYPE_ACT || $hdoc['type'] == sbr::DOCS_TYPE_FM_APPL || $hdoc['type'] == sbr::DOCS_TYPE_WM_APPL || $hdoc['type'] == sbr::DOCS_TYPE_YM_APPL || $hdoc['type'] == sbr::DOCS_TYPE_TZ_PDRD) {
                     $head_docs[] = $hdoc;
                 }
             }
             $stage_name = sbr_meta::getNameForMail($ev0);
             $msg .= "Информируем вас о том, что для получения вашего гонорара по Сделке «<a href='{$url}?site=Stage&id={$ev0['stage_id']}{$this->_addUrlParams('f', '&')}'>{$stage_name}</a>»  в соответствии с решением Арбитража, вам необходимо скачать, распечатать в двух экземплярах и подписать данные документы:<br/>";
             foreach ($head_docs as $hdoc) {
                 $msg .= "<a href='" . WDCPREFIX . "/{$hdoc['file_path']} {$hdoc['file_name']}' class='b-layout__link'> {$hdoc['name']}</a>, " . ConvertBtoMB($hdoc['file_size']);
             }
             $msg .= "<br/><br/>";
             $msg .= "Подписанные документы необходимо в оригиналах отправить на любой удобный вам адрес из списка:<br/>";
             $msg .= "- 129223, Москва, а/я 33;<br/>";
             $msg .= "- 190031, Санкт-Петербург, Сенная пл., д.13/52, а/я 427;<br/>";
             $msg .= "- 420032, Казань, а/я 624;<br/>";
             $msg .= "- 454014, Челябинск - 14, а/я 2710.<br/><br/>";
             $msg .= "Обязательно укажите наименование организации-получателя в поле «Кому» на конверте - ООО \"ВААН\".<br/><br/>";
             $this->message = $this->splitMessage($this->GetHtml($ev0[$r . 'uname'], $msg, array('header' => 'simple', 'footer' => 'norisk_robot')));
             $this->recipient = $ev0[$r . 'uname'] . " " . $ev0[$r . 'usurname'] . " [" . $ev0[$r . 'login'] . "] <" . $ev0[$r . 'email'] . ">";
             $this->SmtpMail('text/html');
         } elseif ($stage->sbr->scheme_type == sbr::SCHEME_LC) {
             $stage_name = sbr_meta::getNameForMail($ev0);
             $this->subject = "Безопасная Сделка по проекту «{$ev0['sbr_name']}» завершена";
             $endDate = date('d.m.Y', strtotime($sbr->data['dateEndLC']));
             $msg = "Безопасная Сделка <a href='{$url}?site=Stage&id={$ev0['stage_id']}{$this->_addUrlParams('f', '&')}'>{$stage_name}</a> завершена. Для того, чтобы получить заработанные деньги, вам необходимо отправить документы в банк путем нажатия на кнопку «Завершить этап».<br/><br/>";
             $msg .= "Обратите внимание, что завершить этап необходимо до того, как истечет срок действия аккредитива (до {$endDate}). В противном случае денежные средства будут возвращены Заказчику.";
             $r = 'f_';
             $this->message = $this->splitMessage($this->GetHtml($ev0[$r . 'uname'], $msg, array('header' => 'simple', 'footer' => 'norisk_robot')));
             $this->recipient = $ev0[$r . 'uname'] . " " . $ev0[$r . 'usurname'] . " [" . $ev0[$r . 'login'] . "] <" . $ev0[$r . 'email'] . ">";
             $this->SmtpMail('text/html');
         }
     }
 }
                                                                <div id="work_image" class="b-layout b-layout_padtop_20 b-layout_padlr_10">
                                                                    <table cellspacing="0" cellpadding="0" border="0" class="b-layout__table b-layout__table_width_full">
                                                                            <tr class="b-layout__tr">
                                                                                <td class="b-icon-layout__icon"><i class="b-icon b-icon_attach_<?php 
        echo getICOFile($cfile->getext());
        ?>
"></i></td>
                                                                                <td class="b-icon-layout__files"><div class="b-layout__txt b-layout__txt_padtop_5"><a href="<?php 
        echo WDCPREFIX . '/' . $cfile->path . $cfile->name;
        ?>
" class="b-icon-layout__link b-icon-layout__link_fontsize_13"><?php 
        echo uploader::cutNameFile($cfile->original_name, portfolio::FILE_NAME_LENGTH_EDIT);
        ?>
</a></div></td>
                                                                                <td class="b-icon-layout__size" style="padding-right:0;"><div class="b-layout__txt b-layout__txt_padtop_5">,<?php 
        echo ConvertBtoMB($cfile->size);
        ?>
</div></td>
                                                                            </tr>
                                                                    </table>
                                                                      <div id="swf_params" class="b-select b-select_padtop_10 b-select_center" <?php 
        echo strtolower(preg_replace("#.*(\\.[a-zA-Z0-9]*)\$#", '$1', $cfile->name)) != ".swf" ? 'style="display:none"' : '';
        ?>
>
                                                                          <label for="wmode" class="b-select__label b-select__label_inline-block b-select__label_fontsize_11">wmode: </label>
                                                                          <select id="wmode" class="b-select__select b-select__select_width_70" name="wmode">
                                                                              <option>window</option>
                                                                              <option>direct</option>
                                                                              <option>gpu</option>
                                                                          </select>
                                                                      </div>
                ?>
                                    <tr class="b-layout__tr">
                                        <td class="b-layout__middle b-layout__middle_padbot_5"><div class="b-layout__txt"><i class="b-icon b-icon_attach_<?php 
                echo getICOFile(CFile::getext($src['name']));
                ?>
"></i> <a class="b-layout__link" href="<?php 
                echo WDCPREFIX;
                ?>
/<?php 
                echo $src['path'] . $src['name'];
                ?>
" target="_blank"><?php 
                echo $src['orig_name'];
                ?>
</a>, <?php 
                echo ConvertBtoMB($src['size']);
                ?>
</div></td>
                                        <td class="b-layout__right b-layout__right_padleft_20 b-layout__right_padbot_5"><div class="b-layout__txt"><a class="b-layout__link" href="<?php 
                echo WDCPREFIX;
                ?>
/<?php 
                echo $src['path'] . $src['name'];
                ?>
" target="_blank">Скачать</a></div></td>
                                    </tr>
                                    <?php 
            }
            //foreach
            ?>
                                </table>
Exemple #23
0
function aEditDocument($stage_id, $doc_id)
{
    require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/sbr_meta.php';
    $stage_id = __paramValue('int', $stage_id);
    $doc_id = __paramValue('int', $doc_id);
    $objResponse = new xajaxResponse();
    if (!hasPermissions('sbr')) {
        return $objResponse;
    }
    $sbr = sbr_meta::getInstance();
    $sbr_id = $sbr->getSbrIdFromStage($stage_id);
    $sbr->initFromId($sbr_id, true, false, false);
    if ($sbr->error) {
        return $objResponse;
    }
    if ($sbr->getDocs($doc_id)) {
        $doc = current($sbr->docs);
        $stage = $sbr->initFromStage($stage_id, false);
        $doc_info = '<i class="b-icon b-icon_attach_' . getICOFile(CFile::getext($doc['file_name'])) . '"></i> <a class="b-layout__link" href="' . WDCPREFIX . '/' . $doc['file_path'] . $doc['file_name'] . '">' . $doc['name'] . '</a>, ' . ConvertBtoMB($doc['file_size']);
        ob_start();
        include $_SERVER['DOCUMENT_ROOT'] . '/sbr/admin/tpl.popup-doc.php';
        $html = ob_get_clean();
        //$objResponse->script("$('popup_admin_files').addClass('b-shadow_hide');");
        $objResponse->assign('popup_admin_files_edit', 'innerHTML', $html);
        $objResponse->script("\n        new attachedFiles2( \$('popup_admin_files{$doc['id']}').getElement('.attachedfiles_admin_sbr{$doc['id']}'), {\n            'hiddenName':   'attaches[]',\n            'files':        '',\n            'selectors': {'template' : '.attachedfiles_admin_sbr-tpl'}\n        });");
        $objResponse->call('shadow_popup');
    }
    return $objResponse;
}
Exemple #24
0
" id="doc_<?php 
    echo $doc['id'];
    ?>
">
    <td>
        <i class="b-icon b-icon_attach_pdf"></i> <a class="b-layout__link" href="<?php 
    echo WDCPREFIX;
    ?>
/<?php 
    echo $doc['file_path'] . $doc['file_name'];
    ?>
" target="_blank"><?php 
    echo $doc['name'];
    ?>
</a>, <?php 
    echo ConvertBtoMB($doc['file_size']);
    ?>
    </td>
    <td><?php 
    echo date('d.m.Y H:i', strtotime($doc['publ_time']));
    ?>
</td>
    <td><?php 
    echo $doc['id'] == $doc['first_doc_id'] ? "<strong style='color:red'>удаленный" : "<strong style='color:green'>действующий";
    ?>
</strong></td>
    <td text-align="right">
        <input type="submit" id="sbmt_add_<?php 
    echo $doc['id'];
    ?>
" onclick="xajax_aRecreateDocLC('<?php 
Exemple #25
0
 /**
  * Получить текущий список файлов.
  *
  * @param array $status Статус файлов которые надо получить
  *
  * @return array Текущий список файлов
  */
 public function getFiles($status = array(1, 3), $md5key = false, $md5id = false, $skey = false)
 {
     global $DB;
     $files = array();
     $sql = 'SELECT * FROM attachedfiles WHERE session ' . ($skey ? ' = ?u' : 'IN (?l)') . ' AND status IN (?l) ORDER BY DATE, file_id;';
     $qFiles = $DB->rows($sql, $skey ? $this->session[$skey] : $this->session, $status);
     if ($qFiles) {
         foreach ($qFiles as $file) {
             $cFile = new CFile($file['file_id']);
             if ($cFile->id) {
                 $arr = array('id' => $md5id ? md5($cFile->id) : $cFile->id, 'name' => $cFile->name, 'path' => $cFile->path, 'size' => $cFile->size, 'tsize' => ConvertBtoMB($cFile->size), 'orig_name' => $cFile->original_name, 'type' => $cFile->getext(), 'status' => $file['status']);
                 if (!$md5key) {
                     array_push($files, $arr);
                 } else {
                     $files[md5($cFile->id)] = $arr;
                 }
             }
         }
     }
     return $files;
 }
Exemple #26
0
 /**
  * Слушатель который обрабатывает на серверной стороне поступление файла
  * 
  * @param string $resource  Сессия загрузчика
  * @return boolean
  */
 static function listener($resource)
 {
     $browser = '';
     $version = array();
     browserCompat($browser, $version);
     // Скрипт посылает в той кодировке в которой страница в IE, в остальных браузерах в UTF-8
     if ($browser != 'msie' && ((int) $version[1] != 8 || (int) $version[1] != 10)) {
         $_FILES = self::encodeCharset($_FILES, array('utf-8', 'cp1251'));
     }
     $validate = self::getValidationInfo(self::sgetTypeUpload($resource));
     if ($validate['is_auth'] && !get_uid(false)) {
         return array('success' => false, 'error' => 'Ошибка загрузки файлов');
     }
     if ($validate['is_admin'] && !hasPermissions('adm')) {
         return array('success' => false, 'error' => 'Ошибка загрузки файлов');
     }
     if ($validate['max_files'] == 1 && $validate['is_replace']) {
         // Удаляем старые файлы для замены на новые
         self::sclear($resource);
     }
     $_FILES['qqfile']['name'] = stripslashes(__paramValue('string', $_FILES['qqfile']['name']));
     $CFile = new CFile($_FILES['qqfile']);
     $CFile->table = 'file';
     $CFile->server_root = $validate['server_root'] === true ? true : false;
     $CFile->max_size = $validate['max_file_size'];
     $uploader = new uploader($resource);
     $resourceInfo = $uploader->getCountResource();
     if ($validate['imageOnly'] && strpos($_FILES['qqfile']['type'], 'image') === false) {
         $file['error'] = "Недопустимый формат файла";
     }
     if ($resourceInfo['count'] + 1 > $validate['max_files']) {
         $file['error'] = "Максимальное количество файлов: {$validate['max_files']}";
     }
     if ($resourceInfo['size'] + $CFile->size > $validate['max_file_size'] && $validate['is_total_size']) {
         $file['error'] = "Максимальный объем файлов: " . ConvertBtoMB($validate['max_file_size']);
     }
     if (in_array($CFile->getext(), $GLOBALS['disallowed_array'])) {
         $file['error'] = "Недопустимый формат файла";
     }
     if ($file['error']) {
         $file['success'] = false;
         return $file;
     } else {
         $CFile->MoveUploadedFile($validate['dir']);
         if ($validate['resize'] && ($CFile->image_size['height'] > $validate['imageHeight'] || $CFile->image_size['width'] > $validate['imageWidth'])) {
             $CFile = $CFile->resizeImage($CFile->path . $CFile->name, $validate['imageWidth'], $validate['imageHeight'], 'auto', true);
         }
     }
     $skipEncoding = false;
     if ($CFile->id) {
         // если заданы типы графических файлов
         if ($validate['imageTypes'] && (!$CFile->image_size['type'] || !in_array($CFile->image_size['type'], $validate['imageTypes']))) {
             $file['error'] = "Недопустимый формат файла";
         }
         // если задана максимальная высота
         if ($validate['maxImageHeight'] && $CFile->image_size['height'] > $validate['maxImageHeight']) {
             $file['error'] = "Превышена максимальная высота изображения";
         }
         // если задана максимальная ширина
         if ($validate['maxImageWidth'] && $CFile->imae_size['width'] > $validate['maxImageWidth']) {
             $file['error'] = "Превышена максимальная ширина изображения";
         }
         if ($file['error']) {
             $CFile->Delete($CFile->id);
             $file['success'] = false;
         } else {
             $file = $uploader->createFile($CFile);
             if ($validate['copy_table'] != '') {
                 $cremotefile = self::remoteCopy($CFile->id, $validate['copy_table'], mailer::FILE_DIR);
                 $file['path'] = $cremotefile->path;
                 $file['fname'] = $cremotefile->name;
             }
             $file['success'] = true;
         }
     } else {
         $file['success'] = false;
         $file['error'] = $CFile->error;
         if (is_array($file['error']) && count($file['error']) == 0 && $CFile->size == 0) {
             $file['error'] = "Пустой файл";
             $skipEncoding = true;
         }
     }
     $file['onComplete'] = self::getCallback(self::sgetTypeUpload($resource), $CFile, $_FILES['qqfile']['type']);
     $file['orig_name'] = self::cutNameFile($file['orig_name'], $validate['fname_length']);
     if (!$skipEncoding) {
         $file = self::encodeCharset($file);
     }
     return $file;
 }