function cate_import($post, $xmlFileName)
 {
     if (isset($_POST['catesubmit'])) {
         include_once "lib/config.php";
         $xml = processXML($xmlFileName);
         //post variables
         if (empty($_POST["tplTagger"])) {
             $tplTagger = false;
         } else {
             $tplTagger = $_POST["tplTagger"];
         }
         //get categories
         $cateData = array();
         foreach ($xml->channel as $post) {
             foreach ($post->children('wp', true)->category as $c) {
                 $cn = parseContent((string) $c->cat_name);
                 $al = $c->category_nicename;
                 if ($cn) {
                     $insert = "INSERT INTO `modx_categories` (`category`) VALUES ('" . $cn . "')";
                     $result = $mysqli->query($insert);
                     $cateData[] = $cn;
                     if ($tplTagger) {
                         $cateInsert = "INSERT INTO `modx_tagger_groups` (`id`,`name`,`alias`,`field_type`,`allow_blank`,`show_for_templates`,`place`) VALUES ('1','Category','category','tagger-combo-tag','1','1,2,3,4,5','in-tab')";
                         $tagInsert = "INSERT INTO `modx_tagger_tags` (`tag`,`alias`,`group`) VALUES ('" . $cn . "','" . $al . "','1')";
                         $cresult = $mysqli->query($cateInsert);
                         $tresult = $mysqli->query($tagInsert);
                     }
                 }
             }
         }
         return '<p>Categories Imported - ' . count($cateData) . '</p>';
     }
 }
 function upload_file($post)
 {
     if (isset($_POST['xmlreviewsubmit'])) {
         setcookie("WPTranspoFile", $_POST["xml-file"], time() + 3600);
         // global naming event
         $xml = processXML($_POST["xml-file"]);
         //get posts
         $postsData = array();
         foreach ($xml->channel->item as $post) {
             //if its not a post, break
             $type = $post->children('wp', true)->post_type;
             if ($type == "post") {
                 $p = parseContent((string) $post->title);
                 //echo $p."<br>";
                 if ($p) {
                     $postsData[] = $p;
                 }
             }
         }
         //get pages
         $pageData = array();
         foreach ($xml->channel->item as $post) {
             //if its not a post, break
             $type = $post->children('wp', true)->post_type;
             if ($type == "page") {
                 $p = parseContent((string) $post->title);
                 //echo $p."<br>";
                 if ($p) {
                     $pageData[] = $p;
                 }
             }
         }
         /*get categories
                     $cateData = array();
                     foreach ($xml->channel as $post) {
         
                         foreach ($post->children('wp',true)->category as $c){
                             $cn = parseContent((string)$c->cat_name);
                             if ( $cn ) { $cateData[] = $cn;}
                         }
         
         
                     }
                     */
         $tnData = array();
         foreach ($xml->channel->item as $post) {
             //file name
             $thumbnail = parseContent((string) $post->image);
             if ($thumbnail) {
                 $tnData[] = $thumbnail;
             }
         }
         //return var_dump($tnData);
         return '<p><strong>Posts:</strong> ' . count($postsData) . ' | <strong>Images:</strong> ' . count($tnData) . ' | <strong>Pages:</strong> ' . count($pageData) . '</p>';
     }
 }
Exemple #3
0
function launchscanner($net)
{
    $tmp_file = "/tmp/" . md5(date('Y-m-d h:I:s' . __FILE__));
    $cmd = "/usr/bin/nmap -O {$net} -oN {$tmp_file} --system-dns -p1";
    compevents("Execute network scanning on {$net}...");
    compevents("{$cmd}");
    compevents("Create temporaty file {$tmp_file}");
    exec($cmd, $arr);
    compevents("Parsing " . basename($tmp_file));
    parseContent($tmp_file);
}
function launchscanner($net)
{
    $unix = new unix();
    $tmp_file = "/tmp/" . md5(date('Y-m-d h:I:s' . __FILE__));
    $cmd = $unix->NMAP_CMDLINE($net, $tmp_file);
    compevents("Execute network scanning on {$net}...");
    compevents("{$cmd}");
    compevents("Create temporaty file {$tmp_file}");
    exec($cmd, $arr);
    compevents("Parsing " . basename($tmp_file));
    parseContent($tmp_file);
}
Exemple #5
0
    $keyw = $row["keyword"];
    $cont = $row["content"];
    $foo = "Change";
}
if (isset($_POST['submit'])) {
    $reporter = $_POST['username'];
    $subject = $_POST['subject'];
    $content = $_POST['content'];
    $keyword = $_POST['keyword'];
    $session_id = session_id();
    // replace < and > in reporter and subject
    $reporter = eliminateHtml($reporter);
    $subject = eliminateHtml($subject);
    $keyword = eliminateHtml($keyword);
    // parse content part
    $content = parseContent($content);
    // check if privileges are correct
    if (isset($_COOKIE['login'])) {
        $priv = $_COOKIE['login'];
    } else {
        $priv = "0";
    }
    if (isset($_COOKIE["PHPSESSID"])) {
        $sessionid = $_COOKIE["PHPSESSID"];
    } else {
        $sessionid = "0";
    }
    $sqlcheck = "SELECT priv FROM authorize WHERE session_id ='{$sessionid}' AND priv = '{$priv}'";
    $resultcheck = $conn->query($sqlcheck);
    $rowcheck = $resultcheck->fetch_assoc();
    if ($change == false) {
 function res_import($post, $xmlFileName)
 {
     if (isset($_POST['ressubmit'])) {
         include_once "lib/config.php";
         $xml = processXML($xmlFileName);
         $pageData = array();
         $pageDataErrors = array();
         $postsData = array();
         $postsDataErrors = array();
         //post variables
         if (empty($_POST["tplMatch"])) {
             $tplMatch = false;
         } else {
             $tplMatch = $_POST["tplMatch"];
         }
         if (empty($_POST["tplPublish"])) {
             $tplPublish = false;
         } else {
             $tplPublish = $_POST["tplPublish"];
         }
         if (empty($_POST["tplParent"])) {
             $tplParent = false;
         } else {
             $tplParent = $_POST["tplParent"];
         }
         if (empty($_POST["tplPageParent"])) {
             $tplPageParent = false;
         } else {
             $tplPageParent = $_POST["tplPageParent"];
         }
         if (empty($_POST["taggerCate"])) {
             $taggerCate = false;
         } else {
             $taggerCate = $_POST["taggerCate"];
         }
         //get posts
         foreach ($xml->channel->item as $post) {
             //if its not a post, break
             $type = $post->children('wp', true)->post_type;
             $wp = $post->children('wp', true);
             $id = $post->children('wp', true)->post_id;
             $pt = $mysqli->real_escape_string(parseContent((string) $post->title));
             $it = $mysqli->real_escape_string(parseContent((string) $post->children('excerpt', true)->encoded));
             $raw_content = $mysqli->real_escape_string(parseContent((string) $post->children('content', true)->encoded));
             //print_r($raw_content); //debug your conent
             $content = '<p>' . str_replace('\\n\\n', "</p><p>", $raw_content) . "</p>";
             // make paragraphs, including one at the end;
             //print_r($content);//debug your conent
             //exit();//debug your conent
             $alias = $mysqli->real_escape_string(parseContent((string) $post->children('wp', true)->post_name));
             $menuIndex = $post->children('wp', true)->menu_order;
             $template = "";
             $publish = "0";
             $pub_date = strtotime((string) $post->pubDate);
             if (empty($pub_date)) {
                 $pub_date = strtotime((string) $wp->post_date);
             }
             //set tagger categories
             $tagId = "";
             if ($taggerCate) {
                 //loop through <category domain="category" nicename="functional-spirits"><![CDATA[Functional Spirits]]></category>
                 foreach ($post->category as $c) {
                     if ($c["domain"] == "category") {
                         $categoryTemp = $c["nicename"];
                     }
                 }
                 //check for tag
                 $tag_query = "SELECT * FROM modx_tagger_tags";
                 if ($tag_result = $mysqli->query($tag_query)) {
                     while ($row = $tag_result->fetch_array()) {
                         //if name matches set it
                         if ($row["alias"] == $categoryTemp) {
                             $tagId = $row["id"];
                         }
                     }
                 }
             }
             //if Respect Publish setting
             if ($tplPublish) {
                 //if its set to publish
                 if ($post->children('wp', true)->status == "publish") {
                     $publish = "1";
                 } else {
                     $publish = "0";
                 }
             }
             //loop through Item postmeta values
             foreach ($post->children('wp', true)->postmeta as $wpm) {
                 //if template matching set
                 if ($tplMatch) {
                     //if its a template Meta Item
                     //<wp:meta_key>_wp_page_template</wp:meta_key>
                     if ($wpm->meta_key == "_wp_page_template") {
                         //<wp:meta_value><![CDATA[default]]></wp:meta_value>
                         $wp_temp = parseContent((string) $wpm->meta_value);
                         //check for automatic match
                         $tpl_query = "SELECT * FROM modx_site_templates";
                         if ($tpl_result = $mysqli->query($tpl_query)) {
                             while ($row = $tpl_result->fetch_array()) {
                                 //if name matches set it
                                 if ($row["templatename"] == $wp_temp) {
                                     $template = $row["id"];
                                 }
                             }
                         }
                     }
                 }
             }
             //eof PostMeta Loop
             //if template was not set above
             if (empty($template)) {
                 $template = $_POST["tplDefault"];
             }
             //Start Post Type Custom options
             if ($type == "post") {
                 //if Global Parent Set
                 if (empty($tplParent)) {
                     $parent = $post->children('wp', true)->post_parent;
                 } else {
                     $parent = $tplParent;
                 }
                 //Insert to DB
                 $insert = "INSERT INTO `modx_site_content` (`id`,`pagetitle`,`introtext`,`content`,`parent`,`template`,`alias`,`menuindex`,`publishedon`,`published`) VALUES ('" . $id . "','" . $pt . "','" . $it . "','" . $content . "','" . $parent . "','" . $template . "','" . $alias . "','" . $menuIndex . "','" . $pub_date . "','" . $publish . "')";
                 $result = $mysqli->query($insert);
                 if ($result) {
                     $postsData[] = $pt;
                     //we are inside matching ID success so we can add Tag now
                     $tagInsert = "INSERT INTO `modx_tagger_tag_resources` (`tag`,`resource`) VALUES ('" . $tagId . "','" . $id . "')";
                     $tresult = $mysqli->query($tagInsert);
                 } else {
                     //try again with no ID, it might have been taken by preset
                     $reinsert = "INSERT INTO `modx_site_content` (`pagetitle`,`introtext`,`content`,`parent`,`template`,`alias`,`menuindex,`publishedon`,`published`) VALUES ('" . $pt . "','" . $it . "','" . $content . "','" . $parent . "','" . $template . "','" . $alias . "','" . $menuIndex . "','" . $pub_date . "','" . $publish . "')";
                     $result_two = $mysqli->query($reinsert);
                     $postsDataErrors[] = $pt;
                 }
             }
             //get pages
             //if its not a page, break
             if ($type == "page") {
                 //if Global Parent && Separate Page is NOT checked
                 if ($tplParent && empty($tplPageParent)) {
                     $parent = $tplParent;
                 } else {
                     $parent = $post->children('wp', true)->post_parent;
                 }
                 //Insert to DB
                 $insert = " INSERT INTO `modx_site_content` (`id`,`pagetitle`,`introtext`,`content`,`parent`,`template`,`alias`,`menuindex`,`publishedon`,`published`) VALUES ('" . $id . "','" . $pt . "','" . $it . "','" . $content . "','" . $parent . "','" . $template . "','" . $alias . "','" . $menuIndex . "','" . $pub_date . "','" . $publish . "')";
                 $result = $mysqli->query($insert);
                 if ($result) {
                     $pageData[] = $pt;
                 } else {
                     //try again with no ID, it might have been taken by preset
                     $reinsert = "INSERT INTO `modx_site_content` (`pagetitle`,`introtext`,`content`,`parent`,`template`,`alias`,`menuindex`,`publishedon`,`published`) VALUES ('" . $pt . "','" . $it . "','" . $content . "','" . $parent . "','" . $template . "','" . $alias . "','" . $menuIndex . "','" . $pub_date . "','" . $publish . "')";
                     $result_two = $mysqli->query($reinsert);
                     $pageDataErrors[] = $pt;
                     if (!$result_two) {
                         printf("%s\n", $mysqli->error);
                     }
                 }
             }
         }
         //for each item
         return '<p><strong>Imported With No Errors:</strong> Posts: ' . count($postsData) . ' | Pages: ' . count($pageData) . '</p><p><strong>Errors:</strong> Posts: ' . count($postsDataErrors) . ' | Pages: ' . count($pageDataErrors) . '</p>';
     }
 }
Exemple #7
0
function parseContent($txtCnt, $aData)
{
    $regIncBlock = '/<!-- include beginning src="((?:\\.{0,2}\\/)*(?:[\\w\\d]+\\/)*[\\w\\d]+\\.html)" *(?:condition="([^\\"]+)")? *(?:variable="([^\\"]+)")? *(?:repeats="([^\\"]+)")? *-->([\\s\\S]*?)<!-- include ending src="\\1" -->/i';
    preg_match_all($regIncBlock, $txtCnt, $aIncs);
    for ($cntIncs = 0; $cntIncs < count($aIncs[0]); $cntIncs++) {
        $sInclude = $aIncs[0][$cntIncs];
        $sSrcRel = $aIncs[1][$cntIncs];
        $sCondition = $aIncs[2][$cntIncs];
        $sVariable = $aIncs[3][$cntIncs];
        $sRepeats = $aIncs[4][$cntIncs];
        $sContent = $aIncs[5][$cntIncs];
        if ($sCondition !== '') {
            $bool = eval("return {$sCondition};");
            if (!$bool) {
                $txtCnt = str_replace($sInclude, '', $txtCnt);
                continue;
            }
        }
        if ($sVariable === '') {
            $aVariable = $aData;
        } else {
            $aVariable = eval("return {$sVariable};");
            if (!isset($aVariable)) {
                echo "{$sVariable} doesn't exist!!!";
                continue;
            }
        }
        if ($sRepeats === "") {
            $sContent = parseContent($sContent, $aVariable);
        } else {
            $piRepeat = eval("return {$sRepeats};");
            $piLength = count($aVariable);
            $aContents = [];
            if ($piRepeat === -1) {
                $maxRepeat = $piLength;
            } else {
                $maxRepeat = min($piRepeat, $piLength);
            }
            for ($cntRepeat = 0; $cntRepeat < $maxRepeat; $cntRepeat++) {
                $aVar =& $aVariable[$cntRepeat];
                $aVar['index'] = $cntRepeat;
                $aVar['of'] = $piLength;
                $aContents[] = parseContent($sContent, $aVar);
            }
            $sContent = implode('', $aContents);
        }
        $txtCnt = str_replace($sInclude, $sContent, $txtCnt);
    }
    $regModels = '/[^\\{](\\{\\$(\\w[\\w\\d]+)\\})[^\\}]/i';
    preg_match_all($regModels, $txtCnt, $aModels);
    for ($cntModels = 0; $cntModels < count($aModels[0]); $cntModels++) {
        $sModel = $aModels[1][$cntModels];
        $sKey = $aModels[2][$cntModels];
        $value = isset($aData[$sKey]) ? $aData[$sKey] : "NO <var>{$sKey}</var>";
        $txtCnt = str_replace($sModel, $value, $txtCnt);
    }
    return $txtCnt;
}
function main($subDir, $class, $cookieURL, $indexURL, $totalClass, $curClass, $code)
{
    $isSleep = true;
    makeDir("./html/{$subDir}/{$class}/");
    $dataFileName = "data/{$subDir}/{$class}.log";
    $httpClient = new HttpClient("epub.cnki.net");
    $content = "";
    $indexFname = "./html/{$subDir}/{$class}/index.html";
    $tf = iconv("utf-8", "gb2312", $indexFname);
    $cookies = "";
    if (file_exists($tf)) {
        $isSleep = false;
        $content = file_get_contents($tf);
        echo "From cache get index.....\n";
    } else {
        /*获取并设置cookie*/
        $httpClient->get($cookieURL);
        $cookies = $httpClient->getCookies();
        $httpClient->setCookies($cookies);
        if (!$cookies) {
            die("cookie error");
        }
        $isSleep = true;
        $httpClient->get($indexURL);
        $content = $httpClient->getContent();
        save($indexFname, $content);
        //保存
        echo "save index file...\n";
    }
    /* 解析出一共有多少页面 */
    $pageCount = parsePageCount($content);
    echo "Page is {$pageCount} ****\n";
    $articleCount = ARTICLE_PRE_PAGE * $pageCount;
    //计算一共有多少篇文章,大于等于实际文章数目,不影响结果
    echo "total article is {$articleCount}\n";
    $pageCount = $articleCount / ARTICLE_PRE_PAGE;
    $pageCount = ceil($pageCount);
    //向上取整,不放过任何数据
    if ($pageCount == 0) {
        $pageCount = 1;
    }
    if ($pageCount > 50) {
        echo "page count is big than 50\n";
    }
    echo "total page of {$class} is : {$pageCount}...............{$curClass} of {$totalClass}\n";
    if ($isSleep) {
        fakeSleep();
    }
    /* 抓取每一个页面并且保存下来,保存的同时进行解析 */
    for ($i = 1; $i <= $pageCount; $i++) {
        $content = NULL;
        $pageI = getPageI($indexURL, $i);
        //第i页的地址
        $htmlI = "./html/{$subDir}/{$class}/{$i}.html";
        if (!file_exists(iconv("utf-8", "gb2312", $htmlI))) {
            $isSleep = true;
            $httpClient->setCookies($cookies);
            $httpClient->get($pageI);
            $content = $httpClient->getContent();
            save($htmlI, $content);
            echo "From newwork & save {$i}.html..........[{$i} of {$pageCount}]\n";
        } else {
            $tmpf2 = iconv("utf-8", "gb2312", $htmlI);
            $content = file_get_contents($tmpf2);
            $ok = validatePageContent($content);
            //是否出现了验证码
            if (!$ok) {
                $i = $i - 1;
                delFile($htmlI);
            } else {
                $isSleep = false;
                echo "Find local file {$htmlI} & skip\n";
            }
            //continue;
        }
        $logName = "./data/{$subDir}/{$class}.log";
        if (!validatePageContent($content)) {
            $i = $i - 1;
            delFile($htmlI);
            dosleep(60);
            $httpClient = new HttpClient("epub.cnki.net");
            $httpClient->get($cookieURL);
            $cookies = $httpClient->getCookies();
            $httpClient->setCookies($cookies);
            continue;
        }
        parseContent($content, $logName, $code);
        if ($i != $pageCount && $isSleep) {
            fakeSleep();
        } else {
            echo "+\n";
            echo "+\n";
            echo "+ {$class} done\n";
            echo "+\n";
            echo "+\n";
        }
    }
}
Exemple #9
0
/**
 * metaWeblog.editPost
 *
 * @access  public
 * @param   array   $params     array of params
 * @return  XML_RPC_Response object
 */
function metaWeblog_editPost($params)
{
    $post_id = getScalarValue($params, 0);
    $user = getScalarValue($params, 1);
    $password = getScalarValue($params, 2);
    $userInfo = userAuthentication($user, $password);
    if (Jaws_Error::IsError($userInfo)) {
        return new XML_RPC_Response(0, $GLOBALS['XML_RPC_erruser'] + 4, _t('GLOBAL_ERROR_LOGIN_WRONG'));
    }
    if (!GetBlogPermission($user, 'AddEntries')) {
        return new XML_RPC_Response(0, $GLOBALS['XML_RPC_erruser'] + 3, _t('GLOBAL_ERROR_NO_PRIVILEGES'));
    }
    $struct = XML_RPC_decode($params->getParam(3));
    $cats = $struct['categories'];
    $catsModel = Jaws_Gadget::getInstance('Blog')->model->load('Categories');
    if (Jaws_Error::isError($catsModel)) {
        return new XML_RPC_Response(0, $GLOBALS['XML_RPC_erruser'] + 2, $catsModel->GetMessage());
    }
    $categories = array();
    foreach ($cats as $cat) {
        $catInfo = $catsModel->GetCategoryByName($cat);
        if (Jaws_Error::IsError($catInfo)) {
            return new XML_RPC_Response(0, $GLOBALS['XML_RPC_erruser'] + 2, $catInfo->GetMessage());
        }
        if (isset($catInfo['id'])) {
            $categories[] = $catInfo['id'];
        }
    }
    $title = $struct['title'];
    if (!isset($struct['mt_text_more'])) {
        if (false !== ($more_pos = Jaws_UTF8::strpos($struct['description'], '<!--more-->'))) {
            $summary = Jaws_UTF8::substr($struct['description'], 0, $more_pos);
            $content = Jaws_UTF8::substr($struct['description'], $more_pos + 11);
        } else {
            $summary = $struct['description'];
            $content = '';
        }
    } else {
        $summary = $struct['description'];
        $content = $struct['mt_text_more'];
    }
    $summary = parseContent($summary);
    $content = parseContent($content);
    // allow comments
    if (isset($struct['mt_allow_comments'])) {
        $allow_c = (bool) $struct['mt_allow_comments'];
    } else {
        $allow_c = (bool) $GLOBALS['app']->Registry->fetch('allow_comments');
    }
    // published
    $publish = getScalarValue($params, 4);
    // tags
    $tags = isset($struct['mt_keywords']) ? $struct['mt_keywords'] : '';
    // publish time
    $timestamp = null;
    if (isset($struct['date_created_gmt'])) {
        $date = date_parse_from_format('Ymd\\TH:i:s', $struct['date_created_gmt']);
        $date = mktime($date['hour'], $date['minute'], $date['second'], $date['month'], $date['day'], $date['year']);
        $timestamp = date('Y-m-d H:i:s', $date);
    }
    // trackbacks
    $trackbacks = '';
    if (isset($struct['mt_tb_ping_urls'])) {
        $trackbacks = implode("\n", $struct['mt_tb_ping_urls']);
    }
    $postModel = Jaws_Gadget::getInstance('Blog')->model->loadAdmin('Posts');
    $blog_result = $postModel->UpdateEntry($post_id, $categories, $title, $summary, $content, null, '', '', '', $tags, $allow_c, $trackbacks, $publish, $timestamp);
    if (Jaws_Error::IsError($blog_result)) {
        return new XML_RPC_Response(0, $GLOBALS['XML_RPC_erruser'] + 2, $blog_result->GetMessage());
    }
    return new XML_RPC_Response(new XML_RPC_Value('1', 'boolean'));
}
Exemple #10
0
$this->viewsNum();
?>
</li>
            <li><?php 
$this->commentsNum('评论%d');
?>
</li>
			<li><?php 
_e('喜欢');
$this->likesNum();
?>
</li>
        </ul>
        <div class="post-content" itemprop="articleBody">
            <?php 
parseContent($this);
?>
        </div>
		<div class="post-tool">
			<span class="post-like"><a class="btn s3 btn-like" data-cid="<?php 
$this->cid();
?>
" href="#"><i class="fa fa-thumbs-up"></i> <?php 
_e('赞');
?>
 <span class="post-likesnum"><?php 
$this->likesNum();
?>
</span></a></span>
			<span class="post-share"><a class="btn s3 btn-dialog" data-dialog="#dialog-share" href="#"><i class="fa fa-share-alt"></i> <?php 
_e('分享');
Exemple #11
0
} else {
    $sessionid = "0";
}
$sqlcheck = "SELECT priv FROM authorize WHERE session_id ='{$sessionid}' AND priv = '{$priv}'";
$resultcheck = $conn->query($sqlcheck);
$rowcheck = $resultcheck->fetch_assoc();
if ($resultcheck->num_rows > 0) {
    // priv must be greater than 2
    if ($rowcheck['priv'] > 2) {
        if ($_POST['action'] == "create") {
            $id = explode("#", $_POST['id'])[0];
            // if anchor stands behind the id
            $name = $_POST['name'];
            $text = $_POST['text'];
            $name = eliminateHtml($name);
            $text = parseContent($text);
            $sql = "INSERT into comment (entry_id, reporter, text) values ({$id}, '{$name}' , '{$text}')";
            $result = $conn->query($sql);
            $sql1 = "SELECT comment_id, created_at, reporter, text from comment where entry_id = '{$id}' ORDER BY comment_id desc LIMIT 1";
            $result1 = $conn->query($sql1);
            $response = "";
            while ($row = $result1->fetch_assoc()) {
                $response = $response . $row['comment_id'] . "#?#" . $row['reporter'] . "#?#" . $row['text'] . "#?#" . $row['created_at'];
            }
            echo $response;
        }
    } else {
        echo "<br><link href='https://fonts.googleapis.com/css?family=Montserrat' rel='stylesheet' type='text/css'>\n        <link rel='stylesheet' type='text/css' href='/css/theme.css'><div style='text-align: center' class='feedback'>Error: Comment not created - Privileges are insufficient</div>";
    }
    // priv must be greater than 7
    if ($rowcheck['priv'] > 7) {
Exemple #12
0
    $i = 0;
    $course = "";
    while ($i < sizeof($array)) {
        if ($array[$i][0] != "") {
            $course = $array[$i][0];
            insertClasses($course, $array[$i][1], $array[$i][3], $conn);
        }
        $time_start = isset($array[$i][7]) && $array[$i][7] != "" ? explode("-", $array[$i][7])[0] : "";
        $time_end = isset($array[$i][7]) && $array[$i][7] != "" ? explode("-", $array[$i][7])[1] : "";
        // class_id, theme, type, section, time_start, time_end, days, instructor, room
        if (isset($array[$i][4])) {
            if ($array[$i][0] != "") {
                insertSection($course, "", $array[$i][4], $array[$i][5], $time_start, $time_end, $array[$i][8], $array[$i][12], $array[$i][13], $conn);
            } else {
                insertSection($course, $array[$i][1], $array[$i][4], $array[$i][5], $time_start, $time_end, $array[$i][8], $array[$i][12], $array[$i][13], $conn);
            }
        }
        $i++;
    }
}
for ($n = 0; $n < sizeof($subject); $n++) {
    parseContent($subject[$n], $subject, $conn);
}
$conn->close();
?>

<form action="cena.php" method="post">
<input type="hidden" name="con" value="something">
<input type="submit" value="POPULATE SQL">
</form>
Exemple #13
0
$count = ceil($linkArray[3][1] / 50);
$actualCount = $linkArray[3][1];
$done = FALSE;
$paramFirst = $linkArray['link'] . '?' . $linkArray[1][0] . '=';
$paramSecond = '&' . $linkArray[2][0] . '=50&' . $linkArray[3][0] . '=';
for ($i = 1; $i <= $count; $i++) {
    $curl->get(BODYBUILDING . $paramFirst . $i . $paramSecond . $count);
    $dom->loadHTML($curl->response);
    $tempSelector = new DOMXPath($dom);
    $articleTag = $tempSelector->query('/html/body//article');
    foreach ($articleTag as $ar) {
        if ($recordCount > $actualCount) {
            $done = TRUE;
            break;
        }
        $details = parseContent($dom->saveXML($ar), PRODUCTDETIALCLASS);
        $result = parseWhey($details);
        echo $result ? '' : 'Failure<br/>';
        $recordCount++;
        unset($details);
    }
    if ($done) {
        break;
    }
}
$curl->close();
$time_end = microtime(true);
$execution_time = $time_end - $time_start;
echo '<b>Total Execution Time:</b> ' . $execution_time . ' seconds<br/>';
echo 'Record count: ' . $recordCount;
function parseContent($html, $tag)