|
Where/what is the best way to store the randomly generated salt, to use for verification/login later?
|
# ¿ Feb 28, 2013 22:59 |
|
|
# ¿ Apr 27, 2024 19:13 |
|
JetsGuy posted:... SONY gently caress up Sony is awesome. I had set the PS3 to ask for the password before PSN purchases, so for the past few weeks the store was asking for my password even when I hit the download buttons on free demos. I input random characters every single time and the download would start. I never tested an actual credit card purchase. Why even prompt for it on free stuff, and then not even verify? Stupid program flow.
|
# ¿ May 3, 2013 19:29 |
|
PHP code:
|
# ¿ Aug 20, 2013 14:14 |
|
omeg posted:That's sort of beautiful. It's like a fractal or something. So trippy, dude.
|
# ¿ Aug 20, 2013 15:09 |
|
rrrrrrrrrrrt posted:Is that what life is like when the only programming construct you understand is if-else? It's inside a weird new addition (called "0-one-file version") to this: http://www.php-login.net/ .. which has a full MVC version, along with two other simple class versions. So a new single file option seems like a pointless exercise.
|
# ¿ Aug 20, 2013 18:51 |
|
Volmarias posted:I'm... honestly not sure if the guy was trolling or mentally ill Well I'm going with he's criminal, thug, mentally ill, bipolar, peadophile, and so on.
|
# ¿ Aug 23, 2013 00:15 |
|
Vasja posted:
Also, extract() creates key/value pairs from an array. So, they could use $whatever instead of $vals['whatever'] after the extract.
|
# ¿ Aug 27, 2013 14:43 |
|
Golbez posted:Having to support my predecessor's code (and follow his stupid no-object rules for a year before he left) is really making me bitter about this job stunting my growth as a programmer for three loving years. gently caress this person. I hope he never gets another development job.
|
# ¿ Sep 13, 2013 19:50 |
|
Just encountered this in the URL bar on a partner's website: <url w/ query string>... &_statement=SELECT%20*%20FROM%20fabrics%20where%20type%20like%20'%<our product's name>%'%20AND%20photo%20like%20'%jpg%'%20and%20dropped%20=0%20and%20active=1%20order%20by%20name
|
# ¿ Oct 15, 2013 21:51 |
|
substitute posted:Just encountered this in the URL bar on a partner's website: Update: It goes so much deeper... I can't even...
|
# ¿ Oct 16, 2013 20:26 |
|
Suspicious Dish posted:Come on, spit it out. GET method forms that accept basically anything and make them hidden fields. Or hell, close the tag and inject/display whatever you want on the page. POST method forms with hidden fields and the values are full SQL statements.
|
# ¿ Oct 16, 2013 21:33 |
|
substitute posted:Update: Official (summarized) response from developer: You can wildly query the database and insert code in the page/display, but the site can't be hacked with any of this stuff. Thanks.
|
# ¿ Oct 17, 2013 15:15 |
|
kitten smoothie posted:Grace Hopper is spinning in her grave ...There is great scholarship talking about weather... Good. Change your major.
|
# ¿ Dec 14, 2013 07:34 |
|
SupSuper posted:So I just inherited the codebase of a self-proclaimed "PHP developer with years of experience" (read: mish-mashing online tutorials into a horrible mess). I could pretty much post the whole thing here but I think this sums it up: print_r($validationOK); echo $validationOK; echo 'Validation: '. $validationOK; die('Error: Validation failure: '. $validationOK');
|
# ¿ Dec 25, 2013 06:07 |
|
I apologize in advance. So I've been dealing with a contracted (mostly JavaScript) developer at work for a few years now, because of some dumb Flash project he was brought in for originally, that's now spun out of control into him having influence all over poo poo. A landing page for an ad was not loading on the live site a bit ago, so I go to check the log and just curious, I open the file. This page is basically just a bunch of thumbnails that open the larger versions in a lightbox. (w/ my changes to obscure company specifics) php:<? $pagetitle = 'Redacted page title poo poo'; $meta_keywords = ''; $meta_desc = 'Redacted meta poo poo'; $pre_page_data="some-text-poo poo"; /// EDIT ABOVE define("LANDING",true); require($_SERVER['INCLUDES_LOCAL'].'/header.php'); //=============================================================== //-- BEGIN: Include Statements --------------------------------- //=============================================================== // Data Structures require_once(XX_LIBRARY_CORE.'/nodeInfo.php'); //=============================================================== //-- END: Include Statements ----------------------------------- //=============================================================== //=============================================================== //-- BEGIN: Import Statements ---------------------------------- //=============================================================== // Data Structures use _global\_core\nodeinfo\FabricNodeInfo; use _global\_core\nodeinfo\GalleryNodeInfo; // Displays //=============================================================== //-- END: Import Statements ------------------------------------ //=============================================================== //=========================================================== //-- BEGIN: Class: LandingStandardData --------------------- //=========================================================== class LandingStandardData{ // BEGIN: Data Memembers const MEDIA_IMG='img'; const MEDIA_HTML='html'; public $css=''; public $img; public $html; public $name; public $fuckingperson; public $description; public $media; // END: Data Memembers /*------------------------------------------------------- BEGIN: CONSTRUCTOR -------------------------------------------------------*/ // LandingStandardData: // Constructor function __construct(){ //trace("LandingStandardData: CONSTR"); } /*------------------------------------------------------- END: CONSTRUCTOR -------------------------------------------------------*/ /*------------------------------------------------------- BEGIN: DECONSTRUCTOR -------------------------------------------------------*/ // __destructor: // Deconstructs object. public function __destructor(){ //trace("LandingStandardData: DECONSTRUCTOR"); $this->css=NULL; $this->img=NULL; $this->html=NULL; $this->name=NULL; $this->fuckingperson=NULL; $this->description=NULL; $this->media=NULL; //parent::__destructor(); } /*------------------------------------------------------- END: DECONSTRUCTOR -------------------------------------------------------*/ } //=========================================================== //-- END: Class: LandingStandardData ----------------------- //=========================================================== // Detail $pfx_detail=CDN_IMG_SERVER . '/_images/_some-loving-path/' . $pre_page_data; // Fabric $pfx_fabric=CDN_IMG_SERVER . GalleryNodeInfo::PREFIX_IMAGE_FABRIC . FabricNodeInfo::PREFIX_IMAGE_SWATCH; $sfx_fabric='.jpg' . GalleryNodeInfo::RASTER_DATA_BITMAP_FABRIC; // Related $pfx_related=CDN_IMG_SERVER . '/_images/_some-loving-path/'; $pfx_related_thumb=$pfx_related.'thumbs/'; $rd_related_thumb=GalleryNodeInfo::RASTER_DATA_BITMAP_RELATED; // Video $pfx_video='/_data/video-data.php?video='; $sfx_video='&amp;autohide=1&amp;showinfo=0&amp;autoplay=1&amp;rel=0'; // Data Structures $data_redacted= array(); $data_related= array(); // BEGIN: redacted Mention Data //// item: redacted item name array_push($data_redacted, $ds=new LandingStandardData()); $ds->media=LandingStandardData::MEDIA_IMG; $ds->img='redacted.jpg'; $ds->name='Redacted Name'; $ds->fuckingperson='Redacted person name'; //// item: redacted item name array_push($data_redacted, $ds=new LandingStandardData()); $ds->media=LandingStandardData::MEDIA_IMG; $ds->img='redacted.jpg'; $ds->name='Redacted Name'; $ds->fuckingperson='Redacted person name'; //// item: FOS video //// item: redacted item name array_push($data_redacted, $ds=new LandingStandardData()); $ds->media=LandingStandardData::MEDIA_IMG; $ds->img='redacted.jpg'; $ds->name='Redacted Name'; $ds->fuckingperson='Redacted person name'; // END: redacted Mention Data // BEGIN: Related Data //// item: redacted item name array_push($data_redacted, $ds=new LandingStandardData()); $ds->media=LandingStandardData::MEDIA_IMG; $ds->img='redacted.jpg'; $ds->name='Redacted Name'; $ds->fuckingperson='Redacted person name'; //// item: redacted item name array_push($data_redacted, $ds=new LandingStandardData()); $ds->media=LandingStandardData::MEDIA_IMG; $ds->img='redacted.jpg'; $ds->name='Redacted Name'; $ds->fuckingperson='Redacted person name'; //// item: redacted item name array_push($data_redacted, $ds=new LandingStandardData()); $ds->media=LandingStandardData::MEDIA_IMG; $ds->img='redacted.jpg'; $ds->name='Redacted Name'; $ds->fuckingperson='Redacted person name'; //// item: redacted item name array_push($data_redacted, $ds=new LandingStandardData()); $ds->media=LandingStandardData::MEDIA_IMG; $ds->img='redacted.jpg'; $ds->name='Redacted Name'; $ds->fuckingperson='Redacted person name'; //// item: redacted item name array_push($data_redacted, $ds=new LandingStandardData()); $ds->media=LandingStandardData::MEDIA_IMG; $ds->img='redacted.jpg'; $ds->name='Redacted Name'; $ds->fuckingperson='Redacted person name'; //// item: redacted item name array_push($data_redacted, $ds=new LandingStandardData()); $ds->media=LandingStandardData::MEDIA_IMG; $ds->img='redacted.jpg'; $ds->name='Redacted Name'; $ds->fuckingperson='Redacted person name'; //// item: redacted item name array_push($data_redacted, $ds=new LandingStandardData()); $ds->media=LandingStandardData::MEDIA_IMG; $ds->img='redacted.jpg'; $ds->name='Redacted Name'; $ds->fuckingperson='Redacted person name'; //// item: redacted item name array_push($data_redacted, $ds=new LandingStandardData()); $ds->media=LandingStandardData::MEDIA_IMG; $ds->img='redacted.jpg'; $ds->name='Redacted Name'; $ds->fuckingperson='Redacted person name'; //// item: redacted item name array_push($data_redacted, $ds=new LandingStandardData()); $ds->media=LandingStandardData::MEDIA_IMG; $ds->img='redacted.jpg'; $ds->name='Redacted Name'; $ds->fuckingperson='Redacted person name'; //// item: redacted item name array_push($data_redacted, $ds=new LandingStandardData()); $ds->media=LandingStandardData::MEDIA_IMG; $ds->img='redacted.jpg'; $ds->name='Redacted Name'; $ds->fuckingperson='Redacted person name'; //// item: redacted item name array_push($data_redacted, $ds=new LandingStandardData()); $ds->media=LandingStandardData::MEDIA_IMG; $ds->img='redacted.jpg'; $ds->name='Redacted Name'; $ds->fuckingperson='Redacted person name'; //// item: redacted item name array_push($data_redacted, $ds=new LandingStandardData()); $ds->media=LandingStandardData::MEDIA_IMG; $ds->img='redacted.jpg'; $ds->name='Redacted Name'; $ds->fuckingperson='Redacted person name'; //// item: redacted item name array_push($data_redacted, $ds=new LandingStandardData()); $ds->media=LandingStandardData::MEDIA_IMG; $ds->img='redacted.jpg'; $ds->name='Redacted Name'; $ds->fuckingperson='Redacted person name'; //// item: redacted item name array_push($data_redacted, $ds=new LandingStandardData()); $ds->media=LandingStandardData::MEDIA_IMG; $ds->img='redacted.jpg'; $ds->name='Redacted Name'; $ds->fuckingperson='Redacted person name'; //// item: redacted item name array_push($data_redacted, $ds=new LandingStandardData()); $ds->media=LandingStandardData::MEDIA_IMG; $ds->img='redacted.jpg'; $ds->name='Redacted Name'; $ds->fuckingperson='Redacted person name'; //// item: redacted item name array_push($data_redacted, $ds=new LandingStandardData()); $ds->media=LandingStandardData::MEDIA_IMG; $ds->img='redacted.jpg'; $ds->name='Redacted Name'; $ds->fuckingperson='Redacted person name'; //// item: redacted item name array_push($data_redacted, $ds=new LandingStandardData()); $ds->media=LandingStandardData::MEDIA_IMG; $ds->img='redacted.jpg'; $ds->name='Redacted Name'; $ds->fuckingperson='Redacted person name'; // END: Related Data ?> <!-- BEGIN: appContainer --> <div id="appContainer" class="gallery"> <!-- BEGIN: rgnDetail --> <div id="rgnDetail" class="gallery-detail"> <section> <!-- BEGIN: scrnDetail --> <div id="scrnDetail" class="gallery-detail fos"> <!-- BEGIN: displaySet --> <div class="displaySet"> <!-- BEGIN: imageArea --> <div class="imageArea"> <div class="imageContainer"> <div class="thumbImg"> <span class="data"><img src="<?=$pfx_detail;?>.jpg" alt="" class="th_detail"></span> </div> <img class="scrolldown" src="<?= CDN_IMG_SERVER?>/_images/_global/instructions/scroll-down.png" width="43" alt="SCROLL DOWN" title="SCROLL DOWN"> </div> </div> <!-- END: imageArea --> <!-- BEGIN: fixedwidth --> <div class="fixedwidth abstract_top"> <!-- BEGIN: menubar --> <div class="menubar"> <!-- BEGIN: utilitynav --> <div class="utilitynav chromeGrey disabled"> <nav> <ul class="navigation"> <br class="clear" /> </ul> </nav> </div> <!-- END: utilitynav --> <!-- BEGIN: cartnav --> <div class="cartnav chromeGrey"> <nav> <ul class="navigation"> <br class="clear" /> </ul> </nav> </div> <!-- END: cartnav --> <div class="clear"></div> </div> <!-- END: menubar --> <div class="clear"></div> <!-- BEGIN: left column --> <div class="column2 left"> <!-- BEGIN: infoPanel --> <div class="infoPanel"> <? /* <!-- BEGIN: share --> <div class="data share"> <p><strong class="txt_lrg">Share</strong> <span class="txt_sm">this image.</span></p> include(INCLUDES.'/social-media-buttons.php'); <br class="clear" /> </div> <!-- END: share --> //*/ ?> <h1>Redacted Title</h1> <!-- BEGIN: copy --> <div class="copy"> <p>Redacted content. This poo poo expands in a single line WAY off the page.</p> <p>Redacted content. This poo poo expands in a single line WAY off the page.</p> <p>Redacted content. This poo poo expands in a single line WAY off the page.</p> </div> <!-- END: copy --> </div> <!-- END: infoPanel --> </div> <!-- END: left column --> <!--// BEGIN: right column //--> <div class="column2 right last"> <!--// BEGIN: redacted-mention //--> <div class="redacted-mention"> <!--// BEGIN: thumbDisplaySet //--> <ul class="thumbDisplaySet"> <? $html=''; $length=sizeof($data_redacted); for($i=0; $i<$length; $i++){ $ds=$data_redacted[$i]; $media=$ds->media; $lbd='data-light-box-type="'.$media.'" '; switch($media){ default: case LandingStandardData::MEDIA_IMG: $lbd.='data-light-box-url="'.$pfx_related.$ds->img.'" '; $copy='<h1 class="name"><a '.$lbd.'><span class="label">Redacted Text</span> “'.$ds->name.'”</a></h1>'; $copy.='<h2 class="fuckingperson" ><a '.$lbd.'>by '.$ds->fuckingperson.'</a></h2>'; break; case LandingStandardData::MEDIA_HTML: $lbd.='data-light-box-url="'.$ds->html.'" '; $copy='<h1 class="name"><a '.$lbd.'><span class="label">Video –</span></a></h1>'; $copy.='<h2 class="fuckingperson" ><a '.$lbd.'>'.$ds->description.'</a></h2>'; break; } $html.='<!--// BEGIN: item //-->'; $html.='<li class="thumbDisplayItem '.$ds->css.'">'; $html.='<section>'; $html.='<div class="thumb"><div class="thumbImg">'; $html.='<a '.$lbd.'><span class="data"><img src="'.$pfx_related_thumb.$ds->img.'" /></span></a>'; $html.='</div></div>'; $html.=$copy; $html.='</section>'; $html.='</li>'; $html.='<!--// END: item //-->'; } echo $html; ?> <br class="clear" /> </ul> <!--// END: thumbDisplaySet //--> </div> <!--// END: redacted-mention //--> </div> <!--// END: right column //--> <div class="clear"></div> </div> <!--// END: fixedwidth //--> <!--// BEGIN: relatedContainer //--> <div id="relatedContainer" class="dark"> <div class="related content fixedwidth abstract_btm"> <h2>More Bullshit Here</h2> <? /* <!--// BEGIN: thumbDisplaySet (video) //--> <ul class="thumbDisplaySet"> <!--// BEGIN: item //--> <li class="thumbDisplayItem video"> <section> <div class="thumb"><div class="thumbImg"> THIS IS A SINGLE LINE OF CODE THAT I'VE BROKEN UP FOR THE POST <a data-light-box-type="html" data-light-box-title="" data-light-box-url="/_data/video-data.php?video=redactedYouTubeID&amp;autohide=1&amp;showinfo=0&amp;autoplay=1&amp;rel=0"> <span class="data"> <img src="<?=$pre_related_thumb?>-vid.jpg"></span></a> END SINGLE LINE </div></div> </section> </li> <!--// END: item //--> <br class="clear" /> </ul> <!--// END: thumbDisplaySet (video) //--> //*/ ?> <!--// BEGIN: thumbDisplaySet (image) //--> <ul class="thumbDisplaySet"> <? $html=''; $length=sizeof($data_related); for($i=0; $i<$length; $i++){ $ds=$data_related[$i]; $lbd='data-light-box-type="img" data-light-box-url="'.$pfx_related.$ds->img.'"'; $html.='<!--// BEGIN: item //-->'; $html.='<li class="thumbDisplayItem">'; $html.='<section>'; $html.='<div class="thumb"><div class="thumbImg">'; $html.='<a '.$lbd.'><span class="data"><img src="'.$pfx_related_thumb.$ds->img.'" /></span></a>'; $html.='</div></div>'; $html.='<h1 class="name"><a '.$lbd.'>'.$ds->name.'</a></h1>'; $html.='<h2 class="fuckingperson" ><a '.$lbd.'>by '.$ds->fuckingperson.'</a></h2>'; $html.='</section>'; $html.='</li>'; $html.='<!--// END: item //-->'; } echo $html; ?> <br class="clear" /> </ul> <!--// END: thumbDisplaySet (image) //--> </div> </div> <!--// END: relatedContainer //--> </div> <!-- END: displaySet --> </div> <!-- END: scrnDetail --> </section> </div> <!-- END: rgnDetail --> </div> <!-- END: appContainer --> <? require(INCLUDES.'/footer.php'); ?> substitute fucked around with this message at 17:34 on Jan 9, 2014 |
# ¿ Jan 9, 2014 17:31 |
|
McGlockenshire posted:Jesus. As Amberskin said, thank you for this term. It's perfect. I'm sharing it with the new developer in my shared office tomorrow. He'll love that.
|
# ¿ Jan 10, 2014 01:10 |
|
Looking over and editing something the ad agency built for us (in CodeIgniter), that I've now inherited.php:<? function get_materials() { $db_table = $this->config->item('db_table_prefix') . 'materials'; $this->db->order_by('material_name ASC'); $query = $this->db->get($db_table); return $query->result(); } function get_attributes() { $db_table = $this->config->item('db_table_prefix') . 'attributes'; $this->db->order_by('attribute_category_id ASC, attribute_name ASC'); $query = $this->db->get($db_table); return $query->result(); } function get_categories() { $db_table = $this->config->item('db_table_prefix') . 'categories'; $this->db->order_by('sort_order ASC, category_name ASC'); $query = $this->db->get($db_table); return $query->result(); } function get_attribute_categories() { $db_table = $this->config->item('db_table_prefix') . 'attribute_categories'; $this->db->order_by('attribute_category_name ASC'); $query = $this->db->get($db_table); return $query->result(); } function get_brands() { $db_table = $this->config->item('db_table_prefix') . 'brands'; $this->db->order_by('brand_name ASC'); $query = $this->db->get($db_table); return $query->result(); } function get_divisions() { $db_table = $this->config->item('db_table_prefix') . 'divisions'; $this->db->order_by('division_name ASC'); $query = $this->db->get($db_table); return $query->result(); } function get_logos() { $db_table = $this->config->item('db_table_prefix') . 'logos'; $this->db->order_by('logo_name ASC'); $query = $this->db->get($db_table); return $query->result(); } ... then they all repeat as get_blah_by_id() { etc, etc... ?>
|
# ¿ Jan 15, 2014 14:30 |
|
php:<? /** * myFunction() * @param whatever $var * @return something, hopefully ;) */ public myFunction($var) { ... } ?>
|
# ¿ Jan 29, 2014 18:44 |
|
When in doubt, just wrap it in a <div>. Within another <div>. Within another <div> Ad nauseam. (I hate the "senior" graphic designer at my work.) pre:<div id="title" class="section"> <div class="content txt-center maxwidth400"> <h2>Welcome to BLAH BLAH BLAH.</h2> </div> </div> <div id="login" class="section"> <div class="content"> <div class="form-container"> <form name="loginForm" id="loginForm" action="/menu" method="post" data-eval="true"> <label>Enter your email address</label> <input name="username" value="" type="email"> <label>Enter your Password</label> <input name="password" value="" type=""> <p class="forgot-password"><a href="#">Forgot password.</a></p> <input name="submitHandler" class="submit" value="Login" type="submit"> </form> </div> <p class="create-profile"><a href="/account/create.php">Create profile</a></p> </div> </div>
|
# ¿ Jan 30, 2014 06:22 |
|
I hate graphic designers.code:
|
# ¿ Feb 20, 2014 19:13 |
|
The exciting follow-up to "I hate graphic designers." main nav example: code:
substitute fucked around with this message at 16:35 on Feb 21, 2014 |
# ¿ Feb 21, 2014 06:38 |
|
EntranceJew posted:I sincerely hope that's generated code. Code generated by a tool produced in 2004. Well, no. The "senior" graphic designer, in 2014, typed/copy-pasted that out to get started on a new project that is, supposedly, due in a week (because of a publication / product ad). I am not kidding.
|
# ¿ Feb 21, 2014 08:10 |
|
Less arguing about goto and more funny/go-kill-yourself bullshit.php:<? <!-- BEGIN: JQUERY LIBRARY --> <? if(APP){ ?> <script src="<?=CDN_SERVER_GLOBAL?>/_assets/scripting/jquery-library/jquery/1.7.1/min.js"></script> <script src="<?=CDN_SERVER_GLOBAL?>/_assets/scripting/jquery-library/jquery-address/1.5/min.js"></script> <script src="<?=CDN_SERVER_GLOBAL?>/_assets/scripting/jquery-library/jquery-easing/1.3/min.js"></script> <script src="<?=CDN_SERVER_GLOBAL?>/_assets/scripting/jquery-library/jquery-mousewheel/3.0.6/min.js"></script> <? }else{ ?> <script src="<?=CDN_SERVER_GLOBAL?>/_assets/scripting/jquery-library/jquery/1.10.2/min.js"></script> <script src="<?=CDN_SERVER_GLOBAL?>/_assets/scripting/jquery-library/jquery-migrate/1.2.1/min.js"></script> <? } ?> <!-- END: JQUERY LIBRARY --> <!-- BEGIN: RESPOND LIBRARY --> <script src="<?=CDN_SERVER_GLOBAL?>/_assets/scripting/respond/1.3.0/min.js"></script> <link href="<?=CDN_SERVER_GLOBAL?>/_assets/scripting/respond/proxy.html" id="respond-proxy" rel="respond-proxy" /> <link href="/_assets/scripting/respond/proxy.gif" id="respond-redirect" rel="respond-redirect" /> <script src="/_assets/scripting/respond/proxy.js"></script> <!-- END: RESPOND LIBRARY --> <!-- BEGIN: LOCAL SCRIPTS --> <script language="javascript" type="text/javascript" src="/_assets/js/animations/slideFX.js"></script> <?php if( SITE_SECTION == SITE_SECTION_COMPANY || SITE_SECTION == SITE_SECTION_SOLUTIONS) { ?> <script language="javascript" type="text/javascript" src="/_assets/box-slider/jquery.bxslider.js"></script> <?php } ?> <!--END: LOCAL SCRIPTS --> <? if(APP === true){ $html=''; $html_fb_static=''; switch(ENVIRONMENT){ ### DEVELOPMENT ENVIRONMENTS case ENVIRONMENT_DEV: case ENVIRONMENT_BETA: $html .=' <!-- BEGIN: <codewordforthislibrary> LIBRARY --> <!-- BEGIN: GLOBAL --> <!-- BEGIN: _core --> <script src="'.CDN_SERVER_GLOBAL.'/_assets/scripting/<codewordforthislibrary>/_objects/_global/_core/_global.js"></script> <script src="'.CDN_SERVER_GLOBAL.'/_assets/scripting/<codewordforthislibrary>/_objects/_global/_core/_main.js"></script> <script src="'.CDN_SERVER_GLOBAL.'/_assets/scripting/<codewordforthislibrary>/_objects/_global/_core/cookieStorage.js"></script> <script src="'.CDN_SERVER_GLOBAL.'/_assets/scripting/<codewordforthislibrary>/_objects/_global/_core/default.js"></script> <script src="'.CDN_SERVER_GLOBAL.'/_assets/scripting/<codewordforthislibrary>/_objects/_global/_core/displays.js"></script> <script src="'.CDN_SERVER_GLOBAL.'/_assets/scripting/<codewordforthislibrary>/_objects/_global/_core/events.js"></script> <script src="'.CDN_SERVER_GLOBAL.'/_assets/scripting/<codewordforthislibrary>/_objects/_global/_core/nodeInfo.js"></script> <!-- BEGIN: url --> <script src="'.CDN_SERVER_GLOBAL.'/_assets/scripting/<codewordforthislibrary>/_objects/_global/url/data.js"></script> <!-- BEGIN: UI --> <!-- BEGIN: ui --> <script src="'.CDN_SERVER_GLOBAL.'/_assets/scripting/<codewordforthislibrary>/_objects/_global/ui/default.js"></script> <script src="'.CDN_SERVER_GLOBAL.'/_assets/scripting/<codewordforthislibrary>/_objects/_global/ui/form.js"></script> <script src="'.CDN_SERVER_GLOBAL.'/_assets/scripting/<codewordforthislibrary>/_objects/_global/ui/lightbox.js"></script> <!-- BEGIN: utility: '.PLATFORM.' --> <script src="'.CDN_SERVER_GLOBAL.'/_assets/scripting/<codewordforthislibrary>/_objects/_global/utility/'.PLATFORM.'.js"></script> '; ### APP DEVELOPMENT if(APP === true){ $html .=' <!-- BEGIN: DATA --> <script src="'.CDN_SERVER_GLOBAL.'/_assets/scripting/<codewordforthislibrary>/_objects/_global/data/fabric/dataSetXML.js"></script> <script src="'.CDN_SERVER_GLOBAL.'/_assets/scripting/<codewordforthislibrary>/_objects/_global/data/fabric/dataXML.js"></script> <script src="'.CDN_SERVER_GLOBAL.'/_assets/scripting/<codewordforthislibrary>/_objects/_global/data/gallery/dataSetXML.js"></script> <script src="'.CDN_SERVER_GLOBAL.'/_assets/scripting/<codewordforthislibrary>/_objects/_global/data/gallery/dataXML.js"></script> <script src="'.CDN_SERVER_GLOBAL.'/_assets/scripting/<codewordforthislibrary>/_objects/_global/data/ioresponse/dataSetXML.js"></script> <script src="'.CDN_SERVER_GLOBAL.'/_assets/scripting/<codewordforthislibrary>/_objects/_global/data/ioresponse/dataXML.js"></script> <script src="'.CDN_SERVER_GLOBAL.'/_assets/scripting/<codewordforthislibrary>/_objects/_global/data/material/dataSetXML.js"></script> <script src="'.CDN_SERVER_GLOBAL.'/_assets/scripting/<codewordforthislibrary>/_objects/_global/data/material/dataXML.js"></script> <script src="'.CDN_SERVER_GLOBAL.'/_assets/scripting/<codewordforthislibrary>/_objects/_global/data/media/dataSetXML.js"></script> <script src="'.CDN_SERVER_GLOBAL.'/_assets/scripting/<codewordforthislibrary>/_objects/_global/data/media/dataXML.js"></script> <!-- BEGIN: APP: global --> <script src="'.CDN_SERVER_GLOBAL.'/_assets/scripting/<codewordforthislibrary>/_objects/_global/app/main.js"></script> <script src="'.CDN_SERVER_GLOBAL.'/_assets/scripting/<codewordforthislibrary>/_objects/_global/app/carts/default.js"></script> <script src="'.CDN_SERVER_GLOBAL.'/_assets/scripting/<codewordforthislibrary>/_objects/_global/app/carts/portfolio.js"></script> <script src="'.CDN_SERVER_GLOBAL.'/_assets/scripting/<codewordforthislibrary>/_objects/_global/app/carts/samples.js"></script> <script src="'.CDN_SERVER_GLOBAL.'/_assets/scripting/<codewordforthislibrary>/_objects/_global/app/complexSearch.js"></script> <script src="'.CDN_SERVER_GLOBAL.'/_assets/scripting/<codewordforthislibrary>/_objects/_global/app/displays/buttons.js"></script> <script src="'.CDN_SERVER_GLOBAL.'/_assets/scripting/<codewordforthislibrary>/_objects/_global/app/displays/display.js"></script> <script src="'.CDN_SERVER_GLOBAL.'/_assets/scripting/<codewordforthislibrary>/_objects/_global/app/displays/displayItem.js"></script> <script src="'.CDN_SERVER_GLOBAL.'/_assets/scripting/<codewordforthislibrary>/_objects/_global/app/displays/displaySet.js"></script> <script src="'.CDN_SERVER_GLOBAL.'/_assets/scripting/<codewordforthislibrary>/_objects/_global/app/displays/image.js"></script> <script src="'.CDN_SERVER_GLOBAL.'/_assets/scripting/<codewordforthislibrary>/_objects/_global/app/displays/menubar.js"></script> <script src="'.CDN_SERVER_GLOBAL.'/_assets/scripting/<codewordforthislibrary>/_objects/_global/app/displays/navigation.js"></script> <script src="'.CDN_SERVER_GLOBAL.'/_assets/scripting/<codewordforthislibrary>/_objects/_global/app/displays/region.js"></script> <script src="'.CDN_SERVER_GLOBAL.'/_assets/scripting/<codewordforthislibrary>/_objects/_global/app/displays/screen.js"></script> <script src="'.CDN_SERVER_GLOBAL.'/_assets/scripting/<codewordforthislibrary>/_objects/_global/app/displays/utilitybar.js"></script> <script src="'.CDN_SERVER_GLOBAL.'/_assets/scripting/<codewordforthislibrary>/_objects/_global/app/interfaceManager.js"></script> <!-- BEGIN: APP: '.FRAMEWORK.': '.STAGE_CONTENT.' --> <script src="'.CDN_SERVER_GLOBAL.'/_assets/scripting/<codewordforthislibrary>/_objects/'.FRAMEWORK.'/'.STAGE_CONTENT.'/complexSearch.js"></script> <script src="'.CDN_SERVER_GLOBAL.'/_assets/scripting/<codewordforthislibrary>/_objects/'.FRAMEWORK.'/'.STAGE_CONTENT.'/interfaceManager.js"></script> <script src="'.CDN_SERVER_GLOBAL.'/_assets/scripting/<codewordforthislibrary>/_objects/'.FRAMEWORK.'/'.STAGE_CONTENT.'/displays/display.js"></script> <script src="'.CDN_SERVER_GLOBAL.'/_assets/scripting/<codewordforthislibrary>/_objects/'.FRAMEWORK.'/'.STAGE_CONTENT.'/displays/displayItem.js"></script> <!-- BEGIN: Dynamic Social Media --> <script src="'.CDN_SERVER_GLOBAL.'/_assets/scripting/<codewordforthislibrary>/_objects/_global/social-media/dynamic.js"></script> <!-- END: <codewordforthislibrary> LIBRARY --> '; } ### SOCIAL MEDIA STATIC $html_fb_static.='<script src="'.CDN_SERVER_GLOBAL.'/_assets/scripting/<codewordforthislibrary>/_objects/_global/social-media/static.js"></script>'; break; ### PRODUCTION ENVIRONMENTS default: $html.=' <!-- BEGIN: <codewordforthislibrary> LIBRARY --> <script src="'.CDN_SERVER_GLOBAL.'/_assets/scripting/<codewordforthislibrary>/core-min.js"></script> <script src="'.CDN_SERVER_GLOBAL.'/_assets/scripting/<codewordforthislibrary>/url-min.js"></script> <script src="'.CDN_SERVER_GLOBAL.'/_assets/scripting/<codewordforthislibrary>/ui-min.js"></script> <script src="'.CDN_SERVER_GLOBAL.'/_assets/scripting/<codewordforthislibrary>/ui-lightbox-min.js"></script> <script src="'.CDN_SERVER_GLOBAL.'/_assets/scripting/<codewordforthislibrary>/utility-min.js"></script> <!-- BEGIN: GOOGLE TRACKING DOWNLOADS / CLICKS <script src="'.CDN_SERVER_GLOBAL.'/_assets/scripting/tracking.js"></script>--> '; if(APP === true) $html .=' <script src="'.CDN_SERVER_GLOBAL.'/_assets/scripting/<codewordforthislibrary>/data-min.js"></script> <script src="'.CDN_SERVER_GLOBAL.'/_assets/scripting/<codewordforthislibrary>/app-min.js"></script> <script src="'.CDN_SERVER_GLOBAL.'/_assets/scripting/<codewordforthislibrary>/app-'.STAGE_CONTENT.'-min.js"></script> <script src="'.CDN_SERVER_GLOBAL.'/_assets/scripting/<codewordforthislibrary>/social-media-dynamic-min.js"></script> <!-- END: <codewordforthislibrary> LIBRARY --> '; ### SOCIAL MEDIA STATIC $html_fb_static.='<script src="'.CDN_SERVER_GLOBAL.'/_assets/scripting/<codewordforthislibrary>/social-media-static-min.js"></script>'; break; } $html.=' <!-- BEGIN: SOCIAL MEDIA --> <script src="'.PROTOCOL.'//platform.twitter.com/widgets.js"></script> <script src="'.PROTOCOL.'//connect.facebook.net/en_US/all.js"></script> <script src="'.PROTOCOL.'//apis.google.com/js/plusone.js"> {"parsetags": "explicit"}</script> <!-- <script src="'.PROTOCOL.'//assets.pinterest.com/js/pinit.js"></script> <script src="'.PROTOCOL.'//www.youtube.com/player_api"></script> --> '.$html_fb_static.' <!-- END: SOCIAL MEDIA --> '; ### PRINT OUT JS echo $html; } ?> substitute fucked around with this message at 16:48 on Feb 25, 2014 |
# ¿ Feb 25, 2014 16:46 |
|
pokeyman posted:What in the flying gently caress is that? More awesomeness from the consultant's work that I've posted before.
|
# ¿ Feb 25, 2014 20:01 |
|
pokeyman posted:Is it meant to be some kind of template that one copies into a new project and modifies as appropriate? Please tell me there isn't a library called "<codewordforthislibrary>". It's all the JS needed to run his three "apps", that are really just an overblown shopping cart / gallery. I removed the library name to obscure it. This is the flow of these "apps": HTML POST -> PHP -> DB -> PHP -> XML -> JS -> HTML I've had the misfortune of handling the PHP/DB portion for 4+ years now. Suspicious Dish posted:I'd imagine that's substitute taking out the identifying pieces of what he works on. Probably, it's "butts.foo.wang" or some other URL. Close. It's actually "douchebag".
|
# ¿ Feb 25, 2014 20:28 |
|
pokeyman posted:That's what I thought at first, but that code is so lovely I thought it was left intact. And, basically it just displays a few pages. A search result, detail of the item, favorites (from DB or cookie written by the JS), and a share via email screen. All the XML data, created from the DB result in PHP, is loaded into and parsed by the JS to output HTML. Yes.
|
# ¿ Feb 26, 2014 00:43 |
|
EntranceJew posted:Are there competitions held to make the most Rube Goldbergian code and include as many token technologies as possible? You may have a reigning gold medalist in your hands. I could fill this thread with code for several pages.
|
# ¿ Feb 26, 2014 03:26 |
|
HardDisk posted:Pretty please? Well... gently caress it. Language switcher: php:<? ### Define namespace(s) //namespace _global\_lang\manager; //=============================================================== //-- BEGIN: Include Statements --------------------------------- //=============================================================== //require_once("default_interface.php"); //=============================================================== //-- END: Include Statements ----------------------------------- //=============================================================== //=========================================================== //-- BEGIN: Class: Region ---------------------------------- //=========================================================== class Region{ // BEGIN: Data Memembers public $domain; public $dspText; public $languages; // END: Data Memembers /*------------------------------------------------------- BEGIN: CONSTRUCTOR -------------------------------------------------------*/ // Region: // Constructor function __construct($domain, $dspText, $languages){ //trace("Region: CONSTR"); $this->domain=$domain; $this->dspText=$dspText; $this->languages=$languages; } /*------------------------------------------------------- END: CONSTRUCTOR -------------------------------------------------------*/ /*------------------------------------------------------- BEGIN: DECONSTRUCTOR -------------------------------------------------------*/ // __destructor: // Deconstructs object. public function __destructor(){ //trace("Region: DECONSTRUCTOR"); $this->domain=NULL; $this->dspText=NULL; $this->languages=NULL; } /*------------------------------------------------------- END: DECONSTRUCTOR -------------------------------------------------------*/ } //=========================================================== //-- END: Class: Region ------------------------------------ //=========================================================== //=========================================================== //-- BEGIN: Class: Language -------------------------------- //=========================================================== class Language{ // BEGIN: Data Memembers public $dspText; // END: Data Memembers /*------------------------------------------------------- BEGIN: CONSTRUCTOR -------------------------------------------------------*/ // Language: // Constructor function __construct($dspText){ //trace("Language: CONSTR"); $this->dspText=$dspText; } /*------------------------------------------------------- END: CONSTRUCTOR -------------------------------------------------------*/ /*------------------------------------------------------- BEGIN: DECONSTRUCTOR -------------------------------------------------------*/ // __destructor: // Deconstructs object. public function __destructor(){ //trace("Language: DECONSTRUCTOR"); $this->dspText=NULL; } /*------------------------------------------------------- END: DECONSTRUCTOR -------------------------------------------------------*/ } //=========================================================== //-- END: Class: Language ---------------------------------- //=========================================================== //=========================================================== //-- BEGIN: Class: LangManager ----------------------------- //=========================================================== class LangManager{ // BEGIN: Data Memembers const DELIMITER = "_"; ////// Abbreviation const REGION = 'rgn'; const RGN_CN = 'cn'; const RGN_EU = 'eu'; const RGN_NA = 'na'; const RGN_SA = 'sa'; //// Country ////// Abbreviation const COUNTRY = 'country'; const COUNTRY_CN = 'cn'; const COUNTRY_DE = 'de'; const COUNTRY_ES = 'es'; const COUNTRY_FR = 'fr'; const COUNTRY_IT = 'it'; const COUNTRY_NL = 'nl'; const COUNTRY_SE = 'se'; const COUNTRY_UK = 'uk'; const COUNTRY_US = 'us'; //// Languages ////// Abbreviation const LANGUAGE = 'lang'; const LANG_DE = 'de'; const LANG_EN = 'en'; const LANG_ES = 'es'; const LANG_FR = 'fr'; const LANG_IT = 'it'; const LANG_NL = 'nl'; const LANG_SV = 'sv'; const LANG_ZH = 'zh'; ////// Display Text const TXT_DE = 'Deutsch'; const TXT_EN = 'English'; const TXT_ES = 'Español'; const TXT_FR = 'Français'; const TXT_IT = 'Italiano'; const TXT_NL = 'Dutch'; const TXT_SV = 'Svenska'; const TXT_ZN = '中国的'; const WELCOME = 'welcome'; const SELECT = 'select'; const REMEMBER = 'remember'; const TXT_WELCOME_EN = 'Welcome to'; const TXT_SELECT_REGION_EN = 'Select Your Region'; const TXT_REMEMBER_SELECTION_EN = 'Remember Selection?'; const TXT_WELCOME_DE = 'Willkommen auf'; const TXT_SELECT_REGION_DE = 'Wählen Sie Ihre Region'; const TXT_REMEMBER_SELECTION_DE = 'Angemeldet Auswahl?'; const TXT_WELCOME_ES = 'Bienvenido a'; const TXT_SELECT_REGION_ES = 'Seleccione su Región'; const TXT_REMEMBER_SELECTION_ES = '¿Recuerde Selección?'; const TXT_WELCOME_FR = 'Bienvenue à'; const TXT_SELECT_REGION_FR = 'Sélectionnez votre région'; const TXT_REMEMBER_SELECTION_FR = 'N\'oubliez pas de sélection?'; const TXT_WELCOME_IT = 'Benvenuti a'; const TXT_SELECT_REGION_IT = 'Seleziona la tua regione'; const TXT_REMEMBER_SELECTION_IT = 'Ricorda di selezione?'; const TXT_WELCOME_NL = 'Welkom bij'; const TXT_SELECT_REGION_NL = 'Selecteer uw regio'; const TXT_REMEMBER_SELECTION_NL = 'Vergeet Selection?'; const TXT_WELCOME_SV = 'Välkommen till'; const TXT_SELECT_REGION_SV = 'Välj din region'; const TXT_REMEMBER_SELECTION_SV = 'Notera Val?'; const TXT_WELCOME_ZH = '欢迎'; const TXT_SELECT_REGION_ZH = '选择您的地区'; const TXT_REMEMBER_SELECTION_ZH = '记得选择?'; protected static $regions; public static $titles; protected static $languages; protected static $countries; // Flags public static $bDefaults = true; public static $bNewSession = true; public static $bSaveCookies = false; public static $bHubpage = false; // CONST static public static $HUBPAGE='index.php'; // END: Data Memembers /*------------------------------------------------------- BEGIN: CONSTRUCTOR -------------------------------------------------------*/ // LangManager: // Constructor function __construct(){ //trace("LangManager: CONSTR"); } /*------------------------------------------------------- END: CONSTRUCTOR -------------------------------------------------------*/ /*------------------------------------------------------- BEGIN: INIT -------------------------------------------------------*/ // LangManager: // INIT static public function init($rgn){ //trace("LangManager: INIT"); self::$languages=self::region_langs($rgn); //self::$countries=self::region_countries($rgn); return self::lang_switch(); } /*------------------------------------------------------- END: INIT -------------------------------------------------------*/ // get_region_titles: // Retuns an array of region titles based language. public static function & get_region_titles($lang=LANG){ //trace("RegionManager: get_region_titles"); try{ // Declare local variables. $data; switch($lang){ case self::LANG_EN.self::DELIMITER.self::COUNTRY_UK: case self::LANG_EN.self::DELIMITER.self::COUNTRY_US: case self::LANG_EN.self::DELIMITER.self::COUNTRY_CN: case self::LANG_EN: default: $data = array( self::REGION=>"Region", self::LANGUAGE=>"Language", self::RGN_NA=>"North America", self::RGN_SA=>"South America", self::RGN_EU=>"Europe, Africa & Middle East", self::RGN_CN=>"China" ); break; case self::LANG_ES.self::DELIMITER.self::COUNTRY_ES: case self::LANG_ES: $data = array( self::REGION=>"Región", self::LANGUAGE=>"Idioma", self::RGN_NA=>"América del Norte", self::RGN_SA=>"América del Sur", self::RGN_EU=>"Europa, África y Medio Oriente", self::RGN_CN=>"China" ); break; case self::LANG_FR.self::DELIMITER.self::COUNTRY_FR: case self::LANG_FR: $data = array( self::REGION=>"Région", self::LANGUAGE=>"Langue", self::RGN_NA=>"Amérique du Nord", self::RGN_SA=>"Amérique du Sud", self::RGN_EU=>"l'Europe, Afrique et Moyen-Orient", self::RGN_CN=>"Chine" ); break; case self::LANG_DE.self::DELIMITER.self::COUNTRY_DE: case self::LANG_DE: $data = array( self::REGION=>"Region", self::LANGUAGE=>"Sprache", self::RGN_NA=>"Nordamerika", self::RGN_SA=>"Südamerika", self::RGN_EU=>"Europa, Afrika und Naher Osten", self::RGN_CN=>"China" ); break; case self::LANG_IT.self::DELIMITER.self::COUNTRY_IT: case self::LANG_IT: $data = array( self::REGION=>"Regione", self::LANGUAGE=>"Lingua", self::RGN_NA=>"del Nord America del", self::RGN_SA=>"Sud America", self::RGN_EU=>"Europa, Africa e Medio Oriente", self::RGN_CN=>"Cina" ); break; case self::LANG_NL.self::DELIMITER.self::COUNTRY_NL: case self::LANG_NL: $data = array( self::REGION=>"Regio", self::LANGUAGE=>"Språk", self::RGN_NA=>"Nordamerika", self::RGN_SA=>"Sydamerika", self::RGN_EU=>"Europa, Afrika & Midden-Oosten", self::RGN_CN=>"China" ); break; case self::LANG_SV.self::DELIMITER.self::COUNTRY_SE: case self::LANG_SV: $data = array( self::REGION=>"Region", self::LANGUAGE=>"taal", self::RGN_NA=>"Noord-Amerika", self::RGN_SA=>"Zuid-Amerika", self::RGN_EU=>"Europa, Afrika och Mellanöstern", self::RGN_CN=>"Kina" ); break; case self::LANG_ZH.self::DELIMITER.self::COUNTRY_CN: case self::LANG_ZH: $data = array( self::REGION=>"地区", self::LANGUAGE=>"语", self::RGN_NA=>"北美", self::RGN_SA=>"南美洲", self::RGN_EU=>"欧洲", self::RGN_CN=>"中国" ); break; } return $data; }catch(Exception $e){trace("RegionManager: get_region_titles > function block: " . $e);} } // lang_switch: // Needs Description. public static function lang_switch(){ //trace("LangManager: lang_switch"); try{ ///* // Declare local variables. $languages = self::$languages; // Request properties $rqpLang='lang'; $rqpSaveCookies='s'; // URL request properties $url=explode('/',PHP_SELF); $rqURL=$url[1]; self::$bHubpage=self::hubpage(); // Set flags //// GET Request Data: lang & saveCookies if(isset($_GET[$rqpLang])){ $rqGET = $_GET[$rqpLang]; self::$bSaveCookies=(isset($_GET[$rqpSaveCookies]) && $_GET[$rqpSaveCookies] == '1' ); }else $rqGET=NULL; //// Session Data: lang if(isset($_SESSION[$rqpLang])){ $rqSESSION = $_SESSION[$rqpLang]; self::$bNewSession=false; }else $rqSESSION=NULL; // Determine which set of parameters to use: URL, GET, SESSION, or DEFAULTS if(isset($rqURL) && $rqURL!=$rqGET && self::validate($rqURL)){ $lang=$rqURL; self::$bSaveCookies=false; }elseif($rqGET && self::validate($rqGET)){ $lang=$rqGET; self::$bDefaults=false; }elseif($rqSESSION || self::validate($rqSESSION)){ $lang=$rqSESSION; self::$bDefaults=false; }else $lang=LANG_DEFAULT . self::DELIMITER . COUNTRY_DEFAULT; // Set Session values $_SESSION[$rqpLang]=$lang; // Set Titles self::$titles=self::get_region_titles($lang); //*/ return $lang; }catch(Exception $e){trace("RegionManager: lang_switch > function block: " . $e);} } // validate: // Validates lang_country selection. public static function validate($lang){ //trace("LangManager: validated"); return in_array($lang, self::$languages); } // hubpage: // Determines whether page is a hub page. public static function hubpage($url=PHP_SELF){ //trace("LangManager: hubpage"); $url=explode('/',$url); $length=sizeof($url); $b=false; switch($length){ case 2: case 3: $b=($url[$length-1] == self::$HUBPAGE); break; } return $b; } // lang_txt: // Needs Description. public static function lang_txt($lang){ //trace("LangManager: lang_txt"); switch($lang){ case self::LANG_EN: case self::LANG_EN.self::DELIMITER.self::COUNTRY_US: case self::LANG_EN.self::DELIMITER.self::COUNTRY_UK: case self::LANG_EN.self::DELIMITER.self::COUNTRY_CN: $txt=self::TXT_EN; break; case self::LANG_ES: case self::LANG_ES.self::DELIMITER.self::COUNTRY_ES: $txt=self::TXT_ES; break; case self::LANG_FR: case self::LANG_FR.self::DELIMITER.self::COUNTRY_FR: $txt=self::TXT_FR; break; case self::LANG_DE: case self::LANG_DE.self::DELIMITER.self::COUNTRY_DE: $txt=self::TXT_DE; break; case self::LANG_IT: case self::LANG_IT.self::DELIMITER.self::COUNTRY_IT: $txt=self::TXT_IT; break; case self::LANG_NL: case self::LANG_NL.self::DELIMITER.self::COUNTRY_NL: $txt=self::TXT_NL; break; case self::LANG_SV: case self::LANG_SV.self::DELIMITER.self::COUNTRY_SE: $txt=self::TXT_SV; break; case self::LANG_ZH: case self::LANG_ZH.self::DELIMITER.self::COUNTRY_CN: $txt=self::TXT_ZN; break; } return $txt; } // region_langs: // Needs Description. public static function region_langs($rgn){ //trace("LangManager: region_langs"); switch($rgn){ default: case self::RGN_NA: $languages = array( self::LANG_EN.self::DELIMITER.self::COUNTRY_US ); break; case self::RGN_EU: $languages = array( self::LANG_EN.self::DELIMITER.self::COUNTRY_UK, self::LANG_FR.self::DELIMITER.self::COUNTRY_FR, self::LANG_DE.self::DELIMITER.self::COUNTRY_DE, self::LANG_ES.self::DELIMITER.self::COUNTRY_ES, self::LANG_IT.self::DELIMITER.self::COUNTRY_IT, self::LANG_NL.self::DELIMITER.self::COUNTRY_NL, self::LANG_SV.self::DELIMITER.self::COUNTRY_SE ); break; case self::RGN_CN: $languages = array( self::LANG_EN.self::DELIMITER.self::COUNTRY_CN, self::LANG_ZH.self::DELIMITER.self::COUNTRY_CN ); break; } return $languages; } // all_region_langs: // Needs Description. public static function all_region_langs($rgns){ //trace("LangManager: all_region_langs"); $ds=array(); return $ds; } // lang_menu_txt: // Needs Description. public static function lang_menu_txt($lang){ switch($lang) { default: case self::LANG_EN: case self::LANG_EN.self::DELIMITER.self::COUNTRY_US: case self::LANG_EN.self::DELIMITER.self::COUNTRY_UK: case self::LANG_EN.self::DELIMITER.self::COUNTRY_CN: $arr = array( self::WELCOME => self::TXT_WELCOME_EN ,self::SELECT => self::TXT_SELECT_REGION_EN ,self::REMEMBER => self::TXT_REMEMBER_SELECTION_EN ); break; case self::LANG_DE: case self::LANG_DE.self::DELIMITER.self::COUNTRY_DE: $arr = array( self::WELCOME => self::TXT_WELCOME_DE ,self::SELECT => self::TXT_SELECT_REGION_DE ,self::REMEMBER => self::TXT_REMEMBER_SELECTION_DE ); break; case self::LANG_ES: case self::LANG_ES.self::DELIMITER.self::COUNTRY_ES: $arr = array( self::WELCOME => self::TXT_WELCOME_ES ,self::SELECT => self::TXT_SELECT_REGION_ES ,self::REMEMBER => self::TXT_REMEMBER_SELECTION_ES ); break; case self::LANG_FR: case self::LANG_FR.self::DELIMITER.self::COUNTRY_FR: $arr = array( self::WELCOME => self::TXT_WELCOME_FR ,self::SELECT => self::TXT_SELECT_REGION_FR ,self::REMEMBER => self::TXT_REMEMBER_SELECTION_FR ); break; case self::LANG_IT: case self::LANG_IT.self::DELIMITER.self::COUNTRY_IT: $arr = array( self::WELCOME => self::TXT_WELCOME_IT ,self::SELECT => self::TXT_SELECT_REGION_IT ,self::REMEMBER => self::TXT_REMEMBER_SELECTION_IT ); break; case self::LANG_NL: case self::LANG_NL.self::DELIMITER.self::COUNTRY_NL: $arr = array( self::WELCOME => self::TXT_WELCOME_NL ,self::SELECT => self::TXT_SELECT_REGION_NL ,self::REMEMBER => self::TXT_REMEMBER_SELECTION_NL ); break; case self::LANG_SV: case self::LANG_SV.self::DELIMITER.self::COUNTRY_SE: $arr = array( self::WELCOME => self::TXT_WELCOME_SV ,self::SELECT => self::TXT_SELECT_REGION_SV ,self::REMEMBER => self::TXT_REMEMBER_SELECTION_SV ); break; case self::LANG_ZH: case self::LANG_ZH.self::DELIMITER.self::COUNTRY_CN: $arr = array( self::WELCOME => self::TXT_WELCOME_ZH ,self::SELECT => self::TXT_SELECT_REGION_ZH ,self::REMEMBER => self::TXT_REMEMBER_SELECTION_ZH ); break; } return $arr; } /*------------------------------------------------------- BEGIN: DECONSTRUCTOR -------------------------------------------------------*/ // __destructor: // Deconstructs object. public function __destructor(){ //trace("LangManager: DECONSTRUCTOR"); $languages=NULL; } /*------------------------------------------------------- END: DECONSTRUCTOR -------------------------------------------------------*/ } //=========================================================== //-- END: Class: LangManager ------------------------------- //=========================================================== ?>
|
# ¿ Feb 26, 2014 04:45 |
|
IT BEGINS posted:I thought I had seen everything. $comma_pipe was in my nightmares. No, that was only the beginning: Wait wait wait, so the variable variable being created from the array key and made global, is then immediately set to null... what is the point??
|
# ¿ Mar 3, 2014 17:08 |
|
Coding horrors: well, at least I'm not being raped in prison
|
# ¿ Mar 5, 2014 22:36 |
|
Tell this person to at least use Kint. https://github.com/raveren/kint/
|
# ¿ Mar 14, 2014 16:09 |
|
It's the same function, with the Dev's name for the second one.php:<? I have a web team meeting tomorrow. And, I may go to prison for murder. So long goons. [php] /** * Static content controller. * * This file will render views from views/pages/ * * CakePHP(tm) : Rapid Development Framework ([url]http://cakephp.org[/url]) * Copyright (c) Cake Software Foundation, Inc. ([url]http://cakefoundation.org[/url]) * * Licensed under The MIT License * For full copyright and license information, please see the LICENSE.txt * Redistributions of files must retain the above copyright notice. * * @copyright Copyright (c) Cake Software Foundation, Inc. ([url]http://cakefoundation.org[/url]) * @link [url]http://cakephp.org[/url] CakePHP(tm) Project * @package app.Controller * @since CakePHP(tm) v 0.2.9 * @license [url]http://www.opensource.org/licenses/mit-license.php[/url] MIT License */ App::uses('AppController', 'Controller'); /** * Static content controller * * Override this controller by placing a copy in controllers directory of an application * * @package app.Controller * @link [url]http://book.cakephp.org/2.0/en/controllers/pages-controller.html[/url] */ class PagesController extends AppController { /** * This controller does not use a model * * @var array */ public $uses = array(); /** * Displays a view * * @param mixed What page to display * @return void * @throws NotFoundException When the view file could not be found * or MissingViewException in debug mode. */ public function display() { $path = func_get_args(); $count = count($path); if (!$count) { return $this->redirect('/'); } $page = $subpage = $title_for_layout = null; if (!empty($path[0])) { $page = $path[0]; } if (!empty($path[1])) { $subpage = $path[1]; } if (!empty($path[$count - 1])) { $title_for_layout = Inflector::humanize($path[$count - 1]); } $this->set(compact('page', 'subpage', 'title_for_layout')); try { $this->render(implode('/', $path),'cake-default'); } catch (MissingViewException $e) { if (Configure::read('debug')) { throw $e; } throw new NotFoundException(); } } /** * Displays a view * * @param mixed What page to display * @return void * @throws NotFoundException When the view file could not be found * or MissingViewException in debug mode. */ public function developersName() { $path = func_get_args(); $count = count($path); if (!$count) { return $this->redirect('/'); } $page = $subpage = $title_for_layout = null; if (!empty($path[0])) { $page = $path[0]; } if (!empty($path[1])) { $subpage = $path[1]; } if (!empty($path[$count - 1])) { $title_for_layout = "DeveloperName: ".Inflector::humanize($path[$count - 1]); } $this->set(compact('page', 'subpage', 'title_for_layout')); try { //$this->layout = 'default_developersName'; $this->render(implode('/', $path),'default'); } catch (MissingViewException $e) { if (Configure::read('debug')) { throw $e; } throw new NotFoundException(); } } } ?> substitute fucked around with this message at 02:31 on Mar 28, 2014 |
# ¿ Mar 27, 2014 08:09 |
|
Not code, but "documentation". Click to enlarge and read. (CakePHP... when you unzip it.)
|
# ¿ Apr 4, 2014 14:46 |
|
I bet he said a little prayer to himself before opening a codebase or starting edits on a file, like how you see people do that in restaurants before eating.
|
# ¿ Apr 28, 2014 18:52 |
|
Yes, PHP is loosely typed, so...php:<? (not a function, or class) //DEFAULTS $url = ''; $prev_link = ''; $next_link = ''; $derp_array = array(); $url_array = array(); $pagination_array = array(); $page_title = 'Derp!'; $page_description = ''; (END not a function, or class) ?>
|
# ¿ Apr 29, 2014 05:16 |
|
Yeah declaring variables is good practice, but I thought this was silly last night when I came across it in some purely procedural as all hell code. Like, I think I'll get that your array vars are arrays (since they have _array) when I scroll down. I need to stop drinking. And the post assumes everyone knows our set-up -- E_NOTICE turned off immediately. The END thing was by habit because I see START whatever and END whatever all over the place all the time around here, in PHP, CSS, HTML. substitute fucked around with this message at 16:18 on Apr 29, 2014 |
# ¿ Apr 29, 2014 16:16 |
|
necrotic posted:
Yep, but our servers would explode from the logs otherwise. I don't deal with that stuff.
|
# ¿ Apr 29, 2014 17:15 |
|
Documentaion.
|
# ¿ May 14, 2014 19:38 |
|
o.m. 94 posted:Actual code Graphic designers are the worst.
|
# ¿ May 16, 2014 16:47 |
|
|
# ¿ Apr 27, 2024 19:13 |
|
From developer at our ad agency.php:<? if( isset($_GET['vars']) && $_GET['vars'] != '') { $url = $_GET['vars']; } if($url == '') { try { $conn = new PDO('mysql:host=localhost;dbname=' . DB_NAME, DB_USER, DB_PASSWORD); $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $stmt = $conn->prepare('SELECT * FROM articles ORDER BY article_date DESC'); $stmt->execute(); $articles_array = $stmt->fetchAll(); if( count($articles_array) > 0) { $article_template = 'articles_listing.php'; } else { header('Location: /articles/'); exit; } } catch(PDOException $e) { header('Location: /articles/'); exit; } } else { try { $conn = new PDO('mysql:host=localhost;dbname=' . DB_NAME, DB_USER, DB_PASSWORD); $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $stmt = $conn->prepare('SELECT * FROM articles WHERE url = ?'); $stmt->execute(array($url)); $articles_array = $stmt->fetchAll(); if( count($articles_array) > 0) { //SET META TITLE TO ARTICLE TITLE $page_title = some_unnecessary_function_copied_from_codeigniter($articles_array[0]['title']); /* CREATE PREV/NEXT ARRAY FOR PAGINATION */ $stmt = $conn->prepare('SELECT * FROM articles ORDER BY article_date DESC'); $stmt->execute(); $articles_list_array = $stmt->fetchAll(); foreach($articles_list_array as $article) { $pagination_array[] = $article['id']; $url_array[$article['id']] = $article['url']; } $array_key = array_search($articles_array[0]['id'], $pagination_array); if(array_key_exists($array_key-1, $pagination_array)) { $prev_link = $url_array[ $pagination_array[$array_key-1] ]; } if(array_key_exists($array_key+1, $pagination_array)) { $next_link = $url_array[ $pagination_array[$array_key+1] ]; } $article_template = 'articles_single.php'; } else { header('Location: /articles/'); exit; } } catch(PDOException $e) { header('Location: /articles/'); exit; } } // then there was some HTML below all of this this, wrapping the included $article_template ?> substitute fucked around with this message at 22:57 on May 16, 2014 |
# ¿ May 16, 2014 21:47 |