コード例 #1
0
/**
 * Вывод сообщений пользователю
 * @param string $rc - ресурс.
 * @param string $message - сообщение.
 * @param bool $header - подключение скрипта в тпл.
 * @return num - возвращаем обработанное сообщение.
 */
function karma_error($rc, $message, $header = false)
{
    global $kr;
    $kr->assign("TEXT_ERROR", cot_rc($rc, array('txt' => $message)));
    if ($header) {
        $kr->parse("MAIN.ERROR.HEADER");
    }
    $kr->parse("MAIN.ERROR");
    return $kr->text("MAIN.ERROR");
}
コード例 #2
0
ファイル: sbr.main.php プロジェクト: cotemplate/cot-sbr
 }
 // Выплата Заказчику
 if ($payemployer > 0) {
     $payinfo['pay_userid'] = $sbr['sbr_employer'];
     $payinfo['pay_area'] = 'balance';
     $payinfo['pay_code'] = 'sbr:' . $id . ';stage:' . $num;
     $payinfo['pay_summ'] = $payemployer;
     $payinfo['pay_cdate'] = $sys['now'];
     $payinfo['pay_pdate'] = $sys['now'];
     $payinfo['pay_adate'] = $sys['now'];
     $payinfo['pay_status'] = 'done';
     $payinfo['pay_desc'] = cot_rc($L['sbr_claim_payments_employer_desc'], array('sbr_title' => $sbr['sbr_title'], 'stage_title' => $stage['stage_title'], 'stage_num' => $stage['stage_num']));
     $db->insert($db_payments, $payinfo);
 }
 cot_sbr_sendpost($id, cot_rc($L['sbr_posts_performer_stage_claim_decision_payment'], array('sbr_title' => $sbr['sbr_title'], 'stage_title' => $stage['stage_title'], 'stage_num' => $stage['stage_num'], 'payperformer' => !empty($payperformer) ? $payperformer : 0, 'payemployer' => !empty($payemployer) ? $payemployer : 0, 'decision' => $rtext, 'valuta' => $cfg['payments']['valuta'])), $sbr['sbr_performer'], 0, 'warning', true);
 cot_sbr_sendpost($id, cot_rc($L['sbr_posts_employer_stage_claim_decision_payment'], array('sbr_title' => $sbr['sbr_title'], 'stage_title' => $stage['stage_title'], 'stage_num' => $stage['stage_num'], 'payperformer' => !empty($payperformer) ? $payperformer : 0, 'payemployer' => !empty($payemployer) ? $payemployer : 0, 'decision' => $rtext, 'valuta' => $cfg['payments']['valuta'])), $sbr['sbr_employer'], 0, 'warning', true);
 // Запуск следующего этапа на исполнение, если он существует
 $nextstagenum = $num + 1;
 if ($nstageid = $db->query("SELECT stage_id FROM {$db_sbr_stages} WHERE stage_sid=" . $id . " AND stage_num=" . $nextstagenum)->fetchColumn()) {
     $nstage['stage_begin'] = $sys['now'];
     $nstage['stage_status'] = 'process';
     $db->update($db_sbr_stages, $nstage, "stage_id=" . $nstageid);
 }
 //  Если нет этапов на исполнении, то завершить сделку полностью
 $notstartedstages = (bool) $db->query("SELECT COUNT(*) FROM {$db_sbr_stages} WHERE stage_sid=" . $id . " AND stage_status='process'")->fetchColumn();
 if (!$notstartedstages) {
     $rsbr['sbr_done'] = $sys['now'];
     $rsbr['sbr_status'] = 'done';
     $db->update($db_sbr, $rsbr, "sbr_id=" . $id);
     cot_sbr_sendpost($id, $L['sbr_posts_performer_done'], $sbr['sbr_performer'], 0, 'success', true);
     cot_sbr_sendpost($id, $L['sbr_posts_employer_done'], $sbr['sbr_employer'], 0, 'success', true);
コード例 #3
0
ファイル: sbr.functions.php プロジェクト: cotemplate/cot-sbr
function cot_sbr_sendpost($id, $text, $to, $from = 0, $type = '', $mail = false, $rfiles = array())
{
    global $db, $db_sbr_posts, $db_sbr, $db_sbr_files, $db_users, $sys, $cfg, $L, $R;
    $rpost['post_sid'] = $id;
    $rpost['post_text'] = $text;
    $rpost['post_date'] = $sys['now'];
    $rpost['post_from'] = $from;
    $rpost['post_to'] = $to;
    $rpost['post_type'] = $type;
    /* === Hook === */
    foreach (cot_getextplugins('sbr.post.add.query') as $pl) {
        include $pl;
    }
    /* ===== */
    if ($db->insert($db_sbr_posts, $rpost)) {
        $postid = $db->lastInsertId();
        $sbr_path = $cfg['plugin']['sbr']['filepath'] . '/' . $id . '/';
        if (!file_exists($sbr_path)) {
            mkdir($sbr_path);
            @chmod($sbr_path, $cfg['dir_perms']);
        }
        for ($j = 0; $j < 10; $j++) {
            if ($rfiles['size'][$j] > 0 && $rfiles['error'][$j] == 0) {
                $u_tmp_name_file = $rfiles['tmp_name'][$j];
                $u_type_file = $rfiles['type'][$j];
                $u_name_file = $rfiles['name'][$j];
                $u_size_file = $rfiles['size'][$j];
                $u_name_file = str_replace("\\'", '', $u_name_file);
                $u_name_file = trim(str_replace("\"", '', $u_name_file));
                $dotpos = strrpos($u_name_file, ".") + 1;
                $f_extension = substr($u_name_file, $dotpos, 5);
                if (!empty($u_tmp_name_file)) {
                    $fcheck = cot_file_check($u_tmp_name_file, $u_name_file, $f_extension);
                    if ($fcheck == 1) {
                        if (in_array($f_extension, explode(',', $cfg['plugin']['sbr']['extensions']))) {
                            $u_newname_file = $postid . "_" . md5(uniqid(rand(), true)) . "." . $f_extension;
                            $file = $sbr_path . $u_newname_file;
                            move_uploaded_file($u_tmp_name_file, $file);
                            @chmod($file, 0766);
                            $rfile['file_sid'] = $id;
                            $rfile['file_url'] = $file;
                            $rfile['file_title'] = $u_name_file;
                            $rfile['file_area'] = 'post';
                            $rfile['file_code'] = $postid;
                            $rfile['file_ext'] = $f_extension;
                            $rfile['file_size'] = floor($u_size_file / 1024);
                            $db->insert($db_sbr_files, $rfile);
                        }
                    }
                }
            }
        }
        // Отправка сообщения на почту!
        if ($mail) {
            $sbr = $db->query("SELECT * FROM {$db_sbr} WHERE sbr_id=" . $id)->fetch();
            if (!empty($to)) {
                $recipients[] = $db->query("SELECT * FROM {$db_users} WHERE user_id=" . $to)->fetch();
            } else {
                $recipients[] = $db->query("SELECT * FROM {$db_users} WHERE user_id=" . $sbr['sbr_performer'])->fetch();
                $recipients[] = $db->query("SELECT * FROM {$db_users} WHERE user_id=" . $sbr['sbr_employer'])->fetch();
            }
            if (!empty($from)) {
                $sender = $db->query("SELECT * FROM {$db_users} WHERE user_id=" . $from)->fetch();
            }
            foreach ($recipients as $recipient) {
                if (!empty($from)) {
                    $rsubject = cot_rc($L['sbr_mail_posts_header'], array('sbr_id' => $id, 'sbr_title' => $sbr['sbr_title']));
                    $rbody = cot_rc($L['sbr_mail_posts_body'], array('user_name' => $recipient['user_name'], 'sender_name' => $sender['user_name'], 'post_text' => $text, 'sitename' => $cfg['maintitle'], 'link' => COT_ABSOLUTE_URL . cot_url('sbr', "id=" . $id, '', true)));
                } else {
                    $rsubject = cot_rc($L['sbr_mail_notification_header'], array('sbr_id' => $id, 'sbr_title' => $sbr['sbr_title']));
                    $rbody = cot_rc($L['sbr_mail_notification_body'], array('user_name' => $recipient['user_name'], 'post_text' => $text, 'sitename' => $cfg['maintitle'], 'link' => COT_ABSOLUTE_URL . cot_url('sbr', "id=" . $id, '', true)));
                }
                cot_mail($recipient['user_email'], $rsubject, $rbody, '', false, null, true);
            }
        }
        /* === Hook === */
        foreach (cot_getextplugins('sbr.post.add.done') as $pl) {
            include $pl;
        }
        /* ===== */
        return $db->lastInsertId();
    }
    return false;
}
コード例 #4
0
        include $pl;
    }
    /* ===== */
    $prj = array();
    if ($cfg['projects']['prevalidate'] && !$usr['isadmin']) {
        $prj['item_state'] = 2;
        $r_url = empty($ritem['item_alias']) ? cot_url('projects', 'c=' . $ritem['item_cat'] . '&id=' . $id, '', true) : cot_url('projects', 'c=' . $ritem['item_cat'] . '&al=' . $ritem['item_alias'], '', true);
        if (!$usr['isadmin']) {
            $rbody = cot_rc($L['project_senttovalidation_mail_body'], array('user_name' => $item['user_name'], 'prj_name' => $item['item_title'], 'sitename' => $cfg['maintitle'], 'link' => COT_ABSOLUTE_URL . $r_url));
            cot_mail($item['user_email'], $L['project_senttovalidation_mail_subj'], $rbody);
        }
    } else {
        $prj['item_state'] = 0;
        $r_url = empty($item['item_alias']) ? cot_url('projects', 'c=' . $item['item_cat'] . '&id=' . $id, '', true) : cot_url('projects', 'c=' . $item['item_cat'] . '&al=' . $item['item_alias'], '', true);
        if (!$usr['isadmin']) {
            $rbody = cot_rc($L['project_added_mail_body'], array('user_name' => $item['user_name'], 'prj_name' => $item['item_title'], 'sitename' => $cfg['maintitle'], 'link' => COT_ABSOLUTE_URL . cot_url('projects', 'id=' . $id, '', true)));
            cot_mail($item['user_email'], $L['project_added_mail_subj'], $rbody);
        }
    }
    $db->update($db_projects, $prj, "item_id=" . (int) $id);
    cot_projects_sync($item['item_cat']);
    /* === Hook === */
    foreach (cot_getextplugins('projects.preview.save.done') as $pl) {
        include $pl;
    }
    /* ===== */
    cot_redirect($r_url);
    exit;
}
$out['subtitle'] = $L['projects'];
$mskin = cot_tplfile(array('projects', 'preview', $structure['projects'][$item['item_cat']]['tpl']));
コード例 #5
0
ファイル: projects.add.php プロジェクト: ASDAFF/cot-freelance
                    $rbody = cot_rc($L['project_added_mail_body'], array('user_name' => $usr['profile']['user_name'], 'prj_name' => $ritem['item_title'], 'sitename' => $cfg['maintitle'], 'link' => COT_ABSOLUTE_URL . $r_url));
                    cot_mail($usr['profile']['user_email'], $L['project_added_mail_subj'], $rbody);
                }
                break;
            case 1:
                $r_url = cot_url('projects', 'm=preview&id=' . $id, '', true);
                break;
            case 2:
                $urlparams = empty($ritem['item_alias']) ? array('c' => $ritem['item_cat'], 'id' => $id) : array('c' => $ritem['item_cat'], 'al' => $ritem['item_alias']);
                $r_url = cot_url('projects', $urlparams, '', true);
                if (!$usr['isadmin']) {
                    $rbody = cot_rc($L['project_senttovalidation_mail_body'], array('user_name' => $usr['profile']['user_name'], 'prj_name' => $ritem['item_title'], 'sitename' => $cfg['maintitle'], 'link' => COT_ABSOLUTE_URL . $r_url));
                    cot_mail($usr['profile']['user_email'], $L['project_senttovalidation_mail_subj'], $rbody);
                }
                if ($cfg['projects']['notif_admin_moderate']) {
                    $nbody = cot_rc($L['project_notif_admin_moderate_mail_body'], array('user_name' => $usr['profile']['user_name'], 'prj_name' => $ritem['item_title'], 'sitename' => $cfg['maintitle'], 'link' => COT_ABSOLUTE_URL . $r_url));
                    cot_mail($cfg['adminemail'], $L['project_notif_admin_moderate_mail_subj'], $nbody);
                }
                break;
        }
        cot_redirect($r_url);
        exit;
    } else {
        cot_redirect(cot_url('projects', 'm=add&c=' . $c . '&type=' . $type, '', true));
    }
}
if (empty($ritem['item_cat']) && !empty($c)) {
    $ritem['item_cat'] = $c;
    $usr['isadmin'] = cot_auth('projects', $ritem['item_cat'], 'A');
}
if (empty($ritem['item_type']) && !empty($type)) {
コード例 #6
0
ファイル: tags.php プロジェクト: Andreyjktl/Cotonti
}
if (cot_module_active('forums')) {
    require_once cot_incfile('forums', 'module');
    $tag_areas[] = 'forums';
}
// Sorting order
$o = cot_import('order', 'P', 'ALP');
if (empty($o)) {
    $o = mb_strtolower($cfg['plugin']['tags']['sort']);
}
$tag_order = '';
$tag_orders = array('Title', 'Date', 'Category');
foreach ($tag_orders as $order) {
    $ord = mb_strtolower($order);
    $selected = $ord == $o ? 'selected="selected"' : '';
    $tag_order .= cot_rc('input_option', array('value' => $ord, 'selected' => $selected, 'title' => $L[$order]));
}
/* == Hook for the plugins == */
foreach (cot_getextplugins('tags.first') as $pl) {
    include $pl;
}
/* ===== */
if ($cfg['plugin']['tags']['noindex']) {
    $out['head'] .= $R['code_noindex'];
}
$out['subtitle'] = empty($qs) ? $L['Tags'] : htmlspecialchars(strip_tags($qs)) . ' - ' . $L['tags_Search_results'];
$t->assign(array('TAGS_ACTION' => cot_url('plug', 'e=tags&a=' . $a), 'TAGS_HINT' => $L['tags_Query_hint'], 'TAGS_QUERY' => htmlspecialchars($qs), 'TAGS_ORDER' => $tag_order));
if ($a == 'pages' && cot_module_active('page')) {
    if (empty($qs)) {
        // Form and cloud
        cot_tag_search_form('pages');
コード例 #7
0
[BEGIN_COT_EXT]
Hooks=tools
[END_COT_EXT]
==================== */
/**
 * Creates aliases in existing pages with empty alias
 *
 * @package AutoAlias
 * @copyright (c) Cotonti Team
 * @license https://github.com/Cotonti/Cotonti/blob/master/License.txt
 */
defined('COT_CODE') or die('Wrong URL');
require_once cot_incfile('autoalias2', 'plug');
require_once cot_langfile('autoalias2', 'plug');
$t = new XTemplate(cot_tplfile('autoalias2.admin', 'plug', true));
$adminsubtitle = $L['AutoAlias'];
if ($a == 'create') {
    $count = 0;
    $res = $db->query("SELECT page_id, page_title FROM {$db_pages} WHERE page_alias = ''");
    foreach ($res->fetchAll() as $row) {
        autoalias2_update($row['page_title'], $row['page_id']);
        $count++;
    }
    $res->closeCursor();
    cot_message(cot_rc('aliases_written', $count));
    cot_redirect(cot_url('admin', 'm=other&p=autoalias2', '', true));
}
$t->assign('AUTOALIAS_CREATE', cot_url('admin', 'm=other&p=autoalias2&a=create'));
cot_display_messages($t);
$t->parse();
$plugin_body = $t->text('MAIN');
コード例 #8
0
                cot_mail($customer['user_email'], $rsubject, $rbody);
                cot_redirect(cot_url('marketorders', 'm=order&id=' . $id, '', true));
                exit;
            }
            cot_redirect(cot_url('marketorders', 'm=order&id=' . $id, '', true));
            exit;
        }
        // Отменяем жалобу
        if ($a == 'cancelclaim') {
            $rorder['order_claim'] = 0;
            $rorder['order_status'] = 'paid';
            if ($db->update($db_market_orders, $rorder, 'order_id=' . $id)) {
                $customer = $db->query("SELECT * FROM {$db_users} WHERE user_id=" . $marketorder['order_userid'])->fetch();
                // Уведопляем покупателя об отклонении жалобы
                $rsubject = cot_rc($L['marketorders_cancelclaim_mail_tocustomer_header'], array('order_id' => $marketorder['order_id'], 'product_title' => $marketorder['item_title']));
                $rbody = cot_rc($L['marketorders_cancelclaim_mail_tocustomer_body'], array('product_title' => $marketorder['item_title'], 'order_id' => $marketorder['order_id'], 'sitename' => $cfg['maintitle'], 'link' => COT_ABSOLUTE_URL . cot_url('marketorders', "id=" . $marketorder['order_id'], '', true)));
                /* === Hook === */
                foreach (cot_getextplugins('marketorders.order.cancelclaim.done') as $pl) {
                    include $pl;
                }
                /* ===== */
                cot_mail($customer['user_email'], $rsubject, $rbody);
            }
            cot_redirect(cot_url('marketorders', 'm=order&id=' . $id, '', true));
            exit;
        }
        $t->parse('MAIN.CLAIM.ADMINCLAIM');
    }
    $t->parse('MAIN.CLAIM');
}
/* === Hook === */
コード例 #9
0
ファイル: resources.php プロジェクト: Cotonti/valencia
 /**
  * A shortcut for plain output of an embedded stylesheet/javascript in the footer of the page
  *
  * Example: Resources::embedFooter(" alert('ssssss') ");
  *
  * @param string $code Stylesheet or javascript code
  * @param string $type Resource type: 'js' or 'css'
  * @param int $order
  */
 public static function embedFooter($code, $type = 'js', $order = 50)
 {
     static::$footerRc[$type . '_embed'][$order][] = cot_rc("code_rc_{$type}_embed", array('code' => $code));
 }
コード例 #10
0
ファイル: functions.php プロジェクト: Andreyjktl/Cotonti
/**
 * Warn user of shield protection
 *
 */
function cot_shield_protect()
{
    global $sys, $shield_limit, $shield_action, $L;
    if ($shield_limit > $sys['now']) {
        cot_die_message(403, true, $L['shield_title'], cot_rc('shield_protect', array('sec' => $shield_limit - $sys['now'], 'action' => $shield_action)));
    }
}
コード例 #11
0
<?php

defined('COT_CODE') or die('Wrong URL');
/* ====================
[BEGIN_COT_EXT]
Hooks=usertags.main
Order=11
[END_COT_EXT]
==================== */
if ($user_data['user_id'] > 0 && empty($user_data['user_avatar'])) {
    switch ($user_data['user_gender']) {
        case 'M':
            $temp_array['AVATAR'] = cot_rc('ga_user_default_avatar_m');
            break;
        case 'F':
            $temp_array['AVATAR'] = cot_rc('ga_user_default_avatar_f');
            break;
        default:
            $temp_array['AVATAR'] = cot_rc('ga_user_default_avatar_u');
            break;
    }
}
コード例 #12
0
<?php

/**
 * [BEGIN_COT_EXT]
 * Hooks=users.profile.update.first, users.edit.update.first, users.register.add.first
 * [END_COT_EXT]
 */
defined('COT_CODE') or die('Wrong URL');
require_once cot_incfile('usercategories', 'plug');
$catslimit = cot_cfg_usercategories();
$rcats = cot_import('rcats', 'P', 'ARR');
if (is_array($rcats)) {
    $rcats = array_filter($rcats);
    $ruser['user_cats'] = implode(',', $rcats);
    if ($m == 'edit' || $m == 'profile') {
        $groupid = $urr['user_maingrp'];
    } else {
        $groupid = cot_import('ruserusergroup', 'P', 'INT');
    }
    if (!cot_plugin_active('paypro') || cot_plugin_active('paypro') && !cot_getuserpro($urr)) {
        cot_check($catslimit[$groupid] > 0 && count($rcats) > $catslimit[$groupid], cot_rc($L['usercategories_error_catslimit'], array('limit' => $catslimit[$groupid])), 'rcats');
    }
}
コード例 #13
0
ファイル: page.list.php プロジェクト: Roffun/Cotonti
}
$arrows = array();
foreach (cot::$extrafields[cot::$db->pages] + array('title' => 'title', 'key' => 'key', 'date' => 'date', 'author' => 'author', 'owner' => 'owner', 'count' => 'count', 'filecount' => 'filecount') as $row_k => $row_p) {
    $uname = strtoupper($row_k);
    $url_asc = cot_url('page', array('s' => $row_k, 'w' => 'asc') + $list_url_path);
    $url_desc = cot_url('page', array('s' => $row_k, 'w' => 'desc') + $list_url_path);
    $arrows[$row_k]['asc'] = cot::$R['icon_down'];
    $arrows[$row_k]['desc'] = cot::$R['icon_up'];
    if ($s == $row_k) {
        $arrows[$s][$w] = cot::$R['icon_vert_active'][$w];
    }
    if (in_array($row_k, array('title', 'key', 'date', 'author', 'owner', 'count', 'filecount'))) {
        $t->assign(array('LIST_TOP_' . $uname => cot_rc("list_link_{$row_k}", array('cot_img_down' => $arrows[$row_k]['asc'], 'cot_img_up' => $arrows[$row_k]['desc'], 'list_link_url_down' => $url_asc, 'list_link_url_up' => $url_desc))));
    } else {
        $extratitle = isset($L['page_' . $row_k . '_title']) ? $L['page_' . $row_k . '_title'] : $row_p['field_description'];
        $t->assign(array('LIST_TOP_' . $uname => cot_rc('list_link_field_name', array('cot_img_down' => $arrows[$row_k]['asc'], 'cot_img_up' => $arrows[$row_k]['desc'], 'list_link_url_down' => $url_asc, 'list_link_url_up' => $url_desc))));
    }
    $t->assign(array('LIST_TOP_' . $uname . '_URL_ASC' => $url_asc, 'LIST_TOP_' . $uname . '_URL_DESC' => $url_desc));
}
$kk = 0;
$allsub = cot_structure_children('page', $c, false, false, true, false);
$subcat = array_slice($allsub, $dc, $cfg['page']['maxlistsperpage']);
/* === Hook === */
foreach (cot_getextplugins('page.list.rowcat.first') as $pl) {
    include $pl;
}
/* ===== */
/* === Hook - Part1 : Set === */
$extp = cot_getextplugins('page.list.rowcat.loop');
/* ===== */
foreach ($subcat as $x) {
コード例 #14
0
if ($a == 'edit') {
    $code = cot_import('code', 'G', 'ALP');
    $width = cot_import('userimg_width', 'P', 'INT');
    $height = cot_import('userimg_height', 'P', 'INT');
    $crop = cot_import('userimg_crop', 'P', 'TXT');
    if (!cot_userimages_config_edit($code, $width, $height, $crop)) {
        cot_error('userimages_emptycode', 'code');
    }
    cot_redirect(cot_url('admin', 'm=other&p=userimages', '', true));
}
if ($a == 'remove') {
    $code = cot_import('code', 'G', 'ALP');
    if (!cot_userimages_config_remove($code)) {
        cot_error('userimages_emptycode');
    }
    cot_redirect(cot_url('admin', 'm=other&p=userimages', '', true));
}
$userimg = cot_userimages_config_get(true);
foreach ($userimg as $code => $settings) {
    $tt->assign(array('CODE' => $code, 'WIDTH' => $settings['width'], 'HEIGHT' => $settings['height'], 'CROP' => $settings['crop'], 'EDIT_URL' => cot_url('admin', 'm=other&p=userimages&a=edit&code=' . $code), 'REMOVE' => cot_rc('userimg_remove', array('url' => cot_url('admin', 'm=other&p=userimages&a=remove&code=' . $code)))));
    $tt->parse('MAIN.USERIMG_LIST');
}
cot_display_messages($tt);
// use cot_message()
/* === Hook  === */
foreach (cot_getextplugins('userimages.admin.tags') as $pl) {
    include $pl;
}
/* ===== */
$tt->parse('MAIN');
$plugin_body = $tt->text('MAIN');
コード例 #15
0
ファイル: pfs.edit.php プロジェクト: Andreyjktl/Cotonti
    $userid = $usr['id'];
} else {
    $more = 'userid=' . $userid;
}
if ($userid != $usr['id']) {
    cot_block($usr['isadmin']);
}
$standalone = FALSE;
$uid = $userid > 0 ? $userid : $usr['id'];
$user_info = cot_userinfo($uid);
$maingroup = $userid == 0 ? 5 : $user_info['user_maingrp'];
$pfs_dir_user = cot_pfs_path($userid);
$thumbs_dir_user = cot_pfs_thumbpath($userid);
reset($cot_extensions);
foreach ($cot_extensions as $k => $line) {
    $icon[$line[0]] = cot_rc('pfs_icon_type', array('type' => $line[2], 'name' => $line[1]));
    $filedesc[$line[0]] = $line[1];
}
if (!empty($c1) || !empty($c2)) {
    $more .= empty($more) ? 'c1=' . $c1 . '&c2=' . $c2 : '&c1=' . $c1 . '&c2=' . $c2;
    $standalone = TRUE;
}
/* ============= */
$L['pfs_title'] = $userid == 0 ? $L['SFS'] : $L['pfs_title'];
$title[] = array(cot_url('pfs', $more), $L['pfs_title']);
/* === Hook === */
foreach (cot_getextplugins('pfs.edit.first') as $pl) {
    include $pl;
}
/* ===== */
if ($userid != $usr['id']) {
コード例 #16
0
            $order = 'cnt DESC';
            break;
        default:
            $order = 'RAND()';
    }
    $tc_res = $db->query("SELECT r.tag AS tag, COUNT(r.tag_item) AS cnt\n\t\tFROM {$db_tag_references} AS r LEFT JOIN {$db_projects} AS p\n\t\tON r.tag_item = p.item_id\n\t\tWHERE r.tag_area = 'projects' {$tags_where} AND p.item_cat IN ('" . $tc_cats . "') AND p.item_state = 0\n\t\tGROUP BY r.tag\n\t\tORDER BY {$order} {$limit}");
    $tc_html = $R['tags_code_cloud_open'];
    $tag_count = 0;
    while ($tc_row = $tc_res->fetch()) {
        $tag_count++;
        $tag = $tc_row['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;
        $cnt = (int) $tc_row['cnt'];
        foreach ($tc_styles as $key => $val) {
            if ($cnt <= $key) {
                $dim = $val;
                break;
            }
        }
        $tc_html .= cot_rc('tags_link_cloud_tag', array('url' => cot_url('plug', array('e' => 'tags', 'a' => 'projects', 't' => str_replace(' ', '-', $tag_u), 'tl' => $tl)), 'tag_title' => htmlspecialchars($tag_t), 'dim' => $dim));
    }
    $tc_res->closeCursor();
    $tc_html .= $R['tags_code_cloud_close'];
    $tc_html = $tag_count > 0 ? $tc_html : $L['tags_Tag_cloud_none'];
    $t->assign('PRJ_TAG_CLOUD', $tc_html);
    if ($cfg['plugin']['tags']['more'] && $limit > 0 && $tag_count == $limit) {
        $t->assign('PRJ_TAG_CLOUD_ALL_LINK', cot_rc('tags_code_cloud_more', array('url' => cot_url('plug', 'e=tags&a=projects'))));
    }
}
コード例 #17
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;
}
コード例 #18
0
ファイル: comments.functions.php プロジェクト: Roffun/Cotonti
/**
 * Generates comments display for a given item
 *
 * @param string $link_area Target URL area for cot_url()
 * @param string $link_params Target URL params for cot_url()
 * @param string $ext_name Module or plugin code
 * @param string $code Item identifier
 * @param string $cat Item category code (optional)
 * @param array $row Database row entry (optional)
 * @return string Rendered HTML output for comments
 * @see cot_comments_count()
 * @global CotDB $db
 */
