Example #1
0
function cot_generate_sbrtags($item_data, $tag_prefix = '', $admin_rights = null, $pagepath_home = false)
{
    global $db, $cot_extrafields, $cfg, $L, $Ls, $R, $db_sbr, $db_sbr_stages, $sys;
    static $extp_first = null, $extp_main = null;
    if (is_null($extp_first)) {
        $extp_first = cot_getextplugins('sbrtags.first');
        $extp_main = cot_getextplugins('sbrtags.main');
    }
    /* === Hook === */
    foreach ($extp_first as $pl) {
        include $pl;
    }
    /* ===== */
    if (!is_array($item_data)) {
        $sql = $db->query("SELECT * FROM {$db_sbr} WHERE sbr_id = '" . (int) $item_data . "' LIMIT 1");
        $item_data = $sql->fetch();
    }
    if ($item_data['sbr_id'] > 0 && !empty($item_data['sbr_title'])) {
        if (is_null($admin_rights)) {
            $admin_rights = cot_auth('plug', 'sbr', 'A');
        }
        $patharray[] = array(cot_url('sbr'), $L['sbr']);
        $patharray[] = array(cot_url('sbr', 'id=' . $item_data['sbr_id']), $item_data['sbr_title']);
        $itempath = cot_breadcrumbs($patharray, $pagepath_home, true);
        $temp_array = array('ID' => $item_data['sbr_id'], 'STATUS' => $item_data['sbr_status'], 'LOCALSTATUS' => $L['sbr_status_' . $item_data['sbr_status']], 'LABELSTATUS' => $R['sbr_labels'][$item_data['sbr_status']], 'URL' => cot_url('sbr', 'id=' . $item_data['sbr_id']), 'TITLE' => $itempath, 'SHORTTITLE' => $item_data['sbr_title'], 'CREATEDATE' => date('d.m.Y H:i', $item_data['sbr_create']), 'CREATEDATE_STAMP' => $item_data['sbr_create'], 'BEGINDATE' => date('d.m.Y H:i', $item_data['sbr_begin']), 'BEGINDATE_STAMP' => $item_data['sbr_begin'], 'DONEDATE' => date('d.m.Y H:i', $item_data['sbr_done']), 'DONEDATE_STAMP' => $item_data['sbr_done'], 'COST' => $item_data['sbr_cost'], 'TAX' => $item_data['sbr_tax'], 'TOTAL' => $item_data['sbr_cost'] + $item_data['sbr_tax'], 'USER_IS_ADMIN' => $admin_rights || $usr['id'] == $item_data['item_userid']);
        if ($admin_rights || $usr['id'] == $item_data['sbr_employer']) {
            $temp_array['ADMIN_EDIT'] = cot_rc_link(cot_url('sbr', 'm=edit&id=' . $item_data['sbr_id']), $L['Edit']);
            $temp_array['ADMIN_EDIT_URL'] = cot_url('sbr', 'm=edit&id=' . $item_data['sbr_id']);
        }
        // Extrafields
        if (isset($cot_extrafields[$db_sbr])) {
            foreach ($cot_extrafields[$db_sbr] as $exfld) {
                $tag = mb_strtoupper($exfld['field_name']);
                $temp_array[$tag . '_TITLE'] = isset($L['sbr_' . $exfld['field_name'] . '_title']) ? $L['sbr_' . $exfld['field_name'] . '_title'] : $exfld['field_description'];
                $temp_array[$tag] = cot_build_extrafields_data('sbr', $exfld, $item_data['item_' . $exfld['field_name']]);
            }
        }
        /* === Hook === */
        foreach ($extp_main as $pl) {
            include $pl;
        }
        /* ===== */
    } else {
        $temp_array = array('TITLE' => !empty($emptytitle) ? $emptytitle : $L['Deleted'], 'SHORTTITLE' => !empty($emptytitle) ? $emptytitle : $L['Deleted']);
    }
    $return_array = array();
    foreach ($temp_array as $key => $val) {
        $return_array[$tag_prefix . $key] = $val;
    }
    return $return_array;
}
Example #2
0
/**
 * Returns all section tags for coTemplate
 *
 * @param string $cat Forums structure cat code
 * @param string $tag_prefix Prefix for tags
 * @param array $stat Category statistics
 *
 * @return array
 */
function cot_generate_sectiontags($cat, $tag_prefix = '', $stat = NULL)
{
    global $cfg, $structure, $cot_extrafields, $usr, $sys, $L, $db_structure;
    $stat['fs_lt_date'] = !empty($stat['fs_lt_date']) ? $stat['fs_lt_date'] : 0;
    $stat['fs_lt_posterid'] = !empty($stat['fs_lt_posterid']) ? $stat['fs_lt_posterid'] : 0;
    $usr['lastvisit'] = !empty($usr['lastvisit']) ? $usr['lastvisit'] : 0;
    $new_elems = $usr['id'] > 0 && $stat['fs_lt_date'] > $usr['lastvisit'] && $stat['fs_lt_posterid'] != $usr['id'];
    $sections = array($tag_prefix . 'CAT' => $cat, $tag_prefix . 'LOCKED' => $structure['forums'][$cat]['locked'], $tag_prefix . 'TITLE' => $structure['forums'][$cat]['title'], $tag_prefix . 'DESC' => cot_parse_autourls($structure['forums'][$cat]['desc']) . ($structure['forums'][$cat]['locked'] ? ' ' . $L['Locked'] : ''), $tag_prefix . 'ICON' => empty($structure['forums'][$cat]['icon']) ? '' : cot_rc('img_structure_cat', array('icon' => $structure['forums'][$cat]['icon'], 'title' => htmlspecialchars($structure['forums'][$cat]['title']), 'desc' => htmlspecialchars($structure['forums'][$cat]['desc']))), $tag_prefix . 'URL' => cot_url('forums', 'm=topics&s=' . $cat), $tag_prefix . 'SECTIONSURL' => cot_url('forums', 'c=' . $cat), $tag_prefix . 'NEWPOSTS' => $new_elems, $tag_prefix . 'CAT_DEFSTATE' => htmlspecialchars($cfg['forums']['cat_' . $cat]['defstate']));
    if (is_array($stat)) {
        if ($stat['fs_lt_date'] > 0) {
            $sections += array($tag_prefix . 'LASTPOSTDATE' => cot_date('datetime_short', $stat['fs_lt_date']), $tag_prefix . 'LASTPOSTER' => cot_build_user($stat['fs_lt_posterid'], htmlspecialchars($stat['fs_lt_postername'])), $tag_prefix . 'LASTPOST' => cot_rc_link($new_elems ? cot_url('forums', 'm=posts&q=' . $stat['fs_lt_id'] . '&n=unread', '#unread') : cot_url('forums', 'm=posts&q=' . $stat['fs_lt_id'] . '&n=last', '#bottom'), cot_cutstring($stat['fs_lt_title'], 32)), $tag_prefix . 'LASTPOST_URL' => $new_elems ? cot_url('forums', 'm=posts&q=' . $stat['fs_lt_id'] . '&n=unread', '#unread') : cot_url('forums', 'm=posts&q=' . $stat['fs_lt_id'] . '&n=last', '#bottom'), $tag_prefix . 'TIMEAGO' => cot_build_timegap($stat['fs_lt_date'], $sys['now']));
        }
        $sections += array($tag_prefix . 'TOPICCOUNT' => $stat['topiccount'], $tag_prefix . 'LASTPOSTDATE_STAMP' => $stat['fs_lt_date'], $tag_prefix . 'POSTCOUNT' => $stat['postcount'], $tag_prefix . 'VIEWCOUNT' => $stat['viewcount'], $tag_prefix . 'VIEWCOUNT_SHORT' => $stat['viewcount'] > 9999 ? floor($stat['viewcount'] / 1000) . 'k' : $stat['viewcount']);
    }
    if (!is_array($stat) || !$stat['fs_lt_date']) {
        $sections[$tag_prefix . 'LASTPOSTDATE'] = '';
        $sections[$tag_prefix . 'LASTPOSTER'] = '';
        $sections[$tag_prefix . 'LASTPOST'] = '';
        $sections[$tag_prefix . 'TIMEAGO'] = '';
        $sections[$tag_prefix . 'TOPICCOUNT'] = 0;
        $sections[$tag_prefix . 'POSTCOUNT'] = 0;
        $sections[$tag_prefix . 'VIEWCOUNT'] = 0;
        $sections[$tag_prefix . 'VIEWCOUNT_SHORT'] = 0;
    }
    foreach ($cot_extrafields[$db_structure] as $exfld) {
        $uname = strtoupper($exfld['field_name']);
        $sections[$tag_prefix . $uname . '_TITLE'] = isset($L['structure_' . $exfld['field_name'] . '_title']) ? $L['structure_' . $exfld['field_name'] . '_title'] : $exfld['field_description'];
        $sections[$tag_prefix . $uname] = cot_build_extrafields_data('structure', $exfld, $structure['forums'][$cat][$exfld['field_name']]);
        $sections[$tag_prefix . $uname . '_VALUE'] = $structure['forums'][$cat][$exfld['field_name']];
    }
    return $sections;
}
    }
    $sqllist = $db->query("SELECT SQL_CALC_FOUND_ROWS p.* {$search_join_columns}\n\t\tFROM {$db_projects} AS p {$search_join_condition}\n\t\tWHERE {$where}\n\t\tORDER BY item_" . $rs['prjsort'] . " " . $rs['prjsort2'] . "\n\t\tLIMIT {$d}, " . $cfg_maxitems . $search_union_query);
    $items = $sql->rowCount();
    $totalitems[] = $db->query('SELECT FOUND_ROWS()')->fetchColumn();
    $jj = 0;
    $sqllist_rowset = $sqllist->fetchAll();
    $sqllist_idset = array();
    foreach ($sqllist_rowset as $item) {
        $sqllist_idset[$item['item_id']] = $item['item_alias'];
    }
    /* === Hook - Part 1 === */
    $extp = cot_getextplugins('projects.search.loop');
    /* ===== */
    foreach ($sqllist_rowset as $row) {
        $url_cat = cot_url('projects', 'c=' . $row['item_cat']);
        $url_prj = empty($row['item_alias']) ? cot_url('projects', 'c=' . $row['item_cat'] . '&id=' . $row['item_id'] . '&highlight=' . $hl) : cot_url('projects', 'c=' . $row['item_cat'] . '&al=' . $row['item_alias'] . '&highlight=' . $hl);
        $t->assign(cot_generate_projecttags($row, 'PLUGIN_PROJECTSRES_'));
        $t->assign(array('PLUGIN_PROJECTSRES_CATEGORY' => cot_rc_link($url_cat, $structure['projects'][$row['item_cat']]['tpath']), 'PLUGIN_PROJECTSRES_CATEGORY_URL' => $url_cat, 'PLUGIN_PROJECTSRES_TITLE' => cot_rc_link($url_prj, htmlspecialchars($row['item_title'])), 'PLUGIN_PROJECTSRES_TEXT' => cot_clear_mark($row['item_text'], $words), 'PLUGIN_PROJECTSRES_TIME' => cot_date('datetime_medium', $row['item_date']), 'PLUGIN_PROJECTSRES_TIMESTAMP' => $row['item_date'], 'PLUGIN_PROJECTSRES_ODDEVEN' => cot_build_oddeven($jj), 'PLUGIN_PROJECTSRES_NUM' => $jj));
        /* === Hook - Part 2 === */
        foreach ($extp as $pl) {
            include $pl;
        }
        /* ===== */
        $t->parse('MAIN.RESULTS.PROJECTS.ITEM');
        $jj++;
    }
    if ($jj > 0) {
        $t->parse('MAIN.RESULTS.PROJECTS');
    }
    unset($where_and, $where_or, $where);
}
Example #4
0
/**
 * Returns all page tags for coTemplate
 *
 * @param mixed $page_data Page Info Array or ID
 * @param string $tag_prefix Prefix for tags
 * @param int $textlength Text truncate
 * @param bool $admin_rights Page Admin Rights
 * @param bool $pagepath_home Add home link for page path
 * @param string $emptytitle Page title text if page does not exist
 * @return array
 * @global CotDB $db
 */
function cot_generate_pagetags($page_data, $tag_prefix = '', $textlength = 0, $admin_rights = null, $pagepath_home = false, $emptytitle = '')
{
    global $db, $cot_extrafields, $cfg, $L, $Ls, $R, $db_pages, $usr, $sys, $cot_yesno, $structure, $db_structure;
    static $extp_first = null, $extp_main = null;
    static $pag_auth = array();
    if (is_null($extp_first)) {
        $extp_first = cot_getextplugins('pagetags.first');
        $extp_main = cot_getextplugins('pagetags.main');
    }
    /* === Hook === */
    foreach ($extp_first as $pl) {
        include $pl;
    }
    /* ===== */
    if (!is_array($page_data)) {
        $sql = $db->query("SELECT * FROM {$db_pages} WHERE page_id = '" . (int) $page_data . "' LIMIT 1");
        $page_data = $sql->fetch();
    }
    if ($page_data['page_id'] > 0 && !empty($page_data['page_title'])) {
        if (is_null($admin_rights)) {
            if (!isset($pag_auth[$page_data['page_cat']])) {
                $pag_auth[$page_data['page_cat']] = cot_auth('page', $page_data['page_cat'], 'RWA1');
            }
            $admin_rights = (bool) $pag_auth[$page_data['page_cat']][2];
        }
        $pagepath = cot_structure_buildpath('page', $page_data['page_cat']);
        $catpath = cot_breadcrumbs($pagepath, $pagepath_home);
        $page_data['page_pageurl'] = empty($page_data['page_alias']) ? cot_url('page', 'c=' . $page_data['page_cat'] . '&id=' . $page_data['page_id']) : cot_url('page', 'c=' . $page_data['page_cat'] . '&al=' . $page_data['page_alias']);
        $page_link[] = array($page_data['page_pageurl'], $page_data['page_title']);
        $page_data['page_fulltitle'] = cot_breadcrumbs(array_merge($pagepath, $page_link), $pagepath_home);
        if (!empty($page_data['page_url']) && $page_data['page_file']) {
            $dotpos = mb_strrpos($page_data['page_url'], ".") + 1;
            $type = mb_strtolower(mb_substr($page_data['page_url'], $dotpos, 5));
            $page_data['page_fileicon'] = cot_rc('page_icon_file_path', array('type' => $type));
            if (!file_exists($page_data['page_fileicon'])) {
                $page_data['page_fileicon'] = cot_rc('page_icon_file_default');
            }
            $page_data['page_fileicon'] = cot_rc('page_icon_file', array('icon' => $page_data['page_fileicon']));
        } else {
            $page_data['page_fileicon'] = '';
        }
        $date_format = 'datetime_medium';
        $text = cot_parse($page_data['page_text'], $cfg['page']['markup'], $page_data['page_parser']);
        $text_cut = cot_cut_more($text);
        if ($textlength > 0 && mb_strlen($text_cut) > $textlength) {
            $text_cut = cot_string_truncate($text_cut, $textlength);
        }
        $cutted = mb_strlen($text) > mb_strlen($text_cut) ? true : false;
        $cat_url = cot_url('page', 'c=' . $page_data['page_cat']);
        $validate_url = cot_url('admin', "m=page&a=validate&id={$page_data['page_id']}&x={$sys['xk']}");
        $unvalidate_url = cot_url('admin', "m=page&a=unvalidate&id={$page_data['page_id']}&x={$sys['xk']}");
        $edit_url = cot_url('page', "m=edit&id={$page_data['page_id']}");
        $delete_url = cot_url('page', "m=edit&a=update&delete=1&id={$page_data['page_id']}&x={$sys['xk']}");
        $page_data['page_status'] = cot_page_status($page_data['page_state'], $page_data['page_begin'], $page_data['page_expire']);
        $temp_array = array('URL' => $page_data['page_pageurl'], 'ID' => $page_data['page_id'], 'TITLE' => $page_data['page_fulltitle'], 'ALIAS' => $page_data['page_alias'], 'STATE' => $page_data['page_state'], 'STATUS' => $page_data['page_status'], 'LOCALSTATUS' => $L['page_status_' . $page_data['page_status']], 'SHORTTITLE' => htmlspecialchars($page_data['page_title'], ENT_COMPAT, 'UTF-8', false), 'CAT' => $page_data['page_cat'], 'CATURL' => $cat_url, 'CATTITLE' => htmlspecialchars($structure['page'][$page_data['page_cat']]['title']), 'CATPATH' => $catpath, 'CATPATH_SHORT' => cot_rc_link($cat_url, htmlspecialchars($structure['page'][$page_data['page_cat']]['title'])), 'CATDESC' => htmlspecialchars($structure['page'][$page_data['page_cat']]['desc']), 'CATICON' => $structure['page'][$page_data['page_cat']]['icon'], 'KEYWORDS' => htmlspecialchars($page_data['page_keywords']), 'DESC' => htmlspecialchars($page_data['page_desc']), 'TEXT' => $text, 'TEXT_CUT' => $text_cut, 'TEXT_IS_CUT' => $cutted, 'DESC_OR_TEXT' => !empty($page_data['page_desc']) ? htmlspecialchars($page_data['page_desc']) : $text, 'MORE' => $cutted ? cot_rc('list_more', array('page_url' => $page_data['page_pageurl'])) : '', 'AUTHOR' => htmlspecialchars($page_data['page_author']), 'OWNERID' => $page_data['page_ownerid'], 'OWNERNAME' => htmlspecialchars($page_data['user_name']), 'DATE' => cot_date($date_format, $page_data['page_date']), 'BEGIN' => cot_date($date_format, $page_data['page_begin']), 'EXPIRE' => cot_date($date_format, $page_data['page_expire']), 'UPDATED' => cot_date($date_format, $page_data['page_updated']), 'DATE_STAMP' => $page_data['page_date'], 'BEGIN_STAMP' => $page_data['page_begin'], 'EXPIRE_STAMP' => $page_data['page_expire'], 'UPDATED_STAMP' => $page_data['page_updated'], 'FILE' => $cot_yesno[$page_data['page_file']], 'FILE_URL' => empty($page_data['page_url']) ? '' : cot_url('page', 'c=' . $page_data['page_cat'] . '&id=' . $page_data['page_id'] . '&a=dl'), 'FILE_SIZE' => $page_data['page_size'] / 1024, 'FILE_SIZE_BYTES' => $page_data['page_size'], 'FILE_SIZE_READABLE' => cot_build_filesize($page_data['page_size'], 1), 'FILE_ICON' => $page_data['page_fileicon'], 'FILE_COUNT' => $page_data['page_filecount'], 'FILE_COUNTTIMES' => cot_declension($page_data['page_filecount'], $Ls['Times']), 'FILE_NAME' => basename($page_data['page_url']), 'COUNT' => $page_data['page_count'], 'ADMIN' => $admin_rights ? cot_rc('list_row_admin', array('unvalidate_url' => $unvalidate_url, 'edit_url' => $edit_url)) : '', 'NOTAVAILABLE' => $page_data['page_begin'] > $sys['now'] ? $L['page_notavailable'] . cot_build_timegap($sys['now'], $pag['page_begin']) : '');
        // Admin tags
        if ($admin_rights) {
            $validate_confirm_url = cot_confirm_url($validate_url, 'page', 'page_confirm_validate');
            $unvalidate_confirm_url = cot_confirm_url($unvalidate_url, 'page', 'page_confirm_unvalidate');
            $delete_confirm_url = cot_confirm_url($delete_url, 'page', 'page_confirm_delete');
            $temp_array['ADMIN_EDIT'] = cot_rc_link($edit_url, $L['Edit']);
            $temp_array['ADMIN_EDIT_URL'] = $edit_url;
            $temp_array['ADMIN_UNVALIDATE'] = $page_data['page_state'] == 1 ? cot_rc_link($validate_confirm_url, $L['Validate'], 'class="confirmLink"') : cot_rc_link($unvalidate_confirm_url, $L['Putinvalidationqueue'], 'class="confirmLink"');
            $temp_array['ADMIN_UNVALIDATE_URL'] = $page_data['page_state'] == 1 ? $validate_confirm_url : $unvalidate_confirm_url;
            $temp_array['ADMIN_DELETE'] = cot_rc_link($delete_confirm_url, $L['Delete'], 'class="confirmLink"');
            $temp_array['ADMIN_DELETE_URL'] = $delete_confirm_url;
        } else {
            if ($usr['id'] == $page_data['page_ownerid']) {
                $temp_array['ADMIN_EDIT'] = cot_rc_link($edit_url, $L['Edit']);
                $temp_array['ADMIN_EDIT_URL'] = $edit_url;
            }
        }
        if (cot_auth('page', 'any', 'W')) {
            $clone_url = cot_url('page', "m=add&c={$page_data['page_cat']}&clone={$page_data['page_id']}");
            $temp_array['ADMIN_CLONE'] = cot_rc_link($clone_url, $L['page_clone']);
            $temp_array['ADMIN_CLONE_URL'] = $clone_url;
        }
        // Extrafields
        if (isset($cot_extrafields[$db_pages])) {
            foreach ($cot_extrafields[$db_pages] as $exfld) {
                $tag = mb_strtoupper($exfld['field_name']);
                $temp_array[$tag . '_TITLE'] = isset($L['page_' . $exfld['field_name'] . '_title']) ? $L['page_' . $exfld['field_name'] . '_title'] : $exfld['field_description'];
                $temp_array[$tag] = cot_build_extrafields_data('page', $exfld, $page_data['page_' . $exfld['field_name']], $page_data['page_parser']);
                $temp_array[$tag . '_VALUE'] = $page_data['page_' . $exfld['field_name']];
            }
        }
        // Extra fields for structure
        if (isset($cot_extrafields[$db_structure])) {
            foreach ($cot_extrafields[$db_structure] as $exfld) {
                $tag = mb_strtoupper($exfld['field_name']);
                $temp_array['CAT_' . $tag . '_TITLE'] = isset($L['structure_' . $exfld['field_name'] . '_title']) ? $L['structure_' . $exfld['field_name'] . '_title'] : $exfld['field_description'];
                $temp_array['CAT_' . $tag] = cot_build_extrafields_data('structure', $exfld, $structure['page'][$page_data['page_cat']][$exfld['field_name']]);
                $temp_array['CAT_' . $tag . '_VALUE'] = $structure['page'][$page_data['page_cat']][$exfld['field_name']];
            }
        }
        /* === Hook === */
        foreach ($extp_main as $pl) {
            include $pl;
        }
        /* ===== */
    } else {
        $temp_array = array('TITLE' => !empty($emptytitle) ? $emptytitle : $L['Deleted'], 'SHORTTITLE' => !empty($emptytitle) ? $emptytitle : $L['Deleted']);
    }
    $return_array = array();
    foreach ($temp_array as $key => $val) {
        $return_array[$tag_prefix . $key] = $val;
    }
    return $return_array;
}
Example #5
0
    $t->assign(array('PM_ROW_ID' => $row['pm_id'], 'PM_ROW_STATE' => $row['pm_tostate'], 'PM_ROW_STAR' => cot_rc($star_class ? 'pm_icon_unstar' : 'pm_icon_star', array('link' => cot_url('pm', 'f=' . $f . '&filter=' . $filter . '&a=star&id=' . $row['pm_id'] . '&d=' . $durl))), 'PM_ROW_STAR_URL' => cot_url('pm', 'f=' . $f . '&filter=' . $filter . '&a=star&id=' . $row['pm_id'] . '&d=' . $durl), 'PM_ROW_DATE' => cot_date('datetime_medium', $row['pm_date']), 'PM_ROW_DATE_STAMP' => $row['pm_date'], 'PM_ROW_TITLE' => cot_rc_link(cot_url('pm', 'm=message&id=' . $row['pm_id']), htmlspecialchars($row['pm_title']), array('class' => $cfg['pm']['turnajax'] ? 'ajax' : '')), 'PM_ROW_URL' => cot_url('pm', 'm=message&id=' . $row['pm_id']), 'PM_ROW_TEXT' => $pm_data, 'PM_ROW_ICON_STATUS' => $row['pm_icon_readstatus'], 'PM_ROW_ICON_STARRED' => $row['pm_icon_starred'], 'PM_ROW_ICON_DELETE' => cot_rc_link($url_delete, $R['pm_icon_trashcan'], array('title' => $L['Delete'], 'class' => $cfg['pm']['turnajax'] ? 'ajax' : '')), 'PM_ROW_ICON_DELETE_CONFIRM' => cot_rc_link(cot_confirm_url($url_delete), $R['pm_icon_trashcan'], array('title' => $L['Delete'], 'class' => $cfg['pm']['turnajax'] ? 'ajax' : '')), 'PM_ROW_DELETE_URL' => $url_delete, 'PM_ROW_DELETE_CONFIRM_URL' => cot_confirm_url($url_delete), 'PM_ROW_ICON_EDIT' => $row['pm_tostate'] == 0 ? cot_rc_link($url_edit, $R['pm_icon_edit'], array('title' => $L['Edit'], 'class' => $cfg['pm']['turnajax'] ? 'ajax' : '')) : '', 'PM_ROW_EDIT_URL' => $row['pm_tostate'] == 0 ? $url_edit : '', 'PM_ROW_DESC' => $pm_desc, 'PM_ROW_ODDEVEN' => cot_build_oddeven($jj), 'PM_ROW_NUM' => $jj));
    $t->assign(cot_generate_usertags($row, 'PM_ROW_USER_'));
    /* === Hook - Part2 : Include === */
    foreach ($extp as $pl) {
        include $pl;
    }
    /* ===== */
    $t->parse('MAIN.PM_ROW');
}
if ($jj == 0) {
    $t->parse('MAIN.PM_ROW_EMPTY');
}
if (!COT_AJAX) {
    $t->parse('MAIN.BEFORE_AJAX');
    $t->parse('MAIN.AFTER_AJAX');
}
$url_newpm = cot_url('pm', 'm=send');
$url_inbox = cot_url('pm');
$url_sentbox = cot_url('pm', 'f=sentbox');
$url_all = cot_url('pm', 'f=' . $f);
$url_unread = cot_url('pm', 'f=' . $f . '&filter=unread');
$url_starred = cot_url('pm', 'f=' . $f . '&filter=starred');
$t->assign(array('PM_PAGETITLE' => cot_breadcrumbs($title, $cfg['homebreadcrumb']), 'PM_SUBTITLE' => $subtitle, 'PM_FORM_UPDATE' => cot_url('pm', cot_xg() . '&f=' . $f . '&filter=' . $filter . '&d=' . $durl), 'PM_SENDNEWPM' => $usr['auth_write'] ? cot_rc_link($url_newpm, $L['pm_sendnew'], $cfg['pm']['turnajax'] ? array('class' => 'ajax') : '') : '', 'PM_SENDNEWPM_URL' => $usr['auth_write'] ? $url_newpm : '', 'PM_INBOX' => cot_rc_link($url_inbox, $L['pm_inbox'], $cfg['pm']['turnajax'] ? array('class' => 'ajax') : ''), 'PM_INBOX_URL' => $url_inbox, 'PM_INBOX_COUNT' => $totalinbox, 'PM_SENTBOX' => cot_rc_link($url_sentbox, $L['pm_sentbox'], $cfg['pm']['turnajax'] ? array('class' => 'ajax') : ''), 'PM_SENTBOX_URL' => $url_sentbox, 'PM_SENTBOX_COUNT' => $totalsentbox, 'PM_FILTER_ALL' => cot_rc_link($url_all, $L['pm_all'], $cfg['pm']['turnajax'] ? array('class' => 'ajax') : ''), 'PM_FILTER_ALL_URL' => $url_all, 'PM_FILTER_UNREAD' => cot_rc_link($url_unread, $L['pm_unread'], $cfg['pm']['turnajax'] ? array('class' => 'ajax') : ''), 'PM_FILTER_UNREAD_URL' => $url_unread, 'PM_FILTER_STARRED' => cot_rc_link($url_starred, $L['pm_starred'], $cfg['pm']['turnajax'] ? array('class' => 'ajax') : ''), 'PM_FILTER_STARRED_URL' => $url_starred, 'PM_PAGEPREV' => $pagenav['prev'], 'PM_PAGENEXT' => $pagenav['next'], 'PM_PAGES' => $pagenav['main'], 'PM_CURRENTPAGE' => $pagenav['current'], 'PM_TOTALPAGES' => $pagenav['total'], 'PM_SENT_TYPE' => $f == 'sentbox' ? $L['Recipient'] : $L['Sender']));
/* === Hook === */
foreach (cot_getextplugins('pm.list.tags') as $pl) {
    include $pl;
}
/* ===== */
$t->parse('MAIN');
$t->out('MAIN');
require_once $cfg['system_dir'] . '/footer.php';
function cot_tag_search_projects($query)
{
    global $db, $t, $L, $lang, $cfg, $usr, $qs, $d, $db_tag_references, $db_projects, $o, $row, $sys;
    if (!cot_module_active('projects')) {
        return;
    }
    $query = cot_tag_parse_query($query, 'p.item_id');
    if (empty($query)) {
        return;
    }
    $totalitems = $db->query("SELECT DISTINCT COUNT(*)\n\t\tFROM {$db_tag_references} AS r LEFT JOIN {$db_projects} AS p\n\t\t\tON r.tag_item = p.item_id\n\t\tWHERE r.tag_area = 'projects' AND ({$query}) AND p.item_state = 0")->fetchColumn();
    switch ($o) {
        case 'title':
            $order = 'ORDER BY `item_title`';
            break;
        case 'date':
            $order = 'ORDER BY `item_date` DESC';
            break;
        case 'category':
            $order = 'ORDER BY `item_cat`';
            break;
        default:
            $order = '';
    }
    /* == Hook == */
    foreach (cot_getextplugins('tags.search.projects.query') as $pl) {
        include $pl;
    }
    /* ===== */
    $sql = $db->query("SELECT DISTINCT p.* {$join_columns}\n\t\tFROM {$db_tag_references} AS r LEFT JOIN {$db_projects} AS p\n\t\t\tON r.tag_item = p.item_id {$join_tables}\n\t\tWHERE r.tag_area = 'projects' AND ({$query}) AND p.item_id IS NOT NULL AND p.item_state = 0 {$join_where}\n\t\t{$order}\n\t\tLIMIT {$d}, {$cfg['maxrowsperpage']}");
    $t->assign('TAGS_RESULT_TITLE', $L['tags_Found_in_projects']);
    $pcount = $sql->rowCount();
    /* == Hook : Part 1 == */
    $extp = cot_getextplugins('tags.search.projects.loop');
    /* ===== */
    if ($pcount > 0) {
        foreach ($sql->fetchAll() as $row) {
            $tags = cot_tag_list($row['item_id'], 'projects');
            $tag_list = '';
            $tag_i = 0;
            foreach ($tags as $tag) {
                $tag_t = $cfg['plugin']['tags']['title'] ? cot_tag_title($tag) : $tag;
                $tag_u = $cfg['plugin']['tags']['translit'] ? cot_translit_encode($tag) : $tag;
                $tl = $lang != 'en' && $tag_u != $tag ? 1 : null;
                if ($tag_i > 0) {
                    $tag_list .= ', ';
                }
                $tag_list .= cot_rc_link(cot_url('plug', array('e' => 'tags', 'a' => 'projects', 't' => str_replace(' ', '-', $tag_u), 'tl' => $tl)), htmlspecialchars($tag_t));
                $tag_i++;
            }
            $t->assign(cot_generate_projecttags($row, 'TAGS_RESULT_ROW_'));
            $t->assign(array('TAGS_RESULT_ROW_TITLE' => htmlspecialchars($row['item_title']), 'TAGS_RESULT_ROW_PATH' => cot_breadcrumbs(cot_structure_buildpath('projects', $row['item_cat']), false), 'TAGS_RESULT_ROW_TAGS' => $tag_list));
            /* == Hook : Part 2 == */
            foreach ($extp as $pl) {
                include $pl;
            }
            /* ===== */
            $t->parse('MAIN.TAGS_RESULT.TAGS_RESULT_ROW');
        }
        $sql->closeCursor();
        $qs_u = $cfg['plugin']['tags']['translit'] ? cot_translit_encode($qs) : $qs;
        $tl = $lang != 'en' && $qs_u != $qs ? 1 : null;
        $pagenav = cot_pagenav('plug', array('e' => 'tags', 'a' => 'projects', 't' => $qs_u, 'tl' => $tl), $d, $totalitems, $cfg['maxrowsperpage']);
        $t->assign(array('TAGS_PAGEPREV' => $pagenav['prev'], 'TAGS_PAGENEXT' => $pagenav['next'], 'TAGS_PAGNAV' => $pagenav['main']));
        /* == Hook == */
        foreach (cot_getextplugins('tags.search.projects.tags') as $pl) {
            include $pl;
        }
        /* ===== */
    }
    if ($pcount == 0) {
        $t->parse('MAIN.TAGS_RESULT.TAGS_RESULT_NONE');
    }
    $t->parse('MAIN.TAGS_RESULT');
}
Example #7
0
$title[] = !$id ? $L['pmsend_title'] : $L['Edit'] . ' #' . $id;
$url_newpm = cot_url('pm', 'm=send');
$url_inbox = cot_url('pm');
$url_sentbox = cot_url('pm', 'f=sentbox');
if (COT_AJAX) {
    // Attach rich text editors to AJAX loaded page
    $rc_tmp = $out['footer_rc'];
    $out['footer_rc'] = '';
    if (is_array($cot_plugins['editor'])) {
        foreach ($cot_plugins['editor'] as $k) {
            if ($k['pl_code'] == $editor && cot_auth('plug', $k['pl_code'], 'R')) {
                include $cfg['plugins_dir'] . '/' . $k['pl_file'];
                break;
            }
        }
    }
    $text_editor_code = $out['footer_rc'];
    $out['footer_rc'] = $rc_tmp;
}
$t->assign(array('PMSEND_TITLE' => cot_breadcrumbs($title, $cfg['homebreadcrumb']), 'PMSEND_SENDNEWPM' => $usr['auth_write'] ? cot_rc_link($url_newpm, $L['pm_sendnew'], array('class' => $cfg['pm']['turnajax'] ? 'ajax' : '')) : '', 'PMSEND_SENDNEWPM_URL' => $usr['auth_write'] ? $url_newpm : '', 'PMSEND_INBOX' => cot_rc_link($url_inbox, $L['pm_inbox'], array('class' => $cfg['pm']['turnajax'] ? 'ajax' : '')), 'PMSEND_INBOX_URL' => $url_inbox, 'PMSEND_INBOX_COUNT' => $totalinbox, 'PMSEND_SENTBOX' => cot_rc_link($url_sentbox, $L['pm_sentbox'], array('class' => $cfg['pm']['turnajax'] ? 'ajax' : '')), 'PMSEND_SENTBOX_URL' => $url_sentbox, 'PMSEND_SENTBOX_COUNT' => $totalsentbox, 'PMSEND_FORM_SEND' => cot_url('pm', 'm=send&a=send' . $idurl), 'PMSEND_FORM_TITLE' => cot_inputbox('text', 'newpmtitle', htmlspecialchars($newpmtitle), 'size="56" maxlength="255"'), 'PMSEND_FORM_TEXT' => cot_textarea('newpmtext', $newpmtext, 8, 56, '', 'input_textarea_editor') . $text_editor_code, 'PMSEND_FORM_TOUSER' => cot_textarea('newpmrecipient', $touser, 3, 56, 'class="userinput"'), 'PMSEND_FORM_NOT_TO_SENTBOX' => cot_checkbox(false, 'fromstate', cot::$L['pm_notmovetosentbox'], '', '3')));
/* === Hook === */
foreach (cot_getextplugins('pm.send.tags') as $pl) {
    include $pl;
}
/* ===== */
if (!$id) {
    $t->parse('MAIN.PMSEND_USERLIST');
}
$t->parse('MAIN');
$t->out('MAIN');
require_once $cfg['system_dir'] . '/footer.php';
Example #8
0
        $jj = 0;
        foreach ($sql_rowset as $pag) {
            $jj++;
            $url = cot_url('index', 'c=' . $pag['page_cat']);
            $news->assign(cot_generate_pagetags($pag, 'PAGE_ROW_', $v[2]));
            $news->assign(array('PAGE_ROW_NEWSPATH' => cot_rc_link($url, htmlspecialchars($structure['page'][$row['page_cat']]['title'])), 'PAGE_ROW_NEWSPATH_URL' => $url, 'PAGE_ROW_CATDESC' => htmlspecialchars($structure['page'][$pag['page_cat']]['desc']), 'PAGE_ROW_OWNER' => cot_build_user($pag['page_ownerid'], htmlspecialchars($pag['user_name'])), 'PAGE_ROW_ODDEVEN' => cot_build_oddeven($jj), 'PAGE_ROW_NUM' => $jj));
            $news->assign(cot_generate_usertags($pag, 'PAGE_ROW_OWNER_'));
            /* === Hook - Part2 : Include === LOOP === */
            foreach ($news_extp as $pl) {
                include $pl;
            }
            /* ===== */
            $news->parse('NEWS.PAGE_ROW');
        }
        $url_newpage = cot_url('page', 'm=add&c=' . $cat);
        $news->assign(array('PAGE_PAGENAV' => $pagenav['main'], 'PAGE_PAGEPREV' => $pagenav['prev'], 'PAGE_PAGENEXT' => $pagenav['next'], 'PAGE_PAGELAST' => $pagenav['last'], 'PAGE_PAGENUM' => $pagenav['current'], 'PAGE_PAGECOUNT' => $pagenav['total'], 'PAGE_ENTRIES_ONPAGE' => $pagenav['onpage'], 'PAGE_ENTRIES_TOTAL' => $pagenav['entries'], 'PAGE_SUBMITNEWPOST' => cot_auth('page', $cat, 'W') ? cot_rc_link($url_newpage, $L['Submitnew']) : '', 'PAGE_SUBMITNEWPOST_URL' => cot_auth('page', $cat, 'W') ? $url_newpage : '', 'PAGE_CATTITLE' => $structure['page'][$cat]['title'], 'PAGE_CATPATH' => cot_breadcrumbs(cot_structure_buildpath('page', $cat), false), 'PAGE_CAT' => $cat));
        /* === Hook - Part2 : Include === TAGS === */
        foreach ($news_tags_extp as $pl) {
            include $pl;
        }
        /* ===== */
        $news->parse('NEWS');
        $news_html = $news->text('NEWS');
        // Cache for guests
        if ($usr['id'] == 0 && $cache && (int) $cfg['plugin']['news']['cache_ttl'] > 0) {
            $cache->disk->store($news_cache_id, $news_html, 'news');
        }
        $t->assign($catn == 0 ? 'INDEX_NEWS' : 'INDEX_NEWS_' . $tagname, $news_html);
        $catn++;
    }
}
Example #9
0
 if ($usr['id'] > 0) {
     $out['adminpanel'] = cot_auth('admin', 'any', 'R') ? cot_rc_link(cot_url('admin'), $L['Administration']) : '';
     $out['loginout_url'] = cot_url('login', 'out=1&' . cot_xg());
     $out['loginout'] = cot_rc_link($out['loginout_url'], $L['Logout']);
     $out['profile'] = cot_rc_link(cot_url('users', 'm=profile'), $L['Profile']);
     $t->assign(array('HEADER_USER_NAME' => $usr['name'], 'HEADER_USER_ADMINPANEL' => $out['adminpanel'], 'HEADER_USER_ADMINPANEL_URL' => cot_url('admin'), 'HEADER_USER_LOGINOUT' => $out['loginout'], 'HEADER_USER_LOGINOUT_URL' => $out['loginout_url'], 'HEADER_USER_PROFILE' => $out['profile'], 'HEADER_USER_PROFILE_URL' => cot_url('users', 'm=profile'), 'HEADER_USER_MESSAGES' => $usr['messages']));
     /* === Hook === */
     foreach (cot_getextplugins('header.user.tags') as $pl) {
         include $pl;
     }
     /* ===== */
     $t->parse('HEADER.USER');
 } else {
     $out['guest_username'] = $R['form_guest_username'];
     $out['guest_password'] = $R['form_guest_password'];
     $out['guest_register'] = cot_rc_link(cot_url('users', 'm=register'), $L['Register']);
     $out['guest_cookiettl'] = $cfg['forcerememberme'] ? $R['form_guest_remember_forced'] : $R['form_guest_remember'];
     $t->assign(array('HEADER_GUEST_SEND' => cot_url('login', 'a=check&' . $sys['url_redirect']), 'HEADER_GUEST_USERNAME' => $out['guest_username'], 'HEADER_GUEST_PASSWORD' => $out['guest_password'], 'HEADER_GUEST_REGISTER' => $out['guest_register'], 'HEADER_GUEST_REGISTER_URL' => cot_url('users', 'm=register'), 'HEADER_GUEST_COOKIETTL' => $out['guest_cookiettl']));
     /* === Hook === */
     foreach (cot_getextplugins('header.guest.tags') as $pl) {
         include $pl;
     }
     /* ===== */
     $t->parse('HEADER.GUEST');
 }
 /* === Hook === */
 foreach (cot_getextplugins('header.tags') as $pl) {
     include $pl;
 }
 /* ===== */
 $t->parse('HEADER');
Example #10
0
        }
        $cot_act[$parents[0]] += $cot_sections_act[$i];
    }
}
$secact_max = count($cot_act) > 0 ? max($cot_act) : 0;
$out['subtitle'] = $L['Forums'];
/* === Hook === */
foreach (cot_getextplugins('forums.sections.main') as $pl) {
    include $pl;
}
/* ===== */
require_once $cfg['system_dir'] . '/header.php';
$t = new XTemplate(cot_tplfile('forums.sections'));
$url_markall = cot_url('forums', "n=markall");
$title[] = array(cot_url('forums'), $L['Forums']);
$t->assign(array('FORUMS_RSS' => cot_url('rss', 'm=forums'), 'FORUMS_SECTIONS_PAGETITLE' => cot_breadcrumbs($title, $cfg['homebreadcrumb']), 'FORUMS_SECTIONS_MARKALL' => $usr['id'] > 0 ? cot_rc_link($url_markall, $L['forums_markallasread']) : '', 'FORUMS_SECTIONS_MARKALL_URL' => $usr['id'] > 0 ? $url_markall : ''));
$xx = 0;
/* === Hook - Part1 : Set === */
$extp = cot_getextplugins('forums.sections.loop');
/* ===== */
/* === Hook - Part1 : Set === */
$extps = cot_getextplugins('forums.sections.loop.sections');
/* ===== */
/* === Hook - Part1 : Set === */
$extpss = cot_getextplugins('forums.sections.loop.subsections');
/* ===== */
foreach ($fstlvl as $x) {
    if (is_array($nxtlvl[$x])) {
        $yy = 0;
        foreach ($nxtlvl[$x] as $y) {
            if (is_array($nxtlvl[$y]) && $cfg['forums']['cat_' . $y]['defstate']) {
Example #11
0
$urr = $sql->fetch();
$out['subtitle'] = $L['Profile'];
$out['head'] .= $R['code_noindex'];
$mskin = cot_tplfile(array('users', 'profile'), 'module');
/* === Hook === */
foreach (cot_getextplugins('users.profile.main') as $pl) {
    include $pl;
}
/* ===== */
require_once $cfg['system_dir'] . '/header.php';
$t = new XTemplate($mskin);
require_once cot_incfile('forms');
$protected = !$cfg['users']['useremailchange'] ? array('disabled' => 'disabled') : array();
$profile_form_email = cot_inputbox('text', 'ruseremail', $urr['user_email'], array('size' => 32, 'maxlength' => 64) + $protected);
$editor_class = $cfg['users']['usertextimg'] ? 'minieditor' : '';
$t->assign(array('USERS_PROFILE_TITLE' => cot_rc_link(cot_url('users', 'm=profile'), $L['pro_title']), 'USERS_PROFILE_SUBTITLE' => $L['pro_subtitle'], 'USERS_PROFILE_DETAILSLINK' => cot_url('users', 'm=details&id=' . $urr['user_id']), 'USERS_PROFILE_EDITLINK' => cot_url('users', 'm=edit&id=' . $urr['user_id']), 'USERS_PROFILE_FORM_SEND' => cot_url('users', "m=profile&a=update&" . cot_xg()), 'USERS_PROFILE_ID' => $urr['user_id'], 'USERS_PROFILE_NAME' => htmlspecialchars($urr['user_name']), 'USERS_PROFILE_MAINGRP' => cot_build_group($urr['user_maingrp']), 'USERS_PROFILE_GROUPS' => cot_build_groupsms($urr['user_id'], FALSE, $urr['user_maingrp']), 'USERS_PROFILE_COUNTRY' => cot_selectbox_countries($urr['user_country'], 'rusercountry'), 'USERS_PROFILE_TEXT' => cot_textarea('rusertext', $urr['user_text'], 8, 56, array('class' => $editor_class)), 'USERS_PROFILE_EMAIL' => $profile_form_email, 'USERS_PROFILE_EMAILPASS' => cot_inputbox('password', 'rmailpass', '', array('size' => 12, 'maxlength' => 32, 'autocomplete' => 'off')), 'USERS_PROFILE_HIDEEMAIL' => cot_radiobox($urr['user_hideemail'], 'ruserhideemail', array(1, 0), array($L['Yes'], $L['No'])), 'USERS_PROFILE_THEME' => cot_selectbox_theme($urr['user_theme'], $urr['user_scheme'], 'rusertheme'), 'USERS_PROFILE_LANG' => cot_selectbox_lang($urr['user_lang'], 'ruserlang'), 'USERS_PROFILE_GENDER' => cot_selectbox_gender($urr['user_gender'], 'rusergender'), 'USERS_PROFILE_BIRTHDATE' => cot_selectbox_date(cot_date2stamp($urr['user_birthdate']), 'short', 'ruserbirthdate', cot_date('Y', $sys['now']), cot_date('Y', $sys['now']) - 100, false), 'USERS_PROFILE_TIMEZONE' => cot_selectbox_timezone($urr['user_timezone'], 'rusertimezone'), 'USERS_PROFILE_REGDATE' => cot_date('datetime_medium', $urr['user_regdate']), 'USERS_PROFILE_REGDATE_STAMP' => $urr['user_regdate'], 'USERS_PROFILE_LASTLOG' => cot_date('datetime_medium', $urr['user_lastlog']), 'USERS_PROFILE_LASTLOG_STAMP' => $urr['user_lastlog'], 'USERS_PROFILE_LOGCOUNT' => $urr['user_logcount'], 'USERS_PROFILE_ADMINRIGHTS' => '', 'USERS_PROFILE_OLDPASS' => cot_inputbox('password', 'roldpass', '', array('size' => 12, 'maxlength' => 32)), 'USERS_PROFILE_NEWPASS1' => cot_inputbox('password', 'rnewpass1', '', array('size' => 12, 'maxlength' => 32, 'autocomplete' => 'off')), 'USERS_PROFILE_NEWPASS2' => cot_inputbox('password', 'rnewpass2', '', array('size' => 12, 'maxlength' => 32, 'autocomplete' => 'off'))));
// Extra fields
if (!empty(cot::$extrafields[cot::$db->users])) {
    foreach (cot::$extrafields[cot::$db->users] as $exfld) {
        $uname = strtoupper($exfld['field_name']);
        $exfld_val = cot_build_extrafields('ruser' . $exfld['field_name'], $exfld, $urr['user_' . $exfld['field_name']]);
        $exfld_title = cot_extrafield_title($exfld, 'user_');
        $t->assign(array('USERS_PROFILE_' . $uname => $exfld_val, 'USERS_PROFILE_' . $uname . '_TITLE' => $exfld_title, 'USERS_PROFILE_EXTRAFLD' => $exfld_val, 'USERS_PROFILE_EXTRAFLD_TITLE' => $exfld_title));
        $t->parse('MAIN.EXTRAFLD');
    }
}
/* === Hook === */
foreach (cot_getextplugins('users.profile.tags') as $pl) {
    include $pl;
}
/* ===== */
Example #12
0
    if (cot_auth('forums', $key, 'R')) {
        $jumpbox[cot_url('forums', "m=topics&s=" . $key, '', true)] = $val['tpath'];
    }
}
function rev($sway)
{
    return $sway == 'desc' ? 'asc' : 'desc';
}
function cursort($trigger, $way)
{
    global $R;
    if ($trigger) {
        return $way == 'asc' ? $R['icon_down'] : $R['icon_up'];
    }
    return '';
}
foreach (array('title', 'viewcount', 'postcount', 'creationdate', 'updated') as $ord) {
    $title_urls[$ord] = cot_url('forums', "m=topics&s={$s}&ord={$ord}&w=" . rev($w));
}
$t->assign(array('FORUMS_TOPICS_PARENT_SECTION_ID' => $s, 'FORUMS_TOPICS_SECTION_RSS' => cot_url('rss', "m=section&c={$s}"), 'FORUMS_TOPICS_PAGETITLE' => $toptitle, 'FORUMS_TOPICS_SHORTTITLE' => htmlspecialchars($structure['forums'][$s]['title']), 'FORUMS_TOPICS_SUBTITLE' => $structure['forums'][$s]['desc'], 'FORUMS_TOPICS_NEWTOPICURL' => cot_url('forums', "m=newtopic&s=" . $s), 'FORUMS_TOPICS_PAGES' => $pagenav['main'], 'FORUMS_TOPICS_PAGEPREV' => $pagenav['prev'], 'FORUMS_TOPICS_PAGENEXT' => $pagenav['next'], 'FORUMS_TOPICS_PAGELAST' => $pagenav['last'], 'FORUMS_TOPICS_PAGECURRENT' => $pagenav['current'], 'FORUMS_TOPICS_PAGETOTAL' => $pagenav['total'], 'FORUMS_TOPICS_PAGEONPAGE' => $pagenav['onpage'], 'FORUMS_TOPICS_PAGEENTRIES' => $pagenav['entries'], 'FORUMS_TOPICS_PRVTOPICS' => $prvtopics, 'FORUMS_TOPICS_JUMPBOX' => cot_selectbox($s, 'jumpbox', array_keys($jumpbox), array_values($jumpbox), false, 'onchange="redirect(this)"'), 'FORUMS_TOPICS_TITLE_TOPICS' => cot_rc_link($title_urls['title'], $L['forums_topics'] . ' ' . cursort($o == 'title', $w), 'rel="nofollow"'), 'FORUMS_TOPICS_TITLE_TOPICS_URL' => $title_urls['title'], 'FORUMS_TOPICS_TITLE_VIEWS' => cot_rc_link($title_urls['viewcount'], $L['Views'] . " " . cursort($o == 'viewcount', $w), 'rel="nofollow"'), 'FORUMS_TOPICS_TITLE_VIEWS_URL' => $title_urls['viewcount'], 'FORUMS_TOPICS_TITLE_POSTS' => cot_rc_link($title_urls['postcount'], $L['forums_posts'] . " " . cursort($o == 'postcount', $w), 'rel="nofollow"'), 'FORUMS_TOPICS_TITLE_POSTS_URL' => $title_urls['postcount'], 'FORUMS_TOPICS_TITLE_REPLIES' => cot_rc_link($title_urls['postcount'], $L['Replies'] . " " . cursort($o == 'postcount', $w), 'rel="nofollow"'), 'FORUMS_TOPICS_TITLE_REPLIES_URL' => $title_urls['postcount'], 'FORUMS_TOPICS_TITLE_STARTED' => cot_rc_link($title_urls['creationdate'], $L['Started'] . " " . cursort($o == 'creationdate', $w), 'rel="nofollow"'), 'FORUMS_TOPICS_TITLE_STARTED_URL' => $title_urls['creationdate'], 'FORUMS_TOPICS_TITLE_LASTPOST' => cot_rc_link($title_urls['updated'], $L['Lastpost'] . " " . cursort($o == 'updated', $w), 'rel="nofollow"'), 'FORUMS_TOPICS_TITLE_LASTPOST_URL' => $title_urls['updated']));
/* === Hook === */
foreach (cot_getextplugins('forums.topics.tags') as $pl) {
    include $pl;
}
/* ===== */
$t->parse('MAIN');
$t->out('MAIN');
require_once $cfg['system_dir'] . '/footer.php';
if ($cache && $usr['id'] === 0 && $cfg['cache_forums']) {
    $cache->page->write();
}
Example #13
0
    }
    if ($files_count > 0) {
        $thumbspagination = $opt == 'thumbs' ? '&opt=thumbs' : '';
        $totalitems = $files_count;
        $pagnavParams = 'f=' . $f;
        if (!empty($more)) {
            $pagnavParams .= '&' . $more;
        }
        $pagnavParams .= $thumbspagination;
        $pagenav = cot_pagenav('pfs', $pagnavParams, $d, $totalitems, $cfg['pfs']['maxpfsperpage']);
        $filesinfolder .= $f > 0 ? $L['pfs_filesinthisfolder'] : $L['pfs_filesintheroot'];
        $t->assign(array('PFS_FILESCOUNT_TITLE' => cot_declension($files_count, $Ls['Files']), 'PFS_ONPAGE_FILES_TITLE' => cot_declension($iji, $Ls['Files']), 'PFS_FILESCOUNT' => $files_count, 'PFS_INTHISFOLDER' => $filesinfolder, 'PFS_ONPAGE_FILES' => $iji, 'PFS_PAGING_PREV' => $pagenav['prev'], 'PFS_PAGING_CURRENT' => $pagenav['main'], 'PFS_PAGING_NEXT' => $pagenav['next']));
    }
}
// ========== Statistics =========
$showthumbs .= $opt != 'thumbs' && $files_count > 0 && $cfg['pfs']['th_amode'] != 'Disabled' ? cot_rc_link(cot_url('pfs', 'f=' . $f . '&' . $more . '&opt=thumbs'), $L['Thumbnails']) : '';
$t->assign(array('PFS_TOTALSIZE' => cot_build_filesize($pfs_totalsize, 1), 'PFS_TOTALSIZE_BYTES' => $pfs_totalsize, 'PFS_TOTALSIZE_KB' => floor($pfs_totalsize / 1024), 'PFS_MAXTOTAL' => cot_build_filesize($maxtotal, 1), 'PFS_MAXTOTAL_BYTES' => $maxtotal, 'PFS_MAXTOTAL_KB' => $maxtotal / 1024, 'PFS_PERCENTAGE' => $maxtotal > 0 ? round($pfs_totalsize / $maxtotal * 100) : 0, 'PFS_MAXFILESIZE' => cot_build_filesize($maxfile, 1), 'PFS_MAXFILESIZE_BYTES' => $maxfile, 'PFS_MAXFILESIZE_KB' => $maxfile / 1024, 'PFS_SHOWTHUMBS' => $showthumbs));
// ========== Upload =========
$t->assign(array('PFS_UPLOAD_FORM_MAX_SIZE' => $maxfile, 'PFS_UPLOAD_FORM_USERID' => $userid));
$t->assign(array('PFS_UPLOAD_FORM_ACTION' => cot_url('pfs', "f={$f}&a=upload&{$more}"), 'PFS_UPLOAD_FORM_FOLDERS' => cot_selectbox_folders($userid, '', $f)));
for ($ii = 0; $ii < $cfg['pfs']['pfsmaxuploads']; $ii++) {
    $t->assign(array('PFS_UPLOAD_FORM_ROW_ID' => $ii, 'PFS_UPLOAD_FORM_ROW_NUM' => $ii + 1));
    $t->parse('MAIN.PFS_UPLOAD_FORM.PFS_UPLOAD_FORM_ROW');
}
$t->parse('MAIN.PFS_UPLOAD_FORM');
// ========== Allowed =========
reset($cot_extensions);
sort($cot_extensions);
foreach ($cot_extensions as $k => $line) {
    $t->assign(array('ALLOWED_ROW_ICON' => $icon[$line[0]], 'ALLOWED_ROW_EXT' => $line[0], 'ALLOWED_ROW_DESC' => $filedesc[$line[0]]));
    $t->parse('MAIN.ALLOWED_ROW');
Example #14
0
    for ($i = 0; $i < $pag['page_totaltabs']; $i++) {
        if (mb_strpos($pag['page_tabs'][$i], '<br />') === 0) {
            $pag['page_tabs'][$i] = mb_substr($pag['page_tabs'][$i], 6);
        }
        $p1 = mb_strpos($pag['page_tabs'][$i], '[title]');
        $p2 = mb_strpos($pag['page_tabs'][$i], '[/title]');
        if ($p2 > $p1 && $p1 < 4) {
            $pag['page_tabtitle'][$i] = mb_substr($pag['page_tabs'][$i], $p1 + 7, $p2 - $p1 - 7);
            if ($i == $pag['page_tab']) {
                $pag['page_tabs'][$i] = trim(str_replace('[title]' . $pag['page_tabtitle'][$i] . '[/title]', '', $pag['page_tabs'][$i]));
            }
        } else {
            $pag['page_tabtitle'][$i] = $i == 0 ? $pag['page_title'] : $L['Page'] . ' ' . ($i + 1);
        }
        $tab_url = empty($al) ? cot_url('page', 'c=' . $pag['page_cat'] . '&id=' . $id . '&pg=' . $i) : cot_url('page', 'c=' . $pag['page_cat'] . '&al=' . $al . '&pg=' . $i);
        $pag['page_tabtitles'][] .= cot_rc_link($tab_url, $i + 1 . '. ' . $pag['page_tabtitle'][$i], array('class' => 'page_tabtitle'));
        $pag['page_tabs'][$i] = str_replace('[newpage]', '', $pag['page_tabs'][$i]);
        $pag['page_tabs'][$i] = preg_replace('#^(<br />)+#', '', $pag['page_tabs'][$i]);
        $pag['page_tabs'][$i] = trim($pag['page_tabs'][$i]);
    }
    $pag['page_tabtitles'] = implode('<br />', $pag['page_tabtitles']);
    $pag['page_text'] = $pag['page_tabs'][$pag['page_tab']];
    // Temporarily disable easypagenav to allow 0-based numbers
    $tmp = $cfg['easypagenav'];
    $cfg['easypagenav'] = false;
    $pn = cot_pagenav('page', empty($al) ? 'id=' . $id : 'al=' . $al, $pag['page_tab'], $pag['page_totaltabs'], 1, 'pg');
    $pag['page_tabnav'] = $pn['main'];
    $cfg['easypagenav'] = $tmp;
    $t->assign(array('PAGE_MULTI_TABNAV' => $pag['page_tabnav'], 'PAGE_MULTI_TABTITLES' => $pag['page_tabtitles'], 'PAGE_MULTI_CURTAB' => $pag['page_tab'] + 1, 'PAGE_MULTI_MAXTAB' => $pag['page_totaltabs'], 'PAGE_TEXT' => $pag['page_text']));
    $t->parse('MAIN.PAGE_MULTI');
}
Example #15
0
            $t->assign('USER_HIDDEN', $L['Hidden']);
        } else {
            continue;
        }
    }
    if ($row['is_user']) {
        $count_users++;
        $url_ipsearch = cot_url('admin', 'm=other&p=ipsearch&a=search&id=' . $row['online_ip'] . '&' . cot_xg());
        $t->assign(array('USER_LOCATION' => htmlspecialchars($row['online_location']), 'USER_SUBLOCATION' => htmlspecialchars($row['online_subloc']), 'USER_IP' => $ipsearch ? cot_rc_link($url_ipsearch, $row['online_ip']) : $row['online_ip'], 'USER_IP_URL' => $ipsearch ? $url_ipsearch : '', 'USER_LINK' => cot_build_user($row['online_userid'], htmlspecialchars($row['online_name'])), 'USER_LASTSEEN' => cot_build_timegap($row['online_lastseen'], $sys['now'])));
        $t->assign(cot_generate_usertags($row, 'USER_'));
        /* === Hook - Part2 : Include === */
        foreach ($users_loop_hook as $pl) {
            include $pl;
        }
        /* ===== */
        $t->parse('MAIN.USERS');
    } else {
        $count_guests++;
        $url_ipsearch = cot_url('admin', 'm=other&p=ipsearch&a=search&id=' . $row['online_ip'] . '&' . cot_xg());
        $t->assign(array('GUEST_LOCATION' => htmlspecialchars($row['online_location']), 'GUEST_SUBLOCATION' => htmlspecialchars($row['online_subloc']), 'GUEST_IP' => $ipsearch ? cot_rc_link($url_ipsearch, $row['online_ip']) : $row['online_ip'], 'GUEST_IP_URL' => $ipsearch ? $url_ipsearch : '', 'GUEST_NUMBER' => $count_guests + $guest_start_num, 'GUEST_LASTSEEN' => cot_build_timegap($row['online_lastseen'], $sys['now'])));
        /* === Hook - Part2 : Include === */
        foreach ($guests_loop_hook as $pl) {
            include $pl;
        }
        /* ===== */
        $t->parse('MAIN.GUESTS');
    }
    //if (($count_users + $count_guests) >= $maxuserssperpage) break;
}
$sql_users->closeCursor();
$t->assign(array('WHO_PAGINATION' => $pagenav['main'], 'WHO_PAGEPREV' => $pagenav['prev'], 'WHO_PAGENEXT' => $pagenav['next'], 'WHO_CURRENTPAGE' => $pagenav['current'], 'WHO_TOTALLINES' => $totallines, 'WHO_MAXPERPAGE' => $maxuserssperpage, 'WHO_TOTALPAGES' => $pagenav['total'], 'STAT_MAXUSERS' => $maxusers, 'STAT_COUNT_USERS' => $who_users, 'STAT_COUNT_GUESTS' => $who_guests, 'USERS' => cot_declension($who_users, $Ls['Members'], true), 'GUESTS' => cot_declension($who_guests, $Ls['Guests'], true)));
Example #16
0
<?php

/* ====================
[BEGIN_COT_EXT]
Hooks=search.page.loop
[END_COT_EXT]
==================== */
/**
 * Displays translated pages in search results
 *
 * @package I18n
 * @copyright (c) Cotonti Team
 * @license https://github.com/Cotonti/Cotonti/blob/master/License.txt
 */
defined('COT_CODE') or die('Wrong URL');
if (!empty($row['ipage_title'])) {
    $page_url = empty($row['page_alias']) ? cot_url('page', 'c=' . $row['page_cat'] . '&id=' . $row['page_id'] . '&l=' . $row['ipage_locale'] . '&highlight=' . $hl) : cot_url('page', 'c=' . $row['page_cat'] . '&al=' . $row['page_alias'] . '&l=' . $row['ipage_locale'] . '&highlight=' . $hl);
    $t->assign(array('PLUGIN_PR_CATEGORY' => cot_breadcrumbs(cot_i18n_build_catpath('page', $row['page_cat'], $row['ipage_locale']), false), 'PLUGIN_PR_TITLE' => cot_rc_link($page_url, htmlspecialchars($row['ipage_title'])), 'PLUGIN_PR_TEXT' => cot_clear_mark($row['ipage_text'], $words), 'PLUGIN_PR_TIME' => cot_date('datetime_medium', $row['ipage_date']), 'PLUGIN_PR_TIMESTAMP' => $row['ipage_date']));
}
Example #17
0
/**
 * Returns group link (button)
 *
 * @param int $grpid Group ID
 * @param bool $title Return group title instead of name
 * @return string
 */
function cot_build_group($grpid, $title = false)
{
    if (empty($grpid)) {
        return '';
    }
    global $cot_groups, $L;
    $type = $title ? 'title' : 'name';
    if ($cot_groups[$grpid]['hidden']) {
        if (cot_auth('users', 'a', 'A')) {
            return cot_rc_link(cot_url('users', 'gm=' . $grpid), $cot_groups[$grpid][$type] . ' (' . $L['Hidden'] . ')');
        } else {
            return $L['Hidden'];
        }
    } else {
        if ($type == 'title' && isset($L['users_grp_' . $grpid . '_title'])) {
            return cot_rc_link(cot_url('users', 'gm=' . $grpid), $L['users_grp_' . $grpid . '_title']);
        }
        return cot_rc_link(cot_url('users', 'gm=' . $grpid), $cot_groups[$grpid][$type]);
    }
}
Example #18
0
/**
 * Builds list of user's groups, editable or not
 *
 * @param int $userid Edited user ID
 * @param bool $edit Permission
 * @param int $maingrp User main group
 * @return string
 * @global CotDB $db
 */
function cot_build_groupsms($userid, $edit = FALSE, $maingrp = 0)
{
    global $db, $db_groups, $db_groups_users, $cot_groups, $L, $usr, $R;
    $memberships = $db->query("SELECT gru_groupid FROM {$db_groups_users}\tWHERE gru_userid = ?", array($userid))->fetchAll();
    foreach ($memberships as $row) {
        $member[$row['gru_groupid']] = TRUE;
    }
    $res = $R['users_code_grplist_begin'];
    foreach ($cot_groups as $k => $i) {
        if ($edit) {
            $checked = $member[$k] ? ' checked="checked"' : '';
            $checked_maingrp = $maingrp == $k ? ' checked="checked"' : '';
            $readonly = $k == COT_GROUP_GUESTS || $k == COT_GROUP_INACTIVE || $k == COT_GROUP_BANNED || $k == COT_GROUP_SUPERADMINS && $userid == 1 ? ' disabled="disabled"' : '';
            $readonly_maingrp = $k == COT_GROUP_GUESTS || $k == COT_GROUP_INACTIVE && $userid == 1 || $k == COT_GROUP_BANNED && $userid == 1 ? ' disabled="disabled"' : '';
        }
        if ($member[$k] || $edit) {
            if (!$cot_groups[$k]['hidden'] || cot_auth('users', 'a', 'A')) {
                $item = '';
                if ($edit) {
                    $item .= cot_rc('users_input_grplist_radio', array('value' => $k, 'name' => 'rusermaingrp', 'checked' => $checked_maingrp, 'title' => '', 'attrs' => $readonly_maingrp));
                    $item .= cot_rc('users_input_grplist_checkbox', array('value' => '1', 'name' => "rusergroupsms[{$k}]", 'checked' => $checked, 'title' => '', 'attrs' => $readonly));
                }
                $item .= $k == COT_GROUP_GUESTS ? $cot_groups[$k]['name'] : cot_rc_link(cot_url('users', 'gm=' . $k), $cot_groups[$k]['name']);
                $item .= $cot_groups[$k]['hidden'] ? ' (' . $L['Hidden'] . ')' : '';
                $rc = $maingrp == $k ? 'users_code_grplist_item_main' : 'users_code_grplist_item';
                $res .= cot_rc($rc, array('item' => $item));
            }
        }
    }
    $res .= $R['users_code_grplist_end'];
    return $res;
}
Example #19
0
            }
            $t->assign(array('I18N_LANG_ROW_URL' => cot_url('page', $urlparams, '', false, true), 'I18N_LANG_ROW_CODE' => $lc, 'I18N_LANG_ROW_TITLE' => $i18n_locales[$lc], 'I18N_LANG_ROW_CLASS' => $lc_class, 'I18N_LANG_ROW_SELECTED' => $lc_selected));
            $t->parse('MAIN.I18N_LANG.I18N_LANG_ROW');
        }
        $t->parse('MAIN.I18N_LANG');
    }
    if ($i18n_write) {
        // Translation tags
        if ($pag_i18n) {
            if ($i18n_admin || $pag_i18n['ipage_translatorid'] == $usr['id']) {
                // Edit translation
                $url_i18n = cot_url('plug', "e=i18n&m=page&a=edit&id={$id}&l={$i18n_locale}");
                $t->assign(array('PAGE_ADMIN_EDIT' => cot_rc_link($url_i18n, $L['Edit']), 'PAGE_ADMIN_EDIT_URL' => $url_i18n));
            }
        } else {
            if (count($pag_i18n_locales) < count($i18n_locales)) {
                // Translate button
                $url_i18n = cot_url('plug', "e=i18n&m=page&a=add&id={$id}");
                $t->assign(array('PAGE_I18N_TRANSLATE' => cot_rc_link($url_i18n, $L['i18n_translate']), 'PAGE_I18N_TRANSLATE_URL' => $url_i18n));
            }
        }
    }
    if ($i18n_admin) {
        // Control tags
        if ($pag_i18n) {
            // Delete translation
            $url_i18n = cot_url('plug', "e=i18n&m=page&a=delete&id={$id}&l={$i18n_locale}");
            $t->assign(array('PAGE_I18N_DELETE' => cot_rc_link($url_i18n, $L['Delete']), 'PAGE_I18N_DELETE_URL' => $url_i18n));
        }
    }
}
<?php

/* ====================
[BEGIN_COT_EXT]
Hooks=admin.structure.tags
Tags=admin.structure.tpl:{ADMIN_STRUCTURE_I18N_LINK}
[END_COT_EXT]
==================== */
/**
 * Locale selection
 *
 * @package I18n
 * @copyright (c) Cotonti Team
 * @license https://github.com/Cotonti/Cotonti/blob/master/License.txt
 */
defined('COT_CODE') or die('Wrong URL');
$t->assign(array('ADMIN_STRUCTURE_I18N_LINK' => cot_rc_link(cot_url('plug', 'e=i18n&m=structure'), $L['i18n_structure']), 'ADMIN_STRUCTURE_I18N_URL' => cot_url('plug', 'e=i18n&m=structure')));
Example #21
0
     $where_and['or'] = '(' . implode(' OR ', $where_or) . ')';
     $where_and = array_diff($where_and, array(''));
     $where = implode(' AND ', $where_and);
     $maxitems = $cfg_maxitems - $items;
     $maxitems = $maxitems < 0 ? 0 : $maxitems;
     if (!$db->fieldExists($db_forum_topics, "ft_{$rs['frmsort']}")) {
         $rs['frmsort'] = 'updated';
     }
     $sql = $db->query("SELECT SQL_CALC_FOUND_ROWS p.*, t.*\n\t\t\t \tFROM {$db_forum_posts} AS p, {$db_forum_topics} AS t\n\t\t\t\tWHERE {$where} AND p.fp_topicid = t.ft_id\n\t\t\t\tGROUP BY t.ft_id ORDER BY ft_" . $rs['frmsort'] . " " . $rs['frmsort2'] . "\n\t\t\t\tLIMIT {$d}, {$maxitems}");
     $items = $sql->rowCount();
     $totalitems[] = $db->query('SELECT FOUND_ROWS()')->fetchColumn();
     $jj = 0;
     while ($row = $sql->fetch()) {
         if ($row['ft_updated'] > 0) {
             $post_url = $cfg['plugin']['search']['searchurl'] == 'Single' ? cot_url('forums', 'm=posts&id=' . $row['fp_id'] . '&highlight=' . $hl) : cot_url('forums', 'm=posts&p=' . $row['fp_id'] . '&highlight=' . $hl, '#' . $row['fp_id']);
             $t->assign(array('PLUGIN_FR_CATEGORY' => cot_breadcrumbs(cot_forums_buildpath($row['ft_cat']), false), 'PLUGIN_FR_TITLE' => cot_rc_link($post_url, htmlspecialchars($row['ft_title'])), 'PLUGIN_FR_TITLE_URL' => $post_url, 'PLUGIN_FR_TEXT' => cot_clear_mark($row['fp_text'], $words), 'PLUGIN_FR_TIME' => $row['ft_updated'] > 0 ? cot_date('datetime_medium', $row['ft_updated']) : cot_date('datetime_medium', $row['fp_updated']), 'PLUGIN_FR_TIMESTAMP' => $row['ft_updated'] > 0 ? $row['ft_updated'] : $row['fp_updated'], 'PLUGIN_FR_ODDEVEN' => cot_build_oddeven($jj), 'PLUGIN_FR_NUM' => $jj));
             $t->parse('MAIN.RESULTS.FORUMS.ITEM');
         }
         $jj++;
     }
     $sql->closeCursor();
     if ($jj > 0) {
         $t->parse('MAIN.RESULTS.FORUMS');
     }
 }
 /* === Hook === */
 foreach (cot_getextplugins('search.list') as $pl) {
     include $pl;
 }
 /* ===== */
 if (array_sum($totalitems) < 1) {
Example #22
0
<?php

/* ====================
[BEGIN_COT_EXT]
Hooks=news.loop
[END_COT_EXT]
==================== */
/**
 * Modifies news selection to display
 * localized entries only
 *
 * @package I18n
 * @copyright (c) Cotonti Team
 * @license https://github.com/Cotonti/Cotonti/blob/master/License.txt
 */
defined('COT_CODE') or die('Wrong URL');
if ($i18n_enabled && $i18n_notmain) {
    // Overwrite some tags
    $i18n_urlp = !$cfg['plugin']['i18n']['omitmain'] || $i18n_locale != $cfg['defaultlang'] ? '&l=' . $i18n_locale : '';
    $news->assign(array('PAGE_ROW_NEWSPATH' => cot_rc_link(cot_url('index', 'c=' . $pag['page_cat'] . $i18n_urlp), htmlspecialchars($cat_i18n['title'])), 'PAGE_ROW_CATDESC' => htmlspecialchars($cat_i18n['desc'])));
}
Example #23
0
/**
 * Returns all product tags for coTemplate
 *
 * @param mixed $item_data product Info Array or ID
 * @param string $tag_prefix Prefix for tags
 * @param int $textlength Text truncate
 * @param bool $admin_rights product Admin Rights
 * @param bool $pagepath_home Add home link for page path
 * @param string $emptytitle Page title text if page does not exist
 * @return array
 * @global CotDB $db
 */
function cot_generate_markettags($item_data, $tag_prefix = '', $textlength = 0, $admin_rights = null, $pagepath_home = false, $emptytitle = '')
{
    global $db, $cot_extrafields, $cfg, $L, $Ls, $R, $db_market, $usr, $sys, $cot_yesno, $structure, $db_structure;
    static $extp_first = null, $extp_main = null;
    if (is_null($extp_first)) {
        $extp_first = cot_getextplugins('markettags.first');
        $extp_main = cot_getextplugins('markettags.main');
    }
    /* === Hook === */
    foreach ($extp_first as $pl) {
        include $pl;
    }
    /* ===== */
    if (!is_array($item_data)) {
        $sql = $db->query("SELECT * FROM {$db_market} WHERE item_id = '" . (int) $item_data . "' LIMIT 1");
        $item_data = $sql->fetch();
    }
    if ($item_data['item_id'] > 0 && !empty($item_data['item_title'])) {
        if (is_null($admin_rights)) {
            $admin_rights = cot_auth('market', $item_data['item_cat'], 'A');
        }
        $item_data['item_pageurl'] = empty($item_data['item_alias']) ? cot_url('market', 'c=' . $item_data['item_cat'] . '&id=' . $item_data['item_id']) : cot_url('market', 'c=' . $item_data['item_cat'] . '&al=' . $item_data['item_alias']);
        $catpatharray[] = array(cot_url('market'), $L['market']);
        $itempatharray[] = array($item_data['item_pageurl'], $item_data['item_title']);
        $patharray = array_merge($catpatharray, cot_structure_buildpath('market', $item_data['item_cat']), $itempatharray);
        $itempath = cot_breadcrumbs($patharray, $pagepath_home, true);
        $patharray = array_merge($catpatharray, cot_structure_buildpath('market', $item_data['item_cat']));
        $catpath = cot_breadcrumbs($patharray, $pagepath_home, true);
        $text = cot_parse($item_data['item_text'], $cfg['market']['markup'], $item_data['item_parser']);
        $text_cut = (int) $textlength > 0 ? cot_string_truncate($text, $textlength) : $text;
        $item_data['item_status'] = cot_market_status($item_data['item_state']);
        $temp_array = array('ID' => $item_data['item_id'], 'ALIAS' => $item_data['item_alias'], 'STATE' => $item_data['item_state'], 'STATUS' => $item_data['item_status'], 'LOCALSTATUS' => $L['market_status_' . $item_data['item_status']], 'URL' => $item_data['item_pageurl'], 'USER_PRDURL' => cot_url('users', 'm=details&id=' . $item_data['item_userid'] . '&u=' . $item_data['user_name'] . '&tab=market'), 'TITLE' => $itempath, 'SHORTTITLE' => $item_data['item_title'], 'CAT' => $item_data['item_cat'], 'CATTITLE' => htmlspecialchars($structure['market'][$item_data['item_cat']]['title']), 'CATURL' => cot_url('market', 'c=' . $item_data['item_cat']), 'CATPATH' => $catpath, 'TEXT' => $text, 'SHORTTEXT' => $text_cut, 'COST' => number_format($item_data['item_cost'], '0', '.', ' '), 'DATE' => cot_date('datetime_medium', $item_data['item_date']), 'DATE_STAMP' => $item_data['item_date'], 'SHOW_URL' => $item_data['item_pageurl'], 'COUNT' => $item_data['item_count'], 'USER_IS_ADMIN' => $admin_rights || $usr['id'] == $item_data['item_userid']);
        if ($admin_rights || $usr['id'] == $item_data['item_userid']) {
            $temp_array['ADMIN_EDIT'] = cot_rc_link(cot_url('market', 'm=edit&id=' . $item_data['item_id']), $L['Edit']);
            $temp_array['ADMIN_EDIT_URL'] = cot_url('market', 'm=edit&id=' . $item_data['item_id']);
            $temp_array['HIDEPRODUCT_URL'] = cot_url('market', 'm=edit&id=' . $item_data['item_id'] . ($item_data['item_state'] == 1 ? '&a=public' : '&a=hide'));
            $temp_array['HIDEPRODUCT_TITLE'] = $item_data['item_state'] == 1 ? $L['Publish'] : $L['Hide'];
        }
        // Extrafields
        if (isset($cot_extrafields[$db_market])) {
            foreach ($cot_extrafields[$db_market] as $exfld) {
                $tag = mb_strtoupper($exfld['field_name']);
                $temp_array[$tag . '_TITLE'] = isset($L['market_' . $exfld['field_name'] . '_title']) ? $L['market_' . $exfld['field_name'] . '_title'] : $exfld['field_description'];
                $temp_array[$tag] = cot_build_extrafields_data('market', $exfld, $item_data['item_' . $exfld['field_name']]);
            }
        }
        // Extra fields for structure
        if (isset($cot_extrafields[$db_structure])) {
            foreach ($cot_extrafields[$db_structure] as $exfld) {
                $tag = mb_strtoupper($exfld['field_name']);
                $temp_array['CAT_' . $tag . '_TITLE'] = isset($L['structure_' . $exfld['field_name'] . '_title']) ? $L['structure_' . $exfld['field_name'] . '_title'] : $exfld['field_description'];
                $temp_array['CAT_' . $tag] = cot_build_extrafields_data('structure', $exfld, $structure['market'][$item_data['item_cat']][$exfld['field_name']]);
            }
        }
        /* === Hook === */
        foreach ($extp_main as $pl) {
            include $pl;
        }
        /* ===== */
    } else {
        $temp_array = array('TITLE' => !empty($emptytitle) ? $emptytitle : $L['Deleted'], 'SHORTTITLE' => !empty($emptytitle) ? $emptytitle : $L['Deleted']);
    }
    $return_array = array();
    foreach ($temp_array as $key => $val) {
        $return_array[$tag_prefix . $key] = $val;
    }
    return $return_array;
}
Example #24
0
} elseif (empty($id) && empty($u) && $usr['id'] > 0) {
    $id = $usr['id'];
}
cot_die(empty($id), true);
$sql = $db->query("SELECT * FROM {$db_users} WHERE user_id={$id} LIMIT 1");
cot_die($sql->rowCount() == 0, true);
$urr = $sql->fetch();
$title_params = array('USER' => $L['User'], 'NAME' => $urr['user_name']);
$out['subtitle'] = cot_title('title_users_details', $title_params);
$mskin = cot_tplfile(array('users', 'details'), 'module');
/* === Hook === */
foreach (cot_getextplugins('users.details.main') as $pl) {
    include $pl;
}
/* ===== */
require_once $cfg['system_dir'] . '/header.php';
$t = new XTemplate($mskin);
$t->assign(cot_generate_usertags($urr, 'USERS_DETAILS_', '', true));
$t->assign(array('USERS_DETAILS_TITLE' => cot_breadcrumbs(array(array(cot_url('users'), $L['Users']), array(cot_url('users', 'm=details&id=' . $urr['user_id'] . '&u=' . $urr['user_name']), $urr['user_name'])), $cfg['homebreadcrumb']), 'USERS_DETAILS_SUBTITLE' => $L['use_subtitle']));
/* === Hook === */
foreach (cot_getextplugins('users.details.tags') as $pl) {
    include $pl;
}
/* ===== */
if ($usr['isadmin']) {
    $t->assign(array('USERS_DETAILS_ADMIN_EDIT' => cot_rc_link(cot_url('users', 'm=edit&id=' . $urr['user_id']), $L['Edit']), 'USERS_DETAILS_ADMIN_EDIT_URL' => cot_url('users', 'm=edit&id=' . $urr['user_id'])));
    $t->parse('MAIN.USERS_DETAILS_ADMIN');
}
$t->parse('MAIN');
$t->out('MAIN');
require_once $cfg['system_dir'] . '/footer.php';
Example #25
0
/**
 * Search by tag in forums
 *
 * @param string $query User-entered query string
 * @global CotDB $db
 */
