• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP log_to_file函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中log_to_file函数的典型用法代码示例。如果您正苦于以下问题:PHP log_to_file函数的具体用法?PHP log_to_file怎么用?PHP log_to_file使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了log_to_file函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: printmessages

function printmessages()
{
    //Print error messages
    initialise_messages();
    $messages = $_SESSION['messages'];
    // move from session to local
    $log_to_file = false;
    // true will start writing to a file
    if (!empty($messages)) {
        //if messages exist
        //first part of message
        if (!empty($messages['success'])) {
            //if success messages exist.
            foreach ($messages['success'] as $value) {
                if ($log_to_file) {
                    log_to_file("Success", $value);
                }
                echo '<div class="alert alert-success alert-dismissible" role="alert">
						<button type="button" class="close" data-dismiss="alert" aria-label="Close">
							<span aria-hidden="true">&times;</span>
						</button>
						<strong>Success!</strong> ' . $value . '</div>';
            }
        }
        if (!empty($messages['alerts'])) {
            //if alert messages exist.
            foreach ($messages['alert'] as $value) {
                if ($log_to_file) {
                    log_to_file("Alert", $value);
                }
                echo '<div class="alert alert-warning alert-dismissible" role="alert">
						<button type="button" class="close" data-dismiss="alert" aria-label="Close">
							<span aria-hidden="true">&times;</span>
						</button>
						<strong>Alert!</strong> ' . $value . '</div>';
            }
        }
        if (!empty($messages['errors'])) {
            //if error messages exist.
            foreach ($messages['errors'] as $value) {
                if ($log_to_file) {
                    log_to_file("Error", $value);
                }
                echo '<div class="alert alert-danger alert-dismissible" role="alert">
						<button type="button" class="close" data-dismiss="alert" aria-label="Close">
							<span aria-hidden="true">&times;</span>
						</button>
						<strong>Warning!</strong> ' . $value . '</div>';
            }
        }
        //end of message
        clear_messages();
        //clear message and start again.
    }
}
开发者ID:eveclarke91,项目名称:FourthYearProject,代码行数:55,代码来源:messagemanager.php


示例2: ResultadoDetalleExtendido

 function ResultadoDetalleExtendido($Resultado)
 {
     if (!$this->user || !$this->password) {
         $ret = generate_error("Autenticacion", "", "ResultadoDetalleExtendido");
     } else {
         $payload = file_get_contents("php://input");
         log_to_file("wsSeguimiento XMLrequest: " . $payload);
         log_to_file("wsSeguimiento request: " . serialize($Resultado));
         $ret = get_ResultadoDetalleExtendido($Resultado->ResultadoExtendido, $this->user, $this->password);
     }
     log_to_file("wsSeguimiento response: " . serialize($ret));
     return $ret;
 }
开发者ID:kevin-bruton,项目名称:marsupial,代码行数:13,代码来源:wsSeguimiento.php


示例3: saveimage

function saveimage()
{
    log_to_file('snyggve', LOGLEVEL_DEBUG, __FILE__, __LINE__, 'File saved in snyggve by ' . $_SESSION['login']['id'] . ' and file ' . $_FILES['image']['tmp_name'], '');
    if (!is_numeric(str_replace('_', '', $_POST['image_id']))) {
        die('Error (Visst är det skönt med felmeddelanden utan förklaring?) #' . __LINE__);
    }
    $query = 'INSERT INTO snyggve(title, owner, timestamp) VALUES("' . htmlspecialchars($_POST['title']) . '", ' . $_SESSION['login']['id'] . ', ' . time() . ')';
    mysql_query($query) or die(report_sql_error($query, __FILE__, __LINE__));
    $id = mysql_insert_id();
    system('cp ' . SNYGGVE_TEMP_PATH . 'thumb/' . $_POST['image_id'] . '.jpg ' . SNYGGVE_PERM_PATH . 'thumb/' . $id . '.jpg');
    system('cp ' . SNYGGVE_TEMP_PATH . 'full/' . $_POST['image_id'] . '.jpg ' . SNYGGVE_PERM_PATH . 'full/' . $id . '.jpg');
    return $id;
}
开发者ID:Rojk,项目名称:hamsterpaj,代码行数:13,代码来源:snyggve.php


示例4: load_config

