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

PHP generateId函数代码示例

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

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



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

示例1: DoUpload

function DoUpload($n, $p, $u, $i, $a, $m, $ai)
{
    $ret = "";
    $str = "";
    if ($m == 1) {
        // update
        $db = openConnection();
        $sql = "update root_tools_recommand set name='{$n}',icon_url='{$i}',download_url='{$a}' where package_name='{$p}'";
        $str = query($db, $sql);
        closeConnection($db);
    } else {
        // add
        $id = generateId("root_tools_recommand", "id");
        $db = openConnection();
        $sql = "insert into root_tools_recommand (id, name, package_name, main_activity, icon_url, download_url, unix_name, app_order) values ({$id}, '{$n}', '{$p}', 'null', '{$i}', '{$a}', '{$u}', 0)";
        $str = query($db, $sql);
        closeConnection($db);
    }
    if ($str == "0") {
        $ret = "1";
    } else {
        $ret = "0";
    }
    return $ret;
}
开发者ID:lasting-yang,项目名称:root-tools,代码行数:25,代码来源:upload.php


示例2: uploadImage

/**
 * Insert image data to database (recoreded_data and thumbnail).
 * First generate an unique image id, then insert image to recoreded_data and resized image to thubnail along with 
 *   other given data
 */
function uploadImage($conn, $sensor_id, $date_created, $description)
{
    $image_id = generateId($conn, "images");
    if ($image_id == 0) {
        return;
    }
    $image2 = file_get_contents($_FILES['file_image']['tmp_name']);
    $image2tmp = resizeImage($_FILES['file_image']);
    $image2Thumbnail = file_get_contents($image2tmp['tmp_name']);
    // encode the stream
    $image = base64_encode($image2);
    $imageThumbnail = base64_encode($image2Thumbnail);
    $sql = "INSERT INTO images (image_id, sensor_id, date_created, description, thumbnail, recoreded_data)\n                      VALUES(" . $image_id . ", " . $sensor_id . ", TO_DATE('" . $date_created . "', 'DD/MM/YYYY hh24:mi:ss'), '" . $description . "', empty_blob(), empty_blob())\n                       RETURNING thumbnail, recoreded_data INTO :thumbnail, :recoreded_data";
    $result = oci_parse($conn, $sql);
    $recoreded_dataBlob = oci_new_descriptor($conn, OCI_D_LOB);
    $thumbnailBlob = oci_new_descriptor($conn, OCI_D_LOB);
    oci_bind_by_name($result, ":recoreded_data", $recoreded_dataBlob, -1, OCI_B_BLOB);
    oci_bind_by_name($result, ":thumbnail", $thumbnailBlob, -1, OCI_B_BLOB);
    $res = oci_execute($result, OCI_DEFAULT) or die("Unable to execute query");
    if ($recoreded_dataBlob->save($image) && $thumbnailBlob->save($imageThumbnail)) {
        oci_commit($conn);
    } else {
        oci_rollback($conn);
    }
    oci_free_statement($result);
    $recoreded_dataBlob->free();
    $thumbnailBlob->free();
    echo "New image is added with image_id ->" . $image_id . "<br>";
}
开发者ID:ayunita,项目名称:OOSproject,代码行数:34,代码来源:datacuratorFunction.php


示例3: showPollOptions

function showPollOptions($options, $alreadyVoted, $totalVoted, $polid)
{
    if ($alreadyVoted) {
        $maxVoted = $totalVoted;
        foreach ($options as $optData) {
            $maxVoted = $optData["polOVotes"];
            break;
        }
        foreach ($options as $optData) {
            ?>
			<table cellspacing="0" cellpadding="0" border="0"><tr>
				<td class="wide">
					<?php 
            echo formatText($optData["polOOption"]);
            ?>
				</td>
				<td class="smalltext disable_wrapping" style="vertical-align: bottom">
					(<?php 
            echo fuzzy_number($optData["polOVotes"]);
            ?>
)
				</td>
			</tr></table>
			<?php 
            showPollBar($optData["polOVotes"], $maxVoted, $totalVoted);
        }
    } else {
        $options = array();
        $result2 = sql_query("SELECT * FROM `pollOptions` " . "WHERE `polOPoll` = '" . $polid . "' ORDER BY `polOid` LIMIT 20");
        while ($optData = mysql_fetch_assoc($result2)) {
            $options[$optData["polOid"]] = $optData;
        }
        foreach ($options as $optData) {
            ?>
			<div>
				<input class="checkbox" type="checkbox" id="<?php 
            echo $chkid = generateId();
            ?>
" name="option<?php 
            echo $optData["polOid"];
            ?>
" />
				<label for="<?php 
            echo $chkid;
            ?>
">
					<?php 
            echo formatText($optData["polOOption"]);
            ?>
				</label>
			</div>
			<?php 
        }
    }
}
开发者ID:brocococonut,项目名称:yGallery,代码行数:55,代码来源:polling.php


