Skip to content

Instantly share code, notes, and snippets.

@zzarbi
Created September 21, 2012 01:13
Show Gist options
  • Save zzarbi/3759241 to your computer and use it in GitHub Desktop.
Save zzarbi/3759241 to your computer and use it in GitHub Desktop.
Bad code
if($magicHash !== false && $fullName == 'phone_call_index'){
// create equivalent array with hashes
$fullAllowedHash = array();
foreach ($fullAllowed as $i => $val) {
$fullAllowedHash[$i] = md5($val);
}
// if the hash is in the array we don't need a popup
if(in_array($magicHash, $fullAllowedHash)){
return;
}
} else if (in_array($fullName, $fullAllowed)){ // if the full front name is in the allowed array, don't show the popup.
return;
} else{
// all the other page well have a popup
//file_put_contents('/tmp/test.log', $fullName.PHP_EOL, FILE_APPEND);
}
/**
* Do not display popup if the page is an excluded system page from the multiselect
*/
if($magicHash !== false && $fullName == 'phone_call_index'){
// create equivalent array with hashes
$systemExcludeHash = array();
foreach ($this->_getSystemExcludes() as $i => $val) {
$systemExcludeHash[$i] = md5($val);
}
// if the hash is in the array we don't need a popup
if(in_array($magicHash, $systemExcludeHash)){
return;
}
} elseif (in_array($fullName, $this->_getSystemExcludes())) {
return;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment