Jump to content

Imaulle

Members
  • Posts

    119
  • Joined

  • Last visited

    Never

Everything posted by Imaulle

  1. Hello, is this ok to do? or should I add in some type of fail safe in case for some reason the server is down etc? If so, how? public function check_update() { $query = $this->db->where('setting_name', 'version')->get('settings')->row(); $latest = file_get_contents('http://www.mydomain.com/version.txt') ) if ( version_compare($query->value, $latest, '<') ) return true; else return false; }
  2. is there a way to excute the system() command here but not wait for it and just let it go in the background? And something that wont boggle down the system too much? Thanks! $this->db->insert('jukebox', $data); echo '1'; system('ffmpeg -i ' . $id . '.mp3 -acodec libvorbis -aq 60 ' . $id . '.ogg');
  3. Hello, ok so I need to have an image to replace the normal file input button but nothing happens when I click the image. What am I doing wrong? <form action="../../uploads/social_handler/<?php echo $row->id; ?>/" method="post" enctype="multipart/form-data"> <input type="file" style="display:none" id="fileInput<?php echo $row->id; ?>" name="fileInput<?php echo $row->id; ?>"> <label for="fileInput<?php echo $row->id; ?>"> <img src="../../assets/adminIcons/replaceimage24.png"> </label> </form> Also, how will I control the file input stuff so that they can only upload png files? Thanks!
  4. OOOOOOOOOHHHHHHHHHHHHHHH okay I see what I did. I didn't have the function call in the isset check. I was trying to combine if statements... silly me. THANK YOU!!!
  5. There an easy fix for this? ermmmm. what doesn't make sense to me is I used basically the same code elsewhere and it works perfectly (though its super messy) Any idea why it works below, but not in the above code? function buildMenu($parent, $menu, $first) { $html = ''; $fullMenu='<div style="display:none">'; if (isset($menu['parents'][$parent])) { if($first === TRUE) { $html .= '<ul id="menuList" class="menu menuFont">'; } else { $html .= '<ul>'; } foreach($menu['parents'][$parent] as $itemId) { if(!isset($menu['parents'][$itemId])) { if($menu['items'][$itemId]->type != 'external') { $a = str_replace(' ','-',$menu['items'][$itemId]->name); $a2='#!/'.$a; $target=''; $typ='typ="m"'; } else { $a = $menu['items'][$itemId]->link; $a2=$a; $target=' target="'.$menu['items'][$itemId]->target.'"'; $typ='typ="e"'; } if($menu['items'][$itemId]->parent == 0) { if($menu['items'][$itemId]->visible != 'false') { $html .= '<li><a class="mainMenu" menuID="'.$menu['items'][$itemId]->id.'" main="' . $menu['items'][$itemId]->name . '" '.$typ.' lnk="'.$menu['items'][$itemId]->name.'" href="'.$a2.'"'.$target.'><h1>'. $menu['items'][$itemId]->name .'</h1></a></li>'; } $fullMenu .= '<span class="fullMenuItem" menuID="'.$menu['items'][$itemId]->id.'" ref="#!/'.$a.'"></span>'; } else { if($menu['items'][$itemId]->type != 'external') { $string = '#!/' . $menu['items'][$menu['items'][$itemId]->parent]->name . '/' . $menu['items'][$itemId]->name ; $string = str_replace(' ','-', $string); } else { $string=$menu['items'][$itemId]->link; } if($menu['items'][$itemId]->visible != 'false' && $menu['items'][$menu['items'][$itemId]->parent]->visible != 'false' && $menu['items'][$menu['items'][$itemId]->parent]->type != 'gallery_portal') { $html .= '<li><a class="subMenu" menuID="'.$menu['items'][$itemId]->id.'" main="' . $menu['items'][$itemId]->name . '" lnk="'.$menu['items'][$itemId]->name.'" href="'.$string.'" style="z-index:300"'.$target.'><h1>'. $menu['items'][$itemId]->name .'</h1></a></li>'; } $fullMenu .= '<span class="fullMenuItem" menuID="'.$menu['items'][$itemId]->id.'" ref="'.$string.'"></span>'; } } if(isset($menu['parents'][$itemId])) { if($menu['items'][$itemId]->type != 'external') { $a = str_replace(' ','-',$menu['items'][$itemId]->name); } else { $a = $menu['items'][$itemId]->link; $a2=$a; $target=' target="'.$menu['items'][$itemId]->target.'"'; } if ($menu['items'][$itemId]->visible != 'false') { if($menu['items'][$itemId]->type != 'gallery_portal') { $html .= '<li><span class="mainMenu" menuID="'.$menu['items'][$itemId]->id.'" main="' . $menu['items'][$itemId]->name . '" typ="h" lnk="'.$menu['items'][$itemId]->name . '"'; } else { $html .= '<li><a class="mainMenu" menuID="'.$menu['items'][$itemId]->id.'" main="' . $menu['items'][$itemId]->name . '" typ="m" lnk="'.$menu['items'][$itemId]->name . '"'; } if ($menu['items'][$itemId]->type == 'gallery_portal') { $string = '#!/' . $menu['items'][$itemId]->name; $string = str_replace(' ','-', $string); $html .= ' href="'.$string.'"'; $html .= '><h1>'.$menu['items'][$itemId]->name .'</h1></a>'; $fullMenu .= '<span class="fullMenuItem" menuID="'.$menu['items'][$itemId]->id.'" ref="'.$string.'"></span>'; } else { $html .= ' onClick="javascript:showSub(this)"'; $html .= '><h1>'.$menu['items'][$itemId]->name .'</h1></span>'; } } $html .= buildMenu($itemId, $menu, FALSE); if($menu['items'][$itemId]->visible != 'false') { $html .= '</li>'; } } } $html .= '</ul>'; $fullMenu .= '</div>'; } return $html.$fullMenu; } return buildMenu(0, $menu, TRUE); }
  6. yes. All errors occur at foreach($menu['parents'][$parent] as $itemId)
  7. No I think that's how it checks if it's a parent with no children. The 2nd if has if(isset($menu['parents'][$itemId])) without the ! The first if will print items that are parents but have no children. The next elseif will print only children. The last if will print parents that have children Hope that makes sense...
  8. oh woops! I did not think of that! sorry! Here ya go Array ( [items] => Array ( [1] => stdClass Object ( [id] => 1 [name] => HOME [parent] => 0 [type] => slideshow [order] => 1 [visible] => true [image] => [color] => [link] => [target] => ) [5] => stdClass Object ( [id] => 5 [name] => INFO [parent] => 0 [type] => parent [order] => 2 [visible] => true [image] => [color] => [link] => [target] => ) [3] => stdClass Object ( [id] => 3 [name] => GALLERIES [parent] => 0 [type] => parent [order] => 3 [visible] => true [image] => [color] => [link] => [target] => ) [18] => stdClass Object ( [id] => 18 [name] => GALLERY SECTIONS [parent] => 0 [type] => gallery_portal [order] => 4 [visible] => true [image] => DSC0250.jpg [color] => 848a5a [link] => [target] => ) [22] => stdClass Object ( [id] => 22 [name] => CONTACT [parent] => 0 [type] => forms [order] => 5 [visible] => true [image] => [color] => [link] => [target] => ) [24] => stdClass Object ( [id] => 24 [name] => MAILING LIST [parent] => 0 [type] => forms [order] => 6 [visible] => false [image] => [color] => [link] => [target] => ) [2] => stdClass Object ( [id] => 2 [name] => WEDDING [parent] => 3 [type] => gallery [order] => 1 [visible] => true [image] => [color] => [link] => [target] => ) [4] => stdClass Object ( [id] => 4 [name] => ABOUT US [parent] => 5 [type] => text_page [order] => 1 [visible] => true [image] => [color] => [link] => [target] => ) [7] => stdClass Object ( [id] => 7 [name] => CALENDAR [parent] => 5 [type] => calendar [order] => 2 [visible] => true [image] => [color] => [link] => [target] => ) [21] => stdClass Object ( [id] => 21 [name] => PORTFOLIOSITEZ [parent] => 5 [type] => external [order] => 3 [visible] => true [image] => [color] => [link] => http://portfoliositez.com [target] => _blank ) [11] => stdClass Object ( [id] => 11 [name] => LANDSCAPE [parent] => 18 [type] => gallery [order] => 1 [visible] => true [image] => [color] => [link] => [target] => ) [6] => stdClass Object ( [id] => 6 [name] => PORTRAITS [parent] => 18 [type] => gallery [order] => 2 [visible] => true [image] => [color] => [link] => [target] => ) ) [parents] => Array ( [0] => Array ( [0] => 1 [1] => 5 [2] => 3 [3] => 18 [4] => 22 [5] => 24 ) [3] => Array ( [0] => 2 ) [5] => Array ( [0] => 4 [1] => 7 [2] => 21 ) [18] => Array ( [0] => 11 [1] => 6 ) ) )
  9. Hello, I'm not able to figure how to fix these warnings / errors I'm getting. The file that I'm creating comes out correctly so it's as if I need some type of conditional to end the function calls or something? I'm really stumped with this one... Undefined index: 1 Invalid argument supplied for foreach() Undefined index: 4 Invalid argument supplied for foreach() Undefined index: 7 Invalid argument supplied for foreach() Undefined index: 21 Invalid argument supplied for foreach() Undefined index: 2 Invalid argument supplied for foreach() Undefined index: 11 Invalid argument supplied for foreach() Undefined index: 6 Invalid argument supplied for foreach() Undefined index: 22 Invalid argument supplied for foreach() Undefined index: 24 Invalid argument supplied for foreach() Here is a var_dump of $menu array(2) { ["items"]=> array(12) { [1]=> object(stdClass)#17 (10) { ["id"]=> string(1) "1" ["name"]=> string(4) "HOME" ["parent"]=> string(1) "0" ["type"]=> string(9) "slideshow" ["order"]=> string(1) "1" ["visible"]=> string(4) "true" ["image"]=> NULL ["color"]=> NULL ["link"]=> NULL ["target"]=> NULL } [5]=> object(stdClass)#18 (10) { ["id"]=> string(1) "5" ["name"]=> string(4) "INFO" ["parent"]=> string(1) "0" ["type"]=> string(6) "parent" ["order"]=> string(1) "2" ["visible"]=> string(4) "true" ["image"]=> NULL ["color"]=> NULL ["link"]=> NULL ["target"]=> NULL } [3]=> object(stdClass)#19 (10) { ["id"]=> string(1) "3" ["name"]=> string(9) "GALLERIES" ["parent"]=> string(1) "0" ["type"]=> string(6) "parent" ["order"]=> string(1) "3" ["visible"]=> string(4) "true" ["image"]=> NULL ["color"]=> NULL ["link"]=> NULL ["target"]=> NULL } [18]=> object(stdClass)#20 (10) { ["id"]=> string(2) "18" ["name"]=> string(16) "GALLERY SECTIONS" ["parent"]=> string(1) "0" ["type"]=> string(14) "gallery_portal" ["order"]=> string(1) "4" ["visible"]=> string(4) "true" ["image"]=> string(11) "DSC0250.jpg" ["color"]=> string(6) "848a5a" ["link"]=> NULL ["target"]=> NULL } [22]=> object(stdClass)#21 (10) { ["id"]=> string(2) "22" ["name"]=> string(7) "CONTACT" ["parent"]=> string(1) "0" ["type"]=> string(5) "forms" ["order"]=> string(1) "5" ["visible"]=> string(4) "true" ["image"]=> NULL ["color"]=> NULL ["link"]=> NULL ["target"]=> NULL } [24]=> object(stdClass)#22 (10) { ["id"]=> string(2) "24" ["name"]=> string(12) "MAILING LIST" ["parent"]=> string(1) "0" ["type"]=> string(5) "forms" ["order"]=> string(1) "6" ["visible"]=> string(5) "false" ["image"]=> NULL ["color"]=> NULL ["link"]=> NULL ["target"]=> NULL } [2]=> object(stdClass)#23 (10) { ["id"]=> string(1) "2" ["name"]=> string(7) "WEDDING" ["parent"]=> string(1) "3" ["type"]=> string(7) "gallery" ["order"]=> string(1) "1" ["visible"]=> string(4) "true" ["image"]=> NULL ["color"]=> NULL ["link"]=> NULL ["target"]=> NULL } [4]=> object(stdClass)#24 (10) { ["id"]=> string(1) "4" ["name"]=> string( "ABOUT US" ["parent"]=> string(1) "5" ["type"]=> string(9) "text_page" ["order"]=> string(1) "1" ["visible"]=> string(4) "true" ["image"]=> NULL ["color"]=> NULL ["link"]=> NULL ["target"]=> NULL } [7]=> object(stdClass)#25 (10) { ["id"]=> string(1) "7" ["name"]=> string( "CALENDAR" ["parent"]=> string(1) "5" ["type"]=> string( "calendar" ["order"]=> string(1) "2" ["visible"]=> string(4) "true" ["image"]=> NULL ["color"]=> NULL ["link"]=> NULL ["target"]=> NULL } [21]=> object(stdClass)#26 (10) { ["id"]=> string(2) "21" ["name"]=> string(14) "PORTFOLIOSITEZ" ["parent"]=> string(1) "5" ["type"]=> string( "external" ["order"]=> string(1) "3" ["visible"]=> string(4) "true" ["image"]=> NULL ["color"]=> NULL ["link"]=> string(25) "http://portfoliositez.com" ["target"]=> string(6) "_blank" } [11]=> object(stdClass)#27 (10) { ["id"]=> string(2) "11" ["name"]=> string(9) "LANDSCAPE" ["parent"]=> string(2) "18" ["type"]=> string(7) "gallery" ["order"]=> string(1) "1" ["visible"]=> string(4) "true" ["image"]=> NULL ["color"]=> NULL ["link"]=> NULL ["target"]=> NULL } [6]=> object(stdClass)#28 (10) { ["id"]=> string(1) "6" ["name"]=> string(9) "PORTRAITS" ["parent"]=> string(2) "18" ["type"]=> string(7) "gallery" ["order"]=> string(1) "2" ["visible"]=> string(4) "true" ["image"]=> NULL ["color"]=> NULL ["link"]=> NULL ["target"]=> NULL } } ["parents"]=> array(4) { [0]=> array(6) { [0]=> string(1) "1" [1]=> string(1) "5" [2]=> string(1) "3" [3]=> string(2) "18" [4]=> string(2) "22" [5]=> string(2) "24" } [3]=> array(1) { [0]=> string(1) "2" } [5]=> array(3) { [0]=> string(1) "4" [1]=> string(1) "7" [2]=> string(2) "21" } [18]=> array(2) { [0]=> string(2) "11" [1]=> string(1) "6" } } } And here is the code public function sitemap() { $query = $this->db->order_by('parent', 'asc')->order_by('order', 'asc')->get('menu'); foreach($query->result() as $row) { $menu['items'][$row->id] = $row; $menu['parents'][$row->parent][] = $row->id; } function build_map($parent, $menu, &$data) { foreach($menu['parents'][$parent] as $itemId) { if(!isset($menu['parents'][$itemId])) { if(($menu['items'][$itemId]->parent == 0) && ($menu['items'][$itemId]->visible != 'false')) { $name = str_replace(' ','-', $menu['items'][$itemId]->name); $data .= "\t<url><loc>" . base_url() . "#!/". $name ."</loc></url>\n"; } elseif($menu['items'][$itemId]->visible != 'false' && $menu['items'][$itemId]->type !='external' && $menu['items'][$itemId]->type != 'parent') { $name = str_replace(' ','-', $menu['items'][$itemId]->name); $name2 = str_replace(' ','-', $menu['items'][$menu['items'][$itemId]->parent]->name); $data .= "\t<url><loc>" . base_url() . "#!/". $name2 ."/" . $name ."</loc></url>\n"; } } if(isset($menu['parents'][$itemId]) && $menu['items'][$itemId]->visible != 'false' && $menu['items'][$itemId]->type != 'parent' && $menu['items'][$itemId]->type !='external') { $name = str_replace(' ','-', $menu['items'][$itemId]->name); $data .= "\t<url><loc>" . base_url() . "#!/". $name ."</loc></url>\n"; } build_map($itemId, $menu, $data); } } $data = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\">\n\t<url><loc>".base_url()."</loc></url>\n"; build_map(0, $menu, $data); $data .= "</urlset>"; write_file('sitemap.xml', $data); }
  10. hmm nope that is not it. from the command line it only works when I do this: php /home/morganb/public_html/html_projectDT/assets/fonts/cufon/convert.php -u "U+??" /home/morganb/public_html/html_projectDT/assets/fonts/Gill_Sans.ttf 1> /home/morganb/public_html/html_projectDT/assets/fonts/Gill_Sans.js if I do /usr/bin/php the convert.php throws an error. Is there a different function I should use other than system()? I don't get how the above command works in putty but not when called from system() :\
  11. sorry bump~ anyone? I'm banging my head against the wall with this one
  12. btw I should maybe mention this is in Codeigniter. However no one from the CI forum could offer any input so now I'm trying here...
  13. I did a write_file('text.txt', $command) and it did this: php /home/morganb/public_html/html_projectDT/assets/fonts/cufon/convert.php -u "U+??" /home/morganb/public_html/html_projectDT/assets/fonts/Gill_Sans.ttf 1> /home/morganb/public_html/html_projectDT/assets/fonts/Gill_Sans.js which is correct as far as the cufon convert.php is concerned. However the Gill_Sans.js file only contains the exit() from the controller "no files uploaded"
  14. so basically what is happening is... the file is uploaded, then somehow it's like the system() call causes the url to be reloaded?!?!? soooooooooo confused how that could be happening....
  15. Hello, I have the following code class Uploads extends Controller { public function __construct() { parent::__construct(); if (empty($_FILES)) { log_message('error', 'Uploads - files empty'); exit('No files uploaded'); } ini_set('memory_limit', '128M'); $this->load->helper('file'); $this->load->helper('helpers'); $this->load->model('uploads_model'); } public function font_handler() { $this->uploads_model->font_handler(); } } class Uploads_model extends Model { public function font_handler() { $config = array( 'max_size' => '8388', 'allowed_types' => 'ttf', 'upload_path' => 'assets/fonts/' ); $this->load->library('upload', $config); if ($this->upload->do_upload('Filedata')) { $file = $this->upload->data(); $jsFile = $file['raw_name'].'.js'; $query = $this->db->where('location', 'menuFont')->get('fonts')->row(); if ($query->customFile != '' && file_exists('assets/fonts/'.$query->customFile)) { unlink('assets/fonts/'.$query->customFile); } $path = getcwd() . '/assets/fonts/cufon/convert.php'; $command = 'php ' . $path . ' -u "U+??" ' . $file['full_path'] . ' 1> ' . getcwd() . '/assets/fonts/' . $jsFile; system($command); } } } Ok so, the ttf file is uploaded correctly and I can run $command from the command promt in putty and it works perfect, but when I try to run the same command from system() the js file just contains (from the controller) "No files uploaded" I have no idea why this is happening? Anyone have any ideas? Also one thing i'm not sure about is if it should be 1> or > when creating the js file?!? Thanks guys!
  16. upon further investigating I've found out that it's a unicode-friendly version of ord(). - mb_convert_encoding($char, 'UCS-4BE', 'UTF-8') converts a UTF-8 character to UCS-4BE. - UCS-4BE is 32-bit unicode big endian. - unpack unpacks binary data into an associative array. - N specifies unsigned long 32-bit big endian as the format. - $cp[1] returns the second index of the associative array. However I'm still unable to figure out how to do this without using mb_convert_encoding.... Anyone got any ideas?
  17. Can someone help me figure out what this does exactly and is it possible to do the same thing without using mb_convert_encoding? I need to be able to do this function without that lib public static function getCodePoint($char) { $cp = unpack('N', mb_convert_encoding($char, 'UCS-4BE', 'UTF-8')); return $cp[1]; } This is from the Cufon generator code that converts ttf to js... Thanks!
  18. I'm having a really bad brain fart and I cannot get the logic correct here lol. I need divs wrapped around every set of 5 images so if there is a total of 8 images then there would be 2 sets of divs (first with 5 images, second with 3 images) and if there was 12 images then there would be 3 sets of divs (first two with five images, last one with 2 images) etc etc What am I doing wrong and is there an easier way to do this? http://pastebin.com/QfsFxe4G Thanks!
  19. ohhhh nevermind figured it out with ob_get_contents()
  20. I'm trying to write a payment module using some cURL commands and I can't figure out how to process the response. When I run the script it loads up some code that I guess is coming from the cgi page? How would I search that page for words like 'Declined' , 'Error' or 'Your information has been processed securely.' Also, since this is for secure money transactions do I have the needed cURL options etc? This is what I have so far: $fields_string =''; $fields = array( 'vendor_id'=>urlencode($vendorid), 'ret_addr'=>urlencode($ret_addr), 'ccnum'=>urlencode($cardnumber), 'ccmo'=>urlencode($month), 'ccyr'=>urlencode($year), 'mername'=>urlencode($mername), 'first_name'=>urlencode($firstname), 'last_name'=>urlencode($lastname), 'address'=>urlencode($address), 'city'=>urlencode($city), 'state'=>urlencode($state), 'zip'=>urlencode($postcode), 'country'=>urlencode($country), 'phone'=>urlencode($phone), 'email'=>urlencode($email), 'total'=>urlencode($amount), ); foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; } rtrim($fields_string,'&'); $ch = curl_init(); curl_setopt($ch,CURLOPT_URL,'https://secure.itransact.com/cgi-bin/rc/ord.cgi'); curl_setopt($ch,CURLOPT_POST,count($fields)); curl_setopt($ch,CURLOPT_POSTFIELDS,$fields_string); $result = curl_exec($ch); curl_close($ch); thanks!
  21. when I would echo $res it would be '5' so that is the read error correct? It works on zips that are less than 10 mb.. I need it working on a zip that is 15-20 mb
  22. sorry.. SIZE of the zip file... It works only on zips under 10mb ????
  23. ok I've figured out this is an issue with the zip of the zip file... It works only if the zip is under 10 mb. How can I increase this to zip files 20mb or less??? Sorry if this is the wrong section!!!!
  24. Hello, the following code is working on all but 2 of my servers I've tested it on. Anyone know the requirements for this to work correctly? I'm not having much luck. The 2 servers in question do have zlib installed. What else is required???? $zip = new ZipArchive; $res = $zip->open('newzip.zip'); if($res===TRUE){ $zip->extractTo($install_folder); $zip->close(); }else{ echo'failed'; }
  25. nevermind it was an issue with cPanel >_<
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.