示例4: doLog

function doLog($d, $m, $o, $mail, $b, $action)
{
    $nid = generateId("root_tools_log", "id");
    date_default_timezone_set("Asia/Hong_Kong");
    $sql = "insert into root_tools_log values ('" . $nid . "', '" . $d . "', '" . $m . "', '" . $o . "', '" . $mail . "', '" . $b . "', '" . $action . "', '" . date("Y-m-d h:i a") . "')";
    $db = openConnection();
    $str = query($db, $sql);
    closeConnection($db);
    $str = "{\"result\":\"" . $str . "\"}";
    return $str;
}
开发者ID:lasting-yang,项目名称:root-tools,代码行数:11,代码来源:log.php


示例5: doLog

function doLog($d, $m, $o, $mail, $b, $comment, $app)
{
    $nid = generateId("root_tools_feedback", "id");
    date_default_timezone_set("Asia/Hong_Kong");
    $sql = "insert into root_tools_feedback(id,deviceId,module,os_version,mail,build_desc,comment,comment_time,app_version) values ('" . $nid . "', '" . $d . "', '" . $m . "', '" . $o . "', '" . $mail . "', '" . $b . "', '" . $comment . "', '" . date("Y-m-d h:i a") . "', '{$app}')";
    $db = openConnection();
    $str = query($db, $sql);
    closeConnection($db);
    $str = "{\"result\":\"" . $str . "\"}";
    return $str;
}
开发者ID:lasting-yang,项目名称:root-tools,代码行数:11,代码来源:user_feedback.php


示例6: doLog

function doLog($d, $m, $o, $mail, $b, $crash, $a)
{
    $nid = generateId("root_tools_crash", "id");
    date_default_timezone_set("Asia/Hong_Kong");
    $sql = "insert into root_tools_crash values ('{$nid}', '{$d}', '{$m}', '{$o}', '{$mail}', '{$b}', '{$crash}', '" . date("Y-m-d h:i a") . "', '{$a}')";
    $db = openConnection();
    $str = query($db, $sql);
    closeConnection($db);
    $str = "{\"result\":\"" . $str . "\"}";
    return $str;
}
开发者ID:lasting-yang,项目名称:root-tools,代码行数:11,代码来源:crash.php


示例7: generateId

function generateId()
{
    $ci =& get_instance();
    $ci->load->database();
    $id = rand(1, 999);
    $query = $ci->db->query("select * from berita where id_berita='{$id}'");
    if ($query->num_rows > 1) {
        generateId();
    } else {
        return $id;
    }
}
开发者ID:Pasukan-MI,项目名称:ecommerce,代码行数:12,代码来源:fungsi_helper.php


示例8: generateFlipBox

function generateFlipBox($atts, $content = null)
{
    $effects = array('right' => array('my-page-item-right', 'back-side-item-right'), 'left' => array('my-page-item-left', 'back-side-item-left'), 'up' => array('my-page-item-up', 'back-side-item-up'), 'down' => array('my-page-item-down', 'back-side-item-down'));
    extract(shortcode_atts(array('style' => 'style1', 'id' => 0, 'content' => '', 'font_color' => '', 'effect' => 'right', 'title' => '', 'front_content' => '', 'back_title' => '', 'back_content' => '', 'link_text' => '', 'link' => '', 'color_front' => '', 'color_back' => '', 'border_color_front' => '', 'border_color_back' => '', 'front_text_color' => '', 'back_text_color' => '', 'circle_color' => '', 'link_color' => '', 'link_text_color' => ''), $atts));
    $postId = 0;
    if ($id != 0) {
        $imgObj = wp_get_attachment_image_src($id, 'full');
        // var_dump($imgObj);
        $imgSrc = $imgObj[0];
    } else {
        $imgSrc = '' . plugins_url() . '/motoPostStyler/img/xparty1.png.pagespeed.ic.UyqFIK62E3.webp';
    }
    $flipBoxStructure = new FlipBoxStructure();
    $chosenEffect = $effects[$effect];
    $arguments = array('style' => $style, 'imgSrc' => $imgSrc, 'content' => $content, 'font_color' => $font_color, 'effect' => $chosenEffect, 'title' => $title, 'front_content' => $front_content, 'back_title' => $back_title, 'back_content' => $back_content, 'link_text' => $link_text, 'link' => $link, 'color_front' => $color_front, 'color_back' => $color_back, 'border_color_front' => $border_color_front, 'border_color_back' => $border_color_back, 'front_text_color' => $front_text_color, 'back_text_color' => $back_text_color, 'circle_color' => $circle_color, 'link_color' => $link_color, 'link_text_color' => $link_text_color);
    // var_dump($arguments['link_color']);
    $boxId = generateId($style, $content, $imgSrc, $color_front, $color_back, $font_color);
    return $flipBoxStructure->generateFlipBoxLayout($arguments, $boxId);
}
开发者ID:vova95,项目名称:motoWidget,代码行数:19,代码来源:FlipBoxCreator.php


