Esempio n. 1
0
</a></td>
	 </tr>
	 <tr>
	  <td class="ubox" colspan="2" align="center"><input type="submit" value="<?php 
    echo $lang->phrase('admin_packages_button_save');
    ?>
" /></td>
	 </tr>
	</table>
	</form>
	<?php 
    echo foot();
} elseif ($job == 'plugins_add2') {
    echo head();
    $hook = $gpc->get('hook', str);
    $isInvisibleHook = isInvisibleHook($hook);
    $packageid = $id = $gpc->get('package', int);
    $title = $gpc->get('title', str);
    $result = $db->query("SELECT id, title FROM {$db->pre}packages WHERE id = '{$packageid}' LIMIT 1", __LINE__, __FILE__);
    if ($db->num_rows($result) != 1) {
        echo head();
        error('admin.php?action=packages&job=plugins_add', $lang->phrase('admin_packages_err_specified_package_foo_does_not_exist'));
    }
    $package = $db->fetch_assoc($result);
    if (strlen($title) < 4) {
        error('admin.php?action=packages&job=plugins_add&id=' . $package['id'], $lang->phrase('admin_packages_err_minimum_number_of_characters_for_title'));
    } elseif (strlen($title) > 200) {
        error('admin.php?action=packages&job=plugins_add&id=' . $package['id'], $lang->phrase('admin_packages_err_maximum_number_of_characters_for_title'));
    }
    if (!$isInvisibleHook) {
        $hookPriority = $db->query("SELECT id, name, ordering FROM {$db->pre}plugins WHERE position = '{$hook}' ORDER BY ordering", __LINE__, __FILE__);
Esempio n. 2
0
         rmdirr($temptpldir);
     }
     copyr($tempdir, $dir);
     if (isset($ini['language']) && count($ini['language']) > 0) {
         $result = $db->query("SELECT id FROM {$db->pre}language", __LINE__, __FILE__);
         while ($row = $db->fetch_assoc($result)) {
             $c->getdata("language/{$row['id']}/modules.lng.php", 'lang');
             foreach ($ini['language'] as $varname => $text) {
                 $c->updateconfig($varname, str, $text);
             }
             $c->savedata();
         }
     }
     if (isset($ini['php']) && count($ini['php']) > 0) {
         foreach ($ini['php'] as $hook => $plugfile) {
             if (isInvisibleHook($hook)) {
                 continue;
             }
             $result = $db->query("SELECT MAX(ordering) AS maximum FROM {$db->pre}plugins WHERE position = '{$hook}'", __LINE__, __FILE__);
             $row = $db->fetch_assoc($result);
             $priority = $row['maximum'] + 1;
             $db->query("\n\t\t\t\tINSERT INTO {$db->pre}plugins \n\t\t\t\t(`name`,`module`,`ordering`,`active`,`position`) \n\t\t\t\tVALUES \n\t\t\t\t('{$ini['info']['title']}','{$packageid}','{$priority}','0','{$hook}')\n\t\t\t\t", __LINE__, __FILE__);
             $filesystem->unlink('cache/modules/' . $plugins->_group($hook) . '.php');
         }
     }
     $confirm = true;
     $pluginid = $packageid;
     ($code = $plugins->install($packageid)) ? eval($code) : null;
     rmdirr($tempdir);
 }
 unset($archive);