PageRenderTime 55ms CodeModel.GetById 23ms RepoModel.GetById 0ms app.codeStats 1ms

/userbox/functions_autotag.inc

https://bitbucket.org/tsuchi/box
PHP | 2627 lines | 1969 code | 360 blank | 298 comment | 198 complexity | fbd91969d42392e2e30b571895a3f4a9 MD5 | raw file
Possible License(s): AGPL-1.0

Large files files are truncated, but you can click here to view the full file

  1. <?php
  2. /* Reminder: always indent with 4 spaces (no tabs). */
  3. // +---------------------------------------------------------------------------+
  4. // | UserBox プラグイン function.inc からrequire
  5. // | 自動タグおよび UserBox 専用関数
  6. // +---------------------------------------------------------------------------+
  7. // $Id: plugins/userbox/functions_autotag.inc
  8. //20101223 tsuchitani AT ivywe DOT co DOT jp http://www.ivywe.co.jp/
  9. //20120416 userbox_category {data_edit}
  10. if (strpos ($_SERVER['PHP_SELF'], 'functions_autotag.inc') !== false) {
  11. die ('This file can not be used on its own.');
  12. }
  13. //=====自動タグ=================================================================
  14. function plugin_autotags_userbox (
  15. $op
  16. , $content = ''
  17. , $autotag = '')
  18. // +---------------------------------------------------------------------------+
  19. // | 自動タグ
  20. // | 書式 plugin_autotags_userbox ($op, $content, $autotag)
  21. // +---------------------------------------------------------------------------+
  22. // 20101229
  23. {
  24. global $_TABLES;
  25. global $_CONF;
  26. global $LANG_USERBOX_autotag_desc;
  27. //Option Display
  28. if ($op == 'tagname' ) {
  29. $tagname[]='userbox';
  30. return $tagname;
  31. } elseif ($op == 'permission' || $op == 'nopermission') {
  32. if ($op == 'permission') {
  33. $flag = true;
  34. } else {
  35. $flag = false;
  36. }
  37. if (isset($_GROUPS['UserBox Admin'])) {
  38. $group_id = $_GROUPS['UserBox Admin'];
  39. } else {
  40. $group_id = DB_getItem($_TABLES['groups'], 'grp_id',
  41. "grp_name = 'UserBox Admin'");
  42. }
  43. $owner_id = SEC_getDefaultRootUser();
  44. if (COM_getPermTag(
  45. $owner_id
  46. , $group_id
  47. , $_USERBOX_CONF['autotag_permissions_userbox'][0]
  48. , $_USERBOX_CONF['autotag_permissions_userbox'][1]
  49. , $_USERBOX_CONF['autotag_permissions_userbox'][2]
  50. , $_USERBOX_CONF['autotag_permissions_userbox'][3]) == $flag) {
  51. return $tagname;
  52. }
  53. } elseif ($op == 'description') {
  54. return $LANG_USERBOX_autotag_desc;
  55. } else if ($op == 'parse') {
  56. //引数チェック
  57. $p1 = COM_applyFilter ($autotag['parm1']);
  58. $p2 = COM_applyFilter ($autotag['parm2']);
  59. $tag = COM_applyFilter ($autotag['tag']);
  60. $tagstr = COM_applyFilter ($autotag['tagstr']);
  61. $parm2_ary[]="category_id";
  62. $parm2_ary[]="category_code";
  63. $parm2_ary[]="mode";
  64. $parm2_ary[]="rss_file";
  65. $parm2_ary[]="title_trim_length";
  66. $parm2_ary[]="intervalday";
  67. $parm2_ary[]="limitcnt";
  68. $parm2_ary[]="newmarkday";
  69. $parm2_ary[]="templatedir";
  70. $parm2_ary[]="id";
  71. $parm2_ary[]="uid";
  72. $parm2_ary[]="username";
  73. $parm2_ary[]="code";
  74. $parm2_ary[]="nohitmsg";
  75. $parm2_ary[]="perpage";
  76. $parm2_ary[]="page";
  77. $parm2_ary[]="order";
  78. $parm2_ary[]="templatesetvar";
  79. $parm2_ary[]="value";
  80. $parm2_ary[]="field_id";
  81. $parm2_ary[]="expired";
  82. $parm2_ary[]="group_id";
  83. $parm2_ary[]="group_code";
  84. $parm2_ary[]="field_code";
  85. $parm2_ary[]="option";
  86. $parm2_ary[]="method";
  87. $parm2_ary[]="roundprecision";
  88. $parm2_ary[]="numberformat";
  89. $parm2_ary[]="permission";
  90. $p=userbox_parm2($p2,$parm2_ary);
  91. //各処理
  92. switch( $tag ) {
  93. case 'userbox' :
  94. switch($p1) {
  95. case 'count':
  96. $rt= userbox_count(
  97. $p['category_id']
  98. ,$p['category_code']
  99. ,$p['mode']
  100. ,$p['permission']
  101. ,$p['numberformat']
  102. );
  103. break;
  104. case 'newlist':
  105. if ($p['category_id']<>""){
  106. $m="id";
  107. $categories=$p['category_id'];
  108. }elseif ($p['category_code']<>"") {
  109. $m="code";
  110. $categories=$p['category_code'];
  111. }else{
  112. $m="ALL";
  113. $categories="";
  114. }
  115. $rt= userbox_newlist(
  116. $m
  117. ,$categories
  118. ,$p['rss_file']
  119. ,$p['title_trim_length']
  120. ,$p['intervalday']
  121. ,$p['limitcnt']
  122. ,$p['newmarkday']
  123. ,$p['templatedir']
  124. ,$p['permission']
  125. );
  126. break;
  127. case 'profile':
  128. $w= userbox_profile(
  129. $p['uid']
  130. ,$p['templatedir']
  131. ,$p['nohitmsg']
  132. ,""
  133. ,$p['username']
  134. );
  135. $rt=$w['display'];
  136. break;
  137. case 'category':
  138. $rt= userbox_category(
  139. "autotag"
  140. ,$p['category_id']
  141. ,$p['templatedir']
  142. ,$p['nohitmsg']
  143. ,$p['perpage']
  144. ,$p['page']
  145. ,$p['order']
  146. ,$p['category_code']
  147. ,$p['mode']
  148. ,$p['expired']
  149. );
  150. break;
  151. case 'attributedatacount':
  152. $rt=DATABOX_count_each_afield(
  153. "userbox"
  154. ,$p['templatesetvar']
  155. ,$p['value']
  156. ,$p['type_id']
  157. ,$p['permission']
  158. ,$p['numberformat']
  159. );
  160. break;
  161. case 'lastmodified':
  162. $rt= userbox_grp(
  163. "modified"
  164. ,"max"
  165. ,"lastmodified"
  166. ,$p['category_id']
  167. ,$p['category_code']
  168. );
  169. break;
  170. case 'lastcreated':
  171. $rt= userbox_grp(
  172. "created"
  173. ,"max"
  174. ,"lastcreated"
  175. ,$p['category_id']
  176. ,$p['category_code']
  177. );
  178. break;
  179. case 'attribute':
  180. $rt= userbox_field(
  181. "autotag"
  182. ,$p['field_id']
  183. ,$p['value']
  184. ,$p['templatedir']
  185. ,$p['nohitmsg']
  186. ,$p['perpage']
  187. ,$p['page']
  188. ,$p['order']
  189. ,$p['field_code']
  190. );
  191. break;
  192. case 'msg':
  193. $rt=userbox_msg($p['for']) ;
  194. break;
  195. case 'categorycount':
  196. $rt= DATABOX_categorycount(
  197. "userbox"
  198. ,$p['group_id']
  199. ,$p['group_code']
  200. ,$p['permission']
  201. ,$p['numberformat']
  202. );
  203. break;
  204. case 'attributevalue':
  205. $rt=DATABOX_fieldvalue(
  206. "userbox"
  207. ,$p['id']
  208. ,$p['code']
  209. ,$p['field_id']
  210. ,$p['field_code']
  211. ,$p['option']
  212. );
  213. break;
  214. case 'math':
  215. $rt=DATABOX_math(
  216. "userbox"
  217. ,$p['method']
  218. ,$p['templatesetvar']
  219. ,$p['type_id']
  220. ,$p['category_id']
  221. ,$p['category_code']
  222. ,$p['mode']
  223. ,$p['roundprecision']
  224. ,$p['numberformat']
  225. ,$p['permission']
  226. );
  227. break;
  228. }
  229. $content = str_replace ($autotag['tagstr'], $rt, $content);
  230. return $content;
  231. }
  232. }
  233. }
  234. //第二引数分割
  235. function userbox_parm2 ($p2,$parm2_ary)
  236. {
  237. $ary=array();
  238. $px = explode (' ', trim ($p2));
  239. if (is_array ($px)) {
  240. foreach ($px as $part) {
  241. $a = explode (':', $part);
  242. if (in_array($a[0],$parm2_ary)){
  243. $ary["{$a[0]}"]=$a[1];
  244. $skip++;
  245. }
  246. }
  247. if (count ($px) > $skip) {
  248. for ($i = 0; $i < $skip; $i++) {
  249. array_shift ($px);
  250. }
  251. $ary["lastparm2"] = trim(implode (' ', $px));
  252. }
  253. }else{
  254. $ary["lastparm2"]=trim($p2);
  255. }
  256. return $ary;
  257. }
  258. //=====ブロック関数============================================================
  259. function phpblock_shownewuserbox()
  260. // +---------------------------------------------------------------------------+
  261. // | 機能 ブロック用 新着data一覧出力 |
  262. // | 書式 phpblock_shownewuserbox() |
  263. // +---------------------------------------------------------------------------+
  264. {
  265. return userbox_newlist();
  266. }
  267. //=====専用関数============================================================
  268. //
  269. function userbox_category(
  270. $autotag
  271. ,$category_id=null
  272. ,$template=null
  273. ,$nohitmsg=""
  274. ,$perpage =0
  275. ,$page=null
  276. ,$order=null
  277. ,$category_code=null
  278. ,$mode=''
  279. ,$expired=''
  280. )
  281. // +---------------------------------------------------------------------------+
  282. // | 機能 カテゴリ別一覧表示
  283. // | 書式 userbox_category($id,$template,"yes","page",$perpage)
  284. // | 書式 userbox_category($p['category_id'],$p['thtml'],$p['nohitmsg']
  285. // | 書式 ,"",$p['perpage'],$p['order'],$p['code']
  286. // +---------------------------------------------------------------------------+
  287. // | 引数 $category_id:カテゴリid
  288. // | 引数 $template:使用するテンプレートのフォルダ名
  289. // | 引数 $nohitmsg :"yes"の時nohitメッセージ表示
  290. // | 引数 $m :"page"の時ヘッダ表示
  291. // | 引数 $perpage :1pageあたりの件数、0の時改ページなし
  292. // | 引数 $order :順序
  293. // | 引数 $code :
  294. // | 引数 $mode :ブランク または AND
  295. // +---------------------------------------------------------------------------+
  296. // | public_html/category.php および 自動タグで使用
  297. // | ヘッダはコンフィギュレーション設定により表示されない場合があります
  298. // | idもcodeも指定されない場合は、全カテゴリ
  299. // +---------------------------------------------------------------------------+
  300. // | 戻値 nomal:category list
  301. // +---------------------------------------------------------------------------+
  302. {
  303. $pi_name="userbox";
  304. global $_CONF;
  305. global $_TABLES;
  306. global $_USERBOX_CONF;
  307. global $LANG_USERBOX;
  308. global $LANG_USERBOX_ADMIN;
  309. global $LANG28;
  310. global $_USER;
  311. global $_IMAGE_TYPE;
  312. global $LANG_confignames;
  313. //ログイン要否チェック
  314. if (COM_isAnonUser()){
  315. if ($_CONF['loginrequired']
  316. OR ($_USERBOX_CONF['loginrequired'] >1) ){
  317. return $LANG_USERBOX['loginrequired'];
  318. }
  319. }
  320. //-----テーブル
  321. $tbl1=$_TABLES['USERBOX_category'] ;
  322. $tbl2=$_TABLES['USERBOX_base'] ;
  323. $tbl3=$_TABLES['USERBOX_addition'] ;
  324. $tbl4=$_TABLES['users'] ;
  325. //
  326. $tbl5=$_TABLES['USERBOX_def_category'] ;
  327. $tbl6=$_TABLES['USERBOX_stats'];
  328. $datefield=$_USERBOX_CONF['datefield'];//使用する日付(編集日付、作成日付)
  329. $new_img=$_USERBOX_CONF['new_img'];
  330. if ($new_img==""){
  331. $new_img="New!";
  332. }
  333. $newmarkday=$_USERBOX_CONF['newmarkday'];
  334. if ($newmarkday==""){
  335. $newmarkday=3;
  336. }
  337. $chkday=strtotime("- $newmarkday days",time());
  338. //-----引数チェック
  339. $ids="";
  340. $idsary=array();
  341. if (is_null($category_id) OR $category_id==0){
  342. if (is_null($category_code)){
  343. }else{
  344. $w=explode("|",$category_code);
  345. foreach( $w as $val ){
  346. if ($ids<>""){
  347. $ids.=",";
  348. }
  349. $w_id=DATABOX_codetoid($val,'USERBOX_def_category',"category_id");
  350. $idsary[]=$w_id;
  351. $ids.=$w_id;
  352. }
  353. }
  354. }else{
  355. $ids=$category_id;
  356. $idsary[]=$category_id;
  357. }
  358. //--CATEGORY
  359. $category_name="";
  360. $defaulttemplatesdirectory = "";
  361. if (count($idsary)<>0){
  362. for ($i = 0; $i < count($idsary); $i++) {
  363. $sql = "SELECT ";
  364. $sql .= " name ".LB;
  365. $sql .= " ,code ".LB;
  366. $sql .= " ,description ".LB;
  367. $sql .= " ,defaulttemplatesdirectory".LB;
  368. $sql .= " FROM ".LB;
  369. $sql .= " {$tbl5} AS t5 ".LB;
  370. $sql .= " WHERE ".LB;
  371. $sql .= " t5.category_id =".$idsary[$i].LB;
  372. $result = DB_query ($sql);
  373. $numrows = DB_numRows ($result);
  374. if ($numrows > 0) {
  375. $A = DB_fetchArray ($result);
  376. $category_name.=COM_applyFilter($A['name'])." ";
  377. $category_description.=COM_applyFilter($A['description'])." ";
  378. if ($i==0){
  379. $defaulttemplatesdirectory=COM_applyFilter($A['defaulttemplatesdirectory']);
  380. }
  381. }
  382. }
  383. }
  384. if (is_null($template) or ($template==="")){
  385. if ($defaulttemplatesdirectory===""){
  386. $template="default";
  387. }else{
  388. $template=$defaulttemplatesdirectory;
  389. }
  390. }
  391. //
  392. if (is_null($page) OR !isset($page) OR $page == 0) {
  393. $page = 1;
  394. }
  395. if ($perpage===0 OR is_null($perpage)){
  396. $perpage=$_USERBOX_CONF['perpage'];
  397. }
  398. //
  399. $w=userbox_orderby($datefield,$order,$orderby,$addfieldorder,$field_id);
  400. //-----
  401. $sql = "SELECT ";
  402. $sql .= " t2.id ".LB;
  403. $sql .= " ,t2.description ".LB;
  404. $sql .= " ,t2.released ".LB;
  405. $sql .= " ,t2.expired ".LB;
  406. $sql .= " ,t2.".$datefield." AS datefield ".LB;
  407. $sql .= " ,t2.fieldset_id ".LB;
  408. $sql .= " ,UNIX_TIMESTAMP(t2.".$datefield.") AS datefield_un ".LB;
  409. $sql .= " ,UNIX_TIMESTAMP(t2.released ) AS released_un ".LB;
  410. $sql .= " ,UNIX_TIMESTAMP(t2.expired ) AS expired_un ".LB;
  411. $sql .= " ,t2.group_id";
  412. $sql .= " ,t2.owner_id";
  413. $sql .= " ,t4.username";
  414. $sql .= " ,t4.fullname";
  415. $sql .= " ,t4.photo";
  416. $sql .= " ,t4.email";
  417. if ($addfieldorder){
  418. $sql .= " ,t3.value ".LB;
  419. }
  420. //--FROM
  421. $sql .= " FROM ".LB;
  422. $sql .= " {$tbl2} AS t2 ".LB;
  423. $sql .= " ,{$tbl4} AS t4 ".LB;
  424. if ($addfieldorder){
  425. $sql .= " ,{$tbl3} AS t3 ".LB;
  426. }
  427. //--WHERE
  428. $sql .= " WHERE ".LB;
  429. $sql .= " t2.id=t4.uid ".LB;
  430. if (count($idsary)<>0){
  431. if (strtoupper($mode)=="AND"){
  432. $w="";
  433. foreach( $idsary as $val ){
  434. if ($w<>""){
  435. $w.=" AND ";
  436. }
  437. $w.=$val." IN (SELECT t1.category_id";
  438. $w.=" FROM {$tbl1} AS t1 ,{$tbl5} AS t5";
  439. $w.=" WHERE t2.id = t1.id AND t1.category_id = t5.category_id AND t5.allow_display<2)";
  440. }
  441. }else{
  442. $w= "t2.id IN (SELECT id FROM {$tbl1} AS t1 ,{$tbl5} AS t5 ";
  443. $w.="WHERE t1.category_id = t5.category_id AND t5.allow_display<2 AND t1.category_id IN ({$ids})) ";
  444. }
  445. $sql.=" AND ({$w})".LB;
  446. }
  447. if ($addfieldorder){
  448. $sql .= " AND t3.field_id=".$field_id.LB;
  449. $sql .= " AND t3.id=t2.id".LB;
  450. }
  451. //下書データはのぞく
  452. $sql .= " AND t2.draft_flag=0".LB;
  453. //アクセス権のないデータ はのぞく
  454. $sql .= COM_getPermSql('AND',0,2,"t2");
  455. //公開日以前のデータはのぞく
  456. $sql .= " AND (released <= NOW())".LB;
  457. //公開終了日を過ぎたデータはのぞく
  458. if (strtoupper($expired)=="NO"){
  459. $sql .= " AND (expired=0 OR expired > NOW())";
  460. }
  461. //--ORDER
  462. $sql .= " ORDER BY ".LB;
  463. $sql .= $orderby.LB;
  464. //
  465. $result = DB_query ($sql);
  466. $cnt = DB_numRows ($result);
  467. $pages = 0;
  468. if ($perpage > 0) {
  469. $pages = ceil($cnt / $perpage);
  470. }
  471. $offset = ($page - 1) * $perpage;
  472. $sql .= " LIMIT $offset, $perpage";
  473. //自動タグでない時 ヘッダ、左ブロック
  474. if ($autotag==="notautotag"){
  475. if ($page > 1) {
  476. $page_title = sprintf ('%s (%d)', $category_name, $page);
  477. } else {
  478. $page_title = sprintf ('%s ', $category_name);
  479. }
  480. // Meta Tags
  481. $headercode=DATABOX_getheadercode(
  482. "category"
  483. ,$template
  484. ,$pi_name
  485. ,$category_id
  486. ,$category_name
  487. ,$category_description
  488. ,$category_name
  489. ,$category_description);
  490. $retval .= DATABOX_siteHeader($pi_name,'',$page_title,$headercode) ;
  491. }
  492. $result = DB_query ($sql);
  493. $numrows = DB_numRows ($result);
  494. if ($numrows > 0) {
  495. $tmplfld=DATABOX_templatePath('category',$template,$pi_name);
  496. $templates = new Template($tmplfld);
  497. $templates->set_file (array (
  498. 'list' => 'list_detail.thtml',
  499. 'nav' => 'navigation_detail.thtml',
  500. 'row' => 'row.thtml',
  501. 'col' => "col_detail.thtml",
  502. 'pagenav' => 'pagenavigation.thtml'
  503. ));
  504. $languageid=COM_getLanguageId();
  505. $language= COM_getLanguage();
  506. $templates->set_var ('languageid', $languageid);
  507. $templates->set_var ('language', $language);
  508. if ($languageid<>"") {
  509. $templates->set_var ('_languageid', "_".$languageid);
  510. }else{
  511. $templates->set_var ('_languageid', "");
  512. }
  513. $templates->set_var ('site_url',$_CONF['site_url']);
  514. $templates->set_var ('this_script',THIS_SCRIPT);
  515. //bread
  516. $templates->set_var ('home',$LANG_USERBOX['home']);
  517. $url=$_CONF['site_url']."/userbox/category.php";
  518. $category_top="<a href='".$url."'>".$LANG_USERBOX['category_top']."</a>";
  519. $templates->set_var ('category_top',$category_top);
  520. $templates->set_var ('lang_category_list_h2',$LANG_USERBOX['category_list_h2']);
  521. $templates->set_var ('category_name',$category_name);
  522. $templates->set_var ('category_code',$category_code);
  523. $templates->set_var ('category_description',$category_description);
  524. //page
  525. $templates->set_var ('cnt', $cnt);
  526. $lin1=$offset+1;
  527. $lin2=$lin1+$perpage - 1;
  528. if ($lin2>$cnt){
  529. $lin2=$cnt;
  530. }
  531. //summary navigation
  532. $templates->set_var ('lang_view', $LANG_USERBOX['view']);
  533. $templates->set_var ('lin', $lin1."-".($lin2));
  534. $templates->set_var ('cnt', $cnt);
  535. $templates->set_var ('lang_name', $LANG_USERBOX_ADMIN['name']);
  536. $templates->set_var ('lang_username', $LANG_USERBOX_ADMIN['username']);
  537. $templates->set_var ('lang_id', $LANG_USERBOX_ADMIN['id']);
  538. $templates->set_var ('lang_uid', $LANG28[2]);
  539. $templates->set_var ('lang_username', $LANG28[3]);
  540. $templates->set_var ('lang_fullname',$LANG28[4]);
  541. //
  542. $templates->set_var ('lang_date', $LANG_USERBOX_ADMIN[$datefield]);
  543. $templates->set_var ('lang_released', $LANG_USERBOX_ADMIN['released']);
  544. $templates->set_var ('lang_expired', $LANG_USERBOX_ADMIN['expired']);
  545. $templates->set_var ('lang_remaingdays', $LANG_USERBOX_ADMIN['remaingdays']);
  546. $templates->set_var ('lang_description', $LANG_USERBOX_ADMIN['description']);
  547. $templates->set_var ('lang_addfield', $addfield_name);
  548. // 追加項目のヘッダ
  549. $addition_def=DATABOX_getadditiondef($pi_name);
  550. //
  551. $templates->set_var('lang_imgfile_frd', $LANG_confignames['userbox']['imgfile_frd']);
  552. $templates->set_var ('imgfile_frd', $_USERBOX_CONF['imgfile_frd']);
  553. $templates->set_var ('data_img_url', $_CONF['site_url']."/".$_USERBOX_CONF['imgfile_frd']);
  554. $templates->set_var('lang_imgfile_thumb_frd', $LANG_confignames['userbox']['imgfile_thumb_frd']);
  555. $templates->set_var ('imgfile_thumb_frd', $_USERBOX_CONF['imgfile_thumb_frd']);
  556. $templates->set_var ('data_thumb_img_url', $_CONF['site_url']."/".$_DATABOX_CONF['imgfile_thumb_frd']);
  557. for ($i = 0; $i < $numrows; $i++) {
  558. $A = DB_fetchArray ($result);
  559. $A = array_map('stripslashes', $A);
  560. $description=COM_applyFilter($A['description']);
  561. $username=COM_applyFilter($A['username']);
  562. $fullname=COM_applyFilter($A['fullname']);
  563. $id=COM_applyFilter($A['id']);
  564. $datefield=COM_applyFilter($A['datefield']);
  565. $released=COM_applyFilter($A['released']);
  566. $expired=COM_applyFilter($A['expired']);
  567. $datefield_ary = COM_getUserDateTimeFormat($A['datefield_un']);
  568. $released_ary = COM_getUserDateTimeFormat($A['released_un']);
  569. if ($expired==="0000-00-00 00:00:00"){
  570. $expired_ary=array();
  571. }else{
  572. $expired_ary = COM_getUserDateTimeFormat($A['expired_un']);
  573. }
  574. $curdate_ary = COM_getUserDateTimeFormat();
  575. $value=COM_applyFilter($A['value']);
  576. $group_id = $A['group_id'];
  577. $owner_id = $A['owner_id'];
  578. $fieldset_id=COM_applyFilter($A['fieldset_id']);
  579. $url=$_CONF['site_url'] . "/userbox/profile.php";
  580. $url.="?";
  581. //コード使用の時
  582. if ($_USERBOX_CONF['datacode']){
  583. $url.="code=".$A['username'];
  584. $url.="&amp;m=code";
  585. }else{
  586. $url.="id=".$A['id'];
  587. $url.="&amp;m=id";
  588. }
  589. $url = COM_buildUrl( $url );
  590. $link= COM_createLink($username, $url);
  591. $templates->set_var ('data_link', $link);
  592. $templates->set_var ('data_fullname', $A['fullname']);
  593. $templates->set_var ('data_title', $A['fullname']);
  594. $templates->set_var ('data_username', $username);
  595. $templates->set_var ('data_code', $username);
  596. $templates->set_var ('data_description', $description);
  597. $templates->set_var ('data_id', $id);
  598. $templates->set_var ('data_url', $url);
  599. $templates->set_var ('data_datefield', $datefield_ary[0]);
  600. $templates->set_var ('data_value', $value);
  601. $templates->set_var ('data_datefield_shortdate', strftime( $_CONF['shortdate'], $A['datefield_un'] ));
  602. $templates->set_var ('data_released', $released_ary[0]);
  603. $templates->set_var ('data_released_shortdate', strftime( $_CONF['shortdate'], $A['released_un'] ));
  604. $templates->set_var ('data_released_date', strftime( $_CONF['date'], $A['released_un'] ));
  605. $templates->set_var ('data_released_daytime', strftime( $_CONF['daytime'], $A['released_un'] ));
  606. $templates->set_var ('data_released_dateonly', strftime( $_CONF['dateonly'], $A['released_un'] ));
  607. $templates->set_var ('data_released_timeonly', strftime( $_CONF['timeonly'], $A['released_un'] ));
  608. $templates->set_var ('data_released_b', strftime( "%b" , $A['released_un']));
  609. $templates->set_var ('data_released_B', strftime( "%B" , $A['released_un']));
  610. $templates->set_var ('data_released_d', strftime( "%d" , $A['released_un']));
  611. $templates->set_var ('data_released_e', strftime( "%e" , $A['released_un']));
  612. //公開終了日 Expired to publish
  613. if ($A['expired'] ==="0000-00-00 00:00:00"){
  614. $templates->set_var ('data_expired', "");
  615. $templates->set_var ('data_expired_shortdate', "" );
  616. $templates->set_var ('data_expired_date', "" );
  617. $templates->set_var ('data_expired_daytime', "" );
  618. $templates->set_var ('data_expired_dateonly', "" );
  619. $templates->set_var ('data_expired_timeonly', "" );
  620. $templates->set_var ('data_expired_b', "" );
  621. $templates->set_var ('data_expired_B', "" );
  622. $templates->set_var ('data_expired_d', "" );
  623. $templates->set_var ('data_expired_e', "" );
  624. }else{
  625. $wary = COM_getUserDateTimeFormat($A['expired_un']);
  626. $templates->set_var ('data_expired', $expired_ary[0]);
  627. $templates->set_var ('data_expired_shortdate', strftime( $_CONF['shortdate'], $A['expired_un'] ));
  628. $templates->set_var ('data_expired_date', strftime( $_CONF['date'], $A['expired_un'] ));
  629. $templates->set_var ('data_expired_daytime', strftime( $_CONF['daytime'], $A['expired_un'] ));
  630. $templates->set_var ('data_expired_dateonly', strftime( $_CONF['dateonly'], $A['expired_un'] ));
  631. $templates->set_var ('data_expired_timeonly', strftime( $_CONF['timeonly'], $A['expired_un'] ));
  632. $templates->set_var ('data_expired_b', strftime( "%b" , $A['expired_un']));
  633. $templates->set_var ('data_expired_B', strftime( "%B" , $A['expired_un']));
  634. $templates->set_var ('data_expired_d', strftime( "%d" , $A['expired_un']));
  635. $templates->set_var ('data_expired_e', strftime( "%e" , $A['expired_un']));
  636. }
  637. $remaingdays="";
  638. if ($expired<>"0000-00-00 00:00:00") {
  639. if ($expired_ary[1]>=$curdate_ary[1]){
  640. $remaingdays=COM_dateDiff( "d", $expired_ary[1], $curdate_ary[1] ) + 1;
  641. }
  642. }
  643. $templates->set_var ('data_remaingdays', $remaingdays);//@@@@@@
  644. if (date("Ymd",strtotime($datefield)) >= date("Ymd",$chkday)){
  645. $templates->set_var ('new_img', $new_img);
  646. }else{
  647. $templates->set_var ('new_img', '');
  648. }
  649. //
  650. if (isset($A['photo']) && empty($A['photo'])) {
  651. $A['photo'] = '(none)'; // user does not have a photo
  652. $templates->set_var('data_photo', "");
  653. }else{
  654. $templates->set_var('data_photo', $A['photo']);
  655. }
  656. $photo = USER_getPhoto($uid, $A['photo'], $A['email'], -1);
  657. $templates->set_var('data_user_photo', $photo);
  658. $hits=COM_applyFilter(DB_getItem( $tbl6 ,"hits","id={$id}"),true);
  659. $templates->set_var('lang_hits', $LANG_USERBOX_ADMIN['hits']);
  660. $templates->set_var('data_hits', $hits);
  661. //カテゴリ@@@@@
  662. $templates->set_var('lang_category', $LANG_USERBOX_ADMIN['category']);
  663. DATABOX_getcategoriesDisp($A['id'],$templates,$chk_user,0,$pi_name);
  664. //追加項目
  665. $chk_user=DATABOX_chkuser($group_id,$owner_id,"userbox.admin");
  666. $additionfields = DATABOX_getadditiondatas($id,$pi_name);
  667. DATABOX_getaddtionfieldsDisp($additionfields,$addition_def,$templates,$chk_user,$pi_name,$fieldset_id);
  668. //管理者の時「編集」
  669. $templates->set_var ('data_edit', "");
  670. if ( SEC_hasRights('userbox.admin')) {
  671. $icon_url = $_CONF['layout_url'] . '/images/edit.' . $_IMAGE_TYPE;
  672. $attr = array('title' => $username." ".$LANG_USERBOX_ADMIN['edit']);
  673. $editiconhtml = COM_createImage($icon_url, $LANG_USERBOX_ADMIN['edit'], $attr);
  674. $attr = array('class' => 'editlink', 'title' => $username." ".$LANG_USERBOX_ADMIN['edit']);
  675. $url = $_CONF['site_admin_url'];
  676. $url .= '/plugins/userbox/profile.php';
  677. $url .= '?mode=edit';
  678. $url .= '&amp;'."id={$id}";
  679. $icon = '&nbsp;' ;
  680. $icon .= COM_createLink( $editiconhtml, $url, $attr );
  681. $templates->set_var ('data_edit', $icon);
  682. }else{
  683. if ($id===$_USER['uid']){
  684. $icon_url = $_CONF['layout_url'] . '/images/edit.' . $_IMAGE_TYPE;
  685. $attr = array('title' => $LANG_USERBOX_ADMIN['edit']);
  686. $editiconhtml = COM_createImage($icon_url, $LANG_USERBOX_ADMIN['edit'], $attr);
  687. $attr = array('class' => 'editlink', 'title' => $username." ".$LANG_USERBOX_ADMIN['edit']);
  688. $url = $_CONF['site_url'];
  689. $url .= '/userbox/myprofile/profile.php';
  690. $icon = '&nbsp;' ;
  691. $icon .= COM_createLink( $editiconhtml, $url, $attr );
  692. $templates->set_var ('data_edit', $icon);
  693. }
  694. }
  695. //=====
  696. $templates->parse ('col_var', 'col', true);
  697. $templates->parse ('row_var', 'row', true);
  698. $templates->set_var ('col_var', '');
  699. }
  700. // Call to plugins to set template variables in the databox
  701. PLG_templateSetVars( 'userbox', $templates );
  702. //------------
  703. //-----navigation
  704. $url = $_CONF['site_url'] . '/';
  705. if ($autotag==="notautotag"){
  706. $url.=THIS_SCRIPT;
  707. }else{
  708. $url.="userbox/category.php";
  709. }
  710. $url .= "?";
  711. if ($category_code<>""){
  712. $url .= "code=".$category_code;
  713. $url .= "&amp;m=code";
  714. }else{
  715. $url .= "id=".$category_id;
  716. $url .= "&amp;m=id";
  717. }
  718. $url .= "&amp;template=".$template;
  719. $url .= "&amp;order=";
  720. //-----order navigation
  721. userbox_order ($url, $templates, $order) ;
  722. //-----page navigation
  723. $url .= $order;
  724. $templates->set_var ('page_navigation',
  725. COM_printPageNavigation ($url, $page, $pages));
  726. if ($order==="random"){
  727. $templates->set_var ( 'pagenavinone', 'style="display:none;"' );
  728. }else{
  729. $templates->set_var ( 'pagenavinone', '' );
  730. }
  731. //------------
  732. $templates->parse ('nav_var', 'nav', true);
  733. $templates->set_var ('blockfooter',COM_endBlock());
  734. $templates->set_var ('msg', "");
  735. //@@@@@@@@$templates->set_var ('search_link', $LANG_USERBOX['search_link']);
  736. //@@@@@@@@$templates->set_var ('search_var',"");
  737. $templates->parse ('output', 'list');
  738. $content = $templates->finish ($templates->get_var ('output'));
  739. $retval .=$content;
  740. }else{
  741. if ($nohitmsg==="yes"){
  742. $tmplfld=DATABOX_templatePath('category',$template,$pi_name);
  743. $templates = new Template($tmplfld);
  744. $templates->set_file (array (
  745. 'list' => 'nohit.thtml',
  746. ));
  747. $templates->set_var ('home',$LANG_USERBOX['home']);
  748. $url=$_CONF['site_url']."/userbox/category.php";
  749. $category_top="<a href='".$url."'>".$LANG_USERBOX['category_top']."</a>";
  750. $templates->set_var ('category_top',$category_top);
  751. $templates->set_var ('category_name',$category_name);
  752. $templates->set_var ('category_code',$category_code);
  753. $templates->set_var ('category_description',$category_description);
  754. $templates->set_var('xhtml', XHTML);
  755. $templates->set_var('site_url', $_CONF['site_url']);
  756. $templates->set_var('site_admin_url', $_CONF['site_admin_url']);
  757. $templates->set_var('layout_url', $_CONF['layout_url']);
  758. $templates->set_var ('lang_nohit', $LANG_USERBOX['nohit']);
  759. $templates->parse ('output', 'list');
  760. $content = $templates->finish ($templates->get_var ('output'));
  761. $retval .=$content;
  762. }
  763. }
  764. $retval =PLG_replacetags ($retval);
  765. //return $dbg.$retval;
  766. return $retval;
  767. }
  768. function userbox_count(
  769. $category_id =null
  770. ,$category_code =null
  771. ,$mode=''
  772. ,$permission=""
  773. ,$numberformat=''
  774. )
  775. // +---------------------------------------------------------------------------+
  776. // | 機能 件数表示
  777. // +---------------------------------------------------------------------------+
  778. // | 書式 userbox_count()
  779. // | 書式 userbox_count(1)
  780. // | 書式 userbox_count("japan")
  781. // +---------------------------------------------------------------------------+
  782. // | 引数 $category_id:カテゴリid (優先)
  783. // | 引数 $category_code:カテゴリコード
  784. // | 引数 $mode :ブランク または AND
  785. // +---------------------------------------------------------------------------+
  786. // | 戻値 nomal:データ総数、カテゴリ別データ件数
  787. // +---------------------------------------------------------------------------+
  788. {
  789. global $_TABLES;
  790. //-----
  791. $tbl1=$_TABLES['USERBOX_base'] ;
  792. $tbl2=$_TABLES['USERBOX_category'] ;
  793. //カテゴリの指定がなければ全件、あればカテゴリ毎
  794. $exp="";
  795. if (is_null($category_id) AND is_null($category_code) ){
  796. }else{
  797. $ids="";
  798. $idsary=array();
  799. if (is_null($category_id) OR $category_id==0){
  800. if (is_null($category_code)){
  801. }else{
  802. $w=explode("|",$category_code);
  803. foreach( $w as $val ){
  804. if ($ids<>""){
  805. $ids.=",";
  806. }
  807. $w_id=DATABOX_codetoid($val,'USERBOX_def_category',"category_id");
  808. $idsary[]=$w_id;
  809. $ids.=$w_id;
  810. }
  811. }
  812. }else{
  813. $ids=$category_id;
  814. $idsary[]=$category_id;
  815. }
  816. if (strtoupper($mode)=="AND"){
  817. $w="";
  818. foreach( $idsary as $val ){
  819. if ($w<>""){
  820. $w.=" AND ";
  821. }
  822. $w.=$val." IN (SELECT category_id";
  823. $w.=" FROM {$tbl2} AS t2 ";
  824. $w.=" WHERE t2.id = t1.id)";
  825. }
  826. }else{
  827. $w= "id IN (SELECT id FROM {$tbl2} ";
  828. $w.="WHERE category_id IN ({$ids})) ";
  829. }
  830. $exp=$w.LB;
  831. }
  832. //-----
  833. $sql = "SELECT ".LB;
  834. $sql .= " distinct t1.id ".LB;
  835. $sql .= " FROM ".LB;
  836. $sql .= " {$tbl1} AS t1 ".LB;
  837. $sql .= " WHERE ".LB;
  838. if ($exp<>""){
  839. $sql .= $exp. " AND ";
  840. }
  841. //@@@@@@@@@@@------>
  842. //下書はのぞく
  843. $sql .= " t1.draft_flag=0".LB;
  844. //アクセス権のないデータ はのぞく
  845. if (strtoupper($permission)=="IGNORE"){
  846. }else{
  847. $sql .= COM_getPermSql('AND').LB;
  848. }
  849. //公開日以前のデータはのぞく
  850. $sql .= " AND (released <= NOW())".LB;
  851. //公開終了日を過ぎたデータはのぞく
  852. $sql .= " AND (expired=0 OR expired > NOW())".LB;
  853. //@@@@@@@@@@@<------
  854. $result = DB_query ($sql);
  855. $cnt = DB_numRows ($result);
  856. if (strtoupper($numberformat)=="YES"){
  857. $rt=COM_NumberFormat($cnt);
  858. }else{
  859. $rt=$cnt;
  860. }
  861. return $rt;
  862. }
  863. function userbox_grp(
  864. $field=null
  865. ,$function=null
  866. ,$format=null
  867. ,$category_id =null
  868. ,$category_code =null
  869. )
  870. // +---------------------------------------------------------------------------+
  871. // | 機能 集計表示(max min sum)
  872. // +---------------------------------------------------------------------------+
  873. // | 書式 userbox_grp()
  874. // | 書式 userbox_grp(1)
  875. // | 書式 userbox_grp("japan")
  876. // +---------------------------------------------------------------------------+
  877. // | 引数 $field:項目 デフォルトmodified
  878. // | 引数 $function:関数 デフォルトmax
  879. // | 引数 $format:書式
  880. // | 引数 $category_id:カテゴリid (優先)
  881. // | 引数 $category_code:カテゴリコード
  882. // +---------------------------------------------------------------------------+
  883. // | 戻値 nomal:データ総数、カテゴリ別データ件数
  884. // +---------------------------------------------------------------------------+
  885. {
  886. global $_TABLEdS;
  887. global $LANG_USERBOX;
  888. $rt="";
  889. if (is_null($field) ){
  890. $field="id";
  891. }
  892. if (is_null($function) ){
  893. $function="max";
  894. }
  895. if (is_null($category_id) AND is_null($category_code) ){
  896. $m="ALL";
  897. }else{
  898. if (is_null($category_id) ){
  899. $category_id=DATABOX_codetoid($category_code,'USERBOX_def_category',"category_id");
  900. }
  901. $m="CATEGORY";
  902. }
  903. //-----
  904. $tbl1=$_TABLES['USERBOX_base'] ;
  905. $tbl2=$_TABLES['USERBOX_category'] ;
  906. //-----
  907. $sql=LB;
  908. $sql .= "SELECT ".LB;
  909. $sql .= " {$function}(t1.{$field}) AS rt".LB;
  910. $sql .= " FROM ".LB;
  911. $sql .= " {$tbl1} AS t1 ".LB;
  912. if ($m==="ALL"){
  913. }else{
  914. $sql .= " ,{$tbl2} AS t2 ".LB;
  915. }
  916. $sql .= " WHERE ".LB;
  917. //@@@@@@@@@--------->
  918. //下書はのぞく
  919. $sql .= " t1.draft_flag=0".LB;
  920. //アクセス権のないデータ はのぞく
  921. $sql .= COM_getPermSql('AND').LB;
  922. //公開日以前のデータはのぞく
  923. $sql .= " AND (released <= NOW())".LB;
  924. //公開終了日を過ぎたデータはのぞく
  925. $sql .= " AND (expired=0 OR expired > NOW())".LB;
  926. //@@@@@@@@@<---------
  927. if ($m==="ALL"){
  928. }else{
  929. $sql .= " AND t1.id = t2.id ".LB;
  930. $sql .= " AND t2.category_id= ".$category_id .LB;
  931. }
  932. $result = DB_query ($sql);
  933. $numrows = DB_numRows ($result);
  934. if ($numrows > 0) {
  935. $A = DB_fetchArray ($result);
  936. $rt=$A['rt'];
  937. if ($rt<>""){
  938. switch($format){
  939. case "lastmodified":// '%Y年%m%e日更新';
  940. case "lastcreated"://'%Y年%m%e日追加';
  941. $fm=$LANG_USERBOX[$format];
  942. $rt=strftime($fm,strtotime($rt));
  943. break;
  944. default:
  945. break;
  946. }
  947. }
  948. }
  949. return $rt;
  950. }
  951. function userbox_profile(
  952. $id=null
  953. ,$template=null
  954. ,$nohitmsg=""
  955. ,$m=""
  956. ,$code=null
  957. )
  958. // +---------------------------------------------------------------------------+
  959. // | 機能 個別データ表示
  960. // | 書式 userbox_profile($id,$template,"yes","page")
  961. // | 書式 userbox_profile($p['id'],$p['thtml'],$p['nohitmsg'],$p['code']
  962. // +---------------------------------------------------------------------------+
  963. // | 引数 $id :
  964. // | 引数 $template :テンプレートのdirectory
  965. // | 引数 $nohitmsg :"yes"の時nohitメッセージ表示
  966. // | 引数 $m :"page"の時ヘッダ表示
  967. // | 引数 $code :
  968. // +---------------------------------------------------------------------------+
  969. // | public_html/profile.php および 自動タグで使用
  970. // | ヘッダはコンフィギュレーション設定により表示されない場合があります
  971. // | idもcodeも指定されない場合は、直近に変更または追加されたデータを返します
  972. // +---------------------------------------------------------------------------+
  973. // | 戻値 nomal:profile
  974. // +---------------------------------------------------------------------------+
  975. // 20120125
  976. {
  977. $pi_name="userbox";
  978. global $_CONF;
  979. global $_TABLES;
  980. global $_IMAGE_TYPE;
  981. global $_USER;
  982. global $LANG28;
  983. global $LANG04;
  984. global $_USERBOX_CONF;
  985. global $LANG_USERBOX;
  986. global $LANG_USERBOX_ADMIN;
  987. global $LANG_confignames;
  988. $layout=$_DATABOX_CONF['layout'];
  989. //-----
  990. if (is_null($id) AND (is_null($code))){
  991. $id=$_USER['uid'];
  992. }
  993. if (is_null($id) OR ($id==0)){
  994. if ($code<>""){
  995. $id=DATABOX_codetoid($code,'users',"uid","username");
  996. }
  997. }
  998. //-----
  999. $display = '';
  1000. $tbl=$_TABLES['USERBOX_base'] ;
  1001. $tbl1=$_TABLES['users'] ;
  1002. $tbl4=$_TABLES['USERBOX_def_fieldset'];
  1003. $tbl5=$_TABLES['USERBOX_stats'];
  1004. $addition_def=DATABOX_getadditiondef($pi_name);
  1005. //-----
  1006. $sql = "SELECT t.* ";
  1007. $sql .= " ,UNIX_TIMESTAMP(t.modified) AS modified_un";
  1008. $sql .= " ,UNIX_TIMESTAMP(t.released) AS released_un";
  1009. $sql .= " ,UNIX_TIMESTAMP(t.comment_expire) AS comment_expire_un";
  1010. $sql .= " ,UNIX_TIMESTAMP(t.expired) AS expired_un";
  1011. $sql .= " ,UNIX_TIMESTAMP(t.created) AS created_un";
  1012. $sql .= " ,UNIX_TIMESTAMP(t.udatetime) AS udatetime_un";
  1013. $sql .= " ,t.fieldset_id";
  1014. $sql .= " ,t1.username ";
  1015. $sql .= " ,t1.fullname ";
  1016. $sql .= " ,t1.photo ";
  1017. $sql .= " ,t1.email";
  1018. $sql .= " ,t3.username AS last_modify_name";
  1019. $sql .= " ,t3.fullname AS last_modify_fullname";
  1020. $sql .= " ,t4.name AS set_name";
  1021. $sql .= " ,t4.description AS set_description";
  1022. $sql .= " ,t4.defaulttemplatesdirectory AS set_defaulttemplatesdirectory";
  1023. $sql .= " ,t4.layout AS set_layout";
  1024. $sql .= " ,t5.hits";
  1025. $sql .= " FROM ";
  1026. $sql .= " {$tbl} AS t ";
  1027. $sql .= " JOIN {$tbl4} AS t4 ON t.fieldset_id=t4.fieldset_id";
  1028. $sql .= " JOIN {$tbl1} AS t1 ON t.id=t1.uid";//owner
  1029. $sql .= " LEFT JOIN {$tbl5} AS t5 ON t.id=t5.id";
  1030. $sql .= " LEFT JOIN {$tbl1} AS t3 ON t.uuid=t3.uid";//last_updateowner
  1031. $sql .= " WHERE ";
  1032. if (is_null($id)){//@@@@@
  1033. $sql .= "1=1";
  1034. }else{
  1035. $sql .= " t.id=".$id;
  1036. }
  1037. //管理者の時,
  1038. if ( SEC_hasRights('userbox.admin') OR $m==="view") {
  1039. }else{
  1040. //下書データはのぞく
  1041. $sql .= " AND t.draft_flag=0".LB;
  1042. //公開日以前のデータはのぞく
  1043. $sql .= " AND (released <= NOW())";
  1044. //公開終了日を過ぎたデータはのぞく
  1045. $sql .= " AND (expired=0 OR expired > NOW())";
  1046. }
  1047. //アクセス権のないデータ はのぞく
  1048. $sql .= COM_getPermSql('AND');
  1049. if (is_null($id)){
  1050. $sql .= " ORDER BY ".$_USERBOX_CONF['datefield'] . " DESC ";
  1051. $sql .= " LIMIT 0 , 1";
  1052. }
  1053. $result = DB_query ($sql);
  1054. $numrows = DB_numRows ($result);
  1055. if ($m==="page" OR $m==="view"){
  1056. if ($numrows <= 0) {
  1057. COM_handle404();
  1058. exit;
  1059. }
  1060. }
  1061. if ($numrows > 0) {
  1062. $A = DB_fetchArray ($result);
  1063. $A = array_map('stripslashes', $A);
  1064. $cache_time=$A['cache_time'];
  1065. $cache=false;
  1066. if ($cache_time===0){
  1067. }else{
  1068. if ($m==="page"){
  1069. if ($cache_time > -1 ) {
  1070. // Don't need to cache per theme since not rendered in a block yet
  1071. $cacheInstance = 'userbox__' . $id . '__' . CACHE_security_hash();
  1072. $retval = CACHE_check_instance($cacheInstance);
  1073. if ($retval AND $cache_time == -1) {
  1074. return $retval;
  1075. } elseif ($retval AND $cache_time > 0) {
  1076. $lu = CACHE_get_instance_update($cacheInstance);
  1077. $now = time();
  1078. if (($now - $lu) < $cache_time) {
  1079. return $retval;
  1080. } else {
  1081. $retval = '';
  1082. }
  1083. }
  1084. }
  1085. }
  1086. }
  1087. if ($cache){
  1088. $display = CACHE_check_instance($cacheInstance."_display",$display);
  1089. $layout = CACHE_check_instance($cacheInstance."_layout",$layout);
  1090. $headercode = CACHE_check_instance($cacheInstance."_headercode",$headercode);
  1091. $title = CACHE_check_instance($cacheInstance."_title",$title);
  1092. }else{
  1093. if (is_null($template) or ($template==="")){
  1094. if ($A['defaulttemplatesdirectory']<>""){
  1095. $template=$A['defaulttemplatesdirectory'];
  1096. }elseif ($A['set_defaulttemplatesdirectory']<>""){
  1097. $template=$A['set_defaulttemplatesdirectory'];
  1098. }else{
  1099. $template="default";
  1100. }
  1101. }
  1102. $group_id = $A['group_id'];
  1103. $owner_id = $A['owner_id'];
  1104. $fieldset_id= $A['fieldset_id'];
  1105. if ($m==="view"){
  1106. $chk_user=1000;//ログインユーザ
  1107. }else{
  1108. $chk_user=DATABOX_chkuser($group_id,$owner_id,"userbox.admin");
  1109. }
  1110. //
  1111. $id=$A['id'];
  1112. $additionfields = DATABOX_getadditiondatas($id,$pi_name);
  1113. //ヘッダ、左ブロック start.............
  1114. if ($m==="page"){
  1115. if ($A['set_layout']<>"0") {
  1116. $layout=$A['set_layout'];
  1117. }
  1118. $title= $A['page_title'];
  1119. if ($title===""){
  1120. $title =$A['username'];
  1121. }
  1122. // Meta Tags
  1123. $headercode=DATABOX_getheadercode(
  1124. "profile"
  1125. ,$template
  1126. ,$pi_name
  1127. ,$A['id']
  1128. ,$title
  1129. ,$A['meta_description']
  1130. ,$A['meta_keywords']
  1131. ,$A['description']);
  1132. }
  1133. $tmplfld=DATABOX_templatePath('profile',$template,$pi_name);
  1134. $templates = new Template($tmplfld);
  1135. $templates->set_file (array (
  1136. 'list' => 'list_detail.thtml',
  1137. 'row' => 'row.thtml',
  1138. 'col' => "col_detail.thtml",
  1139. ));
  1140. $languageid=COM_getLanguageId();
  1141. $language= COM_getLanguage();
  1142. $templates->set_var ('languageid', $languageid);
  1143. $templates->set_var ('language', $language);
  1144. if ($languageid<>"") {
  1145. $templates->set_var ('_languageid', "_".$languageid);
  1146. }else{
  1147. $templates->set_var ('_languageid', "");
  1148. }
  1149. $templates->set_var ('site_admin_url', $_CONF['site_admin_url']);
  1150. $templates->set_var ('site_url',$_CONF['site_url']);
  1151. $templates->set_var('xhtml', XHTML);
  1152. $templates->set_var('layout_url', $_CONF['layout_url']);
  1153. $templates->set_var ('site_name', $_CONF['site_name']);
  1154. $templates->set_var ('site_mail', $_CONF['site_mail']);
  1155. $currenturl= COM_getCurrentURL();
  1156. $templates->set_var ('currenturl', htmlspecialchars($currenturl, ENT_QUOTES, 'UTF-8'));
  1157. //facebook
  1158. $facebook_consumer_key = trim($_CONF['facebook_consumer_key']);
  1159. $templates->set_var ('facebook_consumer_key', $facebook_consumer_key);
  1160. //
  1161. //daft_flag管理者の時
  1162. if ($A['draft_flag']==1){
  1163. $templates->set_var ('draft', "draft!");
  1164. }else{
  1165. $templates->set_var ('draft', "");
  1166. }
  1167. //------------
  1168. //id
  1169. $templates->set_var('lang_id', $LANG_USERBOX_ADMIN['id']);
  1170. $templates->set_var ('id', $A['id']);
  1171. $templates->set_var('lang_fields', $LANG_USERBOX_ADMIN['fields']);
  1172. $templates->set_var('lang_field', $LANG_USERBOX_ADMIN['field']);
  1173. $templates->set_var('lang_templatesetvar', $LANG_USERBOX_ADMIN['templatesetvar']);
  1174. $templates->set_var('lang_content', $LANG_USERBOX_ADMIN['content']);
  1175. $templates->set_var('lang_type', $LANG_USERBOX_ADMIN['type']);
  1176. $templates->set_var('lang_byusingid', $LANG_USERBOX_ADMIN['byusingid']);
  1177. $templates->set_var('lang_byusingcode', $LANG_USERBOX_ADMIN['byusingcode']);
  1178. $templates->set_var('lang_byusingtemplatesetvar', $LANG_USERBOX_ADMIN['byusingtemplatesetvar']);
  1179. $templates->set_var('lang_group', $LANG_USERBOX_ADMIN['group']);
  1180. $templates->set_var('lang_withlink', $LANG_USERBOX_ADMIN['withlink']);
  1181. $templates->set_var('lang_groupbygroup', $LANG_USERBOX_ADMIN['groupbygroup']);
  1182. $templates->set_var('lang_uid', $LANG28['2']);
  1183. $templates->set_var('lang_username', $LANG28['3']);
  1184. $templates->set_var ('username', $A['username']);
  1185. $templates->set_var('lang_fullname', $LANG28['4']);
  1186. $templates->set_var ('fullname', $A['fullname']);
  1187. $templates->set_var('lang_photo', $LANG04['77']);
  1188. if (isset($A['photo']) && empty(

Large files files are truncated, but you can click here to view the full file