示例9: save

 public function save()
 {
     $this->form_validation->set_rules('judul', 'Judul', 'trim|required|xss_clean');
     $this->form_validation->set_rules('editor1', 'Isi', 'trim|required|xss_clean');
     if ($this->form_validation->run() == false) {
         redirect('post/add');
     } else {
         if ($this->input->post('submit') == 'update') {
             $id = $this->input->post('id');
             $data = array('judul' => $this->input->post('judul'), 'isi_berita' => $this->input->post('editor1'), 'tanggal' => date('Y-m-d H:i:s'));
             $result = $this->M_post->update($data, $id);
         } elseif ($this->input->post('submit') == 'tambah') {
             $data = array('id_berita' => generateId(), 'judul' => $this->input->post('judul'), 'isi_berita' => $this->input->post('editor1'), 'tanggal' => date('Y-m-d H:i:s'));
             $result = $this->M_post->save($data);
         }
         if ($result) {
             redirect('post');
         }
     }
 }
开发者ID:Pasukan-MI,项目名称:ecommerce,代码行数:20,代码来源:c_post.php


示例10: doAddRecommand

function doAddRecommand($n, $jm, $ju, $jt, $img, $qr)
{
    $extend = get_extend($img["name"]);
    if ($extend === "") {
        return "0";
    }
    $filename = "file_" . date("YYmmddhhiiss") . "." . $extend;
    move_uploaded_file($img["tmp_name"], "./recommand/" . $filename);
    $qr_extend = get_extend($qr["name"]);
    $qr_filename = "";
    if ($qr_extend != "") {
        $qr_filename = "qr_" . date("YYmmddhhiiss") . "." . $qr_extend;
        move_uploaded_file($qr["tmp_name"], "./recommand/" . $qr_filename);
    }
    $id = generateId("yugioh_recommand", "id");
    $sql = "insert into yugioh_recommand (id,name,jump_mode,jump_url,jump_text,image_name,big_qr) values ({$id},'{$n}',{$jm},'{$ju}','{$jt}','{$filename}','{$qr_filename}')";
    $db = openConnection();
    $result = query($db, $sql);
    closeConnection($db);
    return $result;
}
开发者ID:lasting-yang,项目名称:root-tools,代码行数:21,代码来源:add_recommand.php


示例11: addTask

function addTask($name, $description = "")
{
    global $TASKS_DIR;
    if (!findTask($name)) {
        $id = generateId();
        $date = date("Y-m-d");
        $task = new stdClass();
        $task->id = $id;
        $task->nome = $name;
        $task->descricao = $description;
        $task->concluida = false;
        $task->criacao = $date;
        $task->modificada = $date;
        try {
            writeJson("{$TASKS_DIR}/{$id}.json", $task);
        } catch (Exception $e) {
            echo "Erro ao serializar";
            echo $e;
            return false;
        }
        return $task;
    }
    return false;
}
开发者ID:xlbruce,项目名称:GerenciadorDeTarefas,代码行数:24,代码来源:functions.php


示例12: pyBoxHandler

function pyBoxHandler($options, $content)
{
    //echo "PB[[[".$content."]]]";
    // given a shortcode, print out the html for the user,
    // and save the relevant grader options in a hash file.
    $id = generateId();
    if ($options == FALSE) {
        $options = array();
    }
    // wordpress does a weird thing where valueless
    for ($i = 0; array_key_exists($i, $options); $i++) {
        // attributes map like [0]=>'attname'.
        $options[$options[$i]] = "Y";
        // these lines change it to
        unset($options[$i]);
        // 'attname'=>'Y'
    }
    $shortcodeOptions = json_encode($options);
    // this will be put into DB.
    /// do some cleaning-up and preprocessing of options, and create the problem info for grader
    if (array_key_exists('translate', $options)) {
        $GLOBALS['pb_translation'] = $options['translate'];
    }
    if (array_key_exists('pyexample', $options)) {
        setSoft($options, 'grader', '*nograder*');
        setSoft($options, 'readonly', 'Y');
        setSoft($options, 'hideemptyinput', 'Y');
        unset($options['pyexample']);
    }
    if (array_key_exists('code', $options)) {
        // sugar: code is an alias for defaultcode
        $options["defaultcode"] = $options["code"];
        unset($options['code']);
    }
    $richreadonly = array_key_exists('richreadonly', $options);
    // sugar
    if ($richreadonly) {
        $options['readonly'] = "Y";
        unset($options['richreadonly']);
    }
    if (array_key_exists('nograder', $options)) {
        // syntactic sugar for nograder option
        if (array_key_exists('grader', $options)) {
            pyboxlog('Warning: grader overwritten with *nograder*');
        }
        $options["grader"] = "*nograder*";
        unset($options['nograder']);
    }
    foreach ($options as $optname => $optvalue) {
        // syntactic sugar for inplace grader
        if (preg_match('|tests|', $optname) > 0 || preg_match('|precode|', $optname) > 0) {
            $options["inplace"] = "Y";
        }
    }
    global $post, $lesson_reg_info;
    // $lessonNumber is numeric (major) part of lesson number
    // if lesson_reg_info is set we don't really care about displaying the pybox,
    // but we'll do things for consistency anyway. NB: when displaying a problem
    // in a place other than its original page (e.g., mail) this needs ot be fixed
    $post_title = isset($lesson_reg_info) ? get_the_title($lesson_reg_info['id']) : $post->post_name;
    if (preg_match('|^(\\d+).*|', $post_title, $matches) == 0) {
        $lessonNumber = -1;
    } else {
        $lessonNumber = $matches[1];
    }
    $inplace = booleanize(getSoft($options, 'inplace', 'N'));
    $scramble = booleanize(getSoft($options, 'scramble', 'N'));
    // important booleans used to determine
    $readonly = booleanize(getSoft($options, 'readonly', 'N'));
    // other options... get them first
    $showEditorToggle = booleanize(getSoft($options, 'showeditortoggle', 'N'));
    unset($options['scramble']);
    unset($options['readonly']);
    // don't extract() these!
    unset($options['inplace']);
    if ($inplace) {
        setSoft($options, 'hideemptyoutput', 'Y');
    }
    $defaultValues = array('defaultcode' => FALSE, 'autocommentline' => $lessonNumber > 3 && !($scramble || $readonly), 'console' => 'N', 'rows' => 10, 'allowinput' => $lessonNumber > 5 && !$scramble && !$readonly, 'disablericheditor' => ($lessonNumber > -1 && $lessonNumber < 7 || $scramble || $readonly) && !$richreadonly, 'usertni' => $inplace);
    foreach ($defaultValues as $key => $value) {
        if (!array_key_exists($key, $options)) {
            $options[$key] = $defaultValues[$key];
        }
    }
    extract($options);
    $allowinput = booleanize($allowinput);
    $disablericheditor = booleanize($disablericheditor);
    $console = booleanize($console);
    $autocommentline = booleanize($autocommentline);
    $usertni = booleanize($usertni);
    $facultative = isset($grader) && $grader == '*nograder*' || $console || $readonly;
    if ($scramble || $readonly) {
        $options['nolog'] = 'Y';
    }
    // for grader. note that if they are absent, their default values are 'N'
    if ($facultative) {
        $options['facultative'] = 'Y';
    } else {
        unset($options['facultative']);
    }
//.........这里部分代码省略.........
开发者ID:joostrijneveld,项目名称:cscircles-wp-content,代码行数:101,代码来源:shortcodes-exercises.php


示例13: showKeywordSubcat

function showKeywordSubcat($keywords, $parentId = 0, $parentKeyName = "", $parentLastKeyName = "")
{
    global $requiredTabs, $firstKeywordId, $isInHeader, $previousFullname;
    $noSubcats = true;
    foreach ($keywords as $keyData) {
        if (isset($keyData["subcats"])) {
            $noSubcats = false;
            break;
        }
    }
    if ($parentLastKeyName != "") {
        writeKeywordData(KWD_APP_HEADER, array("caption" => getKeywordCaption($parentLastKeyName)));
    }
    foreach ($keywords as $keyData) {
        $tabid = generateId("");
        $nonSelectable = preg_match('/\\@$/', $keyData["keyWord"]);
        $keyData["keyWord"] = preg_replace('/\\@$/', "", $keyData["keyWord"]);
        $keyWord = htmlspecialchars($keyData["keyWord"]);
        if (!$firstKeywordId && $isInHeader) {
            $firstKeywordId = "kwcache_tab" . $tabid;
        }
        $nameArr = preg_split('/\\"/', $parentKeyName . $keyWord, -1, PREG_SPLIT_NO_EMPTY);
        $fullname = "'";
        $first = true;
        foreach ($nameArr as $name1) {
            if ($name1 == $keyWord) {
                continue;
            }
            $fullname .= ($first ? "" : ",") . getKeywordCaption($name1);
            $first = false;
        }
        $fullname .= "'";
        /*
        if($fullname == $previousFullname)
        	$fullname = "";
        else
        	$previousFullname = $fullname;
        */
        $keywordSpace = $parentId != 0 && !$noSubcats ? 1 : 0;
        // If it contains sub-keywords, display as tab.
        if (isset($keyData["subcats"])) {
            $params = array("keyword_space" => $keywordSpace, "id" => $tabid, "group" => $parentId, "target" => $keyData["keyid"], "caption" => getKeywordCaption($keyWord, formatText($keyData["keyDesc"])));
            if (!($parentId != 0 && !$nonSelectable)) {
                // If it's a root keyword or it's set as non-selectable, display as
                // simple tab.
                writeKeywordData(KWD_APP_TAB, $params);
            } else {
                // Otherwise, display as tab with a selectable keyword inside.
                writeKeywordData(KWD_APP_KEYWORD_TAB, array_merge($params, array("fullname" => $fullname)));
            }
        } else {
            // Otherwise, display as simple selectable keyword.
            writeKeywordData(KWD_APP_KEYWORD, array("keyword_space" => $keywordSpace, "id" => $keyData["keyid"], "caption" => getKeywordCaption($keyWord, formatText($keyData["keyDesc"])), "fullname" => $fullname));
        }
    }
    writeKeywordData(KWD_APP_CLEAR);
    if ($isInHeader) {
        writeKeywordData(KWD_APP_SWITCH);
        $isInHeader = false;
    }
    foreach ($keywords as $keyData) {
        $keyData["keyWord"] = preg_replace('/\\@$/', "", $keyData["keyWord"]);
        unset($requiredTabs[$keyData["keyid"]]);
        if (isset($keyData["subcats"])) {
            writeKeywordData(KWD_APP_OPEN, array("id" => $keyData["keyid"]));
            if ($keyData["keySubcat"] != 0) {
                writeKeywordData(KWD_APP_HLINE);
            }
            showKeywordSubcat($keyData["subcats"], $keyData["keyid"], $parentKeyName . htmlspecialchars($keyData["keyWord"]) . '"', $parentId != 0 ? htmlspecialchars($keyData["keyWord"]) : "");
            writeKeywordData(KWD_APP_CLOSE);
        }
    }
}
开发者ID:brocococonut,项目名称:yGallery,代码行数:73,代码来源:mod_keywords_build.php


示例14: showKeywordSubcatEdit

function showKeywordSubcatEdit($keywords, $listId, $parentId = 0, $parentKeyName = "", $parentLastKeyName = "")
{
    global $requiredTabs, $firstKeywordId;
    $noSubcats = true;
    foreach ($keywords as $keyData) {
        if (isset($keyData["subcats"])) {
            $noSubcats = false;
            break;
        }
    }
    if ($parentId == 0) {
        ?>
		<div class="clear">&nbsp;</div>
		<div class="sep notsowide mar_left mar_bottom">
			Add more keyword groups to the Root separated by&nbsp;;
			<br />
			<input class="notsowide" name="addKeywordsUnder<?php 
        echo $parentId;
        ?>
" type="text" />
		</div>
		<?php 
    }
    foreach ($keywords as $keyData) {
        $tabid = generateId("kwcache_tab");
        $keyName = "&bull; " . $parentKeyName . $keyData["keyWord"];
        $nonSelectable = preg_match('/\\@$/', $keyData["keyWord"]);
        $keyData["keyWord"] = preg_replace('/\\@$/', "", $keyData["keyWord"]);
        ?>
		<div class="f_left">
			<div class="tab normaltext" id="<?php 
        echo $tabid;
        ?>
"
				onclick="open_tab(this,'keywords_<?php 
        echo $parentId;
        ?>
','keywordTab_<?php 
        echo $keyData["keyid"];
        ?>
')">

				<a href="<?php 
        echo url("keywords", array("delete" => $keyData["keyid"]));
        ?>
">
					<?php 
        echo getIMG(url() . "images/emoticons/keydelete.gif", 'alt="del" title="' . _KEYWORDS_DELETE . '" ' . 'onmouseout="this.style.background=\'none\'" ' . 'onmouseover="this.style.background=\'#fff\'"');
        ?>
				</a>
				<a href="<?php 
        echo url("keywords", array("edit" => $keyData["keyid"]));
        ?>
">
					<?php 
        echo getIMG(url() . "images/emoticons/keyedit.gif", 'alt="edit" title="' . _KEYWORDS_EDIT . '" ' . 'onmouseout="this.style.background=\'none\'" ' . 'onmouseover="this.style.background=\'#fff\'"');
        ?>
				</a>
				<?php 
        echo htmlspecialchars($keyData["keyWord"]);
        if ($nonSelectable) {
            echo "@";
        }
        ?>
			</div>
		</div>
		<?php 
    }
    ?>
	<div class="clear">&nbsp;</div>
	<?php 
    foreach ($keywords as $keyData) {
        $keyData["keyWord"] = preg_replace('/\\@$/', "", $keyData["keyWord"]);
        unset($requiredTabs[$keyData["keyid"]]);
        ?>
		<div style="display: none" id="keywordTab_<?php 
        echo $keyData["keyid"];
        ?>
">
			<?php 
        iefixStart();
        ?>
			<div class="hline">&nbsp;</div>
			<div class="hline">&nbsp;</div>
			<div class="sep notsowide_fix mar_left mar_bottom">
				Add more keywords to the group
				<b><?php 
        echo $parentKeyName . htmlspecialchars($keyData["keyWord"]);
        ?>
</b>
				separated by&nbsp;;
				<br />
				<input class="notsowide_fix" name="addKeywordsUnder<?php 
        echo $keyData["keyid"];
        ?>
" type="text" />
			</div>
			<div class="clear">&nbsp;</div>
			<?php 
        iefixEnd();
//.........这里部分代码省略.........
开发者ID:brocococonut,项目名称:yGallery,代码行数:101,代码来源:mod_keywords_edit.php


示例15: sql_query

							<?php 
        echo _ANIMATION;
        ?>
</a>
					</acronym>
					<?php 
        $first = false;
    }
    if (isLoggedIn() && !$isExtras && $useData["useid"] != $_auth["useid"]) {
        if (!$first) {
            echo " &middot; ";
        }
        $result = sql_query("SELECT `favObj` FROM `favourites` " . "WHERE `favObj` = '{$objid}' AND `favCreator` = '" . $_auth["useid"] . "' LIMIT 1");
        $faved = mysql_num_rows($result) > 0;
        $favId = generateId();
        $unfavId = generateId();
        $favScript = "add_operation( 'f{$objid}' ); " . "var el = get_by_id( '{$favId}' ); " . "if( el ) el.style.display = 'none'; " . "el = get_by_id( '{$unfavId}' ); " . "if( el ) el.style.display = 'inline'; " . "el = get_by_id( '{$favAddedId}' ); " . "if( el ) el.style.display = 'block'; " . "return false;";
        $unfavScript = "add_operation( 'fu{$objid}' ); " . "var el = get_by_id( '{$unfavId}' ); " . "if( el ) el.style.display = 'none'; " . "el = get_by_id( '{$favId}' ); " . "if( el ) el.style.display = 'inline'; " . "el = get_by_id( '{$favAddedId}' ); " . "if( el ) el.style.display = 'none'; " . "return false;";
        ?>
					<span id="<?php 
        echo $unfavId;
        ?>
" <?php 
        echo $faved ? "" : 'style="display: none"';
        ?>
>
						<acronym title="<?php 
        echo _FAV_REMOVE;
        ?>
">
							<a onclick="<?php 
开发者ID:brocococonut,项目名称:yGallery,代码行数:31,代码来源:p_view.php


示例16: ajax_saveLink

function ajax_saveLink($selector = 'new', $id1 = '', $id2 = '', $label = '', $what = '', $overwrite = TRUE)
{
    $resultText = '';
    $resultOK = '';
    $resultKO = '';
    $collection_id = explode('/', str_ireplace('xml://', '', $id1));
    $collection_id = $collection_id[0];
    if ($collection_id != '') {
        $thePath = DCTL_PROJECT_PATH . $collection_id . SYS_PATH_SEP;
        // $f = fopen('/tmp/diocaro.log', 'a');
        // fwrite($f, "------------------\n\n" . $thePath);
        switch ($what) {
            case 'lnk':
                $thePath .= DCTL_FILE_LINKER;
                break;
            case 'map':
                $thePath .= DCTL_FILE_MAPPER;
                break;
            default:
                $resultKO .= 'ERROR: CASE UNIMPLEMENTED IN ' . __FUNCTION__;
                break;
        }
        if (is_file($thePath)) {
            // fwrite($f, "------------------\n\n" . $thePath);
            switch ($selector) {
                case 'new':
                case 'add':
                case 'mod':
                case 'ovw':
                    $file_content = file_get_contents($thePath);
                    //fwrite($f, "--------1111111111----------\n\n");
                    $file_content = preg_replace('/' . WS . '+/', ' ', $file_content);
                    //fwrite($f, "------2222222222------------\n\n");
                    $text_head = substr($file_content, 0, stripos($file_content, '%BEGIN%')) . '%BEGIN% -->';
                    $text_foot = '<!-- ' . substr($file_content, stripos($file_content, '%END%'));
                    $dom = new DOMDocument('1.0', 'UTF-8');
                    $dom->preserveWhiteSpace = false;
                    forceUTF8($thePath);
                    if ($dom->load($thePath, DCTL_XML_LOADER)) {
                        $xpath = new DOMXPath($dom);
                        switch ($selector) {
                            case 'new':
                                $type = 'link';
                                $thisID = $collection_id . '-' . generateId();
                                $head = $label;
                                $query = 'id("placeholder")';
                                $entries = $xpath->query($query);
                                foreach ($entries as $entry) {
                                    $newNode = $dom->createElement('ref', $head);
                                    $newNode = $entry->parentNode->insertBefore($newNode, $entry);
                                    $newNode->setAttribute('xml:id', $thisID);
                                    $newNode->setAttribute('type', $type);
                                    $newNode->setAttribute('n', $label);
                                    $newNode->setAttribute('target', $id1 . ' ' . $id2);
                                    $newNode = $dom->createComment(' ');
                                    $newNode = $entry->parentNode->insertBefore($newNode, $entry);
                                }
                                break;
                            case 'add':
                                $query = 'id("' . $id2 . '")';
                                $entries = $xpath->query($query);
                                foreach ($entries as $entry) {
                                    $target = $entry->getAttribute('target');
                                    if (stripos($target, $id1) === FALSE) {
                                        $entry->setAttribute('target', $id1 . ' ' . $target);
                                    } else {
                                        $resultKO .= 'L\'ID "' . $id1 . '" è gia nel collegamento';
                                    }
                                }
                                break;
                            case 'mod':
                                $query = 'id("' . $id2 . '")';
                                $entries = $xpath->query($query);
                                foreach ($entries as $entry) {
                                    $entry->setAttribute('n', $label);
                                    if ((string) $entry->nodeValue == '') {
                                        $entry->nodeValue = $label;
                                    }
                                }
                                break;
                            case 'ovw':
                                //fwrite($f, "------ $query: pronti a morire? ------------ [[".memory_get_usage()."]]");
                                //fwrite($f, "------ 11 ?! ------------[".$entry->namespaceURI."]-- [[".memory_get_usage()."]]\n\n");
                                $entry = $dom->getElementById($id2);
                                //fwrite($f, "------ 22 ?! ------------ ".$entry->getAttribute('n')." > $label [[".memory_get_usage()."]]\n\n");
                                $entry->setAttribute('target', $id1);
                                //fwrite($f, "------ 33 ?! ------------[[".memory_get_usage()."]]\n\n");
                                if ($entry->getAttribute('n') != $label) {
                                    //fwrite($f, "------ 33 AA ?! ------(".$entry->getAttribute('n').")------[[".memory_get_usage()."]]\n\n");
                                    $entry->setAttributeNode(new DOMAttr('n', $label));
                                }
                                //fwrite($f, "------ 44 ?! ------------[[".memory_get_usage()."]]\n\n");
                                if ((string) $entry->nodeValue == '') {
                                    $entry->nodeValue = $label;
                                }
                                /*
                                                                $query = 'id("'.$id2.'")';
                                                                $entries = $xpath->query($query);
                                								foreach ($entries as $entry) {
                                									$entry->setAttribute('n', $label);
//.........这里部分代码省略.........
开发者ID:net7,项目名称:dCTL,代码行数:101,代码来源:functions.inc.php


示例17: showFileInputWithPreview

function showFileInputWithPreview($name, $tiledHName, $tiledVName, $tiledHChecked, $tiledVChecked)
{
    global $errors;
    $previewContainerId = generateId();
    $previewImageId = generateId();
    $previewMessageId = generateId();
    $tileHId = generateId();
    $tileVId = generateId();
    ?>
	<div>
		<input accept="image/jpeg"
		onchange="make_visible('<?php 
    echo $previewContainerId;
    ?>
'); show_preview_image('<?php 
    echo $previewImageId;
    ?>
', '<?php 
    echo $previewMessageId;
    ?>
', this.value)"
		name="<?php 
    echo $name;
    ?>
" size="60" type="file" />
		&nbsp;
		<input type="checkbox" class="checkbox" id="<?php 
    echo $tileHId;
    ?>
"
			<?php 
    echo $tiledHChecked ? 'checked="checked"' : "";
    ?>
 name="<?php 
    echo $tiledHName;
    ?>
" />
		<label title="Horizontal tiling" for="<?php 
    echo $tileHId;
    ?>
">H.Tiling</label>
		&nbsp;
		<input type="checkbox" class="checkbox" id="<?php 
    echo $tileVId;
    ?>
"
			<?php 
    echo $tiledVChecked ? 'checked="checked"' : "";
    ?>
 name="<?php 
    echo $tiledVName;
    ?>
" />
		<label title="Vertical tiling" for="<?php 
    echo $tileVId;
    ?>
">V.Tiling</label>
	</div>
	<?php 
    if (isset($errors[$name])) {
        notice($errors[$name]);
    }
    /*
    ?>
    <table><tr><td>
    <div style="display: none" id="<?= $previewContainerId ?>">
    	<div class="sep caption"><?= _PREVIEW ?>:</div>
    	<div class="container2 a_center">
    		<img alt="preview" style="display: none" id="<?= $previewImageId ?>" src="" />
    		<div id="<?= $previewMessageId ?>"><?= _SUBMIT_SELECT_FILE ?></div>
    	</div>
    </div>
    </td></tr></table>
    <?
    */
}
开发者ID:brocococonut,项目名称:yGallery,代码行数:76,代码来源:p_themedesigner.php


示例18: eLog

function eLog($action)
{
    global $valid_entry;
    global $commit;
    $elog_date = date("Y-m-d H:i:s");
    $elog_user = $_SESSION['EU_ID'];
    //START: Generate ID
    do {
        $generatedId = generateId();
        $sql_id = "SELECT * FROM `electro_log` WHERE ELOG_ID='" . $generatedId . "'";
        $query_id = mysql_query($sql_id);
        $rows = mysql_num_rows($query_id);
    } while ($rows);
    //END: Generate ID
    $sql_elog = "INSERT INTO `electro_log` VALUES ('{$generatedId}','{$elog_date}','{$elog_user}','{$action}')";
    $query_elog = mysql_query($sql_elog);
    if (!$query_elog) {
        $valid_entry = 0;
        $commit = "rollback";
    }
}
开发者ID:Jonur,项目名称:electro-CMS,代码行数:21,代码来源:functions.php


示例19: explode

     $pieces = explode(",", $line);
     echo "Size ->".count($pieces)."<br>";
     echo $pieces[0]."|".$pieces[1]."|".$pieces[2]."|".$pieces[3]."<br>------<br>";
 }
 */
 $i = 0;
 // number of rows
 while (($line = fgets($fp)) != false) {
     // check if there are enough values
     $pieces = explode(",", $line);
     if (count($pieces) != 3) {
         echo "Not enough data<br>";
         continue;
     }
     // generate an unique scalar_id
     $scalar_id = generateId($conn, "scalar_data");
     if ($scalar_id == 0) {
         // Unable to generate more unique id, return
         return;
     }
     // sensor_id
     $sensor_id = intval($pieces[0]);
     if (checkSensorId($conn, $sensor_id) != 0) {
         continue;
     }
     // date
     $date = $pieces[1];
     // value
     $value = intval($pieces[2]);
     $sql = "INSERT INTO scalar_data VALUES (" . $scalar_id . ", " . $sensor_id . ", TO_DATE('" . $date . "', 'DD/MM/YYYY hh24:mi:ss'), " . $value . ")";
     $stid = oci_parse($conn, $sql);
开发者ID:ayunita,项目名称:OOSproject,代码行数:31,代码来源:datacurator.php


示例20: formItemValidation

<?php

if (@$_POST['submit']) {
    //collecting userinfo
    $pName = formItemValidation($_POST['pName']);
    $pBarCode = formItemValidation($_POST['pBarCode']);
    $pBuyingPrice = formItemValidation($_POST['pBuyingPrice']);
    $pSellingPrice = formItemValidation($_POST['pSellingPrice']);
    $pQuantity = formItemValidation($_POST['pQuantity']);
    $cId = $_POST['cId'];
    //current time now
    $nowTime = date("Y-m-d H:i:s&quo 

鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP generateKey函数代码示例发布时间:2022-05-15
下一篇:
PHP generateHeader函数代码示例发布时间: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