コード例 #1
0
ファイル: ajax.php プロジェクト: innova-market/JobExpert
    $arrNews = $news->getNews("id=" . secure::escQuoteData($_POST['getNewsDetail']));
    $smarty->assignByRef('arrNews', $arrNews);
    $smarty->display('user.news.detail.tpl');
} elseif (!empty($_GET['getAnnounceData']) && ('vacancy' === $_GET['getAnnounceData'] || 'resume' === $_GET['getAnnounceData']) && !empty($_POST['unikey'])) {
    $objAnnounce = new $_GET['getAnnounceData']();
    if (empty($_SESSION['sd_user']['data']['id'])) {
        die('{"result":"error", "error":"' . ERROR_DATA . '"}');
        // ошибка: объявление не существует
    } elseif (!$objAnnounce->getAnnounceByUnikey($_POST['unikey'], "id_user IN (" . secure::escQuoteData($_SESSION['sd_user']['data']['id']) . ") AND token IN ('active')")) {
        die('{"result":"error", "error":"' . ERROR_ANNOUNCE_NOT_EXISTS . '"}');
        // ошибка: объявление не существует
    } else {
        $chpu = new chpu();
        $smarty->assignByRef('chpu', $chpu);
        $return_data = $objAnnounce->retAnnSubj();
        $sections = new sections();
        $arrDataSections = $sections->retCategorys();
        $smarty->assignByRef('sections', $arrDataSections);
        $professions = new professions();
        $arrDataProfession = $professions->retCategorysByIds($return_data['id_profession']);
        $smarty->assignByRef('professions', $arrDataProfession);
        $regions = new regions();
        $arrDataRegions = $regions->retCategorys();
        $smarty->assignByRef('regions', $arrDataRegions);
        $citys = new citys();
        $arrDataCity = $citys->retCategorysByIds($return_data['id_city']);
        $smarty->assignByRef('citys', $arrDataCity);
        $smarty->assignByRef('return_data', $return_data);
        echo $smarty->fetch($_GET['getAnnounceData'] . '.responce.tpl');
    }
} elseif (isset($_POST['addComment']) && isset($_POST['newsId'])) {
コード例 #2
0
require 'header.php';
echo '<br>';
$msg = $messagesC->get_message($message_id);
$msg_resp = $messagesC->get_message($msg['referer']);
/* Check if message is news, article or gallery root */
$thread = $threadsC->get_thread($msg['tid']);
$is_news = $is_gallery = false;
if ($thread['cid'] == $msg['id']) {
    switch ($thread['section']) {
        case NEWS_SECTION_ID:
            if (!empty($thread['prooflink'])) {
                $prooflink = '>>> <a href="' . $thread['prooflink'] . '">Подробнее</a>';
            } else {
                $prooflink = '';
            }
            $subsection_image = 'themes/' . $theme . '/icons/' . sections::get_subsection_icon($thread['subsection']);
            $is_news = true;
            break;
        case GALLERY_SECTION_ID:
            $img_thumb_link = 'images/gallery/thumbs/' . $thread['file'] . '_small.png';
            $img_link = 'images/gallery/' . $thread['file'] . '.' . $thread['extension'];
            $size = $thread['image_size'] . ', ' . $thread['file_size'];
            $is_gallery = true;
            break;
    }
}
$reply = '';
if (!empty($msg_resp)) {
    $user_filter = $usersC->get_filter($_SESSION['user_id']);
    $user_filter_arr = $filtersC->parse_filter_string($user_filter);
    if ($messagesC->is_filtered($user_filter_arr, $msg_resp['filters'])) {
コード例 #3
0
ファイル: sections.php プロジェクト: rair/yacs
 /**
  * get sections as radio buttons
  *
  * This allow to move a page to a parent section, or to a child section
  *
  * @param string the current anchor to an existing section (e.g., 'section:12')
  * @param int id of the section that is moved
  * @return the HTML to insert in the page
  *
  * @see articles/edit.php
  * @see articles/import.php
  * @see files/edit.php
  * @see images/edit.php
  * @see links/edit.php
  * @see panel.php
  * @see skins/upload.php
  */
 public static function &get_radio_buttons($current = NULL, $me = NULL)
 {
     global $context;
     // we put radio buttons in a string
     $text = '';
     // get section id from reference
     if (!strncmp($current, 'section:', 8)) {
         $current = substr($current, 8);
     }
     // get the current parent, if any
     $item = Sections::get($current);
     // list all children sections of parent
     $children = '';
     if (isset($item['id'])) {
         $query = "SELECT * FROM " . SQL::table_name('sections') . " AS sections" . " WHERE (anchor LIKE 'section:" . $item['id'] . "')" . " ORDER BY sections.rank, sections.title, sections.edit_date DESC LIMIT 5000";
         if ($result = SQL::query($query)) {
             while ($row = SQL::fetch($result)) {
                 if ($children) {
                     $children .= BR;
                 }
                 // prevent anchoring to myself
                 if ($row['id'] == $me) {
                     $children .= '<input type="radio" name="anchor" value="section:' . $row['id'] . '" disabled="disabled" /> <i>' . Codes::beautify_title($row['title']) . '</i>';
                 } else {
                     $children .= '<input type="radio" name="anchor" value="section:' . $row['id'] . '" /> ' . Codes::beautify_title($row['title']);
                 }
             }
         }
     }
     // list sections at the same level as parent
     $family = '';
     if (isset($item['anchor']) && ($granparent = Anchors::get($item['anchor']))) {
         // limit to accessible scope
         $query = "SELECT * FROM " . SQL::table_name('sections') . " AS sections" . " WHERE (anchor LIKE '" . $item['anchor'] . "') AND " . sections::get_sql_where() . " ORDER BY sections.rank, sections.title, sections.edit_date DESC LIMIT 5000";
         if ($result = SQL::query($query)) {
             // brothers and sisters of parent
             while ($row = SQL::fetch($result)) {
                 if ($family && strncmp(substr($family, -6), '</div>', 6)) {
                     $family .= BR;
                 }
                 if ($row['id'] == $item['id']) {
                     if ($children) {
                         $family .= '<input type="radio" name="anchor" value="section:' . $item['id'] . '" checked="checked" /> ' . Codes::beautify_title($item['title']) . '<div style="margin: 0 0 0 3em">' . $children . '</div>';
                     } else {
                         $family .= '<input type="radio" name="anchor" value="section:' . $item['id'] . '" checked="checked" /> ' . Codes::beautify_title($item['title']);
                     }
                 } else {
                     $family .= '<input type="radio" name="anchor" value="section:' . $row['id'] . '" /> ' . Codes::beautify_title($row['title']);
                 }
             }
         }
         // move to granparent
         if ($granparent->is_assigned()) {
             $family = '<input type="radio" name="anchor" value="' . $granparent->get_reference() . '" /> ' . $granparent->get_title() . '<div style="margin: 0 0 0 3em">' . $family . '</div>';
         } else {
             $family = '<input type="radio" name="anchor" value="' . $granparent->get_reference() . '"  disabled="disabled" /> ' . $granparent->get_title() . '<div style="margin: 0 0 0 3em">' . $family . '</div>';
         }
         // list top-level sections
     } else {
         // at the very top of the content tree
         if (surfer::is_associate()) {
             $family .= '<input type="radio" name="anchor" value="" ' . (!isset($item['id']) ? 'checked="checked"' : '') . ' /> ' . i18n::s('Top of the content tree') . BR . '<div style="margin: 0 0 0 3em">';
         }
         // restrict to accessible scope
         $where = sections::get_sql_where();
         // always mention current and parent sections
         if ($me) {
             $where .= " OR (sections.id=" . $me . ")";
         }
         if ($current) {
             $where .= " OR (sections.id=" . $current . ")";
         }
         // list regular sections first
         $query = "SELECT * FROM " . SQL::table_name('sections') . " AS sections" . " WHERE (sections.anchor='' OR sections.anchor IS NULL) AND (" . $where . ")" . " AND (sections.index_map = 'Y')" . " ORDER BY sections.rank, sections.title, sections.edit_date DESC LIMIT 5000";
         if ($result = SQL::query($query)) {
             // process all matching sections
             while ($row = SQL::fetch($result)) {
                 if ($row['id'] == $item['id']) {
                     if ($children) {
                         $family .= '<input type="radio" name="anchor" value="section:' . $item['id'] . '" checked="checked" /> ' . Codes::beautify_title($item['title']) . '<div style="margin: 0 0 0 3em">' . $children . '</div>';
                     } else {
                         $family .= '<input type="radio" name="anchor" value="section:' . $item['id'] . '" checked="checked" /> ' . Codes::beautify_title($item['title']) . BR;
                     }
                 } elseif (!Surfer::is_associate()) {
                     continue;
                 } elseif ($row['id'] == $me) {
                     $family .= '<input type="radio" name="anchor" disabled="disabled" /> ' . Codes::beautify_title($row['title']) . BR;
                 } else {
                     $family .= '<input type="radio" name="anchor" value="section:' . $row['id'] . '" /> ' . Codes::beautify_title($row['title']) . BR;
                 }
             }
         }
         // close the top of the content tree
         if (surfer::is_associate()) {
             $family .= '</div>';
         }
         // list special sections to associates
         if (Surfer::is_associate()) {
             $query = "SELECT * FROM " . SQL::table_name('sections') . " AS sections" . " WHERE (sections.anchor='' OR sections.anchor IS NULL)" . " AND (sections.index_map != 'Y')" . " ORDER BY sections.rank, sections.title, sections.edit_date DESC LIMIT 5000";
             if ($result = SQL::query($query)) {
                 $family .= '<hr />';
                 // process all matching sections
                 while ($row = SQL::fetch($result)) {
                     if ($row['id'] == $item['id']) {
                         if ($children) {
                             $family .= '<input type="radio" name="anchor" value="section:' . $item['id'] . '" checked="checked" /> ' . Codes::beautify_title($item['title']) . '<div style="margin: 0 0 0 3em">' . $children . '</div>';
                         } else {
                             $family .= '<input type="radio" name="anchor" value="section:' . $item['id'] . '" checked="checked" /> ' . Codes::beautify_title($item['title']) . BR;
                         }
                     } else {
                         $family .= '<input type="radio" name="anchor" value="section:' . $row['id'] . '" /> ' . Codes::beautify_title($row['title']) . BR;
                     }
                 }
             }
         }
     }
     $text .= $family;
     // at least show where we are
     if (!$text && isset($item['id'])) {
         $text .= '<input type="hidden" name="anchor" value="section:' . $item['id'] . '" />' . Codes::beautify_title($item['title']);
     }
     return $text;
 }
コード例 #4
0
 $arrSubscr = $subscription->getSubscriptions($strWhere, false, $arrLimit, false);
 // формируем страницы
 $allRecords = $subscription->cntSubscriptions();
 // получаем общее количество
 $strPages = strings::generatePage($allRecords, $offset, CONF_SUBSCRIPTIONS_STRINGS_PERPAGE_ADMIN_PANEL, $path, true);
 // формируем странциы
 $smarty->assignByRef('arrSubscr', $arrSubscr);
 $smarty->assignByRef('allRecords', $allRecords);
 //передаем в шаблон общее количество записей
 $smarty->assignByRef('strPages', $strPages);
 //передаем в шаблон строку сформированных страниц
 /**
  * РАБОТА СО СЛОВАРЯМИ
  */
 // инициализация списка разделов
 $sections = new sections();
 // инициализация списка регионов
 $regions = new regions();
 // передаем массив селекта "Раздел"
 $smarty->assign('sections', $sections->retCategorys());
 // передаем массив селекта "Регион"
 $smarty->assign('regions', $regions->retCategorys());
 // если массив подписок не пустой
 // формируем списки для вывода городов и профессий
 if ($arrSubscr) {
     $arrProfId = array();
     $arrCitysId = array();
     foreach ($arrSubscr as $value) {
         $value['id_profession'] ? $arrProfId[] = $value['id_profession'] : null;
         $value['id_city'] ? $arrCitysId[] = $value['id_city'] : null;
     }
コード例 #5
0
 $comment_id = $unconfirmed[$i]['cid'];
 $filter_list = $filtersC->get_filter_list($unconfirmed[$i]['filters']);
 $active_filters = $filtersC->get_active_filters($filter_list, $user_filter_list);
 $is_filtered = $messagesC->is_filtered($user_filter_arr, $unconfirmed[$i]['filters']);
 $subject = $unconfirmed[$i]['subject'];
 $comment = $unconfirmed[$i]['comment'];
 $usr = $usersC->get_user_info($unconfirmed[$i]['uid']);
 $coreC->validate_boolean($usr['banned']) ? $author = '<s>' . $usr['nick'] . '</s>' : ($author = $usr['nick']);
 $author_profile = 'user_' . $usr['nick'];
 $timestamp = $coreC->to_local_time_zone($unconfirmed[$i]['timest']);
 $aprove_link = 'approve_thread_' . $thread_id;
 $edit_link = 'message_' . $comment_id . ':edit';
 $thr_link = 'thread_' . $thread_id . '_page_1';
 switch ($unconfirmed[$i]['section']) {
     case NEWS_SECTION_ID:
         $subsection_image = '/themes/' . $theme . '/icons/' . sections::get_subsection_icon($unconfirmed[$i]['subsection']);
         if (!empty($unconfirmed[$i]['prooflink'])) {
             $prooflink = '>>> <a href="' . $unconfirmed[$i]['prooflink'] . '">Подробнее</a>';
         } else {
             $prooflink = '';
         }
         require 'themes/' . $theme . '/templates/view_all/news.tpl.php';
         break;
     case ARTICLES_SECTION_ID:
         require 'themes/' . $theme . '/templates/view_all/art.tpl.php';
         break;
     case GALLERY_SECTION_ID:
         $img_link = '/images/gallery/' . $unconfirmed[$i]['file'] . '.' . $unconfirmed[$i]['extension'];
         $img_thumb_link = '/images/gallery/thumbs/' . $unconfirmed[$i]['file'] . '_small.png';
         $size = $unconfirmed[$i]['image_size'] . ', ' . $unconfirmed[$i]['file_size'];
         require 'themes/' . $theme . '/templates/view_all/gallery.tpl.php';
コード例 #6
0
 function __construct()
 {
     self::$baseC = new base();
 }
コード例 #7
0
ファイル: duplicate.php プロジェクト: rair/yacs
    }
    // action has to be confirmed
} elseif (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] == 'POST') {
    Logger::error(i18n::s('The action has not been confirmed.'));
    // please confirm
} else {
    // the section or the anchor icon, if any
    $context['page_image'] = $item['icon_url'];
    if (!$context['page_image'] && is_object($anchor)) {
        $context['page_image'] = $anchor->get_icon_url();
    }
    // commands
    $menu = array();
    $menu[] = Skin::build_submit_button(i18n::s('Yes, I want to duplicate this section'), NULL, NULL, 'confirmed');
    if (isset($item['id'])) {
        $menu[] = Skin::build_link(sections::get_permalink($item), i18n::s('Cancel'), 'span');
    }
    // render commands
    $context['text'] .= '<form method="post" action="' . $context['script_url'] . '" id="main_form"><p>' . "\n" . Skin::finalize_list($menu, 'menu_bar') . '<input type="hidden" name="id" value="' . $item['id'] . '" />' . "\n" . '<input type="hidden" name="action" value="duplicate" />' . "\n" . '</p></form>' . "\n";
    // set the focus
    Page::insert_script('$("#confirmed").focus();');
    // the title of the action
    $context['text'] .= Skin::build_block($item['title'], 'title');
    // the introduction text, if any
    $context['text'] .= '<div style="margin: 1em 0;">' . Codes::beautify($item['introduction']) . '</div>' . "\n";
    // get text related to the overlay, if any
    if (is_object($overlay)) {
        $context['text'] .= $overlay->get_text('view', $item);
    }
    // details
    $details = array();
コード例 #8
0
ファイル: sections.php プロジェクト: contao-bootstrap/layout
 * @author     David Molineus <*****@*****.**>
 * @copyright  2014-2015 netzmacht creative David Molineus
 * @license    LGPL 3.0
 * @filesource
 *
 */
namespace Netzmacht\Bootstrap\Layout\Migrate;

class sections
{
    public function execute()
    {
        \BackendUser::getInstance();
        $database = \Database::getInstance();
        if (!$database->fieldExists('bootstrap_sections', 'tl_layout')) {
            return;
        }
        // make sure flexible sections exists
        if (!$database->fieldExists('flexible_sections', 'tl_layout')) {
            $database->query('ALTER TABLE tl_layout ADD flexible_sections blob NULL');
        }
        $query = <<<SQL
UPDATE tl_layout
SET    flexible_sections=bootstrap_sections
WHERE  bootstrap_sections != '' AND flexible_sections IS NULL
SQL;
        $database->query($query);
    }
}
$controller = new sections();
$controller->execute();
コード例 #9
0
 /**
  * list sections as rows in a table
  *
  * @param resource the SQL result
  * @return string the rendered text
  **/
 function layout($result)
 {
     global $context;
     // we return some text
     $text = '';
     // empty list
     if (!SQL::count($result)) {
         return $text;
     }
     // we list pages for one surfer
     // sanity check
     if (!isset($this->focus)) {
         $this->focus = Surfer::get_id();
     }
     // build a list of sections
     Skin::define_img('CHECKED_IMG', 'ajax/accept.png', '*');
     $rows = array();
     include_once $context['path_to_root'] . 'comments/comments.php';
     include_once $context['path_to_root'] . 'links/links.php';
     while ($item = SQL::fetch($result)) {
         // get the related overlay
         $overlay = Overlay::load($item, 'section:' . $item['id']);
         // get the anchor
         $anchor = Anchors::get($item['anchor']);
         // the url to view this item
         $url = sections::get_permalink($item);
         // reset everything
         $summary = $update = $owner = $editor = $watcher = '';
         if ($item['activation_date'] >= $context['now']) {
             $summary .= DRAFT_FLAG;
         } elseif ($item['expiry_date'] > NULL_DATE && $item['expiry_date'] <= $context['now']) {
             $summary .= EXPIRED_FLAG;
         }
         // signal restricted and private sections
         if ($item['active'] == 'N') {
             $summary .= PRIVATE_FLAG;
         } elseif ($item['active'] == 'R') {
             $summary .= RESTRICTED_FLAG;
         }
         // indicate the id in the hovering popup
         $hover = i18n::s('View the page');
         if (Surfer::is_member()) {
             $hover .= ' [section=' . $item['id'] . ']';
         }
         // use the title to label the link
         if (is_object($overlay)) {
             $label = Codes::beautify_title($overlay->get_text('title', $item));
         } else {
             $label = Codes::beautify_title($item['title']);
         }
         // use the title as a link to the page
         $summary .= Skin::build_link($url, $label, 'basic', $hover);
         // signal locked sections
         if (isset($item['locked']) && $item['locked'] == 'Y' && Sections::is_owned($item, $anchor)) {
             $summary .= ' ' . LOCKED_FLAG;
         }
         // flag sections updated recently
         if ($item['expiry_date'] > NULL_DATE && $item['expiry_date'] <= $context['now']) {
             $summary .= ' ' . EXPIRED_FLAG;
         } elseif ($item['create_date'] >= $context['fresh']) {
             $summary .= ' ' . NEW_FLAG;
         } elseif ($item['edit_date'] >= $context['fresh']) {
             $summary .= ' ' . UPDATED_FLAG;
         }
         // insert overlay data, if any
         if (is_object($overlay)) {
             $summary .= $overlay->get_text('list', $item);
         }
         // attachment details
         $details = array();
         // info on related sections
         if ($count = Sections::count_for_anchor('section:' . $item['id'])) {
             $details[] = sprintf(i18n::ns('%d section', '%d sections', $count), $count);
         }
         // info on related articles
         if ($count = Articles::count_for_anchor('section:' . $item['id'])) {
             $details[] = sprintf(i18n::ns('%d page', '%d pages', $count), $count);
         }
         // info on related files
         if ($count = Files::count_for_anchor('section:' . $item['id'], TRUE)) {
             $details[] = sprintf(i18n::ns('%d file', '%d files', $count), $count);
         }
         // info on related links
         if ($count = Links::count_for_anchor('section:' . $item['id'], TRUE)) {
             $details[] = sprintf(i18n::ns('%d link', '%d links', $count), $count);
         }
         // comments
         if ($count = Comments::count_for_anchor('section:' . $item['id'], TRUE)) {
             $details[] = sprintf(i18n::ns('%d comment', '%d comments', $count), $count);
         }
         // the main anchor link
         if (is_object($anchor) && (!isset($this->focus) || $item['anchor'] != $this->focus)) {
             $details[] = sprintf(i18n::s('in %s'), Skin::build_link($anchor->get_url(), ucfirst($anchor->get_title()), 'basic'));
         }
         // combine in-line details
         if (count($details)) {
             $summary .= BR . '<span class="details">' . trim(implode(' &middot; ', $details)) . '</span>';
         }
         // display all tags
         if ($item['tags']) {
             $summary .= BR . '<span class="tags">' . Skin::build_tags($item['tags'], 'section:' . $item['id']) . '</span>';
         }
         // watcher
         if (Sections::is_watched($item['id'], $this->focus)) {
             $watcher = CHECKED_IMG;
         }
         // editor
         if (Sections::is_editable($anchor, $item, $this->focus, TRUE)) {
             $editor = CHECKED_IMG;
         }
         // owner
         if (Sections::is_owned($item, NULL, TRUE, $this->focus)) {
             $owner = CHECKED_IMG;
         }
         // this is another row of the output
         $cells = array($summary, $watcher, $editor, $owner);
         // append this row
         $rows[] = $cells;
     }
     // end of processing
     SQL::free($result);
     // headers
     $headers = array(i18n::s('Section'), i18n::s('Watcher'), i18n::s('Editor'), i18n::s('Owner'));
     // return a sortable table
     $text .= Skin::table($headers, $rows, 'yc-grid');
     return $text;
 }