ここの情報は古いです。ご理解頂いた上でお取り扱いください。

Changeset 1019


Ignore:
Timestamp:
Dec 4, 2006, 6:07:41 PM (14 years ago)
Author:
takanashi
Message:

#314確認用

Location:
OpenPNE/branches/takanashi/prj_takanashi2
Files:
8 edited
12 copied

Legend:

Unmodified
Added
Removed
  • OpenPNE/branches/takanashi/prj_takanashi2/webapp/lib/db/etc.php

    r972 r1019  
    702702}
    703703
     704//小窓の使用範囲をチェック
     705function db_is_use_cmd($src, $type)
     706{
     707    $sql = 'SELECT * FROM c_cmd WHERE name = ?';
     708    $params = array(strval($src));
     709    $c_cmd = db_get_row($sql, $params);
     710
     711    $permit_list = db_get_permit_list();
     712
     713    foreach ($permit_list as $key => $name) {
     714        if (($c_cmd['permit'] & $key)
     715         && preg_match('/'.$c_cmd['name'].'/', $src)
     716         && $name == $type) {
     717            return true;
     718        }
     719    }
     720
     721    return false;
     722}
     723
     724//小窓の使用範囲のリスト
     725function db_get_permit_list()
     726{
     727    return array(
     728        '1' => 'community',
     729        '2' => 'diary',
     730        '4' => 'profile',
     731    );
     732}
     733
    704734?>
  • OpenPNE/branches/takanashi/prj_takanashi2/webapp/lib/smarty_plugins/modifier.t_cmd.php

    r291 r1019  
    55 */
    66
    7 function smarty_modifier_t_cmd($string)
     7function smarty_modifier_t_cmd($string, $type = '')
    88{
    99    if (!OPENPNE_USE_CMD_TAG) {
    1010        return $string;
    1111    }
     12
    1213    $regexp = '/<cmd\s+src="([\w\.]+)"\s+args="([\w-\+%]+(,[\w-\+%]+)*)"\s*>/i';
    13     $string = preg_replace_callback($regexp, '_smarty_modifier_t_cmd_make_js', $string);
    14     return $string;
     14    $GLOBALS['_CMD']['type'] = $type;
     15
     16    return preg_replace_callback($regexp, '_smarty_modifier_t_cmd_make_js', $string);
    1517
    1618}
     
    1820function _smarty_modifier_t_cmd_make_js($matches)
    1921{
     22    if (!db_is_use_cmd($matches[1], $GLOBALS['_CMD']['type'])) {
     23        return $matches[0];
     24    }
    2025
    2126    $src  = $matches[1];
  • OpenPNE/branches/takanashi/prj_takanashi2/webapp/lib/smarty_plugins/modifier.t_url2cmd.php

    r339 r1019  
    55 */
    66
    7 function smarty_modifier_t_url2cmd($string)
     7function smarty_modifier_t_url2cmd($string, $type = '')
    88{
    99    // "(") と '(') を元に戻す
     
    1313
    1414    $url_pattern = "/https?:\/\/([a-zA-Z0-9-.]+)\/?[\w\-.,:;\~\^\/?\@&=+\$%#!()]*/";
     15    $GLOBALS['_CMD']['type'] = $type;
     16
    1517    return preg_replace_callback($url_pattern, '_smarty_modifier_t_cmd_make_url_js', $string);
    1618}
     
    2224    $path = './cmd/' . $file;
    2325
    24     if (!OPENPNE_USE_CMD_TAG || !is_readable($path)) {
     26    if (!OPENPNE_USE_CMD_TAG || !db_is_use_cmd($matches[1], $GLOBALS['_CMD']['type']) || !is_readable($path)) {
    2527        // t_url2a
    2628        return pne_url2a($url);
  • OpenPNE/branches/takanashi/prj_takanashi2/webapp/modules/admin/lib/db_admin.php

    r1014 r1019  
    18821882}
    18831883
     1884
     1885
     1886/*--------------------------------
     1887ここからCMD
     1888---------------------------------*/
     1889
     1890//CMDを追加
     1891function db_admin_insert_c_cmd($name, $permit)
     1892{
     1893    $data = array(
     1894        'name' => strval($name),
     1895        'permit' => intval($permit),
     1896    );
     1897    return db_insert('c_cmd', $data);
     1898}
     1899
     1900//CMDを編集
     1901function db_admin_update_c_cmd($c_cmd_id, $name, $permit)
     1902{
     1903    $data = array(
     1904        'name' => strval($name),
     1905        'permit' => intval($permit),
     1906    );
     1907    $where = array('c_cmd_id' => intval($c_cmd_id));
     1908    return db_update('c_cmd', $data, $where);
     1909}
     1910
     1911//CMDを削除
     1912function db_admin_delete_c_cmd($c_cmd_id)
     1913{
     1914    $sql = "DELETE FROM c_cmd WHERE c_cmd_id = ?";
     1915    $params = array(intval($c_cmd_id));
     1916    return db_query($sql, $params);
     1917}
     1918
     1919
     1920//CMDを全て取得(ページャー付き)
     1921function db_admin_get_c_cmd_all($page, $page_size, &$pager)
     1922{
     1923    $sql = 'SELECT * FROM c_cmd ORDER BY c_cmd_id';
     1924
     1925    $list = db_get_all_page($sql, $page, $page_size, $params);
     1926
     1927    $sql = 'SELECT count(*) FROM c_cmd';
     1928    $total_num = db_get_one($sql, $params);
     1929    $pager = admin_make_pager($page, $page_size, $total_num);
     1930
     1931    return $list;
     1932}
     1933
     1934//CMDを一つ取得
     1935function db_admin_get_c_cmd_one($c_cmd_id)
     1936{
     1937    $sql = 'SELECT * FROM c_cmd WHERE c_cmd_id = ?';
     1938    $params = array(intval($c_cmd_id));
     1939
     1940    return db_get_row($sql, $params);
     1941}
     1942
     1943
    18841944?>
  • OpenPNE/branches/takanashi/prj_takanashi2/webapp/modules/pc/templates/c_event_detail.tpl

    r640 r1019  
    323323<div class="padding_s lh_120">
    324324
    325 ({$c_topic.body|nl2br|t_url2cmd|t_cmd})
     325({$c_topic.body|nl2br|t_url2cmd:'community'|t_cmd:'community'})
    326326
    327327</div>
     
    613613
    614614<div class="padding_s lh_120">
    615 ({$item.body|nl2br|t_url2cmd|t_cmd})
     615({$item.body|nl2br|t_url2cmd:'community'|t_cmd:'community'})
    616616</div>
    617617
  • OpenPNE/branches/takanashi/prj_takanashi2/webapp/modules/pc/templates/c_topic_detail.tpl

    r640 r1019  
    120120
    121121<div class="padding_s lh_120">
    122 ({$c_topic.body|nl2br|t_url2cmd|t_cmd})
     122({$c_topic.body|nl2br|t_url2cmd:'community'|t_cmd:'community'})
    123123</div>
    124124
     
    259259
    260260<div class="padding_s lh_120">
    261 ({$item.body|nl2br|t_url2cmd|t_cmd})
     261({$item.body|nl2br|t_url2cmd:'community'|t_cmd:'community'})
    262262</div>
    263263
  • OpenPNE/branches/takanashi/prj_takanashi2/webapp/modules/pc/templates/fh_diary.tpl

    r952 r1019  
    468468
    469469<div class="lh_120" id="DOM_fh_diary_body">
    470 ({$target_diary.body|nl2br|t_url2cmd|t_cmd})
     470({$target_diary.body|nl2br|t_url2cmd:'diary'|t_cmd:'diary'})
    471471</div>
    472472
     
    635635({/if})
    636636
    637 ({$item.body|nl2br|t_url2cmd|t_cmd})
     637({$item.body|nl2br|t_url2cmd:'diary'|t_cmd:'diary'})
    638638
    639639</div>
  • OpenPNE/branches/takanashi/prj_takanashi2/webapp/modules/pc/templates/inc_f_home_h_prof.tpl

    r899 r1019  
    937937
    938938({if $item.form_type == 'textarea'})
    939     ({$item.value|nl2br|t_url2cmd|t_cmd})
     939    ({$item.value|nl2br|t_url2cmd:'profile'|t_cmd:'profile'})
    940940({elseif $item.form_type == 'checkbox'})
    941941    ({$item.value|@t_implode:", "})
Note: See TracChangeset for help on using the changeset viewer.