예제 #1
0
 function _getDokuUrl($url = null)
 {
     return getAbsUrl($url);
 }
예제 #2
0
 /**
  * Формирует Excel отчет по действиям конкретного админа
  * 
  * @param string $sAdminName имя админа
  * @param string $sAdminSurname фамилия админа
  * @param array $filter фильтр
  */
 function printReport($sAdminName = '', $sAdminSurname = '', $filter = array())
 {
     // имя итогового файла
     $sWorkTitle = 'Admin report.xls';
     // подключаем pear
     require_once 'Spreadsheet/Excel/Writer.php';
     // создаем документ
     $workbook = new Spreadsheet_Excel_Writer();
     $workbook->setVersion(8);
     // создаем лист
     $worksheet =& $workbook->addWorksheet('1');
     $worksheet->setInputEncoding('CP1251');
     $worksheet->write(0, 0, 'Администратор ' . $sAdminName . ' ' . $sAdminSurname . ' [' . $log[0]['adm_login'] . ']');
     $worksheet->write(1, 0, $GLOBALS['host'] . '/users/' . $log[0]['adm_login']);
     $d_sty = array('NumFormat' => 'DD MMM, YYYY HH:MM:SS');
     $td_sty = array('FontFamily' => 'Calibri', 'VAlign' => 'vequal_space', 'Align' => 'center', 'Border' => 1, 'BorderColor' => 'black');
     $th_sty = array('FontFamily' => 'Arial', 'Size' => 10, 'Align' => 'center', 'Border' => 1, 'BorderColor' => 'black', 'Bold' => 1);
     $format_top =& $workbook->addFormat($th_sty);
     $format_td =& $workbook->addFormat($td_sty);
     $format_date =& $workbook->addFormat(array_merge($td_sty, $d_sty));
     $format_top->setTextWrap(1);
     $aHeader = array('Действие', 'Объект', 'Ссылка', 'Дата');
     for ($i = 0; $i < count($aHeader); $i++) {
         $worksheet->write(3, $i, $aHeader[$i], $format_top);
     }
     // данные
     $this->filter = $filter;
     $log = $this->getLog($count, 1, 'general', 0, true);
     if ($log) {
         $nCnt = 1;
         foreach ($log as $aOne) {
             $sObjName = $aOne['object_name'] ? $aOne['object_name'] : '<без названия>';
             $sObjLink = $aOne['object_link'] ? getAbsUrl($aOne['object_link']) : '';
             $sDate = $aOne['act_time'] ? date('Y-m-d H:i:s', strtotime($aOne['act_time'])) : 'не известно';
             $worksheet->write($nCnt + 3, 0, $aOne['act_name'] . ' ' . admin_log::$aObj[$aOne['obj_code']]['short'], $format_td);
             $worksheet->write($nCnt + 3, 1, $sObjName, $format_td);
             $worksheet->write($nCnt + 3, 2, $sObjLink, $format_td);
             $worksheet->write($nCnt + 3, 3, $sDate, $format_date);
             $nCnt++;
         }
     }
     // отправляем на скачивание
     $workbook->send($sWorkTitle);
     // закрываем документ
     $workbook->close();
 }
예제 #3
0
    /**
     * Отправляет уведомления об изменении админом сообщения в личке ("Мои контакты").
     * 
     * @param int    $from_uid UID отправителя
     * @param int    $prof_id  ID профессии
     * @param string $reason   причина редактирования
     *
     * @return bool true - успех, false - провал
     */
    public function portfChoiceModifiedNotification($from_uid = 0, $prof_id = 0, $reason = '')
    {
        require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/users.php';
        require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/professions.php';
        $from = new users();
        $from->GetUserByUID($from_uid);
        $prj = professions::GetProfDesc($from_uid, $prof_id);
        $sLink = getAbsUrl('/users/' . $from->login . '/setup/#prof' . $prof_id);
        $sRason = $reason ? "\n\nПричина: " . $reason : '';
        $sFeedback = str_replace('//', '/{службу поддержки}/', $GLOBALS['host'] . '/about/feedback/');
        $message = 'Здравствуйте, ' . $from->uname . ' ' . $from->usurname . '

Модераторы нашего ресурса отредактировали ваши уточнения к разделу &laquo;' . $prj['profname'] . '&raquo;

' . $sLink . $sRason . '

Вы можете обратиться в ' . $sFeedback . '.

Надеемся на понимание, Команда Free-lance.ru
';
        self::Add(users::GetUid($err, 'admin'), $from->login, $message, '', 1);
    }
예제 #4
0
/**
* Добавляет жалобу на проект.
*
* @param    integer     $project_id     ID проекта
* @param    integer     $user_id        ID пользователя
* @param    integer     $type           тип жалобы
* @param    string      $msg            текст жалобы
* @param    string      $files          имена загруженных скриншотов
*
* @return                               xajax responce
*/
function SendComplain($project_id, $type, $msg, $files)
{
    global $session;
    session_start();
    require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/uploader/uploader.php';
    require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/projects_complains.php';
    require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/userecho.php';
    $objResponse = new xajaxResponse();
    $project_id = (int) $project_id;
    $user_id = get_uid(false);
    $type = (int) $type;
    $msg = __paramValue('htmltext', $msg);
    $error = false;
    $project = new projects();
    $prj = $project->GetPrj(0, $project_id, 1);
    $file_list = array();
    if ($files != '') {
        $files = uploader::sgetFiles($files);
        if (!empty($files)) {
            $emp = new users();
            $emp->GetUser($emp->GetField($prj['user_id'], $ee, 'login'));
            $dir = 'users/' . substr($emp->login, 0, 2) . '/' . $emp->login . '/upload/';
            foreach ($files as $file) {
                $copy = uploader::remoteCopy($file['id'], 'file_projects', $dir);
                $rfiles[] = $copy->name;
                $file_list[] = array('name' => $copy->original_name, 'link' => WDCPREFIX . '/' . $copy->path . $copy->name);
            }
            $files = implode(',', $rfiles);
        } else {
            $files = '';
        }
    }
    if (!$files) {
        $files = '';
    }
    if (projects::IsHaveComplainType($project_id, $user_id, $type)) {
        // Уже жаловался
        return $objResponse;
    }
    $projects_complains = new projects_complains();
    $type_name = $projects_complains->GetComplainType($type);
    $project_url = getAbsUrl(getFriendlyURL('project', $project_id));
    $is_moder = $projects_complains->isComplainTypeModer($type);
    if ($is_moder) {
        $userEcho = new UserEcho();
        $topic_message = $userEcho->constructMessage($project_url, $prj['name'], $msg, $file_list);
        $topicUrl = $userEcho->newTopicComplain($type_name, $topic_message, $file_list);
        if ($topicUrl) {
            messages::sendProjectComplain($user_id, $project_url, $prj['name'], $msg, $topicUrl);
        } else {
            $error = true;
        }
    }
    if (!$error) {
        $error = projects::AddComplain($project_id, $user_id, $type, $msg, $files, $is_moder && $topicUrl);
    }
    if ($error) {
        $objResponse->script("\$('abuse_project_popup').toggleClass('b-shadow_hide');");
        if ($is_moder) {
            $objResponse->script("\$('abuse-cause-error').removeClass('b-layout__txt_hide'); abuseResetSelection();");
        } else {
            $objResponse->script("\$\$('.abuse-btn-send').removeClass('b-button_rectangle_color_disable')");
        }
    } else {
        $upl = array('umask' => uploader::umask('prj_abuse'), 'validation' => array('allowedExtensions' => array('jpg', 'gif', 'png', 'jpeg'), 'restrictedExtensions' => array()), 'text' => array('uploadButton' => iconv('cp1251', 'utf8', 'Прикрепить файлы')));
        $objResponse->script("\n            \$('abuse{$type}').addClass('abuse-checked');\n            \$('abuse{$type}').getChildren().each(function(el) { \$(el).addClass('abuse-checked'); });\n        ");
        $objResponse->script("uploader.create('abuse_uploader', " . json_encode($upl) . ');');
        $objResponse->script("\$('prj_abuse_msg').set('value', '')");
        $objResponse->script("\$\$('.abuse-btn-send').removeClass('b-button_disabled')");
        $objResponse->script("\$('abuse_project_popup').toggleClass('b-shadow_hide');");
        $objResponse->script("\$('project_abuse_success').removeClass('b-layout__txt_hide');");
        $objResponse->script("\$('form_abuse').hide();");
        $objResponse->script("setTimeout(\"\$('project_abuse_success').addClass('b-layout__txt_hide')\", 5000);");
        if ($is_moder) {
            $objResponse->script("\$('abuse-cause-error').addClass('b-layout__txt_hide');");
        }
    }
    return $objResponse;
}
예제 #5
0
 /**
  * Отправляет уведомления о новых действиях модераторов
  * 
  * @param  string|array $message_ids идентификаторы комментариев
  * @param  resource $connect соединение к БД (необходимо в PgQ) или NULL -- создать новое
  * @return integer количество отправленных уведомлений
  */
 function AdminLogNotice($log_ids, $connect = NULL)
 {
     require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/admin_log.php";
     $admin_log = new admin_log();
     if (!($comments = $admin_log->GetNotices4Sending($log_ids, $connect))) {
         return NULL;
     }
     $this->subject = 'Новое действие модератора на сайте FL.ru';
     foreach ($comments as $aOne) {
         if (hasPermissions($aOne['rights'], $aOne['notice_uid']) && $aOne['notice_uid'] != $aOne['a_uid']) {
             $sObjEntity = admin_log::$aObj[$aOne['obj_code']]['name'];
             $sObjName = $aOne['object_name'] ? $aOne['object_name'] : '<без названия>';
             setlocale(LC_ALL, 'ru_RU.CP1251');
             $sObjName = str_replace(array('<', '>'), array('&lt;', '&gt;'), $sObjName);
             setlocale(LC_ALL, "en_US.UTF-8");
             if ($aOne['object_link']) {
                 $sObjLink = '<a href="' . getAbsUrl($aOne['object_link']) . '">' . $sObjName . '</a>';
             } else {
                 $sObjLink = $sObjName;
             }
             $this->message = $this->GetHtml($aOne['uname'], "\nНовое действие модератора:<br/>\n<a href='{$GLOBALS['host']}/users/{$aOne['a_login']}{$this->_addUrlParams('b')}'>{$aOne['a_uname']} {$aOne['a_usurname']}</a> [<a href='{$GLOBALS['host']}/users/{$aOne['a_login']}{$this->_addUrlParams('b')}'>{$aOne['a_login']}</a>]\n<br/>\n{$sObjEntity}: {$sObjLink}<br />\nДействие: {$aOne['act_name']}<br />\n<br />\n<a href='{$GLOBALS['host']}/siteadmin/admin_log/?view={$aOne['id']}{$this->_addUrlParams('b', '&')}'>{$GLOBALS['host']}/siteadmin/admin_log/?view={$aOne['id']}</a>\n<br />\n<br />\n            \t", array('header' => 'simple', 'footer' => 'simple'));
             $this->recipient = $aOne['uname'] . " " . $aOne['usurname'] . " [" . $aOne['login'] . "] <" . $aOne['email'] . ">";
             $this->SmtpMail('text/html');
         }
     }
     return $this->sended;
 }
예제 #6
0
function getNextPageContent($pageList, $autoSet, $content_match_type, $content_selector, $outer, $objective, $index, $page_selector, $paged, $delPageArea, $options, $charset, $baseUrl, $page1URL, $filterAtag, $downAttach, $isTest, $useP1, $useP2, $proxy, $pageURLPattern, $pageNum, $cookie)
{
    global $isFetch;
    $content = '';
    if ($pageList != null) {
        foreach ($pageList as $page) {
            $url = $page->href;
            if (trim($url) == '' || $url == null) {
                continue;
            }
            if (!strpos($url, '#038;') === false) {
                $url = str_ireplace('#038;', '', $url);
            }
            if (stripos($url, 'http') === false) {
                if (!(stripos($url, 'javascript') === false)) {
                    continue;
                }
                if (trim($url) == '#') {
                    continue;
                }
                $url = getAbsUrl($url, $baseUrl, $page1URL);
            }
            $url = html_entity_decode(trim($url));
            if (isset($isFetch[$url]) && $isFetch[$url] == 1) {
                continue;
            }
            if ($pageURLPattern != null) {
                $shouldFetchUrl = str_ireplace('(*)', $pageNum, $pageURLPattern);
                if ($shouldFetchUrl != $url) {
                    continue;
                }
                $pageNum++;
            }
            $d = file_get_html_ap(trim($url), $charset, Method, $useP1, $useP2, $proxy, $cookie);
            if ($d == null || $d == '') {
                continue;
            }
            $content = '';
            if ($autoSet) {
                $content .= autoGetContents($d, $charset);
            } else {
                $hasUTFhtml = false;
                $matchNum = count($content_selector);
                foreach ($content_match_type as $cmt) {
                    if ($cmt == 1) {
                        if ($charset != 'UTF-8' && $charset != 'utf-8') {
                            $UTFhtml = $d->save();
                            $UTFhtml = iconv($charset, 'UTF-8//IGNORE', $UTFhtml);
                            $UTFhtml = compress_html($UTFhtml, true, $d);
                        } else {
                            $UTFhtml = $d->save();
                            $UTFhtml = compress_html($UTFhtml, true, $d);
                        }
                        $hasUTFhtml = true;
                        break;
                    }
                }
                for ($i = 0; $i < $matchNum; $i++) {
                    if ($content_match_type[$i] == 0) {
                        switch ($objective[$i]) {
                            case '0':
                                $content .= getContentByCss($d, $content_selector[$i], $options, $charset, $outer[$i], $index[$i]);
                                break;
                        }
                    } else {
                        switch ($objective[$i]) {
                            case '0':
                                $content .= getContentByRule($UTFhtml, $content_selector[$i], $options, $outer[$i]);
                                break;
                        }
                    }
                }
            }
            if ($page_selector[0] == 0) {
                $pageList = $d->find($page_selector[1]);
                if ($pageList != null && $delPageArea == 1) {
                    $delPageAreaString = $pageList[0]->parent()->outertext;
                    if ($charset != 'UTF-8' && $charset != 'utf-8') {
                        $delPageAreaString = iconv($charset, 'UTF-8//IGNORE', $delPageAreaString);
                    }
                    $content = str_ireplace($delPageAreaString, '', $content);
                }
            } elseif ($page_selector[0] == 1) {
                if (!$hasUTFhtml) {
                    if ($charset != 'UTF-8' && $charset != 'utf-8') {
                        $UTFhtml = $d->save();
                        $UTFhtml = iconv($charset, 'UTF-8//IGNORE', $UTFhtml);
                        $UTFhtml = compress_html($UTFhtml);
                    } else {
                        $UTFhtml = $d->save();
                        $UTFhtml = compress_html($UTFhtml);
                    }
                }
                $pageList = getMatchContent($UTFhtml, $page_selector[1], 1);
                if ($delPageArea == 1) {
                    $content = str_ireplace($pageList, '', $content);
                }
                if ($pageList != '' && $pageList != null) {
                    $dom = str_get_html_ap($pageList);
                    $pageList = $dom->find('a');
                    $dom->clear();
                    unset($dom);
                } else {
                    $pageList = null;
                }
            }
            global $page1content;
            if ($content == $page1content) {
                $isFetch[$url] = 1;
                continue;
            }
            if ($isTest == 0) {
                if (DEL_COMMENT == 1) {
                    $content = filterComment($content);
                }
            }
            if ($paged == 1 && $content != null && $content != '') {
                $content = '<!--nextpage-->' . $content;
            }
            $isFetch[$url] = 1;
            $d->clear();
            unset($d);
            unset($UTFhtml);
            $content .= getNextPageContent($pageList, $autoSet, $content_match_type, $content_selector, $outer, $objective, $index, $page_selector, $paged, $delPageArea, $options, $charset, $baseUrl, $page1URL, $filterAtag, $downAttach, $isTest, $useP1, $useP2, $proxy, $pageURLPattern, $pageNum, $cookie);
            break;
        }
    }
    return $content;
}