コード例 #1
0
            $modified_userid = $fetch_modified_user['user_id'];
        }
        $iDropletIdKey = $aDroplets['id'];
        $iDropletIdKey = $admin->getIDKEY($aDroplets['id']);
        $comments = '';
        //        $comments = str_replace(array("\r\n", "\n", "\r"), '<br >', $aDroplets['comments']);
        if (!strpos($comments, "[[")) {
            $comments = "Use: [[" . $aDroplets['name'] . "]]<br />" . $comments;
        }
        $comments = str_replace(array("[[", "]]"), array('<b>[[', ']]</b>'), $comments);
        $valid_code = true;
        $valid_code = check_syntax($aDroplets['code']);
        if (!$valid_code === true) {
            $comments = '<span color=\'red\'><strong>' . $DR_TEXT['INVALIDCODE'] . '</strong></span><br />' . $comments;
        }
        $unique_droplet = check_unique($aDroplets['name']);
        if ($unique_droplet === false) {
            $comments = '<span color=\'red\'><strong>' . $DR_TEXT['NOTUNIQUE'] . '</strong></span><br />' . $comments;
        }
        //        $comments = '<span>'.$comments.'</span>';
        ?>
<tr >
            <td >
               <input type="checkbox" name="cb[<?php 
        echo $aDroplets['id'];
        ?>
]" id="L<?php 
        echo $aDroplets['id'];
        ?>
cb" value="<?php 
        echo $aDroplets['name'];
コード例 #2
0
            $modified_user = $fetch_modified_user['username'];
            $modified_userid = $fetch_modified_user['user_id'];
        } else {
            $modified_user = $TEXT['UNKNOWN'];
            $modified_userid = 0;
        }
        $comments = str_replace(array("\r\n", "\n", "\r"), '<br />', $droplet['comments']);
        if (!strpos($comments, "[[")) {
            $comments = "Use: [[" . $droplet['name'] . "]]<br />" . $comments;
        }
        $comments = str_replace(array("[[", "]]"), array('<b>[[', ']]</b>'), $comments);
        $valid_code = check_syntax($droplet['code']);
        if (!$valid_code === true) {
            $comments = '<font color=\'red\'><strong>' . $DR_TEXT['INVALIDCODE'] . '</strong></font><br /><br />' . $comments;
        }
        $unique_droplet = check_unique($droplet['name']);
        if ($unique_droplet === false) {
            $comments = '<font color=\'red\'><strong>' . $DR_TEXT['NOTUNIQUE'] . '</strong></font><br /><br />' . $comments;
        }
        $comments = '<span>' . $comments . '</span>';
        $id = $droplet['id'];
        if (version_compare(WB_VERSION, '2.8.2', '>=') && WB_VERSION != "2.8.x") {
            $id = $admin->getIDKEY($id);
        }
        ?>
		
		<tr class="row_<?php 
        echo $row;
        ?>
" >
			<td<?php 
コード例 #3
0
 $insert_article_intro = mysql_escape_string(strip_tags($article_intro, '<p><a><img><h1><h2><h3><h4><strong><ul><ol><li><table><td><tr><tbody>'));
 $insert_article_content = mysql_escape_string(strip_tags($article_content, '<p><em><a><img><h1><h2><h3><h4><strong><ul><ol><li><table><td><tr><tbody>'));
 $insert_article_sector = mysql_escape_string($article_sector);
 $insert_article_category = mysql_escape_string($article_category);
 $insert_article_img = mysql_escape_string($article_img);
 $new_article_slug = $article_slug;
 $get_orig_slug = mysql_query("SELECT article_slug FROM articles WHERE article_id='{$article_id}'");
 if ($get_orig_slug == $new_article_slug) {
     function check_unique($article_slug)
     {
         $get_slugs = mysql_query("SELECT article_slug FROM articles WHERE article_slug='{$article_slug}'");
         return mysql_num_rows($get_slugs);
     }
     $x = 2;
     do {
         $is_unique = check_unique($new_article_slug);
         if ($is_unique != 0) {
             $new_article_slug = $article_slug . "_" . $x;
             $x++;
         }
     } while ($is_unique != 0);
     $insert_article_slug = mysql_escape_string($new_article_slug);
 } else {
     $insert_article_slug = mysql_escape_string($get_orig_slug);
 }
 $insert_article_hide = mysql_escape_string($article_hide);
 /*$insert_article_slug = mysql_escape_string($article_slug);
 		$insert_article_hide = mysql_escape_string($article_hide);*/
 /*echo $insert_article_meta_desc;
 		echo "<br />";
 		echo $insert_article_meta_keyw;
コード例 #4
0
function validate_unique($value, $empty, &$params, &$form)
{
    return check_unique($params['field2'], $params['field'], $value, $params['field3'], $params['field4'], $form[$params['field4']], $params['field5'], $params['field6']);
}
コード例 #5
0
ファイル: rename_ripped.php プロジェクト: nloyola/nlscripts
foreach ($files as $file) {
    if (strpos($file, ".mp3") === false) {
        continue;
    }
    $matches = array();
    if (preg_match('/^(\\d+)_(.*)$/', $file, $matches) === 1) {
        $match_offset = intval($matches[1]);
        if ($offset < $match_offset) {
            $offset = $match_offset;
            $numbered_found = true;
        }
        check_unique($matches[2]);
        echo "skipping {$file}\n";
        continue;
    }
    check_unique($file);
    $sorted_files[filemtime($file)] = array($file, date("F d Y H:i:s.", filemtime($file)));
}
ksort($sorted_files);
#print_r($sorted_files);
if ($numbered_found) {
    // numbered files already found
    ++$offset;
}
foreach ($sorted_files as $file) {
    $new_name = sprintf("%04d", $offset) . "_{$file['0']}";
    echo $file[0], ' -> ', $new_name, "\n";
    if (!$test) {
        rename($file[0], $new_name);
    }
    ++$offset;
コード例 #6
0
function add_link($cid, $link, $title = 'N/A', $desc = 'N/A', $status = '2')
{
    global $db, $tables;
    $data = array();
    $data['TITLE'] = $title;
    $data['DESCRIPTION'] = $desc;
    $data['CATEGORY_ID'] = $cid;
    $data['URL'] = $link;
    $data['RECPR_REQUIRED'] = 0;
    $data['STATUS'] = $status;
    $error = array();
    if (!check_unique('link', 'TITLE', $title, NULL, 'CATEGORY_ID', $cid)) {
        $error['TITLE'] = true;
    }
    if (ALLOW_MULTIPLE == 1) {
        $cu = check_unique('link', 'URL', $link, NULL, 'CATEGORY_ID', $cid);
    } else {
        $cu = check_unique('link', 'URL', $link, NULL);
    }
    if (!$cu) {
        $error['URL'] = true;
    }
    if (count($error) > 0) {
        $data['ERROR'] = $error;
        return $data;
    }
    $data['IPADDRESS'] = $client_info['IP'];
    if (!empty($client_info['HOSTNAME'])) {
        $data['DOMAIN'] = $client_info['HOSTNAME'];
    }
    $data['VALID'] = 1;
    $data['LAST_CHECKED'] = gmdate('Y-m-d H:i:s');
    $data['DATE_ADDED'] = gmdate('Y-m-d H:i:s');
    $data['DATE_MODIFIED'] = gmdate('Y-m-d H:i:s');
    if (strlen(trim($data['URL'])) > 0 && !preg_match('#^http[s]?:\\/\\/#i', $data['URL'])) {
        $data['URL'] = "http://" . $data['URL'];
    }
    if (ENABLE_PAGERANK) {
        require_once '../include/pagerank.php';
        $data['PAGERANK'] = get_page_rank($data['URL']);
    }
    $id = $db->GenID($tables['link']['name'] . '_SEQ');
    $data['ID'] = $id;
    if ($db->Replace($tables['link']['name'], $data, 'ID', true) == 0) {
        $error['SQL'] = true;
    }
    $data['ERROR'] = $error;
    return $data;
}