From 5795e2a58bb4a0702a3d318ec6ac05681d6e5864 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Thu, 21 May 2015 22:17:17 -0700 Subject: more migration of page types --- include/comanche.php | 2 +- include/widgets.php | 4 ++-- mod/block.php | 8 ++++---- mod/blocks.php | 34 +++++++++++++++++----------------- mod/editblock.php | 14 +++++++------- mod/item.php | 6 ++---- mod/layouts.php | 6 +++--- mod/page.php | 8 ++++---- 8 files changed, 40 insertions(+), 42 deletions(-) diff --git a/include/comanche.php b/include/comanche.php index 93cbd8b12..dfe907f4d 100644 --- a/include/comanche.php +++ b/include/comanche.php @@ -5,7 +5,7 @@ require_once('include/menu.php'); require_once('include/widgets.php'); // When editing a webpage - a dropdown is needed to select a page layout -// On submit, the pdl_select value (which is the mid of an item with item_restrict = ITEM_PDL) is stored in +// On submit, the pdl_select value (which is the mid of an item with item_type = ITEM_TYPE_PDL) is stored in // the webpage's resource_id, with resource_type 'pdl'. // Then when displaying a webpage, we can see if it has a pdl attached. If not we'll diff --git a/include/widgets.php b/include/widgets.php index 5a61ea639..86f65cdee 100644 --- a/include/widgets.php +++ b/include/widgets.php @@ -902,10 +902,10 @@ function widget_random_block($arr) { $r = q("select item.* from item left join item_id on item.id = item_id.iid where item.uid = %d and sid like '%s' and service = 'BUILDBLOCK' and - item_restrict = %d $sql_options order by $randfunc limit 1", + item_type = %d $sql_options order by $randfunc limit 1", intval($channel_id), dbesc('%' . $contains . '%'), - intval(ITEM_BUILDBLOCK) + intval(ITEM_TYPE_BUILDBLOCK) ); if($r) { diff --git a/mod/block.php b/mod/block.php index 043b0e9e8..fb5645d8a 100644 --- a/mod/block.php +++ b/mod/block.php @@ -50,10 +50,10 @@ function block_content(&$a) { $r = q("select item.* from item left join item_id on item.id = item_id.iid where item.uid = %d and sid = '%s' and service = 'BUILDBLOCK' and - item_restrict = %d $sql_options $revision limit 1", + item_type = %d $sql_options $revision limit 1", intval($u[0]['channel_id']), dbesc($page_id), - intval(ITEM_BUILDBLOCK) + intval(ITEM_TYPE_BUILDBLOCK) ); if(! $r) { @@ -62,10 +62,10 @@ function block_content(&$a) { $x = q("select item.* from item left join item_id on item.id = item_id.iid where item.uid = %d and sid = '%s' and service = 'BUILDBLOCK' and - item_restrict = %d $revision limit 1", + item_type = %d $revision limit 1", intval($u[0]['channel_id']), dbesc($page_id), - intval(ITEM_BUILDBLOCK) + intval(ITEM_TYPE_BUILDBLOCK) ); if($x) { // Yes, it's there. You just aren't allowed to see it. diff --git a/mod/blocks.php b/mod/blocks.php index 11e7d4a30..95979a304 100644 --- a/mod/blocks.php +++ b/mod/blocks.php @@ -84,7 +84,7 @@ function blocks_content(&$a) { } $x = array( - 'webpage' => ITEM_BUILDBLOCK, + 'webpage' => ITEM_TYPE_BUILDBLOCK, 'is_owner' => true, 'nickname' => $a->profile['channel_address'], 'lockstate' => (($channel['channel_allow_cid'] || $channel['channel_allow_gid'] || $channel['channel_deny_cid'] || $channel['channel_deny_gid']) ? 'lock' : 'unlock'), @@ -108,9 +108,9 @@ function blocks_content(&$a) { $editor = status_editor($a,$x); $r = q("select iid, sid, mid, title, body, mimetype, created, edited from item_id left join item on item_id.iid = item.id - where item_id.uid = %d and service = 'BUILDBLOCK' and item_restrict = %d order by item.created desc", + where item_id.uid = %d and service = 'BUILDBLOCK' and item_type = %d order by item.created desc", intval($owner), - intval(ITEM_BUILDBLOCK) + intval(ITEM_TYPE_BUILDBLOCK) ); $pages = null; @@ -143,21 +143,21 @@ function blocks_content(&$a) { $url = z_root() . '/editblock/' . $which; $o .= replace_macros(get_markup_template('blocklist.tpl'), array( - '$baseurl' => $url, - '$title' => t('Blocks'), - '$name' => t('Block Name'), + '$baseurl' => $url, + '$title' => t('Blocks'), + '$name' => t('Block Name'), '$blocktitle' => t('Block Title'), - '$created' => t('Created'), - '$edited' => t('Edited'), - '$create' => t('Create'), - '$edit' => t('Edit'), - '$share' => t('Share'), - '$delete' => t('Delete'), - '$editor' => $editor, - '$pages' => $pages, - '$channel' => $which, - '$view' => t('View'), - '$preview' => '1', + '$created' => t('Created'), + '$edited' => t('Edited'), + '$create' => t('Create'), + '$edit' => t('Edit'), + '$share' => t('Share'), + '$delete' => t('Delete'), + '$editor' => $editor, + '$pages' => $pages, + '$channel' => $which, + '$view' => t('View'), + '$preview' => '1', )); return $o; diff --git a/mod/editblock.php b/mod/editblock.php index a0ece8133..9f9770e77 100644 --- a/mod/editblock.php +++ b/mod/editblock.php @@ -136,14 +136,14 @@ function editblock_content(&$a) { $o .= replace_macros($tpl,array( '$return_path' => $rp, '$action' => 'item', - '$webpage' => ITEM_BUILDBLOCK, + '$webpage' => ITEM_TYPE_BUILDBLOCK, '$share' => t('Edit'), - '$bold' => t('Bold'), - '$italic' => t('Italic'), - '$underline' => t('Underline'), - '$quote' => t('Quote'), - '$code' => t('Code'), - '$writefiles' => (perm_is_allowed($owner, get_observer_hash(), 'post_photos') || perm_is_allowed($owner, get_observer_hash(), 'write_storage')), + '$bold' => t('Bold'), + '$italic' => t('Italic'), + '$underline' => t('Underline'), + '$quote' => t('Quote'), + '$code' => t('Code'), + '$writefiles' => (perm_is_allowed($owner, get_observer_hash(), 'post_photos') || perm_is_allowed($owner, get_observer_hash(), 'write_storage')), '$upload' => t('Upload photo'), '$attach' => t('Attach file'), '$weblink' => t('Insert web link'), diff --git a/mod/item.php b/mod/item.php index 83cf3ce2d..8365aefb0 100644 --- a/mod/item.php +++ b/mod/item.php @@ -115,7 +115,7 @@ function item_post(&$a) { * Check service class limits */ if ($uid && !(x($_REQUEST,'parent')) && !(x($_REQUEST,'post_id'))) { - $ret = item_check_service_class($uid,(($_REQUEST['webpage'] == ITEM_WEBPAGE) ? true : false)); + $ret = item_check_service_class($uid,(($_REQUEST['webpage'] == ITEM_TYPE_WEBPAGE) ? true : false)); if (!$ret['success']) { notice( t($ret['message']) . EOL) ; if(x($_REQUEST,'return')) @@ -674,9 +674,6 @@ function item_post(&$a) { if($moderated) $item_restrict = $item_restrict | ITEM_MODERATED; - if($webpage) - $item_restrict = $item_restrict | $webpage; - if(! strlen($verb)) $verb = ACTIVITY_POST ; @@ -742,6 +739,7 @@ function item_post(&$a) { $datarray['item_unseen'] = $item_unseen; $datarray['item_wall'] = $item_wall; $datarray['item_origin'] = $item_origin; + $datarray['item_type'] = $webpage; $datarray['item_thread_top'] = $item_thread_top; $datarray['layout_mid'] = $layout_mid; $datarray['public_policy'] = $public_policy; diff --git a/mod/layouts.php b/mod/layouts.php index ba1d900a7..daae1ba5a 100644 --- a/mod/layouts.php +++ b/mod/layouts.php @@ -134,10 +134,10 @@ function layouts_content(&$a) { $editor = status_editor($a,$x); - $r = q("select iid, sid, mid, title, body, mimetype, created, edited from item_id left join item on item_id.iid = item.id - where item_id.uid = %d and service = 'PDL' and item_restrict = %d order by item.created desc", + $r = q("select iid, sid, mid, title, body, mimetype, created, edited, item_type from item_id left join item on item_id.iid = item.id + where item_id.uid = %d and service = 'PDL' and item_type = %d order by item.created desc", intval($owner), - intval(ITEM_PDL) + intval(ITEM_TYPE_PDL) ); $pages = null; diff --git a/mod/page.php b/mod/page.php index 2d977fb7a..c37dc7d0b 100644 --- a/mod/page.php +++ b/mod/page.php @@ -64,7 +64,7 @@ function page_init(&$a) { intval($u[0]['channel_id']), dbesc($page_id), intval(ITEM_TYPE_WEBPAGE), - intval(ITEM_PDL) + intval(ITEM_TYPE_PDL) ); if(! $r) { @@ -87,7 +87,7 @@ function page_init(&$a) { return; } - if($r[0]['item_restrict'] == ITEM_PDL) { + if($r[0]['item_type'] == ITEM_TYPE_PDL) { require_once('include/comanche.php'); comanche_parser(get_app(),$r[0]['body']); get_app()->pdl = $r[0]['body']; @@ -118,8 +118,8 @@ function page_content(&$a) { if(! $r) return; - if($r[0]['item_restrict'] == ITEM_PDL) { - $r[0]['body'] = t('Ipsum Lorem'); + if($r[0]['item_type'] == ITEM_TYPE_PDL) { + $r[0]['body'] = t('Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.'); $r[0]['mimetype'] = 'text/plain'; $r[0]['title'] = ''; -- cgit v1.2.3