function cot_tag_search_forums($query)
{
    global $db, $t, $L, $lang, $cfg, $usr, $qs, $d, $db_tag_references, $db_forum_topics, $o, $row;
    if (!cot_module_active('forums')) {
        return;
    }
    $query = cot_tag_parse_query($query, 't.ft_id');
    if (empty($query)) {
        return;
    }
    $maxperpage = cot::$cfg['maxrowsperpage'] && is_numeric(cot::$cfg['maxrowsperpage']) && cot::$cfg['maxrowsperpage'] > 0 ? cot::$cfg['maxrowsperpage'] : 15;
    $join_columns = '';
    $join_tables = '';
    $join_where = '';
    switch ($o) {
        case 'title':
            $order = 'ORDER BY `ft_title`';
            break;
        case 'date':
            $order = 'ORDER BY `ft_updated` DESC';
            break;
        case 'category':
            $order = 'ORDER BY `ft_cat`';
            break;
        default:
            $order = '';
    }
    /* == Hook == */
    foreach (cot_getextplugins('tags.search.forums.query') as $pl) {
        include $pl;
    }
    /* ===== */
    $totalitems = $db->query("SELECT DISTINCT COUNT(*)\n\t\tFROM {$db_tag_references} AS r LEFT JOIN {$db_forum_topics} AS t\n\t\t\tON r.tag_item = t.ft_id {$join_tables}\n\t\tWHERE r.tag_area = 'forums' AND ({$query}) {$join_where}")->fetchColumn();
    $sql = $db->query("SELECT DISTINCT t.ft_id, t.ft_cat, t.ft_title {$join_columns}\n\t\tFROM {$db_tag_references} AS r LEFT JOIN {$db_forum_topics} AS t\n\t\t\tON r.tag_item = t.ft_id {$join_tables}\n\t\tWHERE r.tag_area = 'forums' AND ({$query}) AND t.ft_id IS NOT NULL {$join_where}\n\t\t{$order}\n\t\tLIMIT {$d}, {$maxperpage}");
    $t->assign('TAGS_RESULT_TITLE', $L['tags_Found_in_forums']);
    if ($sql->rowCount() > 0) {
        while ($row = $sql->fetch()) {
            $tags = cot_tag_list($row['ft_id'], 'forums');
            $tag_list = '';
            $tag_i = 0;
            foreach ($tags as $tag) {
                $tag_t = $cfg['plugin']['tags']['title'] ? cot_tag_title($tag) : $tag;
                $tag_u = $cfg['plugin']['tags']['translit'] ? cot_translit_encode($tag) : $tag;
                $tl = $lang != 'en' && $tag_u != $tag ? 1 : null;
                if ($tag_i > 0) {
                    $tag_list .= ', ';
                }
                $tag_list .= cot_rc_link(cot_url('plug', array('e' => 'tags', 'a' => 'forums', 't' => str_replace(' ', '-', $tag_u), 'tl' => $tl)), htmlspecialchars($tag_t));
                $tag_i++;
            }
            $master = $row['fs_masterid'] > 0 ? array($row['fs_masterid'], $row['fs_mastername']) : false;
            $t->assign(array('TAGS_RESULT_ROW_URL' => cot_url('forums', 'm=posts&q=' . $row['ft_id']), 'TAGS_RESULT_ROW_TITLE' => htmlspecialchars($row['ft_title']), 'TAGS_RESULT_ROW_PATH' => cot_breadcrumbs(cot_forums_buildpath($row['ft_cat']), false), 'TAGS_RESULT_ROW_TAGS' => $tag_list));
            $t->parse('MAIN.TAGS_RESULT.TAGS_RESULT_ROW');
        }
        $sql->closeCursor();
        $qs_u = $cfg['plugin']['tags']['translit'] ? cot_translit_encode($qs) : $qs;
        $tl = $lang != 'en' && $qs_u != $qs ? 1 : null;
        $pagenav = cot_pagenav('plug', array('e' => 'tags', 'a' => 'forums', 't' => $qs_u, 'tl' => $tl), $d, $totalitems, $maxperpage);
        $t->assign(array('TAGS_PAGEPREV' => $pagenav['prev'], 'TAGS_PAGENEXT' => $pagenav['next'], 'TAGS_PAGNAV' => $pagenav['main']));
    } else {
        $t->parse('MAIN.TAGS_RESULT.TAGS_RESULT_NONE');
    }
    $t->parse('MAIN.TAGS_RESULT');
}
Example #26
0
File: Main.php Project: Alex300/brs
 /**
  * Вывод баненров ajax
  */
 public function ajxLoadAction()
 {
     global $sys;
     $ret = array('error' => '');
     $brs = cot_import('brs', 'P', 'ARR');
     if (!$brs) {
         $ret['error'] = 'Nothing to load';
         echo json_encode($ret);
         exit;
     }
     $nullDate = date('Y-m-d H:i:s', 0);
     // 1970-01-01 00:00:00
     // Пока выбыраем баненры по одному,
     // @todo оптимизировать
     $baseCondition = array(array('published', 1), array('publish_up', date('Y-m-d H:i:s', cot::$sys['now']), '<='), array('SQL', "publish_down >='" . date('Y-m-d H:i:s', cot::$sys['now']) . "' OR publish_down ='{$nullDate}'"), array('SQL', "imptotal = 0 OR impressions < imptotal"));
     $cnt = 0;
     foreach ($brs as $pid => $data) {
         $pid = (int) $pid;
         if (empty($data['category'])) {
             $ret['items'][$pid] = '';
             continue;
         } else {
             $cat = cot_import($data['category'], 'D', 'TXT');
         }
         if ($pid == 0) {
             continue;
         }
         if (empty($cat)) {
             $ret['items'][$pid] = '';
             continue;
         }
         $condition = $baseCondition;
         $condition[] = array('category', $cat);
         $client = false;
         if (!empty($data['client'])) {
             $client = cot_import($data['client'], 'D', 'INT');
         }
         if ($client) {
             $condition[] = array('client', $client);
         }
         $order = 'order';
         if (!empty($data['order'])) {
             $order = cot_import($data['order'], 'D', 'TXT');
         }
         $ord = "lastimp ASC";
         if ($order == 'rand') {
             $ord = 'RAND()';
         }
         //            $banner = brs_model_Banner::find($condition, 1, 0, $ord);
         $banner = brs_model_Banner::fetchOne($condition, $ord);
         if (empty($banner)) {
             $ret['items'][$pid] = '';
             continue;
         }
         $banner->impress();
         $url = cot_url('brs', 'a=click&id=' . $banner->id);
         switch ($banner->type) {
             case brs_model_Banner::TYPE_IMAGE:
                 if (!empty($banner->file)) {
                     $image = cot_rc('banner_image', array('file' => $banner->file, 'alt' => $banner->alt, 'width' => $banner->width, 'height' => $banner->height));
                     if (!empty($banner->clickurl)) {
                         $image = cot_rc_link($url, $image, array('target' => '_blank'));
                     }
                     $ret['items'][$pid] = cot_rc('banner', array('banner' => $image));
                 }
                 break;
             case brs_model_Banner::TYPE_FLASH:
                 if (!empty($banner->file)) {
                     $image = cot_rc('banner_flash', array('file' => $banner->file, 'width' => $banner->width, 'height' => $banner->height));
                     if (!empty($banner->clickurl)) {
                         $image = cot_rc_link($url, $image, array('target' => '_blank'));
                     }
                     $ret['items'][$pid] = cot_rc('banner', array('banner' => $image));
                 }
                 break;
             case brs_model_Banner::TYPE_CUSTOM:
                 $ret['items'][$pid] = cot_rc('banner', array('banner' => $banner->customcode));
                 break;
         }
         $cnt++;
     }
     echo json_encode($ret);
     exit;
 }
Example #27
0
    if (!empty(cot::$extrafields[cot::$db->contact])) {
        foreach (cot::$extrafields[cot::$db->contact] as $exfld) {
            $tag = mb_strtoupper($exfld['field_name']);
            $exfld_val = cot_build_extrafields_data('contact', $exfld, $row['contact_' . $exfld['field_name']]);
            $exfld_title = cot_extrafield_title($exfld, 'contact_');
            $tuman->assign(array('CONTACT_' . $tag . '_TITLE' => $exfld_title, 'CONTACT_' . $tag => $exfld_val, 'CONTACT_' . $tag . '_VALUE' => $row['contact_' . $exfld['field_name']], 'CONTACT_EXTRAFLD_TITLE' => $exfld_title, 'CONTACT_EXTRAFLD' => $exfld['field_type'] == 'file' ? cot_rc_link($cfg['extrafield_files_dir'] . '/' . $exfld_val, $exfld_val) : $exfld_val, 'CONTACT_EXTRAFLD_VALUE' => $row['contact_' . $exfld['field_name']]));
            $tuman->parse('MAIN.DATA.EXTRAFLD');
        }
    }
    $tuman->parse('MAIN.DATA');
}
$sql->closeCursor();
if ($a == '' && !empty($id)) {
    $row = $db->query("SELECT * FROM " . cot::$db->contact . " WHERE contact_id = {$id}")->fetch();
    $tuman->assign(array('CONTACT_DATE' => cot_date('date_full', $row['contact_date']), 'CONTACT_DATE_STAMP' => $row['contact_date'], 'CONTACT_USER' => $row['contact_authorid'] > 0 ? cot_build_user($row['contact_authorid'], $row['contact_author']) : $row['contact_author'], 'CONTACT_EMAIL' => $row['contact_email'], 'CONTACT_ID' => $row['contact_id'], 'CONTACT_DELLINK' => cot_url('admin', 'm=other&p=contact&a=del&id=' . $row['contact_id']), 'CONTACT_VAL' => $row['contact_val'] == 1 ? 'unval' : 'val', 'CONTACT_VALLINK' => cot_url('admin', 'm=other&p=contact&a=' . $val . '&id=' . $row['contact_id']), 'CONTACT_READLINK' => cot_url('admin', 'm=other&p=contact&a=val&id=' . $row['contact_id']), 'CONTACT_UNREADLINK' => cot_url('admin', 'm=other&p=contact&a=unval&id=' . $row['contact_id']), 'CONTACT_SUBJECT' => $row['contact_subject'], 'CONTACT_TEXT' => $row['contact_text'], 'CONTACT_REPLY' => $row['contact_reply'], 'CONTACT_FORM_SEND' => cot_url("admin", 'm=other&p=contact&a=send&id=' . $row['contact_id']), 'CONTACT_FORM_TEXT' => cot_textarea('rtext', $rtext, 8, 64)));
    // Extrafields
    if (!empty(cot::$extrafields[cot::$db->contact])) {
        foreach (cot::$extrafields[cot::$db->contact] as $exfld) {
            $tag = mb_strtoupper($exfld['field_name']);
            $exfld_val = cot_build_extrafields_data('contact', $exfld, $row['contact_' . $exfld['field_name']]);
            $exfld_title = cot_extrafield_title($exfld, 'contact_');
            $tuman->assign(array('CONTACT_' . $tag . '_TITLE' => $exfld_title, 'CONTACT_' . $tag => $exfld_val, 'CONTACT_' . $tag . '_VALUE' => $row['contact_' . $exfld['field_name']], 'CONTACT_EXTRAFLD_TITLE' => $exfld_title, 'CONTACT_EXTRAFLD' => $exfld['field_type'] == 'file' ? cot_rc_link($cfg['extrafield_files_dir'] . '/' . $exfld_val, $exfld_val) : $exfld_val, 'CONTACT_EXTRAFLD_VALUE' => $row['contact_' . $exfld['field_name']]));
            $tuman->parse('MAIN.VIEW.EXTRAFLD');
        }
    }
    $tuman->parse('MAIN.VIEW');
}
cot_display_messages($tuman);
$tuman->assign(array('CONTACT_PAGINATION' => $pagnav['main'], 'CONTACT_PREV' => $pagenav['prev'], 'CONTACT_NEXT' => $pagenav['next']));
$tuman->parse('MAIN');
$plugin_body .= $tuman->text('MAIN');
Example #28
0
<?php

/* ====================
[BEGIN_COT_EXT]
Hooks=header.main
Tags=header.tpl:{HEADER_USER_PMS},{HEADER_USER_PMREMINDER}
[END_COT_EXT]
==================== */
/**
 * PM header notices
 *
 * @package PM
 * @copyright (c) Cotonti Team
 * @license https://github.com/Cotonti/Cotonti/blob/master/License.txt
 */
defined('COT_CODE') or die('Wrong URL.');
if ($usr['id'] > 0) {
    $out['pms'] = cot_rc_link(cot_url('pm'), $L['Private_Messages']);
    require_once cot_incfile('pm', 'module');
    if ($usr['newpm']) {
        $usr['messages'] = $db->query("SELECT COUNT(*) FROM {$db_pm} WHERE pm_touserid='" . $usr['id'] . "' AND pm_tostate=0")->fetchColumn();
    }
    $out['pmreminder'] = cot_rc_link(cot_url('pm'), $usr['messages'] > 0 ? cot_declension($usr['messages'], $Ls['Privatemessages']) : $L['hea_noprivatemessages']);
    $t->assign(array('HEADER_USER_PM_URL' => cot_url('pm'), 'HEADER_USER_PMS' => $out['pms'], 'HEADER_USER_PMREMINDER' => $out['pmreminder']));
}
if ($cfg['pm']['css'] && $env['ext'] == 'pm') {
    Resources::linkFile($cfg['modules_dir'] . '/pm/tpl/pm.css');
}
<?php

/* ====================
[BEGIN_COT_EXT]
Hooks=tags.search.pages.loop
[END_COT_EXT]
==================== */
/**
 * Tag search for i18n pages
 *
 * @package I18n
 * @copyright (c) Cotonti Team
 * @license https://github.com/Cotonti/Cotonti/blob/master/License.txt
 */
defined('COT_CODE') or die('Wrong URL');
if (!empty($row['ipage_title'])) {
    $tags = cot_tag_list($row['page_id'], 'pages', array('tag_locale' => $row['ipage_locale']));
    $tag_list = '';
    $tag_i = 0;
    foreach ($tags as $tag) {
        $tag_t = $cfg['plugin']['tags']['title'] ? cot_tag_title($tag) : $tag;
        $tag_u = $cfg['plugin']['tags']['translit'] ? cot_translit_encode($tag) : $tag;
        $tl = $lang != 'en' && $tag_u != $tag ? 1 : null;
        if ($tag_i > 0) {
            $tag_list .= ', ';
        }
        $tag_list .= cot_rc_link(cot_url('plug', array('e' => 'tags', 'a' => 'pages', 't' => str_replace(' ', '-', $tag_u), 'tl' => $tl)), htmlspecialchars($tag_t), 'rel="nofollow"');
        $tag_i++;
    }
    $t->assign(array('TAGS_RESULT_ROW_URL' => empty($row['page_alias']) ? cot_url('page', 'c=' . $row['page_cat'] . '&id=' . $row['page_id'] . '&l=' . $row['ipage_locale']) : cot_url('page', 'c=' . $row['page_cat'] . '&al=' . $row['page_alias'] . '&l=' . $row['ipage_locale']), 'TAGS_RESULT_ROW_TITLE' => htmlspecialchars($row['ipage_title']), 'TAGS_RESULT_ROW_PATH' => cot_breadcrumbs(cot_i18n_build_catpath('page', $row['page_cat'], $row['ipage_locale']), false), 'TAGS_RESULT_ROW_TAGS' => $tag_list));
}
Example #30
0
<?php

/* ====================
[BEGIN_COT_EXT]
Hooks=header.tags
Tags=header.tpl:{HEADER_USER_PFS}
[END_COT_EXT]
==================== */
/**
 * PFS header link
 *
 * @package PFS
 * @copyright (c) Cotonti Team
 * @license https://github.com/Cotonti/Cotonti/blob/master/License.txt
 */
defined('COT_CODE') or die('Wrong URL.');
if ($usr['id'] > 0 && $cot_groups[$usr['maingrp']]['pfs_maxtotal'] > 0 && $cot_groups[$usr['maingrp']]['pfs_maxfile'] > 0) {
    $pfs_url = cot_url('pfs');
    $out['pfs'] = cot_rc_link($pfs_url, $L['Mypfs']);
    $t->assign(array('HEADER_USER_PFS' => $out['pfs'], 'HEADER_USER_PFS_URL' => $pfs_url));
}