コード例 #1
0
ファイル: friendlink.php プロジェクト: renduples/alibtob
<?php

/**
 *      [PHPB2B] Copyright (C) 2007-2099, Ualink Inc. All Rights Reserved.
 *      The contents of this file are subject to the License; you may not use this file except in compliance with the License. 
 *
 *      @version $Revision: 2075 $
 */
define('CURSCRIPT', 'friendlink');
require "libraries/common.inc.php";
require "share.inc.php";
uses("setting", "message", "friendlink");
$pms = new Messages();
$friendlink = new Friendlinks();
$setting = new Settings();
if (isset($_POST['do']) && !empty($_POST['friendlink'])) {
    pb_submit_check('friendlink');
    $data = $_POST['friendlink'];
    $result = false;
    $data['status'] = 0;
    $data['created'] = $data['modified'] = $time_stamp;
    $result = $friendlink->save($data);
    if ($result) {
        $pms->SendToAdmin('', array("title" => $data['title'] . L("apply_friendlink"), "content" => $data['title'] . L("apply_friendlink") . "\n" . $_POST['data']['email'] . "\n" . $data['description']));
        $smarty->flash('wait_apply', URL);
    }
}
$viewhelper->setPosition(L("apply_friendlink", "tpl"));
formhash();
render("friendlink");
コード例 #2
0
ファイル: friendlink.php プロジェクト: reboxhost/phpb2b
<?php

/**
 *      [PHPB2B] Copyright (C) 2007-2099, Ualink Inc. All Rights Reserved.
 *      The contents of this file are subject to the License; you may not use this file except in compliance with the License. 
 *
 *      @version $Revision: 2083 $
 */
session_cache_limiter('nocache');
require "../libraries/common.inc.php";
require "session_cp.inc.php";
require CACHE_COMMON_PATH . "cache_type.php";
uses("friendlink", "industry", "typeoption", "area");
require PHPB2B_ROOT . 'libraries/page.class.php';
$link = new Friendlinks();
$page = new Pages();
$area = new Areas();
$industry = new Industries();
$industry = new Industries();
$typeoption = new Typeoption();
$conditions = null;
$tpl_file = "friendlink";
setvar("AskAction", $typeoption->get_cache_type("common_option"));
if (!empty($_PB_CACHE['friendlinktype'])) {
    setvar("FriendlinkTypes", $_PB_CACHE['friendlinktype']);
}
if (isset($_POST['save']) && !empty($_POST['data']['friendlink']['title'])) {
    $vals = array();
    $vals = $_POST['data']['friendlink'];
    if (isset($_POST['id'])) {
        $id = intval($_POST['id']);
コード例 #3
0
/**
 *      [PHPB2B] Copyright (C) 2007-2099, Ualink Inc. All Rights Reserved.
 *      The contents of this file are subject to the License; you may not use this file except in compliance with the License. 
 *
 *      @version $Revision: 2075 $
 */
function smarty_block_friendlink($params, $content, &$smarty, &$repeat)
{
    $conditions = array();
    $conditions[] = "status='1'";
    $param_count = count($smarty->_tag_stack);
    if (empty($params['name'])) {
        $params['name'] = "link";
    }
    if (!class_exists("Friendlinks")) {
        uses("friendlink");
        $friendlink = new Friendlinks();
    } else {
        $friendlink = new Friendlinks();
    }
    $show_logo = false;
    if (isset($params['type'])) {
        if ($params['type'] == 'image') {
            $conditions[] = "logo!=''";
        }
    }
    if (isset($params['typeid'])) {
        $conditions[] = "friendlinktype_id='" . $params['typeid'] . "'";
    }
    if (isset($params['seperate'])) {
        $seperate = $params['seperate'];
    }
    if (isset($params['sep'])) {
        $seperate = $params['sep'];
    }
    if (isset($params['exclode'])) {
        $conditions[] = "id NOT IN (" . $params['exclode'] . ")";
    }
    $friendlink->setCondition($conditions);
    $sql = "SELECT *,logo AS image FROM " . $friendlink->table_prefix . "friendlinks " . $friendlink->getCondition() . " ORDER BY priority ASC";
    if (empty($smarty->blockvars[$param_count])) {
        $smarty->blockvars[$param_count] = $friendlink->GetArray($sql);
        if (!$smarty->blockvars[$param_count]) {
            return $repeat = false;
        }
    }
    $counts = count($smarty->blockvars[$param_count]);
    if (list($key, $item) = each($smarty->blockvars[$param_count])) {
        $repeat = true;
        if (empty($item['url'])) {
            $item['url'] = URL;
        }
        $url = $item['url'];
        if ($seperate) {
            $item['title'] = $key == $counts - 1 ? $item['title'] : $item['title'] . $seperate;
        }
        if (!empty($item['image'])) {
            $item['link'] = '<a title="' . strip_tags($item['title']) . '" href="' . $url . '" target="_blank" linkf="friendlink"><img src="' . $item['image'] . '"</a>';
        } else {
            $item['link'] = '<a title="' . strip_tags($item['title']) . '" href="' . $url . '" target="_blank" linkf="friendlink">' . $item['title'] . '</a>';
        }
        $smarty->assign($params['name'], $item);
    } else {
        $repeat = false;
        reset($smarty->blockvars[$param_count]);
    }
    if (!is_null($content)) {
        print $content;
    }
    if (!$repeat) {
        $smarty->blockvars[$param_count] = array();
    }
}