function load_config()
{
    $filename = "/var/xenoblade/config.txt";
    $mysql_user = "";
    $mysql_host = "";
    $mysql_pass = "";
    $mysql_database = "";
    $settings = array();
    if (fopen($filename, "r") == false) {
        $log_message = "CRITICAL: Unable to load config file! Webpages will not load at all without it.";
        log_to_file($log_message);
    }
    $handle = fopen($filename, "r") or die("Error loading config file! Please contact a system administrator to get this fixed! Webservices are non-functional without it.");
    while (($line = fgets($handle)) !== false) {
        // Fetch config information line-by-line
        if (strcmp(stristr($line, "mysql_user:"), $line) == 0) {
            $mysql_user = trim(str_ireplace("mysql_user:", "", $line));
        }
        if (strcmp(stristr($line, "mysql_host:"), $line) == 0) {
            $mysql_host = trim(str_ireplace("mysql_host:", "", $line));
        }
        if (strcmp(stristr($line, "mysql_pass:"), $line) == 0) {
            $mysql_pass = trim(str_ireplace("mysql_pass:", "", $line));
        }
        if (strcmp(stristr($line, "mysql_database:"), $line) == 0) {
            $mysql_database = trim(str_ireplace("mysql_database:", "", $line));
        }
    }
    fclose($handle);
    $settings[0] = $mysql_user;
    $settings[1] = $mysql_host;
    $settings[2] = $mysql_pass;
    $settings[3] = $mysql_database;
    // Check to see if any of the settings are empty. If they are,
    // that means that there is a typo in one of the settings
    // ie "myr_rpc_uer: " instead of "myr_rpc_user: "
    for ($i = 0; $i < count($settings); $i++) {
        if (empty($settings[$i])) {
            $log_message = "CRITICAL: Unable to load config file due to a damaged setting! Please go through the config file to correct the error. Webpages will not load at all without the config file.";
            log_to_file($log_message);
            die("Error loading config file! Please contact a system administrator to get this fixed! Webservices are non-functional without it.");
        }
    }
    return $settings;
}
开发者ID:birdonwheels5,项目名称:xenoblade-x-site,代码行数:45,代码来源:general_functions.php


示例5: admin_action_count

function admin_action_count($admin_id, $event)
{
    switch ($event) {
        case 'post_removed':
            $query_insert = 'INSERT INTO admin_counts (user_id, posts_removed) VALUES ("' . $admin_id . '", 1)';
            $query_update = 'UPDATE admin_counts SET posts_removed = posts_removed + 1 WHERE user_id="' . $admin_id . '"';
            break;
        case 'avatar_denied':
            $query_insert = 'INSERT INTO admin_counts (user_id, avatars_denied) VALUES ("' . $admin_id . '", 1)';
            $query_update = 'UPDATE admin_counts SET avatars_denied = avatars_denied + 1 WHERE user_id="' . $admin_id . '"';
            break;
        case 'avatar_approved':
            $query_insert = 'INSERT INTO admin_counts (user_id, avatars_approved) VALUES ("' . $admin_id . '", 1)';
            $query_update = 'UPDATE admin_counts SET avatars_approved = avatars_approved + 1 WHERE user_id="' . $admin_id . '"';
            break;
    }
    log_to_file('admin', LOGLEVEL_DEBUG, __FILE__, __LINE__, 'admin_action_count ' . $event, $query_insert);
    mysql_query($query_insert) or mysql_query($query_update) or die(report_sql_error($query_update, __FILE__, __LINE__));
}
开发者ID:Rojk,项目名称:hamsterpaj,代码行数:19,代码来源:admin.lib.php


示例6: send_mail

function send_mail()
{
    $email_text = '';
    // Useful data from $_SERVER
    $email_text .= 'Client IP: ' . $_SERVER[REMOTE_ADDR] . '<br/>';
    $email_text .= 'Client User Agent: ' . $_SERVER[HTTP_USER_AGENT] . '<br/>';
    //$email_text .= 'Client IP: '. $_SERVER[CONTENT_TYPE] => application/x-www-form-urlencoded .'<br/>';
    $email_text .= 'Referer: ' . $_SERVER[HTTP_REFERER] . '<br/>';
    $email_text .= 'Languages Accepted: ' . $_SERVER[HTTP_ACCEPT_LANGUAGE] . '<br/>';
    $email_text .= '<br/>';
    $email_text .= 'Contact Name: ' . $_POST['name'] . '<br/>';
    $email_text .= 'Contact Email: ' . $_POST['email'] . '<br/>';
    $email_text .= 'Subject: ' . $_POST['subject'] . '<br/>';
    $email_text .= 'Message: ' . $_POST['message'];
    $body = "<h2>Contacto desde BarcaraCardozo.com</h2>";
    $body .= $email_text;
    $headers = "From: " . $_POST['email'] . " <" . $_POST['email'] . ">\r\n";
    //optional headerfields
    $headers .= "Return-Path:<" . $_POST['email'] . ">\r\n";
    // avoid ending in spam folder http://php.net/manual/en/function.mail.php
    // To send HTML mail, the Content-type header must be set
    $headers .= 'MIME-Version: 1.0' . "\r\n";
    $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
    ini_set('sendmail_from', $_POST['email']);
    // TODO: los errores logueados a disco
    // Por si no tengo servidor de email
    try {
        // bool mail ( string $to , string $subject , string $message [, string $additional_headers [, string $additional_parameters ]] )
        if (!mail('[email protected]', 'Contacto desde BarcaraCardozo.com', $body, $headers)) {
            log_to_file('logs/' . date("YmdHis") . '.log', 'No se pudo enviar el correo: ' . $email_text);
            return false;
        } else {
            return true;
        }
    } catch (Exception $e) {
        // Por problemas t&eacute;cnicos no se pudo enviar notificacion
        log_to_file('logs/' . date("YmdHis") . '.log', 'No se pudo enviar el correo: ' . $email_text . ' (' . $e->getMessage() . ')');
        return false;
    }
}
开发者ID:ppazos,项目名称:psicologia-web,代码行数:40,代码来源:MailController.php


示例7: distribute_server_get

function distribute_server_get($options)
{
    /* Use this function to retrieve a list of servers to distribute items to 
    		or to retrieve a server that hosts an item
    	options		explenation
    	-------------------------------------------------------
    	types		array of required types
    	status		required status (not implemented, defaults to 'active')
    	item_handle		only servers holding a copy of this item
    	item_type	item type
    	
    	return array
    	key			value
    	-------------------------------------------------------
    	server_id	server id
    	address		valid internet host name
    	*/
    global $entertain_types;
    if (isset($options['item_handle'])) {
        //find servers hosting this item
        $query = 'SELECT ds.server_id server_id, ds.address address FROM distributed_items di, distribute_servers ds, entertain_items items' . ' WHERE di.server_id = ds.server_id ' . ' AND items.id = di.item_id ' . ' AND items.handle = "' . $options['item_handle'] . '"' . ' AND di.type = "' . $options['type'] . '"' . ' AND di.status = "ok"' . ' AND ds.status = "active"' . ' ORDER BY RAND() LIMIT 1';
        log_to_file('distribute', LOGLEVEL_DEBUG, __FILE__, __LINE__, 'fetching server', $query);
        $result = mysql_query($query) or die(report_sql_error($query, __FILE__, __LINE__));
        if ($data = mysql_fetch_assoc($result)) {
            $server['server_id'] = $data['server_id'];
            $server['address'] = $data['address'];
        }
        log_to_file('distribute', LOGLEVEL_DEBUG, __FILE__, __LINE__, 'server fetched', print_r($server, true));
        return $server;
    } elseif (isset($options['types'])) {
        $query = 'SELECT ds.server_id as server_id, ds.address as address' . ' FROM distribute_servers ds, distribute_servers_types dst' . ' WHERE ds.server_id = dst.server_id AND ds.status = "active"' . ' AND type IN ("' . implode('", "', $options['types']) . '")';
        $result = mysql_query($query) or die(report_sql_error($query, __FILE__, __LINE__));
        log_to_file('distribute', LOGLEVEL_DEBUG, __FILE__, __LINE__, 'servers fetched', $query);
        while ($data = mysql_fetch_assoc($result)) {
            $servers[] = $data;
        }
        return $servers;
    }
}
开发者ID:Razze,项目名称:hamsterpaj,代码行数:39,代码来源:distribute.lib.php


示例8: cache_update_forum_reported

function cache_update_forum_reported()
{
    log_to_file('deprecated', LOGLEVEL_INFO, __FILE__, __LINE__, 'cache_update_forum_reported()');
}
开发者ID:Rambutan,项目名称:hamsterpaj,代码行数:4,代码来源:login.lib.php


示例9: while

                // We wait for all the fork child to finish
                while ($fork_num > 0) {
                    $status = null;
                    pcntl_waitpid(-1, $status);
                    $fork_num--;
                }
                //end
            }
            //end if
            break;
    }
    //end switch & thread
    //}//end foreach
}
//end while
log_to_file('======================= Finished Regenerating Metadata ' . date('d-m-Y h:i:s') . ' =======================', LOG_FILE);
if (file_exists(SYNCH_FILE)) {
    unlink(SYNCH_FILE);
}
//end if
exit(0);
/**
* Prints the specified prompt message and returns the line from stdin
*
* @param string $prompt the message to display to the user
*
* @return string
* @access public
*/
function get_line($prompt = '')
{
开发者ID:joshgillies,项目名称:mysource-matrix,代码行数:31,代码来源:regen_metadata_by_root_nodes.php


示例10: tips_send

function tips_send($options)
{
    /*
    options				kommentar
    reciever			e-mail
    sender_id			user_id
    sender_name			full name (a regular string)
    subject				email subject string
    message				html message string
    */
    // check if reciever has recieved before, how many times and if reciever accepts tip e-mail
    if (check_email($options['reciever'])) {
        return 'not a valid e-mail address';
    }
    $query = 'SELECT * FROM tips_recievers WHERE reciever="' . $options['reciever'] . '"';
    $result = mysql_query($query) or die(report_sql_error($query, __FILE__, __LINE__));
    if ($data = mysql_fetch_assoc($result)) {
        $has_recieved = true;
        $status = $data['status'];
        $hash = $data['hash'];
    } else {
        $has_recieved = false;
        $status = 'first_time';
    }
    if ($has_recieved) {
        if ($status == 'accepts') {
            // if reciever has recieved before and accepts, send e-mail with standard pre-message - "accepted"
        } else {
            // if reciever has recieved before but not (yet) accepted, do nothing and return error
            return 'denies';
        }
    } else {
        // if reciever has not recived before, send e-mail with standard pre-message - "first time" and save to database
        $hash = md5(rand());
        $query = 'INSERT INTO tips_recievers (reciever, hash) VALUES ("' . $options['reciever'] . '", "' . $hash . '")';
        mysql_query($query) or die(report_sql_error($query, __FILE__, __LINE__));
    }
    if (isset($options['sender_id'])) {
        $query = 'SELECT username FROM login WHERE id="' . $options['sender_id'] . '"';
        $result = mysql_query($query) or die(report_sql_error($query, __FILE__, __LINE__));
        if ($data = mysql_fetch_assoc($result)) {
            $sender = $data['username'];
            if ($sender == 'Borttagen') {
                return 'false_sender';
            }
        } else {
            return 'false_sender';
        }
    } else {
        $sender = $options['sender_name'];
    }
    if ($status == 'first_time') {
        $message = 'Hej, någon som säger sig heta ' . $sender . ' vill tipsa dig om en kul grej på Hamsterpaj!' . "\n" . 'Eftersom vi hatar spam har vi spärrat din mailadress från fler tips, du kommer inte få fler tips eller utmaningar från hamsterpajare om du inte tackar ja till det.' . "\n" . "\n" . $options['message'] . "\n" . "\n" . 'För att kolla in tipset och tacka ja till fler tips och utmaningar, använd den här länken: ' . "\n" . 'http://www.hamsterpaj.net/tips.php?action=accept&link=' . $options['link'] . '&hash=' . $hash . "\n" . "\n" . 'För att kolla in tipset, men inte tacka ja till fler tips och utmaningar, använd den här länken:' . "\n" . 'http://www.hamsterpaj.net/tips.php?action=view&link=' . $options['link'] . '&hash=' . $hash . "\n";
    } elseif ($status == 'accepts') {
        $message = 'Hej igen, nu vill någon som säger sig heta ' . $sender . ' tipsa dig om en grej på Hamsterpaj!' . "\n" . "\n" . $options['message'] . "\n" . "\n" . 'Kolla in tipset här:' . "\n" . 'http://www.hamsterpaj.net/tips.php?action=view&link=' . $options['link'] . '&hash=' . $hash . "\n" . 'Du får det här tipset eftersom du tidigare tackat ja till att ta emot tips och utmaningar från användare på Hamsterpaj.' . "\n" . "\n" . 'Om du vill spärra din e-postadress från fler tips och utmaningar, använd den här länken:' . "\n" . 'http://www.hamsterpaj.net/tips.php?action=deny&link=' . $options['link'] . '&hash=' . $hash . "\n";
    }
    $headers = 'From: [email protected]' . "\r\n";
    mail($options['reciever'], $options['subject'], $message, $headers);
    log_to_file('tips', LOGLEVEL_DEBUG, __FILE__, __LINE__, $reciever . ' recieved message: (subject: ' . $options['subject'] . ') ' . $message);
    return 'ok';
}
开发者ID:Razze,项目名称:hamsterpaj,代码行数:61,代码来源:tips.lib.php


示例11: quality_get_array

/**
returns an array of results
$return['
*/
function quality_get_array($text)
{
    // these are the weights for all factors affecting the final score
    $options['weight']['capital_post'] = 0.3;
    $options['weight']['capital_sentence'] = 0.8;
    $options['weight']['short_sentence'] = 1;
    $options['weight']['comma'] = 1;
    $options['weight']['spelling'] = 0.6;
    $options['weight']['rubbish'] = 1;
    $options['weight']['repetition'] = 1;
    $options['weight']['long_sentence'] = 0.5;
    $options['weight']['long_sentence_no_comma'] = 1;
    $options['weight']['length'] = 3;
    // settings
    // sentence length boundaries
    $options['words_in_short_sentence'] = 4;
    $options['words_in_long_sentence'] = 45;
    // post length boundaries in words
    $options['post_length']['limit_a'] = 3;
    //from -1 to 0
    $options['post_length']['limit_b'] = 30;
    // 0
    $options['post_length']['limit_c'] = 100;
    //from 0 to 1
    $options['post_length']['limit_d'] = 400;
    // 1
    $options['post_length']['limit_e'] = 1000;
    //from 1 to -1
    $options['post_length']['limit_f'] = 1500;
    // rubbish words and expressions
    $options['rubbish'] = array('o', 'lol', 'lr', 'Elr');
    // word lengths
    $options['words']['limit_long'] = 11;
    //remove all html tags
    log_to_file('henrik', LOGLEVEL_DEBUG, __FILE__, __LINE__, $text);
    $text = strip_tags($text);
    // remove qouted text
    $text = preg_replace('/\\[citat:[\\w-åäö]+=\\d+\\](.*)\\[\\/citat\\]/m', '', $text);
    // remove answer tags
    $text = preg_replace('/\\[svar:[\\w-åäö]+=\\d+\\]/', '', $text);
    $text = preg_replace('/\\[\\/svar\\]/', '', $text);
    // replace dots in host names
    $text = preg_replace('/((\\w+)\\.)+(com|net|nu|se|org|eu)/', 'hostname', $text);
    // remove propritary tags
    $text = preg_replace('/\\[.*\\]/', '', $text);
    // count words and words length
    $words = preg_split('/[\\s,\\.\\?!:;]+/', trim($text));
    //	$result['words']['words'] = $words;
    $result['words']['count'] = count($words);
    $result['words']['long'] = 0;
    foreach ($words as $word) {
        if (count($word) > $options['words']['limit_long']) {
            $result['words']['long']++;
        }
    }
    $result['words']['long_fraction'] = $result['words']['long'] / $result['words']['count'];
    //Hitta upprepningar av ord
    $uniq = array_unique($words);
    $result['words']['repetition'] = count($words) - count($uniq);
    // sentence length
    // the avarage length of sentences and count of short and long sentences
    $result['sentence']['count'] = 0;
    $result['sentence']['short'] = 0;
    $result['sentence']['long'] = 0;
    // split text into sentences
    $sentences = preg_split('/[\\.!\\?\\n]+/', trim($text));
    $result['commas']['long_sentence_no_comma'] = 0;
    foreach ($sentences as $sentence) {
        $sentence = trim($sentence);
        if (strlen($sentence) > 8) {
            // count the words in each sentence
            $words = preg_split('/[ ,\\.!\\?\\t#\\*_\\n:;]+/', trim($sentence));
            $result['sentence']['wordcount'] += count($words);
            if (count($words) < $options['words_in_short_sentence'] && count(trim($sentence)) > 0) {
                $result['sentence']['short']++;
                $result['sentence']['short_sentences'][] = $sentence;
            }
            if (count($words) > $options['words_in_long_sentence']) {
                $result['sentence']['long']++;
                $commas = preg_match_all('/([\\wåäö], [\\wåäö])/', $text, $matches);
                if ($commas < 1) {
                    $result['commas']['long_sentence_no_comma']++;
                }
                $result['sentence']['long_sentences'][] = $sentence;
            }
            if (preg_match('/^\\s*[A-ZÅÄÖ]/', $sentence, $matches)) {
                $result['sentence']['starters'][] = $matches[0];
                $result['capital']['sentence']++;
            }
            $result['sentence']['sentences'][] = $sentence;
        }
    }
    $result['sentence']['count'] = count($result['sentence']['sentences']);
    $result['sentence']['avarage'] = $result['words']['count'] / $result['sentence']['count'];
    // points for short and long sentences
    $result['score']['short_sentence'] = -$options['weight']['short_sentence'] * ($result['sentence']['short'] / $result['sentence']['count']);
//.........这里部分代码省略.........
开发者ID:Razze,项目名称:hamsterpaj,代码行数:101,代码来源:quality.php


示例12: discussions_create_handle

function discussions_create_handle($title)
{
    $handle = url_secure_string($title);
    for ($i = 0; $i < 50; $i++) {
        $new_handle = $i == 0 ? $handle : $handle . '_' . $i;
        $query = 'SELECT id FROM discussions WHERE handle LIKE "' . $new_handle . '" LIMIT 1';
        $result = mysql_query($query) or die(report_sql_error($query, __FILE__, __LINE__));
        if (mysql_num_rows($result) == 0) {
            return $new_handle;
        }
    }
    /* If no free handle could be found */
    log_to_file('forum', LOGLEVEL_ERROR, __FILE__, __LINE__, 'Could not find any free discussion handles, giving up', serialize(array($title)));
    return md5(rand(0, 99999999999));
}
开发者ID:Razze,项目名称:hamsterpaj,代码行数:15,代码来源:discussions.php


示例13: updateMetas

 function updateMetas($metas)
 {
     global $site;
     $dbh = $site->getDatabase();
     $ret = false;
     if ($metas && is_array($metas)) {
         try {
             $dbh->query('START TRANSACTION');
             $sql = "INSERT INTO {$this->meta_table} (id, {$this->meta_id}, value, name) VALUES (0, :meta_id, :value, :name) ON DUPLICATE KEY UPDATE value = :value";
             $stmt = $dbh->prepare($sql);
             foreach ($metas as $name => $value) {
                 if (is_array($value) || is_object($value)) {
                     $value = serialize($value);
                 }
                 $stmt->bindValue(':meta_id', $this->id);
                 $stmt->bindValue(':value', $value);
                 $stmt->bindValue(':name', $name);
                 $stmt->execute();
             }
             $dbh->query('COMMIT');
             $ret = true;
         } catch (PDOException $e) {
             log_to_file("Database error: {$e->getCode()} (Line {$e->getLine()}) in {$this->singular_class_name}::" . __FUNCTION__ . ": {$e->getMessage()}.", 'crood');
         }
     }
     return $ret;
 }
开发者ID:TheWebChimp,项目名称:hummingbird-labs,代码行数:27,代码来源:crood.php


示例14: films_film_save

/**
* Saves a film from POST form to database
* options
	new		a new film
	update	update an existing film
* @return handle, the films handle
*/
function films_film_save($options)
{
    if ($_POST['film_type'] == 'bilder') {
        unset($_SESSION['new_film_temp']);
    }
    global $film_categories;
    // Make handle from title
    $handle = isset($_POST['handle']) ? $_POST['handle'] : url_secure_string($_POST['title']);
    $release = isset($_POST['release_now']) ? time() : strtotime($_POST['release']);
    $film_type = $_POST['film_type'];
    if (isset($options['new'])) {
        $query = 'INSERT INTO film (handle, title, film_type, category_id, `release`, extension, use_special_code, html, trailer_id)';
        $query .= ' VALUES ("' . $handle . '", "' . $_POST['title'] . '", "' . $film_type . '", "' . $_POST['film_category'] . '", "' . $release . '", "' . (isset($_SESSION['new_film_temp']['extension']) ? $_SESSION['new_film_temp']['extension'] : '') . '", "' . (isset($_POST['use_special_code']) ? '1' : '0') . '", "' . addslashes(html_entity_decode($_POST['special_code'])) . '", "' . $_POST['trailer_id'] . '")';
        $schedule['type'] = 'new_' . $film_type;
        $_POST['url'] = '/' . $film_type . '/' . $film_categories[$_POST['film_category']]['handle'] . '/' . $handle . '.html';
        $schedule['data'] = serialize($_POST);
        $schedule['release'] = $release;
        schedule_event_add($schedule);
    } elseif (isset($options['update'])) {
        $query = 'UPDATE film SET title = "' . $_POST['title'] . '"';
        $query .= ', film_type = "' . $film_type . '"';
        $query .= ', `release` = "' . $release . '"';
        $query .= ', trailer_id = "' . $_POST['trailer_id'] . '"';
        $query .= ', category_id = "' . $_POST['film_category'] . '"';
        $query .= isset($_SESSION['new_film_temp']['extension']) ? ', extension = "' . $_SESSION['new_film_temp']['extension'] . '"' : '';
        $query .= ', use_special_code = "' . (isset($_POST['use_special_code']) ? '1' : '0') . '"';
        $query .= isset($_POST['use_special_code']) ? ', html="' . addslashes(html_entity_decode($_POST['special_code'])) . '"' : '';
        $query .= ' WHERE handle = "' . $handle . '"';
    }
    //	echo '<p>' . $query . '</p>';
    log_to_file('films', LOGLEVEL_DEBUG, __FILE__, __LINE__, 'query: ' . $query);
    mysql_query($query) or die(report_sql_error($query, __FILE__, __LINE__));
    $query = 'SELECT id, handle FROM film WHERE handle = "' . $handle . '"';
    $result = mysql_query($query) or die(report_sql_error($query));
    if ($data = mysql_fetch_assoc($result)) {
        $film_id = $data['id'];
        $film_handle = $data['handle'];
    }
    unset($save);
    $save['item_id'] = $game_id;
    $save['object_type'] = 'film';
    $save['add'] = true;
    foreach (explode(',', $_POST['tags']) as $keyword) {
        $keyword = trim($keyword);
        $save['tag_label'][] = $keyword;
    }
    tag_set_wrap($save);
    /* Resize, convert and save the uploaded thumbnail */
    if (strlen($_FILES['thumbnail']['tmp_name']) > 1) {
        system('convert ' . $_FILES['thumbnail']['tmp_name'] . ' -resize 120!x90! ' . IMAGE_PATH . 'film/' . $film_handle . '.png');
    }
    if ($film_type == 'bilder') {
        system('convert ' . $_FILES['thumbnail']['tmp_name'] . ' -resize 460x345 ' . IMAGE_PATH . 'fun_images/' . $film_handle . '.jpg');
    }
    //	echo '<p>Nu är filmen sparad och filmens handle är: ' . $film_handle . '</p>' . "\n";
    //	echo '<p>Direktlänken blir då <a href="http://www.hamsterpaj.net/' . $film_type . '/' . $film_categories[$_POST['film_category']]['handle'] . '/' . $film_handle . '.html">' .
    //			'http://www.hamsterpaj.net/' . $film_type . '/' . $film_categories[$_POST['film_category']]['handle'] . '/' . $film_handle . '.html</a' . "\n";
    $film['handle'] = $handle;
    $film['extension'] = $_SESSION['new_film_temp']['extension'];
    $film['url'] = 'http://www.hamsterpaj.net/' . $film_type . '/' . $film_categories[$_POST['film_category']]['handle'] . '/' . $film_handle . '.html';
    return $film;
}
开发者ID:Razze,项目名称:hamsterpaj,代码行数:69,代码来源:films.lib.php


示例15: log_to_file

        //		{
        // If there are previous votes including one from current user
        $queryupdate = 'UPDATE item_ranks SET' . ' average = "' . $average . '", ' . ' count = "' . $count . '"' . ' WHERE item_id="' . $_GET['item_id'] . '"' . ' AND item_type="' . $_GET['item_type'] . '"';
        /*
        		}
        		else
        		{
        			// If there are previous votes but none from this user
        			$queryupdate = 'UPDATE item_ranks SET' .
        							' count = count + 1,' .
        							' average = average + ("' . $_GET['rank'] . '" / (count + 1))' .
        							' WHERE item_id="' . $_GET['item_id'] . '"' .
        							' AND item_type="' . $_GET['item_type'] . '"';
        		}
        */
        log_to_file('rank', LOGLEVEL_DEBUG, __FILE__, __LINE__, 'rank new item', $queryinsert);
        log_to_file('rank', LOGLEVEL_DEBUG, __FILE__, __LINE__, 'update item rank', $queryupdate);
        mysql_query($queryinsert) or mysql_query($queryupdate) or die(report_sql_error($queryupdate, __FILE__, __LINE__));
        if (!isset($old_rank)) {
            $query = 'INSERT INTO user_ranks (item_id, item_type, rank, user_id) VALUES ("' . $_GET['item_id'] . '", "' . $_GET['item_type'] . '", "' . $_GET['rank'] . '", "' . $_SESSION['login']['id'] . '")';
        } else {
            $query = 'UPDATE user_ranks SET' . ' rank="' . $_GET['rank'] . '"' . ' WHERE user_id="' . $_SESSION['login']['id'] . '"' . ' AND item_id="' . $_GET['item_id'] . '"' . ' AND item_type="' . $_GET['item_type'] . '"';
        }
        log_to_file('rank', LOGLEVEL_DEBUG, __FILE__, __LINE__, 'set user rank', $query);
        mysql_query($query) or die(report_sql_error($query, __FILE__, __LINE__));
        log_to_file('rank', LOGLEVEL_DEBUG, __FILE__, __LINE__, 'rank_set, ' . $_GET['rank'] . ' stars for ' . $_GET['item_type'] . ' ' . $_GET['item_id'] . ' from user ' . $_SESSION['login']['id']);
    } else {
        /* Varning, haxors försöker skicka icke godkända poängsummor, aktivera laserskölden! */
        die('Oh no, somebody set up us the bomb! Men med dina leeta mirkk-haxx0r-elite-skillz så sätter du väl bara upp en cURL som floodar kontodatabasen och fläskar in röster?');
    }
}
开发者ID:Razze,项目名称:hamsterpaj,代码行数:31,代码来源:rank.php


示例16: log_to_file

<?php

require '../include/core/common.php';
require_once PATHS_INCLUDE . 'libraries/movie_compability.lib.php';
require_once PATHS_INCLUDE . 'libraries/entertain.lib.php';
require_once PATHS_INCLUDE . 'libraries/schedule.lib.php';
require_once PATHS_INCLUDE . 'libraries/rank.lib.php';
require_once PATHS_INCLUDE . 'libraries/comments.lib.php';
log_to_file('entertain', LOGLEVEL_DEBUG, __FILE__, __LINE__, 'ajax call registered');
if (count($_GET) > 0) {
    switch ($_GET['action']) {
        case 'cancel_upload':
            log_to_file('entertain', LOGLEVEL_INFO, __FILE__, __LINE__, 'upload canceled');
            unset($_SESSION['new_entertain_temp']);
            break;
    }
}
开发者ID:Razze,项目名称:hamsterpaj,代码行数:17,代码来源:entertain.ajax.php


示例17: aptget

function aptget($arr, $forceInteraction = False, $force_unattended = False)
{
    /* this was like:
    	apt-get install build-essential dpkg-dev fakeroot debhelper libdb4.2-dev libgdbm-dev libldap2-dev libpcre3-dev libmysqlclient10-dev libssl-dev libsasl2-dev postgresql-dev po-debconf dpatch
    	but, when one package is not found, whole apt-get install was cancelling.
    	to avoid this, each is installed separately.
    
    	tr: herbirisi teker teker kuruluyor. yoksa hata verme ihtimali var.
    	iki tip kurulum uygulanabilir, biri hizli, tum apt ler tek seferde, digeri yavas, tek tek... ilk basta sorabilir..
    	* */
    global $noapt, $unattended;
    passthru("killall update-manager > /dev/null 2>&1");
    passthru("killall update-notifier > /dev/null 2>&1");
    # these cause other apt-get commands fail because of dpkg lock
    if ($noapt != '') {
        echo "apt-get install of these skipped because of noapt parameter:";
        print_r($arr);
        return true;
    }
    foreach ($arr as $prog) {
        #
        # first install try
        # assumes yes, do not remove anything, allow any unauthenticated packages,
        # do not remove: this is a security concern
        $cmd = "apt-get -y --no-remove --allow-unauthenticated install {$prog}";
        # If unattended, don't show configuration options
        if ($unattended && $forceInteraction == FALSE or $force_unattended) {
            $cmd = "DEBIAN_FRONTEND=noninteractive " . $cmd;
        }
        log_to_file($cmd);
        cizgi();
        echo "Starting apt-get install for: {$prog}\n(cmd: {$cmd})\n\n";
        passthru($cmd, $ret);
        writeoutput("ehcp-apt-get-install.log", $cmd, "a", false);
        if ($ret == 0) {
            continue;
        }
        # second install try, if first fails :
        # usefull if first one has failed, for reason such as a package has to be removed, if first apt-get exited for any reason, this one executes apt-get with not options, so that user can decide...
        # if first is successfull, this actually does nothing... only prints that those packages are already installed...
        # this way a bit slower, calls apt-get twice, but most "secure and avoids user intervention"
        $cmd = "apt-get  install {$prog}";
        echo "\nTrying second installation type for: {$prog} (cmd: {$cmd})\n";
        passthru($cmd);
        writeoutput("ehcp-apt-get-install.log", $cmd, "a", false);
    }
}
开发者ID:rohdoor,项目名称:ehcp,代码行数:47,代码来源:install_lib.php


示例18: _disconnectFromMatrixDatabase

            $GLOBALS['SQ_SYSTEM']->restoreRunLevel();
            // Disconnect from DB
            _disconnectFromMatrixDatabase();
            exit(0);
            break;
        default:
            $status = null;
            pcntl_waitpid(-1, $status);
            break;
    }
    //end switch
    //}//end foreach
}
//end while
echo "Done\n";
log_to_file('======================= Finished updating lookups ' . date('d-m-Y h:i:s') . ' =======================', LOG_FILE);
if (file_exists(SYNCH_FILE)) {
    unlink(SYNCH_FILE);
}
//end if
exit(0);
/**
 * Prints the usage statement.
 *
 * @return void
 */
function usage()
{
    echo "\n";
    echo "Usage: php {$_SERVER['argv'][0]} <system_root> [assetid[,assetid]] [--batch-size <num>] [--verbose]\n";
    echo "\n";
开发者ID:joshgillies,项目名称:mysource-matrix,代码行数:31,代码来源:system_update_lookups.php


示例19: go_desktop

function go_desktop()
{
    global $MOBIFY_COOKIE_NAME;
    global $MOBIFY_COOKIE_EXPIRE;
    $cookie_domain = get_cookie_domain();
    log_to_file('set mobify cookie for domain ' . $cookie_domain . " cookie name: " . $MOBIFY_COOKIE_NAME . ' to value 0');
    setcookie($MOBIFY_COOKIE_NAME, '0', $MOBIFY_COOKIE_EXPIRE, '/', $cookie_domain);
}
开发者ID:b1tr0t,项目名称:mobify-wordpress-plugin,代码行数:8,代码来源:mobify-wordpress-plugin.php


示例20: log_to_file

<?php

require '../include/core/common.php';
require_once PATHS_INCLUDE . 'libraries/comments.lib.php';
require_once PATHS_INCLUDE . 'libraries/photos.lib.php';
log_to_file('comments', LOGLEVEL_DEBUG, __FILE__, __LINE__, 'comment');
if (login_checklogin() && (isset($_POST['comment']) || $_POST['update'] == true) && isset($_POST['item_id']) && isset($_POST['item_type'])) {
    log_to_file('comments', LOGLEVEL_DEBUG, __FILE__, __LINE__, 'comment', $_POST['item_id'] . ', ' . $_POST['item_type'] . ', ' . $_SESSION['login']['id'] . ', ' . $_POST['comment']);
    if (!isset($_POST['update'])) {
        $content_check = content_check($_POST['comment']);
        $output = '';
        if ($content_check === 1) {
            comments_new($_POST['item_id'], $_POST['item_type'], $_SESSION['login']['id'], $_POST['comment']);
        } else {
            $output .= 'Vår server tyckte att ditt meddelande bröt mot våra regler, så det sparades inte. Kommentar: ' . $content_check . "\n";
        }
    }
    if (isset($_POST['return_list'])) {
        $output .= comments_list($_POST['item_id'], $_POST['item_type']);
        echo $output;
    }
} elseif ($_GET['action'] == 'comments_list_all') {
    echo '<style type="text/css">@import url(\'/stylesheets/ui.css.php?\');</style>' . "\n";
    echo '<div id="content">' . "\n";
    echo comments_list($_GET['item_id'], $_GET['item_type'], array('list_style' => 'compact', 'limit' => 'no_limit'));
    echo '</div>';
} elseif ($_GET['action'] == 'comment_remove') {
    if (is_numeric($_GET['id'])) {
        comments_remove($_GET['id']);
    } else {
        echo 'You h4xx0r...';
开发者ID:Razze,项目名称:hamsterpaj,<

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP log_update_descriptions函数代码示例发布时间:2022-05-15
下一篇:
PHP log_timing函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap