Ejemplo n.º 1
0
$query = "SELECT nombre, code, name \n\t\t\tFROM country \n\t\t\tORDER BY 1 ASC;\n\t\t\t";
$que = mysql_query($query) or die(mysql_error());
while ($fila = mysql_fetch_assoc($que)) {
    $xml .= "\n<url>\n  <loc>http://www.owloo.com/facebook-stats/cities/" . convert_to_url_string($fila['name']) . "/</loc>\n  <changefreq>daily</changefreq>\n</url>";
}
//Countries page
$query = "SELECT nombre, code, name \n\t\t\tFROM country \n\t\t\tORDER BY 1 ASC;\n\t\t\t";
$que = mysql_query($query) or die(mysql_error());
while ($fila = mysql_fetch_assoc($que)) {
    $xml .= "\n<url>\n  <loc>http://www.owloo.com/facebook-stats/pages/country/" . convert_to_url_string($fila['code']) . "/</loc>\n  <changefreq>daily</changefreq>\n</url>";
}
//Facebook page
$query = "SELECT id_page, username \n\t\t\tFROM facebook_page\n\t\t\tWHERE active = 1 \n\t\t\tORDER BY 1 ASC;\n\t\t\t";
$que = mysql_query($query) or die(mysql_error());
while ($fila = mysql_fetch_assoc($que)) {
    $xml .= "\n<url>\n  <loc>http://www.owloo.com/facebook-stats/pages/" . convert_to_url_string($fila['username']) . "/</loc>\n  <changefreq>daily</changefreq>\n</url>";
}
//Twitter's profiles
reconnect_db('owloo_twitter');
$qry = "";
$qry = " SELECT owloo_screen_name FROM owloo_user_master";
$qry = $qry . " Order By owloo_followers_count DESC";
$qrydata = mysql_query($qry);
while ($fetchdata = mysql_fetch_array($qrydata)) {
    $xml .= "\n<url>\n  <loc>http://www.owloo.com/twitter-stats/userpage/" . $fetchdata['owloo_screen_name'] . "</loc>\n  <changefreq>daily</changefreq>\n</url>";
}
$xml .= "\n</urlset>";
$f = fopen(__DIR__ . '/sitemap.xml', 'w+');
fwrite($f, $xml);
fclose($f);
echo '<p>Sitemap generado!</p>';
Ejemplo n.º 2
0
 function daemon()
 {
     global $CFG;
     $pid = getmypid();
     mtrace('Judge daemon created. PID = ' . $pid);
     if (function_exists('pcntl_fork')) {
         // In linux, this is a new session
         // Start a new sesssion. So it works like a daemon
         $sid = posix_setsid();
         if ($sid < 0) {
             mtrace('Can not setsid');
             exit;
         }
         //Redirect error output to php log
         $CFG->debugdisplay = false;
         @ini_set('display_errors', '0');
         @ini_set('log_errors', '1');
         // Close unused fd
         fclose(STDIN);
         fclose(STDOUT);
         fclose(STDERR);
         reconnect_db();
         // Handle SIGTERM so that can be killed without pain
         declare (ticks=1);
         // tick use required as of PHP 4.3.0
         pcntl_signal(SIGTERM, 'sigterm_handler');
     }
     set_config('assignment_oj_daemon_pid', $pid);
     // Run forever until be killed or plugin was upgraded
     while (!empty($CFG->assignment_oj_daemon_pid)) {
         global $db;
         $this->judge_all_unjudged();
         // If error occured, reconnect db
         if ($db->ErrorNo()) {
             reconnect_db();
         }
         //Check interval is 5 seconds
         sleep(5);
         //renew the config value which could be modified by other processes
         $CFG->assignment_oj_daemon_pid = get_config(NULL, 'assignment_oj_daemon_pid');
     }
 }
Ejemplo n.º 3
0
     } elseif ($_POST['type'] == 'page') {
         $_check = get_current_favorite_page_data($_POST['id_element']);
         if (empty($_check)) {
             echo 1;
             //No data
             exit;
         }
     } else {
         reconnect_db('owloo_twitter');
         $_check = get_current_favorite_twitter_data($_POST['id_element']);
         if (empty($_check)) {
             echo 1;
             //No data
             exit;
         }
         reconnect_db('owloo_owloo');
     }
     if (add_current_favorite($_POST['type'], $_POST['id_element'])) {
         echo 2;
     } else {
         echo 3;
     }
     //Add error
     exit;
 } else {
     if (down_current_favorite($_POST['type'], $_POST['id_element'])) {
         echo 4;
     } else {
         echo 5;
     }
     //Down error