Additional Admin Switches chmod /pub and Categories/Products Go To

Additional switches needed.

Configuring default setting for Categories/Products Go To for sites with Large categories
Configuration chmod setting for /pub for sites that cannot use hard coded 777
<a href='#crh-start'></a><a href='#crh-data-%7B%22processed%22%3A%20%5B%22https%3A//github.com/zencart/zc-v1-series/pull/148%23discussion_r17261767%22%2C%20%22https%3A//github.com/zencart/zc-v1-series/pull/148%23discussion_r17396708%22%2C%20%22https%3A//github.com/zencart/zc-v1-series/pull/148%23discussion_r17435184%22%2C%20%22https%3A//github.com/zencart/zc-v1-series/pull/148%23discussion_r17435622%22%2C%20%22https%3A//github.com/zencart/zc-v1-series/pull/148%23discussion_r17435818%22%2C%20%22https%3A//github.com/zencart/zc-v1-series/pull/148%23discussion_r17436875%22%2C%20%22https%3A//github.com/zencart/zc-v1-series/pull/148%23discussion_r17437443%22%5D%2C%20%22comments%22%3A%20%7B%22Pull%20bb4ea7ab9c78a918dde5835be51247e2c7c42a19%20zc_install/sql/install/mysql_zencart.sql%2012%22%3A%20%7B%22html_url%22%3A%20%22https%3A//github.com/zencart/zc-v1-series/pull/148%23discussion_r17261767%22%2C%20%22comments%22%3A%20%5B%7B%22body%22%3A%20%22Should%20this%20be%20left%20as%20a%20free-form%20input%20field%3F%20Or%20limit%20to%20a%20few%20acceptable%20values%2C%20like%20777%2C%20755%2C%20655%2C%20644%20and%20merely%20suggest%20that%20755%20be%20the%20usual%20choice%3F%22%2C%20%22created_at%22%3A%20%222014-09-08T19%3A45%3A01Z%22%2C%20%22user%22%3A%20%7B%22avatar_url%22%3A%20%22https%3A//avatars.githubusercontent.com/u/404472%3Fv%3D2%22%2C%20%22html_url%22%3A%20%22https%3A//github.com/drbyte%22%7D%7D%2C%20%7B%22body%22%3A%20%22That%27s%20business%20logic%20that%20is%20best%20handled%20by%20the%20application%2C%20not%20the%20database.%22%2C%20%22created_at%22%3A%20%222014-09-10T23%3A48%3A43Z%22%2C%20%22user%22%3A%20%7B%22avatar_url%22%3A%20%22https%3A//avatars.githubusercontent.com/u/1590605%3Fv%3D2%22%2C%20%22html_url%22%3A%20%22https%3A//github.com/texdc%22%7D%7D%2C%20%7B%22body%22%3A%20%22I%20think%20what%20%40drbyte%20was%20suggesting%20is%20that%20the%20configuration%20settings%20can%20define%20a%20enum/select%20rather%20than%20a%20free%20form%2C%20and%20doing%20so%20would%20mitigate%20against%20users%20entering%20some%20%27stupid%27%20value.%20%22%2C%20%22created_at%22%3A%20%222014-09-11T17%3A35%3A13Z%22%2C%20%22user%22%3A%20%7B%22avatar_url%22%3A%20%22https%3A//avatars.githubusercontent.com/u/227354%3Fv%3D2%22%2C%20%22html_url%22%3A%20%22https%3A//github.com/zcwilt%22%7D%7D%2C%20%7B%22body%22%3A%20%22I%27m%20aware%20of%20that%20and%20it%20was%20the%20motivation%20for%20my%20comment%3A%20%20business%20logic%2C%20such%20as%20restricting%20a%20set%20of%20valid%20values%2C%20belongs%20in%20the%20app%20not%20the%20db.%5Cr%5Cn%5Cr%5Cn%3E%20On%20Sep%2011%2C%202014%2C%20at%2012%3A35%20PM%2C%20Ian%20Wilson%20%3Cnotifications%40github.com%3E%20wrote%3A%5Cr%5Cn%3E%20%5Cr%5Cn%3E%20In%20zc_install/sql/install/mysql_zencart.sql%3A%5Cr%5Cn%3E%20%5Cr%5Cn%3E%20%3E%20%40%40%20-2671%2C6%20%2B2672%2C7%20%40%40%20INSERT%20INTO%20configuration%20%28configuration_title%2C%20configuration_key%2C%20configuration%5Cr%5Cn%3E%20%3E%20%20INSERT%20INTO%20configuration%20%28configuration_title%2C%20configuration_key%2C%20configuration_value%2C%20configuration_description%2C%20configuration_group_id%2C%20sort_order%2C%20set_function%2C%20date_added%29%20VALUES%20%28%27Enable%20Downloads%27%2C%20%27DOWNLOAD_ENABLED%27%2C%20%27true%27%2C%20%27Enable%20the%20products%20download%20functions.%27%2C%20%2713%27%2C%20%271%27%2C%20%27zen_cfg_select_option%28array%28%5C%5C%27true%5C%5C%27%2C%20%5C%5C%27false%5C%5C%27%29%2C%20%27%2C%20now%28%29%29%3B%5Cr%5Cn%3E%20%3E%20%20INSERT%20INTO%20configuration%20%28configuration_title%2C%20configuration_key%2C%20configuration_value%2C%20configuration_description%2C%20configuration_group_id%2C%20sort_order%2C%20set_function%2C%20date_added%29%20VALUES%20%28%27Download%20by%20Redirect%27%2C%20%27DOWNLOAD_BY_REDIRECT%27%2C%20%27true%27%2C%20%27Use%20browser%20redirection%20for%20download.%20Disable%20on%20non-Unix%20systems.%3Cbr%20/%3E%3Cbr%20/%3ENote%3A%20Set%20/pub%20to%20777%20when%20redirect%20is%20true%27%2C%20%2713%27%2C%20%272%27%2C%20%27zen_cfg_select_option%28array%28%5C%5C%27true%5C%5C%27%2C%20%5C%5C%27false%5C%5C%27%29%2C%20%27%2C%20now%28%29%29%3B%5Cr%5Cn%3E%20%3E%20%20INSERT%20INTO%20configuration%20%28configuration_title%2C%20configuration_key%2C%20configuration_value%2C%20configuration_description%2C%20configuration_group_id%2C%20sort_order%2C%20set_function%2C%20date_added%29%20VALUES%20%28%27Download%20by%20streaming%27%2C%20%27DOWNLOAD_IN_CHUNKS%27%2C%20%27false%27%2C%20%27If%20download-by-redirect%20is%20disabled%2C%20and%20your%20PHP%20memory_limit%20setting%20is%20under%208%20MB%2C%20you%20might%20need%20to%20enable%20this%20setting%20so%20that%20files%20are%20streamed%20in%20smaller%20segments%20to%20the%20browser.%3Cbr%20/%3E%3Cbr%20/%3EHas%20no%20effect%20if%20Download%20By%20Redirect%20is%20enabled.%27%2C%20%2713%27%2C%20%272%27%2C%20%27zen_cfg_select_option%28array%28%5C%5C%27true%5C%5C%27%2C%20%5C%5C%27false%5C%5C%27%29%2C%20%27%2C%20now%28%29%29%3B%5Cr%5Cn%3E%20%3E%20%2BINSERT%20INTO%20configuration%20%28configuration_title%2C%20configuration_key%2C%20configuration_value%2C%20configuration_description%2C%20configuration_group_id%2C%20sort_order%2C%20set_function%2C%20date_added%29%20VALUES%20%28%27Set%20Download%20directory%20chmod%20setting%27%20%2C%27DOWNLOAD_CHMOD%27%2C%20%27777%27%2C%20%27Set%20Download%20directory%20chmod%20setting%20to%20777%20or%20755.%27%2C%20%2713%27%2C%20%273%27%2C%20%27%27%2C%20now%28%29%29%3B%5Cr%5Cn%3E%20I%20think%20what%20%40drbyte%20was%20suggesting%20is%20that%20the%20configuration%20settings%20can%20define%20a%20enum/select%20rather%20than%20a%20free%20form%2C%20and%20doing%20so%20would%20mitigate%20against%20users%20entering%20some%20%27stupid%27%20value.%5Cr%5Cn%3E%20%5Cr%5Cn%3E%20%5Cu2014%5Cr%5Cn%3E%20Reply%20to%20this%20email%20directly%20or%20view%20it%20on%20GitHub.%22%2C%20%22created_at%22%3A%20%222014-09-11T17%3A42%3A08Z%22%2C%20%22user%22%3A%20%7B%22avatar_url%22%3A%20%22https%3A//avatars.githubusercontent.com/u/1590605%3Fv%3D2%22%2C%20%22html_url%22%3A%20%22https%3A//github.com/texdc%22%7D%7D%2C%20%7B%22body%22%3A%20%22Do%20you%20really%20even%20understand%20Zen%20Cart%20configuration%20settings%20then%3F%20%5Cr%5CnThis%20isn%27t%20a%20db%20thing.%20The%20db%20is%20merely%20storing%20configuration%20options%2C%20which%20are%20enforced%20by%20the%20application%20based%20on%20what%20the%20end-user%20has%20chosen%20from%20available%20choices.%22%2C%20%22created_at%22%3A%20%222014-09-11T17%3A44%3A53Z%22%2C%20%22user%22%3A%20%7B%22avatar_url%22%3A%20%22https%3A//avatars.githubusercontent.com/u/404472%3Fv%3D2%22%2C%20%22html_url%22%3A%20%22https%3A//github.com/drbyte%22%7D%7D%2C%20%7B%22body%22%3A%20%22And%20where%20is%20the%20application%20validating%20%28enforcing%29%20those%20values%3F%20%20The%20db%20field%20can%20be%20a%20%60decimal%283%2C0%29%60%2C%20but%20since%20PHP%20doesn%27t%20have%20an%20%60enum%60%20%28outside%20of%20an%20extension%29%2C%20the%20valid%20values%20should%20at%20least%20be%20an%20array%2C%20if%20not%20a%20value%20object.%22%2C%20%22created_at%22%3A%20%222014-09-11T17%3A59%3A40Z%22%2C%20%22user%22%3A%20%7B%22avatar_url%22%3A%20%22https%3A//avatars.githubusercontent.com/u/1590605%3Fv%3D2%22%2C%20%22html_url%22%3A%20%22https%3A//github.com/texdc%22%7D%7D%2C%20%7B%22body%22%3A%20%22At%20this%20point%20it%20isn%27t.%20That%27s%20the%20whole%20point%20of%20my%20first%20comment%3A%20the%20commit%20as%20it%20stands%20right%20now%20allows%20free-form%20text.%20%5Cr%5CnChanging%20it%20to%20use%20zen_cfg_select_option%28array%28%5C%5C%27755%5C%5C%27%2C%20%5C%5C%27777%5C%5C%27%2C%20.....%29%20....%29%20would%20provide%20the%20administrator%20only%20a%20list%20of%20radio-buttons%20from%20which%20to%20choose%20pre-defined%20%27safe%27%20options.%22%2C%20%22created_at%22%3A%20%222014-09-11T18%3A07%3A41Z%22%2C%20%22user%22%3A%20%7B%22avatar_url%22%3A%20%22https%3A//avatars.githubusercontent.com/u/404472%3Fv%3D2%22%2C%20%22html_url%22%3A%20%22https%3A//github.com/drbyte%22%7D%7D%5D%2C%20%22title%22%3A%20%22File%3A%20zc_install/sql/install/mysql_zencart.sql%3AL2672-2679%22%7D%7D%7D'></a>
<a href='https://www.codereviewhub.com/'><img src='http://www.codereviewhub.com/site/github-bar.png' height=40></a>
- [ ] <a href='#crh-comment-Pull bb4ea7ab9c78a918dde5835be51247e2c7c42a19 zc_install/sql/install/mysql_zencart.sql 12'></a> <img src='http://www.codereviewhub.com/site/github-remaining.png' height=16 width=60>&nbsp;<b><a href='https://github.com/zencart/zc-v1-series/pull/148#discussion_r17261767'>File: zc_install/sql/install/mysql_zencart.sql:L2672-2679</a></b>
- <a href='https://github.com/drbyte'><img border=0 src='https://avatars.githubusercontent.com/u/404472?v=2' height=16 width=16'></a> Should this be left as a free-form input field? Or limit to a few acceptable values, like 777, 755, 655, 644 and merely suggest that 755 be the usual choice?
- <a href='https://github.com/texdc'><img border=0 src='https://avatars.githubusercontent.com/u/1590605?v=2' height=16 width=16'></a> That's business logic that is best handled by the application, not the database.
- <a href='https://github.com/zcwilt'><img border=0 src='https://avatars.githubusercontent.com/u/227354?v=2' height=16 width=16'></a> I think what @drbyte was suggesting is that the configuration settings can define a enum/select rather than a free form, and doing so would mitigate against users entering some 'stupid' value.
- <a href='https://github.com/texdc'><img border=0 src='https://avatars.githubusercontent.com/u/1590605?v=2' height=16 width=16'></a> I'm aware of that and it was the motivation for my comment:  business logic, such as restricting a set of valid values, belongs in the app not the db.
> On Sep 11, 2014, at 12:35 PM, Ian Wilson <notifications@github.com> wrote:
>
> In zc_install/sql/install/mysql_zencart.sql:
>
> > @@ -2671,6 +2672,7 @@ INSERT INTO configuration (configuration_title, configuration_key, configuration
> >  INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES ('Enable Downloads', 'DOWNLOAD_ENABLED', 'true', 'Enable the products download functions.', '13', '1', 'zen_cfg_select_option(array(\'true\', \'false\'), ', now());
> >  INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES ('Download by Redirect', 'DOWNLOAD_BY_REDIRECT', 'true', 'Use browser redirection for download. Disable on non-Unix systems.<br /><br />Note: Set /pub to 777 when redirect is true', '13', '2', 'zen_cfg_select_option(array(\'true\', \'false\'), ', now());
> >  INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES ('Download by streaming', 'DOWNLOAD_IN_CHUNKS', 'false', 'If download-by-redirect is disabled, and your PHP memory_limit setting is under 8 MB, you might need to enable this setting so that files are streamed in smaller segments to the browser.<br /><br />Has no effect if Download By Redirect is enabled.', '13', '2', 'zen_cfg_select_option(array(\'true\', \'false\'), ', now());
> > +INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES ('Set Download directory chmod setting' ,'DOWNLOAD_CHMOD', '777', 'Set Download directory chmod setting to 777 or 755.', '13', '3', '', now());
> I think what @drbyte was suggesting is that the configuration settings can define a enum/select rather than a free form, and doing so would mitigate against users entering some 'stupid' value.
>
> —
> Reply to this email directly or view it on GitHub.
- <a href='https://github.com/drbyte'><img border=0 src='https://avatars.githubusercontent.com/u/404472?v=2' height=16 width=16'></a> Do you really even understand Zen Cart configuration settings then?
This isn't a db thing. The db is merely storing configuration options, which are enforced by the application based on what the end-user has chosen from available choices.
- <a href='https://github.com/texdc'><img border=0 src='https://avatars.githubusercontent.com/u/1590605?v=2' height=16 width=16'></a> And where is the application validating (enforcing) those values?  The db field can be a `decimal(3,0)`, but since PHP doesn't have an `enum` (outside of an extension), the valid values should at least be an array, if not a value object.
- <a href='https://github.com/drbyte'><img border=0 src='https://avatars.githubusercontent.com/u/404472?v=2' height=16 width=16'></a> At this point it isn't. That's the whole point of my first comment: the commit as it stands right now allows free-form text.
Changing it to use zen_cfg_select_option(array(\'755\', \'777\', .....) ....) would provide the administrator only a list of radio-buttons from which to choose pre-defined 'safe' options.


<a href='https://www.codereviewhub.com/zencart/zc-v1-series/pull/148?mark_as_completed=1'><img src='http://www.codereviewhub.com/site/github-mark-as-completed.png' height=26></a>&nbsp;<a href='https://www.codereviewhub.com/zencart/zc-v1-series/pull/148?approve=1'><img src='http://www.codereviewhub.com/site/github-approve.png' height=26></a>&nbsp;<a href='https://github.com/zencart/zc-v1-series/pull/148'><img src='http://www.codereviewhub.com/site/github-refresh.png' height=26></a>
<a href='#crh-end'></a>
The fact that the app isn't doing any validation is the point of my comment.  However, the `zen_cfg_select_option()` suggestion coupled with some pre-commit validation sounds like the best solution right now until we can further refine and update the codebase to address these deficiencies.