function cot_comments_link($link_area, $link_params, $ext_name, $code, $cat = '', $row = array())
{
    global $cfg, $db, $R, $L, $db_com;
    if (!cot_comments_enabled($ext_name, $cat, $code)) {
        return '';
    }
    $res = cot_rc('comments_link', array('url' => cot_url($link_area, $link_params, '#comments'), 'count' => $cfg['plugin']['comments']['countcomments'] ? cot_comments_count($ext_name, $code, $row) : ''));
    return $res;
}
コード例 #19
0
ファイル: install.install.php プロジェクト: Newman101/Cotonti
/**
 * Parses extensions selection section
 *
 * @param string $ext_type Extension type: 'Module' or 'Plugin'
 * @param array $default_list A list of recommended extensions (checked by default)
 * @param array $selected_list A list of previously selected extensions
 */
function cot_install_parse_extensions($ext_type, $default_list = array(), $selected_list = array())
{
    global $t, $cfg, $L;
    $ext_type_lc = strtolower($ext_type);
    $ext_type_uc = strtoupper($ext_type);
    $ext_list = cot_extension_list_info($cfg["{$ext_type_lc}s_dir"]);
    $ext_type_lc == 'plugin' ? uasort($ext_list, 'cot_extension_catcmp') : ksort($ext_list);
    $prev_cat = '';
    $block_name = $ext_type_lc == 'plugin' ? "{$ext_type_uc}_CAT.{$ext_type_uc}_ROW" : "{$ext_type_uc}_ROW";
    foreach ($ext_list as $f => $info) {
        if (is_array($info)) {
            $code = $f;
            if ($ext_type_lc == 'plugin' && $prev_cat != $info['Category']) {
                if ($prev_cat != '') {
                    // Render previous category
                    $t->parse("MAIN.STEP_4.{$ext_type_uc}_CAT");
                }
                // Assign a new one
                $prev_cat = $info['Category'];
                $t->assign('PLUGIN_CAT_TITLE', $L['ext_cat_' . $info['Category']]);
            }
            if (!empty($info['Requires_modules']) || !empty($info['Requires_plugins'])) {
                $modules_list = empty($info['Requires_modules']) ? $L['None'] : implode(', ', explode(',', $info['Requires_modules']));
                $plugins_list = empty($info['Requires_plugins']) ? $L['None'] : implode(', ', explode(',', $info['Requires_plugins']));
                $requires = cot_rc('install_code_requires', array('modules_list' => $modules_list, 'plugins_list' => $plugins_list));
            } else {
                $requires = '';
            }
            if (!empty($info['Recommends_modules']) || !empty($info['Recommends_plugins'])) {
                $modules_list = empty($info['Recommends_modules']) ? $L['None'] : implode(', ', explode(',', $info['Recommends_modules']));
                $plugins_list = empty($info['Recommends_plugins']) ? $L['None'] : implode(', ', explode(',', $info['Recommends_plugins']));
                $recommends = cot_rc('install_code_recommends', array('modules_list' => $modules_list, 'plugins_list' => $plugins_list));
            } else {
                $recommends = '';
            }
            if (count($selected_list) > 0) {
                $checked = in_array($code, $selected_list);
            } else {
                $checked = in_array($code, $default_list);
            }
            $type = $ext_type == 'Module' ? 'module' : 'plug';
            $L['info_name'] = '';
            $L['info_desc'] = '';
            if (file_exists(cot_langfile($code, $type))) {
                include cot_langfile($code, $type);
            }
            $t->assign(array("{$ext_type_uc}_ROW_CHECKBOX" => cot_checkbox($checked, "install_{$ext_type_lc}s[{$code}]"), "{$ext_type_uc}_ROW_TITLE" => empty($L['info_name']) ? $info['Name'] : $L['info_name'], "{$ext_type_uc}_ROW_DESCRIPTION" => empty($L['info_desc']) ? $info['Description'] : $L['info_desc'], "{$ext_type_uc}_ROW_REQUIRES" => $requires, "{$ext_type_uc}_ROW_RECOMMENDS" => $recommends));
            $t->parse("MAIN.STEP_4.{$block_name}");
        }
    }
    if ($ext_type_lc == 'plugin' && $prev_cat != '') {
        // Render last category
        $t->parse("MAIN.STEP_4.{$ext_type_uc}_CAT");
    }
}
コード例 #20
0
/**
 * Generates ratings display for a given item
 *
 * @param string $ext_name Module or plugin code
 * @param string $code Item identifier
 * @param string $cat Item category code (optional)
 * @param bool $readonly Display as read-only
 * @return array Rendered HTML output for ratings and average integer value as an array with 2 elements
 * @global CotDB $db
 */
function cot_ratings_display($ext_name, $code, $cat = '', $readonly = false)
{
    global $db, $db_ratings, $db_rated, $db_users, $cfg, $usr, $sys, $L, $R;
    // Check permissions
    list($auth_read, $auth_write, $auth_admin) = cot_auth('plug', 'ratings');
    $enabled = cot_ratings_enabled($ext_name, $cat, $code);
    if (!$auth_read || !$enabled && !$auth_admin) {
        return array('', 0);
    }
    // Get current rating value
    $sql = $db->query("SELECT r.*, (SELECT COUNT(*) FROM {$db_rated} WHERE rated_area = ? AND rated_code = ?) AS `cnt` FROM {$db_ratings} AS r\n\t\tWHERE rating_area = ? AND rating_code = ? LIMIT 1", array($ext_name, $code, $ext_name, $code));
    if ($row = $sql->fetch()) {
        $rating_average = $row['rating_average'];
        $item_has_rating = true;
        if ($rating_average < 1) {
            $rating_average = 1;
        } elseif ($rating_average > 10) {
            $rating_average = 10;
        }
        $rating_cntround = round($rating_average, 0);
        $rating_raters_count = $row['cnt'];
    } else {
        $item_has_rating = false;
        $rating_average = 0;
        $rating_cntround = 0;
        $rating_raters_count = 0;
    }
    // Render read-only image
    $rating_fancy = cot_rc('icon_rating_stars', array('val' => $rating_cntround));
    if (!$auth_write || $readonly) {
        return array($rating_fancy, $rating_cntround, $rating_raters_count);
    }
    // Check if the user has voted already for this item
    $already_voted = false;
    if ($usr['id'] > 0) {
        $sql1 = $db->query("SELECT rated_value FROM {$db_rated}\n\t\t\tWHERE rated_area = ? AND rated_code = ? AND rated_userid = ?", array($ext_name, $code, $usr['id']));
        if ($rated_value = $sql1->fetchColumn()) {
            $already_voted = true;
            $rating_uservote = $L['rat_alreadyvoted'] . ' (' . $rated_value . ')';
        }
    }
    if ($already_voted && !$cfg['plugin']['ratings']['ratings_allowchange']) {
        return array($rating_fancy, $rating_cntround, $rating_raters_count);
    }
    $t = new XTemplate(cot_tplfile('ratings', 'plug'));
    /* == Hook for the plugins == */
    foreach (cot_getextplugins('ratings.main') as $pl) {
        include $pl;
    }
    /* ===== */
    // Get some extra information about votes
    if ($item_has_rating) {
        $sql = $db->query("SELECT COUNT(*) FROM {$db_rated}\n\t\t\tWHERE rated_area = ? AND rated_code = ?", array($ext_name, $code));
        $rating_voters = $sql->fetchColumn();
        $rating_since = $L['rat_since'] . ' ' . cot_date('datetime_medium', $row['rating_creationdate']);
        $rating_since_stamp = $row['rating_creationdate'];
        $rating_averageimg = cot_rc('icon_rating_stars', array('val' => $rating_cntround));
    } else {
        $rating_voters = 0;
        $rating_since = '';
        $rating_since_stamp = '';
        $rating_averageimg = '';
    }
    // Assign tags
    $t->assign(array('RATINGS_CODE' => $code, 'RATINGS_AVERAGE' => round($rating_average), 'RATINGS_AVERAGEIMG' => $rating_averageimg, 'RATINGS_VOTERS' => $rating_voters, 'RATINGS_SINCE' => $rating_since, 'RATINGS_SINCE_STAMP' => $rating_since_stamp, 'RATINGS_FANCYIMG' => $rating_fancy, 'RATINGS_USERVOTE' => $rating_uservote));
    /* == Hook for the plugins == */
    foreach (cot_getextplugins('ratings.tags') as $pl) {
        include $pl;
    }
    /* ===== */
    // Render voting form
    $vote_block = $auth_write && (!$already_voted || $cfg['plugin']['ratings']['ratings_allowchange']) ? 'NOTVOTED.' : 'VOTED.';
    for ($i = 1; $i <= 10; $i++) {
        $checked = $i <= $rating_cntround ? 'checked="checked"' : '';
        $t->assign(array('RATINGS_ROW_VALUE' => $i, 'RATINGS_ROW_TITLE' => $L['rat_choice' . $i], 'RATINGS_ROW_CHECKED' => $checked));
        $t->parse('RATINGS.' . $vote_block . 'RATINGS_ROW');
    }
    if ($vote_block == 'NOTVOTED.') {
        // 'r=ratings&area=' . $ext_name . '&code=' . $code.'&inr=send'
        $t->assign('RATINGS_FORM_SEND', cot_url('plug', array('r' => 'ratings', 'inr' => 'send', 'area' => $ext_name, 'code' => $code, 'cat' => $cat)));
        $t->parse('RATINGS.NOTVOTED');
    } else {
        $t->parse('RATINGS.VOTED');
    }
    // Parse and return
    $t->parse('RATINGS');
    $res = $t->text('RATINGS');
    return array($res, round($rating_cntround), $rating_raters_count);
}
コード例 #21
0
ファイル: pm.list.php プロジェクト: Andreyjktl/Cotonti
/* === Hook - Part1 : Set === */
$extp = cot_getextplugins('pm.list.loop');
/* ===== */
foreach ($pm_sql->fetchAll() as $row) {
    $jj++;
    $row['pm_icon_readstatus'] = $row['pm_tostate'] == '0' ? cot_rc_link(cot_url('pm', 'm=message&id=' . $row['pm_id']), $R['pm_icon_new'], array('title' => $L['pm_unread'], 'class' => $cfg['pm']['turnajax'] ? 'ajax' : '')) : cot_rc_link(cot_url('pm', 'm=message&id=' . $row['pm_id']), $R['pm_icon'], array('title' => $L['pm_read'], 'class' => 'ajax'));
    $pm_data = cot_parse($row['pm_text'], $cfg['pm']['markup']);
    $pm_desc = cot_string_truncate($pm_data, 100, true, false, '...');
    if ($f == 'sentbox') {
        $star_class = $row['pm_fromstate'] == 2 ? 1 : 0;
    } else {
        $star_class = $row['pm_tostate'] == 2 ? 1 : 0;
    }
    $url_edit = cot_url('pm', 'm=send&id=' . $row['pm_id']);
    $url_delete = cot_url('pm', 'm=edit&a=delete&' . cot_xg() . '&id=' . $row['pm_id'] . '&f=' . $f . '&d=' . $durl);
    $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');
}
コード例 #22
0
ファイル: tags.index.php プロジェクト: Andreyjktl/Cotonti
 * @package Tags
 * @copyright (c) Cotonti Team
 * @license https://github.com/Cotonti/Cotonti/blob/master/License.txt
 */
