Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
substitute
Aug 30, 2003

you for my mum
Where/what is the best way to store the randomly generated salt, to use for verification/login later?

Adbot
ADBOT LOVES YOU

substitute
Aug 30, 2003

you for my mum

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.

substitute
Aug 30, 2003

you for my mum
PHP code:
function register()
{
    if (!empty($_POST)) {
        $msg = '';
        if ($_POST['user_name']) {
            if ($_POST['user_password_new']) {
                if ($_POST['user_password_new'] === $_POST['user_password_repeat']) {
                    if (strlen($_POST['user_password_new']) > 5) {
                        if (strlen($_POST['user_name']) < 65 && strlen($_POST['user_name']) > 1) {
                            if (preg_match('/^[a-z\d]{2,64}$/i', $_POST['user_name'])) {
                                $user = read_user($_POST['user_name']);
                                if (!isset($user['user_name'])) {
                                    if ($_POST['user_email']) {
                                        if (strlen($_POST['user_email']) < 65) {
                                            if (filter_var($_POST['user_email'], FILTER_VALIDATE_EMAIL)) {
                                                create_user();
                                                $_SESSION['msg'] = 'You are now registered so please login';
                                                header('Location: ' . $_SERVER['PHP_SELF']);
                                                exit();
                                            } else $msg = 'You must provide a valid email address';
                                        } else $msg = 'Email must be less than 64 characters';
                                    } else $msg = 'Email cannot be empty';
                                } else $msg = 'Username already exists';
                            } else $msg = 'Username must be only a-z, A-Z, 0-9';
                        } else $msg = 'Username must be between 2 and 64 characters';
                    } else $msg = 'Password must be at least 6 characters';
                } else $msg = 'Passwords do not match';
            } else $msg = 'Empty Password';
        } else $msg = 'Empty Username';
        $_SESSION['msg'] = $msg;
    }
    return register_form();
}

substitute
Aug 30, 2003

you for my mum

omeg posted:

That's sort of beautiful. :allears:

It's like a fractal or something. So trippy, dude.

substitute
Aug 30, 2003

you for my mum

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.

substitute
Aug 30, 2003

you for my mum

Volmarias posted:

I'm... honestly not sure if the guy was trolling or mentally ill :psyduck:

Well I'm going with he's criminal, thug, mentally ill, bipolar, peadophile, and so on.

substitute
Aug 30, 2003

you for my mum

Vasja posted:

php:
<?
extract($vals);
$ref = $referencenotes;
if (!strstr ("XDXD", "$CUSTCODE$")) {
    $refnum      = $vals["referencenotes2"];
    $brk = "; ";
    if (strlen ($refnum))
        $ref .= (strlen ($ref) ? "$brk" :"").$refnum;

    $refnum      = $vals["referencenotes3"];
    if (strlen ($refnum))
        $ref .= (strlen ($ref) ? "$brk" :"").$refnum;

    $refnum      = $vals["custponum"];
    if (strlen ($refnum))
        $ref .= (strlen ($ref) ? "$brk" :"").$refnum;

    $refnum      = $vals["custinvnum"];
    if (strlen ($refnum))
        $ref .= (strlen ($ref) ? "$brk" :"").$refnum;

    $refnum      = $vals["custdeptnum"];
    if (strlen ($refnum))
        $ref .= (strlen ($ref) ? "$brk" :"").$refnum;

    $refnum      = $vals["department"];
    if (strlen ($refnum))
        $ref .= (strlen ($ref) ? "$brk" :"").$refnum;
}
?>
Somehow, I don't think think this was the best way to handle this. If you're wondering what $CUSTCODE$ is, seems they decided to implement a pre-processor for php. :what:

Also, extract() creates key/value pairs from an array. So, they could use $whatever instead of $vals['whatever'] after the extract.

substitute
Aug 30, 2003

you for my mum

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.

I don't want to break the table so I won't put it in a tag. Just know that this is one line of code. (Is it okay to put it in the code tag?)

if ($_SESSION['website_enrollment']['change']['plan'] != ""): $aPlanSettings = $_SESSION['website_enrollment']['group']['plans'][$_SESSION['website_enrollment']['change']['plan']]['settings']; elseif ($_SESSION['website_enrollment']['change']['enrollee_info']['current'][$_SESSION['website_enrollment']['change']['individual']]['plan'] != ""): $aPlanSettings = $_SESSION['website_enrollment']['group']['plans'][$_SESSION['website_enrollment']['change']['enrollee_info']['current'][$_SESSION['website_enrollment']['change']['individual']]['plan']]['settings']; endif;

Also, this isn't the longest line of code in the file. The longest is a 614 character line that ends "endif; endif; endif;". It's a insane person's twisted version of Shantih, Shantih, Shantih. Did I mention this file has eleven thousand lines?

At least I think I've exorcised most of the "if(...): foreach(...): if(...): foreach(...): if(...); foo(); bar(); endif; endforeach; endif; endforeach; endif;" trains that took up single lines.

gently caress this person. I hope he never gets another development job.

substitute
Aug 30, 2003

you for my mum
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

substitute
Aug 30, 2003

you for my mum

substitute posted:

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

Update: :stare:

It goes so much deeper...

I can't even...

:stonk:

substitute
Aug 30, 2003

you for my mum

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.

substitute
Aug 30, 2003

you for my mum

substitute posted:

Update: :stare:

It goes so much deeper...

I can't even...

:stonk:

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.

substitute
Aug 30, 2003

you for my mum

kitten smoothie posted:

Grace Hopper is spinning in her grave


The author explains in the comments (sort of).

...There is great scholarship talking about weather...

Good. Change your major.

:iceburn:

substitute
Aug 30, 2003

you for my mum

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:

PHP code:
// validation
$validationOK=true;
if (!$validationOK) {
  echo "Error";
  exit;
}


print_r($validationOK);
echo $validationOK;
echo 'Validation: '. $validationOK;
die('Error: Validation failure: '. $validationOK');

substitute
Aug 30, 2003

you for my mum
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;amp;autohide=1&amp;amp;showinfo=0&amp;amp;autoplay=1&amp;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> &ldquo;'.$ds->name.'&rdquo;</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 &ndash;</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;amp;autohide=1&amp;amp;showinfo=0&amp;amp;autoplay=1&amp;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

substitute
Aug 30, 2003

you for my mum

McGlockenshire posted:

Jesus.

You're dealing with an architecture astronaut with a bunch of cargo cult poo poo thrown in for good measure.

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.

substitute
Aug 30, 2003

you for my mum
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...
?>
loving gently caress, why?

substitute
Aug 30, 2003

you for my mum
php:
<?
/**
 * myFunction()
 * @param  whatever $var
 * @return something, hopefully ;)
 */
public myFunction($var) 
{ 
...
}
?>

substitute
Aug 30, 2003

you for my mum
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>

substitute
Aug 30, 2003

you for my mum
I hate graphic designers.
code:
<h6>
	<a href="/company/locations">
		<span class="nowrap">See Contact</span>
		<span class="nowrap">Information for</span>
		<span class="nowrap">other Locations</span>
	</a>
</h6>

substitute
Aug 30, 2003

you for my mum
The exciting follow-up to "I hate graphic designers."

main nav example:

code:
<!doctype html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<META NAME="viewport" CONTENT="WIDTH=DEVICE-WIDTH, INITIAL-SCALE=1, MINIMUM-SCALE=1, MAXIMUM-SCALE=1" />
	<link rel="stylesheet" href="/css/styles.css">
</head>
<body>

<div id="nav-container">
    <div id="site-nav" class="content-group">
        <a href="index.php">
            <div class="content-group-item header">
                <div class="content-group-wrapper">
                    <div class="content-group-data logo">
                        <span class="content-group-label"><h1>BLAH</h1></span>
                        <span class="content-group-icon"><img class="nav-logo" src="/img/global/blah-logo.jpg"/></span>
                    </div>
                </div>
            </div>
        </a>
       
        <a href="index.php">
            <div class="content-group-item feature">                 
                <div class="content-group-wrapper">
                    <div class="content-group-data blah2-bg">
                        <span class="content-group-label"><h1>BLAH 2</h1></span>
                    </div>
                </div>
            </div>
        </a>
        
        <a href="index.php">
            <div class="content-group-item feature">
                <div class="content-group-wrapper">
                    <div class="content-group-data blah3-bg">
                        <span class="content-group-label"><h1>BLAH 3</h1></span>
                    </div>
                </div>
            </div>
        </a>
        
        <a href="index.php">
            <div class="content-group-item">
                <div class="content-group-wrapper">
                    <div class="content-group-data">
                        <span class="content-group-label"><h1>BLAH 4</h1></span>
                    </div>
                </div>
            </div>
        </a>
        
        <a href="index.php">
            <div class="content-group-item">
                <div class="content-group-wrapper">
                    <div class="content-group-data">
                        <span class="content-group-label"><h1>BLAH 5</h1></span>
                    </div>
                </div>
            </div>
        </a>
    </div>
</div>
    
<div id="content-container">
        <div class="section">
    <div id="homepage-hero" class="content-group">
       
        <a href="index.php">
            <div class="content-group-item">
                <div class="content-group-wrapper">
                    <div class="content-group-data">
                        <span class="hero-container someproduct-bg"> 
                            <span class="hero-cta-container">
                                <span class="hero-cta-inner-container">Call to action</span>
                            </span>
                        </span>
                    </div>
                </div>
            </div>
        </a>
        
        <a href="index.php">
            <div class="content-group-item">
                <div class="content-group-wrapper">
                    <div class="content-group-data">
                        <span class="hero-container another-product"> 
                            <span class="hero-cta-container">
                                <span class="hero-cta-inner-container">Call to action</span>
                            </span>
                        </span>
                    </div>
                </div>
            </div>
        </a>
        
    
    </div>
    </div>
</div>
<div id="footer-container">
    <span class="upper"><h1>Contact Us</h1></span>
    <span class="lower"><p>BLAH BLAH is a registered trademark of BLAH BLAH.</p></span>
</div>
    
</body>
</html>
How could someone type this out and not stop to think, "There has to be a better way." (??)

substitute fucked around with this message at 16:35 on Feb 21, 2014

substitute
Aug 30, 2003

you for my mum

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.

substitute
Aug 30, 2003

you for my mum
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;
}

?>
Blast off!!

substitute fucked around with this message at 16:48 on Feb 25, 2014

substitute
Aug 30, 2003

you for my mum

pokeyman posted:

What in the flying gently caress is that?

More awesomeness from the consultant's work that I've posted before.

substitute
Aug 30, 2003

you for my mum

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".

substitute
Aug 30, 2003

you for my mum

pokeyman posted:

That's what I thought at first, but that code is so lovely I thought it was left intact.

What a piece of poo poo.

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.

substitute
Aug 30, 2003

you for my mum

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.

substitute
Aug 30, 2003

you for my mum

HardDisk posted:

Pretty please? :allears:

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 = '&#20013;&#22269;&#30340;';
    
    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 = '&#27426;&#36814;';
    const TXT_SELECT_REGION_ZH = '&#36873;&#25321;&#24744;&#30340;&#22320;&#21306;';
    const TXT_REMEMBER_SELECTION_ZH = '&#35760;&#24471;&#36873;&#25321;&#65311;';

    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 &amp; 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=>"&#22320;&#21306;",
             self::LANGUAGE=>"&#35821;",
             self::RGN_NA=>"&#21271;&#32654;",
             self::RGN_SA=>"&#21335;&#32654;&#27954;",
             self::RGN_EU=>"&#27431;&#27954;",
             self::RGN_CN=>"&#20013;&#22269;"
            );
            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  -------------------------------
//===========================================================

?>
:suicide:

substitute
Aug 30, 2003

you for my mum

IT BEGINS posted:

I thought I had seen everything. $comma_pipe was in my nightmares. No, that was only the beginning:

php:
<?
function MapValsToBasedefs($fnames, $basedefs)
{
        //$fnames = array_map('strtolower', $fnames);
        foreach($basedefs as $arname=>$basedef)
        {
            global $$arname;

            $$arname = SetToNull( $$arname);
            $$arname = FindAndMapFieldsToTableNames($basedef, $fnames, $$arname);
            foreach ($$arname as $fld=>$idx) {
                if ($idx !== null) {
                    $offsetArr[$idx] = $fld;
                }
            }
            // $$offsetArr = array_flip($$arname);  cant use array_flip when some values are null
            if (count($offsetArr))
                ksort($offsetArr);
            $arname_Offset = "{$arname}_Offset";
            global $$arname_Offset;
            $$arname_Offset = $offsetArr;
        }
        return true;
}
?>
What the actual gently caress.

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??

substitute
Aug 30, 2003

you for my mum
Coding horrors: well, at least I'm not being raped in prison

substitute
Aug 30, 2003

you for my mum
Tell this person to at least use Kint.

https://github.com/raveren/kint/

substitute
Aug 30, 2003

you for my mum
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

substitute
Aug 30, 2003

you for my mum
Not code, but "documentation".

Click to enlarge and read.



(CakePHP... when you unzip it.)

substitute
Aug 30, 2003

you for my mum
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.

substitute
Aug 30, 2003

you for my mum
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)

?>
Thanks for letting me know that basically all your vars are empty before use... in PHP. A loosely typed language.

substitute
Aug 30, 2003

you for my mum
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

substitute
Aug 30, 2003

you for my mum

necrotic posted:


This is the real horror.

Yep, but our servers would explode from the logs otherwise. I don't deal with that stuff.

substitute
Aug 30, 2003

you for my mum
Documentaion.

:airquote:

substitute
Aug 30, 2003

you for my mum

o.m. 94 posted:

Actual code

code:
#delegate {font-size:16px; color:#000; background-color:#FFF; border-top: 1px; border-right: 1px; border-bottom: 1px;border-left: 1px; border-color: blue; border-style: solid}
"It makes the CSS file smaller"
"It makes it easier to read"

We automatically minify. Also note the border declaration
No it doesn't
I can't read the diff anymore
I hate you

Graphic designers are the worst.

Adbot
ADBOT LOVES YOU

substitute
Aug 30, 2003

you for my mum
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

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply