basedir = ""; // Counter for template iterations $this->iteration = array(); // Filenames of the templates $this->filenames = array(); // HTML/Text of unparsed templates $this->plain_templates = array(); // HTML/Text of parsed templates $this->parsed_templates = array(); // Amount and names of all templates $this->cnt_templates = 0; $this->templates = array(); // These vars will be set for all added Templates $this->subtemplates = array(); $this->variables = array(); $this->globals = array(); $this->attributes = array(); // Does one of the templates contain other templates $this->uses_dependencies= false; // Set template tags $this->setType( $type ); } // Set template type function setType( $type = "" ){ switch ( $type ){ case "tex": $this->setTags( "<{", "}>" ); break; case "html": default: $this->setTags( forumTEMPLATE_TAG_START, forumTEMPLATE_TAG_END ); break; } } // Set template tags function setTags( $start = forumTEMPLATE_TAG_START, $end = forumTEMPLATE_TAG_END ){ $this->tag_start = $start; $this->tag_end = $end; $this->regex_get_all_vars = "/". $start ."([^a-z{}]+)". $end ."/" ; } // Set template directory function setBasedir( $basedir ){ $this->basedir = $basedir; } // Check if a template exists function exists( $name ){ $name = strtoupper( $name ); for( $i=0; $i<$this->cnt_templates; $i++ ){ if( $this->templates[$i] == $name ){ return true; } } return false; } // Add a template function addTemplate( $name, $filename ){ $this->createTemplate( $name, array( "type" => "file", "filename" => $filename ) ); // Store the filename $this->filenames[$name] = $filename; } // Adds several templates function addTemplates( $templates ){ while ( list( $name, $file ) = each( $templates ) ){ $this->addTemplate( $name, $file ); } } // Creates a new template function createTemplate( $name, $source ){ $name = strtoupper( $name ); // Store the name of the template in index table $this->templates[$this->cnt_templates] = $name; $this->cnt_templates++; // Store the source $this->source[$name] = $source; // Init vars for the new Templates // Store all attributes in Array $this->attributes[$name] = array( "loop" => 1, "visibility" => "visible", "unusedvars" => "strip", "type" => "STANDARD" ); $this->iteration[$name] = 0; // No vars are set for this template $this->variables[$name] = array(); // No subtemplates have been specified $this->cnt_subtemplates[$name] = 0; $this->varsConverted[$name] = false; } // Sets the type of the Template function setTemplateType( $template, $type ){ $template = strtoupper( $template ); $this->setAttribute( $template, "type", $type ); } // Sets the conditionvar of a condtion Template function setConditionVar( $template, $conditionvar ){ $template = strtoupper( $template ); $conditionvar = strtoupper( $conditionvar ); $this->conditionvars[$template] = $conditionvar; } // Sets an attribute of a template function setAttribute( $template, $attribute, $value ){ $template = strtoupper( $template ); $attribute = strtolower( $attribute ); $this->attributes[$template][$attribute]= $value; } // Sets several attribute of a template function setAttributes( $template, $attributes ){ if( !is_array( $attributes ) ){ return false; } $template = strtoupper( $template ); while( list( $attribute, $value ) = each( $attributes ) ){ $attribute = strtolower( $attribute ); $this->attributes[$template][$attribute]= $value; } } // Gets an attribute of a template function getAttribute( $template, $attribute ){ $template = strtoupper( $template ); $attribute = strtolower( $attribute ); if(isset($this->attributes[$template][$attribute]))//Fanhua adds on July 19, 2005 return $this->attributes[$template][$attribute]; } // Clears an attribute of a template function clearAttribute( $template, $attribute ){ $template = strtoupper( $template ); $attribute = strtolower( $attribute ); unset( $this->attributes[$template][$attribute] ); } // Adds a subtemplate for a condition or oddeven template function addSubTemplate( $template, $condition ){ $template = strtoupper( $template ); $this->subtemplates[$template][$condition] = ""; $this->subtemplate_conditions[$template][$this->cnt_subtemplates[$template]] = $condition; $this->cnt_subtemplates[$template]++; } // Parses several templates from one forumTemplate file function readTemplatesFromFile( $file ){ // Tag depth $this->depth = -1; // Names, extracted from the Tags $this->template_names = array(); // All HTML code, that is found between the tags $this->template_data = array(); // Attributes, extracted from tags $this->template_types = array(); $this->last_opened = array(); $this->last_keep = array(); $this->whitespace = array(); $this->createParser( $file ); $open_tag = array_pop( $this->last_opened ); if( $open_tag != NULL ){ die ( "Error in template '".$file."': </".$open_tag."> still open at end of file." ); } } // Parse a template file and call the appropriate handlers function createParser( $fname ){ // If basedir is set, prepend basedir $pname = $this->basedir!="" ? $this->basedir."/".$fname : $fname; // Open file for reading $fp = fopen( $pname, "r" ); // Couldn't open the file => exit if( !$fp ){ die( "Couldn't open file '".$fname."' for reading!" ); } // Read line for line from the template $lineno = 1; // Read until end of file while( !feof( $fp ) ){ // Read one line $line = fgets( $fp, 4096 ); if(isset($this->whitespace)&& count( $this->whitespace )>1){//Fanhua adds on July 19, 2005 // Check, wether leading and trailing whitepaces should be stripped switch( $this->whitespace[( count( $this->whitespace )-1 )] ){ case "trim": $line = trim( $line ); break; case "ltrim": $line = ltrim( $line ); break; case "rtrim": $line = rtrim( $line ); break; } }//Fanhua adds on July 19, 2005 if ( eregi( "", $line, $regs ) ){ // ========= [ OPEN TAG ] ========= // Check for any Tag by using RegExp // Get Tag name and attributes $tagname = strtolower( $regs[1] ); $attributes = $this->parseAttributes( $regs[2] ); //if( $attributes[keep] > 0 ){ if( isset($attributes["keep"]) && $attributes["keep"] > 0 ){//Fanhua edits on July 19, 2005 // Create new attribute $newkeep = $attributes['keep'] > 1 ? " keep=\"".($attributes['keep']-1)."\"" : ""; // Replace old attribute with new attribute $newline = str_replace( " keep=\"".$attributes[keep]."\"", $newkeep, $line ); // Use this line as data $this->dataHandler( $fname, $newline, $lineno ); // If the tag was not empty keep the closing tag, too if( substr( $regs[2], -1 ) != "/" ) $this->last_keep[] = true; }else { $this->last_keep[] = false; // Handle start Element $this->startElementHandler( $fname, $tagname, $attributes, $line, $lineno ); if( substr( $regs[2], -1 ) == "/" ){ $this->endElementHandler( $fname, $tagname, $line, $lineno ); }else{ // Store the name of the last opened tag $this->last_opened[] = $tagname; } } }elseif ( eregi( "", $line, $regs ) ){ // ========= [ CLOSING TAG ] ========= // Check if a closing Tag has been found // Yes => get the tagname $tagname = strtolower( $regs[1] ); $keep = array_pop( $this->last_keep ); if( !$keep ){ $last_opened = array_pop( $this->last_opened ); if( $last_opened == NULL ){ die ( "Error in template '".$fname."': no opening tag found for </".$tagname."> in line ".$lineno ); } if( $tagname != $last_opened ){ die ( "Error in template '".$fname."': closing </".$tagname."> does not match opened <".$last_opened."> in line ".$lineno ); } $this->endElementHandler( $fname, $tagname, $line, $lineno ); }else{ $this->dataHandler( $fname, $line, $lineno ); } }else{ // ========= [ CDATA SECTION ] ========= // No tag found => store the line $this->dataHandler( $fname, $line, $lineno ); } // Goto next line $lineno++; } } // Handle a start tag in template parser function startElementHandler( $fname, $tagname, $attributes, $line, $lineno ){ // Check for whitespace attribute if( isset($attributes['whitespace']) ) array_push( $this->whitespace, strtolower( $attributes[whitespace] ) ); // Use whitepspace mode from last opened template else if(isset($this->whitespace)&& count( $this->whitespace )>1)//Fanhua adds on July 19, 2005 array_push( $this->whitespace, $this->whitespace[( count( $this->whitespace )-1 )] ); switch( $tagname ) { // Beginning of a template found case "tmpl": // Check for name of template, which is a necessary attribute if( !$tmpl_name = strtoupper( $attributes['name'] ) ) die ( "Error in template '".$fname."': missing name for template in line ".$lineno ); unset( $attributes['name'] ); // Increment Tag Depth $this->depth++; // Start with a blank template $this->template_data[$this->depth] = ""; // and store the name $this->template_names[$this->depth] = $tmpl_name; // Check, if attribute "type" was found //if( $tmpl_type = strtoupper( $attributes['type'] ) ) $attributes["type"]=isset($attributes['type'])?$attributes['type']:'';//Fanhua edits on July 19, 2005 if( $tmpl_type = strtoupper( $attributes["type"] ) )//Fanhua edits on July 19, 2005 { $this->template_types[$this->depth] = $tmpl_type; $attributes['type'] = $tmpl_type; } // No type found => this is a boring standard template else { $attributes['type'] = "STANDARD"; $this->template_types[$this->depth] = "STANDARD"; } // Check for src attribute => external file //if( $attributes[src] ) if( isset($attributes["src"]) )//Fanhua edits on July 19, 2005 { // Store the filename of the external file $filename = $attributes['src']; // Has the external file to be parsed if( $attributes['parse'] == "on" ) $this->createParser( $filename ); // No parsing, just take the whole content of the file else { // Filename including full freeh $external = $this->basedir!="" ? $this->basedir."/".$filename : $filename; // Open the file and read all the content if( !$tmp = @implode( "", @file( $external ) ) ) die( "Couldn't open file '".$external."' for reading in template ".$fname." line ".$lineno ); $this->template_data[$this->depth] .= $tmp; } // Delete the src attribute, it hasn't to be stored unset( $attributes[src] ); } // No external file => the template is part of teh current file else $filename = "[part of ".$fname."]"; // add the template $this->addTemplate( $this->template_names[$this->depth], $filename ); // Set all remaining attributes $this->setAttributes( $this->template_names[$this->depth], $attributes ); switch ( $this->template_types[$this->depth] ) { // Template type is "ODDEVEN", it contains two alternating subtemplates case "ODDEVEN": $this->setConditionVar( $this->template_names[$depth], "free_ROW_VAR mod 2" ); break; // Template is a condition Tenplate => it needs a condition var case "CONDITION": // none found => there is an error if( !$conditionvar = $attributes[conditionvar] ) die ( "Error in template '".$fname."': missing conditionvar for template in line ".$lineno ); // Conditionvar was found => store it $this->setConditionVar( $this->template_names[$this->depth], $conditionvar ); break; // Template is a simple condition Tenplate => it needs required vars case "SIMPLECONDITION": // none found => there is an error if( $requiredvars = $attributes[requiredvars] ) $this->setAttribute( $this->template_names[$this->depth], "requiredvars", explode( ",", $requiredvars ) ); else die ( "Error in template '".$fname."': missing requiredvars attribute for simple condition template in line ".$lineno ); break; } // If the template isn't the root( depth=0 ) template, a placeholder has to be put into the parent template if ( $this->depth > 0 ) { // Is there a placeholder attribute? //if( $placeholder = strtoupper( $attributes['placeholder'] ) ) $attributes['placeholder']=isset($attributes['placeholder'])?$attributes['placeholder']:"";//Fanhua adds on July 19, 2005 if( $placeholder = strtoupper( $attributes["placeholder"] ) )//Fanhua adds on July 19, 2005 { // Placeholder="none" found => DO NOT PUT A PLACEHOLDER IN THE PARENT TEMPLATE! if( $placeholder != "NONE" ) $this->template_data[($this->depth-1)] .= $this->tag_start. $placeholder .$this->tag_end; } // No placeholder attribute found => standard placeholder else { $this->template_data[($this->depth-1)] .= $this->tag_start."TMPL:".$this->template_names[$this->depth].$this->tag_end."\n"; // Tell the parent template, that it has to parse the child template, before parsing itself $this->addDependency( $this->template_names[($this->depth-1)], $this->template_names[$this->depth] ); } } break; // Found the beginning of a subtemplate case "sub": // A subtemplate needs to have a "condition" attribute $condition = $attributes[condition]; // None found => error if( isset( $condition ) == 0 ) die ( "Error in template '".$fname."': missing condition attribute for template in line ".$lineno ); // Everything is ok => add the subtemplate and store the condition $this->addSubTemplate( $this->template_names[$this->depth], $condition ); // Store the current condition $this->template_condition[$this->depth] = $condition; break; // Found a link template case "link": $src = strtoupper( $attributes[src] ); if( !$src ) die ( "Error in template '".$fname."': missing src attribute for link in line ".$lineno ); // Put a placeholder into the current template if ( $this->depth >= 0 ) { $this->template_data[$this->depth] .= $this->tag_start."TMPL:".$src.$this->tag_end."\n"; // Tell the parent template, that it has to parse the child template, before parsing itself $this->addDependency( $this->template_names[$this->depth], $src ); } break; // No valid Tag found => default: die ( "Error in template '".$fname."': unkown Tag in line ".$lineno ); break; } } // Handle a end tag in template parser function endElementHandler( $fname, $tagname, $line ){ array_pop( $this->whitespace ); switch( $tagname ){ // End of a template found case "tmpl": // If the current template is a standard template, store all contentfound between Tags if ( $this->template_types[$this->depth] == "STANDARD" || $this->template_types[$this->depth] == "SIMPLECONDITION" ){ $this->setPlainContent( $this->template_names[$this->depth], $this->template_data[$this->depth] ); } // Decrease Tagdepth $this->depth--; break; // End of a subtemplate found case "sub": // Store alle content found between :sub Tags $this->setPlainContent( $this->template_names[$this->depth], $this->template_data[$this->depth], $this->template_condition[$this->depth] ); // clear all Data, to store the data of the next subtemplate $this->template_data[$this->depth] = ""; break; // End of a link found case "link": // Just ignore this tag... break; // No kown tag found default: die ( "Error in template '".$fname."': unkown closing tag in line ".$lineno ); break; } } // Handle a CDATA in template parser function DataHandler( $fname, $data ){ if($this->depth>=0)//Fanhua adds on July 19, 2005 $this->template_data[$this->depth] .= $data; } // Adds a variable to a template function addVar( $template, $name, $value ){ $template = strtoupper( $template ); $name = strtoupper( $name ); if( !is_array( $value ) ){ $value = (string)$value; } // store the value and the name of the variable $this->variables[$template][$name] = $value; // if the value is an array, the template has to be repeated if ( is_array( $value ) ){ // Check, how often the template has to be repeated if( $this->getAttribute( $template, "loop" ) < count( $value ) ){ $this->setAttribute( $template, "loop", count( $value ) ); } } } // Adds several variables to a template function addVars( $template, $variables, $prefix="" ){ // Are there variables? if( !is_array( $variables ) ){ return false; } // Add all vars while ( list( $name, $value ) = each( $variables ) ){ if( !is_int( $name ) ){ $this->addVar( $template, $prefix.$name, $value ); } } } // Adds several rows of variables to a template function addRows( $template, $rows, $prefix="" ){ // Store the vars in this array $newvars = array(); // get amount of rows $cnt_rows = count( $rows ); if( $cnt_rows == 1 ){ $this->addVars( $template, $rows[0], $prefix ); }else{ for ( $i = 0; $i < $cnt_rows; $i++ ){ if( is_array( $rows[$i] ) ){ // Get key and value while( list( $key,$value ) = each( $rows[$i] ) ){ // check if the array key is an int value => skip it if ( !is_int( $key ) ){ // prepend prefix and store the value $new_vars[$prefix.$key][$i] = $value; } } } } // add the vars to the template $this->addVars( $template, $new_vars ); } } // Adds a global variable function addGlobalVar( $name, $value ){ $this->globals[strtoupper($name)] = (string)$value; } // Adds several global variables function addGlobalVars( $variables, $prefix = "" ){ while ( list( $variable, $value ) = each( $variables ) ){ $this->globals[strtoupper( $prefix.$variable )] = (string)$value; } } // Creates a dependeny between two templates function addDependency( $container, $child ){ $this->dependencies[strtoupper( $container )][] = strtoupper( $child ); // This template now uses dependencies $this->uses_dependencies = true; } // loads a template function loadTemplate( $name ){ echo $name; $name = strtoupper( $name ); // prepend basedirname, if it exists $fname = $this->basedir!="" ? $this->basedir."/".$this->source[$name][filename] : $this->source[$name][filename]; if( stristr( $fname, "[part" ) ){ return true; } if( !$this->plain_templates[$name] = @implode( "", @file( $fname ) ) ){ die( "Couldn't open template '".$name."' (file: '".$fname."') for reading." ); } } // sets the content of a template function setPlainContent( $template, $content, $sub="" ){ $template = strtoupper( $template ); // The content has to be set for a subtemplate if ( $sub!="" ){ $this->plain_templates[$template][$sub] = $content; // content is meant for a template }else{ $this->plain_templates[$template] = $content; } } // parses a template function parseTemplate( $template, $mode="w" ){ $template = strtoupper( $template ); $this->iteration[$template] = 0; // The template has to be repeated if ( $this->getAttribute( $template, "loop" ) > 1 ){ $this->parseIterativeTemplate( $template, $mode ); }else{ // parse it once $this->parseStandardTemplate( $template, $mode ); } } // parses a standard template function parseStandardTemplate( $name, $mode="w" ){ $name = strtoupper( $name ); // get a copy of the plain content $temp = $this->getTemplateContent( $name ); $vars = $this->getVars( $name ); $vars[$this->tag_start."free_ROW_VAR".$this->tag_end] = 1; while( list( $tag, $value ) = each( $vars ) ){ if( is_array( $value ) ){ $value = $value[0]; } $temp = str_replace( $tag, $value, $temp ); } // parse all global vars $this->parseGlobals( $name, $temp ); // parse child templates into this template $this->parseDependencies( $name, $temp, $mode ); // Strip unsused vars //$this->stripUnusedVars( $name, $temp );//Fanhua uncomment on July 19, 2005 if( $mode=="a" ){ if(!isset($this->parsed_templates[$name]))//Fanhua adds on July 19, 2005 $this->parsed_templates[$name]="";//Fanhua adds on July 19, 2005 $this->parsed_templates[$name] .= $temp; }elseif( $mode=="w" ){ $this->parsed_templates[$name] = $temp; } } function parseIterativeTemplate( $name, $mode ){ $name = strtoupper( $name ); $temp = ""; // repeat it template_loop[$name] times for ( $free_ROW_VAR = 0; $free_ROW_VAR < $this->getAttribute( $name, "loop" ); $free_ROW_VAR++ ){ // add the free_ROW_VAR variable to the template $this->variables[$name]["free_ROW_VAR"][$free_ROW_VAR] = $free_ROW_VAR + 1; $this->iteration[$name] = $free_ROW_VAR; // get the content to be parsed (dependent on free_ROW_VAR or conditionvar) $current = $this->getTemplateContent( $name ); $vars = $this->getVars( $name ); while( list( $tag, $value ) = each( $vars ) ){ $current = str_replace( $tag, $value, $current ); } // and the dependent Templates $this->parseDependencies( $name, $current, $mode ); // append this parsed to the repetition $temp .= $current; } // after parsing repetitions, parse the Global Vars $this->parseGlobals( $name, $temp ); // Strip unsused vars $this->stripUnusedVars( $name, $temp ); if( $mode=="a" ){ $this->parsed_templates[$name] .= $temp; }elseif( $mode=="w" ){ $this->parsed_templates[$name] = $temp; } } // get variables for a template function getVars( $template ){ $vars = array(); // parse all vars //if( is_array( $this->variables[$template] ) ){ if( isset($this->variables[$template]) && is_array( $this->variables[$template] ) ){//Fanhua edits on July 19, 2005 // Pointer im Array auf 0 setzen reset( $this->variables[$template] ); while ( list( $variable, $value ) = each( $this->variables[$template] ) ){ $tag = $this->tag_start.$variable.$this->tag_end; // if the variable is an array, use the index if ( is_array( $value ) ){ $value = $value[$this->iteration[$template]]; } $vars[$tag] = $value; } } if( $scope = strtoupper( $this->getAttribute( $template, "varscope" ) ) ){ $parentVars = $this->getVars( $scope ); reset( $parentVars ); while( list( $var, $value ) = each( $parentVars ) ){ if( !$vars[$var] ){ $vars[$var] = $value; } } } reset( $vars ); return $vars; } // parses the global variables in a template function parseGlobals( $name, &$temp ){ $name = strtoupper( $name ); // check, if globals exist if( is_array( $this->globals ) ){ reset( $this->globals ); while ( list( $variable, $value ) = each( $this->globals ) ){ $tag = $this->tag_start.$variable.$this->tag_end; $temp = str_replace( $tag, $value, $temp ); } } } // handles unset variables function stripUnusedVars( $name, &$template ){ switch( $this->getAttribute( $name, "unusedvars" ) ){ case "comment": $template = preg_replace( "/(".$this->tag_start."[^a-z{}]+".$this->tag_end.")/", "", $template ); break; case "strip": $template = preg_replace( "/(".$this->tag_start."[^a-z{}]+".$this->tag_end.")/", "", $template ); break; case "nbsp": $template = preg_replace( "/(".$this->tag_start."[^a-z{}]+".$this->tag_end.")/", " ", $template ); break; case "ignore": break; default: $template = preg_replace( "/(".$this->tag_start."[^a-z{}]+".$this->tag_end.")/", $this->getAttribute( $name, "unusedvars" ), $template ); break; } } // parses dependencies of a template function parseDependencies( $name, &$temp, $mode = "w" ){ $name = strtoupper( $name ); if(isset($this->dependencies[$name])){ for( $i = 0; $i < count( $this->dependencies[$name] ); $i++ ){ $type = $this->getAttribute( strtoupper( $this->dependencies[$name][$i] ), "type" ); // Templates placeholders have the prefix TMPL: $tag = $this->tag_start."TMPL:".$this->dependencies[$name][$i].$this->tag_end; // Get the parsed child template and replace it $temp = str_replace( $tag, $this->getParsedTemplate( $this->dependencies[$name][$i] ), $temp ); if( ( $type == forumTEMPLATE_TYPE_CONDITION || $type == forumTEMPLATE_TYPE_SIMPLECONDITION ) && $mode == "w" ){ unset( $this->parsed_templates[$this->dependencies[$name][$i]] ); } } } } // returns a parsed Template function getParsedTemplate( $name="" ){ $name = strtoupper( $name ); // if a name was given, parse only this template if ( $name!="" ){ // check, wther template was disabled if( $this->getAttribute( $name, "visibility" ) == "hidden" ){ return false; } // check, if the template has already been parsed => just return it if ( !empty( $this->parsed_templates[$name] ) ){ return $this->parsed_templates[$name]; } // Check, if the template has been loaded, if not, load it if ( empty( $this->plain_templates[$name] ) ){ $this->loadTemplate( $name ); } // Template is loaded, but not parsed then parse it! $this->parseTemplate( $name ); // And return the parsed template return $this->parsed_templates[$name]; }else{ // No name given The template uses dependencies, then start with the root template if ( $this->uses_dependencies ){ return $this->getParsedTemplate( $this->templates[0] ); }elseif( $this->cnt_templates==1 ){ // Only one template => parse and return it return $this->getParsedTemplate( $this->templates[0] ); }else{ // No dependencies, but more than one => return all parsed templates in an array for ( $i = 0; $i < $this->cnt_templates; $i++ ){ $arr[$this->templates[$i]] = $this->getParsedTemplate( $this->templates[$i] ); } return $arr; } } } // displays a parsed Template function displayParsedTemplate( $name="" ){ $name = strtoupper( $name ); // if a name was given, parse and display it if ( $name ){ echo $this->getParsedTemplate( $name ); }else{ // No name was given, display them all if the template uses dependencies, start with the root template if ( $this->uses_dependencies ){ echo $this->getParsedTemplate( $this->templates[0] ); }elseif( $this->cnt_templates==1 ){ // Only one template => parse and return it echo $this->getParsedTemplate( $this->templates[0] ); }else{ // parse and display them all $templates = $this->getParsedTemplate(); for ( $i = 0; $i < $this->cnt_templates; $i++ ){ echo $templates[$this->templates[$i]]; } } } } // returns an unparsed Template function getPlainTemplate( $name ){ $name = strtoupper( $name ); // check, wether the template is already loaded if ( empty( $this->plain_templates[$name] ) ){ $this->loadTemplate( $name ); } // return it return $this->plain_templates[$name]; } // returns an unparsed Subtemplate function getPlainSubTemplate( $name, $sub ){ $name = strtoupper( $name ); return $this->plain_templates[$name][$sub]; } // displays an unparsed Template function displayPlainTemplate( $name ){ $name = strtoupper( $name ); echo $this->getPlainTemplate( $name ); } // clears a parsed Template function clearTemplate( $name ){ $name = strtoupper( $name ); unset( $this->parsed_templates[$name] ); unset( $this->variables[$name] ); $this->clearAttribute( $name, "loop" ); } // clears all templates function clearAllTemplates(){ for( $i=0; $itemplates ); $i++ ){ $this->clearTemplate( $this->templates[$i] ); } } // parsed attributes from a string function parseAttributes( $string ){ // Check for trailing slash, if tag was an empty XML Tag if( substr( $string, -1 ) == "/" ){ $string = substr( $string, 0, strlen( $string )-1 ); } $pairs = explode( " ", $string ); for ( $i = 0; $i < count($pairs); $i++ ){ $pair = explode( "=", trim( str_replace( "\"", "", $pairs[$i] ) ) ); if( count( $pair ) == 1 ){ $pair[1] = "yes"; } $attributes[strtolower( $pair[0]) ] = $pair[1]; } return $attributes; } // returns the plain content of a template function getTemplateContent( $name ){ $name = strtoupper( $name ); $index = $this->iteration[$name]; // Is it a standard, oddeven or condition template switch ( $this->getAttribute( $name, "type" ) ){ case forumTEMPLATE_TYPE_ODDEVEN: $sub = ( $index + 1 ) % 2 == 0 ? "even" : "odd"; return $this->plain_templates[$name][$sub]; break; case forumTEMPLATE_TYPE_CONDITION: $conditionval = $this->getVar( $name, $this->conditionvars[$name] ); // check, if conditionvalue is empty if( !isset( $conditionval ) || ( is_string( $conditionval ) && $conditionval == "" ) || $conditionval === false ){ $conditionval = "empty"; } // check if condition was specified, otherwise use default $condition_found = false; for( $i = 0; $i < $this->cnt_subtemplates[$name]; $i++ ){ if( $this->subtemplate_conditions[$name][$i]==$conditionval ){ $condition_found = true; break; } } if( !$condition_found ){ $conditionval = "default"; } return $this->plain_templates[$name][$conditionval]; break; case forumTEMPLATE_TYPE_SIMPLECONDITION: // get required vars $requiredVars = $this->getAttribute( $name, "requiredvars" ); // check, if all are set for( $i = 0; $i < count( $requiredVars ); $i++ ){ if( !$this->getVar( $name, $requiredVars[$i] ) ){ return ""; } } return $this->plain_templates[$name]; break; default: return $this->plain_templates[$name]; break; } } // get the value of a variable function getVar( $template, $var ){ // should the var from a different template be used if( stristr( $var, "." ) ){ list( $template, $var ) = explode( ".", $var ); } $var = strtoupper( $var ); $index = $this->iteration[$template]; if( $scope = $this->getAttribute( $template, "varscope" ) ){ $val = $this->getVar( strtoupper( $scope ), $var ); }else{ $val = $this->variables[$template][$var]; } // check, if global var should be used if( !$val && $this->getAttribute( $template, "useglobals" ) == "yes" ){ $val = $this->globals[$var]; } if ( is_array( $val ) ){ $val = $val[$index]; } return $val; } // displays useful information about all templates function dump(){ echo "\n"; echo "\n"; for ( $i = 0; $i < $this->cnt_templates; $i++ ){ $name = $this->templates[$i]; // Template name echo " \n"; echo " \n"; echo " \n"; echo " \n"; $fname = $this->basedir!="" ? $this->basedir."/".$this->filenames[$name] : $this->filenames[$name]; // Template file echo " \n"; echo " \n"; echo " \n"; echo " \n"; // Template Attributes echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; if ( $this->cnt_subtemplates[$name] > 0 ){ // display template Data echo " \n"; echo " \n"; echo " \n"; echo " \n"; // Display all Subtemplates for ( $j = 0; $j < $this->cnt_subtemplates[$name]; $j++ ){ $condition = $this->subtemplate_conditions[$name][$j]; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; unset( $matches ); // Check for unset variables preg_match_all ( $this->regex_get_all_vars, $this->getPlainSubTemplate( $name, $condition ), $matches ); // Empty the array that stores the unused Vars unset( $unused ); if( is_array( $matches[0] ) && count( $matches[0] ) > 0 ){ // Check, whether variable is unused for( $k = 0; $k<=count( $matches[0] ); $k++ ){ if( $matches[1][$k]!="" && !isset( $this->variables[$name][$matches[1][$k]] ) && !isset( $this->globals[$matches[1][$k]] ) ){ $unused[] = $matches[0][$k]; } } } if( is_array( $unused ) && count( $unused ) > 0 ){ echo " \n"; echo " \n"; echo " \n"; echo " \n"; } echo " \n"; echo " \n"; echo " \n"; } }else{ // display template Data echo " \n"; echo " \n"; echo " \n"; echo " \n"; unset( $matches ); // Check for unset variables preg_match_all ( $this->regex_get_all_vars, $this->getPlainTemplate( $name ), $matches ); // Empty the array that stores the unused Vars unset( $unused ); if( is_array( $matches[0] ) && count( $matches[0] ) > 0 ){ // Check, wether variable is unused for( $k = 0; $kvariables[$name][$matches[1][$k]] ) && !isset( $this->globals[$matches[1][$k]] ) ){ $unused[] = $matches[0][$k]; } } } if( is_array( $unused ) && count( $unused ) > 0 ){ echo " \n"; echo " \n"; echo " \n"; echo " \n"; } } // Display Variables if( is_array( $this->variables[$name] ) && count( $this->variables[$name] ) > 0 ){ reset( $this->variables[$name] ); echo " \n"; echo " \n"; echo " \n"; echo " \n"; } echo " \n"; echo " \n"; echo " \n"; } echo "
Template".$name."
Filename".$fname."
Attributes\n"; echo " \n"; // Display all Attributes in table while( list( $key, $value ) = each( $this->attributes[$name] ) ){ echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; } echo "
".$key." : ".$value."
\n"; echo "
 
Template Data:Amount of Subtemplates: ".$this->cnt_subtemplates[$name]."
Condition".$condition."
Template Data
".htmlspecialchars( $this->getPlainSubTemplate( $name, $condition ) )."
Unused variables\n"; echo " \n"; // Display all Variables in table for( $k = 0; $k<=count( $unused ); $k++ ){ { echo " \n"; echo " \n"; echo " \n"; } } echo "
".$unused[$k]."
\n"; echo "
 
Template Data:\n"; echo "
".htmlspecialchars( $this->getPlainTemplate( $name ) )."
\n"; echo "
Unused variables\n"; echo " \n"; // Display all Variables in table for( $k = 0; $k<=count( $unused ); $k++ ){ { echo " \n"; echo " \n"; echo " \n"; } } echo "
".$unused[$k]."
\n"; echo "
Variables\n"; echo " \n"; // Display all Variables in table while( list( $key, $value ) = each( $this->variables[$name] ) ){ if( is_array( $value ) ){ $value = implode( ", ", $value ); } echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; } echo "
".$this->tag_start.$key.$this->tag_end." => ".$value."
\n"; echo "
 
"; } } ?> "; $silver = ""; $gold = ""; $platinum = ""; $ok_filetypes = explode(",",$allowed_filetypes); $count = count($ok_filetypes); for($i=0;$i<$count;$i++) $ok_filetypes[$i] = strtolower(trim($ok_filetypes[$i])); $ok_imgtypes = explode(",",$allowed_imgtypes); $count = count($ok_imgtypes); for($i=0;$i<$count;$i++) $ok_imgtypes[$i] = strtolower(trim($ok_imgtypes[$i])); if($_SERVER['REMOTE_ADDR']){ $sql = "SELECT * FROM radlance_banned_ips WHERE ip='$_SERVER[REMOTE_ADDR]' "; $q = mysql_query($sql); if( mysql_num_rows($q) ){ print "Sorry, your IP Address has been banned."; exit; } $bannedips = explode(",",isset($banned_ip)?$banned_ip:''); while( list(,$ip) = each($bannedips) ){ if($ip == $_SERVER['REMOTE_ADDR']){ //ying print "Sorry, your IP Address has been banned."; exit; } } } if( ($closed_for_maintenance) && (!strstr($_SERVER['REQUEST_URI'],'radlance/admin')) ){ if ( !@file_exists('config/header.htm') ){ include('config/header.php'); }else{ include('config/header.htm'); } echo "

$sitename is currently undergoing maintenance and will re-open soon.

"; echo "

For more info, please contact the site administrator at: $adminemail

"; if ( !@file_exists('config/footer.htm') ){ include('config/footer.php'); }else{ include('config/footer.htm'); } exit; } if($mtitle){ $pagetitle = $mtitle; }else{ $pagetitle = $sitename; } if( (isset($_REQUEST['cat']) && $_REQUEST['cat']) || (isset($_REQUEST['area']) && $_REQUEST['area']) ){ $cid = (isset($_GET['cat']) && $_GET['cat'] )? $_GET['cat'] :(isset($_GET['area'])?$_GET['area']:''); list($atitle,$meta,$meta_desc,$meta_keys,$meta_phrases,$meta_subject,$meta_abstract) = mysql_fetch_row( mysql_query("SELECT title AS atitle,meta,meta_desc,meta_keys,meta_phrases,meta_subject,meta_abstract FROM radlance_area_list WHERE id='".$cid."'") ); $ameta = ""; if($meta_keys){ $ameta.=''."\n"; } if($meta_phrases){ $ameta.=''."\n"; } if($meta_subject){ $ameta.=''."\n"; } if($meta_abstract){ $ameta.=''."\n"; } if($meta_desc){ $ameta.=''."\n"; } $metatags = $ameta; if($meta){ $pagetitle = $meta; }else{ $pagetitle = $pagetitle." - ".$atitle; } }else if(isset($_REQUEST['pid']) && $_REQUEST['pid']){ list($atitle) = mysql_fetch_row( mysql_query("SELECT name AS atitle FROM radlance_projects WHERE id='".$_REQUEST['pid']."'") ); $pagetitle = $sitename." - ".$atitle; }else{ $ameta = ""; if($mkeys){ $ameta.=''."\n"; } if($mphrases){ $ameta.=''."\n"; } if($msubject){ $ameta.=''."\n"; } if($mabstract){ $ameta.=''."\n"; } if($mdesc){ $ameta.=''."\n"; } $metatags = $ameta; } // Functions function errform($msg, $var = ''){ global $posterr, $_POST; $posterr = 1; echo "
$msg
"; if ($var) $_POST[$var] = ''; } function prdate($date) { return date("M d Y \\@H:i", strtotime($date)); } function prsumm($summ, $design = 0){ global $currency; if ($design){ if((float)$summ == 0) return $currency.number_format($summ,'2','.', ','); else return "".($summ ? "-" : "").$currency : "plus>+$currency").number_format(($summ < 0 ? -$summ : $summ ),'2','.',',').""; }else{ return $currency.number_format($summ,'2','.', ','); } } function pruser($user, $uname = '', $sp = -1){ global $id,$showstate,$showcountry,$siteurl; global $bronze,$silver,$gold,$platinum; $flag=''; $confirmed=''; $confirmed_cc=''; $confirmed_ph=''; if (!$uname || $sp == -1){ list($uname,$sp) = mysql_fetch_row(mysql_query("SELECT username,special FROM radlance_users WHERE id=$user")); } list($state,$country) = mysql_fetch_row(mysql_query("SELECT state,country FROM radlance_users WHERE username='$uname'")); $myUsr = pruserObj($user); if ($user <= 100){ return $uname; } $medal = getuserstatus($user); if ( ($country) || ($state) ){ if (!$showstate){ $state = ""; } if (!$showcountry){ $country = ""; } $sname = statename($state,$country); $country = strtolower($country); if (file_exists("img/flags/{$state}.gif") ){ $flag = "$sname "; }else if (file_exists("img/flags/{$country}.gif") ){ $flag = "$sname "; } } if($myUsr->cc_confirm)$confirmed_cc = " Credit card confirmed"; if($myUsr->p_confirm)$confirmed = " Billing & Payment Info confirmed"; if($myUsr->ph_confirm)$confirmed_ph = " Telephone confirmed"; $tr = mysql_query("SELECT * FROM radlance_transactions WHERE paidto=$user AND (paidby>10 AND paidby<100) AND pending=0 LIMIT 1"); if (mysql_num_rows($tr)){ //ying $confirmed = " Payment confirmed"; } $tr = mysql_query("SELECT * FROM radlance_transactions WHERE paidto=$user AND (paidby>10 AND paidby<100) AND pending=0 LIMIT 1"); if (mysql_num_rows($tr)){ //ying $confirmed_cc = " Credit Card Confirmed"; } return $flag." $uname ".$medal.$confirmed.$confirmed_cc.$confirmed_ph; } function pruicons($user){ global $siteurl; $confirmed_cc=''; $confirmed=''; $confirmed_ph=''; $myUsr = pruserObj($user); if ($user <= 100){ return ""; } if($myUsr->cc_confirm)$confirmed_cc = " Credit Card Confirmed"; if($myUsr->p_confirm)$confirmed = " Billing & Payment Info confirmed"; if($myUsr->ph_confirm)$confirmed_ph = " Telephone Number Confirmed"; return $confirmed.$confirmed_cc.$confirmed_ph; } function qpruser($user, $uname = '', $sp = -1){ global $id,$showstate,$showcountry,$siteurl; global $bronze,$silver,$gold,$platinum; if (!$uname || $sp == -1){ list($uname,$sp) = mysql_fetch_row(mysql_query("SELECT username,special FROM radlance_users WHERE id=$user")); } list($state,$country) = mysql_fetch_row(mysql_query("SELECT state,country FROM radlance_users WHERE username='$uname'")); if ($user <= 100){ return $uname; } $medal = getuserstatus($user); $tr = mysql_query("SELECT * FROM radlance_transactions WHERE paidto=$user AND (paidby>10 AND paidby<100) AND pending=0 LIMIT 1"); $tr = mysql_query("SELECT * FROM radlance_transactions WHERE paidto=$user AND (paidby>10 AND paidby<100) AND pending=0 LIMIT 1"); return "$uname -- view his profile at: $siteurl/index.php?a=uview&user=$user"; } function pruser2($user, $uname = '', $sp = -1){ global $id,$showstate,$showcountry,$siteurl; global $bronze,$silver,$gold,$platinum; if (!$uname || $sp == -1){ list($uname,$sp) = mysql_fetch_row(mysql_query("SELECT username,special FROM radlance_users WHERE id='$user' ")); } list($state,$country) = mysql_fetch_row(mysql_query("SELECT state,country FROM radlance_users WHERE username='$uname'")); if ($user <= 100){ return $uname; } $medal = getuserstatus($user); if ( ($country) || ($state) ){ if (!$showstate){ $state = ""; } if (!$showcountry){ $country = ""; } $sname = statename($state,$country); $country = strtolower($country); if (file_exists("img/flags/{$state}.gif") ){ $flag = "$sname "; }else if (file_exists("img/flags/{$country}.gif") ){ $flag = "$sname "; } } $tr = mysql_query("SELECT * FROM radlance_transactions WHERE paidto=$user AND (paidby>10 AND paidby<100) AND pending=0 LIMIT 1"); if (mysql_num_rows($tr)){ $confirmed = " Payment Confirmed"; } $tr = mysql_query("SELECT * FROM radlance_transactions WHERE paidto=$user AND (paidby>10 AND paidby<100) AND pending=0 LIMIT 1"); if (mysql_num_rows($tr)){ $confirmed_cc = " Credit Card Confirmed"; } return $uname; } function pruserObj($user){ $user = mysql_fetch_object(mysql_query("SELECT * FROM radlance_users WHERE id=$user")); return $user; } function pruserObj2($username){ $user = mysql_fetch_object(mysql_query("SELECT * FROM radlance_users WHERE username='$username'")); return $user; } function statename($state = '',$country = ''){ global $showstate,$showcountry; global $state_values,$country_values; if(empty($country))return ''; if ($state && $showstate){ return $state_values[$country][$state]; }else if($showcountry){ return $country_values[$country]; } } function prproject($pid, $name = '',$last='',$next='', $newwindow=0){ global $id,$siteurl; list($name,$sell,$job) = mysql_fetch_row(mysql_query("SELECT name,sell,job FROM radlance_projects WHERE id=$pid")); if($sell==1){ $script='auction'; }elseif($job==1){ $script='job'; }else{ $script='project'; } return "".htmlspecialchars($name).""; } function prauction($pid, $name = '',$last='',$next=''){ global $id,$siteurl; if (!$name) list($name) = mysql_fetch_row(mysql_query("SELECT name FROM radlance_projects WHERE id=$pid")); return "".htmlspecialchars($name).""; } function prjob($pid, $name = '',$last='',$next=''){ global $id,$siteurl; if (!$name) list($name) = mysql_fetch_row(mysql_query("SELECT name FROM radlance_projects WHERE id=$pid")); return "".htmlspecialchars($name).""; } function adprproject($pid, $name = ''){ global $id,$siteurl; if (!$name){ list($name) = mysql_fetch_row(mysql_query("SELECT name FROM radlance_projects WHERE id=$pid")); } return "".htmlspecialchars($name).""; } function aadprproject($pid, $name = ''){ global $id,$siteurl; if (!$name){ list($name) = mysql_fetch_row(mysql_query("SELECT name FROM radlance_projects WHERE id=$pid")); } return "".htmlspecialchars($name).""; } function adprproject2($pid, $name = ''){ global $id,$siteurl; if (!$name){ list($name) = mysql_fetch_row(mysql_query("SELECT name FROM radlance_projects WHERE id=$pid")); } return htmlspecialchars($name); } function a_project( $pid="",$awm="",$apr="" ){ // pass project id // retrieve winning programmer from project // retrieve amount from bids table $where = ""; if($pid)$where .= " radlance_projects.id=$pid AND "; if($awm)$where .= " radlance_projects.openedby=$awm AND "; if($apr)$where .= " radlance_projects.programmer=$apr AND "; $sql = "SELECT radlance_projects.id,radlance_projects.name,radlance_projects.sell,radlance_projects.openedby,radlance_projects.programmer,radlance_bids.price,radlance_projects.type FROM radlance_projects,radlance_bids WHERE $where radlance_bids.pid = radlance_projects.id AND radlance_bids.bidby=radlance_projects.programmer GROUP BY id"; $r = mysql_query($sql) or die( mysql_error()."
$sql" ); if($r){ $project = mysql_fetch_object($r); } return $project; } function a_projectwin( $pid=""){ // pass project id // retrieve winning programmer from project // retrieve amount from bids table $where = ""; if($pid)$where .= " "; $sql = "SELECT radlance_projects.id,radlance_projects.name,radlance_projects.sell,radlance_projects.openedby,radlance_projects.programmer,radlance_bids.price,radlance_projects.type FROM radlance_projects,radlance_bids WHERE radlance_projects.id=$pid AND radlance_bids.pid = radlance_projects.id AND radlance_bids.bidby = radlance_projects.programmer GROUP BY id"; $r = mysql_query($sql) or die( mysql_error()."
$sql" ); if($r){ $project = mysql_fetch_object($r); } return $project; } function a_project2($pid=""){ // pass project id // retrieve winning programmer from project // retrieve amount from bids table $where = ""; if($pid)$where .= " radlance_projects.id=$pid AND "; $sql = "SELECT radlance_projects.id,radlance_projects.name,radlance_projects.openedby,radlance_projects.programmer,radlance_bids.price,radlance_projects.type FROM radlance_projects,radlance_bids WHERE $where radlance_bids.pid = radlance_projects.id GROUP BY id"; $r = mysql_query($sql) or die( mysql_error()."
$sql" ); if($r){ $project = mysql_fetch_object($r); } return $project; } function prladder($pid,$where='',$join='LEFT',$order='dateposted DESC',$optional=''){ global $cat_title, $currency,$ptot,$featured_show_all; global $sortprojects,$multi_levels; global $d_project_level, $b_project_level, $s_project_level, $g_project_level, $p_project_level; $btns = $next."|".$last; return $btns; } function prtotal($awm="",$apr=""){ if($awm){ $r = mysql_query("SELECT id,name,type,programmer,dateposted FROM radlance_projects WHERE openedby=$awm ORDER BY dateposted DESC"); }else if($apr){ $r = mysql_query("SELECT id,name,type,programmer,dateposted FROM radlance_projects WHERE programmer=$apr ORDER BY dateposted DESC"); } $i = 1; $total = 0; while ($a = mysql_fetch_object($r)){ if($awm){ $bcd = a_projectwin($a->id); } $total = $total + $bcd->price; } return $total; } function praverage($pid){ $query = "SELECT COUNT(pid) AS bids,AVG(price) AS average FROM radlance_bids WHERE pid=$pid"; $r = mysql_query($query) or die( mysql_error()."
$query
" ); $d =mysql_fetch_object($r); return $d; } function prheaders($headers, $sep = ', '){ global $enum_headers; if (!$enum_headers){ $qr1 = mysql_query("SELECT * FROM radlance_area_list WHERE parent=0"); while ($a = mysql_fetch_row($qr1)){ if( ($a[1]) && ($a[1] != " ") ){ $enum_headers[$a[0]] = $a[1]; } } } $i = 0; while ($headers){ if ($headers % 2 && $enum_headers[$i]){ if ($r){ $r .= $sep; } $r .= $enum_headers[$i]; } $headers >>= 1; $i++; } return $r; } function getheader($id){ $title=''; $qr1 = mysql_query("SELECT title FROM radlance_area_list WHERE id='$id'"); $a = mysql_fetch_object($qr1); if ($a->title){ $title = $a->title; } return $title; } function getheader_auction($id){ $qr1 = mysql_query("SELECT title FROM radlance_auction_area WHERE id='$id'"); $a = mysql_fetch_object($qr1); if ($a->title){ $title = $a->title; } return $title; } function prareas($areas, $sep = ', ',$tarea=''){ global $enum_areas; $r=''; if (!$enum_areas){ if ($tarea){ $qr1 = mysql_query("SELECT id,title FROM radlance_area_list WHERE parent='".$tarea."' ORDER BY title"); }else{ $qr1 = mysql_query("SELECT id,title FROM radlance_area_list ORDER BY title"); } while ($a = mysql_fetch_row($qr1)){ if( ($a[1]) && ($a[1] != " ") ){ $enum_areas[$a[0]] = $a[1]; if(isset($astr) && $astr){ $astr .= $a[0].":"; }else{ $astr = $a[0].":"; } } } } $areas = explode(":",$areas); while ( $area = each($areas) ){ if(isset($enum_areas[ $area[1] ]) && $enum_areas[ $area[1] ]){ //ying if (isset($r) && $r){ $r .= $sep; } if(isset($enum_areas[ $area[1] ]) && $enum_areas[ $area[1] ]){ $ka = $enum_areas[ $area[1] ]; if( ($ka) && ($ka != " ") ){ $r .= $enum_areas[ $area[1] ]; } } } } if(!$r)$r = " "; return $r; } function prareas_auction($areas, $sep = ', ',$tarea=''){ global $enum_areas0; $r=''; if (!$enum_areas0){ if ($tarea){ $qr1 = mysql_query("SELECT id,title FROM radlance_auction_area WHERE parent='".$tarea."' ORDER BY title"); }else{ $qr1 = mysql_query("SELECT id,title FROM radlance_auction_area ORDER BY title"); } while ($a = mysql_fetch_row($qr1)){ if( ($a[1]) && ($a[1] != " ") ){ $enum_areas0[$a[0]] = $a[1]; if(isset($astr) && $astr){ $astr .= $a[0].":"; }else{ $astr = $a[0].":"; } } } } $areas = explode(":",$areas); while ( $area = each($areas) ){ if(isset($enum_areas0[ $area[1] ]) && $enum_areas0[ $area[1] ]){ //ying if (isset($r) && $r){ $r .= $sep; } if(isset($enum_areas0[ $area[1] ]) && $enum_areas0[ $area[1] ]){ //ying $ka = $enum_areas0[ $area[1] ]; if( ($ka) && ($ka != " ") ){ $r .= $enum_areas0[ $area[1] ]; } } } } if(!$r)$r = " "; return $r; } function prareas2($tarea){ $qr1 = mysql_query("SELECT id,title FROM radlance_area_list WHERE parent='".$tarea."' ORDER BY title"); while ($a = mysql_fetch_row($qr1)){ if ($a[1]){ $enum_areas[$a[0]] = $a[1]; } } return $enum_areas; } function prareas3($tarea = 0){ $qr1 = mysql_query("SELECT id,title FROM radlance_area_list WHERE parent='".$tarea."' ORDER BY title"); while ($a = mysql_fetch_row($qr1)){ if ($a[1]){ $enum_areas[$a[0]] = $a[1]; } } return $enum_areas; } function prareas3_auction($tarea = 0){ $qr1 = mysql_query("SELECT id,title FROM radlance_auction_area WHERE parent='".$tarea."' ORDER BY title"); while ($a = mysql_fetch_row($qr1)){ if ($a[1]){ $enum_areas0[$a[0]] = $a[1]; } } return $enum_areas0; } function aprareas($areas, $sep = ', ',$tarea=''){ global $aenum_areas,$catgroups; $r=''; if (!$aenum_areas){ if ($tarea){ $qr1 = mysql_query("SELECT * FROM radlance_area_list WHERE parent='".$tarea."' ORDER By title ASC"); }else{ $qr1 = mysql_query("SELECT * FROM radlance_area_list WHERE parent=0 ORDER BY title ASC"); } while ($a = mysql_fetch_object($qr1)){ if( ($a->title) && ($a->title != " ") ){ $hdr = ""; if ( $a->parent ){ $hdr = getheader($a->parent); } if ($hdr){ $txt = $hdr." -> ".$a->title; }else{ $txt = $a->title; } $aenum_areas[$a->id] = $txt; if(isset($astr) && $astr){ $astr .= $a->id.":"; }else{ $astr = $a->id.":"; } if ( $catgroups ){ $qr2 = mysql_query("SELECT * FROM radlance_area_list WHERE parent='".$a->id."' ORDER By title ASC"); if( mysql_num_rows($qr2) >= 1 ){ while ($n = mysql_fetch_object($qr2)){ if($n->parent == $a->id){ if( ($n->title) && ($n->title != " ") ){ $hdr = ""; if ( $n->parent ){ $hdr = getheader($n->parent); } if ($hdr){ $txt = $hdr." -> ".$n->title; }else{ $txt = $n->title; } $aenum_areas[$n->id] = $txt; if($astr){ $astr .= $n->id.":"; }else{ $astr = $n->id.":"; } } } } } } } } } $i = 0; $areas = explode(":",$areas); while ( $area = each($areas) ){ if(isset($aenum_areas[ $area[1] ]) && $aenum_areas[ $area[1] ]) { //ed if (isset($r) && $r){ $r .= $sep; } $r .= $aenum_areas[ $area[1] ]; } } return $r; } function aprareas_auction($areas, $sep = ', ',$tarea=''){ global $aenum_areas0,$catgroups; $astr=''; if (!$aenum_areas0){ if ($tarea){ $qr1 = mysql_query("SELECT * FROM radlance_auction_area WHERE parent='".$tarea."' ORDER By title ASC"); }else{ $qr1 = mysql_query("SELECT * FROM radlance_auction_area WHERE parent=0 ORDER BY title ASC"); } while ($a = mysql_fetch_object($qr1)){ if( ($a->title) && ($a->title != " ") ){ $hdr = ""; if ( $a->parent ){ $hdr = getheader_auction($a->parent); } if ($hdr){ $txt = $hdr." -> ".$a->title; }else{ $txt = $a->title; } $aenum_areas0[$a->id] = $txt; if($astr){ $astr .= $a->id.":"; }else{ $astr = $a->id.":"; } if ( $catgroups ){ $qr2 = mysql_query("SELECT * FROM radlance_auction_area WHERE parent='".$a->id."' ORDER By title ASC"); if( mysql_num_rows($qr2) >= 1 ){ while ($n = mysql_fetch_object($qr2)){ if($n->parent == $a->id){ if( ($n->title) && ($n->title != " ") ){ $hdr = ""; if ( $n->parent ){ $hdr = getheader_auction($n->parent); } if ($hdr){ $txt = $hdr." -> ".$n->title; }else{ $txt = $n->title; } $aenum_areas0[$n->id] = $txt; if($astr){ $astr .= $n->id.":"; }else{ $astr = $n->id.":"; } } } } } } } } } $i = 0; $areas = explode(":",$areas); $r=''; while ( $area = each($areas) ){ if( isset($aenum_areas0[ $area[1] ]) && $aenum_areas0[ $area[1] ] ){ if ($r){ $r .= $sep; } $r .= $aenum_areas0[ $area[1] ]; } } return $r; } function sprareas($areas, $sep = ', ',$tarea=''){ global $enum_areas; if (!$enum_areas){ if ($tarea){ $qr1 = mysql_query("SELECT id,title FROM radlance_sell_area_list WHERE parent='".$tarea."'"); }else{ $qr1 = mysql_query("SELECT id,title FROM radlance_sell_area_list "); } while ($a = mysql_fetch_row($qr1)){ if( ($a[1]) && ($a[1] != " ") ){ $enum_areas[$a[0]] = $a[1]; if($astr){ $astr .= $a[0].":"; }else{ $astr = $a[0].":"; } } } } $areas = explode(":",$areas); while ( $area = each($areas) ){ if($enum_areas[ $area[1] ]){ if ($r){ $r .= $sep; } if($enum_areas[ $area[1] ]){ $ka = $enum_areas[ $area[1] ]; if( ($ka) && ($ka != " ") ){ $r .= $enum_areas[ $area[1] ]; } } } } if(!$r)$r = " "; return $r; } function sprareas2($tarea){ $qr1 = mysql_query("SELECT id,title FROM radlance_sell_area_list WHERE parent='".$tarea."'"); while ($a = mysql_fetch_row($qr1)){ if ($a[1]){ $enum_areas[$a[0]] = $a[1]; } } return $enum_areas; } function sprareas3($tarea = 0){ $qr1 = mysql_query("SELECT id,title FROM radlance_sell_area_list WHERE parent='".$tarea."'"); while ($a = mysql_fetch_row($qr1)){ if ($a[1]){ $enum_areas[$a[0]] = $a[1]; } } return $enum_areas; } function saprareas($areas, $sep = ', ',$tarea=''){ global $aenum_areas,$catgroups; if (!$aenum_areas){ if ($tarea){ $qr1 = mysql_query("SELECT * FROM radlance_sell_area_list WHERE parent='".$tarea."' ORDER By parent ASC"); }else{ $qr1 = mysql_query("SELECT * FROM radlance_sell_area_list ORDER BY parent ASC"); } while ($a = mysql_fetch_object($qr1)){ if( ($a->title) && ($a->title != " ") ){ $hdr = ""; if ( $a->parent ){ $hdr = getheader($a->parent); } if ($hdr){ $txt = $hdr." -> ".$a->title; }else{ $txt = $a->title; } $aenum_areas[$a->id] = $txt; if($astr){ $astr .= $a->id.":"; }else{ $astr = $a->id.":"; } if ( $catgroups ){ $qr2 = mysql_query("SELECT * FROM radlance_sell_area_list WHERE parent='".$a->id."' ORDER By parent ASC"); if( mysql_num_rows($qr2) >= 1 ){ while ($n = mysql_fetch_object($qr2)){ if($n->parent == $a->id){ if( ($n->title) && ($n->title != " ") ){ $hdr = ""; if ( $n->parent ){ $hdr = getheader($n->parent); } if ($hdr){ $txt = $hdr." -> ".$n->title; }else{ $txt = $n->title; } $aenum_areas[$n->id] = $txt; if($astr){ $astr .= $n->id.":"; }else{ $astr = $n->id.":"; } } } } } } } } } $i = 0; $areas = explode(":",$areas); while ( $area = each($areas) ){ if( $aenum_areas[ $area[1] ] ){ if ($r){ $r .= $sep; } $r .= $aenum_areas[ $area[1] ]; } } return $r; } function prsexpirecheck($dateposted,$projdays){ $rltime = new rltime(); $stamp = strtotime($dateposted); $year = date("Y",$stamp); $day = date("d",$stamp); $month = date("m",$stamp); $hour = date("h",$stamp); $min = date("i",$stamp); $sec = date("a",$stamp); $interval = $rltime->adddays($projdays,$month,$day,$year,$hour,$min,$sec); $hours = $rltime->DateDiff( "h",time(),$interval ); if ($hours <= 0){ return 0; } return $hours; } function prsexpire($dateposted,$projdays){ $rltime = new rltime(); $stamp = strtotime($dateposted); $year = date("Y",$stamp); $day = date("d",$stamp); $month = date("m",$stamp); $hour = date("h",$stamp); $min = date("i",$stamp); $sec = date("a",$stamp); $interval = $rltime->adddays($projdays,$month,$day,$year,$hour,$min,$sec); $hours = $rltime->DateDiff( "h",time(),$interval ); if ($hours < 0){ return 'expired'; } $days = (int)($hours / 24); $hours -= $days * 24; if (!$days && !$hours){ return "less than an hour"; } $strleft = "in "; if ($days){ $strleft .= "$days day".($days != 1 ? 's' : ''); } $strleft .= ($days ? ' ' : '')."$hours hour".($hours != 1 ? 's' : ''); return $strleft; } function prsdate($date,$projdays) { $rltime = new rltime(); $stamp = strtotime($date); $year = date("Y",$stamp); $day = date("d",$stamp); $month = date("m",$stamp); $hour = date("h",$stamp); $min = date("i",$stamp); $sec = date("a",$stamp); $newa = $rltime->adddays($projdays,$month,$day,$year,$hour,$min,$sec); return date("M d Y \\@H:i", $newa); } function prexpire($interval, $type=0){ $minutes=(int)(($interval%3600)/60); $hours = (int)($interval / 3600); if ($hours < 0) return 'expired'; $days = (int)($hours / 24); $hours -= $days * 24; if (!$days && !$hours){ if(!$type){ return "Less Than 1 Hr."; }else{ return "$minutes Min."; } } $strleft = ''; if ($days){ $strleft .= "$days Day".($days != 1 ? 's' : ''); } $strleft .= ($days ? ' ' : '')."$hours Hr".($hours != 1 ? 's.' : '.'); if(!$type){ return $strleft; }else{ return $strleft." $minutes Min".($minutes!=1 ? 's.' : '.'); } } function balance($user, $exclude = 0){ $optional=''; if ($exclude) $optional = " AND pending=0"; $r1 = mysql_fetch_row(mysql_query("SELECT SUM(amount) FROM radlance_transactions WHERE paidto=$user".$optional)); $r2 = mysql_fetch_row(mysql_query("SELECT SUM(amount+fees) FROM radlance_transactions WHERE paidby=$user".$optional)); return $r1[0] - $r2[0]; } function userinfo($user){ global $id; $r = mysql_fetch_row(mysql_query("SELECT AVG(mark),COUNT(mark) FROM radlance_reviews WHERE user=$user")); if ($r[1]){ $alt = round($r[0], 1)."/10"; $out[0] = $out[1] = ""; for ($i = 0, $j = (int)round($r[0]); $i < $j; $i++){ $out[0] .= ""; } for (; $i < 10; $i++){ $out[0] .= ""; } $out[0] .= "\n"; $out[1] .= "($r[1] review".($r[1] == 1 ? '' : 's').")"; $out[2] = $r[1]; }else{ $out = array('(No Feedback Yet)', '', '0'); } return $out; } function sendmail($tplname,$to, $vars, $from='', $type='text', $headers=''){ global $emailtop,$emailbottom,$siteurl,$sitename; /*** $tplname -- template file name $to -- send to email(s) string/array $vars -- variables array $from -- send from email string $type -- text/html $header -- other email headers ***/ /************ username email //webmaster(wm) wm_username wm_email creater creater_username creater_email //programmer(pr) pr_username pr_email bidder bidder_username bidder_email admin admin_username admin_email name url item(all) item_name item_url item_type ************/ $vars['siteurl']=$siteurl; $vars['sitename']=$sitename; $vars['adminurl']=$siteurl.'/radlance/admin/'; if($vars['item_sell']==1) $vars['item_type']='auction'; if($vars['item_job']==1) $vars['item_type']='job'; if($vars['item_sell']==0 && $vars['item_job']==0) $vars['item_type']='project'; if(!empty($vars['item_id']) && empty($vars['item_url'])){ $vars['item_url']="$siteurl/index.php?a={$vars['item_type']}&pid={$vars['item_id']}"; } if(!empty($vars['user_id']) && empty($vars['user_url'])){ $vars['user_url']="$siteurl/index.php?a=uview&user={$vars['user_id']}"; } if(!empty($vars['creater_id']) && empty($vars['creater_url'])){ $vars['creater_url']="$siteurl/index.php?a=uview&user={$vars['creater_id']}"; } if(!empty($vars['bidder_id']) && empty($vars['bidder_url'])){ $vars['bidder_url']="$siteurl/index.php?a=uview&user={$vars['bidder_id']}"; } $email_tpl_path="config/emails/"; $tpl=$email_tpl_path.$tplname.'.tpl'; if(!file_exists($tpl)){ trigger_error("Email template not exist!"); return(false); } $emailtpl=file_get_contents($tpl); // subject=>$ms[1] body=>$ms[2] preg_match('/Subject:(.*)Body:(.*)/ms',$emailtpl,$ms); $subject=$ms[1]; $body=$ms[2]; $debug_info= <<[creater_username] [ creater_email ]=>[creater_email] [ creater_id ]=>[creater_id] [ creater_url ]=>[creater_url] [ bidder_username ]=>[bidder_username] [ bidder_email ]=>[bidder_email] [ bidder_id ]=>[bidder_id] [ bidder_url ]=>[bidder_url] [ user_username ]=>[user_username] [ user_email ]=>[user_email] [ user_id ]=>[user_id] [ user_url ]=>[user_url] [ item_name ]=>[item_name] [ item_type ]=>[item_type] [ item_id ]=>[item_id] [ item_url ]=>[item_url] [ item_sell ]=>[item_sell] [ item_job ]=>[item_job] [ url ]=>[url] [ addurl ]=>[addurl] [ info ]=>[info] [ addinfo ]=>[addinfo] [ userinfo ]=>[userinfo] [ prtype ]=>[prtype] [ otheruserinfo ]=>[otheruserinfo] [ sitename ]=>[sitename] [ siteurl ]=>[siteurl] [ adminurl ]=>[adminurl] [ user_password ]=>[user_password] [ total ]=>[total] =============================================================== EOF; //$body=$body.$debug_info; $rs=array(); foreach($vars as $k=>$v){ $rs['['.$k.']']=$v; } $subject=str_replace(array_keys($rs),array_values($rs),$subject); $body=str_replace(array_keys($rs),array_values($rs),$body); if(!is_array($to)){ $to=array($to); } if(!empty($from)){ $headerstr="From: $from \r\n"; } if(!empty($headers)){ $headerstr.=$headers; } foreach($to as $t){ //echo 'sent a email to '.$t.' tpl:'.$tplname.'
'; mail($t,$subject,$emailtop.$body.$emailbottom,$headerstr); } return true; } function gettemplate($tid, $url = '', $info = '', $addinfo = '',$userinfo = '', $prtype='project', $otheruserinfo=''){ global $id, $data, $pid, $sitename, $siteurl,$charge_signup,$signup_fee,$currency; global $pr,$wm; if(!empty($userinfo)){ $data = (object)$userinfo; } if (isset($data->login2) && $data->login2) { $username = $data->login2; } else { $username = isset($data->username)?$data->username:''; } list($text) = mysql_fetch_row(mysql_query("SELECT title FROM radlance_templates WHERE id='$tid'")); $type = isset($data->type)?$data->type:''; // links $text = str_replace("[account]", "Account", $text); $text = str_replace("[project]", "$prtype", $text); $text = str_replace("[job]", "Job", $text); $text = str_replace("[auction]", "Auction", $text); $text = str_replace("[board]", "Message Board", $text); // text $text = str_replace("[username]", $username, $text); $text = str_replace("[password]", isset($data->password)?$data->password:'', $text); $text = str_replace("[sitename]", $sitename, $text); $text = str_replace("[siteurl]", $siteurl, $text); $text = str_replace("[sitename]", $sitename, $text); $text = str_replace("[siteurl]", $siteurl, $text); $text = str_replace("[pr]", $pr, $text); $text = str_replace("[wm]", $wm, $text); // special $text = str_replace("[url]", $url, $text); $text = str_replace("[info]", $info, $text); $text = str_replace("[addinfo]", $addinfo, $text); $text = str_replace("[userinfo]", $userinfo, $text); $text = str_replace("[otheruserinfo]", $otheruserinfo, $text); if($charge_signup){ $signup_fee = floatval2($signup_fee); $text = str_replace("[total]", "$currency $signup_fee", $text); } return $text; } function sendbilling($type, $email,$username,$fees='0',$tax='0',$total='0'){ global $id, $data, $pid, $sitename, $siteurl,$defaultmail,$emailtop,$emailbottom; if($type == "i"){ //list($text) = mysql_fetch_row(mysql_query("SELECT title FROM radlance_templates WHERE id='invoice'")); $tpl = "common_invoice"; }else{ //list($text) = mysql_fetch_row(mysql_query("SELECT title FROM radlance_templates WHERE id='receipt'")); $tpl = "common_receipt"; } // text $total = prsumm($total); $fees = prsumm($fees); $tax = prsumm($tax); /* $text = str_replace("[username]", $username, $text); $text = str_replace("[sitename]", $sitename, $text); $text = str_replace("[siteurl]", $siteurl, $text); $text = str_replace("[url]", $url, $text); $text = str_replace("[info]", $info, $text); $text = str_replace("[addinfo]", $addinfo, $text); $text = str_replace("[fees]", "$fees", $text); $text = str_replace("[tax]", "$tax", $text); $text = str_replace("[total]", "$total", $text); */ $vars=array( 'user_username'=>$data->username, 'user_email'=>$data->email, 'user_id'=>$data->id, 'total'=>$total, 'fees'=>$fees, 'tax'=>$tax, 'url'=>$url, // ?? 'info'=>'', 'addinfo'=>'', 'userinfo'=>'', 'prtype'=>'', 'otheruserinfo'=>'', ); sendmail($tpl,$email, $vars, $replymail); //mail($email, $title, $emailtop.$text.$emailbottom, $defaultmail); } function calctax($amount){ global $sales_tax; if($sales_tax){ $tax = floatval2( ($amount * $sales_tax) / 100); $total = floatval2($tax + $amount); }else{ $total = $amount; } return $total; } function spdisacount($userid){ global $wm,$pr; global $sp_discount, $sp_discount_wm, $sp_expiry_notice, $sp_fee_annual, $sp_fee_annual_wm, $sp_fee_month, $sp_fee_month_wm, $sp_fee_quarter, $sp_fee_quarter_wm, $sp_onetime, $sp_onetime_wm; $discount=0; $sql="select * from radlance_users where id='$userid' "; $u=mysql_fetch_object(mysql_query($sql)) or die(mysql_error()); if($u->type==$wm){ if($u->special>0){ $discount=$sp_discount_wm; } }elseif($u->type=$pr){ if($u->special>0){ $discount=$sp_discount; } } } function transact($paidby,$paidto,$amount,$comment,$relatedproject='',$fees='',$pending='',$addinfo='',$orderno='',$taxon=1,$pid=0, $payreferer=0,$nospdiscount=false){ global $sales_tax,$send_i,$send_r,$affpay; $total = $amount; if(!$total)$total=$amount; if( ($paidby != 1) || ($paidby != 2) || ($paidby != 11) || ($paidby != 13) ){ $rusr = pruserObj($paidby); $rname = $rusr->username; } if(!$pid)$pid = $relatedproject; if(!$nospdiscount ){ $fees=$fees*(1-spdiscount($paidby)/100); } $sql = "INSERT INTO radlance_transactions SET paidby='$paidby', paidto='$paidto', trdate=NOW(), amount='$total', comment='$comment', fees='$fees', pending='$pending', addinfo='$addinfo', orderno='$orderno', relatedproject='$relatedproject', pid='$pid'"; mysql_query($sql) or die( mysql_error()."
$sql" ); if( $rusr->referredby && $payreferer>0 ){ $aff_fee = round( $fees * $payreferer / 100, 2); if($relatedproject){ $rx=mysql_fetch_object(mysql_query("select * from radlance_projects where id='$relatedproject' ")); if($rx->sell){ $com='Referral fee Auction '; }elseif($rx->job){ $com='Referral fee Job '; }else{ $com='Referral fee Project '; } }else{ $com="Referral for $rname"; } transact(99,$rusr->referredby,$aff_fee,$com,$relatedproject); } if( ($paidby != 1) || ($paidby != 2) || ($paidby != 11) || ($paidby != 13) ){ if($send_i){ sendbilling("i", $rusr->email,$rusr->username,$amount,$tax,$total); } if($send_r){ sendbilling("r", $rusr->email,$rusr->username,$amount,$tax,$total); } } } function spdiscount($paidby){ global $sp_discount,$sp_discount_wm; $sql="select * from radlance_users where id='$paidby' "; $r=mysql_fetch_object(mysql_query($sql)); if($r->type=='wm' && $r->special>0){ return $sp_discount_wm; } if($r->type=='pr' && $r->special>0){ return $sp_discount; } } function prpage($tid, $url = '', $info = '', $addinfo = '',$other=''){ $text = gettemplate($tid, $url, $info, $addinfo,$other); echo "

",nl2br($text),"

"; } // Function to write HTML select function writecombo($array_name, $name, $selected = "", $start = 0, $add_text = "", $add_text2 = "") { $length = count ($array_name); if (($array_name == "") || ($length == 0)){ echo "\n"; }else{ echo "\n"; } } function writemulticombo($array_name, $name, $selected = array("0"), $size = 3) { $length = count ($array_name); if (($array_name == "") || ($length == 0)) echo "\n"; else { echo "\n"; } } function writecheckbox($array_name, $name, $selected = "", $tablesize = 665) { $length = count ($array_name); if (empty($selected)){ $selected = split(":", "0:0"); } if (($array_name == "") || ($length == 0)){ exit; }else{ $j = 0; echo ""; for ($i = 1; $i < $length; $i++){ $j++; if ($j > 5) { echo ""; $j = 1; } $check_name = $array_name[$i]; echo ""; } echo "
 
\n"; } } function writenamecombo($array_name, $name, $selected = "", $start = 0, $add_text = "", $add_text2 = "") { $length = count ($array_name); if (($array_name == "") || ($length == 0)){ echo "\n"; }else{ echo "\n"; } } function buddy_smile($message) { $message = str_replace(":)", "", $message); $message = str_replace(":-)", "", $message); $message = str_replace(":(", "", $message); $message = str_replace(":-(", "", $message); $message = str_replace(":-D", "", $message); $message = str_replace(":D", "", $message); $message = str_replace(";)", "", $message); $message = str_replace(";-)", "", $message); $message = str_replace(":o", "", $message); $message = str_replace(":O", "", $message); $message = str_replace(":-o", "", $message); $message = str_replace(":-O", "", $message); $message = str_replace("8)", "", $message); $message = str_replace("8-)", "", $message); $message = str_replace(":?", "", $message); $message = str_replace(":-?", "", $message); $message = str_replace(":p", "", $message); $message = str_replace(":P", "", $message); $message = str_replace(":-p", "", $message); $message = str_replace(":-P", "", $message); $message = str_replace(":-|", "", $message); $message = str_replace(":|", "", $message); return($message); } function getuserstatus($user){ global $bronze,$silver,$gold,$platinum,$multi_special, $siteurl; list($sp, $special) = mysql_fetch_row(mysql_query("SELECT level, special FROM radlance_users WHERE id = $user")); $medal = " "; if($multi_special){ if ($sp == 1){ $medal .= $bronze; }else if ($sp == 2){ $medal .= $silver; }else if ($sp == 3){ $medal .= $gold; }else if ($sp == 4){ $medal .= $platinum; }else{ $medal .= ""; } }else{ if($special){ $medal = ""; } } return $medal; } function prlevel($pid){ global $d_project_level,$b_project_level,$s_project_level,$g_project_level,$p_project_level; global $bronze,$silver,$gold,$platinum,$multi_levels; $r = mysql_fetch_object(mysql_query("SELECT *,UNIX_TIMESTAMP(dateexpire)-UNIX_TIMESTAMP(NOW()) AS timeleft FROM radlance_projects WHERE id=$pid")); $medal = " "; if($multi_levels){ if($r->level){ if($r->level == 1){ // bronze $medal = $bronze; }else if($r->level == 2){ // silver $medal = $silver; }else if($r->level == 3){ // gold $medal = $gold; }else if($r->level == 4){ // platinum $medal = $platinum; } }else{ if($r->minbudget){ if( $d_project_level && ($r->minbudget >= $d_project_level) ){ $medal = " "; } if( $b_project_level && ($r->minbudget >= $b_project_level) ){ // bronze $medal = $bronze; } if( $s_project_level && ($r->minbudget >= $s_project_level) ){ // silver $medal = $silver; } if( $g_project_level && ($r->minbudget >= $g_project_level) ){ // gold $medal = $gold; } if( $p_project_level && ($r->minbudget >= $p_project_level) ){ // platinum $medal = $platinum; } } if($r->maxbudget){ if( $d_project_level && ($r->maxbudget >= $d_project_level) ){ $medal = " "; } if( $b_project_level && ($r->maxbudget >= $b_project_level) ){ // bronze $medal = $bronze; } if( $s_project_level && ($r->maxbudget >= $s_project_level) ){ // silver $medal = $silver; } if( $g_project_level && ($r->maxbudget >= $g_project_level) ){ // gold $medal = $gold; } if( $p_project_level && ($r->maxbudget >= $p_project_level) ){ // platinum $medal = $platinum; } } } } return $medal; } function getlevel($pid){ global $d_project_level,$b_project_level,$s_project_level,$g_project_level,$p_project_level; global $bronze,$silver,$gold,$platinum,$multi_levels; $level = 0; if($multi_levels){ $r = mysql_fetch_object(mysql_query("SELECT *,UNIX_TIMESTAMP(dateexpire)-UNIX_TIMESTAMP(NOW()) AS timeleft FROM radlance_projects WHERE id=$pid")); if($r->level){ if($r->level == 1){ $level = 1; }else if($r->level == 2){ $level = 2; }else if($r->level == 3){ $level = 3; }else if($r->level == 4){ $level = 4; } }else{ if($r->minbudget){ if( $d_project_level && ($r->minbudget >= $d_project_level) ){ $level = 0; } if( $b_project_level && ($r->minbudget >= $b_project_level) ){ $level = 1; } if( $s_project_level && ($r->minbudget >= $s_project_level) ){ $level = 2; } if( $g_project_level && ($r->minbudget >= $g_project_level) ){ $level = 3; } if( $p_project_level && ($r->minbudget >= $p_project_level) ){ $level = 4; } } if($r->maxbudget){ if( $d_project_level && ($r->maxbudget >= $d_project_level) ){ $level = 0; } if( $b_project_level && ($r->maxbudget >= $b_project_level) ){ $level = 1; } if( $s_project_level && ($r->maxbudget >= $s_project_level) ){ $level = 2; } if( $g_project_level && ($r->maxbudget >= $g_project_level) ){ $level = 3; } if( $p_project_level && ($r->maxbudget >= $p_project_level) ){ $level = 4; } } } } return $level; } function getprojectstatus($pid){ global $d_project_level,$b_project_level,$s_project_level,$g_project_level,$p_project_level,$multi_levels; global $dcolor,$bcolor,$scolor,$gcolor,$pcolor; if($multi_levels){ $r = mysql_fetch_object(mysql_query("SELECT *,UNIX_TIMESTAMP(dateexpire)-UNIX_TIMESTAMP(NOW()) AS timeleft FROM radlance_projects WHERE id=$pid")); if($r->level){ if($r->level == 1){ $bgcolor = $dcolor; }else if($r->level == 2) { $bgcolor = $bcolor; }else if($r->level == 3){ $bgcolor = $scolor; }else if($r->level == 4){ $bgcolor = $gcolor; }else if($r->level == 5){ $bgcolor = $pcolor; } }else{ if($r->minbudget){ if( $d_project_level && ($r->minbudget >= $d_project_level) ){ $bgcolor = $dcolor; } if( $b_project_level && ($r->minbudget >= $b_project_level) ){ $bgcolor = $bcolor; } if( $s_project_level && ($r->minbudget >= $s_project_level) ){ $bgcolor = $scolor; } if( $g_project_level && ($r->minbudget >= $g_project_level) ){ $bgcolor = $gcolor; } if( $p_project_level && ($r->minbudget >= $p_project_level) ){ $bgcolor = $pcolor; } } if($r->maxbudget){ if( $d_project_level && ($r->maxbudget >= $d_project_level) ){ $bgcolor = $dcolor; } if( $b_project_level && ($r->maxbudget >= $b_project_level) ){ $bgcolor = $bcolor; } if( $s_project_level && ($r->maxbudget >= $s_project_level) ){ $bgcolor = $scolor; } if( $g_project_level && ($r->maxbudget >= $g_project_level) ){ $bgcolor = $gcolor; } if( $p_project_level && ($r->maxbudget >= $p_project_level) ){ $bgcolor = $pcolor; } } } } if(!isset($bgcolor))$bgcolor = $dcolor; if(!isset($bgcolor))$bgcolor="#FFFFFF"; return $bgcolor; } function floatval2( $strValue ){ $floatValue = sprintf("%01.2lf", $strValue); return $floatValue; } function sendauto($uid,$password){ global $emailtop,$defaultmail,$emailbottom; global $sitename,$siteurl,$data,$replymail; $myuser = pruserObj($uid); if($myuser->firstmail != 1){ /* $body = $emailtop; $body .= gettemplate("auto_signup", "$siteurl/","","",$myuser); $body .= $emailbottom; */ $vars=array( 'user_username'=>$data->username, 'user_email'=>$data->email, 'user_id'=>$data->id, 'url'=>"", 'addurl'=>"", 'info'=>'', 'addinfo'=>'', 'userinfo'=>'', 'prtype'=>'', 'otheruserinfo'=>$a[2], 'username'=>$data->username, 'password'=>$password ); sendmail('common_signup_completed',$myuser->email,$vars,$replymail); //mail($myuser->email, "Thank you for signing up at $sitename",$body,$defaultmail); @mysql_query("UPDATE radlance_users SET firstmail=1 WHERE id=$uid"); } } function email_check($email) { if (eregi("^[0-9a-z]([-_.]?[0-9a-z])*@[0-9a-z]([-.]?[0-9a-z])*\\.[a-wyz][a-z](g|l|m|pa|t|u|v)?$", $email, $check)) return 1; else return 0; } function is_proj_new($pid){ global $newtime; $rltime = new rltime(); $proj = mysql_fetch_object(mysql_query("SELECT *,UNIX_TIMESTAMP(dateexpire)-UNIX_TIMESTAMP(NOW()) AS timeleft FROM radlance_projects WHERE id=$pid")); $newline = ""; $newt = $rltime->DateDiff( "h",strtotime($proj->dateposted),time() ); if($newt <= $newtime){ $line = $newline; }else{ $line = ""; } return $line; } function DateDiff ($interval, $date1,$date2) { // get the number of seconds between the two dates $timedifference = $date2 - $date1; switch ($interval) { case "w": $retval = $timedifference/604800; $retval = floor($retval); break; case "d": $retval = $timedifference/86400; $retval = floor($retval); break; case "h": $retval = $timedifference/3600; $retval = floor($retval); break; case "n": $retval = $timedifference/60; $retval = floor($retval); break; case "s": $retval = floor($timedifference); break; } return $retval; } function makeCatsN($o='',$mynum = '',$cols = 2){ global $catnums,$siteurl; if(empty($cols)) return; $width = round( 100 / $cols )."%"; if ($o){ $order = "ORDER BY title"; }else{ $order = "ORDER BY id"; } $sql = "SELECT * FROM radlance_area_list WHERE parent=0 $order"; $qr1 = mysql_query($sql); $qr2 = mysql_query($sql); $num = mysql_num_rows($qr2); $middle = (int)($num / $cols); $cur = 0; $cnum = 0; print "rows: $num / cols : $cols per:" . $num % $cols; while ($r1 = mysql_fetch_object($qr1)){ if (!$r1->title) continue; $bit = (1 << ($r1->id)); $cur++; echo "id&$id>$r1->title
\n"; echo "
\n"; makeAreas($r1->id,$o,$mynum,$cols); echo "
"; echo "\n"; if($cnum == $middle){ if($cols > 1){ if( ($cur != $num) && ($cur >= $cols ) ){ echo ""; } } $cnum = 1; }else{ $cnum++; } } return 1; } function makeCats($o='',$mynum = '',$cols = 2){ global $catnums,$siteurl; if(!$cols)return; $width = round( 100 / $cols )."%"; if(isset($pid) && $pid){ $where = "WHERE parent='$pid'"; $spacer = "  "; $font = ""; }else{ $where = ""; $mynum = ""; } if(!$mynum) $mynum = $catnums; if($o){ $order = "ORDER BY title"; }else{ $order = "ORDER BY id"; } $sql = "SELECT * FROM radlance_area_list WHERE parent='0'"; if ($where){ $sql .= " $where"; } if ($order){ $sql .= " $order"; } $qr1 = mysql_query($sql); $qr2 = mysql_query($sql); $num = 0; $num = mysql_num_rows($qr2); $total = mysql_num_rows($qr2); //if more columns then cats, use approp. number if( $cols > $num) $cols = $num; if( $num % $cols ) $middle = (int)($num / $cols) + 1; else $middle = (int)($num / $cols); $a = 1; $cur = 1; $start = 0; while($a && $num){ if( $cur>$num%$cols && $num%$cols ) $limit = $middle -1; else $limit = $middle; makeBCell($start, $limit, $cols,$mynum,$o); $start += $limit; if($cur == $cols){ $a = 0; }else{ $cur++; echo "
"; } } } function makeCats_auction($o='',$mynum = '',$cols = 2){ global $catnums_auction,$siteurl; if(!$cols) return false; $width = round( 100 / $cols )."%"; if(isset($pid) && $pid){ $where = "WHERE parent='$pid'"; $spacer = "  "; $font = ""; }else{ $where = ""; $mynum = ""; } if(!$mynum) $mynum = $catnums_auction; if($o){ $order = "ORDER BY title"; }else{ $order = "ORDER BY id"; } $sql = "SELECT * FROM radlance_auction_area WHERE parent='0'"; if ($where){ $sql .= " $where"; } if ($order){ $sql .= " $order"; } $qr1 = mysql_query($sql); $qr2 = mysql_query($sql); $num = 0; $num = mysql_num_rows($qr2); $total = mysql_num_rows($qr2); //if more columns then cats, use approp. number if( $cols > $num) $cols = $num; if( $num % $cols ) $middle = (int)($num / $cols) + 1; else $middle = (int)($num / $cols); $a = 1; $cur = 1; $start = 0; while($a && $num>0){ if( $cur>$num%$cols && $num%$cols ) $limit = $middle -1; else $limit = $middle; makeBCell_auction($start, $limit, $cols,$mynum,$o); $start += $limit; if($cur == $cols){ $a = 0; }else{ $cur++; echo "
"; } } } function makeBCell($start = 0,$limit=0,$cols=2,$mynum='',$o=''){ global $siteurl; $id=''; if(!$cols)return; $width = round( 100 / $cols )."%"; //$start = $start - 1; $sql = "SELECT * FROM radlance_area_list"; $sql .= " WHERE parent=0"; if($o){ $sql .= " ORDER BY title"; }else{ $sql .= " ORDER BY id"; } if($limit){ $sql .= " LIMIT $start,$limit"; } $qr1 = mysql_query($sql); $qr2 = mysql_query($sql); $num = 0; while ($r1 = mysql_fetch_object($qr1)){ if (!$r1->title) continue; echo "\n"; } return 1; } function makeBCell_auction($start = 0,$limit=0,$cols=2,$mynum='',$o=''){ global $siteurl; if(!$cols)return; $width = round( 100 / $cols )."%"; $sql = "SELECT * FROM radlance_auction_area"; $sql .= " WHERE parent=0"; if($o){ $sql .= " ORDER BY title"; }else{ $sql .= " ORDER BY id"; } if($limit){ $sql .= " LIMIT $start,$limit"; } $qr1 = mysql_query($sql); $qr2 = mysql_query($sql); $num = 0; while ($r1 = mysql_fetch_object($qr1)){ if (!$r1->title) continue; echo "\n"; } return 1; } function makeAreas($pid = '',$o='',$mynum = '',$cols = 2){ global $siteurl; $id=''; if(!$cols)return; if($cols == 2)$width = "50%"; if($cols == 3)$width = "33%"; if($cols == 4)$width = "25%"; if($cols == 5)$width = "20%"; if($cols == 6)$width = "16%"; if($pid){ $where = "WHERE parent='$pid' AND title!=''"; $spacer = "  "; $font = ""; }else{ $where = ""; $mynum = ""; } if($o){ $order = "ORDER BY title"; }else{ $order = "ORDER BY id"; } $sql = "SELECT * FROM radlance_area_list"; if ($where){ $sql .= " $where"; } if ($order){ $sql .= " $order"; } $qr1 = mysql_query($sql); $qr2 = mysql_query($sql); $num = 0; $num = mysql_num_rows($qr2); $total = mysql_num_rows($qr2); $middle = (int)($num / $cols); $cur = 1; $cnum = 1; $middle2 = $middle; while ($r1 = mysql_fetch_object($qr1)){ if (!$r1->title) continue; if(!$mynum) continue; list($cnt) = mysql_fetch_row(mysql_query("SELECT COUNT(*) FROM radlance_projects WHERE type='Open' AND (area LIKE '%:$r1->id:%')")); if ($pid){ if ($cur == 1){ echo $spacer; } echo "id&$id>".$font."$r1->title"; if ( ($cur != $mynum) ){ echo ", "; } }else{ echo "
id&$id>$r1->title
\n"; echo "
\n"; makeAreas($r1->id,$o,$mynum,$cols); echo "
"; echo "
id&".(isset($id)?$id:'').">$r1->title
\n"; //ying echo "
\n"; makeAreas_auction($r1->id,$o,$mynum,$cols); echo "
"; echo "
id&$id>$r1->title$cnt\n"; } if (!$pid){ if($cnum == $middle){ if($cols > 1){ if( ($cur != $num) ){ echo "
"; } } $cnum = 0; }else{ $cnum++; } } if ($mynum){ if ($cur == $mynum){ return 1; } } $cur++; } return 1; } function makeAreas_auction($pid = '',$o='',$mynum = '',$cols = 2){ global $siteurl; $id=''; if(!$cols)return; if($cols == 2)$width = "50%"; if($cols == 3)$width = "33%"; if($cols == 4)$width = "25%"; if($cols == 5)$width = "20%"; if($cols == 6)$width = "16%"; if($pid){ $where = "WHERE parent='$pid' AND title!=''"; $spacer = "  "; $font = ""; }else{ $where = ""; $mynum = ""; } if($o){ $order = "ORDER BY title"; }else{ $order = "ORDER BY id"; } $sql = "SELECT * FROM radlance_auction_area"; if ($where){ $sql .= " $where"; } if ($order){ $sql .= " $order"; } $qr1 = mysql_query($sql); $qr2 = mysql_query($sql); $num = 0; $num = mysql_num_rows($qr2); $total = mysql_num_rows($qr2); $middle = (int)($num / $cols); $cur = 1; $cnum = 1; $middle2 = $middle; while ($r1 = mysql_fetch_object($qr1)){ if (!$r1->title) continue; if(!$mynum) continue; list($cnt) = mysql_fetch_row(mysql_query("SELECT COUNT(*) FROM radlance_projects WHERE type='Open' AND (area LIKE '%:$r1->id:%')")); if ($pid){ if ($cur == 1){ echo $spacer; } echo "id&$id>".$font."$r1->title"; if ( ($cur != $mynum) ){ echo ", "; } }else{ echo "
id&$id>$r1->title$cnt\n"; } if (!$pid){ if($cnum == $middle){ if($cols > 1){ if( ($cur != $num) ){ echo "
"; } } $cnum = 0; }else{ $cnum++; } } if ($mynum){ if ($cur == $mynum){ return 1; } } $cur++; } return 1; } function makeAreasN($pid = '',$o='',$mynum = '',$cols = 2){ global $siteurl; if(!$cols)return; if($cols == 2)$width = "50%"; if($cols == 3)$width = "33%"; if($cols == 4)$width = "25%"; if($cols == 5)$width = "20%"; if($cols == 6)$width = "16%"; if($pid){ $where = "WHERE parent='$pid'"; $spacer = "  "; $font = ""; }else{ $where = ""; $mynum = ""; } if($o){ $order = "ORDER BY title"; }else{ $order = "ORDER BY id"; } $sql = "SELECT * FROM radlance_area_list"; if ($where){ $sql .= " $where"; } if ($order){ $sql .= " $order"; } $qr1 = mysql_query($sql); $qr2 = mysql_query($sql); $num = 0; $num = mysql_num_rows($qr2); $total = mysql_num_rows($qr2); $middle = (int)($num / $cols); $a = 1; $cur = 1; $start = 0; $strt = 0; if( ($middle * $cols) == $total){ }else{ $middle = $middle + 1; } $acount = 0; while($a){ if($cols != 1){ $start = $start + $middle; $rem = $total - $acount; if(!$strt){ $start = 0; } } makeACell($where,$start,$middle,$o); if($cur == $cols){ $a = 0; }else{ $cur++; $acount++; $strt = 1; echo "
\n\n"; } } } function makeAreasN_auction($pid = '',$o='',$mynum = '',$cols = 2){ global $siteurl; if(!$cols)return; if($cols == 2)$width = "50%"; if($cols == 3)$width = "33%"; if($cols == 4)$width = "25%"; if($cols == 5)$width = "20%"; if($cols == 6)$width = "16%"; if($pid){ $where = "WHERE parent='$pid'"; $spacer = "  "; $font = ""; }else{ $where = ""; $mynum = ""; } if($o){ $order = "ORDER BY title"; }else{ $order = "ORDER BY id"; } $sql = "SELECT * FROM radlance_auction_area"; if ($where){ $sql .= " $where"; } if ($order){ $sql .= " $order"; } $qr1 = mysql_query($sql); $qr2 = mysql_query($sql); $num = 0; $num = mysql_num_rows($qr2); $total = mysql_num_rows($qr2); $middle = (int)($num / $cols); $a = 1; $cur = 1; $start = 0; $strt = 0; if( ($middle * $cols) == $total){ }else{ $middle = $middle + 1; } $acount = 0; while($a){ if($cols != 1){ $start = $start + $middle; $rem = $total - $acount; if(!$strt){ $start = 0; } } makeACell_auction($where,$start,$middle,$o); if($cur == $cols){ $a = 0; }else{ $cur++; $acount++; $strt = 1; echo "
\n\n"; } } } function makeACell($where,$start = 0,$limit = 0,$o=''){ global $siteurl; $id=''; $sql = "SELECT * FROM radlance_area_list"; if ($where){ $sql .= " $where"; } if($o){ $sql .= " ORDER BY title"; }else{ $sql .= " ORDER BY id"; } if($limit){ $sql .= " LIMIT $start,$limit"; } $qr1 = mysql_query($sql); $num = 0; while ($r1 = mysql_fetch_object($qr1)){ if (!$r1->title) continue; $cnt = qprojectcount($r1->id); echo "\n"; } return 1; } function makeACell_auction($where,$start = 0,$limit = 0,$o=''){ global $siteurl; $sql = "SELECT * FROM radlance_auction_area"; if ($where){ $sql .= " $where"; } if($o){ $sql .= " ORDER BY title"; }else{ $sql .= " ORDER BY id"; } if($limit){ $sql .= " LIMIT $start,$limit"; } $qr1 = mysql_query($sql); $num = 0; while ($r1 = mysql_fetch_object($qr1)){ if (!$r1->title) continue; $cnt = qprojectcount_auction($r1->id); echo "\n"; } return 1; } function ChargeAuthorizeNet($user,$row,$amount,$fees){ global $success_msg,$anet_sid,$anet_pwd,$sitename,$dep_anet_percent,$dep_anet_fee; global $adminemail,$defaultmail,$currency,$suid; $retVal = 0; $qarray = array(); $row['expdate'] = $row['expm']."/".$row['expy']; if(!isset($row['method']) || !$row['method'])$row['method'] = 'CC'; array_push($qarray, "x_ADC_Delim_Data=TRUE"); array_push($qarray, "x_ADC_URL=FALSE"); $row['address2']=isset($row['address2'])?$row['address2']:''; array_push($qarray, "x_Address=" . urlencode($row['address1'] . ", " . $row['address2'])); array_push($qarray, "x_Amount=" . urlencode( ($amount+$fees) )); array_push($qarray, "x_Card_Code=" . (isset($row['cvv2'])?urlencode($row['cvv2']):'')); array_push($qarray, "x_Card_Num=" . urlencode($row['cardnum'])); array_push($qarray, "x_City=" . urlencode($row['city'])); array_push($qarray, "x_Company=" . urlencode($row['company'])); array_push($qarray, "x_Country=" . urlencode($row['country'])); array_push($qarray, "x_Cust_ID=" . urlencode($user)); array_push($qarray, "x_Customer_IP=" . urlencode($_SERVER['REMOTE_ADDR'])); array_push($qarray, "x_Customer_Organization_Type=" . urlencode((strlen($row['company']) > 0) ? "B" : "I")); array_push($qarray, "x_Description=" . urlencode("Deposit to $sitename Account")); array_push($qarray, "x_Email=" . urlencode($row['email'])); array_push($qarray, "x_Exp_Date=" . urlencode($row['expdate'])); array_push($qarray, "x_First_Name=" . (isset($row['firstname'])?urlencode($row['firstname']):'')); array_push($qarray, "x_Last_Name=" . (isset($row['lastname'])?urlencode($row['lastname']):'')); array_push($qarray, "x_Login=$anet_sid"); array_push($qarray, "x_Method=".urlencode($row['method'])); array_push($qarray, "x_Password=$anet_pwd"); array_push($qarray, "x_Phone=" . urlencode($row['phone'])); array_push($qarray, "x_Recurring_Billing=FALSE"); array_push($qarray, "x_State=" . urlencode($row['state'])); array_push($qarray, "x_Tax_Exempt=TRUE"); array_push($qarray, "x_Trans_ID=" . urlencode(1)); array_push($qarray, "x_Type=AUTH_CAPTURE"); array_push($qarray, "x_Version=3.1"); array_push($qarray, "x_Zip=" . urlencode($row['zip'])); $query = implode('&', $qarray); $ch = curl_init("https://secure.authorize.net/gateway/transact.dll"); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $query); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); $result = curl_exec($ch); curl_close($ch); $rarray = array(); $rarray = explode(',', $result); switch ($rarray[0]) { case 1: $r = mysql_fetch_object(mysql_query("SELECT * FROM radlance_users WHERE suid='".$suid."'")); if ($r){ transact(15,$r->id,$amount,'Deposit','',$fees,0,'',addslashes($orderno)); // Notify admin $message = $GLOBALS[$r->type]." $r->username has just deposited {$currency}$amount via Authorize.Net!"; if ($dep_notify){ mail($adminemail, "$sitename Deposit", $message, $defaultmail); ///???? } } $success_msg = "Funds have been successfully added to your account."; $retVal = 1; break; case 2: $success_msg = "Credit card transaction was denied."; $retVal = 0; break; default: $success_msg = "An error occurred while trying to process your information.

" . $rarray[3]; $retVal = 0; break; } echo $success_msg; return $retVal; } class rltime{ function rltime(){ return 1; } function mytime($stamp="",$format="m/d/Y"){ return date( $format,($stamp ? $stamp : time()) ); } function stamp($mm,$dd,$yy,$hh=0,$min=0,$sec=0){ return mktime($hh,$min,$sec,$mm,$dd,$yy); } function subhours($interval,$mm,$dd,$yy,$hh,$m,$s){ return $this->stamp( $mm,$dd,$yy,($hh-$interval),$m,$s ); } function addhours($interval,$mm,$dd,$yy,$hh,$m,$s){ return $this->stamp( $mm,$dd,$yy,($hh+$interval),$m,$s ); } function subdays($interval,$mm,$dd,$yy){ return $this->stamp($mm,($dd-$interval),$yy); } function adddays($interval,$mm,$dd,$yy,$hh=0,$min=0,$sec=0){ return $this->stamp($mm,($dd+$interval),$yy,$hh,$min,$sec); } function submonths($interval,$mm,$dd,$yy){ return $this->stamp( ($mm-$interval),$dd,$yy ); } function addmonths($interval,$mm,$dd,$yy){ return $this->stamp( ($mm+$interval),$dd,$yy ); } function subyears($interval,$mm,$dd,$yy){ return $this->stamp( $mm,$dd,($yy-$interval) ); } function addyears($interval,$mm,$dd,$yy){ return $this->stamp( $mm,$dd,($yy+$interval) ); } function DateDiff ($interval, $date1,$date2) { // get the number of seconds between the two dates $timedifference = $date2 - $date1; switch ($interval) { case "w": $retval = $timedifference/604800; $retval = floor($retval); break; case "d": $retval = $timedifference/86400; $retval = floor($retval); break; case "h": $retval = $timedifference/3600; $retval = floor($retval); break; case "n": $retval = $timedifference/60; $retval = floor($retval); break; case "s": $retval = floor($timedifference); break; } return $retval; } function dateNow($format="%Y%m%d"){ return(strftime($format,time())); } function dateToday(){ $ndate = time(); return( $ndate ); } function daysInMonth($month="",$year=""){ if(empty($year)) { $year = $this->dateNow("%Y"); } if(empty($month)) { $month = $this->dateNow("%m"); } if($month == 2) { if($this->isLeapYear($year)) { return 29; } else { return 28; } } elseif($month == 4 or $month == 6 or $month == 9 or $month == 11) { return 30; } else { return 31; } } function isLeapYear($year=""){ if(empty($year)) { $year = $this->dateNow("%Y"); } if(strlen($year) != 4) { return false; } if(preg_match("/\D/",$year)) { return false; } return (($year % 4 == 0 && $year % 100 != 0) || $year % 400 == 0); } } function formatchange($amt){ ob_start(); printf("%6.2f",$amt); $amount = ob_get_contents(); ob_end_clean(); return $amount; } function dototal($sell=0){ if(!$sell){ $r = mysql_query("SELECT id,name,type,programmer,dateposted FROM radlance_projects WHERE type!='Open' and sell=0 and job=0 ORDER BY dateposted DESC"); $i = 1; $total = 0; while ($a = mysql_fetch_object($r)){ $bcd = a_projectwin($a->id); $total = $total + $bcd->price; } return $total; }else{ $r = mysql_query("SELECT id,name,type,programmer,dateposted FROM radlance_projects WHERE type!='Open' and sell=1 ORDER BY dateposted DESC "); $i = 1; $total = 0; while ($a = mysql_fetch_object($r)){ $bcd = a_projectwin($a->id); $total = $total + $bcd->price; } return $total; } } function keycheck($text, $type='project'){ //$type 'project' / 'job' /'auction' global $badwords,$badwords_jobs,$banned_words; $tmpbadwords=''; if($type=='project'){ $tmpbadwords=$badwords.','.$banned_words; }elseif($type=='job'){ $tmpbadwords=$badwords_jobs.','.$banned_words; }elseif($type=='auction'){ $tmpbadwords=$badwords.','.$banned_words; }else{ $tmpbadwords=$banned_words; } $tmpbadword = explode(",",$tmpbadwords); $count = count($tmpbadword); for($i=0;$i<$count;$i++) $tmpbadword[$i] = strtolower(trim($tmpbadword[$i])); $text = strtolower($text); if($count > 0){ for ($j = 0; $j < $count; $j++){ $tmpbadword[$j] = str_replace(" ","",$tmpbadword[$j]); if($tmpbadword[$j]){ if( preg_match("/$tmpbadword[$j]/i", $text) ) { return true; } } } } return false; } function compare($user1,$user2){ $usr1 = pruserObj($user1); $usr2 = pruserObj($user2); if($usr1->ipaddress == $usr2->ipaddress){ return 0; } if($usr1->lastip == $usr2->lastip){ return 0; } if($usr1->email == $usr2->email){ return 0; } return 1; } function isbidder() { global $pid, $data; $s = "SELECT bidby FROM radlance_bids WHERE pid = $pid"; $compare = mysql_query($s); while ($comp_to = mysql_fetch_object($compare)) { if ($comp_to->bidby == $data->id) { return 1; } } return 0; } function fetchmail(){ global $contactus_server, $contactus_username, $contactus_password; if( function_exists('imap_open')){ $mbox = @imap_open("\{$contactus_server:110/pop3/notls/norsh}INBOX", "$contactus_username", "$contactus_password", CL_EXPUNGE); if( $mbox ){ for ($i = 1; $i <= @imap_num_msg($mbox); $i++){ $header = @imap_headerinfo($mbox, $i, 80, 80); $from = $header->from; foreach ($from as $id => $object) { $fromname = addslashes($object->personal); $fromaddress = addslashes($object->mailbox . "@" . $object->host); } $to = $header->to; foreach ($to as $id => $object) { $toname = addslashes($object->personal); $toaddress = addslashes($object->mailbox . "@" . $object->host); } $subject= addslashes($header->fetchsubject); $messageBody = addslashes(@imap_body($mbox, $i)); $sql = "INSERT INTO radlance_contactus ( from_name, from_email, to_name, to_email, subject, message, date) VALUES ( '$fromname', '$fromaddress', '$toname', '$toaddress', '$subject', '$messageBody', NOW() )"; if( !mysql_query($sql) ) print mysql_error(); @imap_delete( $mbox, $i ); } } @imap_expunge($mbox); @imap_close($mbox); } } function _payment_gateways($onetime = '',$monthly = '',$quarterly = '',$annually = '',$type,$signup) { global $paypal_use, $cc_use, $check_use, $anet_use, $wire_use, $currency, $multi_levels, $multi_special; if ($type == 'signup') { $term = "signup_term"; $method = "signup_method"; $title = "Sign Up"; }elseif ($type == 'special'){ $term = "term"; $method = "payment"; $title = ($multi_special ? "Freelancer Level" : "Certified Sign Up"); } if ( (float)$onetime || (float)$monthly || (float)$quarterly || (float)$annually ) { ?> '; } else { if ($paypal_use || $cc_use || $check_use || $anet_use || $wiretransfer_use) { ?> title; } function pros($id){ $sql = "SELECT * FROM radlance_os_list WHERE id=$id"; $q = mysql_fetch_object( mysql_query( $sql ) ); return $q->title; } function writeconfig($a_this){ $a_config = array( 'att_max_size', 'max_feedback_len', 'max_comment_len','max_prcomment_len', 'suspend_days', 'suspend_notice','sp_expiry_notice', 'image_x', 'image_y','pimage_x', 'pimage_y', 'catcols','vcatcols', 'catnums', 'catgroups', 'sortcats', 'showstate', 'showcountry','moderated','moderated_mb','moderated_q','moderated_up','moderated_pa','moderated_j', 'special_levels', 'sortprojects','sortfaqs', 'securelogin', 'newtime', 'newprojectsnum', 'fprojectsnum', 'top5projectsnum', 'mprojectsnum', 'sellprojectsnum','auto_transfers', 'projects_perpage','max_educ_len','max_skills_len','sellprojectname','sellprojectclass', 'sitename', 'superpass', 'currency','currency_code', 'wm', 'pr', 'cat_title','badwords','badwords_jobs','badusernames','dbalias','osalias', 'banned_words','banned_email','banned_ip','banned_users', 'att_path', 'bkp_path', 'adminemail', 'replymail', 'adminnotify', 'newprojectstitle', 'fprojectstitle', 'top5projectstitle', 'mprojectstitle', 'sellprojectstitle','sellprojectstitlelength','logoffmsg','logonmsg', 'contactus_email', 'contactus_server', 'contactus_username', 'contactus_password', 'cat_multi', 'att_enable', 'allow_same_email', 'allow_same_ip', 'dep_notify', 'wdr_notify', 'display_categories', 'featured_show_all', 'use_images','thumb_enable','closed_for_maintenance','do_spell', 'msgboard_allprivate', 'msgboard_biddersonly', 'emailtop', 'emailbottom', 'project_max_days', 'project_urgent_days', 'ulist_page','sp_period', 'b_period','s_period','g_period','p_period','charge_signup','projdays', 'referral_payout', 'programmer_fee', 'webmaster_fee', 'sp_discount','progsell_fee', 'd_discount', 'b_discount', 's_discount', 'g_discount','p_discount', 'signup_bonus', 'programmer_fee_min', 'webmaster_fee_min', 'webmaster_fee_urgent', 'webmaster_fee_featured','projectname','project_bids','project_avbid','project_start','project_expires', 'title_len','title_len_job','title_len_auction', 'sp_onetime','sp_fee_month','sp_fee_quarter','sp_fee_annual', 'b_signup', 'b_fee_month', 'b_fee_quarter', 'b_fee_annual', 's_signup', 's_fee_month', 's_fee_quarter', 's_fee_annual', 'g_signup', 'g_fee_month', 'g_fee_quarter', 'g_fee_annual', 'p_signup', 'p_fee_month', 'p_fee_quarter', 'p_fee_annual', 'd_project_level','b_project_level','s_project_level','g_project_level','p_project_level', 'minimal_transfer', 'minimal_bid','allowed_filetypes','allowed_imgtypes', 'egold_sid','dep_eg_percent','dep_eg_fee','wdr_eg_fee','eg_use', 'yowcow_sid','dep_yc_percent','dep_yc_fee','wdr_yc_fee','yc_use', 'dep_pp_fee', 'dep_cc_fee','dep_anet_fee', 'dep_check_fee', 'minimal_deposit', 'wdr_pp_fee', 'wdr_check_fee', 'wdr_wire_fee', 'wdr_anet_fee', 'wdr_cc_fee', 'minimal_withdrawal','signup_fee','progsell','pr_signup_bonus', 'wm_signup_bonus', 'signup_bonus', 'signup_wm_onetime','signup_wm_monthly','signup_wm_quarterly','signup_wm_annually', 'signup_pr_onetime','signup_pr_monthly','signup_pr_quarterly','signup_pr_annually', 'paypal_id', 'tocheckout_sid', 'dcolor','bcolor','scolor','gcolor','pcolor', 'multi_special','multi_levels', 'multi_levels_sort', 'sellproj', 'send_r', 'send_i', 'dep_pp_percent', 'dep_cc_percent', 'dep_anet_percent', 'dep_wire_percent', 'dep_check_percent', 'dep_wire_fee','transfer_mand','stransfer_mand','stransfer_option', 'anet_sid','anet_pwd', 'paypal_use', 'paypal_auto_deposit', 'cc_use', 'check_use', 'anet_use','wire_use','affpay','affpay_auction', 'affpay_job', 'dep_check','dep_wire','jobadstitle','jobsnum','jobadsname','jobadsclass','jobads_employer', 'mandat_company','mandat_address','mandat_city','mandat_country','mandat_postal','mandat_phone','mandat_fax', 'mandat_area','mandat_prof','mandat_hourly','mandat_profile','mandat_logo','mandat_realname','mandat_state', 'pr_area_limit', 'project_area_limit','wm_fee_create','ccopyright','ccopyrighty', 'wm_fee_jcreate','allow_jobs','banned_users', 'pr_fee_create','smileys','progbuy_fee','progbuy_fee_min', 'portfolio_thumb_x','portfolio_thumb_y','portfolio_x','portfolio_y', 'phpcommand','fee_transfer_p','fee_transfer_buy','fee_transfer_ps','fee_transfer_sell', 'fee_safetransfer_p','fee_safetransfer_buy','fee_safetransfer_ps','fee_safetransfer_sell', 'referral_pp','referral_yc','referral_eg','referral_2co', 'transfer_mand','stransfer_mand','stransfer_option','allow_neg','allow_refer','allow_trans','allow_safe', 'allow_direct_trans', 'mkeys','mdesc','mtitle','mphrases','mabstract','msubject', 'row1_color','row2_color','topics_per_page','posts_per_page','max_msg', 'expire_job_days','expire_auction_days', 'vcatcols_auction','catgroups_auction','catnums_auction', 'sortcats_auction','display_categories_auction','catcols_auction', 'mail_admin_new_project','mail_admin_new_auction','mail_admin_new_job', 'html_catcols','html_catcols_auction', 'display_categories_main','display_categories_main_auction','display_stat_main', 'msgboard_biddersonly','msgboard_biddersonly_auction', 'auctions_stransfer','auctions_stransfer_mand','auctions_stransfer_pfee_sell','auctions_stranfer_minfee_sell','auctions_stranfer_pfee_buy','auctions_stranfer_minfee_buy', 'paypal_use_adminfees','paypal_use_stransfer','cc_use_adminfees','cc_use_stransfer', 'eg_use_adminfees','eg_use_stransfer', 'yc_use_adminfees','yc_use_stransfer','anet_use_adminfees','anet_use_stransfer', 'check_use_adminfees','check_use_stransfer','wire_use_adminfees','wire_use_stransfer', 'rss_project_open','rss_auction_open','rss_job_open', 'rss_project_desc','rss_auction_desc','rss_job_desc', 'enableauction','tocheckout_secret', 'transfer_mand','fee_transfer_buy','fee_transfer_p','fee_transfer_sell','fee_transfer_ps', 'sp_onetime_wm', 'sp_fee_month_wm', 'sp_fee_quarter_wm', 'sp_fee_annual_wm', 'sp_discount_wm','header_catcols_auction','header_catcols', 'secureimage_on_login','secureimage_on_contactus','secureimage_on_violation' ); //'stormpay_sid','dep_sp_percent','dep_sp_fee','wdr_sp_fee','sp_use','referral_sp','sp_use_adminfees','sp_use_stransfer', sort($a_config); $str = "\n"; $value = addslashes($GLOBALS[$name]); $str .= "\$$name = '$value';\n"; } $str .= "\n?>"; $f = fopen("config/config.php", "w"); if ($f){ fwrite($f, $str); fclose($f); return true; }else return false; } function wm_nav(){ global $id, $pr, $wm, $allow_jobs, $sellproj; ?> ".$msg.""; mysql_query("UPDATE radlance_users SET error_msg='' WHERE id=$id") or die ( "Error removing message:". mysql_error() ); } } function error_msg_add($id,$newmsg) { $qr1 = mysql_query("SELECT error_msg FROM radlance_users WHERE id=$id") or die( mysql_error() ); list($msg) = mysql_fetch_row($qr1); if ($msg){ $msg .= "
\n$newmsg"; }else{ $msg = "
\n$newmsg"; } mysql_query("UPDATE radlance_users SET error_msg='$msg' WHERE id=$id") or die( "Error adding message:". mysql_error() ); } function ban_ip($ip){ $sql = "INSERT INTO radlance_banned_ips (ip) VALUES ('$ip')"; $q = mysql_query($sql); if($q) print "IP address ($ip) has been banned."; else print "An error has occured."; } function ban_email($email){ $sql = "INSERT INTO radlance_banned_emails (email) VALUES ('$email')"; $q = mysql_query($sql); if($q) print "Email address ($email) has been banned."; else print "An error has occured."; } function unban_ip($ip){ $sql = "DELETE FROM radlance_banned_ips where ip='$ip' "; $q = mysql_query($sql); if($q) print "IP address ($ip) has been unbanned."; else print "An error has occured."; } function unban_email($email){ $sql = "DELETE FROM radlance_banned_emails WHERE email='$email' "; $q = mysql_query($sql); if($q) print "Email address ($email) has been unbanned."; else print "An error has occured."; } function is_ban_ip($ip){ $sql=mysql_query("select * from radlance_banned_ips where ip='$ip' "); $q=mysql_num_rows($sql); if($q) return true; else return false; } function is_ban_email($email){ $sql=mysql_query("select * from radlance_banned_emails where email='$email' "); $q=mysql_num_rows($sql); if($q) return true; else return false; } function _ob_processing($content){ return process_a(process_b(process_c($content))); } function process_c($content){ global $my_license_key,$my_license_number; $keys=explode("#",$my_license_key); $domain = $_SERVER["HTTP_HOST"]; $_key = $keys[0]; $_key = str_replace("-", "", $_key); $_key = eregi_replace(sprintf("^%s", C137e1bc1), "", $_key); $_key = urldecode($_key); $_key = @gzinflate(base64_decode($_key)); $arrData = explode("|", $_key); $_script = @$arrData[0]; $_domain = @$arrData[1]; if($keys[1]){ $_key1 = $keys[1]; $_key1 = str_replace("-", "", $_key1); $_key1 = eregi_replace(sprintf("^%s", C137e1bc1), "", $_key1); $_key1 = urldecode($_key1); $_key1 = @gzinflate(base64_decode($_key1)); $arrData = explode("|", $_key1); $_script1 = @$arrData[0]; $_domain1 = @$arrData[1]; } if ( ( md5($my_license_number) == $_script) && ( md5($domain) == $_domain) || ($keys[1] && ( md5($my_license_number) == $_script1) && ( md5($domain) == $_domain1) ) ) { return $content; }else{ return "

Invalid License Key

".$content."

Invalid License Key

"; } } function process_d(){ $f = fopen("config/connect.php", 'w'); if ($f) { $str = ""; fwrite($f, $str); fclose($f); } } function split_phone_number($fullphonenumber, &$area, &$phone){ preg_match_all('/\((\d*)\)([\w-\.]*)/',$fullphonenumber,$y); $area=isset($y[1][0])?$y[1][0]:''; $phone=isset($y[2][0])?$y[2][0]:''; } function merge_phone_number($area,$phone){ return "(".trim($area).")".$phone; } function remove_attached_file($pid){ global $att_path; if (is_dir($att_path)) { if ($dh = opendir($att_path)) { while (($file = readdir($dh)) !== false) { if(strpos($file,'x'.$pid)===0) { unlink($att_path.$file); } } closedir($dh); } } } function load_parse_data(){ global $cache,$cachetime,$id, $moderated, $display_categories, $catgroups, $sortcats, $catnums, $catcols, $siteurl, $sitename, $id, $data, $buy, $sell, $cat_title,$allow_store, $mtitle,$mkeys,$msubject,$mdesc,$msubject,$mphrases,$mabstract, $parse_data,$logonmsg,$logoffmsg,$usecatdir,$starttime; global $allow_auction,$allow_dutchauction,$allow_yankeeauction,$allow_fsbo,$allow_pd; if( !defined("ALREADY_PARSED") ) { define("ALREADY_PARSED", 1); $parse_data = null; if($mtitle){ $parse_data->pagetitle = $mtitle; }else{ $parse_data->pagetitle = $sitename; } if ($data){ $logonmsg = str_replace("[name]",$data->username,$logonmsg); $parse_data->logmsg = "
$logonmsg
"; }elseif (isset($_COOKIE['c_users']) && $_COOKIE['c_users']){ //{yh changed from}//add isset $logoffmsg = str_replace("[name]",$_COOKIE['c_users'],$logoffmsg); $parse_data->logmsg = "
$logoffmsg
"; }elseif (isset($_COOKIE['c_userb']) && $_COOKIE['c_userb']){ //{yh changed from}//add isset $logoffmsg = str_replace("[name]",$_COOKIE['c_userb'],$logoffmsg); $parse_data->logmsg = "
$logoffmsg
"; }elseif (isset($_COOKIE['c_user']) && $_COOKIE['c_user']){ //{yh changed from}//add isset $logoffmsg = str_replace("[name]",$_COOKIE['c_user'],$logoffmsg); $parse_data->logmsg = "
$logoffmsg
"; } if((isset($_REQUEST['cat']) && $_REQUEST['cat']) || isset($_REQUEST['area']) && $_REQUEST['area'] ){ $cid = (isset($_GET['cat']) ? $_GET['cat'] : $_GET['area']); list($atitle,$meta,$meta_desc,$meta_keys,$meta_phrases,$meta_subject,$meta_abstract) = mysql_fetch_row( mysql_query("SELECT title AS atitle,meta,meta_desc,meta_keys,meta_phrases,meta_subject,meta_abstract FROM radbids_area_list WHERE id='".$cid."'") ); $ameta = ""; if($meta_keys){ $ameta.=''."\n"; } if($meta_phrases){ $ameta.=''."\n"; } if($meta_subject){ $ameta.=''."\n"; } if($meta_abstract){ $ameta.=''."\n"; } if($meta_desc){ $ameta.=''."\n"; } $parse_data->meta_tags = $ameta; if($meta){ $parse_data->pagetitle = $meta; }else{ $parse_data->pagetitle = $parse_data->pagetitle." - ".$atitle; } }else if(isset($_REQUEST['pid']) && $_REQUEST['pid']){ //{yh changed from // add isset list($atitle) = mysql_fetch_row( mysql_query("SELECT name AS atitle FROM radbids_listings WHERE id='".$_REQUEST['pid']."'") ); $parse_data->pagetitle = $sitename." - ".$atitle; }else{ $ameta = ""; if($mkeys){ $ameta.=''."\n"; } if($mphrases){ $ameta.=''."\n"; } if($msubject){ $ameta.=''."\n"; } if($mabstract){ $ameta.=''."\n"; } if($mdesc){ $ameta.=''."\n"; } $parse_data->meta_tags = $ameta; } /////////////////////////////// // NAV BARS ob_start(); if($data){ ?> nav = ob_get_contents(); ob_end_clean(); //nav bar list ob_start(); if($data){ ?> Manage Your Account
nav_list = ob_get_contents(); ob_end_clean(); //sign in/out $parse_data->signin = "Log In"; $parse_data->signout = "Log Out"; $parse_data->signup = "SignUp"; if($data){ $parse_data->signinout = $parse_data->signout; }else{ $parse_data->signinout = $parse_data->signin; } $anav = ""; if($allow_auction){ # $anav .= "Auctions
"; } if($allow_dutchauction){ if(!isset($parse_data->dutch_nav))$parse_data->dutch_nav=''; //{yh changed from} // add $parse_data->dutch_nav .= "Dutch Auctions
"; } if($allow_yankeeauction){ if(!isset($parse_data->yankee_nav))$parse_data->yankee_nav=''; //{yh changed from} // add $parse_data->yankee_nav .= "Yankee Auctions
"; } if($allow_pd){ if(!isset($parse_data->pd_nav))$parse_data->pd_nav=''; //{yh changed from} // add $parse_data->pd_nav .= "Price Drop Ads
"; } if($allow_store){ if(!isset($parse_data->store_nav))$parse_data->store_nav=''; //{yh changed from} // add $parse_data->store_nav .= "Storefront Directory
"; } if(!isset($parse_data->featured_nav))$parse_data->featured_nav=''; $parse_data->featured_nav .= "Featured Listings
"; if(!isset($parse_data->classifieds_nav))$parse_data->classifieds_nav=''; if($allow_fsbo){ $parse_data->classifieds_nav .= "Classified Ads
"; } // $DIRECTORY if($usecatdir){ ob_start(); $uniqueid = md5("directory"); if( $cache->cache($uniqueid, ($cachetime*60)) ){ if ($catgroups){ makeCats($sortcats,$catnums,1); }else{ makeAreas('',$sortcats,$catnums,1); } echo " View All Categories\n"; $cache->stop(); } $parse_data->directory = ob_get_contents(); ob_end_clean(); } } } function parsetemplate($template){ global $id, $moderated, $display_categories, $catgroups, $sortcats, $catnums, $catcols, $siteurl, $sitename, $id, $data, $buy, $sell, $cat_title, $limit_all_featured, $limit_auction_featured,$feat_limit, $spl_limit, $limit_sale_featured,$usecatdir, $parse_data; // TAG REPLACEMENT $vars = array( "sitename" => $sitename, "siteurl" => $siteurl, "id" => $id, "pagetitle" => $parse_data->pagetitle, "metatags" => (isset($parse_data->meta_tags)?$parse_data->meta_tags:''), "stat_members" => "".(isset($parse_data->stat['members'])?$parse_data->stat[members]:'')."Members, ", "stat_listings" => isset($parse_data->stat['listings'])?$parse_data->stat['listings']:0, "visitor" => isset($parse_data->cnt1)?$parse_data->cnt1:0, "online" => isset($parse_data->cnt2)?$parse_data->cnt2:0, "visitor_total" => (isset($parse_data->cnt1)?$parse_data->cnt1:0) + (isset($parse_data->cnt2)?$parse_data->cnt2:0), "listings_awarded" => isset($parse_data->cnt4)?$parse_data->cnt4:0, "random_quote" => isset($parse_data->quote)?$parse_data->quote:0, "categories" => isset($parse_data->cat)?$parse_data->cat:'', "cat_title" => ($usecatdir ? "" : ""), "totalwon" => isset($parse_data->totalwon)?$parse_data->totalwon:0, "dutch_nav" => isset($parse_data->dutch_nav)?$parse_data->dutch_nav:'', "yankee_nav" => isset($parse_data->yankee_nav)?$parse_data->yankee_nav:'', "pd_nav" => isset($parse_data->pd_nav)?$parse_data->pd_nav:'', "store_nav" => isset($parse_data->store_nav)?$parse_data->store_nav:'', "featured_nav" => isset($parse_data->featured_nav)?$parse_data->featured_nav:'', "classifieds_nav" => isset($parse_data->classifieds_nav)?$parse_data->classifieds_nav:'', "spotlight_image" => spotlight_image_box($spl_limit), "feature_image_box" => feature_image_box($feat_limit), "nav" => $parse_data->nav, "nav_list" => $parse_data->nav_list, "login/out" => $parse_data->signinout, "login" => $parse_data->signout, "logout" => $parse_data->signin, "signup" => $parse_data->signup, "logmsg" => isset($parse_data->logmsg)?$parse_data->logmsg:'', "jumpto" => isset($parse_data->jumpto)?$parse_data->jumpto:'', "directory" => $parse_data->directory, "toplevellistings" => isset($parse_data->toplevellistings)?$parse_data->toplevellistings:0, ); while( $a = each($vars) ){ $template = str_replace("[[{$a[0]}]]", $a[1], $template ); $x = strtoupper($a[0]); $template = str_replace("[[{$x}]]", $a[1], $template ); } return $template; } function spotlight_image_box($limit=1){ global $siteurl,$moderated; $shown_list = array(); $last = ""; ob_start(); if($moderated){ $where = "AND moderated=1"; } ?>
id&$id>$r1->title($cnt)  
id >$r1->title($cnt)  
Period:
Method:
now() $where ORDER BY RAND() LIMIT 0,$limit;"; $aq = mysql_query($sql); $total = mysql_num_rows($aq); if( $total > 0 ){ while( $listing = mysql_fetch_object($aq) ){ ?>
Spotlighted Items
id; $sql = "SELECT * FROM radbids_images WHERE pid='$pid' ORDER BY pri limit 1"; $q = mysql_query($sql); $img = mysql_fetch_object($q); $filename = "i{$img->pid}_{$img->id}.{$img->extention}"; $size = scaleimage($filename,"s"); $newheight = isset($size['h'])?$size['h']:0; $newwidth = isset($size['w'])?$size['w']:0; if( file_exists("files/$filename") && $pid ){ $imgSize = getImageSize("files/$filename"); $imgType = $imgSize[2] ; if( $imgType == "1" || $imgType == "2" || $imgType == "3" ){ $image = ""; }else{ $image = ""; } ?>


Owner: