PHPCMS Publishing Page Column selection problem _php tutorial

Source: Internet
Author: User
In the Phpcms publishing page, there is a bug, even if the editor has no access to a column, but also can be in the publishing page of the Column drop-down menu to select the column, and the article can be published under this section. How does this bug fix? Let's take a look at how the drop-down menu for the publishing page is generated.

The template file for the publishing page is in/admin/templates/content_add.tpl.php, whose form is output through the following statement:

if (Is_array ($forminfos [' base ')]) {foreach ($forminfos [' base '] as $field = + $info) {}}

The clue is found, $forminfos this array. This array is really/admin/content.inc.php generated in this file, let's look at the generated code:

$data [' catid '] = $catid; $data [' template '] = isset ($template _show)? $template _show: $MODEL [$modelid] [' Template_show '];require cache_model_path. ' content_form.class.php '; $content _ form = new Content_form ($modelid); $forminfos = $content _form->get ($data);

By printing the array $forminfos you can find that the code for the drop-down menu is stored in the $forminfos [' base '] [' catid '] [' form ']:

Pro-Poor NewsNotice announcementLatest NewsNewsCharity donationDonation DocumentaryLove FeedbackList of donationsEmergency assistanceHelp CenterFriendship ConnectionCounterpart AreaNews UpdateAided projectsCharity donationFeeling in the Three GorgesNews areaCharity donationPolicy trendsPairing and helpingAided projectsStatus of poverty alleviationHelping objectsNews UpdateCharity donationPoverty Alleviation ProjectFund profileDonation situationFund usesAccount statusNews UpdateVoluntary workersPolicies and regulationsTop News BarTop News BarTop News BarTop News BarTop News Bar[also posted to other columns]

Or speculation, as long as the number in the inside is extracted, to verify the authority, no permission to unset off, the rest of the combination to regenerate $forminfos [' base '] [' catid '] [' form '] can:

$data [' catid '] = $catid; $data [' template '] = isset ($template _show)? $template _show: $MODEL [$modelid] [' Template_show '];require cache_model_path. ' content_form.class.php '; $content _ form = new Content_form ($modelid), $forminfos = $content _form->get ($data);//Judge Permission Preg_match_all ("
 <> / <\ option="">
  /", $forminfos [' base '] [' catid '] [' form '], $matches [' str ']);p reg_match_all ("/[1-9]\d/", $forminfos [' base '] [' CATID '] [' form '], $matches [' num ']), foreach ($matches [' num '][0] as $key = = $value) {$allow _manage = $priv _role->check (' CatID ', $matches [' num '][0][$key], ' manage '), if (! $allow _manage) {unset ($matches [' num '][0][$key]); unset ($matches [' Str '][0][$key]);}} foreach ($matches [' str '][0] as $key = + $value) {$opstr. = $matches [' str '][0][$key];} $forminfos [' base '] [' catid '] [' form '] = preg_replace ('/
  
  
   
   /', $opstr, $forminfos [' base '] [' catid '] [' form '] );
  
  
 <\>
  
  

The speculative ingredient is very high and is for reference only.

http://www.bkjia.com/PHPjc/751688.html www.bkjia.com true http://www.bkjia.com/PHPjc/751688.html techarticle in the Phpcms publishing page, there is a bug, even if the editor has no access to a column, but also can be in the publishing page of the Column drop-down menu to select the column, and can publish the article ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.