PageRenderTime 45ms CodeModel.GetById 42ms RepoModel.GetById 0ms app.codeStats 3ms

/system/cp/cp.publish.php

https://github.com/danboy/Croissierd
PHP | 12868 lines | 9690 code | 2051 blank | 1127 comment | 1357 complexity | 0b20243405f78f6fdced90969332db15 MD5 | raw file

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

  1. <?php
  2. /*
  3. =====================================================
  4. ExpressionEngine - by EllisLab
  5. -----------------------------------------------------
  6. http://expressionengine.com/
  7. -----------------------------------------------------
  8. Copyright (c) 2003 - 2010 EllisLab, Inc.
  9. =====================================================
  10. THIS IS COPYRIGHTED SOFTWARE
  11. PLEASE READ THE LICENSE AGREEMENT
  12. http://expressionengine.com/docs/license.html
  13. =====================================================
  14. File: cp.publish.php
  15. -----------------------------------------------------
  16. Purpose: The main weblog class
  17. =====================================================
  18. */
  19. if ( ! defined('EXT'))
  20. {
  21. exit('Invalid file request');
  22. }
  23. class Publish {
  24. var $assign_cat_parent = TRUE;
  25. var $direct_return = FALSE;
  26. var $categories = array();
  27. var $cat_parents = array();
  28. var $smileys = array();
  29. var $glossary = array();
  30. var $nest_categories = 'y';
  31. var $cat_array = array();
  32. var $SPELL = FALSE;
  33. var $comment_chars = 25;
  34. var $comment_leave_breaks = 'n';
  35. var $url_title_error = FALSE;
  36. var $installed_modules = array();
  37. /** ------------------------
  38. /** Request handler
  39. /** ------------------------*/
  40. function request_handler()
  41. {
  42. global $IN, $DSP, $LANG, $FNS, $PREFS, $DB;
  43. $this->assign_cat_parent = ($PREFS->ini('auto_assign_cat_parents') == 'n') ? FALSE : TRUE;
  44. $query = $DB->query("SELECT LOWER(module_name) as name FROM exp_modules");
  45. foreach($query->result as $row)
  46. {
  47. $this->installed_modules[$row['name']] = $row['name'];
  48. }
  49. switch ($IN->GBL('M'))
  50. {
  51. case 'new_entry' : ( ! $IN->GBL('preview', 'POST')) ? $this->submit_new_entry() : $this->new_entry_form('preview');
  52. break;
  53. case 'entry_form' : $this->new_entry_form();
  54. break;
  55. case 'edit_entry' : $this->new_entry_form('edit');
  56. break;
  57. case 'view_entry' : $this->view_entry();
  58. break;
  59. case 'view_entries' : $this->edit_entries();
  60. break;
  61. case 'multi_edit' : $this->multi_edit_form();
  62. break;
  63. case 'update_multi_entries' : $this->update_multi_entries();
  64. break;
  65. case 'entry_category_update': $this->multi_entry_category_update();
  66. break;
  67. case 'delete_conf' : $this->delete_entries_confirm();
  68. break;
  69. case 'delete_entries' : $this->delete_entries();
  70. break;
  71. case 'view_comments' : $this->view_comments();
  72. break;
  73. case 'view_trackbacks' : $this->view_trackbacks();
  74. break;
  75. case 'move_comments_form' : $this->move_comments_form();
  76. break;
  77. case 'move_comments' : $this->move_comments();
  78. break;
  79. case 'edit_comment' : $this->edit_comment_form();
  80. break;
  81. case 'edit_trackback' : $this->edit_trackback_form();
  82. break;
  83. case 'change_status' : $this->change_comment_status();
  84. break;
  85. case 'update_comment' : $this->update_comment();
  86. break;
  87. case 'update_trackback' : $this->update_trackback();
  88. break;
  89. case 'modify_comments' : $this->modify_comments();
  90. break;
  91. case 'del_comment_conf' : $this->delete_comment_confirm();
  92. break;
  93. case 'del_comment' : $this->delete_comment();
  94. break;
  95. case 'view_pings' : $this->view_previous_pings();
  96. break;
  97. case 'file_upload_form' : $this->file_upload_form();
  98. break;
  99. case 'upload_file' : $this->upload_file();
  100. break;
  101. case 'file_browser' : $this->file_browser();
  102. break;
  103. case 'replace_file' : $this->replace_file();
  104. break;
  105. case 'image_options' : $this->image_options_form();
  106. break;
  107. case 'create_thumb' : $this->create_thumb();
  108. break;
  109. case 'spellcheck_iframe' : $this->spellcheck_iframe();
  110. break;
  111. case 'spellcheck' : $this->spellcheck();
  112. break;
  113. case 'emoticons' : $this->emoticons();
  114. break;
  115. default :
  116. if ($IN->GBL('C') == 'publish')
  117. {
  118. if ($IN->GBL('BK'))
  119. {
  120. return $this->new_entry_form();
  121. }
  122. $assigned_weblogs = $FNS->fetch_assigned_weblogs();
  123. if (count($assigned_weblogs) == 0)
  124. {
  125. return $DSP->no_access_message($LANG->line('unauthorized_for_any_blogs'));
  126. }
  127. else
  128. {
  129. if (count($assigned_weblogs) == 1)
  130. {
  131. return $this->new_entry_form();
  132. }
  133. else
  134. {
  135. return $this->weblog_select_list();
  136. }
  137. }
  138. }
  139. else
  140. {
  141. return $this->edit_entries();
  142. }
  143. break;
  144. }
  145. }
  146. /* END */
  147. /** --------------------------------------------
  148. /** Weblog selection menu
  149. /** --------------------------------------------*/
  150. // This function shows a list of available weblogs.
  151. // This list will be displayed when a user clicks the
  152. // "publish" link when more than one weblog exist.
  153. //--------------------------------------------
  154. function weblog_select_list($add='')
  155. {
  156. global $IN, $DSP, $DB, $LANG, $FNS, $SESS;
  157. if ($IN->GBL('C') == 'publish')
  158. {
  159. $blurb = $LANG->line('select_blog_to_post_in');
  160. $title = $LANG->line('publish');
  161. $action = 'C=publish'.AMP.'M=entry_form';
  162. }
  163. else
  164. {
  165. $blurb = $LANG->line('select_blog_to_edit');
  166. $title = $LANG->line('edit');
  167. $action = 'C=edit'.AMP.'M=view_entries';
  168. }
  169. /** -------------------------------------------------
  170. /** Fetch the blogs the user is allowed to post in
  171. /** -------------------------------------------------*/
  172. $links = array();
  173. $i = 0;
  174. foreach ($SESS->userdata['assigned_weblogs'] as $weblog_id => $weblog_title)
  175. {
  176. $links[] = $DSP->table_qrow(($i++ % 2) ? 'tableCellOne' : 'tableCellTwo', $DSP->qdiv('defaultBold', $DSP->anchor(BASE.AMP.$action.AMP.'weblog_id='.$weblog_id.$add, $weblog_title)));
  177. }
  178. // If there are no allowed blogs, show a message
  179. if (count($links) < 1)
  180. {
  181. return $DSP->no_access_message($LANG->line('unauthorized_for_any_blogs'));
  182. }
  183. $DSP->body .= $DSP->table('tableBorder', '0', '', '100%')
  184. .$DSP->table_qrow('tableHeading', $blurb);
  185. foreach ($links as $val)
  186. {
  187. $DSP->body .= $val;
  188. }
  189. $DSP->body .= $DSP->table_c();
  190. $DSP->title = $title;
  191. $DSP->crumb = $title;
  192. }
  193. /* END */
  194. /** --------------------------------------------
  195. /** Weblog "new entry" form
  196. /** --------------------------------------------*/
  197. // This function displays the form used to submit, edit, or
  198. // preview new weblog entries with.
  199. //--------------------------------------------
  200. function new_entry_form($which = 'new', $submission_error = '', $entry_id='', $hidden = array())
  201. {
  202. global $DSP, $LANG, $LOC, $DB, $IN, $REGX, $FNS, $SESS, $PREFS, $EXT;
  203. $title = '';
  204. $url_title = '';
  205. $url_title_prefix = '';
  206. $default_entry_title = '';
  207. $status = '';
  208. $expiration_date = '';
  209. $comment_expiration_date = '';
  210. $entry_date = '';
  211. $sticky = '';
  212. $allow_trackbacks = '';
  213. $trackback_urls = '';
  214. $field_data = '';
  215. $allow_comments = '';
  216. $preview_text = '';
  217. $catlist = '';
  218. $author_id = '';
  219. $tb_url = '';
  220. $bookmarklet = FALSE;
  221. $version_id = $IN->GBL('version_id');
  222. $version_num = $IN->GBL('version_num');
  223. $dst_enabled = $SESS->userdata('daylight_savings');
  224. $weblog_id = '';
  225. if ($PREFS->ini('site_pages') !== FALSE)
  226. {
  227. $LANG->fetch_language_file('pages');
  228. }
  229. $publish_tabs = array('form' => $LANG->line('publish_form'),
  230. 'date' => $LANG->line('date'),
  231. 'cat' => $LANG->line('categories'),
  232. 'option' => $LANG->line('options'),
  233. 'tb' => $LANG->line('trackbacks'),
  234. 'ping' => $LANG->line('pings'),
  235. 'forum' => $LANG->line('forum'),
  236. 'revisions' => $LANG->line('revisions'),
  237. 'pages' => $LANG->line('pages_module_name'),
  238. 'show_all' => $LANG->line('show_all'),
  239. );
  240. /** ------------------------------------------------------------------
  241. /** We need to first determine which weblog to post the entry into.
  242. /** ------------------------------------------------------------------*/
  243. $assigned_weblogs = $FNS->fetch_assigned_weblogs();
  244. // if it's an edit, we just need the entry id and can figure out the rest
  245. if ($IN->GBL('entry_id', 'GET') !== FALSE AND is_numeric($IN->GBL('entry_id', 'GET')) AND $weblog_id == '')
  246. {
  247. $query = $DB->query("SELECT weblog_id FROM exp_weblog_titles WHERE entry_id = '".$DB->escape_str($IN->GBL('entry_id', 'GET'))."'");
  248. if ($query->num_rows == 1)
  249. {
  250. $weblog_id = $query->row['weblog_id'];
  251. }
  252. }
  253. if ($weblog_id == '' AND ! ($weblog_id = $IN->GBL('weblog_id', 'GP')))
  254. {
  255. // Does the user have their own blog?
  256. if ($SESS->userdata['weblog_id'] != 0)
  257. {
  258. $weblog_id = $SESS->userdata['weblog_id'];
  259. }
  260. elseif (sizeof($assigned_weblogs) == 1)
  261. {
  262. $weblog_id = $assigned_weblogs['0'];
  263. }
  264. else
  265. {
  266. $query = $DB->query("SELECT weblog_id from exp_weblogs WHERE is_user_blog = 'n'");
  267. if ($query->num_rows == 1)
  268. {
  269. $weblog_id = $query->row['weblog_id'];
  270. }
  271. else
  272. {
  273. return false;
  274. }
  275. }
  276. }
  277. if ( ! is_numeric($weblog_id))
  278. return FALSE;
  279. /** ----------------------------------------------
  280. /** Security check
  281. /** ---------------------------------------------*/
  282. if ( ! in_array($weblog_id, $assigned_weblogs))
  283. {
  284. return $DSP->no_access_message($LANG->line('unauthorized_for_this_blog'));
  285. }
  286. // -------------------------------------------
  287. // 'publish_form_start' hook.
  288. // - Allows complete rewrite of Publish page.
  289. // - Added $hidden: 1.6.0
  290. //
  291. $edata = $EXT->call_extension('publish_form_start', $which, $submission_error, $entry_id, $hidden);
  292. if ($EXT->end_script === TRUE) return;
  293. //
  294. // -------------------------------------------
  295. // -------------------------------------------
  296. // 'publish_form_headers' hook.
  297. // - Adds content to headers for Publish page.
  298. // - Added $weblog_id: 1.6
  299. // - Added $hidden: 1.6.0
  300. //
  301. $DSP->extra_header .= $EXT->call_extension('publish_form_headers', $which, $submission_error, $entry_id, $weblog_id, $hidden);
  302. if ($EXT->end_script === TRUE) return;
  303. //
  304. // -------------------------------------------
  305. // -------------------------------------------
  306. // 'publish_form_new_tabs' hook.
  307. // - Allows adding of new tabs to submission form
  308. // - Added: 1.4.1
  309. // - Added $hidden: 1.6.0
  310. //
  311. if ($EXT->active_hook('publish_form_new_tabs') === TRUE)
  312. {
  313. $publish_tabs = $EXT->call_extension('publish_form_new_tabs', $publish_tabs, $weblog_id, $entry_id, $hidden);
  314. }
  315. //
  316. // -------------------------------------------
  317. /** ----------------------------------------------
  318. /** If Still Set, Show All Goes at the End
  319. /** ---------------------------------------------*/
  320. if (isset($publish_tabs['show_all']))
  321. {
  322. unset($publish_tabs['show_all']);
  323. $publish_tabs['show_all'] = $LANG->line('show_all');
  324. }
  325. /** ----------------------------------------------
  326. /** Fetch weblog preferences
  327. /** ---------------------------------------------*/
  328. $query = $DB->query("SELECT * FROM exp_weblogs WHERE weblog_id = '".$DB->escape_str($weblog_id)."'");
  329. if ($query->num_rows == 0)
  330. {
  331. return $DSP->error_message($LANG->line('no_weblog_exits'));
  332. }
  333. // -------------------------------------------
  334. // 'publish_form_weblog_preferences' hook.
  335. // - Modify weblog preferences
  336. // - Added: 1.4.1
  337. //
  338. if ($EXT->active_hook('publish_form_weblog_preferences') === TRUE)
  339. {
  340. $query->row = $EXT->call_extension('publish_form_weblog_preferences', $query->row);
  341. }
  342. //
  343. // -------------------------------------------
  344. foreach ($query->row as $key => $val)
  345. {
  346. $$key = $val;
  347. }
  348. /** ----------------------------------------------
  349. /** Fetch Revision if Necessary
  350. /** ---------------------------------------------*/
  351. $show_revision_cluster = ($enable_versioning == 'y') ? 'y' : 'n';
  352. if ($which == 'new')
  353. {
  354. $versioning_enabled = ($enable_versioning == 'y') ? 'y' : 'n';
  355. }
  356. else
  357. {
  358. $versioning_enabled = (isset($_POST['versioning_enabled'])) ? 'y' : 'n';
  359. }
  360. if (is_numeric($version_id))
  361. {
  362. $entry_id = $IN->GBL('entry_id');
  363. $revquery = $DB->query("SELECT version_data FROM exp_entry_versioning WHERE entry_id = '{$entry_id}' AND version_id = '{$version_id}'");
  364. if ($revquery->num_rows == 1)
  365. {
  366. $_POST = $REGX->array_stripslashes(@unserialize($revquery->row['version_data']));
  367. $_POST['entry_id'] = $entry_id;
  368. $which = 'preview';
  369. }
  370. unset($revquery);
  371. }
  372. /** ---------------------------------------
  373. /** Insane Idea to Have Defaults and Prefixes
  374. /** ---------------------------------------*/
  375. if ($which == 'edit')
  376. {
  377. $url_title_prefix = '';
  378. }
  379. elseif ($which == 'new')
  380. {
  381. $title = $default_entry_title;
  382. $url_title = $url_title_prefix;
  383. }
  384. // --------------------------------------------------------------------
  385. // The $which variable determines what the page should show:
  386. // If $which = 'new' we'll show a blank "new entry" page
  387. // If $which = "preview", the user has clicked the "preview" button.
  388. // If $which = "edit", we are editing an already existing entry.
  389. // If $which = 'save', like a preview, but also an edit.
  390. // --------------------------------------------------------------------
  391. if ($which == 'edit')
  392. {
  393. if ( ! $entry_id = $IN->GBL('entry_id', 'GET'))
  394. {
  395. return false;
  396. }
  397. // Fetch the weblog data
  398. $sql = "SELECT t.*, d.*
  399. FROM exp_weblog_titles AS t, exp_weblog_data AS d
  400. WHERE t.entry_id = '$entry_id'
  401. AND t.weblog_id = '$weblog_id'
  402. AND t.entry_id = d.entry_id";
  403. $result = $DB->query($sql);
  404. if ($result->num_rows == 0)
  405. {
  406. return $DSP->error_message($LANG->line('no_weblog_exits'));
  407. }
  408. if ($result->row['author_id'] != $SESS->userdata('member_id'))
  409. {
  410. if ( ! $DSP->allowed_group('can_edit_other_entries'))
  411. {
  412. return $DSP->no_access_message();
  413. }
  414. }
  415. // -------------------------------------------
  416. // 'publish_form_entry_data' hook.
  417. // - Modify entry's data
  418. // - Added: 1.4.1
  419. //
  420. if ($EXT->active_hook('publish_form_entry_data') === TRUE)
  421. {
  422. $result->row = $EXT->call_extension('publish_form_entry_data', $result->row);
  423. }
  424. //
  425. // -------------------------------------------
  426. foreach ($result->row as $key => $val)
  427. {
  428. $$key = $val;
  429. }
  430. }
  431. /** ---------------------------------------------
  432. /** Assign page title based on type of request
  433. /** ---------------------------------------------*/
  434. switch ($which)
  435. {
  436. case 'edit' : $DSP->title = $LANG->line('edit_entry');
  437. break;
  438. case 'save' : $DSP->title = $LANG->line('edit_entry');
  439. break;
  440. case 'preview' : $DSP->title = $LANG->line('preview');
  441. break;
  442. default : $DSP->title = $LANG->line('new_entry');
  443. break;
  444. }
  445. /** ----------------------------------------------
  446. /** Assign breadcrumb
  447. /** ---------------------------------------------*/
  448. $DSP->crumb = $DSP->title.$DSP->crumb_item($blog_title);
  449. $activate_calendars = '"';
  450. if ($show_date_menu == 'y')
  451. {
  452. // Setup some onload items
  453. $activate_calendars = 'activate_calendars();" ';
  454. $DSP->extra_header .= '<script type="text/javascript">
  455. // depending on timezones, local settings and localization prefs, its possible for js to misinterpret the day,
  456. // but the humanized time is correct, so we activate the humanized time to sync the calendar
  457. function activate_calendars() {
  458. update_calendar(\'entry_date\', document.getElementById(\'entry_date\').value);
  459. update_calendar(\'expiration_date\', document.getElementById(\'expiration_date\').value);';
  460. if ($comment_system_enabled == 'y')
  461. {
  462. $DSP->extra_header .= "\n\t\t\t\t".'update_calendar(\'comment_expiration_date\', document.getElementById(\'comment_expiration_date\').value);';
  463. }
  464. $DSP->extra_header .= "\n\t\t\t\t"."current_month = '';
  465. current_year = '';
  466. last_date = '';";
  467. $DSP->extra_header .= "\n".'}
  468. </script>';
  469. }
  470. /* -------------------------------------
  471. /* Publish Page Title Focus
  472. /*
  473. /* makes the title field gain focus when the page is loaded
  474. /*
  475. /* Hidden Configuration Variable
  476. /* - publish_page_title_focus => Set focus to the tile? (y/n)
  477. /* -------------------------------------*/
  478. if ($which != 'edit' && $PREFS->ini('publish_page_title_focus') !== 'n')
  479. {
  480. $load_events = 'document.forms[0].title.focus();set_catlink();';
  481. }
  482. else
  483. {
  484. $load_events = 'set_catlink();';
  485. }
  486. $DSP->body_props .= ' onload="'.$load_events.$activate_calendars;
  487. // -------------------------------------------
  488. // 'publish_form_body_props' hook.
  489. // - Allows setting of the body properties
  490. //
  491. $edata = $EXT->call_extension('publish_form_body_props');
  492. if ($EXT->end_script === TRUE) return;
  493. //
  494. // -------------------------------------------
  495. /** ----------------------------------------------
  496. /** Are we using the bookmarklet?
  497. /** ---------------------------------------------*/
  498. if ($IN->GBL('BK', 'GP'))
  499. {
  500. $bookmarklet = TRUE;
  501. $tb_url = $IN->GBL('tb_url', 'GP');
  502. }
  503. /** ----------------------------------------------
  504. /** Start building the page output
  505. /** ---------------------------------------------*/
  506. $r = '';
  507. /** ----------------------------------------------
  508. /** Form header and hidden fields
  509. /** ---------------------------------------------*/
  510. $BK = ($bookmarklet == TRUE) ? AMP.'BK=1'.AMP.'Z=1' : '';
  511. if ($IN->GBL('C') == 'publish')
  512. {
  513. $r .= $DSP->form_open(
  514. array(
  515. 'action' => 'C=publish'.AMP.'M=new_entry'.$BK,
  516. 'name' => 'entryform',
  517. 'id' => 'entryform'
  518. )
  519. );
  520. }
  521. else
  522. {
  523. $r .= $DSP->form_open(
  524. array(
  525. 'action' => 'C=edit'.AMP.'M=new_entry'.$BK,
  526. 'name' => 'entryform',
  527. 'id' => 'entryform'
  528. )
  529. );
  530. }
  531. $r .= $DSP->input_hidden('weblog_id', $weblog_id);
  532. foreach($hidden as $key => $value)
  533. {
  534. $r .= $DSP->input_hidden($key, $value);
  535. }
  536. if ($IN->GBL('entry_id', 'POST'))
  537. {
  538. $entry_id = $IN->GBL('entry_id');
  539. }
  540. if (isset($entry_id))
  541. {
  542. $r .= $DSP->input_hidden('entry_id', $entry_id);
  543. }
  544. if ($bookmarklet == TRUE)
  545. {
  546. $r .= $DSP->input_hidden('tb_url', $tb_url);
  547. }
  548. /** --------------------------------
  549. /** Fetch Custom Fields
  550. /** --------------------------------*/
  551. // Even though we don't need this query until laters we'll run the
  552. // query here so that we can show previews in the proper order.
  553. // -------------------------------------------
  554. // 'publish_form_field_query' hook.
  555. // - Allows control over the field query, controlling what fields will be displayed
  556. //
  557. if (isset($EXT->extensions['publish_form_field_query']))
  558. {
  559. $field_query = $EXT->call_extension('publish_form_field_query', $this, $field_group);
  560. }
  561. else
  562. {
  563. $field_query = $DB->query("SELECT * FROM exp_weblog_fields WHERE group_id = '$field_group' ORDER BY field_order");
  564. }
  565. //
  566. // -------------------------------------------
  567. /** ----------------------------------------------
  568. /** Javascript stuff
  569. /** ---------------------------------------------*/
  570. $convert_ascii = ($PREFS->ini('auto_convert_high_ascii') == 'y') ? TRUE : FALSE;
  571. // "title" input Field
  572. if ($IN->GBL('title', 'GET'))
  573. {
  574. $title = $this->bm_qstr_decode($IN->GBL('title', 'GET'));
  575. }
  576. $word_separator = $PREFS->ini('word_separator') != "dash" ? '_' : '-';
  577. if ( ! class_exists('Spellcheck'))
  578. {
  579. require PATH_CORE.'core.spellcheck'.EXT;
  580. }
  581. $this->SPELL = new Spellcheck();
  582. $spellcheck_js = $this->SPELL->JavaScript(BASE.'&C=publish&M=spellcheck');
  583. /** -------------------------------------
  584. /** Create Foreign Character Conversion JS
  585. /** -------------------------------------*/
  586. /* -------------------------------------
  587. /* 'foreign_character_conversion_array' hook.
  588. /* - Allows you to use your own foreign character conversion array
  589. /* - Added 1.6.0
  590. */
  591. if (isset($EXT->extensions['foreign_character_conversion_array']))
  592. {
  593. $foreign_characters = $EXT->call_extension('foreign_character_conversion_array');
  594. }
  595. else
  596. {
  597. $foreign_characters = array('223' => "ss", // ß
  598. '224' => "a", '225' => "a", '226' => "a", '229' => "a",
  599. '227' => "ae", '230' => "ae", '228' => "ae",
  600. '231' => "c",
  601. '232' => "e", // è
  602. '233' => "e", // é
  603. '234' => "e", // ê
  604. '235' => "e", // ë
  605. '236' => "i", '237' => "i", '238' => "i", '239' => "i",
  606. '241' => "n",
  607. '242' => "o", '243' => "o", '244' => "o", '245' => "o",
  608. '246' => "oe", // ö
  609. '249' => "u", '250' => "u", '251' => "u",
  610. '252' => "ue", // ü
  611. '255' => "y",
  612. '257' => "aa",
  613. '269' => "ch",
  614. '275' => "ee",
  615. '291' => "gj",
  616. '299' => "ii",
  617. '311' => "kj",
  618. '316' => "lj",
  619. '326' => "nj",
  620. '353' => "sh",
  621. '363' => "uu",
  622. '382' => "zh",
  623. '256' => "aa",
  624. '268' => "ch",
  625. '274' => "ee",
  626. '290' => "gj",
  627. '298' => "ii",
  628. '310' => "kj",
  629. '315' => "lj",
  630. '325' => "nj",
  631. '352' => "sh",
  632. '362' => "uu",
  633. '381' => "zh",
  634. );
  635. }
  636. /*
  637. /* -------------------------------------*/
  638. $foreign_replace = '';
  639. foreach($foreign_characters as $old => $new)
  640. {
  641. $foreign_replace .= "if (c == '$old') {NewTextTemp += '$new'; continue;}\n\t\t\t\t";
  642. }
  643. /** -------------------------------------
  644. /** Publish Tabs JavaScript
  645. /** -------------------------------------*/
  646. $publish_tabs_javascript = "var blockarray = new Array(".(sizeof($publish_tabs) - 1).")\n";
  647. $p = 0;
  648. foreach($publish_tabs as $short => $long)
  649. {
  650. $publish_tabs_javascript .= "\t\t".'blockarray['.$p.'] = "block'.$short.'"'."\n"; $p++;
  651. }
  652. $default_entry_title = $REGX->form_prep($default_entry_title);
  653. $r .= <<<EOT
  654. <script type="text/javascript">
  655. <!--
  656. /** ------------------------------------
  657. /** Swap out categories
  658. /** -------------------------------------*/
  659. // This is used by the "edit categories" feature
  660. function set_catlink()
  661. {
  662. if (document.getElementById('cateditlink'))
  663. {
  664. if (browser == "IE" && OS == "Mac")
  665. {
  666. document.getElementById('cateditlink').style.display = "none";
  667. }
  668. else
  669. {
  670. document.getElementById('cateditlink').style.display = "block";
  671. }
  672. }
  673. }
  674. function swap_categories(str)
  675. {
  676. document.getElementById('categorytree').innerHTML = str;
  677. }
  678. /** ------------------------------------
  679. /** Array Helper Functions
  680. /** -------------------------------------*/
  681. function getarraysize(thearray)
  682. {
  683. for (i = 0; i < thearray.length; i++)
  684. {
  685. if ((thearray[i] == "undefined") || (thearray[i] == "") || (thearray[i] == null))
  686. {
  687. return i;
  688. }
  689. }
  690. return thearray.length;
  691. }
  692. // Array push
  693. function arraypush(thearray, value)
  694. {
  695. thearray[getarraysize(thearray)] = value;
  696. }
  697. // Array pop
  698. function arraypop(thearray)
  699. {
  700. thearraysize = getarraysize(thearray);
  701. retval = thearray[thearraysize - 1];
  702. delete thearray[thearraysize - 1];
  703. return retval;
  704. }
  705. /** ------------------------------------
  706. /** Live URL Title Function
  707. /** -------------------------------------*/
  708. function liveUrlTitle()
  709. {
  710. var defaultTitle = '{$default_entry_title}';
  711. var NewText = document.getElementById("title").value;
  712. if (defaultTitle != '')
  713. {
  714. if (NewText.substr(0, defaultTitle.length) == defaultTitle)
  715. {
  716. NewText = NewText.substr(defaultTitle.length);
  717. }
  718. }
  719. NewText = NewText.toLowerCase();
  720. var separator = "{$word_separator}";
  721. // Foreign Character Attempt
  722. var NewTextTemp = '';
  723. for(var pos=0; pos<NewText.length; pos++)
  724. {
  725. var c = NewText.charCodeAt(pos);
  726. if (c >= 32 && c < 128)
  727. {
  728. NewTextTemp += NewText.charAt(pos);
  729. }
  730. else
  731. {
  732. {$foreign_replace}
  733. }
  734. }
  735. var multiReg = new RegExp(separator + '{2,}', 'g');
  736. NewText = NewTextTemp;
  737. NewText = NewText.replace('/<(.*?)>/g', '');
  738. NewText = NewText.replace(/\s+/g, separator);
  739. NewText = NewText.replace(/\//g, separator);
  740. NewText = NewText.replace(/[^a-z0-9\-\._]/g,'');
  741. NewText = NewText.replace(/\+/g, separator);
  742. NewText = NewText.replace(multiReg, separator);
  743. NewText = NewText.replace(/-$/g,'');
  744. NewText = NewText.replace(/_$/g,'');
  745. NewText = NewText.replace(/^_/g,'');
  746. NewText = NewText.replace(/^-/g,'');
  747. NewText = NewText.replace(/\.+$/g,'');
  748. if (document.getElementById("url_title"))
  749. {
  750. document.getElementById("url_title").value = "{$url_title_prefix}" + NewText;
  751. }
  752. else
  753. {
  754. document.forms['entryform'].elements['url_title'].value = "{$url_title_prefix}" + NewText;
  755. }
  756. }
  757. /** ------------------------------------
  758. /** Publish Option Tabs Open/Close
  759. /** -------------------------------------*/
  760. {$publish_tabs_javascript}
  761. function showblock(which)
  762. {
  763. for (i = 0 ; i < blockarray.length; i++ )
  764. {
  765. if (document.getElementById(blockarray[i]))
  766. {
  767. if (which == 'blockshow_all')
  768. {
  769. document.getElementById(blockarray[i]).style.display = "block";
  770. }
  771. else
  772. {
  773. document.getElementById(blockarray[i]).style.display = "none";
  774. }
  775. }
  776. var menu = blockarray[i].substring(5) + 'menu';
  777. if (document.getElementById(menu))
  778. {
  779. document.getElementById(menu).style.display = "none";
  780. }
  781. }
  782. var menu = which.substring(5) + 'menu';
  783. if (document.getElementById(which))
  784. {
  785. document.getElementById(which).style.display = "block";
  786. document.getElementById(menu).style.display = "block";
  787. }
  788. }
  789. function styleswitch(link)
  790. {
  791. if (document.getElementById(link).className == 'publishTabs')
  792. {
  793. document.getElementById(link).className = 'publishTabsHover';
  794. }
  795. }
  796. function stylereset(link)
  797. {
  798. if (document.getElementById(link).className == 'publishTabsHover')
  799. {
  800. document.getElementById(link).className = 'publishTabs';
  801. }
  802. }
  803. /** ------------------------------------
  804. /** Glossary Item Insert
  805. /** -------------------------------------*/
  806. function glossaryInsert(item, id, tag)
  807. {
  808. selField = "field_id_" + id;
  809. taginsert('other', tag, '');
  810. }
  811. /** ------------------------------------
  812. /** Smiley Insert
  813. /** -------------------------------------*/
  814. function add_smiley(smiley, id)
  815. {
  816. selField = "field_id_" + id;
  817. taginsert('other', " " + smiley + " ", '');
  818. showhide_smileys(id);
  819. }
  820. {$spellcheck_js}
  821. /** ------------------------------------
  822. /** Show/Hide Similey Pane
  823. /** -------------------------------------*/
  824. var open_panes = new Array();
  825. function showhide_smileys(id)
  826. {
  827. cid = 'smileys_' + id;
  828. gl = 'glossary_' + id;
  829. sp = 'spellcheck_field_id_' + id;
  830. if (document.getElementById(cid))
  831. {
  832. if (document.getElementById(cid).style.display == "block")
  833. {
  834. hide_open_panes();
  835. }
  836. else
  837. {
  838. document.getElementById(cid).style.display = "block";
  839. document.getElementById(gl).style.display = "none";
  840. if (document.getElementById(sp))
  841. {
  842. document.getElementById(sp).style.display = "none";
  843. }
  844. hide_open_panes();
  845. arraypush(open_panes, cid);
  846. }
  847. }
  848. }
  849. /** ------------------------------------
  850. /** Show/hide Glossary Pane
  851. /** -------------------------------------*/
  852. function showhide_glossary(id)
  853. {
  854. cid = 'glossary_' + id;
  855. sm = 'smileys_' + id;
  856. sp = 'spellcheck_field_id_' + id;
  857. if (document.getElementById(cid))
  858. {
  859. if (document.getElementById(cid).style.display == "block")
  860. {
  861. hide_open_panes();
  862. }
  863. else
  864. {
  865. document.getElementById(cid).style.display = "block";
  866. document.getElementById(sm).style.display = "none";
  867. if (document.getElementById(sp))
  868. {
  869. document.getElementById(sp).style.display = "none";
  870. }
  871. hide_open_panes();
  872. arraypush(open_panes, cid);
  873. }
  874. }
  875. }
  876. /** ------------------------------------
  877. /** Show/hide Spellcheck Pane
  878. /** -------------------------------------*/
  879. function showhide_spellcheck(id)
  880. {
  881. cid = 'spellcheck_field_id_' + id;
  882. sm = 'smileys_' + id;
  883. gl = 'glossary_' + id;
  884. if (document.getElementById(cid))
  885. {
  886. if (document.getElementById(cid).style.display == "block")
  887. {
  888. SP_closeSpellCheck();
  889. hide_open_panes();
  890. }
  891. else
  892. {
  893. document.getElementById(cid).style.display = "block";
  894. document.getElementById(sm).style.display = "none";
  895. document.getElementById(gl).style.display = "none";
  896. eeSpell.getResults('field_id_'+id);
  897. hide_open_panes();
  898. arraypush(open_panes, cid);
  899. }
  900. }
  901. }
  902. /** ------------------------------------
  903. /** Close Open Panes
  904. /** -------------------------------------*/
  905. function hide_open_panes()
  906. {
  907. if (open_panes[0])
  908. {
  909. while (open_panes[0])
  910. {
  911. clearState = arraypop(open_panes);
  912. document.getElementById(clearState).style.display = "none";
  913. }
  914. }
  915. }
  916. /** ------------------------------------
  917. /** Generic show/hide
  918. /** -------------------------------------*/
  919. function showhide_item(id)
  920. {
  921. if (document.getElementById(id).style.display == "block")
  922. {
  923. document.getElementById(id).style.display = "none";
  924. }
  925. else
  926. {
  927. document.getElementById(id).style.display = "block";
  928. }
  929. }
  930. /** ------------------------------------
  931. /** Show/hide Fields
  932. /** -------------------------------------*/
  933. function showhide_field(id)
  934. {
  935. f_off = 'field_pane_off_' + id;
  936. f_on = 'field_pane_on_' + id;
  937. if (document.getElementById(f_off).style.display == "block")
  938. {
  939. document.getElementById(f_off).style.display = "none";
  940. document.getElementById(f_on).style.display = "block";
  941. }
  942. else
  943. {
  944. document.getElementById(f_off).style.display = "block";
  945. document.getElementById(f_on).style.display = "none";
  946. }
  947. }
  948. // Remove the Preview from the DOM so it isn't added to submitted content
  949. document.getElementById('entryform').onsubmit = function()
  950. {
  951. if (document.getElementById('entryform').hasChildNodes(document.getElementById('previewBox')) == true)
  952. {
  953. document.getElementById('entryform').removeChild(document.getElementById('previewBox'));
  954. }
  955. }
  956. -->
  957. </script>
  958. EOT;
  959. $r .= NL.NL;
  960. if ($bookmarklet == TRUE)
  961. {
  962. $r .= $DSP->qdiv('defaultSmall', NBS);
  963. }
  964. /** ----------------------------------------------
  965. /** Are we previewing an entry?
  966. /** ---------------------------------------------*/
  967. if ($which == 'preview')
  968. {
  969. /** ----------------------------------------
  970. /** Instantiate Typography class
  971. /** ----------------------------------------*/
  972. if ( ! class_exists('Typography'))
  973. {
  974. require PATH_CORE.'core.typography'.EXT;
  975. }
  976. $TYPE = new Typography;
  977. $TYPE->convert_curly = FALSE;
  978. $this->smileys = $TYPE->smiley_array;
  979. $preview = ($version_id == FALSE) ? $LANG->line('preview') : $LANG->line('version_preview');
  980. if (is_numeric($version_num))
  981. {
  982. $preview = str_replace('%s', $version_num, $preview);
  983. }
  984. $prv_title = ($submission_error == '') ? $preview : $DSP->qspan('alert', $LANG->line('error'));
  985. $r .= '<fieldset class="previewBox" id="previewBox">';
  986. $r .= '<legend class="previewItemTitle">&nbsp;'.$prv_title.'&nbsp;</legend>';
  987. if ($submission_error == '')
  988. {
  989. $r .= $DSP->heading($TYPE->format_characters(stripslashes($IN->GBL('title', 'POST'))));
  990. }
  991. // We need to grab each global array index and do a little formatting
  992. $preview_build = array();
  993. foreach($_POST as $key => $val)
  994. {
  995. // Gather categories. Since you can select as many categories as you want
  996. // they are submitted as an array. The $_POST['category'] index
  997. // contains a sub-array as the value, therefore we need to loop through
  998. // it and assign discrete variables.
  999. if (is_array($val))
  1000. {
  1001. foreach($val as $k => $v)
  1002. {
  1003. $_POST[$k] = $v;
  1004. }
  1005. if ($key == 'category' OR $key == 'ping')
  1006. {
  1007. unset($_POST[$key]);
  1008. }
  1009. }
  1010. else
  1011. {
  1012. if ($submission_error == '')
  1013. {
  1014. if (strstr($key, 'field_id'))
  1015. {
  1016. $expl = explode('field_id_', $key);
  1017. // Pass the entry data to the typography class
  1018. $txt_fmt = ( ! isset($_POST['field_ft_'.$expl['1']])) ? 'xhtml' : $_POST['field_ft_'.$expl['1']];
  1019. $p_open = ($txt_fmt != 'xhtml') ? '<p>' : '';
  1020. $p_close = ($txt_fmt != 'xhtml') ? '</p>' : '';
  1021. $preview_build['field_id_'.$expl['1']] = $p_open.$TYPE->parse_type( stripslashes($val),
  1022. array(
  1023. 'text_format' => $txt_fmt,
  1024. 'html_format' => $weblog_html_formatting,
  1025. 'auto_links' => $weblog_auto_link_urls,
  1026. 'allow_img_url' => $weblog_allow_img_urls
  1027. )
  1028. ).$p_close;
  1029. /** ----------------------------
  1030. /** Certain tags might cause havoc, so we remove them
  1031. /** ----------------------------*/
  1032. $preview_build['field_id_'.$expl['1']] = preg_replace("#<script([^>]*)>.*?</script>#is", '', $preview_build['field_id_'.$expl['1']]);
  1033. $preview_build['field_id_'.$expl['1']] = preg_replace("#<form([^>]*)>(.*?)</form>#is", '\2', $preview_build['field_id_'.$expl['1']]);
  1034. }
  1035. }
  1036. $val = stripslashes($val);
  1037. $_POST[$key] = $val;
  1038. }
  1039. $$key = $val;
  1040. }
  1041. // Show the preview. We do it this way in order to honor
  1042. // the custom field order since we can't guarantee that $_POST
  1043. // data will be in the correct order
  1044. if (count($preview_build) > 0)
  1045. {
  1046. foreach ($field_query->result as $row)
  1047. {
  1048. if (isset($preview_build['field_id_'.$row['field_id']]))
  1049. {
  1050. $r .= $preview_build['field_id_'.$row['field_id']];
  1051. }
  1052. }
  1053. }
  1054. // Do we have a forum topic preview?
  1055. if ($PREFS->ini('forum_is_installed') == "y")
  1056. {
  1057. if ($IN->GBL('forum_title') != '')
  1058. {
  1059. $r .= $DSP->qdiv('itemWrapper',
  1060. $DSP->qdiv('itemTitle', $LANG->line('forum_title', 'title')).
  1061. $DSP->qdiv('', $IN->GBL('forum_title'))
  1062. );
  1063. }
  1064. if ($IN->GBL('forum_body') != '')
  1065. {
  1066. $forum_body = $TYPE->parse_type( stripslashes($IN->GBL('forum_body')),
  1067. array(
  1068. 'text_format' => 'xhtml',
  1069. 'html_format' => 'safe',
  1070. 'auto_links' => 'y',
  1071. 'allow_img_url' => 'y'
  1072. )
  1073. );
  1074. $r .= $DSP->qdiv('itemWrapper',
  1075. $DSP->qdiv('itemTitle', $LANG->line('forum_body', 'title')).
  1076. $DSP->qdiv('', $forum_body)
  1077. );
  1078. }
  1079. }
  1080. // -------------------------------------------
  1081. // 'publish_form_preview_additions' hook.
  1082. // - Add content to preview
  1083. // - As this is a preview, content can be gotten from $_POST
  1084. // - Added: 1.4.1
  1085. //
  1086. if ($EXT->active_hook('publish_form_preview_additions') === TRUE)
  1087. {
  1088. $r .= $EXT->call_extension('publish_form_preview_additions');
  1089. }
  1090. //
  1091. // -------------------------------------------
  1092. // Are there any errors?
  1093. if ($submission_error != '')
  1094. {
  1095. $r .= $DSP->qdiv('highlight', $submission_error);
  1096. }
  1097. $r .= '</fieldset>';
  1098. }
  1099. // END PREVIEW
  1100. // QUICK SAVE: THE PREVIEW PART
  1101. if ($which == 'save')
  1102. {
  1103. foreach($_POST as $key => $val)
  1104. {
  1105. if (is_array($val))
  1106. {
  1107. foreach($val as $k => $v)
  1108. {
  1109. $_POST[$k] = $v;
  1110. }
  1111. if ($key == 'category' OR $key == 'ping')
  1112. {
  1113. unset($_POST[$key]);
  1114. }
  1115. }
  1116. else
  1117. {
  1118. $val = stripslashes($val);
  1119. $_POST[$key] = $val;
  1120. }
  1121. if ($key != 'entry_id')
  1122. {
  1123. $$key = $val;
  1124. }
  1125. // we need to unset this or it will cause the forum tab to not display the existing connection
  1126. unset($forum_topic_id);
  1127. }
  1128. $r .= '<fieldset class="previewBox" id="previewBox">';
  1129. $r .= '<legend class="previewItemTitle">&nbsp;'.$LANG->line('quick_save').'&nbsp;</legend></fieldset>';
  1130. }
  1131. // END SAVE
  1132. /** --------------------------------
  1133. /** Weblog pull-down menu
  1134. /** --------------------------------*/
  1135. $menu_weblog = '';
  1136. $show_weblog_menu = 'y';
  1137. if ($show_weblog_menu == 'n')
  1138. {
  1139. $r .= $DSP->input_hidden('new_weblog', $weblog_id);
  1140. }
  1141. elseif($which != 'new')
  1142. {
  1143. /** --------------------------------
  1144. /** Create weblog menu
  1145. /** --------------------------------*/
  1146. $query = $DB->query("SELECT weblog_id, blog_title FROM exp_weblogs
  1147. WHERE status_group = '$status_group'
  1148. AND cat_group = '".$DB->escape_str($cat_group)."'
  1149. AND field_group = '$field_group'
  1150. AND site_id = '".$DB->escape_str($PREFS->ini('site_id'))."'
  1151. ORDER BY blog_title");
  1152. if ($query->num_rows > 0)
  1153. {
  1154. foreach ($query->result as $row)
  1155. {
  1156. if ($SESS->userdata['group_id'] == 1 OR in_array($row['weblog_id'], $assigned_weblogs))
  1157. {
  1158. if (isset($_POST['new_weblog']) && is_numeric($_POST['new_weblog']))
  1159. {
  1160. $selected = ($_POST['new_weblog'] == $row['weblog_id']) ? 1 : '';
  1161. }
  1162. else
  1163. {
  1164. $selected = ($weblog_id == $row['weblog_id']) ? 1 : '';
  1165. }
  1166. $menu_weblog .= $DSP->input_select_option($row['weblog_id'], $REGX->form_prep($row['blog_title']), $selected);
  1167. }
  1168. }
  1169. if ($menu_weblog != '')
  1170. {
  1171. $menu_weblog = $DSP->input_select_header('new_weblog').$menu_weblog.$DSP->input_select_footer();
  1172. }
  1173. }
  1174. }
  1175. /** --------------------------------
  1176. /** Status pull-down menu
  1177. /** --------------------------------*/
  1178. $menu_status = '';
  1179. if ($deft_status == '')
  1180. $deft_status = 'open';
  1181. if ($status == '')
  1182. $status = $deft_status;
  1183. if ($show_status_menu == 'n')
  1184. {
  1185. $r .= $DSP->input_hidden('status', $status);
  1186. }
  1187. else
  1188. {
  1189. $menu_status .= $DSP->input_select_header('status');
  1190. /** --------------------------------
  1191. /** Fetch disallowed statuses
  1192. /** --------------------------------*/
  1193. $no_status_access = array();
  1194. if ($SESS->userdata['group_id'] != 1)
  1195. {
  1196. $query = $DB->query("SELECT status_id FROM exp_status_no_access WHERE member_group = '".$SESS->userdata['group_id']."'");
  1197. if ($query->num_rows > 0)
  1198. {
  1199. foreach ($query->result as $row)
  1200. {
  1201. $no_status_access[] = $row['status_id'];
  1202. }
  1203. }
  1204. }
  1205. /** --------------------------------
  1206. /** Create status menu
  1207. /** --------------------------------*/
  1208. $query = $DB->query("SELECT * FROM exp_statuses WHERE group_id = '$status_group' order by status_order");
  1209. if ($query->num_rows == 0)
  1210. {
  1211. // if there is no status group assigned, only Super Admins can create 'open' entries
  1212. if ($SESS->userdata['group_id'] == 1)
  1213. {
  1214. $menu_status .= $DSP->input_select_option('open', $LANG->line('open'), ($status == 'open') ? 1 : '');
  1215. }
  1216. $menu_status .= $DSP->input_select_option('closed', $LANG->line('closed'), ($status == 'closed') ? 1 : '');
  1217. }
  1218. else
  1219. {
  1220. $no_status_flag = TRUE;
  1221. foreach ($query->result as $row)
  1222. {
  1223. $selected = ($status == $row['status']) ? 1 : '';
  1224. if (in_array($row['status_id'], $no_status_access))
  1225. {
  1226. continue;
  1227. }
  1228. $no_status_flag = FALSE;
  1229. $status_name = ($row['status'] == 'open' OR $row['status'] == 'closed') ? $LANG->line($row['status']) : $row['status'];
  1230. $menu_status .= $DSP->input_select_option($REGX->form_prep($row['status']), $REGX->form_prep($status_name), $selected);
  1231. }
  1232. /** --------------------------------
  1233. /** Were there no statuses?
  1234. /** --------------------------------*/
  1235. // If the current user is not allowed to submit any statuses
  1236. // we'll set the default to closed
  1237. if ($no_status_flag == TRUE)
  1238. {
  1239. $menu_status .= $DSP->input_select_option('closed', $LANG->line('closed'));
  1240. }
  1241. }
  1242. $menu_status .= $DSP->input_select_footer();
  1243. }
  1244. /** --------------------------------
  1245. /** Author pull-down menu
  1246. /** --------------------------------*/
  1247. $menu_author = '';
  1248. // First we'll assign the default author.
  1249. if ($author_id == '')
  1250. $author_id = $SESS->userdata('member_id');
  1251. if ($show_author_menu == 'n')
  1252. {
  1253. $r .= $DSP->input_hidden('author_id', $author_id);
  1254. }
  1255. else
  1256. {
  1257. $menu_author .= $DSP->input_select_header('author_id');
  1258. $query = $DB->query("SELECT username, screen_name FROM exp_members WHERE member_id = '$author_id'");
  1259. $author = ($query->row['screen_name'] == '') ? $query->row['username'] : $query->row['screen_name'];
  1260. $menu_author .= $DSP->input_select_option($author_id, $author);
  1261. // Next we'll gather all the authors that are allowed to be in this list
  1262. /*
  1263. // OLD VERSION OF THE QUERY... not so good
  1264. $ss = "SELECT exp_members.member_id, exp_members.group_id, exp_members.username, exp_members.screen_name, exp_members.weblog_id,
  1265. exp_member_groups.*
  1266. FROM exp_members, exp_member_groups
  1267. WHERE exp_members.member_id != '$author_id'
  1268. AND (exp_members.in_authorlist = 'y' OR exp_member_groups.include_in_authorlist = 'y')
  1269. AND exp_members.group_id = exp_member_groups.group_id
  1270. AND exp_member_groups.site_id = '".$DB->escape_str($PREFS->ini('site_id'))."'
  1271. ORDER BY screen_name asc, username asc";
  1272. */
  1273. $ss = "SELECT exp_members.member_id, exp_members.group_id, exp_members.username, exp_members.screen_name, exp_members.weblog_id
  1274. FROM exp_members
  1275. LEFT JOIN exp_member_groups on exp_member_groups.group_id = exp_members.group_id
  1276. WHERE exp_members.member_id != '$author_id'
  1277. AND (exp_members.in_authorlist = 'y' OR exp_member_groups.include_in_authorlist = 'y')
  1278. AND exp_member_groups.site_id = '".$DB->escape_str($PREFS->ini('site_id'))."'
  1279. ORDER BY screen_name asc, username asc";
  1280. $query = $DB->query($ss);
  1281. if ($query->num_rows > 0)
  1282. {
  1283. foreach ($query->result as $row)
  1284. {
  1285. // Is this a "user blog"? If so, we'll only allow
  1286. // multiple authors if they are assigned to this particular blog
  1287. if ($SESS->userdata['weblog_id'] != 0)
  1288. {
  1289. if ($row['weblog_id'] == $weblog_id)
  1290. {
  1291. $author = ($row['screen_name'] == '') ? $row['username'] : $row['screen_name'];
  1292. $selected = ($author_id == $row['member_id']) ? 1 : '';
  1293. $menu_author .= $DSP->input_select_option($row['member_i…

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