defined('COT_CODE') or die('Wrong URL');
if ($cfg['plugin']['tags']['pages'] || $cfg['plugin']['tags']['forums']) {
    require_once cot_incfile('tags', 'plug');
    $limit = $cfg['plugin']['tags']['lim_index'] == 0 ? null : (int) $cfg['plugin']['tags']['lim_index'];
    $tcloud = cot_tag_cloud($cfg['plugin']['tags']['index'], $cfg['plugin']['tags']['order'], $limit);
    $tc_html = $R['tags_code_cloud_open'];
    $tag_count = 0;
    foreach ($tcloud as $tag => $cnt) {
        $tag_count++;
        $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;
        foreach ($tc_styles as $key => $val) {
            if ($cnt <= $key) {
                $dim = $val;
                break;
            }
        }
        $tc_html .= cot_rc('tags_link_cloud_tag', array('url' => cot_url('plug', array('e' => 'tags', 'a' => $cfg['plugin']['tags']['index'], 't' => str_replace(' ', '-', $tag_u), 'tl' => $tl)), 'tag_title' => htmlspecialchars($tag_t), 'dim' => $dim));
    }
    $tc_html .= $R['tags_code_cloud_close'];
    $tc_html = $tag_count > 0 ? $tc_html : $L['tags_Tag_cloud_none'];
    $t->assign('INDEX_TAG_CLOUD', $tc_html);
    if ($cfg['plugin']['tags']['more'] && $limit > 0 && $tag_count == $limit) {
        $t->assign('INDEX_TAG_CLOUD_ALL_LINK', cot_rc('tags_code_cloud_more', array('url' => cot_url('plug', 'e=tags&a=' . $cfg['plugin']['tags']['index']))));
    }
}
コード例 #23
0
    /* === Hook === */
    foreach (cot_getextplugins('projects.offers.addpost.error') as $pl) {
        include $pl;
    }
    /* ===== */
    if (!empty($offer_post['post_text']) && (in_array($usr['id'], array($offer['offer_userid'], $item['item_userid'])) || $usr['isadmin']) && !cot_error_found()) {
        $db->insert($db_projects_posts, $offer_post);
        if ($usr['id'] == $offer['offer_userid']) {
            $urlparams = empty($item['item_alias']) ? array('c' => $item['item_cat'], 'id' => $item['item_id']) : array('c' => $item['item_cat'], 'al' => $item['item_alias']);
            $rsubject = cot_rc($L['project_added_post_header'], array('prtitle' => $item['item_title']));
            $rbody = cot_rc($L['project_added_post_body'], array('user_name' => $item['user_name'], 'postuser_name' => $usr['profile']['user_name'], 'prj_name' => $item['item_title'], 'sitename' => $cfg['maintitle'], 'link' => COT_ABSOLUTE_URL . cot_url('projects', $urlparams, '', true)));
            cot_mail($item['user_email'], $rsubject, $rbody);
        } else {
            $urlparams = empty($item['item_alias']) ? array('c' => $item['item_cat'], 'id' => $item['item_id']) : array('c' => $item['item_cat'], 'al' => $item['item_alias']);
            $rsubject = cot_rc($L['project_added_post_header'], array('prtitle' => $item['item_title']));
            $rbody = cot_rc($L['project_added_post_body'], array('user_name' => $offer['user_name'], 'postuser_name' => $usr['profile']['user_name'], 'prj_name' => $item['item_title'], 'sitename' => $cfg['maintitle'], 'link' => COT_ABSOLUTE_URL . cot_url('projects', $urlparams, '', true)));
            cot_mail($offer['user_email'], $rsubject, $rbody);
        }
        cot_message($L['offers_add_post'], 'ok');
        /* === Hook === */
        foreach (cot_getextplugins('projects.offers.addpost.done') as $pl) {
            include $pl;
        }
        /* ===== */
    }
    cot_redirect(cot_url('projects', 'id=' . $id, '', true));
    exit;
}
$t_o = new XTemplate(cot_tplfile(array('projects', 'offers', $structure['projects'][$item['item_cat']]['tpl'])));
// Вычисление выбранного исполнителя по проекту
if ($item['item_performer']) {
コード例 #24
0
ファイル: pm.send.php プロジェクト: Andreyjktl/Cotonti
/* === Hook === */
foreach (cot_getextplugins('pm.send.first') as $pl) {
    include $pl;
}
/* ===== */
if ($a == 'send') {
    cot_shield_protect();
    $newpmtitle = cot_import('newpmtitle', 'P', 'TXT');
    $newpmtext = cot_import('newpmtext', 'P', 'HTM');
    $newpmrecipient = cot_import('newpmrecipient', 'P', 'TXT');
    $fromstate = cot_import('fromstate', 'P', 'INT') == 0 ? 0 : 3;
    if (mb_strlen($newpmtext) < 2) {
        cot_error('pm_bodytooshort', 'newpmtext');
    }
    if (mb_strlen($newpmtext) > $cfg['pm']['maxsize']) {
        cot_error(cot_rc('pm_bodytoolong', array('size' => $cfg['pm']['maxsize'])), 'newpmtext');
    }
    $newpmtitle .= mb_strlen($newpmtitle) < 2 ? ' . . . ' : '';
    /* === Hook === */
    foreach (cot_getextplugins('pm.send.send.first') as $pl) {
        include $pl;
    }
    /* ===== */
    if (!empty($id)) {
        if (!cot_error_found()) {
            $pm['pm_title'] = $newpmtitle;
            $pm['pm_date'] = (int) $sys['now'];
            $pm['pm_text'] = $newpmtext;
            $pm['pm_fromstate'] = $fromstate;
            $sql_pm_update = $db->update($db_pm, $pm, "pm_id = {$id} AND pm_fromuserid = " . $usr['id'] . " AND pm_tostate = '0'");
        }
コード例 #25
0
ファイル: configuration.php プロジェクト: Andreyjktl/Cotonti
/**
 * Imports data for config values from outer world
 *
 * @param string|array $name Name of value or array of names for list of values
 * @param string $source Source type
 * @param string $filter Filter type
 * @param string $defvalue Default value for filtered data
 * @see cot_import()
 * @return mixed Filtered value of array of values
 */
function cot_config_import($name, $source = 'POST', $filter = 'NOC', $defvalue = null)
{
    global $cot_import_filters;
    if (!$name) {
        return null;
    }
    if (!is_array($name)) {
        $name = array($name);
        $single_value = true;
    }
    $res = array();
    foreach ($name as $idx => $var_name) {
        $filter_type = is_array($filter) ? $filter[$var_name] ? $filter[$var_name] : ($filter[$idx] ? $filter[$idx] : 'NOC') : $filter;
        $not_filtered = cot_import($var_name, $source, 'NOC');
        $value = cot_import($var_name, $source, $filter_type);
        // addition filtering by varname
        if (sizeof($cot_import_filters[$var_name])) {
            $value = cot_import($value, 'DIRECT', $var_name);
        }
        // if invalid value is used
        if (is_null($value)) {
            $value_to_show = in_array($filter_type, array('INT', 'NUM', 'TXT', 'ALP')) ? htmlspecialchars(cot_cutstring(strip_tags($not_filtered), 15)) : '';
            list($field_title) = cot_config_titles($var_name);
            $error_msg = cot_rc('adm_invalid_input', array('value' => $value_to_show, 'field_name' => $field_title));
            if (!is_null($defvalue)) {
                $value = !is_array($defvalue) ? $defvalue : (isset($defvalue[$var_name]) ? $defvalue[$var_name] : (isset($defvalue[$idx]) ? $defvalue[$idx] : null));
                $error_msg .= $value_to_show ? '. ' . cot_rc('adm_set_default', htmlspecialchars(strip_tags($value))) : '';
            }
            cot_message($error_msg, 'error', $var_name);
        }
        $res[$var_name] = $value;
    }
    return $single_value ? $value : $res;
}
コード例 #26
0
    global $lang;
    $mkup_lang = $cfg['plugins_dir'] . "/markitup/lang/{$lang}.lang.js";
    if (!file_exists($mkup_lang)) {
        $mkup_lang = $cfg['plugins_dir'] . '/markitup/lang/en.lang.js';
    }
    $smile_lang = "./images/smilies/lang/{$lang}.lang.js";
    if (!file_exists($smile_lang)) {
        $smile_lang = './images/smilies/lang/en.lang.js';
    }
    // BBcode or HTML preset
    $mkup_set = $sys['parser'] == 'bbcode' ? 'bbcode' : 'html';
    // Load resources
    $mkup_skin_path = $cfg['plugins_dir'] . '/markitup/skins/' . $cfg['plugin']['markitup']['skin'] . '/style.css';
    $mkup_skin = cot_rc('code_rc_css_file', array('url' => $mkup_skin_path));
    $mkup_style_path = $cfg['plugins_dir'] . '/markitup/style.css';
    $mkup_style = cot_rc('code_rc_css_file', array('url' => $mkup_style_path));
    cot_rc_link_footer($smile_lang);
    cot_rc_link_footer('images/smilies/set.js');
    cot_rc_link_footer($cfg['plugins_dir'] . '/markitup/js/jquery.markitup.min.js');
    cot_rc_link_footer($mkup_lang);
    cot_rc_link_footer($cfg['plugins_dir'] . "/markitup/js/{$mkup_set}.set.js");
    if ($cfg['plugin']['markitup']['chili']) {
        cot_rc_link_footer($cfg['plugins_dir'] . '/markitup/js/chili.js');
    }
    // User-specific setup
    $autorefresh = $cfg['plugin']['markitup']['autorefresh'] ? 'true' : 'false';
    cot_rc_embed_footer('$(document).ready(function() {
		if (document.createStyleSheet) { document.createStyleSheet("' . $mkup_skin_path . '"); } else { $("head").append(\'' . $mkup_skin . '\'); }
		if (document.createStyleSheet) { document.createStyleSheet("' . $mkup_style_path . '"); } else { $("head").append(\'' . $mkup_style . '\'); }
		mySettings.previewAutorefresh = ' . $autorefresh . ';
		mySettings.previewParserPath = "index.php?r=markitup&x=" + $("input[name=\'x\'][type=\'hidden\']").eq(0).val();
コード例 #27
0
<?php

/** 
 * [BEGIN_COT_EXT]
 * Hooks=market.add.tags
 * [END_COT_EXT]
 */
/**
 * plugin tagslance for Cotonti Siena
 * 
 * @package tagslance
 * @version 1.0.0
 * @author CMSWorks Team
 * @copyright Copyright (c) CMSWorks.ru, littledev.ru
 * @license BSD
 *  */
defined('COT_CODE') or die('Wrong URL.');
if ($cfg['plugin']['tagslance']['market'] && cot_auth('plug', 'tags', 'W')) {
    require_once cot_incfile('tags', 'plug');
    $t->assign(array('PRDADD_TOP_TAGS' => $L['Tags'], 'PRDADD_TOP_TAGS_HINT' => $L['tags_comma_separated'], 'PRDADD_FORM_TAGS' => cot_rc('tags_input_editpage', array('tags' => ''))));
    if (cot_get_caller() == 'i18n.market') {
        $t->assign(array('I18N_PRD_TAGS' => implode(', ', cot_tag_list($id)), 'I18N_IPRD_TAGS' => cot_rc('tags_input_editpage', array('tags' => ''))));
    }
    $t->parse('MAIN.TAGS');
}
コード例 #28
0
ファイル: folio.edit.php プロジェクト: ASDAFF/cot-freelance
}
if ($a == 'public') {
    $ritem = array();
    if ($cfg['folio']['prevalidate']) {
        $ritem['item_state'] = $usr['isadmin'] ? 0 : 2;
    } else {
        $ritem['item_state'] = 0;
    }
    $urlparams = empty($item['item_alias']) ? array('c' => $item['item_cat'], 'id' => $id) : array('c' => $item['item_cat'], 'al' => $item['item_alias']);
    $r_url = cot_url('folio', $urlparams, '', true);
    if (!$usr['isadmin']) {
        if ($ritem['item_state'] == 2) {
            $rbody = cot_rc($L['folio_senttovalidation_mail_body'], array('user_name' => $usr['profile']['user_name'], 'prd_name' => $item['item_title'], 'sitename' => $cfg['maintitle'], 'link' => COT_ABSOLUTE_URL . $r_url));
            cot_mail($usr['profile']['user_email'], $L['folio_senttovalidation_mail_subj'], $rbody);
        } else {
            $rbody = cot_rc($L['folio_added_mail_body'], array('user_name' => $usr['profile']['user_name'], 'prd_name' => $item['item_title'], 'sitename' => $cfg['maintitle'], 'link' => COT_ABSOLUTE_URL . $r_url));
            cot_mail($usr['profile']['user_email'], $L['folio_added_mail_subj'], $rbody);
        }
    }
    $db->update($db_folio, $ritem, 'item_id = ?', $id);
    cot_folio_sync($item['item_cat']);
    /* === Hook === */
    foreach (cot_getextplugins('folio.edit.public') as $pl) {
        include $pl;
    }
    /* ===== */
    cot_redirect($r_url);
    exit;
}
if ($a == 'hide') {
    $ritem = array();
コード例 #29
0
ファイル: message.php プロジェクト: Andreyjktl/Cotonti
        break;
    default:
        $rc = '';
        break;
}
if ($rc != '') {
    if (mb_strpos($r["{$rc}"], '://') === false) {
        $r["{$rc}"] = COT_ABSOLUTE_URL . $r["{$rc}"];
    }
    $out['head'] .= cot_rc('msg_code_redir_head', array('delay' => 2, 'url' => $r["{$rc}"]));
    $body .= $R['code_error_separator'] . $L['msgredir'];
} elseif ($rd != '') {
    if (mb_strpos($ru, '://') === false) {
        $ru = COT_ABSOLUTE_URL . ltrim($ru, '/');
    }
    $out['head'] .= cot_rc('msg_code_redir_head', array('delay' => $rd, 'url' => $ru));
    $body .= $R['code_error_separator'] . $L['msgredir'];
}
/* === Hook === */
foreach (cot_getextplugins('message.main') as $pl) {
    include $pl;
}
/* ===== */
$out['head'] .= $R['code_noindex'];
$out['subtitle'] = $title;
require_once $cfg['system_dir'] . '/header.php';
$tpl_type = defined('COT_ADMIN') ? 'core' : 'module';
$t = new XTemplate(cot_tplfile('message', $tpl_type));
if (COT_AJAX) {
    $t->assign('AJAX_MODE', true);
}
コード例 #30
0
ファイル: advboard.list.php プロジェクト: ASDAFF/advboard
        ?>
                        <div class="margintop10">
                            <?php 
        if ($advRow->description != '') {
            echo $advRow->description;
        } else {
            echo $advRow->textCut;
            ?>
                            <?php 
        }
        ?>
                        </div>

                        <div class="margintop10 text-right">
                            <?php 
        echo cot_rc('list_more', array('page_url' => $advRow->url));
        ?>
                        </div>
                        <div class="clearfix"></div>

                        <?php 
        if ($advRow->canEdit()) {
            $expireStatus = $advRow->expireStatus;
            ?>
                            <div class="row margintop10">
                                <div class="col-xs-12 col-md-5">
                                    <?php 
            if ($expireStatus == advboard_model_Advert::EXPIRED) {
                ?>
                                        <span class="label label-warning"><?php 
                echo cot::$L['advboard_expire_' . $expireStatus];